@firestitch/common 13.0.1 → 13.0.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.
- package/app/directives/auto-focus.directive.d.ts +15 -0
- package/app/directives/auto-select.directive.d.ts +11 -0
- package/app/directives/index.d.ts +5 -4
- package/app/directives/model-change.directive.d.ts +16 -16
- package/app/directives/prevent-default.directive.d.ts +6 -6
- package/app/directives/stop-propagation.directive.d.ts +6 -6
- package/app/fs-common.module.d.ts +19 -19
- package/app/pipes/bytes.pipe.d.ts +7 -7
- package/app/pipes/currency.pipe.d.ts +9 -9
- package/app/pipes/index.d.ts +2 -2
- package/app/pipes/number.pipe.d.ts +7 -7
- package/app/pipes/ordinal-number.pipe.d.ts +7 -7
- package/app/pipes/truncate.pipe.d.ts +8 -8
- package/app/pipes/util.pipe.d.ts +24 -24
- package/app/services/array.service.d.ts +61 -61
- package/app/services/math.service.d.ts +9 -9
- package/app/services/util.service.d.ts +89 -89
- package/app/services/vaildate.service.d.ts +16 -16
- package/esm2020/app/directives/auto-focus.directive.mjs +59 -0
- package/esm2020/app/directives/auto-select.directive.mjs +31 -0
- package/esm2020/app/directives/index.mjs +6 -5
- package/esm2020/app/directives/model-change.directive.mjs +36 -36
- package/esm2020/app/directives/prevent-default.directive.mjs +18 -18
- package/esm2020/app/directives/stop-propagation.directive.mjs +18 -18
- package/esm2020/app/fs-common.module.mjs +97 -98
- package/esm2020/app/pipes/bytes.pipe.mjs +16 -16
- package/esm2020/app/pipes/currency.pipe.mjs +22 -22
- package/esm2020/app/pipes/index.mjs +2 -2
- package/esm2020/app/pipes/number.pipe.mjs +16 -16
- package/esm2020/app/pipes/ordinal-number.pipe.mjs +16 -16
- package/esm2020/app/pipes/truncate.pipe.mjs +17 -17
- package/esm2020/app/pipes/util.pipe.mjs +59 -59
- package/esm2020/app/services/array.service.mjs +224 -224
- package/esm2020/app/services/math.service.mjs +20 -20
- package/esm2020/app/services/util.service.mjs +250 -250
- package/esm2020/app/services/vaildate.service.mjs +27 -27
- package/esm2020/firestitch-common.mjs +4 -4
- package/esm2020/libs/array/compare/compare.mjs +7 -7
- package/esm2020/libs/array/compare/index.mjs +1 -1
- package/esm2020/libs/array/filter/filter.mjs +26 -26
- package/esm2020/libs/array/filter/index.mjs +1 -1
- package/esm2020/libs/array/find/find.mjs +5 -5
- package/esm2020/libs/array/find/index.mjs +1 -1
- package/esm2020/libs/array/inArray/inArray.mjs +11 -11
- package/esm2020/libs/array/inArray/index.mjs +1 -1
- package/esm2020/libs/array/index/index.mjs +7 -7
- package/esm2020/libs/array/index.mjs +13 -13
- package/esm2020/libs/array/indexOf/index.mjs +1 -1
- package/esm2020/libs/array/indexOf/indexOf.mjs +15 -15
- package/esm2020/libs/array/keyExists/index.mjs +1 -1
- package/esm2020/libs/array/keyExists/keyExists.mjs +3 -3
- package/esm2020/libs/array/ksort/index.mjs +1 -1
- package/esm2020/libs/array/ksort/ksort.mjs +7 -7
- package/esm2020/libs/array/list/index.mjs +1 -1
- package/esm2020/libs/array/list/list.mjs +12 -12
- package/esm2020/libs/array/nameValue/index.mjs +1 -1
- package/esm2020/libs/array/nameValue/nameValue.mjs +20 -20
- package/esm2020/libs/array/remove/index.mjs +1 -1
- package/esm2020/libs/array/remove/remove.mjs +8 -8
- package/esm2020/libs/array/rsort/index.mjs +1 -1
- package/esm2020/libs/array/rsort/rsort.mjs +4 -4
- package/esm2020/libs/array/sort/index.mjs +1 -1
- package/esm2020/libs/array/sort/sort.mjs +26 -26
- package/esm2020/libs/format/acronym/acronym.mjs +21 -21
- package/esm2020/libs/format/acronym/index.mjs +1 -1
- package/esm2020/libs/format/bytes/bytes.mjs +17 -17
- package/esm2020/libs/format/bytes/index.mjs +1 -1
- package/esm2020/libs/format/currency/currency.mjs +8 -8
- package/esm2020/libs/format/currency/index.mjs +1 -1
- package/esm2020/libs/format/index.mjs +5 -5
- package/esm2020/libs/format/number/index.mjs +1 -1
- package/esm2020/libs/format/number/number.mjs +7 -7
- package/esm2020/libs/format/truncate/index.mjs +1 -1
- package/esm2020/libs/format/truncate/truncate.mjs +11 -11
- package/esm2020/libs/index.mjs +5 -5
- package/esm2020/libs/rxjs/delayedRetry.mjs +19 -19
- package/esm2020/libs/rxjs/keyboard-shortcut.mjs +17 -17
- package/esm2020/libs/util/boolean/boolean.mjs +3 -3
- package/esm2020/libs/util/boolean/index.mjs +1 -1
- package/esm2020/libs/util/clone/clone.mjs +20 -20
- package/esm2020/libs/util/clone/index.mjs +1 -1
- package/esm2020/libs/util/debounce/debounce.mjs +16 -16
- package/esm2020/libs/util/debounce/index.mjs +1 -1
- package/esm2020/libs/util/get-normalized-path/get-normalized-path.mjs +5 -5
- package/esm2020/libs/util/get-normalized-path/index.mjs +1 -1
- package/esm2020/libs/util/guid/guid.mjs +18 -18
- package/esm2020/libs/util/guid/index.mjs +1 -1
- package/esm2020/libs/util/index.mjs +24 -24
- package/esm2020/libs/util/is-array-equal/index.mjs +2 -2
- package/esm2020/libs/util/is-array-equal/is-array-equal.mjs +21 -21
- package/esm2020/libs/util/is-class/index.mjs +1 -1
- package/esm2020/libs/util/is-class/is-class.mjs +17 -17
- package/esm2020/libs/util/is-empty/index.mjs +1 -1
- package/esm2020/libs/util/is-empty/is-empty.mjs +11 -11
- package/esm2020/libs/util/is-numeric/index.mjs +1 -1
- package/esm2020/libs/util/is-numeric/is-numeric.mjs +4 -4
- package/esm2020/libs/util/is-object/index.mjs +1 -1
- package/esm2020/libs/util/is-object/is-object.mjs +3 -3
- package/esm2020/libs/util/keys/index.mjs +1 -1
- package/esm2020/libs/util/keys/keys.mjs +37 -37
- package/esm2020/libs/util/length/index.mjs +1 -1
- package/esm2020/libs/util/length/length.mjs +9 -9
- package/esm2020/libs/util/ordinal-number/index.mjs +2 -2
- package/esm2020/libs/util/ordinal-number/ordinal-number.mjs +7 -7
- package/esm2020/libs/util/queue/index.mjs +3 -3
- package/esm2020/libs/util/queue/operation.mjs +14 -14
- package/esm2020/libs/util/queue/queue-stats.mjs +1 -1
- package/esm2020/libs/util/queue/queue.enum.mjs +5 -5
- package/esm2020/libs/util/queue/queue.mjs +164 -164
- package/esm2020/libs/util/remove-query-params/index.mjs +1 -1
- package/esm2020/libs/util/remove-query-params/remove-query-params.mjs +3 -3
- package/esm2020/libs/util/resolve/index.mjs +1 -1
- package/esm2020/libs/util/resolve/resolve.mjs +9 -9
- package/esm2020/libs/util/round/index.mjs +1 -1
- package/esm2020/libs/util/round/round.mjs +5 -5
- package/esm2020/libs/util/source-loader/index.mjs +2 -2
- package/esm2020/libs/util/source-loader/source-loader.mjs +154 -154
- package/esm2020/libs/util/stringify/index.mjs +1 -1
- package/esm2020/libs/util/stringify/stringify.mjs +3 -3
- package/esm2020/libs/util/throttle/index.mjs +1 -1
- package/esm2020/libs/util/throttle/throttle.mjs +12 -12
- package/esm2020/libs/util/to-string/index.mjs +1 -1
- package/esm2020/libs/util/to-string/to-string.mjs +6 -6
- package/esm2020/libs/util/uuid/index.mjs +1 -1
- package/esm2020/libs/util/uuid/uuid.mjs +4 -4
- package/esm2020/libs/util/value/index.mjs +1 -1
- package/esm2020/libs/util/value/value.mjs +8 -8
- package/esm2020/libs/validate/email/email.mjs +3 -3
- package/esm2020/libs/validate/email/index.mjs +1 -1
- package/esm2020/libs/validate/index.mjs +3 -3
- package/esm2020/libs/validate/phone/index.mjs +1 -1
- package/esm2020/libs/validate/phone/phone.mjs +4 -4
- package/esm2020/libs/validate/url/index.mjs +1 -1
- package/esm2020/libs/validate/url/url.mjs +11 -11
- package/esm2020/public_api.mjs +18 -17
- package/fesm2015/firestitch-common.mjs +1698 -1659
- package/fesm2015/firestitch-common.mjs.map +1 -1
- package/fesm2020/firestitch-common.mjs +1691 -1654
- package/fesm2020/firestitch-common.mjs.map +1 -1
- package/firestitch-common.d.ts +5 -5
- package/libs/array/compare/compare.d.ts +1 -1
- package/libs/array/compare/index.d.ts +1 -1
- package/libs/array/filter/filter.d.ts +1 -1
- package/libs/array/filter/index.d.ts +1 -1
- package/libs/array/find/find.d.ts +1 -1
- package/libs/array/find/index.d.ts +1 -1
- package/libs/array/inArray/inArray.d.ts +1 -1
- package/libs/array/inArray/index.d.ts +1 -1
- package/libs/array/index/index.d.ts +1 -1
- package/libs/array/index.d.ts +13 -13
- package/libs/array/indexOf/index.d.ts +1 -1
- package/libs/array/indexOf/indexOf.d.ts +1 -1
- package/libs/array/keyExists/index.d.ts +1 -1
- package/libs/array/keyExists/keyExists.d.ts +1 -1
- package/libs/array/ksort/index.d.ts +1 -1
- package/libs/array/ksort/ksort.d.ts +1 -1
- package/libs/array/list/index.d.ts +1 -1
- package/libs/array/list/list.d.ts +1 -1
- package/libs/array/nameValue/index.d.ts +1 -1
- package/libs/array/nameValue/nameValue.d.ts +1 -1
- package/libs/array/remove/index.d.ts +1 -1
- package/libs/array/remove/remove.d.ts +1 -1
- package/libs/array/rsort/index.d.ts +1 -1
- package/libs/array/rsort/rsort.d.ts +1 -1
- package/libs/array/sort/index.d.ts +1 -1
- package/libs/array/sort/sort.d.ts +1 -1
- package/libs/format/acronym/acronym.d.ts +1 -1
- package/libs/format/acronym/index.d.ts +1 -1
- package/libs/format/bytes/bytes.d.ts +1 -1
- package/libs/format/bytes/index.d.ts +1 -1
- package/libs/format/currency/currency.d.ts +1 -1
- package/libs/format/currency/index.d.ts +1 -1
- package/libs/format/index.d.ts +5 -5
- package/libs/format/number/index.d.ts +1 -1
- package/libs/format/number/number.d.ts +1 -1
- package/libs/format/truncate/index.d.ts +1 -1
- package/libs/format/truncate/truncate.d.ts +1 -1
- package/libs/index.d.ts +5 -5
- package/libs/rxjs/delayedRetry.d.ts +2 -2
- package/libs/rxjs/keyboard-shortcut.d.ts +2 -2
- package/libs/util/boolean/boolean.d.ts +1 -1
- package/libs/util/boolean/index.d.ts +1 -1
- package/libs/util/clone/clone.d.ts +1 -1
- package/libs/util/clone/index.d.ts +1 -1
- package/libs/util/debounce/debounce.d.ts +1 -1
- package/libs/util/debounce/index.d.ts +1 -1
- package/libs/util/get-normalized-path/get-normalized-path.d.ts +2 -2
- package/libs/util/get-normalized-path/index.d.ts +1 -1
- package/libs/util/guid/guid.d.ts +1 -1
- package/libs/util/guid/index.d.ts +1 -1
- package/libs/util/index.d.ts +23 -23
- package/libs/util/is-array-equal/index.d.ts +1 -1
- package/libs/util/is-array-equal/is-array-equal.d.ts +1 -1
- package/libs/util/is-class/index.d.ts +1 -1
- package/libs/util/is-class/is-class.d.ts +1 -1
- package/libs/util/is-empty/index.d.ts +1 -1
- package/libs/util/is-empty/is-empty.d.ts +1 -1
- package/libs/util/is-numeric/index.d.ts +1 -1
- package/libs/util/is-numeric/is-numeric.d.ts +1 -1
- package/libs/util/is-object/index.d.ts +1 -1
- package/libs/util/is-object/is-object.d.ts +1 -1
- package/libs/util/keys/index.d.ts +1 -1
- package/libs/util/keys/keys.d.ts +37 -37
- package/libs/util/length/index.d.ts +1 -1
- package/libs/util/length/length.d.ts +1 -1
- package/libs/util/ordinal-number/index.d.ts +1 -1
- package/libs/util/ordinal-number/ordinal-number.d.ts +1 -1
- package/libs/util/queue/index.d.ts +3 -3
- package/libs/util/queue/operation.d.ts +7 -7
- package/libs/util/queue/queue-stats.d.ts +5 -5
- package/libs/util/queue/queue.d.ts +39 -39
- package/libs/util/queue/queue.enum.d.ts +4 -4
- package/libs/util/remove-query-params/index.d.ts +1 -1
- package/libs/util/remove-query-params/remove-query-params.d.ts +1 -1
- package/libs/util/resolve/index.d.ts +1 -1
- package/libs/util/resolve/resolve.d.ts +1 -1
- package/libs/util/round/index.d.ts +1 -1
- package/libs/util/round/round.d.ts +1 -1
- package/libs/util/source-loader/index.d.ts +1 -1
- package/libs/util/source-loader/source-loader.d.ts +11 -11
- package/libs/util/stringify/index.d.ts +1 -1
- package/libs/util/stringify/stringify.d.ts +1 -1
- package/libs/util/throttle/index.d.ts +1 -1
- package/libs/util/throttle/throttle.d.ts +1 -1
- package/libs/util/to-string/index.d.ts +1 -1
- package/libs/util/to-string/to-string.d.ts +1 -1
- package/libs/util/uuid/index.d.ts +1 -1
- package/libs/util/uuid/uuid.d.ts +1 -1
- package/libs/util/value/index.d.ts +1 -1
- package/libs/util/value/value.d.ts +1 -1
- package/libs/validate/email/email.d.ts +1 -1
- package/libs/validate/email/index.d.ts +1 -1
- package/libs/validate/index.d.ts +3 -3
- package/libs/validate/phone/index.d.ts +1 -1
- package/libs/validate/phone/phone.d.ts +1 -1
- package/libs/validate/url/index.d.ts +1 -1
- package/libs/validate/url/url.d.ts +7 -7
- package/package.json +1 -1
- package/public_api.d.ts +15 -14
- package/app/directives/autofocus.directive.d.ts +0 -13
- package/esm2020/app/directives/autofocus.directive.mjs +0 -51
|
@@ -6,1708 +6,1747 @@ import { Subject, Observable, of, combineLatest, iif, throwError, timer, fromEve
|
|
|
6
6
|
import { debounceTime, takeUntil, take, map, delay, finalize, shareReplay, retryWhen, tap, concatMap, distinctUntilChanged, share, filter as filter$1 } from 'rxjs/operators';
|
|
7
7
|
import * as i1$1 from '@angular/forms';
|
|
8
8
|
|
|
9
|
-
class
|
|
10
|
-
constructor(_matInput, _el) {
|
|
11
|
-
this._matInput = _matInput;
|
|
12
|
-
this._el = _el;
|
|
13
|
-
this.fsAutofocus = true;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
tmpEl
|
|
28
|
-
tmpEl.style.
|
|
29
|
-
|
|
30
|
-
tmpEl.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
9
|
+
class FsAutoFocusDirective {
|
|
10
|
+
constructor(_matInput, _el) {
|
|
11
|
+
this._matInput = _matInput;
|
|
12
|
+
this._el = _el;
|
|
13
|
+
this.fsAutofocus = true;
|
|
14
|
+
this.fsAutoFocus = true;
|
|
15
|
+
this.autofocus = true;
|
|
16
|
+
}
|
|
17
|
+
ngAfterViewInit() {
|
|
18
|
+
var _a, _b, _c;
|
|
19
|
+
if (((_a = this.fsAutofocus) !== null && _a !== void 0 ? _a : true) === true &&
|
|
20
|
+
((_b = this.fsAutofocus) !== null && _b !== void 0 ? _b : true) === true &&
|
|
21
|
+
((_c = this.autofocus) !== null && _c !== void 0 ? _c : true) === true) {
|
|
22
|
+
this.focus();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
focus() {
|
|
26
|
+
setTimeout(() => {
|
|
27
|
+
const tmpEl = document.createElement('input');
|
|
28
|
+
tmpEl.style.width = '0';
|
|
29
|
+
tmpEl.style.height = '0';
|
|
30
|
+
tmpEl.style.margin = '0';
|
|
31
|
+
tmpEl.style.padding = '0';
|
|
32
|
+
tmpEl.style.border = '0';
|
|
33
|
+
tmpEl.style.opacity = '0';
|
|
34
|
+
document.body.appendChild(tmpEl);
|
|
35
|
+
tmpEl.focus();
|
|
36
|
+
if (this._matInput) {
|
|
37
|
+
this._matInput.focus();
|
|
38
|
+
}
|
|
39
|
+
else if (this._el.nativeElement.focus) {
|
|
40
|
+
this._el.nativeElement.focus();
|
|
41
|
+
}
|
|
42
|
+
document.body.removeChild(tmpEl);
|
|
43
|
+
}, 50);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
FsAutoFocusDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAutoFocusDirective, deps: [{ token: i1.MatInput, host: true, optional: true }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
47
|
+
FsAutoFocusDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsAutoFocusDirective, selector: "[fsAutofocus],[fsAutoFocus],[autofocus]", inputs: { fsAutofocus: "fsAutofocus", fsAutoFocus: "fsAutoFocus", autofocus: "autofocus" }, ngImport: i0 });
|
|
48
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAutoFocusDirective, decorators: [{
|
|
49
|
+
type: Directive,
|
|
50
|
+
args: [{
|
|
51
|
+
selector: '[fsAutofocus],[fsAutoFocus],[autofocus]',
|
|
52
|
+
}]
|
|
53
|
+
}], ctorParameters: function () {
|
|
54
|
+
return [{ type: i1.MatInput, decorators: [{
|
|
55
|
+
type: Optional
|
|
56
|
+
}, {
|
|
57
|
+
type: Host
|
|
58
|
+
}] }, { type: i0.ElementRef }];
|
|
59
|
+
}, propDecorators: { fsAutofocus: [{
|
|
60
|
+
type: Input
|
|
61
|
+
}], fsAutoFocus: [{
|
|
62
|
+
type: Input
|
|
63
|
+
}], autofocus: [{
|
|
64
|
+
type: Input
|
|
56
65
|
}] } });
|
|
57
66
|
|
|
58
|
-
class
|
|
59
|
-
constructor(
|
|
60
|
-
this.
|
|
61
|
-
this.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type:
|
|
80
|
-
type: Directive,
|
|
81
|
-
args: [{
|
|
82
|
-
selector: '[
|
|
83
|
-
}]
|
|
84
|
-
}], ctorParameters: function () { return [{ type:
|
|
85
|
-
type: Input
|
|
86
|
-
}], fsModelChange: [{
|
|
87
|
-
type: Output
|
|
67
|
+
class FsAutoSelectDirective {
|
|
68
|
+
constructor(_el) {
|
|
69
|
+
this._el = _el;
|
|
70
|
+
this.fsAutoSelect = true;
|
|
71
|
+
}
|
|
72
|
+
ngAfterViewInit() {
|
|
73
|
+
var _a;
|
|
74
|
+
if (((_a = this.fsAutoSelect) !== null && _a !== void 0 ? _a : true) === true) {
|
|
75
|
+
this.select();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
select() {
|
|
79
|
+
setTimeout(() => {
|
|
80
|
+
if (this._el.nativeElement.focus) {
|
|
81
|
+
this._el.nativeElement.select();
|
|
82
|
+
}
|
|
83
|
+
}, 50);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
FsAutoSelectDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAutoSelectDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
87
|
+
FsAutoSelectDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsAutoSelectDirective, selector: "[fsAutoSelect]", inputs: { fsAutoSelect: "fsAutoSelect" }, ngImport: i0 });
|
|
88
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsAutoSelectDirective, decorators: [{
|
|
89
|
+
type: Directive,
|
|
90
|
+
args: [{
|
|
91
|
+
selector: '[fsAutoSelect]',
|
|
92
|
+
}]
|
|
93
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { fsAutoSelect: [{
|
|
94
|
+
type: Input
|
|
88
95
|
}] } });
|
|
89
96
|
|
|
90
|
-
class
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
97
|
+
class FsModelChangeDirective {
|
|
98
|
+
constructor(_ngModel) {
|
|
99
|
+
this._ngModel = _ngModel;
|
|
100
|
+
this.fsModelChange = new EventEmitter();
|
|
101
|
+
this._destroy$ = new Subject();
|
|
102
|
+
}
|
|
103
|
+
ngOnInit() {
|
|
104
|
+
var _a;
|
|
105
|
+
this._ngModel.update
|
|
106
|
+
.pipe(debounceTime(((_a = this.fsModelChangeOptions) === null || _a === void 0 ? void 0 : _a.debounce) || 500), takeUntil(this._destroy$))
|
|
107
|
+
.subscribe((value) => {
|
|
108
|
+
this.fsModelChange.emit(value);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
ngOnDestroy() {
|
|
112
|
+
this._destroy$.next();
|
|
113
|
+
this._destroy$.complete();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
FsModelChangeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsModelChangeDirective, deps: [{ token: i1$1.NgModel }], target: i0.ɵɵFactoryTarget.Directive });
|
|
117
|
+
FsModelChangeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsModelChangeDirective, selector: "[fsModelChange]", inputs: { fsModelChangeOptions: "fsModelChangeOptions" }, outputs: { fsModelChange: "fsModelChange" }, ngImport: i0 });
|
|
118
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsModelChangeDirective, decorators: [{
|
|
119
|
+
type: Directive,
|
|
120
|
+
args: [{
|
|
121
|
+
selector: '[fsModelChange]',
|
|
122
|
+
}]
|
|
123
|
+
}], ctorParameters: function () { return [{ type: i1$1.NgModel }]; }, propDecorators: { fsModelChangeOptions: [{
|
|
124
|
+
type: Input
|
|
125
|
+
}], fsModelChange: [{
|
|
126
|
+
type: Output
|
|
105
127
|
}] } });
|
|
106
128
|
|
|
107
|
-
class
|
|
108
|
-
preventClick(event) {
|
|
109
|
-
event.
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type:
|
|
115
|
-
type: Directive,
|
|
116
|
-
args: [{
|
|
117
|
-
selector: '[
|
|
118
|
-
}]
|
|
119
|
-
}], propDecorators: { preventClick: [{
|
|
120
|
-
type: HostListener,
|
|
121
|
-
args: ['click', ['$event']]
|
|
129
|
+
class FsPreventDefaultDirective {
|
|
130
|
+
preventClick(event) {
|
|
131
|
+
event.preventDefault();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
FsPreventDefaultDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsPreventDefaultDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
135
|
+
FsPreventDefaultDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsPreventDefaultDirective, selector: "[fsPreventDefault]", host: { listeners: { "click": "preventClick($event)" } }, ngImport: i0 });
|
|
136
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsPreventDefaultDirective, decorators: [{
|
|
137
|
+
type: Directive,
|
|
138
|
+
args: [{
|
|
139
|
+
selector: '[fsPreventDefault]',
|
|
140
|
+
}]
|
|
141
|
+
}], propDecorators: { preventClick: [{
|
|
142
|
+
type: HostListener,
|
|
143
|
+
args: ['click', ['$event']]
|
|
122
144
|
}] } });
|
|
123
145
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function isEmpty(value, options) {
|
|
144
|
-
options = options || {};
|
|
145
|
-
return value === undefined ||
|
|
146
|
-
value === null ||
|
|
147
|
-
value === false ||
|
|
148
|
-
value === '' ||
|
|
149
|
-
String(value).length === 0 ||
|
|
150
|
-
(Array.isArray(value) && value.length === 0) ||
|
|
151
|
-
(value instanceof Object && (value.constructor.name === 'Object' && !Object.keys(value).length)) ||
|
|
152
|
-
(!options.zero && (value === 0 || value === '0'));
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function stringify(value) {
|
|
156
|
-
return JSON.stringify(value);
|
|
157
|
-
}
|
|
146
|
+
class FsStopPropagationDirective {
|
|
147
|
+
preventClick(event) {
|
|
148
|
+
event.stopPropagation();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
FsStopPropagationDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsStopPropagationDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
152
|
+
FsStopPropagationDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsStopPropagationDirective, selector: "[fsStopPropagation]", host: { listeners: { "click": "preventClick($event)" } }, ngImport: i0 });
|
|
153
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsStopPropagationDirective, decorators: [{
|
|
154
|
+
type: Directive,
|
|
155
|
+
args: [{
|
|
156
|
+
selector: '[fsStopPropagation]',
|
|
157
|
+
}]
|
|
158
|
+
}], propDecorators: { preventClick: [{
|
|
159
|
+
type: HostListener,
|
|
160
|
+
args: ['click', ['$event']]
|
|
161
|
+
}] } });
|
|
158
162
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
163
|
+
function guid(pattern, options = { case: 'lower', numbers: true }) {
|
|
164
|
+
pattern = pattern || 'xxxxxx';
|
|
165
|
+
let s = '';
|
|
166
|
+
if (options.numbers !== false) {
|
|
167
|
+
s = '0123456789';
|
|
168
|
+
}
|
|
169
|
+
if (!options.case || options.case === 'lower' || options.case === 'mixed') {
|
|
170
|
+
s = s.concat('abcdefghijklmnopqrstuvwxyz');
|
|
171
|
+
}
|
|
172
|
+
if (options.case === 'upper' || options.case === 'mixed') {
|
|
173
|
+
s = s.concat('ABCDEFGHIJKLMNOPQRSTUVWXYZ');
|
|
174
|
+
}
|
|
175
|
+
const chars = s.match(/(.{1,1})/g);
|
|
176
|
+
return pattern.replace(/[x]/g, function (c) {
|
|
177
|
+
const i = (Math.random() * chars.length) | 0;
|
|
178
|
+
return chars[i];
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function isEmpty(value, options) {
|
|
183
|
+
options = options || {};
|
|
184
|
+
return value === undefined ||
|
|
185
|
+
value === null ||
|
|
186
|
+
value === false ||
|
|
187
|
+
value === '' ||
|
|
188
|
+
String(value).length === 0 ||
|
|
189
|
+
(Array.isArray(value) && value.length === 0) ||
|
|
190
|
+
(value instanceof Object && (value.constructor.name === 'Object' && !Object.keys(value).length)) ||
|
|
191
|
+
(!options.zero && (value === 0 || value === '0'));
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function stringify(value) {
|
|
195
|
+
return JSON.stringify(value);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
class FsUtilStringifyPipe {
|
|
199
|
+
constructor() { }
|
|
200
|
+
transform(value) {
|
|
201
|
+
return stringify(value);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
FsUtilStringifyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsUtilStringifyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
205
|
+
FsUtilStringifyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsUtilStringifyPipe, name: "fsUtilStringify" });
|
|
206
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsUtilStringifyPipe, decorators: [{
|
|
207
|
+
type: Pipe,
|
|
208
|
+
args: [{
|
|
209
|
+
name: 'fsUtilStringify',
|
|
210
|
+
}]
|
|
211
|
+
}], ctorParameters: function () { return []; } });
|
|
212
|
+
class FsUtilGuidPipe {
|
|
213
|
+
constructor() { }
|
|
214
|
+
transform() {
|
|
215
|
+
return guid();
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
FsUtilGuidPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsUtilGuidPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
219
|
+
FsUtilGuidPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsUtilGuidPipe, name: "fsUtilGuid" });
|
|
220
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsUtilGuidPipe, decorators: [{
|
|
221
|
+
type: Pipe,
|
|
222
|
+
args: [{
|
|
223
|
+
name: 'fsUtilGuid',
|
|
224
|
+
}]
|
|
225
|
+
}], ctorParameters: function () { return []; } });
|
|
226
|
+
class FsUtilIsEmptyPipe {
|
|
227
|
+
transform(value) {
|
|
228
|
+
return isEmpty(value);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
FsUtilIsEmptyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsUtilIsEmptyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
232
|
+
FsUtilIsEmptyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsUtilIsEmptyPipe, name: "fsUtilIsEmpty" });
|
|
233
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsUtilIsEmptyPipe, decorators: [{
|
|
234
|
+
type: Pipe,
|
|
235
|
+
args: [{
|
|
236
|
+
name: 'fsUtilIsEmpty',
|
|
237
|
+
}]
|
|
238
|
+
}] });
|
|
239
|
+
class FsUtilIsNotEmptyPipe {
|
|
240
|
+
transform(value) {
|
|
241
|
+
return !isEmpty(value);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
FsUtilIsNotEmptyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsUtilIsNotEmptyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
245
|
+
FsUtilIsNotEmptyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsUtilIsNotEmptyPipe, name: "fsUtilIsNotEmpty" });
|
|
246
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsUtilIsNotEmptyPipe, decorators: [{
|
|
247
|
+
type: Pipe,
|
|
248
|
+
args: [{
|
|
249
|
+
name: 'fsUtilIsNotEmpty',
|
|
250
|
+
}]
|
|
212
251
|
}] });
|
|
213
252
|
|
|
214
|
-
function compare(query, item) {
|
|
215
|
-
let value = true;
|
|
216
|
-
for (const key in query) {
|
|
217
|
-
value = value && item[key] == query[key];
|
|
218
|
-
}
|
|
219
|
-
return value;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
function filter(array, query) {
|
|
223
|
-
if (typeof query !== 'function') {
|
|
224
|
-
const queryObj = query;
|
|
225
|
-
query = (item) => {
|
|
226
|
-
return compare(queryObj, item);
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
const isarray = Array.isArray(array);
|
|
230
|
-
const list = isarray ? [] : {};
|
|
231
|
-
if (isarray) {
|
|
232
|
-
array.forEach(function (item, idx) {
|
|
233
|
-
if (query(item)) {
|
|
234
|
-
list.push(item);
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
else {
|
|
239
|
-
Object.keys(array).forEach(key => {
|
|
240
|
-
if (query(array[key])) {
|
|
241
|
-
list[key] = array[key];
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
return list;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
function inArray(values, array) {
|
|
249
|
-
if (!Array.isArray(values)) {
|
|
250
|
-
values = [values];
|
|
251
|
-
}
|
|
252
|
-
for (let i = 0, len = values.length; i < len; i++) {
|
|
253
|
-
if (array.indexOf(values[i]) >= 0) {
|
|
254
|
-
return true;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
return false;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
function index(array, name, value = null) {
|
|
261
|
-
const list = {};
|
|
262
|
-
array.forEach(function (item) {
|
|
263
|
-
list[item[name]] = value ? item[value] : item;
|
|
264
|
-
});
|
|
265
|
-
return list;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
function indexOf(array, query) {
|
|
269
|
-
if (typeof query !== 'function') {
|
|
270
|
-
const queryObj = query;
|
|
271
|
-
query = (item) => {
|
|
272
|
-
return compare(queryObj, item);
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
for (let i = 0, len = array.length; i < len; i++) {
|
|
276
|
-
if (query(array[i])) {
|
|
277
|
-
return i;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
return -1;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
function keyExists(array, key) {
|
|
284
|
-
return array.hasOwnProperty(key);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
function ksort(unordered) {
|
|
288
|
-
Object.keys(unordered).sort().forEach(function (key) {
|
|
289
|
-
const value = unordered[key];
|
|
290
|
-
delete unordered[key];
|
|
291
|
-
unordered[key] = value;
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
function list(array, property, index = null) {
|
|
296
|
-
const resultList = index ? {} : [];
|
|
297
|
-
array.forEach(function (item, idx) {
|
|
298
|
-
if (index) {
|
|
299
|
-
resultList[item[index]] = item[property];
|
|
300
|
-
}
|
|
301
|
-
else {
|
|
302
|
-
resultList.push(item[property]);
|
|
303
|
-
}
|
|
304
|
-
});
|
|
305
|
-
return resultList;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
function nameValue(array, name, value) {
|
|
309
|
-
const list = [];
|
|
310
|
-
if (name || value) {
|
|
311
|
-
const nameFn = typeof name === 'function' ? name : function (item) {
|
|
312
|
-
return item[name];
|
|
313
|
-
};
|
|
314
|
-
const valueFn = typeof value === 'function' ? value : function (item) {
|
|
315
|
-
return item[value];
|
|
316
|
-
};
|
|
317
|
-
array.forEach(function (item) {
|
|
318
|
-
list.push({ name: nameFn(item), value: valueFn(item) });
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
else {
|
|
322
|
-
array.forEach(function (n, v) {
|
|
323
|
-
list.push({ name: n, value: v });
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
return list;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
function remove(array, query) {
|
|
330
|
-
const idx = indexOf(array, query);
|
|
331
|
-
if (idx >= 0) {
|
|
332
|
-
return array.splice(idx, 1);
|
|
333
|
-
}
|
|
334
|
-
return idx;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
function sort(array, query, reverse = false) {
|
|
338
|
-
if (typeof query !== 'function') {
|
|
339
|
-
const queryStr = query;
|
|
340
|
-
query = function (a, b) {
|
|
341
|
-
if (reverse) {
|
|
342
|
-
if (a[queryStr] < b[queryStr]) {
|
|
343
|
-
return 1;
|
|
344
|
-
}
|
|
345
|
-
else if (a[queryStr] > b[queryStr]) {
|
|
346
|
-
return -1;
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
else {
|
|
350
|
-
if (a[queryStr] > b[queryStr]) {
|
|
351
|
-
return 1;
|
|
352
|
-
}
|
|
353
|
-
else if (a[queryStr] < b[queryStr]) {
|
|
354
|
-
return -1;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
return 0;
|
|
358
|
-
};
|
|
359
|
-
}
|
|
360
|
-
array.sort(query);
|
|
361
|
-
return array;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
function rsort(array, query) {
|
|
365
|
-
return sort(array, query, true);
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
function find(array, query) {
|
|
369
|
-
const data = filter(array, query);
|
|
370
|
-
return data.length ? data[0] : null;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
function boolean(value) {
|
|
374
|
-
return String(value).toLowerCase() !== 'false' && !!value;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
function clone(obj) {
|
|
378
|
-
if (obj instanceof Date) {
|
|
379
|
-
return new Date(obj);
|
|
380
|
-
}
|
|
381
|
-
else if (Array.isArray(obj)) {
|
|
382
|
-
const arr = [];
|
|
383
|
-
for (let i = 0; i < obj.length; i++) {
|
|
384
|
-
arr[i] = clone(obj[i]);
|
|
385
|
-
}
|
|
386
|
-
return arr;
|
|
387
|
-
}
|
|
388
|
-
else if (typeof (obj) === 'object') {
|
|
389
|
-
const cloned = {};
|
|
390
|
-
for (let key in obj) {
|
|
391
|
-
cloned[key] = clone(obj[key]);
|
|
392
|
-
}
|
|
393
|
-
return cloned;
|
|
394
|
-
}
|
|
395
|
-
return obj;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
function debounce(func, wait, immediate) {
|
|
399
|
-
let timeout;
|
|
400
|
-
return function () {
|
|
401
|
-
const context = this, args = arguments;
|
|
402
|
-
const later = function () {
|
|
403
|
-
timeout = null;
|
|
404
|
-
if (!immediate)
|
|
405
|
-
func.apply(context, args);
|
|
406
|
-
};
|
|
407
|
-
const callNow = immediate && !timeout;
|
|
408
|
-
clearTimeout(timeout);
|
|
409
|
-
timeout = setTimeout(later, wait);
|
|
410
|
-
if (callNow)
|
|
411
|
-
func.apply(context, args);
|
|
412
|
-
};
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
function removeQueryParams(path) {
|
|
416
|
-
return path.split('?')[0];
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
function getNormalizedPath(locationSrv) {
|
|
420
|
-
const path = locationSrv.prepareExternalUrl(locationSrv.path());
|
|
421
|
-
return removeQueryParams(path);
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
function isArrayEqual(arr1, arr2) {
|
|
425
|
-
if (!Array.isArray(arr1) || !Array.isArray(arr2) || arr1.length !== arr2.length) {
|
|
426
|
-
return false;
|
|
427
|
-
}
|
|
428
|
-
const sortFn = (a, b) => {
|
|
429
|
-
if (a < b) {
|
|
430
|
-
return -1;
|
|
431
|
-
}
|
|
432
|
-
else if (a > b) {
|
|
433
|
-
return 1;
|
|
434
|
-
}
|
|
435
|
-
else {
|
|
436
|
-
return 0;
|
|
437
|
-
}
|
|
438
|
-
};
|
|
439
|
-
arr1 = [...arr1].sort(sortFn);
|
|
440
|
-
arr2 = [...arr2].sort(sortFn);
|
|
441
|
-
return arr1.every((value, index) => {
|
|
442
|
-
return value === arr2[index];
|
|
443
|
-
});
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
function isClass(value, cls) {
|
|
447
|
-
if (typeof value === 'object') {
|
|
448
|
-
if (typeof cls === 'string') {
|
|
449
|
-
if (value.constructor) {
|
|
450
|
-
if (value.constructor.name === cls) {
|
|
451
|
-
return true;
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
else {
|
|
456
|
-
if (value instanceof cls) {
|
|
457
|
-
return true;
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
return false;
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
function isNumeric(value) {
|
|
465
|
-
const str = String(value);
|
|
466
|
-
return str.length && !!str.match(/^-?\d*\.?\d*$/);
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
function isObject(value) {
|
|
470
|
-
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
const KEY_CANCEL$1 = 3;
|
|
474
|
-
const KEY_HELP$1 = 6;
|
|
475
|
-
const KEY_BACKSPACE$1 = 8;
|
|
476
|
-
const KEY_TAB$1 = 9;
|
|
477
|
-
const KEY_CLEAR$1 = 12;
|
|
478
|
-
const KEY_RETURN$1 = 13;
|
|
479
|
-
const KEY_ENTER$1 = 14;
|
|
480
|
-
const KEY_SHIFT$1 = 16;
|
|
481
|
-
const KEY_CONTROL$1 = 17;
|
|
482
|
-
const KEY_ALT$1 = 18;
|
|
483
|
-
const KEY_PAUSE$1 = 19;
|
|
484
|
-
const KEY_CAPS_LOCK$1 = 20;
|
|
485
|
-
const KEY_ESCAPE$1 = 27;
|
|
486
|
-
const KEY_SPACE$1 = 32;
|
|
487
|
-
const KEY_PAGE_UP$1 = 33;
|
|
488
|
-
const KEY_PAGE_DOWN$1 = 34;
|
|
489
|
-
const KEY_END$1 = 35;
|
|
490
|
-
const KEY_HOME$1 = 36;
|
|
491
|
-
const KEY_LEFT$1 = 37;
|
|
492
|
-
const KEY_UP$1 = 38;
|
|
493
|
-
const KEY_RIGHT$1 = 39;
|
|
494
|
-
const KEY_DOWN$1 = 40;
|
|
495
|
-
const KEY_PRINTSCREEN$1 = 44;
|
|
496
|
-
const KEY_INSERT$1 = 45;
|
|
497
|
-
const KEY_DELETE$1 = 46;
|
|
498
|
-
const KEY_0$1 = 48;
|
|
499
|
-
const KEY_1$1 = 49;
|
|
500
|
-
const KEY_2$1 = 50;
|
|
501
|
-
const KEY_3$1 = 51;
|
|
502
|
-
const KEY_4$1 = 52;
|
|
503
|
-
const KEY_5$1 = 53;
|
|
504
|
-
const KEY_6$1 = 54;
|
|
505
|
-
const KEY_7$1 = 55;
|
|
506
|
-
const KEY_8$1 = 56;
|
|
507
|
-
const KEY_9$1 = 57;
|
|
508
|
-
const KEY_SEMICOLON$1 = 59;
|
|
253
|
+
function compare(query, item) {
|
|
254
|
+
let value = true;
|
|
255
|
+
for (const key in query) {
|
|
256
|
+
value = value && item[key] == query[key];
|
|
257
|
+
}
|
|
258
|
+
return value;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function filter(array, query) {
|
|
262
|
+
if (typeof query !== 'function') {
|
|
263
|
+
const queryObj = query;
|
|
264
|
+
query = (item) => {
|
|
265
|
+
return compare(queryObj, item);
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
const isarray = Array.isArray(array);
|
|
269
|
+
const list = isarray ? [] : {};
|
|
270
|
+
if (isarray) {
|
|
271
|
+
array.forEach(function (item, idx) {
|
|
272
|
+
if (query(item)) {
|
|
273
|
+
list.push(item);
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
Object.keys(array).forEach(key => {
|
|
279
|
+
if (query(array[key])) {
|
|
280
|
+
list[key] = array[key];
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
return list;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function inArray(values, array) {
|
|
288
|
+
if (!Array.isArray(values)) {
|
|
289
|
+
values = [values];
|
|
290
|
+
}
|
|
291
|
+
for (let i = 0, len = values.length; i < len; i++) {
|
|
292
|
+
if (array.indexOf(values[i]) >= 0) {
|
|
293
|
+
return true;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
return false;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function index(array, name, value = null) {
|
|
300
|
+
const list = {};
|
|
301
|
+
array.forEach(function (item) {
|
|
302
|
+
list[item[name]] = value ? item[value] : item;
|
|
303
|
+
});
|
|
304
|
+
return list;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
function indexOf(array, query) {
|
|
308
|
+
if (typeof query !== 'function') {
|
|
309
|
+
const queryObj = query;
|
|
310
|
+
query = (item) => {
|
|
311
|
+
return compare(queryObj, item);
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
for (let i = 0, len = array.length; i < len; i++) {
|
|
315
|
+
if (query(array[i])) {
|
|
316
|
+
return i;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return -1;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
function keyExists(array, key) {
|
|
323
|
+
return array.hasOwnProperty(key);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function ksort(unordered) {
|
|
327
|
+
Object.keys(unordered).sort().forEach(function (key) {
|
|
328
|
+
const value = unordered[key];
|
|
329
|
+
delete unordered[key];
|
|
330
|
+
unordered[key] = value;
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function list(array, property, index = null) {
|
|
335
|
+
const resultList = index ? {} : [];
|
|
336
|
+
array.forEach(function (item, idx) {
|
|
337
|
+
if (index) {
|
|
338
|
+
resultList[item[index]] = item[property];
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
resultList.push(item[property]);
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
return resultList;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
function nameValue(array, name, value) {
|
|
348
|
+
const list = [];
|
|
349
|
+
if (name || value) {
|
|
350
|
+
const nameFn = typeof name === 'function' ? name : function (item) {
|
|
351
|
+
return item[name];
|
|
352
|
+
};
|
|
353
|
+
const valueFn = typeof value === 'function' ? value : function (item) {
|
|
354
|
+
return item[value];
|
|
355
|
+
};
|
|
356
|
+
array.forEach(function (item) {
|
|
357
|
+
list.push({ name: nameFn(item), value: valueFn(item) });
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
array.forEach(function (n, v) {
|
|
362
|
+
list.push({ name: n, value: v });
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
return list;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
function remove(array, query) {
|
|
369
|
+
const idx = indexOf(array, query);
|
|
370
|
+
if (idx >= 0) {
|
|
371
|
+
return array.splice(idx, 1);
|
|
372
|
+
}
|
|
373
|
+
return idx;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
function sort(array, query, reverse = false) {
|
|
377
|
+
if (typeof query !== 'function') {
|
|
378
|
+
const queryStr = query;
|
|
379
|
+
query = function (a, b) {
|
|
380
|
+
if (reverse) {
|
|
381
|
+
if (a[queryStr] < b[queryStr]) {
|
|
382
|
+
return 1;
|
|
383
|
+
}
|
|
384
|
+
else if (a[queryStr] > b[queryStr]) {
|
|
385
|
+
return -1;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
if (a[queryStr] > b[queryStr]) {
|
|
390
|
+
return 1;
|
|
391
|
+
}
|
|
392
|
+
else if (a[queryStr] < b[queryStr]) {
|
|
393
|
+
return -1;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
return 0;
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
array.sort(query);
|
|
400
|
+
return array;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
function rsort(array, query) {
|
|
404
|
+
return sort(array, query, true);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
function find(array, query) {
|
|
408
|
+
const data = filter(array, query);
|
|
409
|
+
return data.length ? data[0] : null;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
function boolean(value) {
|
|
413
|
+
return String(value).toLowerCase() !== 'false' && !!value;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
function clone(obj) {
|
|
417
|
+
if (obj instanceof Date) {
|
|
418
|
+
return new Date(obj);
|
|
419
|
+
}
|
|
420
|
+
else if (Array.isArray(obj)) {
|
|
421
|
+
const arr = [];
|
|
422
|
+
for (let i = 0; i < obj.length; i++) {
|
|
423
|
+
arr[i] = clone(obj[i]);
|
|
424
|
+
}
|
|
425
|
+
return arr;
|
|
426
|
+
}
|
|
427
|
+
else if (typeof (obj) === 'object') {
|
|
428
|
+
const cloned = {};
|
|
429
|
+
for (let key in obj) {
|
|
430
|
+
cloned[key] = clone(obj[key]);
|
|
431
|
+
}
|
|
432
|
+
return cloned;
|
|
433
|
+
}
|
|
434
|
+
return obj;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
function debounce(func, wait, immediate) {
|
|
438
|
+
let timeout;
|
|
439
|
+
return function () {
|
|
440
|
+
const context = this, args = arguments;
|
|
441
|
+
const later = function () {
|
|
442
|
+
timeout = null;
|
|
443
|
+
if (!immediate)
|
|
444
|
+
func.apply(context, args);
|
|
445
|
+
};
|
|
446
|
+
const callNow = immediate && !timeout;
|
|
447
|
+
clearTimeout(timeout);
|
|
448
|
+
timeout = setTimeout(later, wait);
|
|
449
|
+
if (callNow)
|
|
450
|
+
func.apply(context, args);
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
function removeQueryParams(path) {
|
|
455
|
+
return path.split('?')[0];
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
function getNormalizedPath(locationSrv) {
|
|
459
|
+
const path = locationSrv.prepareExternalUrl(locationSrv.path());
|
|
460
|
+
return removeQueryParams(path);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
function isArrayEqual(arr1, arr2) {
|
|
464
|
+
if (!Array.isArray(arr1) || !Array.isArray(arr2) || arr1.length !== arr2.length) {
|
|
465
|
+
return false;
|
|
466
|
+
}
|
|
467
|
+
const sortFn = (a, b) => {
|
|
468
|
+
if (a < b) {
|
|
469
|
+
return -1;
|
|
470
|
+
}
|
|
471
|
+
else if (a > b) {
|
|
472
|
+
return 1;
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
475
|
+
return 0;
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
arr1 = [...arr1].sort(sortFn);
|
|
479
|
+
arr2 = [...arr2].sort(sortFn);
|
|
480
|
+
return arr1.every((value, index) => {
|
|
481
|
+
return value === arr2[index];
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
function isClass(value, cls) {
|
|
486
|
+
if (typeof value === 'object') {
|
|
487
|
+
if (typeof cls === 'string') {
|
|
488
|
+
if (value.constructor) {
|
|
489
|
+
if (value.constructor.name === cls) {
|
|
490
|
+
return true;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
if (value instanceof cls) {
|
|
496
|
+
return true;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
return false;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
function isNumeric(value) {
|
|
504
|
+
const str = String(value);
|
|
505
|
+
return str.length && !!str.match(/^-?\d*\.?\d*$/);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
function isObject(value) {
|
|
509
|
+
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
const KEY_CANCEL$1 = 3;
|
|
513
|
+
const KEY_HELP$1 = 6;
|
|
514
|
+
const KEY_BACKSPACE$1 = 8;
|
|
515
|
+
const KEY_TAB$1 = 9;
|
|
516
|
+
const KEY_CLEAR$1 = 12;
|
|
517
|
+
const KEY_RETURN$1 = 13;
|
|
518
|
+
const KEY_ENTER$1 = 14;
|
|
519
|
+
const KEY_SHIFT$1 = 16;
|
|
520
|
+
const KEY_CONTROL$1 = 17;
|
|
521
|
+
const KEY_ALT$1 = 18;
|
|
522
|
+
const KEY_PAUSE$1 = 19;
|
|
523
|
+
const KEY_CAPS_LOCK$1 = 20;
|
|
524
|
+
const KEY_ESCAPE$1 = 27;
|
|
525
|
+
const KEY_SPACE$1 = 32;
|
|
526
|
+
const KEY_PAGE_UP$1 = 33;
|
|
527
|
+
const KEY_PAGE_DOWN$1 = 34;
|
|
528
|
+
const KEY_END$1 = 35;
|
|
529
|
+
const KEY_HOME$1 = 36;
|
|
530
|
+
const KEY_LEFT$1 = 37;
|
|
531
|
+
const KEY_UP$1 = 38;
|
|
532
|
+
const KEY_RIGHT$1 = 39;
|
|
533
|
+
const KEY_DOWN$1 = 40;
|
|
534
|
+
const KEY_PRINTSCREEN$1 = 44;
|
|
535
|
+
const KEY_INSERT$1 = 45;
|
|
536
|
+
const KEY_DELETE$1 = 46;
|
|
537
|
+
const KEY_0$1 = 48;
|
|
538
|
+
const KEY_1$1 = 49;
|
|
539
|
+
const KEY_2$1 = 50;
|
|
540
|
+
const KEY_3$1 = 51;
|
|
541
|
+
const KEY_4$1 = 52;
|
|
542
|
+
const KEY_5$1 = 53;
|
|
543
|
+
const KEY_6$1 = 54;
|
|
544
|
+
const KEY_7$1 = 55;
|
|
545
|
+
const KEY_8$1 = 56;
|
|
546
|
+
const KEY_9$1 = 57;
|
|
547
|
+
const KEY_SEMICOLON$1 = 59;
|
|
509
548
|
const KEY_EQUALS$1 = 61;
|
|
510
549
|
|
|
511
|
-
function length(object) {
|
|
512
|
-
if (Array.isArray(object)) {
|
|
513
|
-
return object.length;
|
|
514
|
-
}
|
|
515
|
-
if (object instanceof Object) {
|
|
516
|
-
return Object.keys(object).length;
|
|
517
|
-
}
|
|
518
|
-
return 0;
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
function ordinalNumber(value) {
|
|
522
|
-
value = String(value);
|
|
523
|
-
const index = value.match `1?.$`;
|
|
524
|
-
const endings = [, 'st', 'nd', 'rd'];
|
|
525
|
-
const ending = endings[index] || 'th';
|
|
526
|
-
return value + ending;
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
class Operation {
|
|
530
|
-
constructor(target, name) {
|
|
531
|
-
this.ready$ = new Subject();
|
|
532
|
-
this.name = name ? name : guid();
|
|
533
|
-
if (target instanceof Observable) {
|
|
534
|
-
this.target = target;
|
|
535
|
-
}
|
|
536
|
-
else {
|
|
537
|
-
this.target = of(target);
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
var QueueState;
|
|
543
|
-
(function (QueueState) {
|
|
544
|
-
QueueState["Idle"] = "idle";
|
|
545
|
-
QueueState["Processing"] = "processing";
|
|
550
|
+
function length(object) {
|
|
551
|
+
if (Array.isArray(object)) {
|
|
552
|
+
return object.length;
|
|
553
|
+
}
|
|
554
|
+
if (object instanceof Object) {
|
|
555
|
+
return Object.keys(object).length;
|
|
556
|
+
}
|
|
557
|
+
return 0;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
function ordinalNumber(value) {
|
|
561
|
+
value = String(value);
|
|
562
|
+
const index = value.match `1?.$`;
|
|
563
|
+
const endings = [, 'st', 'nd', 'rd'];
|
|
564
|
+
const ending = endings[index] || 'th';
|
|
565
|
+
return value + ending;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
class Operation {
|
|
569
|
+
constructor(target, name) {
|
|
570
|
+
this.ready$ = new Subject();
|
|
571
|
+
this.name = name ? name : guid();
|
|
572
|
+
if (target instanceof Observable) {
|
|
573
|
+
this.target = target;
|
|
574
|
+
}
|
|
575
|
+
else {
|
|
576
|
+
this.target = of(target);
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
var QueueState;
|
|
582
|
+
(function (QueueState) {
|
|
583
|
+
QueueState["Idle"] = "idle";
|
|
584
|
+
QueueState["Processing"] = "processing";
|
|
546
585
|
})(QueueState || (QueueState = {}));
|
|
547
586
|
|
|
548
|
-
class Queue {
|
|
549
|
-
constructor(_limit = Infinity) {
|
|
550
|
-
this._limit = _limit;
|
|
551
|
-
this._queueStats = {
|
|
552
|
-
completed: 0,
|
|
553
|
-
total: 0,
|
|
554
|
-
errors: [],
|
|
555
|
-
};
|
|
556
|
-
this._doneQueueStats = {
|
|
557
|
-
completed: 0,
|
|
558
|
-
total: 0,
|
|
559
|
-
errors: [],
|
|
560
|
-
};
|
|
561
|
-
this._completeQueueStats = {
|
|
562
|
-
completed: 0,
|
|
563
|
-
total: 0,
|
|
564
|
-
errors: [],
|
|
565
|
-
};
|
|
566
|
-
this._done = new Subject();
|
|
567
|
-
this._queue = [];
|
|
568
|
-
this._inProgress = [];
|
|
569
|
-
this._state = QueueState.Idle;
|
|
570
|
-
this._destroy$ = new Subject();
|
|
571
|
-
// if(_targets) {
|
|
572
|
-
// _targets.forEach((target) => {
|
|
573
|
-
// this.push(target);
|
|
574
|
-
// });
|
|
575
|
-
// }
|
|
576
|
-
}
|
|
577
|
-
get total() {
|
|
578
|
-
return this._queueStats.total;
|
|
579
|
-
}
|
|
580
|
-
get completed() {
|
|
581
|
-
return this._queueStats.completed;
|
|
582
|
-
}
|
|
583
|
-
get pending() {
|
|
584
|
-
return this._queue.length;
|
|
585
|
-
}
|
|
586
|
-
get inProgress() {
|
|
587
|
-
return this._inProgress.length;
|
|
588
|
-
}
|
|
589
|
-
get errors() {
|
|
590
|
-
return this._queueStats.errors;
|
|
591
|
-
}
|
|
592
|
-
get state() {
|
|
593
|
-
return this._state;
|
|
594
|
-
}
|
|
595
|
-
get empty() {
|
|
596
|
-
return !this._queue.length && !this._inProgress.length;
|
|
597
|
-
}
|
|
598
|
-
get pendingOperations() {
|
|
599
|
-
return this._queue
|
|
600
|
-
.map((operation) => operation.name);
|
|
601
|
-
}
|
|
602
|
-
get inProgressOperations() {
|
|
603
|
-
return this._inProgress
|
|
604
|
-
.map((operation) => operation.name);
|
|
605
|
-
}
|
|
606
|
-
isProcessing() {
|
|
607
|
-
return this._state === QueueState.Processing;
|
|
608
|
-
}
|
|
609
|
-
isIdle() {
|
|
610
|
-
return this._state === QueueState.Idle;
|
|
611
|
-
}
|
|
612
|
-
setLimit(value) {
|
|
613
|
-
this._limit = value;
|
|
614
|
-
}
|
|
615
|
-
/**
|
|
616
|
-
* @depreated
|
|
617
|
-
*/
|
|
618
|
-
subscribe(fun, err, complete) {
|
|
619
|
-
this.observe$
|
|
620
|
-
.subscribe(fun, err, complete);
|
|
621
|
-
}
|
|
622
|
-
get observe$() {
|
|
623
|
-
return this._done
|
|
624
|
-
.pipe(takeUntil(this._destroy$));
|
|
625
|
-
}
|
|
626
|
-
get complete$() {
|
|
627
|
-
if (!this.isProcessing()) {
|
|
628
|
-
return of({ total: 0, completed: 0, errors: [] });
|
|
629
|
-
}
|
|
630
|
-
return this.observe$
|
|
631
|
-
.pipe(take(1), map(() => (this._completeQueueStats)));
|
|
632
|
-
}
|
|
633
|
-
complete(fun, err, complete) {
|
|
634
|
-
this.complete$.subscribe(fun, err, complete);
|
|
635
|
-
}
|
|
636
|
-
push(target, name) {
|
|
637
|
-
const operation = new Operation(target, name);
|
|
638
|
-
this._queueStats.total++;
|
|
639
|
-
this._doneQueueStats.total++;
|
|
640
|
-
this._completeQueueStats.total++;
|
|
641
|
-
this._state = QueueState.Processing;
|
|
642
|
-
if (this._inProgress.length < this._limit) {
|
|
643
|
-
this._processOperation(operation);
|
|
644
|
-
}
|
|
645
|
-
else {
|
|
646
|
-
this._queue.push(operation);
|
|
647
|
-
}
|
|
648
|
-
return operation.ready$;
|
|
649
|
-
}
|
|
650
|
-
clear() {
|
|
651
|
-
this._queue = [];
|
|
652
|
-
this._state = QueueState.Idle;
|
|
653
|
-
this._queueStats = {
|
|
654
|
-
total: 0,
|
|
655
|
-
errors: [],
|
|
656
|
-
completed: 0,
|
|
657
|
-
};
|
|
658
|
-
this._clearDoneQueueStats();
|
|
659
|
-
}
|
|
660
|
-
destroy() {
|
|
661
|
-
this._done.complete();
|
|
662
|
-
this.clear();
|
|
663
|
-
}
|
|
664
|
-
_processOperation(operation) {
|
|
665
|
-
this._inProgress.push(operation);
|
|
666
|
-
operation.target
|
|
667
|
-
.pipe(delay(200), // Hack to prevent extra quick proccess execution
|
|
668
|
-
finalize(() => {
|
|
669
|
-
const opIndex = this._inProgress.indexOf(operation);
|
|
670
|
-
this._inProgress.splice(opIndex, 1);
|
|
671
|
-
if (this.empty) {
|
|
672
|
-
this._state = QueueState.Idle;
|
|
673
|
-
this._done.next(this._doneQueueStats);
|
|
674
|
-
this._clearDoneQueueStats();
|
|
675
|
-
}
|
|
676
|
-
else {
|
|
677
|
-
if (this._queue.length) {
|
|
678
|
-
const queueItem = this._queue.shift();
|
|
679
|
-
this._processOperation(queueItem);
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
}), takeUntil(this._destroy$)).subscribe({
|
|
683
|
-
next: (data) => {
|
|
684
|
-
operation.ready$.next(data);
|
|
685
|
-
},
|
|
686
|
-
error: (error) => {
|
|
687
|
-
this._queueStats.errors.push(error);
|
|
688
|
-
this._doneQueueStats.errors.push(error);
|
|
689
|
-
this._completeQueueStats.errors.push(error);
|
|
690
|
-
operation.ready$.error(error);
|
|
691
|
-
},
|
|
692
|
-
complete: () => {
|
|
693
|
-
this._queueStats.completed++;
|
|
694
|
-
this._doneQueueStats.completed++;
|
|
695
|
-
this._completeQueueStats.completed++;
|
|
696
|
-
operation.ready$.complete();
|
|
697
|
-
}
|
|
698
|
-
});
|
|
699
|
-
}
|
|
700
|
-
_clearDoneQueueStats() {
|
|
701
|
-
this._doneQueueStats = {
|
|
702
|
-
total: 0,
|
|
703
|
-
errors: [],
|
|
704
|
-
completed: 0,
|
|
705
|
-
};
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
function resolve(promise, defaults = []) {
|
|
710
|
-
const result = defaults;
|
|
711
|
-
return new Promise(resolve => {
|
|
712
|
-
promise.then(function (data) {
|
|
713
|
-
Object.keys(data).forEach(key => result[key] = data[key]);
|
|
714
|
-
resolve(result);
|
|
715
|
-
});
|
|
716
|
-
});
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
function round(num, decimalPlaces = 0) {
|
|
720
|
-
num = parseFloat(parseFloat(num).toPrecision(Number.MAX_SAFE_INTEGER.toString().length - 1));
|
|
721
|
-
const p = Math.pow(10, decimalPlaces);
|
|
722
|
-
return Math.round(num * p) / p;
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
const fsSourceLoader = (function () {
|
|
726
|
-
let _document;
|
|
727
|
-
let _headElement;
|
|
728
|
-
const _sources = new Map();
|
|
729
|
-
const _loadedResources = new Map();
|
|
730
|
-
// bad way but don't want to bother developer
|
|
731
|
-
setDocument(document);
|
|
732
|
-
// but developer can set document at any time
|
|
733
|
-
function setDocument(document) {
|
|
734
|
-
_document = document;
|
|
735
|
-
_headElement = _document === null || _document === void 0 ? void 0 : _document.head;
|
|
736
|
-
}
|
|
737
|
-
/**
|
|
738
|
-
* register a list of the resources for future loading
|
|
739
|
-
*
|
|
740
|
-
* example:
|
|
741
|
-
* sourceLoader.registerResources({
|
|
742
|
-
* froala: [
|
|
743
|
-
* '/assets/js/froala/froala_editor.min.js',
|
|
744
|
-
* '/assets/css/froala_editor.pkgd.min.css',
|
|
745
|
-
* ],
|
|
746
|
-
* froala_align: '/assets/js/froala/plugins/align.min.js',
|
|
747
|
-
* froala_colors: '/assets/js/froala/plugins/colors.min.js',
|
|
748
|
-
* froala_image: '/assets/js/froala/plugins/image.min.js',
|
|
749
|
-
* });
|
|
750
|
-
*
|
|
751
|
-
*/
|
|
752
|
-
function registerResources(resources) {
|
|
753
|
-
Object.entries(resources)
|
|
754
|
-
.forEach(([name, path]) => {
|
|
755
|
-
if (typeof path === 'string') {
|
|
756
|
-
path = [path];
|
|
757
|
-
}
|
|
758
|
-
if (!_sources.has(name)) {
|
|
759
|
-
_sources.set(name, new Set());
|
|
760
|
-
}
|
|
761
|
-
const resourcesList = _sources.get(name);
|
|
762
|
-
path.forEach((p) => {
|
|
763
|
-
resourcesList.add(p);
|
|
764
|
-
});
|
|
765
|
-
});
|
|
766
|
-
}
|
|
767
|
-
/**
|
|
768
|
-
* load any resource previously registered
|
|
769
|
-
*
|
|
770
|
-
* sourceLoader.loadResource('froala')
|
|
771
|
-
*
|
|
772
|
-
* or load any js/css file
|
|
773
|
-
*
|
|
774
|
-
* sourceLoader.loadResource('/assets/my-source.js')
|
|
775
|
-
*
|
|
776
|
-
*/
|
|
777
|
-
function loadResource(name) {
|
|
778
|
-
if (_loadedResources.has(name)) {
|
|
779
|
-
return _loadedResources.get(name);
|
|
780
|
-
}
|
|
781
|
-
if (_sources.has(name)) {
|
|
782
|
-
const sourcesForLoading = [..._sources.get(name)]
|
|
783
|
-
.map((path) => {
|
|
784
|
-
return _loadResource(path);
|
|
785
|
-
})
|
|
786
|
-
.filter((v) => !!v);
|
|
787
|
-
return combineLatest(sourcesForLoading);
|
|
788
|
-
}
|
|
789
|
-
return _loadResource(name);
|
|
790
|
-
}
|
|
791
|
-
/**
|
|
792
|
-
* the same as `loadResource` but you can pass list of the resources for loading
|
|
793
|
-
*/
|
|
794
|
-
function loadResources(listOfResources) {
|
|
795
|
-
const resourcesToLoad = listOfResources
|
|
796
|
-
.reduce((acc, name) => {
|
|
797
|
-
const loading$ = loadResource(name);
|
|
798
|
-
if (loading$) {
|
|
799
|
-
acc.push(loading$);
|
|
800
|
-
}
|
|
801
|
-
return acc;
|
|
802
|
-
}, []);
|
|
803
|
-
return combineLatest(resourcesToLoad);
|
|
804
|
-
}
|
|
805
|
-
///
|
|
806
|
-
function _loadResource(path) {
|
|
807
|
-
if (_isStylesUrl(path)) {
|
|
808
|
-
return _loadStyles(path);
|
|
809
|
-
}
|
|
810
|
-
if (_isJavascriptUrl(path)) {
|
|
811
|
-
return _loadJs(path);
|
|
812
|
-
}
|
|
813
|
-
console.warn(`Resource ${path} can not be identified and loaded`);
|
|
814
|
-
return null;
|
|
815
|
-
}
|
|
816
|
-
function _loadJs(scriptPath) {
|
|
817
|
-
if (!_loadedResources.has(scriptPath)) {
|
|
818
|
-
const obs$ = new Observable((obs) => {
|
|
819
|
-
const script = document.createElement('script');
|
|
820
|
-
script.src = scriptPath;
|
|
821
|
-
_headElement.appendChild(script);
|
|
822
|
-
script.onload = () => {
|
|
823
|
-
obs.next();
|
|
824
|
-
obs.complete();
|
|
825
|
-
};
|
|
826
|
-
script.onerror = (err) => {
|
|
827
|
-
obs.error(err);
|
|
828
|
-
};
|
|
829
|
-
}).pipe(shareReplay(1));
|
|
830
|
-
_loadedResources.set(scriptPath, obs$);
|
|
831
|
-
}
|
|
832
|
-
return _loadedResources.get(scriptPath);
|
|
833
|
-
}
|
|
834
|
-
function _loadStyles(stylePath) {
|
|
835
|
-
if (!_loadedResources.has(stylePath)) {
|
|
836
|
-
const obs$ = new Observable((obs) => {
|
|
837
|
-
const style = document.createElement('link');
|
|
838
|
-
style.id = stylePath;
|
|
839
|
-
style.rel = 'stylesheet';
|
|
840
|
-
style.href = `${stylePath}`;
|
|
841
|
-
_headElement.appendChild(style);
|
|
842
|
-
style.onload = () => {
|
|
843
|
-
obs.next();
|
|
844
|
-
obs.complete();
|
|
845
|
-
};
|
|
846
|
-
style.onerror = (err) => {
|
|
847
|
-
obs.error(err);
|
|
848
|
-
};
|
|
849
|
-
});
|
|
850
|
-
_loadedResources.set(stylePath, obs$);
|
|
851
|
-
}
|
|
852
|
-
return _loadedResources.get(stylePath);
|
|
853
|
-
}
|
|
854
|
-
function _isJavascriptUrl(url) {
|
|
855
|
-
return url.endsWith('.js');
|
|
856
|
-
}
|
|
857
|
-
function _isStylesUrl(url) {
|
|
858
|
-
return url.endsWith('.css');
|
|
859
|
-
}
|
|
860
|
-
return {
|
|
861
|
-
setDocument,
|
|
862
|
-
registerResources,
|
|
863
|
-
loadResource,
|
|
864
|
-
loadResources,
|
|
865
|
-
loadJs: _loadJs,
|
|
866
|
-
loadStyles: _loadStyles,
|
|
867
|
-
};
|
|
868
|
-
})();
|
|
869
|
-
function loadStyles(path) {
|
|
870
|
-
return fsSourceLoader.loadStyles(path);
|
|
871
|
-
}
|
|
587
|
+
class Queue {
|
|
588
|
+
constructor(_limit = Infinity) {
|
|
589
|
+
this._limit = _limit;
|
|
590
|
+
this._queueStats = {
|
|
591
|
+
completed: 0,
|
|
592
|
+
total: 0,
|
|
593
|
+
errors: [],
|
|
594
|
+
};
|
|
595
|
+
this._doneQueueStats = {
|
|
596
|
+
completed: 0,
|
|
597
|
+
total: 0,
|
|
598
|
+
errors: [],
|
|
599
|
+
};
|
|
600
|
+
this._completeQueueStats = {
|
|
601
|
+
completed: 0,
|
|
602
|
+
total: 0,
|
|
603
|
+
errors: [],
|
|
604
|
+
};
|
|
605
|
+
this._done = new Subject();
|
|
606
|
+
this._queue = [];
|
|
607
|
+
this._inProgress = [];
|
|
608
|
+
this._state = QueueState.Idle;
|
|
609
|
+
this._destroy$ = new Subject();
|
|
610
|
+
// if(_targets) {
|
|
611
|
+
// _targets.forEach((target) => {
|
|
612
|
+
// this.push(target);
|
|
613
|
+
// });
|
|
614
|
+
// }
|
|
615
|
+
}
|
|
616
|
+
get total() {
|
|
617
|
+
return this._queueStats.total;
|
|
618
|
+
}
|
|
619
|
+
get completed() {
|
|
620
|
+
return this._queueStats.completed;
|
|
621
|
+
}
|
|
622
|
+
get pending() {
|
|
623
|
+
return this._queue.length;
|
|
624
|
+
}
|
|
625
|
+
get inProgress() {
|
|
626
|
+
return this._inProgress.length;
|
|
627
|
+
}
|
|
628
|
+
get errors() {
|
|
629
|
+
return this._queueStats.errors;
|
|
630
|
+
}
|
|
631
|
+
get state() {
|
|
632
|
+
return this._state;
|
|
633
|
+
}
|
|
634
|
+
get empty() {
|
|
635
|
+
return !this._queue.length && !this._inProgress.length;
|
|
636
|
+
}
|
|
637
|
+
get pendingOperations() {
|
|
638
|
+
return this._queue
|
|
639
|
+
.map((operation) => operation.name);
|
|
640
|
+
}
|
|
641
|
+
get inProgressOperations() {
|
|
642
|
+
return this._inProgress
|
|
643
|
+
.map((operation) => operation.name);
|
|
644
|
+
}
|
|
645
|
+
isProcessing() {
|
|
646
|
+
return this._state === QueueState.Processing;
|
|
647
|
+
}
|
|
648
|
+
isIdle() {
|
|
649
|
+
return this._state === QueueState.Idle;
|
|
650
|
+
}
|
|
651
|
+
setLimit(value) {
|
|
652
|
+
this._limit = value;
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* @depreated
|
|
656
|
+
*/
|
|
657
|
+
subscribe(fun, err, complete) {
|
|
658
|
+
this.observe$
|
|
659
|
+
.subscribe(fun, err, complete);
|
|
660
|
+
}
|
|
661
|
+
get observe$() {
|
|
662
|
+
return this._done
|
|
663
|
+
.pipe(takeUntil(this._destroy$));
|
|
664
|
+
}
|
|
665
|
+
get complete$() {
|
|
666
|
+
if (!this.isProcessing()) {
|
|
667
|
+
return of({ total: 0, completed: 0, errors: [] });
|
|
668
|
+
}
|
|
669
|
+
return this.observe$
|
|
670
|
+
.pipe(take(1), map(() => (this._completeQueueStats)));
|
|
671
|
+
}
|
|
672
|
+
complete(fun, err, complete) {
|
|
673
|
+
this.complete$.subscribe(fun, err, complete);
|
|
674
|
+
}
|
|
675
|
+
push(target, name) {
|
|
676
|
+
const operation = new Operation(target, name);
|
|
677
|
+
this._queueStats.total++;
|
|
678
|
+
this._doneQueueStats.total++;
|
|
679
|
+
this._completeQueueStats.total++;
|
|
680
|
+
this._state = QueueState.Processing;
|
|
681
|
+
if (this._inProgress.length < this._limit) {
|
|
682
|
+
this._processOperation(operation);
|
|
683
|
+
}
|
|
684
|
+
else {
|
|
685
|
+
this._queue.push(operation);
|
|
686
|
+
}
|
|
687
|
+
return operation.ready$;
|
|
688
|
+
}
|
|
689
|
+
clear() {
|
|
690
|
+
this._queue = [];
|
|
691
|
+
this._state = QueueState.Idle;
|
|
692
|
+
this._queueStats = {
|
|
693
|
+
total: 0,
|
|
694
|
+
errors: [],
|
|
695
|
+
completed: 0,
|
|
696
|
+
};
|
|
697
|
+
this._clearDoneQueueStats();
|
|
698
|
+
}
|
|
699
|
+
destroy() {
|
|
700
|
+
this._done.complete();
|
|
701
|
+
this.clear();
|
|
702
|
+
}
|
|
703
|
+
_processOperation(operation) {
|
|
704
|
+
this._inProgress.push(operation);
|
|
705
|
+
operation.target
|
|
706
|
+
.pipe(delay(200), // Hack to prevent extra quick proccess execution
|
|
707
|
+
finalize(() => {
|
|
708
|
+
const opIndex = this._inProgress.indexOf(operation);
|
|
709
|
+
this._inProgress.splice(opIndex, 1);
|
|
710
|
+
if (this.empty) {
|
|
711
|
+
this._state = QueueState.Idle;
|
|
712
|
+
this._done.next(this._doneQueueStats);
|
|
713
|
+
this._clearDoneQueueStats();
|
|
714
|
+
}
|
|
715
|
+
else {
|
|
716
|
+
if (this._queue.length) {
|
|
717
|
+
const queueItem = this._queue.shift();
|
|
718
|
+
this._processOperation(queueItem);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
}), takeUntil(this._destroy$)).subscribe({
|
|
722
|
+
next: (data) => {
|
|
723
|
+
operation.ready$.next(data);
|
|
724
|
+
},
|
|
725
|
+
error: (error) => {
|
|
726
|
+
this._queueStats.errors.push(error);
|
|
727
|
+
this._doneQueueStats.errors.push(error);
|
|
728
|
+
this._completeQueueStats.errors.push(error);
|
|
729
|
+
operation.ready$.error(error);
|
|
730
|
+
},
|
|
731
|
+
complete: () => {
|
|
732
|
+
this._queueStats.completed++;
|
|
733
|
+
this._doneQueueStats.completed++;
|
|
734
|
+
this._completeQueueStats.completed++;
|
|
735
|
+
operation.ready$.complete();
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
_clearDoneQueueStats() {
|
|
740
|
+
this._doneQueueStats = {
|
|
741
|
+
total: 0,
|
|
742
|
+
errors: [],
|
|
743
|
+
completed: 0,
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
function resolve(promise, defaults = []) {
|
|
749
|
+
const result = defaults;
|
|
750
|
+
return new Promise(resolve => {
|
|
751
|
+
promise.then(function (data) {
|
|
752
|
+
Object.keys(data).forEach(key => result[key] = data[key]);
|
|
753
|
+
resolve(result);
|
|
754
|
+
});
|
|
755
|
+
});
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
function round(num, decimalPlaces = 0) {
|
|
759
|
+
num = parseFloat(parseFloat(num).toPrecision(Number.MAX_SAFE_INTEGER.toString().length - 1));
|
|
760
|
+
const p = Math.pow(10, decimalPlaces);
|
|
761
|
+
return Math.round(num * p) / p;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
const fsSourceLoader = (function () {
|
|
765
|
+
let _document;
|
|
766
|
+
let _headElement;
|
|
767
|
+
const _sources = new Map();
|
|
768
|
+
const _loadedResources = new Map();
|
|
769
|
+
// bad way but don't want to bother developer
|
|
770
|
+
setDocument(document);
|
|
771
|
+
// but developer can set document at any time
|
|
772
|
+
function setDocument(document) {
|
|
773
|
+
_document = document;
|
|
774
|
+
_headElement = _document === null || _document === void 0 ? void 0 : _document.head;
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* register a list of the resources for future loading
|
|
778
|
+
*
|
|
779
|
+
* example:
|
|
780
|
+
* sourceLoader.registerResources({
|
|
781
|
+
* froala: [
|
|
782
|
+
* '/assets/js/froala/froala_editor.min.js',
|
|
783
|
+
* '/assets/css/froala_editor.pkgd.min.css',
|
|
784
|
+
* ],
|
|
785
|
+
* froala_align: '/assets/js/froala/plugins/align.min.js',
|
|
786
|
+
* froala_colors: '/assets/js/froala/plugins/colors.min.js',
|
|
787
|
+
* froala_image: '/assets/js/froala/plugins/image.min.js',
|
|
788
|
+
* });
|
|
789
|
+
*
|
|
790
|
+
*/
|
|
791
|
+
function registerResources(resources) {
|
|
792
|
+
Object.entries(resources)
|
|
793
|
+
.forEach(([name, path]) => {
|
|
794
|
+
if (typeof path === 'string') {
|
|
795
|
+
path = [path];
|
|
796
|
+
}
|
|
797
|
+
if (!_sources.has(name)) {
|
|
798
|
+
_sources.set(name, new Set());
|
|
799
|
+
}
|
|
800
|
+
const resourcesList = _sources.get(name);
|
|
801
|
+
path.forEach((p) => {
|
|
802
|
+
resourcesList.add(p);
|
|
803
|
+
});
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* load any resource previously registered
|
|
808
|
+
*
|
|
809
|
+
* sourceLoader.loadResource('froala')
|
|
810
|
+
*
|
|
811
|
+
* or load any js/css file
|
|
812
|
+
*
|
|
813
|
+
* sourceLoader.loadResource('/assets/my-source.js')
|
|
814
|
+
*
|
|
815
|
+
*/
|
|
816
|
+
function loadResource(name) {
|
|
817
|
+
if (_loadedResources.has(name)) {
|
|
818
|
+
return _loadedResources.get(name);
|
|
819
|
+
}
|
|
820
|
+
if (_sources.has(name)) {
|
|
821
|
+
const sourcesForLoading = [..._sources.get(name)]
|
|
822
|
+
.map((path) => {
|
|
823
|
+
return _loadResource(path);
|
|
824
|
+
})
|
|
825
|
+
.filter((v) => !!v);
|
|
826
|
+
return combineLatest(sourcesForLoading);
|
|
827
|
+
}
|
|
828
|
+
return _loadResource(name);
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* the same as `loadResource` but you can pass list of the resources for loading
|
|
832
|
+
*/
|
|
833
|
+
function loadResources(listOfResources) {
|
|
834
|
+
const resourcesToLoad = listOfResources
|
|
835
|
+
.reduce((acc, name) => {
|
|
836
|
+
const loading$ = loadResource(name);
|
|
837
|
+
if (loading$) {
|
|
838
|
+
acc.push(loading$);
|
|
839
|
+
}
|
|
840
|
+
return acc;
|
|
841
|
+
}, []);
|
|
842
|
+
return combineLatest(resourcesToLoad);
|
|
843
|
+
}
|
|
844
|
+
///
|
|
845
|
+
function _loadResource(path) {
|
|
846
|
+
if (_isStylesUrl(path)) {
|
|
847
|
+
return _loadStyles(path);
|
|
848
|
+
}
|
|
849
|
+
if (_isJavascriptUrl(path)) {
|
|
850
|
+
return _loadJs(path);
|
|
851
|
+
}
|
|
852
|
+
console.warn(`Resource ${path} can not be identified and loaded`);
|
|
853
|
+
return null;
|
|
854
|
+
}
|
|
855
|
+
function _loadJs(scriptPath) {
|
|
856
|
+
if (!_loadedResources.has(scriptPath)) {
|
|
857
|
+
const obs$ = new Observable((obs) => {
|
|
858
|
+
const script = document.createElement('script');
|
|
859
|
+
script.src = scriptPath;
|
|
860
|
+
_headElement.appendChild(script);
|
|
861
|
+
script.onload = () => {
|
|
862
|
+
obs.next();
|
|
863
|
+
obs.complete();
|
|
864
|
+
};
|
|
865
|
+
script.onerror = (err) => {
|
|
866
|
+
obs.error(err);
|
|
867
|
+
};
|
|
868
|
+
}).pipe(shareReplay(1));
|
|
869
|
+
_loadedResources.set(scriptPath, obs$);
|
|
870
|
+
}
|
|
871
|
+
return _loadedResources.get(scriptPath);
|
|
872
|
+
}
|
|
873
|
+
function _loadStyles(stylePath) {
|
|
874
|
+
if (!_loadedResources.has(stylePath)) {
|
|
875
|
+
const obs$ = new Observable((obs) => {
|
|
876
|
+
const style = document.createElement('link');
|
|
877
|
+
style.id = stylePath;
|
|
878
|
+
style.rel = 'stylesheet';
|
|
879
|
+
style.href = `${stylePath}`;
|
|
880
|
+
_headElement.appendChild(style);
|
|
881
|
+
style.onload = () => {
|
|
882
|
+
obs.next();
|
|
883
|
+
obs.complete();
|
|
884
|
+
};
|
|
885
|
+
style.onerror = (err) => {
|
|
886
|
+
obs.error(err);
|
|
887
|
+
};
|
|
888
|
+
});
|
|
889
|
+
_loadedResources.set(stylePath, obs$);
|
|
890
|
+
}
|
|
891
|
+
return _loadedResources.get(stylePath);
|
|
892
|
+
}
|
|
893
|
+
function _isJavascriptUrl(url) {
|
|
894
|
+
return url.endsWith('.js');
|
|
895
|
+
}
|
|
896
|
+
function _isStylesUrl(url) {
|
|
897
|
+
return url.endsWith('.css');
|
|
898
|
+
}
|
|
899
|
+
return {
|
|
900
|
+
setDocument,
|
|
901
|
+
registerResources,
|
|
902
|
+
loadResource,
|
|
903
|
+
loadResources,
|
|
904
|
+
loadJs: _loadJs,
|
|
905
|
+
loadStyles: _loadStyles,
|
|
906
|
+
};
|
|
907
|
+
})();
|
|
908
|
+
function loadStyles(path) {
|
|
909
|
+
return fsSourceLoader.loadStyles(path);
|
|
910
|
+
}
|
|
911
|
+
;
|
|
912
|
+
function loadJs(path) {
|
|
913
|
+
return fsSourceLoader.loadJs(path);
|
|
914
|
+
}
|
|
872
915
|
;
|
|
873
|
-
function loadJs(path) {
|
|
874
|
-
return fsSourceLoader.loadJs(path);
|
|
875
|
-
}
|
|
876
|
-
;
|
|
877
|
-
|
|
878
|
-
function throttle(func, wait) {
|
|
879
|
-
let waiting = false; // Initially, we're not waiting
|
|
880
|
-
return function () {
|
|
881
|
-
if (!waiting) { // If we're not waiting
|
|
882
|
-
func.apply(null, arguments); // Execute users function
|
|
883
|
-
waiting = true; // Prevent future invocations
|
|
884
|
-
setTimeout(function () {
|
|
885
|
-
waiting = false; // And allow future invocations
|
|
886
|
-
}, wait);
|
|
887
|
-
}
|
|
888
|
-
};
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
function toString(value) {
|
|
892
|
-
if (value === null || value === undefined) {
|
|
893
|
-
return '';
|
|
894
|
-
}
|
|
895
|
-
return `${value}`;
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
function uuid() {
|
|
899
|
-
return guid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx');
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
function value(object, key, def) {
|
|
903
|
-
if (typeof object === 'object' || Array.isArray(object)) {
|
|
904
|
-
if (object.hasOwnProperty(key)) {
|
|
905
|
-
return object[key];
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
return def;
|
|
909
|
-
}
|
|
910
916
|
|
|
911
|
-
function
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
function
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
917
|
+
function throttle(func, wait) {
|
|
918
|
+
let waiting = false; // Initially, we're not waiting
|
|
919
|
+
return function () {
|
|
920
|
+
if (!waiting) { // If we're not waiting
|
|
921
|
+
func.apply(null, arguments); // Execute users function
|
|
922
|
+
waiting = true; // Prevent future invocations
|
|
923
|
+
setTimeout(function () {
|
|
924
|
+
waiting = false; // And allow future invocations
|
|
925
|
+
}, wait);
|
|
926
|
+
}
|
|
927
|
+
};
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
function toString(value) {
|
|
931
|
+
if (value === null || value === undefined) {
|
|
932
|
+
return '';
|
|
933
|
+
}
|
|
934
|
+
return `${value}`;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
function uuid() {
|
|
938
|
+
return guid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx');
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
function value(object, key, def) {
|
|
942
|
+
if (typeof object === 'object' || Array.isArray(object)) {
|
|
943
|
+
if (object.hasOwnProperty(key)) {
|
|
944
|
+
return object[key];
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
return def;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
function number(value, decimals) {
|
|
951
|
+
if (isNumeric(decimals)) {
|
|
952
|
+
value = round(value, decimals);
|
|
953
|
+
}
|
|
954
|
+
return Number(value || 0).toLocaleString(undefined, { maximumFractionDigits: decimals });
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
function acronym(str, length = 2) {
|
|
958
|
+
const splittedString = str
|
|
959
|
+
.replace(/[^a-zA-Z0-9]+/g, ' ')
|
|
960
|
+
.split(' ');
|
|
961
|
+
let result = '';
|
|
962
|
+
for (let i = 0; i < length; i++) {
|
|
963
|
+
if (!splittedString[i]) {
|
|
964
|
+
if (splittedString.length === 1) {
|
|
965
|
+
for (let j = 1; j < length; j++) {
|
|
966
|
+
if (!splittedString[i - 1][j]) {
|
|
967
|
+
break;
|
|
968
|
+
}
|
|
969
|
+
result += splittedString[i - 1][j].toUpperCase();
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
break;
|
|
973
|
+
}
|
|
974
|
+
result += splittedString[i][0].toUpperCase();
|
|
975
|
+
}
|
|
976
|
+
return result;
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
function currency(amount, precision = [2, 10], currencyCode = 'USD', locale = 'en-US') {
|
|
980
|
+
const digitsInfo = Array.isArray(precision) ? precision : [precision, precision];
|
|
981
|
+
amount = round(amount, digitsInfo[1]);
|
|
982
|
+
return new CurrencyPipe(locale)
|
|
983
|
+
.transform(amount, currencyCode, 'symbol', `1.${digitsInfo[0]}-${digitsInfo[1]}`);
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
function truncate(value, limit = 100, completeWords = false, ellipsis = '...') {
|
|
987
|
+
value = value || '';
|
|
988
|
+
if (completeWords) {
|
|
989
|
+
limit = value.substr(0, limit).lastIndexOf(' ');
|
|
990
|
+
}
|
|
991
|
+
let result = `${value.substr(0, limit)}`;
|
|
992
|
+
if (result !== value) {
|
|
993
|
+
result += ellipsis;
|
|
994
|
+
}
|
|
995
|
+
return result;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
function email(value) {
|
|
999
|
+
return !!String(value).match(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
function phone(value) {
|
|
1003
|
+
const valid = /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4}/.test(value);
|
|
1004
|
+
return valid || !String(value).length;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
/**
|
|
1008
|
+
* Check validity of the url.
|
|
1009
|
+
* Protocol (http/https) isn't required.
|
|
1010
|
+
* @param value
|
|
1011
|
+
* @returns {boolean}
|
|
1012
|
+
*/
|
|
1013
|
+
function url(value) {
|
|
1014
|
+
const expression = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#%[\]@!\$&'\(\)\*\+,;=.]+$/gm;
|
|
1015
|
+
const regexp = new RegExp(expression);
|
|
1016
|
+
return !!String(value).match(regexp);
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
function delayedRetry(delayMs, maxRetry = 5, message) {
|
|
1020
|
+
let retries = 0;
|
|
1021
|
+
return (src) => src.pipe(retryWhen((errors) => errors.pipe(tap(() => {
|
|
1022
|
+
retries++;
|
|
1023
|
+
if (retries <= maxRetry) {
|
|
1024
|
+
console.info(`Failed to load Resource. Retry in ${delayMs / 1000} sec. ${retries}/${maxRetry} times...`);
|
|
1025
|
+
}
|
|
1026
|
+
}), concatMap((error) => iif(() => retries > maxRetry, throwError(getErrorMessage(maxRetry, message)), timer(delayMs))))));
|
|
1027
|
+
}
|
|
1028
|
+
const getErrorMessage = (maxRetry, defaultMessage) => {
|
|
1029
|
+
if (!defaultMessage) {
|
|
1030
|
+
return `Failed to load Resource for ${maxRetry} times. Giving up.`;
|
|
1031
|
+
}
|
|
1032
|
+
else {
|
|
1033
|
+
return defaultMessage;
|
|
1034
|
+
}
|
|
996
1035
|
};
|
|
997
1036
|
|
|
998
|
-
function bytes(bytes, decimals, unit) {
|
|
999
|
-
if (!bytes) {
|
|
1000
|
-
return '0 MB';
|
|
1001
|
-
}
|
|
1002
|
-
const e = typeof unit === 'string' ?
|
|
1003
|
-
'KMGTP'.indexOf(unit.replace('B', '')) + 1 :
|
|
1004
|
-
Math.floor(Math.log(bytes) / Math.log(1024));
|
|
1005
|
-
if (!isNumeric(decimals)) {
|
|
1006
|
-
decimals = (bytes / 1024) > 1000 ? 2 : 0;
|
|
1007
|
-
}
|
|
1008
|
-
return `${(bytes / Math.pow(1024, e))
|
|
1009
|
-
.toFixed(decimals)}`
|
|
1010
|
-
.replace(/\.00/, '')
|
|
1011
|
-
+ ' '
|
|
1012
|
-
+ (e ? ' KMGTP'.charAt(e) : '') + 'B';
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
class FsFormatBytesPipe {
|
|
1016
|
-
transform(value, decimals, unit) {
|
|
1017
|
-
return bytes(value, decimals, unit);
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
FsFormatBytesPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatBytesPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1021
|
-
FsFormatBytesPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatBytesPipe, name: "fsFormatBytes" });
|
|
1022
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatBytesPipe, decorators: [{
|
|
1023
|
-
type: Pipe,
|
|
1024
|
-
args: [{
|
|
1025
|
-
name: 'fsFormatBytes',
|
|
1026
|
-
}]
|
|
1037
|
+
function bytes(bytes, decimals, unit) {
|
|
1038
|
+
if (!bytes) {
|
|
1039
|
+
return '0 MB';
|
|
1040
|
+
}
|
|
1041
|
+
const e = typeof unit === 'string' ?
|
|
1042
|
+
'KMGTP'.indexOf(unit.replace('B', '')) + 1 :
|
|
1043
|
+
Math.floor(Math.log(bytes) / Math.log(1024));
|
|
1044
|
+
if (!isNumeric(decimals)) {
|
|
1045
|
+
decimals = (bytes / 1024) > 1000 ? 2 : 0;
|
|
1046
|
+
}
|
|
1047
|
+
return `${(bytes / Math.pow(1024, e))
|
|
1048
|
+
.toFixed(decimals)}`
|
|
1049
|
+
.replace(/\.00/, '')
|
|
1050
|
+
+ ' '
|
|
1051
|
+
+ (e ? ' KMGTP'.charAt(e) : '') + 'B';
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
class FsFormatBytesPipe {
|
|
1055
|
+
transform(value, decimals, unit) {
|
|
1056
|
+
return bytes(value, decimals, unit);
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
FsFormatBytesPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatBytesPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1060
|
+
FsFormatBytesPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatBytesPipe, name: "fsFormatBytes" });
|
|
1061
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatBytesPipe, decorators: [{
|
|
1062
|
+
type: Pipe,
|
|
1063
|
+
args: [{
|
|
1064
|
+
name: 'fsFormatBytes',
|
|
1065
|
+
}]
|
|
1027
1066
|
}] });
|
|
1028
1067
|
|
|
1029
|
-
class FsFormatCurrencyPipe {
|
|
1030
|
-
constructor(locale) {
|
|
1031
|
-
this.locale = locale;
|
|
1032
|
-
}
|
|
1033
|
-
transform(amount, precision = 2, currencyCode) {
|
|
1034
|
-
return currency(amount, precision, currencyCode);
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
FsFormatCurrencyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatCurrencyPipe, deps: [{ token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1038
|
-
FsFormatCurrencyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatCurrencyPipe, name: "fsFormatCurrency" });
|
|
1039
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatCurrencyPipe, decorators: [{
|
|
1040
|
-
type: Pipe,
|
|
1041
|
-
args: [{
|
|
1042
|
-
name: 'fsFormatCurrency',
|
|
1043
|
-
}]
|
|
1044
|
-
}], ctorParameters: function () {
|
|
1045
|
-
return [{ type: undefined, decorators: [{
|
|
1046
|
-
type: Inject,
|
|
1047
|
-
args: [LOCALE_ID]
|
|
1048
|
-
}] }];
|
|
1068
|
+
class FsFormatCurrencyPipe {
|
|
1069
|
+
constructor(locale) {
|
|
1070
|
+
this.locale = locale;
|
|
1071
|
+
}
|
|
1072
|
+
transform(amount, precision = 2, currencyCode) {
|
|
1073
|
+
return currency(amount, precision, currencyCode);
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
FsFormatCurrencyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatCurrencyPipe, deps: [{ token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1077
|
+
FsFormatCurrencyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatCurrencyPipe, name: "fsFormatCurrency" });
|
|
1078
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatCurrencyPipe, decorators: [{
|
|
1079
|
+
type: Pipe,
|
|
1080
|
+
args: [{
|
|
1081
|
+
name: 'fsFormatCurrency',
|
|
1082
|
+
}]
|
|
1083
|
+
}], ctorParameters: function () {
|
|
1084
|
+
return [{ type: undefined, decorators: [{
|
|
1085
|
+
type: Inject,
|
|
1086
|
+
args: [LOCALE_ID]
|
|
1087
|
+
}] }];
|
|
1049
1088
|
} });
|
|
1050
1089
|
|
|
1051
|
-
class FsFormatNumberPipe {
|
|
1052
|
-
transform(value, decimals) {
|
|
1053
|
-
return number(value, decimals);
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
FsFormatNumberPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatNumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1057
|
-
FsFormatNumberPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatNumberPipe, name: "fsFormatNumber" });
|
|
1058
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatNumberPipe, decorators: [{
|
|
1059
|
-
type: Pipe,
|
|
1060
|
-
args: [{
|
|
1061
|
-
name: 'fsFormatNumber'
|
|
1062
|
-
}]
|
|
1090
|
+
class FsFormatNumberPipe {
|
|
1091
|
+
transform(value, decimals) {
|
|
1092
|
+
return number(value, decimals);
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
FsFormatNumberPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatNumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1096
|
+
FsFormatNumberPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatNumberPipe, name: "fsFormatNumber" });
|
|
1097
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatNumberPipe, decorators: [{
|
|
1098
|
+
type: Pipe,
|
|
1099
|
+
args: [{
|
|
1100
|
+
name: 'fsFormatNumber'
|
|
1101
|
+
}]
|
|
1063
1102
|
}] });
|
|
1064
1103
|
|
|
1065
|
-
class FsFormatOrdinalNumberPipe {
|
|
1066
|
-
transform(value) {
|
|
1067
|
-
return ordinalNumber(value);
|
|
1068
|
-
}
|
|
1069
|
-
}
|
|
1070
|
-
FsFormatOrdinalNumberPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatOrdinalNumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1071
|
-
FsFormatOrdinalNumberPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatOrdinalNumberPipe, name: "fsFormatOrdinalNumber" });
|
|
1072
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatOrdinalNumberPipe, decorators: [{
|
|
1073
|
-
type: Pipe,
|
|
1074
|
-
args: [{
|
|
1075
|
-
name: 'fsFormatOrdinalNumber',
|
|
1076
|
-
}]
|
|
1104
|
+
class FsFormatOrdinalNumberPipe {
|
|
1105
|
+
transform(value) {
|
|
1106
|
+
return ordinalNumber(value);
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
FsFormatOrdinalNumberPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatOrdinalNumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1110
|
+
FsFormatOrdinalNumberPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatOrdinalNumberPipe, name: "fsFormatOrdinalNumber" });
|
|
1111
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatOrdinalNumberPipe, decorators: [{
|
|
1112
|
+
type: Pipe,
|
|
1113
|
+
args: [{
|
|
1114
|
+
name: 'fsFormatOrdinalNumber',
|
|
1115
|
+
}]
|
|
1077
1116
|
}] });
|
|
1078
1117
|
|
|
1079
|
-
class FsFormatTruncatePipe {
|
|
1080
|
-
constructor() { }
|
|
1081
|
-
transform(value, limit, completeWords, ellipsis) {
|
|
1082
|
-
return truncate(value, limit, completeWords, ellipsis);
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
FsFormatTruncatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatTruncatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1086
|
-
FsFormatTruncatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatTruncatePipe, name: "fsFormatTruncate" });
|
|
1087
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatTruncatePipe, decorators: [{
|
|
1088
|
-
type: Pipe,
|
|
1089
|
-
args: [{
|
|
1090
|
-
name: 'fsFormatTruncate'
|
|
1091
|
-
}]
|
|
1118
|
+
class FsFormatTruncatePipe {
|
|
1119
|
+
constructor() { }
|
|
1120
|
+
transform(value, limit, completeWords, ellipsis) {
|
|
1121
|
+
return truncate(value, limit, completeWords, ellipsis);
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
FsFormatTruncatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatTruncatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1125
|
+
FsFormatTruncatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatTruncatePipe, name: "fsFormatTruncate" });
|
|
1126
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormatTruncatePipe, decorators: [{
|
|
1127
|
+
type: Pipe,
|
|
1128
|
+
args: [{
|
|
1129
|
+
name: 'fsFormatTruncate'
|
|
1130
|
+
}]
|
|
1092
1131
|
}], ctorParameters: function () { return []; } });
|
|
1093
1132
|
|
|
1094
|
-
class FsArray {
|
|
1095
|
-
/**
|
|
1096
|
-
* @deprecated use import { nameValue } from @firestitch/common/array; instead
|
|
1097
|
-
*/
|
|
1098
|
-
nameValue(array, name, value) {
|
|
1099
|
-
console.warn('@deprecated use import { nameValue } from @firestitch/common/array; instead');
|
|
1100
|
-
let list = [];
|
|
1101
|
-
if (name || value) {
|
|
1102
|
-
let nameFn = typeof name === 'function' ? name : function (item) { return item[name]; };
|
|
1103
|
-
let valueFn = typeof value === 'function' ? value : function (item) { return item[value]; };
|
|
1104
|
-
array.forEach(function (item) {
|
|
1105
|
-
list.push({ name: nameFn(item), value: valueFn(item) });
|
|
1106
|
-
});
|
|
1107
|
-
}
|
|
1108
|
-
else {
|
|
1109
|
-
array.forEach(function (name, value) {
|
|
1110
|
-
list.push({ name: name, value: value });
|
|
1111
|
-
});
|
|
1112
|
-
}
|
|
1113
|
-
return list;
|
|
1114
|
-
}
|
|
1115
|
-
/**
|
|
1116
|
-
* @deprecated use import { remove } from @firestitch/common/array; instead
|
|
1117
|
-
*/
|
|
1118
|
-
remove(array, query) {
|
|
1119
|
-
console.warn('@deprecated use import { remove } from @firestitch/common/array; instead');
|
|
1120
|
-
let idx = this.indexOf(array, query);
|
|
1121
|
-
if (idx >= 0) {
|
|
1122
|
-
return array.splice(idx, 1);
|
|
1123
|
-
}
|
|
1124
|
-
return idx;
|
|
1125
|
-
}
|
|
1126
|
-
/**
|
|
1127
|
-
* @deprecated use import { indexOf } from @firestitch/common/array; instead
|
|
1128
|
-
*/
|
|
1129
|
-
indexOf(array, query) {
|
|
1130
|
-
console.warn('@deprecated use import { indexOf } from @firestitch/common/array; instead');
|
|
1131
|
-
if (typeof query !== 'function') {
|
|
1132
|
-
let queryObj = query;
|
|
1133
|
-
query = (item) => {
|
|
1134
|
-
return this.compare(queryObj, item);
|
|
1135
|
-
};
|
|
1136
|
-
}
|
|
1137
|
-
for (let i = 0, len = array.length; i < len; i++) {
|
|
1138
|
-
if (query(array[i])) {
|
|
1139
|
-
return i;
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
return -1;
|
|
1143
|
-
}
|
|
1144
|
-
/**
|
|
1145
|
-
* @deprecated use import { compare } from @firestitch/common/array; instead
|
|
1146
|
-
*/
|
|
1147
|
-
compare(query, item) {
|
|
1148
|
-
console.warn('@deprecated use import { compare } from @firestitch/common/array; instead');
|
|
1149
|
-
let value = true;
|
|
1150
|
-
for (let key in query) {
|
|
1151
|
-
value = value && item[key] == query[key];
|
|
1152
|
-
}
|
|
1153
|
-
return value;
|
|
1154
|
-
}
|
|
1155
|
-
/**
|
|
1156
|
-
* @deprecated use import { filter } from @firestitch/common/array; instead
|
|
1157
|
-
*/
|
|
1158
|
-
filter(array, query) {
|
|
1159
|
-
console.warn('@deprecated use import { filter } from @firestitch/common/array; instead');
|
|
1160
|
-
if (typeof query !== 'function') {
|
|
1161
|
-
let queryObj = query;
|
|
1162
|
-
query = (item) => {
|
|
1163
|
-
return this.compare(queryObj, item);
|
|
1164
|
-
};
|
|
1165
|
-
}
|
|
1166
|
-
let isarray = Array.isArray(array);
|
|
1167
|
-
let list = isarray ? [] : {};
|
|
1168
|
-
if (isarray)
|
|
1169
|
-
array.forEach(function (item, idx) {
|
|
1170
|
-
if (query(item)) {
|
|
1171
|
-
list.push(item);
|
|
1172
|
-
}
|
|
1173
|
-
});
|
|
1174
|
-
else
|
|
1175
|
-
Object.keys(array).forEach(key => {
|
|
1176
|
-
if (query(array[key])) {
|
|
1177
|
-
list[key] = array[key];
|
|
1178
|
-
}
|
|
1179
|
-
});
|
|
1180
|
-
return list;
|
|
1181
|
-
}
|
|
1182
|
-
/**
|
|
1183
|
-
* @deprecated use import { index } from @firestitch/common/array; instead
|
|
1184
|
-
*/
|
|
1185
|
-
index(array, property) {
|
|
1186
|
-
console.warn('@deprecated use import { index } from @firestitch/common/array; instead');
|
|
1187
|
-
let list = {};
|
|
1188
|
-
array.forEach(function (item, idx) {
|
|
1189
|
-
list[item[property]] = item;
|
|
1190
|
-
});
|
|
1191
|
-
return list;
|
|
1192
|
-
}
|
|
1193
|
-
/**
|
|
1194
|
-
* @deprecated use import { sort } from @firestitch/common/array; instead
|
|
1195
|
-
*/
|
|
1196
|
-
sort(array, query, reverse = false) {
|
|
1197
|
-
console.warn('@deprecated use import { sort } from @firestitch/common/array; instead');
|
|
1198
|
-
if (typeof query !== 'function') {
|
|
1199
|
-
let queryStr = query;
|
|
1200
|
-
query = function (a, b) {
|
|
1201
|
-
if (reverse) {
|
|
1202
|
-
if (a[queryStr] < b[queryStr]) {
|
|
1203
|
-
return 1;
|
|
1204
|
-
}
|
|
1205
|
-
else if (a[queryStr] > b[queryStr]) {
|
|
1206
|
-
return -1;
|
|
1207
|
-
}
|
|
1208
|
-
}
|
|
1209
|
-
else {
|
|
1210
|
-
if (a[queryStr] > b[queryStr]) {
|
|
1211
|
-
return 1;
|
|
1212
|
-
}
|
|
1213
|
-
else if (a[queryStr] < b[queryStr]) {
|
|
1214
|
-
return -1;
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1217
|
-
return 0;
|
|
1218
|
-
};
|
|
1219
|
-
}
|
|
1220
|
-
array.sort(query);
|
|
1221
|
-
return array;
|
|
1222
|
-
}
|
|
1223
|
-
/**
|
|
1224
|
-
* @deprecated use import { rsort } from @firestitch/common/array; instead
|
|
1225
|
-
*/
|
|
1226
|
-
rsort(array, query) {
|
|
1227
|
-
console.warn('@deprecated use import { rsort } from @firestitch/common/array; instead');
|
|
1228
|
-
return this.sort(array, query, true);
|
|
1229
|
-
}
|
|
1230
|
-
/**
|
|
1231
|
-
* @deprecated use import { list } from @firestitch/common/array; instead
|
|
1232
|
-
*/
|
|
1233
|
-
list(array, property, index = null) {
|
|
1234
|
-
console.warn('@deprecated use import { list } from @firestitch/common/array; instead');
|
|
1235
|
-
let list = index ? {} : [];
|
|
1236
|
-
array.forEach(function (item, idx) {
|
|
1237
|
-
if (index) {
|
|
1238
|
-
list[item[index]] = item[property];
|
|
1239
|
-
}
|
|
1240
|
-
else {
|
|
1241
|
-
list.push(item[property]);
|
|
1242
|
-
}
|
|
1243
|
-
});
|
|
1244
|
-
return list;
|
|
1245
|
-
}
|
|
1246
|
-
/**
|
|
1247
|
-
* @deprecated use import { applyDepth } from @firestitch/common/array; instead
|
|
1248
|
-
*/
|
|
1249
|
-
applyDepth(objects, parent_property, id_property = 'id', depth_property = 'depth') {
|
|
1250
|
-
console.warn('@deprecated use import { applyDepth } from @firestitch/common/array; instead');
|
|
1251
|
-
let keyed = {};
|
|
1252
|
-
objects.forEach(function (object) {
|
|
1253
|
-
if (!object[parent_property]) {
|
|
1254
|
-
object[depth_property] = 0;
|
|
1255
|
-
}
|
|
1256
|
-
keyed[object[id_property]] = object;
|
|
1257
|
-
});
|
|
1258
|
-
Object.keys(keyed).forEach(key => {
|
|
1259
|
-
Object.keys(keyed).forEach(key => {
|
|
1260
|
-
let object = keyed[key];
|
|
1261
|
-
if (!keyed[key][depth_property]) {
|
|
1262
|
-
if (keyed[key][parent_property]) {
|
|
1263
|
-
keyed[key][depth_property] = keyed[keyed[key][parent_property]][depth_property] + 1;
|
|
1264
|
-
}
|
|
1265
|
-
}
|
|
1266
|
-
});
|
|
1267
|
-
});
|
|
1268
|
-
return keyed;
|
|
1269
|
-
}
|
|
1270
|
-
/**
|
|
1271
|
-
* @deprecated use import { inArray } from @firestitch/common/array; instead
|
|
1272
|
-
*/
|
|
1273
|
-
inArray(values, array) {
|
|
1274
|
-
console.warn('@deprecated use import { inArray } from @firestitch/common/array; instead');
|
|
1275
|
-
if (!Array.isArray(values)) {
|
|
1276
|
-
values = [values];
|
|
1277
|
-
}
|
|
1278
|
-
for (let i = 0, len = values.length; i < len; i++) {
|
|
1279
|
-
if (array.indexOf(values[i]) >= 0) {
|
|
1280
|
-
return true;
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
return false;
|
|
1284
|
-
}
|
|
1285
|
-
/**
|
|
1286
|
-
* @deprecated use import { keyExists } from @firestitch/common/array; instead
|
|
1287
|
-
*/
|
|
1288
|
-
keyExists(array, key) {
|
|
1289
|
-
console.warn('@deprecated use import { keyExists } from @firestitch/common/array; instead');
|
|
1290
|
-
return array.hasOwnProperty(key);
|
|
1291
|
-
}
|
|
1292
|
-
/**
|
|
1293
|
-
* @deprecated use import { length } from @firestitch/common/array; instead
|
|
1294
|
-
*/
|
|
1295
|
-
length(array) {
|
|
1296
|
-
console.warn('@deprecated use import { length } from @firestitch/common/array; instead');
|
|
1297
|
-
return array.length;
|
|
1298
|
-
}
|
|
1299
|
-
/**
|
|
1300
|
-
* @deprecated use import { ksort } from @firestitch/common/array; instead
|
|
1301
|
-
*/
|
|
1302
|
-
ksort(unordered) {
|
|
1303
|
-
console.warn('@deprecated use import { ksort } from @firestitch/common/array; instead');
|
|
1304
|
-
Object.keys(unordered).sort().forEach(function (key) {
|
|
1305
|
-
let value = unordered[key];
|
|
1306
|
-
delete unordered[key];
|
|
1307
|
-
unordered[key] = value;
|
|
1308
|
-
});
|
|
1309
|
-
}
|
|
1310
|
-
}
|
|
1311
|
-
FsArray.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsArray, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1312
|
-
FsArray.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsArray });
|
|
1313
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsArray, decorators: [{
|
|
1314
|
-
type: Injectable
|
|
1133
|
+
class FsArray {
|
|
1134
|
+
/**
|
|
1135
|
+
* @deprecated use import { nameValue } from @firestitch/common/array; instead
|
|
1136
|
+
*/
|
|
1137
|
+
nameValue(array, name, value) {
|
|
1138
|
+
console.warn('@deprecated use import { nameValue } from @firestitch/common/array; instead');
|
|
1139
|
+
let list = [];
|
|
1140
|
+
if (name || value) {
|
|
1141
|
+
let nameFn = typeof name === 'function' ? name : function (item) { return item[name]; };
|
|
1142
|
+
let valueFn = typeof value === 'function' ? value : function (item) { return item[value]; };
|
|
1143
|
+
array.forEach(function (item) {
|
|
1144
|
+
list.push({ name: nameFn(item), value: valueFn(item) });
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
else {
|
|
1148
|
+
array.forEach(function (name, value) {
|
|
1149
|
+
list.push({ name: name, value: value });
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
return list;
|
|
1153
|
+
}
|
|
1154
|
+
/**
|
|
1155
|
+
* @deprecated use import { remove } from @firestitch/common/array; instead
|
|
1156
|
+
*/
|
|
1157
|
+
remove(array, query) {
|
|
1158
|
+
console.warn('@deprecated use import { remove } from @firestitch/common/array; instead');
|
|
1159
|
+
let idx = this.indexOf(array, query);
|
|
1160
|
+
if (idx >= 0) {
|
|
1161
|
+
return array.splice(idx, 1);
|
|
1162
|
+
}
|
|
1163
|
+
return idx;
|
|
1164
|
+
}
|
|
1165
|
+
/**
|
|
1166
|
+
* @deprecated use import { indexOf } from @firestitch/common/array; instead
|
|
1167
|
+
*/
|
|
1168
|
+
indexOf(array, query) {
|
|
1169
|
+
console.warn('@deprecated use import { indexOf } from @firestitch/common/array; instead');
|
|
1170
|
+
if (typeof query !== 'function') {
|
|
1171
|
+
let queryObj = query;
|
|
1172
|
+
query = (item) => {
|
|
1173
|
+
return this.compare(queryObj, item);
|
|
1174
|
+
};
|
|
1175
|
+
}
|
|
1176
|
+
for (let i = 0, len = array.length; i < len; i++) {
|
|
1177
|
+
if (query(array[i])) {
|
|
1178
|
+
return i;
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
return -1;
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* @deprecated use import { compare } from @firestitch/common/array; instead
|
|
1185
|
+
*/
|
|
1186
|
+
compare(query, item) {
|
|
1187
|
+
console.warn('@deprecated use import { compare } from @firestitch/common/array; instead');
|
|
1188
|
+
let value = true;
|
|
1189
|
+
for (let key in query) {
|
|
1190
|
+
value = value && item[key] == query[key];
|
|
1191
|
+
}
|
|
1192
|
+
return value;
|
|
1193
|
+
}
|
|
1194
|
+
/**
|
|
1195
|
+
* @deprecated use import { filter } from @firestitch/common/array; instead
|
|
1196
|
+
*/
|
|
1197
|
+
filter(array, query) {
|
|
1198
|
+
console.warn('@deprecated use import { filter } from @firestitch/common/array; instead');
|
|
1199
|
+
if (typeof query !== 'function') {
|
|
1200
|
+
let queryObj = query;
|
|
1201
|
+
query = (item) => {
|
|
1202
|
+
return this.compare(queryObj, item);
|
|
1203
|
+
};
|
|
1204
|
+
}
|
|
1205
|
+
let isarray = Array.isArray(array);
|
|
1206
|
+
let list = isarray ? [] : {};
|
|
1207
|
+
if (isarray)
|
|
1208
|
+
array.forEach(function (item, idx) {
|
|
1209
|
+
if (query(item)) {
|
|
1210
|
+
list.push(item);
|
|
1211
|
+
}
|
|
1212
|
+
});
|
|
1213
|
+
else
|
|
1214
|
+
Object.keys(array).forEach(key => {
|
|
1215
|
+
if (query(array[key])) {
|
|
1216
|
+
list[key] = array[key];
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1219
|
+
return list;
|
|
1220
|
+
}
|
|
1221
|
+
/**
|
|
1222
|
+
* @deprecated use import { index } from @firestitch/common/array; instead
|
|
1223
|
+
*/
|
|
1224
|
+
index(array, property) {
|
|
1225
|
+
console.warn('@deprecated use import { index } from @firestitch/common/array; instead');
|
|
1226
|
+
let list = {};
|
|
1227
|
+
array.forEach(function (item, idx) {
|
|
1228
|
+
list[item[property]] = item;
|
|
1229
|
+
});
|
|
1230
|
+
return list;
|
|
1231
|
+
}
|
|
1232
|
+
/**
|
|
1233
|
+
* @deprecated use import { sort } from @firestitch/common/array; instead
|
|
1234
|
+
*/
|
|
1235
|
+
sort(array, query, reverse = false) {
|
|
1236
|
+
console.warn('@deprecated use import { sort } from @firestitch/common/array; instead');
|
|
1237
|
+
if (typeof query !== 'function') {
|
|
1238
|
+
let queryStr = query;
|
|
1239
|
+
query = function (a, b) {
|
|
1240
|
+
if (reverse) {
|
|
1241
|
+
if (a[queryStr] < b[queryStr]) {
|
|
1242
|
+
return 1;
|
|
1243
|
+
}
|
|
1244
|
+
else if (a[queryStr] > b[queryStr]) {
|
|
1245
|
+
return -1;
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
else {
|
|
1249
|
+
if (a[queryStr] > b[queryStr]) {
|
|
1250
|
+
return 1;
|
|
1251
|
+
}
|
|
1252
|
+
else if (a[queryStr] < b[queryStr]) {
|
|
1253
|
+
return -1;
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
return 0;
|
|
1257
|
+
};
|
|
1258
|
+
}
|
|
1259
|
+
array.sort(query);
|
|
1260
|
+
return array;
|
|
1261
|
+
}
|
|
1262
|
+
/**
|
|
1263
|
+
* @deprecated use import { rsort } from @firestitch/common/array; instead
|
|
1264
|
+
*/
|
|
1265
|
+
rsort(array, query) {
|
|
1266
|
+
console.warn('@deprecated use import { rsort } from @firestitch/common/array; instead');
|
|
1267
|
+
return this.sort(array, query, true);
|
|
1268
|
+
}
|
|
1269
|
+
/**
|
|
1270
|
+
* @deprecated use import { list } from @firestitch/common/array; instead
|
|
1271
|
+
*/
|
|
1272
|
+
list(array, property, index = null) {
|
|
1273
|
+
console.warn('@deprecated use import { list } from @firestitch/common/array; instead');
|
|
1274
|
+
let list = index ? {} : [];
|
|
1275
|
+
array.forEach(function (item, idx) {
|
|
1276
|
+
if (index) {
|
|
1277
|
+
list[item[index]] = item[property];
|
|
1278
|
+
}
|
|
1279
|
+
else {
|
|
1280
|
+
list.push(item[property]);
|
|
1281
|
+
}
|
|
1282
|
+
});
|
|
1283
|
+
return list;
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1286
|
+
* @deprecated use import { applyDepth } from @firestitch/common/array; instead
|
|
1287
|
+
*/
|
|
1288
|
+
applyDepth(objects, parent_property, id_property = 'id', depth_property = 'depth') {
|
|
1289
|
+
console.warn('@deprecated use import { applyDepth } from @firestitch/common/array; instead');
|
|
1290
|
+
let keyed = {};
|
|
1291
|
+
objects.forEach(function (object) {
|
|
1292
|
+
if (!object[parent_property]) {
|
|
1293
|
+
object[depth_property] = 0;
|
|
1294
|
+
}
|
|
1295
|
+
keyed[object[id_property]] = object;
|
|
1296
|
+
});
|
|
1297
|
+
Object.keys(keyed).forEach(key => {
|
|
1298
|
+
Object.keys(keyed).forEach(key => {
|
|
1299
|
+
let object = keyed[key];
|
|
1300
|
+
if (!keyed[key][depth_property]) {
|
|
1301
|
+
if (keyed[key][parent_property]) {
|
|
1302
|
+
keyed[key][depth_property] = keyed[keyed[key][parent_property]][depth_property] + 1;
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
});
|
|
1306
|
+
});
|
|
1307
|
+
return keyed;
|
|
1308
|
+
}
|
|
1309
|
+
/**
|
|
1310
|
+
* @deprecated use import { inArray } from @firestitch/common/array; instead
|
|
1311
|
+
*/
|
|
1312
|
+
inArray(values, array) {
|
|
1313
|
+
console.warn('@deprecated use import { inArray } from @firestitch/common/array; instead');
|
|
1314
|
+
if (!Array.isArray(values)) {
|
|
1315
|
+
values = [values];
|
|
1316
|
+
}
|
|
1317
|
+
for (let i = 0, len = values.length; i < len; i++) {
|
|
1318
|
+
if (array.indexOf(values[i]) >= 0) {
|
|
1319
|
+
return true;
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
return false;
|
|
1323
|
+
}
|
|
1324
|
+
/**
|
|
1325
|
+
* @deprecated use import { keyExists } from @firestitch/common/array; instead
|
|
1326
|
+
*/
|
|
1327
|
+
keyExists(array, key) {
|
|
1328
|
+
console.warn('@deprecated use import { keyExists } from @firestitch/common/array; instead');
|
|
1329
|
+
return array.hasOwnProperty(key);
|
|
1330
|
+
}
|
|
1331
|
+
/**
|
|
1332
|
+
* @deprecated use import { length } from @firestitch/common/array; instead
|
|
1333
|
+
*/
|
|
1334
|
+
length(array) {
|
|
1335
|
+
console.warn('@deprecated use import { length } from @firestitch/common/array; instead');
|
|
1336
|
+
return array.length;
|
|
1337
|
+
}
|
|
1338
|
+
/**
|
|
1339
|
+
* @deprecated use import { ksort } from @firestitch/common/array; instead
|
|
1340
|
+
*/
|
|
1341
|
+
ksort(unordered) {
|
|
1342
|
+
console.warn('@deprecated use import { ksort } from @firestitch/common/array; instead');
|
|
1343
|
+
Object.keys(unordered).sort().forEach(function (key) {
|
|
1344
|
+
let value = unordered[key];
|
|
1345
|
+
delete unordered[key];
|
|
1346
|
+
unordered[key] = value;
|
|
1347
|
+
});
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
FsArray.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsArray, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1351
|
+
FsArray.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsArray });
|
|
1352
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsArray, decorators: [{
|
|
1353
|
+
type: Injectable
|
|
1315
1354
|
}] });
|
|
1316
1355
|
|
|
1317
|
-
class FsMath {
|
|
1318
|
-
/**
|
|
1319
|
-
* @deprecated use _.round() instead {@link https://lodash.com/docs/4.17.5#round}
|
|
1320
|
-
*/
|
|
1321
|
-
round(number, precision) {
|
|
1322
|
-
console.warn('@deprecated use _.round() instead {@link https://lodash.com/docs/4.17.5#round}');
|
|
1323
|
-
precision = precision || 0;
|
|
1324
|
-
let factor = Math.pow(10, precision);
|
|
1325
|
-
let tempNumber = number * factor;
|
|
1326
|
-
let roundedTempNumber = Math.round(tempNumber);
|
|
1327
|
-
return roundedTempNumber / factor;
|
|
1328
|
-
}
|
|
1329
|
-
}
|
|
1330
|
-
FsMath.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsMath, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1331
|
-
FsMath.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsMath });
|
|
1332
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsMath, decorators: [{
|
|
1333
|
-
type: Injectable
|
|
1356
|
+
class FsMath {
|
|
1357
|
+
/**
|
|
1358
|
+
* @deprecated use _.round() instead {@link https://lodash.com/docs/4.17.5#round}
|
|
1359
|
+
*/
|
|
1360
|
+
round(number, precision) {
|
|
1361
|
+
console.warn('@deprecated use _.round() instead {@link https://lodash.com/docs/4.17.5#round}');
|
|
1362
|
+
precision = precision || 0;
|
|
1363
|
+
let factor = Math.pow(10, precision);
|
|
1364
|
+
let tempNumber = number * factor;
|
|
1365
|
+
let roundedTempNumber = Math.round(tempNumber);
|
|
1366
|
+
return roundedTempNumber / factor;
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
FsMath.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsMath, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1370
|
+
FsMath.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsMath });
|
|
1371
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsMath, decorators: [{
|
|
1372
|
+
type: Injectable
|
|
1334
1373
|
}] });
|
|
1335
1374
|
|
|
1336
|
-
const KEY_CANCEL = 3, KEY_HELP = 6, KEY_BACKSPACE = 8, KEY_TAB = 9, KEY_CLEAR = 12, KEY_RETURN = 13, KEY_ENTER = 14, KEY_SHIFT = 16, KEY_CONTROL = 17, KEY_ALT = 18, KEY_PAUSE = 19, KEY_CAPS_LOCK = 20, KEY_ESCAPE = 27, KEY_SPACE = 32, KEY_PAGE_UP = 33, KEY_PAGE_DOWN = 34, KEY_END = 35, KEY_HOME = 36, KEY_LEFT = 37, KEY_UP = 38, KEY_RIGHT = 39, KEY_DOWN = 40, KEY_PRINTSCREEN = 44, KEY_INSERT = 45, KEY_DELETE = 46, KEY_0 = 48, KEY_1 = 49, KEY_2 = 50, KEY_3 = 51, KEY_4 = 52, KEY_5 = 53, KEY_6 = 54, KEY_7 = 55, KEY_8 = 56, KEY_9 = 57, KEY_SEMICOLON = 59, KEY_EQUALS = 61;
|
|
1337
|
-
/*
|
|
1338
|
-
Basically, just copy-pasted functionality from fs-boilerplate v1.x, with some small changes (like we dont have angular.bind anymore, had to go with a workaround)
|
|
1339
|
-
There might be a better way to organise constatns but I need to know use-cases
|
|
1340
|
-
*/
|
|
1341
|
-
class FsUtil {
|
|
1342
|
-
constructor() {
|
|
1343
|
-
this.intervals = {};
|
|
1344
|
-
}
|
|
1345
|
-
/**
|
|
1346
|
-
* @deprecated use @firestitch/common/util/guid instead
|
|
1347
|
-
*/
|
|
1348
|
-
guid(pattern) {
|
|
1349
|
-
console.warn('@deprecated use @firestitch/common/util/guid instead');
|
|
1350
|
-
pattern = pattern || 'xxxxxx';
|
|
1351
|
-
return pattern.replace(/[xy]/g, function (c) {
|
|
1352
|
-
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
|
1353
|
-
return v.toString(16);
|
|
1354
|
-
});
|
|
1355
|
-
}
|
|
1356
|
-
/**
|
|
1357
|
-
* @deprecated use import { uuid } from @firestitch/common/util; instead
|
|
1358
|
-
*/
|
|
1359
|
-
uuid() {
|
|
1360
|
-
console.warn('@deprecated use @firestitch/common/util/uuid instead');
|
|
1361
|
-
return this.guid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx');
|
|
1362
|
-
}
|
|
1363
|
-
/**
|
|
1364
|
-
* @deprecated use import { resolve } from @firestitch/common/util; instead
|
|
1365
|
-
*/
|
|
1366
|
-
resolve(promise, defaults = []) {
|
|
1367
|
-
console.warn('@deprecated use @firestitch/common/util/resolve instead');
|
|
1368
|
-
const result = defaults;
|
|
1369
|
-
return new Promise(resolve => {
|
|
1370
|
-
promise.then(function (data) {
|
|
1371
|
-
Object.keys(data).forEach(key => result[key] = data[key]);
|
|
1372
|
-
resolve(result);
|
|
1373
|
-
});
|
|
1374
|
-
});
|
|
1375
|
-
}
|
|
1376
|
-
/**
|
|
1377
|
-
* @deprecated use _.toInteger() instead
|
|
1378
|
-
*/
|
|
1379
|
-
int(value) {
|
|
1380
|
-
console.warn('@deprecated use _.toInteger() instead');
|
|
1381
|
-
value = parseInt(value);
|
|
1382
|
-
if (isNaN(value)) {
|
|
1383
|
-
value = 0;
|
|
1384
|
-
}
|
|
1385
|
-
return value;
|
|
1386
|
-
}
|
|
1387
|
-
/**
|
|
1388
|
-
* @deprecated use _.toFinite() instead
|
|
1389
|
-
*/
|
|
1390
|
-
float(value) {
|
|
1391
|
-
console.warn('@deprecated use _.toFinite() instead');
|
|
1392
|
-
value = parseFloat(value);
|
|
1393
|
-
if (isNaN(value)) {
|
|
1394
|
-
value = 0;
|
|
1395
|
-
}
|
|
1396
|
-
return value;
|
|
1397
|
-
}
|
|
1398
|
-
/**
|
|
1399
|
-
* @deprecated use _.toString() instead
|
|
1400
|
-
*/
|
|
1401
|
-
string(string) {
|
|
1402
|
-
console.warn('@deprecated use _.toString() instead');
|
|
1403
|
-
if (string === null || string === undefined) {
|
|
1404
|
-
string = '';
|
|
1405
|
-
}
|
|
1406
|
-
return (string).toString();
|
|
1407
|
-
}
|
|
1408
|
-
/**
|
|
1409
|
-
* @deprecated use import { isEmpty } from @firestitch/common/util; instead
|
|
1410
|
-
*/
|
|
1411
|
-
isEmpty(value, options) {
|
|
1412
|
-
console.warn('@deprecated use import { isEmpty } from @firestitch/common/util; instead');
|
|
1413
|
-
options = options || {};
|
|
1414
|
-
return value === undefined ||
|
|
1415
|
-
value === null ||
|
|
1416
|
-
value === false ||
|
|
1417
|
-
value === '' ||
|
|
1418
|
-
!this.string(value).length ||
|
|
1419
|
-
(this.isObject(value) &&
|
|
1420
|
-
(value.constructor.name === 'Object' && !Object.keys(value).length)) ||
|
|
1421
|
-
(!options.zero && (value === 0 || value === '0'));
|
|
1422
|
-
}
|
|
1423
|
-
/**
|
|
1424
|
-
* @deprecated use _.isInteger() instead
|
|
1425
|
-
*/
|
|
1426
|
-
isInt(value, type) {
|
|
1427
|
-
console.warn('@deprecated use _.isInteger() instead');
|
|
1428
|
-
const int = !!this.string(value).match(/^\d+$/);
|
|
1429
|
-
if (!int) {
|
|
1430
|
-
return false;
|
|
1431
|
-
}
|
|
1432
|
-
if (type) {
|
|
1433
|
-
return Number.isInteger(value);
|
|
1434
|
-
}
|
|
1435
|
-
return true;
|
|
1436
|
-
}
|
|
1437
|
-
/**
|
|
1438
|
-
* @deprecated use _.each() instead {@link https://lodash.com/docs/4.17.5#forEach}
|
|
1439
|
-
*/
|
|
1440
|
-
each(object, func) {
|
|
1441
|
-
console.warn('@deprecated use _.each() instead {@link https://lodash.com/docs/4.17.5#forEach}');
|
|
1442
|
-
if (!this.isArray(object) && !this.isObject(object)) {
|
|
1443
|
-
return;
|
|
1444
|
-
}
|
|
1445
|
-
Object.keys(object).forEach(function (key) {
|
|
1446
|
-
func(object[key], key);
|
|
1447
|
-
});
|
|
1448
|
-
}
|
|
1449
|
-
/**
|
|
1450
|
-
* @deprecated use _.isArrayLikeObject() {@link https://lodash.com/docs/4.17.5#isArrayLikeObject}
|
|
1451
|
-
* or _.isObject() {@link https://lodash.com/docs/4.17.5#isObject} instead
|
|
1452
|
-
*/
|
|
1453
|
-
isObject(value) {
|
|
1454
|
-
console.warn('@deprecated use _.isArrayLikeObject() {@link https://lodash.com/docs/4.17.5#isArrayLikeObject} or _.isObject() {@link https://lodash.com/docs/4.17.5#isObject} instead');
|
|
1455
|
-
return value !== null && typeof value === 'object' && !this.isArray(value);
|
|
1456
|
-
}
|
|
1457
|
-
/**
|
|
1458
|
-
* @deprecated use _.isString() instead {@link https://lodash.com/docs/4.17.5#isString}
|
|
1459
|
-
*/
|
|
1460
|
-
isString(value) {
|
|
1461
|
-
console.warn('@deprecated use _.isString() instead {@link https://lodash.com/docs/4.17.5#isString}');
|
|
1462
|
-
return typeof value === 'string' || value instanceof String;
|
|
1463
|
-
}
|
|
1464
|
-
/**
|
|
1465
|
-
* @deprecated use _.isArray() instead {@link https://lodash.com/docs/4.17.5#isArray}
|
|
1466
|
-
*/
|
|
1467
|
-
isArray(value) {
|
|
1468
|
-
console.warn('@deprecated use _.isArray() instead {@link https://lodash.com/docs/4.17.5#isArray}');
|
|
1469
|
-
return value instanceof Array;
|
|
1470
|
-
}
|
|
1471
|
-
/**
|
|
1472
|
-
* @deprecated use import { isNumeric } from @firestitch/common/util; instead
|
|
1473
|
-
*/
|
|
1474
|
-
isNumeric(value) {
|
|
1475
|
-
console.warn('@deprecated use import { isNumeric } from @firestitch/common/util; instead');
|
|
1476
|
-
return this.string(value).length && !!this.string(value).match(/^-?\d*\.?\d*$/);
|
|
1477
|
-
}
|
|
1478
|
-
/**
|
|
1479
|
-
* @deprecated use import { isClass } from @firestitch/common/util; instead
|
|
1480
|
-
*/
|
|
1481
|
-
isClass(value, cls) {
|
|
1482
|
-
console.warn('@deprecated use import { isClass } from @firestitch/common/util; instead');
|
|
1483
|
-
if (this.isObject(value)) {
|
|
1484
|
-
if (this.isString(cls)) {
|
|
1485
|
-
if (value.constructor) {
|
|
1486
|
-
if (value.constructor.name === cls) {
|
|
1487
|
-
return true;
|
|
1488
|
-
}
|
|
1489
|
-
}
|
|
1490
|
-
}
|
|
1491
|
-
else {
|
|
1492
|
-
if (value instanceof cls) {
|
|
1493
|
-
return true;
|
|
1494
|
-
}
|
|
1495
|
-
}
|
|
1496
|
-
}
|
|
1497
|
-
return false;
|
|
1498
|
-
}
|
|
1499
|
-
/**
|
|
1500
|
-
* @deprecated use _.isBoolean() instead {@link https://lodash.com/docs/4.17.5#isBoolean}
|
|
1501
|
-
*/
|
|
1502
|
-
isBoolean(value) {
|
|
1503
|
-
console.warn('@deprecated use _.isBoolean() instead {@link https://lodash.com/docs/4.17.5#isBoolean}');
|
|
1504
|
-
return value === true || value === false;
|
|
1505
|
-
}
|
|
1506
|
-
/**
|
|
1507
|
-
* @deprecated use import { value } from @firestitch/common/util; instead
|
|
1508
|
-
*/
|
|
1509
|
-
value(object, key, def) {
|
|
1510
|
-
console.warn('@deprecated use import { value } from @firestitch/common/util; instead');
|
|
1511
|
-
if (this.isObject(object) || this.isArray(object)) {
|
|
1512
|
-
if (object.hasOwnProperty(key)) {
|
|
1513
|
-
return object[key];
|
|
1514
|
-
}
|
|
1515
|
-
}
|
|
1516
|
-
return def;
|
|
1517
|
-
}
|
|
1518
|
-
throttle(func, wait) {
|
|
1519
|
-
console.warn('@deprecated use import { throttle } from @firestitch/common/util; instead');
|
|
1520
|
-
let waiting = false; // Initially, we're not waiting
|
|
1521
|
-
return function () {
|
|
1522
|
-
if (!waiting) { // If we're not waiting
|
|
1523
|
-
func.apply(null, arguments); // Execute users function
|
|
1524
|
-
waiting = true; // Prevent future invocations
|
|
1525
|
-
setTimeout(function () {
|
|
1526
|
-
waiting = false; // And allow future invocations
|
|
1527
|
-
}, wait);
|
|
1528
|
-
}
|
|
1529
|
-
};
|
|
1530
|
-
}
|
|
1531
|
-
/**
|
|
1532
|
-
* @deprecated use import { debounce } from @firestitch/common/util; instead
|
|
1533
|
-
*/
|
|
1534
|
-
debounce(func, wait, immediate) {
|
|
1535
|
-
console.warn('@deprecated use import { debounce } from @firestitch/common/util; instead');
|
|
1536
|
-
var timeout;
|
|
1537
|
-
return function () {
|
|
1538
|
-
var context = this, args = arguments;
|
|
1539
|
-
var later = function () {
|
|
1540
|
-
timeout = null;
|
|
1541
|
-
if (!immediate)
|
|
1542
|
-
func.apply(context, args);
|
|
1543
|
-
};
|
|
1544
|
-
var callNow = immediate && !timeout;
|
|
1545
|
-
clearTimeout(timeout);
|
|
1546
|
-
timeout = setTimeout(later, wait);
|
|
1547
|
-
if (callNow)
|
|
1548
|
-
func.apply(context, args);
|
|
1549
|
-
};
|
|
1550
|
-
}
|
|
1551
|
-
/**
|
|
1552
|
-
* @deprecated use import { length } from @firestitch/common/util; instead
|
|
1553
|
-
*/
|
|
1554
|
-
length(object) {
|
|
1555
|
-
console.warn('@deprecated use import { length } from @firestitch/common/util; instead');
|
|
1556
|
-
if (this.isObject(object)) {
|
|
1557
|
-
return Object.keys(object).length;
|
|
1558
|
-
}
|
|
1559
|
-
if (this.isArray(object)) {
|
|
1560
|
-
return object.length;
|
|
1561
|
-
}
|
|
1562
|
-
return 0;
|
|
1563
|
-
}
|
|
1564
|
-
/**
|
|
1565
|
-
* @deprecated use import { boolean } from @firestitch/common/util; instead
|
|
1566
|
-
*/
|
|
1567
|
-
boolean(value) {
|
|
1568
|
-
console.warn('@deprecated use import { boolean } from @firestitch/common/util; instead');
|
|
1569
|
-
return this.string(value).toLowerCase() !== 'false' && !!value;
|
|
1570
|
-
}
|
|
1571
|
-
/**
|
|
1572
|
-
* @deprecated use import { stringify } from @firestitch/common/util; instead
|
|
1573
|
-
*/
|
|
1574
|
-
stringify(value) {
|
|
1575
|
-
console.warn('@deprecated use import { stringify } from @firestitch/common/util; instead');
|
|
1576
|
-
return JSON.stringify(value);
|
|
1577
|
-
}
|
|
1578
|
-
}
|
|
1579
|
-
FsUtil.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsUtil, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1580
|
-
FsUtil.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsUtil });
|
|
1581
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsUtil, decorators: [{
|
|
1582
|
-
type: Injectable
|
|
1375
|
+
const KEY_CANCEL = 3, KEY_HELP = 6, KEY_BACKSPACE = 8, KEY_TAB = 9, KEY_CLEAR = 12, KEY_RETURN = 13, KEY_ENTER = 14, KEY_SHIFT = 16, KEY_CONTROL = 17, KEY_ALT = 18, KEY_PAUSE = 19, KEY_CAPS_LOCK = 20, KEY_ESCAPE = 27, KEY_SPACE = 32, KEY_PAGE_UP = 33, KEY_PAGE_DOWN = 34, KEY_END = 35, KEY_HOME = 36, KEY_LEFT = 37, KEY_UP = 38, KEY_RIGHT = 39, KEY_DOWN = 40, KEY_PRINTSCREEN = 44, KEY_INSERT = 45, KEY_DELETE = 46, KEY_0 = 48, KEY_1 = 49, KEY_2 = 50, KEY_3 = 51, KEY_4 = 52, KEY_5 = 53, KEY_6 = 54, KEY_7 = 55, KEY_8 = 56, KEY_9 = 57, KEY_SEMICOLON = 59, KEY_EQUALS = 61;
|
|
1376
|
+
/*
|
|
1377
|
+
Basically, just copy-pasted functionality from fs-boilerplate v1.x, with some small changes (like we dont have angular.bind anymore, had to go with a workaround)
|
|
1378
|
+
There might be a better way to organise constatns but I need to know use-cases
|
|
1379
|
+
*/
|
|
1380
|
+
class FsUtil {
|
|
1381
|
+
constructor() {
|
|
1382
|
+
this.intervals = {};
|
|
1383
|
+
}
|
|
1384
|
+
/**
|
|
1385
|
+
* @deprecated use @firestitch/common/util/guid instead
|
|
1386
|
+
*/
|
|
1387
|
+
guid(pattern) {
|
|
1388
|
+
console.warn('@deprecated use @firestitch/common/util/guid instead');
|
|
1389
|
+
pattern = pattern || 'xxxxxx';
|
|
1390
|
+
return pattern.replace(/[xy]/g, function (c) {
|
|
1391
|
+
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
|
1392
|
+
return v.toString(16);
|
|
1393
|
+
});
|
|
1394
|
+
}
|
|
1395
|
+
/**
|
|
1396
|
+
* @deprecated use import { uuid } from @firestitch/common/util; instead
|
|
1397
|
+
*/
|
|
1398
|
+
uuid() {
|
|
1399
|
+
console.warn('@deprecated use @firestitch/common/util/uuid instead');
|
|
1400
|
+
return this.guid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx');
|
|
1401
|
+
}
|
|
1402
|
+
/**
|
|
1403
|
+
* @deprecated use import { resolve } from @firestitch/common/util; instead
|
|
1404
|
+
*/
|
|
1405
|
+
resolve(promise, defaults = []) {
|
|
1406
|
+
console.warn('@deprecated use @firestitch/common/util/resolve instead');
|
|
1407
|
+
const result = defaults;
|
|
1408
|
+
return new Promise(resolve => {
|
|
1409
|
+
promise.then(function (data) {
|
|
1410
|
+
Object.keys(data).forEach(key => result[key] = data[key]);
|
|
1411
|
+
resolve(result);
|
|
1412
|
+
});
|
|
1413
|
+
});
|
|
1414
|
+
}
|
|
1415
|
+
/**
|
|
1416
|
+
* @deprecated use _.toInteger() instead
|
|
1417
|
+
*/
|
|
1418
|
+
int(value) {
|
|
1419
|
+
console.warn('@deprecated use _.toInteger() instead');
|
|
1420
|
+
value = parseInt(value);
|
|
1421
|
+
if (isNaN(value)) {
|
|
1422
|
+
value = 0;
|
|
1423
|
+
}
|
|
1424
|
+
return value;
|
|
1425
|
+
}
|
|
1426
|
+
/**
|
|
1427
|
+
* @deprecated use _.toFinite() instead
|
|
1428
|
+
*/
|
|
1429
|
+
float(value) {
|
|
1430
|
+
console.warn('@deprecated use _.toFinite() instead');
|
|
1431
|
+
value = parseFloat(value);
|
|
1432
|
+
if (isNaN(value)) {
|
|
1433
|
+
value = 0;
|
|
1434
|
+
}
|
|
1435
|
+
return value;
|
|
1436
|
+
}
|
|
1437
|
+
/**
|
|
1438
|
+
* @deprecated use _.toString() instead
|
|
1439
|
+
*/
|
|
1440
|
+
string(string) {
|
|
1441
|
+
console.warn('@deprecated use _.toString() instead');
|
|
1442
|
+
if (string === null || string === undefined) {
|
|
1443
|
+
string = '';
|
|
1444
|
+
}
|
|
1445
|
+
return (string).toString();
|
|
1446
|
+
}
|
|
1447
|
+
/**
|
|
1448
|
+
* @deprecated use import { isEmpty } from @firestitch/common/util; instead
|
|
1449
|
+
*/
|
|
1450
|
+
isEmpty(value, options) {
|
|
1451
|
+
console.warn('@deprecated use import { isEmpty } from @firestitch/common/util; instead');
|
|
1452
|
+
options = options || {};
|
|
1453
|
+
return value === undefined ||
|
|
1454
|
+
value === null ||
|
|
1455
|
+
value === false ||
|
|
1456
|
+
value === '' ||
|
|
1457
|
+
!this.string(value).length ||
|
|
1458
|
+
(this.isObject(value) &&
|
|
1459
|
+
(value.constructor.name === 'Object' && !Object.keys(value).length)) ||
|
|
1460
|
+
(!options.zero && (value === 0 || value === '0'));
|
|
1461
|
+
}
|
|
1462
|
+
/**
|
|
1463
|
+
* @deprecated use _.isInteger() instead
|
|
1464
|
+
*/
|
|
1465
|
+
isInt(value, type) {
|
|
1466
|
+
console.warn('@deprecated use _.isInteger() instead');
|
|
1467
|
+
const int = !!this.string(value).match(/^\d+$/);
|
|
1468
|
+
if (!int) {
|
|
1469
|
+
return false;
|
|
1470
|
+
}
|
|
1471
|
+
if (type) {
|
|
1472
|
+
return Number.isInteger(value);
|
|
1473
|
+
}
|
|
1474
|
+
return true;
|
|
1475
|
+
}
|
|
1476
|
+
/**
|
|
1477
|
+
* @deprecated use _.each() instead {@link https://lodash.com/docs/4.17.5#forEach}
|
|
1478
|
+
*/
|
|
1479
|
+
each(object, func) {
|
|
1480
|
+
console.warn('@deprecated use _.each() instead {@link https://lodash.com/docs/4.17.5#forEach}');
|
|
1481
|
+
if (!this.isArray(object) && !this.isObject(object)) {
|
|
1482
|
+
return;
|
|
1483
|
+
}
|
|
1484
|
+
Object.keys(object).forEach(function (key) {
|
|
1485
|
+
func(object[key], key);
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1488
|
+
/**
|
|
1489
|
+
* @deprecated use _.isArrayLikeObject() {@link https://lodash.com/docs/4.17.5#isArrayLikeObject}
|
|
1490
|
+
* or _.isObject() {@link https://lodash.com/docs/4.17.5#isObject} instead
|
|
1491
|
+
*/
|
|
1492
|
+
isObject(value) {
|
|
1493
|
+
console.warn('@deprecated use _.isArrayLikeObject() {@link https://lodash.com/docs/4.17.5#isArrayLikeObject} or _.isObject() {@link https://lodash.com/docs/4.17.5#isObject} instead');
|
|
1494
|
+
return value !== null && typeof value === 'object' && !this.isArray(value);
|
|
1495
|
+
}
|
|
1496
|
+
/**
|
|
1497
|
+
* @deprecated use _.isString() instead {@link https://lodash.com/docs/4.17.5#isString}
|
|
1498
|
+
*/
|
|
1499
|
+
isString(value) {
|
|
1500
|
+
console.warn('@deprecated use _.isString() instead {@link https://lodash.com/docs/4.17.5#isString}');
|
|
1501
|
+
return typeof value === 'string' || value instanceof String;
|
|
1502
|
+
}
|
|
1503
|
+
/**
|
|
1504
|
+
* @deprecated use _.isArray() instead {@link https://lodash.com/docs/4.17.5#isArray}
|
|
1505
|
+
*/
|
|
1506
|
+
isArray(value) {
|
|
1507
|
+
console.warn('@deprecated use _.isArray() instead {@link https://lodash.com/docs/4.17.5#isArray}');
|
|
1508
|
+
return value instanceof Array;
|
|
1509
|
+
}
|
|
1510
|
+
/**
|
|
1511
|
+
* @deprecated use import { isNumeric } from @firestitch/common/util; instead
|
|
1512
|
+
*/
|
|
1513
|
+
isNumeric(value) {
|
|
1514
|
+
console.warn('@deprecated use import { isNumeric } from @firestitch/common/util; instead');
|
|
1515
|
+
return this.string(value).length && !!this.string(value).match(/^-?\d*\.?\d*$/);
|
|
1516
|
+
}
|
|
1517
|
+
/**
|
|
1518
|
+
* @deprecated use import { isClass } from @firestitch/common/util; instead
|
|
1519
|
+
*/
|
|
1520
|
+
isClass(value, cls) {
|
|
1521
|
+
console.warn('@deprecated use import { isClass } from @firestitch/common/util; instead');
|
|
1522
|
+
if (this.isObject(value)) {
|
|
1523
|
+
if (this.isString(cls)) {
|
|
1524
|
+
if (value.constructor) {
|
|
1525
|
+
if (value.constructor.name === cls) {
|
|
1526
|
+
return true;
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
else {
|
|
1531
|
+
if (value instanceof cls) {
|
|
1532
|
+
return true;
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
return false;
|
|
1537
|
+
}
|
|
1538
|
+
/**
|
|
1539
|
+
* @deprecated use _.isBoolean() instead {@link https://lodash.com/docs/4.17.5#isBoolean}
|
|
1540
|
+
*/
|
|
1541
|
+
isBoolean(value) {
|
|
1542
|
+
console.warn('@deprecated use _.isBoolean() instead {@link https://lodash.com/docs/4.17.5#isBoolean}');
|
|
1543
|
+
return value === true || value === false;
|
|
1544
|
+
}
|
|
1545
|
+
/**
|
|
1546
|
+
* @deprecated use import { value } from @firestitch/common/util; instead
|
|
1547
|
+
*/
|
|
1548
|
+
value(object, key, def) {
|
|
1549
|
+
console.warn('@deprecated use import { value } from @firestitch/common/util; instead');
|
|
1550
|
+
if (this.isObject(object) || this.isArray(object)) {
|
|
1551
|
+
if (object.hasOwnProperty(key)) {
|
|
1552
|
+
return object[key];
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
return def;
|
|
1556
|
+
}
|
|
1557
|
+
throttle(func, wait) {
|
|
1558
|
+
console.warn('@deprecated use import { throttle } from @firestitch/common/util; instead');
|
|
1559
|
+
let waiting = false; // Initially, we're not waiting
|
|
1560
|
+
return function () {
|
|
1561
|
+
if (!waiting) { // If we're not waiting
|
|
1562
|
+
func.apply(null, arguments); // Execute users function
|
|
1563
|
+
waiting = true; // Prevent future invocations
|
|
1564
|
+
setTimeout(function () {
|
|
1565
|
+
waiting = false; // And allow future invocations
|
|
1566
|
+
}, wait);
|
|
1567
|
+
}
|
|
1568
|
+
};
|
|
1569
|
+
}
|
|
1570
|
+
/**
|
|
1571
|
+
* @deprecated use import { debounce } from @firestitch/common/util; instead
|
|
1572
|
+
*/
|
|
1573
|
+
debounce(func, wait, immediate) {
|
|
1574
|
+
console.warn('@deprecated use import { debounce } from @firestitch/common/util; instead');
|
|
1575
|
+
var timeout;
|
|
1576
|
+
return function () {
|
|
1577
|
+
var context = this, args = arguments;
|
|
1578
|
+
var later = function () {
|
|
1579
|
+
timeout = null;
|
|
1580
|
+
if (!immediate)
|
|
1581
|
+
func.apply(context, args);
|
|
1582
|
+
};
|
|
1583
|
+
var callNow = immediate && !timeout;
|
|
1584
|
+
clearTimeout(timeout);
|
|
1585
|
+
timeout = setTimeout(later, wait);
|
|
1586
|
+
if (callNow)
|
|
1587
|
+
func.apply(context, args);
|
|
1588
|
+
};
|
|
1589
|
+
}
|
|
1590
|
+
/**
|
|
1591
|
+
* @deprecated use import { length } from @firestitch/common/util; instead
|
|
1592
|
+
*/
|
|
1593
|
+
length(object) {
|
|
1594
|
+
console.warn('@deprecated use import { length } from @firestitch/common/util; instead');
|
|
1595
|
+
if (this.isObject(object)) {
|
|
1596
|
+
return Object.keys(object).length;
|
|
1597
|
+
}
|
|
1598
|
+
if (this.isArray(object)) {
|
|
1599
|
+
return object.length;
|
|
1600
|
+
}
|
|
1601
|
+
return 0;
|
|
1602
|
+
}
|
|
1603
|
+
/**
|
|
1604
|
+
* @deprecated use import { boolean } from @firestitch/common/util; instead
|
|
1605
|
+
*/
|
|
1606
|
+
boolean(value) {
|
|
1607
|
+
console.warn('@deprecated use import { boolean } from @firestitch/common/util; instead');
|
|
1608
|
+
return this.string(value).toLowerCase() !== 'false' && !!value;
|
|
1609
|
+
}
|
|
1610
|
+
/**
|
|
1611
|
+
* @deprecated use import { stringify } from @firestitch/common/util; instead
|
|
1612
|
+
*/
|
|
1613
|
+
stringify(value) {
|
|
1614
|
+
console.warn('@deprecated use import { stringify } from @firestitch/common/util; instead');
|
|
1615
|
+
return JSON.stringify(value);
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
FsUtil.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsUtil, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1619
|
+
FsUtil.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsUtil });
|
|
1620
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsUtil, decorators: [{
|
|
1621
|
+
type: Injectable
|
|
1583
1622
|
}] });
|
|
1584
1623
|
|
|
1585
|
-
class FsValidate {
|
|
1586
|
-
constructor(fsUtil) {
|
|
1587
|
-
this.fsUtil = fsUtil;
|
|
1588
|
-
}
|
|
1589
|
-
/**
|
|
1590
|
-
* @deprecated use import { email } from @firestitch/common/validate; instead
|
|
1591
|
-
*/
|
|
1592
|
-
phone(value) {
|
|
1593
|
-
const valid = /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/.test(value);
|
|
1594
|
-
return valid || !String(value).length;
|
|
1595
|
-
}
|
|
1596
|
-
/**
|
|
1597
|
-
* @deprecated use import { email } from @firestitch/common/validate; instead
|
|
1598
|
-
*/
|
|
1599
|
-
email(value) {
|
|
1600
|
-
return !!this.fsUtil.string(value).match(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);
|
|
1601
|
-
}
|
|
1602
|
-
}
|
|
1603
|
-
FsValidate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsValidate, deps: [{ token: FsUtil }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1604
|
-
FsValidate.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsValidate });
|
|
1605
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsValidate, decorators: [{
|
|
1606
|
-
type: Injectable
|
|
1624
|
+
class FsValidate {
|
|
1625
|
+
constructor(fsUtil) {
|
|
1626
|
+
this.fsUtil = fsUtil;
|
|
1627
|
+
}
|
|
1628
|
+
/**
|
|
1629
|
+
* @deprecated use import { email } from @firestitch/common/validate; instead
|
|
1630
|
+
*/
|
|
1631
|
+
phone(value) {
|
|
1632
|
+
const valid = /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/.test(value);
|
|
1633
|
+
return valid || !String(value).length;
|
|
1634
|
+
}
|
|
1635
|
+
/**
|
|
1636
|
+
* @deprecated use import { email } from @firestitch/common/validate; instead
|
|
1637
|
+
*/
|
|
1638
|
+
email(value) {
|
|
1639
|
+
return !!this.fsUtil.string(value).match(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
FsValidate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsValidate, deps: [{ token: FsUtil }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1643
|
+
FsValidate.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsValidate });
|
|
1644
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsValidate, decorators: [{
|
|
1645
|
+
type: Injectable
|
|
1607
1646
|
}], ctorParameters: function () { return [{ type: FsUtil }]; } });
|
|
1608
1647
|
|
|
1609
|
-
class FsCommonModule {
|
|
1610
|
-
static forRoot() {
|
|
1611
|
-
return {
|
|
1612
|
-
ngModule: FsCommonModule,
|
|
1613
|
-
providers: [
|
|
1614
|
-
FsArray,
|
|
1615
|
-
FsMath,
|
|
1616
|
-
FsUtil,
|
|
1617
|
-
FsValidate,
|
|
1618
|
-
],
|
|
1619
|
-
};
|
|
1620
|
-
}
|
|
1621
|
-
}
|
|
1622
|
-
FsCommonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsCommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1623
|
-
FsCommonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsCommonModule, declarations: [FsStopPropagationDirective,
|
|
1624
|
-
FsPreventDefaultDirective,
|
|
1625
|
-
|
|
1626
|
-
FsUtilGuidPipe,
|
|
1627
|
-
FsUtilIsEmptyPipe,
|
|
1628
|
-
FsUtilIsNotEmptyPipe,
|
|
1629
|
-
FsUtilStringifyPipe,
|
|
1630
|
-
FsFormatNumberPipe,
|
|
1631
|
-
FsFormatCurrencyPipe,
|
|
1632
|
-
FsFormatTruncatePipe,
|
|
1633
|
-
FsFormatBytesPipe,
|
|
1634
|
-
FsFormatOrdinalNumberPipe,
|
|
1635
|
-
FsModelChangeDirective], imports: [CommonModule], exports: [FsStopPropagationDirective,
|
|
1636
|
-
FsPreventDefaultDirective,
|
|
1637
|
-
|
|
1638
|
-
FsUtilGuidPipe,
|
|
1639
|
-
FsUtilStringifyPipe,
|
|
1640
|
-
FsFormatNumberPipe,
|
|
1641
|
-
FsFormatCurrencyPipe,
|
|
1642
|
-
FsFormatTruncatePipe,
|
|
1643
|
-
FsUtilIsEmptyPipe,
|
|
1644
|
-
FsUtilIsNotEmptyPipe,
|
|
1645
|
-
FsFormatBytesPipe,
|
|
1646
|
-
FsModelChangeDirective,
|
|
1647
|
-
FsFormatOrdinalNumberPipe] });
|
|
1648
|
-
FsCommonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsCommonModule, imports: [[
|
|
1649
|
-
CommonModule,
|
|
1650
|
-
]] });
|
|
1651
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsCommonModule, decorators: [{
|
|
1652
|
-
type: NgModule,
|
|
1653
|
-
args: [{
|
|
1654
|
-
imports: [
|
|
1655
|
-
CommonModule,
|
|
1656
|
-
],
|
|
1657
|
-
declarations: [
|
|
1658
|
-
FsStopPropagationDirective,
|
|
1659
|
-
FsPreventDefaultDirective,
|
|
1660
|
-
|
|
1661
|
-
FsUtilGuidPipe,
|
|
1662
|
-
FsUtilIsEmptyPipe,
|
|
1663
|
-
FsUtilIsNotEmptyPipe,
|
|
1664
|
-
FsUtilStringifyPipe,
|
|
1665
|
-
FsFormatNumberPipe,
|
|
1666
|
-
FsFormatCurrencyPipe,
|
|
1667
|
-
FsFormatTruncatePipe,
|
|
1668
|
-
FsFormatBytesPipe,
|
|
1669
|
-
FsFormatOrdinalNumberPipe,
|
|
1670
|
-
FsModelChangeDirective,
|
|
1671
|
-
],
|
|
1672
|
-
exports: [
|
|
1673
|
-
FsStopPropagationDirective,
|
|
1674
|
-
FsPreventDefaultDirective,
|
|
1675
|
-
|
|
1676
|
-
FsUtilGuidPipe,
|
|
1677
|
-
FsUtilStringifyPipe,
|
|
1678
|
-
FsFormatNumberPipe,
|
|
1679
|
-
FsFormatCurrencyPipe,
|
|
1680
|
-
FsFormatTruncatePipe,
|
|
1681
|
-
FsUtilIsEmptyPipe,
|
|
1682
|
-
FsUtilIsNotEmptyPipe,
|
|
1683
|
-
FsFormatBytesPipe,
|
|
1684
|
-
FsModelChangeDirective,
|
|
1685
|
-
FsFormatOrdinalNumberPipe,
|
|
1686
|
-
],
|
|
1687
|
-
}]
|
|
1648
|
+
class FsCommonModule {
|
|
1649
|
+
static forRoot() {
|
|
1650
|
+
return {
|
|
1651
|
+
ngModule: FsCommonModule,
|
|
1652
|
+
providers: [
|
|
1653
|
+
FsArray,
|
|
1654
|
+
FsMath,
|
|
1655
|
+
FsUtil,
|
|
1656
|
+
FsValidate,
|
|
1657
|
+
],
|
|
1658
|
+
};
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
FsCommonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsCommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1662
|
+
FsCommonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsCommonModule, declarations: [FsStopPropagationDirective,
|
|
1663
|
+
FsPreventDefaultDirective,
|
|
1664
|
+
FsAutoFocusDirective,
|
|
1665
|
+
FsUtilGuidPipe,
|
|
1666
|
+
FsUtilIsEmptyPipe,
|
|
1667
|
+
FsUtilIsNotEmptyPipe,
|
|
1668
|
+
FsUtilStringifyPipe,
|
|
1669
|
+
FsFormatNumberPipe,
|
|
1670
|
+
FsFormatCurrencyPipe,
|
|
1671
|
+
FsFormatTruncatePipe,
|
|
1672
|
+
FsFormatBytesPipe,
|
|
1673
|
+
FsFormatOrdinalNumberPipe,
|
|
1674
|
+
FsModelChangeDirective], imports: [CommonModule], exports: [FsStopPropagationDirective,
|
|
1675
|
+
FsPreventDefaultDirective,
|
|
1676
|
+
FsAutoFocusDirective,
|
|
1677
|
+
FsUtilGuidPipe,
|
|
1678
|
+
FsUtilStringifyPipe,
|
|
1679
|
+
FsFormatNumberPipe,
|
|
1680
|
+
FsFormatCurrencyPipe,
|
|
1681
|
+
FsFormatTruncatePipe,
|
|
1682
|
+
FsUtilIsEmptyPipe,
|
|
1683
|
+
FsUtilIsNotEmptyPipe,
|
|
1684
|
+
FsFormatBytesPipe,
|
|
1685
|
+
FsModelChangeDirective,
|
|
1686
|
+
FsFormatOrdinalNumberPipe] });
|
|
1687
|
+
FsCommonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsCommonModule, imports: [[
|
|
1688
|
+
CommonModule,
|
|
1689
|
+
]] });
|
|
1690
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsCommonModule, decorators: [{
|
|
1691
|
+
type: NgModule,
|
|
1692
|
+
args: [{
|
|
1693
|
+
imports: [
|
|
1694
|
+
CommonModule,
|
|
1695
|
+
],
|
|
1696
|
+
declarations: [
|
|
1697
|
+
FsStopPropagationDirective,
|
|
1698
|
+
FsPreventDefaultDirective,
|
|
1699
|
+
FsAutoFocusDirective,
|
|
1700
|
+
FsUtilGuidPipe,
|
|
1701
|
+
FsUtilIsEmptyPipe,
|
|
1702
|
+
FsUtilIsNotEmptyPipe,
|
|
1703
|
+
FsUtilStringifyPipe,
|
|
1704
|
+
FsFormatNumberPipe,
|
|
1705
|
+
FsFormatCurrencyPipe,
|
|
1706
|
+
FsFormatTruncatePipe,
|
|
1707
|
+
FsFormatBytesPipe,
|
|
1708
|
+
FsFormatOrdinalNumberPipe,
|
|
1709
|
+
FsModelChangeDirective,
|
|
1710
|
+
],
|
|
1711
|
+
exports: [
|
|
1712
|
+
FsStopPropagationDirective,
|
|
1713
|
+
FsPreventDefaultDirective,
|
|
1714
|
+
FsAutoFocusDirective,
|
|
1715
|
+
FsUtilGuidPipe,
|
|
1716
|
+
FsUtilStringifyPipe,
|
|
1717
|
+
FsFormatNumberPipe,
|
|
1718
|
+
FsFormatCurrencyPipe,
|
|
1719
|
+
FsFormatTruncatePipe,
|
|
1720
|
+
FsUtilIsEmptyPipe,
|
|
1721
|
+
FsUtilIsNotEmptyPipe,
|
|
1722
|
+
FsFormatBytesPipe,
|
|
1723
|
+
FsModelChangeDirective,
|
|
1724
|
+
FsFormatOrdinalNumberPipe,
|
|
1725
|
+
],
|
|
1726
|
+
}]
|
|
1688
1727
|
}] });
|
|
1689
1728
|
|
|
1690
|
-
const keyboardShortcut = (shortcut) => {
|
|
1691
|
-
// Observables for all keydown and keyup events
|
|
1692
|
-
const keyDown$ = fromEvent(document, 'keydown');
|
|
1693
|
-
const keyUp$ = fromEvent(document, 'keyup');
|
|
1694
|
-
// All KeyboardEvents - emitted only when KeyboardEvent changes (key or type)
|
|
1695
|
-
const keyEvents$ = merge(keyDown$, keyUp$).pipe(distinctUntilChanged((a, b) => a.code === b.code && a.type === b.type), share());
|
|
1696
|
-
// Create KeyboardEvent Observable for specified KeyCode
|
|
1697
|
-
const createKeyPressStream = (charCode) => keyEvents$.pipe(filter$1((event) => event.keyCode === charCode));
|
|
1698
|
-
// Create Event Stream for every KeyCode in shortcut
|
|
1699
|
-
const keyCodeEvents$ = shortcut.map((s) => createKeyPressStream(s));
|
|
1700
|
-
// Emit when specified keys are pressed (keydown).
|
|
1701
|
-
// Emit only when all specified keys are pressed at the same time.
|
|
1702
|
-
// More on combineLatest below
|
|
1703
|
-
return combineLatest(keyCodeEvents$).pipe(filter$1((arr) => arr.every((a) => a.type === 'keydown')));
|
|
1729
|
+
const keyboardShortcut = (shortcut) => {
|
|
1730
|
+
// Observables for all keydown and keyup events
|
|
1731
|
+
const keyDown$ = fromEvent(document, 'keydown');
|
|
1732
|
+
const keyUp$ = fromEvent(document, 'keyup');
|
|
1733
|
+
// All KeyboardEvents - emitted only when KeyboardEvent changes (key or type)
|
|
1734
|
+
const keyEvents$ = merge(keyDown$, keyUp$).pipe(distinctUntilChanged((a, b) => a.code === b.code && a.type === b.type), share());
|
|
1735
|
+
// Create KeyboardEvent Observable for specified KeyCode
|
|
1736
|
+
const createKeyPressStream = (charCode) => keyEvents$.pipe(filter$1((event) => event.keyCode === charCode));
|
|
1737
|
+
// Create Event Stream for every KeyCode in shortcut
|
|
1738
|
+
const keyCodeEvents$ = shortcut.map((s) => createKeyPressStream(s));
|
|
1739
|
+
// Emit when specified keys are pressed (keydown).
|
|
1740
|
+
// Emit only when all specified keys are pressed at the same time.
|
|
1741
|
+
// More on combineLatest below
|
|
1742
|
+
return combineLatest(keyCodeEvents$).pipe(filter$1((arr) => arr.every((a) => a.type === 'keydown')));
|
|
1704
1743
|
};
|
|
1705
1744
|
|
|
1706
1745
|
// Modules
|
|
1707
1746
|
|
|
1708
|
-
/**
|
|
1709
|
-
* Generated bundle index. Do not edit.
|
|
1747
|
+
/**
|
|
1748
|
+
* Generated bundle index. Do not edit.
|
|
1710
1749
|
*/
|
|
1711
1750
|
|
|
1712
|
-
export { FsArray,
|
|
1751
|
+
export { FsArray, FsAutoFocusDirective, FsAutoSelectDirective, FsCommonModule, FsFormatBytesPipe, FsFormatCurrencyPipe, FsFormatNumberPipe, FsFormatOrdinalNumberPipe, FsFormatTruncatePipe, FsMath, FsModelChangeDirective, FsPreventDefaultDirective, FsStopPropagationDirective, FsUtil, FsUtilGuidPipe, FsUtilIsEmptyPipe, FsUtilIsNotEmptyPipe, FsUtilStringifyPipe, FsValidate, KEY_0$1 as KEY_0, KEY_1$1 as KEY_1, KEY_2$1 as KEY_2, KEY_3$1 as KEY_3, KEY_4$1 as KEY_4, KEY_5$1 as KEY_5, KEY_6$1 as KEY_6, KEY_7$1 as KEY_7, KEY_8$1 as KEY_8, KEY_9$1 as KEY_9, KEY_ALT$1 as KEY_ALT, KEY_BACKSPACE$1 as KEY_BACKSPACE, KEY_CANCEL$1 as KEY_CANCEL, KEY_CAPS_LOCK$1 as KEY_CAPS_LOCK, KEY_CLEAR$1 as KEY_CLEAR, KEY_CONTROL$1 as KEY_CONTROL, KEY_DELETE$1 as KEY_DELETE, KEY_DOWN$1 as KEY_DOWN, KEY_END$1 as KEY_END, KEY_ENTER$1 as KEY_ENTER, KEY_EQUALS$1 as KEY_EQUALS, KEY_ESCAPE$1 as KEY_ESCAPE, KEY_HELP$1 as KEY_HELP, KEY_HOME$1 as KEY_HOME, KEY_INSERT$1 as KEY_INSERT, KEY_LEFT$1 as KEY_LEFT, KEY_PAGE_DOWN$1 as KEY_PAGE_DOWN, KEY_PAGE_UP$1 as KEY_PAGE_UP, KEY_PAUSE$1 as KEY_PAUSE, KEY_PRINTSCREEN$1 as KEY_PRINTSCREEN, KEY_RETURN$1 as KEY_RETURN, KEY_RIGHT$1 as KEY_RIGHT, KEY_SEMICOLON$1 as KEY_SEMICOLON, KEY_SHIFT$1 as KEY_SHIFT, KEY_SPACE$1 as KEY_SPACE, KEY_TAB$1 as KEY_TAB, KEY_UP$1 as KEY_UP, Queue, QueueState, acronym, boolean, bytes, clone, compare, currency, debounce, delayedRetry, email, filter, find, fsSourceLoader, getNormalizedPath, guid, inArray, index, indexOf, isArrayEqual, isClass, isEmpty, isNumeric, isObject, keyExists, keyboardShortcut, ksort, length, list, loadJs, loadStyles, nameValue, number, ordinalNumber, phone, remove, removeQueryParams, resolve, round, rsort, sort, stringify, throttle, toString, truncate, url, uuid, value };
|
|
1713
1752
|
//# sourceMappingURL=firestitch-common.mjs.map
|