@sixbell-telco/sdk 0.11.0 → 0.12.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/CHANGELOG.md +23 -0
- package/components/accordion/accordion-item/accordion-item.component.d.ts +1 -1
- package/components/card/card-actions/card-actions.component.d.ts +1 -1
- package/components/forms/input/src/input.component.d.ts +3 -1
- package/components/forms/toggle/src/toggle.component.d.ts +1 -1
- package/components/icon/src/icon.component.d.ts +1 -1
- package/components/link/src/link.component.d.ts +1 -1
- package/components/modal/modal-actions/modal-actions.component.d.ts +1 -1
- package/components/modal/src/modal.component.d.ts +2 -2
- package/components/notification/src/notification.component.d.ts +2 -3
- package/components/product-card/src/product-card.component.d.ts +4 -4
- package/components/tab/directives/tab-content/tab-content.directive.d.ts +1 -1
- package/components/tab/directives/tab-header/tab-header.directive.d.ts +1 -1
- package/components/tab/src/tab.component.d.ts +1 -1
- package/components/toast/toast-message/toast-message.component.d.ts +1 -1
- package/components/wizard/wizard-actions/wizard-actions.component.d.ts +1 -1
- package/directives/auto-focus/index.d.ts +5 -0
- package/directives/auto-focus/public-api.d.ts +1 -0
- package/directives/auto-focus/src/autofocus.directive.d.ts +93 -0
- package/directives/click-outside/src/click-outside.directive.d.ts +48 -3
- package/directives/only-numbers/index.d.ts +5 -0
- package/directives/only-numbers/public-api.d.ts +1 -0
- package/directives/only-numbers/src/only-numbers.directive.d.ts +9 -0
- package/fesm2022/sixbell-telco-sdk-components-accordion.mjs +9 -11
- package/fesm2022/sixbell-telco-sdk-components-accordion.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-audio-player.mjs +18 -18
- package/fesm2022/sixbell-telco-sdk-components-avatar.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-components-badge.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-components-button.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-components-card.mjs +16 -16
- package/fesm2022/sixbell-telco-sdk-components-card.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-countdown.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-components-dropdown.mjs +8 -8
- package/fesm2022/sixbell-telco-sdk-components-dropdown.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-dual-list.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-components-dual-list.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-file-upload.mjs +6 -6
- package/fesm2022/sixbell-telco-sdk-components-file-upload.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-checkbox.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs +4 -4
- package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-datepicker.mjs +7 -7
- package/fesm2022/sixbell-telco-sdk-components-forms-datepicker.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-form-error.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-components-forms-input.mjs +13 -9
- package/fesm2022/sixbell-telco-sdk-components-forms-input.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-radio.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-components-forms-range.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-components-forms-select.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-components-forms-switch.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-components-forms-textarea.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-components-forms-toggle.mjs +17 -209
- package/fesm2022/sixbell-telco-sdk-components-forms-toggle.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-icon.mjs +6 -8
- package/fesm2022/sixbell-telco-sdk-components-icon.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-link.mjs +7 -7
- package/fesm2022/sixbell-telco-sdk-components-link.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-modal.mjs +27 -26
- package/fesm2022/sixbell-telco-sdk-components-modal.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-notification.mjs +12 -9
- package/fesm2022/sixbell-telco-sdk-components-notification.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-paginator.mjs +6 -6
- package/fesm2022/sixbell-telco-sdk-components-product-card.mjs +29 -37
- package/fesm2022/sixbell-telco-sdk-components-product-card.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-progress.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-components-tab.mjs +21 -23
- package/fesm2022/sixbell-telco-sdk-components-tab.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-table.mjs +9 -9
- package/fesm2022/sixbell-telco-sdk-components-toast.mjs +25 -41
- package/fesm2022/sixbell-telco-sdk-components-toast.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-tooltip.mjs +6 -6
- package/fesm2022/sixbell-telco-sdk-components-wizard.mjs +23 -23
- package/fesm2022/sixbell-telco-sdk-components-wizard.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-directives-auto-focus.mjs +206 -0
- package/fesm2022/sixbell-telco-sdk-directives-auto-focus.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-directives-click-outside.mjs +53 -10
- package/fesm2022/sixbell-telco-sdk-directives-click-outside.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-directives-only-numbers.mjs +52 -0
- package/fesm2022/sixbell-telco-sdk-directives-only-numbers.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-directives-typography.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-utils-pipes-extract-extension.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-utils-pipes-time.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-utils-pipes-to-bytes-extesion.mjs +3 -3
- package/package.json +59 -51
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, signal, effect, Directive } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Directive that automatically focuses an element when it becomes visible.
|
|
6
|
+
*
|
|
7
|
+
* This directive uses multiple strategies to detect when an element becomes visible:
|
|
8
|
+
* - IntersectionObserver to detect when the element enters the viewport
|
|
9
|
+
* - MutationObserver to detect DOM changes that might affect visibility
|
|
10
|
+
* - Polling at regular intervals as a fallback mechanism
|
|
11
|
+
*
|
|
12
|
+
* The directive works reliably with modals, dialogs, accordions, and other UI components
|
|
13
|
+
* that dynamically show and hide content.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```html
|
|
17
|
+
* <!-- Basic usage -->
|
|
18
|
+
* <input [stAutofocus]="true" />
|
|
19
|
+
*
|
|
20
|
+
* <!-- Conditional autofocus -->
|
|
21
|
+
* <input [stAutofocus]="shouldFocus" />
|
|
22
|
+
*
|
|
23
|
+
* <!-- In a form inside a modal -->
|
|
24
|
+
* <st-modal>
|
|
25
|
+
* <input [stAutofocus]="true" />
|
|
26
|
+
* </st-modal>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @usageNotes
|
|
30
|
+
* The directive takes a boolean input that determines whether autofocus should be applied.
|
|
31
|
+
* When this value is true, the directive will attempt to focus the element once it becomes visible,
|
|
32
|
+
* and will continue to monitor the element's visibility state in case it changes.
|
|
33
|
+
*
|
|
34
|
+
* This is particularly useful for:
|
|
35
|
+
* - Elements in modals that need focus when opened
|
|
36
|
+
* - Elements in accordions/collapsible sections that should receive focus when expanded
|
|
37
|
+
* - Elements that are conditionally rendered and need focus when they appear
|
|
38
|
+
*
|
|
39
|
+
* @publicApi
|
|
40
|
+
*/
|
|
41
|
+
class AutofocusDirective {
|
|
42
|
+
elementRef;
|
|
43
|
+
/**
|
|
44
|
+
* Controls whether autofocus should be applied to the element.
|
|
45
|
+
* Set to true to enable autofocus.
|
|
46
|
+
*/
|
|
47
|
+
focus = input(false);
|
|
48
|
+
/** Tracks the current visibility state of the element */
|
|
49
|
+
isVisible = signal(false);
|
|
50
|
+
/** Forces effect to run when visibility changes, even to the same value */
|
|
51
|
+
changeTimestamp = signal(0);
|
|
52
|
+
/** Collection of observers for cleanup */
|
|
53
|
+
observers = [];
|
|
54
|
+
/** Interval used for polling visibility */
|
|
55
|
+
pollingInterval = null;
|
|
56
|
+
/** Flag to prevent concurrent visibility checks */
|
|
57
|
+
checkingVisibility = false;
|
|
58
|
+
/** Timeout reference for focus operation */
|
|
59
|
+
focusTimeout = null;
|
|
60
|
+
constructor(elementRef) {
|
|
61
|
+
this.elementRef = elementRef;
|
|
62
|
+
// Effect that triggers focus when element becomes visible
|
|
63
|
+
effect(() => {
|
|
64
|
+
const visible = this.isVisible();
|
|
65
|
+
const timestamp = this.changeTimestamp();
|
|
66
|
+
if (this.focus() && visible) {
|
|
67
|
+
// Clear any existing timeout first
|
|
68
|
+
if (this.focusTimeout !== null) {
|
|
69
|
+
clearTimeout(this.focusTimeout);
|
|
70
|
+
}
|
|
71
|
+
// Store the timeout reference
|
|
72
|
+
this.focusTimeout = window.setTimeout(() => {
|
|
73
|
+
this.elementRef.nativeElement.focus();
|
|
74
|
+
}, 50);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Sets up visibility observers after the view is initialized
|
|
80
|
+
*/
|
|
81
|
+
ngAfterViewInit() {
|
|
82
|
+
if (this.focus()) {
|
|
83
|
+
// Set up both observer types
|
|
84
|
+
this.setupIntersectionObserver();
|
|
85
|
+
this.setupMutationObserver();
|
|
86
|
+
// Lightweight polling (every 500ms) as fallback for edge cases
|
|
87
|
+
this.pollingInterval = window.setInterval(() => {
|
|
88
|
+
this.checkVisibility(true);
|
|
89
|
+
}, 500);
|
|
90
|
+
// Initial visibility check
|
|
91
|
+
this.checkVisibility(true);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Cleans up all observers and timers to prevent memory leaks
|
|
96
|
+
*/
|
|
97
|
+
ngOnDestroy() {
|
|
98
|
+
// Cleanup all observers
|
|
99
|
+
this.observers.forEach((observer) => {
|
|
100
|
+
if (observer) {
|
|
101
|
+
observer.disconnect();
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
this.observers = [];
|
|
105
|
+
// Clear polling interval
|
|
106
|
+
if (this.pollingInterval !== null) {
|
|
107
|
+
clearInterval(this.pollingInterval);
|
|
108
|
+
}
|
|
109
|
+
// Clear focus timeout
|
|
110
|
+
if (this.focusTimeout !== null) {
|
|
111
|
+
clearTimeout(this.focusTimeout);
|
|
112
|
+
this.focusTimeout = null;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Sets up the IntersectionObserver to detect when the element enters or leaves the viewport
|
|
117
|
+
* @private
|
|
118
|
+
*/
|
|
119
|
+
setupIntersectionObserver() {
|
|
120
|
+
if ('IntersectionObserver' in window) {
|
|
121
|
+
const intersectionObserver = new IntersectionObserver((entries) => {
|
|
122
|
+
if (entries[0].isIntersecting) {
|
|
123
|
+
this.checkVisibility(true);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
this.updateVisibility(false);
|
|
127
|
+
}
|
|
128
|
+
}, { threshold: 0.1 });
|
|
129
|
+
intersectionObserver.observe(this.elementRef.nativeElement);
|
|
130
|
+
this.observers.push(intersectionObserver);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Sets up MutationObserver to detect style/class changes that might affect visibility
|
|
135
|
+
* Also monitors parent elements to detect when containers like modals appear/disappear
|
|
136
|
+
* @private
|
|
137
|
+
*/
|
|
138
|
+
setupMutationObserver() {
|
|
139
|
+
const mutationObserver = new MutationObserver(() => {
|
|
140
|
+
this.checkVisibility(true);
|
|
141
|
+
});
|
|
142
|
+
// Watch this element
|
|
143
|
+
mutationObserver.observe(this.elementRef.nativeElement, {
|
|
144
|
+
attributes: true,
|
|
145
|
+
attributeFilter: ['style', 'class'],
|
|
146
|
+
});
|
|
147
|
+
// Watch parent elements - important for modals, accordions, etc.
|
|
148
|
+
let parent = this.elementRef.nativeElement.parentElement;
|
|
149
|
+
let level = 0;
|
|
150
|
+
// Watch up to 3 parent levels
|
|
151
|
+
while (parent && level < 3) {
|
|
152
|
+
mutationObserver.observe(parent, {
|
|
153
|
+
attributes: true,
|
|
154
|
+
attributeFilter: ['style', 'class'],
|
|
155
|
+
childList: true,
|
|
156
|
+
});
|
|
157
|
+
parent = parent.parentElement;
|
|
158
|
+
level++;
|
|
159
|
+
}
|
|
160
|
+
this.observers.push(mutationObserver);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Checks if the element is truly visible by examining computed style and dimensions
|
|
164
|
+
* @param force Whether to force a check even if one is already in progress
|
|
165
|
+
* @private
|
|
166
|
+
*/
|
|
167
|
+
checkVisibility(force = false) {
|
|
168
|
+
if (this.checkingVisibility && !force)
|
|
169
|
+
return;
|
|
170
|
+
this.checkingVisibility = true;
|
|
171
|
+
const el = this.elementRef.nativeElement;
|
|
172
|
+
requestAnimationFrame(() => {
|
|
173
|
+
const style = window.getComputedStyle(el);
|
|
174
|
+
const isNowVisible = el.offsetWidth > 0 && el.offsetHeight > 0 && style.visibility !== 'hidden' && style.display !== 'none';
|
|
175
|
+
this.updateVisibility(isNowVisible);
|
|
176
|
+
this.checkingVisibility = false;
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Updates the visibility signal and triggers the effect by updating the timestamp
|
|
181
|
+
* @param visible The new visibility state
|
|
182
|
+
* @private
|
|
183
|
+
*/
|
|
184
|
+
updateVisibility(visible) {
|
|
185
|
+
if (this.isVisible() !== visible) {
|
|
186
|
+
this.isVisible.set(visible);
|
|
187
|
+
// Always update timestamp to force the effect to run
|
|
188
|
+
this.changeTimestamp.set(Date.now());
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: AutofocusDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
192
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.0", type: AutofocusDirective, isStandalone: true, selector: "[stAutofocus]", inputs: { focus: { classPropertyName: "focus", publicName: "focus", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
193
|
+
}
|
|
194
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: AutofocusDirective, decorators: [{
|
|
195
|
+
type: Directive,
|
|
196
|
+
args: [{
|
|
197
|
+
selector: '[stAutofocus]',
|
|
198
|
+
}]
|
|
199
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }] });
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Generated bundle index. Do not edit.
|
|
203
|
+
*/
|
|
204
|
+
|
|
205
|
+
export { AutofocusDirective };
|
|
206
|
+
//# sourceMappingURL=sixbell-telco-sdk-directives-auto-focus.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sixbell-telco-sdk-directives-auto-focus.mjs","sources":["../../../projects/sdk/directives/auto-focus/src/autofocus.directive.ts","../../../projects/sdk/directives/auto-focus/sixbell-telco-sdk-directives-auto-focus.ts"],"sourcesContent":["import { AfterViewInit, Directive, ElementRef, OnDestroy, effect, input, signal } from '@angular/core';\n\n/**\n * Directive that automatically focuses an element when it becomes visible.\n *\n * This directive uses multiple strategies to detect when an element becomes visible:\n * - IntersectionObserver to detect when the element enters the viewport\n * - MutationObserver to detect DOM changes that might affect visibility\n * - Polling at regular intervals as a fallback mechanism\n *\n * The directive works reliably with modals, dialogs, accordions, and other UI components\n * that dynamically show and hide content.\n *\n * @example\n * ```html\n * <!-- Basic usage -->\n * <input [stAutofocus]=\"true\" />\n *\n * <!-- Conditional autofocus -->\n * <input [stAutofocus]=\"shouldFocus\" />\n *\n * <!-- In a form inside a modal -->\n * <st-modal>\n * <input [stAutofocus]=\"true\" />\n * </st-modal>\n * ```\n *\n * @usageNotes\n * The directive takes a boolean input that determines whether autofocus should be applied.\n * When this value is true, the directive will attempt to focus the element once it becomes visible,\n * and will continue to monitor the element's visibility state in case it changes.\n *\n * This is particularly useful for:\n * - Elements in modals that need focus when opened\n * - Elements in accordions/collapsible sections that should receive focus when expanded\n * - Elements that are conditionally rendered and need focus when they appear\n *\n * @publicApi\n */\n@Directive({\n\tselector: '[stAutofocus]',\n})\nexport class AutofocusDirective implements AfterViewInit, OnDestroy {\n\t/**\n\t * Controls whether autofocus should be applied to the element.\n\t * Set to true to enable autofocus.\n\t */\n\tfocus = input<boolean>(false);\n\n\t/** Tracks the current visibility state of the element */\n\tprivate isVisible = signal(false);\n\n\t/** Forces effect to run when visibility changes, even to the same value */\n\tprivate changeTimestamp = signal(0);\n\n\t/** Collection of observers for cleanup */\n\tprivate observers: (IntersectionObserver | MutationObserver)[] = [];\n\n\t/** Interval used for polling visibility */\n\tprivate pollingInterval: number | null = null;\n\n\t/** Flag to prevent concurrent visibility checks */\n\tprivate checkingVisibility = false;\n\n\t/** Timeout reference for focus operation */\n\tprivate focusTimeout: number | null = null;\n\n\tconstructor(private elementRef: ElementRef) {\n\t\t// Effect that triggers focus when element becomes visible\n\t\teffect(() => {\n\t\t\tconst visible = this.isVisible();\n\t\t\tconst timestamp = this.changeTimestamp();\n\n\t\t\tif (this.focus() && visible) {\n\t\t\t\t// Clear any existing timeout first\n\t\t\t\tif (this.focusTimeout !== null) {\n\t\t\t\t\tclearTimeout(this.focusTimeout);\n\t\t\t\t}\n\n\t\t\t\t// Store the timeout reference\n\t\t\t\tthis.focusTimeout = window.setTimeout(() => {\n\t\t\t\t\tthis.elementRef.nativeElement.focus();\n\t\t\t\t}, 50);\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Sets up visibility observers after the view is initialized\n\t */\n\tngAfterViewInit() {\n\t\tif (this.focus()) {\n\t\t\t// Set up both observer types\n\t\t\tthis.setupIntersectionObserver();\n\t\t\tthis.setupMutationObserver();\n\n\t\t\t// Lightweight polling (every 500ms) as fallback for edge cases\n\t\t\tthis.pollingInterval = window.setInterval(() => {\n\t\t\t\tthis.checkVisibility(true);\n\t\t\t}, 500);\n\n\t\t\t// Initial visibility check\n\t\t\tthis.checkVisibility(true);\n\t\t}\n\t}\n\n\t/**\n\t * Cleans up all observers and timers to prevent memory leaks\n\t */\n\tngOnDestroy() {\n\t\t// Cleanup all observers\n\t\tthis.observers.forEach((observer) => {\n\t\t\tif (observer) {\n\t\t\t\tobserver.disconnect();\n\t\t\t}\n\t\t});\n\t\tthis.observers = [];\n\n\t\t// Clear polling interval\n\t\tif (this.pollingInterval !== null) {\n\t\t\tclearInterval(this.pollingInterval);\n\t\t}\n\n\t\t// Clear focus timeout\n\t\tif (this.focusTimeout !== null) {\n\t\t\tclearTimeout(this.focusTimeout);\n\t\t\tthis.focusTimeout = null;\n\t\t}\n\t}\n\n\t/**\n\t * Sets up the IntersectionObserver to detect when the element enters or leaves the viewport\n\t * @private\n\t */\n\tprivate setupIntersectionObserver(): void {\n\t\tif ('IntersectionObserver' in window) {\n\t\t\tconst intersectionObserver = new IntersectionObserver(\n\t\t\t\t(entries) => {\n\t\t\t\t\tif (entries[0].isIntersecting) {\n\t\t\t\t\t\tthis.checkVisibility(true);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.updateVisibility(false);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{ threshold: 0.1 },\n\t\t\t);\n\n\t\t\tintersectionObserver.observe(this.elementRef.nativeElement);\n\t\t\tthis.observers.push(intersectionObserver);\n\t\t}\n\t}\n\n\t/**\n\t * Sets up MutationObserver to detect style/class changes that might affect visibility\n\t * Also monitors parent elements to detect when containers like modals appear/disappear\n\t * @private\n\t */\n\tprivate setupMutationObserver(): void {\n\t\tconst mutationObserver = new MutationObserver(() => {\n\t\t\tthis.checkVisibility(true);\n\t\t});\n\n\t\t// Watch this element\n\t\tmutationObserver.observe(this.elementRef.nativeElement, {\n\t\t\tattributes: true,\n\t\t\tattributeFilter: ['style', 'class'],\n\t\t});\n\n\t\t// Watch parent elements - important for modals, accordions, etc.\n\t\tlet parent = this.elementRef.nativeElement.parentElement;\n\t\tlet level = 0;\n\n\t\t// Watch up to 3 parent levels\n\t\twhile (parent && level < 3) {\n\t\t\tmutationObserver.observe(parent, {\n\t\t\t\tattributes: true,\n\t\t\t\tattributeFilter: ['style', 'class'],\n\t\t\t\tchildList: true,\n\t\t\t});\n\t\t\tparent = parent.parentElement;\n\t\t\tlevel++;\n\t\t}\n\n\t\tthis.observers.push(mutationObserver);\n\t}\n\n\t/**\n\t * Checks if the element is truly visible by examining computed style and dimensions\n\t * @param force Whether to force a check even if one is already in progress\n\t * @private\n\t */\n\tprivate checkVisibility(force = false): void {\n\t\tif (this.checkingVisibility && !force) return;\n\n\t\tthis.checkingVisibility = true;\n\t\tconst el = this.elementRef.nativeElement;\n\n\t\trequestAnimationFrame(() => {\n\t\t\tconst style = window.getComputedStyle(el);\n\t\t\tconst isNowVisible = el.offsetWidth > 0 && el.offsetHeight > 0 && style.visibility !== 'hidden' && style.display !== 'none';\n\n\t\t\tthis.updateVisibility(isNowVisible);\n\t\t\tthis.checkingVisibility = false;\n\t\t});\n\t}\n\n\t/**\n\t * Updates the visibility signal and triggers the effect by updating the timestamp\n\t * @param visible The new visibility state\n\t * @private\n\t */\n\tprivate updateVisibility(visible: boolean): void {\n\t\tif (this.isVisible() !== visible) {\n\t\t\tthis.isVisible.set(visible);\n\t\t\t// Always update timestamp to force the effect to run\n\t\t\tthis.changeTimestamp.set(Date.now());\n\t\t}\n\t}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCG;MAIU,kBAAkB,CAAA;AAyBV,IAAA,UAAA;A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C,OAAO,CAAC;;YAE3B,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;;;uGA7K1B,kBAAkB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,UAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAlB,kBAAkB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,eAAA,EAAA,MAAA,EAAA,EAAA,KAAA,EAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,UAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAH9B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,eAAe;AACzB,iBAAA;;;ACzCD;;AAEG;;;;"}
|
|
@@ -1,30 +1,73 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { output, HostListener, Directive } from '@angular/core';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Directive that detects clicks outside of an element and emits an event when they occur.
|
|
6
|
+
*
|
|
7
|
+
* This directive is useful for implementing dismissible UI components like dropdowns,
|
|
8
|
+
* modals, and popups that should close when a user clicks outside of them.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```html
|
|
12
|
+
* <!-- Basic usage -->
|
|
13
|
+
* <div stClickOutside (outsideClick)="closeDropdown()">
|
|
14
|
+
* Dropdown content
|
|
15
|
+
* </div>
|
|
16
|
+
*
|
|
17
|
+
* <!-- With conditional behavior -->
|
|
18
|
+
* <div stClickOutside (outsideClick)="isOpen ? closeDropdown() : null">
|
|
19
|
+
* Dropdown content that only closes when open
|
|
20
|
+
* </div>
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @usageNotes
|
|
24
|
+
* The directive emits the `outsideClick` event when a click occurs outside
|
|
25
|
+
* the element it's attached to. It does not automatically hide or modify
|
|
26
|
+
* the element - you need to handle that in your component logic.
|
|
27
|
+
*
|
|
28
|
+
* Common use cases include:
|
|
29
|
+
* - Closing dropdowns when clicking elsewhere on the page
|
|
30
|
+
* - Dismissing modals when clicking outside the modal content
|
|
31
|
+
* - Hiding tooltips or popovers when clicking outside
|
|
32
|
+
*
|
|
33
|
+
* @publicApi
|
|
34
|
+
*/
|
|
5
35
|
class ClickOutsideDirective {
|
|
6
36
|
elementRef;
|
|
7
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Event emitted when a click occurs outside the element.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```html
|
|
42
|
+
* <div stClickOutside (outsideClick)="handleOutsideClick()">...</div>
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
outsideClick = output();
|
|
8
46
|
constructor(elementRef) {
|
|
9
47
|
this.elementRef = elementRef;
|
|
10
48
|
}
|
|
11
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Listens for clicks on the document and determines if they occurred
|
|
51
|
+
* outside the element this directive is attached to.
|
|
52
|
+
*
|
|
53
|
+
* @param event The mouse event from the document click
|
|
54
|
+
*/
|
|
55
|
+
clickedOutside(event) {
|
|
12
56
|
const clickedInside = this.elementRef.nativeElement.contains(event.target);
|
|
13
57
|
if (!clickedInside) {
|
|
14
|
-
this.
|
|
58
|
+
this.outsideClick.emit();
|
|
15
59
|
}
|
|
16
60
|
}
|
|
17
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
18
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.
|
|
61
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: ClickOutsideDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
62
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.0", type: ClickOutsideDirective, isStandalone: true, selector: "[stClickOutside]", outputs: { outsideClick: "outsideClick" }, host: { listeners: { "document:click": "clickedOutside($event)" } }, ngImport: i0 });
|
|
19
63
|
}
|
|
20
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
64
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: ClickOutsideDirective, decorators: [{
|
|
21
65
|
type: Directive,
|
|
22
66
|
args: [{
|
|
23
|
-
|
|
24
|
-
selector: '[clickOutside]',
|
|
67
|
+
selector: '[stClickOutside]',
|
|
25
68
|
standalone: true,
|
|
26
69
|
}]
|
|
27
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: {
|
|
70
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { clickedOutside: [{
|
|
28
71
|
type: HostListener,
|
|
29
72
|
args: ['document:click', ['$event']]
|
|
30
73
|
}] } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sixbell-telco-sdk-directives-click-outside.mjs","sources":["../../../projects/sdk/directives/click-outside/src/click-outside.directive.ts","../../../projects/sdk/directives/click-outside/sixbell-telco-sdk-directives-click-outside.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"sixbell-telco-sdk-directives-click-outside.mjs","sources":["../../../projects/sdk/directives/click-outside/src/click-outside.directive.ts","../../../projects/sdk/directives/click-outside/sixbell-telco-sdk-directives-click-outside.ts"],"sourcesContent":["import { Directive, ElementRef, HostListener, output } from '@angular/core';\n\n/**\n * Directive that detects clicks outside of an element and emits an event when they occur.\n *\n * This directive is useful for implementing dismissible UI components like dropdowns,\n * modals, and popups that should close when a user clicks outside of them.\n *\n * @example\n * ```html\n * <!-- Basic usage -->\n * <div stClickOutside (outsideClick)=\"closeDropdown()\">\n * Dropdown content\n * </div>\n *\n * <!-- With conditional behavior -->\n * <div stClickOutside (outsideClick)=\"isOpen ? closeDropdown() : null\">\n * Dropdown content that only closes when open\n * </div>\n * ```\n *\n * @usageNotes\n * The directive emits the `outsideClick` event when a click occurs outside\n * the element it's attached to. It does not automatically hide or modify\n * the element - you need to handle that in your component logic.\n *\n * Common use cases include:\n * - Closing dropdowns when clicking elsewhere on the page\n * - Dismissing modals when clicking outside the modal content\n * - Hiding tooltips or popovers when clicking outside\n *\n * @publicApi\n */\n@Directive({\n\tselector: '[stClickOutside]',\n\tstandalone: true,\n})\nexport class ClickOutsideDirective {\n\t/**\n\t * Event emitted when a click occurs outside the element.\n\t *\n\t * @example\n\t * ```html\n\t * <div stClickOutside (outsideClick)=\"handleOutsideClick()\">...</div>\n\t * ```\n\t */\n\toutsideClick = output<void>();\n\n\tconstructor(private elementRef: ElementRef) {}\n\n\t/**\n\t * Listens for clicks on the document and determines if they occurred\n\t * outside the element this directive is attached to.\n\t *\n\t * @param event The mouse event from the document click\n\t */\n\t@HostListener('document:click', ['$event'])\n\tclickedOutside(event: MouseEvent) {\n\t\tconst clickedInside = this.elementRef.nativeElement.contains(event.target);\n\t\tif (!clickedInside) {\n\t\t\tthis.outsideClick.emit();\n\t\t}\n\t}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BG;MAKU,qBAAqB,CAAA;AAWb,IAAA,UAAA;AAVpB;;;;;;;AAOG;IACH,YAAY,GAAG,MAAM,EAAQ;AAE7B,IAAA,WAAA,CAAoB,UAAsB,EAAA;QAAtB,IAAU,CAAA,UAAA,GAAV,UAAU;;AAE9B;;;;;AAKG;AAEH,IAAA,cAAc,CAAC,KAAiB,EAAA;AAC/B,QAAA,MAAM,aAAa,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;QAC1E,IAAI,CAAC,aAAa,EAAE;AACnB,YAAA,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE;;;uGAvBd,qBAAqB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,UAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAArB,qBAAqB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,kBAAA,EAAA,OAAA,EAAA,EAAA,YAAA,EAAA,cAAA,EAAA,EAAA,IAAA,EAAA,EAAA,SAAA,EAAA,EAAA,gBAAA,EAAA,wBAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAArB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAJjC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,kBAAkB;AAC5B,oBAAA,UAAU,EAAE,IAAI;AAChB,iBAAA;+EAqBA,cAAc,EAAA,CAAA;sBADb,YAAY;uBAAC,gBAAgB,EAAE,CAAC,QAAQ,CAAC;;;ACxD3C;;AAEG;;;;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, HostListener, Directive } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
class OnlyNumbersDirective {
|
|
5
|
+
onlyNumbers = input(false);
|
|
6
|
+
constructor() { }
|
|
7
|
+
blockPaste(event) {
|
|
8
|
+
if (!this.onlyNumbers())
|
|
9
|
+
return true;
|
|
10
|
+
const onlyNumbersReg = new RegExp('^[0-9]+$');
|
|
11
|
+
const clipboardData = event.clipboardData;
|
|
12
|
+
if (!clipboardData)
|
|
13
|
+
return true;
|
|
14
|
+
const pastedValue = clipboardData.getData('Text');
|
|
15
|
+
if (!onlyNumbersReg.test(pastedValue)) {
|
|
16
|
+
event.preventDefault();
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
onKeyPress(event) {
|
|
22
|
+
if (!this.onlyNumbers())
|
|
23
|
+
return true;
|
|
24
|
+
const key = event.key;
|
|
25
|
+
if (!/^[0-9]$/.test(key)) {
|
|
26
|
+
event.preventDefault();
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: OnlyNumbersDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
32
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.0", type: OnlyNumbersDirective, isStandalone: true, selector: "[stOnlynumbers]", inputs: { onlyNumbers: { classPropertyName: "onlyNumbers", publicName: "onlyNumbers", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "paste": "blockPaste($event)", "keypress": "onKeyPress($event)" } }, ngImport: i0 });
|
|
33
|
+
}
|
|
34
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: OnlyNumbersDirective, decorators: [{
|
|
35
|
+
type: Directive,
|
|
36
|
+
args: [{
|
|
37
|
+
selector: '[stOnlynumbers]',
|
|
38
|
+
}]
|
|
39
|
+
}], ctorParameters: () => [], propDecorators: { blockPaste: [{
|
|
40
|
+
type: HostListener,
|
|
41
|
+
args: ['paste', ['$event']]
|
|
42
|
+
}], onKeyPress: [{
|
|
43
|
+
type: HostListener,
|
|
44
|
+
args: ['keypress', ['$event']]
|
|
45
|
+
}] } });
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Generated bundle index. Do not edit.
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
export { OnlyNumbersDirective };
|
|
52
|
+
//# sourceMappingURL=sixbell-telco-sdk-directives-only-numbers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sixbell-telco-sdk-directives-only-numbers.mjs","sources":["../../../projects/sdk/directives/only-numbers/src/only-numbers.directive.ts","../../../projects/sdk/directives/only-numbers/sixbell-telco-sdk-directives-only-numbers.ts"],"sourcesContent":["import { Directive, HostListener, input } from '@angular/core';\n\n@Directive({\n\tselector: '[stOnlynumbers]',\n})\nexport class OnlyNumbersDirective {\n\tonlyNumbers = input<boolean>(false);\n\n\tconstructor() {}\n\n\t@HostListener('paste', ['$event'])\n\tblockPaste(event: ClipboardEvent) {\n\t\tif (!this.onlyNumbers()) return true;\n\n\t\tconst onlyNumbersReg = new RegExp('^[0-9]+$');\n\t\tconst clipboardData = event.clipboardData;\n\t\tif (!clipboardData) return true;\n\n\t\tconst pastedValue = clipboardData.getData('Text');\n\t\tif (!onlyNumbersReg.test(pastedValue)) {\n\t\t\tevent.preventDefault();\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t@HostListener('keypress', ['$event'])\n\tonKeyPress(event: KeyboardEvent) {\n\t\tif (!this.onlyNumbers()) return true;\n\n\t\tconst key = event.key;\n\t\tif (!/^[0-9]$/.test(key)) {\n\t\t\tevent.preventDefault();\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MAKa,oBAAoB,CAAA;AAChC,IAAA,WAAW,GAAG,KAAK,CAAU,KAAK,CAAC;AAEnC,IAAA,WAAA,GAAA;AAGA,IAAA,UAAU,CAAC,KAAqB,EAAA;AAC/B,QAAA,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;AAAE,YAAA,OAAO,IAAI;AAEpC,QAAA,MAAM,cAAc,GAAG,IAAI,MAAM,CAAC,UAAU,CAAC;AAC7C,QAAA,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa;AACzC,QAAA,IAAI,CAAC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EAAA,CAAA;sBADT,YAAY;uBAAC,UAAU,EAAE,CAAC,QAAQ,CAAC;;;AC3BrC;;AAEG;;;;"}
|
|
@@ -106,10 +106,10 @@ class TypographyDirective {
|
|
|
106
106
|
}));
|
|
107
107
|
this.renderer.setAttribute(this.element.nativeElement, 'class', classList);
|
|
108
108
|
});
|
|
109
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
110
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.
|
|
109
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: TypographyDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
110
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.0", type: TypographyDirective, isStandalone: true, selector: "[typography]", inputs: { variant: { classPropertyName: "variant", publicName: "tyVariant", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "tyColor", isSignal: true, isRequired: false, transformFunction: null }, fontWeight: { classPropertyName: "fontWeight", publicName: "tyFontWeight", isSignal: true, isRequired: false, transformFunction: null }, textOverflow: { classPropertyName: "textOverflow", publicName: "tyTextOverflow", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
111
111
|
}
|
|
112
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
112
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: TypographyDirective, decorators: [{
|
|
113
113
|
type: Directive,
|
|
114
114
|
args: [{
|
|
115
115
|
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
@@ -18,10 +18,10 @@ class ExtractExtensionPipe {
|
|
|
18
18
|
// Return the substring after the last dot
|
|
19
19
|
return filename.substring(lastDotIndex + 1);
|
|
20
20
|
}
|
|
21
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
22
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.
|
|
21
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: ExtractExtensionPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
22
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.0", ngImport: i0, type: ExtractExtensionPipe, isStandalone: true, name: "extractExtension" });
|
|
23
23
|
}
|
|
24
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
24
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: ExtractExtensionPipe, decorators: [{
|
|
25
25
|
type: Pipe,
|
|
26
26
|
args: [{
|
|
27
27
|
name: 'extractExtension',
|
|
@@ -7,10 +7,10 @@ class TimePipe {
|
|
|
7
7
|
const seconds = Math.floor(value % 60);
|
|
8
8
|
return `${minutes}:${seconds.toString().padStart(2, '0')}`;
|
|
9
9
|
}
|
|
10
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
11
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.
|
|
10
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: TimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
11
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.0", ngImport: i0, type: TimePipe, isStandalone: true, name: "time" });
|
|
12
12
|
}
|
|
13
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
13
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: TimePipe, decorators: [{
|
|
14
14
|
type: Pipe,
|
|
15
15
|
args: [{
|
|
16
16
|
name: 'time',
|
|
@@ -17,10 +17,10 @@ class ToBytesPipe {
|
|
|
17
17
|
// Remove space between the number and the unit
|
|
18
18
|
return formattedNumber + sizes[i];
|
|
19
19
|
}
|
|
20
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
21
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.
|
|
20
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: ToBytesPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
21
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.0", ngImport: i0, type: ToBytesPipe, isStandalone: true, name: "toBytes" });
|
|
22
22
|
}
|
|
23
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
23
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: ToBytesPipe, decorators: [{
|
|
24
24
|
type: Pipe,
|
|
25
25
|
args: [{
|
|
26
26
|
name: 'toBytes',
|