@fundamental-ngx/cdk 0.52.2-rc.7 → 0.52.2-rc.9
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.
|
@@ -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,
|
|
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
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';
|
|
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']],
|
|
@@ -110,6 +197,129 @@ class KeyUtil {
|
|
|
110
197
|
}
|
|
111
198
|
}
|
|
112
199
|
|
|
200
|
+
const ModuleDeprecations = new InjectionToken('ModuleDeprecations');
|
|
201
|
+
|
|
202
|
+
/** Module deprecations provider */
|
|
203
|
+
function moduleDeprecationsProvider(classRef) {
|
|
204
|
+
return {
|
|
205
|
+
provide: ModuleDeprecations,
|
|
206
|
+
useClass: classRef,
|
|
207
|
+
multi: true
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
/** Module deprecations provider factory */
|
|
211
|
+
function moduleDeprecationsFactory(factory) {
|
|
212
|
+
return {
|
|
213
|
+
provide: ModuleDeprecations,
|
|
214
|
+
...factory,
|
|
215
|
+
multi: true
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const fileSizeMap = new Map([
|
|
220
|
+
['KB', 1024],
|
|
221
|
+
['MB', 1048576],
|
|
222
|
+
['GB', 1073741824],
|
|
223
|
+
['TB', 1099511627776]
|
|
224
|
+
]);
|
|
225
|
+
/** Parse file size to bytes */
|
|
226
|
+
function parserFileSize(fileSize) {
|
|
227
|
+
if (fileSize === '') {
|
|
228
|
+
return 0;
|
|
229
|
+
}
|
|
230
|
+
const sizes = fileSize.match(/[\d.]+|\D+/g);
|
|
231
|
+
if (sizes && sizes.length > 1) {
|
|
232
|
+
const size = Number(sizes[0].replace(/ +/g, ''));
|
|
233
|
+
const unit = sizes[1].replace(/ +/g, '').toUpperCase();
|
|
234
|
+
const unitSize = fileSizeMap.get(unit);
|
|
235
|
+
if (isNaN(size)) {
|
|
236
|
+
throw new Error('FileSizeError - Invalid File size please check.');
|
|
237
|
+
}
|
|
238
|
+
if (unit === 'B' || unit === 'BYTE' || unit === 'BYTES') {
|
|
239
|
+
return size;
|
|
240
|
+
}
|
|
241
|
+
if (!unitSize) {
|
|
242
|
+
throw new Error('FileSizeError - Invalid File size please check.');
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
return unitSize * size;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
if (isNaN(Number(sizes))) {
|
|
250
|
+
throw new Error('FileSizeError - Invalid File size please check.');
|
|
251
|
+
}
|
|
252
|
+
return Number(sizes);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/** Get random number from 1 to 10. */
|
|
257
|
+
function getRandomColorAccent() {
|
|
258
|
+
return (Math.floor(Math.random() * 10) + 1);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* RxJS wrapper for ResizeObserver class.
|
|
263
|
+
* @param target HTML element to spy on.
|
|
264
|
+
* @param options @see {ResizeObserverOptions}
|
|
265
|
+
* @returns {Observable} with observer entries.
|
|
266
|
+
*/
|
|
267
|
+
function resizeObservable(target, options) {
|
|
268
|
+
if ('ResizeObserver' in window) {
|
|
269
|
+
return new Observable((subscriber) => {
|
|
270
|
+
let animationFrame;
|
|
271
|
+
const ro = new ResizeObserver((entries) => {
|
|
272
|
+
animationFrame = window.requestAnimationFrame(() => {
|
|
273
|
+
subscriber.next(entries);
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
ro.observe(target, options);
|
|
277
|
+
return function unsubscribe() {
|
|
278
|
+
if (animationFrame) {
|
|
279
|
+
window.cancelAnimationFrame(animationFrame);
|
|
280
|
+
}
|
|
281
|
+
ro.unobserve(target);
|
|
282
|
+
ro.disconnect();
|
|
283
|
+
};
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
// If current browser does not support resizeObserver, rely on window resize and return empty array of items.
|
|
288
|
+
return fromEvent(window, 'resize').pipe(map(() => []));
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Function used to scroll specified element by some distance
|
|
294
|
+
*
|
|
295
|
+
* @param containerElement - Container element scrolled
|
|
296
|
+
* @param distanceToScroll - Distance of scroll in px
|
|
297
|
+
* */
|
|
298
|
+
function scrollTop(containerElement, distanceToScroll) {
|
|
299
|
+
// Check if scrollTo method is supported by current browser
|
|
300
|
+
if (containerElement.scrollTo && containerElement.scrollTo instanceof Function) {
|
|
301
|
+
containerElement.scrollTo({
|
|
302
|
+
top: distanceToScroll,
|
|
303
|
+
behavior: 'smooth'
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
containerElement.scrollTop = distanceToScroll;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/** Generate a UUID v4 */
|
|
312
|
+
function uuidv4() {
|
|
313
|
+
const modifier = 16;
|
|
314
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
315
|
+
// eslint-disable-next-line no-bitwise
|
|
316
|
+
const r = (Math.random() * modifier) | 0,
|
|
317
|
+
// eslint-disable-next-line no-bitwise
|
|
318
|
+
v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
319
|
+
return v.toString(modifier);
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
|
|
113
323
|
class AutoCompleteDirective {
|
|
114
324
|
/** @hidden */
|
|
115
325
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
@@ -130,6 +340,8 @@ class AutoCompleteDirective {
|
|
|
130
340
|
/** @hidden */
|
|
131
341
|
this._stopKeys = [BACKSPACE, DELETE, ESCAPE];
|
|
132
342
|
/** @hidden */
|
|
343
|
+
this._isComposing = false;
|
|
344
|
+
/** @hidden */
|
|
133
345
|
this._elementRef = inject(ElementRef);
|
|
134
346
|
this._zone = inject(NgZone);
|
|
135
347
|
/** Matcher function for testing the str for a search term */
|
|
@@ -141,14 +353,23 @@ class AutoCompleteDirective {
|
|
|
141
353
|
*/
|
|
142
354
|
this._zone.runOutsideAngular(() => {
|
|
143
355
|
const keyupEvent = fromEvent(this._elementRef.nativeElement, 'keyup');
|
|
356
|
+
const compositionStartEvent = fromEvent(this._elementRef.nativeElement, 'compositionstart');
|
|
357
|
+
const compositionEndEvent = fromEvent(this._elementRef.nativeElement, 'compositionend');
|
|
144
358
|
keyupEvent
|
|
145
|
-
.pipe(switchMap((evt) => this._zone.onStable.pipe(first(), map(() => evt))), takeUntilDestroyed())
|
|
359
|
+
.pipe(switchMap((evt) => this._zone.onStable.pipe(first(), map$1(() => evt))), takeUntilDestroyed())
|
|
146
360
|
.subscribe((evt) => this._handleKeyboardEvent(evt));
|
|
361
|
+
compositionStartEvent.pipe(takeUntilDestroyed()).subscribe(() => {
|
|
362
|
+
this._isComposing = true;
|
|
363
|
+
});
|
|
364
|
+
compositionEndEvent.pipe(takeUntilDestroyed()).subscribe(() => {
|
|
365
|
+
this._isComposing = false;
|
|
366
|
+
this.inputText = this._elementRef.nativeElement.value;
|
|
367
|
+
});
|
|
147
368
|
});
|
|
148
369
|
}
|
|
149
370
|
/** @hidden */
|
|
150
371
|
_handleKeyboardEvent(event) {
|
|
151
|
-
if (this.enable) {
|
|
372
|
+
if (this.enable && !this._isComposing) {
|
|
152
373
|
if (KeyUtil.isKeyCode(event, this._stopKeys)) {
|
|
153
374
|
this._elementRef.nativeElement.value = this.inputText;
|
|
154
375
|
}
|
|
@@ -160,7 +381,6 @@ class AutoCompleteDirective {
|
|
|
160
381
|
this._sendCompleteEvent(false);
|
|
161
382
|
}
|
|
162
383
|
else if (!this._isControlKey(event) && this.inputText) {
|
|
163
|
-
/** Prevention from triggering typeahead, when having crtl/cmd + keys */
|
|
164
384
|
if (!this._triggerTypeAhead()) {
|
|
165
385
|
return;
|
|
166
386
|
}
|
|
@@ -242,17 +462,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImpor
|
|
|
242
462
|
}]
|
|
243
463
|
}] });
|
|
244
464
|
|
|
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
465
|
/**
|
|
257
466
|
* Creates an observable that emits when the component is destroyed.
|
|
258
467
|
* @param destroyRef
|
|
@@ -546,7 +755,7 @@ class ContentDensityService {
|
|
|
546
755
|
}
|
|
547
756
|
/** @hidden */
|
|
548
757
|
get _isCompactDensity() {
|
|
549
|
-
return this._contentDensityListener.pipe(map
|
|
758
|
+
return this._contentDensityListener.pipe(map((density) => isCompactDensity(density)));
|
|
550
759
|
}
|
|
551
760
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: ContentDensityService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
552
761
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: ContentDensityService }); }
|
|
@@ -577,18 +786,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImpor
|
|
|
577
786
|
type: Injectable
|
|
578
787
|
}], ctorParameters: () => [] });
|
|
579
788
|
|
|
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
789
|
class FocusTrapService {
|
|
593
790
|
constructor() {
|
|
594
791
|
/** @hidden */
|
|
@@ -677,193 +874,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImpor
|
|
|
677
874
|
}]
|
|
678
875
|
}] });
|
|
679
876
|
|
|
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
877
|
class KeyboardSupportService {
|
|
868
878
|
constructor() {
|
|
869
879
|
/** Subject that is thrown, when focus escapes the list */
|
|
@@ -1204,7 +1214,7 @@ const ViewportSizeObservable = new InjectionToken('ViewportSizeObservable', {
|
|
|
1204
1214
|
const viewportRuler = inject(ViewportRuler);
|
|
1205
1215
|
return viewportRuler
|
|
1206
1216
|
.change(50)
|
|
1207
|
-
.pipe(map((e) => e.target.innerWidth))
|
|
1217
|
+
.pipe(map$1((e) => e.target.innerWidth))
|
|
1208
1218
|
.pipe(startWith(window.innerWidth));
|
|
1209
1219
|
}
|
|
1210
1220
|
});
|
|
@@ -1253,7 +1263,7 @@ class BreakpointDirective {
|
|
|
1253
1263
|
return;
|
|
1254
1264
|
}
|
|
1255
1265
|
const element = coerceElement(value);
|
|
1256
|
-
this._sizeObservable$.next(this._resizeObserverService.observe(value).pipe(map
|
|
1266
|
+
this._sizeObservable$.next(this._resizeObserverService.observe(value).pipe(map(() => element.offsetWidth), startWith(element.offsetWidth)));
|
|
1257
1267
|
}
|
|
1258
1268
|
/** @hidden */
|
|
1259
1269
|
constructor(templateRef, viewContainer) {
|
|
@@ -1292,7 +1302,7 @@ class BreakpointDirective {
|
|
|
1292
1302
|
/** @hidden */
|
|
1293
1303
|
ngAfterViewInit() {
|
|
1294
1304
|
combineLatest([this._sizeObservable$.pipe(switchMap$1((obs$) => obs$)), this.onChanges$.pipe(startWith(void 0))])
|
|
1295
|
-
.pipe(map
|
|
1305
|
+
.pipe(map(([w]) => [w, getBreakpointName(w)]), map(([width, breakpointName]) => this._shouldShow(width, breakpointName)), tap((shouldShow) => {
|
|
1296
1306
|
if (shouldShow) {
|
|
1297
1307
|
if (!this.templateViewRef) {
|
|
1298
1308
|
this.viewContainer.clear();
|
|
@@ -1719,7 +1729,7 @@ class DisabledObserver {
|
|
|
1719
1729
|
}
|
|
1720
1730
|
/** @hidden */
|
|
1721
1731
|
observe(element) {
|
|
1722
|
-
return this._attributeObserver.observe(element).pipe(map
|
|
1732
|
+
return this._attributeObserver.observe(element).pipe(map(() => DisabledObserver.isDisabled(getNativeElement(element))), distinctUntilChanged());
|
|
1723
1733
|
}
|
|
1724
1734
|
/** @hidden */
|
|
1725
1735
|
unobserve(element) {
|
|
@@ -2049,7 +2059,7 @@ class FocusableObserver {
|
|
|
2049
2059
|
/** @hidden */
|
|
2050
2060
|
observe(element, respectTabIndex = true) {
|
|
2051
2061
|
const nativeElement = getNativeElement(element);
|
|
2052
|
-
return this._attributeObserver.observe(nativeElement).pipe(map
|
|
2062
|
+
return this._attributeObserver.observe(nativeElement).pipe(map(() => FocusableObserver.isFocusable(nativeElement, respectTabIndex)), distinctUntilChanged());
|
|
2053
2063
|
}
|
|
2054
2064
|
/** @hidden */
|
|
2055
2065
|
unobserve(element) {
|
|
@@ -2285,7 +2295,7 @@ class IndirectFocusableListDirective {
|
|
|
2285
2295
|
[Symbol.iterator]: () => this._indirectChildren.value[Symbol.iterator](),
|
|
2286
2296
|
forEach: (callback, thisArg) => this._indirectChildren.value.forEach(callback, thisArg)
|
|
2287
2297
|
};
|
|
2288
|
-
queryList['changes'] = this._indirectChildren.pipe(debounceTime(100), distinctUntilChanged$1(deepEqual), map(() => queryList));
|
|
2298
|
+
queryList['changes'] = this._indirectChildren.pipe(debounceTime(100), distinctUntilChanged$1(deepEqual), map$1(() => queryList));
|
|
2289
2299
|
this._focusableList.setItems(queryList);
|
|
2290
2300
|
}
|
|
2291
2301
|
}
|
|
@@ -2653,7 +2663,7 @@ class FocusableListDirective {
|
|
|
2653
2663
|
const refresh$ = merge(this._refresh$, destroyObservable(this._destroyRef));
|
|
2654
2664
|
this._refresh$.next();
|
|
2655
2665
|
this._focusableItems.changes
|
|
2656
|
-
.pipe(startWith(null), map
|
|
2666
|
+
.pipe(startWith(null), map(() => this._focusableItems.toArray()), tap((items) => {
|
|
2657
2667
|
const direction = this.navigationDirection === 'grid' ? 'horizontal' : this.navigationDirection;
|
|
2658
2668
|
this._initializeFocusManager(items, {
|
|
2659
2669
|
direction,
|
|
@@ -3080,7 +3090,7 @@ class IntersectionSpyDirective {
|
|
|
3080
3090
|
/** @hidden */
|
|
3081
3091
|
ngOnInit() {
|
|
3082
3092
|
intersectionObservable(this._elementRef.nativeElement, this.viewportOptions)
|
|
3083
|
-
.pipe(map((entries) => entries[0]), takeUntilDestroyed(this._destroyRef))
|
|
3093
|
+
.pipe(map$1((entries) => entries[0]), takeUntilDestroyed(this._destroyRef))
|
|
3084
3094
|
.subscribe((entry) => {
|
|
3085
3095
|
this.intersected.emit(entry.isIntersecting);
|
|
3086
3096
|
});
|
|
@@ -3712,7 +3722,7 @@ class ReadonlyObserver {
|
|
|
3712
3722
|
}
|
|
3713
3723
|
/** @hidden */
|
|
3714
3724
|
observe(element) {
|
|
3715
|
-
return this._attributeObserver.observe(element).pipe(map
|
|
3725
|
+
return this._attributeObserver.observe(element).pipe(map(() => ReadonlyObserver.isReadonly(getNativeElement(element))), distinctUntilChanged());
|
|
3716
3726
|
}
|
|
3717
3727
|
/** @Hidden */
|
|
3718
3728
|
unobserve(element) {
|
|
@@ -4064,12 +4074,12 @@ class ResizeDirective {
|
|
|
4064
4074
|
const mouseUpEvent$ = fromEvent(window, 'mouseup');
|
|
4065
4075
|
const mouseMoveEvent$ = fromEvent(resizeContainer, 'mousemove');
|
|
4066
4076
|
const mouseDownEvent$ = fromEvent(this.resizeHandleReference.elementRef.nativeElement, 'mousedown');
|
|
4067
|
-
const resizeActive$ = merge(mouseDownEvent$.pipe(map
|
|
4077
|
+
const resizeActive$ = merge(mouseDownEvent$.pipe(map(() => true), tap(() => {
|
|
4068
4078
|
moveOffset = this._getMoveOffsetFunction();
|
|
4069
|
-
})), mouseUpEvent$.pipe(map
|
|
4079
|
+
})), mouseUpEvent$.pipe(map(() => false)));
|
|
4070
4080
|
const emitResizableEvents$ = this._getResizeEventsNotifiers(resizeActive$);
|
|
4071
4081
|
const preventOtherPointerEvents$ = this._blockOtherPointerEvents(resizeActive$);
|
|
4072
|
-
const resizingCursorMovement$ = mouseMoveEvent$.pipe(pairwise(), map
|
|
4082
|
+
const resizingCursorMovement$ = mouseMoveEvent$.pipe(pairwise(), map(([event1, event2]) => moveOffset(event1, event2)), filter((move) => isBoundaryOverflow(move)));
|
|
4073
4083
|
const setupResizer = () => {
|
|
4074
4084
|
resizingCursorMovement$.pipe(takeUntil(mouseUpEvent$)).subscribe((event) => resize(event));
|
|
4075
4085
|
};
|
|
@@ -4175,7 +4185,7 @@ class ResizeDirective {
|
|
|
4175
4185
|
else {
|
|
4176
4186
|
this._elementRef.nativeElement.classList.add(this.fdkResizeClass);
|
|
4177
4187
|
}
|
|
4178
|
-
}), map
|
|
4188
|
+
}), map((isActive) => (isActive ? 'none' : 'auto')), tap((value) => {
|
|
4179
4189
|
this._elementRef.nativeElement.style.pointerEvents = value;
|
|
4180
4190
|
}));
|
|
4181
4191
|
}
|
|
@@ -4246,9 +4256,9 @@ class SelectionService {
|
|
|
4246
4256
|
this._clear$ = new Subject();
|
|
4247
4257
|
/** @hidden */
|
|
4248
4258
|
this._value = [];
|
|
4249
|
-
this._normalizedValue$ = this._value$.pipe(distinctUntilChanged(deepEqual), map
|
|
4259
|
+
this._normalizedValue$ = this._value$.pipe(distinctUntilChanged(deepEqual), map((v) => coerceArray(v)), map((value) => (this._isMultipleMode ? value : [value[0]])), map((coerced) => coerced.filter(Boolean)));
|
|
4250
4260
|
this._normalizedValue$.pipe(takeUntilDestroyed(this._destroyRef)).subscribe((val) => (this._value = val));
|
|
4251
|
-
this.value$ = this._normalizedValue$.pipe(map
|
|
4261
|
+
this.value$ = this._normalizedValue$.pipe(map((v) => this._getProperValues(v)), shareReplay(1));
|
|
4252
4262
|
}
|
|
4253
4263
|
/**
|
|
4254
4264
|
* Register main select component, which holds config
|
|
@@ -4267,7 +4277,7 @@ class SelectionService {
|
|
|
4267
4277
|
* */
|
|
4268
4278
|
initialize(list) {
|
|
4269
4279
|
if (list instanceof QueryList) {
|
|
4270
|
-
this._items$ = list.changes.pipe(startWith(list), map
|
|
4280
|
+
this._items$ = list.changes.pipe(startWith(list), map((items) => items.toArray()), shareReplay(1));
|
|
4271
4281
|
}
|
|
4272
4282
|
else {
|
|
4273
4283
|
this._items$ = isObservable(list) ? list : of(list);
|
|
@@ -4293,8 +4303,8 @@ class SelectionService {
|
|
|
4293
4303
|
const unsubscribe$ = merge(destroyObservable(this._destroyRef), this._clear$);
|
|
4294
4304
|
if (this._items$) {
|
|
4295
4305
|
this._items$
|
|
4296
|
-
.pipe(map
|
|
4297
|
-
const clickedEvents$ = items.map((item) => item.clicked.pipe(map
|
|
4306
|
+
.pipe(map((items) => items.filter((itm) => itm.fdkSelectableItem !== false)), switchMap((items) => {
|
|
4307
|
+
const clickedEvents$ = items.map((item) => item.clicked.pipe(map(() => item)));
|
|
4298
4308
|
return merge(...clickedEvents$);
|
|
4299
4309
|
}), tap((clickedItem) => this._itemClicked(clickedItem)), takeUntil(unsubscribe$))
|
|
4300
4310
|
.subscribe();
|
|
@@ -5833,7 +5843,7 @@ class DynamicPortalComponent {
|
|
|
5833
5843
|
ngAfterViewInit() {
|
|
5834
5844
|
const portalOutlet = this.portalOutlet;
|
|
5835
5845
|
this.portalContent$
|
|
5836
|
-
.pipe(tap$1(() => portalOutlet.detach()), filter$1(Boolean), map((content) => {
|
|
5846
|
+
.pipe(tap$1(() => portalOutlet.detach()), filter$1(Boolean), map$1((content) => {
|
|
5837
5847
|
if (typeof content === 'string') {
|
|
5838
5848
|
const textElement = this.renderer.createText(content);
|
|
5839
5849
|
this.renderer.appendChild(this.elementRef.nativeElement, textElement);
|