@firestitch/common 12.6.4 → 12.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/directives/index.d.ts +4 -0
- package/app/directives/model-change.directive.d.ts +16 -0
- package/app/fs-common.module.d.ts +3 -2
- package/app/pipes/currency.pipe.d.ts +1 -1
- package/bundles/firestitch-common.umd.js +1071 -1032
- package/bundles/firestitch-common.umd.js.map +1 -1
- package/esm2015/app/directives/index.js +5 -0
- package/esm2015/app/directives/model-change.directive.js +37 -0
- package/esm2015/app/fs-common.module.js +19 -14
- package/esm2015/app/pipes/currency.pipe.js +3 -3
- package/esm2015/public_api.js +6 -8
- package/fesm2015/firestitch-common.js +961 -925
- package/fesm2015/firestitch-common.js.map +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +5 -7
|
@@ -1,524 +1,122 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, Pipe, LOCALE_ID, Inject, Directive, HostListener, Optional, Host, Input, NgModule } from '@angular/core';
|
|
3
1
|
import { CurrencyPipe, CommonModule } from '@angular/common';
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { Directive, Optional, Host, Input, EventEmitter, Output, HostListener, Pipe, LOCALE_ID, Inject, Injectable, NgModule } from '@angular/core';
|
|
6
4
|
import * as i1 from '@angular/material/input';
|
|
5
|
+
import * as i1$1 from '@angular/forms';
|
|
6
|
+
import { Subject, Observable, of, combineLatest, iif, throwError, timer, fromEvent, merge } from 'rxjs';
|
|
7
|
+
import { debounceTime, takeUntil, take, map, delay, finalize, shareReplay, retryWhen, tap, concatMap, distinctUntilChanged, share, filter as filter$1 } from 'rxjs/operators';
|
|
7
8
|
|
|
8
|
-
class
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
console.warn('@deprecated use import { nameValue } from @firestitch/common/array; instead');
|
|
14
|
-
let list = [];
|
|
15
|
-
if (name || value) {
|
|
16
|
-
let nameFn = typeof name === 'function' ? name : function (item) { return item[name]; };
|
|
17
|
-
let valueFn = typeof value === 'function' ? value : function (item) { return item[value]; };
|
|
18
|
-
array.forEach(function (item) {
|
|
19
|
-
list.push({ name: nameFn(item), value: valueFn(item) });
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
array.forEach(function (name, value) {
|
|
24
|
-
list.push({ name: name, value: value });
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
return list;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated use import { remove } from @firestitch/common/array; instead
|
|
31
|
-
*/
|
|
32
|
-
remove(array, query) {
|
|
33
|
-
console.warn('@deprecated use import { remove } from @firestitch/common/array; instead');
|
|
34
|
-
let idx = this.indexOf(array, query);
|
|
35
|
-
if (idx >= 0) {
|
|
36
|
-
return array.splice(idx, 1);
|
|
37
|
-
}
|
|
38
|
-
return idx;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* @deprecated use import { indexOf } from @firestitch/common/array; instead
|
|
42
|
-
*/
|
|
43
|
-
indexOf(array, query) {
|
|
44
|
-
console.warn('@deprecated use import { indexOf } from @firestitch/common/array; instead');
|
|
45
|
-
if (typeof query !== 'function') {
|
|
46
|
-
let queryObj = query;
|
|
47
|
-
query = (item) => {
|
|
48
|
-
return this.compare(queryObj, item);
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
for (let i = 0, len = array.length; i < len; i++) {
|
|
52
|
-
if (query(array[i])) {
|
|
53
|
-
return i;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return -1;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* @deprecated use import { compare } from @firestitch/common/array; instead
|
|
60
|
-
*/
|
|
61
|
-
compare(query, item) {
|
|
62
|
-
console.warn('@deprecated use import { compare } from @firestitch/common/array; instead');
|
|
63
|
-
let value = true;
|
|
64
|
-
for (let key in query) {
|
|
65
|
-
value = value && item[key] == query[key];
|
|
66
|
-
}
|
|
67
|
-
return value;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* @deprecated use import { filter } from @firestitch/common/array; instead
|
|
71
|
-
*/
|
|
72
|
-
filter(array, query) {
|
|
73
|
-
console.warn('@deprecated use import { filter } from @firestitch/common/array; instead');
|
|
74
|
-
if (typeof query !== 'function') {
|
|
75
|
-
let queryObj = query;
|
|
76
|
-
query = (item) => {
|
|
77
|
-
return this.compare(queryObj, item);
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
let isarray = Array.isArray(array);
|
|
81
|
-
let list = isarray ? [] : {};
|
|
82
|
-
if (isarray)
|
|
83
|
-
array.forEach(function (item, idx) {
|
|
84
|
-
if (query(item)) {
|
|
85
|
-
list.push(item);
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
else
|
|
89
|
-
Object.keys(array).forEach(key => {
|
|
90
|
-
if (query(array[key])) {
|
|
91
|
-
list[key] = array[key];
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
return list;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* @deprecated use import { index } from @firestitch/common/array; instead
|
|
98
|
-
*/
|
|
99
|
-
index(array, property) {
|
|
100
|
-
console.warn('@deprecated use import { index } from @firestitch/common/array; instead');
|
|
101
|
-
let list = {};
|
|
102
|
-
array.forEach(function (item, idx) {
|
|
103
|
-
list[item[property]] = item;
|
|
104
|
-
});
|
|
105
|
-
return list;
|
|
9
|
+
class FsAutofocusDirective {
|
|
10
|
+
constructor(_matInput, _el) {
|
|
11
|
+
this._matInput = _matInput;
|
|
12
|
+
this._el = _el;
|
|
13
|
+
this.fsAutofocus = true;
|
|
106
14
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
sort(array, query, reverse = false) {
|
|
111
|
-
console.warn('@deprecated use import { sort } from @firestitch/common/array; instead');
|
|
112
|
-
if (typeof query !== 'function') {
|
|
113
|
-
let queryStr = query;
|
|
114
|
-
query = function (a, b) {
|
|
115
|
-
if (reverse) {
|
|
116
|
-
if (a[queryStr] < b[queryStr]) {
|
|
117
|
-
return 1;
|
|
118
|
-
}
|
|
119
|
-
else if (a[queryStr] > b[queryStr]) {
|
|
120
|
-
return -1;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
if (a[queryStr] > b[queryStr]) {
|
|
125
|
-
return 1;
|
|
126
|
-
}
|
|
127
|
-
else if (a[queryStr] < b[queryStr]) {
|
|
128
|
-
return -1;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
return 0;
|
|
132
|
-
};
|
|
15
|
+
ngAfterViewInit() {
|
|
16
|
+
if (this.fsAutofocus || this.fsAutofocus === undefined) {
|
|
17
|
+
this.focus();
|
|
133
18
|
}
|
|
134
|
-
array.sort(query);
|
|
135
|
-
return array;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* @deprecated use import { rsort } from @firestitch/common/array; instead
|
|
139
|
-
*/
|
|
140
|
-
rsort(array, query) {
|
|
141
|
-
console.warn('@deprecated use import { rsort } from @firestitch/common/array; instead');
|
|
142
|
-
return this.sort(array, query, true);
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* @deprecated use import { list } from @firestitch/common/array; instead
|
|
146
|
-
*/
|
|
147
|
-
list(array, property, index = null) {
|
|
148
|
-
console.warn('@deprecated use import { list } from @firestitch/common/array; instead');
|
|
149
|
-
let list = index ? {} : [];
|
|
150
|
-
array.forEach(function (item, idx) {
|
|
151
|
-
if (index) {
|
|
152
|
-
list[item[index]] = item[property];
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
list.push(item[property]);
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
return list;
|
|
159
19
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
20
|
+
focus() {
|
|
21
|
+
setTimeout(() => {
|
|
22
|
+
const tmpEl = document.createElement('input');
|
|
23
|
+
tmpEl.style.width = '0';
|
|
24
|
+
tmpEl.style.height = '0';
|
|
25
|
+
tmpEl.style.margin = '0';
|
|
26
|
+
tmpEl.style.padding = '0';
|
|
27
|
+
tmpEl.style.border = '0';
|
|
28
|
+
tmpEl.style.opacity = '0';
|
|
29
|
+
document.body.appendChild(tmpEl);
|
|
30
|
+
tmpEl.focus();
|
|
31
|
+
if (this._matInput) {
|
|
32
|
+
this._matInput.focus();
|
|
169
33
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
Object.keys(keyed).forEach(key => {
|
|
173
|
-
Object.keys(keyed).forEach(key => {
|
|
174
|
-
let object = keyed[key];
|
|
175
|
-
if (!keyed[key][depth_property]) {
|
|
176
|
-
if (keyed[key][parent_property]) {
|
|
177
|
-
keyed[key][depth_property] = keyed[keyed[key][parent_property]][depth_property] + 1;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
return keyed;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* @deprecated use import { inArray } from @firestitch/common/array; instead
|
|
186
|
-
*/
|
|
187
|
-
inArray(values, array) {
|
|
188
|
-
console.warn('@deprecated use import { inArray } from @firestitch/common/array; instead');
|
|
189
|
-
if (!Array.isArray(values)) {
|
|
190
|
-
values = [values];
|
|
191
|
-
}
|
|
192
|
-
for (let i = 0, len = values.length; i < len; i++) {
|
|
193
|
-
if (array.indexOf(values[i]) >= 0) {
|
|
194
|
-
return true;
|
|
34
|
+
else if (this._el.nativeElement.focus) {
|
|
35
|
+
this._el.nativeElement.focus();
|
|
195
36
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* @deprecated use import { keyExists } from @firestitch/common/array; instead
|
|
201
|
-
*/
|
|
202
|
-
keyExists(array, key) {
|
|
203
|
-
console.warn('@deprecated use import { keyExists } from @firestitch/common/array; instead');
|
|
204
|
-
return array.hasOwnProperty(key);
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* @deprecated use import { length } from @firestitch/common/array; instead
|
|
208
|
-
*/
|
|
209
|
-
length(array) {
|
|
210
|
-
console.warn('@deprecated use import { length } from @firestitch/common/array; instead');
|
|
211
|
-
return array.length;
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* @deprecated use import { ksort } from @firestitch/common/array; instead
|
|
215
|
-
*/
|
|
216
|
-
ksort(unordered) {
|
|
217
|
-
console.warn('@deprecated use import { ksort } from @firestitch/common/array; instead');
|
|
218
|
-
Object.keys(unordered).sort().forEach(function (key) {
|
|
219
|
-
let value = unordered[key];
|
|
220
|
-
delete unordered[key];
|
|
221
|
-
unordered[key] = value;
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
FsArray.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsArray, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
226
|
-
FsArray.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsArray });
|
|
227
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsArray, decorators: [{
|
|
228
|
-
type: Injectable
|
|
229
|
-
}] });
|
|
230
|
-
|
|
231
|
-
class FsMath {
|
|
232
|
-
/**
|
|
233
|
-
* @deprecated use _.round() instead {@link https://lodash.com/docs/4.17.5#round}
|
|
234
|
-
*/
|
|
235
|
-
round(number, precision) {
|
|
236
|
-
console.warn('@deprecated use _.round() instead {@link https://lodash.com/docs/4.17.5#round}');
|
|
237
|
-
precision = precision || 0;
|
|
238
|
-
let factor = Math.pow(10, precision);
|
|
239
|
-
let tempNumber = number * factor;
|
|
240
|
-
let roundedTempNumber = Math.round(tempNumber);
|
|
241
|
-
return roundedTempNumber / factor;
|
|
37
|
+
document.body.removeChild(tmpEl);
|
|
38
|
+
}, 50);
|
|
242
39
|
}
|
|
243
40
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type:
|
|
247
|
-
type:
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
pattern = pattern || 'xxxxxx';
|
|
265
|
-
return pattern.replace(/[xy]/g, function (c) {
|
|
266
|
-
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
|
267
|
-
return v.toString(16);
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* @deprecated use import { uuid } from @firestitch/common/util; instead
|
|
272
|
-
*/
|
|
273
|
-
uuid() {
|
|
274
|
-
console.warn('@deprecated use @firestitch/common/util/uuid instead');
|
|
275
|
-
return this.guid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx');
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* @deprecated use import { resolve } from @firestitch/common/util; instead
|
|
279
|
-
*/
|
|
280
|
-
resolve(promise, defaults = []) {
|
|
281
|
-
console.warn('@deprecated use @firestitch/common/util/resolve instead');
|
|
282
|
-
const result = defaults;
|
|
283
|
-
return new Promise(resolve => {
|
|
284
|
-
promise.then(function (data) {
|
|
285
|
-
Object.keys(data).forEach(key => result[key] = data[key]);
|
|
286
|
-
resolve(result);
|
|
287
|
-
});
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* @deprecated use _.toInteger() instead
|
|
292
|
-
*/
|
|
293
|
-
int(value) {
|
|
294
|
-
console.warn('@deprecated use _.toInteger() instead');
|
|
295
|
-
value = parseInt(value);
|
|
296
|
-
if (isNaN(value)) {
|
|
297
|
-
value = 0;
|
|
298
|
-
}
|
|
299
|
-
return value;
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* @deprecated use _.toFinite() instead
|
|
303
|
-
*/
|
|
304
|
-
float(value) {
|
|
305
|
-
console.warn('@deprecated use _.toFinite() instead');
|
|
306
|
-
value = parseFloat(value);
|
|
307
|
-
if (isNaN(value)) {
|
|
308
|
-
value = 0;
|
|
309
|
-
}
|
|
310
|
-
return value;
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* @deprecated use _.toString() instead
|
|
314
|
-
*/
|
|
315
|
-
string(string) {
|
|
316
|
-
console.warn('@deprecated use _.toString() instead');
|
|
317
|
-
if (string === null || string === undefined) {
|
|
318
|
-
string = '';
|
|
319
|
-
}
|
|
320
|
-
return (string).toString();
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* @deprecated use import { isEmpty } from @firestitch/common/util; instead
|
|
324
|
-
*/
|
|
325
|
-
isEmpty(value, options) {
|
|
326
|
-
console.warn('@deprecated use import { isEmpty } from @firestitch/common/util; instead');
|
|
327
|
-
options = options || {};
|
|
328
|
-
return value === undefined ||
|
|
329
|
-
value === null ||
|
|
330
|
-
value === false ||
|
|
331
|
-
value === '' ||
|
|
332
|
-
!this.string(value).length ||
|
|
333
|
-
(this.isObject(value) &&
|
|
334
|
-
(value.constructor.name === 'Object' && !Object.keys(value).length)) ||
|
|
335
|
-
(!options.zero && (value === 0 || value === '0'));
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
* @deprecated use _.isInteger() instead
|
|
339
|
-
*/
|
|
340
|
-
isInt(value, type) {
|
|
341
|
-
console.warn('@deprecated use _.isInteger() instead');
|
|
342
|
-
const int = !!this.string(value).match(/^\d+$/);
|
|
343
|
-
if (!int) {
|
|
344
|
-
return false;
|
|
345
|
-
}
|
|
346
|
-
if (type) {
|
|
347
|
-
return Number.isInteger(value);
|
|
348
|
-
}
|
|
349
|
-
return true;
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* @deprecated use _.each() instead {@link https://lodash.com/docs/4.17.5#forEach}
|
|
353
|
-
*/
|
|
354
|
-
each(object, func) {
|
|
355
|
-
console.warn('@deprecated use _.each() instead {@link https://lodash.com/docs/4.17.5#forEach}');
|
|
356
|
-
if (!this.isArray(object) && !this.isObject(object)) {
|
|
357
|
-
return;
|
|
358
|
-
}
|
|
359
|
-
Object.keys(object).forEach(function (key) {
|
|
360
|
-
func(object[key], key);
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* @deprecated use _.isArrayLikeObject() {@link https://lodash.com/docs/4.17.5#isArrayLikeObject}
|
|
365
|
-
* or _.isObject() {@link https://lodash.com/docs/4.17.5#isObject} instead
|
|
366
|
-
*/
|
|
367
|
-
isObject(value) {
|
|
368
|
-
console.warn('@deprecated use _.isArrayLikeObject() {@link https://lodash.com/docs/4.17.5#isArrayLikeObject} or _.isObject() {@link https://lodash.com/docs/4.17.5#isObject} instead');
|
|
369
|
-
return value !== null && typeof value === 'object' && !this.isArray(value);
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* @deprecated use _.isString() instead {@link https://lodash.com/docs/4.17.5#isString}
|
|
373
|
-
*/
|
|
374
|
-
isString(value) {
|
|
375
|
-
console.warn('@deprecated use _.isString() instead {@link https://lodash.com/docs/4.17.5#isString}');
|
|
376
|
-
return typeof value === 'string' || value instanceof String;
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* @deprecated use _.isArray() instead {@link https://lodash.com/docs/4.17.5#isArray}
|
|
380
|
-
*/
|
|
381
|
-
isArray(value) {
|
|
382
|
-
console.warn('@deprecated use _.isArray() instead {@link https://lodash.com/docs/4.17.5#isArray}');
|
|
383
|
-
return value instanceof Array;
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* @deprecated use import { isNumeric } from @firestitch/common/util; instead
|
|
387
|
-
*/
|
|
388
|
-
isNumeric(value) {
|
|
389
|
-
console.warn('@deprecated use import { isNumeric } from @firestitch/common/util; instead');
|
|
390
|
-
return this.string(value).length && !!this.string(value).match(/^-?\d*\.?\d*$/);
|
|
391
|
-
}
|
|
392
|
-
/**
|
|
393
|
-
* @deprecated use import { isClass } from @firestitch/common/util; instead
|
|
394
|
-
*/
|
|
395
|
-
isClass(value, cls) {
|
|
396
|
-
console.warn('@deprecated use import { isClass } from @firestitch/common/util; instead');
|
|
397
|
-
if (this.isObject(value)) {
|
|
398
|
-
if (this.isString(cls)) {
|
|
399
|
-
if (value.constructor) {
|
|
400
|
-
if (value.constructor.name === cls) {
|
|
401
|
-
return true;
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
else {
|
|
406
|
-
if (value instanceof cls) {
|
|
407
|
-
return true;
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
return false;
|
|
412
|
-
}
|
|
413
|
-
/**
|
|
414
|
-
* @deprecated use _.isBoolean() instead {@link https://lodash.com/docs/4.17.5#isBoolean}
|
|
415
|
-
*/
|
|
416
|
-
isBoolean(value) {
|
|
417
|
-
console.warn('@deprecated use _.isBoolean() instead {@link https://lodash.com/docs/4.17.5#isBoolean}');
|
|
418
|
-
return value === true || value === false;
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* @deprecated use import { value } from @firestitch/common/util; instead
|
|
422
|
-
*/
|
|
423
|
-
value(object, key, def) {
|
|
424
|
-
console.warn('@deprecated use import { value } from @firestitch/common/util; instead');
|
|
425
|
-
if (this.isObject(object) || this.isArray(object)) {
|
|
426
|
-
if (object.hasOwnProperty(key)) {
|
|
427
|
-
return object[key];
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
return def;
|
|
431
|
-
}
|
|
432
|
-
throttle(func, wait) {
|
|
433
|
-
console.warn('@deprecated use import { throttle } from @firestitch/common/util; instead');
|
|
434
|
-
let waiting = false; // Initially, we're not waiting
|
|
435
|
-
return function () {
|
|
436
|
-
if (!waiting) { // If we're not waiting
|
|
437
|
-
func.apply(null, arguments); // Execute users function
|
|
438
|
-
waiting = true; // Prevent future invocations
|
|
439
|
-
setTimeout(function () {
|
|
440
|
-
waiting = false; // And allow future invocations
|
|
441
|
-
}, wait);
|
|
442
|
-
}
|
|
443
|
-
};
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* @deprecated use import { debounce } from @firestitch/common/util; instead
|
|
447
|
-
*/
|
|
448
|
-
debounce(func, wait, immediate) {
|
|
449
|
-
console.warn('@deprecated use import { debounce } from @firestitch/common/util; instead');
|
|
450
|
-
var timeout;
|
|
451
|
-
return function () {
|
|
452
|
-
var context = this, args = arguments;
|
|
453
|
-
var later = function () {
|
|
454
|
-
timeout = null;
|
|
455
|
-
if (!immediate)
|
|
456
|
-
func.apply(context, args);
|
|
457
|
-
};
|
|
458
|
-
var callNow = immediate && !timeout;
|
|
459
|
-
clearTimeout(timeout);
|
|
460
|
-
timeout = setTimeout(later, wait);
|
|
461
|
-
if (callNow)
|
|
462
|
-
func.apply(context, args);
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
|
-
/**
|
|
466
|
-
* @deprecated use import { length } from @firestitch/common/util; instead
|
|
467
|
-
*/
|
|
468
|
-
length(object) {
|
|
469
|
-
console.warn('@deprecated use import { length } from @firestitch/common/util; instead');
|
|
470
|
-
if (this.isObject(object)) {
|
|
471
|
-
return Object.keys(object).length;
|
|
472
|
-
}
|
|
473
|
-
if (this.isArray(object)) {
|
|
474
|
-
return object.length;
|
|
475
|
-
}
|
|
476
|
-
return 0;
|
|
41
|
+
FsAutofocusDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAutofocusDirective, deps: [{ token: i1.MatInput, host: true, optional: true }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
42
|
+
FsAutofocusDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsAutofocusDirective, selector: "[fsAutofocus],[autofocus]", inputs: { fsAutofocus: "fsAutofocus" }, ngImport: i0 });
|
|
43
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsAutofocusDirective, decorators: [{
|
|
44
|
+
type: Directive,
|
|
45
|
+
args: [{
|
|
46
|
+
selector: '[fsAutofocus],[autofocus]',
|
|
47
|
+
}]
|
|
48
|
+
}], ctorParameters: function () { return [{ type: i1.MatInput, decorators: [{
|
|
49
|
+
type: Optional
|
|
50
|
+
}, {
|
|
51
|
+
type: Host
|
|
52
|
+
}] }, { type: i0.ElementRef }]; }, propDecorators: { fsAutofocus: [{
|
|
53
|
+
type: Input
|
|
54
|
+
}] } });
|
|
55
|
+
|
|
56
|
+
class FsModelChangeDirective {
|
|
57
|
+
constructor(_ngModel) {
|
|
58
|
+
this._ngModel = _ngModel;
|
|
59
|
+
this.fsModelChange = new EventEmitter();
|
|
60
|
+
this._destroy$ = new Subject();
|
|
477
61
|
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
62
|
+
ngOnInit() {
|
|
63
|
+
this._ngModel.update
|
|
64
|
+
.pipe(debounceTime(this.fsModelChangeOptions.debounce), takeUntil(this._destroy$))
|
|
65
|
+
.subscribe((value) => {
|
|
66
|
+
this.fsModelChange.emit(value);
|
|
67
|
+
});
|
|
484
68
|
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
stringify(value) {
|
|
489
|
-
console.warn('@deprecated use import { stringify } from @firestitch/common/util; instead');
|
|
490
|
-
return JSON.stringify(value);
|
|
69
|
+
ngOnDestroy() {
|
|
70
|
+
this._destroy$.next();
|
|
71
|
+
this._destroy$.complete();
|
|
491
72
|
}
|
|
492
73
|
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type:
|
|
496
|
-
type:
|
|
497
|
-
|
|
74
|
+
FsModelChangeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsModelChangeDirective, deps: [{ token: i1$1.NgModel }], target: i0.ɵɵFactoryTarget.Directive });
|
|
75
|
+
FsModelChangeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsModelChangeDirective, selector: "[fsModelChange]", inputs: { fsModelChangeOptions: "fsModelChangeOptions" }, outputs: { fsModelChange: "fsModelChange" }, ngImport: i0 });
|
|
76
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsModelChangeDirective, decorators: [{
|
|
77
|
+
type: Directive,
|
|
78
|
+
args: [{
|
|
79
|
+
selector: '[fsModelChange]',
|
|
80
|
+
}]
|
|
81
|
+
}], ctorParameters: function () { return [{ type: i1$1.NgModel }]; }, propDecorators: { fsModelChangeOptions: [{
|
|
82
|
+
type: Input
|
|
83
|
+
}], fsModelChange: [{
|
|
84
|
+
type: Output
|
|
85
|
+
}] } });
|
|
498
86
|
|
|
499
|
-
class
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
}
|
|
503
|
-
/**
|
|
504
|
-
* @deprecated use import { email } from @firestitch/common/validate; instead
|
|
505
|
-
*/
|
|
506
|
-
phone(value) {
|
|
507
|
-
const valid = /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/.test(value);
|
|
508
|
-
return valid || !String(value).length;
|
|
87
|
+
class FsPreventDefaultDirective {
|
|
88
|
+
preventClick(event) {
|
|
89
|
+
event.preventDefault();
|
|
509
90
|
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
91
|
+
}
|
|
92
|
+
FsPreventDefaultDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPreventDefaultDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
93
|
+
FsPreventDefaultDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsPreventDefaultDirective, selector: "[fsPreventDefault]", host: { listeners: { "click": "preventClick($event)" } }, ngImport: i0 });
|
|
94
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPreventDefaultDirective, decorators: [{
|
|
95
|
+
type: Directive,
|
|
96
|
+
args: [{
|
|
97
|
+
selector: '[fsPreventDefault]',
|
|
98
|
+
}]
|
|
99
|
+
}], propDecorators: { preventClick: [{
|
|
100
|
+
type: HostListener,
|
|
101
|
+
args: ['click', ['$event']]
|
|
102
|
+
}] } });
|
|
103
|
+
|
|
104
|
+
class FsStopPropagationDirective {
|
|
105
|
+
preventClick(event) {
|
|
106
|
+
event.stopPropagation();
|
|
515
107
|
}
|
|
516
108
|
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type:
|
|
520
|
-
type:
|
|
521
|
-
|
|
109
|
+
FsStopPropagationDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsStopPropagationDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
110
|
+
FsStopPropagationDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsStopPropagationDirective, selector: "[fsStopPropagation]", host: { listeners: { "click": "preventClick($event)" } }, ngImport: i0 });
|
|
111
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsStopPropagationDirective, decorators: [{
|
|
112
|
+
type: Directive,
|
|
113
|
+
args: [{
|
|
114
|
+
selector: '[fsStopPropagation]',
|
|
115
|
+
}]
|
|
116
|
+
}], propDecorators: { preventClick: [{
|
|
117
|
+
type: HostListener,
|
|
118
|
+
args: ['click', ['$event']]
|
|
119
|
+
}] } });
|
|
522
120
|
|
|
523
121
|
function stringify(value) {
|
|
524
122
|
return JSON.stringify(value);
|
|
@@ -543,72 +141,252 @@ function guid(pattern, options = { case: 'lower', numbers: true }) {
|
|
|
543
141
|
});
|
|
544
142
|
}
|
|
545
143
|
|
|
546
|
-
function isEmpty(value, options) {
|
|
547
|
-
options = options || {};
|
|
548
|
-
return value === undefined ||
|
|
549
|
-
value === null ||
|
|
550
|
-
value === false ||
|
|
551
|
-
value === '' ||
|
|
552
|
-
String(value).length === 0 ||
|
|
553
|
-
(Array.isArray(value) && value.length === 0) ||
|
|
554
|
-
(value instanceof Object && (value.constructor.name === 'Object' && !Object.keys(value).length)) ||
|
|
555
|
-
(!options.zero && (value === 0 || value === '0'));
|
|
144
|
+
function isEmpty(value, options) {
|
|
145
|
+
options = options || {};
|
|
146
|
+
return value === undefined ||
|
|
147
|
+
value === null ||
|
|
148
|
+
value === false ||
|
|
149
|
+
value === '' ||
|
|
150
|
+
String(value).length === 0 ||
|
|
151
|
+
(Array.isArray(value) && value.length === 0) ||
|
|
152
|
+
(value instanceof Object && (value.constructor.name === 'Object' && !Object.keys(value).length)) ||
|
|
153
|
+
(!options.zero && (value === 0 || value === '0'));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
class FsUtilStringifyPipe {
|
|
157
|
+
constructor() { }
|
|
158
|
+
transform(value) {
|
|
159
|
+
return stringify(value);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
FsUtilStringifyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsUtilStringifyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
163
|
+
FsUtilStringifyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsUtilStringifyPipe, name: "fsUtilStringify" });
|
|
164
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsUtilStringifyPipe, decorators: [{
|
|
165
|
+
type: Pipe,
|
|
166
|
+
args: [{
|
|
167
|
+
name: 'fsUtilStringify'
|
|
168
|
+
}]
|
|
169
|
+
}], ctorParameters: function () { return []; } });
|
|
170
|
+
class FsUtilGuidPipe {
|
|
171
|
+
constructor() { }
|
|
172
|
+
transform() {
|
|
173
|
+
return guid();
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
FsUtilGuidPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsUtilGuidPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
177
|
+
FsUtilGuidPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsUtilGuidPipe, name: "fsUtilGuid" });
|
|
178
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsUtilGuidPipe, decorators: [{
|
|
179
|
+
type: Pipe,
|
|
180
|
+
args: [{
|
|
181
|
+
name: 'fsUtilGuid'
|
|
182
|
+
}]
|
|
183
|
+
}], ctorParameters: function () { return []; } });
|
|
184
|
+
class FsUtilIsEmptyPipe {
|
|
185
|
+
transform(value) {
|
|
186
|
+
return isEmpty(value);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
FsUtilIsEmptyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsUtilIsEmptyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
190
|
+
FsUtilIsEmptyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsUtilIsEmptyPipe, name: "fsUtilIsEmpty" });
|
|
191
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsUtilIsEmptyPipe, decorators: [{
|
|
192
|
+
type: Pipe,
|
|
193
|
+
args: [{
|
|
194
|
+
name: 'fsUtilIsEmpty'
|
|
195
|
+
}]
|
|
196
|
+
}] });
|
|
197
|
+
class FsUtilIsNotEmptyPipe {
|
|
198
|
+
transform(value) {
|
|
199
|
+
return !isEmpty(value);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
FsUtilIsNotEmptyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsUtilIsNotEmptyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
203
|
+
FsUtilIsNotEmptyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsUtilIsNotEmptyPipe, name: "fsUtilIsNotEmpty" });
|
|
204
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsUtilIsNotEmptyPipe, decorators: [{
|
|
205
|
+
type: Pipe,
|
|
206
|
+
args: [{
|
|
207
|
+
name: 'fsUtilIsNotEmpty'
|
|
208
|
+
}]
|
|
209
|
+
}] });
|
|
210
|
+
|
|
211
|
+
function email(value) {
|
|
212
|
+
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,}))$/);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function phone(value) {
|
|
216
|
+
const valid = /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4}/.test(value);
|
|
217
|
+
return valid || !String(value).length;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Check validity of the url.
|
|
222
|
+
* Protocol (http/https) isn't required.
|
|
223
|
+
* @param value
|
|
224
|
+
* @returns {boolean}
|
|
225
|
+
*/
|
|
226
|
+
function url(value) {
|
|
227
|
+
const expression = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#%[\]@!\$&'\(\)\*\+,;=.]+$/gm;
|
|
228
|
+
const regexp = new RegExp(expression);
|
|
229
|
+
return !!String(value).match(regexp);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function compare(query, item) {
|
|
233
|
+
let value = true;
|
|
234
|
+
for (const key in query) {
|
|
235
|
+
value = value && item[key] == query[key];
|
|
236
|
+
}
|
|
237
|
+
return value;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function filter(array, query) {
|
|
241
|
+
if (typeof query !== 'function') {
|
|
242
|
+
const queryObj = query;
|
|
243
|
+
query = (item) => {
|
|
244
|
+
return compare(queryObj, item);
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
const isarray = Array.isArray(array);
|
|
248
|
+
const list = isarray ? [] : {};
|
|
249
|
+
if (isarray) {
|
|
250
|
+
array.forEach(function (item, idx) {
|
|
251
|
+
if (query(item)) {
|
|
252
|
+
list.push(item);
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
Object.keys(array).forEach(key => {
|
|
258
|
+
if (query(array[key])) {
|
|
259
|
+
list[key] = array[key];
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
return list;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function inArray(values, array) {
|
|
267
|
+
if (!Array.isArray(values)) {
|
|
268
|
+
values = [values];
|
|
269
|
+
}
|
|
270
|
+
for (let i = 0, len = values.length; i < len; i++) {
|
|
271
|
+
if (array.indexOf(values[i]) >= 0) {
|
|
272
|
+
return true;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function index(array, name, value = null) {
|
|
279
|
+
const list = {};
|
|
280
|
+
array.forEach(function (item) {
|
|
281
|
+
list[item[name]] = value ? item[value] : item;
|
|
282
|
+
});
|
|
283
|
+
return list;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function indexOf(array, query) {
|
|
287
|
+
if (typeof query !== 'function') {
|
|
288
|
+
const queryObj = query;
|
|
289
|
+
query = (item) => {
|
|
290
|
+
return compare(queryObj, item);
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
for (let i = 0, len = array.length; i < len; i++) {
|
|
294
|
+
if (query(array[i])) {
|
|
295
|
+
return i;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return -1;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function keyExists(array, key) {
|
|
302
|
+
return array.hasOwnProperty(key);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function ksort(unordered) {
|
|
306
|
+
Object.keys(unordered).sort().forEach(function (key) {
|
|
307
|
+
const value = unordered[key];
|
|
308
|
+
delete unordered[key];
|
|
309
|
+
unordered[key] = value;
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
function list(array, property, index = null) {
|
|
314
|
+
const resultList = index ? {} : [];
|
|
315
|
+
array.forEach(function (item, idx) {
|
|
316
|
+
if (index) {
|
|
317
|
+
resultList[item[index]] = item[property];
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
resultList.push(item[property]);
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
return resultList;
|
|
556
324
|
}
|
|
557
325
|
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
326
|
+
function nameValue(array, name, value) {
|
|
327
|
+
const list = [];
|
|
328
|
+
if (name || value) {
|
|
329
|
+
const nameFn = typeof name === 'function' ? name : function (item) {
|
|
330
|
+
return item[name];
|
|
331
|
+
};
|
|
332
|
+
const valueFn = typeof value === 'function' ? value : function (item) {
|
|
333
|
+
return item[value];
|
|
334
|
+
};
|
|
335
|
+
array.forEach(function (item) {
|
|
336
|
+
list.push({ name: nameFn(item), value: valueFn(item) });
|
|
337
|
+
});
|
|
562
338
|
}
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
type: Pipe,
|
|
568
|
-
args: [{
|
|
569
|
-
name: 'fsUtilStringify'
|
|
570
|
-
}]
|
|
571
|
-
}], ctorParameters: function () { return []; } });
|
|
572
|
-
class FsUtilGuidPipe {
|
|
573
|
-
constructor() { }
|
|
574
|
-
transform() {
|
|
575
|
-
return guid();
|
|
339
|
+
else {
|
|
340
|
+
array.forEach(function (n, v) {
|
|
341
|
+
list.push({ name: n, value: v });
|
|
342
|
+
});
|
|
576
343
|
}
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
}]
|
|
585
|
-
}], ctorParameters: function () { return []; } });
|
|
586
|
-
class FsUtilIsEmptyPipe {
|
|
587
|
-
transform(value) {
|
|
588
|
-
return isEmpty(value);
|
|
344
|
+
return list;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
function remove(array, query) {
|
|
348
|
+
const idx = indexOf(array, query);
|
|
349
|
+
if (idx >= 0) {
|
|
350
|
+
return array.splice(idx, 1);
|
|
589
351
|
}
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
352
|
+
return idx;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
function sort(array, query, reverse = false) {
|
|
356
|
+
if (typeof query !== 'function') {
|
|
357
|
+
const queryStr = query;
|
|
358
|
+
query = function (a, b) {
|
|
359
|
+
if (reverse) {
|
|
360
|
+
if (a[queryStr] < b[queryStr]) {
|
|
361
|
+
return 1;
|
|
362
|
+
}
|
|
363
|
+
else if (a[queryStr] > b[queryStr]) {
|
|
364
|
+
return -1;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
if (a[queryStr] > b[queryStr]) {
|
|
369
|
+
return 1;
|
|
370
|
+
}
|
|
371
|
+
else if (a[queryStr] < b[queryStr]) {
|
|
372
|
+
return -1;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
return 0;
|
|
376
|
+
};
|
|
602
377
|
}
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
378
|
+
array.sort(query);
|
|
379
|
+
return array;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
function rsort(array, query) {
|
|
383
|
+
return sort(array, query, true);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
function find(array, query) {
|
|
387
|
+
const data = filter(array, query);
|
|
388
|
+
return data.length ? data[0] : null;
|
|
389
|
+
}
|
|
612
390
|
|
|
613
391
|
function boolean(value) {
|
|
614
392
|
return String(value).toLowerCase() !== 'false' && !!value;
|
|
@@ -631,43 +409,43 @@ function debounce(func, wait, immediate) {
|
|
|
631
409
|
};
|
|
632
410
|
}
|
|
633
411
|
|
|
634
|
-
const KEY_CANCEL = 3;
|
|
635
|
-
const KEY_HELP = 6;
|
|
636
|
-
const KEY_BACKSPACE = 8;
|
|
637
|
-
const KEY_TAB = 9;
|
|
638
|
-
const KEY_CLEAR = 12;
|
|
639
|
-
const KEY_RETURN = 13;
|
|
640
|
-
const KEY_ENTER = 14;
|
|
641
|
-
const KEY_SHIFT = 16;
|
|
642
|
-
const KEY_CONTROL = 17;
|
|
643
|
-
const KEY_ALT = 18;
|
|
644
|
-
const KEY_PAUSE = 19;
|
|
645
|
-
const KEY_CAPS_LOCK = 20;
|
|
646
|
-
const KEY_ESCAPE = 27;
|
|
647
|
-
const KEY_SPACE = 32;
|
|
648
|
-
const KEY_PAGE_UP = 33;
|
|
649
|
-
const KEY_PAGE_DOWN = 34;
|
|
650
|
-
const KEY_END = 35;
|
|
651
|
-
const KEY_HOME = 36;
|
|
652
|
-
const KEY_LEFT = 37;
|
|
653
|
-
const KEY_UP = 38;
|
|
654
|
-
const KEY_RIGHT = 39;
|
|
655
|
-
const KEY_DOWN = 40;
|
|
656
|
-
const KEY_PRINTSCREEN = 44;
|
|
657
|
-
const KEY_INSERT = 45;
|
|
658
|
-
const KEY_DELETE = 46;
|
|
659
|
-
const KEY_0 = 48;
|
|
660
|
-
const KEY_1 = 49;
|
|
661
|
-
const KEY_2 = 50;
|
|
662
|
-
const KEY_3 = 51;
|
|
663
|
-
const KEY_4 = 52;
|
|
664
|
-
const KEY_5 = 53;
|
|
665
|
-
const KEY_6 = 54;
|
|
666
|
-
const KEY_7 = 55;
|
|
667
|
-
const KEY_8 = 56;
|
|
668
|
-
const KEY_9 = 57;
|
|
669
|
-
const KEY_SEMICOLON = 59;
|
|
670
|
-
const KEY_EQUALS = 61;
|
|
412
|
+
const KEY_CANCEL$1 = 3;
|
|
413
|
+
const KEY_HELP$1 = 6;
|
|
414
|
+
const KEY_BACKSPACE$1 = 8;
|
|
415
|
+
const KEY_TAB$1 = 9;
|
|
416
|
+
const KEY_CLEAR$1 = 12;
|
|
417
|
+
const KEY_RETURN$1 = 13;
|
|
418
|
+
const KEY_ENTER$1 = 14;
|
|
419
|
+
const KEY_SHIFT$1 = 16;
|
|
420
|
+
const KEY_CONTROL$1 = 17;
|
|
421
|
+
const KEY_ALT$1 = 18;
|
|
422
|
+
const KEY_PAUSE$1 = 19;
|
|
423
|
+
const KEY_CAPS_LOCK$1 = 20;
|
|
424
|
+
const KEY_ESCAPE$1 = 27;
|
|
425
|
+
const KEY_SPACE$1 = 32;
|
|
426
|
+
const KEY_PAGE_UP$1 = 33;
|
|
427
|
+
const KEY_PAGE_DOWN$1 = 34;
|
|
428
|
+
const KEY_END$1 = 35;
|
|
429
|
+
const KEY_HOME$1 = 36;
|
|
430
|
+
const KEY_LEFT$1 = 37;
|
|
431
|
+
const KEY_UP$1 = 38;
|
|
432
|
+
const KEY_RIGHT$1 = 39;
|
|
433
|
+
const KEY_DOWN$1 = 40;
|
|
434
|
+
const KEY_PRINTSCREEN$1 = 44;
|
|
435
|
+
const KEY_INSERT$1 = 45;
|
|
436
|
+
const KEY_DELETE$1 = 46;
|
|
437
|
+
const KEY_0$1 = 48;
|
|
438
|
+
const KEY_1$1 = 49;
|
|
439
|
+
const KEY_2$1 = 50;
|
|
440
|
+
const KEY_3$1 = 51;
|
|
441
|
+
const KEY_4$1 = 52;
|
|
442
|
+
const KEY_5$1 = 53;
|
|
443
|
+
const KEY_6$1 = 54;
|
|
444
|
+
const KEY_7$1 = 55;
|
|
445
|
+
const KEY_8$1 = 56;
|
|
446
|
+
const KEY_9$1 = 57;
|
|
447
|
+
const KEY_SEMICOLON$1 = 59;
|
|
448
|
+
const KEY_EQUALS$1 = 61;
|
|
671
449
|
|
|
672
450
|
function length(object) {
|
|
673
451
|
if (Array.isArray(object)) {
|
|
@@ -1145,19 +923,27 @@ function number(value, decimals) {
|
|
|
1145
923
|
return Number(value || 0).toLocaleString(undefined, { maximumFractionDigits: decimals });
|
|
1146
924
|
}
|
|
1147
925
|
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
926
|
+
function acronym(str, length = 2) {
|
|
927
|
+
const splittedString = str
|
|
928
|
+
.replace(/[^a-zA-Z0-9]+/g, ' ')
|
|
929
|
+
.split(' ');
|
|
930
|
+
let result = '';
|
|
931
|
+
for (let i = 0; i < length; i++) {
|
|
932
|
+
if (!splittedString[i]) {
|
|
933
|
+
if (splittedString.length === 1) {
|
|
934
|
+
for (let j = 1; j < length; j++) {
|
|
935
|
+
if (!splittedString[i - 1][j]) {
|
|
936
|
+
break;
|
|
937
|
+
}
|
|
938
|
+
result += splittedString[i - 1][j].toUpperCase();
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
break;
|
|
942
|
+
}
|
|
943
|
+
result += splittedString[i][0].toUpperCase();
|
|
1151
944
|
}
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
FsFormatNumberPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormatNumberPipe, name: "fsFormatNumber" });
|
|
1155
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormatNumberPipe, decorators: [{
|
|
1156
|
-
type: Pipe,
|
|
1157
|
-
args: [{
|
|
1158
|
-
name: 'fsFormatNumber'
|
|
1159
|
-
}]
|
|
1160
|
-
}] });
|
|
945
|
+
return result;
|
|
946
|
+
}
|
|
1161
947
|
|
|
1162
948
|
function currency(amount, precision = [2, 10], currencyCode = 'USD', locale = 'en-US') {
|
|
1163
949
|
const digitsInfo = Array.isArray(precision) ? precision : [precision, precision];
|
|
@@ -1166,6 +952,67 @@ function currency(amount, precision = [2, 10], currencyCode = 'USD', locale = 'e
|
|
|
1166
952
|
.transform(amount, currencyCode, 'symbol', `1.${digitsInfo[0]}-${digitsInfo[1]}`);
|
|
1167
953
|
}
|
|
1168
954
|
|
|
955
|
+
function truncate(value, limit = 100, completeWords = false, ellipsis = '...') {
|
|
956
|
+
value = value || '';
|
|
957
|
+
if (completeWords) {
|
|
958
|
+
limit = value.substr(0, limit).lastIndexOf(' ');
|
|
959
|
+
}
|
|
960
|
+
let result = `${value.substr(0, limit)}`;
|
|
961
|
+
if (result !== value) {
|
|
962
|
+
result += ellipsis;
|
|
963
|
+
}
|
|
964
|
+
return result;
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
function delayedRetry(delayMs, maxRetry = 5, message) {
|
|
968
|
+
let retries = 0;
|
|
969
|
+
return (src) => src.pipe(retryWhen((errors) => errors.pipe(tap(() => {
|
|
970
|
+
retries++;
|
|
971
|
+
if (retries <= maxRetry) {
|
|
972
|
+
console.info(`Failed to load Resource. Retry in ${delayMs / 1000} sec. ${retries}/${maxRetry} times...`);
|
|
973
|
+
}
|
|
974
|
+
}), concatMap((error) => iif(() => retries > maxRetry, throwError(getErrorMessage(maxRetry, message)), timer(delayMs))))));
|
|
975
|
+
}
|
|
976
|
+
const getErrorMessage = (maxRetry, defaultMessage) => {
|
|
977
|
+
if (!defaultMessage) {
|
|
978
|
+
return `Failed to load Resource for ${maxRetry} times. Giving up.`;
|
|
979
|
+
}
|
|
980
|
+
else {
|
|
981
|
+
return defaultMessage;
|
|
982
|
+
}
|
|
983
|
+
};
|
|
984
|
+
|
|
985
|
+
function bytes(bytes, decimals, unit) {
|
|
986
|
+
if (!bytes) {
|
|
987
|
+
return '0 MB';
|
|
988
|
+
}
|
|
989
|
+
const e = typeof unit === 'string' ?
|
|
990
|
+
'KMGTP'.indexOf(unit.replace('B', '')) + 1 :
|
|
991
|
+
Math.floor(Math.log(bytes) / Math.log(1024));
|
|
992
|
+
if (!isNumeric(decimals)) {
|
|
993
|
+
decimals = (bytes / 1024) > 1000 ? 2 : 0;
|
|
994
|
+
}
|
|
995
|
+
return `${(bytes / Math.pow(1024, e))
|
|
996
|
+
.toFixed(decimals)}`
|
|
997
|
+
.replace(/\.00/, '')
|
|
998
|
+
+ ' '
|
|
999
|
+
+ (e ? ' KMGTP'.charAt(e) : '') + 'B';
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
class FsFormatBytesPipe {
|
|
1003
|
+
transform(value, decimals, unit) {
|
|
1004
|
+
return bytes(value, decimals, unit);
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
FsFormatBytesPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormatBytesPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1008
|
+
FsFormatBytesPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormatBytesPipe, name: "fsFormatBytes" });
|
|
1009
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormatBytesPipe, decorators: [{
|
|
1010
|
+
type: Pipe,
|
|
1011
|
+
args: [{
|
|
1012
|
+
name: 'fsFormatBytes',
|
|
1013
|
+
}]
|
|
1014
|
+
}] });
|
|
1015
|
+
|
|
1169
1016
|
class FsFormatCurrencyPipe {
|
|
1170
1017
|
constructor(locale) {
|
|
1171
1018
|
this.locale = locale;
|
|
@@ -1179,24 +1026,40 @@ FsFormatCurrencyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", versi
|
|
|
1179
1026
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormatCurrencyPipe, decorators: [{
|
|
1180
1027
|
type: Pipe,
|
|
1181
1028
|
args: [{
|
|
1182
|
-
name: 'fsFormatCurrency'
|
|
1029
|
+
name: 'fsFormatCurrency',
|
|
1183
1030
|
}]
|
|
1184
1031
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1185
1032
|
type: Inject,
|
|
1186
1033
|
args: [LOCALE_ID]
|
|
1187
1034
|
}] }]; } });
|
|
1188
1035
|
|
|
1189
|
-
|
|
1190
|
-
value
|
|
1191
|
-
|
|
1192
|
-
limit = value.substr(0, limit).lastIndexOf(' ');
|
|
1036
|
+
class FsFormatNumberPipe {
|
|
1037
|
+
transform(value, decimals) {
|
|
1038
|
+
return number(value, decimals);
|
|
1193
1039
|
}
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1040
|
+
}
|
|
1041
|
+
FsFormatNumberPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormatNumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1042
|
+
FsFormatNumberPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormatNumberPipe, name: "fsFormatNumber" });
|
|
1043
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormatNumberPipe, decorators: [{
|
|
1044
|
+
type: Pipe,
|
|
1045
|
+
args: [{
|
|
1046
|
+
name: 'fsFormatNumber'
|
|
1047
|
+
}]
|
|
1048
|
+
}] });
|
|
1049
|
+
|
|
1050
|
+
class FsFormatOrdinalNumberPipe {
|
|
1051
|
+
transform(value) {
|
|
1052
|
+
return ordinalNumber(value);
|
|
1197
1053
|
}
|
|
1198
|
-
|
|
1199
|
-
}
|
|
1054
|
+
}
|
|
1055
|
+
FsFormatOrdinalNumberPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormatOrdinalNumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1056
|
+
FsFormatOrdinalNumberPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormatOrdinalNumberPipe, name: "fsFormatOrdinalNumber" });
|
|
1057
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormatOrdinalNumberPipe, decorators: [{
|
|
1058
|
+
type: Pipe,
|
|
1059
|
+
args: [{
|
|
1060
|
+
name: 'fsFormatOrdinalNumber',
|
|
1061
|
+
}]
|
|
1062
|
+
}] });
|
|
1200
1063
|
|
|
1201
1064
|
class FsFormatTruncatePipe {
|
|
1202
1065
|
constructor() { }
|
|
@@ -1213,351 +1076,520 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1213
1076
|
}]
|
|
1214
1077
|
}], ctorParameters: function () { return []; } });
|
|
1215
1078
|
|
|
1216
|
-
class
|
|
1217
|
-
|
|
1218
|
-
|
|
1079
|
+
class FsArray {
|
|
1080
|
+
/**
|
|
1081
|
+
* @deprecated use import { nameValue } from @firestitch/common/array; instead
|
|
1082
|
+
*/
|
|
1083
|
+
nameValue(array, name, value) {
|
|
1084
|
+
console.warn('@deprecated use import { nameValue } from @firestitch/common/array; instead');
|
|
1085
|
+
let list = [];
|
|
1086
|
+
if (name || value) {
|
|
1087
|
+
let nameFn = typeof name === 'function' ? name : function (item) { return item[name]; };
|
|
1088
|
+
let valueFn = typeof value === 'function' ? value : function (item) { return item[value]; };
|
|
1089
|
+
array.forEach(function (item) {
|
|
1090
|
+
list.push({ name: nameFn(item), value: valueFn(item) });
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1093
|
+
else {
|
|
1094
|
+
array.forEach(function (name, value) {
|
|
1095
|
+
list.push({ name: name, value: value });
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
return list;
|
|
1219
1099
|
}
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
}
|
|
1229
|
-
|
|
1230
|
-
args: ['click', ['$event']]
|
|
1231
|
-
}] } });
|
|
1232
|
-
|
|
1233
|
-
class FsPreventDefaultDirective {
|
|
1234
|
-
preventClick(event) {
|
|
1235
|
-
event.preventDefault();
|
|
1100
|
+
/**
|
|
1101
|
+
* @deprecated use import { remove } from @firestitch/common/array; instead
|
|
1102
|
+
*/
|
|
1103
|
+
remove(array, query) {
|
|
1104
|
+
console.warn('@deprecated use import { remove } from @firestitch/common/array; instead');
|
|
1105
|
+
let idx = this.indexOf(array, query);
|
|
1106
|
+
if (idx >= 0) {
|
|
1107
|
+
return array.splice(idx, 1);
|
|
1108
|
+
}
|
|
1109
|
+
return idx;
|
|
1236
1110
|
}
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
this.fsAutofocus = true;
|
|
1111
|
+
/**
|
|
1112
|
+
* @deprecated use import { indexOf } from @firestitch/common/array; instead
|
|
1113
|
+
*/
|
|
1114
|
+
indexOf(array, query) {
|
|
1115
|
+
console.warn('@deprecated use import { indexOf } from @firestitch/common/array; instead');
|
|
1116
|
+
if (typeof query !== 'function') {
|
|
1117
|
+
let queryObj = query;
|
|
1118
|
+
query = (item) => {
|
|
1119
|
+
return this.compare(queryObj, item);
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
for (let i = 0, len = array.length; i < len; i++) {
|
|
1123
|
+
if (query(array[i])) {
|
|
1124
|
+
return i;
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
return -1;
|
|
1255
1128
|
}
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1129
|
+
/**
|
|
1130
|
+
* @deprecated use import { compare } from @firestitch/common/array; instead
|
|
1131
|
+
*/
|
|
1132
|
+
compare(query, item) {
|
|
1133
|
+
console.warn('@deprecated use import { compare } from @firestitch/common/array; instead');
|
|
1134
|
+
let value = true;
|
|
1135
|
+
for (let key in query) {
|
|
1136
|
+
value = value && item[key] == query[key];
|
|
1259
1137
|
}
|
|
1138
|
+
return value;
|
|
1260
1139
|
}
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1140
|
+
/**
|
|
1141
|
+
* @deprecated use import { filter } from @firestitch/common/array; instead
|
|
1142
|
+
*/
|
|
1143
|
+
filter(array, query) {
|
|
1144
|
+
console.warn('@deprecated use import { filter } from @firestitch/common/array; instead');
|
|
1145
|
+
if (typeof query !== 'function') {
|
|
1146
|
+
let queryObj = query;
|
|
1147
|
+
query = (item) => {
|
|
1148
|
+
return this.compare(queryObj, item);
|
|
1149
|
+
};
|
|
1150
|
+
}
|
|
1151
|
+
let isarray = Array.isArray(array);
|
|
1152
|
+
let list = isarray ? [] : {};
|
|
1153
|
+
if (isarray)
|
|
1154
|
+
array.forEach(function (item, idx) {
|
|
1155
|
+
if (query(item)) {
|
|
1156
|
+
list.push(item);
|
|
1157
|
+
}
|
|
1158
|
+
});
|
|
1159
|
+
else
|
|
1160
|
+
Object.keys(array).forEach(key => {
|
|
1161
|
+
if (query(array[key])) {
|
|
1162
|
+
list[key] = array[key];
|
|
1163
|
+
}
|
|
1164
|
+
});
|
|
1165
|
+
return list;
|
|
1166
|
+
}
|
|
1167
|
+
/**
|
|
1168
|
+
* @deprecated use import { index } from @firestitch/common/array; instead
|
|
1169
|
+
*/
|
|
1170
|
+
index(array, property) {
|
|
1171
|
+
console.warn('@deprecated use import { index } from @firestitch/common/array; instead');
|
|
1172
|
+
let list = {};
|
|
1173
|
+
array.forEach(function (item, idx) {
|
|
1174
|
+
list[item[property]] = item;
|
|
1175
|
+
});
|
|
1176
|
+
return list;
|
|
1177
|
+
}
|
|
1178
|
+
/**
|
|
1179
|
+
* @deprecated use import { sort } from @firestitch/common/array; instead
|
|
1180
|
+
*/
|
|
1181
|
+
sort(array, query, reverse = false) {
|
|
1182
|
+
console.warn('@deprecated use import { sort } from @firestitch/common/array; instead');
|
|
1183
|
+
if (typeof query !== 'function') {
|
|
1184
|
+
let queryStr = query;
|
|
1185
|
+
query = function (a, b) {
|
|
1186
|
+
if (reverse) {
|
|
1187
|
+
if (a[queryStr] < b[queryStr]) {
|
|
1188
|
+
return 1;
|
|
1189
|
+
}
|
|
1190
|
+
else if (a[queryStr] > b[queryStr]) {
|
|
1191
|
+
return -1;
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
else {
|
|
1195
|
+
if (a[queryStr] > b[queryStr]) {
|
|
1196
|
+
return 1;
|
|
1197
|
+
}
|
|
1198
|
+
else if (a[queryStr] < b[queryStr]) {
|
|
1199
|
+
return -1;
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
return 0;
|
|
1203
|
+
};
|
|
1204
|
+
}
|
|
1205
|
+
array.sort(query);
|
|
1206
|
+
return array;
|
|
1207
|
+
}
|
|
1208
|
+
/**
|
|
1209
|
+
* @deprecated use import { rsort } from @firestitch/common/array; instead
|
|
1210
|
+
*/
|
|
1211
|
+
rsort(array, query) {
|
|
1212
|
+
console.warn('@deprecated use import { rsort } from @firestitch/common/array; instead');
|
|
1213
|
+
return this.sort(array, query, true);
|
|
1214
|
+
}
|
|
1215
|
+
/**
|
|
1216
|
+
* @deprecated use import { list } from @firestitch/common/array; instead
|
|
1217
|
+
*/
|
|
1218
|
+
list(array, property, index = null) {
|
|
1219
|
+
console.warn('@deprecated use import { list } from @firestitch/common/array; instead');
|
|
1220
|
+
let list = index ? {} : [];
|
|
1221
|
+
array.forEach(function (item, idx) {
|
|
1222
|
+
if (index) {
|
|
1223
|
+
list[item[index]] = item[property];
|
|
1274
1224
|
}
|
|
1275
|
-
else
|
|
1276
|
-
|
|
1225
|
+
else {
|
|
1226
|
+
list.push(item[property]);
|
|
1277
1227
|
}
|
|
1278
|
-
|
|
1279
|
-
|
|
1228
|
+
});
|
|
1229
|
+
return list;
|
|
1230
|
+
}
|
|
1231
|
+
/**
|
|
1232
|
+
* @deprecated use import { applyDepth } from @firestitch/common/array; instead
|
|
1233
|
+
*/
|
|
1234
|
+
applyDepth(objects, parent_property, id_property = 'id', depth_property = 'depth') {
|
|
1235
|
+
console.warn('@deprecated use import { applyDepth } from @firestitch/common/array; instead');
|
|
1236
|
+
let keyed = {};
|
|
1237
|
+
objects.forEach(function (object) {
|
|
1238
|
+
if (!object[parent_property]) {
|
|
1239
|
+
object[depth_property] = 0;
|
|
1240
|
+
}
|
|
1241
|
+
keyed[object[id_property]] = object;
|
|
1242
|
+
});
|
|
1243
|
+
Object.keys(keyed).forEach(key => {
|
|
1244
|
+
Object.keys(keyed).forEach(key => {
|
|
1245
|
+
let object = keyed[key];
|
|
1246
|
+
if (!keyed[key][depth_property]) {
|
|
1247
|
+
if (keyed[key][parent_property]) {
|
|
1248
|
+
keyed[key][depth_property] = keyed[keyed[key][parent_property]][depth_property] + 1;
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
});
|
|
1252
|
+
});
|
|
1253
|
+
return keyed;
|
|
1254
|
+
}
|
|
1255
|
+
/**
|
|
1256
|
+
* @deprecated use import { inArray } from @firestitch/common/array; instead
|
|
1257
|
+
*/
|
|
1258
|
+
inArray(values, array) {
|
|
1259
|
+
console.warn('@deprecated use import { inArray } from @firestitch/common/array; instead');
|
|
1260
|
+
if (!Array.isArray(values)) {
|
|
1261
|
+
values = [values];
|
|
1262
|
+
}
|
|
1263
|
+
for (let i = 0, len = values.length; i < len; i++) {
|
|
1264
|
+
if (array.indexOf(values[i]) >= 0) {
|
|
1265
|
+
return true;
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
return false;
|
|
1269
|
+
}
|
|
1270
|
+
/**
|
|
1271
|
+
* @deprecated use import { keyExists } from @firestitch/common/array; instead
|
|
1272
|
+
*/
|
|
1273
|
+
keyExists(array, key) {
|
|
1274
|
+
console.warn('@deprecated use import { keyExists } from @firestitch/common/array; instead');
|
|
1275
|
+
return array.hasOwnProperty(key);
|
|
1276
|
+
}
|
|
1277
|
+
/**
|
|
1278
|
+
* @deprecated use import { length } from @firestitch/common/array; instead
|
|
1279
|
+
*/
|
|
1280
|
+
length(array) {
|
|
1281
|
+
console.warn('@deprecated use import { length } from @firestitch/common/array; instead');
|
|
1282
|
+
return array.length;
|
|
1280
1283
|
}
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
}, {
|
|
1292
|
-
type: Host
|
|
1293
|
-
}] }, { type: i0.ElementRef }]; }, propDecorators: { fsAutofocus: [{
|
|
1294
|
-
type: Input
|
|
1295
|
-
}] } });
|
|
1296
|
-
|
|
1297
|
-
class FsFormatOrdinalNumberPipe {
|
|
1298
|
-
transform(value) {
|
|
1299
|
-
return ordinalNumber(value);
|
|
1284
|
+
/**
|
|
1285
|
+
* @deprecated use import { ksort } from @firestitch/common/array; instead
|
|
1286
|
+
*/
|
|
1287
|
+
ksort(unordered) {
|
|
1288
|
+
console.warn('@deprecated use import { ksort } from @firestitch/common/array; instead');
|
|
1289
|
+
Object.keys(unordered).sort().forEach(function (key) {
|
|
1290
|
+
let value = unordered[key];
|
|
1291
|
+
delete unordered[key];
|
|
1292
|
+
unordered[key] = value;
|
|
1293
|
+
});
|
|
1300
1294
|
}
|
|
1301
1295
|
}
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type:
|
|
1305
|
-
type:
|
|
1306
|
-
args: [{
|
|
1307
|
-
name: 'fsFormatOrdinalNumber',
|
|
1308
|
-
}]
|
|
1296
|
+
FsArray.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsArray, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1297
|
+
FsArray.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsArray });
|
|
1298
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsArray, decorators: [{
|
|
1299
|
+
type: Injectable
|
|
1309
1300
|
}] });
|
|
1310
1301
|
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
* Protocol (http/https) isn't required.
|
|
1323
|
-
* @param value
|
|
1324
|
-
* @returns {boolean}
|
|
1325
|
-
*/
|
|
1326
|
-
function url(value) {
|
|
1327
|
-
const expression = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#%[\]@!\$&'\(\)\*\+,;=.]+$/gm;
|
|
1328
|
-
const regexp = new RegExp(expression);
|
|
1329
|
-
return !!String(value).match(regexp);
|
|
1330
|
-
}
|
|
1331
|
-
|
|
1332
|
-
function compare(query, item) {
|
|
1333
|
-
let value = true;
|
|
1334
|
-
for (const key in query) {
|
|
1335
|
-
value = value && item[key] == query[key];
|
|
1302
|
+
class FsMath {
|
|
1303
|
+
/**
|
|
1304
|
+
* @deprecated use _.round() instead {@link https://lodash.com/docs/4.17.5#round}
|
|
1305
|
+
*/
|
|
1306
|
+
round(number, precision) {
|
|
1307
|
+
console.warn('@deprecated use _.round() instead {@link https://lodash.com/docs/4.17.5#round}');
|
|
1308
|
+
precision = precision || 0;
|
|
1309
|
+
let factor = Math.pow(10, precision);
|
|
1310
|
+
let tempNumber = number * factor;
|
|
1311
|
+
let roundedTempNumber = Math.round(tempNumber);
|
|
1312
|
+
return roundedTempNumber / factor;
|
|
1336
1313
|
}
|
|
1337
|
-
|
|
1338
|
-
}
|
|
1314
|
+
}
|
|
1315
|
+
FsMath.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsMath, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1316
|
+
FsMath.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsMath });
|
|
1317
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsMath, decorators: [{
|
|
1318
|
+
type: Injectable
|
|
1319
|
+
}] });
|
|
1339
1320
|
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1321
|
+
const KEY_CANCEL = 3, KEY_HELP = 6, KEY_BACKSPACE = 8, KEY_TAB = 9, KEY_CLEAR = 12, KEY_RETURN = 13, KEY_ENTER = 14, KEY_SHIFT = 16, KEY_CONTROL = 17, KEY_ALT = 18, KEY_PAUSE = 19, KEY_CAPS_LOCK = 20, KEY_ESCAPE = 27, KEY_SPACE = 32, KEY_PAGE_UP = 33, KEY_PAGE_DOWN = 34, KEY_END = 35, KEY_HOME = 36, KEY_LEFT = 37, KEY_UP = 38, KEY_RIGHT = 39, KEY_DOWN = 40, KEY_PRINTSCREEN = 44, KEY_INSERT = 45, KEY_DELETE = 46, KEY_0 = 48, KEY_1 = 49, KEY_2 = 50, KEY_3 = 51, KEY_4 = 52, KEY_5 = 53, KEY_6 = 54, KEY_7 = 55, KEY_8 = 56, KEY_9 = 57, KEY_SEMICOLON = 59, KEY_EQUALS = 61;
|
|
1322
|
+
/*
|
|
1323
|
+
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)
|
|
1324
|
+
There might be a better way to organise constatns but I need to know use-cases
|
|
1325
|
+
*/
|
|
1326
|
+
class FsUtil {
|
|
1327
|
+
constructor() {
|
|
1328
|
+
this.intervals = {};
|
|
1346
1329
|
}
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1330
|
+
/**
|
|
1331
|
+
* @deprecated use @firestitch/common/util/guid instead
|
|
1332
|
+
*/
|
|
1333
|
+
guid(pattern) {
|
|
1334
|
+
console.warn('@deprecated use @firestitch/common/util/guid instead');
|
|
1335
|
+
pattern = pattern || 'xxxxxx';
|
|
1336
|
+
return pattern.replace(/[xy]/g, function (c) {
|
|
1337
|
+
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
|
1338
|
+
return v.toString(16);
|
|
1354
1339
|
});
|
|
1355
1340
|
}
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1341
|
+
/**
|
|
1342
|
+
* @deprecated use import { uuid } from @firestitch/common/util; instead
|
|
1343
|
+
*/
|
|
1344
|
+
uuid() {
|
|
1345
|
+
console.warn('@deprecated use @firestitch/common/util/uuid instead');
|
|
1346
|
+
return this.guid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx');
|
|
1362
1347
|
}
|
|
1363
|
-
|
|
1364
|
-
}
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1348
|
+
/**
|
|
1349
|
+
* @deprecated use import { resolve } from @firestitch/common/util; instead
|
|
1350
|
+
*/
|
|
1351
|
+
resolve(promise, defaults = []) {
|
|
1352
|
+
console.warn('@deprecated use @firestitch/common/util/resolve instead');
|
|
1353
|
+
const result = defaults;
|
|
1354
|
+
return new Promise(resolve => {
|
|
1355
|
+
promise.then(function (data) {
|
|
1356
|
+
Object.keys(data).forEach(key => result[key] = data[key]);
|
|
1357
|
+
resolve(result);
|
|
1358
|
+
});
|
|
1359
|
+
});
|
|
1369
1360
|
}
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1361
|
+
/**
|
|
1362
|
+
* @deprecated use _.toInteger() instead
|
|
1363
|
+
*/
|
|
1364
|
+
int(value) {
|
|
1365
|
+
console.warn('@deprecated use _.toInteger() instead');
|
|
1366
|
+
value = parseInt(value);
|
|
1367
|
+
if (isNaN(value)) {
|
|
1368
|
+
value = 0;
|
|
1373
1369
|
}
|
|
1370
|
+
return value;
|
|
1374
1371
|
}
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
return list;
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
function indexOf(array, query) {
|
|
1387
|
-
if (typeof query !== 'function') {
|
|
1388
|
-
const queryObj = query;
|
|
1389
|
-
query = (item) => {
|
|
1390
|
-
return compare(queryObj, item);
|
|
1391
|
-
};
|
|
1392
|
-
}
|
|
1393
|
-
for (let i = 0, len = array.length; i < len; i++) {
|
|
1394
|
-
if (query(array[i])) {
|
|
1395
|
-
return i;
|
|
1372
|
+
/**
|
|
1373
|
+
* @deprecated use _.toFinite() instead
|
|
1374
|
+
*/
|
|
1375
|
+
float(value) {
|
|
1376
|
+
console.warn('@deprecated use _.toFinite() instead');
|
|
1377
|
+
value = parseFloat(value);
|
|
1378
|
+
if (isNaN(value)) {
|
|
1379
|
+
value = 0;
|
|
1396
1380
|
}
|
|
1381
|
+
return value;
|
|
1397
1382
|
}
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
function ksort(unordered) {
|
|
1406
|
-
Object.keys(unordered).sort().forEach(function (key) {
|
|
1407
|
-
const value = unordered[key];
|
|
1408
|
-
delete unordered[key];
|
|
1409
|
-
unordered[key] = value;
|
|
1410
|
-
});
|
|
1411
|
-
}
|
|
1412
|
-
|
|
1413
|
-
function list(array, property, index = null) {
|
|
1414
|
-
const resultList = index ? {} : [];
|
|
1415
|
-
array.forEach(function (item, idx) {
|
|
1416
|
-
if (index) {
|
|
1417
|
-
resultList[item[index]] = item[property];
|
|
1383
|
+
/**
|
|
1384
|
+
* @deprecated use _.toString() instead
|
|
1385
|
+
*/
|
|
1386
|
+
string(string) {
|
|
1387
|
+
console.warn('@deprecated use _.toString() instead');
|
|
1388
|
+
if (string === null || string === undefined) {
|
|
1389
|
+
string = '';
|
|
1418
1390
|
}
|
|
1419
|
-
|
|
1420
|
-
|
|
1391
|
+
return (string).toString();
|
|
1392
|
+
}
|
|
1393
|
+
/**
|
|
1394
|
+
* @deprecated use import { isEmpty } from @firestitch/common/util; instead
|
|
1395
|
+
*/
|
|
1396
|
+
isEmpty(value, options) {
|
|
1397
|
+
console.warn('@deprecated use import { isEmpty } from @firestitch/common/util; instead');
|
|
1398
|
+
options = options || {};
|
|
1399
|
+
return value === undefined ||
|
|
1400
|
+
value === null ||
|
|
1401
|
+
value === false ||
|
|
1402
|
+
value === '' ||
|
|
1403
|
+
!this.string(value).length ||
|
|
1404
|
+
(this.isObject(value) &&
|
|
1405
|
+
(value.constructor.name === 'Object' && !Object.keys(value).length)) ||
|
|
1406
|
+
(!options.zero && (value === 0 || value === '0'));
|
|
1407
|
+
}
|
|
1408
|
+
/**
|
|
1409
|
+
* @deprecated use _.isInteger() instead
|
|
1410
|
+
*/
|
|
1411
|
+
isInt(value, type) {
|
|
1412
|
+
console.warn('@deprecated use _.isInteger() instead');
|
|
1413
|
+
const int = !!this.string(value).match(/^\d+$/);
|
|
1414
|
+
if (!int) {
|
|
1415
|
+
return false;
|
|
1421
1416
|
}
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
}
|
|
1425
|
-
|
|
1426
|
-
function nameValue(array, name, value) {
|
|
1427
|
-
const list = [];
|
|
1428
|
-
if (name || value) {
|
|
1429
|
-
const nameFn = typeof name === 'function' ? name : function (item) {
|
|
1430
|
-
return item[name];
|
|
1431
|
-
};
|
|
1432
|
-
const valueFn = typeof value === 'function' ? value : function (item) {
|
|
1433
|
-
return item[value];
|
|
1434
|
-
};
|
|
1435
|
-
array.forEach(function (item) {
|
|
1436
|
-
list.push({ name: nameFn(item), value: valueFn(item) });
|
|
1437
|
-
});
|
|
1417
|
+
if (type) {
|
|
1418
|
+
return Number.isInteger(value);
|
|
1419
|
+
}
|
|
1420
|
+
return true;
|
|
1438
1421
|
}
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1422
|
+
/**
|
|
1423
|
+
* @deprecated use _.each() instead {@link https://lodash.com/docs/4.17.5#forEach}
|
|
1424
|
+
*/
|
|
1425
|
+
each(object, func) {
|
|
1426
|
+
console.warn('@deprecated use _.each() instead {@link https://lodash.com/docs/4.17.5#forEach}');
|
|
1427
|
+
if (!this.isArray(object) && !this.isObject(object)) {
|
|
1428
|
+
return;
|
|
1429
|
+
}
|
|
1430
|
+
Object.keys(object).forEach(function (key) {
|
|
1431
|
+
func(object[key], key);
|
|
1442
1432
|
});
|
|
1443
1433
|
}
|
|
1444
|
-
|
|
1445
|
-
}
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
return
|
|
1434
|
+
/**
|
|
1435
|
+
* @deprecated use _.isArrayLikeObject() {@link https://lodash.com/docs/4.17.5#isArrayLikeObject}
|
|
1436
|
+
* or _.isObject() {@link https://lodash.com/docs/4.17.5#isObject} instead
|
|
1437
|
+
*/
|
|
1438
|
+
isObject(value) {
|
|
1439
|
+
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');
|
|
1440
|
+
return value !== null && typeof value === 'object' && !this.isArray(value);
|
|
1451
1441
|
}
|
|
1452
|
-
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1442
|
+
/**
|
|
1443
|
+
* @deprecated use _.isString() instead {@link https://lodash.com/docs/4.17.5#isString}
|
|
1444
|
+
*/
|
|
1445
|
+
isString(value) {
|
|
1446
|
+
console.warn('@deprecated use _.isString() instead {@link https://lodash.com/docs/4.17.5#isString}');
|
|
1447
|
+
return typeof value === 'string' || value instanceof String;
|
|
1448
|
+
}
|
|
1449
|
+
/**
|
|
1450
|
+
* @deprecated use _.isArray() instead {@link https://lodash.com/docs/4.17.5#isArray}
|
|
1451
|
+
*/
|
|
1452
|
+
isArray(value) {
|
|
1453
|
+
console.warn('@deprecated use _.isArray() instead {@link https://lodash.com/docs/4.17.5#isArray}');
|
|
1454
|
+
return value instanceof Array;
|
|
1455
|
+
}
|
|
1456
|
+
/**
|
|
1457
|
+
* @deprecated use import { isNumeric } from @firestitch/common/util; instead
|
|
1458
|
+
*/
|
|
1459
|
+
isNumeric(value) {
|
|
1460
|
+
console.warn('@deprecated use import { isNumeric } from @firestitch/common/util; instead');
|
|
1461
|
+
return this.string(value).length && !!this.string(value).match(/^-?\d*\.?\d*$/);
|
|
1462
|
+
}
|
|
1463
|
+
/**
|
|
1464
|
+
* @deprecated use import { isClass } from @firestitch/common/util; instead
|
|
1465
|
+
*/
|
|
1466
|
+
isClass(value, cls) {
|
|
1467
|
+
console.warn('@deprecated use import { isClass } from @firestitch/common/util; instead');
|
|
1468
|
+
if (this.isObject(value)) {
|
|
1469
|
+
if (this.isString(cls)) {
|
|
1470
|
+
if (value.constructor) {
|
|
1471
|
+
if (value.constructor.name === cls) {
|
|
1472
|
+
return true;
|
|
1473
|
+
}
|
|
1465
1474
|
}
|
|
1466
1475
|
}
|
|
1467
1476
|
else {
|
|
1468
|
-
if (
|
|
1469
|
-
return
|
|
1470
|
-
}
|
|
1471
|
-
else if (a[queryStr] < b[queryStr]) {
|
|
1472
|
-
return -1;
|
|
1477
|
+
if (value instanceof cls) {
|
|
1478
|
+
return true;
|
|
1473
1479
|
}
|
|
1474
1480
|
}
|
|
1475
|
-
|
|
1476
|
-
|
|
1481
|
+
}
|
|
1482
|
+
return false;
|
|
1477
1483
|
}
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
}
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
}
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
.replace(/[^a-zA-Z0-9]+/g, ' ')
|
|
1494
|
-
.split(' ');
|
|
1495
|
-
let result = '';
|
|
1496
|
-
for (let i = 0; i < length; i++) {
|
|
1497
|
-
if (!splittedString[i]) {
|
|
1498
|
-
if (splittedString.length === 1) {
|
|
1499
|
-
for (let j = 1; j < length; j++) {
|
|
1500
|
-
if (!splittedString[i - 1][j]) {
|
|
1501
|
-
break;
|
|
1502
|
-
}
|
|
1503
|
-
result += splittedString[i - 1][j].toUpperCase();
|
|
1504
|
-
}
|
|
1484
|
+
/**
|
|
1485
|
+
* @deprecated use _.isBoolean() instead {@link https://lodash.com/docs/4.17.5#isBoolean}
|
|
1486
|
+
*/
|
|
1487
|
+
isBoolean(value) {
|
|
1488
|
+
console.warn('@deprecated use _.isBoolean() instead {@link https://lodash.com/docs/4.17.5#isBoolean}');
|
|
1489
|
+
return value === true || value === false;
|
|
1490
|
+
}
|
|
1491
|
+
/**
|
|
1492
|
+
* @deprecated use import { value } from @firestitch/common/util; instead
|
|
1493
|
+
*/
|
|
1494
|
+
value(object, key, def) {
|
|
1495
|
+
console.warn('@deprecated use import { value } from @firestitch/common/util; instead');
|
|
1496
|
+
if (this.isObject(object) || this.isArray(object)) {
|
|
1497
|
+
if (object.hasOwnProperty(key)) {
|
|
1498
|
+
return object[key];
|
|
1505
1499
|
}
|
|
1506
|
-
break;
|
|
1507
1500
|
}
|
|
1508
|
-
|
|
1501
|
+
return def;
|
|
1509
1502
|
}
|
|
1510
|
-
|
|
1511
|
-
}
|
|
1512
|
-
|
|
1513
|
-
function
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1503
|
+
throttle(func, wait) {
|
|
1504
|
+
console.warn('@deprecated use import { throttle } from @firestitch/common/util; instead');
|
|
1505
|
+
let waiting = false; // Initially, we're not waiting
|
|
1506
|
+
return function () {
|
|
1507
|
+
if (!waiting) { // If we're not waiting
|
|
1508
|
+
func.apply(null, arguments); // Execute users function
|
|
1509
|
+
waiting = true; // Prevent future invocations
|
|
1510
|
+
setTimeout(function () {
|
|
1511
|
+
waiting = false; // And allow future invocations
|
|
1512
|
+
}, wait);
|
|
1513
|
+
}
|
|
1514
|
+
};
|
|
1515
|
+
}
|
|
1516
|
+
/**
|
|
1517
|
+
* @deprecated use import { debounce } from @firestitch/common/util; instead
|
|
1518
|
+
*/
|
|
1519
|
+
debounce(func, wait, immediate) {
|
|
1520
|
+
console.warn('@deprecated use import { debounce } from @firestitch/common/util; instead');
|
|
1521
|
+
var timeout;
|
|
1522
|
+
return function () {
|
|
1523
|
+
var context = this, args = arguments;
|
|
1524
|
+
var later = function () {
|
|
1525
|
+
timeout = null;
|
|
1526
|
+
if (!immediate)
|
|
1527
|
+
func.apply(context, args);
|
|
1528
|
+
};
|
|
1529
|
+
var callNow = immediate && !timeout;
|
|
1530
|
+
clearTimeout(timeout);
|
|
1531
|
+
timeout = setTimeout(later, wait);
|
|
1532
|
+
if (callNow)
|
|
1533
|
+
func.apply(context, args);
|
|
1534
|
+
};
|
|
1535
|
+
}
|
|
1536
|
+
/**
|
|
1537
|
+
* @deprecated use import { length } from @firestitch/common/util; instead
|
|
1538
|
+
*/
|
|
1539
|
+
length(object) {
|
|
1540
|
+
console.warn('@deprecated use import { length } from @firestitch/common/util; instead');
|
|
1541
|
+
if (this.isObject(object)) {
|
|
1542
|
+
return Object.keys(object).length;
|
|
1519
1543
|
}
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
return `Failed to load Resource for ${maxRetry} times. Giving up.`;
|
|
1544
|
+
if (this.isArray(object)) {
|
|
1545
|
+
return object.length;
|
|
1546
|
+
}
|
|
1547
|
+
return 0;
|
|
1525
1548
|
}
|
|
1526
|
-
|
|
1527
|
-
|
|
1549
|
+
/**
|
|
1550
|
+
* @deprecated use import { boolean } from @firestitch/common/util; instead
|
|
1551
|
+
*/
|
|
1552
|
+
boolean(value) {
|
|
1553
|
+
console.warn('@deprecated use import { boolean } from @firestitch/common/util; instead');
|
|
1554
|
+
return this.string(value).toLowerCase() !== 'false' && !!value;
|
|
1528
1555
|
}
|
|
1529
|
-
|
|
1556
|
+
/**
|
|
1557
|
+
* @deprecated use import { stringify } from @firestitch/common/util; instead
|
|
1558
|
+
*/
|
|
1559
|
+
stringify(value) {
|
|
1560
|
+
console.warn('@deprecated use import { stringify } from @firestitch/common/util; instead');
|
|
1561
|
+
return JSON.stringify(value);
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
FsUtil.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsUtil, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1565
|
+
FsUtil.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsUtil });
|
|
1566
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsUtil, decorators: [{
|
|
1567
|
+
type: Injectable
|
|
1568
|
+
}] });
|
|
1530
1569
|
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1570
|
+
class FsValidate {
|
|
1571
|
+
constructor(fsUtil) {
|
|
1572
|
+
this.fsUtil = fsUtil;
|
|
1534
1573
|
}
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1574
|
+
/**
|
|
1575
|
+
* @deprecated use import { email } from @firestitch/common/validate; instead
|
|
1576
|
+
*/
|
|
1577
|
+
phone(value) {
|
|
1578
|
+
const valid = /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/.test(value);
|
|
1579
|
+
return valid || !String(value).length;
|
|
1540
1580
|
}
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
}
|
|
1547
|
-
|
|
1548
|
-
class FsFormatBytesPipe {
|
|
1549
|
-
transform(value, decimals, unit) {
|
|
1550
|
-
return bytes(value, decimals, unit);
|
|
1581
|
+
/**
|
|
1582
|
+
* @deprecated use import { email } from @firestitch/common/validate; instead
|
|
1583
|
+
*/
|
|
1584
|
+
email(value) {
|
|
1585
|
+
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,}))$/);
|
|
1551
1586
|
}
|
|
1552
1587
|
}
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type:
|
|
1556
|
-
type:
|
|
1557
|
-
|
|
1558
|
-
name: 'fsFormatBytes',
|
|
1559
|
-
}]
|
|
1560
|
-
}] });
|
|
1588
|
+
FsValidate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsValidate, deps: [{ token: FsUtil }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1589
|
+
FsValidate.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsValidate });
|
|
1590
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsValidate, decorators: [{
|
|
1591
|
+
type: Injectable
|
|
1592
|
+
}], ctorParameters: function () { return [{ type: FsUtil }]; } });
|
|
1561
1593
|
|
|
1562
1594
|
class FsCommonModule {
|
|
1563
1595
|
static forRoot() {
|
|
@@ -1567,8 +1599,8 @@ class FsCommonModule {
|
|
|
1567
1599
|
FsArray,
|
|
1568
1600
|
FsMath,
|
|
1569
1601
|
FsUtil,
|
|
1570
|
-
FsValidate
|
|
1571
|
-
]
|
|
1602
|
+
FsValidate,
|
|
1603
|
+
],
|
|
1572
1604
|
};
|
|
1573
1605
|
}
|
|
1574
1606
|
}
|
|
@@ -1584,7 +1616,8 @@ FsCommonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version:
|
|
|
1584
1616
|
FsFormatCurrencyPipe,
|
|
1585
1617
|
FsFormatTruncatePipe,
|
|
1586
1618
|
FsFormatBytesPipe,
|
|
1587
|
-
FsFormatOrdinalNumberPipe
|
|
1619
|
+
FsFormatOrdinalNumberPipe,
|
|
1620
|
+
FsModelChangeDirective], imports: [CommonModule], exports: [FsStopPropagationDirective,
|
|
1588
1621
|
FsPreventDefaultDirective,
|
|
1589
1622
|
FsAutofocusDirective,
|
|
1590
1623
|
FsUtilGuidPipe,
|
|
@@ -1595,6 +1628,7 @@ FsCommonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version:
|
|
|
1595
1628
|
FsUtilIsEmptyPipe,
|
|
1596
1629
|
FsUtilIsNotEmptyPipe,
|
|
1597
1630
|
FsFormatBytesPipe,
|
|
1631
|
+
FsModelChangeDirective,
|
|
1598
1632
|
FsFormatOrdinalNumberPipe] });
|
|
1599
1633
|
FsCommonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsCommonModule, imports: [[
|
|
1600
1634
|
CommonModule,
|
|
@@ -1618,6 +1652,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1618
1652
|
FsFormatTruncatePipe,
|
|
1619
1653
|
FsFormatBytesPipe,
|
|
1620
1654
|
FsFormatOrdinalNumberPipe,
|
|
1655
|
+
FsModelChangeDirective,
|
|
1621
1656
|
],
|
|
1622
1657
|
exports: [
|
|
1623
1658
|
FsStopPropagationDirective,
|
|
@@ -1631,6 +1666,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1631
1666
|
FsUtilIsEmptyPipe,
|
|
1632
1667
|
FsUtilIsNotEmptyPipe,
|
|
1633
1668
|
FsFormatBytesPipe,
|
|
1669
|
+
FsModelChangeDirective,
|
|
1634
1670
|
FsFormatOrdinalNumberPipe,
|
|
1635
1671
|
],
|
|
1636
1672
|
}]
|
|
@@ -1658,5 +1694,5 @@ const keyboardShortcut = (shortcut) => {
|
|
|
1658
1694
|
* Generated bundle index. Do not edit.
|
|
1659
1695
|
*/
|
|
1660
1696
|
|
|
1661
|
-
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, isObject, keyExists, keyboardShortcut, ksort, length, list, nameValue, number, ordinalNumber, phone, remove, removeQueryParams, resolve, round, rsort, sort, stringify, throttle, toString, truncate, url, uuid, value };
|
|
1697
|
+
export { FsArray, FsAutofocusDirective, FsCommonModule, FsFormatBytesPipe, FsFormatCurrencyPipe, FsFormatNumberPipe, FsFormatOrdinalNumberPipe, FsFormatTruncatePipe, FsMath, FsModelChangeDirective, FsPreventDefaultDirective, FsStopPropagationDirective, FsUtil, FsUtilGuidPipe, FsUtilIsEmptyPipe, FsUtilIsNotEmptyPipe, FsUtilStringifyPipe, FsValidate, KEY_0$1 as KEY_0, KEY_1$1 as KEY_1, KEY_2$1 as KEY_2, KEY_3$1 as KEY_3, KEY_4$1 as KEY_4, KEY_5$1 as KEY_5, KEY_6$1 as KEY_6, KEY_7$1 as KEY_7, KEY_8$1 as KEY_8, KEY_9$1 as KEY_9, KEY_ALT$1 as KEY_ALT, KEY_BACKSPACE$1 as KEY_BACKSPACE, KEY_CANCEL$1 as KEY_CANCEL, KEY_CAPS_LOCK$1 as KEY_CAPS_LOCK, KEY_CLEAR$1 as KEY_CLEAR, KEY_CONTROL$1 as KEY_CONTROL, KEY_DELETE$1 as KEY_DELETE, KEY_DOWN$1 as KEY_DOWN, KEY_END$1 as KEY_END, KEY_ENTER$1 as KEY_ENTER, KEY_EQUALS$1 as KEY_EQUALS, KEY_ESCAPE$1 as KEY_ESCAPE, KEY_HELP$1 as KEY_HELP, KEY_HOME$1 as KEY_HOME, KEY_INSERT$1 as KEY_INSERT, KEY_LEFT$1 as KEY_LEFT, KEY_PAGE_DOWN$1 as KEY_PAGE_DOWN, KEY_PAGE_UP$1 as KEY_PAGE_UP, KEY_PAUSE$1 as KEY_PAUSE, KEY_PRINTSCREEN$1 as KEY_PRINTSCREEN, KEY_RETURN$1 as KEY_RETURN, KEY_RIGHT$1 as KEY_RIGHT, KEY_SEMICOLON$1 as KEY_SEMICOLON, KEY_SHIFT$1 as KEY_SHIFT, KEY_SPACE$1 as KEY_SPACE, KEY_TAB$1 as KEY_TAB, KEY_UP$1 as KEY_UP, Queue, QueueState, acronym, boolean, bytes, clone, compare, currency, debounce, delayedRetry, email, filter, find, fsSourceLoader, getNormalizedPath, guid, inArray, index, indexOf, isArrayEqual, isClass, isEmpty, isNumeric, isObject, keyExists, keyboardShortcut, ksort, length, list, nameValue, number, ordinalNumber, phone, remove, removeQueryParams, resolve, round, rsort, sort, stringify, throttle, toString, truncate, url, uuid, value };
|
|
1662
1698
|
//# sourceMappingURL=firestitch-common.js.map
|