@skyux/core 5.6.2 → 5.7.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/bundles/skyux-core.umd.js +55 -31
- package/documentation.json +109 -109
- package/esm2015/lib/modules/dock/dock.service.js +18 -15
- package/esm2015/lib/modules/dock/dock.service.js.map +1 -1
- package/esm2015/lib/modules/numeric/numeric.options.js +1 -1
- package/esm2015/lib/modules/numeric/numeric.options.js.map +1 -1
- package/esm2015/lib/modules/scrollable-host/scrollable-host.service.js +35 -14
- package/esm2015/lib/modules/scrollable-host/scrollable-host.service.js.map +1 -1
- package/esm2015/lib/modules/shared/sky-core-resources.module.js +1 -1
- package/esm2015/lib/modules/shared/sky-core-resources.module.js.map +1 -1
- package/fesm2015/skyux-core.js +55 -31
- package/fesm2015/skyux-core.js.map +1 -1
- package/lib/modules/dock/dock.service.d.ts +2 -2
- package/lib/modules/numeric/numeric.options.d.ts +1 -1
- package/lib/modules/scrollable-host/scrollable-host.service.d.ts +2 -1
- package/lib/modules/shared/sky-core-resources.module.d.ts +1 -1
- package/package.json +2 -2
@@ -13,13 +13,12 @@ import * as i1 from "../dynamic-component/dynamic-component.service";
|
|
13
13
|
export class SkyDockService {
|
14
14
|
constructor(dynamicComponentService) {
|
15
15
|
this.dynamicComponentService = dynamicComponentService;
|
16
|
-
this._items = [];
|
17
16
|
}
|
18
17
|
/**
|
19
18
|
* Returns all docked items.
|
20
19
|
*/
|
21
20
|
get items() {
|
22
|
-
return
|
21
|
+
return SkyDockService._items;
|
23
22
|
}
|
24
23
|
/**
|
25
24
|
* Docks a component to the bottom of the page.
|
@@ -27,20 +26,20 @@ export class SkyDockService {
|
|
27
26
|
* @param config Options that affect the docking action.
|
28
27
|
*/
|
29
28
|
insertComponent(component, config) {
|
30
|
-
if (!
|
29
|
+
if (!SkyDockService.dockRef) {
|
31
30
|
this.createDock();
|
32
31
|
}
|
33
|
-
const itemRef =
|
32
|
+
const itemRef = SkyDockService.dockRef.instance.insertComponent(component, config);
|
34
33
|
const item = new SkyDockItem(itemRef.componentRef.instance, itemRef.stackOrder);
|
35
34
|
item.destroyed.subscribe(() => {
|
36
|
-
|
37
|
-
|
38
|
-
if (
|
35
|
+
SkyDockService.dockRef.instance.removeItem(itemRef);
|
36
|
+
SkyDockService._items.splice(SkyDockService._items.indexOf(item), 1);
|
37
|
+
if (SkyDockService._items.length === 0) {
|
39
38
|
this.destroyDock();
|
40
39
|
}
|
41
40
|
});
|
42
|
-
|
43
|
-
|
41
|
+
SkyDockService._items.push(item);
|
42
|
+
SkyDockService._items.sort(sortByStackOrder);
|
44
43
|
return item;
|
45
44
|
}
|
46
45
|
/**
|
@@ -73,20 +72,24 @@ export class SkyDockService {
|
|
73
72
|
referenceEl: this.options.referenceEl,
|
74
73
|
};
|
75
74
|
}
|
76
|
-
|
77
|
-
|
75
|
+
SkyDockService.dockRef = this.dynamicComponentService.createComponent(SkyDockComponent, dockOptions);
|
76
|
+
SkyDockService.dockRef.instance.setOptions(this.options);
|
78
77
|
}
|
79
78
|
destroyDock() {
|
80
|
-
this.dynamicComponentService.removeComponent(
|
81
|
-
|
79
|
+
this.dynamicComponentService.removeComponent(SkyDockService.dockRef);
|
80
|
+
SkyDockService.dockRef = undefined;
|
82
81
|
}
|
83
82
|
}
|
83
|
+
SkyDockService._items = [];
|
84
84
|
SkyDockService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDockService, deps: [{ token: i1.SkyDynamicComponentService }], target: i0.ɵɵFactoryTarget.Injectable });
|
85
|
-
SkyDockService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDockService, providedIn: '
|
85
|
+
SkyDockService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDockService, providedIn: 'any' });
|
86
86
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDockService, decorators: [{
|
87
87
|
type: Injectable,
|
88
88
|
args: [{
|
89
|
-
|
89
|
+
// Must be 'any' so that the dock component is created in the context of its module's injector.
|
90
|
+
// If set to 'root', the component's dependency injections would only be derived from the root
|
91
|
+
// injector and may loose context if the dock was opened from within a lazy-loaded module.
|
92
|
+
providedIn: 'any',
|
90
93
|
}]
|
91
94
|
}], ctorParameters: function () { return [{ type: i1.SkyDynamicComponentService }]; } });
|
92
95
|
//# sourceMappingURL=dock.service.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dock.service.js","sourceRoot":"","sources":["../../../../../../../../libs/components/core/src/lib/modules/dock/dock.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,UAAU,EAAQ,MAAM,eAAe,CAAC;AAE/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC;AAE9F,OAAO,EAAE,0BAA0B,EAAE,MAAM,gDAAgD,CAAC;AAG5F,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;;;AAEzD;;GAEG;
|
1
|
+
{"version":3,"file":"dock.service.js","sourceRoot":"","sources":["../../../../../../../../libs/components/core/src/lib/modules/dock/dock.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,UAAU,EAAQ,MAAM,eAAe,CAAC;AAE/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC;AAE9F,OAAO,EAAE,0BAA0B,EAAE,MAAM,gDAAgD,CAAC;AAG5F,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,gBA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,CAAC;IACzB,CAAC;IAEO,UAAU;QAChB,IAAI,WAAuC,CAAC;QAE5C,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,IAAI,eAA4C,CAAC;YACjD,QAAQ,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;gBAC7B,KAAK,eAAe,CAAC,aAAa;oBAChC,eAAe,GAAG,2BAA2B,CAAC,aAAa,CAAC;oBAC5D,MAAM;gBACR,KAAK,eAAe,CAAC,aAAa;oBAChC,eAAe,GAAG,2BAA2B,CAAC,aAAa,CAAC;oBAC5D,MAAM;gBACR;oBACE,eAAe,GAAG,2BAA2B,CAAC,OAAO,CAAC;oBACtD,MAAM;aACT;YAED,WAAW,GAAG;gBACZ,QAAQ,EAAE,eAAe;gBACzB,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW;aACtC,CAAC;SACH;QAED,cAAc,CAAC,OAAO,GAAG,IAAI,CAAC,uBAAuB,CAAC,eAAe,CACnE,gBAAgB,EAChB,WAAW,CACZ,CAAC;QACF,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3D,CAAC;IAEO,WAAW;QACjB,IAAI,CAAC,uBAAuB,CAAC,eAAe,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACrE,cAAc,CAAC,OAAO,GAAG,SAAS,CAAC;IACrC,CAAC;;AA7Fc,qBAAM,GAAuB,EAAE,CAAC;4GAFpC,cAAc;gHAAd,cAAc,cAFb,KAAK;4FAEN,cAAc;kBAN1B,UAAU;mBAAC;oBACV,+FAA+F;oBAC/F,8FAA8F;oBAC9F,0FAA0F;oBAC1F,UAAU,EAAE,KAAK;iBAClB","sourcesContent":["import { ComponentRef, Injectable, Type } from '@angular/core';\n\nimport { SkyDynamicComponentLocation } from '../dynamic-component/dynamic-component-location';\nimport { SkyDynamicComponentOptions } from '../dynamic-component/dynamic-component-options';\nimport { SkyDynamicComponentService } from '../dynamic-component/dynamic-component.service';\n\nimport { SkyDockInsertComponentConfig } from './dock-insert-component-config';\nimport { SkyDockItem } from './dock-item';\nimport { SkyDockLocation } from './dock-location';\nimport { SkyDockOptions } from './dock-options';\nimport { SkyDockComponent } from './dock.component';\nimport { sortByStackOrder } from './sort-by-stack-order';\n\n/**\n * This service docks components to specific areas on the page.\n */\n@Injectable({\n // Must be 'any' so that the dock component is created in the context of its module's injector.\n // If set to 'root', the component's dependency injections would only be derived from the root\n // injector and may loose context if the dock was opened from within a lazy-loaded module.\n providedIn: 'any',\n})\nexport class SkyDockService {\n private static dockRef: ComponentRef<SkyDockComponent>;\n private static _items: SkyDockItem<any>[] = [];\n\n /**\n * Returns all docked items.\n */\n public get items(): SkyDockItem<any>[] {\n return SkyDockService._items;\n }\n\n private options: SkyDockOptions;\n\n constructor(private dynamicComponentService: SkyDynamicComponentService) {}\n\n /**\n * Docks a component to the bottom of the page.\n * @param component The component to dock.\n * @param config Options that affect the docking action.\n */\n public insertComponent<T>(\n component: Type<T>,\n config?: SkyDockInsertComponentConfig\n ): SkyDockItem<T> {\n if (!SkyDockService.dockRef) {\n this.createDock();\n }\n\n const itemRef = SkyDockService.dockRef.instance.insertComponent(\n component,\n config\n );\n const item = new SkyDockItem(\n itemRef.componentRef.instance,\n itemRef.stackOrder\n );\n\n item.destroyed.subscribe(() => {\n SkyDockService.dockRef.instance.removeItem(itemRef);\n SkyDockService._items.splice(SkyDockService._items.indexOf(item), 1);\n if (SkyDockService._items.length === 0) {\n this.destroyDock();\n }\n });\n\n SkyDockService._items.push(item);\n SkyDockService._items.sort(sortByStackOrder);\n\n return item;\n }\n\n /**\n * Sets options for the positioning and styling of the dock component. Since the dock service is a\n * singleton instance, these options will be applied to all components inserted into the dock. In\n * order to create a seperate dock with different options, consumers should provide a different\n * instance of the dock service.\n * @param options The options for positioning and styling\n */\n public setDockOptions(options: SkyDockOptions): void {\n this.options = options;\n }\n\n private createDock(): void {\n let dockOptions: SkyDynamicComponentOptions;\n\n if (this.options) {\n let dynamicLocation: SkyDynamicComponentLocation;\n switch (this.options.location) {\n case SkyDockLocation.BeforeElement:\n dynamicLocation = SkyDynamicComponentLocation.BeforeElement;\n break;\n case SkyDockLocation.ElementBottom:\n dynamicLocation = SkyDynamicComponentLocation.ElementBottom;\n break;\n default:\n dynamicLocation = SkyDynamicComponentLocation.BodyTop;\n break;\n }\n\n dockOptions = {\n location: dynamicLocation,\n referenceEl: this.options.referenceEl,\n };\n }\n\n SkyDockService.dockRef = this.dynamicComponentService.createComponent(\n SkyDockComponent,\n dockOptions\n );\n SkyDockService.dockRef.instance.setOptions(this.options);\n }\n\n private destroyDock(): void {\n this.dynamicComponentService.removeComponent(SkyDockService.dockRef);\n SkyDockService.dockRef = undefined;\n }\n}\n"]}
|
@@ -27,7 +27,7 @@ export class NumericOptions {
|
|
27
27
|
this.iso = 'USD';
|
28
28
|
/**
|
29
29
|
* Indicates whether to shorten numbers to rounded numbers and abbreviation characters
|
30
|
-
* such as K for thousands, M for millions, B for billions, and T for
|
30
|
+
* such as K for thousands, M for millions, B for billions, and T for trillions.
|
31
31
|
*/
|
32
32
|
this.truncate = true;
|
33
33
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"numeric.options.js","sourceRoot":"","sources":["../../../../../../../../libs/components/core/src/lib/modules/numeric/numeric.options.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,cAAc;IAA3B;QACE;;;WAGG;QACI,WAAM,GAAY,CAAC,CAAC;QAE3B;;;WAGG;QACI,WAAM,GAAY,QAAQ,CAAC;QAElC;;;WAGG;QACI,iBAAY,GAA+B,UAAU,CAAC;QAE7D;;;;;WAKG;QACI,QAAG,GAAY,KAAK,CAAC;QAc5B;;;WAGG;QACI,aAAQ,GAAa,IAAI,CAAC;QAEjC;;;;WAIG;QACI,kBAAa,GAAY,CAAC,CAAC;IACpC,CAAC;CAAA","sourcesContent":["/**\n * Provides arguments for the number to format.\n */\nexport class NumericOptions {\n /**\n * Specifies the maximum number of digits after the decimal separator.\n * @default 1\n */\n public digits?: number = 1;\n\n /**\n * Specifies how to format the number. Options are `currency` or `number`.\n * @default \"number\"\n */\n public format?: string = 'number';\n\n /**\n * Specifies the format of the currency.\n * @default \"standard\"\n */\n public currencySign?: 'accounting' | 'standard' = 'standard';\n\n /**\n * Specifies the ISO4217 currency code to use for currency formatting. If you do not specify a\n * currency code, the component uses the browser's culture to determine the currency unless your\n * SPA provides a different culture with `SkyAppLocaleProvider`.\n * @default \"USD\"\n */\n public iso?: string = 'USD';\n\n /**\n * Specifies the locale code to use when formatting.\n */\n public locale?: string;\n\n /**\n * Specifies the minimum number of digits after the decimal separator. This property only applies\n * when the `truncate` property is set to `false`. If `digits` specifies a maximum number of\n * digits, then `minDigits` must be less than that value.\n */\n public minDigits?: number;\n\n /**\n * Indicates whether to shorten numbers to rounded numbers and abbreviation characters\n * such as K for thousands, M for millions, B for billions, and T for
|
1
|
+
{"version":3,"file":"numeric.options.js","sourceRoot":"","sources":["../../../../../../../../libs/components/core/src/lib/modules/numeric/numeric.options.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,cAAc;IAA3B;QACE;;;WAGG;QACI,WAAM,GAAY,CAAC,CAAC;QAE3B;;;WAGG;QACI,WAAM,GAAY,QAAQ,CAAC;QAElC;;;WAGG;QACI,iBAAY,GAA+B,UAAU,CAAC;QAE7D;;;;;WAKG;QACI,QAAG,GAAY,KAAK,CAAC;QAc5B;;;WAGG;QACI,aAAQ,GAAa,IAAI,CAAC;QAEjC;;;;WAIG;QACI,kBAAa,GAAY,CAAC,CAAC;IACpC,CAAC;CAAA","sourcesContent":["/**\n * Provides arguments for the number to format.\n */\nexport class NumericOptions {\n /**\n * Specifies the maximum number of digits after the decimal separator.\n * @default 1\n */\n public digits?: number = 1;\n\n /**\n * Specifies how to format the number. Options are `currency` or `number`.\n * @default \"number\"\n */\n public format?: string = 'number';\n\n /**\n * Specifies the format of the currency.\n * @default \"standard\"\n */\n public currencySign?: 'accounting' | 'standard' = 'standard';\n\n /**\n * Specifies the ISO4217 currency code to use for currency formatting. If you do not specify a\n * currency code, the component uses the browser's culture to determine the currency unless your\n * SPA provides a different culture with `SkyAppLocaleProvider`.\n * @default \"USD\"\n */\n public iso?: string = 'USD';\n\n /**\n * Specifies the locale code to use when formatting.\n */\n public locale?: string;\n\n /**\n * Specifies the minimum number of digits after the decimal separator. This property only applies\n * when the `truncate` property is set to `false`. If `digits` specifies a maximum number of\n * digits, then `minDigits` must be less than that value.\n */\n public minDigits?: number;\n\n /**\n * Indicates whether to shorten numbers to rounded numbers and abbreviation characters\n * such as K for thousands, M for millions, B for billions, and T for trillions.\n */\n public truncate?: boolean = true;\n\n /**\n * Specifies the starting point after which numbers are shortened to rounded numbers\n * and abbreviation characters.\n * @default 0\n */\n public truncateAfter?: number = 0;\n}\n"]}
|
@@ -33,20 +33,30 @@ export class SkyScrollableHostService {
|
|
33
33
|
*/
|
34
34
|
watchScrollableHost(elementRef) {
|
35
35
|
const subscribers = [];
|
36
|
-
let
|
36
|
+
let parentMutationObserver;
|
37
|
+
let documentHiddenElementMutationObserver;
|
37
38
|
return new Observable((subscriber) => {
|
38
39
|
subscribers.push(subscriber);
|
39
40
|
let scrollableHost = this.findScrollableHost(elementRef.nativeElement);
|
40
41
|
if (subscribers.length === 1) {
|
41
|
-
|
42
|
+
parentMutationObserver = this.mutationObserverSvc.create(() => {
|
42
43
|
const newScrollableHost = this.findScrollableHost(elementRef.nativeElement);
|
43
|
-
if (newScrollableHost !== scrollableHost
|
44
|
+
if (newScrollableHost !== scrollableHost &&
|
45
|
+
elementRef.nativeElement.offsetParent) {
|
44
46
|
scrollableHost = newScrollableHost;
|
45
|
-
this.observeForScrollableHostChanges(scrollableHost,
|
47
|
+
this.observeForScrollableHostChanges(scrollableHost, parentMutationObserver);
|
46
48
|
notifySubscribers(subscribers, scrollableHost);
|
47
49
|
}
|
48
50
|
});
|
49
|
-
this.observeForScrollableHostChanges(scrollableHost,
|
51
|
+
this.observeForScrollableHostChanges(scrollableHost, parentMutationObserver);
|
52
|
+
documentHiddenElementMutationObserver = this.mutationObserverSvc.create(() => {
|
53
|
+
if (!elementRef.nativeElement.offsetParent) {
|
54
|
+
scrollableHost = undefined;
|
55
|
+
this.observeForScrollableHostChanges(scrollableHost, parentMutationObserver);
|
56
|
+
notifySubscribers(subscribers, scrollableHost);
|
57
|
+
}
|
58
|
+
});
|
59
|
+
this.observeDocumentHiddenElementChanges(documentHiddenElementMutationObserver);
|
50
60
|
}
|
51
61
|
subscriber.next(scrollableHost);
|
52
62
|
subscriber.add(() => {
|
@@ -57,7 +67,8 @@ export class SkyScrollableHostService {
|
|
57
67
|
subscribers.splice(subIndex, 1);
|
58
68
|
}
|
59
69
|
if (subscribers.length === 0) {
|
60
|
-
|
70
|
+
documentHiddenElementMutationObserver.disconnect();
|
71
|
+
parentMutationObserver.disconnect();
|
61
72
|
}
|
62
73
|
});
|
63
74
|
});
|
@@ -66,7 +77,7 @@ export class SkyScrollableHostService {
|
|
66
77
|
* Returns an observable which emits whenever the element's scrollable host emits a scroll event. The observable will always emit the scroll events from the elements current scrollable host and will update based on any scrollable host changes. The observable will also emit once whenever the scrollable host changes.
|
67
78
|
* @param elementRef The element whose scrollable host scroll events are being requested
|
68
79
|
* @param completionObservable An observable which alerts the internal observers that they should complete
|
69
|
-
* @returns An observable which emits the
|
80
|
+
* @returns An observable which emits when the elements scrollable host is scrolled or is changed
|
70
81
|
*/
|
71
82
|
watchScrollableHostScrollEvents(elementRef) {
|
72
83
|
const subscribers = [];
|
@@ -85,11 +96,13 @@ export class SkyScrollableHostService {
|
|
85
96
|
}
|
86
97
|
scrollableHost = newScrollableHost;
|
87
98
|
newScrollableHostObservable = new Subject();
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
99
|
+
if (newScrollableHost) {
|
100
|
+
scrollEventSubscription = fromEvent(newScrollableHost, 'scroll')
|
101
|
+
.pipe(takeUntil(newScrollableHostObservable))
|
102
|
+
.subscribe(() => {
|
103
|
+
notifySubscribers(subscribers);
|
104
|
+
});
|
105
|
+
}
|
93
106
|
});
|
94
107
|
}
|
95
108
|
subscriber.add(() => {
|
@@ -132,12 +145,20 @@ export class SkyScrollableHostService {
|
|
132
145
|
}
|
133
146
|
return parent;
|
134
147
|
}
|
148
|
+
observeDocumentHiddenElementChanges(mutationObserver) {
|
149
|
+
mutationObserver.observe(document.documentElement, {
|
150
|
+
attributes: true,
|
151
|
+
attributeFilter: ['class', 'style', 'hidden'],
|
152
|
+
childList: true,
|
153
|
+
subtree: true,
|
154
|
+
});
|
155
|
+
}
|
135
156
|
observeForScrollableHostChanges(element, mutationObserver) {
|
136
157
|
mutationObserver.disconnect();
|
137
158
|
if (element instanceof HTMLElement) {
|
138
159
|
mutationObserver.observe(element, {
|
139
160
|
attributes: true,
|
140
|
-
attributeFilter: ['class', 'style
|
161
|
+
attributeFilter: ['class', 'style'],
|
141
162
|
childList: true,
|
142
163
|
subtree: true,
|
143
164
|
});
|
@@ -145,7 +166,7 @@ export class SkyScrollableHostService {
|
|
145
166
|
else {
|
146
167
|
mutationObserver.observe(document.documentElement, {
|
147
168
|
attributes: true,
|
148
|
-
attributeFilter: ['class', 'style
|
169
|
+
attributeFilter: ['class', 'style'],
|
149
170
|
childList: true,
|
150
171
|
subtree: true,
|
151
172
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"scrollable-host.service.js","sourceRoot":"","sources":["../../../../../../../../libs/components/core/src/lib/modules/scrollable-host/scrollable-host.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,OAAO,EAA4B,SAAS,EAAE,MAAM,MAAM,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE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AAS,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;SAC5C,QACC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;YAC3B,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;YAC5B,MAAM,KAAK,OAAO,EAClB;QAEF,IAAI,MAAM,KAAK,OAAO,EAAE;YACtB,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,+BAA+B,CACrC,OAA6B,EAC7B,gBAAkC;QAElC,gBAAgB,CAAC,UAAU,EAAE,CAAC;QAC9B,IAAI,OAAO,YAAY,WAAW,EAAE;YAClC,gBAAgB,CAAC,OAAO,CAAC,OAAO,EAAE;gBAChC,UAAU,EAAE,IAAI;gBAChB,eAAe,EAAE,CAAC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,CAAC;gBAChE,SAAS,EAAE,IAAI;gBACf,OAAO,EAAE,IAAI;aACd,CAAC,CAAC;SACJ;aAAM;YACL,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,EAAE;gBACjD,UAAU,EAAE,IAAI;gBAChB,eAAe,EAAE,CAAC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,CAAC;gBAChE,SAAS,EAAE,IAAI;gBACf,OAAO,EAAE,IAAI;aACd,CAAC,CAAC;SACJ;IACH,CAAC;;sHAlLU,wBAAwB;0HAAxB,wBAAwB,cAFvB,MAAM;4FAEP,wBAAwB;kBAHpC,UAAU;mBAAC;oBACV,UAAU,EAAE,MAAM;iBACnB","sourcesContent":["import { ElementRef, Injectable } from '@angular/core';\n\nimport { Observable, Subject, Subscriber, Subscription, fromEvent } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { MutationObserverService } from '../mutation/mutation-observer-service';\nimport { SkyAppWindowRef } from '../window/window-ref';\n\nfunction notifySubscribers(subscribers: Subscriber<unknown>[], item?: unknown) {\n for (const subscriber of subscribers) {\n subscriber.next(item);\n }\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SkyScrollableHostService {\n constructor(\n private mutationObserverSvc: MutationObserverService,\n private windowRef: SkyAppWindowRef\n ) {}\n\n /**\n * Returns the given element's current scrollable host\n * @param elementRef The element whose scrollable host is being requested\n * @returns The current scrollable host\n */\n public getScrollableHost(elementRef: ElementRef): HTMLElement | Window {\n return this.findScrollableHost(elementRef.nativeElement);\n }\n\n /**\n * Returns an observable which emits the given element's current scrollable host\n * @param elementRef The element whose scrollable host is being requested\n * @param completionObservable An observable which alerts the internal observers that they should complete\n * @returns An observable which emits the current scrollable host\n * @internal\n */\n public watchScrollableHost(\n elementRef: ElementRef\n ): Observable<HTMLElement | Window> {\n const subscribers: Subscriber<HTMLElement | Window>[] = [];\n let mutationObserver: MutationObserver;\n\n return new Observable((subscriber) => {\n subscribers.push(subscriber);\n\n let scrollableHost = this.findScrollableHost(elementRef.nativeElement);\n if (subscribers.length === 1) {\n mutationObserver = this.mutationObserverSvc.create(() => {\n const newScrollableHost = this.findScrollableHost(\n elementRef.nativeElement\n );\n\n if (newScrollableHost !== scrollableHost) {\n scrollableHost = newScrollableHost;\n this.observeForScrollableHostChanges(\n scrollableHost,\n mutationObserver\n );\n\n notifySubscribers(subscribers, scrollableHost);\n }\n });\n this.observeForScrollableHostChanges(scrollableHost, mutationObserver);\n }\n subscriber.next(scrollableHost);\n\n subscriber.add(() => {\n const subIndex = subscribers.indexOf(subscriber);\n\n /* sanity check */\n /* istanbul ignore else */\n if (subIndex >= 0) {\n subscribers.splice(subIndex, 1);\n }\n\n if (subscribers.length === 0) {\n mutationObserver.disconnect();\n }\n });\n });\n }\n\n /**\n * Returns an observable which emits whenever the element's scrollable host emits a scroll event. The observable will always emit the scroll events from the elements current scrollable host and will update based on any scrollable host changes. The observable will also emit once whenever the scrollable host changes.\n * @param elementRef The element whose scrollable host scroll events are being requested\n * @param completionObservable An observable which alerts the internal observers that they should complete\n * @returns An observable which emits the scroll events from the given element's scrollable host\n */\n public watchScrollableHostScrollEvents(\n elementRef: ElementRef\n ): Observable<void> {\n const subscribers: Subscriber<void>[] = [];\n let scrollableHost: HTMLElement | Window;\n\n let newScrollableHostObservable = new Subject();\n let scrollableHostSubscription: Subscription;\n let scrollEventSubscription: Subscription;\n return new Observable((subscriber) => {\n subscribers.push(subscriber);\n\n if (subscribers.length === 1) {\n scrollableHostSubscription = this.watchScrollableHost(\n elementRef\n ).subscribe((newScrollableHost) => {\n newScrollableHostObservable.next();\n newScrollableHostObservable.complete();\n if (scrollableHost && scrollableHost !== newScrollableHost) {\n notifySubscribers(subscribers);\n }\n scrollableHost = newScrollableHost;\n newScrollableHostObservable = new Subject();\n scrollEventSubscription = fromEvent(newScrollableHost, 'scroll')\n .pipe(takeUntil(newScrollableHostObservable))\n .subscribe(() => {\n notifySubscribers(subscribers);\n });\n });\n }\n\n subscriber.add(() => {\n const subIndex = subscribers.indexOf(subscriber);\n\n /* sanity check */\n /* istanbul ignore else */\n if (subIndex >= 0) {\n subscribers.splice(subIndex, 1);\n }\n\n if (subscribers.length === 0) {\n scrollableHostSubscription.unsubscribe();\n scrollEventSubscription.unsubscribe();\n newScrollableHostObservable.complete();\n }\n });\n });\n }\n\n private findScrollableHost(element: HTMLElement): HTMLElement | Window {\n const regex = /(auto|scroll)/;\n const windowObj = this.windowRef.nativeWindow;\n const bodyObj = windowObj.document.body;\n\n /* Sanity check */\n if (!element) {\n return windowObj;\n }\n\n let style = windowObj.getComputedStyle(element);\n let parent: HTMLElement = element;\n\n do {\n parent = parent.parentNode as HTMLElement;\n\n /* Sanity check for if this function is called for an element which has been removed from the DOM */\n if (!(parent instanceof HTMLElement)) {\n return windowObj;\n }\n\n style = windowObj.getComputedStyle(parent);\n } while (\n !regex.test(style.overflow) &&\n !regex.test(style.overflowY) &&\n parent !== bodyObj\n );\n\n if (parent === bodyObj) {\n return windowObj;\n }\n\n return parent;\n }\n\n private observeForScrollableHostChanges(\n element: HTMLElement | Window,\n mutationObserver: MutationObserver\n ) {\n mutationObserver.disconnect();\n if (element instanceof HTMLElement) {\n mutationObserver.observe(element, {\n attributes: true,\n attributeFilter: ['class', 'style.overflow', 'style.overflow-y'],\n childList: true,\n subtree: true,\n });\n } else {\n mutationObserver.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['class', 'style.overflow', 'style.overflow-y'],\n childList: true,\n subtree: true,\n });\n }\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"scrollable-host.service.js","sourceRoot":"","sources":["../../../../../../../../libs/components/core/src/lib/modules/scrollable-host/scrollable-host.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,OAAO,EAA4B,SAAS,EAAE,MAAM,MAAM,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;;;;AAEvD,SAAS,iBAAiB,CAAC,WAAkC,EAAE,IAAc;IAC3E,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;QACpC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACvB;AACH,CAAC;AAKD,MAAM,OAAO,wBAAwB;IACnC,YACU,mBAA4C,EAC5C,SAA0B;QAD1B,wBAAmB,GAAnB,mBAAmB,CAAyB;QAC5C,cAAS,GAAT,SAAS,CAAiB;IACjC,CAAC;IAEJ;;;;OAIG;IACI,iBAAiB,CAAC,UAAsB;QAC7C,OAAO,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;OAMG;IACI,mBAAmB,CACxB,UAAsB;QAEtB,MAAM,WAAW,GAAuC,EAAE,CAAC;QAC3D,IAAI,sBAAwC,CAAC;QAC7C,IAAI,qCAAuD,CAAC;QAE5D,OAAO,I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C;YAC3B,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;YAC5B,MAAM,KAAK,OAAO,EAClB;QAEF,IAAI,MAAM,KAAK,OAAO,EAAE;YACtB,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,mCAAmC,CACzC,gBAAkC;QAElC,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,EAAE;YACjD,UAAU,EAAE,IAAI;YAChB,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC;YAC7C,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;IACL,CAAC;IAEO,+BAA+B,CACrC,OAA6B,EAC7B,gBAAkC;QAElC,gBAAgB,CAAC,UAAU,EAAE,CAAC;QAC9B,IAAI,OAAO,YAAY,WAAW,EAAE;YAClC,gBAAgB,CAAC,OAAO,CAAC,OAAO,EAAE;gBAChC,UAAU,EAAE,IAAI;gBAChB,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;gBACnC,SAAS,EAAE,IAAI;gBACf,OAAO,EAAE,IAAI;aACd,CAAC,CAAC;SACJ;aAAM;YACL,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,EAAE;gBACjD,UAAU,EAAE,IAAI;gBAChB,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;gBACnC,SAAS,EAAE,IAAI;gBACf,OAAO,EAAE,IAAI;aACd,CAAC,CAAC;SACJ;IACH,CAAC;;sHAzNU,wBAAwB;0HAAxB,wBAAwB,cAFvB,MAAM;4FAEP,wBAAwB;kBAHpC,UAAU;mBAAC;oBACV,UAAU,EAAE,MAAM;iBACnB","sourcesContent":["import { ElementRef, Injectable } from '@angular/core';\n\nimport { Observable, Subject, Subscriber, Subscription, fromEvent } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { MutationObserverService } from '../mutation/mutation-observer-service';\nimport { SkyAppWindowRef } from '../window/window-ref';\n\nfunction notifySubscribers(subscribers: Subscriber<unknown>[], item?: unknown) {\n for (const subscriber of subscribers) {\n subscriber.next(item);\n }\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SkyScrollableHostService {\n constructor(\n private mutationObserverSvc: MutationObserverService,\n private windowRef: SkyAppWindowRef\n ) {}\n\n /**\n * Returns the given element's current scrollable host\n * @param elementRef The element whose scrollable host is being requested\n * @returns The current scrollable host\n */\n public getScrollableHost(elementRef: ElementRef): HTMLElement | Window {\n return this.findScrollableHost(elementRef.nativeElement);\n }\n\n /**\n * Returns an observable which emits the given element's current scrollable host\n * @param elementRef The element whose scrollable host is being requested\n * @param completionObservable An observable which alerts the internal observers that they should complete\n * @returns An observable which emits the current scrollable host\n * @internal\n */\n public watchScrollableHost(\n elementRef: ElementRef\n ): Observable<HTMLElement | Window> {\n const subscribers: Subscriber<HTMLElement | Window>[] = [];\n let parentMutationObserver: MutationObserver;\n let documentHiddenElementMutationObserver: MutationObserver;\n\n return new Observable((subscriber) => {\n subscribers.push(subscriber);\n\n let scrollableHost = this.findScrollableHost(elementRef.nativeElement);\n if (subscribers.length === 1) {\n parentMutationObserver = this.mutationObserverSvc.create(() => {\n const newScrollableHost = this.findScrollableHost(\n elementRef.nativeElement\n );\n\n if (\n newScrollableHost !== scrollableHost &&\n elementRef.nativeElement.offsetParent\n ) {\n scrollableHost = newScrollableHost;\n this.observeForScrollableHostChanges(\n scrollableHost,\n parentMutationObserver\n );\n\n notifySubscribers(subscribers, scrollableHost);\n }\n });\n this.observeForScrollableHostChanges(\n scrollableHost,\n parentMutationObserver\n );\n\n documentHiddenElementMutationObserver = this.mutationObserverSvc.create(\n () => {\n if (!elementRef.nativeElement.offsetParent) {\n scrollableHost = undefined;\n\n this.observeForScrollableHostChanges(\n scrollableHost,\n parentMutationObserver\n );\n\n notifySubscribers(subscribers, scrollableHost);\n }\n }\n );\n this.observeDocumentHiddenElementChanges(\n documentHiddenElementMutationObserver\n );\n }\n subscriber.next(scrollableHost);\n\n subscriber.add(() => {\n const subIndex = subscribers.indexOf(subscriber);\n\n /* sanity check */\n /* istanbul ignore else */\n if (subIndex >= 0) {\n subscribers.splice(subIndex, 1);\n }\n\n if (subscribers.length === 0) {\n documentHiddenElementMutationObserver.disconnect();\n parentMutationObserver.disconnect();\n }\n });\n });\n }\n\n /**\n * Returns an observable which emits whenever the element's scrollable host emits a scroll event. The observable will always emit the scroll events from the elements current scrollable host and will update based on any scrollable host changes. The observable will also emit once whenever the scrollable host changes.\n * @param elementRef The element whose scrollable host scroll events are being requested\n * @param completionObservable An observable which alerts the internal observers that they should complete\n * @returns An observable which emits when the elements scrollable host is scrolled or is changed\n */\n public watchScrollableHostScrollEvents(\n elementRef: ElementRef\n ): Observable<void> {\n const subscribers: Subscriber<void>[] = [];\n let scrollableHost: HTMLElement | Window;\n\n let newScrollableHostObservable = new Subject();\n let scrollableHostSubscription: Subscription;\n let scrollEventSubscription: Subscription;\n return new Observable((subscriber) => {\n subscribers.push(subscriber);\n\n if (subscribers.length === 1) {\n scrollableHostSubscription = this.watchScrollableHost(\n elementRef\n ).subscribe((newScrollableHost) => {\n newScrollableHostObservable.next();\n newScrollableHostObservable.complete();\n if (scrollableHost && scrollableHost !== newScrollableHost) {\n notifySubscribers(subscribers);\n }\n scrollableHost = newScrollableHost;\n newScrollableHostObservable = new Subject();\n if (newScrollableHost) {\n scrollEventSubscription = fromEvent(newScrollableHost, 'scroll')\n .pipe(takeUntil(newScrollableHostObservable))\n .subscribe(() => {\n notifySubscribers(subscribers);\n });\n }\n });\n }\n\n subscriber.add(() => {\n const subIndex = subscribers.indexOf(subscriber);\n\n /* sanity check */\n /* istanbul ignore else */\n if (subIndex >= 0) {\n subscribers.splice(subIndex, 1);\n }\n\n if (subscribers.length === 0) {\n scrollableHostSubscription.unsubscribe();\n scrollEventSubscription.unsubscribe();\n newScrollableHostObservable.complete();\n }\n });\n });\n }\n\n private findScrollableHost(element: HTMLElement): HTMLElement | Window {\n const regex = /(auto|scroll)/;\n const windowObj = this.windowRef.nativeWindow;\n const bodyObj = windowObj.document.body;\n\n /* Sanity check */\n if (!element) {\n return windowObj;\n }\n\n let style = windowObj.getComputedStyle(element);\n let parent: HTMLElement = element;\n\n do {\n parent = parent.parentNode as HTMLElement;\n\n /* Sanity check for if this function is called for an element which has been removed from the DOM */\n if (!(parent instanceof HTMLElement)) {\n return windowObj;\n }\n\n style = windowObj.getComputedStyle(parent);\n } while (\n !regex.test(style.overflow) &&\n !regex.test(style.overflowY) &&\n parent !== bodyObj\n );\n\n if (parent === bodyObj) {\n return windowObj;\n }\n\n return parent;\n }\n\n private observeDocumentHiddenElementChanges(\n mutationObserver: MutationObserver\n ) {\n mutationObserver.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['class', 'style', 'hidden'],\n childList: true,\n subtree: true,\n });\n }\n\n private observeForScrollableHostChanges(\n element: HTMLElement | Window,\n mutationObserver: MutationObserver\n ) {\n mutationObserver.disconnect();\n if (element instanceof HTMLElement) {\n mutationObserver.observe(element, {\n attributes: true,\n attributeFilter: ['class', 'style'],\n childList: true,\n subtree: true,\n });\n } else {\n mutationObserver.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['class', 'style'],\n childList: true,\n subtree: true,\n });\n }\n }\n}\n"]}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* NOTICE: DO NOT MODIFY THIS FILE!
|
3
3
|
* The contents of this file were automatically generated by
|
4
|
-
* the 'ng generate @skyux/i18n:lib-resources-module modules/shared/sky-core' schematic.
|
4
|
+
* the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-core' schematic.
|
5
5
|
* To update this file, simply rerun the command.
|
6
6
|
*/
|
7
7
|
import { NgModule } from '@angular/core';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"sky-core-resources.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/core/src/lib/modules/shared/sky-core-resources.module.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,2BAA2B,EAE3B,aAAa,EAGb,qBAAqB,GACtB,MAAM,aAAa,CAAC;;AAErB,MAAM,SAAS,GAA0C;IACvD,OAAO,EAAE;QACP,6BAA6B,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE;QAC/C,6BAA6B,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE;QAC/C,8BAA8B,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE;QAChD,8BAA8B,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE;KACjD;CACF,CAAC;AAEF,MAAM,OAAO,wBAAwB;IAC5B,SAAS,
|
1
|
+
{"version":3,"file":"sky-core-resources.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/core/src/lib/modules/shared/sky-core-resources.module.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,2BAA2B,EAE3B,aAAa,EAGb,qBAAqB,GACtB,MAAM,aAAa,CAAC;;AAErB,MAAM,SAAS,GAA0C;IACvD,OAAO,EAAE;QACP,6BAA6B,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE;QAC/C,6BAA6B,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE;QAC/C,8BAA8B,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE;QAChD,8BAA8B,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE;KACjD;CACF,CAAC;AAEF,MAAM,OAAO,wBAAwB;IAC5B,SAAS,CACd,UAA4B,EAC5B,IAAY;QAEZ,OAAO,qBAAqB,CAAC,SAAS,EAAE,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACnE,CAAC;CACF;AAED;;GAEG;AAWH,MAAM,OAAO,sBAAsB;;oHAAtB,sBAAsB;qHAAtB,sBAAsB,YATvB,aAAa;qHASZ,sBAAsB,aARtB;QACT;YACE,OAAO,EAAE,2BAA2B;YACpC,QAAQ,EAAE,wBAAwB;YAClC,KAAK,EAAE,IAAI;SACZ;KACF,YAPS,aAAa;4FASZ,sBAAsB;kBAVlC,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAC,aAAa,CAAC;oBACxB,SAAS,EAAE;wBACT;4BACE,OAAO,EAAE,2BAA2B;4BACpC,QAAQ,EAAE,wBAAwB;4BAClC,KAAK,EAAE,IAAI;yBACZ;qBACF;iBACF","sourcesContent":["/**\n * NOTICE: DO NOT MODIFY THIS FILE!\n * The contents of this file were automatically generated by\n * the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-core' schematic.\n * To update this file, simply rerun the command.\n */\nimport { NgModule } from '@angular/core';\nimport {\n SKY_LIB_RESOURCES_PROVIDERS,\n SkyAppLocaleInfo,\n SkyI18nModule,\n SkyLibResources,\n SkyLibResourcesProvider,\n getLibStringForLocale,\n} from '@skyux/i18n';\n\nconst RESOURCES: { [locale: string]: SkyLibResources } = {\n 'EN-US': {\n skyux_numeric_billions_symbol: { message: 'B' },\n skyux_numeric_millions_symbol: { message: 'M' },\n skyux_numeric_thousands_symbol: { message: 'K' },\n skyux_numeric_trillions_symbol: { message: 'T' },\n },\n};\n\nexport class SkyCoreResourcesProvider implements SkyLibResourcesProvider {\n public getString(\n localeInfo: SkyAppLocaleInfo,\n name: string\n ): string | undefined {\n return getLibStringForLocale(RESOURCES, localeInfo.locale, name);\n }\n}\n\n/**\n * Import into any component library module that needs to use resource strings.\n */\n@NgModule({\n exports: [SkyI18nModule],\n providers: [\n {\n provide: SKY_LIB_RESOURCES_PROVIDERS,\n useClass: SkyCoreResourcesProvider,\n multi: true,\n },\n ],\n})\nexport class SkyCoreResourcesModule {}\n"]}
|
package/fesm2015/skyux-core.js
CHANGED
@@ -1230,13 +1230,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
1230
1230
|
class SkyDockService {
|
1231
1231
|
constructor(dynamicComponentService) {
|
1232
1232
|
this.dynamicComponentService = dynamicComponentService;
|
1233
|
-
this._items = [];
|
1234
1233
|
}
|
1235
1234
|
/**
|
1236
1235
|
* Returns all docked items.
|
1237
1236
|
*/
|
1238
1237
|
get items() {
|
1239
|
-
return
|
1238
|
+
return SkyDockService._items;
|
1240
1239
|
}
|
1241
1240
|
/**
|
1242
1241
|
* Docks a component to the bottom of the page.
|
@@ -1244,20 +1243,20 @@ class SkyDockService {
|
|
1244
1243
|
* @param config Options that affect the docking action.
|
1245
1244
|
*/
|
1246
1245
|
insertComponent(component, config) {
|
1247
|
-
if (!
|
1246
|
+
if (!SkyDockService.dockRef) {
|
1248
1247
|
this.createDock();
|
1249
1248
|
}
|
1250
|
-
const itemRef =
|
1249
|
+
const itemRef = SkyDockService.dockRef.instance.insertComponent(component, config);
|
1251
1250
|
const item = new SkyDockItem(itemRef.componentRef.instance, itemRef.stackOrder);
|
1252
1251
|
item.destroyed.subscribe(() => {
|
1253
|
-
|
1254
|
-
|
1255
|
-
if (
|
1252
|
+
SkyDockService.dockRef.instance.removeItem(itemRef);
|
1253
|
+
SkyDockService._items.splice(SkyDockService._items.indexOf(item), 1);
|
1254
|
+
if (SkyDockService._items.length === 0) {
|
1256
1255
|
this.destroyDock();
|
1257
1256
|
}
|
1258
1257
|
});
|
1259
|
-
|
1260
|
-
|
1258
|
+
SkyDockService._items.push(item);
|
1259
|
+
SkyDockService._items.sort(sortByStackOrder);
|
1261
1260
|
return item;
|
1262
1261
|
}
|
1263
1262
|
/**
|
@@ -1290,20 +1289,24 @@ class SkyDockService {
|
|
1290
1289
|
referenceEl: this.options.referenceEl,
|
1291
1290
|
};
|
1292
1291
|
}
|
1293
|
-
|
1294
|
-
|
1292
|
+
SkyDockService.dockRef = this.dynamicComponentService.createComponent(SkyDockComponent, dockOptions);
|
1293
|
+
SkyDockService.dockRef.instance.setOptions(this.options);
|
1295
1294
|
}
|
1296
1295
|
destroyDock() {
|
1297
|
-
this.dynamicComponentService.removeComponent(
|
1298
|
-
|
1296
|
+
this.dynamicComponentService.removeComponent(SkyDockService.dockRef);
|
1297
|
+
SkyDockService.dockRef = undefined;
|
1299
1298
|
}
|
1300
1299
|
}
|
1300
|
+
SkyDockService._items = [];
|
1301
1301
|
SkyDockService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDockService, deps: [{ token: SkyDynamicComponentService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1302
|
-
SkyDockService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDockService, providedIn: '
|
1302
|
+
SkyDockService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDockService, providedIn: 'any' });
|
1303
1303
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyDockService, decorators: [{
|
1304
1304
|
type: Injectable,
|
1305
1305
|
args: [{
|
1306
|
-
|
1306
|
+
// Must be 'any' so that the dock component is created in the context of its module's injector.
|
1307
|
+
// If set to 'root', the component's dependency injections would only be derived from the root
|
1308
|
+
// injector and may loose context if the dock was opened from within a lazy-loaded module.
|
1309
|
+
providedIn: 'any',
|
1307
1310
|
}]
|
1308
1311
|
}], ctorParameters: function () { return [{ type: SkyDynamicComponentService }]; } });
|
1309
1312
|
|
@@ -1552,7 +1555,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
1552
1555
|
/**
|
1553
1556
|
* NOTICE: DO NOT MODIFY THIS FILE!
|
1554
1557
|
* The contents of this file were automatically generated by
|
1555
|
-
* the 'ng generate @skyux/i18n:lib-resources-module modules/shared/sky-core' schematic.
|
1558
|
+
* the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-core' schematic.
|
1556
1559
|
* To update this file, simply rerun the command.
|
1557
1560
|
*/
|
1558
1561
|
const RESOURCES = {
|
@@ -1625,7 +1628,7 @@ class NumericOptions {
|
|
1625
1628
|
this.iso = 'USD';
|
1626
1629
|
/**
|
1627
1630
|
* Indicates whether to shorten numbers to rounded numbers and abbreviation characters
|
1628
|
-
* such as K for thousands, M for millions, B for billions, and T for
|
1631
|
+
* such as K for thousands, M for millions, B for billions, and T for trillions.
|
1629
1632
|
*/
|
1630
1633
|
this.truncate = true;
|
1631
1634
|
/**
|
@@ -2433,20 +2436,30 @@ class SkyScrollableHostService {
|
|
2433
2436
|
*/
|
2434
2437
|
watchScrollableHost(elementRef) {
|
2435
2438
|
const subscribers = [];
|
2436
|
-
let
|
2439
|
+
let parentMutationObserver;
|
2440
|
+
let documentHiddenElementMutationObserver;
|
2437
2441
|
return new Observable((subscriber) => {
|
2438
2442
|
subscribers.push(subscriber);
|
2439
2443
|
let scrollableHost = this.findScrollableHost(elementRef.nativeElement);
|
2440
2444
|
if (subscribers.length === 1) {
|
2441
|
-
|
2445
|
+
parentMutationObserver = this.mutationObserverSvc.create(() => {
|
2442
2446
|
const newScrollableHost = this.findScrollableHost(elementRef.nativeElement);
|
2443
|
-
if (newScrollableHost !== scrollableHost
|
2447
|
+
if (newScrollableHost !== scrollableHost &&
|
2448
|
+
elementRef.nativeElement.offsetParent) {
|
2444
2449
|
scrollableHost = newScrollableHost;
|
2445
|
-
this.observeForScrollableHostChanges(scrollableHost,
|
2450
|
+
this.observeForScrollableHostChanges(scrollableHost, parentMutationObserver);
|
2446
2451
|
notifySubscribers(subscribers, scrollableHost);
|
2447
2452
|
}
|
2448
2453
|
});
|
2449
|
-
this.observeForScrollableHostChanges(scrollableHost,
|
2454
|
+
this.observeForScrollableHostChanges(scrollableHost, parentMutationObserver);
|
2455
|
+
documentHiddenElementMutationObserver = this.mutationObserverSvc.create(() => {
|
2456
|
+
if (!elementRef.nativeElement.offsetParent) {
|
2457
|
+
scrollableHost = undefined;
|
2458
|
+
this.observeForScrollableHostChanges(scrollableHost, parentMutationObserver);
|
2459
|
+
notifySubscribers(subscribers, scrollableHost);
|
2460
|
+
}
|
2461
|
+
});
|
2462
|
+
this.observeDocumentHiddenElementChanges(documentHiddenElementMutationObserver);
|
2450
2463
|
}
|
2451
2464
|
subscriber.next(scrollableHost);
|
2452
2465
|
subscriber.add(() => {
|
@@ -2457,7 +2470,8 @@ class SkyScrollableHostService {
|
|
2457
2470
|
subscribers.splice(subIndex, 1);
|
2458
2471
|
}
|
2459
2472
|
if (subscribers.length === 0) {
|
2460
|
-
|
2473
|
+
documentHiddenElementMutationObserver.disconnect();
|
2474
|
+
parentMutationObserver.disconnect();
|
2461
2475
|
}
|
2462
2476
|
});
|
2463
2477
|
});
|
@@ -2466,7 +2480,7 @@ class SkyScrollableHostService {
|
|
2466
2480
|
* Returns an observable which emits whenever the element's scrollable host emits a scroll event. The observable will always emit the scroll events from the elements current scrollable host and will update based on any scrollable host changes. The observable will also emit once whenever the scrollable host changes.
|
2467
2481
|
* @param elementRef The element whose scrollable host scroll events are being requested
|
2468
2482
|
* @param completionObservable An observable which alerts the internal observers that they should complete
|
2469
|
-
* @returns An observable which emits the
|
2483
|
+
* @returns An observable which emits when the elements scrollable host is scrolled or is changed
|
2470
2484
|
*/
|
2471
2485
|
watchScrollableHostScrollEvents(elementRef) {
|
2472
2486
|
const subscribers = [];
|
@@ -2485,11 +2499,13 @@ class SkyScrollableHostService {
|
|
2485
2499
|
}
|
2486
2500
|
scrollableHost = newScrollableHost;
|
2487
2501
|
newScrollableHostObservable = new Subject();
|
2488
|
-
|
2489
|
-
|
2490
|
-
|
2491
|
-
|
2492
|
-
|
2502
|
+
if (newScrollableHost) {
|
2503
|
+
scrollEventSubscription = fromEvent(newScrollableHost, 'scroll')
|
2504
|
+
.pipe(takeUntil(newScrollableHostObservable))
|
2505
|
+
.subscribe(() => {
|
2506
|
+
notifySubscribers(subscribers);
|
2507
|
+
});
|
2508
|
+
}
|
2493
2509
|
});
|
2494
2510
|
}
|
2495
2511
|
subscriber.add(() => {
|
@@ -2532,12 +2548,20 @@ class SkyScrollableHostService {
|
|
2532
2548
|
}
|
2533
2549
|
return parent;
|
2534
2550
|
}
|
2551
|
+
observeDocumentHiddenElementChanges(mutationObserver) {
|
2552
|
+
mutationObserver.observe(document.documentElement, {
|
2553
|
+
attributes: true,
|
2554
|
+
attributeFilter: ['class', 'style', 'hidden'],
|
2555
|
+
childList: true,
|
2556
|
+
subtree: true,
|
2557
|
+
});
|
2558
|
+
}
|
2535
2559
|
observeForScrollableHostChanges(element, mutationObserver) {
|
2536
2560
|
mutationObserver.disconnect();
|
2537
2561
|
if (element instanceof HTMLElement) {
|
2538
2562
|
mutationObserver.observe(element, {
|
2539
2563
|
attributes: true,
|
2540
|
-
attributeFilter: ['class', 'style
|
2564
|
+
attributeFilter: ['class', 'style'],
|
2541
2565
|
childList: true,
|
2542
2566
|
subtree: true,
|
2543
2567
|
});
|
@@ -2545,7 +2569,7 @@ class SkyScrollableHostService {
|
|
2545
2569
|
else {
|
2546
2570
|
mutationObserver.observe(document.documentElement, {
|
2547
2571
|
attributes: true,
|
2548
|
-
attributeFilter: ['class', 'style
|
2572
|
+
attributeFilter: ['class', 'style'],
|
2549
2573
|
childList: true,
|
2550
2574
|
subtree: true,
|
2551
2575
|
});
|