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