@skyux/tabs 8.6.0 → 9.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/documentation.json +92 -54
- package/esm2022/index.mjs +26 -0
- package/esm2022/lib/modules/sectioned-form/sectioned-form-section.component.mjs +65 -0
- package/esm2022/lib/modules/sectioned-form/sectioned-form.component.mjs +187 -0
- package/{esm2020 → esm2022}/lib/modules/sectioned-form/sectioned-form.module.mjs +11 -11
- package/{esm2020 → esm2022}/lib/modules/sectioned-form/sectioned-form.service.mjs +4 -4
- package/esm2022/lib/modules/shared/sky-tabs-resources.module.mjs +61 -0
- package/esm2022/lib/modules/shared/tab-id.service.mjs +50 -0
- package/{esm2020 → esm2022}/lib/modules/tabs/tab-button-adapter.service.mjs +4 -4
- package/esm2022/lib/modules/tabs/tab-button.component.mjs +162 -0
- package/{esm2020 → esm2022}/lib/modules/tabs/tab-layout-type.mjs +1 -1
- package/esm2022/lib/modules/tabs/tab.component.mjs +197 -0
- package/{esm2020 → esm2022}/lib/modules/tabs/tabs.module.mjs +21 -21
- package/esm2022/lib/modules/tabs/tabset-adapter.service.mjs +68 -0
- package/{esm2020 → esm2022}/lib/modules/tabs/tabset-nav-button-disabled.pipe.mjs +4 -4
- package/esm2022/lib/modules/tabs/tabset-nav-button.component.mjs +149 -0
- package/esm2022/lib/modules/tabs/tabset-permalink.service.mjs +128 -0
- package/esm2022/lib/modules/tabs/tabset.component.mjs +466 -0
- package/esm2022/lib/modules/tabs/tabset.service.mjs +198 -0
- package/esm2022/lib/modules/vertical-tabset/vertical-tab-media-query.service.mjs +68 -0
- package/esm2022/lib/modules/vertical-tabset/vertical-tab.component.mjs +217 -0
- package/esm2022/lib/modules/vertical-tabset/vertical-tabset-adapter.service.mjs +48 -0
- package/esm2022/lib/modules/vertical-tabset/vertical-tabset-group.component.mjs +108 -0
- package/esm2022/lib/modules/vertical-tabset/vertical-tabset.component.mjs +158 -0
- package/{esm2020 → esm2022}/lib/modules/vertical-tabset/vertical-tabset.module.mjs +21 -21
- package/esm2022/lib/modules/vertical-tabset/vertical-tabset.service.mjs +169 -0
- package/esm2022/testing/tabs/tabset-fixture.mjs +129 -0
- package/fesm2022/skyux-tabs-testing.mjs +136 -0
- package/{fesm2020 → fesm2022}/skyux-tabs-testing.mjs.map +1 -1
- package/fesm2022/skyux-tabs.mjs +2586 -0
- package/{fesm2020 → fesm2022}/skyux-tabs.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/lib/modules/sectioned-form/sectioned-form-section.component.d.ts +1 -1
- package/lib/modules/sectioned-form/sectioned-form.component.d.ts +1 -1
- package/lib/modules/tabs/tab-button.component.d.ts +1 -1
- package/lib/modules/tabs/tab-layout-type.d.ts +1 -1
- package/lib/modules/tabs/tab.component.d.ts +1 -1
- package/lib/modules/tabs/tabset-nav-button.component.d.ts +1 -1
- package/lib/modules/tabs/tabset.component.d.ts +1 -1
- package/lib/modules/vertical-tabset/vertical-tab.component.d.ts +1 -1
- package/lib/modules/vertical-tabset/vertical-tabset-group.component.d.ts +1 -1
- package/lib/modules/vertical-tabset/vertical-tabset.component.d.ts +1 -1
- package/package.json +21 -29
- package/esm2020/index.mjs +0 -25
- package/esm2020/lib/modules/sectioned-form/sectioned-form-section.component.mjs +0 -67
- package/esm2020/lib/modules/sectioned-form/sectioned-form.component.mjs +0 -187
- package/esm2020/lib/modules/shared/sky-tabs-resources.module.mjs +0 -61
- package/esm2020/lib/modules/shared/tab-id.service.mjs +0 -53
- package/esm2020/lib/modules/tabs/tab-button.component.mjs +0 -162
- package/esm2020/lib/modules/tabs/tab.component.mjs +0 -198
- package/esm2020/lib/modules/tabs/tabset-adapter.service.mjs +0 -68
- package/esm2020/lib/modules/tabs/tabset-nav-button.component.mjs +0 -149
- package/esm2020/lib/modules/tabs/tabset-permalink.service.mjs +0 -128
- package/esm2020/lib/modules/tabs/tabset.component.mjs +0 -429
- package/esm2020/lib/modules/tabs/tabset.service.mjs +0 -196
- package/esm2020/lib/modules/vertical-tabset/vertical-tab-media-query.service.mjs +0 -71
- package/esm2020/lib/modules/vertical-tabset/vertical-tab.component.mjs +0 -216
- package/esm2020/lib/modules/vertical-tabset/vertical-tabset-adapter.service.mjs +0 -51
- package/esm2020/lib/modules/vertical-tabset/vertical-tabset-group.component.mjs +0 -110
- package/esm2020/lib/modules/vertical-tabset/vertical-tabset.component.mjs +0 -159
- package/esm2020/lib/modules/vertical-tabset/vertical-tabset.service.mjs +0 -167
- package/esm2020/testing/tabs/tabset-fixture.mjs +0 -128
- package/fesm2015/skyux-tabs-testing.mjs +0 -147
- package/fesm2015/skyux-tabs-testing.mjs.map +0 -1
- package/fesm2015/skyux-tabs.mjs +0 -2560
- package/fesm2015/skyux-tabs.mjs.map +0 -1
- package/fesm2020/skyux-tabs-testing.mjs +0 -135
- package/fesm2020/skyux-tabs.mjs +0 -2544
- /package/{esm2020 → esm2022}/lib/modules/sectioned-form/types/sectioned-form-message-type.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/sectioned-form/types/sectioned-form-message.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/tabs/tab-button-view-model.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/tabs/tab-index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/tabs/tabset-active-tab-unregistered-args.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/tabs/tabset-buttons-display-mode.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/tabs/tabset-nav-button-type.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/tabs/tabset-style.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/modules/tabs/tabset-tab-indexes-change.mjs +0 -0
- /package/{esm2020 → esm2022}/skyux-tabs.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/skyux-tabs-testing.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/tabs/tab-fixture-tab.mjs +0 -0
|
@@ -0,0 +1,2586 @@
|
|
|
1
|
+
import * as i4 from '@angular/common';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { NgModule, Injectable, Component, ChangeDetectionStrategy, Optional, Input, ViewChild, HostListener, ContentChildren, EventEmitter, Output, ViewEncapsulation, HostBinding, Pipe, inject } from '@angular/core';
|
|
5
|
+
import { SkyCheckboxModule } from '@skyux/forms';
|
|
6
|
+
import * as i7 from '@skyux/theme';
|
|
7
|
+
import { SkyThemeModule } from '@skyux/theme';
|
|
8
|
+
import * as i1 from '@skyux/core';
|
|
9
|
+
import { SkyMediaBreakpoints, SkyMediaQueryService, SkyIdModule, SkyLayoutHostService } from '@skyux/core';
|
|
10
|
+
import * as i6 from '@skyux/indicators';
|
|
11
|
+
import { SkyIconModule, SkyExpansionIndicatorModule, SkyStatusIndicatorModule } from '@skyux/indicators';
|
|
12
|
+
import * as i3 from '@skyux/i18n';
|
|
13
|
+
import { getLibStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS } from '@skyux/i18n';
|
|
14
|
+
import { ReplaySubject, BehaviorSubject, Subject, combineLatest, race } from 'rxjs';
|
|
15
|
+
import { takeUntil, take, distinctUntilChanged } from 'rxjs/operators';
|
|
16
|
+
import { skyAnimationSlide } from '@skyux/animations';
|
|
17
|
+
import { trigger, transition, style, animate } from '@angular/animations';
|
|
18
|
+
import * as i1$1 from '@angular/router';
|
|
19
|
+
import { RouterModule } from '@angular/router';
|
|
20
|
+
import * as i5 from '@skyux/popovers';
|
|
21
|
+
import { SkyDropdownModule } from '@skyux/popovers';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* NOTICE: DO NOT MODIFY THIS FILE!
|
|
25
|
+
* The contents of this file were automatically generated by
|
|
26
|
+
* the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-tabs' schematic.
|
|
27
|
+
* To update this file, simply rerun the command.
|
|
28
|
+
*/
|
|
29
|
+
const RESOURCES = {
|
|
30
|
+
'EN-US': {
|
|
31
|
+
skyux_tab_add: { message: 'Add tab' },
|
|
32
|
+
skyux_tab_close: { message: 'Close {0} tab' },
|
|
33
|
+
skyux_tabs_navigator_finish: { message: 'Finish' },
|
|
34
|
+
skyux_tabs_navigator_next: { message: 'Next' },
|
|
35
|
+
skyux_tabs_navigator_previous: { message: 'Previous' },
|
|
36
|
+
skyux_tab_open: { message: 'Open tab' },
|
|
37
|
+
skyux_tabs_sr_tab_order: { message: 'Tab {0} of {1}: {2}' },
|
|
38
|
+
skyux_vertical_tabs_show_tabs_text: { message: 'Tab list' },
|
|
39
|
+
skyux_wizard_sr_step_current: { message: 'Step {0} of {1}, current: {2}' },
|
|
40
|
+
skyux_wizard_sr_step_completed: {
|
|
41
|
+
message: 'Step {0} of {1}, completed: {2}',
|
|
42
|
+
},
|
|
43
|
+
skyux_wizard_sr_step_unavailable: {
|
|
44
|
+
message: 'Step {0} of {1}, unavailable: {2}',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
class SkyTabsResourcesProvider {
|
|
49
|
+
getString(localeInfo, name) {
|
|
50
|
+
return getLibStringForLocale(RESOURCES, localeInfo.locale, name);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Import into any component library module that needs to use resource strings.
|
|
55
|
+
*/
|
|
56
|
+
class SkyTabsResourcesModule {
|
|
57
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabsResourcesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
58
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SkyTabsResourcesModule, exports: [SkyI18nModule] }); }
|
|
59
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabsResourcesModule, providers: [
|
|
60
|
+
{
|
|
61
|
+
provide: SKY_LIB_RESOURCES_PROVIDERS,
|
|
62
|
+
useClass: SkyTabsResourcesProvider,
|
|
63
|
+
multi: true,
|
|
64
|
+
},
|
|
65
|
+
], imports: [SkyI18nModule] }); }
|
|
66
|
+
}
|
|
67
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabsResourcesModule, decorators: [{
|
|
68
|
+
type: NgModule,
|
|
69
|
+
args: [{
|
|
70
|
+
exports: [SkyI18nModule],
|
|
71
|
+
providers: [
|
|
72
|
+
{
|
|
73
|
+
provide: SKY_LIB_RESOURCES_PROVIDERS,
|
|
74
|
+
useClass: SkyTabsResourcesProvider,
|
|
75
|
+
multi: true,
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
}]
|
|
79
|
+
}] });
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
class SkyVerticalTabMediaQueryService {
|
|
85
|
+
#currentSubject;
|
|
86
|
+
constructor() {
|
|
87
|
+
this.#currentSubject = new ReplaySubject(1);
|
|
88
|
+
}
|
|
89
|
+
subscribe(listener) {
|
|
90
|
+
return this.#currentSubject.subscribe({
|
|
91
|
+
next: (breakpoints) => {
|
|
92
|
+
listener(breakpoints);
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
setBreakpointForWidth(width) {
|
|
97
|
+
let breakpoint;
|
|
98
|
+
if (this.isWidthWithinBreakpoint(width, SkyMediaBreakpoints.xs)) {
|
|
99
|
+
breakpoint = SkyMediaBreakpoints.xs;
|
|
100
|
+
}
|
|
101
|
+
else if (this.isWidthWithinBreakpoint(width, SkyMediaBreakpoints.sm)) {
|
|
102
|
+
breakpoint = SkyMediaBreakpoints.sm;
|
|
103
|
+
}
|
|
104
|
+
else if (this.isWidthWithinBreakpoint(width, SkyMediaBreakpoints.md)) {
|
|
105
|
+
breakpoint = SkyMediaBreakpoints.md;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
breakpoint = SkyMediaBreakpoints.lg;
|
|
109
|
+
}
|
|
110
|
+
this.current = breakpoint;
|
|
111
|
+
this.#currentSubject.next(this.current);
|
|
112
|
+
}
|
|
113
|
+
isWidthWithinBreakpoint(width, breakpoint) {
|
|
114
|
+
const xsBreakpointMaxPixels = 767;
|
|
115
|
+
const smBreakpointMinPixels = 768;
|
|
116
|
+
const smBreakpointMaxPixels = 991;
|
|
117
|
+
const mdBreakpointMinPixels = 992;
|
|
118
|
+
const mdBreakpointMaxPixels = 1199;
|
|
119
|
+
const lgBreakpointMinPixels = 1200;
|
|
120
|
+
switch (breakpoint) {
|
|
121
|
+
case SkyMediaBreakpoints.xs: {
|
|
122
|
+
return width <= xsBreakpointMaxPixels;
|
|
123
|
+
}
|
|
124
|
+
case SkyMediaBreakpoints.sm: {
|
|
125
|
+
return width >= smBreakpointMinPixels && width <= smBreakpointMaxPixels;
|
|
126
|
+
}
|
|
127
|
+
case SkyMediaBreakpoints.md: {
|
|
128
|
+
return width >= mdBreakpointMinPixels && width <= mdBreakpointMaxPixels;
|
|
129
|
+
}
|
|
130
|
+
default: {
|
|
131
|
+
return width >= lgBreakpointMinPixels;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
destroy() {
|
|
136
|
+
this.#currentSubject.complete();
|
|
137
|
+
}
|
|
138
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyVerticalTabMediaQueryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
139
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyVerticalTabMediaQueryService }); }
|
|
140
|
+
}
|
|
141
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyVerticalTabMediaQueryService, decorators: [{
|
|
142
|
+
type: Injectable
|
|
143
|
+
}], ctorParameters: function () { return []; } });
|
|
144
|
+
|
|
145
|
+
class SkyVerticalTabsetAdapterService {
|
|
146
|
+
#renderer;
|
|
147
|
+
constructor(rendererFactory) {
|
|
148
|
+
this.#renderer = rendererFactory.createRenderer(undefined, null);
|
|
149
|
+
}
|
|
150
|
+
getWidth(elementRef) {
|
|
151
|
+
return elementRef.nativeElement.clientWidth;
|
|
152
|
+
}
|
|
153
|
+
scrollToContentTop(element) {
|
|
154
|
+
element.nativeElement.scrollTop = 0;
|
|
155
|
+
}
|
|
156
|
+
setResponsiveClass(element, breakpoint) {
|
|
157
|
+
const nativeEl = element.nativeElement;
|
|
158
|
+
this.#renderer.removeClass(nativeEl, 'sky-responsive-container-xs');
|
|
159
|
+
this.#renderer.removeClass(nativeEl, 'sky-responsive-container-sm');
|
|
160
|
+
this.#renderer.removeClass(nativeEl, 'sky-responsive-container-md');
|
|
161
|
+
this.#renderer.removeClass(nativeEl, 'sky-responsive-container-lg');
|
|
162
|
+
let newClass;
|
|
163
|
+
switch (breakpoint) {
|
|
164
|
+
case SkyMediaBreakpoints.xs: {
|
|
165
|
+
newClass = 'sky-responsive-container-xs';
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
case SkyMediaBreakpoints.sm: {
|
|
169
|
+
newClass = 'sky-responsive-container-sm';
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
case SkyMediaBreakpoints.md: {
|
|
173
|
+
newClass = 'sky-responsive-container-md';
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
default: {
|
|
177
|
+
newClass = 'sky-responsive-container-lg';
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
this.#renderer.addClass(nativeEl, newClass);
|
|
182
|
+
}
|
|
183
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyVerticalTabsetAdapterService, deps: [{ token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
184
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyVerticalTabsetAdapterService }); }
|
|
185
|
+
}
|
|
186
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyVerticalTabsetAdapterService, decorators: [{
|
|
187
|
+
type: Injectable
|
|
188
|
+
}], ctorParameters: function () { return [{ type: i0.RendererFactory2 }]; } });
|
|
189
|
+
|
|
190
|
+
const VISIBLE_STATE = 'shown';
|
|
191
|
+
const HIDDEN_STATE = 'void';
|
|
192
|
+
/**
|
|
193
|
+
* @internal
|
|
194
|
+
*/
|
|
195
|
+
class SkyVerticalTabsetService {
|
|
196
|
+
#contentAdded;
|
|
197
|
+
#tabsVisible;
|
|
198
|
+
#isMobile;
|
|
199
|
+
#mediaQueryService;
|
|
200
|
+
constructor(mediaQueryService) {
|
|
201
|
+
this.activeIndex = undefined;
|
|
202
|
+
this.hidingTabs = new BehaviorSubject(false);
|
|
203
|
+
this.indexChanged = new ReplaySubject(1);
|
|
204
|
+
this.maintainTabContent = false;
|
|
205
|
+
this.showingTabs = new BehaviorSubject(false);
|
|
206
|
+
this.switchingMobile = new Subject();
|
|
207
|
+
this.tabs = [];
|
|
208
|
+
this.tabAdded = new Subject();
|
|
209
|
+
this.tabClicked = new ReplaySubject(1);
|
|
210
|
+
this.#contentAdded = false;
|
|
211
|
+
this.#tabsVisible = false;
|
|
212
|
+
this.#isMobile = false;
|
|
213
|
+
this.#mediaQueryService = mediaQueryService;
|
|
214
|
+
this.#mediaQueryService.subscribe((breakpoint) => {
|
|
215
|
+
const nowMobile = breakpoint === SkyMediaBreakpoints.xs;
|
|
216
|
+
if (nowMobile && !this.#isMobile) {
|
|
217
|
+
// switching to mobile
|
|
218
|
+
this.switchingMobile.next(true);
|
|
219
|
+
if (!this.#tabsVisible) {
|
|
220
|
+
this.hidingTabs.next(true);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
else if (!nowMobile && this.#isMobile) {
|
|
224
|
+
// switching to widescreen
|
|
225
|
+
this.switchingMobile.next(false);
|
|
226
|
+
if (!this.#tabsVisible) {
|
|
227
|
+
this.showingTabs.next(true);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
this.#isMobile = nowMobile;
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
addTab(tab) {
|
|
234
|
+
const index = this.tabs.length;
|
|
235
|
+
tab.index = index;
|
|
236
|
+
this.tabs.push(tab);
|
|
237
|
+
if (tab.active) {
|
|
238
|
+
this.activateTab(tab);
|
|
239
|
+
}
|
|
240
|
+
this.tabAdded.next(tab);
|
|
241
|
+
}
|
|
242
|
+
destroyTab(tab) {
|
|
243
|
+
const tabIndex = this.tabs.indexOf(tab);
|
|
244
|
+
if (tabIndex === -1) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
if (this.maintainTabContent &&
|
|
248
|
+
tab.contentRendered &&
|
|
249
|
+
/* istanbul ignore next */
|
|
250
|
+
this.content?.nativeElement.contains(tab.tabContent?.nativeElement)) {
|
|
251
|
+
this.content?.nativeElement.removeChild(tab.tabContent?.nativeElement);
|
|
252
|
+
}
|
|
253
|
+
this.tabs.splice(tabIndex, 1);
|
|
254
|
+
// update tab indices
|
|
255
|
+
this.tabs.forEach((tabItem, index) => (tabItem.index = index));
|
|
256
|
+
if (tab.active) {
|
|
257
|
+
if (!this.maintainTabContent) {
|
|
258
|
+
this.#destroyContent();
|
|
259
|
+
}
|
|
260
|
+
// Try selecting the next tab first, and if there's no next tab then
|
|
261
|
+
// try selecting the previous one.
|
|
262
|
+
const newActiveTab = this.tabs[tabIndex] || this.tabs[tabIndex - 1];
|
|
263
|
+
/*istanbul ignore else */
|
|
264
|
+
if (newActiveTab) {
|
|
265
|
+
newActiveTab.activateTab();
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
activateTab(tab) {
|
|
270
|
+
// deactivate active tab
|
|
271
|
+
const activeTab = this.tabs.find((t) => t.index === this.activeIndex);
|
|
272
|
+
if (activeTab && activeTab.index !== tab.index) {
|
|
273
|
+
activeTab.active = false;
|
|
274
|
+
activeTab.tabDeactivated();
|
|
275
|
+
}
|
|
276
|
+
this.activeIndex = tab.index;
|
|
277
|
+
this.tabClicked.next(true);
|
|
278
|
+
this.#updateTabClicked();
|
|
279
|
+
}
|
|
280
|
+
activeTab() {
|
|
281
|
+
return this.tabs.find((t) => t.index === this.activeIndex);
|
|
282
|
+
}
|
|
283
|
+
isMobile() {
|
|
284
|
+
return this.#isMobile;
|
|
285
|
+
}
|
|
286
|
+
updateContent() {
|
|
287
|
+
if (!this.maintainTabContent) {
|
|
288
|
+
if (!this.#contentAdded && this.contentVisible()) {
|
|
289
|
+
// content needs to be moved
|
|
290
|
+
this.#moveContent();
|
|
291
|
+
}
|
|
292
|
+
else if (this.#contentAdded && !this.contentVisible()) {
|
|
293
|
+
// content hidden
|
|
294
|
+
this.#contentAdded = false;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
this.tabs.forEach((tab) => {
|
|
299
|
+
if (!tab.contentRendered) {
|
|
300
|
+
this.content?.nativeElement.appendChild(tab.tabContent?.nativeElement);
|
|
301
|
+
tab.contentRendered = true;
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
tabsVisible() {
|
|
307
|
+
return !this.isMobile() || this.#tabsVisible;
|
|
308
|
+
}
|
|
309
|
+
contentVisible() {
|
|
310
|
+
return !this.isMobile() || !this.#tabsVisible;
|
|
311
|
+
}
|
|
312
|
+
showTabs() {
|
|
313
|
+
this.#tabsVisible = true;
|
|
314
|
+
this.#contentAdded = false;
|
|
315
|
+
this.animationTabsVisibleState = VISIBLE_STATE;
|
|
316
|
+
this.animationContentVisibleState = HIDDEN_STATE;
|
|
317
|
+
this.showingTabs.next(true);
|
|
318
|
+
}
|
|
319
|
+
#destroyContent() {
|
|
320
|
+
if (this.content) {
|
|
321
|
+
this.content.nativeElement.innerHTML = '';
|
|
322
|
+
}
|
|
323
|
+
this.content = undefined;
|
|
324
|
+
}
|
|
325
|
+
#moveContent() {
|
|
326
|
+
/* istanbul ignore else */
|
|
327
|
+
if (this.content && !this.#contentAdded) {
|
|
328
|
+
const activeTab = this.activeTab();
|
|
329
|
+
const activeContent = activeTab ? activeTab.tabContent : undefined;
|
|
330
|
+
if (activeContent && activeTab && activeContent.nativeElement) {
|
|
331
|
+
this.content.nativeElement.appendChild(activeContent.nativeElement);
|
|
332
|
+
activeTab.contentRendered = true;
|
|
333
|
+
this.#contentAdded = true;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
#updateTabClicked() {
|
|
338
|
+
this.#contentAdded = false;
|
|
339
|
+
if (this.isMobile()) {
|
|
340
|
+
this.#tabsVisible = false;
|
|
341
|
+
this.animationContentVisibleState = VISIBLE_STATE;
|
|
342
|
+
this.animationTabsVisibleState = HIDDEN_STATE;
|
|
343
|
+
this.hidingTabs.next(true);
|
|
344
|
+
}
|
|
345
|
+
this.indexChanged.next(this.activeIndex);
|
|
346
|
+
}
|
|
347
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyVerticalTabsetService, deps: [{ token: i1.SkyMediaQueryService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
348
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyVerticalTabsetService }); }
|
|
349
|
+
}
|
|
350
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyVerticalTabsetService, decorators: [{
|
|
351
|
+
type: Injectable
|
|
352
|
+
}], ctorParameters: function () { return [{ type: i1.SkyMediaQueryService }]; } });
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Tracks the element IDs for all tabs within a tablist.
|
|
356
|
+
* @internal
|
|
357
|
+
*/
|
|
358
|
+
class SkyTabIdService {
|
|
359
|
+
get ids() {
|
|
360
|
+
return this.#idsObs;
|
|
361
|
+
}
|
|
362
|
+
#ids;
|
|
363
|
+
#ids$;
|
|
364
|
+
#idsObs;
|
|
365
|
+
constructor() {
|
|
366
|
+
this.#ids = new Map();
|
|
367
|
+
this.#ids$ = new BehaviorSubject([]);
|
|
368
|
+
this.#idsObs = this.#ids$.asObservable();
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Associates a tab's ID with its parent tablist.
|
|
372
|
+
* @param {string} id A unique ID for the tab's registration.
|
|
373
|
+
* @param {string} elementId The ID applied to the tab's element.
|
|
374
|
+
*/
|
|
375
|
+
register(id, elementId) {
|
|
376
|
+
if (!this.#ids.has(id) || this.#ids.get(id) !== elementId) {
|
|
377
|
+
this.#ids.set(id, elementId);
|
|
378
|
+
this.#emitIds();
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Disassociates a tab's ID with its parent tablist.
|
|
383
|
+
* @param {string} id The ID used to register the tab.
|
|
384
|
+
*/
|
|
385
|
+
unregister(id) {
|
|
386
|
+
if (this.#ids.has(id)) {
|
|
387
|
+
this.#ids.delete(id);
|
|
388
|
+
this.#emitIds();
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
#emitIds() {
|
|
392
|
+
this.#ids$.next(Array.from(this.#ids.values()));
|
|
393
|
+
}
|
|
394
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabIdService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
395
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabIdService }); }
|
|
396
|
+
}
|
|
397
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabIdService, decorators: [{
|
|
398
|
+
type: Injectable
|
|
399
|
+
}], ctorParameters: function () { return []; } });
|
|
400
|
+
|
|
401
|
+
let nextId$2 = 0;
|
|
402
|
+
class SkyVerticalTabComponent {
|
|
403
|
+
/**
|
|
404
|
+
* The ARIA role for the vertical tab
|
|
405
|
+
* [to support accessibility](https://developer.blackbaud.com/skyux/learn/accessibility)
|
|
406
|
+
* by indicating how the tab functions and what it controls. For information about how
|
|
407
|
+
* an ARIA role indicates what an item represents on a web page, see the
|
|
408
|
+
* [WAI-ARIA roles model](https://www.w3.org/WAI/PF/aria/#roles).
|
|
409
|
+
* @default "tab"
|
|
410
|
+
* @deprecated Any other value than `tab` could lead to a poor user experience for users with assistive technology.
|
|
411
|
+
* In the next major version, this property will be automatically set to `tab`.
|
|
412
|
+
*/
|
|
413
|
+
get ariaRole() {
|
|
414
|
+
return this.#_ariaRole;
|
|
415
|
+
}
|
|
416
|
+
set ariaRole(value) {
|
|
417
|
+
this.#_ariaRole = value ?? 'tab';
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* The ID for the tab.
|
|
421
|
+
* @deprecated Now that the vertical tabs provide aria labels automatically, this input is no longer necessary.
|
|
422
|
+
*/
|
|
423
|
+
set tabId(value) {
|
|
424
|
+
this.#tabIdOrDefault = value || this.#defaultTabId;
|
|
425
|
+
this.#tabIdSvc?.register(this.#defaultTabId, this.#tabIdOrDefault);
|
|
426
|
+
}
|
|
427
|
+
get tabId() {
|
|
428
|
+
return this.#tabIdOrDefault;
|
|
429
|
+
}
|
|
430
|
+
set contentRendered(value) {
|
|
431
|
+
this.#_contentRendered = value;
|
|
432
|
+
/* istanbul ignore else */
|
|
433
|
+
if (this.#_contentRendered) {
|
|
434
|
+
// NOTE: Wrapped in a setTimeout here to ensure that everything has completed rendering.
|
|
435
|
+
setTimeout(() => {
|
|
436
|
+
if (this.tabContent) {
|
|
437
|
+
this.#updateBreakpointAndResponsiveClass();
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
get contentRendered() {
|
|
443
|
+
return this.#_contentRendered;
|
|
444
|
+
}
|
|
445
|
+
#_ariaRole;
|
|
446
|
+
#_contentRendered;
|
|
447
|
+
#tabIdOrDefault;
|
|
448
|
+
#defaultTabId;
|
|
449
|
+
#mobileSubscription;
|
|
450
|
+
#ngUnsubscribe;
|
|
451
|
+
#adapterService;
|
|
452
|
+
#changeRef;
|
|
453
|
+
#tabsetService;
|
|
454
|
+
#verticalTabMediaQueryService;
|
|
455
|
+
#tabIdSvc;
|
|
456
|
+
constructor(adapterService, changeRef, tabsetService, verticalTabMediaQueryService, tabIdSvc) {
|
|
457
|
+
/**
|
|
458
|
+
* Whether the tab is active when the tabset loads.
|
|
459
|
+
*/
|
|
460
|
+
this.active = false;
|
|
461
|
+
/**
|
|
462
|
+
* Whether to disable the tab.
|
|
463
|
+
*/
|
|
464
|
+
this.disabled = false;
|
|
465
|
+
/**
|
|
466
|
+
* Whether to indicate that the tab has an error.
|
|
467
|
+
* @internal This is used for sectioned forms and is not currently a supported design for pure vertical tabs.
|
|
468
|
+
*/
|
|
469
|
+
this.errorIndicator = false;
|
|
470
|
+
this.isMobile = false;
|
|
471
|
+
this.#_ariaRole = 'tab';
|
|
472
|
+
this.#_contentRendered = false;
|
|
473
|
+
this.#mobileSubscription = new Subject();
|
|
474
|
+
this.#ngUnsubscribe = new Subject();
|
|
475
|
+
this.#adapterService = adapterService;
|
|
476
|
+
this.#changeRef = changeRef;
|
|
477
|
+
this.#tabsetService = tabsetService;
|
|
478
|
+
this.#verticalTabMediaQueryService = verticalTabMediaQueryService;
|
|
479
|
+
this.#tabIdSvc = tabIdSvc;
|
|
480
|
+
this.#tabIdOrDefault = this.#defaultTabId = `sky-vertical-tab-${++nextId$2}`;
|
|
481
|
+
this.tabId = this.#defaultTabId;
|
|
482
|
+
}
|
|
483
|
+
ngOnInit() {
|
|
484
|
+
this.isMobile = this.#tabsetService.isMobile();
|
|
485
|
+
this.#changeRef.markForCheck();
|
|
486
|
+
this.#tabsetService.switchingMobile.subscribe((mobile) => {
|
|
487
|
+
this.isMobile = mobile;
|
|
488
|
+
this.#changeRef.markForCheck();
|
|
489
|
+
});
|
|
490
|
+
// Update the breakpoint and responsive class here just as a sanity check since we can not
|
|
491
|
+
// watch for element resizing.
|
|
492
|
+
this.#tabsetService.indexChanged
|
|
493
|
+
.pipe(takeUntil(this.#ngUnsubscribe))
|
|
494
|
+
.subscribe((index) => {
|
|
495
|
+
if (this.index === index && this.contentRendered) {
|
|
496
|
+
if (this.tabContent) {
|
|
497
|
+
this.#updateBreakpointAndResponsiveClass();
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
this.#tabsetService.addTab(this);
|
|
502
|
+
}
|
|
503
|
+
ngOnDestroy() {
|
|
504
|
+
this.#tabIdSvc?.unregister(this.#defaultTabId);
|
|
505
|
+
this.#mobileSubscription.unsubscribe();
|
|
506
|
+
this.#ngUnsubscribe.next();
|
|
507
|
+
this.#ngUnsubscribe.complete();
|
|
508
|
+
this.#tabsetService.destroyTab(this);
|
|
509
|
+
}
|
|
510
|
+
tabIndex() {
|
|
511
|
+
if (!this.disabled) {
|
|
512
|
+
return 0;
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
return -1;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
activateTab() {
|
|
519
|
+
if (!this.disabled) {
|
|
520
|
+
this.active = true;
|
|
521
|
+
this.#tabsetService.activateTab(this);
|
|
522
|
+
this.#changeRef.markForCheck();
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
onTabButtonKeyUp(event) {
|
|
526
|
+
/*istanbul ignore else */
|
|
527
|
+
if (event.key) {
|
|
528
|
+
switch (event.key.toUpperCase()) {
|
|
529
|
+
case ' ':
|
|
530
|
+
case 'ENTER':
|
|
531
|
+
this.activateTab();
|
|
532
|
+
event.stopPropagation();
|
|
533
|
+
break;
|
|
534
|
+
/* istanbul ignore next */
|
|
535
|
+
default:
|
|
536
|
+
break;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
onWindowResize() {
|
|
541
|
+
if (this.tabContent) {
|
|
542
|
+
this.#updateBreakpointAndResponsiveClass();
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
tabDeactivated() {
|
|
546
|
+
this.#changeRef.markForCheck();
|
|
547
|
+
}
|
|
548
|
+
#updateBreakpointAndResponsiveClass() {
|
|
549
|
+
if (this.tabContent) {
|
|
550
|
+
const width = this.#adapterService.getWidth(this.tabContent);
|
|
551
|
+
this.#verticalTabMediaQueryService.setBreakpointForWidth(width);
|
|
552
|
+
const newBreakpoint = this.#verticalTabMediaQueryService.current;
|
|
553
|
+
if (newBreakpoint) {
|
|
554
|
+
this.#adapterService.setResponsiveClass(this.tabContent, newBreakpoint);
|
|
555
|
+
}
|
|
556
|
+
this.#changeRef.markForCheck();
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyVerticalTabComponent, deps: [{ token: SkyVerticalTabsetAdapterService }, { token: i0.ChangeDetectorRef }, { token: SkyVerticalTabsetService }, { token: SkyVerticalTabMediaQueryService }, { token: SkyTabIdService, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
560
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SkyVerticalTabComponent, selector: "sky-vertical-tab", inputs: { active: "active", ariaControls: "ariaControls", ariaRole: "ariaRole", disabled: "disabled", errorIndicator: "errorIndicator", tabHeaderCount: "tabHeaderCount", tabHeading: "tabHeading", showTabRightArrow: "showTabRightArrow", tabId: "tabId" }, host: { listeners: { "window:resize": "onWindowResize()" } }, providers: [
|
|
561
|
+
SkyVerticalTabMediaQueryService,
|
|
562
|
+
{
|
|
563
|
+
provide: SkyMediaQueryService,
|
|
564
|
+
useExisting: SkyVerticalTabMediaQueryService,
|
|
565
|
+
},
|
|
566
|
+
], viewQueries: [{ propertyName: "tabContent", first: true, predicate: ["tabContentWrapper"], descendants: true }], ngImport: i0, template: "<a\n class=\"sky-vertical-tab\"\n [attr.aria-controls]=\"isMobile ? null : ariaControls || tabContentPane.id\"\n [attr.aria-selected]=\"active\"\n [attr.id]=\"tabId\"\n [attr.role]=\"isMobile ? undefined : ariaRole\"\n [ngClass]=\"{\n 'sky-vertical-tab-active': active,\n 'sky-vertical-tab-disabled': disabled,\n 'sky-font-deemphasized': disabled,\n 'sky-deemphasized': disabled\n }\"\n [tabIndex]=\"tabIndex()\"\n (click)=\"activateTab()\"\n (keyup)=\"onTabButtonKeyUp($event)\"\n>\n <div class=\"sky-vertical-tab-display\">\n <div class=\"sky-vertical-tab-heading\">\n <span class=\"sky-vertical-tab-heading-value\">{{ tabHeading }}</span>\n <span\n class=\"sky-vertical-tab-count\"\n *ngIf=\"tabHeaderCount || tabHeaderCount === 0\"\n >\n ({{ tabHeaderCount }})\n </span>\n </div>\n <sky-status-indicator\n *ngIf=\"errorIndicator\"\n class=\"sky-vertical-tab-heading-error\"\n descriptionType=\"error\"\n indicatorType=\"danger\"\n ></sky-status-indicator>\n <sky-icon\n *ngIf=\"isMobile && showTabRightArrow\"\n class=\"sky-vertical-tab-right-arrow\"\n icon=\"chevron-right\"\n >\n </sky-icon>\n </div>\n</a>\n\n<div #tabContentWrapper>\n <div\n class=\"sky-vertical-tab-content-pane\"\n role=\"tabpanel\"\n tabindex=\"0\"\n skyId\n [attr.aria-labelledby]=\"tabId\"\n [ngClass]=\"{ 'sky-vertical-tab-hidden': !active }\"\n #tabContentPane\n >\n <ng-content></ng-content>\n\n <div></div>\n </div>\n</div>\n", styles: [".sky-vertical-tab{cursor:pointer;padding:7px 0 7px 10px;margin:5px 0 5px 10px;display:flex;text-decoration:none}.sky-vertical-tab:not(.sky-deemphasized){color:#212327}.sky-vertical-tab:hover{background-color:#eeeeef}.sky-vertical-tab:focus-visible{outline:thin dotted;outline:-webkit-focus-ring-color auto 5px}.sky-vertical-tab:hover .sky-vertical-tab-right-arrow{color:#979ba2}.sky-vertical-tab-active{background-color:#eeeeef;color:#212327;padding-left:6px;border-left:4px solid #00b4f1}.sky-vertical-tab-hidden{display:none}.sky-vertical-tab-display{display:flex;flex-grow:1}.sky-vertical-tab-heading-error{padding-left:5px}.sky-vertical-tab-count{margin-left:5px}.sky-vertical-tab-disabled{cursor:not-allowed;pointer-events:none}.sky-vertical-tab-right-arrow{padding:3px 10px 0 0;color:#cdcfd2}:host-context(.sky-theme-modern) .sky-vertical-tab{color:#686c73;cursor:pointer;padding:10px 0 10px 10px;margin:10px 0 20px 10px}:host-context(.sky-theme-modern) .sky-vertical-tab:not(.sky-vertical-tab-active):not(:active):hover{color:#212327;background-color:transparent;padding-left:9px;border-left:1px solid #00b4f1}:host-context(.sky-theme-modern) .sky-vertical-tab:not(:active):focus-visible{outline:solid 2px #1870B8;outline-offset:-2px;box-shadow:0 1px 8px #0000004d}:host-context(.sky-theme-modern) .sky-vertical-tab:focus:active:hover{outline:none;background:none}:host-context(.sky-theme-modern) .sky-vertical-tab:active{border-left:3px solid #00b4f1;color:#212327;padding-left:7px}:host-context(.sky-theme-modern) .sky-vertical-tab .sky-vertical-tab-heading-error{padding-left:10px;position:relative;top:-2px}:host-context(.sky-theme-modern) .sky-vertical-tab-active{background:none;color:#212327;padding-left:7px;border-left:3px solid #1870B8}.sky-theme-modern .sky-vertical-tab{color:#686c73;cursor:pointer;padding:10px 0 10px 10px;margin:10px 0 20px 10px}.sky-theme-modern .sky-vertical-tab:not(.sky-vertical-tab-active):not(:active):hover{color:#212327;background-color:transparent;padding-left:9px;border-left:1px solid #00b4f1}.sky-theme-modern .sky-vertical-tab:not(:active):focus-visible{outline:solid 2px #1870B8;outline-offset:-2px;box-shadow:0 1px 8px #0000004d}.sky-theme-modern .sky-vertical-tab:focus:active:hover{outline:none;background:none}.sky-theme-modern .sky-vertical-tab:active{border-left:3px solid #00b4f1;color:#212327;padding-left:7px}.sky-theme-modern .sky-vertical-tab .sky-vertical-tab-heading-error{padding-left:10px;position:relative;top:-2px}.sky-theme-modern .sky-vertical-tab-active{background:none;color:#212327;padding-left:7px;border-left:3px solid #1870B8}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i6.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { kind: "directive", type: i1.λ2, selector: "[skyId]", exportAs: ["skyId"] }, { kind: "component", type: i6.λ10, selector: "sky-status-indicator", inputs: ["indicatorType", "descriptionType", "customDescription"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
567
|
+
}
|
|
568
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyVerticalTabComponent, decorators: [{
|
|
569
|
+
type: Component,
|
|
570
|
+
args: [{ selector: 'sky-vertical-tab', providers: [
|
|
571
|
+
SkyVerticalTabMediaQueryService,
|
|
572
|
+
{
|
|
573
|
+
provide: SkyMediaQueryService,
|
|
574
|
+
useExisting: SkyVerticalTabMediaQueryService,
|
|
575
|
+
},
|
|
576
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<a\n class=\"sky-vertical-tab\"\n [attr.aria-controls]=\"isMobile ? null : ariaControls || tabContentPane.id\"\n [attr.aria-selected]=\"active\"\n [attr.id]=\"tabId\"\n [attr.role]=\"isMobile ? undefined : ariaRole\"\n [ngClass]=\"{\n 'sky-vertical-tab-active': active,\n 'sky-vertical-tab-disabled': disabled,\n 'sky-font-deemphasized': disabled,\n 'sky-deemphasized': disabled\n }\"\n [tabIndex]=\"tabIndex()\"\n (click)=\"activateTab()\"\n (keyup)=\"onTabButtonKeyUp($event)\"\n>\n <div class=\"sky-vertical-tab-display\">\n <div class=\"sky-vertical-tab-heading\">\n <span class=\"sky-vertical-tab-heading-value\">{{ tabHeading }}</span>\n <span\n class=\"sky-vertical-tab-count\"\n *ngIf=\"tabHeaderCount || tabHeaderCount === 0\"\n >\n ({{ tabHeaderCount }})\n </span>\n </div>\n <sky-status-indicator\n *ngIf=\"errorIndicator\"\n class=\"sky-vertical-tab-heading-error\"\n descriptionType=\"error\"\n indicatorType=\"danger\"\n ></sky-status-indicator>\n <sky-icon\n *ngIf=\"isMobile && showTabRightArrow\"\n class=\"sky-vertical-tab-right-arrow\"\n icon=\"chevron-right\"\n >\n </sky-icon>\n </div>\n</a>\n\n<div #tabContentWrapper>\n <div\n class=\"sky-vertical-tab-content-pane\"\n role=\"tabpanel\"\n tabindex=\"0\"\n skyId\n [attr.aria-labelledby]=\"tabId\"\n [ngClass]=\"{ 'sky-vertical-tab-hidden': !active }\"\n #tabContentPane\n >\n <ng-content></ng-content>\n\n <div></div>\n </div>\n</div>\n", styles: [".sky-vertical-tab{cursor:pointer;padding:7px 0 7px 10px;margin:5px 0 5px 10px;display:flex;text-decoration:none}.sky-vertical-tab:not(.sky-deemphasized){color:#212327}.sky-vertical-tab:hover{background-color:#eeeeef}.sky-vertical-tab:focus-visible{outline:thin dotted;outline:-webkit-focus-ring-color auto 5px}.sky-vertical-tab:hover .sky-vertical-tab-right-arrow{color:#979ba2}.sky-vertical-tab-active{background-color:#eeeeef;color:#212327;padding-left:6px;border-left:4px solid #00b4f1}.sky-vertical-tab-hidden{display:none}.sky-vertical-tab-display{display:flex;flex-grow:1}.sky-vertical-tab-heading-error{padding-left:5px}.sky-vertical-tab-count{margin-left:5px}.sky-vertical-tab-disabled{cursor:not-allowed;pointer-events:none}.sky-vertical-tab-right-arrow{padding:3px 10px 0 0;color:#cdcfd2}:host-context(.sky-theme-modern) .sky-vertical-tab{color:#686c73;cursor:pointer;padding:10px 0 10px 10px;margin:10px 0 20px 10px}:host-context(.sky-theme-modern) .sky-vertical-tab:not(.sky-vertical-tab-active):not(:active):hover{color:#212327;background-color:transparent;padding-left:9px;border-left:1px solid #00b4f1}:host-context(.sky-theme-modern) .sky-vertical-tab:not(:active):focus-visible{outline:solid 2px #1870B8;outline-offset:-2px;box-shadow:0 1px 8px #0000004d}:host-context(.sky-theme-modern) .sky-vertical-tab:focus:active:hover{outline:none;background:none}:host-context(.sky-theme-modern) .sky-vertical-tab:active{border-left:3px solid #00b4f1;color:#212327;padding-left:7px}:host-context(.sky-theme-modern) .sky-vertical-tab .sky-vertical-tab-heading-error{padding-left:10px;position:relative;top:-2px}:host-context(.sky-theme-modern) .sky-vertical-tab-active{background:none;color:#212327;padding-left:7px;border-left:3px solid #1870B8}.sky-theme-modern .sky-vertical-tab{color:#686c73;cursor:pointer;padding:10px 0 10px 10px;margin:10px 0 20px 10px}.sky-theme-modern .sky-vertical-tab:not(.sky-vertical-tab-active):not(:active):hover{color:#212327;background-color:transparent;padding-left:9px;border-left:1px solid #00b4f1}.sky-theme-modern .sky-vertical-tab:not(:active):focus-visible{outline:solid 2px #1870B8;outline-offset:-2px;box-shadow:0 1px 8px #0000004d}.sky-theme-modern .sky-vertical-tab:focus:active:hover{outline:none;background:none}.sky-theme-modern .sky-vertical-tab:active{border-left:3px solid #00b4f1;color:#212327;padding-left:7px}.sky-theme-modern .sky-vertical-tab .sky-vertical-tab-heading-error{padding-left:10px;position:relative;top:-2px}.sky-theme-modern .sky-vertical-tab-active{background:none;color:#212327;padding-left:7px;border-left:3px solid #1870B8}\n"] }]
|
|
577
|
+
}], ctorParameters: function () { return [{ type: SkyVerticalTabsetAdapterService }, { type: i0.ChangeDetectorRef }, { type: SkyVerticalTabsetService }, { type: SkyVerticalTabMediaQueryService }, { type: SkyTabIdService, decorators: [{
|
|
578
|
+
type: Optional
|
|
579
|
+
}] }]; }, propDecorators: { active: [{
|
|
580
|
+
type: Input
|
|
581
|
+
}], ariaControls: [{
|
|
582
|
+
type: Input
|
|
583
|
+
}], ariaRole: [{
|
|
584
|
+
type: Input
|
|
585
|
+
}], disabled: [{
|
|
586
|
+
type: Input
|
|
587
|
+
}], errorIndicator: [{
|
|
588
|
+
type: Input
|
|
589
|
+
}], tabHeaderCount: [{
|
|
590
|
+
type: Input
|
|
591
|
+
}], tabHeading: [{
|
|
592
|
+
type: Input
|
|
593
|
+
}], showTabRightArrow: [{
|
|
594
|
+
type: Input
|
|
595
|
+
}], tabId: [{
|
|
596
|
+
type: Input
|
|
597
|
+
}], tabContent: [{
|
|
598
|
+
type: ViewChild,
|
|
599
|
+
args: ['tabContentWrapper']
|
|
600
|
+
}], onWindowResize: [{
|
|
601
|
+
type: HostListener,
|
|
602
|
+
args: ['window:resize']
|
|
603
|
+
}] } });
|
|
604
|
+
|
|
605
|
+
class SkyVerticalTabsetGroupComponent {
|
|
606
|
+
/**
|
|
607
|
+
* Whether to disable the ability to expand and collapse the group.
|
|
608
|
+
* @default false
|
|
609
|
+
*/
|
|
610
|
+
set disabled(value) {
|
|
611
|
+
this.#_disabled = value;
|
|
612
|
+
this.#updateSlideDirection(false);
|
|
613
|
+
}
|
|
614
|
+
get disabled() {
|
|
615
|
+
return this.#_disabled;
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* Whether the collapsible group is expanded.
|
|
619
|
+
* @default false
|
|
620
|
+
*/
|
|
621
|
+
set open(value) {
|
|
622
|
+
this.#_open = value;
|
|
623
|
+
this.#updateSlideDirection(false);
|
|
624
|
+
}
|
|
625
|
+
get open() {
|
|
626
|
+
return this.#_open;
|
|
627
|
+
}
|
|
628
|
+
#ngUnsubscribe;
|
|
629
|
+
#tabService;
|
|
630
|
+
#changeRef;
|
|
631
|
+
#_disabled;
|
|
632
|
+
#_open;
|
|
633
|
+
constructor(tabService, changeRef) {
|
|
634
|
+
this.animationDisabled = false;
|
|
635
|
+
this.slideDirection = 'up';
|
|
636
|
+
this.#ngUnsubscribe = new Subject();
|
|
637
|
+
this.tabClicked = () => {
|
|
638
|
+
this.#changeRef.markForCheck();
|
|
639
|
+
};
|
|
640
|
+
this.tabsHidden = () => {
|
|
641
|
+
// Angular will sometimes place the animation into the "void" state when tabs are hidden. Update our internal variable to reflect that.
|
|
642
|
+
this.slideDirection = 'void';
|
|
643
|
+
this.#changeRef.markForCheck();
|
|
644
|
+
};
|
|
645
|
+
this.tabsShown = () => {
|
|
646
|
+
// Set the animation back up so that the "void" state is returned to where it was prior to the tabs being hidden.
|
|
647
|
+
// This will be instantaneous due to there not being a "void -> *" state on the slide animation.
|
|
648
|
+
this.#updateSlideDirection(true);
|
|
649
|
+
this.#changeRef.markForCheck();
|
|
650
|
+
};
|
|
651
|
+
this.#tabService = tabService;
|
|
652
|
+
this.#changeRef = changeRef;
|
|
653
|
+
}
|
|
654
|
+
ngOnInit() {
|
|
655
|
+
this.#tabService.hidingTabs
|
|
656
|
+
.pipe(takeUntil(this.#ngUnsubscribe))
|
|
657
|
+
.subscribe(this.tabsHidden);
|
|
658
|
+
this.#tabService.showingTabs
|
|
659
|
+
.pipe(takeUntil(this.#ngUnsubscribe))
|
|
660
|
+
.subscribe(this.tabsShown);
|
|
661
|
+
this.#tabService.tabClicked
|
|
662
|
+
.pipe(takeUntil(this.#ngUnsubscribe))
|
|
663
|
+
.subscribe(this.tabClicked);
|
|
664
|
+
}
|
|
665
|
+
ngOnDestroy() {
|
|
666
|
+
this.#ngUnsubscribe.next();
|
|
667
|
+
this.#ngUnsubscribe.complete();
|
|
668
|
+
}
|
|
669
|
+
updateSlideDirection(event) {
|
|
670
|
+
this.slideDirection = event.toState;
|
|
671
|
+
}
|
|
672
|
+
toggleMenuOpen() {
|
|
673
|
+
if (!this.disabled) {
|
|
674
|
+
this.open = !this.open;
|
|
675
|
+
}
|
|
676
|
+
this.#updateSlideDirection(true);
|
|
677
|
+
this.#changeRef.markForCheck();
|
|
678
|
+
}
|
|
679
|
+
subMenuOpen() {
|
|
680
|
+
return !!this.tabs && this.tabs.find((t) => !!t.active) !== undefined;
|
|
681
|
+
}
|
|
682
|
+
#updateSlideDirection(animate) {
|
|
683
|
+
this.animationDisabled = !animate;
|
|
684
|
+
this.slideDirection = this.open && !this.disabled ? 'down' : 'up';
|
|
685
|
+
}
|
|
686
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyVerticalTabsetGroupComponent, deps: [{ token: SkyVerticalTabsetService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
687
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SkyVerticalTabsetGroupComponent, selector: "sky-vertical-tabset-group", inputs: { disabled: "disabled", groupHeading: "groupHeading", open: "open" }, queries: [{ propertyName: "tabs", predicate: SkyVerticalTabComponent }], ngImport: i0, template: "<div class=\"sky-vertical-tabset-group\">\n <!-- [ngClass] includes font classes for both modern and default styles -->\n <div\n class=\"sky-vertical-tabset-group-header\"\n [ngClass]=\"{\n 'sky-vertical-tabset-group-header-sub-open sky-font-emphasized':\n subMenuOpen(),\n 'sky-font-deemphasized': disabled,\n 'sky-deemphasized': disabled,\n 'sky-vertical-tabset-disabled': disabled\n }\"\n [tabIndex]=\"-1\"\n >\n <button\n class=\"sky-padding-even-default\"\n type=\"button\"\n skyId\n [attr.aria-controls]=\"groupContent.id\"\n [attr.aria-expanded]=\"!disabled && open\"\n (click)=\"toggleMenuOpen()\"\n #groupHeadingButton\n >\n {{ groupHeading }}\n <sky-expansion-indicator\n class=\"sky-vertical-tabset-group-expansion-indicator\"\n [direction]=\"!disabled && open ? 'up' : 'down'\"\n >\n </sky-expansion-indicator>\n </button>\n </div>\n <div\n class=\"sky-vertical-tabset-group-content\"\n skyId\n [attr.labelledby]=\"groupHeadingButton.id\"\n [@.disabled]=\"animationDisabled\"\n [@skyAnimationSlide]=\"slideDirection\"\n (@skyAnimationSlide.done)=\"updateSlideDirection($event)\"\n #groupContent\n >\n <ng-content></ng-content>\n </div>\n</div>\n", styles: [".sky-vertical-tabset-group{border-bottom:1px solid #e2e3e4;margin:5px 0 5px 5px}.sky-vertical-tabset-group-header button{cursor:pointer;display:flex;justify-content:space-between;border:none;width:100%;text-align:left;background:none}.sky-vertical-tabset-group-content{overflow:hidden;border-top:1px solid #e2e3e4}:host ::ng-deep .sky-vertical-tabset-group-expansion-indicator>button{font-size:14px!important}.sky-vertical-tabset-disabled{cursor:not-allowed;pointer-events:none}:host-context(.sky-theme-modern) .sky-vertical-tabset-group{border:none;margin:10px 0}:host-context(.sky-theme-modern) .sky-vertical-tabset-group-content{border:none;padding-left:25px}:host-context(.sky-theme-modern) .sky-vertical-tabset-group-header{position:relative}:host-context(.sky-theme-modern) .sky-vertical-tabset-group-expansion-indicator{position:absolute;top:6px;right:5px}.sky-theme-modern .sky-vertical-tabset-group{border:none;margin:10px 0}.sky-theme-modern .sky-vertical-tabset-group-content{border:none;padding-left:25px}.sky-theme-modern .sky-vertical-tabset-group-header{position:relative}.sky-theme-modern .sky-vertical-tabset-group-expansion-indicator{position:absolute;top:6px;right:5px}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.λ2, selector: "[skyId]", exportAs: ["skyId"] }, { kind: "component", type: i6.λ15, selector: "sky-expansion-indicator", inputs: ["direction"] }], animations: [skyAnimationSlide], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
688
|
+
}
|
|
689
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyVerticalTabsetGroupComponent, decorators: [{
|
|
690
|
+
type: Component,
|
|
691
|
+
args: [{ selector: 'sky-vertical-tabset-group', changeDetection: ChangeDetectionStrategy.OnPush, animations: [skyAnimationSlide], template: "<div class=\"sky-vertical-tabset-group\">\n <!-- [ngClass] includes font classes for both modern and default styles -->\n <div\n class=\"sky-vertical-tabset-group-header\"\n [ngClass]=\"{\n 'sky-vertical-tabset-group-header-sub-open sky-font-emphasized':\n subMenuOpen(),\n 'sky-font-deemphasized': disabled,\n 'sky-deemphasized': disabled,\n 'sky-vertical-tabset-disabled': disabled\n }\"\n [tabIndex]=\"-1\"\n >\n <button\n class=\"sky-padding-even-default\"\n type=\"button\"\n skyId\n [attr.aria-controls]=\"groupContent.id\"\n [attr.aria-expanded]=\"!disabled && open\"\n (click)=\"toggleMenuOpen()\"\n #groupHeadingButton\n >\n {{ groupHeading }}\n <sky-expansion-indicator\n class=\"sky-vertical-tabset-group-expansion-indicator\"\n [direction]=\"!disabled && open ? 'up' : 'down'\"\n >\n </sky-expansion-indicator>\n </button>\n </div>\n <div\n class=\"sky-vertical-tabset-group-content\"\n skyId\n [attr.labelledby]=\"groupHeadingButton.id\"\n [@.disabled]=\"animationDisabled\"\n [@skyAnimationSlide]=\"slideDirection\"\n (@skyAnimationSlide.done)=\"updateSlideDirection($event)\"\n #groupContent\n >\n <ng-content></ng-content>\n </div>\n</div>\n", styles: [".sky-vertical-tabset-group{border-bottom:1px solid #e2e3e4;margin:5px 0 5px 5px}.sky-vertical-tabset-group-header button{cursor:pointer;display:flex;justify-content:space-between;border:none;width:100%;text-align:left;background:none}.sky-vertical-tabset-group-content{overflow:hidden;border-top:1px solid #e2e3e4}:host ::ng-deep .sky-vertical-tabset-group-expansion-indicator>button{font-size:14px!important}.sky-vertical-tabset-disabled{cursor:not-allowed;pointer-events:none}:host-context(.sky-theme-modern) .sky-vertical-tabset-group{border:none;margin:10px 0}:host-context(.sky-theme-modern) .sky-vertical-tabset-group-content{border:none;padding-left:25px}:host-context(.sky-theme-modern) .sky-vertical-tabset-group-header{position:relative}:host-context(.sky-theme-modern) .sky-vertical-tabset-group-expansion-indicator{position:absolute;top:6px;right:5px}.sky-theme-modern .sky-vertical-tabset-group{border:none;margin:10px 0}.sky-theme-modern .sky-vertical-tabset-group-content{border:none;padding-left:25px}.sky-theme-modern .sky-vertical-tabset-group-header{position:relative}.sky-theme-modern .sky-vertical-tabset-group-expansion-indicator{position:absolute;top:6px;right:5px}\n"] }]
|
|
692
|
+
}], ctorParameters: function () { return [{ type: SkyVerticalTabsetService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { disabled: [{
|
|
693
|
+
type: Input
|
|
694
|
+
}], groupHeading: [{
|
|
695
|
+
type: Input
|
|
696
|
+
}], open: [{
|
|
697
|
+
type: Input
|
|
698
|
+
}], tabs: [{
|
|
699
|
+
type: ContentChildren,
|
|
700
|
+
args: [SkyVerticalTabComponent]
|
|
701
|
+
}] } });
|
|
702
|
+
|
|
703
|
+
class SkyVerticalTabsetComponent {
|
|
704
|
+
/**
|
|
705
|
+
* The ARIA role for the vertical tabset
|
|
706
|
+
* [to support accessibility](https://developer.blackbaud.com/skyux/learn/accessibility)
|
|
707
|
+
* by indicating how the tabset functions and what it controls. For information about how
|
|
708
|
+
* an ARIA role indicates what an item represents on a web page, see the
|
|
709
|
+
* [WAI-ARIA roles model](https://www.w3.org/WAI/PF/aria/#roles).
|
|
710
|
+
* @default "tablist"
|
|
711
|
+
* @deprecated Any other value than `tablist` could lead to a poor user experience for users with assistive technology.
|
|
712
|
+
* In the next major version, this property will be automatically set to `tablist`.
|
|
713
|
+
*/
|
|
714
|
+
get ariaRole() {
|
|
715
|
+
return this.#_ariaRole;
|
|
716
|
+
}
|
|
717
|
+
set ariaRole(value) {
|
|
718
|
+
this.#_ariaRole = value ?? 'tablist';
|
|
719
|
+
}
|
|
720
|
+
#ngUnsubscribe;
|
|
721
|
+
#_ariaRole;
|
|
722
|
+
#resources;
|
|
723
|
+
#changeRef;
|
|
724
|
+
#tabIdSvc;
|
|
725
|
+
constructor(adapterService, tabService, resources, changeRef, tabIdSvc) {
|
|
726
|
+
this.adapterService = adapterService;
|
|
727
|
+
this.tabService = tabService;
|
|
728
|
+
/**
|
|
729
|
+
* Whether the vertical tabset loads tab content during initialization so that it
|
|
730
|
+
* displays content without moving around elements in the content container.
|
|
731
|
+
* @default false
|
|
732
|
+
*/
|
|
733
|
+
this.maintainTabContent = false;
|
|
734
|
+
/**
|
|
735
|
+
* Fires when the active tab changes. Emits the index of the active tab. The
|
|
736
|
+
* index is based on the tab's position when it loads.
|
|
737
|
+
*/
|
|
738
|
+
this.activeChange = new EventEmitter();
|
|
739
|
+
this.isMobile = false;
|
|
740
|
+
this.#ngUnsubscribe = new Subject();
|
|
741
|
+
this.#_ariaRole = 'tablist';
|
|
742
|
+
this.#resources = resources;
|
|
743
|
+
this.#changeRef = changeRef;
|
|
744
|
+
this.#tabIdSvc = tabIdSvc;
|
|
745
|
+
this.#tabIdSvc.ids.pipe(takeUntil(this.#ngUnsubscribe)).subscribe((ids) => {
|
|
746
|
+
this.ariaOwns = ids.join(' ') || undefined;
|
|
747
|
+
this.#changeRef.markForCheck();
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
ngOnInit() {
|
|
751
|
+
this.tabService.maintainTabContent = this.maintainTabContent;
|
|
752
|
+
this.tabService.indexChanged
|
|
753
|
+
.pipe(takeUntil(this.#ngUnsubscribe))
|
|
754
|
+
.subscribe((index) => {
|
|
755
|
+
this.activeChange.emit(index);
|
|
756
|
+
if (this.contentWrapper) {
|
|
757
|
+
this.adapterService.scrollToContentTop(this.contentWrapper);
|
|
758
|
+
}
|
|
759
|
+
this.#changeRef.markForCheck();
|
|
760
|
+
});
|
|
761
|
+
this.tabService.switchingMobile
|
|
762
|
+
.pipe(takeUntil(this.#ngUnsubscribe))
|
|
763
|
+
.subscribe((mobile) => {
|
|
764
|
+
this.isMobile = mobile;
|
|
765
|
+
this.#changeRef.markForCheck();
|
|
766
|
+
});
|
|
767
|
+
if (this.tabService.isMobile()) {
|
|
768
|
+
this.isMobile = true;
|
|
769
|
+
this.tabService.animationContentVisibleState = VISIBLE_STATE;
|
|
770
|
+
this.#changeRef.markForCheck();
|
|
771
|
+
}
|
|
772
|
+
if (!this.showTabsText) {
|
|
773
|
+
this.#resources
|
|
774
|
+
.getString('skyux_vertical_tabs_show_tabs_text')
|
|
775
|
+
.pipe(take(1))
|
|
776
|
+
.subscribe((resource) => {
|
|
777
|
+
/* sanity check */
|
|
778
|
+
/* istanbul ignore else */
|
|
779
|
+
if (!this.showTabsText) {
|
|
780
|
+
this.showTabsText = resource;
|
|
781
|
+
}
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
ngAfterViewChecked() {
|
|
786
|
+
this.tabService.content = this.content;
|
|
787
|
+
this.tabService.updateContent();
|
|
788
|
+
}
|
|
789
|
+
ngOnDestroy() {
|
|
790
|
+
this.#ngUnsubscribe.next();
|
|
791
|
+
this.#ngUnsubscribe.complete();
|
|
792
|
+
}
|
|
793
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyVerticalTabsetComponent, deps: [{ token: SkyVerticalTabsetAdapterService }, { token: SkyVerticalTabsetService }, { token: i3.SkyLibResourcesService }, { token: i0.ChangeDetectorRef }, { token: SkyTabIdService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
794
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SkyVerticalTabsetComponent, selector: "sky-vertical-tabset", inputs: { showTabsText: "showTabsText", ariaLabel: "ariaLabel", ariaLabelledBy: "ariaLabelledBy", ariaRole: "ariaRole", maintainTabContent: "maintainTabContent" }, outputs: { activeChange: "activeChange" }, providers: [SkyTabIdService, SkyVerticalTabsetService], viewQueries: [{ propertyName: "tabGroups", first: true, predicate: ["groupContainerWrapper"], descendants: true }, { propertyName: "content", first: true, predicate: ["skySideContent"], descendants: true }, { propertyName: "contentWrapper", first: true, predicate: ["contentContainerWrapper"], descendants: true }], ngImport: i0, template: "<div class=\"sky-vertical-tabset\">\n <!--\n ARIA rules do not allow tabpanel elements to be children of a tablist element.\n However, the markup for each sky-vertical-tab component includes both the tab button\n and its panel, making the panel element a child of its tablist. Moreover, our\n sky-vertical-tab components can be grouped within collapsible containers, which also\n violates accessibility rules because only tab buttons can be children of a tablist.\n To address this, we create an empty tablist element with an aria-owns attribute,\n pointing to each tab element individually. That way, we don't have to worry about the\n structure for each sky-vertical-tab component in order to satisfy accessibility\n guidelines.\n -->\n <span\n aria-orientation=\"vertical\"\n class=\"sky-vertical-tabset-tablist\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledBy\"\n [attr.aria-owns]=\"ariaOwns\"\n [attr.role]=\"isMobile ? undefined : ariaRole\"\n ></span>\n <div\n *ngIf=\"maintainTabContent || tabService.tabsVisible()\"\n class=\"sky-vertical-tabset-group-container\"\n [@tabGroupEnter]=\"tabService.animationTabsVisibleState\"\n [ngClass]=\"{ 'sky-vertical-tabset-hidden': !tabService.tabsVisible() }\"\n >\n <ng-content></ng-content>\n </div>\n <div\n *ngIf=\"maintainTabContent || tabService.contentVisible()\"\n class=\"sky-vertical-tabset-content\"\n [ngClass]=\"{\n 'sky-vertical-tabset-content-hidden': !tabService.contentVisible()\n }\"\n [@contentEnter]=\"tabService.animationContentVisibleState\"\n #contentContainerWrapper\n >\n <div #skySideContent></div>\n <button\n *ngIf=\"!tabService.tabsVisible()\"\n (click)=\"tabService.showTabs()\"\n class=\"sky-btn sky-btn-primary sky-vertical-tabset-show-tabs-btn\"\n >\n <sky-icon icon=\"chevron-left\"></sky-icon>\n {{ showTabsText }}\n </button>\n </div>\n</div>\n", styles: [":host .sky-vertical-tabset{display:block;height:auto}:host .sky-vertical-tabset-group-container{border-right:none}:host-context(.sky-responsive-container-xs) .sky-vertical-tabset,:host-context(.sky-responsive-container-sm) .sky-vertical-tabset,:host-context(.sky-responsive-container-md) .sky-vertical-tabset,:host-context(.sky-responsive-container-lg) .sky-vertical-tabset{display:block;height:auto}:host-context(.sky-responsive-container-xs) .sky-vertical-tabset-group-container,:host-context(.sky-responsive-container-sm) .sky-vertical-tabset-group-container,:host-context(.sky-responsive-container-md) .sky-vertical-tabset-group-container,:host-context(.sky-responsive-container-lg) .sky-vertical-tabset-group-container{border-right:none}@media (min-width: 768px){:host .sky-vertical-tabset{display:flex;height:100%}:host .sky-vertical-tabset-group-container{border-right:1px solid #cdcfd2}}:host-context(.sky-responsive-container-sm) .sky-vertical-tabset,:host-context(.sky-responsive-container-md) .sky-vertical-tabset,:host-context(.sky-responsive-container-lg) .sky-vertical-tabset{display:flex;height:100%}:host-context(.sky-responsive-container-sm) .sky-vertical-tabset-group-container,:host-context(.sky-responsive-container-md) .sky-vertical-tabset-group-container,:host-context(.sky-responsive-container-lg) .sky-vertical-tabset-group-container{border-right:1px solid #cdcfd2}.sky-vertical-tabset-hidden{display:none}.sky-vertical-tabset-content{margin:10px 0 0 10px;flex-basis:75%;overflow-y:auto}.sky-vertical-tabset-content-hidden{display:none}.sky-vertical-tabset-show-tabs-btn{margin-top:10px}.sky-vertical-tabset-group-container{flex-basis:25%;overflow-y:auto}:host-context(sky-modal-content)>.sky-vertical-tabset{margin:-15px}:host-context(.sky-theme-modern) .sky-vertical-tabset-content{margin:15px}@media (min-width: 768px){:host-context(.sky-theme-modern) :host .sky-vertical-tabset-content{margin:20px 30px}:host-context(.sky-theme-modern) :host .sky-vertical-tabset-group-container{border-right:1px solid #d2d2d2}}:host-context(.sky-theme-modern) :host-context(.sky-responsive-container-sm) .sky-vertical-tabset-content,:host-context(.sky-theme-modern) :host-context(.sky-responsive-container-md) .sky-vertical-tabset-content,:host-context(.sky-theme-modern) :host-context(.sky-responsive-container-lg) .sky-vertical-tabset-content{margin:20px 30px}:host-context(.sky-theme-modern) :host-context(.sky-responsive-container-sm) .sky-vertical-tabset-group-container,:host-context(.sky-theme-modern) :host-context(.sky-responsive-container-md) .sky-vertical-tabset-group-container,:host-context(.sky-theme-modern) :host-context(.sky-responsive-container-lg) .sky-vertical-tabset-group-container{border-right:1px solid #d2d2d2}.sky-theme-modern .sky-vertical-tabset-content{margin:15px}@media (min-width: 768px){.sky-theme-modern :host .sky-vertical-tabset-content{margin:20px 30px}.sky-theme-modern :host .sky-vertical-tabset-group-container{border-right:1px solid #d2d2d2}}.sky-theme-modern :host-context(.sky-responsive-container-sm) .sky-vertical-tabset-content,.sky-theme-modern :host-context(.sky-responsive-container-md) .sky-vertical-tabset-content,.sky-theme-modern :host-context(.sky-responsive-container-lg) .sky-vertical-tabset-content{margin:20px 30px}.sky-theme-modern :host-context(.sky-responsive-container-sm) .sky-vertical-tabset-group-container,.sky-theme-modern :host-context(.sky-responsive-container-md) .sky-vertical-tabset-group-container,.sky-theme-modern :host-context(.sky-responsive-container-lg) .sky-vertical-tabset-group-container{border-right:1px solid #d2d2d2}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i6.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }], animations: [
|
|
795
|
+
trigger('tabGroupEnter', [
|
|
796
|
+
transition(`${HIDDEN_STATE} => ${VISIBLE_STATE}`, [
|
|
797
|
+
style({ transform: 'translate(-100%)' }),
|
|
798
|
+
animate('150ms ease-in'),
|
|
799
|
+
]),
|
|
800
|
+
]),
|
|
801
|
+
trigger('contentEnter', [
|
|
802
|
+
transition(`${HIDDEN_STATE} => ${VISIBLE_STATE}`, [
|
|
803
|
+
style({ transform: 'translate(100%)' }),
|
|
804
|
+
animate('150ms ease-in'),
|
|
805
|
+
]),
|
|
806
|
+
]),
|
|
807
|
+
], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
808
|
+
}
|
|
809
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyVerticalTabsetComponent, decorators: [{
|
|
810
|
+
type: Component,
|
|
811
|
+
args: [{ selector: 'sky-vertical-tabset', providers: [SkyTabIdService, SkyVerticalTabsetService], changeDetection: ChangeDetectionStrategy.OnPush, animations: [
|
|
812
|
+
trigger('tabGroupEnter', [
|
|
813
|
+
transition(`${HIDDEN_STATE} => ${VISIBLE_STATE}`, [
|
|
814
|
+
style({ transform: 'translate(-100%)' }),
|
|
815
|
+
animate('150ms ease-in'),
|
|
816
|
+
]),
|
|
817
|
+
]),
|
|
818
|
+
trigger('contentEnter', [
|
|
819
|
+
transition(`${HIDDEN_STATE} => ${VISIBLE_STATE}`, [
|
|
820
|
+
style({ transform: 'translate(100%)' }),
|
|
821
|
+
animate('150ms ease-in'),
|
|
822
|
+
]),
|
|
823
|
+
]),
|
|
824
|
+
], template: "<div class=\"sky-vertical-tabset\">\n <!--\n ARIA rules do not allow tabpanel elements to be children of a tablist element.\n However, the markup for each sky-vertical-tab component includes both the tab button\n and its panel, making the panel element a child of its tablist. Moreover, our\n sky-vertical-tab components can be grouped within collapsible containers, which also\n violates accessibility rules because only tab buttons can be children of a tablist.\n To address this, we create an empty tablist element with an aria-owns attribute,\n pointing to each tab element individually. That way, we don't have to worry about the\n structure for each sky-vertical-tab component in order to satisfy accessibility\n guidelines.\n -->\n <span\n aria-orientation=\"vertical\"\n class=\"sky-vertical-tabset-tablist\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledBy\"\n [attr.aria-owns]=\"ariaOwns\"\n [attr.role]=\"isMobile ? undefined : ariaRole\"\n ></span>\n <div\n *ngIf=\"maintainTabContent || tabService.tabsVisible()\"\n class=\"sky-vertical-tabset-group-container\"\n [@tabGroupEnter]=\"tabService.animationTabsVisibleState\"\n [ngClass]=\"{ 'sky-vertical-tabset-hidden': !tabService.tabsVisible() }\"\n >\n <ng-content></ng-content>\n </div>\n <div\n *ngIf=\"maintainTabContent || tabService.contentVisible()\"\n class=\"sky-vertical-tabset-content\"\n [ngClass]=\"{\n 'sky-vertical-tabset-content-hidden': !tabService.contentVisible()\n }\"\n [@contentEnter]=\"tabService.animationContentVisibleState\"\n #contentContainerWrapper\n >\n <div #skySideContent></div>\n <button\n *ngIf=\"!tabService.tabsVisible()\"\n (click)=\"tabService.showTabs()\"\n class=\"sky-btn sky-btn-primary sky-vertical-tabset-show-tabs-btn\"\n >\n <sky-icon icon=\"chevron-left\"></sky-icon>\n {{ showTabsText }}\n </button>\n </div>\n</div>\n", styles: [":host .sky-vertical-tabset{display:block;height:auto}:host .sky-vertical-tabset-group-container{border-right:none}:host-context(.sky-responsive-container-xs) .sky-vertical-tabset,:host-context(.sky-responsive-container-sm) .sky-vertical-tabset,:host-context(.sky-responsive-container-md) .sky-vertical-tabset,:host-context(.sky-responsive-container-lg) .sky-vertical-tabset{display:block;height:auto}:host-context(.sky-responsive-container-xs) .sky-vertical-tabset-group-container,:host-context(.sky-responsive-container-sm) .sky-vertical-tabset-group-container,:host-context(.sky-responsive-container-md) .sky-vertical-tabset-group-container,:host-context(.sky-responsive-container-lg) .sky-vertical-tabset-group-container{border-right:none}@media (min-width: 768px){:host .sky-vertical-tabset{display:flex;height:100%}:host .sky-vertical-tabset-group-container{border-right:1px solid #cdcfd2}}:host-context(.sky-responsive-container-sm) .sky-vertical-tabset,:host-context(.sky-responsive-container-md) .sky-vertical-tabset,:host-context(.sky-responsive-container-lg) .sky-vertical-tabset{display:flex;height:100%}:host-context(.sky-responsive-container-sm) .sky-vertical-tabset-group-container,:host-context(.sky-responsive-container-md) .sky-vertical-tabset-group-container,:host-context(.sky-responsive-container-lg) .sky-vertical-tabset-group-container{border-right:1px solid #cdcfd2}.sky-vertical-tabset-hidden{display:none}.sky-vertical-tabset-content{margin:10px 0 0 10px;flex-basis:75%;overflow-y:auto}.sky-vertical-tabset-content-hidden{display:none}.sky-vertical-tabset-show-tabs-btn{margin-top:10px}.sky-vertical-tabset-group-container{flex-basis:25%;overflow-y:auto}:host-context(sky-modal-content)>.sky-vertical-tabset{margin:-15px}:host-context(.sky-theme-modern) .sky-vertical-tabset-content{margin:15px}@media (min-width: 768px){:host-context(.sky-theme-modern) :host .sky-vertical-tabset-content{margin:20px 30px}:host-context(.sky-theme-modern) :host .sky-vertical-tabset-group-container{border-right:1px solid #d2d2d2}}:host-context(.sky-theme-modern) :host-context(.sky-responsive-container-sm) .sky-vertical-tabset-content,:host-context(.sky-theme-modern) :host-context(.sky-responsive-container-md) .sky-vertical-tabset-content,:host-context(.sky-theme-modern) :host-context(.sky-responsive-container-lg) .sky-vertical-tabset-content{margin:20px 30px}:host-context(.sky-theme-modern) :host-context(.sky-responsive-container-sm) .sky-vertical-tabset-group-container,:host-context(.sky-theme-modern) :host-context(.sky-responsive-container-md) .sky-vertical-tabset-group-container,:host-context(.sky-theme-modern) :host-context(.sky-responsive-container-lg) .sky-vertical-tabset-group-container{border-right:1px solid #d2d2d2}.sky-theme-modern .sky-vertical-tabset-content{margin:15px}@media (min-width: 768px){.sky-theme-modern :host .sky-vertical-tabset-content{margin:20px 30px}.sky-theme-modern :host .sky-vertical-tabset-group-container{border-right:1px solid #d2d2d2}}.sky-theme-modern :host-context(.sky-responsive-container-sm) .sky-vertical-tabset-content,.sky-theme-modern :host-context(.sky-responsive-container-md) .sky-vertical-tabset-content,.sky-theme-modern :host-context(.sky-responsive-container-lg) .sky-vertical-tabset-content{margin:20px 30px}.sky-theme-modern :host-context(.sky-responsive-container-sm) .sky-vertical-tabset-group-container,.sky-theme-modern :host-context(.sky-responsive-container-md) .sky-vertical-tabset-group-container,.sky-theme-modern :host-context(.sky-responsive-container-lg) .sky-vertical-tabset-group-container{border-right:1px solid #d2d2d2}\n"] }]
|
|
825
|
+
}], ctorParameters: function () { return [{ type: SkyVerticalTabsetAdapterService }, { type: SkyVerticalTabsetService }, { type: i3.SkyLibResourcesService }, { type: i0.ChangeDetectorRef }, { type: SkyTabIdService }]; }, propDecorators: { showTabsText: [{
|
|
826
|
+
type: Input
|
|
827
|
+
}], ariaLabel: [{
|
|
828
|
+
type: Input
|
|
829
|
+
}], ariaLabelledBy: [{
|
|
830
|
+
type: Input
|
|
831
|
+
}], ariaRole: [{
|
|
832
|
+
type: Input
|
|
833
|
+
}], maintainTabContent: [{
|
|
834
|
+
type: Input
|
|
835
|
+
}], activeChange: [{
|
|
836
|
+
type: Output
|
|
837
|
+
}], tabGroups: [{
|
|
838
|
+
type: ViewChild,
|
|
839
|
+
args: ['groupContainerWrapper']
|
|
840
|
+
}], content: [{
|
|
841
|
+
type: ViewChild,
|
|
842
|
+
args: ['skySideContent']
|
|
843
|
+
}], contentWrapper: [{
|
|
844
|
+
type: ViewChild,
|
|
845
|
+
args: ['contentContainerWrapper']
|
|
846
|
+
}] } });
|
|
847
|
+
|
|
848
|
+
class SkyVerticalTabsetModule {
|
|
849
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyVerticalTabsetModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
850
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SkyVerticalTabsetModule, declarations: [SkyVerticalTabsetComponent,
|
|
851
|
+
SkyVerticalTabsetGroupComponent,
|
|
852
|
+
SkyVerticalTabComponent], imports: [CommonModule,
|
|
853
|
+
SkyIconModule,
|
|
854
|
+
SkyIdModule,
|
|
855
|
+
SkyExpansionIndicatorModule,
|
|
856
|
+
SkyStatusIndicatorModule,
|
|
857
|
+
SkyTabsResourcesModule,
|
|
858
|
+
SkyThemeModule], exports: [SkyVerticalTabsetComponent,
|
|
859
|
+
SkyVerticalTabsetGroupComponent,
|
|
860
|
+
SkyVerticalTabComponent] }); }
|
|
861
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyVerticalTabsetModule, providers: [SkyVerticalTabsetAdapterService], imports: [CommonModule,
|
|
862
|
+
SkyIconModule,
|
|
863
|
+
SkyIdModule,
|
|
864
|
+
SkyExpansionIndicatorModule,
|
|
865
|
+
SkyStatusIndicatorModule,
|
|
866
|
+
SkyTabsResourcesModule,
|
|
867
|
+
SkyThemeModule] }); }
|
|
868
|
+
}
|
|
869
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyVerticalTabsetModule, decorators: [{
|
|
870
|
+
type: NgModule,
|
|
871
|
+
args: [{
|
|
872
|
+
declarations: [
|
|
873
|
+
SkyVerticalTabsetComponent,
|
|
874
|
+
SkyVerticalTabsetGroupComponent,
|
|
875
|
+
SkyVerticalTabComponent,
|
|
876
|
+
],
|
|
877
|
+
imports: [
|
|
878
|
+
CommonModule,
|
|
879
|
+
SkyIconModule,
|
|
880
|
+
SkyIdModule,
|
|
881
|
+
SkyExpansionIndicatorModule,
|
|
882
|
+
SkyStatusIndicatorModule,
|
|
883
|
+
SkyTabsResourcesModule,
|
|
884
|
+
SkyThemeModule,
|
|
885
|
+
],
|
|
886
|
+
providers: [SkyVerticalTabsetAdapterService],
|
|
887
|
+
exports: [
|
|
888
|
+
SkyVerticalTabsetComponent,
|
|
889
|
+
SkyVerticalTabsetGroupComponent,
|
|
890
|
+
SkyVerticalTabComponent,
|
|
891
|
+
],
|
|
892
|
+
}]
|
|
893
|
+
}] });
|
|
894
|
+
|
|
895
|
+
class SkySectionedFormService {
|
|
896
|
+
constructor() {
|
|
897
|
+
/**
|
|
898
|
+
* @internal
|
|
899
|
+
*/
|
|
900
|
+
this.invalidChange = new BehaviorSubject(undefined);
|
|
901
|
+
/**
|
|
902
|
+
* @internal
|
|
903
|
+
*/
|
|
904
|
+
this.requiredChange = new BehaviorSubject(undefined);
|
|
905
|
+
}
|
|
906
|
+
/**
|
|
907
|
+
* Sets the current section's invalid state based on the `isInvalid` parameter.
|
|
908
|
+
* This method is used within a `sky-sectioned-form-section` element.
|
|
909
|
+
*/
|
|
910
|
+
invalidFieldChanged(isInvalid) {
|
|
911
|
+
this.invalidChange.next(isInvalid);
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* Sets the current section's required state based on the `isRequired` parameter.
|
|
915
|
+
* This method is used within a `sky-sectioned-form-section` element.
|
|
916
|
+
*/
|
|
917
|
+
requiredFieldChanged(isRequired) {
|
|
918
|
+
this.requiredChange.next(isRequired);
|
|
919
|
+
}
|
|
920
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySectionedFormService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
921
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySectionedFormService }); }
|
|
922
|
+
}
|
|
923
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySectionedFormService, decorators: [{
|
|
924
|
+
type: Injectable
|
|
925
|
+
}] });
|
|
926
|
+
|
|
927
|
+
let nextId$1 = 0;
|
|
928
|
+
/**
|
|
929
|
+
* Creates an individual form to display as a section within the sectioned form.
|
|
930
|
+
*/
|
|
931
|
+
class SkySectionedFormSectionComponent {
|
|
932
|
+
#ngUnsubscribe;
|
|
933
|
+
#sectionedFormService;
|
|
934
|
+
#tabsetService;
|
|
935
|
+
#changeRef;
|
|
936
|
+
constructor(sectionedFormService, tabsetService, changeRef) {
|
|
937
|
+
this.sectionTabId = `sky-sectioned-form-tab-${++nextId$1}`;
|
|
938
|
+
this.sectionContentId = `sky-sectioned-form-section-${++nextId$1}`;
|
|
939
|
+
/**
|
|
940
|
+
* Whether the section is active when the form loads.
|
|
941
|
+
* @default false
|
|
942
|
+
*/
|
|
943
|
+
this.active = false;
|
|
944
|
+
this.#ngUnsubscribe = new Subject();
|
|
945
|
+
this.#sectionedFormService = sectionedFormService;
|
|
946
|
+
this.#tabsetService = tabsetService;
|
|
947
|
+
this.#changeRef = changeRef;
|
|
948
|
+
}
|
|
949
|
+
ngOnInit() {
|
|
950
|
+
this.#changeRef.detectChanges();
|
|
951
|
+
this.#tabsetService.switchingMobile.subscribe((mobile) => {
|
|
952
|
+
this.#changeRef.detectChanges();
|
|
953
|
+
});
|
|
954
|
+
this.#sectionedFormService.requiredChange
|
|
955
|
+
.pipe(takeUntil(this.#ngUnsubscribe))
|
|
956
|
+
.subscribe((required) => (this.fieldRequired = required));
|
|
957
|
+
this.#sectionedFormService.invalidChange
|
|
958
|
+
.pipe(takeUntil(this.#ngUnsubscribe))
|
|
959
|
+
.subscribe((invalid) => (this.fieldInvalid = invalid));
|
|
960
|
+
}
|
|
961
|
+
ngOnDestroy() {
|
|
962
|
+
this.#ngUnsubscribe.next();
|
|
963
|
+
this.#ngUnsubscribe.complete();
|
|
964
|
+
}
|
|
965
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySectionedFormSectionComponent, deps: [{ token: SkySectionedFormService }, { token: SkyVerticalTabsetService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
966
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SkySectionedFormSectionComponent, selector: "sky-sectioned-form-section", inputs: { heading: "heading", itemCount: "itemCount", active: "active" }, providers: [SkySectionedFormService], viewQueries: [{ propertyName: "tab", first: true, predicate: SkyVerticalTabComponent, descendants: true }], ngImport: i0, template: "<sky-vertical-tab\n [active]=\"active\"\n [errorIndicator]=\"fieldInvalid\"\n [ngClass]=\"{\n 'sky-tab-field-required': fieldRequired\n }\"\n [showTabRightArrow]=\"true\"\n [tabHeaderCount]=\"itemCount\"\n [tabHeading]=\"heading\"\n [tabId]=\"sectionTabId\"\n>\n <ng-content></ng-content>\n</sky-vertical-tab>\n", styles: [":host .sky-tab-field-required ::ng-deep .sky-vertical-tab-heading:after{content:\"*\";color:var(--sky-highlight-color-danger);padding-left:5px}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: SkyVerticalTabComponent, selector: "sky-vertical-tab", inputs: ["active", "ariaControls", "ariaRole", "disabled", "errorIndicator", "tabHeaderCount", "tabHeading", "showTabRightArrow", "tabId"] }] }); }
|
|
967
|
+
}
|
|
968
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySectionedFormSectionComponent, decorators: [{
|
|
969
|
+
type: Component,
|
|
970
|
+
args: [{ selector: 'sky-sectioned-form-section', providers: [SkySectionedFormService], template: "<sky-vertical-tab\n [active]=\"active\"\n [errorIndicator]=\"fieldInvalid\"\n [ngClass]=\"{\n 'sky-tab-field-required': fieldRequired\n }\"\n [showTabRightArrow]=\"true\"\n [tabHeaderCount]=\"itemCount\"\n [tabHeading]=\"heading\"\n [tabId]=\"sectionTabId\"\n>\n <ng-content></ng-content>\n</sky-vertical-tab>\n", styles: [":host .sky-tab-field-required ::ng-deep .sky-vertical-tab-heading:after{content:\"*\";color:var(--sky-highlight-color-danger);padding-left:5px}\n"] }]
|
|
971
|
+
}], ctorParameters: function () { return [{ type: SkySectionedFormService }, { type: SkyVerticalTabsetService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { heading: [{
|
|
972
|
+
type: Input
|
|
973
|
+
}], itemCount: [{
|
|
974
|
+
type: Input
|
|
975
|
+
}], active: [{
|
|
976
|
+
type: Input
|
|
977
|
+
}], tab: [{
|
|
978
|
+
type: ViewChild,
|
|
979
|
+
args: [SkyVerticalTabComponent]
|
|
980
|
+
}] } });
|
|
981
|
+
|
|
982
|
+
var SkySectionedFormMessageType;
|
|
983
|
+
(function (SkySectionedFormMessageType) {
|
|
984
|
+
SkySectionedFormMessageType[SkySectionedFormMessageType["ShowTabs"] = 1] = "ShowTabs";
|
|
985
|
+
})(SkySectionedFormMessageType || (SkySectionedFormMessageType = {}));
|
|
986
|
+
|
|
987
|
+
/**
|
|
988
|
+
* Creates a container for the sectioned forms.
|
|
989
|
+
*/
|
|
990
|
+
class SkySectionedFormComponent {
|
|
991
|
+
set messageStream(value) {
|
|
992
|
+
this.#_messageStream = value || new Subject();
|
|
993
|
+
this.#initMessageStream();
|
|
994
|
+
}
|
|
995
|
+
get messageStream() {
|
|
996
|
+
return this.#_messageStream;
|
|
997
|
+
}
|
|
998
|
+
#ngUnsubscribe;
|
|
999
|
+
#messageStreamSub;
|
|
1000
|
+
#changeRef;
|
|
1001
|
+
#tabIdSvc;
|
|
1002
|
+
#logger;
|
|
1003
|
+
#_messageStream;
|
|
1004
|
+
constructor(tabService, changeRef, tabIdSvc, logger) {
|
|
1005
|
+
this.tabService = tabService;
|
|
1006
|
+
/**
|
|
1007
|
+
* Whether the sectioned form loads section content during initialization so that it
|
|
1008
|
+
* displays content without moving around elements in the content container.
|
|
1009
|
+
* @default false
|
|
1010
|
+
*/
|
|
1011
|
+
this.maintainSectionContent = false;
|
|
1012
|
+
/**
|
|
1013
|
+
* Fires when the active tab changes and emits the index of the active
|
|
1014
|
+
* section. The index is based on the section's position when the form loads.
|
|
1015
|
+
*/
|
|
1016
|
+
this.indexChanged = new EventEmitter();
|
|
1017
|
+
/**
|
|
1018
|
+
* Fires when the sectioned form tabs are shown or hidden.
|
|
1019
|
+
*/
|
|
1020
|
+
this.tabsVisibleChanged = new EventEmitter();
|
|
1021
|
+
this.ariaRole = 'tablist';
|
|
1022
|
+
this.#ngUnsubscribe = new Subject();
|
|
1023
|
+
this.#_messageStream = new Subject();
|
|
1024
|
+
this.#changeRef = changeRef;
|
|
1025
|
+
this.#tabIdSvc = tabIdSvc;
|
|
1026
|
+
this.#logger = logger;
|
|
1027
|
+
this.#initMessageStream();
|
|
1028
|
+
this.#tabIdSvc.ids.pipe(takeUntil(this.#ngUnsubscribe)).subscribe((ids) => {
|
|
1029
|
+
this.ariaOwns = ids.join(' ') || undefined;
|
|
1030
|
+
this.#changeRef.markForCheck();
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
1033
|
+
ngOnInit() {
|
|
1034
|
+
this.tabService.maintainTabContent = this.maintainSectionContent;
|
|
1035
|
+
this.tabService.indexChanged
|
|
1036
|
+
.pipe(takeUntil(this.#ngUnsubscribe))
|
|
1037
|
+
.subscribe((index) => {
|
|
1038
|
+
this.indexChanged.emit(index);
|
|
1039
|
+
this.#changeRef.markForCheck();
|
|
1040
|
+
});
|
|
1041
|
+
this.tabService.switchingMobile
|
|
1042
|
+
.pipe(takeUntil(this.#ngUnsubscribe))
|
|
1043
|
+
.subscribe((mobile) => {
|
|
1044
|
+
if (!mobile) {
|
|
1045
|
+
this.ariaRole = 'tablist';
|
|
1046
|
+
}
|
|
1047
|
+
else {
|
|
1048
|
+
this.ariaRole = undefined;
|
|
1049
|
+
}
|
|
1050
|
+
this.#changeRef.markForCheck();
|
|
1051
|
+
});
|
|
1052
|
+
this.tabService.hidingTabs
|
|
1053
|
+
.pipe(takeUntil(this.#ngUnsubscribe))
|
|
1054
|
+
.subscribe(() => {
|
|
1055
|
+
this.tabsVisibleChanged.emit(false);
|
|
1056
|
+
});
|
|
1057
|
+
this.tabService.showingTabs
|
|
1058
|
+
.pipe(takeUntil(this.#ngUnsubscribe))
|
|
1059
|
+
.subscribe(() => {
|
|
1060
|
+
this.tabsVisibleChanged.emit(true);
|
|
1061
|
+
});
|
|
1062
|
+
if (this.tabService.isMobile()) {
|
|
1063
|
+
this.ariaRole = undefined;
|
|
1064
|
+
this.tabService.animationContentVisibleState = VISIBLE_STATE;
|
|
1065
|
+
this.#changeRef.markForCheck();
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
ngAfterViewChecked() {
|
|
1069
|
+
this.tabService.content = this.content;
|
|
1070
|
+
this.tabService.updateContent();
|
|
1071
|
+
}
|
|
1072
|
+
ngOnDestroy() {
|
|
1073
|
+
this.#ngUnsubscribe.next();
|
|
1074
|
+
this.#ngUnsubscribe.complete();
|
|
1075
|
+
}
|
|
1076
|
+
/**
|
|
1077
|
+
* @deprecated Use the `tabsVisibleChanged` output to listen for tab visibility changes.
|
|
1078
|
+
*/
|
|
1079
|
+
tabsVisible() {
|
|
1080
|
+
this.#logger.deprecated('SectionedFormComponent.tabsVisible()', {
|
|
1081
|
+
deprecationMajorVersion: 8,
|
|
1082
|
+
moreInfoUrl: 'https://developer.blackbaud.com/skyux/components/sectioned-form',
|
|
1083
|
+
replacementRecommendation: 'Use the `tabsVisibleChanged` output to listen for tab visibility changes.',
|
|
1084
|
+
});
|
|
1085
|
+
this.#changeRef.markForCheck();
|
|
1086
|
+
return this.tabService.tabsVisible();
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* @deprecated Use the `messageStream` input and push a `ShowTabs` message to the message stream instead.
|
|
1090
|
+
*/
|
|
1091
|
+
showTabs() {
|
|
1092
|
+
this.#logger.deprecated('SectionedFormComponent.showTabs()', {
|
|
1093
|
+
deprecationMajorVersion: 8,
|
|
1094
|
+
moreInfoUrl: 'https://developer.blackbaud.com/skyux/components/sectioned-form',
|
|
1095
|
+
replacementRecommendation: 'Use the `messageStream` input and push a `ShowTabs` message to the message stream instead.',
|
|
1096
|
+
});
|
|
1097
|
+
this.#showTabs();
|
|
1098
|
+
}
|
|
1099
|
+
#showTabs() {
|
|
1100
|
+
this.tabService.showTabs();
|
|
1101
|
+
this.#changeRef.markForCheck();
|
|
1102
|
+
}
|
|
1103
|
+
#initMessageStream() {
|
|
1104
|
+
if (this.#messageStreamSub) {
|
|
1105
|
+
this.#messageStreamSub.unsubscribe();
|
|
1106
|
+
}
|
|
1107
|
+
this.#messageStreamSub = this.messageStream
|
|
1108
|
+
.pipe(takeUntil(this.#ngUnsubscribe))
|
|
1109
|
+
.subscribe((message) => {
|
|
1110
|
+
switch (message.type) {
|
|
1111
|
+
case SkySectionedFormMessageType.ShowTabs:
|
|
1112
|
+
this.#showTabs();
|
|
1113
|
+
break;
|
|
1114
|
+
}
|
|
1115
|
+
});
|
|
1116
|
+
}
|
|
1117
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySectionedFormComponent, deps: [{ token: SkyVerticalTabsetService }, { token: i0.ChangeDetectorRef }, { token: SkyTabIdService }, { token: i1.SkyLogService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1118
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SkySectionedFormComponent, selector: "sky-sectioned-form", inputs: { maintainSectionContent: "maintainSectionContent", messageStream: "messageStream" }, outputs: { indexChanged: "indexChanged", tabsVisibleChanged: "tabsVisibleChanged" }, providers: [SkyTabIdService, SkyVerticalTabsetService], viewQueries: [{ propertyName: "content", first: true, predicate: ["skySectionSideContent"], descendants: true }], ngImport: i0, template: "<div class=\"sky-sectioned-form\" (window:resize)=\"tabService.updateContent()\">\n <!--\n ARIA rules do not allow tabpanel elements to be children of a tablist element.\n However, the markup for each sky-vertical-tab component includes both the tab button\n and its panel, making the panel element a child of its tablist. Moreover, our\n sky-vertical-tab components can be grouped within collapsible containers, which also\n violates accessibility rules because only tab buttons can be children of a tablist.\n To address this, we create an empty tablist element with an aria-owns attribute,\n pointing to each tab element individually. That way, we don't have to worry about the\n structure for each sky-vertical-tab component in order to satisfy accessibility\n guidelines.\n -->\n <span\n aria-orientation=\"vertical\"\n [attr.aria-owns]=\"ariaOwns\"\n [attr.role]=\"ariaRole\"\n ></span>\n <div\n *ngIf=\"maintainSectionContent || tabsVisible()\"\n class=\"sky-sectioned-form-tabs\"\n [ngClass]=\"{ 'sky-sectioned-form-tabs-hidden': !tabsVisible() }\"\n [@tabEnter]=\"tabService.animationTabsVisibleState\"\n >\n <ng-content></ng-content>\n </div>\n <div\n *ngIf=\"maintainSectionContent || tabService.contentVisible()\"\n class=\"sky-sectioned-form-content\"\n [ngClass]=\"{\n 'sky-sectioned-form-content-hidden': !tabService.contentVisible()\n }\"\n [@contentEnter]=\"tabService.animationContentVisibleState\"\n #skySectionSideContent\n ></div>\n</div>\n", styles: [":host .sky-sectioned-form{display:block;max-height:none}:host .sky-sectioned-form-content{flex-basis:auto;overflow-y:visible}:host .sky-sectioned-form-tabs{flex-basis:auto;overflow-y:visible;border-right:1px solid #e2e3e4}:host-context(.sky-responsive-container-xs) .sky-sectioned-form,:host-context(.sky-responsive-container-sm) .sky-sectioned-form,:host-context(.sky-responsive-container-md) .sky-sectioned-form,:host-context(.sky-responsive-container-lg) .sky-sectioned-form{display:block;max-height:none}:host-context(.sky-responsive-container-xs) .sky-sectioned-form-content,:host-context(.sky-responsive-container-sm) .sky-sectioned-form-content,:host-context(.sky-responsive-container-md) .sky-sectioned-form-content,:host-context(.sky-responsive-container-lg) .sky-sectioned-form-content{flex-basis:auto;overflow-y:visible}:host-context(.sky-responsive-container-xs) .sky-sectioned-form-tabs,:host-context(.sky-responsive-container-sm) .sky-sectioned-form-tabs,:host-context(.sky-responsive-container-md) .sky-sectioned-form-tabs,:host-context(.sky-responsive-container-lg) .sky-sectioned-form-tabs{flex-basis:auto;overflow-y:visible;border-right:1px solid #e2e3e4}@media (min-width: 768px){:host .sky-sectioned-form{display:flex;max-height:100%}:host .sky-sectioned-form-content{flex-basis:70%;padding:15px;overflow-y:auto}:host .sky-sectioned-form-tabs{flex-basis:30%;overflow-y:auto}}:host-context(.sky-responsive-container-sm) .sky-sectioned-form,:host-context(.sky-responsive-container-md) .sky-sectioned-form,:host-context(.sky-responsive-container-lg) .sky-sectioned-form{display:flex;max-height:100%}:host-context(.sky-responsive-container-sm) .sky-sectioned-form-content,:host-context(.sky-responsive-container-md) .sky-sectioned-form-content,:host-context(.sky-responsive-container-lg) .sky-sectioned-form-content{flex-basis:70%;padding:15px;overflow-y:auto}:host-context(.sky-responsive-container-sm) .sky-sectioned-form-tabs,:host-context(.sky-responsive-container-md) .sky-sectioned-form-tabs,:host-context(.sky-responsive-container-lg) .sky-sectioned-form-tabs{flex-basis:30%;overflow-y:auto}.sky-sectioned-form-tabs-hidden,.sky-sectioned-form-content-hidden{display:none}:host-context(.sky-theme-modern) .sky-sectioned-form-content{padding:15px}:host-context(.sky-theme-modern) .sky-sectioned-form-tabs{border-right:1px solid #d2d2d2}@media (min-width: 768px){:host-context(.sky-theme-modern) :host .sky-sectioned-form-content{margin:20px 30px}}:host-context(.sky-theme-modern) :host-context(.sky-responsive-container-sm) .sky-sectioned-form-content,:host-context(.sky-theme-modern) :host-context(.sky-responsive-container-md) .sky-sectioned-form-content,:host-context(.sky-theme-modern) :host-context(.sky-responsive-container-lg) .sky-sectioned-form-content{margin:20px 30px}.sky-theme-modern .sky-sectioned-form-content{padding:15px}.sky-theme-modern .sky-sectioned-form-tabs{border-right:1px solid #d2d2d2}@media (min-width: 768px){.sky-theme-modern :host .sky-sectioned-form-content{margin:20px 30px}}.sky-theme-modern :host-context(.sky-responsive-container-sm) .sky-sectioned-form-content,.sky-theme-modern :host-context(.sky-responsive-container-md) .sky-sectioned-form-content,.sky-theme-modern :host-context(.sky-responsive-container-lg) .sky-sectioned-form-content{margin:20px 30px}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], animations: [
|
|
1119
|
+
trigger('tabEnter', [
|
|
1120
|
+
transition(`${HIDDEN_STATE} => ${VISIBLE_STATE}`, [
|
|
1121
|
+
style({ transform: 'translate(-100%)' }),
|
|
1122
|
+
animate('150ms ease-in'),
|
|
1123
|
+
]),
|
|
1124
|
+
]),
|
|
1125
|
+
trigger('contentEnter', [
|
|
1126
|
+
transition(`${HIDDEN_STATE} => ${VISIBLE_STATE}`, [
|
|
1127
|
+
style({ transform: 'translate(100%)' }),
|
|
1128
|
+
animate('150ms ease-in'),
|
|
1129
|
+
]),
|
|
1130
|
+
]),
|
|
1131
|
+
], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1132
|
+
}
|
|
1133
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySectionedFormComponent, decorators: [{
|
|
1134
|
+
type: Component,
|
|
1135
|
+
args: [{ selector: 'sky-sectioned-form', providers: [SkyTabIdService, SkyVerticalTabsetService], changeDetection: ChangeDetectionStrategy.OnPush, animations: [
|
|
1136
|
+
trigger('tabEnter', [
|
|
1137
|
+
transition(`${HIDDEN_STATE} => ${VISIBLE_STATE}`, [
|
|
1138
|
+
style({ transform: 'translate(-100%)' }),
|
|
1139
|
+
animate('150ms ease-in'),
|
|
1140
|
+
]),
|
|
1141
|
+
]),
|
|
1142
|
+
trigger('contentEnter', [
|
|
1143
|
+
transition(`${HIDDEN_STATE} => ${VISIBLE_STATE}`, [
|
|
1144
|
+
style({ transform: 'translate(100%)' }),
|
|
1145
|
+
animate('150ms ease-in'),
|
|
1146
|
+
]),
|
|
1147
|
+
]),
|
|
1148
|
+
], template: "<div class=\"sky-sectioned-form\" (window:resize)=\"tabService.updateContent()\">\n <!--\n ARIA rules do not allow tabpanel elements to be children of a tablist element.\n However, the markup for each sky-vertical-tab component includes both the tab button\n and its panel, making the panel element a child of its tablist. Moreover, our\n sky-vertical-tab components can be grouped within collapsible containers, which also\n violates accessibility rules because only tab buttons can be children of a tablist.\n To address this, we create an empty tablist element with an aria-owns attribute,\n pointing to each tab element individually. That way, we don't have to worry about the\n structure for each sky-vertical-tab component in order to satisfy accessibility\n guidelines.\n -->\n <span\n aria-orientation=\"vertical\"\n [attr.aria-owns]=\"ariaOwns\"\n [attr.role]=\"ariaRole\"\n ></span>\n <div\n *ngIf=\"maintainSectionContent || tabsVisible()\"\n class=\"sky-sectioned-form-tabs\"\n [ngClass]=\"{ 'sky-sectioned-form-tabs-hidden': !tabsVisible() }\"\n [@tabEnter]=\"tabService.animationTabsVisibleState\"\n >\n <ng-content></ng-content>\n </div>\n <div\n *ngIf=\"maintainSectionContent || tabService.contentVisible()\"\n class=\"sky-sectioned-form-content\"\n [ngClass]=\"{\n 'sky-sectioned-form-content-hidden': !tabService.contentVisible()\n }\"\n [@contentEnter]=\"tabService.animationContentVisibleState\"\n #skySectionSideContent\n ></div>\n</div>\n", styles: [":host .sky-sectioned-form{display:block;max-height:none}:host .sky-sectioned-form-content{flex-basis:auto;overflow-y:visible}:host .sky-sectioned-form-tabs{flex-basis:auto;overflow-y:visible;border-right:1px solid #e2e3e4}:host-context(.sky-responsive-container-xs) .sky-sectioned-form,:host-context(.sky-responsive-container-sm) .sky-sectioned-form,:host-context(.sky-responsive-container-md) .sky-sectioned-form,:host-context(.sky-responsive-container-lg) .sky-sectioned-form{display:block;max-height:none}:host-context(.sky-responsive-container-xs) .sky-sectioned-form-content,:host-context(.sky-responsive-container-sm) .sky-sectioned-form-content,:host-context(.sky-responsive-container-md) .sky-sectioned-form-content,:host-context(.sky-responsive-container-lg) .sky-sectioned-form-content{flex-basis:auto;overflow-y:visible}:host-context(.sky-responsive-container-xs) .sky-sectioned-form-tabs,:host-context(.sky-responsive-container-sm) .sky-sectioned-form-tabs,:host-context(.sky-responsive-container-md) .sky-sectioned-form-tabs,:host-context(.sky-responsive-container-lg) .sky-sectioned-form-tabs{flex-basis:auto;overflow-y:visible;border-right:1px solid #e2e3e4}@media (min-width: 768px){:host .sky-sectioned-form{display:flex;max-height:100%}:host .sky-sectioned-form-content{flex-basis:70%;padding:15px;overflow-y:auto}:host .sky-sectioned-form-tabs{flex-basis:30%;overflow-y:auto}}:host-context(.sky-responsive-container-sm) .sky-sectioned-form,:host-context(.sky-responsive-container-md) .sky-sectioned-form,:host-context(.sky-responsive-container-lg) .sky-sectioned-form{display:flex;max-height:100%}:host-context(.sky-responsive-container-sm) .sky-sectioned-form-content,:host-context(.sky-responsive-container-md) .sky-sectioned-form-content,:host-context(.sky-responsive-container-lg) .sky-sectioned-form-content{flex-basis:70%;padding:15px;overflow-y:auto}:host-context(.sky-responsive-container-sm) .sky-sectioned-form-tabs,:host-context(.sky-responsive-container-md) .sky-sectioned-form-tabs,:host-context(.sky-responsive-container-lg) .sky-sectioned-form-tabs{flex-basis:30%;overflow-y:auto}.sky-sectioned-form-tabs-hidden,.sky-sectioned-form-content-hidden{display:none}:host-context(.sky-theme-modern) .sky-sectioned-form-content{padding:15px}:host-context(.sky-theme-modern) .sky-sectioned-form-tabs{border-right:1px solid #d2d2d2}@media (min-width: 768px){:host-context(.sky-theme-modern) :host .sky-sectioned-form-content{margin:20px 30px}}:host-context(.sky-theme-modern) :host-context(.sky-responsive-container-sm) .sky-sectioned-form-content,:host-context(.sky-theme-modern) :host-context(.sky-responsive-container-md) .sky-sectioned-form-content,:host-context(.sky-theme-modern) :host-context(.sky-responsive-container-lg) .sky-sectioned-form-content{margin:20px 30px}.sky-theme-modern .sky-sectioned-form-content{padding:15px}.sky-theme-modern .sky-sectioned-form-tabs{border-right:1px solid #d2d2d2}@media (min-width: 768px){.sky-theme-modern :host .sky-sectioned-form-content{margin:20px 30px}}.sky-theme-modern :host-context(.sky-responsive-container-sm) .sky-sectioned-form-content,.sky-theme-modern :host-context(.sky-responsive-container-md) .sky-sectioned-form-content,.sky-theme-modern :host-context(.sky-responsive-container-lg) .sky-sectioned-form-content{margin:20px 30px}\n"] }]
|
|
1149
|
+
}], ctorParameters: function () { return [{ type: SkyVerticalTabsetService }, { type: i0.ChangeDetectorRef }, { type: SkyTabIdService }, { type: i1.SkyLogService }]; }, propDecorators: { maintainSectionContent: [{
|
|
1150
|
+
type: Input
|
|
1151
|
+
}], messageStream: [{
|
|
1152
|
+
type: Input
|
|
1153
|
+
}], indexChanged: [{
|
|
1154
|
+
type: Output
|
|
1155
|
+
}], tabsVisibleChanged: [{
|
|
1156
|
+
type: Output
|
|
1157
|
+
}], content: [{
|
|
1158
|
+
type: ViewChild,
|
|
1159
|
+
args: ['skySectionSideContent']
|
|
1160
|
+
}] } });
|
|
1161
|
+
|
|
1162
|
+
class SkySectionedFormModule {
|
|
1163
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySectionedFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1164
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SkySectionedFormModule, declarations: [SkySectionedFormComponent, SkySectionedFormSectionComponent], imports: [CommonModule,
|
|
1165
|
+
SkyCheckboxModule,
|
|
1166
|
+
SkyThemeModule,
|
|
1167
|
+
SkyVerticalTabsetModule], exports: [SkySectionedFormComponent, SkySectionedFormSectionComponent] }); }
|
|
1168
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySectionedFormModule, imports: [CommonModule,
|
|
1169
|
+
SkyCheckboxModule,
|
|
1170
|
+
SkyThemeModule,
|
|
1171
|
+
SkyVerticalTabsetModule] }); }
|
|
1172
|
+
}
|
|
1173
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySectionedFormModule, decorators: [{
|
|
1174
|
+
type: NgModule,
|
|
1175
|
+
args: [{
|
|
1176
|
+
declarations: [SkySectionedFormComponent, SkySectionedFormSectionComponent],
|
|
1177
|
+
imports: [
|
|
1178
|
+
CommonModule,
|
|
1179
|
+
SkyCheckboxModule,
|
|
1180
|
+
SkyThemeModule,
|
|
1181
|
+
SkyVerticalTabsetModule,
|
|
1182
|
+
],
|
|
1183
|
+
exports: [SkySectionedFormComponent, SkySectionedFormSectionComponent],
|
|
1184
|
+
}]
|
|
1185
|
+
}] });
|
|
1186
|
+
|
|
1187
|
+
/**
|
|
1188
|
+
* @internal
|
|
1189
|
+
*/
|
|
1190
|
+
class SkyTabButtonAdapterService {
|
|
1191
|
+
focusButtonLink(buttonEl) {
|
|
1192
|
+
buttonEl.nativeElement.querySelector('a').focus();
|
|
1193
|
+
}
|
|
1194
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabButtonAdapterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1195
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabButtonAdapterService }); }
|
|
1196
|
+
}
|
|
1197
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabButtonAdapterService, decorators: [{
|
|
1198
|
+
type: Injectable
|
|
1199
|
+
}] });
|
|
1200
|
+
|
|
1201
|
+
/**
|
|
1202
|
+
* @internal
|
|
1203
|
+
*/
|
|
1204
|
+
class SkyTabsetService {
|
|
1205
|
+
get activeTabUnregistered() {
|
|
1206
|
+
return this.#activeTabUnregistered;
|
|
1207
|
+
}
|
|
1208
|
+
get activeTabIndex() {
|
|
1209
|
+
return this.#activeTabIndex;
|
|
1210
|
+
}
|
|
1211
|
+
get focusedTabBtnIndex() {
|
|
1212
|
+
return this.#focusedTabBtnIndex;
|
|
1213
|
+
}
|
|
1214
|
+
get activeTabLayout() {
|
|
1215
|
+
return this.#activeTabLayout;
|
|
1216
|
+
}
|
|
1217
|
+
#activeTabIndex;
|
|
1218
|
+
#focusedTabBtnIndex;
|
|
1219
|
+
#activeTabUnregistered;
|
|
1220
|
+
#activeTabLayout;
|
|
1221
|
+
#tabs;
|
|
1222
|
+
#tabCounter;
|
|
1223
|
+
constructor() {
|
|
1224
|
+
this.currentActiveTabIndex = 0;
|
|
1225
|
+
this.currentFocusedTabBtnIndex = 0;
|
|
1226
|
+
this.#activeTabLayout = new Subject();
|
|
1227
|
+
this.#tabs = [];
|
|
1228
|
+
this.#tabCounter = 0;
|
|
1229
|
+
this.#activeTabIndex = new BehaviorSubject(0);
|
|
1230
|
+
this.#activeTabUnregistered =
|
|
1231
|
+
new Subject();
|
|
1232
|
+
this.#focusedTabBtnIndex = new Subject();
|
|
1233
|
+
}
|
|
1234
|
+
ngOnDestroy() {
|
|
1235
|
+
this.#activeTabIndex.complete();
|
|
1236
|
+
this.#activeTabUnregistered.complete();
|
|
1237
|
+
this.#focusedTabBtnIndex.complete();
|
|
1238
|
+
this.#activeTabLayout.complete();
|
|
1239
|
+
}
|
|
1240
|
+
/**
|
|
1241
|
+
* Sets the active tab by its unique `tabIndex` property.
|
|
1242
|
+
*/
|
|
1243
|
+
setActiveTabIndex(value, config = {
|
|
1244
|
+
emitChange: true,
|
|
1245
|
+
}) {
|
|
1246
|
+
if (value !== undefined &&
|
|
1247
|
+
!this.tabIndexesEqual(value, this.currentActiveTabIndex)) {
|
|
1248
|
+
this.currentActiveTabIndex = value;
|
|
1249
|
+
/* istanbul ignore else */
|
|
1250
|
+
if (config.emitChange) {
|
|
1251
|
+
this.#activeTabIndex.next(value);
|
|
1252
|
+
}
|
|
1253
|
+
this.setFocusedTabBtnIndex(value);
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
focusNextTabBtn(tabButtons) {
|
|
1257
|
+
const currentTabArrayIndex = this.#tabs.findIndex((tab) => this.tabIndexesEqual(tab.tabIndex, this.currentFocusedTabBtnIndex));
|
|
1258
|
+
for (let i = this.#getNextTabArrayIndex(currentTabArrayIndex); i !== currentTabArrayIndex; i = this.#getNextTabArrayIndex(i)) {
|
|
1259
|
+
const tabBtn = tabButtons[i];
|
|
1260
|
+
if (!tabBtn.disabled && tabBtn.tabIndex !== undefined) {
|
|
1261
|
+
this.setFocusedTabBtnIndex(tabBtn.tabIndex);
|
|
1262
|
+
return;
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
focusPrevTabBtn(tabButtons) {
|
|
1267
|
+
const currentTabArrayIndex = this.#tabs.findIndex((tab) => this.tabIndexesEqual(tab.tabIndex, this.currentFocusedTabBtnIndex));
|
|
1268
|
+
for (let i = this.#getPrevTabArrayIndex(currentTabArrayIndex); i !== currentTabArrayIndex; i = this.#getPrevTabArrayIndex(i)) {
|
|
1269
|
+
const tabBtn = tabButtons[i];
|
|
1270
|
+
if (!tabBtn.disabled && tabBtn.tabIndex !== undefined) {
|
|
1271
|
+
this.setFocusedTabBtnIndex(tabBtn.tabIndex);
|
|
1272
|
+
return;
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
focusFirstOrNearestTabBtn(tabButtons) {
|
|
1277
|
+
for (let i = 0; i < tabButtons.length; i++) {
|
|
1278
|
+
const tabBtn = tabButtons[i];
|
|
1279
|
+
if (!tabBtn.disabled && tabBtn.tabIndex !== undefined) {
|
|
1280
|
+
this.setFocusedTabBtnIndex(tabBtn.tabIndex);
|
|
1281
|
+
return;
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
focusLastOrNearestTabBtn(tabButtons) {
|
|
1286
|
+
for (let i = tabButtons.length - 1; i >= 0; i--) {
|
|
1287
|
+
const tabBtn = tabButtons[i];
|
|
1288
|
+
if (!tabBtn.disabled && tabBtn.tabIndex !== undefined) {
|
|
1289
|
+
this.setFocusedTabBtnIndex(tabBtn.tabIndex);
|
|
1290
|
+
return;
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
setFocusedTabBtnIndex(tabIndex) {
|
|
1295
|
+
this.currentFocusedTabBtnIndex = tabIndex;
|
|
1296
|
+
this.#focusedTabBtnIndex.next(tabIndex);
|
|
1297
|
+
}
|
|
1298
|
+
/**
|
|
1299
|
+
* Registers a tab component.
|
|
1300
|
+
*/
|
|
1301
|
+
registerTab(tabIndex) {
|
|
1302
|
+
if (tabIndex === undefined) {
|
|
1303
|
+
tabIndex = this.#tabCounter;
|
|
1304
|
+
this.#tabCounter++;
|
|
1305
|
+
}
|
|
1306
|
+
this.#tabs.push({ tabIndex });
|
|
1307
|
+
return tabIndex;
|
|
1308
|
+
}
|
|
1309
|
+
updateTabIndex(currentTabIndex, newTabIndex) {
|
|
1310
|
+
const found = this.#tabs.find((tab) => this.tabIndexesEqual(tab.tabIndex, currentTabIndex));
|
|
1311
|
+
if (found) {
|
|
1312
|
+
found.tabIndex = newTabIndex;
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
updateActiveTabLayout(layout) {
|
|
1316
|
+
this.#activeTabLayout.next(layout);
|
|
1317
|
+
}
|
|
1318
|
+
/**
|
|
1319
|
+
* Unregisters a tab component.
|
|
1320
|
+
*/
|
|
1321
|
+
unregisterTab(tabIndex) {
|
|
1322
|
+
const index = this.#tabs.findIndex((tab) => this.tabIndexesEqual(tab.tabIndex, tabIndex));
|
|
1323
|
+
// Notify the tabset component when an active tab is unregistered.
|
|
1324
|
+
if (this.#isTabIndexActive(this.#tabs[index]?.tabIndex)) {
|
|
1325
|
+
this.#activeTabUnregistered.next({
|
|
1326
|
+
arrayIndex: index,
|
|
1327
|
+
});
|
|
1328
|
+
}
|
|
1329
|
+
this.#tabs.splice(index, 1);
|
|
1330
|
+
}
|
|
1331
|
+
/**
|
|
1332
|
+
* Unregisters all tab components at once.
|
|
1333
|
+
*/
|
|
1334
|
+
unregisterAll() {
|
|
1335
|
+
this.#tabs = [];
|
|
1336
|
+
}
|
|
1337
|
+
/**
|
|
1338
|
+
* Compares two tab indexes and returns `true` if they are equal.
|
|
1339
|
+
*/
|
|
1340
|
+
tabIndexesEqual(tabIndex1, tabIndex2) {
|
|
1341
|
+
return (tabIndex1 === tabIndex2 ||
|
|
1342
|
+
(tabIndex1 !== undefined &&
|
|
1343
|
+
tabIndex2 !== undefined &&
|
|
1344
|
+
+tabIndex1 === +tabIndex2));
|
|
1345
|
+
}
|
|
1346
|
+
/**
|
|
1347
|
+
* Verifies if a provided tab index is registered.
|
|
1348
|
+
*/
|
|
1349
|
+
isValidTabIndex(tabIndex) {
|
|
1350
|
+
return this.#tabs.some((tab) => this.tabIndexesEqual(tab.tabIndex, tabIndex));
|
|
1351
|
+
}
|
|
1352
|
+
/**
|
|
1353
|
+
* Activates the first registered tab.
|
|
1354
|
+
*/
|
|
1355
|
+
activateFirstTab() {
|
|
1356
|
+
const firstTabIndex = this.#tabs[0] && this.#tabs[0].tabIndex;
|
|
1357
|
+
if (firstTabIndex !== undefined) {
|
|
1358
|
+
this.setActiveTabIndex(firstTabIndex);
|
|
1359
|
+
return firstTabIndex;
|
|
1360
|
+
}
|
|
1361
|
+
return undefined;
|
|
1362
|
+
}
|
|
1363
|
+
/**
|
|
1364
|
+
* Activates the next registered tab, or the previous one based on a provided array index.
|
|
1365
|
+
*/
|
|
1366
|
+
activateNearestTab(arrayIndex) {
|
|
1367
|
+
const newActiveTab = this.#tabs[arrayIndex] || this.#tabs[arrayIndex - 1];
|
|
1368
|
+
if (newActiveTab) {
|
|
1369
|
+
this.currentActiveTabIndex = newActiveTab.tabIndex;
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
#isTabIndexActive(tabIndex) {
|
|
1373
|
+
return this.tabIndexesEqual(tabIndex, this.currentActiveTabIndex);
|
|
1374
|
+
}
|
|
1375
|
+
#getNextTabArrayIndex(currentIndex) {
|
|
1376
|
+
let nextIndex = currentIndex + 1;
|
|
1377
|
+
if (nextIndex === this.#tabs.length) {
|
|
1378
|
+
nextIndex = 0;
|
|
1379
|
+
}
|
|
1380
|
+
return nextIndex;
|
|
1381
|
+
}
|
|
1382
|
+
#getPrevTabArrayIndex(currentIndex) {
|
|
1383
|
+
let prevIndex = currentIndex - 1;
|
|
1384
|
+
if (prevIndex < 0) {
|
|
1385
|
+
prevIndex = this.#tabs.length - 1;
|
|
1386
|
+
}
|
|
1387
|
+
return prevIndex;
|
|
1388
|
+
}
|
|
1389
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabsetService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1390
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabsetService }); }
|
|
1391
|
+
}
|
|
1392
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabsetService, decorators: [{
|
|
1393
|
+
type: Injectable
|
|
1394
|
+
}], ctorParameters: function () { return []; } });
|
|
1395
|
+
|
|
1396
|
+
const DEFAULT_DISABLED = false;
|
|
1397
|
+
/**
|
|
1398
|
+
* @internal
|
|
1399
|
+
*/
|
|
1400
|
+
class SkyTabButtonComponent {
|
|
1401
|
+
get active() {
|
|
1402
|
+
return this.#_isActive;
|
|
1403
|
+
}
|
|
1404
|
+
set active(value) {
|
|
1405
|
+
this.#_isActive = value;
|
|
1406
|
+
this.#updateWizardStepState();
|
|
1407
|
+
}
|
|
1408
|
+
get disabled() {
|
|
1409
|
+
return this.#_isDisabled;
|
|
1410
|
+
}
|
|
1411
|
+
set disabled(value) {
|
|
1412
|
+
this.#_isDisabled = value ?? DEFAULT_DISABLED;
|
|
1413
|
+
this.#updateWizardStepState();
|
|
1414
|
+
}
|
|
1415
|
+
get tabStyle() {
|
|
1416
|
+
return this.#_tabStyle;
|
|
1417
|
+
}
|
|
1418
|
+
set tabStyle(style) {
|
|
1419
|
+
this.#_tabStyle = style;
|
|
1420
|
+
this.#updateWizardStepState();
|
|
1421
|
+
}
|
|
1422
|
+
constructor(elementRef, adapterService, changeDetectorRef, tabsetService) {
|
|
1423
|
+
this.buttonClick = new EventEmitter();
|
|
1424
|
+
this.closeClick = new EventEmitter();
|
|
1425
|
+
this.closeBtnTabIndex = '-1';
|
|
1426
|
+
this.#_isActive = false;
|
|
1427
|
+
this.#_isDisabled = DEFAULT_DISABLED;
|
|
1428
|
+
this.#ngUnsubscribe = new Subject();
|
|
1429
|
+
this.#adapterService = adapterService;
|
|
1430
|
+
this.#changeDetectorRef = changeDetectorRef;
|
|
1431
|
+
this.#elementRef = elementRef;
|
|
1432
|
+
this.#tabsetService = tabsetService;
|
|
1433
|
+
}
|
|
1434
|
+
#_isActive;
|
|
1435
|
+
#_isDisabled;
|
|
1436
|
+
#_tabStyle;
|
|
1437
|
+
#adapterService;
|
|
1438
|
+
#changeDetectorRef;
|
|
1439
|
+
#elementRef;
|
|
1440
|
+
#tabsetService;
|
|
1441
|
+
#ngUnsubscribe;
|
|
1442
|
+
ngAfterViewInit() {
|
|
1443
|
+
this.#tabsetService.focusedTabBtnIndex
|
|
1444
|
+
.pipe(distinctUntilChanged(), takeUntil(this.#ngUnsubscribe))
|
|
1445
|
+
.subscribe((focusedIndex) => {
|
|
1446
|
+
if (this.tabIndex !== undefined && focusedIndex === this.tabIndex) {
|
|
1447
|
+
this.closeBtnTabIndex = '0';
|
|
1448
|
+
this.focusBtn();
|
|
1449
|
+
}
|
|
1450
|
+
else {
|
|
1451
|
+
this.closeBtnTabIndex = '-1';
|
|
1452
|
+
}
|
|
1453
|
+
this.#changeDetectorRef.markForCheck();
|
|
1454
|
+
});
|
|
1455
|
+
}
|
|
1456
|
+
ngOnDestroy() {
|
|
1457
|
+
this.#ngUnsubscribe.next();
|
|
1458
|
+
this.#ngUnsubscribe.complete();
|
|
1459
|
+
}
|
|
1460
|
+
onButtonClick(event) {
|
|
1461
|
+
if (!this.disabled) {
|
|
1462
|
+
this.buttonClick.emit();
|
|
1463
|
+
event.preventDefault();
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
onTabButtonKeyDown(event) {
|
|
1467
|
+
/*istanbul ignore else */
|
|
1468
|
+
if (event.key) {
|
|
1469
|
+
switch (event.key.toUpperCase()) {
|
|
1470
|
+
case ' ':
|
|
1471
|
+
case 'ENTER':
|
|
1472
|
+
this.onButtonClick(event);
|
|
1473
|
+
break;
|
|
1474
|
+
/* istanbul ignore next */
|
|
1475
|
+
default:
|
|
1476
|
+
break;
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
onCloseClick(event) {
|
|
1481
|
+
this.closeClick.emit();
|
|
1482
|
+
// Prevent the click event from bubbling up to the anchor tag;
|
|
1483
|
+
// otherwise it will trigger a page refresh.
|
|
1484
|
+
event.stopPropagation();
|
|
1485
|
+
event.preventDefault();
|
|
1486
|
+
}
|
|
1487
|
+
focusBtn() {
|
|
1488
|
+
this.#adapterService.focusButtonLink(this.#elementRef);
|
|
1489
|
+
}
|
|
1490
|
+
onFocus() {
|
|
1491
|
+
if (this.tabIndex !== undefined) {
|
|
1492
|
+
this.#tabsetService.setFocusedTabBtnIndex(this.tabIndex);
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
#updateWizardStepState() {
|
|
1496
|
+
if (this.tabStyle === 'tabs') {
|
|
1497
|
+
this.wizardStepState = undefined;
|
|
1498
|
+
}
|
|
1499
|
+
else {
|
|
1500
|
+
if (this.active) {
|
|
1501
|
+
this.wizardStepState = 'current';
|
|
1502
|
+
}
|
|
1503
|
+
else if (!this.disabled) {
|
|
1504
|
+
this.wizardStepState = 'completed';
|
|
1505
|
+
}
|
|
1506
|
+
else {
|
|
1507
|
+
this.wizardStepState = 'unavailable';
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
this.#changeDetectorRef.markForCheck();
|
|
1511
|
+
}
|
|
1512
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabButtonComponent, deps: [{ token: i0.ElementRef }, { token: SkyTabButtonAdapterService }, { token: i0.ChangeDetectorRef }, { token: SkyTabsetService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1513
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SkyTabButtonComponent, selector: "sky-tab-button", inputs: { active: "active", ariaControls: "ariaControls", buttonHref: "buttonHref", buttonId: "buttonId", buttonText: "buttonText", buttonTextCount: "buttonTextCount", closeable: "closeable", disabled: "disabled", tabIndex: "tabIndex", tabNumber: "tabNumber", totalTabsCount: "totalTabsCount", tabStyle: "tabStyle" }, outputs: { buttonClick: "buttonClick", closeClick: "closeClick" }, providers: [SkyTabButtonAdapterService], ngImport: i0, template: "<div\n class=\"sky-btn-tab-wrapper\"\n [ngClass]=\"{\n 'sky-btn-tab-wrapper-selected': active,\n 'sky-btn-tab-wrapper-disabled': disabled\n }\"\n>\n <a\n #tabButtonEl\n class=\"sky-btn-tab\"\n role=\"tab\"\n [attr.aria-controls]=\"ariaControls\"\n [attr.aria-disabled]=\"disabled\"\n [attr.aria-selected]=\"active\"\n [attr.href]=\"buttonHref\"\n [attr.aria-label]=\"\n (tabStyle === 'wizard'\n ? 'skyux_wizard_sr_step_' + wizardStepState\n : 'skyux_tabs_sr_tab_order'\n ) | skyLibResources : tabNumber : totalTabsCount : buttonText\n \"\n [id]=\"buttonId\"\n [ngClass]=\"{\n 'sky-btn-tab-wizard': tabStyle === 'wizard',\n 'sky-btn-tab-selected': active,\n 'sky-btn-tab-disabled': disabled,\n 'sky-tab-btn-closeable': closeable\n }\"\n [tabindex]=\"active ? '0' : '-1'\"\n (click)=\"onButtonClick($event)\"\n (keydown)=\"onTabButtonKeyDown($event)\"\n (focus)=\"onFocus()\"\n >\n <span class=\"sky-tab-heading\" [attr.aria-hidden]=\"true\">\n {{ buttonText }}\n <span *ngIf=\"buttonTextCount !== undefined\" class=\"sky-tab-header-count\">\n {{ buttonTextCount }}\n </span>\n <span\n *ngIf=\"closeable\"\n class=\"sky-btn-tab-close\"\n [tabindex]=\"closeBtnTabIndex\"\n [attr.aria-label]=\"'skyux_tab_close' | skyLibResources : buttonText\"\n [ngClass]=\"{\n 'sky-btn-tab-close-disabled': disabled\n }\"\n (click)=\"onCloseClick($event)\"\n (keydown.enter)=\"onCloseClick($event)\"\n >\n <sky-icon icon=\"remove\"></sky-icon>\n </span>\n </span>\n </a>\n</div>\n", styles: [".sky-btn-tab-wrapper{display:inline-block;position:relative;margin-right:5px}.sky-btn-tab-wrapper .sky-btn-tab-close{position:absolute;top:10px;right:10px;color:#686c73;padding:1px 6px}.sky-btn-tab-wrapper .sky-btn-tab-close:hover{color:#212327;transition:color .15s}.sky-btn-tab-wrapper.sky-btn-tab-wrapper-selected:not(.sky-btn-tab-wrapper-disabled) .sky-btn-tab-close{color:#fff}.sky-btn-tab-wrapper.sky-btn-tab-wrapper-disabled{cursor:not-allowed}.sky-tab-btn-closeable{padding-right:43px}:host-context(.sky-theme-modern) .sky-btn-tab-wrapper{margin-right:10px}:host-context(.sky-theme-modern) .sky-btn-tab-wrapper .sky-btn-tab-close{top:12px;right:10px}:host-context(.sky-theme-modern) .sky-btn-tab-wrapper.sky-btn-tab-wrapper-selected:not(.sky-btn-tab-wrapper-disabled) .sky-btn-tab-close{color:#686c73}:host-context(.sky-theme-modern) .sky-tab-btn-closeable{padding-right:44px}.sky-theme-modern .sky-btn-tab-wrapper{margin-right:10px}.sky-theme-modern .sky-btn-tab-wrapper .sky-btn-tab-close{top:12px;right:10px}.sky-theme-modern .sky-btn-tab-wrapper.sky-btn-tab-wrapper-selected:not(.sky-btn-tab-wrapper-disabled) .sky-btn-tab-close{color:#686c73}.sky-theme-modern .sky-tab-btn-closeable{padding-right:44px}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-btn-tab-wrapper .sky-btn-tab-close{color:#eeeeef}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-btn-tab-wrapper.sky-btn-tab-wrapper-selected:not(.sky-btn-tab-wrapper-disabled) .sky-btn-tab-close{color:#eeeeef}.sky-theme-modern.sky-theme-mode-dark .sky-btn-tab-wrapper .sky-btn-tab-close{color:#eeeeef}.sky-theme-modern.sky-theme-mode-dark .sky-btn-tab-wrapper.sky-btn-tab-wrapper-selected:not(.sky-btn-tab-wrapper-disabled) .sky-btn-tab-close{color:#eeeeef}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i6.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { kind: "pipe", type: i3.SkyLibResourcesPipe, name: "skyLibResources" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1514
|
+
}
|
|
1515
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabButtonComponent, decorators: [{
|
|
1516
|
+
type: Component,
|
|
1517
|
+
args: [{ selector: 'sky-tab-button', providers: [SkyTabButtonAdapterService], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<div\n class=\"sky-btn-tab-wrapper\"\n [ngClass]=\"{\n 'sky-btn-tab-wrapper-selected': active,\n 'sky-btn-tab-wrapper-disabled': disabled\n }\"\n>\n <a\n #tabButtonEl\n class=\"sky-btn-tab\"\n role=\"tab\"\n [attr.aria-controls]=\"ariaControls\"\n [attr.aria-disabled]=\"disabled\"\n [attr.aria-selected]=\"active\"\n [attr.href]=\"buttonHref\"\n [attr.aria-label]=\"\n (tabStyle === 'wizard'\n ? 'skyux_wizard_sr_step_' + wizardStepState\n : 'skyux_tabs_sr_tab_order'\n ) | skyLibResources : tabNumber : totalTabsCount : buttonText\n \"\n [id]=\"buttonId\"\n [ngClass]=\"{\n 'sky-btn-tab-wizard': tabStyle === 'wizard',\n 'sky-btn-tab-selected': active,\n 'sky-btn-tab-disabled': disabled,\n 'sky-tab-btn-closeable': closeable\n }\"\n [tabindex]=\"active ? '0' : '-1'\"\n (click)=\"onButtonClick($event)\"\n (keydown)=\"onTabButtonKeyDown($event)\"\n (focus)=\"onFocus()\"\n >\n <span class=\"sky-tab-heading\" [attr.aria-hidden]=\"true\">\n {{ buttonText }}\n <span *ngIf=\"buttonTextCount !== undefined\" class=\"sky-tab-header-count\">\n {{ buttonTextCount }}\n </span>\n <span\n *ngIf=\"closeable\"\n class=\"sky-btn-tab-close\"\n [tabindex]=\"closeBtnTabIndex\"\n [attr.aria-label]=\"'skyux_tab_close' | skyLibResources : buttonText\"\n [ngClass]=\"{\n 'sky-btn-tab-close-disabled': disabled\n }\"\n (click)=\"onCloseClick($event)\"\n (keydown.enter)=\"onCloseClick($event)\"\n >\n <sky-icon icon=\"remove\"></sky-icon>\n </span>\n </span>\n </a>\n</div>\n", styles: [".sky-btn-tab-wrapper{display:inline-block;position:relative;margin-right:5px}.sky-btn-tab-wrapper .sky-btn-tab-close{position:absolute;top:10px;right:10px;color:#686c73;padding:1px 6px}.sky-btn-tab-wrapper .sky-btn-tab-close:hover{color:#212327;transition:color .15s}.sky-btn-tab-wrapper.sky-btn-tab-wrapper-selected:not(.sky-btn-tab-wrapper-disabled) .sky-btn-tab-close{color:#fff}.sky-btn-tab-wrapper.sky-btn-tab-wrapper-disabled{cursor:not-allowed}.sky-tab-btn-closeable{padding-right:43px}:host-context(.sky-theme-modern) .sky-btn-tab-wrapper{margin-right:10px}:host-context(.sky-theme-modern) .sky-btn-tab-wrapper .sky-btn-tab-close{top:12px;right:10px}:host-context(.sky-theme-modern) .sky-btn-tab-wrapper.sky-btn-tab-wrapper-selected:not(.sky-btn-tab-wrapper-disabled) .sky-btn-tab-close{color:#686c73}:host-context(.sky-theme-modern) .sky-tab-btn-closeable{padding-right:44px}.sky-theme-modern .sky-btn-tab-wrapper{margin-right:10px}.sky-theme-modern .sky-btn-tab-wrapper .sky-btn-tab-close{top:12px;right:10px}.sky-theme-modern .sky-btn-tab-wrapper.sky-btn-tab-wrapper-selected:not(.sky-btn-tab-wrapper-disabled) .sky-btn-tab-close{color:#686c73}.sky-theme-modern .sky-tab-btn-closeable{padding-right:44px}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-btn-tab-wrapper .sky-btn-tab-close{color:#eeeeef}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-btn-tab-wrapper.sky-btn-tab-wrapper-selected:not(.sky-btn-tab-wrapper-disabled) .sky-btn-tab-close{color:#eeeeef}.sky-theme-modern.sky-theme-mode-dark .sky-btn-tab-wrapper .sky-btn-tab-close{color:#eeeeef}.sky-theme-modern.sky-theme-mode-dark .sky-btn-tab-wrapper.sky-btn-tab-wrapper-selected:not(.sky-btn-tab-wrapper-disabled) .sky-btn-tab-close{color:#eeeeef}\n"] }]
|
|
1518
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: SkyTabButtonAdapterService }, { type: i0.ChangeDetectorRef }, { type: SkyTabsetService }]; }, propDecorators: { active: [{
|
|
1519
|
+
type: Input
|
|
1520
|
+
}], ariaControls: [{
|
|
1521
|
+
type: Input
|
|
1522
|
+
}], buttonHref: [{
|
|
1523
|
+
type: Input
|
|
1524
|
+
}], buttonId: [{
|
|
1525
|
+
type: Input
|
|
1526
|
+
}], buttonText: [{
|
|
1527
|
+
type: Input
|
|
1528
|
+
}], buttonTextCount: [{
|
|
1529
|
+
type: Input
|
|
1530
|
+
}], closeable: [{
|
|
1531
|
+
type: Input
|
|
1532
|
+
}], disabled: [{
|
|
1533
|
+
type: Input
|
|
1534
|
+
}], tabIndex: [{
|
|
1535
|
+
type: Input
|
|
1536
|
+
}], tabNumber: [{
|
|
1537
|
+
type: Input
|
|
1538
|
+
}], totalTabsCount: [{
|
|
1539
|
+
type: Input
|
|
1540
|
+
}], tabStyle: [{
|
|
1541
|
+
type: Input
|
|
1542
|
+
}], buttonClick: [{
|
|
1543
|
+
type: Output
|
|
1544
|
+
}], closeClick: [{
|
|
1545
|
+
type: Output
|
|
1546
|
+
}] } });
|
|
1547
|
+
|
|
1548
|
+
/**
|
|
1549
|
+
* @internal
|
|
1550
|
+
*/
|
|
1551
|
+
class SkyTabsetPermalinkService {
|
|
1552
|
+
get popStateChange() {
|
|
1553
|
+
return this.#popStateChange;
|
|
1554
|
+
}
|
|
1555
|
+
#popStateChange;
|
|
1556
|
+
#subscription;
|
|
1557
|
+
#activatedRoute;
|
|
1558
|
+
#location;
|
|
1559
|
+
#router;
|
|
1560
|
+
constructor(activatedRoute, location, router) {
|
|
1561
|
+
this.#activatedRoute = activatedRoute;
|
|
1562
|
+
this.#location = location;
|
|
1563
|
+
this.#router = router;
|
|
1564
|
+
this.#popStateChange = new Subject();
|
|
1565
|
+
}
|
|
1566
|
+
ngOnDestroy() {
|
|
1567
|
+
if (this.#subscription) {
|
|
1568
|
+
this.#subscription.unsubscribe();
|
|
1569
|
+
}
|
|
1570
|
+
this.#popStateChange.complete();
|
|
1571
|
+
}
|
|
1572
|
+
init() {
|
|
1573
|
+
this.#subscription = this.#location.subscribe(() => {
|
|
1574
|
+
this.#popStateChange.next();
|
|
1575
|
+
});
|
|
1576
|
+
}
|
|
1577
|
+
/**
|
|
1578
|
+
* Returns the value of a URL query param.
|
|
1579
|
+
*/
|
|
1580
|
+
getParam(name) {
|
|
1581
|
+
return this.#getParams()[name];
|
|
1582
|
+
}
|
|
1583
|
+
/**
|
|
1584
|
+
* Sets the value of a URL query param.
|
|
1585
|
+
*/
|
|
1586
|
+
setParam(name, value) {
|
|
1587
|
+
const params = this.#getParams();
|
|
1588
|
+
if (value === null) {
|
|
1589
|
+
delete params[name];
|
|
1590
|
+
}
|
|
1591
|
+
else {
|
|
1592
|
+
params[name] = value;
|
|
1593
|
+
}
|
|
1594
|
+
// Update the URL without triggering a navigation state change.
|
|
1595
|
+
// See: https://stackoverflow.com/a/46486677
|
|
1596
|
+
const url = this.#router
|
|
1597
|
+
.createUrlTree([], {
|
|
1598
|
+
relativeTo: this.#activatedRoute,
|
|
1599
|
+
queryParams: params,
|
|
1600
|
+
queryParamsHandling: 'merge',
|
|
1601
|
+
})
|
|
1602
|
+
.toString();
|
|
1603
|
+
// Abort redirect if the current URL is equal to the new URL.
|
|
1604
|
+
if (this.#location.isCurrentPathEqualTo(url)) {
|
|
1605
|
+
return;
|
|
1606
|
+
}
|
|
1607
|
+
this.#location.go(url);
|
|
1608
|
+
}
|
|
1609
|
+
/**
|
|
1610
|
+
* Removes the provided query param from the URL.
|
|
1611
|
+
*/
|
|
1612
|
+
clearParam(name) {
|
|
1613
|
+
this.setParam(name, null);
|
|
1614
|
+
}
|
|
1615
|
+
/**
|
|
1616
|
+
* Returns a relative URL that includes the provided query parameter. The value is intended to be
|
|
1617
|
+
* used by an HTML anchor element.
|
|
1618
|
+
*/
|
|
1619
|
+
getParamHref(name, value) {
|
|
1620
|
+
if (!name) {
|
|
1621
|
+
return null;
|
|
1622
|
+
}
|
|
1623
|
+
const params = this.#getParams();
|
|
1624
|
+
params[name] = value;
|
|
1625
|
+
const baseUrl = this.#location.path().split('?')[0];
|
|
1626
|
+
const paramString = Object.keys(params)
|
|
1627
|
+
.map((k) => `${k}=${params[k]}`)
|
|
1628
|
+
.join('&');
|
|
1629
|
+
return this.#location.prepareExternalUrl(`${baseUrl}?${paramString}`);
|
|
1630
|
+
}
|
|
1631
|
+
/**
|
|
1632
|
+
* Converts the provided string into a value that can be safely used in a URL.
|
|
1633
|
+
*/
|
|
1634
|
+
urlify(value) {
|
|
1635
|
+
if (!value) {
|
|
1636
|
+
return '';
|
|
1637
|
+
}
|
|
1638
|
+
const sanitized = value
|
|
1639
|
+
.toLowerCase()
|
|
1640
|
+
// Remove special characters.
|
|
1641
|
+
.replace(/[_~`@!#$%^&*()[\]{};:'/\\<>,.?=+|"]/g, '')
|
|
1642
|
+
// Replace space characters with a dash.
|
|
1643
|
+
.replace(/\s/g, '-')
|
|
1644
|
+
// Remove any double-dashes.
|
|
1645
|
+
.replace(/--/g, '-');
|
|
1646
|
+
return sanitized;
|
|
1647
|
+
}
|
|
1648
|
+
/**
|
|
1649
|
+
* Returns all query params that exist in the current URL.
|
|
1650
|
+
*/
|
|
1651
|
+
#getParams() {
|
|
1652
|
+
const params = {};
|
|
1653
|
+
const path = this.#location.path();
|
|
1654
|
+
if (path.indexOf('?') === -1) {
|
|
1655
|
+
return params;
|
|
1656
|
+
}
|
|
1657
|
+
const existingParamPairs = path.split('?')[1].split('&');
|
|
1658
|
+
existingParamPairs.forEach((pair) => {
|
|
1659
|
+
const fragments = pair.split('=');
|
|
1660
|
+
params[fragments[0]] = decodeURIComponent(fragments[1]);
|
|
1661
|
+
});
|
|
1662
|
+
return params;
|
|
1663
|
+
}
|
|
1664
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabsetPermalinkService, deps: [{ token: i1$1.ActivatedRoute }, { token: i4.Location }, { token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1665
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabsetPermalinkService }); }
|
|
1666
|
+
}
|
|
1667
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabsetPermalinkService, decorators: [{
|
|
1668
|
+
type: Injectable
|
|
1669
|
+
}], ctorParameters: function () { return [{ type: i1$1.ActivatedRoute }, { type: i4.Location }, { type: i1$1.Router }]; } });
|
|
1670
|
+
|
|
1671
|
+
const LAYOUT_CLASS_PREFIX = 'sky-layout-host-';
|
|
1672
|
+
const LAYOUT_DEFAULT = 'none';
|
|
1673
|
+
let nextId = 0;
|
|
1674
|
+
class SkyTabComponent {
|
|
1675
|
+
/**
|
|
1676
|
+
* Whether the tab is active when the tabset loads. After initialization, the `active`
|
|
1677
|
+
* property on the tabset component should be used to set the active tab.
|
|
1678
|
+
* @default false
|
|
1679
|
+
*/
|
|
1680
|
+
set active(value) {
|
|
1681
|
+
if (value !== undefined && !!value !== this.#_active) {
|
|
1682
|
+
this.#_active = value;
|
|
1683
|
+
this.#activeChange.next();
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
get active() {
|
|
1687
|
+
return this.#_active;
|
|
1688
|
+
}
|
|
1689
|
+
get activeChange() {
|
|
1690
|
+
return this.#activeChange;
|
|
1691
|
+
}
|
|
1692
|
+
/**
|
|
1693
|
+
* The custom query parameter value for the tab.
|
|
1694
|
+
* This works in conjunction with the tabset's `permalinkId` to distinguish
|
|
1695
|
+
* the tab's unique state in the URL by generating a query parameter that is
|
|
1696
|
+
* written as `?<queryParam>-active-tab=<sanitized-tab-heading`.
|
|
1697
|
+
* By default, the query parameter's value is parsed automatically from the tab's heading text.
|
|
1698
|
+
* This input only applies when the tabset's `tabStyle` is `"tabs"`.
|
|
1699
|
+
*/
|
|
1700
|
+
set permalinkValue(value) {
|
|
1701
|
+
this.#_permalinkValue = value;
|
|
1702
|
+
this.#setPermalinkValueOrDefault();
|
|
1703
|
+
}
|
|
1704
|
+
get permalinkValue() {
|
|
1705
|
+
return this.#_permalinkValue;
|
|
1706
|
+
}
|
|
1707
|
+
/**
|
|
1708
|
+
* The tab header.
|
|
1709
|
+
* When using tabs as the main navigation on a page,
|
|
1710
|
+
* use [the Angular `Title` service](https://angular.io/docs/ts/latest/cookbook/set-document-title.html)
|
|
1711
|
+
* and [the SKY UX `title` configuration property](https://developer.blackbaud.com/skyux/learn/reference/configuration#app)
|
|
1712
|
+
* to reflect the tab header in the page title.
|
|
1713
|
+
* @required
|
|
1714
|
+
*/
|
|
1715
|
+
set tabHeading(value) {
|
|
1716
|
+
this.#_tabHeading = value;
|
|
1717
|
+
this.#setPermalinkValueOrDefault();
|
|
1718
|
+
}
|
|
1719
|
+
get tabHeading() {
|
|
1720
|
+
return this.#_tabHeading;
|
|
1721
|
+
}
|
|
1722
|
+
/**
|
|
1723
|
+
* The unique identifier for the tab.
|
|
1724
|
+
* If not defined, the identifier is set to the position of the tab on load, starting with `0`.
|
|
1725
|
+
*/
|
|
1726
|
+
set tabIndex(value) {
|
|
1727
|
+
if (value !== this.#_tabIndex &&
|
|
1728
|
+
value !== undefined &&
|
|
1729
|
+
this.#_tabIndex !== undefined) {
|
|
1730
|
+
this.#tabsetService.updateTabIndex(this.#_tabIndex, value);
|
|
1731
|
+
this.#tabIndexChange.next(value);
|
|
1732
|
+
}
|
|
1733
|
+
this.#_tabIndex = value;
|
|
1734
|
+
}
|
|
1735
|
+
get tabIndex() {
|
|
1736
|
+
return this.#_tabIndex;
|
|
1737
|
+
}
|
|
1738
|
+
/**
|
|
1739
|
+
* The page layout that corresponds with the top-level component type
|
|
1740
|
+
* used on the page. For laying out custom content, use `auto` to allow
|
|
1741
|
+
* the page contents to expand beyond the bottom of the browser window
|
|
1742
|
+
* or `fit` to constrain the page contents to the available viewport.
|
|
1743
|
+
* @default "auto"
|
|
1744
|
+
*/
|
|
1745
|
+
set layout(value) {
|
|
1746
|
+
const layout = value || LAYOUT_DEFAULT;
|
|
1747
|
+
this.#_layout = layout;
|
|
1748
|
+
this.cssClass = `${LAYOUT_CLASS_PREFIX}${layout}`;
|
|
1749
|
+
if (this.active) {
|
|
1750
|
+
this.#tabsetService.updateActiveTabLayout(layout);
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
get layout() {
|
|
1754
|
+
return this.#_layout;
|
|
1755
|
+
}
|
|
1756
|
+
/**
|
|
1757
|
+
* Alerts the tabset component when this component has changes that need to be reflected in the UI.
|
|
1758
|
+
*/
|
|
1759
|
+
get stateChange() {
|
|
1760
|
+
return this.#stateChange;
|
|
1761
|
+
}
|
|
1762
|
+
get tabIndexChange() {
|
|
1763
|
+
return this.#tabIndexChange;
|
|
1764
|
+
}
|
|
1765
|
+
#_active;
|
|
1766
|
+
#activeChange;
|
|
1767
|
+
#_permalinkValue;
|
|
1768
|
+
#stateChange;
|
|
1769
|
+
#_tabHeading;
|
|
1770
|
+
#_tabIndex;
|
|
1771
|
+
#_layout;
|
|
1772
|
+
#tabIndexChange;
|
|
1773
|
+
#changeDetector;
|
|
1774
|
+
#permalinkService;
|
|
1775
|
+
#tabsetService;
|
|
1776
|
+
constructor(changeDetector, permalinkService, tabsetService) {
|
|
1777
|
+
this.cssClass = `${LAYOUT_CLASS_PREFIX}${LAYOUT_DEFAULT}`;
|
|
1778
|
+
/**
|
|
1779
|
+
* Fires when users click the button to close the tab.
|
|
1780
|
+
* The close button is added to the tab when you specify a listener for this event.
|
|
1781
|
+
* This event only applies when the tabset's `tabStyle` is `"tabs"`.
|
|
1782
|
+
*/
|
|
1783
|
+
this.close = new EventEmitter(); // eslint-disable-line @angular-eslint/no-output-native
|
|
1784
|
+
this.permalinkValueOrDefault = '';
|
|
1785
|
+
this.showContent = false;
|
|
1786
|
+
this.#_active = false;
|
|
1787
|
+
this.#_layout = LAYOUT_DEFAULT;
|
|
1788
|
+
this.#changeDetector = changeDetector;
|
|
1789
|
+
this.#permalinkService = permalinkService;
|
|
1790
|
+
this.#tabsetService = tabsetService;
|
|
1791
|
+
const id = nextId++;
|
|
1792
|
+
this.tabPanelId = `sky-tab-${id}`;
|
|
1793
|
+
this.tabButtonId = `${this.tabPanelId}-nav-btn`;
|
|
1794
|
+
this.#activeChange = new BehaviorSubject(undefined);
|
|
1795
|
+
this.#stateChange = new BehaviorSubject(undefined);
|
|
1796
|
+
this.#tabIndexChange = new BehaviorSubject(undefined);
|
|
1797
|
+
this.#setPermalinkValueOrDefault();
|
|
1798
|
+
}
|
|
1799
|
+
ngOnChanges(changes) {
|
|
1800
|
+
if ((changes['disabled'] && !changes['disabled'].firstChange) ||
|
|
1801
|
+
(changes['tabHeading'] && !changes['tabHeading'].firstChange) ||
|
|
1802
|
+
(changes['tabHeaderCount'] && !changes['tabHeaderCount'].firstChange) ||
|
|
1803
|
+
(changes['permalinkValue'] && !changes['permalinkValue'].firstChange)) {
|
|
1804
|
+
this.#stateChange.next();
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
ngOnDestroy() {
|
|
1808
|
+
this.#activeChange.complete();
|
|
1809
|
+
this.#stateChange.complete();
|
|
1810
|
+
this.#tabIndexChange.complete();
|
|
1811
|
+
if (this.tabIndex !== undefined) {
|
|
1812
|
+
this.#tabsetService.unregisterTab(this.tabIndex);
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
init() {
|
|
1816
|
+
this.#_tabIndex = this.#tabsetService.registerTab(this.tabIndex);
|
|
1817
|
+
}
|
|
1818
|
+
activate() {
|
|
1819
|
+
this.#_active = true;
|
|
1820
|
+
this.showContent = true;
|
|
1821
|
+
this.#changeDetector.markForCheck();
|
|
1822
|
+
}
|
|
1823
|
+
deactivate() {
|
|
1824
|
+
this.#_active = false;
|
|
1825
|
+
this.showContent = false;
|
|
1826
|
+
this.#changeDetector.markForCheck();
|
|
1827
|
+
}
|
|
1828
|
+
isCloseable() {
|
|
1829
|
+
return this.close.observers.length > 0;
|
|
1830
|
+
}
|
|
1831
|
+
#setPermalinkValueOrDefault() {
|
|
1832
|
+
this.permalinkValueOrDefault =
|
|
1833
|
+
this.#permalinkService.urlify(this.permalinkValue) ||
|
|
1834
|
+
this.#permalinkService.urlify(this.tabHeading);
|
|
1835
|
+
}
|
|
1836
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: SkyTabsetPermalinkService }, { token: SkyTabsetService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1837
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SkyTabComponent, selector: "sky-tab", inputs: { active: "active", disabled: "disabled", permalinkValue: "permalinkValue", tabHeaderCount: "tabHeaderCount", tabHeading: "tabHeading", tabIndex: "tabIndex", layout: "layout" }, outputs: { close: "close" }, host: { properties: { "class": "this.cssClass" } }, usesOnChanges: true, ngImport: i0, template: "<div\n class=\"sky-tab\"\n role=\"tabpanel\"\n [attr.aria-labelledby]=\"tabButtonId\"\n [hidden]=\"!showContent\"\n [id]=\"tabPanelId\"\n>\n <ng-content></ng-content>\n</div>\n", styles: [":host.sky-layout-host-fit{display:flex;flex-grow:1;position:static}:host.sky-layout-host-fit .sky-tab{flex-grow:1;position:relative}.sky-tab{flex-grow:var(--sky-layout-host-content-flex-grow, 0);overflow:var(--sky-layout-host-content-overflow, visible);padding:var(--sky-layout-host-content-spacing, 0);position:var(--sky-layout-host-content-position, static)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1838
|
+
}
|
|
1839
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabComponent, decorators: [{
|
|
1840
|
+
type: Component,
|
|
1841
|
+
args: [{ selector: 'sky-tab', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"sky-tab\"\n role=\"tabpanel\"\n [attr.aria-labelledby]=\"tabButtonId\"\n [hidden]=\"!showContent\"\n [id]=\"tabPanelId\"\n>\n <ng-content></ng-content>\n</div>\n", styles: [":host.sky-layout-host-fit{display:flex;flex-grow:1;position:static}:host.sky-layout-host-fit .sky-tab{flex-grow:1;position:relative}.sky-tab{flex-grow:var(--sky-layout-host-content-flex-grow, 0);overflow:var(--sky-layout-host-content-overflow, visible);padding:var(--sky-layout-host-content-spacing, 0);position:var(--sky-layout-host-content-position, static)}\n"] }]
|
|
1842
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: SkyTabsetPermalinkService }, { type: SkyTabsetService }]; }, propDecorators: { active: [{
|
|
1843
|
+
type: Input
|
|
1844
|
+
}], disabled: [{
|
|
1845
|
+
type: Input
|
|
1846
|
+
}], permalinkValue: [{
|
|
1847
|
+
type: Input
|
|
1848
|
+
}], tabHeaderCount: [{
|
|
1849
|
+
type: Input
|
|
1850
|
+
}], tabHeading: [{
|
|
1851
|
+
type: Input
|
|
1852
|
+
}], tabIndex: [{
|
|
1853
|
+
type: Input
|
|
1854
|
+
}], layout: [{
|
|
1855
|
+
type: Input
|
|
1856
|
+
}], cssClass: [{
|
|
1857
|
+
type: HostBinding,
|
|
1858
|
+
args: ['class']
|
|
1859
|
+
}], close: [{
|
|
1860
|
+
type: Output
|
|
1861
|
+
}] } });
|
|
1862
|
+
|
|
1863
|
+
class SkyTabsetNavButtonDisabledPipe {
|
|
1864
|
+
transform(disabled, buttonType, tabToSelectExists, tabToSelectIsDisabled) {
|
|
1865
|
+
if (disabled !== undefined) {
|
|
1866
|
+
return disabled;
|
|
1867
|
+
}
|
|
1868
|
+
else if (buttonType === 'finish') {
|
|
1869
|
+
return false;
|
|
1870
|
+
}
|
|
1871
|
+
return !tabToSelectExists || !!tabToSelectIsDisabled;
|
|
1872
|
+
}
|
|
1873
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabsetNavButtonDisabledPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1874
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SkyTabsetNavButtonDisabledPipe, name: "skyTabsetNavButtonDisabled" }); }
|
|
1875
|
+
}
|
|
1876
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabsetNavButtonDisabledPipe, decorators: [{
|
|
1877
|
+
type: Pipe,
|
|
1878
|
+
args: [{
|
|
1879
|
+
name: 'skyTabsetNavButtonDisabled',
|
|
1880
|
+
}]
|
|
1881
|
+
}] });
|
|
1882
|
+
|
|
1883
|
+
const buttonTypeNext = 'next';
|
|
1884
|
+
const buttonTypePrevious = 'previous';
|
|
1885
|
+
const buttonTypeFinish = 'finish';
|
|
1886
|
+
class SkyTabsetNavButtonComponent {
|
|
1887
|
+
/**
|
|
1888
|
+
* The tabset wizard component to associate with the nav button.
|
|
1889
|
+
* @required
|
|
1890
|
+
*/
|
|
1891
|
+
get tabset() {
|
|
1892
|
+
return this.#_tabset;
|
|
1893
|
+
}
|
|
1894
|
+
set tabset(value) {
|
|
1895
|
+
this.#_tabset = value;
|
|
1896
|
+
if (this.#currentTabsetSub) {
|
|
1897
|
+
this.#currentTabsetSub.unsubscribe();
|
|
1898
|
+
}
|
|
1899
|
+
if (value) {
|
|
1900
|
+
this.#currentTabsetSub = value.activeChange
|
|
1901
|
+
.pipe(distinctUntilChanged(), takeUntil(this.#ngUnsubscribe))
|
|
1902
|
+
.subscribe((index) => {
|
|
1903
|
+
this.#activeSkyTabIndex = index;
|
|
1904
|
+
this.#tabCount = this.#_tabset?.tabs?.length;
|
|
1905
|
+
this.#updateTabToSelect();
|
|
1906
|
+
this.#updateButtonVisibility();
|
|
1907
|
+
this.#updateButtonProperties();
|
|
1908
|
+
});
|
|
1909
|
+
}
|
|
1910
|
+
else {
|
|
1911
|
+
this.#logger.error('The SkyTabsetNavButtonComponent requires a reference to the SkyTabsetComponent it controls.');
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
/**
|
|
1915
|
+
* The type of nav button to include.
|
|
1916
|
+
* @required
|
|
1917
|
+
*/
|
|
1918
|
+
get buttonType() {
|
|
1919
|
+
return this.#_buttonType;
|
|
1920
|
+
}
|
|
1921
|
+
set buttonType(value) {
|
|
1922
|
+
this.#_buttonType = value;
|
|
1923
|
+
this.#updateTabToSelect();
|
|
1924
|
+
this.#updateButtonProperties();
|
|
1925
|
+
this.#updateButtonVisibility();
|
|
1926
|
+
if (value === buttonTypeFinish) {
|
|
1927
|
+
this.type = 'submit';
|
|
1928
|
+
}
|
|
1929
|
+
else {
|
|
1930
|
+
this.type = 'button';
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
/**
|
|
1934
|
+
* Whether to disable the nav button.
|
|
1935
|
+
* Defaults to the disabled state of the next tab for `next`, the existence of a previous tab for `previous`,
|
|
1936
|
+
* and false for `finish`.
|
|
1937
|
+
*/
|
|
1938
|
+
set disabled(value) {
|
|
1939
|
+
this.#_disabled = value;
|
|
1940
|
+
}
|
|
1941
|
+
get disabled() {
|
|
1942
|
+
return this.#_disabled;
|
|
1943
|
+
}
|
|
1944
|
+
#_buttonType;
|
|
1945
|
+
#_disabled;
|
|
1946
|
+
#_tabset;
|
|
1947
|
+
#activeIndexNumber;
|
|
1948
|
+
#activeSkyTabIndex;
|
|
1949
|
+
#currentTabsetSub;
|
|
1950
|
+
#logger;
|
|
1951
|
+
#tabCount;
|
|
1952
|
+
#ngUnsubscribe;
|
|
1953
|
+
constructor(logger) {
|
|
1954
|
+
this.isVisible = false;
|
|
1955
|
+
this.type = 'submit';
|
|
1956
|
+
this.#ngUnsubscribe = new Subject();
|
|
1957
|
+
this.#logger = logger;
|
|
1958
|
+
}
|
|
1959
|
+
ngOnDestroy() {
|
|
1960
|
+
this.#ngUnsubscribe.next();
|
|
1961
|
+
this.#ngUnsubscribe.complete();
|
|
1962
|
+
}
|
|
1963
|
+
buttonClick() {
|
|
1964
|
+
/* istanbul ignore else */
|
|
1965
|
+
if (this.tabToSelect && !this.tabToSelect.disabled && this.tabset) {
|
|
1966
|
+
this.tabset.active = this.tabToSelect.tabIndex;
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
#updateButtonVisibility() {
|
|
1970
|
+
const isLastStep = !!this.#tabCount && this.#activeIndexNumber === this.#tabCount - 1;
|
|
1971
|
+
if (this.buttonType === buttonTypeFinish) {
|
|
1972
|
+
this.isVisible = isLastStep;
|
|
1973
|
+
}
|
|
1974
|
+
else if (this.buttonType === buttonTypeNext) {
|
|
1975
|
+
this.isVisible = !isLastStep;
|
|
1976
|
+
}
|
|
1977
|
+
else {
|
|
1978
|
+
this.isVisible = true;
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
#updateButtonProperties() {
|
|
1982
|
+
if (this.buttonType === buttonTypeNext ||
|
|
1983
|
+
this.buttonType === buttonTypeFinish) {
|
|
1984
|
+
this.buttonClassName = 'sky-btn-primary';
|
|
1985
|
+
}
|
|
1986
|
+
else {
|
|
1987
|
+
this.buttonClassName = 'sky-btn-default';
|
|
1988
|
+
}
|
|
1989
|
+
this.ariaControls = this.tabToSelect?.tabPanelId;
|
|
1990
|
+
}
|
|
1991
|
+
#updateTabToSelect() {
|
|
1992
|
+
if (this.tabset?.tabs) {
|
|
1993
|
+
const tabs = this.tabset.tabs.toArray();
|
|
1994
|
+
this.tabToSelect = undefined;
|
|
1995
|
+
// tab index can be a number or a string, but we need the actual number index
|
|
1996
|
+
this.#activeIndexNumber = tabs.findIndex((tab) => tab.tabIndex === this.#activeSkyTabIndex);
|
|
1997
|
+
/* istanbul ignore else */
|
|
1998
|
+
if (this.#activeIndexNumber !== undefined) {
|
|
1999
|
+
if (this.buttonType === buttonTypeNext) {
|
|
2000
|
+
this.tabToSelect = tabs[this.#activeIndexNumber + 1];
|
|
2001
|
+
}
|
|
2002
|
+
else if (this.buttonType === buttonTypePrevious) {
|
|
2003
|
+
this.tabToSelect = tabs[this.#activeIndexNumber - 1];
|
|
2004
|
+
}
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabsetNavButtonComponent, deps: [{ token: i1.SkyLogService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2009
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SkyTabsetNavButtonComponent, selector: "sky-tabset-nav-button", inputs: { tabset: "tabset", buttonType: "buttonType", buttonText: "buttonText", disabled: "disabled" }, ngImport: i0, template: "<button\n *ngIf=\"isVisible\"\n class=\"sky-btn sky-margin-inline-sm\"\n [attr.aria-controls]=\"ariaControls\"\n [disabled]=\"\n disabled\n | skyTabsetNavButtonDisabled\n : buttonType\n : !!tabToSelect\n : tabToSelect?.disabled\n \"\n [ngClass]=\"buttonClassName\"\n [type]=\"type\"\n (click)=\"buttonType === 'finish' ? null : buttonClick()\"\n>\n {{ buttonText || ('skyux_tabs_navigator_' + buttonType | skyLibResources) }}\n</button>\n", dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i3.SkyLibResourcesPipe, name: "skyLibResources" }, { kind: "pipe", type: SkyTabsetNavButtonDisabledPipe, name: "skyTabsetNavButtonDisabled" }] }); }
|
|
2010
|
+
}
|
|
2011
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabsetNavButtonComponent, decorators: [{
|
|
2012
|
+
type: Component,
|
|
2013
|
+
args: [{ selector: 'sky-tabset-nav-button', template: "<button\n *ngIf=\"isVisible\"\n class=\"sky-btn sky-margin-inline-sm\"\n [attr.aria-controls]=\"ariaControls\"\n [disabled]=\"\n disabled\n | skyTabsetNavButtonDisabled\n : buttonType\n : !!tabToSelect\n : tabToSelect?.disabled\n \"\n [ngClass]=\"buttonClassName\"\n [type]=\"type\"\n (click)=\"buttonType === 'finish' ? null : buttonClick()\"\n>\n {{ buttonText || ('skyux_tabs_navigator_' + buttonType | skyLibResources) }}\n</button>\n" }]
|
|
2014
|
+
}], ctorParameters: function () { return [{ type: i1.SkyLogService }]; }, propDecorators: { tabset: [{
|
|
2015
|
+
type: Input
|
|
2016
|
+
}], buttonType: [{
|
|
2017
|
+
type: Input
|
|
2018
|
+
}], buttonText: [{
|
|
2019
|
+
type: Input
|
|
2020
|
+
}], disabled: [{
|
|
2021
|
+
type: Input
|
|
2022
|
+
}] } });
|
|
2023
|
+
|
|
2024
|
+
/**
|
|
2025
|
+
* @internal
|
|
2026
|
+
*/
|
|
2027
|
+
class SkyTabsetAdapterService {
|
|
2028
|
+
get overflowChange() {
|
|
2029
|
+
return this.#overflowChange;
|
|
2030
|
+
}
|
|
2031
|
+
#currentOverflow = false;
|
|
2032
|
+
#tabsetRef;
|
|
2033
|
+
#tabsOffsetLeft;
|
|
2034
|
+
#overflowChange;
|
|
2035
|
+
constructor() {
|
|
2036
|
+
this.#overflowChange = new BehaviorSubject(false);
|
|
2037
|
+
}
|
|
2038
|
+
ngOnDestroy() {
|
|
2039
|
+
this.#overflowChange.complete();
|
|
2040
|
+
}
|
|
2041
|
+
registerTabset(tabsetRef) {
|
|
2042
|
+
this.#tabsetRef = tabsetRef;
|
|
2043
|
+
this.#tabsOffsetLeft = this.#getTabsOffsetLeft(tabsetRef.nativeElement);
|
|
2044
|
+
}
|
|
2045
|
+
/**
|
|
2046
|
+
* Detects if the tab buttons are wider than the tabset container.
|
|
2047
|
+
*/
|
|
2048
|
+
detectOverflow() {
|
|
2049
|
+
const nativeElement = this.#tabsetRef?.nativeElement;
|
|
2050
|
+
const tabsetRect = nativeElement
|
|
2051
|
+
.querySelector('.sky-tabset')
|
|
2052
|
+
.getBoundingClientRect();
|
|
2053
|
+
const tabButtonsRect = nativeElement
|
|
2054
|
+
.querySelector('.sky-tabset-tabs')
|
|
2055
|
+
.getBoundingClientRect();
|
|
2056
|
+
const tabExtraButtonsRect = nativeElement
|
|
2057
|
+
.querySelector('.sky-tabset-btns')
|
|
2058
|
+
.getBoundingClientRect();
|
|
2059
|
+
const tabButtonsWidth = tabButtonsRect.width + tabExtraButtonsRect.width + this.#tabsOffsetLeft;
|
|
2060
|
+
const newOverflow = tabButtonsWidth > tabsetRect.width;
|
|
2061
|
+
if (this.#currentOverflow !== newOverflow) {
|
|
2062
|
+
this.#currentOverflow = newOverflow;
|
|
2063
|
+
this.#overflowChange.next(this.#currentOverflow);
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2066
|
+
/**
|
|
2067
|
+
* Returns the number of pixels to the left of the first tab.
|
|
2068
|
+
*/
|
|
2069
|
+
#getTabsOffsetLeft(tabsetEl) {
|
|
2070
|
+
const tabsetRect = tabsetEl.getBoundingClientRect();
|
|
2071
|
+
// The dropdown element is the first "tab" and always exists in the DOM, even when hidden.
|
|
2072
|
+
const firstTabRect = tabsetEl
|
|
2073
|
+
.querySelector('.sky-tabset-dropdown')
|
|
2074
|
+
?.getBoundingClientRect();
|
|
2075
|
+
// Safety check
|
|
2076
|
+
/* istanbul ignore next */
|
|
2077
|
+
if (!firstTabRect) {
|
|
2078
|
+
return 0;
|
|
2079
|
+
}
|
|
2080
|
+
return firstTabRect.left - tabsetRect.left;
|
|
2081
|
+
}
|
|
2082
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabsetAdapterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2083
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabsetAdapterService }); }
|
|
2084
|
+
}
|
|
2085
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabsetAdapterService, decorators: [{
|
|
2086
|
+
type: Injectable
|
|
2087
|
+
}], ctorParameters: function () { return []; } });
|
|
2088
|
+
|
|
2089
|
+
class SkyTabsetComponent {
|
|
2090
|
+
/**
|
|
2091
|
+
* Activates a tab by its `tabIndex` property.
|
|
2092
|
+
*/
|
|
2093
|
+
set active(value) {
|
|
2094
|
+
if (value === undefined ||
|
|
2095
|
+
this.#tabsetService.tabIndexesEqual(value, this.#_active)) {
|
|
2096
|
+
return;
|
|
2097
|
+
}
|
|
2098
|
+
this.#_active = value;
|
|
2099
|
+
if (this.tabs) {
|
|
2100
|
+
this.#tabsetService.setActiveTabIndex(value);
|
|
2101
|
+
}
|
|
2102
|
+
else {
|
|
2103
|
+
// On init, wait for children tabs to render before broadcasting the active tab index.
|
|
2104
|
+
setTimeout(() => {
|
|
2105
|
+
if (this.#tabsetService.isValidTabIndex(value)) {
|
|
2106
|
+
// On init, yield to the permalink ID, if it exists.
|
|
2107
|
+
if (this.#getActiveTabIndexByPermalinkId() === undefined) {
|
|
2108
|
+
this.#tabsetService.setActiveTabIndex(value);
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2111
|
+
else {
|
|
2112
|
+
// Activate the first tab if the new tab index is invalid.
|
|
2113
|
+
this.#_active = this.#tabsetService.activateFirstTab();
|
|
2114
|
+
}
|
|
2115
|
+
});
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
get active() {
|
|
2119
|
+
return this.#_active;
|
|
2120
|
+
}
|
|
2121
|
+
/**
|
|
2122
|
+
* Distinguishes a tabset's unique state in the URL by generating a query parameter
|
|
2123
|
+
* that is written as `?<queryParam>-active-tab=<sanitized-tab-heading>`.
|
|
2124
|
+
* The query parameter's value is parsed automatically from the selected tab's heading text,
|
|
2125
|
+
* but you can supply a custom query parameter value for each tab with its `permalinkValue`.
|
|
2126
|
+
* This input only applies when `tabStyle` is `"tabs"`
|
|
2127
|
+
*/
|
|
2128
|
+
set permalinkId(value) {
|
|
2129
|
+
if (!value) {
|
|
2130
|
+
this.#_permalinkId = '';
|
|
2131
|
+
}
|
|
2132
|
+
else {
|
|
2133
|
+
const sanitized = this.#permalinkService.urlify(value);
|
|
2134
|
+
this.#_permalinkId = `${sanitized}-active-tab`;
|
|
2135
|
+
}
|
|
2136
|
+
}
|
|
2137
|
+
get permalinkId() {
|
|
2138
|
+
return this.#_permalinkId;
|
|
2139
|
+
}
|
|
2140
|
+
/**
|
|
2141
|
+
* The behavior for a series of tabs.
|
|
2142
|
+
* @default "tabs"
|
|
2143
|
+
*/
|
|
2144
|
+
set tabStyle(value) {
|
|
2145
|
+
this.#_tabStyle = value || 'tabs';
|
|
2146
|
+
}
|
|
2147
|
+
get tabStyle() {
|
|
2148
|
+
return this.#_tabStyle;
|
|
2149
|
+
}
|
|
2150
|
+
set tabDisplayMode(value) {
|
|
2151
|
+
this.#_tabDisplayMode = value;
|
|
2152
|
+
this.#changeDetector.markForCheck();
|
|
2153
|
+
}
|
|
2154
|
+
get tabDisplayMode() {
|
|
2155
|
+
return this.#_tabDisplayMode;
|
|
2156
|
+
}
|
|
2157
|
+
set tabs(value) {
|
|
2158
|
+
this.#_tabs = value;
|
|
2159
|
+
this.#tabComponentsChangeUnsubscribe.next();
|
|
2160
|
+
value?.changes
|
|
2161
|
+
.pipe(takeUntil(this.#tabComponentsChangeUnsubscribe))
|
|
2162
|
+
.subscribe(() => {
|
|
2163
|
+
this.#resetTabComponents();
|
|
2164
|
+
});
|
|
2165
|
+
}
|
|
2166
|
+
get tabs() {
|
|
2167
|
+
return this.#_tabs;
|
|
2168
|
+
}
|
|
2169
|
+
#ngUnsubscribe;
|
|
2170
|
+
#tabComponentsChangeUnsubscribe;
|
|
2171
|
+
#tabComponentsStateChangeUnsubscribe;
|
|
2172
|
+
#_active;
|
|
2173
|
+
#_permalinkId;
|
|
2174
|
+
#_tabs;
|
|
2175
|
+
#_tabDisplayMode;
|
|
2176
|
+
#_tabStyle;
|
|
2177
|
+
#changeDetector;
|
|
2178
|
+
#elementRef;
|
|
2179
|
+
#adapterService;
|
|
2180
|
+
#permalinkService;
|
|
2181
|
+
#tabsetService;
|
|
2182
|
+
#layoutHostSvc;
|
|
2183
|
+
constructor(changeDetector, elementRef, adapterService, permalinkService, tabsetService) {
|
|
2184
|
+
/**
|
|
2185
|
+
* Fires when the active tab changes. This event emits the index of the active tab.
|
|
2186
|
+
*/
|
|
2187
|
+
this.activeChange = new EventEmitter();
|
|
2188
|
+
/**
|
|
2189
|
+
* Fires when users click the button to add a new tab.
|
|
2190
|
+
* The new tab button is added to the tab area when you specify a listener for this event.
|
|
2191
|
+
* This event only applies when `tabStyle` is `"tabs"`.
|
|
2192
|
+
*/
|
|
2193
|
+
this.newTab = new EventEmitter();
|
|
2194
|
+
/**
|
|
2195
|
+
* Fires when users click the button to open a tab.
|
|
2196
|
+
* The open tab button is added to the tab area when you specify a listener for this event.
|
|
2197
|
+
* This event only applies when `tabStyle` is `"tabs"`.
|
|
2198
|
+
*/
|
|
2199
|
+
this.openTab = new EventEmitter();
|
|
2200
|
+
/**
|
|
2201
|
+
* Fires when any tab's `tabIndex` value changes.
|
|
2202
|
+
* This event only applies when `tabStyle` is `"tabs"`.
|
|
2203
|
+
*/
|
|
2204
|
+
this.tabIndexesChange = new EventEmitter();
|
|
2205
|
+
this.cssClass = 'sky-tabset-layout-none';
|
|
2206
|
+
this.dropdownTriggerButtonText = '';
|
|
2207
|
+
this.tabButtons = [];
|
|
2208
|
+
this.#ngUnsubscribe = new Subject();
|
|
2209
|
+
this.#tabComponentsChangeUnsubscribe = new Subject();
|
|
2210
|
+
this.#tabComponentsStateChangeUnsubscribe = new Subject();
|
|
2211
|
+
this.#_permalinkId = '';
|
|
2212
|
+
this.#_tabDisplayMode = 'tabs';
|
|
2213
|
+
this.#_tabStyle = 'tabs';
|
|
2214
|
+
this.#layoutHostSvc = inject(SkyLayoutHostService, { optional: true });
|
|
2215
|
+
this.#changeDetector = changeDetector;
|
|
2216
|
+
this.#elementRef = elementRef;
|
|
2217
|
+
this.#adapterService = adapterService;
|
|
2218
|
+
this.#permalinkService = permalinkService;
|
|
2219
|
+
this.#tabsetService = tabsetService;
|
|
2220
|
+
}
|
|
2221
|
+
ngAfterViewInit() {
|
|
2222
|
+
this.#initTabComponents();
|
|
2223
|
+
const initialTabIndex = this.#getInitialTabIndex();
|
|
2224
|
+
this.#tabsetService.setActiveTabIndex(initialTabIndex);
|
|
2225
|
+
this.#listenTabButtonsOverflowChange();
|
|
2226
|
+
this.#listenLocationPopStateChange();
|
|
2227
|
+
// If the currently active tab is getting unregistered, activate the next one.
|
|
2228
|
+
this.#tabsetService.activeTabUnregistered
|
|
2229
|
+
.pipe(takeUntil(this.#ngUnsubscribe))
|
|
2230
|
+
.subscribe((tab) => {
|
|
2231
|
+
// Wait for the new tabs to render before activating.
|
|
2232
|
+
setTimeout(() => {
|
|
2233
|
+
this.#tabsetService.activateNearestTab(tab.arrayIndex);
|
|
2234
|
+
});
|
|
2235
|
+
});
|
|
2236
|
+
this.#tabsetService.activeTabLayout
|
|
2237
|
+
.pipe(takeUntil(this.#ngUnsubscribe))
|
|
2238
|
+
.subscribe((layout) => {
|
|
2239
|
+
this.#updateLayout(layout);
|
|
2240
|
+
});
|
|
2241
|
+
// Let the tabset render the initial active index before listening for changes.
|
|
2242
|
+
setTimeout(() => {
|
|
2243
|
+
this.#listenTabComponentsStateChange();
|
|
2244
|
+
this.#listenActiveIndexChange();
|
|
2245
|
+
this.#permalinkService.init();
|
|
2246
|
+
});
|
|
2247
|
+
}
|
|
2248
|
+
ngOnDestroy() {
|
|
2249
|
+
this.#ngUnsubscribe.next();
|
|
2250
|
+
this.#ngUnsubscribe.complete();
|
|
2251
|
+
this.#tabComponentsChangeUnsubscribe.next();
|
|
2252
|
+
this.#tabComponentsChangeUnsubscribe.complete();
|
|
2253
|
+
this.#unsubscribeTabComponentsStateChange();
|
|
2254
|
+
if (this.permalinkId) {
|
|
2255
|
+
this.#permalinkService.clearParam(this.permalinkId);
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
onWindowResize() {
|
|
2259
|
+
this.#adapterService.detectOverflow();
|
|
2260
|
+
}
|
|
2261
|
+
onTabCloseClick(tabButton) {
|
|
2262
|
+
const tabComponent = this.tabs?.find((tab) => this.#tabsetService.tabIndexesEqual(tab.tabIndex, tabButton.tabIndex));
|
|
2263
|
+
tabComponent?.close.emit();
|
|
2264
|
+
}
|
|
2265
|
+
onTabButtonClick(tabButton) {
|
|
2266
|
+
this.#tabsetService.setActiveTabIndex(tabButton.tabIndex);
|
|
2267
|
+
}
|
|
2268
|
+
onNewTabClick() {
|
|
2269
|
+
this.newTab.emit();
|
|
2270
|
+
}
|
|
2271
|
+
onOpenTabClick() {
|
|
2272
|
+
this.openTab.emit();
|
|
2273
|
+
}
|
|
2274
|
+
onRightKeyDown() {
|
|
2275
|
+
this.#tabsetService.focusNextTabBtn(this.tabButtons);
|
|
2276
|
+
}
|
|
2277
|
+
onLeftKeyDown() {
|
|
2278
|
+
this.#tabsetService.focusPrevTabBtn(this.tabButtons);
|
|
2279
|
+
}
|
|
2280
|
+
onHomeKeyDown() {
|
|
2281
|
+
this.#tabsetService.focusFirstOrNearestTabBtn(this.tabButtons);
|
|
2282
|
+
}
|
|
2283
|
+
onEndKeyDown() {
|
|
2284
|
+
this.#tabsetService.focusLastOrNearestTabBtn(this.tabButtons);
|
|
2285
|
+
}
|
|
2286
|
+
/**
|
|
2287
|
+
* Sets the initial active tab index based on the following criteria.
|
|
2288
|
+
* 1. Does the URL include a query param that reflects this tabset's active tab?
|
|
2289
|
+
* 2. Does one of the tab components have their `active` property set to `true`?
|
|
2290
|
+
* 3. Is the tabset component's `active` property set to a specific tab index?
|
|
2291
|
+
*/
|
|
2292
|
+
#getInitialTabIndex() {
|
|
2293
|
+
let activeIndex = this.#getActiveTabIndexByPermalinkId();
|
|
2294
|
+
if (activeIndex === undefined) {
|
|
2295
|
+
activeIndex = this.#getActiveTabComponent()?.tabIndex;
|
|
2296
|
+
if (activeIndex === undefined) {
|
|
2297
|
+
activeIndex = this.active;
|
|
2298
|
+
}
|
|
2299
|
+
}
|
|
2300
|
+
return activeIndex;
|
|
2301
|
+
}
|
|
2302
|
+
#listenActiveIndexChange() {
|
|
2303
|
+
this.#tabsetService.activeTabIndex
|
|
2304
|
+
.pipe(distinctUntilChanged(), takeUntil(this.#ngUnsubscribe))
|
|
2305
|
+
.subscribe((activeIndex) => {
|
|
2306
|
+
this.#updateTabsetComponent(activeIndex);
|
|
2307
|
+
const activeTab = this.#getActiveTabComponent();
|
|
2308
|
+
this.#updateLayout(activeTab?.layout);
|
|
2309
|
+
});
|
|
2310
|
+
}
|
|
2311
|
+
#updateLayout(layout) {
|
|
2312
|
+
if (this.#layoutHostSvc && layout) {
|
|
2313
|
+
this.#layoutHostSvc.setHostLayoutForChild({
|
|
2314
|
+
layout,
|
|
2315
|
+
});
|
|
2316
|
+
this.cssClass = `sky-tabset-layout-${layout}`;
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
#listenTabComponentsStateChange() {
|
|
2320
|
+
if (this.tabs) {
|
|
2321
|
+
combineLatest(this.tabs.map((tab) => tab.activeChange))
|
|
2322
|
+
.pipe(takeUntil(race(this.#tabComponentsStateChangeUnsubscribe, this.#ngUnsubscribe)))
|
|
2323
|
+
.subscribe(() => {
|
|
2324
|
+
// Wait for the tab components to render changes before finding the active one.
|
|
2325
|
+
setTimeout(() => {
|
|
2326
|
+
const tabIndex = this.#getActiveTabComponent()?.tabIndex;
|
|
2327
|
+
this.#tabsetService.setActiveTabIndex(tabIndex);
|
|
2328
|
+
});
|
|
2329
|
+
});
|
|
2330
|
+
combineLatest(this.tabs.map((tab) => tab.tabIndexChange))
|
|
2331
|
+
.pipe(takeUntil(race(this.#tabComponentsStateChangeUnsubscribe, this.#ngUnsubscribe)))
|
|
2332
|
+
.subscribe(() => {
|
|
2333
|
+
// Don't emit the first change.
|
|
2334
|
+
if (this.lastActiveTabIndex !== undefined) {
|
|
2335
|
+
// Wait for the tab components to render changes before updating the view.
|
|
2336
|
+
setTimeout(() => {
|
|
2337
|
+
this.#updateTabsetComponent(this.#tabsetService.currentActiveTabIndex, true);
|
|
2338
|
+
this.#emitTabIndexChange();
|
|
2339
|
+
});
|
|
2340
|
+
}
|
|
2341
|
+
});
|
|
2342
|
+
combineLatest(this.tabs.map((tab) => tab.stateChange))
|
|
2343
|
+
.pipe(takeUntil(race(this.#tabComponentsStateChangeUnsubscribe, this.#ngUnsubscribe)))
|
|
2344
|
+
.subscribe(() => {
|
|
2345
|
+
// Wait for the tab components to render changes before finding the active one.
|
|
2346
|
+
setTimeout(() => {
|
|
2347
|
+
this.#updateTabsetComponent(this.#tabsetService.currentActiveTabIndex, true);
|
|
2348
|
+
});
|
|
2349
|
+
});
|
|
2350
|
+
}
|
|
2351
|
+
}
|
|
2352
|
+
#initTabComponents() {
|
|
2353
|
+
this.tabs?.forEach((tab) => tab.init());
|
|
2354
|
+
}
|
|
2355
|
+
#resetTabComponents() {
|
|
2356
|
+
this.#unsubscribeTabComponentsStateChange();
|
|
2357
|
+
this.#tabsetService.unregisterAll();
|
|
2358
|
+
// If there are no tab components, do a hard reset of the view.
|
|
2359
|
+
if (this.tabs?.length === 0) {
|
|
2360
|
+
this.#updateTabsetComponent(0, true);
|
|
2361
|
+
return;
|
|
2362
|
+
}
|
|
2363
|
+
this.#initTabComponents();
|
|
2364
|
+
const activeIndex = this.#getActiveTabComponent()?.tabIndex;
|
|
2365
|
+
this.#tabsetService.setActiveTabIndex(activeIndex, {
|
|
2366
|
+
emitChange: false,
|
|
2367
|
+
});
|
|
2368
|
+
this.#listenTabComponentsStateChange();
|
|
2369
|
+
}
|
|
2370
|
+
#emitTabIndexChange() {
|
|
2371
|
+
this.tabIndexesChange.emit({
|
|
2372
|
+
tabs: this.tabs?.map((tab) => ({
|
|
2373
|
+
tabHeading: tab.tabHeading,
|
|
2374
|
+
tabIndex: tab.tabIndex,
|
|
2375
|
+
})),
|
|
2376
|
+
});
|
|
2377
|
+
}
|
|
2378
|
+
#unsubscribeTabComponentsStateChange() {
|
|
2379
|
+
this.#tabComponentsStateChangeUnsubscribe.next();
|
|
2380
|
+
this.#tabComponentsStateChangeUnsubscribe.complete();
|
|
2381
|
+
this.#tabComponentsStateChangeUnsubscribe = new Subject();
|
|
2382
|
+
}
|
|
2383
|
+
#listenTabButtonsOverflowChange() {
|
|
2384
|
+
this.#adapterService.registerTabset(this.#elementRef);
|
|
2385
|
+
this.#adapterService.overflowChange
|
|
2386
|
+
.pipe(takeUntil(this.#ngUnsubscribe))
|
|
2387
|
+
.subscribe((isOverflowing) => {
|
|
2388
|
+
this.tabDisplayMode = isOverflowing ? 'dropdown' : 'tabs';
|
|
2389
|
+
this.#changeDetector.markForCheck();
|
|
2390
|
+
});
|
|
2391
|
+
}
|
|
2392
|
+
/**
|
|
2393
|
+
* Listen for back/forward history button presses to detect query param changes in the URL.
|
|
2394
|
+
*/
|
|
2395
|
+
#listenLocationPopStateChange() {
|
|
2396
|
+
this.#permalinkService.popStateChange
|
|
2397
|
+
.pipe(takeUntil(this.#ngUnsubscribe))
|
|
2398
|
+
.subscribe(() => {
|
|
2399
|
+
this.#setActiveTabIndexByPermalinkId();
|
|
2400
|
+
});
|
|
2401
|
+
}
|
|
2402
|
+
#setActiveTabIndexByPermalinkId() {
|
|
2403
|
+
const activeIndex = this.#getActiveTabIndexByPermalinkId();
|
|
2404
|
+
this.#tabsetService.setActiveTabIndex(activeIndex);
|
|
2405
|
+
}
|
|
2406
|
+
#getActiveTabIndexByPermalinkId() {
|
|
2407
|
+
if (this.permalinkId) {
|
|
2408
|
+
const paramValue = this.#permalinkService.getParam(this.permalinkId);
|
|
2409
|
+
if (paramValue) {
|
|
2410
|
+
return this.tabs?.find((tab) => tab.permalinkValueOrDefault === paramValue)?.tabIndex;
|
|
2411
|
+
}
|
|
2412
|
+
return undefined;
|
|
2413
|
+
}
|
|
2414
|
+
return undefined;
|
|
2415
|
+
}
|
|
2416
|
+
#getActiveTabComponent() {
|
|
2417
|
+
return this.tabs
|
|
2418
|
+
?.toArray()
|
|
2419
|
+
.reverse()
|
|
2420
|
+
.find((tab) => tab.active === true);
|
|
2421
|
+
}
|
|
2422
|
+
#createTabButtons(activeIndex) {
|
|
2423
|
+
// Safety check
|
|
2424
|
+
/* istanbul ignore next */
|
|
2425
|
+
if (!this.tabs) {
|
|
2426
|
+
return [];
|
|
2427
|
+
}
|
|
2428
|
+
return this.tabs.map((tab, index) => ({
|
|
2429
|
+
active: this.#tabsetService.tabIndexesEqual(tab.tabIndex, activeIndex),
|
|
2430
|
+
closeable: tab.isCloseable(),
|
|
2431
|
+
ariaControls: tab.tabPanelId,
|
|
2432
|
+
disabled: tab.disabled,
|
|
2433
|
+
buttonHref: tab.disabled
|
|
2434
|
+
? null
|
|
2435
|
+
: this.#permalinkService.getParamHref(this.permalinkId, tab.permalinkValueOrDefault),
|
|
2436
|
+
buttonId: tab.tabButtonId,
|
|
2437
|
+
buttonTextCount: tab.tabHeaderCount,
|
|
2438
|
+
buttonText: tab.tabHeading,
|
|
2439
|
+
tabIndex: tab.tabIndex,
|
|
2440
|
+
tabNumber: index + 1,
|
|
2441
|
+
totalTabsCount: this.tabs.length,
|
|
2442
|
+
}));
|
|
2443
|
+
}
|
|
2444
|
+
#updateTabButtons(activeIndex) {
|
|
2445
|
+
this.tabButtons.forEach((button) => {
|
|
2446
|
+
button.active = this.#tabsetService.tabIndexesEqual(button.tabIndex, activeIndex);
|
|
2447
|
+
});
|
|
2448
|
+
}
|
|
2449
|
+
/**
|
|
2450
|
+
* Updates the UI and state of the tabset component after the tab index or
|
|
2451
|
+
* tab components have changed.
|
|
2452
|
+
* @param activeIndex The currently active tab index.
|
|
2453
|
+
* @param regenerateTabButtons Indicates if tab button view models should be regenerated.
|
|
2454
|
+
* Setting this value to `false` will simply update the existing tab buttons. Setting this value
|
|
2455
|
+
* to `true` is only necessary when the underlying tab components have changed and the tab
|
|
2456
|
+
* buttons must reflect those changes.
|
|
2457
|
+
*/
|
|
2458
|
+
#updateTabsetComponent(activeIndex, regenerateTabButtons = false) {
|
|
2459
|
+
// Activate/deactivate tab components.
|
|
2460
|
+
this.tabs?.forEach((tab) => {
|
|
2461
|
+
this.#tabsetService.tabIndexesEqual(tab.tabIndex, activeIndex)
|
|
2462
|
+
? tab.activate()
|
|
2463
|
+
: tab.deactivate();
|
|
2464
|
+
});
|
|
2465
|
+
// Update the tab button models.
|
|
2466
|
+
if (regenerateTabButtons || !this.tabButtons.length) {
|
|
2467
|
+
this.tabButtons = this.#createTabButtons(activeIndex);
|
|
2468
|
+
}
|
|
2469
|
+
else {
|
|
2470
|
+
this.#updateTabButtons(activeIndex);
|
|
2471
|
+
}
|
|
2472
|
+
// Update the dropdown trigger button text.
|
|
2473
|
+
this.dropdownTriggerButtonText =
|
|
2474
|
+
this.tabButtons.find((b) => {
|
|
2475
|
+
return this.#tabsetService.tabIndexesEqual(b.tabIndex, activeIndex);
|
|
2476
|
+
})?.buttonText ?? '';
|
|
2477
|
+
// Set the query params based on active tab.
|
|
2478
|
+
if (this.permalinkId) {
|
|
2479
|
+
const activeTabComponent = this.tabs?.find((tab) => {
|
|
2480
|
+
return this.#tabsetService.tabIndexesEqual(tab.tabIndex, activeIndex);
|
|
2481
|
+
});
|
|
2482
|
+
if (activeTabComponent) {
|
|
2483
|
+
this.#permalinkService.setParam(this.permalinkId, activeTabComponent.permalinkValueOrDefault);
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2486
|
+
// Wait for tab button view models to render before gauging dimensions.
|
|
2487
|
+
setTimeout(() => {
|
|
2488
|
+
this.#adapterService.detectOverflow();
|
|
2489
|
+
});
|
|
2490
|
+
this.#changeDetector.markForCheck();
|
|
2491
|
+
// Emit the new active index value to consumers.
|
|
2492
|
+
if (this.lastActiveTabIndex !== activeIndex) {
|
|
2493
|
+
this.lastActiveTabIndex = activeIndex;
|
|
2494
|
+
this.activeChange.emit(activeIndex);
|
|
2495
|
+
}
|
|
2496
|
+
}
|
|
2497
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabsetComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: SkyTabsetAdapterService }, { token: SkyTabsetPermalinkService }, { token: SkyTabsetService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2498
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SkyTabsetComponent, selector: "sky-tabset", inputs: { active: "active", ariaLabel: "ariaLabel", ariaLabelledBy: "ariaLabelledBy", permalinkId: "permalinkId", tabStyle: "tabStyle" }, outputs: { activeChange: "activeChange", newTab: "newTab", openTab: "openTab", tabIndexesChange: "tabIndexesChange" }, host: { properties: { "class": "this.cssClass" } }, providers: [
|
|
2499
|
+
SkyTabsetAdapterService,
|
|
2500
|
+
SkyTabsetPermalinkService,
|
|
2501
|
+
SkyTabsetService,
|
|
2502
|
+
], queries: [{ propertyName: "tabs", predicate: SkyTabComponent }], ngImport: i0, template: "<div\n class=\"sky-tabset\"\n role=\"tablist\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledBy\"\n [ngClass]=\"\n 'sky-tabset-mode-' + tabDisplayMode + ' sky-tabset-style-' + tabStyle\n \"\n (window:resize)=\"onWindowResize()\"\n (keydown.arrowright)=\"onRightKeyDown()\"\n (keydown.arrowleft)=\"onLeftKeyDown()\"\n (keydown.home)=\"onHomeKeyDown()\"\n (keydown.end)=\"onEndKeyDown()\"\n>\n <span class=\"sky-tabset-dropdown\">\n <sky-dropdown *ngIf=\"tabDisplayMode === 'dropdown'\" buttonType=\"tab\">\n <sky-dropdown-button>\n {{ dropdownTriggerButtonText }}\n </sky-dropdown-button>\n <sky-dropdown-menu>\n <sky-dropdown-item\n *ngFor=\"let tabButton of tabButtons\"\n class=\"sky-tab-dropdown-menu-item\"\n >\n <div\n class=\"sky-tab-dropdown-item\"\n [ngClass]=\"{\n 'sky-tab-dropdown-item-selected': tabButton.active\n }\"\n >\n <ng-container\n *ngTemplateOutlet=\"\n tabButtonTemplate;\n context: {\n $implicit: tabButton\n }\n \"\n ></ng-container>\n </div>\n </sky-dropdown-item>\n </sky-dropdown-menu>\n </sky-dropdown>\n </span>\n <span class=\"sky-tabset-tabs\">\n <ng-container *ngFor=\"let tabButton of tabButtons\">\n <ng-container\n *ngTemplateOutlet=\"\n tabButtonTemplate;\n context: {\n $implicit: tabButton\n }\n \"\n ></ng-container>\n </ng-container>\n </span>\n <span class=\"sky-tabset-btns\">\n <button\n *ngIf=\"newTab.observers.length > 0\"\n class=\"sky-btn sky-btn-icon sky-tabset-btn-new sky-margin-inline-compact\"\n type=\"button\"\n [attr.aria-label]=\"'skyux_tab_add' | skyLibResources\"\n [skyThemeClass]=\"{\n 'sky-margin-inline-sm': 'modern'\n }\"\n (click)=\"onNewTabClick()\"\n >\n <sky-icon icon=\"plus-circle\" size=\"lg\"> </sky-icon>\n </button>\n <button\n *ngIf=\"openTab.observers.length > 0\"\n class=\"sky-btn sky-btn-icon sky-tabset-btn-open sky-margin-inline-compact\"\n type=\"button\"\n [attr.aria-label]=\"'skyux_tab_open' | skyLibResources\"\n [skyThemeClass]=\"{\n 'sky-margin-inline-sm': 'modern'\n }\"\n (click)=\"onOpenTabClick()\"\n >\n <sky-icon icon=\"folder-open-o\" size=\"lg\"> </sky-icon>\n </button>\n </span>\n</div>\n<ng-content></ng-content>\n\n<ng-template let-tabButton #tabButtonTemplate>\n <sky-tab-button\n [active]=\"tabButton.active\"\n [ariaControls]=\"tabButton.ariaControls\"\n [buttonHref]=\"tabButton.buttonHref\"\n [buttonId]=\"tabButton.buttonId\"\n [buttonText]=\"tabButton.buttonText\"\n [buttonTextCount]=\"tabButton.buttonTextCount\"\n [closeable]=\"tabButton.closeable\"\n [disabled]=\"tabButton.disabled\"\n [tabIndex]=\"tabButton.tabIndex\"\n [tabStyle]=\"tabStyle\"\n [tabNumber]=\"tabButton.tabNumber\"\n [totalTabsCount]=\"tabButton.totalTabsCount\"\n (buttonClick)=\"onTabButtonClick(tabButton)\"\n (closeClick)=\"onTabCloseClick(tabButton)\"\n ></sky-tab-button>\n</ng-template>\n", styles: ["sky-tabset.sky-tabset-layout-fit{position:absolute;inset:0;display:flex;flex-direction:column}sky-tabset.sky-tabset-layout-fit .sky-tabset{flex-grow:0}.sky-tabset{--sky-tabset-margin: 0;align-items:center;border-bottom:2px solid #0974a1;display:flex;list-style-type:none;margin:var(--sky-tabset-margin);padding:0 0 0 var(--sky-layout-host-tab-content-spacing, 15px);white-space:nowrap;flex-grow:var(--sky-layout-host-content-flex-grow, 0);overflow:var(--sky-layout-host-content-overflow, hidden);position:var(--sky-layout-host-content-position, static)}.sky-tabset.sky-tabset-style-wizard{border-bottom:none;padding-left:0}.sky-modal-content .sky-tabset-style-tabs{--sky-tabset-margin: var( --sky-compat-tabset-tabs-modal-margin, 0 -15px 20px )}.sky-modal-content .sky-tabset-style-wizard{--sky-tabset-margin: var( --sky-compat-tabset-wizard-modal-margin, 0 0 20px )}.sky-tabset-btns{order:1;padding-left:10px}.sky-tabset-dropdown{order:0;max-width:100%}.sky-tabset-mode-dropdown{line-height:0}.sky-tabset-mode-dropdown .sky-tabset-tabs{visibility:hidden;order:2}.sky-tab-dropdown-menu-item sky-tab-button{display:flex;min-width:300px}.sky-tab-dropdown-menu-item .sky-dropdown-item{margin:0}.sky-tab-dropdown-menu-item .sky-btn-tab-wrapper{width:100%;margin-right:0}.sky-tab-dropdown-menu-item .sky-btn-tab{margin:0;border-radius:0;width:100%;display:flex}.sky-tab-dropdown-menu-item .sky-btn-tab>.sky-tab-heading{flex:1 1 auto}.sky-tab-dropdown-menu-item .sky-btn-tab>.sky-btn-tab-close{flex:0 1 auto}.sky-tabset-tabs{order:0;white-space:nowrap}.sky-tabset-btn-new,.sky-tabset-btn-open{color:#0974a1}.sky-theme-modern .sky-modal-content .sky-tabset{--sky-tabset-margin: -10px -30px 30px;padding-left:30px;padding-right:30px}.sky-theme-modern .sky-tabset{border-bottom:1px solid #d2d2d2;overflow:visible}.sky-theme-modern .sky-tab-dropdown-menu-item .sky-btn-tab-wrapper{margin-right:0}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i5.λ2, selector: "sky-dropdown-button" }, { kind: "component", type: i5.λ3, selector: "sky-dropdown", inputs: ["buttonStyle", "buttonType", "disabled", "dismissOnBlur", "label", "horizontalAlignment", "messageStream", "title", "trigger"] }, { kind: "component", type: i5.λ1, selector: "sky-dropdown-item", inputs: ["ariaRole"] }, { kind: "component", type: i5.λ4, selector: "sky-dropdown-menu", inputs: ["ariaLabelledBy", "ariaRole", "useNativeFocus"], outputs: ["menuChanges"] }, { kind: "component", type: i6.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { kind: "directive", type: i7.λ2, selector: "[skyThemeClass]", inputs: ["class", "skyThemeClass"] }, { kind: "component", type: SkyTabButtonComponent, selector: "sky-tab-button", inputs: ["active", "ariaControls", "buttonHref", "buttonId", "buttonText", "buttonTextCount", "closeable", "disabled", "tabIndex", "tabNumber", "totalTabsCount", "tabStyle"], outputs: ["buttonClick", "closeClick"] }, { kind: "pipe", type: i3.SkyLibResourcesPipe, name: "skyLibResources" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
2503
|
+
}
|
|
2504
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabsetComponent, decorators: [{
|
|
2505
|
+
type: Component,
|
|
2506
|
+
args: [{ selector: 'sky-tabset', providers: [
|
|
2507
|
+
SkyTabsetAdapterService,
|
|
2508
|
+
SkyTabsetPermalinkService,
|
|
2509
|
+
SkyTabsetService,
|
|
2510
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<div\n class=\"sky-tabset\"\n role=\"tablist\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledBy\"\n [ngClass]=\"\n 'sky-tabset-mode-' + tabDisplayMode + ' sky-tabset-style-' + tabStyle\n \"\n (window:resize)=\"onWindowResize()\"\n (keydown.arrowright)=\"onRightKeyDown()\"\n (keydown.arrowleft)=\"onLeftKeyDown()\"\n (keydown.home)=\"onHomeKeyDown()\"\n (keydown.end)=\"onEndKeyDown()\"\n>\n <span class=\"sky-tabset-dropdown\">\n <sky-dropdown *ngIf=\"tabDisplayMode === 'dropdown'\" buttonType=\"tab\">\n <sky-dropdown-button>\n {{ dropdownTriggerButtonText }}\n </sky-dropdown-button>\n <sky-dropdown-menu>\n <sky-dropdown-item\n *ngFor=\"let tabButton of tabButtons\"\n class=\"sky-tab-dropdown-menu-item\"\n >\n <div\n class=\"sky-tab-dropdown-item\"\n [ngClass]=\"{\n 'sky-tab-dropdown-item-selected': tabButton.active\n }\"\n >\n <ng-container\n *ngTemplateOutlet=\"\n tabButtonTemplate;\n context: {\n $implicit: tabButton\n }\n \"\n ></ng-container>\n </div>\n </sky-dropdown-item>\n </sky-dropdown-menu>\n </sky-dropdown>\n </span>\n <span class=\"sky-tabset-tabs\">\n <ng-container *ngFor=\"let tabButton of tabButtons\">\n <ng-container\n *ngTemplateOutlet=\"\n tabButtonTemplate;\n context: {\n $implicit: tabButton\n }\n \"\n ></ng-container>\n </ng-container>\n </span>\n <span class=\"sky-tabset-btns\">\n <button\n *ngIf=\"newTab.observers.length > 0\"\n class=\"sky-btn sky-btn-icon sky-tabset-btn-new sky-margin-inline-compact\"\n type=\"button\"\n [attr.aria-label]=\"'skyux_tab_add' | skyLibResources\"\n [skyThemeClass]=\"{\n 'sky-margin-inline-sm': 'modern'\n }\"\n (click)=\"onNewTabClick()\"\n >\n <sky-icon icon=\"plus-circle\" size=\"lg\"> </sky-icon>\n </button>\n <button\n *ngIf=\"openTab.observers.length > 0\"\n class=\"sky-btn sky-btn-icon sky-tabset-btn-open sky-margin-inline-compact\"\n type=\"button\"\n [attr.aria-label]=\"'skyux_tab_open' | skyLibResources\"\n [skyThemeClass]=\"{\n 'sky-margin-inline-sm': 'modern'\n }\"\n (click)=\"onOpenTabClick()\"\n >\n <sky-icon icon=\"folder-open-o\" size=\"lg\"> </sky-icon>\n </button>\n </span>\n</div>\n<ng-content></ng-content>\n\n<ng-template let-tabButton #tabButtonTemplate>\n <sky-tab-button\n [active]=\"tabButton.active\"\n [ariaControls]=\"tabButton.ariaControls\"\n [buttonHref]=\"tabButton.buttonHref\"\n [buttonId]=\"tabButton.buttonId\"\n [buttonText]=\"tabButton.buttonText\"\n [buttonTextCount]=\"tabButton.buttonTextCount\"\n [closeable]=\"tabButton.closeable\"\n [disabled]=\"tabButton.disabled\"\n [tabIndex]=\"tabButton.tabIndex\"\n [tabStyle]=\"tabStyle\"\n [tabNumber]=\"tabButton.tabNumber\"\n [totalTabsCount]=\"tabButton.totalTabsCount\"\n (buttonClick)=\"onTabButtonClick(tabButton)\"\n (closeClick)=\"onTabCloseClick(tabButton)\"\n ></sky-tab-button>\n</ng-template>\n", styles: ["sky-tabset.sky-tabset-layout-fit{position:absolute;inset:0;display:flex;flex-direction:column}sky-tabset.sky-tabset-layout-fit .sky-tabset{flex-grow:0}.sky-tabset{--sky-tabset-margin: 0;align-items:center;border-bottom:2px solid #0974a1;display:flex;list-style-type:none;margin:var(--sky-tabset-margin);padding:0 0 0 var(--sky-layout-host-tab-content-spacing, 15px);white-space:nowrap;flex-grow:var(--sky-layout-host-content-flex-grow, 0);overflow:var(--sky-layout-host-content-overflow, hidden);position:var(--sky-layout-host-content-position, static)}.sky-tabset.sky-tabset-style-wizard{border-bottom:none;padding-left:0}.sky-modal-content .sky-tabset-style-tabs{--sky-tabset-margin: var( --sky-compat-tabset-tabs-modal-margin, 0 -15px 20px )}.sky-modal-content .sky-tabset-style-wizard{--sky-tabset-margin: var( --sky-compat-tabset-wizard-modal-margin, 0 0 20px )}.sky-tabset-btns{order:1;padding-left:10px}.sky-tabset-dropdown{order:0;max-width:100%}.sky-tabset-mode-dropdown{line-height:0}.sky-tabset-mode-dropdown .sky-tabset-tabs{visibility:hidden;order:2}.sky-tab-dropdown-menu-item sky-tab-button{display:flex;min-width:300px}.sky-tab-dropdown-menu-item .sky-dropdown-item{margin:0}.sky-tab-dropdown-menu-item .sky-btn-tab-wrapper{width:100%;margin-right:0}.sky-tab-dropdown-menu-item .sky-btn-tab{margin:0;border-radius:0;width:100%;display:flex}.sky-tab-dropdown-menu-item .sky-btn-tab>.sky-tab-heading{flex:1 1 auto}.sky-tab-dropdown-menu-item .sky-btn-tab>.sky-btn-tab-close{flex:0 1 auto}.sky-tabset-tabs{order:0;white-space:nowrap}.sky-tabset-btn-new,.sky-tabset-btn-open{color:#0974a1}.sky-theme-modern .sky-modal-content .sky-tabset{--sky-tabset-margin: -10px -30px 30px;padding-left:30px;padding-right:30px}.sky-theme-modern .sky-tabset{border-bottom:1px solid #d2d2d2;overflow:visible}.sky-theme-modern .sky-tab-dropdown-menu-item .sky-btn-tab-wrapper{margin-right:0}\n"] }]
|
|
2511
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: SkyTabsetAdapterService }, { type: SkyTabsetPermalinkService }, { type: SkyTabsetService }]; }, propDecorators: { active: [{
|
|
2512
|
+
type: Input
|
|
2513
|
+
}], ariaLabel: [{
|
|
2514
|
+
type: Input
|
|
2515
|
+
}], ariaLabelledBy: [{
|
|
2516
|
+
type: Input
|
|
2517
|
+
}], permalinkId: [{
|
|
2518
|
+
type: Input
|
|
2519
|
+
}], tabStyle: [{
|
|
2520
|
+
type: Input
|
|
2521
|
+
}], activeChange: [{
|
|
2522
|
+
type: Output
|
|
2523
|
+
}], newTab: [{
|
|
2524
|
+
type: Output
|
|
2525
|
+
}], openTab: [{
|
|
2526
|
+
type: Output
|
|
2527
|
+
}], tabIndexesChange: [{
|
|
2528
|
+
type: Output
|
|
2529
|
+
}], tabs: [{
|
|
2530
|
+
type: ContentChildren,
|
|
2531
|
+
args: [SkyTabComponent]
|
|
2532
|
+
}], cssClass: [{
|
|
2533
|
+
type: HostBinding,
|
|
2534
|
+
args: ['class']
|
|
2535
|
+
}] } });
|
|
2536
|
+
|
|
2537
|
+
class SkyTabsModule {
|
|
2538
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2539
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SkyTabsModule, declarations: [SkyTabButtonComponent,
|
|
2540
|
+
SkyTabComponent,
|
|
2541
|
+
SkyTabsetComponent,
|
|
2542
|
+
SkyTabsetNavButtonComponent,
|
|
2543
|
+
SkyTabsetNavButtonDisabledPipe], imports: [CommonModule,
|
|
2544
|
+
RouterModule,
|
|
2545
|
+
SkyDropdownModule,
|
|
2546
|
+
SkyI18nModule,
|
|
2547
|
+
SkyIconModule,
|
|
2548
|
+
SkyTabsResourcesModule,
|
|
2549
|
+
SkyThemeModule], exports: [SkyTabComponent, SkyTabsetComponent, SkyTabsetNavButtonComponent] }); }
|
|
2550
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabsModule, imports: [CommonModule,
|
|
2551
|
+
RouterModule,
|
|
2552
|
+
SkyDropdownModule,
|
|
2553
|
+
SkyI18nModule,
|
|
2554
|
+
SkyIconModule,
|
|
2555
|
+
SkyTabsResourcesModule,
|
|
2556
|
+
SkyThemeModule] }); }
|
|
2557
|
+
}
|
|
2558
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyTabsModule, decorators: [{
|
|
2559
|
+
type: NgModule,
|
|
2560
|
+
args: [{
|
|
2561
|
+
declarations: [
|
|
2562
|
+
SkyTabButtonComponent,
|
|
2563
|
+
SkyTabComponent,
|
|
2564
|
+
SkyTabsetComponent,
|
|
2565
|
+
SkyTabsetNavButtonComponent,
|
|
2566
|
+
SkyTabsetNavButtonDisabledPipe,
|
|
2567
|
+
],
|
|
2568
|
+
imports: [
|
|
2569
|
+
CommonModule,
|
|
2570
|
+
RouterModule,
|
|
2571
|
+
SkyDropdownModule,
|
|
2572
|
+
SkyI18nModule,
|
|
2573
|
+
SkyIconModule,
|
|
2574
|
+
SkyTabsResourcesModule,
|
|
2575
|
+
SkyThemeModule,
|
|
2576
|
+
],
|
|
2577
|
+
exports: [SkyTabComponent, SkyTabsetComponent, SkyTabsetNavButtonComponent],
|
|
2578
|
+
}]
|
|
2579
|
+
}] });
|
|
2580
|
+
|
|
2581
|
+
/**
|
|
2582
|
+
* Generated bundle index. Do not edit.
|
|
2583
|
+
*/
|
|
2584
|
+
|
|
2585
|
+
export { SkySectionedFormComponent, SkySectionedFormMessageType, SkySectionedFormModule, SkySectionedFormService, SkyTabsModule, SkyVerticalTabsetModule, SkyTabComponent as λ1, SkyTabsetComponent as λ2, SkyTabsetNavButtonComponent as λ3, SkyVerticalTabComponent as λ4, SkySectionedFormSectionComponent as λ5, SkyVerticalTabsetComponent as λ6, SkyVerticalTabsetGroupComponent as λ7 };
|
|
2586
|
+
//# sourceMappingURL=skyux-tabs.mjs.map
|