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