@fundamental-ngx/cdk 0.52.2-rc.9 → 0.52.2
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 {
|
|
3
|
+
import { isDevMode, EventEmitter, inject, ElementRef, NgZone, Directive, Input, Output, NgModule, DestroyRef, Injectable, INJECTOR, InjectionToken, 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 {
|
|
7
|
-
import {
|
|
6
|
+
import { fromEvent, switchMap, map, Subject, BehaviorSubject, ReplaySubject, Observable, NEVER, 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 { first, distinctUntilChanged, startWith, map as map$1, 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,93 +23,6 @@ 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
|
-
|
|
113
26
|
/** Map of keyCodes and their corresponding "key" values */
|
|
114
27
|
const keyMap = new Map([
|
|
115
28
|
[RIGHT_ARROW, ['ArrowRight', 'Right']],
|
|
@@ -197,129 +110,6 @@ class KeyUtil {
|
|
|
197
110
|
}
|
|
198
111
|
}
|
|
199
112
|
|
|
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
|
-
|
|
323
113
|
class AutoCompleteDirective {
|
|
324
114
|
/** @hidden */
|
|
325
115
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
@@ -340,8 +130,6 @@ class AutoCompleteDirective {
|
|
|
340
130
|
/** @hidden */
|
|
341
131
|
this._stopKeys = [BACKSPACE, DELETE, ESCAPE];
|
|
342
132
|
/** @hidden */
|
|
343
|
-
this._isComposing = false;
|
|
344
|
-
/** @hidden */
|
|
345
133
|
this._elementRef = inject(ElementRef);
|
|
346
134
|
this._zone = inject(NgZone);
|
|
347
135
|
/** Matcher function for testing the str for a search term */
|
|
@@ -353,23 +141,14 @@ class AutoCompleteDirective {
|
|
|
353
141
|
*/
|
|
354
142
|
this._zone.runOutsideAngular(() => {
|
|
355
143
|
const keyupEvent = fromEvent(this._elementRef.nativeElement, 'keyup');
|
|
356
|
-
const compositionStartEvent = fromEvent(this._elementRef.nativeElement, 'compositionstart');
|
|
357
|
-
const compositionEndEvent = fromEvent(this._elementRef.nativeElement, 'compositionend');
|
|
358
144
|
keyupEvent
|
|
359
|
-
.pipe(switchMap((evt) => this._zone.onStable.pipe(first(), map
|
|
145
|
+
.pipe(switchMap((evt) => this._zone.onStable.pipe(first(), map(() => evt))), takeUntilDestroyed())
|
|
360
146
|
.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
|
-
});
|
|
368
147
|
});
|
|
369
148
|
}
|
|
370
149
|
/** @hidden */
|
|
371
150
|
_handleKeyboardEvent(event) {
|
|
372
|
-
if (this.enable
|
|
151
|
+
if (this.enable) {
|
|
373
152
|
if (KeyUtil.isKeyCode(event, this._stopKeys)) {
|
|
374
153
|
this._elementRef.nativeElement.value = this.inputText;
|
|
375
154
|
}
|
|
@@ -381,6 +160,7 @@ class AutoCompleteDirective {
|
|
|
381
160
|
this._sendCompleteEvent(false);
|
|
382
161
|
}
|
|
383
162
|
else if (!this._isControlKey(event) && this.inputText) {
|
|
163
|
+
/** Prevention from triggering typeahead, when having crtl/cmd + keys */
|
|
384
164
|
if (!this._triggerTypeAhead()) {
|
|
385
165
|
return;
|
|
386
166
|
}
|
|
@@ -462,6 +242,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImpor
|
|
|
462
242
|
}]
|
|
463
243
|
}] });
|
|
464
244
|
|
|
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
|
+
|
|
465
256
|
/**
|
|
466
257
|
* Creates an observable that emits when the component is destroyed.
|
|
467
258
|
* @param destroyRef
|
|
@@ -755,7 +546,7 @@ class ContentDensityService {
|
|
|
755
546
|
}
|
|
756
547
|
/** @hidden */
|
|
757
548
|
get _isCompactDensity() {
|
|
758
|
-
return this._contentDensityListener.pipe(map((density) => isCompactDensity(density)));
|
|
549
|
+
return this._contentDensityListener.pipe(map$1((density) => isCompactDensity(density)));
|
|
759
550
|
}
|
|
760
551
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: ContentDensityService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
761
552
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.3", ngImport: i0, type: ContentDensityService }); }
|
|
@@ -786,6 +577,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImpor
|
|
|
786
577
|
type: Injectable
|
|
787
578
|
}], ctorParameters: () => [] });
|
|
788
579
|
|
|
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
|
+
|
|
789
592
|
class FocusTrapService {
|
|
790
593
|
constructor() {
|
|
791
594
|
/** @hidden */
|
|
@@ -874,6 +677,193 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.3", ngImpor
|
|
|
874
677
|
}]
|
|
875
678
|
}] });
|
|
876
679
|
|
|
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
|
+
|
|
877
867
|
class KeyboardSupportService {
|
|
878
868
|
constructor() {
|
|
879
869
|
/** Subject that is thrown, when focus escapes the list */
|
|
@@ -1214,7 +1204,7 @@ const ViewportSizeObservable = new InjectionToken('ViewportSizeObservable', {
|
|
|
1214
1204
|
const viewportRuler = inject(ViewportRuler);
|
|
1215
1205
|
return viewportRuler
|
|
1216
1206
|
.change(50)
|
|
1217
|
-
.pipe(map
|
|
1207
|
+
.pipe(map((e) => e.target.innerWidth))
|
|
1218
1208
|
.pipe(startWith(window.innerWidth));
|
|
1219
1209
|
}
|
|
1220
1210
|
});
|
|
@@ -1263,7 +1253,7 @@ class BreakpointDirective {
|
|
|
1263
1253
|
return;
|
|
1264
1254
|
}
|
|
1265
1255
|
const element = coerceElement(value);
|
|
1266
|
-
this._sizeObservable$.next(this._resizeObserverService.observe(value).pipe(map(() => element.offsetWidth), startWith(element.offsetWidth)));
|
|
1256
|
+
this._sizeObservable$.next(this._resizeObserverService.observe(value).pipe(map$1(() => element.offsetWidth), startWith(element.offsetWidth)));
|
|
1267
1257
|
}
|
|
1268
1258
|
/** @hidden */
|
|
1269
1259
|
constructor(templateRef, viewContainer) {
|
|
@@ -1302,7 +1292,7 @@ class BreakpointDirective {
|
|
|
1302
1292
|
/** @hidden */
|
|
1303
1293
|
ngAfterViewInit() {
|
|
1304
1294
|
combineLatest([this._sizeObservable$.pipe(switchMap$1((obs$) => obs$)), this.onChanges$.pipe(startWith(void 0))])
|
|
1305
|
-
.pipe(map(([w]) => [w, getBreakpointName(w)]), map(([width, breakpointName]) => this._shouldShow(width, breakpointName)), tap((shouldShow) => {
|
|
1295
|
+
.pipe(map$1(([w]) => [w, getBreakpointName(w)]), map$1(([width, breakpointName]) => this._shouldShow(width, breakpointName)), tap((shouldShow) => {
|
|
1306
1296
|
if (shouldShow) {
|
|
1307
1297
|
if (!this.templateViewRef) {
|
|
1308
1298
|
this.viewContainer.clear();
|
|
@@ -1729,7 +1719,7 @@ class DisabledObserver {
|
|
|
1729
1719
|
}
|
|
1730
1720
|
/** @hidden */
|
|
1731
1721
|
observe(element) {
|
|
1732
|
-
return this._attributeObserver.observe(element).pipe(map(() => DisabledObserver.isDisabled(getNativeElement(element))), distinctUntilChanged());
|
|
1722
|
+
return this._attributeObserver.observe(element).pipe(map$1(() => DisabledObserver.isDisabled(getNativeElement(element))), distinctUntilChanged());
|
|
1733
1723
|
}
|
|
1734
1724
|
/** @hidden */
|
|
1735
1725
|
unobserve(element) {
|
|
@@ -2059,7 +2049,7 @@ class FocusableObserver {
|
|
|
2059
2049
|
/** @hidden */
|
|
2060
2050
|
observe(element, respectTabIndex = true) {
|
|
2061
2051
|
const nativeElement = getNativeElement(element);
|
|
2062
|
-
return this._attributeObserver.observe(nativeElement).pipe(map(() => FocusableObserver.isFocusable(nativeElement, respectTabIndex)), distinctUntilChanged());
|
|
2052
|
+
return this._attributeObserver.observe(nativeElement).pipe(map$1(() => FocusableObserver.isFocusable(nativeElement, respectTabIndex)), distinctUntilChanged());
|
|
2063
2053
|
}
|
|
2064
2054
|
/** @hidden */
|
|
2065
2055
|
unobserve(element) {
|
|
@@ -2295,7 +2285,7 @@ class IndirectFocusableListDirective {
|
|
|
2295
2285
|
[Symbol.iterator]: () => this._indirectChildren.value[Symbol.iterator](),
|
|
2296
2286
|
forEach: (callback, thisArg) => this._indirectChildren.value.forEach(callback, thisArg)
|
|
2297
2287
|
};
|
|
2298
|
-
queryList['changes'] = this._indirectChildren.pipe(debounceTime(100), distinctUntilChanged$1(deepEqual), map
|
|
2288
|
+
queryList['changes'] = this._indirectChildren.pipe(debounceTime(100), distinctUntilChanged$1(deepEqual), map(() => queryList));
|
|
2299
2289
|
this._focusableList.setItems(queryList);
|
|
2300
2290
|
}
|
|
2301
2291
|
}
|
|
@@ -2663,7 +2653,7 @@ class FocusableListDirective {
|
|
|
2663
2653
|
const refresh$ = merge(this._refresh$, destroyObservable(this._destroyRef));
|
|
2664
2654
|
this._refresh$.next();
|
|
2665
2655
|
this._focusableItems.changes
|
|
2666
|
-
.pipe(startWith(null), map(() => this._focusableItems.toArray()), tap((items) => {
|
|
2656
|
+
.pipe(startWith(null), map$1(() => this._focusableItems.toArray()), tap((items) => {
|
|
2667
2657
|
const direction = this.navigationDirection === 'grid' ? 'horizontal' : this.navigationDirection;
|
|
2668
2658
|
this._initializeFocusManager(items, {
|
|
2669
2659
|
direction,
|
|
@@ -3090,7 +3080,7 @@ class IntersectionSpyDirective {
|
|
|
3090
3080
|
/** @hidden */
|
|
3091
3081
|
ngOnInit() {
|
|
3092
3082
|
intersectionObservable(this._elementRef.nativeElement, this.viewportOptions)
|
|
3093
|
-
.pipe(map
|
|
3083
|
+
.pipe(map((entries) => entries[0]), takeUntilDestroyed(this._destroyRef))
|
|
3094
3084
|
.subscribe((entry) => {
|
|
3095
3085
|
this.intersected.emit(entry.isIntersecting);
|
|
3096
3086
|
});
|
|
@@ -3722,7 +3712,7 @@ class ReadonlyObserver {
|
|
|
3722
3712
|
}
|
|
3723
3713
|
/** @hidden */
|
|
3724
3714
|
observe(element) {
|
|
3725
|
-
return this._attributeObserver.observe(element).pipe(map(() => ReadonlyObserver.isReadonly(getNativeElement(element))), distinctUntilChanged());
|
|
3715
|
+
return this._attributeObserver.observe(element).pipe(map$1(() => ReadonlyObserver.isReadonly(getNativeElement(element))), distinctUntilChanged());
|
|
3726
3716
|
}
|
|
3727
3717
|
/** @Hidden */
|
|
3728
3718
|
unobserve(element) {
|
|
@@ -4074,12 +4064,12 @@ class ResizeDirective {
|
|
|
4074
4064
|
const mouseUpEvent$ = fromEvent(window, 'mouseup');
|
|
4075
4065
|
const mouseMoveEvent$ = fromEvent(resizeContainer, 'mousemove');
|
|
4076
4066
|
const mouseDownEvent$ = fromEvent(this.resizeHandleReference.elementRef.nativeElement, 'mousedown');
|
|
4077
|
-
const resizeActive$ = merge(mouseDownEvent$.pipe(map(() => true), tap(() => {
|
|
4067
|
+
const resizeActive$ = merge(mouseDownEvent$.pipe(map$1(() => true), tap(() => {
|
|
4078
4068
|
moveOffset = this._getMoveOffsetFunction();
|
|
4079
|
-
})), mouseUpEvent$.pipe(map(() => false)));
|
|
4069
|
+
})), mouseUpEvent$.pipe(map$1(() => false)));
|
|
4080
4070
|
const emitResizableEvents$ = this._getResizeEventsNotifiers(resizeActive$);
|
|
4081
4071
|
const preventOtherPointerEvents$ = this._blockOtherPointerEvents(resizeActive$);
|
|
4082
|
-
const resizingCursorMovement$ = mouseMoveEvent$.pipe(pairwise(), map(([event1, event2]) => moveOffset(event1, event2)), filter((move) => isBoundaryOverflow(move)));
|
|
4072
|
+
const resizingCursorMovement$ = mouseMoveEvent$.pipe(pairwise(), map$1(([event1, event2]) => moveOffset(event1, event2)), filter((move) => isBoundaryOverflow(move)));
|
|
4083
4073
|
const setupResizer = () => {
|
|
4084
4074
|
resizingCursorMovement$.pipe(takeUntil(mouseUpEvent$)).subscribe((event) => resize(event));
|
|
4085
4075
|
};
|
|
@@ -4185,7 +4175,7 @@ class ResizeDirective {
|
|
|
4185
4175
|
else {
|
|
4186
4176
|
this._elementRef.nativeElement.classList.add(this.fdkResizeClass);
|
|
4187
4177
|
}
|
|
4188
|
-
}), map((isActive) => (isActive ? 'none' : 'auto')), tap((value) => {
|
|
4178
|
+
}), map$1((isActive) => (isActive ? 'none' : 'auto')), tap((value) => {
|
|
4189
4179
|
this._elementRef.nativeElement.style.pointerEvents = value;
|
|
4190
4180
|
}));
|
|
4191
4181
|
}
|
|
@@ -4256,9 +4246,9 @@ class SelectionService {
|
|
|
4256
4246
|
this._clear$ = new Subject();
|
|
4257
4247
|
/** @hidden */
|
|
4258
4248
|
this._value = [];
|
|
4259
|
-
this._normalizedValue$ = this._value$.pipe(distinctUntilChanged(deepEqual), map((v) => coerceArray(v)), map((value) => (this._isMultipleMode ? value : [value[0]])), map((coerced) => coerced.filter(Boolean)));
|
|
4249
|
+
this._normalizedValue$ = this._value$.pipe(distinctUntilChanged(deepEqual), map$1((v) => coerceArray(v)), map$1((value) => (this._isMultipleMode ? value : [value[0]])), map$1((coerced) => coerced.filter(Boolean)));
|
|
4260
4250
|
this._normalizedValue$.pipe(takeUntilDestroyed(this._destroyRef)).subscribe((val) => (this._value = val));
|
|
4261
|
-
this.value$ = this._normalizedValue$.pipe(map((v) => this._getProperValues(v)), shareReplay(1));
|
|
4251
|
+
this.value$ = this._normalizedValue$.pipe(map$1((v) => this._getProperValues(v)), shareReplay(1));
|
|
4262
4252
|
}
|
|
4263
4253
|
/**
|
|
4264
4254
|
* Register main select component, which holds config
|
|
@@ -4277,7 +4267,7 @@ class SelectionService {
|
|
|
4277
4267
|
* */
|
|
4278
4268
|
initialize(list) {
|
|
4279
4269
|
if (list instanceof QueryList) {
|
|
4280
|
-
this._items$ = list.changes.pipe(startWith(list), map((items) => items.toArray()), shareReplay(1));
|
|
4270
|
+
this._items$ = list.changes.pipe(startWith(list), map$1((items) => items.toArray()), shareReplay(1));
|
|
4281
4271
|
}
|
|
4282
4272
|
else {
|
|
4283
4273
|
this._items$ = isObservable(list) ? list : of(list);
|
|
@@ -4303,8 +4293,8 @@ class SelectionService {
|
|
|
4303
4293
|
const unsubscribe$ = merge(destroyObservable(this._destroyRef), this._clear$);
|
|
4304
4294
|
if (this._items$) {
|
|
4305
4295
|
this._items$
|
|
4306
|
-
.pipe(map((items) => items.filter((itm) => itm.fdkSelectableItem !== false)), switchMap((items) => {
|
|
4307
|
-
const clickedEvents$ = items.map((item) => item.clicked.pipe(map(() => item)));
|
|
4296
|
+
.pipe(map$1((items) => items.filter((itm) => itm.fdkSelectableItem !== false)), switchMap((items) => {
|
|
4297
|
+
const clickedEvents$ = items.map((item) => item.clicked.pipe(map$1(() => item)));
|
|
4308
4298
|
return merge(...clickedEvents$);
|
|
4309
4299
|
}), tap((clickedItem) => this._itemClicked(clickedItem)), takeUntil(unsubscribe$))
|
|
4310
4300
|
.subscribe();
|
|
@@ -5843,7 +5833,7 @@ class DynamicPortalComponent {
|
|
|
5843
5833
|
ngAfterViewInit() {
|
|
5844
5834
|
const portalOutlet = this.portalOutlet;
|
|
5845
5835
|
this.portalContent$
|
|
5846
|
-
.pipe(tap$1(() => portalOutlet.detach()), filter$1(Boolean), map
|
|
5836
|
+
.pipe(tap$1(() => portalOutlet.detach()), filter$1(Boolean), map((content) => {
|
|
5847
5837
|
if (typeof content === 'string') {
|
|
5848
5838
|
const textElement = this.renderer.createText(content);
|
|
5849
5839
|
this.renderer.appendChild(this.elementRef.nativeElement, textElement);
|