@spicainternational/ngx-sds-components 5.13.0-beta.3 → 5.14.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.
Files changed (92) hide show
  1. package/esm2020/public-api.mjs +5 -1
  2. package/esm2020/src/lib/color-picker/color-picker.component.mjs +11 -27
  3. package/esm2020/src/lib/date-picker/date-picker.component.mjs +3 -3
  4. package/esm2020/src/lib/date-picker/date-picker.model.mjs +1 -1
  5. package/esm2020/src/lib/ellipsis/directives/ellipsis.directive.mjs +51 -0
  6. package/esm2020/src/lib/ellipsis/ellipsis.module.mjs +26 -0
  7. package/esm2020/src/lib/ellipsis/public-api.mjs +3 -0
  8. package/esm2020/src/lib/ellipsis/spicainternational-ngx-sds-components-src-lib-ellipsis.mjs +5 -0
  9. package/esm2020/src/lib/intersection/directives/index.mjs +2 -0
  10. package/esm2020/src/lib/intersection/directives/intersection.directive.mjs +51 -0
  11. package/esm2020/src/lib/intersection/intersection.module.mjs +22 -0
  12. package/esm2020/src/lib/intersection/public-api.mjs +4 -0
  13. package/esm2020/src/lib/intersection/services/index.mjs +2 -0
  14. package/esm2020/src/lib/intersection/services/intersection.service.mjs +54 -0
  15. package/esm2020/src/lib/intersection/spicainternational-ngx-sds-components-src-lib-intersection.mjs +5 -0
  16. package/esm2020/src/lib/keyboard-shortcut/directives/index.mjs +2 -0
  17. package/esm2020/src/lib/keyboard-shortcut/directives/keyboard-shortcut.directive.mjs +56 -0
  18. package/esm2020/src/lib/keyboard-shortcut/keyboard-shortcut.module.mjs +26 -0
  19. package/esm2020/src/lib/keyboard-shortcut/public-api.mjs +3 -0
  20. package/esm2020/src/lib/keyboard-shortcut/spicainternational-ngx-sds-components-src-lib-keyboard-shortcut.mjs +5 -0
  21. package/esm2020/src/lib/modal/modal.component.mjs +3 -3
  22. package/esm2020/src/lib/timer/public-api.mjs +4 -0
  23. package/esm2020/src/lib/timer/services/index.mjs +2 -0
  24. package/esm2020/src/lib/timer/services/timer.service.mjs +99 -0
  25. package/esm2020/src/lib/timer/spicainternational-ngx-sds-components-src-lib-timer.mjs +5 -0
  26. package/esm2020/src/lib/timer/timer.module.mjs +36 -0
  27. package/esm2020/src/lib/timer/utils/index.mjs +2 -0
  28. package/esm2020/src/lib/timer/utils/timer.utils.mjs +97 -0
  29. package/fesm2015/spicainternational-ngx-sds-components-src-lib-color-picker.mjs +10 -26
  30. package/fesm2015/spicainternational-ngx-sds-components-src-lib-color-picker.mjs.map +1 -1
  31. package/fesm2015/spicainternational-ngx-sds-components-src-lib-date-picker.mjs +2 -2
  32. package/fesm2015/spicainternational-ngx-sds-components-src-lib-date-picker.mjs.map +1 -1
  33. package/fesm2015/spicainternational-ngx-sds-components-src-lib-ellipsis.mjs +82 -0
  34. package/fesm2015/spicainternational-ngx-sds-components-src-lib-ellipsis.mjs.map +1 -0
  35. package/fesm2015/spicainternational-ngx-sds-components-src-lib-intersection.mjs +129 -0
  36. package/fesm2015/spicainternational-ngx-sds-components-src-lib-intersection.mjs.map +1 -0
  37. package/fesm2015/spicainternational-ngx-sds-components-src-lib-keyboard-shortcut.mjs +87 -0
  38. package/fesm2015/spicainternational-ngx-sds-components-src-lib-keyboard-shortcut.mjs.map +1 -0
  39. package/fesm2015/spicainternational-ngx-sds-components-src-lib-modal.mjs +2 -2
  40. package/fesm2015/spicainternational-ngx-sds-components-src-lib-modal.mjs.map +1 -1
  41. package/fesm2015/spicainternational-ngx-sds-components-src-lib-timer.mjs +237 -0
  42. package/fesm2015/spicainternational-ngx-sds-components-src-lib-timer.mjs.map +1 -0
  43. package/fesm2015/spicainternational-ngx-sds-components.mjs +4 -0
  44. package/fesm2015/spicainternational-ngx-sds-components.mjs.map +1 -1
  45. package/fesm2020/spicainternational-ngx-sds-components-src-lib-color-picker.mjs +10 -26
  46. package/fesm2020/spicainternational-ngx-sds-components-src-lib-color-picker.mjs.map +1 -1
  47. package/fesm2020/spicainternational-ngx-sds-components-src-lib-date-picker.mjs +2 -2
  48. package/fesm2020/spicainternational-ngx-sds-components-src-lib-date-picker.mjs.map +1 -1
  49. package/fesm2020/spicainternational-ngx-sds-components-src-lib-ellipsis.mjs +81 -0
  50. package/fesm2020/spicainternational-ngx-sds-components-src-lib-ellipsis.mjs.map +1 -0
  51. package/fesm2020/spicainternational-ngx-sds-components-src-lib-intersection.mjs +126 -0
  52. package/fesm2020/spicainternational-ngx-sds-components-src-lib-intersection.mjs.map +1 -0
  53. package/fesm2020/spicainternational-ngx-sds-components-src-lib-keyboard-shortcut.mjs +85 -0
  54. package/fesm2020/spicainternational-ngx-sds-components-src-lib-keyboard-shortcut.mjs.map +1 -0
  55. package/fesm2020/spicainternational-ngx-sds-components-src-lib-modal.mjs +2 -2
  56. package/fesm2020/spicainternational-ngx-sds-components-src-lib-modal.mjs.map +1 -1
  57. package/fesm2020/spicainternational-ngx-sds-components-src-lib-timer.mjs +235 -0
  58. package/fesm2020/spicainternational-ngx-sds-components-src-lib-timer.mjs.map +1 -0
  59. package/fesm2020/spicainternational-ngx-sds-components.mjs +4 -0
  60. package/fesm2020/spicainternational-ngx-sds-components.mjs.map +1 -1
  61. package/package.json +33 -1
  62. package/public-api.d.ts +4 -0
  63. package/src/lib/color-picker/color-picker.component.d.ts +6 -2
  64. package/src/lib/date-picker/date-picker.model.d.ts +1 -0
  65. package/src/lib/ellipsis/directives/ellipsis.directive.d.ts +13 -0
  66. package/src/lib/ellipsis/ellipsis.module.d.ts +8 -0
  67. package/src/lib/ellipsis/package.json +10 -0
  68. package/src/lib/ellipsis/public-api.d.ts +2 -0
  69. package/src/lib/ellipsis/spicainternational-ngx-sds-components-src-lib-ellipsis.d.ts +5 -0
  70. package/src/lib/intersection/directives/index.d.ts +1 -0
  71. package/src/lib/intersection/directives/intersection.directive.d.ts +24 -0
  72. package/src/lib/intersection/intersection.module.d.ts +8 -0
  73. package/src/lib/intersection/package.json +10 -0
  74. package/src/lib/intersection/public-api.d.ts +3 -0
  75. package/src/lib/intersection/services/index.d.ts +1 -0
  76. package/src/lib/intersection/services/intersection.service.d.ts +19 -0
  77. package/src/lib/intersection/spicainternational-ngx-sds-components-src-lib-intersection.d.ts +5 -0
  78. package/src/lib/keyboard-shortcut/directives/index.d.ts +1 -0
  79. package/src/lib/keyboard-shortcut/directives/keyboard-shortcut.directive.d.ts +22 -0
  80. package/src/lib/keyboard-shortcut/keyboard-shortcut.module.d.ts +8 -0
  81. package/src/lib/keyboard-shortcut/package.json +10 -0
  82. package/src/lib/keyboard-shortcut/public-api.d.ts +2 -0
  83. package/src/lib/keyboard-shortcut/spicainternational-ngx-sds-components-src-lib-keyboard-shortcut.d.ts +5 -0
  84. package/src/lib/modal/modal.component.d.ts +1 -1
  85. package/src/lib/timer/package.json +10 -0
  86. package/src/lib/timer/public-api.d.ts +3 -0
  87. package/src/lib/timer/services/index.d.ts +1 -0
  88. package/src/lib/timer/services/timer.service.d.ts +78 -0
  89. package/src/lib/timer/spicainternational-ngx-sds-components-src-lib-timer.d.ts +5 -0
  90. package/src/lib/timer/timer.module.d.ts +10 -0
  91. package/src/lib/timer/utils/index.d.ts +1 -0
  92. package/src/lib/timer/utils/timer.utils.d.ts +61 -0
@@ -0,0 +1,129 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, Inject, EventEmitter, Directive, Input, Output, NgModule } from '@angular/core';
3
+ import { DOCUMENT, CommonModule } from '@angular/common';
4
+ import { concat, defer, of, fromEvent, Observable, combineLatest } from 'rxjs';
5
+ import { map, mergeMap, distinctUntilChanged } from 'rxjs/operators';
6
+
7
+ class IntersectionService {
8
+ constructor(document) {
9
+ this._documentVisible$ = concat(defer(() => of(!document.hidden)), fromEvent(document, 'visibilitychange').pipe(map(e => !document.hidden)));
10
+ }
11
+ /**
12
+ * @description
13
+ * Method responsible for determining if element is visible
14
+ * on screen or not. Please
15
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API for options meaning
16
+ * @param { ElementRef } element
17
+ * @param { IntersectionObserverInit } options
18
+ * @returns { Observable<boolean> }
19
+ */
20
+ elementInSight$(element, options) {
21
+ var _a, _b, _c;
22
+ const intersectionOptions = {
23
+ root: (_a = options === null || options === void 0 ? void 0 : options.root) !== null && _a !== void 0 ? _a : null,
24
+ rootMargin: (_b = options === null || options === void 0 ? void 0 : options.rootMargin) !== null && _b !== void 0 ? _b : '0px 0px 0px 0px',
25
+ threshold: (_c = options === null || options === void 0 ? void 0 : options.threshold) !== null && _c !== void 0 ? _c : 0.5
26
+ };
27
+ const elementVisible$ = new Observable((observer) => {
28
+ const intersectionObserver = new IntersectionObserver(entries => {
29
+ observer.next(entries);
30
+ }, intersectionOptions);
31
+ intersectionObserver.observe(element.nativeElement);
32
+ return () => {
33
+ intersectionObserver.disconnect();
34
+ };
35
+ }).pipe(mergeMap((entries) => entries), map((entry) => entry.isIntersecting), distinctUntilChanged());
36
+ const elementInSight$ = combineLatest([
37
+ this._documentVisible$,
38
+ elementVisible$
39
+ ]).pipe(map(stream => {
40
+ const pageVisible = stream[0];
41
+ const elementVisible = stream[1];
42
+ const isVisible = pageVisible && elementVisible;
43
+ return isVisible;
44
+ }), distinctUntilChanged());
45
+ return elementInSight$;
46
+ }
47
+ }
48
+ IntersectionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: IntersectionService, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
49
+ IntersectionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: IntersectionService });
50
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: IntersectionService, decorators: [{
51
+ type: Injectable
52
+ }], ctorParameters: function () {
53
+ return [{ type: undefined, decorators: [{
54
+ type: Inject,
55
+ args: [DOCUMENT]
56
+ }] }];
57
+ } });
58
+
59
+ class IntersectionDirective {
60
+ constructor(_element, _intersectionService) {
61
+ this._element = _element;
62
+ this._intersectionService = _intersectionService;
63
+ /**
64
+ * Emits current visibility status
65
+ */
66
+ this.elementInSight = new EventEmitter();
67
+ this._subscriptions = [];
68
+ }
69
+ /**
70
+ *
71
+ */
72
+ get intersectionOptions() {
73
+ return this._intersectionOptions;
74
+ }
75
+ set intersectionOptions(value) {
76
+ this._intersectionOptions = value;
77
+ }
78
+ ngOnInit() {
79
+ }
80
+ ngOnDestroy() {
81
+ this._subscriptions.forEach(subscription => subscription.unsubscribe());
82
+ }
83
+ ngAfterViewInit() {
84
+ const intersetionSubscription = this._intersectionService
85
+ .elementInSight$(this._element, this.intersectionOptions)
86
+ .subscribe(visibilityFlag => {
87
+ this.elementInSight.emit(visibilityFlag);
88
+ });
89
+ this._subscriptions.push(intersetionSubscription);
90
+ }
91
+ }
92
+ IntersectionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: IntersectionDirective, deps: [{ token: i0.ElementRef }, { token: IntersectionService }], target: i0.ɵɵFactoryTarget.Directive });
93
+ IntersectionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.1", type: IntersectionDirective, selector: "[sdsIntersection]", inputs: { intersectionOptions: "intersectionOptions" }, outputs: { elementInSight: "elementInSight" }, providers: [IntersectionService], ngImport: i0 });
94
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: IntersectionDirective, decorators: [{
95
+ type: Directive,
96
+ args: [{
97
+ selector: '[sdsIntersection]',
98
+ providers: [IntersectionService]
99
+ }]
100
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: IntersectionService }]; }, propDecorators: { intersectionOptions: [{
101
+ type: Input
102
+ }], elementInSight: [{
103
+ type: Output
104
+ }] } });
105
+
106
+ class SdsIntersectionModule {
107
+ }
108
+ SdsIntersectionModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsIntersectionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
109
+ SdsIntersectionModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsIntersectionModule, declarations: [IntersectionDirective], imports: [CommonModule], exports: [IntersectionDirective] });
110
+ SdsIntersectionModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsIntersectionModule, imports: [[
111
+ CommonModule
112
+ ]] });
113
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsIntersectionModule, decorators: [{
114
+ type: NgModule,
115
+ args: [{
116
+ declarations: [IntersectionDirective],
117
+ exports: [IntersectionDirective],
118
+ imports: [
119
+ CommonModule
120
+ ]
121
+ }]
122
+ }] });
123
+
124
+ /**
125
+ * Generated bundle index. Do not edit.
126
+ */
127
+
128
+ export { IntersectionDirective, IntersectionService, SdsIntersectionModule };
129
+ //# sourceMappingURL=spicainternational-ngx-sds-components-src-lib-intersection.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spicainternational-ngx-sds-components-src-lib-intersection.mjs","sources":["../../../projects/ngx-sds-components/src/lib/intersection/services/intersection.service.ts","../../../projects/ngx-sds-components/src/lib/intersection/directives/intersection.directive.ts","../../../projects/ngx-sds-components/src/lib/intersection/intersection.module.ts","../../../projects/ngx-sds-components/src/lib/intersection/spicainternational-ngx-sds-components-src-lib-intersection.ts"],"sourcesContent":["import { DOCUMENT } from '@angular/common';\r\nimport { ElementRef, Inject, Injectable } from '@angular/core';\r\nimport { Observable, Subscriber, combineLatest, concat, defer, fromEvent, of } from 'rxjs';\r\nimport { map, mergeMap, distinctUntilChanged } from 'rxjs/operators';\r\n\r\n@Injectable()\r\nexport class IntersectionService {\r\n private _documentVisible$: Observable<boolean>;\r\n\r\n constructor(@Inject(DOCUMENT) document: any) {\r\n this._documentVisible$ = concat(\r\n defer(() => of(!document.hidden)),\r\n fromEvent(document, 'visibilitychange').pipe(map(e => !document.hidden))\r\n );\r\n }\r\n\r\n /**\r\n * @description\r\n * Method responsible for determining if element is visible\r\n * on screen or not. Please\r\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API for options meaning\r\n * @param { ElementRef } element\r\n * @param { IntersectionObserverInit } options\r\n * @returns { Observable<boolean> }\r\n */\r\n elementInSight$(\r\n element: ElementRef,\r\n options?: IntersectionObserverInit\r\n ): Observable<boolean> {\r\n const intersectionOptions: IntersectionObserverInit = {\r\n root: options?.root ?? null,\r\n rootMargin: options?.rootMargin ?? '0px 0px 0px 0px',\r\n threshold: options?.threshold ?? 0.5\r\n };\r\n\r\n const elementVisible$ = new Observable(\r\n (observer: Subscriber<IntersectionObserverEntry[]>) => {\r\n const intersectionObserver = new IntersectionObserver(entries => {\r\n observer.next(entries);\r\n }, intersectionOptions);\r\n\r\n intersectionObserver.observe(element.nativeElement);\r\n\r\n return () => {\r\n intersectionObserver.disconnect();\r\n };\r\n }\r\n ).pipe(\r\n mergeMap((entries: IntersectionObserverEntry[]) => entries),\r\n map((entry: IntersectionObserverEntry) => entry.isIntersecting),\r\n distinctUntilChanged()\r\n );\r\n\r\n const elementInSight$ = combineLatest([\r\n this._documentVisible$,\r\n elementVisible$\r\n ]).pipe(\r\n map(stream => {\r\n const pageVisible: boolean = stream[0];\r\n const elementVisible: boolean = stream[1];\r\n\r\n const isVisible = pageVisible && elementVisible;\r\n\r\n return isVisible;\r\n }),\r\n distinctUntilChanged()\r\n );\r\n\r\n return elementInSight$;\r\n }\r\n}\r\n","import { AfterViewInit, Directive, ElementRef, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';\r\nimport { Subscription } from 'rxjs';\r\nimport { IntersectionService } from '../services';\r\n\r\n@Directive({\r\n selector: '[sdsIntersection]',\r\n providers: [IntersectionService]\r\n})\r\nexport class IntersectionDirective implements OnInit, OnDestroy, AfterViewInit {\r\n /**\r\n *\r\n */\r\n @Input()\r\n get intersectionOptions(): IntersectionObserverInit | undefined {\r\n return this._intersectionOptions;\r\n }\r\n set intersectionOptions(value: IntersectionObserverInit | undefined) {\r\n this._intersectionOptions = value;\r\n }\r\n\r\n /**\r\n * Emits current visibility status\r\n */\r\n @Output() elementInSight: EventEmitter<boolean> = new EventEmitter<boolean>();\r\n\r\n private _intersectionOptions: IntersectionObserverInit | undefined;\r\n private _subscriptions: Subscription[] = [];\r\n\r\n constructor(\r\n private readonly _element: ElementRef,\r\n private readonly _intersectionService: IntersectionService\r\n ) {}\r\n\r\n ngOnInit(): void {\r\n\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this._subscriptions.forEach(subscription => subscription.unsubscribe());\r\n }\r\n\r\n ngAfterViewInit(): void {\r\n const intersetionSubscription = this._intersectionService\r\n .elementInSight$(this._element, this.intersectionOptions)\r\n .subscribe(visibilityFlag => {\r\n this.elementInSight.emit(visibilityFlag);\r\n });\r\n\r\n this._subscriptions.push(intersetionSubscription);\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { IntersectionDirective } from './directives';\r\n\r\n@NgModule({\r\n declarations: [IntersectionDirective],\r\n exports: [IntersectionDirective],\r\n imports: [\r\n CommonModule\r\n ]\r\n})\r\nexport class SdsIntersectionModule { }\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.IntersectionService"],"mappings":";;;;;;MAMa,mBAAmB,CAAA;AAG5B,IAAA,WAAA,CAA8B,QAAa,EAAA;AACzC,QAAA,IAAI,CAAC,iBAAiB,GAAG,MAAM,CAC7B,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EACjC,SAAS,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CACzE,CAAC;KACH;AAED;;;;;;;;AAQG;IACH,eAAe,CACb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,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,EANjB,YAAA,EAAA,CAAA,qBAAqB,CAGlC,EAAA,OAAA,EAAA,CAAA,YAAY,aAFJ,qBAAqB,CAAA,EAAA,CAAA,CAAA;AAKpB,qBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,EAJvB,OAAA,EAAA,CAAA;YACP,YAAY;SACb,CAAA,EAAA,CAAA,CAAA;2FAEU,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAPjC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,qBAAqB,CAAC;oBACrC,OAAO,EAAE,CAAC,qBAAqB,CAAC;AAChC,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;iBACF,CAAA;;;ACVD;;AAEG;;;;"}
@@ -0,0 +1,87 @@
1
+ import * as i0 from '@angular/core';
2
+ import { EventEmitter, Directive, Inject, Output, NgModule } from '@angular/core';
3
+ import { DOCUMENT, CommonModule } from '@angular/common';
4
+ import { fromEvent } from 'rxjs';
5
+ import { groupBy, mergeAll } from 'rxjs/operators';
6
+
7
+ class KeyboardShortcutDirective {
8
+ constructor(_document) {
9
+ this._document = _document;
10
+ /**
11
+ * OUTPUTS
12
+ */
13
+ /**
14
+ * Emitted when user presses Escape
15
+ */
16
+ this.closeShortcut = new EventEmitter();
17
+ /**
18
+ * Emitted when user presses ctrl+Enter or cmd+Enter
19
+ */
20
+ this.saveRecordShortcut = new EventEmitter();
21
+ this._subscriptions = [];
22
+ }
23
+ ngOnInit() {
24
+ const keyboardEventsSubscription = fromEvent(this._document, 'keydown')
25
+ .pipe(groupBy(e => e.code), mergeAll())
26
+ .subscribe(keyboardEvent => {
27
+ // Define shortcut(s) logic here.
28
+ if (keyboardEvent.code === 'Escape') {
29
+ this.closeShortcut.emit();
30
+ }
31
+ if (keyboardEvent.code === 'Enter' && keyboardEvent.ctrlKey) {
32
+ // Ctrl+Enter was pressed (Cmd+Enter on Apple HW)
33
+ this.saveRecordShortcut.emit();
34
+ }
35
+ });
36
+ this._subscriptions.push(keyboardEventsSubscription);
37
+ }
38
+ ngOnDestroy() {
39
+ this._subscriptions.forEach(subscription => subscription.unsubscribe());
40
+ }
41
+ }
42
+ KeyboardShortcutDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: KeyboardShortcutDirective, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Directive });
43
+ KeyboardShortcutDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.1", type: KeyboardShortcutDirective, selector: "[sdsKeyboardShortcut]", outputs: { closeShortcut: "closeShortcut", saveRecordShortcut: "saveRecordShortcut" }, ngImport: i0 });
44
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: KeyboardShortcutDirective, decorators: [{
45
+ type: Directive,
46
+ args: [{
47
+ selector: '[sdsKeyboardShortcut]'
48
+ }]
49
+ }], ctorParameters: function () {
50
+ return [{ type: undefined, decorators: [{
51
+ type: Inject,
52
+ args: [DOCUMENT]
53
+ }] }];
54
+ }, propDecorators: { closeShortcut: [{
55
+ type: Output
56
+ }], saveRecordShortcut: [{
57
+ type: Output
58
+ }] } });
59
+
60
+ class SdsKeyboardShortcutModule {
61
+ }
62
+ SdsKeyboardShortcutModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsKeyboardShortcutModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
63
+ SdsKeyboardShortcutModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsKeyboardShortcutModule, declarations: [KeyboardShortcutDirective], imports: [CommonModule], exports: [KeyboardShortcutDirective] });
64
+ SdsKeyboardShortcutModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsKeyboardShortcutModule, imports: [[
65
+ CommonModule
66
+ ]] });
67
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsKeyboardShortcutModule, decorators: [{
68
+ type: NgModule,
69
+ args: [{
70
+ declarations: [
71
+ KeyboardShortcutDirective
72
+ ],
73
+ exports: [
74
+ KeyboardShortcutDirective
75
+ ],
76
+ imports: [
77
+ CommonModule
78
+ ]
79
+ }]
80
+ }] });
81
+
82
+ /**
83
+ * Generated bundle index. Do not edit.
84
+ */
85
+
86
+ export { KeyboardShortcutDirective, SdsKeyboardShortcutModule };
87
+ //# sourceMappingURL=spicainternational-ngx-sds-components-src-lib-keyboard-shortcut.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spicainternational-ngx-sds-components-src-lib-keyboard-shortcut.mjs","sources":["../../../projects/ngx-sds-components/src/lib/keyboard-shortcut/directives/keyboard-shortcut.directive.ts","../../../projects/ngx-sds-components/src/lib/keyboard-shortcut/keyboard-shortcut.module.ts","../../../projects/ngx-sds-components/src/lib/keyboard-shortcut/spicainternational-ngx-sds-components-src-lib-keyboard-shortcut.ts"],"sourcesContent":["import { DOCUMENT } from '@angular/common';\r\nimport { Directive, EventEmitter, Inject, OnDestroy, OnInit, Output } from '@angular/core';\r\nimport { Subscription, fromEvent } from 'rxjs';\r\nimport { groupBy, mergeAll } from 'rxjs/operators';\r\n\r\n@Directive({\r\n selector: '[sdsKeyboardShortcut]'\r\n})\r\nexport class KeyboardShortcutDirective implements OnInit, OnDestroy {\r\n/**\r\n * OUTPUTS\r\n */\r\n /**\r\n * Emitted when user presses Escape\r\n */\r\n @Output() closeShortcut: EventEmitter<void> = new EventEmitter<void>();\r\n\r\n /**\r\n * Emitted when user presses ctrl+Enter or cmd+Enter\r\n */\r\n @Output() saveRecordShortcut: EventEmitter<void> = new EventEmitter<void>();\r\n\r\n private _subscriptions: Subscription[] = [];\r\n constructor(@Inject(DOCUMENT) private readonly _document: any) {}\r\n\r\n ngOnInit(): void {\r\n const keyboardEventsSubscription = fromEvent<KeyboardEvent>(\r\n this._document,\r\n 'keydown'\r\n )\r\n .pipe(\r\n groupBy(e => e.code),\r\n mergeAll()\r\n )\r\n .subscribe(keyboardEvent => {\r\n // Define shortcut(s) logic here.\r\n\r\n if (keyboardEvent.code === 'Escape') {\r\n this.closeShortcut.emit();\r\n }\r\n\r\n if (keyboardEvent.code === 'Enter' && keyboardEvent.ctrlKey) {\r\n // Ctrl+Enter was pressed (Cmd+Enter on Apple HW)\r\n this.saveRecordShortcut.emit();\r\n }\r\n });\r\n\r\n this._subscriptions.push(keyboardEventsSubscription);\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this._subscriptions.forEach(subscription => subscription.unsubscribe());\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { KeyboardShortcutDirective } from './directives';\r\n\r\n@NgModule({\r\n declarations: [\r\n KeyboardShortcutDirective\r\n ],\r\n exports: [\r\n KeyboardShortcutDirective\r\n ],\r\n imports: [\r\n CommonModule\r\n ]\r\n})\r\nexport class SdsKeyboardShortcutModule { }\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAQa,yBAAyB,CAAA;AAepC,IAAA,WAAA,CAA+C,SAAc,EAAA;AAAd,QAAA,IAAS,CAAA,SAAA,GAAT,SAAS,CAAK;AAd/D;;AAEK;AACH;;AAEG;AACO,QAAA,IAAA,CAAA,aAAa,GAAuB,IAAI,YAAY,EAAQ,CAAC;AAEvE;;AAEG;AACO,QAAA,IAAA,CAAA,kB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"13.3.1", ngImport: i0, type: SdsModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
64
- SdsModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.1", type: SdsModalComponent, selector: "sds-modal", inputs: { modalTitle: "modalTitle", showHeader: "showHeader", showFooter: "showFooter", size: "size", modalDialogId: "modalDialogId", showCloseButton: "showCloseButton", autoFocusCloseButton: "autoFocusCloseButton", translations: "translations", isScrollable: "isScrollable", closeOnEscape: "closeOnEscape" }, outputs: { modalOpen: "modalOpen", modalClose: "modalClose", closeClick: "closeClick", closeEscapeKeypress: "closeEscapeKeypress" }, queries: [{ propertyName: "headerContent", first: true, predicate: ["header"], descendants: true }], viewQueries: [{ propertyName: "_modal", first: true, predicate: ["modal"], descendants: true }, { propertyName: "_closeButton", first: true, predicate: ["closeButton"], descendants: true }], ngImport: i0, template: "<div #modal class=\"modal\" (keydown)=\"onKeydown($event)\" [cdkTrapFocus]=\"isOpen\" [cdkTrapFocusAutoCapture]=\"true\" >\r\n <div\r\n class=\"modal-dialog modal-dialog-centered\"\r\n [class.modal-dialog-scrollable] = \"isScrollable\"\r\n [attr.id]=\"modalDialogId\"\r\n [ngClass]=\"'modal-' + size\"\r\n role=\"document\"\r\n >\r\n <div class=\"modal-content\">\r\n\r\n <div *ngIf=\"showHeader && headerContent\" class=\"modal-header\">\r\n <ng-content select='header'></ng-content>\r\n </div> \r\n\r\n <div *ngIf=\"showHeader && !headerContent\" class=\"modal-header\">\r\n <h5 class=\"modal-title\">{{modalTitle}}</h5>\r\n <button \r\n #closeButton\r\n *ngIf=\"showCloseButton\"\r\n type=\"button\" \r\n class=\"btn-close\" \r\n [title]=\"translations.close ?? ''\"\r\n (click)=\"onCloseButtonClick()\">\r\n </button>\r\n </div>\r\n\r\n <div class=\"modal-body\">\r\n <ng-content></ng-content>\r\n </div>\r\n\r\n <div *ngIf=\"showFooter\" class=\"modal-footer\">\r\n <ng-content select=\"footer\"></ng-content>\r\n </div> \r\n </div>\r\n </div>\r\n</div>", styles: [".modal{background:rgba(0,0,0,.5)}.modal .modal-header button.btn-close:hover{background-color:#e9ecef}.modal.in{opacity:1}.modal.in .modal-dialog{transform:translate(0)}.modal-backdrop.fade{filter:alpha(opacity=0);opacity:0}.modal-backdrop.in{filter:alpha(opacity=50);opacity:.5}\n"], directives: [{ type: i1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
64
+ SdsModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.1", type: SdsModalComponent, selector: "sds-modal", inputs: { modalTitle: "modalTitle", showHeader: "showHeader", showFooter: "showFooter", size: "size", modalDialogId: "modalDialogId", showCloseButton: "showCloseButton", autoFocusCloseButton: "autoFocusCloseButton", translations: "translations", isScrollable: "isScrollable", closeOnEscape: "closeOnEscape" }, outputs: { modalOpen: "modalOpen", modalClose: "modalClose", closeClick: "closeClick", closeEscapeKeypress: "closeEscapeKeypress" }, queries: [{ propertyName: "headerContent", first: true, predicate: ["header"], descendants: true }], viewQueries: [{ propertyName: "_modal", first: true, predicate: ["modal"], descendants: true }, { propertyName: "_closeButton", first: true, predicate: ["closeButton"], descendants: true }], ngImport: i0, template: "<div #modal class=\"modal\" (keydown)=\"onKeydown($event)\" [cdkTrapFocus]=\"isOpen\" [cdkTrapFocusAutoCapture]=\"true\" >\r\n <div\r\n class=\"modal-dialog modal-dialog-centered\"\r\n [class.modal-dialog-scrollable] = \"isScrollable\"\r\n [attr.id]=\"modalDialogId\"\r\n [ngClass]=\"'modal-' + size\"\r\n role=\"document\"\r\n >\r\n <div class=\"modal-content\">\r\n\r\n <div *ngIf=\"showHeader && headerContent\" class=\"modal-header\">\r\n <ng-content select='header'></ng-content>\r\n </div> \r\n\r\n <div *ngIf=\"showHeader && !headerContent\" class=\"modal-header\">\r\n <h5 class=\"modal-title\">{{modalTitle}}</h5>\r\n <button \r\n #closeButton\r\n *ngIf=\"showCloseButton\"\r\n type=\"button\" \r\n class=\"btn-close\" \r\n [title]=\"translations.close ?? ''\"\r\n (click)=\"onCloseButtonClick()\">\r\n </button>\r\n </div>\r\n\r\n <div class=\"modal-body\">\r\n <ng-content></ng-content>\r\n </div>\r\n\r\n <div *ngIf=\"showFooter\" class=\"modal-footer\">\r\n <ng-content select=\"footer\"></ng-content>\r\n </div> \r\n </div>\r\n </div>\r\n</div>", styles: [".modal{background:rgba(0,0,0,.5)}.modal .modal-header button.btn-close:hover{background-color:#e9ecef}.modal.in{opacity:1}.modal.in .modal-dialog{transform:translate(0)}.modal-backdrop.fade{filter:alpha(opacity=0);opacity:0}.modal-backdrop.in{filter:alpha(opacity=50);opacity:.5}@media (min-width: 820px){.modal-820{max-width:820px}}\n"], directives: [{ type: i1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
65
65
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsModalComponent, decorators: [{
66
66
  type: Component,
67
- args: [{ selector: 'sds-modal', template: "<div #modal class=\"modal\" (keydown)=\"onKeydown($event)\" [cdkTrapFocus]=\"isOpen\" [cdkTrapFocusAutoCapture]=\"true\" >\r\n <div\r\n class=\"modal-dialog modal-dialog-centered\"\r\n [class.modal-dialog-scrollable] = \"isScrollable\"\r\n [attr.id]=\"modalDialogId\"\r\n [ngClass]=\"'modal-' + size\"\r\n role=\"document\"\r\n >\r\n <div class=\"modal-content\">\r\n\r\n <div *ngIf=\"showHeader && headerContent\" class=\"modal-header\">\r\n <ng-content select='header'></ng-content>\r\n </div> \r\n\r\n <div *ngIf=\"showHeader && !headerContent\" class=\"modal-header\">\r\n <h5 class=\"modal-title\">{{modalTitle}}</h5>\r\n <button \r\n #closeButton\r\n *ngIf=\"showCloseButton\"\r\n type=\"button\" \r\n class=\"btn-close\" \r\n [title]=\"translations.close ?? ''\"\r\n (click)=\"onCloseButtonClick()\">\r\n </button>\r\n </div>\r\n\r\n <div class=\"modal-body\">\r\n <ng-content></ng-content>\r\n </div>\r\n\r\n <div *ngIf=\"showFooter\" class=\"modal-footer\">\r\n <ng-content select=\"footer\"></ng-content>\r\n </div> \r\n </div>\r\n </div>\r\n</div>", styles: [".modal{background:rgba(0,0,0,.5)}.modal .modal-header button.btn-close:hover{background-color:#e9ecef}.modal.in{opacity:1}.modal.in .modal-dialog{transform:translate(0)}.modal-backdrop.fade{filter:alpha(opacity=0);opacity:0}.modal-backdrop.in{filter:alpha(opacity=50);opacity:.5}\n"] }]
67
+ args: [{ selector: 'sds-modal', template: "<div #modal class=\"modal\" (keydown)=\"onKeydown($event)\" [cdkTrapFocus]=\"isOpen\" [cdkTrapFocusAutoCapture]=\"true\" >\r\n <div\r\n class=\"modal-dialog modal-dialog-centered\"\r\n [class.modal-dialog-scrollable] = \"isScrollable\"\r\n [attr.id]=\"modalDialogId\"\r\n [ngClass]=\"'modal-' + size\"\r\n role=\"document\"\r\n >\r\n <div class=\"modal-content\">\r\n\r\n <div *ngIf=\"showHeader && headerContent\" class=\"modal-header\">\r\n <ng-content select='header'></ng-content>\r\n </div> \r\n\r\n <div *ngIf=\"showHeader && !headerContent\" class=\"modal-header\">\r\n <h5 class=\"modal-title\">{{modalTitle}}</h5>\r\n <button \r\n #closeButton\r\n *ngIf=\"showCloseButton\"\r\n type=\"button\" \r\n class=\"btn-close\" \r\n [title]=\"translations.close ?? ''\"\r\n (click)=\"onCloseButtonClick()\">\r\n </button>\r\n </div>\r\n\r\n <div class=\"modal-body\">\r\n <ng-content></ng-content>\r\n </div>\r\n\r\n <div *ngIf=\"showFooter\" class=\"modal-footer\">\r\n <ng-content select=\"footer\"></ng-content>\r\n </div> \r\n </div>\r\n </div>\r\n</div>", styles: [".modal{background:rgba(0,0,0,.5)}.modal .modal-header button.btn-close:hover{background-color:#e9ecef}.modal.in{opacity:1}.modal.in .modal-dialog{transform:translate(0)}.modal-backdrop.fade{filter:alpha(opacity=0);opacity:0}.modal-backdrop.in{filter:alpha(opacity=50);opacity:.5}@media (min-width: 820px){.modal-820{max-width:820px}}\n"] }]
68
68
  }], ctorParameters: function () { return []; }, propDecorators: { headerContent: [{
69
69
  type: ContentChild,
70
70
  args: ['header']
@@ -1 +1 @@
1
- {"version":3,"file":"spicainternational-ngx-sds-components-src-lib-modal.mjs","sources":["../../../projects/ngx-sds-components/src/lib/modal/modal.component.ts","../../../projects/ngx-sds-components/src/lib/modal/modal.component.html","../../../projects/ngx-sds-components/src/lib/modal/dialog/dialog.component.ts","../../../projects/ngx-sds-components/src/lib/modal/dialog/dialog.component.html","../../../projects/ngx-sds-components/src/lib/modal/modal.module.ts","../../../projects/ngx-sds-components/src/lib/modal/spicainternational-ngx-sds-components-src-lib-modal.ts"],"sourcesContent":["import {\r\n Component,\r\n ElementRef,\r\n Input,\r\n OnInit,\r\n Output,\r\n ViewChild,\r\n EventEmitter,\r\n ContentChild\r\n} from '@angular/core';\r\nimport { faXmark } from '@fortawesome/pro-regular-svg-icons';\r\nimport { ModalTranslations } from './modal.model';\r\n\r\n@Component({\r\n selector: 'sds-modal',\r\n templateUrl: './modal.component.html',\r\n styleUrls: ['./modal.component.scss'],\r\n})\r\nexport class SdsModalComponent implements OnInit {\r\n @ContentChild('header') headerContent: ElementRef = { nativeElement: undefined };\r\n\r\n @Input() public modalTitle?: string;\r\n @Input() public showHeader: boolean = true;\r\n @Input() public showFooter: boolean = true;\r\n @Input() public size: 'sm' | 'md' | 'lg' | 'xl' = 'md';\r\n @Input() public modalDialogId?: string;\r\n @Input() public showCloseButton: boolean = true;\r\n @Input() public autoFocusCloseButton: boolean = false;\r\n\r\n @Input() public translations: ModalTranslations;\r\n @Input() public isScrollable = true;\r\n @Input() public closeOnEscape = false;\r\n\r\n @Output() public modalOpen: EventEmitter<void> = new EventEmitter<void>();\r\n @Output() public modalClose: EventEmitter<void> = new EventEmitter<void>();\r\n\r\n @Output() public closeClick: EventEmitter<void> = new EventEmitter<void>();\r\n @Output() public closeEscapeKeypress: EventEmitter<void> = new EventEmitter<void>();\r\n\r\n public closeIcon = faXmark;\r\n\r\n public isOpen: boolean = false;\r\n\r\n @ViewChild('modal', { static: false }) private _modal: ElementRef | undefined;\r\n @ViewChild('closeButton', { static: false }) private _closeButton: ElementRef | undefined;\r\n \r\n\r\n constructor() {\r\n this.translations = {\r\n close: undefined\r\n }\r\n }\r\n\r\n ngOnInit(): void {}\r\n\r\n public open(): void {\r\n if (this._modal != undefined) {\r\n this._modal.nativeElement.style.display = 'block';\r\n this.isOpen = true;\r\n if(this.autoFocusCloseButton)\r\n this._closeButton?.nativeElement.focus();\r\n this.modalOpen.emit();\r\n }\r\n }\r\n\r\n public close(): void {\r\n if (this._modal != undefined) {\r\n this._modal.nativeElement.style.display = 'none';\r\n this.isOpen = false;\r\n this.modalClose.emit();\r\n }\r\n }\r\n\r\n public onCloseButtonClick(){\r\n this.closeClick.emit();\r\n this.close();\r\n }\r\n\r\n onKeydown(event: KeyboardEvent){\r\n if (\r\n event.code === 'Escape' &&\r\n this.closeOnEscape && \r\n this._modal != undefined && \r\n this._modal.nativeElement.style.display === 'block'){\r\n // console.log(`${this.constructor.name} got event: ${event.code}`);\r\n this.closeEscapeKeypress.emit();\r\n this.close();\r\n }\r\n }\r\n}\r\n","<div #modal class=\"modal\" (keydown)=\"onKeydown($event)\" [cdkTrapFocus]=\"isOpen\" [cdkTrapFocusAutoCapture]=\"true\" >\r\n <div\r\n class=\"modal-dialog modal-dialog-centered\"\r\n [class.modal-dialog-scrollable] = \"isScrollable\"\r\n [attr.id]=\"modalDialogId\"\r\n [ngClass]=\"'modal-' + size\"\r\n role=\"document\"\r\n >\r\n <div class=\"modal-content\">\r\n\r\n <div *ngIf=\"showHeader && headerContent\" class=\"modal-header\">\r\n <ng-content select='header'></ng-content>\r\n </div> \r\n\r\n <div *ngIf=\"showHeader && !headerContent\" class=\"modal-header\">\r\n <h5 class=\"modal-title\">{{modalTitle}}</h5>\r\n <button \r\n #closeButton\r\n *ngIf=\"showCloseButton\"\r\n type=\"button\" \r\n class=\"btn-close\" \r\n [title]=\"translations.close ?? ''\"\r\n (click)=\"onCloseButtonClick()\">\r\n </button>\r\n </div>\r\n\r\n <div class=\"modal-body\">\r\n <ng-content></ng-content>\r\n </div>\r\n\r\n <div *ngIf=\"showFooter\" class=\"modal-footer\">\r\n <ng-content select=\"footer\"></ng-content>\r\n </div> \r\n </div>\r\n </div>\r\n</div>","import { Component, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core';\r\nimport { SdsModalComponent } from '../modal.component';\r\nimport { ButtonType } from './dialog.types';\r\n\r\ntype modalButton = 'primary' | 'secondary' | 'close';\r\n\r\n@Component({\r\n selector: 'sds-dialog',\r\n templateUrl: './dialog.component.html',\r\n styleUrls: ['./dialog.component.scss'],\r\n})\r\nexport class SdsDialogComponent implements OnInit {\r\n @Input() public title: string = '';\r\n @Input() public closeText?: string = 'close';\r\n @Input() public size: 'sm' | 'md' | 'lg' | 'xl' = 'md';\r\n\r\n @Input() public primaryButtonText: string = 'Ok';\r\n @Input() public primaryButtonClass: string = 'btn-primary';\r\n @Input() public primaryButtonType: ButtonType = 'button';\r\n \r\n @Input() public secondaryButtonText: string = 'Cancel'; \r\n @Input() public secondaryButtonClass: string = 'btn-secondary';\r\n @Input() public secondaryButtonType: ButtonType = 'button';\r\n\r\n @Input() public closeOnEscape: boolean = true;\r\n @Input() public showHeader: boolean = true;\r\n @Input() public showCloseButton: boolean = true;\r\n @Input() public showPrimaryButton: boolean = true;\r\n @Input() public showSecondaryButton: boolean = true;\r\n @Input() public autofocusElement: 'primary' | 'secondary' | 'close' | 'content' = 'primary';\r\n\r\n @Input() public modalDialogId?: string;\r\n\r\n\r\n @Output() public dialogOpen: EventEmitter<void> = new EventEmitter<void>();\r\n @Output() public dialogClose: EventEmitter<void> = new EventEmitter<void>();\r\n\r\n @ViewChild('modal', { static: true }) private _modal: SdsModalComponent | undefined;\r\n @ViewChild('content', { read: ElementRef, static: true }) private _content?: ElementRef;\r\n @ViewChild('primaryButton', { read: ElementRef, static: false }) private _primaryButton?: ElementRef;\r\n @ViewChild('secondaryButton', { read: ElementRef, static: false }) private _secondaryButton?: ElementRef;\r\n\r\n private _callback?: Function;\r\n private _callbackData: any;\r\n\r\n public isOpen: boolean = false;\r\n\r\n constructor() {}\r\n\r\n ngOnInit(): void {\r\n if (this.autofocusElement == 'primary' && !this.showPrimaryButton) {\r\n this.autofocusElement = 'secondary';\r\n }\r\n if (this.autofocusElement == 'secondary' && !this.showSecondaryButton) {\r\n this.autofocusElement = 'close';\r\n }\r\n if (this.autofocusElement == 'close' && !this.showCloseButton) {\r\n this.autofocusElement = 'content';\r\n }\r\n }\r\n\r\n public open(callback?: (button: modalButton, data: any) => void, data?: any): void{\r\n this._callback = callback;\r\n this._callbackData = data;\r\n\r\n if (this._modal != undefined) {\r\n this.isOpen = true;\r\n this._modal.open();\r\n }\r\n }\r\n\r\n private close(): void {\r\n if (this._modal != undefined) {\r\n this.isOpen = false;\r\n this._modal.close();\r\n }\r\n }\r\n\r\n public onSecondaryClick(): void {\r\n if (this._callback) {\r\n this._callback('secondary', this._callbackData);\r\n }\r\n this.close();\r\n }\r\n\r\n public onPrimaryClick(): void {\r\n if (this._callback) {\r\n this._callback('primary', this._callbackData);\r\n }\r\n this.close();\r\n }\r\n\r\n public onCloseClick(): void {\r\n if (this._callback) {\r\n this._callback('close', this._callbackData);\r\n }\r\n }\r\n\r\n public onCloseEscapeKeypress(): void {\r\n if (this._callback) {\r\n this._callback('close', this._callbackData);\r\n }\r\n }\r\n\r\n public onModalClose(): void {\r\n this.dialogClose.emit();\r\n }\r\n\r\n public onModalOpen(): void {\r\n this.dialogOpen.emit();\r\n switch (this.autofocusElement) {\r\n case 'primary':\r\n this._primaryButton?.nativeElement.focus();\r\n break;\r\n case 'secondary':\r\n this._secondaryButton?.nativeElement.focus();\r\n break;\r\n case 'content':\r\n this._content?.nativeElement.focus();\r\n break;\r\n default:\r\n break;\r\n }\r\n } \r\n\r\n}\r\n\r\n\r\n\r\n","<sds-modal\r\n #modal\r\n [modalTitle]=\"title\"\r\n [size]=\"size\"\r\n [modalDialogId]=\"modalDialogId\"\r\n [showCloseButton]=\"showCloseButton\"\r\n [showHeader]=\"showHeader\"\r\n [translations]=\"{ close: closeText}\"\r\n [autoFocusCloseButton]=\"autofocusElement === 'close'\"\r\n [closeOnEscape]=\"closeOnEscape\"\r\n (closeClick)=\"onCloseClick()\"\r\n (closeEscapeKeypress)=\"onCloseEscapeKeypress()\"\r\n (modalClose)=\"onModalClose()\"\r\n (modalOpen)=\"onModalOpen()\"\r\n>\r\n\r\n <div #content [attr.tabindex]=\"autofocusElement === 'content' ? 0 : undefined\" >\r\n <ng-content></ng-content>\r\n </div>\r\n <ng-container #footer ngProjectAs='footer'>\r\n <button\r\n #secondaryButton\r\n *ngIf=\"showSecondaryButton\"\r\n class=\"btn\"\r\n [class]=\"secondaryButtonClass\"\r\n (click)=\"onSecondaryClick()\"\r\n >{{secondaryButtonText}}</button>\r\n <button\r\n #primaryButton\r\n *ngIf=\"showPrimaryButton\"\r\n class=\"btn\"\r\n [class]=\"primaryButtonClass\"\r\n (click)=\"onPrimaryClick()\"\r\n >{{primaryButtonText}}</button>\r\n </ng-container>\r\n</sds-modal>\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { SdsModalComponent } from './modal.component';\r\nimport { FontAwesomeModule } from '@fortawesome/angular-fontawesome';\r\nimport { SdsDialogComponent } from './dialog/dialog.component';\r\nimport { A11yModule } from '@angular/cdk/a11y';\r\n\r\n\r\nconst components = [\r\n SdsModalComponent,\r\n SdsDialogComponent\r\n];\r\n\r\n@NgModule({\r\n declarations: [\r\n ...components\r\n ],\r\n imports: [\r\n CommonModule,\r\n A11yModule,\r\n FontAwesomeModule\r\n ],\r\n exports: [\r\n ...components\r\n]\r\n})\r\nexport class SdsModalModule { }\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.SdsModalComponent"],"mappings":";;;;;;;;;MAkBa,iBAAiB,CAAA;AA6B1B,IAAA,WAAA,GAAA;QA5BwB,IAAA,CAAA,aAAa,GAAe,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC;AAGjE,QAAA,IAAU,CAAA,UAAA,GAAY,IAAI,CAAC;AAC3B,QAAA,IAAU,CAAA,UAAA,GAAY,IAAI,CAAC;AAC3B,QAAA,IAAI,CAAA,IAAA,GAA8B,IAAI,CAAC;AAEvC,QAAA,IAAe,CAAA,eAAA,GAAY,IAAI,CAAC;AAChC,QAAA,IAAoB,CAAA,oBAAA,GAAY,KAAK,CAAC;AAGtC,QAAA,IAAY,CAAA,YAAA,GAAG,IAAI,CAAC;AACpB,QAAA,IAAa,CAAA,aAAA,GAAG,KAAK,CAAC;AAErB,QAAA,IAAA,CAAA,SAAS,GAAuB,IAAI,YAAY,EAAQ,CAAC;AACzD,QAAA,IAAA,CAAA,UAAU,GAAuB,IAAI,YAAY,EAAQ,CAAC;AAE1D,QAAA,IAAA,CAAA,UAAU,GAAuB,IAAI,YAAY,EAAQ,CAAC;AAC1D,QAAA,IAAA,CAAA,mBAAmB,GAAuB,IAAI,YAAY,EAAQ,CAAC;AAE7E,QAAA,IAAS,CAAA,SAAA,GAAG,OAAO,CAAC;AAEpB,QAAA,IAAM,CAAA,MAAA,GAAY,KAAK,CAAC;QAO3B,IAAI,CAAC,YAAY,GAAG;AAChB,YAAA,KAAK,EAAE,SAAS;SACnB,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+ {"version":3,"file":"spicainternational-ngx-sds-components-src-lib-modal.mjs","sources":["../../../projects/ngx-sds-components/src/lib/modal/modal.component.ts","../../../projects/ngx-sds-components/src/lib/modal/modal.component.html","../../../projects/ngx-sds-components/src/lib/modal/dialog/dialog.component.ts","../../../projects/ngx-sds-components/src/lib/modal/dialog/dialog.component.html","../../../projects/ngx-sds-components/src/lib/modal/modal.module.ts","../../../projects/ngx-sds-components/src/lib/modal/spicainternational-ngx-sds-components-src-lib-modal.ts"],"sourcesContent":["import {\r\n Component,\r\n ElementRef,\r\n Input,\r\n OnInit,\r\n Output,\r\n ViewChild,\r\n EventEmitter,\r\n ContentChild\r\n} from '@angular/core';\r\nimport { faXmark } from '@fortawesome/pro-regular-svg-icons';\r\nimport { ModalTranslations } from './modal.model';\r\n\r\n@Component({\r\n selector: 'sds-modal',\r\n templateUrl: './modal.component.html',\r\n styleUrls: ['./modal.component.scss'],\r\n})\r\nexport class SdsModalComponent implements OnInit {\r\n @ContentChild('header') headerContent: ElementRef = { nativeElement: undefined };\r\n\r\n @Input() public modalTitle?: string;\r\n @Input() public showHeader: boolean = true;\r\n @Input() public showFooter: boolean = true;\r\n @Input() public size: 'sm' | 'md' | 'lg' | 'xl' | '820' = 'md';\r\n @Input() public modalDialogId?: string;\r\n @Input() public showCloseButton: boolean = true;\r\n @Input() public autoFocusCloseButton: boolean = false;\r\n\r\n @Input() public translations: ModalTranslations;\r\n @Input() public isScrollable = true;\r\n @Input() public closeOnEscape = false;\r\n\r\n @Output() public modalOpen: EventEmitter<void> = new EventEmitter<void>();\r\n @Output() public modalClose: EventEmitter<void> = new EventEmitter<void>();\r\n\r\n @Output() public closeClick: EventEmitter<void> = new EventEmitter<void>();\r\n @Output() public closeEscapeKeypress: EventEmitter<void> = new EventEmitter<void>();\r\n\r\n public closeIcon = faXmark;\r\n\r\n public isOpen: boolean = false;\r\n\r\n @ViewChild('modal', { static: false }) private _modal: ElementRef | undefined;\r\n @ViewChild('closeButton', { static: false }) private _closeButton: ElementRef | undefined;\r\n \r\n\r\n constructor() {\r\n this.translations = {\r\n close: undefined\r\n }\r\n }\r\n\r\n ngOnInit(): void {}\r\n\r\n public open(): void {\r\n if (this._modal != undefined) {\r\n this._modal.nativeElement.style.display = 'block';\r\n this.isOpen = true;\r\n if(this.autoFocusCloseButton)\r\n this._closeButton?.nativeElement.focus();\r\n this.modalOpen.emit();\r\n }\r\n }\r\n\r\n public close(): void {\r\n if (this._modal != undefined) {\r\n this._modal.nativeElement.style.display = 'none';\r\n this.isOpen = false;\r\n this.modalClose.emit();\r\n }\r\n }\r\n\r\n public onCloseButtonClick(){\r\n this.closeClick.emit();\r\n this.close();\r\n }\r\n\r\n onKeydown(event: KeyboardEvent){\r\n if (\r\n event.code === 'Escape' &&\r\n this.closeOnEscape && \r\n this._modal != undefined && \r\n this._modal.nativeElement.style.display === 'block'){\r\n // console.log(`${this.constructor.name} got event: ${event.code}`);\r\n this.closeEscapeKeypress.emit();\r\n this.close();\r\n }\r\n }\r\n}\r\n","<div #modal class=\"modal\" (keydown)=\"onKeydown($event)\" [cdkTrapFocus]=\"isOpen\" [cdkTrapFocusAutoCapture]=\"true\" >\r\n <div\r\n class=\"modal-dialog modal-dialog-centered\"\r\n [class.modal-dialog-scrollable] = \"isScrollable\"\r\n [attr.id]=\"modalDialogId\"\r\n [ngClass]=\"'modal-' + size\"\r\n role=\"document\"\r\n >\r\n <div class=\"modal-content\">\r\n\r\n <div *ngIf=\"showHeader && headerContent\" class=\"modal-header\">\r\n <ng-content select='header'></ng-content>\r\n </div> \r\n\r\n <div *ngIf=\"showHeader && !headerContent\" class=\"modal-header\">\r\n <h5 class=\"modal-title\">{{modalTitle}}</h5>\r\n <button \r\n #closeButton\r\n *ngIf=\"showCloseButton\"\r\n type=\"button\" \r\n class=\"btn-close\" \r\n [title]=\"translations.close ?? ''\"\r\n (click)=\"onCloseButtonClick()\">\r\n </button>\r\n </div>\r\n\r\n <div class=\"modal-body\">\r\n <ng-content></ng-content>\r\n </div>\r\n\r\n <div *ngIf=\"showFooter\" class=\"modal-footer\">\r\n <ng-content select=\"footer\"></ng-content>\r\n </div> \r\n </div>\r\n </div>\r\n</div>","import { Component, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core';\r\nimport { SdsModalComponent } from '../modal.component';\r\nimport { ButtonType } from './dialog.types';\r\n\r\ntype modalButton = 'primary' | 'secondary' | 'close';\r\n\r\n@Component({\r\n selector: 'sds-dialog',\r\n templateUrl: './dialog.component.html',\r\n styleUrls: ['./dialog.component.scss'],\r\n})\r\nexport class SdsDialogComponent implements OnInit {\r\n @Input() public title: string = '';\r\n @Input() public closeText?: string = 'close';\r\n @Input() public size: 'sm' | 'md' | 'lg' | 'xl' = 'md';\r\n\r\n @Input() public primaryButtonText: string = 'Ok';\r\n @Input() public primaryButtonClass: string = 'btn-primary';\r\n @Input() public primaryButtonType: ButtonType = 'button';\r\n \r\n @Input() public secondaryButtonText: string = 'Cancel'; \r\n @Input() public secondaryButtonClass: string = 'btn-secondary';\r\n @Input() public secondaryButtonType: ButtonType = 'button';\r\n\r\n @Input() public closeOnEscape: boolean = true;\r\n @Input() public showHeader: boolean = true;\r\n @Input() public showCloseButton: boolean = true;\r\n @Input() public showPrimaryButton: boolean = true;\r\n @Input() public showSecondaryButton: boolean = true;\r\n @Input() public autofocusElement: 'primary' | 'secondary' | 'close' | 'content' = 'primary';\r\n\r\n @Input() public modalDialogId?: string;\r\n\r\n\r\n @Output() public dialogOpen: EventEmitter<void> = new EventEmitter<void>();\r\n @Output() public dialogClose: EventEmitter<void> = new EventEmitter<void>();\r\n\r\n @ViewChild('modal', { static: true }) private _modal: SdsModalComponent | undefined;\r\n @ViewChild('content', { read: ElementRef, static: true }) private _content?: ElementRef;\r\n @ViewChild('primaryButton', { read: ElementRef, static: false }) private _primaryButton?: ElementRef;\r\n @ViewChild('secondaryButton', { read: ElementRef, static: false }) private _secondaryButton?: ElementRef;\r\n\r\n private _callback?: Function;\r\n private _callbackData: any;\r\n\r\n public isOpen: boolean = false;\r\n\r\n constructor() {}\r\n\r\n ngOnInit(): void {\r\n if (this.autofocusElement == 'primary' && !this.showPrimaryButton) {\r\n this.autofocusElement = 'secondary';\r\n }\r\n if (this.autofocusElement == 'secondary' && !this.showSecondaryButton) {\r\n this.autofocusElement = 'close';\r\n }\r\n if (this.autofocusElement == 'close' && !this.showCloseButton) {\r\n this.autofocusElement = 'content';\r\n }\r\n }\r\n\r\n public open(callback?: (button: modalButton, data: any) => void, data?: any): void{\r\n this._callback = callback;\r\n this._callbackData = data;\r\n\r\n if (this._modal != undefined) {\r\n this.isOpen = true;\r\n this._modal.open();\r\n }\r\n }\r\n\r\n private close(): void {\r\n if (this._modal != undefined) {\r\n this.isOpen = false;\r\n this._modal.close();\r\n }\r\n }\r\n\r\n public onSecondaryClick(): void {\r\n if (this._callback) {\r\n this._callback('secondary', this._callbackData);\r\n }\r\n this.close();\r\n }\r\n\r\n public onPrimaryClick(): void {\r\n if (this._callback) {\r\n this._callback('primary', this._callbackData);\r\n }\r\n this.close();\r\n }\r\n\r\n public onCloseClick(): void {\r\n if (this._callback) {\r\n this._callback('close', this._callbackData);\r\n }\r\n }\r\n\r\n public onCloseEscapeKeypress(): void {\r\n if (this._callback) {\r\n this._callback('close', this._callbackData);\r\n }\r\n }\r\n\r\n public onModalClose(): void {\r\n this.dialogClose.emit();\r\n }\r\n\r\n public onModalOpen(): void {\r\n this.dialogOpen.emit();\r\n switch (this.autofocusElement) {\r\n case 'primary':\r\n this._primaryButton?.nativeElement.focus();\r\n break;\r\n case 'secondary':\r\n this._secondaryButton?.nativeElement.focus();\r\n break;\r\n case 'content':\r\n this._content?.nativeElement.focus();\r\n break;\r\n default:\r\n break;\r\n }\r\n } \r\n\r\n}\r\n\r\n\r\n\r\n","<sds-modal\r\n #modal\r\n [modalTitle]=\"title\"\r\n [size]=\"size\"\r\n [modalDialogId]=\"modalDialogId\"\r\n [showCloseButton]=\"showCloseButton\"\r\n [showHeader]=\"showHeader\"\r\n [translations]=\"{ close: closeText}\"\r\n [autoFocusCloseButton]=\"autofocusElement === 'close'\"\r\n [closeOnEscape]=\"closeOnEscape\"\r\n (closeClick)=\"onCloseClick()\"\r\n (closeEscapeKeypress)=\"onCloseEscapeKeypress()\"\r\n (modalClose)=\"onModalClose()\"\r\n (modalOpen)=\"onModalOpen()\"\r\n>\r\n\r\n <div #content [attr.tabindex]=\"autofocusElement === 'content' ? 0 : undefined\" >\r\n <ng-content></ng-content>\r\n </div>\r\n <ng-container #footer ngProjectAs='footer'>\r\n <button\r\n #secondaryButton\r\n *ngIf=\"showSecondaryButton\"\r\n class=\"btn\"\r\n [class]=\"secondaryButtonClass\"\r\n (click)=\"onSecondaryClick()\"\r\n >{{secondaryButtonText}}</button>\r\n <button\r\n #primaryButton\r\n *ngIf=\"showPrimaryButton\"\r\n class=\"btn\"\r\n [class]=\"primaryButtonClass\"\r\n (click)=\"onPrimaryClick()\"\r\n >{{primaryButtonText}}</button>\r\n </ng-container>\r\n</sds-modal>\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { SdsModalComponent } from './modal.component';\r\nimport { FontAwesomeModule } from '@fortawesome/angular-fontawesome';\r\nimport { SdsDialogComponent } from './dialog/dialog.component';\r\nimport { A11yModule } from '@angular/cdk/a11y';\r\n\r\n\r\nconst components = [\r\n SdsModalComponent,\r\n SdsDialogComponent\r\n];\r\n\r\n@NgModule({\r\n declarations: [\r\n ...components\r\n ],\r\n imports: [\r\n CommonModule,\r\n A11yModule,\r\n FontAwesomeModule\r\n ],\r\n exports: [\r\n ...components\r\n]\r\n})\r\nexport class SdsModalModule { }\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.SdsModalComponent"],"mappings":";;;;;;;;;MAkBa,iBAAiB,CAAA;AA6B1B,IAAA,WAAA,GAAA;QA5BwB,IAAA,CAAA,aAAa,GAAe,EAAE,aAAa,EAAE,SA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AA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,iBAjBvB,iBAAiB;AACjB,QAAA,kBAAkB,aAQlB,YAAY;QACZ,UAAU;AACV,QAAA,iBAAiB,aAXjB,iBAAiB;QACjB,kBAAkB,CAAA,EAAA,CAAA,CAAA;AAgBT,cAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,EAThB,OAAA,EAAA,CAAA;YACP,YAAY;YACZ,UAAU;YACV,iBAAiB;SAClB,CAAA,EAAA,CAAA,CAAA;2FAKU,cAAc,EAAA,UAAA,EAAA,CAAA;kBAb1B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE;AACZ,wBAAA,GAAG,UAAU;AACd,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,UAAU;wBACV,iBAAiB;AAClB,qBAAA;AACD,oBAAA,OAAO,EAAE;AACP,wBAAA,GAAG,UAAU;AAChB,qBAAA;iBACA,CAAA;;;ACzBD;;AAEG;;;;"}
@@ -0,0 +1,237 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, NgModule, Optional, SkipSelf } from '@angular/core';
3
+ import { CommonModule } from '@angular/common';
4
+ import { BehaviorSubject, interval } from 'rxjs';
5
+ import { skip, debounceTime } from 'rxjs/operators';
6
+
7
+ /**
8
+ * @public @function timeToNextFifteenMinutesInterval
9
+ * @description
10
+ * Function responsible for calc of time until next fifteen minutes interval. By fifteen minutes interval
11
+ * we mean (e.g. 08:15, 08:30, 08:45,...)
12
+ * @param { number } currentTimestampMs
13
+ * @returns { number }
14
+ */
15
+ const timeToNextFifteenMinutesInterval = (currentTimestamp) => {
16
+ const timestampSeconds = currentTimestamp / 1000;
17
+ const numberOfSecondsIntoTheCurrentInterval = timestampSeconds % 900;
18
+ const numberOfSecondsToTheNextInterval = 900 - numberOfSecondsIntoTheCurrentInterval;
19
+ return numberOfSecondsToTheNextInterval;
20
+ };
21
+ /**
22
+ * @public @function timeToNextFiveMinutesInterval
23
+ * @description
24
+ * Function responsible for calc of time until next five minutes interval. By five minutes interval
25
+ * we mean (e.g. 08:05, 08:10, 08:15,...)
26
+ * @param { number } currentTimestampMs
27
+ * @returns { number }
28
+ */
29
+ const timeToNextFiveMinutesInterval = (currentTimestamp) => {
30
+ const timestampSeconds = currentTimestamp / 1000;
31
+ const numberOfSecondsIntoTheCurrentInterval = timestampSeconds % 300;
32
+ const numberOfSecondsToTheNextInterval = 300 - numberOfSecondsIntoTheCurrentInterval;
33
+ return numberOfSecondsToTheNextInterval;
34
+ };
35
+ /**
36
+ * @public @function timeToNextHour
37
+ * @description
38
+ * Function responsible for calc of time until next hour
39
+ * @param { number } currentTimestampMs
40
+ * @returns { number }
41
+ */
42
+ const timeToNextHour = (currentTimestamp) => {
43
+ const timestampSeconds = currentTimestamp / 1000;
44
+ const numberOfSecondsIntoTheCurrentHour = timestampSeconds % 3600;
45
+ const numberOfSecondsToTheNextHour = 3600 - numberOfSecondsIntoTheCurrentHour;
46
+ return numberOfSecondsToTheNextHour;
47
+ };
48
+ /**
49
+ * @public @function timeToNextHalfHour
50
+ * @description
51
+ * Function responsible for calc of time until half hour
52
+ * @param { number } currentTimestampMs
53
+ * @returns { number }
54
+ */
55
+ const timeToNextHalfHour = (currentTimestamp) => {
56
+ const timestampSeconds = currentTimestamp / 1000;
57
+ const numberOfSecondsIntoTheCurrentHalfHour = timestampSeconds % 1800;
58
+ const numberOfSecondsToTheNextHalfHour = 1800 - numberOfSecondsIntoTheCurrentHalfHour;
59
+ return numberOfSecondsToTheNextHalfHour;
60
+ };
61
+ /**
62
+ * @public @function timeToNextMinuteInterval
63
+ * @description
64
+ * Function responsible for calc of time until next minute interval. By minute interval
65
+ * we mean (e.g. 08:00, 08:01, 08:02,...)
66
+ * @param { number } currentTimestampMs
67
+ * @returns { number }
68
+ */
69
+ const timeToNextMinuteInterval = (currentTimestamp) => {
70
+ const timestampSeconds = currentTimestamp / 1000;
71
+ const numberOfSecondsIntoTheCurrentInterval = timestampSeconds % 60;
72
+ const numberOfSecondsToTheNextInterval = 60 - numberOfSecondsIntoTheCurrentInterval;
73
+ return numberOfSecondsToTheNextInterval;
74
+ };
75
+ /**
76
+ * @public @function timeToNextSecondInterval
77
+ * @description
78
+ * Function responsible for calc of time until next second interval. By second interval
79
+ * we mean (e.g. 08:00:01, 08:00:01, 08:00:02,...)
80
+ * @param { number } currentTimestampMs
81
+ * @returns { number }
82
+ */
83
+ const timeToNextSecondInterval = (currentTimestamp) => {
84
+ const timestampSeconds = currentTimestamp;
85
+ const numberOfMilisecSecondsIntoTheCurrentInterval = timestampSeconds % 999;
86
+ const numberOfMilisecondsSecondsToTheNextInterval = 999 - numberOfMilisecSecondsIntoTheCurrentInterval;
87
+ return numberOfMilisecondsSecondsToTheNextInterval;
88
+ };
89
+ /**
90
+ * @public @function timeToNextTenMinutesInterval
91
+ * @description
92
+ * Function responsible for calc of time until next ten minutes interval. By ten minutes interval
93
+ * we mean (e.g. 08:10, 08:20, 08:30,...)
94
+ * @param { number } currentTimestampMs
95
+ * @returns { number }
96
+ */
97
+ const timeToNextTenMinutesInterval = (currentTimestamp) => {
98
+ const timestampSeconds = currentTimestamp / 1000;
99
+ const numberOfSecondsIntoTheCurrentInterval = timestampSeconds % 600;
100
+ const numberOfSecondsToTheNextInterval = 600 - numberOfSecondsIntoTheCurrentInterval;
101
+ return numberOfSecondsToTheNextInterval;
102
+ };
103
+
104
+ class TimerService {
105
+ constructor() {
106
+ /**
107
+ * @description
108
+ * Source for fifteen minute interval
109
+ */
110
+ this._fifteenMinutesInterval = new BehaviorSubject(undefined);
111
+ /**
112
+ * @description
113
+ * Source for five minute interval
114
+ */
115
+ this._fiveMinutesInterval = new BehaviorSubject(undefined);
116
+ /**
117
+ * @description
118
+ * Source for half hour interval
119
+ */
120
+ this._fullHourInterval = new BehaviorSubject(undefined);
121
+ /**
122
+ * @description
123
+ * Source for half hour interval
124
+ */
125
+ this._halfHourInterval = new BehaviorSubject(undefined);
126
+ /**
127
+ * @description
128
+ * Source for minute interval
129
+ */
130
+ this._minuteInterval = new BehaviorSubject(undefined);
131
+ /**
132
+ * @description
133
+ * Source for secong interval
134
+ */
135
+ this._secondsInterval = new BehaviorSubject(undefined);
136
+ /**
137
+ * @description
138
+ * Source for ten minutes interval
139
+ */
140
+ this._tenMinutesInterval = new BehaviorSubject(undefined);
141
+ this._subscriptions = [];
142
+ this.fifteenMinutesInterval$ = this._fifteenMinutesInterval.asObservable().pipe(skip(1));
143
+ this.fiveMinutesInterval$ = this._fiveMinutesInterval.asObservable().pipe(skip(1));
144
+ this.fullHourInterval$ = this._fullHourInterval.asObservable().pipe(skip(1));
145
+ this.halfHourInterval$ = this._halfHourInterval.asObservable().pipe(skip(1));
146
+ this.minuteInterval$ = this._minuteInterval.asObservable().pipe().pipe(skip(1));
147
+ this.secondsInterval$ = this._secondsInterval.asObservable().pipe(skip(1));
148
+ this.tenMinutesInterval$ = this._tenMinutesInterval.asObservable().pipe(skip(1));
149
+ const timeOffsetToFullSecond = timeToNextSecondInterval(new Date().getTime());
150
+ // This observable will invoke each second while app is running
151
+ const ticksSubscription = interval(1000).pipe(debounceTime(timeOffsetToFullSecond)).subscribe(intervalTick => {
152
+ const now = new Date().getTime();
153
+ const timeRemainingToNextMinuteInterval = timeToNextMinuteInterval(now);
154
+ const timeRemaingingToNextFiveMinutesInterval = timeToNextFiveMinutesInterval(now);
155
+ const timeRemainingToNextTenMinutesInterval = timeToNextTenMinutesInterval(now);
156
+ const timeRemainingToNextFifteenMinutesInterval = timeToNextFifteenMinutesInterval(now);
157
+ const timeRemainingToNextFullHour = timeToNextHour(now);
158
+ const timeRemainingToNextHalfHour = timeToNextHalfHour(now);
159
+ this._secondsInterval.next();
160
+ // Check if its minute tick
161
+ if (timeRemainingToNextMinuteInterval > 59) {
162
+ this._minuteInterval.next();
163
+ }
164
+ // Check if its five minute interval tick
165
+ if (timeRemaingingToNextFiveMinutesInterval > 299) {
166
+ this._fiveMinutesInterval.next();
167
+ }
168
+ // Check if its ten minute interval
169
+ if (timeRemainingToNextTenMinutesInterval > 599) {
170
+ this._tenMinutesInterval.next();
171
+ }
172
+ // Check if its fifteen minute interval
173
+ if (timeRemainingToNextFifteenMinutesInterval > 899) {
174
+ this._fifteenMinutesInterval.next();
175
+ }
176
+ // Check if its half hour tick
177
+ if (timeRemainingToNextHalfHour > 1799) {
178
+ this._halfHourInterval.next();
179
+ }
180
+ // Check if its full hour tick
181
+ if (timeRemainingToNextFullHour > 3599) {
182
+ this._fullHourInterval.next();
183
+ }
184
+ // Define any additional intervals that might be needed
185
+ });
186
+ this._subscriptions.push(ticksSubscription);
187
+ }
188
+ }
189
+ TimerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: TimerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
190
+ TimerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: TimerService, providedIn: 'root' });
191
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: TimerService, decorators: [{
192
+ type: Injectable,
193
+ args: [{
194
+ providedIn: 'root'
195
+ }]
196
+ }], ctorParameters: function () { return []; } });
197
+
198
+ class SdsTimerModule {
199
+ constructor(parentModule) {
200
+ if (parentModule) {
201
+ throw new Error('TimerModule is already loaded. Import it in the AppModule only');
202
+ }
203
+ }
204
+ static forRoot() {
205
+ return {
206
+ ngModule: SdsTimerModule,
207
+ providers: [TimerService]
208
+ };
209
+ }
210
+ }
211
+ SdsTimerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsTimerModule, deps: [{ token: SdsTimerModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule });
212
+ SdsTimerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsTimerModule, imports: [CommonModule] });
213
+ SdsTimerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsTimerModule, imports: [[
214
+ CommonModule
215
+ ]] });
216
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsTimerModule, decorators: [{
217
+ type: NgModule,
218
+ args: [{
219
+ declarations: [],
220
+ imports: [
221
+ CommonModule
222
+ ]
223
+ }]
224
+ }], ctorParameters: function () {
225
+ return [{ type: SdsTimerModule, decorators: [{
226
+ type: Optional
227
+ }, {
228
+ type: SkipSelf
229
+ }] }];
230
+ } });
231
+
232
+ /**
233
+ * Generated bundle index. Do not edit.
234
+ */
235
+
236
+ export { SdsTimerModule, TimerService, timeToNextFifteenMinutesInterval, timeToNextFiveMinutesInterval, timeToNextHalfHour, timeToNextHour, timeToNextMinuteInterval, timeToNextSecondInterval, timeToNextTenMinutesInterval };
237
+ //# sourceMappingURL=spicainternational-ngx-sds-components-src-lib-timer.mjs.map