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