@fundamental-ngx/cdk 0.52.2-rc.8 → 0.53.0-rc.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/esm2022/forms/cva/cva.directive.mjs +2 -2
- package/esm2022/utils/directives/auto-complete/auto-complete.directive.mjs +14 -4
- package/esm2022/utils/functions/key-util.mjs +4 -3
- package/fesm2022/fundamental-ngx-cdk-forms.mjs +1 -1
- package/fesm2022/fundamental-ngx-cdk-forms.mjs.map +1 -1
- package/fesm2022/fundamental-ngx-cdk-utils.mjs +249 -238
- package/fesm2022/fundamental-ngx-cdk-utils.mjs.map +1 -1
- package/package.json +3 -3
- package/utils/directives/auto-complete/auto-complete.directive.d.ts +2 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { DOCUMENT, CommonModule, AsyncPipe } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { isDevMode, EventEmitter, inject,
|
|
4
|
-
import { RIGHT_ARROW, DOWN_ARROW, LEFT_ARROW, UP_ARROW, SPACE, ESCAPE, DELETE, ENTER, MAC_ENTER, TAB, HOME, END, ALT, CONTROL, META, SHIFT, BACKSPACE, A, C, V, X, PAGE_UP, PAGE_DOWN, DASH, NUMPAD_MINUS, NUMPAD_ZERO, NUMPAD_ONE, NUMPAD_TWO, NUMPAD_THREE, NUMPAD_FOUR, NUMPAD_FIVE, NUMPAD_SIX, NUMPAD_SEVEN, NUMPAD_EIGHT, NUMPAD_NINE, F2, hasModifierKey } from '@angular/cdk/keycodes';
|
|
3
|
+
import { INJECTOR, ElementRef, isDevMode, InjectionToken, EventEmitter, inject, NgZone, Directive, Input, Output, NgModule, DestroyRef, Injectable, Optional, Inject, booleanAttribute, Renderer2, PLATFORM_ID, Self, SkipSelf, ContentChildren, forwardRef, HostBinding, HostListener, Injector, computed, ContentChild, QueryList, ViewContainerRef, TemplateRef, Component, ViewChild, NgModuleFactory, Pipe, signal } from '@angular/core';
|
|
4
|
+
import { RIGHT_ARROW, DOWN_ARROW, LEFT_ARROW, UP_ARROW, SPACE, ESCAPE, DELETE, ENTER, MAC_ENTER, TAB, HOME, END, ALT, CONTROL, META, SHIFT, BACKSPACE, A, C, V, X, PAGE_UP, PAGE_DOWN, DASH, NUMPAD_MINUS, NUMPAD_ZERO, NUMPAD_ONE, NUMPAD_TWO, NUMPAD_THREE, NUMPAD_FOUR, NUMPAD_FIVE, NUMPAD_SIX, NUMPAD_SEVEN, NUMPAD_EIGHT, NUMPAD_NINE, F2, F7, hasModifierKey } from '@angular/cdk/keycodes';
|
|
5
5
|
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
|
6
|
-
import { fromEvent, switchMap, map, Subject, BehaviorSubject, ReplaySubject,
|
|
7
|
-
import { first, distinctUntilChanged, startWith,
|
|
6
|
+
import { Observable, NEVER, fromEvent, switchMap, map as map$1, Subject, BehaviorSubject, ReplaySubject, merge, combineLatest, filter as filter$1, firstValueFrom, debounceTime, distinctUntilChanged as distinctUntilChanged$1, startWith as startWith$1, Subscription, isObservable, of, tap as tap$1, take as take$1 } from 'rxjs';
|
|
7
|
+
import { map, first, distinctUntilChanged, startWith, takeUntil, filter, tap, switchMap as switchMap$1, finalize, take, debounceTime as debounceTime$1, pairwise, shareReplay, delay } from 'rxjs/operators';
|
|
8
8
|
import { coerceElement, coerceBooleanProperty, coerceNumberProperty, coerceArray, coerceCssPixelValue } from '@angular/cdk/coercion';
|
|
9
9
|
import { get, findLastIndex, escape } from 'lodash-es';
|
|
10
10
|
import { createFocusTrap } from 'focus-trap';
|
|
@@ -23,6 +23,93 @@ import { DomPortal, TemplatePortal, ComponentPortal, CdkPortalOutlet, PortalModu
|
|
|
23
23
|
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
24
24
|
import { __decorate, __metadata } from 'tslib';
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Creates provider for ConsumerClass
|
|
28
|
+
*/
|
|
29
|
+
function consumerProviderFactory(ConsumerClass, providedConfiguration) {
|
|
30
|
+
return {
|
|
31
|
+
provide: ConsumerClass,
|
|
32
|
+
useFactory: (injector) => new ConsumerClass(injector, providedConfiguration),
|
|
33
|
+
deps: [INJECTOR]
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const pxToNum = (pixels) => Number(pixels.replace('px', '')) || 0;
|
|
38
|
+
const toNativeElement = (element) => element instanceof ElementRef ? element.nativeElement : element;
|
|
39
|
+
/** Return elements capacity (width subtract by element padding)
|
|
40
|
+
* @param element - HTMLelement or element reference
|
|
41
|
+
* */
|
|
42
|
+
function getElementCapacity(element) {
|
|
43
|
+
const _element = toNativeElement(element);
|
|
44
|
+
const computedStyle = window.getComputedStyle(_element);
|
|
45
|
+
return pxToNum(computedStyle.width) - pxToNum(computedStyle.paddingLeft) - pxToNum(computedStyle.paddingRight);
|
|
46
|
+
}
|
|
47
|
+
/** Return elements width
|
|
48
|
+
* @param element - HTMLelement or element reference
|
|
49
|
+
* @param withMargin - weather to add element margins to width
|
|
50
|
+
* */
|
|
51
|
+
function getElementWidth(element, withMargin) {
|
|
52
|
+
const _element = toNativeElement(element);
|
|
53
|
+
const computedStyle = getComputedStyle(_element);
|
|
54
|
+
return withMargin
|
|
55
|
+
? pxToNum(computedStyle.width) + pxToNum(computedStyle.marginLeft) + pxToNum(computedStyle.marginRight)
|
|
56
|
+
: pxToNum(computedStyle.width);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Get document font size in pixels. */
|
|
60
|
+
function getDocumentFontSize() {
|
|
61
|
+
const DEFAULT_SIZE = 16;
|
|
62
|
+
const clientFontSize = document?.documentElement
|
|
63
|
+
? parseFloat(getComputedStyle(document.documentElement).fontSize)
|
|
64
|
+
: DEFAULT_SIZE;
|
|
65
|
+
return isNaN(clientFontSize) ? DEFAULT_SIZE : clientFontSize;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* RxJS wrapper for IntersectionObserver class.
|
|
70
|
+
* @param target HTML element to spy on.
|
|
71
|
+
* @param options @see {IntersectionObserverInit}
|
|
72
|
+
* @returns {Observable} with observer entries.
|
|
73
|
+
*/
|
|
74
|
+
function intersectionObservable(target, options) {
|
|
75
|
+
if ('IntersectionObserver' in window) {
|
|
76
|
+
return new Observable((subscriber) => {
|
|
77
|
+
const io = new IntersectionObserver((entries) => {
|
|
78
|
+
subscriber.next(entries);
|
|
79
|
+
}, options);
|
|
80
|
+
io.observe(target);
|
|
81
|
+
return function unsubscribe() {
|
|
82
|
+
io.disconnect();
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
// If browser doesn't support IntersectionObserver API never emit a value
|
|
88
|
+
// since we're not supporting IE11 and any other browser should have it.
|
|
89
|
+
return NEVER;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Determines whether provided value is valid content density */
|
|
94
|
+
function isValidContentDensity(size) {
|
|
95
|
+
return size === 'cozy' || size === 'compact' || size === 'condensed';
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Determines if "compact" styles should be applied based on provided content density
|
|
99
|
+
*/
|
|
100
|
+
function isCompactDensity(size) {
|
|
101
|
+
return isValidContentDensity(size) && size !== 'cozy';
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Function checks whether the passed number is odd.
|
|
106
|
+
* @param number number to check.
|
|
107
|
+
* @returns Boolean whether the number is odd.
|
|
108
|
+
*/
|
|
109
|
+
function isOdd(number) {
|
|
110
|
+
return number % 2 === 1;
|
|
111
|
+
}
|
|
112
|
+
|
|
26
113
|
/** Map of keyCodes and their corresponding "key" values */
|
|
27
114
|
const keyMap = new Map([
|
|
28
115
|
[RIGHT_ARROW, ['ArrowRight', 'Right']],
|
|
@@ -60,7 +147,8 @@ const keyMap = new Map([
|
|
|
60
147
|
[NUMPAD_SEVEN, ['NumPad7']],
|
|
61
148
|
[NUMPAD_EIGHT, ['NumPad8']],
|
|
62
149
|
[NUMPAD_NINE, ['NumPad9']],
|
|
63
|
-
[F2, ['F2']]
|
|
150
|
+
[F2, ['F2']],
|
|
151
|
+
[F7, ['F7']]
|
|
64
152
|
]);
|
|
65
153
|
class KeyUtil {
|
|
66
154
|
/**
|
|
@@ -110,6 +198,129 @@ class KeyUtil {
|
|
|
110
198
|
}
|
|
111
199
|
}
|
|
112
200
|
|
|
201
|
+
const ModuleDeprecations = new InjectionToken('ModuleDeprecations');
|
|
202
|
+
|
|
203
|
+
/** Module deprecations provider */
|
|
204
|
+
function moduleDeprecationsProvider(classRef) {
|
|
205
|
+
return {
|
|
206
|
+
provide: ModuleDeprecations,
|
|
207
|
+
useClass: classRef,
|
|
208
|
+
multi: true
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
/** Module deprecations provider factory */
|
|
212
|
+
function moduleDeprecationsFactory(factory) {
|
|
213
|
+
return {
|
|
214
|
+
provide: ModuleDeprecations,
|
|
215
|
+
...factory,
|
|
216
|
+
multi: true
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const fileSizeMap = new Map([
|
|
221
|
+
['KB', 1024],
|
|
222
|
+
['MB', 1048576],
|
|
223
|
+
['GB', 1073741824],
|
|
224
|
+
['TB', 1099511627776]
|
|
225
|
+
]);
|
|
226
|
+
/** Parse file size to bytes */
|
|
227
|
+
function parserFileSize(fileSize) {
|
|
228
|
+
if (fileSize === '') {
|
|
229
|
+
return 0;
|
|
230
|
+
}
|
|
231
|
+
const sizes = fileSize.match(/[\d.]+|\D+/g);
|
|
232
|
+
if (sizes && sizes.length > 1) {
|
|
233
|
+
const size = Number(sizes[0].replace(/ +/g, ''));
|
|
234
|
+
const unit = sizes[1].replace(/ +/g, '').toUpperCase();
|
|
235
|
+
const unitSize = fileSizeMap.get(unit);
|
|
236
|
+
if (isNaN(size)) {
|
|
237
|
+
throw new Error('FileSizeError - Invalid File size please check.');
|
|
238
|
+
}
|
|
239
|
+
if (unit === 'B' || unit === 'BYTE' || unit === 'BYTES') {
|
|
240
|
+
return size;
|
|
241
|
+
}
|
|
242
|
+
if (!unitSize) {
|
|
243
|
+
throw new Error('FileSizeError - Invalid File size please check.');
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
return unitSize * size;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
if (isNaN(Number(sizes))) {
|
|
251
|
+
throw new Error('FileSizeError - Invalid File size please check.');
|
|
252
|
+
}
|
|
253
|
+
return Number(sizes);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/** Get random number from 1 to 10. */
|
|
258
|
+
function getRandomColorAccent() {
|
|
259
|
+
return (Math.floor(Math.random() * 10) + 1);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* RxJS wrapper for ResizeObserver class.
|
|
264
|
+
* @param target HTML element to spy on.
|
|
265
|
+
* @param options @see {ResizeObserverOptions}
|
|
266
|
+
* @returns {Observable} with observer entries.
|
|
267
|
+
*/
|
|
268
|
+
function resizeObservable(target, options) {
|
|
269
|
+
if ('ResizeObserver' in window) {
|
|
270
|
+
return new Observable((subscriber) => {
|
|
271
|
+
let animationFrame;
|
|
272
|
+
const ro = new ResizeObserver((entries) => {
|
|
273
|
+
animationFrame = window.requestAnimationFrame(() => {
|
|
274
|
+
subscriber.next(entries);
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
ro.observe(target, options);
|
|
278
|
+
return function unsubscribe() {
|
|
279
|
+
if (animationFrame) {
|
|
280
|
+
window.cancelAnimationFrame(animationFrame);
|
|
281
|
+
}
|
|
282
|
+
ro.unobserve(target);
|
|
283
|
+
ro.disconnect();
|
|
284
|
+
};
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
// If current browser does not support resizeObserver, rely on window resize and return empty array of items.
|
|
289
|
+
return fromEvent(window, 'resize').pipe(map(() => []));
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Function used to scroll specified element by some distance
|
|
295
|
+
*
|
|
296
|
+
* @param containerElement - Container element scrolled
|
|
297
|
+
* @param distanceToScroll - Distance of scroll in px
|
|
298
|
+
* */
|
|
299
|
+
function scrollTop(containerElement, distanceToScroll) {
|
|
300
|
+
// Check if scrollTo method is supported by current browser
|
|
301
|
+
if (containerElement.scrollTo && containerElement.scrollTo instanceof Function) {
|
|
302
|
+
containerElement.scrollTo({
|
|
303
|
+
top: distanceToScroll,
|
|
304
|
+
behavior: 'smooth'
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
containerElement.scrollTop = distanceToScroll;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/** Generate a UUID v4 */
|
|
313
|
+
function uuidv4() {
|
|
314
|
+
const modifier = 16;
|
|
315
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
316
|
+
// eslint-disable-next-line no-bitwise
|
|
317
|
+
const r = (Math.random() * modifier) | 0,
|
|
318
|
+
// eslint-disable-next-line no-bitwise
|
|
319
|
+
v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
320
|
+
return v.toString(modifier);
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
|
|
113
324
|
class AutoCompleteDirective {
|
|
114
325
|
/** @hidden */
|
|
115
326
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
@@ -130,6 +341,8 @@ class AutoCompleteDirective {
|
|
|
130
341
|
/** @hidden */
|
|
131
342
|
this._stopKeys = [BACKSPACE, DELETE, ESCAPE];
|
|
132
343
|
/** @hidden */
|
|
344
|
+
this._isComposing = false;
|
|
345
|
+
/** @hidden */
|
|
133
346
|
this._elementRef = inject(ElementRef);
|
|
134
347
|
this._zone = inject(NgZone);
|
|
135
348
|
/** Matcher function for testing the str for a search term */
|
|
@@ -141,14 +354,23 @@ class AutoCompleteDirective {
|
|
|
141
354
|
*/
|
|
142
355
|
this._zone.runOutsideAngular(() => {
|
|
143
356
|
const keyupEvent = fromEvent(this._elementRef.nativeElement, 'keyup');
|
|
357
|
+
const compositionStartEvent = fromEvent(this._elementRef.nativeElement, 'compositionstart');
|
|
358
|
+
const compositionEndEvent = fromEvent(this._elementRef.nativeElement, 'compositionend');
|
|
144
359
|
keyupEvent
|
|
145
|
-
.pipe(switchMap((evt) => this._zone.onStable.pipe(first(), map(() => evt))), takeUntilDestroyed())
|
|
360
|
+
.pipe(switchMap((evt) => this._zone.onStable.pipe(first(), map$1(() => evt))), takeUntilDestroyed())
|
|
146
361
|
.subscribe((evt) => this._handleKeyboardEvent(evt));
|
|
362
|
+
compositionStartEvent.pipe(takeUntilDestroyed()).subscribe(() => {
|
|
363
|
+
this._isComposing = true;
|
|
364
|
+
});
|
|
365
|
+
compositionEndEvent.pipe(takeUntilDestroyed()).subscribe(() => {
|
|
366
|
+
this._isComposing = false;
|
|
367
|
+
this.inputText = this._elementRef.nativeElement.value;
|
|
368
|
+
});
|
|
147
369
|
});
|
|
148
370
|
}
|
|
149
371
|
/** @hidden */
|
|
150
372
|
_handleKeyboardEvent(event) {
|
|
151
|
-
if (this.enable) {
|
|
373
|
+
if (this.enable && !this._isComposing) {
|
|
152
374
|
if (KeyUtil.isKeyCode(event, this._stopKeys)) {
|
|
153
375
|
this._elementRef.nativeElement.value = this.inputText;
|
|
154
376
|
}
|
|
@@ -160,7 +382,6 @@ class AutoCompleteDirective {
|
|
|
160
382
|
this._sendCompleteEvent(false);
|
|
161
383
|
}
|
|
162
384
|
else if (!this._isControlKey(event) && this.inputText) {
|
|
163
|
-
/** Prevention from triggering typeahead, when having crtl/cmd + keys */
|
|
164
385
|
if (!this._triggerTypeAhead()) {
|
|
165
386
|
return;
|
|
166
387
|
}
|
|
@@ -242,17 +463,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImpor
|
|
|
242
463
|
}]
|
|
243
464
|
}] });
|
|
244
465
|
|
|
245
|
-
/** Determines whether provided value is valid content density */
|
|
246
|
-
function isValidContentDensity(size) {
|
|
247
|
-
return size === 'cozy' || size === 'compact' || size === 'condensed';
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Determines if "compact" styles should be applied based on provided content density
|
|
251
|
-
*/
|
|
252
|
-
function isCompactDensity(size) {
|
|
253
|
-
return isValidContentDensity(size) && size !== 'cozy';
|
|
254
|
-
}
|
|
255
|
-
|
|
256
466
|
/**
|
|
257
467
|
* Creates an observable that emits when the component is destroyed.
|
|
258
468
|
* @param destroyRef
|
|
@@ -546,7 +756,7 @@ class ContentDensityService {
|
|
|
546
756
|
}
|
|
547
757
|
/** @hidden */
|
|
548
758
|
get _isCompactDensity() {
|
|
549
|
-
return this._contentDensityListener.pipe(map
|
|
759
|
+
return this._contentDensityListener.pipe(map((density) => isCompactDensity(density)));
|
|
550
760
|
}
|
|
551
761
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: ContentDensityService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
552
762
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: ContentDensityService }); }
|
|
@@ -577,18 +787,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImpor
|
|
|
577
787
|
type: Injectable
|
|
578
788
|
}], ctorParameters: () => [] });
|
|
579
789
|
|
|
580
|
-
/** Generate a UUID v4 */
|
|
581
|
-
function uuidv4() {
|
|
582
|
-
const modifier = 16;
|
|
583
|
-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
584
|
-
// eslint-disable-next-line no-bitwise
|
|
585
|
-
const r = (Math.random() * modifier) | 0,
|
|
586
|
-
// eslint-disable-next-line no-bitwise
|
|
587
|
-
v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
588
|
-
return v.toString(modifier);
|
|
589
|
-
});
|
|
590
|
-
}
|
|
591
|
-
|
|
592
790
|
class FocusTrapService {
|
|
593
791
|
constructor() {
|
|
594
792
|
/** @hidden */
|
|
@@ -677,193 +875,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImpor
|
|
|
677
875
|
}]
|
|
678
876
|
}] });
|
|
679
877
|
|
|
680
|
-
/**
|
|
681
|
-
* Creates provider for ConsumerClass
|
|
682
|
-
*/
|
|
683
|
-
function consumerProviderFactory(ConsumerClass, providedConfiguration) {
|
|
684
|
-
return {
|
|
685
|
-
provide: ConsumerClass,
|
|
686
|
-
useFactory: (injector) => new ConsumerClass(injector, providedConfiguration),
|
|
687
|
-
deps: [INJECTOR]
|
|
688
|
-
};
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
const pxToNum = (pixels) => Number(pixels.replace('px', '')) || 0;
|
|
692
|
-
const toNativeElement = (element) => element instanceof ElementRef ? element.nativeElement : element;
|
|
693
|
-
/** Return elements capacity (width subtract by element padding)
|
|
694
|
-
* @param element - HTMLelement or element reference
|
|
695
|
-
* */
|
|
696
|
-
function getElementCapacity(element) {
|
|
697
|
-
const _element = toNativeElement(element);
|
|
698
|
-
const computedStyle = window.getComputedStyle(_element);
|
|
699
|
-
return pxToNum(computedStyle.width) - pxToNum(computedStyle.paddingLeft) - pxToNum(computedStyle.paddingRight);
|
|
700
|
-
}
|
|
701
|
-
/** Return elements width
|
|
702
|
-
* @param element - HTMLelement or element reference
|
|
703
|
-
* @param withMargin - weather to add element margins to width
|
|
704
|
-
* */
|
|
705
|
-
function getElementWidth(element, withMargin) {
|
|
706
|
-
const _element = toNativeElement(element);
|
|
707
|
-
const computedStyle = getComputedStyle(_element);
|
|
708
|
-
return withMargin
|
|
709
|
-
? pxToNum(computedStyle.width) + pxToNum(computedStyle.marginLeft) + pxToNum(computedStyle.marginRight)
|
|
710
|
-
: pxToNum(computedStyle.width);
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
/** Get document font size in pixels. */
|
|
714
|
-
function getDocumentFontSize() {
|
|
715
|
-
const DEFAULT_SIZE = 16;
|
|
716
|
-
const clientFontSize = document?.documentElement
|
|
717
|
-
? parseFloat(getComputedStyle(document.documentElement).fontSize)
|
|
718
|
-
: DEFAULT_SIZE;
|
|
719
|
-
return isNaN(clientFontSize) ? DEFAULT_SIZE : clientFontSize;
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
/**
|
|
723
|
-
* RxJS wrapper for IntersectionObserver class.
|
|
724
|
-
* @param target HTML element to spy on.
|
|
725
|
-
* @param options @see {IntersectionObserverInit}
|
|
726
|
-
* @returns {Observable} with observer entries.
|
|
727
|
-
*/
|
|
728
|
-
function intersectionObservable(target, options) {
|
|
729
|
-
if ('IntersectionObserver' in window) {
|
|
730
|
-
return new Observable((subscriber) => {
|
|
731
|
-
const io = new IntersectionObserver((entries) => {
|
|
732
|
-
subscriber.next(entries);
|
|
733
|
-
}, options);
|
|
734
|
-
io.observe(target);
|
|
735
|
-
return function unsubscribe() {
|
|
736
|
-
io.disconnect();
|
|
737
|
-
};
|
|
738
|
-
});
|
|
739
|
-
}
|
|
740
|
-
else {
|
|
741
|
-
// If browser doesn't support IntersectionObserver API never emit a value
|
|
742
|
-
// since we're not supporting IE11 and any other browser should have it.
|
|
743
|
-
return NEVER;
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
/**
|
|
748
|
-
* Function checks whether the passed number is odd.
|
|
749
|
-
* @param number number to check.
|
|
750
|
-
* @returns Boolean whether the number is odd.
|
|
751
|
-
*/
|
|
752
|
-
function isOdd(number) {
|
|
753
|
-
return number % 2 === 1;
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
const ModuleDeprecations = new InjectionToken('ModuleDeprecations');
|
|
757
|
-
|
|
758
|
-
/** Module deprecations provider */
|
|
759
|
-
function moduleDeprecationsProvider(classRef) {
|
|
760
|
-
return {
|
|
761
|
-
provide: ModuleDeprecations,
|
|
762
|
-
useClass: classRef,
|
|
763
|
-
multi: true
|
|
764
|
-
};
|
|
765
|
-
}
|
|
766
|
-
/** Module deprecations provider factory */
|
|
767
|
-
function moduleDeprecationsFactory(factory) {
|
|
768
|
-
return {
|
|
769
|
-
provide: ModuleDeprecations,
|
|
770
|
-
...factory,
|
|
771
|
-
multi: true
|
|
772
|
-
};
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
const fileSizeMap = new Map([
|
|
776
|
-
['KB', 1024],
|
|
777
|
-
['MB', 1048576],
|
|
778
|
-
['GB', 1073741824],
|
|
779
|
-
['TB', 1099511627776]
|
|
780
|
-
]);
|
|
781
|
-
/** Parse file size to bytes */
|
|
782
|
-
function parserFileSize(fileSize) {
|
|
783
|
-
if (fileSize === '') {
|
|
784
|
-
return 0;
|
|
785
|
-
}
|
|
786
|
-
const sizes = fileSize.match(/[\d.]+|\D+/g);
|
|
787
|
-
if (sizes && sizes.length > 1) {
|
|
788
|
-
const size = Number(sizes[0].replace(/ +/g, ''));
|
|
789
|
-
const unit = sizes[1].replace(/ +/g, '').toUpperCase();
|
|
790
|
-
const unitSize = fileSizeMap.get(unit);
|
|
791
|
-
if (isNaN(size)) {
|
|
792
|
-
throw new Error('FileSizeError - Invalid File size please check.');
|
|
793
|
-
}
|
|
794
|
-
if (unit === 'B' || unit === 'BYTE' || unit === 'BYTES') {
|
|
795
|
-
return size;
|
|
796
|
-
}
|
|
797
|
-
if (!unitSize) {
|
|
798
|
-
throw new Error('FileSizeError - Invalid File size please check.');
|
|
799
|
-
}
|
|
800
|
-
else {
|
|
801
|
-
return unitSize * size;
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
else {
|
|
805
|
-
if (isNaN(Number(sizes))) {
|
|
806
|
-
throw new Error('FileSizeError - Invalid File size please check.');
|
|
807
|
-
}
|
|
808
|
-
return Number(sizes);
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
/** Get random number from 1 to 10. */
|
|
813
|
-
function getRandomColorAccent() {
|
|
814
|
-
return (Math.floor(Math.random() * 10) + 1);
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
/**
|
|
818
|
-
* RxJS wrapper for ResizeObserver class.
|
|
819
|
-
* @param target HTML element to spy on.
|
|
820
|
-
* @param options @see {ResizeObserverOptions}
|
|
821
|
-
* @returns {Observable} with observer entries.
|
|
822
|
-
*/
|
|
823
|
-
function resizeObservable(target, options) {
|
|
824
|
-
if ('ResizeObserver' in window) {
|
|
825
|
-
return new Observable((subscriber) => {
|
|
826
|
-
let animationFrame;
|
|
827
|
-
const ro = new ResizeObserver((entries) => {
|
|
828
|
-
animationFrame = window.requestAnimationFrame(() => {
|
|
829
|
-
subscriber.next(entries);
|
|
830
|
-
});
|
|
831
|
-
});
|
|
832
|
-
ro.observe(target, options);
|
|
833
|
-
return function unsubscribe() {
|
|
834
|
-
if (animationFrame) {
|
|
835
|
-
window.cancelAnimationFrame(animationFrame);
|
|
836
|
-
}
|
|
837
|
-
ro.unobserve(target);
|
|
838
|
-
ro.disconnect();
|
|
839
|
-
};
|
|
840
|
-
});
|
|
841
|
-
}
|
|
842
|
-
else {
|
|
843
|
-
// If current browser does not support resizeObserver, rely on window resize and return empty array of items.
|
|
844
|
-
return fromEvent(window, 'resize').pipe(map$1(() => []));
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
/**
|
|
849
|
-
* Function used to scroll specified element by some distance
|
|
850
|
-
*
|
|
851
|
-
* @param containerElement - Container element scrolled
|
|
852
|
-
* @param distanceToScroll - Distance of scroll in px
|
|
853
|
-
* */
|
|
854
|
-
function scrollTop(containerElement, distanceToScroll) {
|
|
855
|
-
// Check if scrollTo method is supported by current browser
|
|
856
|
-
if (containerElement.scrollTo && containerElement.scrollTo instanceof Function) {
|
|
857
|
-
containerElement.scrollTo({
|
|
858
|
-
top: distanceToScroll,
|
|
859
|
-
behavior: 'smooth'
|
|
860
|
-
});
|
|
861
|
-
}
|
|
862
|
-
else {
|
|
863
|
-
containerElement.scrollTop = distanceToScroll;
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
|
|
867
878
|
class KeyboardSupportService {
|
|
868
879
|
constructor() {
|
|
869
880
|
/** Subject that is thrown, when focus escapes the list */
|
|
@@ -1204,7 +1215,7 @@ const ViewportSizeObservable = new InjectionToken('ViewportSizeObservable', {
|
|
|
1204
1215
|
const viewportRuler = inject(ViewportRuler);
|
|
1205
1216
|
return viewportRuler
|
|
1206
1217
|
.change(50)
|
|
1207
|
-
.pipe(map((e) => e.target.innerWidth))
|
|
1218
|
+
.pipe(map$1((e) => e.target.innerWidth))
|
|
1208
1219
|
.pipe(startWith(window.innerWidth));
|
|
1209
1220
|
}
|
|
1210
1221
|
});
|
|
@@ -1253,7 +1264,7 @@ class BreakpointDirective {
|
|
|
1253
1264
|
return;
|
|
1254
1265
|
}
|
|
1255
1266
|
const element = coerceElement(value);
|
|
1256
|
-
this._sizeObservable$.next(this._resizeObserverService.observe(value).pipe(map
|
|
1267
|
+
this._sizeObservable$.next(this._resizeObserverService.observe(value).pipe(map(() => element.offsetWidth), startWith(element.offsetWidth)));
|
|
1257
1268
|
}
|
|
1258
1269
|
/** @hidden */
|
|
1259
1270
|
constructor(templateRef, viewContainer) {
|
|
@@ -1292,7 +1303,7 @@ class BreakpointDirective {
|
|
|
1292
1303
|
/** @hidden */
|
|
1293
1304
|
ngAfterViewInit() {
|
|
1294
1305
|
combineLatest([this._sizeObservable$.pipe(switchMap$1((obs$) => obs$)), this.onChanges$.pipe(startWith(void 0))])
|
|
1295
|
-
.pipe(map
|
|
1306
|
+
.pipe(map(([w]) => [w, getBreakpointName(w)]), map(([width, breakpointName]) => this._shouldShow(width, breakpointName)), tap((shouldShow) => {
|
|
1296
1307
|
if (shouldShow) {
|
|
1297
1308
|
if (!this.templateViewRef) {
|
|
1298
1309
|
this.viewContainer.clear();
|
|
@@ -1719,7 +1730,7 @@ class DisabledObserver {
|
|
|
1719
1730
|
}
|
|
1720
1731
|
/** @hidden */
|
|
1721
1732
|
observe(element) {
|
|
1722
|
-
return this._attributeObserver.observe(element).pipe(map
|
|
1733
|
+
return this._attributeObserver.observe(element).pipe(map(() => DisabledObserver.isDisabled(getNativeElement(element))), distinctUntilChanged());
|
|
1723
1734
|
}
|
|
1724
1735
|
/** @hidden */
|
|
1725
1736
|
unobserve(element) {
|
|
@@ -2049,7 +2060,7 @@ class FocusableObserver {
|
|
|
2049
2060
|
/** @hidden */
|
|
2050
2061
|
observe(element, respectTabIndex = true) {
|
|
2051
2062
|
const nativeElement = getNativeElement(element);
|
|
2052
|
-
return this._attributeObserver.observe(nativeElement).pipe(map
|
|
2063
|
+
return this._attributeObserver.observe(nativeElement).pipe(map(() => FocusableObserver.isFocusable(nativeElement, respectTabIndex)), distinctUntilChanged());
|
|
2053
2064
|
}
|
|
2054
2065
|
/** @hidden */
|
|
2055
2066
|
unobserve(element) {
|
|
@@ -2285,7 +2296,7 @@ class IndirectFocusableListDirective {
|
|
|
2285
2296
|
[Symbol.iterator]: () => this._indirectChildren.value[Symbol.iterator](),
|
|
2286
2297
|
forEach: (callback, thisArg) => this._indirectChildren.value.forEach(callback, thisArg)
|
|
2287
2298
|
};
|
|
2288
|
-
queryList['changes'] = this._indirectChildren.pipe(debounceTime(100), distinctUntilChanged$1(deepEqual), map(() => queryList));
|
|
2299
|
+
queryList['changes'] = this._indirectChildren.pipe(debounceTime(100), distinctUntilChanged$1(deepEqual), map$1(() => queryList));
|
|
2289
2300
|
this._focusableList.setItems(queryList);
|
|
2290
2301
|
}
|
|
2291
2302
|
}
|
|
@@ -2653,7 +2664,7 @@ class FocusableListDirective {
|
|
|
2653
2664
|
const refresh$ = merge(this._refresh$, destroyObservable(this._destroyRef));
|
|
2654
2665
|
this._refresh$.next();
|
|
2655
2666
|
this._focusableItems.changes
|
|
2656
|
-
.pipe(startWith(null), map
|
|
2667
|
+
.pipe(startWith(null), map(() => this._focusableItems.toArray()), tap((items) => {
|
|
2657
2668
|
const direction = this.navigationDirection === 'grid' ? 'horizontal' : this.navigationDirection;
|
|
2658
2669
|
this._initializeFocusManager(items, {
|
|
2659
2670
|
direction,
|
|
@@ -3080,7 +3091,7 @@ class IntersectionSpyDirective {
|
|
|
3080
3091
|
/** @hidden */
|
|
3081
3092
|
ngOnInit() {
|
|
3082
3093
|
intersectionObservable(this._elementRef.nativeElement, this.viewportOptions)
|
|
3083
|
-
.pipe(map((entries) => entries[0]), takeUntilDestroyed(this._destroyRef))
|
|
3094
|
+
.pipe(map$1((entries) => entries[0]), takeUntilDestroyed(this._destroyRef))
|
|
3084
3095
|
.subscribe((entry) => {
|
|
3085
3096
|
this.intersected.emit(entry.isIntersecting);
|
|
3086
3097
|
});
|
|
@@ -3712,7 +3723,7 @@ class ReadonlyObserver {
|
|
|
3712
3723
|
}
|
|
3713
3724
|
/** @hidden */
|
|
3714
3725
|
observe(element) {
|
|
3715
|
-
return this._attributeObserver.observe(element).pipe(map
|
|
3726
|
+
return this._attributeObserver.observe(element).pipe(map(() => ReadonlyObserver.isReadonly(getNativeElement(element))), distinctUntilChanged());
|
|
3716
3727
|
}
|
|
3717
3728
|
/** @Hidden */
|
|
3718
3729
|
unobserve(element) {
|
|
@@ -4064,12 +4075,12 @@ class ResizeDirective {
|
|
|
4064
4075
|
const mouseUpEvent$ = fromEvent(window, 'mouseup');
|
|
4065
4076
|
const mouseMoveEvent$ = fromEvent(resizeContainer, 'mousemove');
|
|
4066
4077
|
const mouseDownEvent$ = fromEvent(this.resizeHandleReference.elementRef.nativeElement, 'mousedown');
|
|
4067
|
-
const resizeActive$ = merge(mouseDownEvent$.pipe(map
|
|
4078
|
+
const resizeActive$ = merge(mouseDownEvent$.pipe(map(() => true), tap(() => {
|
|
4068
4079
|
moveOffset = this._getMoveOffsetFunction();
|
|
4069
|
-
})), mouseUpEvent$.pipe(map
|
|
4080
|
+
})), mouseUpEvent$.pipe(map(() => false)));
|
|
4070
4081
|
const emitResizableEvents$ = this._getResizeEventsNotifiers(resizeActive$);
|
|
4071
4082
|
const preventOtherPointerEvents$ = this._blockOtherPointerEvents(resizeActive$);
|
|
4072
|
-
const resizingCursorMovement$ = mouseMoveEvent$.pipe(pairwise(), map
|
|
4083
|
+
const resizingCursorMovement$ = mouseMoveEvent$.pipe(pairwise(), map(([event1, event2]) => moveOffset(event1, event2)), filter((move) => isBoundaryOverflow(move)));
|
|
4073
4084
|
const setupResizer = () => {
|
|
4074
4085
|
resizingCursorMovement$.pipe(takeUntil(mouseUpEvent$)).subscribe((event) => resize(event));
|
|
4075
4086
|
};
|
|
@@ -4175,7 +4186,7 @@ class ResizeDirective {
|
|
|
4175
4186
|
else {
|
|
4176
4187
|
this._elementRef.nativeElement.classList.add(this.fdkResizeClass);
|
|
4177
4188
|
}
|
|
4178
|
-
}), map
|
|
4189
|
+
}), map((isActive) => (isActive ? 'none' : 'auto')), tap((value) => {
|
|
4179
4190
|
this._elementRef.nativeElement.style.pointerEvents = value;
|
|
4180
4191
|
}));
|
|
4181
4192
|
}
|
|
@@ -4246,9 +4257,9 @@ class SelectionService {
|
|
|
4246
4257
|
this._clear$ = new Subject();
|
|
4247
4258
|
/** @hidden */
|
|
4248
4259
|
this._value = [];
|
|
4249
|
-
this._normalizedValue$ = this._value$.pipe(distinctUntilChanged(deepEqual), map
|
|
4260
|
+
this._normalizedValue$ = this._value$.pipe(distinctUntilChanged(deepEqual), map((v) => coerceArray(v)), map((value) => (this._isMultipleMode ? value : [value[0]])), map((coerced) => coerced.filter(Boolean)));
|
|
4250
4261
|
this._normalizedValue$.pipe(takeUntilDestroyed(this._destroyRef)).subscribe((val) => (this._value = val));
|
|
4251
|
-
this.value$ = this._normalizedValue$.pipe(map
|
|
4262
|
+
this.value$ = this._normalizedValue$.pipe(map((v) => this._getProperValues(v)), shareReplay(1));
|
|
4252
4263
|
}
|
|
4253
4264
|
/**
|
|
4254
4265
|
* Register main select component, which holds config
|
|
@@ -4267,7 +4278,7 @@ class SelectionService {
|
|
|
4267
4278
|
* */
|
|
4268
4279
|
initialize(list) {
|
|
4269
4280
|
if (list instanceof QueryList) {
|
|
4270
|
-
this._items$ = list.changes.pipe(startWith(list), map
|
|
4281
|
+
this._items$ = list.changes.pipe(startWith(list), map((items) => items.toArray()), shareReplay(1));
|
|
4271
4282
|
}
|
|
4272
4283
|
else {
|
|
4273
4284
|
this._items$ = isObservable(list) ? list : of(list);
|
|
@@ -4293,8 +4304,8 @@ class SelectionService {
|
|
|
4293
4304
|
const unsubscribe$ = merge(destroyObservable(this._destroyRef), this._clear$);
|
|
4294
4305
|
if (this._items$) {
|
|
4295
4306
|
this._items$
|
|
4296
|
-
.pipe(map
|
|
4297
|
-
const clickedEvents$ = items.map((item) => item.clicked.pipe(map
|
|
4307
|
+
.pipe(map((items) => items.filter((itm) => itm.fdkSelectableItem !== false)), switchMap((items) => {
|
|
4308
|
+
const clickedEvents$ = items.map((item) => item.clicked.pipe(map(() => item)));
|
|
4298
4309
|
return merge(...clickedEvents$);
|
|
4299
4310
|
}), tap((clickedItem) => this._itemClicked(clickedItem)), takeUntil(unsubscribe$))
|
|
4300
4311
|
.subscribe();
|
|
@@ -5833,7 +5844,7 @@ class DynamicPortalComponent {
|
|
|
5833
5844
|
ngAfterViewInit() {
|
|
5834
5845
|
const portalOutlet = this.portalOutlet;
|
|
5835
5846
|
this.portalContent$
|
|
5836
|
-
.pipe(tap$1(() => portalOutlet.detach()), filter$1(Boolean), map((content) => {
|
|
5847
|
+
.pipe(tap$1(() => portalOutlet.detach()), filter$1(Boolean), map$1((content) => {
|
|
5837
5848
|
if (typeof content === 'string') {
|
|
5838
5849
|
const textElement = this.renderer.createText(content);
|
|
5839
5850
|
this.renderer.appendChild(this.elementRef.nativeElement, textElement);
|