Skip to content

Commit e89ca9e

Browse files
authored
fix(tabset): fixed tabset active input (#6768)
* fix(tabset): fixed tabset active input * fix(tabset): updated tests * 20.0.1 * chore(version-bump): updated to v20.0.1
1 parent 39d6967 commit e89ca9e

File tree

34 files changed

+91
-43
lines changed

34 files changed

+91
-43
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "20.0.0"
2+
"version": "20.0.1"
33
}

libs/common-docs/src/lib/docs-section/docs-section.component.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ContentSection } from '../models/content-section.model';
22
import { ChangeDetectorRef, Component, Injector, Input } from '@angular/core';
3-
import { Router, NavigationExtras } from '@angular/router';
3+
import { ActivatedRoute, Router, NavigationExtras } from '@angular/router';
44

55
const availableTabsPaths = ['overview', 'api', 'examples'] as const;
66
type AvailableTabsPathsType = typeof availableTabsPaths[number];
@@ -36,9 +36,28 @@ export class DocsSectionComponent {
3636

3737
constructor(
3838
private injector: Injector,
39+
private activatedRoute: ActivatedRoute,
3940
private router: Router,
4041
private changeDetection: ChangeDetectorRef
4142
) {
43+
this.activatedRoute.queryParamMap.subscribe((params) => {
44+
this.initActiveTab(params.get('tab')?.toString());
45+
});
46+
}
47+
48+
initActiveTab(activeTab?: string) {
49+
this.resetTabs();
50+
if (!activeTab || !this.checkActiveTab(activeTab)) {
51+
this.overview = true;
52+
this.onSelect('overview');
53+
return;
54+
}
55+
56+
this[activeTab as AvailableTabsPathsType] = true;
57+
}
58+
59+
checkActiveTab(activeTab: string): boolean {
60+
return activeTab === 'overview' || activeTab === 'api' || activeTab === 'examples';
4261
}
4362

4463
onSelect(tabName: string) {

libs/doc-pages/tabs/src/lib/demos/dynamic/dynamic.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ interface ITab {
1919
export class DemoTabsDynamicComponent {
2020
tabs: ITab[] = [
2121
{ title: 'Dynamic Title 1', content: 'Dynamic content 1', removable: false, disabled: false},
22-
{ title: 'Dynamic Title 2', content: 'Dynamic content 2', removable: false, disabled: false},
22+
{ title: 'Dynamic Title 2', content: 'Dynamic content 2', removable: false, disabled: false, active: true},
2323
{ title: 'Dynamic Title 3', content: 'Dynamic content 3', removable: true, disabled: false}
2424
];
2525

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-bootstrap-base",
3-
"version": "20.0.0",
3+
"version": "20.0.1",
44
"license": "MIT",
55
"author": "Dmitriy Shekhovtsov <[email protected]>",
66
"schematics": "./schematics/src/collection.json",

src/accordion/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-bootstrap/accordion",
3-
"version": "20.0.0",
3+
"version": "20.0.1",
44
"author": "Dmitriy Shekhovtsov <[email protected]>",
55
"license": "MIT"
66
}

src/alert/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-bootstrap/alert",
3-
"version": "20.0.0",
3+
"version": "20.0.1",
44
"author": "Dmitriy Shekhovtsov <[email protected]>",
55
"license": "MIT"
66
}

src/buttons/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-bootstrap/buttons",
3-
"version": "20.0.0",
3+
"version": "20.0.1",
44
"author": "Dmitriy Shekhovtsov <[email protected]>",
55
"license": "MIT"
66
}

src/carousel/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-bootstrap/carousel",
3-
"version": "20.0.0",
3+
"version": "20.0.1",
44
"author": "Dmitriy Shekhovtsov <[email protected]>",
55
"license": "MIT"
66
}

src/chronos/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-bootstrap/chronos",
3-
"version": "20.0.0",
3+
"version": "20.0.1",
44
"author": "Dmitriy Shekhovtsov <[email protected]>",
55
"license": "MIT"
66
}

0 commit comments

Comments
 (0)