@skyux/core 5.7.1 → 6.0.0-beta.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 +4 -4
- package/esm2020/index.mjs +60 -0
- package/esm2020/lib/modules/adapter-service/adapter.module.mjs +16 -0
- package/esm2020/lib/modules/adapter-service/adapter.service.mjs +218 -0
- package/esm2020/lib/modules/adapter-service/focusable-children-options.mjs +2 -0
- package/esm2020/lib/modules/affix/affix-auto-fit-context.mjs +12 -0
- package/esm2020/lib/modules/affix/affix-config.mjs +2 -0
- package/esm2020/lib/modules/affix/affix-horizontal-alignment.mjs +2 -0
- package/esm2020/lib/modules/affix/affix-offset-change.mjs +2 -0
- package/esm2020/lib/modules/affix/affix-offset.mjs +2 -0
- package/esm2020/lib/modules/affix/affix-placement-change.mjs +2 -0
- package/esm2020/lib/modules/affix/affix-placement.mjs +2 -0
- package/esm2020/lib/modules/affix/affix-utils.mjs +18 -0
- package/esm2020/lib/modules/affix/affix-vertical-alignment.mjs +2 -0
- package/esm2020/lib/modules/affix/affix.directive.mjs +100 -0
- package/esm2020/lib/modules/affix/affix.module.mjs +18 -0
- package/esm2020/lib/modules/affix/affix.service.mjs +24 -0
- package/esm2020/lib/modules/affix/affixer.mjs +349 -0
- package/esm2020/lib/modules/affix/dom-utils.mjs +77 -0
- package/esm2020/lib/modules/dock/dock-dom-adapter.service.mjs +80 -0
- package/esm2020/lib/modules/dock/dock-insert-component-config.mjs +2 -0
- package/esm2020/lib/modules/dock/dock-item-config.mjs +2 -0
- package/esm2020/lib/modules/dock/dock-item-reference.mjs +2 -0
- package/esm2020/lib/modules/dock/dock-item.mjs +29 -0
- package/esm2020/lib/modules/dock/dock-location.mjs +19 -0
- package/esm2020/lib/modules/dock/dock-options.mjs +2 -0
- package/esm2020/lib/modules/dock/dock.component.mjs +88 -0
- package/esm2020/lib/modules/dock/dock.module.mjs +19 -0
- package/esm2020/lib/modules/dock/dock.service.mjs +95 -0
- package/esm2020/lib/modules/dock/sort-by-stack-order.mjs +13 -0
- package/esm2020/lib/modules/dynamic-component/dynamic-component-location.mjs +27 -0
- package/esm2020/lib/modules/dynamic-component/dynamic-component-options.mjs +2 -0
- package/esm2020/lib/modules/dynamic-component/dynamic-component.module.mjs +17 -0
- package/esm2020/lib/modules/dynamic-component/dynamic-component.service.mjs +83 -0
- package/esm2020/lib/modules/format/app-format.mjs +18 -0
- package/esm2020/lib/modules/id/id.directive.mjs +34 -0
- package/esm2020/lib/modules/id/id.module.mjs +16 -0
- package/esm2020/lib/modules/log/log.module.mjs +16 -0
- package/esm2020/lib/modules/log/log.service.mjs +23 -0
- package/esm2020/lib/modules/media-query/media-breakpoints.mjs +20 -0
- package/esm2020/lib/modules/media-query/media-query-listener.mjs +2 -0
- package/esm2020/lib/modules/media-query/media-query.module.mjs +16 -0
- package/esm2020/lib/modules/media-query/media-query.service.mjs +121 -0
- package/esm2020/lib/modules/mutation/mutation-observer-service.mjs +16 -0
- package/esm2020/lib/modules/numeric/numeric-symbol.mjs +2 -0
- package/esm2020/lib/modules/numeric/numeric.module.mjs +20 -0
- package/esm2020/lib/modules/numeric/numeric.options.mjs +41 -0
- package/esm2020/lib/modules/numeric/numeric.pipe.mjs +82 -0
- package/esm2020/lib/modules/numeric/numeric.service.mjs +188 -0
- package/esm2020/lib/modules/overlay/overlay-adapter.service.mjs +41 -0
- package/esm2020/lib/modules/overlay/overlay-config.mjs +2 -0
- package/esm2020/lib/modules/overlay/overlay-context.mjs +10 -0
- package/esm2020/lib/modules/overlay/overlay-instance.mjs +55 -0
- package/esm2020/lib/modules/overlay/overlay.component.mjs +149 -0
- package/esm2020/lib/modules/overlay/overlay.module.mjs +17 -0
- package/esm2020/lib/modules/overlay/overlay.service.mjs +120 -0
- package/esm2020/lib/modules/percent-pipe/percent-pipe.module.mjs +20 -0
- package/esm2020/lib/modules/percent-pipe/percent.pipe.mjs +48 -0
- package/esm2020/lib/modules/scrollable-host/scrollable-host.service.mjs +184 -0
- package/esm2020/lib/modules/shared/number-format/number-format-utility.mjs +72 -0
- package/esm2020/lib/modules/shared/sky-core-resources.module.mjs +50 -0
- package/esm2020/lib/modules/title/set-title-args.mjs +2 -0
- package/esm2020/lib/modules/title/title.service.mjs +31 -0
- package/esm2020/lib/modules/ui-config/ui-config.service.mjs +21 -0
- package/esm2020/lib/modules/viewkeeper/viewkeeper-boundary-info.mjs +2 -0
- package/esm2020/lib/modules/viewkeeper/viewkeeper-fixed-styles.mjs +2 -0
- package/esm2020/lib/modules/viewkeeper/viewkeeper-host-options.mjs +10 -0
- package/esm2020/lib/modules/viewkeeper/viewkeeper-offset.mjs +2 -0
- package/esm2020/lib/modules/viewkeeper/viewkeeper-options.mjs +2 -0
- package/esm2020/lib/modules/viewkeeper/viewkeeper.directive.mjs +116 -0
- package/esm2020/lib/modules/viewkeeper/viewkeeper.mjs +251 -0
- package/esm2020/lib/modules/viewkeeper/viewkeeper.module.mjs +16 -0
- package/esm2020/lib/modules/viewkeeper/viewkeeper.service.mjs +39 -0
- package/esm2020/lib/modules/window/window-ref.mjs +30 -0
- package/esm2020/skyux-core.mjs +5 -0
- package/esm2020/testing/mock-media-query.service.mjs +41 -0
- package/esm2020/testing/mock-ui-config.service.mjs +59 -0
- package/esm2020/testing/public-api.mjs +3 -0
- package/esm2020/testing/skyux-core-testing.mjs +5 -0
- package/fesm2015/{skyux-core-testing.js → skyux-core-testing.mjs} +7 -7
- package/fesm2015/skyux-core-testing.mjs.map +1 -0
- package/fesm2015/skyux-core.mjs +3043 -0
- package/fesm2015/skyux-core.mjs.map +1 -0
- package/fesm2020/skyux-core-testing.mjs +103 -0
- package/fesm2020/skyux-core-testing.mjs.map +1 -0
- package/{fesm2015/skyux-core.js → fesm2020/skyux-core.mjs} +134 -150
- package/fesm2020/skyux-core.mjs.map +1 -0
- package/package.json +32 -11
- package/testing/package.json +5 -5
- package/bundles/skyux-core-testing.umd.js +0 -459
- package/bundles/skyux-core.umd.js +0 -3648
- package/esm2015/index.js +0 -60
- package/esm2015/index.js.map +0 -1
- package/esm2015/lib/modules/adapter-service/adapter.module.js +0 -16
- package/esm2015/lib/modules/adapter-service/adapter.module.js.map +0 -1
- package/esm2015/lib/modules/adapter-service/adapter.service.js +0 -218
- package/esm2015/lib/modules/adapter-service/adapter.service.js.map +0 -1
- package/esm2015/lib/modules/adapter-service/focusable-children-options.js +0 -2
- package/esm2015/lib/modules/adapter-service/focusable-children-options.js.map +0 -1
- package/esm2015/lib/modules/affix/affix-auto-fit-context.js +0 -12
- package/esm2015/lib/modules/affix/affix-auto-fit-context.js.map +0 -1
- package/esm2015/lib/modules/affix/affix-config.js +0 -2
- package/esm2015/lib/modules/affix/affix-config.js.map +0 -1
- package/esm2015/lib/modules/affix/affix-horizontal-alignment.js +0 -2
- package/esm2015/lib/modules/affix/affix-horizontal-alignment.js.map +0 -1
- package/esm2015/lib/modules/affix/affix-offset-change.js +0 -2
- package/esm2015/lib/modules/affix/affix-offset-change.js.map +0 -1
- package/esm2015/lib/modules/affix/affix-offset.js +0 -2
- package/esm2015/lib/modules/affix/affix-offset.js.map +0 -1
- package/esm2015/lib/modules/affix/affix-placement-change.js +0 -2
- package/esm2015/lib/modules/affix/affix-placement-change.js.map +0 -1
- package/esm2015/lib/modules/affix/affix-placement.js +0 -2
- package/esm2015/lib/modules/affix/affix-placement.js.map +0 -1
- package/esm2015/lib/modules/affix/affix-utils.js +0 -18
- package/esm2015/lib/modules/affix/affix-utils.js.map +0 -1
- package/esm2015/lib/modules/affix/affix-vertical-alignment.js +0 -2
- package/esm2015/lib/modules/affix/affix-vertical-alignment.js.map +0 -1
- package/esm2015/lib/modules/affix/affix.directive.js +0 -100
- package/esm2015/lib/modules/affix/affix.directive.js.map +0 -1
- package/esm2015/lib/modules/affix/affix.module.js +0 -18
- package/esm2015/lib/modules/affix/affix.module.js.map +0 -1
- package/esm2015/lib/modules/affix/affix.service.js +0 -24
- package/esm2015/lib/modules/affix/affix.service.js.map +0 -1
- package/esm2015/lib/modules/affix/affixer.js +0 -349
- package/esm2015/lib/modules/affix/affixer.js.map +0 -1
- package/esm2015/lib/modules/affix/dom-utils.js +0 -77
- package/esm2015/lib/modules/affix/dom-utils.js.map +0 -1
- package/esm2015/lib/modules/dock/dock-dom-adapter.service.js +0 -80
- package/esm2015/lib/modules/dock/dock-dom-adapter.service.js.map +0 -1
- package/esm2015/lib/modules/dock/dock-insert-component-config.js +0 -2
- package/esm2015/lib/modules/dock/dock-insert-component-config.js.map +0 -1
- package/esm2015/lib/modules/dock/dock-item-config.js +0 -2
- package/esm2015/lib/modules/dock/dock-item-config.js.map +0 -1
- package/esm2015/lib/modules/dock/dock-item-reference.js +0 -2
- package/esm2015/lib/modules/dock/dock-item-reference.js.map +0 -1
- package/esm2015/lib/modules/dock/dock-item.js +0 -29
- package/esm2015/lib/modules/dock/dock-item.js.map +0 -1
- package/esm2015/lib/modules/dock/dock-location.js +0 -19
- package/esm2015/lib/modules/dock/dock-location.js.map +0 -1
- package/esm2015/lib/modules/dock/dock-options.js +0 -2
- package/esm2015/lib/modules/dock/dock-options.js.map +0 -1
- package/esm2015/lib/modules/dock/dock.component.js +0 -95
- package/esm2015/lib/modules/dock/dock.component.js.map +0 -1
- package/esm2015/lib/modules/dock/dock.module.js +0 -20
- package/esm2015/lib/modules/dock/dock.module.js.map +0 -1
- package/esm2015/lib/modules/dock/dock.service.js +0 -95
- package/esm2015/lib/modules/dock/dock.service.js.map +0 -1
- package/esm2015/lib/modules/dock/sort-by-stack-order.js +0 -13
- package/esm2015/lib/modules/dock/sort-by-stack-order.js.map +0 -1
- package/esm2015/lib/modules/dynamic-component/dynamic-component-location.js +0 -27
- package/esm2015/lib/modules/dynamic-component/dynamic-component-location.js.map +0 -1
- package/esm2015/lib/modules/dynamic-component/dynamic-component-options.js +0 -2
- package/esm2015/lib/modules/dynamic-component/dynamic-component-options.js.map +0 -1
- package/esm2015/lib/modules/dynamic-component/dynamic-component.module.js +0 -17
- package/esm2015/lib/modules/dynamic-component/dynamic-component.module.js.map +0 -1
- package/esm2015/lib/modules/dynamic-component/dynamic-component.service.js +0 -83
- package/esm2015/lib/modules/dynamic-component/dynamic-component.service.js.map +0 -1
- package/esm2015/lib/modules/format/app-format.js +0 -18
- package/esm2015/lib/modules/format/app-format.js.map +0 -1
- package/esm2015/lib/modules/id/id.directive.js +0 -34
- package/esm2015/lib/modules/id/id.directive.js.map +0 -1
- package/esm2015/lib/modules/id/id.module.js +0 -16
- package/esm2015/lib/modules/id/id.module.js.map +0 -1
- package/esm2015/lib/modules/log/log.module.js +0 -16
- package/esm2015/lib/modules/log/log.module.js.map +0 -1
- package/esm2015/lib/modules/log/log.service.js +0 -23
- package/esm2015/lib/modules/log/log.service.js.map +0 -1
- package/esm2015/lib/modules/media-query/media-breakpoints.js +0 -20
- package/esm2015/lib/modules/media-query/media-breakpoints.js.map +0 -1
- package/esm2015/lib/modules/media-query/media-query-listener.js +0 -2
- package/esm2015/lib/modules/media-query/media-query-listener.js.map +0 -1
- package/esm2015/lib/modules/media-query/media-query.module.js +0 -16
- package/esm2015/lib/modules/media-query/media-query.module.js.map +0 -1
- package/esm2015/lib/modules/media-query/media-query.service.js +0 -121
- package/esm2015/lib/modules/media-query/media-query.service.js.map +0 -1
- package/esm2015/lib/modules/mutation/mutation-observer-service.js +0 -16
- package/esm2015/lib/modules/mutation/mutation-observer-service.js.map +0 -1
- package/esm2015/lib/modules/numeric/numeric-symbol.js +0 -2
- package/esm2015/lib/modules/numeric/numeric-symbol.js.map +0 -1
- package/esm2015/lib/modules/numeric/numeric.module.js +0 -20
- package/esm2015/lib/modules/numeric/numeric.module.js.map +0 -1
- package/esm2015/lib/modules/numeric/numeric.options.js +0 -41
- package/esm2015/lib/modules/numeric/numeric.options.js.map +0 -1
- package/esm2015/lib/modules/numeric/numeric.pipe.js +0 -83
- package/esm2015/lib/modules/numeric/numeric.pipe.js.map +0 -1
- package/esm2015/lib/modules/numeric/numeric.service.js +0 -189
- package/esm2015/lib/modules/numeric/numeric.service.js.map +0 -1
- package/esm2015/lib/modules/overlay/overlay-adapter.service.js +0 -41
- package/esm2015/lib/modules/overlay/overlay-adapter.service.js.map +0 -1
- package/esm2015/lib/modules/overlay/overlay-config.js +0 -2
- package/esm2015/lib/modules/overlay/overlay-config.js.map +0 -1
- package/esm2015/lib/modules/overlay/overlay-context.js +0 -10
- package/esm2015/lib/modules/overlay/overlay-context.js.map +0 -1
- package/esm2015/lib/modules/overlay/overlay-instance.js +0 -55
- package/esm2015/lib/modules/overlay/overlay-instance.js.map +0 -1
- package/esm2015/lib/modules/overlay/overlay.component.js +0 -154
- package/esm2015/lib/modules/overlay/overlay.component.js.map +0 -1
- package/esm2015/lib/modules/overlay/overlay.module.js +0 -18
- package/esm2015/lib/modules/overlay/overlay.module.js.map +0 -1
- package/esm2015/lib/modules/overlay/overlay.service.js +0 -120
- package/esm2015/lib/modules/overlay/overlay.service.js.map +0 -1
- package/esm2015/lib/modules/percent-pipe/percent-pipe.module.js +0 -20
- package/esm2015/lib/modules/percent-pipe/percent-pipe.module.js.map +0 -1
- package/esm2015/lib/modules/percent-pipe/percent.pipe.js +0 -48
- package/esm2015/lib/modules/percent-pipe/percent.pipe.js.map +0 -1
- package/esm2015/lib/modules/scrollable-host/scrollable-host.service.js +0 -184
- package/esm2015/lib/modules/scrollable-host/scrollable-host.service.js.map +0 -1
- package/esm2015/lib/modules/shared/number-format/number-format-utility.js +0 -72
- package/esm2015/lib/modules/shared/number-format/number-format-utility.js.map +0 -1
- package/esm2015/lib/modules/shared/sky-core-resources.module.js +0 -50
- package/esm2015/lib/modules/shared/sky-core-resources.module.js.map +0 -1
- package/esm2015/lib/modules/title/set-title-args.js +0 -2
- package/esm2015/lib/modules/title/set-title-args.js.map +0 -1
- package/esm2015/lib/modules/title/title.service.js +0 -31
- package/esm2015/lib/modules/title/title.service.js.map +0 -1
- package/esm2015/lib/modules/ui-config/ui-config.service.js +0 -21
- package/esm2015/lib/modules/ui-config/ui-config.service.js.map +0 -1
- package/esm2015/lib/modules/viewkeeper/viewkeeper-boundary-info.js +0 -2
- package/esm2015/lib/modules/viewkeeper/viewkeeper-boundary-info.js.map +0 -1
- package/esm2015/lib/modules/viewkeeper/viewkeeper-fixed-styles.js +0 -2
- package/esm2015/lib/modules/viewkeeper/viewkeeper-fixed-styles.js.map +0 -1
- package/esm2015/lib/modules/viewkeeper/viewkeeper-host-options.js +0 -10
- package/esm2015/lib/modules/viewkeeper/viewkeeper-host-options.js.map +0 -1
- package/esm2015/lib/modules/viewkeeper/viewkeeper-offset.js +0 -2
- package/esm2015/lib/modules/viewkeeper/viewkeeper-offset.js.map +0 -1
- package/esm2015/lib/modules/viewkeeper/viewkeeper-options.js +0 -2
- package/esm2015/lib/modules/viewkeeper/viewkeeper-options.js.map +0 -1
- package/esm2015/lib/modules/viewkeeper/viewkeeper.directive.js +0 -116
- package/esm2015/lib/modules/viewkeeper/viewkeeper.directive.js.map +0 -1
- package/esm2015/lib/modules/viewkeeper/viewkeeper.js +0 -251
- package/esm2015/lib/modules/viewkeeper/viewkeeper.js.map +0 -1
- package/esm2015/lib/modules/viewkeeper/viewkeeper.module.js +0 -16
- package/esm2015/lib/modules/viewkeeper/viewkeeper.module.js.map +0 -1
- package/esm2015/lib/modules/viewkeeper/viewkeeper.service.js +0 -39
- package/esm2015/lib/modules/viewkeeper/viewkeeper.service.js.map +0 -1
- package/esm2015/lib/modules/window/window-ref.js +0 -30
- package/esm2015/lib/modules/window/window-ref.js.map +0 -1
- package/esm2015/skyux-core.js +0 -5
- package/esm2015/skyux-core.js.map +0 -1
- package/esm2015/testing/mock-media-query.service.js +0 -41
- package/esm2015/testing/mock-media-query.service.js.map +0 -1
- package/esm2015/testing/mock-ui-config.service.js +0 -59
- package/esm2015/testing/mock-ui-config.service.js.map +0 -1
- package/esm2015/testing/public-api.js +0 -3
- package/esm2015/testing/public-api.js.map +0 -1
- package/esm2015/testing/skyux-core-testing.js +0 -5
- package/esm2015/testing/skyux-core-testing.js.map +0 -1
- package/fesm2015/skyux-core-testing.js.map +0 -1
- package/fesm2015/skyux-core.js.map +0 -1
@@ -1,23 +0,0 @@
|
|
1
|
-
import { Injectable } from '@angular/core';
|
2
|
-
import * as i0 from "@angular/core";
|
3
|
-
/**
|
4
|
-
* @deprecated The `SkyLogService` will be removed in the next major version of `@skyux/core`.
|
5
|
-
*/
|
6
|
-
export class SkyLogService {
|
7
|
-
warn(message, ...optionalParams) {
|
8
|
-
/*istanbul ignore else */
|
9
|
-
if (window.console) {
|
10
|
-
// eslint-disable-next-line prefer-spread,prefer-rest-params
|
11
|
-
window.console.warn.apply(window.console, arguments);
|
12
|
-
}
|
13
|
-
}
|
14
|
-
}
|
15
|
-
SkyLogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
16
|
-
SkyLogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLogService, providedIn: 'root' });
|
17
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLogService, decorators: [{
|
18
|
-
type: Injectable,
|
19
|
-
args: [{
|
20
|
-
providedIn: 'root',
|
21
|
-
}]
|
22
|
-
}] });
|
23
|
-
//# sourceMappingURL=log.service.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"log.service.js","sourceRoot":"","sources":["../../../../../../../../libs/components/core/src/lib/modules/log/log.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;;AAE3C;;GAEG;AAIH,MAAM,OAAO,aAAa;IACjB,IAAI,CAAC,OAAa,EAAE,GAAG,cAAqB;QACjD,yBAAyB;QACzB,IAAI,MAAM,CAAC,OAAO,EAAE;YAClB,4DAA4D;YAC5D,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;SACtD;IACH,CAAC;;2GAPU,aAAa;+GAAb,aAAa,cAFZ,MAAM;4FAEP,aAAa;kBAHzB,UAAU;mBAAC;oBACV,UAAU,EAAE,MAAM;iBACnB","sourcesContent":["import { Injectable } from '@angular/core';\n\n/**\n * @deprecated The `SkyLogService` will be removed in the next major version of `@skyux/core`.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class SkyLogService {\n public warn(message?: any, ...optionalParams: any[]): void {\n /*istanbul ignore else */\n if (window.console) {\n // eslint-disable-next-line prefer-spread,prefer-rest-params\n window.console.warn.apply(window.console, arguments);\n }\n }\n}\n"]}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
export var SkyMediaBreakpoints;
|
2
|
-
(function (SkyMediaBreakpoints) {
|
3
|
-
/**
|
4
|
-
* Indicates screen widths of 767px or less.
|
5
|
-
*/
|
6
|
-
SkyMediaBreakpoints[SkyMediaBreakpoints["xs"] = 1] = "xs";
|
7
|
-
/**
|
8
|
-
* Indicates screen widths of 768px to 991px.
|
9
|
-
*/
|
10
|
-
SkyMediaBreakpoints[SkyMediaBreakpoints["sm"] = 2] = "sm";
|
11
|
-
/**
|
12
|
-
* Indicates screen widths of 992px to 1199px.
|
13
|
-
*/
|
14
|
-
SkyMediaBreakpoints[SkyMediaBreakpoints["md"] = 3] = "md";
|
15
|
-
/**
|
16
|
-
* Indicates screen widths of 1200px or greater.
|
17
|
-
*/
|
18
|
-
SkyMediaBreakpoints[SkyMediaBreakpoints["lg"] = 4] = "lg";
|
19
|
-
})(SkyMediaBreakpoints || (SkyMediaBreakpoints = {}));
|
20
|
-
//# sourceMappingURL=media-breakpoints.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"media-breakpoints.js","sourceRoot":"","sources":["../../../../../../../../libs/components/core/src/lib/modules/media-query/media-breakpoints.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,mBAoBX;AApBD,WAAY,mBAAmB;IAC7B;;OAEG;IACH,yDAAM,CAAA;IAEN;;OAEG;IACH,yDAAE,CAAA;IAEF;;OAEG;IACH,yDAAE,CAAA;IAEF;;OAEG;IACH,yDAAE,CAAA;AACJ,CAAC,EApBW,mBAAmB,KAAnB,mBAAmB,QAoB9B","sourcesContent":["export enum SkyMediaBreakpoints {\n /**\n * Indicates screen widths of 767px or less.\n */\n xs = 1,\n\n /**\n * Indicates screen widths of 768px to 991px.\n */\n sm,\n\n /**\n * Indicates screen widths of 992px to 1199px.\n */\n md,\n\n /**\n * Indicates screen widths of 1200px or greater.\n */\n lg,\n}\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"media-query-listener.js","sourceRoot":"","sources":["../../../../../../../../libs/components/core/src/lib/modules/media-query/media-query-listener.ts"],"names":[],"mappings":"","sourcesContent":["import { SkyMediaBreakpoints } from './media-breakpoints';\n\n/**\n * Specifies a funciton that is called when the breakpoints change. It is called\n * with a `SkyMediaBreakpoints` argument, which is an enum that represents the new breakpoint.\n */\nexport type SkyMediaQueryListener = (args: SkyMediaBreakpoints) => void;\n"]}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import { NgModule } from '@angular/core';
|
2
|
-
import * as i0 from "@angular/core";
|
3
|
-
/**
|
4
|
-
* @deprecated The `SkyMediaQueryService` no longer needs the `SkyMediaQueryModule`.
|
5
|
-
* The `SkyMediaQueryModule` can be removed from your project.
|
6
|
-
*/
|
7
|
-
export class SkyMediaQueryModule {
|
8
|
-
}
|
9
|
-
SkyMediaQueryModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyMediaQueryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
10
|
-
SkyMediaQueryModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyMediaQueryModule });
|
11
|
-
SkyMediaQueryModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyMediaQueryModule });
|
12
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyMediaQueryModule, decorators: [{
|
13
|
-
type: NgModule,
|
14
|
-
args: [{}]
|
15
|
-
}] });
|
16
|
-
//# sourceMappingURL=media-query.module.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"media-query.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/core/src/lib/modules/media-query/media-query.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;;AAEzC;;;GAGG;AAEH,MAAM,OAAO,mBAAmB;;iHAAnB,mBAAmB;kHAAnB,mBAAmB;kHAAnB,mBAAmB;4FAAnB,mBAAmB;kBAD/B,QAAQ;mBAAC,EAAE","sourcesContent":["import { NgModule } from '@angular/core';\n\n/**\n * @deprecated The `SkyMediaQueryService` no longer needs the `SkyMediaQueryModule`.\n * The `SkyMediaQueryModule` can be removed from your project.\n */\n@NgModule({})\nexport class SkyMediaQueryModule {}\n"]}
|
@@ -1,121 +0,0 @@
|
|
1
|
-
import { Injectable, NgZone } from '@angular/core';
|
2
|
-
import { BehaviorSubject } from 'rxjs';
|
3
|
-
import { SkyMediaBreakpoints } from './media-breakpoints';
|
4
|
-
import * as i0 from "@angular/core";
|
5
|
-
export class SkyMediaQueryService {
|
6
|
-
constructor(zone) {
|
7
|
-
this.zone = zone;
|
8
|
-
this.currentSubject = new BehaviorSubject(this.current);
|
9
|
-
this._current = SkyMediaBreakpoints.md;
|
10
|
-
this.breakpoints = [
|
11
|
-
{
|
12
|
-
mediaQueryString: SkyMediaQueryService.xs,
|
13
|
-
name: SkyMediaBreakpoints.xs,
|
14
|
-
},
|
15
|
-
{
|
16
|
-
mediaQueryString: SkyMediaQueryService.sm,
|
17
|
-
name: SkyMediaBreakpoints.sm,
|
18
|
-
},
|
19
|
-
{
|
20
|
-
mediaQueryString: SkyMediaQueryService.md,
|
21
|
-
name: SkyMediaBreakpoints.md,
|
22
|
-
},
|
23
|
-
{
|
24
|
-
mediaQueryString: SkyMediaQueryService.lg,
|
25
|
-
name: SkyMediaBreakpoints.lg,
|
26
|
-
},
|
27
|
-
];
|
28
|
-
this.mediaQueries = [];
|
29
|
-
this.addListeners();
|
30
|
-
}
|
31
|
-
/**
|
32
|
-
* Returns the current breakpoint.
|
33
|
-
*/
|
34
|
-
get current() {
|
35
|
-
return this._current;
|
36
|
-
}
|
37
|
-
ngOnDestroy() {
|
38
|
-
this.removeListeners();
|
39
|
-
this.currentSubject.complete();
|
40
|
-
}
|
41
|
-
/**
|
42
|
-
* Suscribes to screen size changes.
|
43
|
-
* @param listener Specifies a function that is called when breakpoints change.
|
44
|
-
*/
|
45
|
-
subscribe(listener) {
|
46
|
-
return this.currentSubject.subscribe({
|
47
|
-
next: (breakpoints) => {
|
48
|
-
listener(breakpoints);
|
49
|
-
},
|
50
|
-
});
|
51
|
-
}
|
52
|
-
/**
|
53
|
-
* @internal
|
54
|
-
*/
|
55
|
-
destroy() {
|
56
|
-
this.removeListeners();
|
57
|
-
this.currentSubject.complete();
|
58
|
-
}
|
59
|
-
addListeners() {
|
60
|
-
this.mediaQueries = this.breakpoints.map((breakpoint) => {
|
61
|
-
const mq = matchMedia(breakpoint.mediaQueryString);
|
62
|
-
const listener = (event) => {
|
63
|
-
// Run the check outside of Angular's change detection since Angular
|
64
|
-
// does not wrap matchMedia listeners in NgZone.
|
65
|
-
// See: https://blog.assaf.co/angular-2-change-detection-zones-and-an-example/
|
66
|
-
this.zone.run(() => {
|
67
|
-
if (event.matches) {
|
68
|
-
this.notifyBreakpointChange(breakpoint.name);
|
69
|
-
}
|
70
|
-
});
|
71
|
-
};
|
72
|
-
mq.addListener(listener);
|
73
|
-
if (mq.matches) {
|
74
|
-
this.notifyBreakpointChange(breakpoint.name);
|
75
|
-
}
|
76
|
-
return {
|
77
|
-
mediaQueryList: mq,
|
78
|
-
listener,
|
79
|
-
};
|
80
|
-
});
|
81
|
-
}
|
82
|
-
removeListeners() {
|
83
|
-
this.mediaQueries.forEach((mediaQuery) => {
|
84
|
-
mediaQuery.mediaQueryList.removeListener(mediaQuery.listener);
|
85
|
-
});
|
86
|
-
this.mediaQueries = [];
|
87
|
-
}
|
88
|
-
notifyBreakpointChange(breakpoint) {
|
89
|
-
this._current = breakpoint;
|
90
|
-
this.currentSubject.next(breakpoint);
|
91
|
-
}
|
92
|
-
}
|
93
|
-
/**
|
94
|
-
* The size for the `xs` breakpoint.
|
95
|
-
* @default "(max-width: 767px)"
|
96
|
-
*/
|
97
|
-
SkyMediaQueryService.xs = '(max-width: 767px)';
|
98
|
-
/**
|
99
|
-
* The size for the `sm` breakpoint.
|
100
|
-
* @default "(min-width: 768px) and (max-width: 991px)"
|
101
|
-
*/
|
102
|
-
SkyMediaQueryService.sm = '(min-width: 768px) and (max-width: 991px)';
|
103
|
-
/**
|
104
|
-
* The size for the `md` breakpoint.
|
105
|
-
* @default "(min-width: 992px) and (max-width: 1199px)"
|
106
|
-
*/
|
107
|
-
SkyMediaQueryService.md = '(min-width: 992px) and (max-width: 1199px)';
|
108
|
-
/**
|
109
|
-
* The size for the `lg` breakpoint.
|
110
|
-
* @default "(min-width: 1200px)"
|
111
|
-
*/
|
112
|
-
SkyMediaQueryService.lg = '(min-width: 1200px)';
|
113
|
-
SkyMediaQueryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyMediaQueryService, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
|
114
|
-
SkyMediaQueryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyMediaQueryService, providedIn: 'root' });
|
115
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyMediaQueryService, decorators: [{
|
116
|
-
type: Injectable,
|
117
|
-
args: [{
|
118
|
-
providedIn: 'root',
|
119
|
-
}]
|
120
|
-
}], ctorParameters: function () { return [{ type: i0.NgZone }]; } });
|
121
|
-
//# sourceMappingURL=media-query.service.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"media-query.service.js","sourceRoot":"","sources":["../../../../../../../../libs/components/core/src/lib/modules/media-query/media-query.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAa,MAAM,eAAe,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAgB,MAAM,MAAM,CAAC;AAErD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;;AAM1D,MAAM,OAAO,oBAAoB;IAiE/B,YAAoB,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;QAjCxB,mBAAc,GAAG,IAAI,eAAe,CAC1C,IAAI,CAAC,OAAO,CACb,CAAC;QAEM,aAAQ,GAAG,mBAAmB,CAAC,EAAE,CAAC;QAElC,gBAAW,GAGb;YACJ;gBACE,gBAAgB,EAAE,oBAAoB,CAAC,EAAE;gBACzC,IAAI,EAAE,mBAAmB,CAAC,EAAE;aAC7B;YACD;gBACE,gBAAgB,EAAE,oBAAoB,CAAC,EAAE;gBACzC,IAAI,EAAE,mBAAmB,CAAC,EAAE;aAC7B;YACD;gBACE,gBAAgB,EAAE,oBAAoB,CAAC,EAAE;gBACzC,IAAI,EAAE,mBAAmB,CAAC,EAAE;aAC7B;YACD;gBACE,gBAAgB,EAAE,oBAAoB,CAAC,EAAE;gBACzC,IAAI,EAAE,mBAAmB,CAAC,EAAE;aAC7B;SACF,CAAC;QAEM,iBAAY,GAGd,EAAE,CAAC;QAGP,IAAI,CAAC,YAAY,EAAE,CAAC;IACtB,CAAC;IA1CD;;OAEG;IACH,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAuCM,WAAW;QAChB,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;IAED;;;OAGG;IACI,SAAS,CAAC,QAA+B;QAC9C,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC;YACnC,IAAI,EAAE,CAAC,WAAgC,EAAE,EAAE;gBACzC,QAAQ,CAAC,WAAW,CAAC,CAAC;YACxB,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACI,OAAO;QACZ,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;IAEO,YAAY;QAClB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAe,EAAE,EAAE;YAC3D,MAAM,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;YAEnD,MAAM,QAAQ,GAAG,CAAC,KAAU,EAAE,EAAE;gBAC9B,oEAAoE;gBACpE,gDAAgD;gBAChD,8EAA8E;gBAC9E,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;oBACjB,IAAI,KAAK,CAAC,OAAO,EAAE;wBACjB,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;qBAC9C;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC;YAEF,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YAEzB,IAAI,EAAE,CAAC,OAAO,EAAE;gBACd,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;aAC9C;YAED,OAAO;gBACL,cAAc,EAAE,EAAE;gBAClB,QAAQ;aACT,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,eAAe;QACrB,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;YACvC,UAAU,CAAC,cAAc,CAAC,cAAc,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;IACzB,CAAC;IAEO,sBAAsB,CAAC,UAA+B;QAC5D,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC;QAC3B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;;AAnID;;;GAGG;AACW,uBAAE,GAAG,oBAAoB,CAAC;AAExC;;;GAGG;AACW,uBAAE,GAAG,2CAA2C,CAAC;AAE/D;;;GAGG;AACW,uBAAE,GAAG,4CAA4C,CAAC;AAEhE;;;GAGG;AACW,uBAAE,GAAG,qBAAqB,CAAC;kHAvB9B,oBAAoB;sHAApB,oBAAoB,cAFnB,MAAM;4FAEP,oBAAoB;kBAHhC,UAAU;mBAAC;oBACV,UAAU,EAAE,MAAM;iBACnB","sourcesContent":["import { Injectable, NgZone, OnDestroy } from '@angular/core';\n\nimport { BehaviorSubject, Subscription } from 'rxjs';\n\nimport { SkyMediaBreakpoints } from './media-breakpoints';\nimport { SkyMediaQueryListener } from './media-query-listener';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SkyMediaQueryService implements OnDestroy {\n /**\n * The size for the `xs` breakpoint.\n * @default \"(max-width: 767px)\"\n */\n public static xs = '(max-width: 767px)';\n\n /**\n * The size for the `sm` breakpoint.\n * @default \"(min-width: 768px) and (max-width: 991px)\"\n */\n public static sm = '(min-width: 768px) and (max-width: 991px)';\n\n /**\n * The size for the `md` breakpoint.\n * @default \"(min-width: 992px) and (max-width: 1199px)\"\n */\n public static md = '(min-width: 992px) and (max-width: 1199px)';\n\n /**\n * The size for the `lg` breakpoint.\n * @default \"(min-width: 1200px)\"\n */\n public static lg = '(min-width: 1200px)';\n\n /**\n * Returns the current breakpoint.\n */\n public get current(): SkyMediaBreakpoints {\n return this._current;\n }\n\n private currentSubject = new BehaviorSubject<SkyMediaBreakpoints>(\n this.current\n );\n\n private _current = SkyMediaBreakpoints.md;\n\n private breakpoints: {\n mediaQueryString: string;\n name: SkyMediaBreakpoints;\n }[] = [\n {\n mediaQueryString: SkyMediaQueryService.xs,\n name: SkyMediaBreakpoints.xs,\n },\n {\n mediaQueryString: SkyMediaQueryService.sm,\n name: SkyMediaBreakpoints.sm,\n },\n {\n mediaQueryString: SkyMediaQueryService.md,\n name: SkyMediaBreakpoints.md,\n },\n {\n mediaQueryString: SkyMediaQueryService.lg,\n name: SkyMediaBreakpoints.lg,\n },\n ];\n\n private mediaQueries: {\n mediaQueryList: MediaQueryList;\n listener: (event: any) => void;\n }[] = [];\n\n constructor(private zone: NgZone) {\n this.addListeners();\n }\n\n public ngOnDestroy(): void {\n this.removeListeners();\n this.currentSubject.complete();\n }\n\n /**\n * Suscribes to screen size changes.\n * @param listener Specifies a function that is called when breakpoints change.\n */\n public subscribe(listener: SkyMediaQueryListener): Subscription {\n return this.currentSubject.subscribe({\n next: (breakpoints: SkyMediaBreakpoints) => {\n listener(breakpoints);\n },\n });\n }\n\n /**\n * @internal\n */\n public destroy(): void {\n this.removeListeners();\n this.currentSubject.complete();\n }\n\n private addListeners(): void {\n this.mediaQueries = this.breakpoints.map((breakpoint: any) => {\n const mq = matchMedia(breakpoint.mediaQueryString);\n\n const listener = (event: any) => {\n // Run the check outside of Angular's change detection since Angular\n // does not wrap matchMedia listeners in NgZone.\n // See: https://blog.assaf.co/angular-2-change-detection-zones-and-an-example/\n this.zone.run(() => {\n if (event.matches) {\n this.notifyBreakpointChange(breakpoint.name);\n }\n });\n };\n\n mq.addListener(listener);\n\n if (mq.matches) {\n this.notifyBreakpointChange(breakpoint.name);\n }\n\n return {\n mediaQueryList: mq,\n listener,\n };\n });\n }\n\n private removeListeners(): void {\n this.mediaQueries.forEach((mediaQuery) => {\n mediaQuery.mediaQueryList.removeListener(mediaQuery.listener);\n });\n this.mediaQueries = [];\n }\n\n private notifyBreakpointChange(breakpoint: SkyMediaBreakpoints): void {\n this._current = breakpoint;\n this.currentSubject.next(breakpoint);\n }\n}\n"]}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import { Injectable } from '@angular/core';
|
2
|
-
import * as i0 from "@angular/core";
|
3
|
-
export class MutationObserverService {
|
4
|
-
create(callback) {
|
5
|
-
return new MutationObserver(callback);
|
6
|
-
}
|
7
|
-
}
|
8
|
-
MutationObserverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MutationObserverService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
9
|
-
MutationObserverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MutationObserverService, providedIn: 'root' });
|
10
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MutationObserverService, decorators: [{
|
11
|
-
type: Injectable,
|
12
|
-
args: [{
|
13
|
-
providedIn: 'root',
|
14
|
-
}]
|
15
|
-
}] });
|
16
|
-
//# sourceMappingURL=mutation-observer-service.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"mutation-observer-service.js","sourceRoot":"","sources":["../../../../../../../../libs/components/core/src/lib/modules/mutation/mutation-observer-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;;AAK3C,MAAM,OAAO,uBAAuB;IAC3B,MAAM,CAAC,QAAa;QACzB,OAAO,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;;qHAHU,uBAAuB;yHAAvB,uBAAuB,cAFtB,MAAM;4FAEP,uBAAuB;kBAHnC,UAAU;mBAAC;oBACV,UAAU,EAAE,MAAM;iBACnB","sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class MutationObserverService {\n public create(callback: any): MutationObserver {\n return new MutationObserver(callback);\n }\n}\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"numeric-symbol.js","sourceRoot":"","sources":["../../../../../../../../libs/components/core/src/lib/modules/numeric/numeric-symbol.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @internal\n */\nexport interface SkyNumericSymbol {\n value: number;\n label: string;\n}\n"]}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import { NgModule } from '@angular/core';
|
2
|
-
import { SkyI18nModule } from '@skyux/i18n';
|
3
|
-
import { SkyCoreResourcesModule } from '../shared/sky-core-resources.module';
|
4
|
-
import { SkyNumericPipe } from './numeric.pipe';
|
5
|
-
import * as i0 from "@angular/core";
|
6
|
-
export class SkyNumericModule {
|
7
|
-
}
|
8
|
-
SkyNumericModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyNumericModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
9
|
-
SkyNumericModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyNumericModule, declarations: [SkyNumericPipe], imports: [SkyI18nModule, SkyCoreResourcesModule], exports: [SkyNumericPipe] });
|
10
|
-
SkyNumericModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyNumericModule, providers: [SkyNumericPipe], imports: [[SkyI18nModule, SkyCoreResourcesModule]] });
|
11
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyNumericModule, decorators: [{
|
12
|
-
type: NgModule,
|
13
|
-
args: [{
|
14
|
-
declarations: [SkyNumericPipe],
|
15
|
-
providers: [SkyNumericPipe],
|
16
|
-
imports: [SkyI18nModule, SkyCoreResourcesModule],
|
17
|
-
exports: [SkyNumericPipe],
|
18
|
-
}]
|
19
|
-
}] });
|
20
|
-
//# sourceMappingURL=numeric.module.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"numeric.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/core/src/lib/modules/numeric/numeric.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;;AAQhD,MAAM,OAAO,gBAAgB;;8GAAhB,gBAAgB;+GAAhB,gBAAgB,iBALZ,cAAc,aAEnB,aAAa,EAAE,sBAAsB,aACrC,cAAc;+GAEb,gBAAgB,aAJhB,CAAC,cAAc,CAAC,YAClB,CAAC,aAAa,EAAE,sBAAsB,CAAC;4FAGrC,gBAAgB;kBAN5B,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,cAAc,CAAC;oBAC9B,SAAS,EAAE,CAAC,cAAc,CAAC;oBAC3B,OAAO,EAAE,CAAC,aAAa,EAAE,sBAAsB,CAAC;oBAChD,OAAO,EAAE,CAAC,cAAc,CAAC;iBAC1B","sourcesContent":["import { NgModule } from '@angular/core';\nimport { SkyI18nModule } from '@skyux/i18n';\n\nimport { SkyCoreResourcesModule } from '../shared/sky-core-resources.module';\n\nimport { SkyNumericPipe } from './numeric.pipe';\n\n@NgModule({\n declarations: [SkyNumericPipe],\n providers: [SkyNumericPipe],\n imports: [SkyI18nModule, SkyCoreResourcesModule],\n exports: [SkyNumericPipe],\n})\nexport class SkyNumericModule {}\n"]}
|
@@ -1,41 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Provides arguments for the number to format.
|
3
|
-
*/
|
4
|
-
export class NumericOptions {
|
5
|
-
constructor() {
|
6
|
-
/**
|
7
|
-
* Specifies the maximum number of digits after the decimal separator.
|
8
|
-
* @default 1
|
9
|
-
*/
|
10
|
-
this.digits = 1;
|
11
|
-
/**
|
12
|
-
* Specifies how to format the number. Options are `currency` or `number`.
|
13
|
-
* @default "number"
|
14
|
-
*/
|
15
|
-
this.format = 'number';
|
16
|
-
/**
|
17
|
-
* Specifies the format of the currency.
|
18
|
-
* @default "standard"
|
19
|
-
*/
|
20
|
-
this.currencySign = 'standard';
|
21
|
-
/**
|
22
|
-
* Specifies the ISO4217 currency code to use for currency formatting. If you do not specify a
|
23
|
-
* currency code, the component uses the browser's culture to determine the currency unless your
|
24
|
-
* SPA provides a different culture with `SkyAppLocaleProvider`.
|
25
|
-
* @default "USD"
|
26
|
-
*/
|
27
|
-
this.iso = 'USD';
|
28
|
-
/**
|
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 trillions.
|
31
|
-
*/
|
32
|
-
this.truncate = true;
|
33
|
-
/**
|
34
|
-
* Specifies the starting point after which numbers are shortened to rounded numbers
|
35
|
-
* and abbreviation characters.
|
36
|
-
* @default 0
|
37
|
-
*/
|
38
|
-
this.truncateAfter = 0;
|
39
|
-
}
|
40
|
-
}
|
41
|
-
//# sourceMappingURL=numeric.options.js.map
|
@@ -1 +0,0 @@
|
|
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"]}
|
@@ -1,83 +0,0 @@
|
|
1
|
-
import { ChangeDetectorRef, Pipe, } from '@angular/core';
|
2
|
-
import { SkyAppLocaleProvider } from '@skyux/i18n';
|
3
|
-
import { Subject } from 'rxjs';
|
4
|
-
import { takeUntil } from 'rxjs/operators';
|
5
|
-
import { NumericOptions } from './numeric.options';
|
6
|
-
import { SkyNumericService } from './numeric.service';
|
7
|
-
import * as i0 from "@angular/core";
|
8
|
-
import * as i1 from "@skyux/i18n";
|
9
|
-
import * as i2 from "./numeric.service";
|
10
|
-
/**
|
11
|
-
* Shortens numbers to rounded numbers and abbreviation characters such as K for thousands,
|
12
|
-
* M for millions, B for billions, and T for trillions. The pipe also formats for currency.
|
13
|
-
* Be sure you have a space after the two curly brackets opening the pipe and
|
14
|
-
* a space before the two curly brackets closing the pipe or it will not work.
|
15
|
-
* Usage:
|
16
|
-
* ```
|
17
|
-
* {{ value | skyNumeric(config) }}
|
18
|
-
* ```
|
19
|
-
*/
|
20
|
-
export class SkyNumericPipe {
|
21
|
-
constructor(localeProvider, numericService, changeDetector) {
|
22
|
-
this.localeProvider = localeProvider;
|
23
|
-
this.numericService = numericService;
|
24
|
-
this.changeDetector = changeDetector;
|
25
|
-
this.ngUnsubscribe = new Subject();
|
26
|
-
this.localeProvider
|
27
|
-
.getLocaleInfo()
|
28
|
-
.pipe(takeUntil(this.ngUnsubscribe))
|
29
|
-
.subscribe((localeInfo) => {
|
30
|
-
this.providerLocale = localeInfo.locale;
|
31
|
-
numericService.currentLocale = this.providerLocale;
|
32
|
-
this.changeDetector.markForCheck();
|
33
|
-
});
|
34
|
-
}
|
35
|
-
ngOnDestroy() {
|
36
|
-
this.ngUnsubscribe.next();
|
37
|
-
this.ngUnsubscribe.complete();
|
38
|
-
}
|
39
|
-
transform(value, config) {
|
40
|
-
var _a;
|
41
|
-
const newCacheKey = (config ? JSON.stringify(config, Object.keys(config).sort()) : '') +
|
42
|
-
`${value}_${(config === null || config === void 0 ? void 0 : config.locale) || this.providerLocale}`;
|
43
|
-
/* If the value and locale are the same as the last transform then return the previous value
|
44
|
-
instead of reformatting. */
|
45
|
-
if (this.formattedValue && this.cacheKey === newCacheKey) {
|
46
|
-
return this.formattedValue;
|
47
|
-
}
|
48
|
-
const options = new NumericOptions();
|
49
|
-
// The default number of digits is `1`. When truncate is disabled, set digits
|
50
|
-
// to `0` to avoid the unnecessary addition of `.0` at the end of the formatted number.
|
51
|
-
if (config && config.truncate === false && config.digits === undefined) {
|
52
|
-
options.digits = 0;
|
53
|
-
}
|
54
|
-
// If the minimum digits is less than the set maximum digits then throw an error
|
55
|
-
if (config &&
|
56
|
-
config.minDigits &&
|
57
|
-
config.digits &&
|
58
|
-
config.minDigits > config.digits) {
|
59
|
-
throw new Error('The `digits` property must be greater than or equal to the `minDigits` property');
|
60
|
-
// If there is a minimum digits given but not a maximum then default the maximum to the minimum
|
61
|
-
}
|
62
|
-
else if (config && config.minDigits && !config.digits) {
|
63
|
-
options.digits = config.minDigits;
|
64
|
-
}
|
65
|
-
Object.assign(options, config);
|
66
|
-
// Assign properties for proper result caching.
|
67
|
-
this.rawValue = value;
|
68
|
-
this.lastTransformLocale = (_a = config === null || config === void 0 ? void 0 : config.locale) !== null && _a !== void 0 ? _a : this.providerLocale;
|
69
|
-
this.cacheKey = newCacheKey;
|
70
|
-
this.formattedValue = this.numericService.formatNumber(value, options);
|
71
|
-
return this.formattedValue;
|
72
|
-
}
|
73
|
-
}
|
74
|
-
SkyNumericPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyNumericPipe, deps: [{ token: i1.SkyAppLocaleProvider }, { token: i2.SkyNumericService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Pipe });
|
75
|
-
SkyNumericPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyNumericPipe, name: "skyNumeric", pure: false });
|
76
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyNumericPipe, decorators: [{
|
77
|
-
type: Pipe,
|
78
|
-
args: [{
|
79
|
-
name: 'skyNumeric',
|
80
|
-
pure: false,
|
81
|
-
}]
|
82
|
-
}], ctorParameters: function () { return [{ type: i1.SkyAppLocaleProvider }, { type: i2.SkyNumericService }, { type: i0.ChangeDetectorRef }]; } });
|
83
|
-
//# sourceMappingURL=numeric.pipe.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"numeric.pipe.js","sourceRoot":"","sources":["../../../../../../../../libs/components/core/src/lib/modules/numeric/numeric.pipe.ts"],"names":[],"mappings":"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","sourcesContent":["import {\n ChangeDetectorRef,\n OnDestroy,\n Pipe,\n PipeTransform,\n} from '@angular/core';\nimport { SkyAppLocaleProvider } from '@skyux/i18n';\n\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { NumericOptions } from './numeric.options';\nimport { SkyNumericService } from './numeric.service';\n\n/**\n * Shortens numbers to rounded numbers and abbreviation characters such as K for thousands,\n * M for millions, B for billions, and T for trillions. The pipe also formats for currency.\n * Be sure you have a space after the two curly brackets opening the pipe and\n * a space before the two curly brackets closing the pipe or it will not work.\n * Usage:\n * ```\n * {{ value | skyNumeric(config) }}\n * ```\n */\n@Pipe({\n name: 'skyNumeric',\n pure: false,\n})\nexport class SkyNumericPipe implements PipeTransform, OnDestroy {\n private cacheKey: string;\n private formattedValue: string;\n private lastTransformLocale: string;\n private rawValue: number;\n private providerLocale: string;\n\n private ngUnsubscribe = new Subject<void>();\n\n constructor(\n private localeProvider: SkyAppLocaleProvider,\n private readonly numericService: SkyNumericService,\n private changeDetector: ChangeDetectorRef\n ) {\n this.localeProvider\n .getLocaleInfo()\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((localeInfo) => {\n this.providerLocale = localeInfo.locale;\n numericService.currentLocale = this.providerLocale;\n this.changeDetector.markForCheck();\n });\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n\n public transform(value: number, config?: NumericOptions): string {\n const newCacheKey =\n (config ? JSON.stringify(config, Object.keys(config).sort()) : '') +\n `${value}_${config?.locale || this.providerLocale}`;\n\n /* If the value and locale are the same as the last transform then return the previous value\n instead of reformatting. */\n if (this.formattedValue && this.cacheKey === newCacheKey) {\n return this.formattedValue;\n }\n\n const options = new NumericOptions();\n\n // The default number of digits is `1`. When truncate is disabled, set digits\n // to `0` to avoid the unnecessary addition of `.0` at the end of the formatted number.\n if (config && config.truncate === false && config.digits === undefined) {\n options.digits = 0;\n }\n\n // If the minimum digits is less than the set maximum digits then throw an error\n if (\n config &&\n config.minDigits &&\n config.digits &&\n config.minDigits > config.digits\n ) {\n throw new Error(\n 'The `digits` property must be greater than or equal to the `minDigits` property'\n );\n\n // If there is a minimum digits given but not a maximum then default the maximum to the minimum\n } else if (config && config.minDigits && !config.digits) {\n options.digits = config.minDigits;\n }\n\n Object.assign(options, config);\n\n // Assign properties for proper result caching.\n this.rawValue = value;\n this.lastTransformLocale = config?.locale ?? this.providerLocale;\n this.cacheKey = newCacheKey;\n\n this.formattedValue = this.numericService.formatNumber(value, options);\n return this.formattedValue;\n }\n}\n"]}
|
@@ -1,189 +0,0 @@
|
|
1
|
-
import { Injectable } from '@angular/core';
|
2
|
-
import { SkyIntlNumberFormatStyle, SkyLibResourcesService } from '@skyux/i18n';
|
3
|
-
import { SkyNumberFormatUtility } from '../shared/number-format/number-format-utility';
|
4
|
-
import * as i0 from "@angular/core";
|
5
|
-
import * as i1 from "@skyux/i18n";
|
6
|
-
export class SkyNumericService {
|
7
|
-
constructor(resourcesService) {
|
8
|
-
this.resourcesService = resourcesService;
|
9
|
-
this.symbolIndex = [
|
10
|
-
{ value: 1e12, label: this.getSymbol('skyux_numeric_trillions_symbol') },
|
11
|
-
{ value: 1e9, label: this.getSymbol('skyux_numeric_billions_symbol') },
|
12
|
-
{ value: 1e6, label: this.getSymbol('skyux_numeric_millions_symbol') },
|
13
|
-
{ value: 1e3, label: this.getSymbol('skyux_numeric_thousands_symbol') },
|
14
|
-
];
|
15
|
-
}
|
16
|
-
/**
|
17
|
-
* The browser's current locale.
|
18
|
-
* @internal
|
19
|
-
*/
|
20
|
-
set currentLocale(value) {
|
21
|
-
this._locale = value;
|
22
|
-
}
|
23
|
-
get currentLocale() {
|
24
|
-
return this._locale || 'en-US';
|
25
|
-
}
|
26
|
-
/**
|
27
|
-
* Shortens with or without symbol (K/M/B/T) depending on value of number.
|
28
|
-
* @param value The number to format.
|
29
|
-
* @param options Format options.
|
30
|
-
*/
|
31
|
-
formatNumber(value, options) {
|
32
|
-
var _a;
|
33
|
-
/* tslint:disable-next-line:no-null-keyword */
|
34
|
-
if (isNaN(value) || value === null) {
|
35
|
-
return '';
|
36
|
-
}
|
37
|
-
const decimalPlaceRegExp = /\.0+$|(\.[0-9]*[1-9])0+$/;
|
38
|
-
// Get the symbol for the number after rounding, since rounding could push the number
|
39
|
-
// into a different symbol range.
|
40
|
-
let roundedNumber = this.roundNumber(value, options.digits);
|
41
|
-
const roundedNumberAbs = Math.abs(roundedNumber);
|
42
|
-
let suffix = '';
|
43
|
-
for (let i = 0; i < this.symbolIndex.length; i++) {
|
44
|
-
let symbol = this.symbolIndex[i];
|
45
|
-
if (options.truncate &&
|
46
|
-
roundedNumberAbs >= options.truncateAfter &&
|
47
|
-
roundedNumberAbs >= symbol.value) {
|
48
|
-
roundedNumber = this.roundNumber(value / symbol.value, options.digits);
|
49
|
-
if (Math.abs(roundedNumber) === 1000 && i > 0) {
|
50
|
-
// Rounding caused the number to cross into the range of the next symbol.
|
51
|
-
symbol = this.symbolIndex[i - 1];
|
52
|
-
roundedNumber /= 1000;
|
53
|
-
}
|
54
|
-
suffix = symbol.label;
|
55
|
-
break;
|
56
|
-
}
|
57
|
-
}
|
58
|
-
let output = roundedNumber.toString().replace(decimalPlaceRegExp, '$1') + suffix;
|
59
|
-
this.storeShortenSymbol(output);
|
60
|
-
const locale = options.locale || this.currentLocale;
|
61
|
-
let digits;
|
62
|
-
let isDecimal;
|
63
|
-
// Checks the string entered for format. Using toLowerCase to ignore case.
|
64
|
-
switch ((_a = options.format) === null || _a === void 0 ? void 0 : _a.toLowerCase()) {
|
65
|
-
// In a case where a decimal value was not shortened and
|
66
|
-
// the digit input is 2 or higher, it forces 2 digits.
|
67
|
-
// For example, this prevents a value like $15.50 from displaying as $15.5.
|
68
|
-
// Note: This will need to be reviewed if we support currencies with
|
69
|
-
// three decimal digits.
|
70
|
-
case 'currency':
|
71
|
-
isDecimal = value % 1 !== 0;
|
72
|
-
if (options.minDigits) {
|
73
|
-
digits = `1.${options.minDigits}-${options.digits}`;
|
74
|
-
}
|
75
|
-
else if (isDecimal && options.digits >= 2) {
|
76
|
-
digits = `1.2-${options.digits}`;
|
77
|
-
}
|
78
|
-
else {
|
79
|
-
digits = `1.0-${options.digits}`;
|
80
|
-
}
|
81
|
-
output = SkyNumberFormatUtility.formatNumber(locale, parseFloat(output), SkyIntlNumberFormatStyle.Currency, digits, options.iso,
|
82
|
-
// Angular 5+ needs a string for this parameter, but Angular 4 needs a boolean.
|
83
|
-
// To support both versions we can supply 'symbol' which will evaluate truthy for Angular 4
|
84
|
-
// and the appropriate string value for Angular 5+.
|
85
|
-
// See: https://angular.io/api/common/CurrencyPipe#parameters
|
86
|
-
'symbol', options.currencySign);
|
87
|
-
break;
|
88
|
-
// The following is a catch-all to ensure that if
|
89
|
-
// anything but currency (or a future option) are entered,
|
90
|
-
// it will be treated like a number.
|
91
|
-
default:
|
92
|
-
// Ensures localization of the number to ensure comma and
|
93
|
-
// decimal separator
|
94
|
-
if (options.minDigits) {
|
95
|
-
digits = `1.${options.minDigits}-${options.digits}`;
|
96
|
-
}
|
97
|
-
else if (options.truncate) {
|
98
|
-
digits = `1.0-${options.digits}`;
|
99
|
-
}
|
100
|
-
else {
|
101
|
-
digits = `1.${options.digits}-${options.digits}`;
|
102
|
-
}
|
103
|
-
output = SkyNumberFormatUtility.formatNumber(locale, parseFloat(output), SkyIntlNumberFormatStyle.Decimal, digits);
|
104
|
-
break;
|
105
|
-
}
|
106
|
-
if (options.truncate) {
|
107
|
-
output = this.replaceShortenSymbol(output);
|
108
|
-
}
|
109
|
-
return output;
|
110
|
-
}
|
111
|
-
/**
|
112
|
-
* Rounds a given number
|
113
|
-
*
|
114
|
-
* JS's limitation - numbers bigger than Number.MIN_SAFE_INTEGER or Number.MAX_SAFE_INTEGER
|
115
|
-
* are not guaranteed to be represented or rounded correctly
|
116
|
-
* @param value - value to round
|
117
|
-
* @param precision - what precision to round with, defaults to 0 decimal places
|
118
|
-
*/
|
119
|
-
roundNumber(value, precision = 0) {
|
120
|
-
if (precision < 0) {
|
121
|
-
throw new Error('SkyInvalidArgument: precision must be >= 0');
|
122
|
-
}
|
123
|
-
/* tslint:disable-next-line:no-null-keyword */
|
124
|
-
/* Sanity check - ignoring coverage but should not ignore if we make this method public */
|
125
|
-
/* istanbul ignore next */
|
126
|
-
if (isNaN(value) || value === null) {
|
127
|
-
return 0;
|
128
|
-
}
|
129
|
-
const scaledValue = this.scaleNumberByPowerOfTen(value, precision, true);
|
130
|
-
const scaledRoundedValue = Math.round(scaledValue);
|
131
|
-
const unscaledRoundedValue = this.scaleNumberByPowerOfTen(scaledRoundedValue, precision, false);
|
132
|
-
return unscaledRoundedValue;
|
133
|
-
}
|
134
|
-
/**
|
135
|
-
* Scales a given number by a power of 10
|
136
|
-
* @param value - value to scale
|
137
|
-
* @param scalar - 10^scalar
|
138
|
-
* @param scaleUp - whether to increase or decrease the value
|
139
|
-
*/
|
140
|
-
scaleNumberByPowerOfTen(value, scalar, scaleUp) {
|
141
|
-
const valueStr = value.toString().toLowerCase();
|
142
|
-
const isExponentFormat = valueStr.includes('e');
|
143
|
-
if (isExponentFormat) {
|
144
|
-
const [base, exp] = valueStr.split('e');
|
145
|
-
const newExp = scaleUp ? Number(exp) + scalar : Number(exp) - scalar;
|
146
|
-
return Number(`${base}e${newExp}`);
|
147
|
-
}
|
148
|
-
else {
|
149
|
-
const e = scaleUp ? 'e' : 'e-';
|
150
|
-
return Number(`${value}${e}${scalar}`);
|
151
|
-
}
|
152
|
-
}
|
153
|
-
/**
|
154
|
-
* Stores the symbol added from shortening to reapply later.
|
155
|
-
* @param value The string to derive the shorten symbol from.
|
156
|
-
*/
|
157
|
-
storeShortenSymbol(value) {
|
158
|
-
const symbols = this.symbolIndex.map((s) => s.label);
|
159
|
-
const regexp = new RegExp(symbols.join('|'), 'ig');
|
160
|
-
const match = value.match(regexp);
|
161
|
-
this.shortSymbol = match ? match.toString() : '';
|
162
|
-
}
|
163
|
-
/**
|
164
|
-
* Must have previously called storeShortenSymbol to have something to replace.
|
165
|
-
* Finds the last number in the formatted number, gets the index of the position
|
166
|
-
* after that character and re-inserts the symbol.
|
167
|
-
* Works regardless of currency symbol position.
|
168
|
-
* @param value The string to modify.
|
169
|
-
*/
|
170
|
-
replaceShortenSymbol(value) {
|
171
|
-
const result = /(\d)(?!.*\d)/g.exec(value);
|
172
|
-
const pos = result.index + result.length;
|
173
|
-
const output = value.substring(0, pos) + this.shortSymbol + value.substring(pos);
|
174
|
-
return output;
|
175
|
-
}
|
176
|
-
getSymbol(key) {
|
177
|
-
// TODO: Need to implement the async `getString` method in a breaking change.
|
178
|
-
return this.resourcesService.getStringForLocale({ locale: 'en_US' }, key);
|
179
|
-
}
|
180
|
-
}
|
181
|
-
SkyNumericService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyNumericService, deps: [{ token: i1.SkyLibResourcesService }], target: i0.ɵɵFactoryTarget.Injectable });
|
182
|
-
SkyNumericService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyNumericService, providedIn: 'any' });
|
183
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyNumericService, decorators: [{
|
184
|
-
type: Injectable,
|
185
|
-
args: [{
|
186
|
-
providedIn: 'any',
|
187
|
-
}]
|
188
|
-
}], ctorParameters: function () { return [{ type: i1.SkyLibResourcesService }]; } });
|
189
|
-
//# sourceMappingURL=numeric.service.js.map
|