@firestitch/common 12.6.5 → 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.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('rxjs'), require('rxjs/operators'), require('@angular/material/input')) :
3
- typeof define === 'function' && define.amd ? define('@firestitch/common', ['exports', '@angular/core', '@angular/common', 'rxjs', 'rxjs/operators', '@angular/material/input'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.firestitch = global.firestitch || {}, global.firestitch.common = {}), global.ng.core, global.ng.common, global.rxjs, global.rxjs.operators, global.ng.material.input));
5
- })(this, (function (exports, i0, common, rxjs, operators, i1) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/material/input'), require('rxjs'), require('rxjs/operators'), require('@angular/forms')) :
3
+ typeof define === 'function' && define.amd ? define('@firestitch/common', ['exports', '@angular/common', '@angular/core', '@angular/material/input', 'rxjs', 'rxjs/operators', '@angular/forms'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.firestitch = global.firestitch || {}, global.firestitch.common = {}), global.ng.common, global.ng.core, global.ng.material.input, global.rxjs, global.rxjs.operators, global.ng.forms));
5
+ })(this, (function (exports, common, i0, i1, rxjs, operators, i1$1) { 'use strict';
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -24,638 +24,416 @@
24
24
 
25
25
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
26
26
  var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
27
+ var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
27
28
 
28
- var FsArray = /** @class */ (function () {
29
- function FsArray() {
29
+ var FsAutofocusDirective = /** @class */ (function () {
30
+ function FsAutofocusDirective(_matInput, _el) {
31
+ this._matInput = _matInput;
32
+ this._el = _el;
33
+ this.fsAutofocus = true;
30
34
  }
31
- /**
32
- * @deprecated use import { nameValue } from @firestitch/common/array; instead
33
- */
34
- FsArray.prototype.nameValue = function (array, name, value) {
35
- console.warn('@deprecated use import { nameValue } from @firestitch/common/array; instead');
36
- var list = [];
37
- if (name || value) {
38
- var nameFn_1 = typeof name === 'function' ? name : function (item) { return item[name]; };
39
- var valueFn_1 = typeof value === 'function' ? value : function (item) { return item[value]; };
40
- array.forEach(function (item) {
41
- list.push({ name: nameFn_1(item), value: valueFn_1(item) });
42
- });
43
- }
44
- else {
45
- array.forEach(function (name, value) {
46
- list.push({ name: name, value: value });
47
- });
48
- }
49
- return list;
50
- };
51
- /**
52
- * @deprecated use import { remove } from @firestitch/common/array; instead
53
- */
54
- FsArray.prototype.remove = function (array, query) {
55
- console.warn('@deprecated use import { remove } from @firestitch/common/array; instead');
56
- var idx = this.indexOf(array, query);
57
- if (idx >= 0) {
58
- return array.splice(idx, 1);
35
+ FsAutofocusDirective.prototype.ngAfterViewInit = function () {
36
+ if (this.fsAutofocus || this.fsAutofocus === undefined) {
37
+ this.focus();
59
38
  }
60
- return idx;
61
39
  };
62
- /**
63
- * @deprecated use import { indexOf } from @firestitch/common/array; instead
64
- */
65
- FsArray.prototype.indexOf = function (array, query) {
40
+ FsAutofocusDirective.prototype.focus = function () {
66
41
  var _this = this;
67
- console.warn('@deprecated use import { indexOf } from @firestitch/common/array; instead');
68
- if (typeof query !== 'function') {
69
- var queryObj_1 = query;
70
- query = function (item) {
71
- return _this.compare(queryObj_1, item);
72
- };
73
- }
74
- for (var i = 0, len = array.length; i < len; i++) {
75
- if (query(array[i])) {
76
- return i;
42
+ setTimeout(function () {
43
+ var tmpEl = document.createElement('input');
44
+ tmpEl.style.width = '0';
45
+ tmpEl.style.height = '0';
46
+ tmpEl.style.margin = '0';
47
+ tmpEl.style.padding = '0';
48
+ tmpEl.style.border = '0';
49
+ tmpEl.style.opacity = '0';
50
+ document.body.appendChild(tmpEl);
51
+ tmpEl.focus();
52
+ if (_this._matInput) {
53
+ _this._matInput.focus();
77
54
  }
78
- }
79
- return -1;
80
- };
81
- /**
82
- * @deprecated use import { compare } from @firestitch/common/array; instead
83
- */
84
- FsArray.prototype.compare = function (query, item) {
85
- console.warn('@deprecated use import { compare } from @firestitch/common/array; instead');
86
- var value = true;
87
- for (var key in query) {
88
- value = value && item[key] == query[key];
89
- }
90
- return value;
55
+ else if (_this._el.nativeElement.focus) {
56
+ _this._el.nativeElement.focus();
57
+ }
58
+ document.body.removeChild(tmpEl);
59
+ }, 50);
91
60
  };
92
- /**
93
- * @deprecated use import { filter } from @firestitch/common/array; instead
94
- */
95
- FsArray.prototype.filter = function (array, query) {
61
+ return FsAutofocusDirective;
62
+ }());
63
+ FsAutofocusDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsAutofocusDirective, deps: [{ token: i1__namespace.MatInput, host: true, optional: true }, { token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
64
+ FsAutofocusDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsAutofocusDirective, selector: "[fsAutofocus],[autofocus]", inputs: { fsAutofocus: "fsAutofocus" }, ngImport: i0__namespace });
65
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsAutofocusDirective, decorators: [{
66
+ type: i0.Directive,
67
+ args: [{
68
+ selector: '[fsAutofocus],[autofocus]',
69
+ }]
70
+ }], ctorParameters: function () {
71
+ return [{ type: i1__namespace.MatInput, decorators: [{
72
+ type: i0.Optional
73
+ }, {
74
+ type: i0.Host
75
+ }] }, { type: i0__namespace.ElementRef }];
76
+ }, propDecorators: { fsAutofocus: [{
77
+ type: i0.Input
78
+ }] } });
79
+
80
+ var FsModelChangeDirective = /** @class */ (function () {
81
+ function FsModelChangeDirective(_ngModel) {
82
+ this._ngModel = _ngModel;
83
+ this.fsModelChange = new i0.EventEmitter();
84
+ this._destroy$ = new rxjs.Subject();
85
+ }
86
+ FsModelChangeDirective.prototype.ngOnInit = function () {
96
87
  var _this = this;
97
- console.warn('@deprecated use import { filter } from @firestitch/common/array; instead');
98
- if (typeof query !== 'function') {
99
- var queryObj_2 = query;
100
- query = function (item) {
101
- return _this.compare(queryObj_2, item);
102
- };
103
- }
104
- var isarray = Array.isArray(array);
105
- var list = isarray ? [] : {};
106
- if (isarray)
107
- array.forEach(function (item, idx) {
108
- if (query(item)) {
109
- list.push(item);
110
- }
111
- });
112
- else
113
- Object.keys(array).forEach(function (key) {
114
- if (query(array[key])) {
115
- list[key] = array[key];
116
- }
117
- });
118
- return list;
119
- };
120
- /**
121
- * @deprecated use import { index } from @firestitch/common/array; instead
122
- */
123
- FsArray.prototype.index = function (array, property) {
124
- console.warn('@deprecated use import { index } from @firestitch/common/array; instead');
125
- var list = {};
126
- array.forEach(function (item, idx) {
127
- list[item[property]] = item;
88
+ this._ngModel.update
89
+ .pipe(operators.debounceTime(this.fsModelChangeOptions.debounce), operators.takeUntil(this._destroy$))
90
+ .subscribe(function (value) {
91
+ _this.fsModelChange.emit(value);
128
92
  });
129
- return list;
130
- };
131
- /**
132
- * @deprecated use import { sort } from @firestitch/common/array; instead
133
- */
134
- FsArray.prototype.sort = function (array, query, reverse) {
135
- if (reverse === void 0) { reverse = false; }
136
- console.warn('@deprecated use import { sort } from @firestitch/common/array; instead');
137
- if (typeof query !== 'function') {
138
- var queryStr_1 = query;
139
- query = function (a, b) {
140
- if (reverse) {
141
- if (a[queryStr_1] < b[queryStr_1]) {
142
- return 1;
143
- }
144
- else if (a[queryStr_1] > b[queryStr_1]) {
145
- return -1;
146
- }
147
- }
148
- else {
149
- if (a[queryStr_1] > b[queryStr_1]) {
150
- return 1;
151
- }
152
- else if (a[queryStr_1] < b[queryStr_1]) {
153
- return -1;
154
- }
155
- }
156
- return 0;
157
- };
158
- }
159
- array.sort(query);
160
- return array;
161
93
  };
162
- /**
163
- * @deprecated use import { rsort } from @firestitch/common/array; instead
164
- */
165
- FsArray.prototype.rsort = function (array, query) {
166
- console.warn('@deprecated use import { rsort } from @firestitch/common/array; instead');
167
- return this.sort(array, query, true);
94
+ FsModelChangeDirective.prototype.ngOnDestroy = function () {
95
+ this._destroy$.next();
96
+ this._destroy$.complete();
168
97
  };
169
- /**
170
- * @deprecated use import { list } from @firestitch/common/array; instead
171
- */
172
- FsArray.prototype.list = function (array, property, index) {
173
- if (index === void 0) { index = null; }
174
- console.warn('@deprecated use import { list } from @firestitch/common/array; instead');
175
- var list = index ? {} : [];
176
- array.forEach(function (item, idx) {
177
- if (index) {
178
- list[item[index]] = item[property];
179
- }
180
- else {
181
- list.push(item[property]);
182
- }
183
- });
184
- return list;
98
+ return FsModelChangeDirective;
99
+ }());
100
+ FsModelChangeDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsModelChangeDirective, deps: [{ token: i1__namespace$1.NgModel }], target: i0__namespace.ɵɵFactoryTarget.Directive });
101
+ FsModelChangeDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsModelChangeDirective, selector: "[fsModelChange]", inputs: { fsModelChangeOptions: "fsModelChangeOptions" }, outputs: { fsModelChange: "fsModelChange" }, ngImport: i0__namespace });
102
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsModelChangeDirective, decorators: [{
103
+ type: i0.Directive,
104
+ args: [{
105
+ selector: '[fsModelChange]',
106
+ }]
107
+ }], ctorParameters: function () { return [{ type: i1__namespace$1.NgModel }]; }, propDecorators: { fsModelChangeOptions: [{
108
+ type: i0.Input
109
+ }], fsModelChange: [{
110
+ type: i0.Output
111
+ }] } });
112
+
113
+ var FsPreventDefaultDirective = /** @class */ (function () {
114
+ function FsPreventDefaultDirective() {
115
+ }
116
+ FsPreventDefaultDirective.prototype.preventClick = function (event) {
117
+ event.preventDefault();
185
118
  };
186
- /**
187
- * @deprecated use import { applyDepth } from @firestitch/common/array; instead
188
- */
189
- FsArray.prototype.applyDepth = function (objects, parent_property, id_property, depth_property) {
190
- if (id_property === void 0) { id_property = 'id'; }
191
- if (depth_property === void 0) { depth_property = 'depth'; }
192
- console.warn('@deprecated use import { applyDepth } from @firestitch/common/array; instead');
193
- var keyed = {};
194
- objects.forEach(function (object) {
195
- if (!object[parent_property]) {
196
- object[depth_property] = 0;
197
- }
198
- keyed[object[id_property]] = object;
199
- });
200
- Object.keys(keyed).forEach(function (key) {
201
- Object.keys(keyed).forEach(function (key) {
202
- var object = keyed[key];
203
- if (!keyed[key][depth_property]) {
204
- if (keyed[key][parent_property]) {
205
- keyed[key][depth_property] = keyed[keyed[key][parent_property]][depth_property] + 1;
206
- }
207
- }
208
- });
209
- });
210
- return keyed;
119
+ return FsPreventDefaultDirective;
120
+ }());
121
+ FsPreventDefaultDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsPreventDefaultDirective, deps: [], target: i0__namespace.ɵɵFactoryTarget.Directive });
122
+ FsPreventDefaultDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsPreventDefaultDirective, selector: "[fsPreventDefault]", host: { listeners: { "click": "preventClick($event)" } }, ngImport: i0__namespace });
123
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsPreventDefaultDirective, decorators: [{
124
+ type: i0.Directive,
125
+ args: [{
126
+ selector: '[fsPreventDefault]',
127
+ }]
128
+ }], propDecorators: { preventClick: [{
129
+ type: i0.HostListener,
130
+ args: ['click', ['$event']]
131
+ }] } });
132
+
133
+ var FsStopPropagationDirective = /** @class */ (function () {
134
+ function FsStopPropagationDirective() {
135
+ }
136
+ FsStopPropagationDirective.prototype.preventClick = function (event) {
137
+ event.stopPropagation();
211
138
  };
212
- /**
213
- * @deprecated use import { inArray } from @firestitch/common/array; instead
214
- */
215
- FsArray.prototype.inArray = function (values, array) {
216
- console.warn('@deprecated use import { inArray } from @firestitch/common/array; instead');
217
- if (!Array.isArray(values)) {
218
- values = [values];
219
- }
220
- for (var i = 0, len = values.length; i < len; i++) {
221
- if (array.indexOf(values[i]) >= 0) {
222
- return true;
223
- }
224
- }
225
- return false;
226
- };
227
- /**
228
- * @deprecated use import { keyExists } from @firestitch/common/array; instead
229
- */
230
- FsArray.prototype.keyExists = function (array, key) {
231
- console.warn('@deprecated use import { keyExists } from @firestitch/common/array; instead');
232
- return array.hasOwnProperty(key);
139
+ return FsStopPropagationDirective;
140
+ }());
141
+ FsStopPropagationDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsStopPropagationDirective, deps: [], target: i0__namespace.ɵɵFactoryTarget.Directive });
142
+ FsStopPropagationDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsStopPropagationDirective, selector: "[fsStopPropagation]", host: { listeners: { "click": "preventClick($event)" } }, ngImport: i0__namespace });
143
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsStopPropagationDirective, decorators: [{
144
+ type: i0.Directive,
145
+ args: [{
146
+ selector: '[fsStopPropagation]',
147
+ }]
148
+ }], propDecorators: { preventClick: [{
149
+ type: i0.HostListener,
150
+ args: ['click', ['$event']]
151
+ }] } });
152
+
153
+ function stringify(value) {
154
+ return JSON.stringify(value);
155
+ }
156
+
157
+ function guid(pattern, options) {
158
+ if (options === void 0) { options = { case: 'lower', numbers: true }; }
159
+ pattern = pattern || 'xxxxxx';
160
+ var s = '';
161
+ if (options.numbers !== false) {
162
+ s = '0123456789';
163
+ }
164
+ if (!options.case || options.case === 'lower' || options.case === 'mixed') {
165
+ s = s.concat('abcdefghijklmnopqrstuvwxyz');
166
+ }
167
+ if (options.case === 'upper' || options.case === 'mixed') {
168
+ s = s.concat('ABCDEFGHIJKLMNOPQRSTUVWXYZ');
169
+ }
170
+ var chars = s.match(/(.{1,1})/g);
171
+ return pattern.replace(/[x]/g, function (c) {
172
+ var i = (Math.random() * chars.length) | 0;
173
+ return chars[i];
174
+ });
175
+ }
176
+
177
+ function isEmpty(value, options) {
178
+ options = options || {};
179
+ return value === undefined ||
180
+ value === null ||
181
+ value === false ||
182
+ value === '' ||
183
+ String(value).length === 0 ||
184
+ (Array.isArray(value) && value.length === 0) ||
185
+ (value instanceof Object && (value.constructor.name === 'Object' && !Object.keys(value).length)) ||
186
+ (!options.zero && (value === 0 || value === '0'));
187
+ }
188
+
189
+ var FsUtilStringifyPipe = /** @class */ (function () {
190
+ function FsUtilStringifyPipe() {
191
+ }
192
+ FsUtilStringifyPipe.prototype.transform = function (value) {
193
+ return stringify(value);
233
194
  };
234
- /**
235
- * @deprecated use import { length } from @firestitch/common/array; instead
236
- */
237
- FsArray.prototype.length = function (array) {
238
- console.warn('@deprecated use import { length } from @firestitch/common/array; instead');
239
- return array.length;
195
+ return FsUtilStringifyPipe;
196
+ }());
197
+ FsUtilStringifyPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtilStringifyPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
198
+ FsUtilStringifyPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtilStringifyPipe, name: "fsUtilStringify" });
199
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtilStringifyPipe, decorators: [{
200
+ type: i0.Pipe,
201
+ args: [{
202
+ name: 'fsUtilStringify'
203
+ }]
204
+ }], ctorParameters: function () { return []; } });
205
+ var FsUtilGuidPipe = /** @class */ (function () {
206
+ function FsUtilGuidPipe() {
207
+ }
208
+ FsUtilGuidPipe.prototype.transform = function () {
209
+ return guid();
240
210
  };
241
- /**
242
- * @deprecated use import { ksort } from @firestitch/common/array; instead
243
- */
244
- FsArray.prototype.ksort = function (unordered) {
245
- console.warn('@deprecated use import { ksort } from @firestitch/common/array; instead');
246
- Object.keys(unordered).sort().forEach(function (key) {
247
- var value = unordered[key];
248
- delete unordered[key];
249
- unordered[key] = value;
250
- });
211
+ return FsUtilGuidPipe;
212
+ }());
213
+ FsUtilGuidPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtilGuidPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
214
+ FsUtilGuidPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtilGuidPipe, name: "fsUtilGuid" });
215
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtilGuidPipe, decorators: [{
216
+ type: i0.Pipe,
217
+ args: [{
218
+ name: 'fsUtilGuid'
219
+ }]
220
+ }], ctorParameters: function () { return []; } });
221
+ var FsUtilIsEmptyPipe = /** @class */ (function () {
222
+ function FsUtilIsEmptyPipe() {
223
+ }
224
+ FsUtilIsEmptyPipe.prototype.transform = function (value) {
225
+ return isEmpty(value);
251
226
  };
252
- return FsArray;
227
+ return FsUtilIsEmptyPipe;
253
228
  }());
254
- FsArray.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsArray, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
255
- FsArrayprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsArray });
256
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsArray, decorators: [{
257
- type: i0.Injectable
258
- }] });
259
-
260
- var FsMath = /** @class */ (function () {
261
- function FsMath() {
229
+ FsUtilIsEmptyPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtilIsEmptyPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
230
+ FsUtilIsEmptyPipepipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtilIsEmptyPipe, name: "fsUtilIsEmpty" });
231
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtilIsEmptyPipe, decorators: [{
232
+ type: i0.Pipe,
233
+ args: [{
234
+ name: 'fsUtilIsEmpty'
235
+ }]
236
+ }] });
237
+ var FsUtilIsNotEmptyPipe = /** @class */ (function () {
238
+ function FsUtilIsNotEmptyPipe() {
262
239
  }
263
- /**
264
- * @deprecated use _.round() instead {@link https://lodash.com/docs/4.17.5#round}
265
- */
266
- FsMath.prototype.round = function (number, precision) {
267
- console.warn('@deprecated use _.round() instead {@link https://lodash.com/docs/4.17.5#round}');
268
- precision = precision || 0;
269
- var factor = Math.pow(10, precision);
270
- var tempNumber = number * factor;
271
- var roundedTempNumber = Math.round(tempNumber);
272
- return roundedTempNumber / factor;
240
+ FsUtilIsNotEmptyPipe.prototype.transform = function (value) {
241
+ return !isEmpty(value);
273
242
  };
274
- return FsMath;
243
+ return FsUtilIsNotEmptyPipe;
275
244
  }());
276
- FsMath.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsMath, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
277
- FsMathprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsMath });
278
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsMath, decorators: [{
279
- type: i0.Injectable
245
+ FsUtilIsNotEmptyPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtilIsNotEmptyPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
246
+ FsUtilIsNotEmptyPipepipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtilIsNotEmptyPipe, name: "fsUtilIsNotEmpty" });
247
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtilIsNotEmptyPipe, decorators: [{
248
+ type: i0.Pipe,
249
+ args: [{
250
+ name: 'fsUtilIsNotEmpty'
251
+ }]
280
252
  }] });
281
253
 
282
- var 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;
283
- /*
284
- 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)
285
- There might be a better way to organise constatns but I need to know use-cases
286
- */
287
- var FsUtil = /** @class */ (function () {
288
- function FsUtil() {
289
- this.intervals = {};
254
+ function email(value) {
255
+ 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,}))$/);
256
+ }
257
+
258
+ function phone(value) {
259
+ var valid = /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4}/.test(value);
260
+ return valid || !String(value).length;
261
+ }
262
+
263
+ /**
264
+ * Check validity of the url.
265
+ * Protocol (http/https) isn't required.
266
+ * @param value
267
+ * @returns {boolean}
268
+ */
269
+ function url(value) {
270
+ var expression = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#%[\]@!\$&'\(\)\*\+,;=.]+$/gm;
271
+ var regexp = new RegExp(expression);
272
+ return !!String(value).match(regexp);
273
+ }
274
+
275
+ function compare(query, item) {
276
+ var value = true;
277
+ for (var key in query) {
278
+ value = value && item[key] == query[key];
290
279
  }
291
- /**
292
- * @deprecated use @firestitch/common/util/guid instead
293
- */
294
- FsUtil.prototype.guid = function (pattern) {
295
- console.warn('@deprecated use @firestitch/common/util/guid instead');
296
- pattern = pattern || 'xxxxxx';
297
- return pattern.replace(/[xy]/g, function (c) {
298
- var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
299
- return v.toString(16);
280
+ return value;
281
+ }
282
+
283
+ function filter(array, query) {
284
+ if (typeof query !== 'function') {
285
+ var queryObj_1 = query;
286
+ query = function (item) {
287
+ return compare(queryObj_1, item);
288
+ };
289
+ }
290
+ var isarray = Array.isArray(array);
291
+ var list = isarray ? [] : {};
292
+ if (isarray) {
293
+ array.forEach(function (item, idx) {
294
+ if (query(item)) {
295
+ list.push(item);
296
+ }
300
297
  });
301
- };
302
- /**
303
- * @deprecated use import { uuid } from @firestitch/common/util; instead
304
- */
305
- FsUtil.prototype.uuid = function () {
306
- console.warn('@deprecated use @firestitch/common/util/uuid instead');
307
- return this.guid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx');
308
- };
309
- /**
310
- * @deprecated use import { resolve } from @firestitch/common/util; instead
311
- */
312
- FsUtil.prototype.resolve = function (promise, defaults) {
313
- if (defaults === void 0) { defaults = []; }
314
- console.warn('@deprecated use @firestitch/common/util/resolve instead');
315
- var result = defaults;
316
- return new Promise(function (resolve) {
317
- promise.then(function (data) {
318
- Object.keys(data).forEach(function (key) { return result[key] = data[key]; });
319
- resolve(result);
320
- });
298
+ }
299
+ else {
300
+ Object.keys(array).forEach(function (key) {
301
+ if (query(array[key])) {
302
+ list[key] = array[key];
303
+ }
321
304
  });
322
- };
323
- /**
324
- * @deprecated use _.toInteger() instead
325
- */
326
- FsUtil.prototype.int = function (value) {
327
- console.warn('@deprecated use _.toInteger() instead');
328
- value = parseInt(value);
329
- if (isNaN(value)) {
330
- value = 0;
331
- }
332
- return value;
333
- };
334
- /**
335
- * @deprecated use _.toFinite() instead
336
- */
337
- FsUtil.prototype.float = function (value) {
338
- console.warn('@deprecated use _.toFinite() instead');
339
- value = parseFloat(value);
340
- if (isNaN(value)) {
341
- value = 0;
342
- }
343
- return value;
344
- };
345
- /**
346
- * @deprecated use _.toString() instead
347
- */
348
- FsUtil.prototype.string = function (string) {
349
- console.warn('@deprecated use _.toString() instead');
350
- if (string === null || string === undefined) {
351
- string = '';
305
+ }
306
+ return list;
307
+ }
308
+
309
+ function inArray(values, array) {
310
+ if (!Array.isArray(values)) {
311
+ values = [values];
312
+ }
313
+ for (var i = 0, len = values.length; i < len; i++) {
314
+ if (array.indexOf(values[i]) >= 0) {
315
+ return true;
352
316
  }
353
- return (string).toString();
354
- };
355
- /**
356
- * @deprecated use import { isEmpty } from @firestitch/common/util; instead
357
- */
358
- FsUtil.prototype.isEmpty = function (value, options) {
359
- console.warn('@deprecated use import { isEmpty } from @firestitch/common/util; instead');
360
- options = options || {};
361
- return value === undefined ||
362
- value === null ||
363
- value === false ||
364
- value === '' ||
365
- !this.string(value).length ||
366
- (this.isObject(value) &&
367
- (value.constructor.name === 'Object' && !Object.keys(value).length)) ||
368
- (!options.zero && (value === 0 || value === '0'));
369
- };
370
- /**
371
- * @deprecated use _.isInteger() instead
372
- */
373
- FsUtil.prototype.isInt = function (value, type) {
374
- console.warn('@deprecated use _.isInteger() instead');
375
- var int = !!this.string(value).match(/^\d+$/);
376
- if (!int) {
377
- return false;
317
+ }
318
+ return false;
319
+ }
320
+
321
+ function index(array, name, value) {
322
+ if (value === void 0) { value = null; }
323
+ var list = {};
324
+ array.forEach(function (item) {
325
+ list[item[name]] = value ? item[value] : item;
326
+ });
327
+ return list;
328
+ }
329
+
330
+ function indexOf(array, query) {
331
+ if (typeof query !== 'function') {
332
+ var queryObj_1 = query;
333
+ query = function (item) {
334
+ return compare(queryObj_1, item);
335
+ };
336
+ }
337
+ for (var i = 0, len = array.length; i < len; i++) {
338
+ if (query(array[i])) {
339
+ return i;
378
340
  }
379
- if (type) {
380
- return Number.isInteger(value);
341
+ }
342
+ return -1;
343
+ }
344
+
345
+ function keyExists(array, key) {
346
+ return array.hasOwnProperty(key);
347
+ }
348
+
349
+ function ksort(unordered) {
350
+ Object.keys(unordered).sort().forEach(function (key) {
351
+ var value = unordered[key];
352
+ delete unordered[key];
353
+ unordered[key] = value;
354
+ });
355
+ }
356
+
357
+ function list(array, property, index) {
358
+ if (index === void 0) { index = null; }
359
+ var resultList = index ? {} : [];
360
+ array.forEach(function (item, idx) {
361
+ if (index) {
362
+ resultList[item[index]] = item[property];
381
363
  }
382
- return true;
383
- };
384
- /**
385
- * @deprecated use _.each() instead {@link https://lodash.com/docs/4.17.5#forEach}
386
- */
387
- FsUtil.prototype.each = function (object, func) {
388
- console.warn('@deprecated use _.each() instead {@link https://lodash.com/docs/4.17.5#forEach}');
389
- if (!this.isArray(object) && !this.isObject(object)) {
390
- return;
364
+ else {
365
+ resultList.push(item[property]);
391
366
  }
392
- Object.keys(object).forEach(function (key) {
393
- func(object[key], key);
367
+ });
368
+ return resultList;
369
+ }
370
+
371
+ function nameValue(array, name, value) {
372
+ var list = [];
373
+ if (name || value) {
374
+ var nameFn_1 = typeof name === 'function' ? name : function (item) {
375
+ return item[name];
376
+ };
377
+ var valueFn_1 = typeof value === 'function' ? value : function (item) {
378
+ return item[value];
379
+ };
380
+ array.forEach(function (item) {
381
+ list.push({ name: nameFn_1(item), value: valueFn_1(item) });
394
382
  });
395
- };
396
- /**
397
- * @deprecated use _.isArrayLikeObject() {@link https://lodash.com/docs/4.17.5#isArrayLikeObject}
398
- * or _.isObject() {@link https://lodash.com/docs/4.17.5#isObject} instead
399
- */
400
- FsUtil.prototype.isObject = function (value) {
401
- 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');
402
- return value !== null && typeof value === 'object' && !this.isArray(value);
403
- };
404
- /**
405
- * @deprecated use _.isString() instead {@link https://lodash.com/docs/4.17.5#isString}
406
- */
407
- FsUtil.prototype.isString = function (value) {
408
- console.warn('@deprecated use _.isString() instead {@link https://lodash.com/docs/4.17.5#isString}');
409
- return typeof value === 'string' || value instanceof String;
410
- };
411
- /**
412
- * @deprecated use _.isArray() instead {@link https://lodash.com/docs/4.17.5#isArray}
413
- */
414
- FsUtil.prototype.isArray = function (value) {
415
- console.warn('@deprecated use _.isArray() instead {@link https://lodash.com/docs/4.17.5#isArray}');
416
- return value instanceof Array;
417
- };
418
- /**
419
- * @deprecated use import { isNumeric } from @firestitch/common/util; instead
420
- */
421
- FsUtil.prototype.isNumeric = function (value) {
422
- console.warn('@deprecated use import { isNumeric } from @firestitch/common/util; instead');
423
- return this.string(value).length && !!this.string(value).match(/^-?\d*\.?\d*$/);
424
- };
425
- /**
426
- * @deprecated use import { isClass } from @firestitch/common/util; instead
427
- */
428
- FsUtil.prototype.isClass = function (value, cls) {
429
- console.warn('@deprecated use import { isClass } from @firestitch/common/util; instead');
430
- if (this.isObject(value)) {
431
- if (this.isString(cls)) {
432
- if (value.constructor) {
433
- if (value.constructor.name === cls) {
434
- return true;
435
- }
383
+ }
384
+ else {
385
+ array.forEach(function (n, v) {
386
+ list.push({ name: n, value: v });
387
+ });
388
+ }
389
+ return list;
390
+ }
391
+
392
+ function remove(array, query) {
393
+ var idx = indexOf(array, query);
394
+ if (idx >= 0) {
395
+ return array.splice(idx, 1);
396
+ }
397
+ return idx;
398
+ }
399
+
400
+ function sort(array, query, reverse) {
401
+ if (reverse === void 0) { reverse = false; }
402
+ if (typeof query !== 'function') {
403
+ var queryStr_1 = query;
404
+ query = function (a, b) {
405
+ if (reverse) {
406
+ if (a[queryStr_1] < b[queryStr_1]) {
407
+ return 1;
408
+ }
409
+ else if (a[queryStr_1] > b[queryStr_1]) {
410
+ return -1;
436
411
  }
437
412
  }
438
413
  else {
439
- if (value instanceof cls) {
440
- return true;
414
+ if (a[queryStr_1] > b[queryStr_1]) {
415
+ return 1;
416
+ }
417
+ else if (a[queryStr_1] < b[queryStr_1]) {
418
+ return -1;
441
419
  }
442
420
  }
443
- }
444
- return false;
445
- };
446
- /**
447
- * @deprecated use _.isBoolean() instead {@link https://lodash.com/docs/4.17.5#isBoolean}
448
- */
449
- FsUtil.prototype.isBoolean = function (value) {
450
- console.warn('@deprecated use _.isBoolean() instead {@link https://lodash.com/docs/4.17.5#isBoolean}');
451
- return value === true || value === false;
452
- };
453
- /**
454
- * @deprecated use import { value } from @firestitch/common/util; instead
455
- */
456
- FsUtil.prototype.value = function (object, key, def) {
457
- console.warn('@deprecated use import { value } from @firestitch/common/util; instead');
458
- if (this.isObject(object) || this.isArray(object)) {
459
- if (object.hasOwnProperty(key)) {
460
- return object[key];
461
- }
462
- }
463
- return def;
464
- };
465
- FsUtil.prototype.throttle = function (func, wait) {
466
- console.warn('@deprecated use import { throttle } from @firestitch/common/util; instead');
467
- var waiting = false; // Initially, we're not waiting
468
- return function () {
469
- if (!waiting) { // If we're not waiting
470
- func.apply(null, arguments); // Execute users function
471
- waiting = true; // Prevent future invocations
472
- setTimeout(function () {
473
- waiting = false; // And allow future invocations
474
- }, wait);
475
- }
421
+ return 0;
476
422
  };
477
- };
478
- /**
479
- * @deprecated use import { debounce } from @firestitch/common/util; instead
480
- */
481
- FsUtil.prototype.debounce = function (func, wait, immediate) {
482
- console.warn('@deprecated use import { debounce } from @firestitch/common/util; instead');
483
- var timeout;
484
- return function () {
485
- var context = this, args = arguments;
486
- var later = function () {
487
- timeout = null;
488
- if (!immediate)
489
- func.apply(context, args);
490
- };
491
- var callNow = immediate && !timeout;
492
- clearTimeout(timeout);
493
- timeout = setTimeout(later, wait);
494
- if (callNow)
495
- func.apply(context, args);
496
- };
497
- };
498
- /**
499
- * @deprecated use import { length } from @firestitch/common/util; instead
500
- */
501
- FsUtil.prototype.length = function (object) {
502
- console.warn('@deprecated use import { length } from @firestitch/common/util; instead');
503
- if (this.isObject(object)) {
504
- return Object.keys(object).length;
505
- }
506
- if (this.isArray(object)) {
507
- return object.length;
508
- }
509
- return 0;
510
- };
511
- /**
512
- * @deprecated use import { boolean } from @firestitch/common/util; instead
513
- */
514
- FsUtil.prototype.boolean = function (value) {
515
- console.warn('@deprecated use import { boolean } from @firestitch/common/util; instead');
516
- return this.string(value).toLowerCase() !== 'false' && !!value;
517
- };
518
- /**
519
- * @deprecated use import { stringify } from @firestitch/common/util; instead
520
- */
521
- FsUtil.prototype.stringify = function (value) {
522
- console.warn('@deprecated use import { stringify } from @firestitch/common/util; instead');
523
- return JSON.stringify(value);
524
- };
525
- return FsUtil;
526
- }());
527
- FsUtil.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtil, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
528
- FsUtil.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtil });
529
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtil, decorators: [{
530
- type: i0.Injectable
531
- }] });
532
-
533
- var FsValidate = /** @class */ (function () {
534
- function FsValidate(fsUtil) {
535
- this.fsUtil = fsUtil;
536
423
  }
537
- /**
538
- * @deprecated use import { email } from @firestitch/common/validate; instead
539
- */
540
- FsValidate.prototype.phone = function (value) {
541
- var valid = /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/.test(value);
542
- return valid || !String(value).length;
543
- };
544
- /**
545
- * @deprecated use import { email } from @firestitch/common/validate; instead
546
- */
547
- FsValidate.prototype.email = function (value) {
548
- 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,}))$/);
549
- };
550
- return FsValidate;
551
- }());
552
- FsValidate.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsValidate, deps: [{ token: FsUtil }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
553
- FsValidate.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsValidate });
554
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsValidate, decorators: [{
555
- type: i0.Injectable
556
- }], ctorParameters: function () { return [{ type: FsUtil }]; } });
557
-
558
- function stringify(value) {
559
- return JSON.stringify(value);
424
+ array.sort(query);
425
+ return array;
560
426
  }
561
427
 
562
- function guid(pattern, options) {
563
- if (options === void 0) { options = { case: 'lower', numbers: true }; }
564
- pattern = pattern || 'xxxxxx';
565
- var s = '';
566
- if (options.numbers !== false) {
567
- s = '0123456789';
568
- }
569
- if (!options.case || options.case === 'lower' || options.case === 'mixed') {
570
- s = s.concat('abcdefghijklmnopqrstuvwxyz');
571
- }
572
- if (options.case === 'upper' || options.case === 'mixed') {
573
- s = s.concat('ABCDEFGHIJKLMNOPQRSTUVWXYZ');
574
- }
575
- var chars = s.match(/(.{1,1})/g);
576
- return pattern.replace(/[x]/g, function (c) {
577
- var i = (Math.random() * chars.length) | 0;
578
- return chars[i];
579
- });
428
+ function rsort(array, query) {
429
+ return sort(array, query, true);
580
430
  }
581
431
 
582
- function isEmpty(value, options) {
583
- options = options || {};
584
- return value === undefined ||
585
- value === null ||
586
- value === false ||
587
- value === '' ||
588
- String(value).length === 0 ||
589
- (Array.isArray(value) && value.length === 0) ||
590
- (value instanceof Object && (value.constructor.name === 'Object' && !Object.keys(value).length)) ||
591
- (!options.zero && (value === 0 || value === '0'));
432
+ function find(array, query) {
433
+ var data = filter(array, query);
434
+ return data.length ? data[0] : null;
592
435
  }
593
436
 
594
- var FsUtilStringifyPipe = /** @class */ (function () {
595
- function FsUtilStringifyPipe() {
596
- }
597
- FsUtilStringifyPipe.prototype.transform = function (value) {
598
- return stringify(value);
599
- };
600
- return FsUtilStringifyPipe;
601
- }());
602
- FsUtilStringifyPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtilStringifyPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
603
- FsUtilStringifyPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtilStringifyPipe, name: "fsUtilStringify" });
604
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtilStringifyPipe, decorators: [{
605
- type: i0.Pipe,
606
- args: [{
607
- name: 'fsUtilStringify'
608
- }]
609
- }], ctorParameters: function () { return []; } });
610
- var FsUtilGuidPipe = /** @class */ (function () {
611
- function FsUtilGuidPipe() {
612
- }
613
- FsUtilGuidPipe.prototype.transform = function () {
614
- return guid();
615
- };
616
- return FsUtilGuidPipe;
617
- }());
618
- FsUtilGuidPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtilGuidPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
619
- FsUtilGuidPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtilGuidPipe, name: "fsUtilGuid" });
620
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtilGuidPipe, decorators: [{
621
- type: i0.Pipe,
622
- args: [{
623
- name: 'fsUtilGuid'
624
- }]
625
- }], ctorParameters: function () { return []; } });
626
- var FsUtilIsEmptyPipe = /** @class */ (function () {
627
- function FsUtilIsEmptyPipe() {
628
- }
629
- FsUtilIsEmptyPipe.prototype.transform = function (value) {
630
- return isEmpty(value);
631
- };
632
- return FsUtilIsEmptyPipe;
633
- }());
634
- FsUtilIsEmptyPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtilIsEmptyPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
635
- FsUtilIsEmptyPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtilIsEmptyPipe, name: "fsUtilIsEmpty" });
636
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtilIsEmptyPipe, decorators: [{
637
- type: i0.Pipe,
638
- args: [{
639
- name: 'fsUtilIsEmpty'
640
- }]
641
- }] });
642
- var FsUtilIsNotEmptyPipe = /** @class */ (function () {
643
- function FsUtilIsNotEmptyPipe() {
644
- }
645
- FsUtilIsNotEmptyPipe.prototype.transform = function (value) {
646
- return !isEmpty(value);
647
- };
648
- return FsUtilIsNotEmptyPipe;
649
- }());
650
- FsUtilIsNotEmptyPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtilIsNotEmptyPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
651
- FsUtilIsNotEmptyPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtilIsNotEmptyPipe, name: "fsUtilIsNotEmpty" });
652
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtilIsNotEmptyPipe, decorators: [{
653
- type: i0.Pipe,
654
- args: [{
655
- name: 'fsUtilIsNotEmpty'
656
- }]
657
- }] });
658
-
659
437
  function boolean(value) {
660
438
  return String(value).toLowerCase() !== 'false' && !!value;
661
439
  }
@@ -677,43 +455,43 @@
677
455
  };
678
456
  }
679
457
 
680
- var KEY_CANCEL = 3;
681
- var KEY_HELP = 6;
682
- var KEY_BACKSPACE = 8;
683
- var KEY_TAB = 9;
684
- var KEY_CLEAR = 12;
685
- var KEY_RETURN = 13;
686
- var KEY_ENTER = 14;
687
- var KEY_SHIFT = 16;
688
- var KEY_CONTROL = 17;
689
- var KEY_ALT = 18;
690
- var KEY_PAUSE = 19;
691
- var KEY_CAPS_LOCK = 20;
692
- var KEY_ESCAPE = 27;
693
- var KEY_SPACE = 32;
694
- var KEY_PAGE_UP = 33;
695
- var KEY_PAGE_DOWN = 34;
696
- var KEY_END = 35;
697
- var KEY_HOME = 36;
698
- var KEY_LEFT = 37;
699
- var KEY_UP = 38;
700
- var KEY_RIGHT = 39;
701
- var KEY_DOWN = 40;
702
- var KEY_PRINTSCREEN = 44;
703
- var KEY_INSERT = 45;
704
- var KEY_DELETE = 46;
705
- var KEY_0 = 48;
706
- var KEY_1 = 49;
707
- var KEY_2 = 50;
708
- var KEY_3 = 51;
709
- var KEY_4 = 52;
710
- var KEY_5 = 53;
711
- var KEY_6 = 54;
712
- var KEY_7 = 55;
713
- var KEY_8 = 56;
714
- var KEY_9 = 57;
715
- var KEY_SEMICOLON = 59;
716
- var KEY_EQUALS = 61;
458
+ var KEY_CANCEL$1 = 3;
459
+ var KEY_HELP$1 = 6;
460
+ var KEY_BACKSPACE$1 = 8;
461
+ var KEY_TAB$1 = 9;
462
+ var KEY_CLEAR$1 = 12;
463
+ var KEY_RETURN$1 = 13;
464
+ var KEY_ENTER$1 = 14;
465
+ var KEY_SHIFT$1 = 16;
466
+ var KEY_CONTROL$1 = 17;
467
+ var KEY_ALT$1 = 18;
468
+ var KEY_PAUSE$1 = 19;
469
+ var KEY_CAPS_LOCK$1 = 20;
470
+ var KEY_ESCAPE$1 = 27;
471
+ var KEY_SPACE$1 = 32;
472
+ var KEY_PAGE_UP$1 = 33;
473
+ var KEY_PAGE_DOWN$1 = 34;
474
+ var KEY_END$1 = 35;
475
+ var KEY_HOME$1 = 36;
476
+ var KEY_LEFT$1 = 37;
477
+ var KEY_UP$1 = 38;
478
+ var KEY_RIGHT$1 = 39;
479
+ var KEY_DOWN$1 = 40;
480
+ var KEY_PRINTSCREEN$1 = 44;
481
+ var KEY_INSERT$1 = 45;
482
+ var KEY_DELETE$1 = 46;
483
+ var KEY_0$1 = 48;
484
+ var KEY_1$1 = 49;
485
+ var KEY_2$1 = 50;
486
+ var KEY_3$1 = 51;
487
+ var KEY_4$1 = 52;
488
+ var KEY_5$1 = 53;
489
+ var KEY_6$1 = 54;
490
+ var KEY_7$1 = 55;
491
+ var KEY_8$1 = 56;
492
+ var KEY_9$1 = 57;
493
+ var KEY_SEMICOLON$1 = 59;
494
+ var KEY_EQUALS$1 = 61;
717
495
 
718
496
  function length(object) {
719
497
  if (Array.isArray(object)) {
@@ -1561,22 +1339,28 @@
1561
1339
  return Number(value || 0).toLocaleString(undefined, { maximumFractionDigits: decimals });
1562
1340
  }
1563
1341
 
1564
- var FsFormatNumberPipe = /** @class */ (function () {
1565
- function FsFormatNumberPipe() {
1342
+ function acronym(str, length) {
1343
+ if (length === void 0) { length = 2; }
1344
+ var splittedString = str
1345
+ .replace(/[^a-zA-Z0-9]+/g, ' ')
1346
+ .split(' ');
1347
+ var result = '';
1348
+ for (var i = 0; i < length; i++) {
1349
+ if (!splittedString[i]) {
1350
+ if (splittedString.length === 1) {
1351
+ for (var j = 1; j < length; j++) {
1352
+ if (!splittedString[i - 1][j]) {
1353
+ break;
1354
+ }
1355
+ result += splittedString[i - 1][j].toUpperCase();
1356
+ }
1357
+ }
1358
+ break;
1359
+ }
1360
+ result += splittedString[i][0].toUpperCase();
1566
1361
  }
1567
- FsFormatNumberPipe.prototype.transform = function (value, decimals) {
1568
- return number(value, decimals);
1569
- };
1570
- return FsFormatNumberPipe;
1571
- }());
1572
- FsFormatNumberPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatNumberPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
1573
- FsFormatNumberPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatNumberPipe, name: "fsFormatNumber" });
1574
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatNumberPipe, decorators: [{
1575
- type: i0.Pipe,
1576
- args: [{
1577
- name: 'fsFormatNumber'
1578
- }]
1579
- }] });
1362
+ return result;
1363
+ }
1580
1364
 
1581
1365
  function currency(amount, precision, currencyCode, locale) {
1582
1366
  if (precision === void 0) { precision = [2, 10]; }
@@ -1588,30 +1372,6 @@
1588
1372
  .transform(amount, currencyCode, 'symbol', "1." + digitsInfo[0] + "-" + digitsInfo[1]);
1589
1373
  }
1590
1374
 
1591
- var FsFormatCurrencyPipe = /** @class */ (function () {
1592
- function FsFormatCurrencyPipe(locale) {
1593
- this.locale = locale;
1594
- }
1595
- FsFormatCurrencyPipe.prototype.transform = function (amount, precision, currencyCode) {
1596
- if (precision === void 0) { precision = 2; }
1597
- return currency(amount, precision, currencyCode);
1598
- };
1599
- return FsFormatCurrencyPipe;
1600
- }());
1601
- FsFormatCurrencyPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatCurrencyPipe, deps: [{ token: i0.LOCALE_ID }], target: i0__namespace.ɵɵFactoryTarget.Pipe });
1602
- FsFormatCurrencyPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatCurrencyPipe, name: "fsFormatCurrency" });
1603
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatCurrencyPipe, decorators: [{
1604
- type: i0.Pipe,
1605
- args: [{
1606
- name: 'fsFormatCurrency',
1607
- }]
1608
- }], ctorParameters: function () {
1609
- return [{ type: undefined, decorators: [{
1610
- type: i0.Inject,
1611
- args: [i0.LOCALE_ID]
1612
- }] }];
1613
- } });
1614
-
1615
1375
  function truncate(value, limit, completeWords, ellipsis) {
1616
1376
  if (limit === void 0) { limit = 100; }
1617
1377
  if (completeWords === void 0) { completeWords = false; }
@@ -1627,113 +1387,99 @@
1627
1387
  return result;
1628
1388
  }
1629
1389
 
1630
- var FsFormatTruncatePipe = /** @class */ (function () {
1631
- function FsFormatTruncatePipe() {
1390
+ function delayedRetry(delayMs, maxRetry, message) {
1391
+ if (maxRetry === void 0) { maxRetry = 5; }
1392
+ var retries = 0;
1393
+ return function (src) { return src.pipe(operators.retryWhen(function (errors) { return errors.pipe(operators.tap(function () {
1394
+ retries++;
1395
+ if (retries <= maxRetry) {
1396
+ console.info("Failed to load Resource. Retry in " + delayMs / 1000 + " sec. " + retries + "/" + maxRetry + " times...");
1397
+ }
1398
+ }), operators.concatMap(function (error) { return rxjs.iif(function () { return retries > maxRetry; }, rxjs.throwError(getErrorMessage(maxRetry, message)), rxjs.timer(delayMs)); })); })); };
1399
+ }
1400
+ var getErrorMessage = function (maxRetry, defaultMessage) {
1401
+ if (!defaultMessage) {
1402
+ return "Failed to load Resource for " + maxRetry + " times. Giving up.";
1632
1403
  }
1633
- FsFormatTruncatePipe.prototype.transform = function (value, limit, completeWords, ellipsis) {
1634
- return truncate(value, limit, completeWords, ellipsis);
1635
- };
1636
- return FsFormatTruncatePipe;
1637
- }());
1638
- FsFormatTruncatePipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatTruncatePipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
1639
- FsFormatTruncatePipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatTruncatePipe, name: "fsFormatTruncate" });
1640
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatTruncatePipe, decorators: [{
1641
- type: i0.Pipe,
1642
- args: [{
1643
- name: 'fsFormatTruncate'
1644
- }]
1645
- }], ctorParameters: function () { return []; } });
1646
-
1647
- var FsStopPropagationDirective = /** @class */ (function () {
1648
- function FsStopPropagationDirective() {
1404
+ else {
1405
+ return defaultMessage;
1649
1406
  }
1650
- FsStopPropagationDirective.prototype.preventClick = function (event) {
1651
- event.stopPropagation();
1407
+ };
1408
+
1409
+ function bytes(bytes, decimals, unit) {
1410
+ if (!bytes) {
1411
+ return '0 MB';
1412
+ }
1413
+ var e = typeof unit === 'string' ?
1414
+ 'KMGTP'.indexOf(unit.replace('B', '')) + 1 :
1415
+ Math.floor(Math.log(bytes) / Math.log(1024));
1416
+ if (!isNumeric(decimals)) {
1417
+ decimals = (bytes / 1024) > 1000 ? 2 : 0;
1418
+ }
1419
+ return ("" + (bytes / Math.pow(1024, e))
1420
+ .toFixed(decimals))
1421
+ .replace(/\.00/, '')
1422
+ + ' '
1423
+ + (e ? ' KMGTP'.charAt(e) : '') + 'B';
1424
+ }
1425
+
1426
+ var FsFormatBytesPipe = /** @class */ (function () {
1427
+ function FsFormatBytesPipe() {
1428
+ }
1429
+ FsFormatBytesPipe.prototype.transform = function (value, decimals, unit) {
1430
+ return bytes(value, decimals, unit);
1652
1431
  };
1653
- return FsStopPropagationDirective;
1432
+ return FsFormatBytesPipe;
1654
1433
  }());
1655
- FsStopPropagationDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsStopPropagationDirective, deps: [], target: i0__namespace.ɵɵFactoryTarget.Directive });
1656
- FsStopPropagationDirectivedir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsStopPropagationDirective, selector: "[fsStopPropagation]", host: { listeners: { "click": "preventClick($event)" } }, ngImport: i0__namespace });
1657
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsStopPropagationDirective, decorators: [{
1658
- type: i0.Directive,
1434
+ FsFormatBytesPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatBytesPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
1435
+ FsFormatBytesPipepipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatBytesPipe, name: "fsFormatBytes" });
1436
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatBytesPipe, decorators: [{
1437
+ type: i0.Pipe,
1659
1438
  args: [{
1660
- selector: '[fsStopPropagation]',
1439
+ name: 'fsFormatBytes',
1661
1440
  }]
1662
- }], propDecorators: { preventClick: [{
1663
- type: i0.HostListener,
1664
- args: ['click', ['$event']]
1665
- }] } });
1441
+ }] });
1666
1442
 
1667
- var FsPreventDefaultDirective = /** @class */ (function () {
1668
- function FsPreventDefaultDirective() {
1443
+ var FsFormatCurrencyPipe = /** @class */ (function () {
1444
+ function FsFormatCurrencyPipe(locale) {
1445
+ this.locale = locale;
1669
1446
  }
1670
- FsPreventDefaultDirective.prototype.preventClick = function (event) {
1671
- event.preventDefault();
1447
+ FsFormatCurrencyPipe.prototype.transform = function (amount, precision, currencyCode) {
1448
+ if (precision === void 0) { precision = 2; }
1449
+ return currency(amount, precision, currencyCode);
1672
1450
  };
1673
- return FsPreventDefaultDirective;
1451
+ return FsFormatCurrencyPipe;
1674
1452
  }());
1675
- FsPreventDefaultDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsPreventDefaultDirective, deps: [], target: i0__namespace.ɵɵFactoryTarget.Directive });
1676
- FsPreventDefaultDirectivedir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsPreventDefaultDirective, selector: "[fsPreventDefault]", host: { listeners: { "click": "preventClick($event)" } }, ngImport: i0__namespace });
1677
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsPreventDefaultDirective, decorators: [{
1678
- type: i0.Directive,
1453
+ FsFormatCurrencyPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatCurrencyPipe, deps: [{ token: i0.LOCALE_ID }], target: i0__namespace.ɵɵFactoryTarget.Pipe });
1454
+ FsFormatCurrencyPipepipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatCurrencyPipe, name: "fsFormatCurrency" });
1455
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatCurrencyPipe, decorators: [{
1456
+ type: i0.Pipe,
1679
1457
  args: [{
1680
- selector: '[fsPreventDefault]',
1458
+ name: 'fsFormatCurrency',
1681
1459
  }]
1682
- }], propDecorators: { preventClick: [{
1683
- type: i0.HostListener,
1684
- args: ['click', ['$event']]
1685
- }] } });
1460
+ }], ctorParameters: function () {
1461
+ return [{ type: undefined, decorators: [{
1462
+ type: i0.Inject,
1463
+ args: [i0.LOCALE_ID]
1464
+ }] }];
1465
+ } });
1686
1466
 
1687
- var FsAutofocusDirective = /** @class */ (function () {
1688
- function FsAutofocusDirective(_matInput, _el) {
1689
- this._matInput = _matInput;
1690
- this._el = _el;
1691
- this.fsAutofocus = true;
1467
+ var FsFormatNumberPipe = /** @class */ (function () {
1468
+ function FsFormatNumberPipe() {
1692
1469
  }
1693
- FsAutofocusDirective.prototype.ngAfterViewInit = function () {
1694
- if (this.fsAutofocus || this.fsAutofocus === undefined) {
1695
- this.focus();
1696
- }
1697
- };
1698
- FsAutofocusDirective.prototype.focus = function () {
1699
- var _this = this;
1700
- setTimeout(function () {
1701
- var tmpEl = document.createElement('input');
1702
- tmpEl.style.width = '0';
1703
- tmpEl.style.height = '0';
1704
- tmpEl.style.margin = '0';
1705
- tmpEl.style.padding = '0';
1706
- tmpEl.style.border = '0';
1707
- tmpEl.style.opacity = '0';
1708
- document.body.appendChild(tmpEl);
1709
- tmpEl.focus();
1710
- if (_this._matInput) {
1711
- _this._matInput.focus();
1712
- }
1713
- else if (_this._el.nativeElement.focus) {
1714
- _this._el.nativeElement.focus();
1715
- }
1716
- document.body.removeChild(tmpEl);
1717
- }, 50);
1470
+ FsFormatNumberPipe.prototype.transform = function (value, decimals) {
1471
+ return number(value, decimals);
1718
1472
  };
1719
- return FsAutofocusDirective;
1473
+ return FsFormatNumberPipe;
1720
1474
  }());
1721
- FsAutofocusDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsAutofocusDirective, deps: [{ token: i1__namespace.MatInput, host: true, optional: true }, { token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1722
- FsAutofocusDirectivedir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsAutofocusDirective, selector: "[fsAutofocus],[autofocus]", inputs: { fsAutofocus: "fsAutofocus" }, ngImport: i0__namespace });
1723
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsAutofocusDirective, decorators: [{
1724
- type: i0.Directive,
1475
+ FsFormatNumberPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatNumberPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
1476
+ FsFormatNumberPipepipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatNumberPipe, name: "fsFormatNumber" });
1477
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatNumberPipe, decorators: [{
1478
+ type: i0.Pipe,
1725
1479
  args: [{
1726
- selector: '[fsAutofocus],[autofocus]',
1480
+ name: 'fsFormatNumber'
1727
1481
  }]
1728
- }], ctorParameters: function () {
1729
- return [{ type: i1__namespace.MatInput, decorators: [{
1730
- type: i0.Optional
1731
- }, {
1732
- type: i0.Host
1733
- }] }, { type: i0__namespace.ElementRef }];
1734
- }, propDecorators: { fsAutofocus: [{
1735
- type: i0.Input
1736
- }] } });
1482
+ }] });
1737
1483
 
1738
1484
  var FsFormatOrdinalNumberPipe = /** @class */ (function () {
1739
1485
  function FsFormatOrdinalNumberPipe() {
@@ -1752,264 +1498,552 @@
1752
1498
  }]
1753
1499
  }] });
1754
1500
 
1755
- function email(value) {
1756
- 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,}))$/);
1757
- }
1758
-
1759
- function phone(value) {
1760
- var valid = /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4}/.test(value);
1761
- return valid || !String(value).length;
1762
- }
1763
-
1764
- /**
1765
- * Check validity of the url.
1766
- * Protocol (http/https) isn't required.
1767
- * @param value
1768
- * @returns {boolean}
1769
- */
1770
- function url(value) {
1771
- var expression = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#%[\]@!\$&'\(\)\*\+,;=.]+$/gm;
1772
- var regexp = new RegExp(expression);
1773
- return !!String(value).match(regexp);
1774
- }
1775
-
1776
- function compare(query, item) {
1777
- var value = true;
1778
- for (var key in query) {
1779
- value = value && item[key] == query[key];
1780
- }
1781
- return value;
1782
- }
1783
-
1784
- function filter(array, query) {
1785
- if (typeof query !== 'function') {
1786
- var queryObj_1 = query;
1787
- query = function (item) {
1788
- return compare(queryObj_1, item);
1789
- };
1790
- }
1791
- var isarray = Array.isArray(array);
1792
- var list = isarray ? [] : {};
1793
- if (isarray) {
1794
- array.forEach(function (item, idx) {
1795
- if (query(item)) {
1796
- list.push(item);
1797
- }
1798
- });
1799
- }
1800
- else {
1801
- Object.keys(array).forEach(function (key) {
1802
- if (query(array[key])) {
1803
- list[key] = array[key];
1804
- }
1805
- });
1501
+ var FsFormatTruncatePipe = /** @class */ (function () {
1502
+ function FsFormatTruncatePipe() {
1806
1503
  }
1807
- return list;
1808
- }
1504
+ FsFormatTruncatePipe.prototype.transform = function (value, limit, completeWords, ellipsis) {
1505
+ return truncate(value, limit, completeWords, ellipsis);
1506
+ };
1507
+ return FsFormatTruncatePipe;
1508
+ }());
1509
+ FsFormatTruncatePipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatTruncatePipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
1510
+ FsFormatTruncatePipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatTruncatePipe, name: "fsFormatTruncate" });
1511
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatTruncatePipe, decorators: [{
1512
+ type: i0.Pipe,
1513
+ args: [{
1514
+ name: 'fsFormatTruncate'
1515
+ }]
1516
+ }], ctorParameters: function () { return []; } });
1809
1517
 
1810
- function inArray(values, array) {
1811
- if (!Array.isArray(values)) {
1812
- values = [values];
1518
+ var FsArray = /** @class */ (function () {
1519
+ function FsArray() {
1813
1520
  }
1814
- for (var i = 0, len = values.length; i < len; i++) {
1815
- if (array.indexOf(values[i]) >= 0) {
1816
- return true;
1521
+ /**
1522
+ * @deprecated use import { nameValue } from @firestitch/common/array; instead
1523
+ */
1524
+ FsArray.prototype.nameValue = function (array, name, value) {
1525
+ console.warn('@deprecated use import { nameValue } from @firestitch/common/array; instead');
1526
+ var list = [];
1527
+ if (name || value) {
1528
+ var nameFn_1 = typeof name === 'function' ? name : function (item) { return item[name]; };
1529
+ var valueFn_1 = typeof value === 'function' ? value : function (item) { return item[value]; };
1530
+ array.forEach(function (item) {
1531
+ list.push({ name: nameFn_1(item), value: valueFn_1(item) });
1532
+ });
1817
1533
  }
1818
- }
1819
- return false;
1820
- }
1821
-
1822
- function index(array, name, value) {
1823
- if (value === void 0) { value = null; }
1824
- var list = {};
1825
- array.forEach(function (item) {
1826
- list[item[name]] = value ? item[value] : item;
1827
- });
1828
- return list;
1829
- }
1830
-
1831
- function indexOf(array, query) {
1832
- if (typeof query !== 'function') {
1833
- var queryObj_1 = query;
1834
- query = function (item) {
1835
- return compare(queryObj_1, item);
1836
- };
1837
- }
1838
- for (var i = 0, len = array.length; i < len; i++) {
1839
- if (query(array[i])) {
1840
- return i;
1534
+ else {
1535
+ array.forEach(function (name, value) {
1536
+ list.push({ name: name, value: value });
1537
+ });
1841
1538
  }
1842
- }
1843
- return -1;
1844
- }
1845
-
1846
- function keyExists(array, key) {
1847
- return array.hasOwnProperty(key);
1848
- }
1849
-
1850
- function ksort(unordered) {
1851
- Object.keys(unordered).sort().forEach(function (key) {
1852
- var value = unordered[key];
1853
- delete unordered[key];
1854
- unordered[key] = value;
1855
- });
1856
- }
1857
-
1858
- function list(array, property, index) {
1859
- if (index === void 0) { index = null; }
1860
- var resultList = index ? {} : [];
1861
- array.forEach(function (item, idx) {
1862
- if (index) {
1863
- resultList[item[index]] = item[property];
1539
+ return list;
1540
+ };
1541
+ /**
1542
+ * @deprecated use import { remove } from @firestitch/common/array; instead
1543
+ */
1544
+ FsArray.prototype.remove = function (array, query) {
1545
+ console.warn('@deprecated use import { remove } from @firestitch/common/array; instead');
1546
+ var idx = this.indexOf(array, query);
1547
+ if (idx >= 0) {
1548
+ return array.splice(idx, 1);
1864
1549
  }
1865
- else {
1866
- resultList.push(item[property]);
1550
+ return idx;
1551
+ };
1552
+ /**
1553
+ * @deprecated use import { indexOf } from @firestitch/common/array; instead
1554
+ */
1555
+ FsArray.prototype.indexOf = function (array, query) {
1556
+ var _this = this;
1557
+ console.warn('@deprecated use import { indexOf } from @firestitch/common/array; instead');
1558
+ if (typeof query !== 'function') {
1559
+ var queryObj_1 = query;
1560
+ query = function (item) {
1561
+ return _this.compare(queryObj_1, item);
1562
+ };
1867
1563
  }
1868
- });
1869
- return resultList;
1870
- }
1871
-
1872
- function nameValue(array, name, value) {
1873
- var list = [];
1874
- if (name || value) {
1875
- var nameFn_1 = typeof name === 'function' ? name : function (item) {
1876
- return item[name];
1877
- };
1878
- var valueFn_1 = typeof value === 'function' ? value : function (item) {
1879
- return item[value];
1880
- };
1881
- array.forEach(function (item) {
1882
- list.push({ name: nameFn_1(item), value: valueFn_1(item) });
1564
+ for (var i = 0, len = array.length; i < len; i++) {
1565
+ if (query(array[i])) {
1566
+ return i;
1567
+ }
1568
+ }
1569
+ return -1;
1570
+ };
1571
+ /**
1572
+ * @deprecated use import { compare } from @firestitch/common/array; instead
1573
+ */
1574
+ FsArray.prototype.compare = function (query, item) {
1575
+ console.warn('@deprecated use import { compare } from @firestitch/common/array; instead');
1576
+ var value = true;
1577
+ for (var key in query) {
1578
+ value = value && item[key] == query[key];
1579
+ }
1580
+ return value;
1581
+ };
1582
+ /**
1583
+ * @deprecated use import { filter } from @firestitch/common/array; instead
1584
+ */
1585
+ FsArray.prototype.filter = function (array, query) {
1586
+ var _this = this;
1587
+ console.warn('@deprecated use import { filter } from @firestitch/common/array; instead');
1588
+ if (typeof query !== 'function') {
1589
+ var queryObj_2 = query;
1590
+ query = function (item) {
1591
+ return _this.compare(queryObj_2, item);
1592
+ };
1593
+ }
1594
+ var isarray = Array.isArray(array);
1595
+ var list = isarray ? [] : {};
1596
+ if (isarray)
1597
+ array.forEach(function (item, idx) {
1598
+ if (query(item)) {
1599
+ list.push(item);
1600
+ }
1601
+ });
1602
+ else
1603
+ Object.keys(array).forEach(function (key) {
1604
+ if (query(array[key])) {
1605
+ list[key] = array[key];
1606
+ }
1607
+ });
1608
+ return list;
1609
+ };
1610
+ /**
1611
+ * @deprecated use import { index } from @firestitch/common/array; instead
1612
+ */
1613
+ FsArray.prototype.index = function (array, property) {
1614
+ console.warn('@deprecated use import { index } from @firestitch/common/array; instead');
1615
+ var list = {};
1616
+ array.forEach(function (item, idx) {
1617
+ list[item[property]] = item;
1883
1618
  });
1884
- }
1885
- else {
1886
- array.forEach(function (n, v) {
1887
- list.push({ name: n, value: v });
1619
+ return list;
1620
+ };
1621
+ /**
1622
+ * @deprecated use import { sort } from @firestitch/common/array; instead
1623
+ */
1624
+ FsArray.prototype.sort = function (array, query, reverse) {
1625
+ if (reverse === void 0) { reverse = false; }
1626
+ console.warn('@deprecated use import { sort } from @firestitch/common/array; instead');
1627
+ if (typeof query !== 'function') {
1628
+ var queryStr_1 = query;
1629
+ query = function (a, b) {
1630
+ if (reverse) {
1631
+ if (a[queryStr_1] < b[queryStr_1]) {
1632
+ return 1;
1633
+ }
1634
+ else if (a[queryStr_1] > b[queryStr_1]) {
1635
+ return -1;
1636
+ }
1637
+ }
1638
+ else {
1639
+ if (a[queryStr_1] > b[queryStr_1]) {
1640
+ return 1;
1641
+ }
1642
+ else if (a[queryStr_1] < b[queryStr_1]) {
1643
+ return -1;
1644
+ }
1645
+ }
1646
+ return 0;
1647
+ };
1648
+ }
1649
+ array.sort(query);
1650
+ return array;
1651
+ };
1652
+ /**
1653
+ * @deprecated use import { rsort } from @firestitch/common/array; instead
1654
+ */
1655
+ FsArray.prototype.rsort = function (array, query) {
1656
+ console.warn('@deprecated use import { rsort } from @firestitch/common/array; instead');
1657
+ return this.sort(array, query, true);
1658
+ };
1659
+ /**
1660
+ * @deprecated use import { list } from @firestitch/common/array; instead
1661
+ */
1662
+ FsArray.prototype.list = function (array, property, index) {
1663
+ if (index === void 0) { index = null; }
1664
+ console.warn('@deprecated use import { list } from @firestitch/common/array; instead');
1665
+ var list = index ? {} : [];
1666
+ array.forEach(function (item, idx) {
1667
+ if (index) {
1668
+ list[item[index]] = item[property];
1669
+ }
1670
+ else {
1671
+ list.push(item[property]);
1672
+ }
1888
1673
  });
1889
- }
1890
- return list;
1891
- }
1674
+ return list;
1675
+ };
1676
+ /**
1677
+ * @deprecated use import { applyDepth } from @firestitch/common/array; instead
1678
+ */
1679
+ FsArray.prototype.applyDepth = function (objects, parent_property, id_property, depth_property) {
1680
+ if (id_property === void 0) { id_property = 'id'; }
1681
+ if (depth_property === void 0) { depth_property = 'depth'; }
1682
+ console.warn('@deprecated use import { applyDepth } from @firestitch/common/array; instead');
1683
+ var keyed = {};
1684
+ objects.forEach(function (object) {
1685
+ if (!object[parent_property]) {
1686
+ object[depth_property] = 0;
1687
+ }
1688
+ keyed[object[id_property]] = object;
1689
+ });
1690
+ Object.keys(keyed).forEach(function (key) {
1691
+ Object.keys(keyed).forEach(function (key) {
1692
+ var object = keyed[key];
1693
+ if (!keyed[key][depth_property]) {
1694
+ if (keyed[key][parent_property]) {
1695
+ keyed[key][depth_property] = keyed[keyed[key][parent_property]][depth_property] + 1;
1696
+ }
1697
+ }
1698
+ });
1699
+ });
1700
+ return keyed;
1701
+ };
1702
+ /**
1703
+ * @deprecated use import { inArray } from @firestitch/common/array; instead
1704
+ */
1705
+ FsArray.prototype.inArray = function (values, array) {
1706
+ console.warn('@deprecated use import { inArray } from @firestitch/common/array; instead');
1707
+ if (!Array.isArray(values)) {
1708
+ values = [values];
1709
+ }
1710
+ for (var i = 0, len = values.length; i < len; i++) {
1711
+ if (array.indexOf(values[i]) >= 0) {
1712
+ return true;
1713
+ }
1714
+ }
1715
+ return false;
1716
+ };
1717
+ /**
1718
+ * @deprecated use import { keyExists } from @firestitch/common/array; instead
1719
+ */
1720
+ FsArray.prototype.keyExists = function (array, key) {
1721
+ console.warn('@deprecated use import { keyExists } from @firestitch/common/array; instead');
1722
+ return array.hasOwnProperty(key);
1723
+ };
1724
+ /**
1725
+ * @deprecated use import { length } from @firestitch/common/array; instead
1726
+ */
1727
+ FsArray.prototype.length = function (array) {
1728
+ console.warn('@deprecated use import { length } from @firestitch/common/array; instead');
1729
+ return array.length;
1730
+ };
1731
+ /**
1732
+ * @deprecated use import { ksort } from @firestitch/common/array; instead
1733
+ */
1734
+ FsArray.prototype.ksort = function (unordered) {
1735
+ console.warn('@deprecated use import { ksort } from @firestitch/common/array; instead');
1736
+ Object.keys(unordered).sort().forEach(function (key) {
1737
+ var value = unordered[key];
1738
+ delete unordered[key];
1739
+ unordered[key] = value;
1740
+ });
1741
+ };
1742
+ return FsArray;
1743
+ }());
1744
+ FsArray.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsArray, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1745
+ FsArray.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsArray });
1746
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsArray, decorators: [{
1747
+ type: i0.Injectable
1748
+ }] });
1892
1749
 
1893
- function remove(array, query) {
1894
- var idx = indexOf(array, query);
1895
- if (idx >= 0) {
1896
- return array.splice(idx, 1);
1750
+ var FsMath = /** @class */ (function () {
1751
+ function FsMath() {
1897
1752
  }
1898
- return idx;
1899
- }
1753
+ /**
1754
+ * @deprecated use _.round() instead {@link https://lodash.com/docs/4.17.5#round}
1755
+ */
1756
+ FsMath.prototype.round = function (number, precision) {
1757
+ console.warn('@deprecated use _.round() instead {@link https://lodash.com/docs/4.17.5#round}');
1758
+ precision = precision || 0;
1759
+ var factor = Math.pow(10, precision);
1760
+ var tempNumber = number * factor;
1761
+ var roundedTempNumber = Math.round(tempNumber);
1762
+ return roundedTempNumber / factor;
1763
+ };
1764
+ return FsMath;
1765
+ }());
1766
+ FsMath.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsMath, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1767
+ FsMath.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsMath });
1768
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsMath, decorators: [{
1769
+ type: i0.Injectable
1770
+ }] });
1900
1771
 
1901
- function sort(array, query, reverse) {
1902
- if (reverse === void 0) { reverse = false; }
1903
- if (typeof query !== 'function') {
1904
- var queryStr_1 = query;
1905
- query = function (a, b) {
1906
- if (reverse) {
1907
- if (a[queryStr_1] < b[queryStr_1]) {
1908
- return 1;
1909
- }
1910
- else if (a[queryStr_1] > b[queryStr_1]) {
1911
- return -1;
1772
+ var 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;
1773
+ /*
1774
+ 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)
1775
+ There might be a better way to organise constatns but I need to know use-cases
1776
+ */
1777
+ var FsUtil = /** @class */ (function () {
1778
+ function FsUtil() {
1779
+ this.intervals = {};
1780
+ }
1781
+ /**
1782
+ * @deprecated use @firestitch/common/util/guid instead
1783
+ */
1784
+ FsUtil.prototype.guid = function (pattern) {
1785
+ console.warn('@deprecated use @firestitch/common/util/guid instead');
1786
+ pattern = pattern || 'xxxxxx';
1787
+ return pattern.replace(/[xy]/g, function (c) {
1788
+ var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
1789
+ return v.toString(16);
1790
+ });
1791
+ };
1792
+ /**
1793
+ * @deprecated use import { uuid } from @firestitch/common/util; instead
1794
+ */
1795
+ FsUtil.prototype.uuid = function () {
1796
+ console.warn('@deprecated use @firestitch/common/util/uuid instead');
1797
+ return this.guid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx');
1798
+ };
1799
+ /**
1800
+ * @deprecated use import { resolve } from @firestitch/common/util; instead
1801
+ */
1802
+ FsUtil.prototype.resolve = function (promise, defaults) {
1803
+ if (defaults === void 0) { defaults = []; }
1804
+ console.warn('@deprecated use @firestitch/common/util/resolve instead');
1805
+ var result = defaults;
1806
+ return new Promise(function (resolve) {
1807
+ promise.then(function (data) {
1808
+ Object.keys(data).forEach(function (key) { return result[key] = data[key]; });
1809
+ resolve(result);
1810
+ });
1811
+ });
1812
+ };
1813
+ /**
1814
+ * @deprecated use _.toInteger() instead
1815
+ */
1816
+ FsUtil.prototype.int = function (value) {
1817
+ console.warn('@deprecated use _.toInteger() instead');
1818
+ value = parseInt(value);
1819
+ if (isNaN(value)) {
1820
+ value = 0;
1821
+ }
1822
+ return value;
1823
+ };
1824
+ /**
1825
+ * @deprecated use _.toFinite() instead
1826
+ */
1827
+ FsUtil.prototype.float = function (value) {
1828
+ console.warn('@deprecated use _.toFinite() instead');
1829
+ value = parseFloat(value);
1830
+ if (isNaN(value)) {
1831
+ value = 0;
1832
+ }
1833
+ return value;
1834
+ };
1835
+ /**
1836
+ * @deprecated use _.toString() instead
1837
+ */
1838
+ FsUtil.prototype.string = function (string) {
1839
+ console.warn('@deprecated use _.toString() instead');
1840
+ if (string === null || string === undefined) {
1841
+ string = '';
1842
+ }
1843
+ return (string).toString();
1844
+ };
1845
+ /**
1846
+ * @deprecated use import { isEmpty } from @firestitch/common/util; instead
1847
+ */
1848
+ FsUtil.prototype.isEmpty = function (value, options) {
1849
+ console.warn('@deprecated use import { isEmpty } from @firestitch/common/util; instead');
1850
+ options = options || {};
1851
+ return value === undefined ||
1852
+ value === null ||
1853
+ value === false ||
1854
+ value === '' ||
1855
+ !this.string(value).length ||
1856
+ (this.isObject(value) &&
1857
+ (value.constructor.name === 'Object' && !Object.keys(value).length)) ||
1858
+ (!options.zero && (value === 0 || value === '0'));
1859
+ };
1860
+ /**
1861
+ * @deprecated use _.isInteger() instead
1862
+ */
1863
+ FsUtil.prototype.isInt = function (value, type) {
1864
+ console.warn('@deprecated use _.isInteger() instead');
1865
+ var int = !!this.string(value).match(/^\d+$/);
1866
+ if (!int) {
1867
+ return false;
1868
+ }
1869
+ if (type) {
1870
+ return Number.isInteger(value);
1871
+ }
1872
+ return true;
1873
+ };
1874
+ /**
1875
+ * @deprecated use _.each() instead {@link https://lodash.com/docs/4.17.5#forEach}
1876
+ */
1877
+ FsUtil.prototype.each = function (object, func) {
1878
+ console.warn('@deprecated use _.each() instead {@link https://lodash.com/docs/4.17.5#forEach}');
1879
+ if (!this.isArray(object) && !this.isObject(object)) {
1880
+ return;
1881
+ }
1882
+ Object.keys(object).forEach(function (key) {
1883
+ func(object[key], key);
1884
+ });
1885
+ };
1886
+ /**
1887
+ * @deprecated use _.isArrayLikeObject() {@link https://lodash.com/docs/4.17.5#isArrayLikeObject}
1888
+ * or _.isObject() {@link https://lodash.com/docs/4.17.5#isObject} instead
1889
+ */
1890
+ FsUtil.prototype.isObject = function (value) {
1891
+ 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');
1892
+ return value !== null && typeof value === 'object' && !this.isArray(value);
1893
+ };
1894
+ /**
1895
+ * @deprecated use _.isString() instead {@link https://lodash.com/docs/4.17.5#isString}
1896
+ */
1897
+ FsUtil.prototype.isString = function (value) {
1898
+ console.warn('@deprecated use _.isString() instead {@link https://lodash.com/docs/4.17.5#isString}');
1899
+ return typeof value === 'string' || value instanceof String;
1900
+ };
1901
+ /**
1902
+ * @deprecated use _.isArray() instead {@link https://lodash.com/docs/4.17.5#isArray}
1903
+ */
1904
+ FsUtil.prototype.isArray = function (value) {
1905
+ console.warn('@deprecated use _.isArray() instead {@link https://lodash.com/docs/4.17.5#isArray}');
1906
+ return value instanceof Array;
1907
+ };
1908
+ /**
1909
+ * @deprecated use import { isNumeric } from @firestitch/common/util; instead
1910
+ */
1911
+ FsUtil.prototype.isNumeric = function (value) {
1912
+ console.warn('@deprecated use import { isNumeric } from @firestitch/common/util; instead');
1913
+ return this.string(value).length && !!this.string(value).match(/^-?\d*\.?\d*$/);
1914
+ };
1915
+ /**
1916
+ * @deprecated use import { isClass } from @firestitch/common/util; instead
1917
+ */
1918
+ FsUtil.prototype.isClass = function (value, cls) {
1919
+ console.warn('@deprecated use import { isClass } from @firestitch/common/util; instead');
1920
+ if (this.isObject(value)) {
1921
+ if (this.isString(cls)) {
1922
+ if (value.constructor) {
1923
+ if (value.constructor.name === cls) {
1924
+ return true;
1925
+ }
1912
1926
  }
1913
1927
  }
1914
1928
  else {
1915
- if (a[queryStr_1] > b[queryStr_1]) {
1916
- return 1;
1917
- }
1918
- else if (a[queryStr_1] < b[queryStr_1]) {
1919
- return -1;
1929
+ if (value instanceof cls) {
1930
+ return true;
1920
1931
  }
1921
1932
  }
1922
- return 0;
1923
- };
1924
- }
1925
- array.sort(query);
1926
- return array;
1927
- }
1928
-
1929
- function rsort(array, query) {
1930
- return sort(array, query, true);
1931
- }
1932
-
1933
- function find(array, query) {
1934
- var data = filter(array, query);
1935
- return data.length ? data[0] : null;
1936
- }
1937
-
1938
- function acronym(str, length) {
1939
- if (length === void 0) { length = 2; }
1940
- var splittedString = str
1941
- .replace(/[^a-zA-Z0-9]+/g, ' ')
1942
- .split(' ');
1943
- var result = '';
1944
- for (var i = 0; i < length; i++) {
1945
- if (!splittedString[i]) {
1946
- if (splittedString.length === 1) {
1947
- for (var j = 1; j < length; j++) {
1948
- if (!splittedString[i - 1][j]) {
1949
- break;
1950
- }
1951
- result += splittedString[i - 1][j].toUpperCase();
1952
- }
1933
+ }
1934
+ return false;
1935
+ };
1936
+ /**
1937
+ * @deprecated use _.isBoolean() instead {@link https://lodash.com/docs/4.17.5#isBoolean}
1938
+ */
1939
+ FsUtil.prototype.isBoolean = function (value) {
1940
+ console.warn('@deprecated use _.isBoolean() instead {@link https://lodash.com/docs/4.17.5#isBoolean}');
1941
+ return value === true || value === false;
1942
+ };
1943
+ /**
1944
+ * @deprecated use import { value } from @firestitch/common/util; instead
1945
+ */
1946
+ FsUtil.prototype.value = function (object, key, def) {
1947
+ console.warn('@deprecated use import { value } from @firestitch/common/util; instead');
1948
+ if (this.isObject(object) || this.isArray(object)) {
1949
+ if (object.hasOwnProperty(key)) {
1950
+ return object[key];
1953
1951
  }
1954
- break;
1955
1952
  }
1956
- result += splittedString[i][0].toUpperCase();
1957
- }
1958
- return result;
1959
- }
1960
-
1961
- function delayedRetry(delayMs, maxRetry, message) {
1962
- if (maxRetry === void 0) { maxRetry = 5; }
1963
- var retries = 0;
1964
- return function (src) { return src.pipe(operators.retryWhen(function (errors) { return errors.pipe(operators.tap(function () {
1965
- retries++;
1966
- if (retries <= maxRetry) {
1967
- console.info("Failed to load Resource. Retry in " + delayMs / 1000 + " sec. " + retries + "/" + maxRetry + " times...");
1953
+ return def;
1954
+ };
1955
+ FsUtil.prototype.throttle = function (func, wait) {
1956
+ console.warn('@deprecated use import { throttle } from @firestitch/common/util; instead');
1957
+ var waiting = false; // Initially, we're not waiting
1958
+ return function () {
1959
+ if (!waiting) { // If we're not waiting
1960
+ func.apply(null, arguments); // Execute users function
1961
+ waiting = true; // Prevent future invocations
1962
+ setTimeout(function () {
1963
+ waiting = false; // And allow future invocations
1964
+ }, wait);
1965
+ }
1966
+ };
1967
+ };
1968
+ /**
1969
+ * @deprecated use import { debounce } from @firestitch/common/util; instead
1970
+ */
1971
+ FsUtil.prototype.debounce = function (func, wait, immediate) {
1972
+ console.warn('@deprecated use import { debounce } from @firestitch/common/util; instead');
1973
+ var timeout;
1974
+ return function () {
1975
+ var context = this, args = arguments;
1976
+ var later = function () {
1977
+ timeout = null;
1978
+ if (!immediate)
1979
+ func.apply(context, args);
1980
+ };
1981
+ var callNow = immediate && !timeout;
1982
+ clearTimeout(timeout);
1983
+ timeout = setTimeout(later, wait);
1984
+ if (callNow)
1985
+ func.apply(context, args);
1986
+ };
1987
+ };
1988
+ /**
1989
+ * @deprecated use import { length } from @firestitch/common/util; instead
1990
+ */
1991
+ FsUtil.prototype.length = function (object) {
1992
+ console.warn('@deprecated use import { length } from @firestitch/common/util; instead');
1993
+ if (this.isObject(object)) {
1994
+ return Object.keys(object).length;
1968
1995
  }
1969
- }), operators.concatMap(function (error) { return rxjs.iif(function () { return retries > maxRetry; }, rxjs.throwError(getErrorMessage(maxRetry, message)), rxjs.timer(delayMs)); })); })); };
1970
- }
1971
- var getErrorMessage = function (maxRetry, defaultMessage) {
1972
- if (!defaultMessage) {
1973
- return "Failed to load Resource for " + maxRetry + " times. Giving up.";
1974
- }
1975
- else {
1976
- return defaultMessage;
1977
- }
1978
- };
1979
-
1980
- function bytes(bytes, decimals, unit) {
1981
- if (!bytes) {
1982
- return '0 MB';
1983
- }
1984
- var e = typeof unit === 'string' ?
1985
- 'KMGTP'.indexOf(unit.replace('B', '')) + 1 :
1986
- Math.floor(Math.log(bytes) / Math.log(1024));
1987
- if (!isNumeric(decimals)) {
1988
- decimals = (bytes / 1024) > 1000 ? 2 : 0;
1989
- }
1990
- return ("" + (bytes / Math.pow(1024, e))
1991
- .toFixed(decimals))
1992
- .replace(/\.00/, '')
1993
- + ' '
1994
- + (e ? ' KMGTP'.charAt(e) : '') + 'B';
1995
- }
1996
+ if (this.isArray(object)) {
1997
+ return object.length;
1998
+ }
1999
+ return 0;
2000
+ };
2001
+ /**
2002
+ * @deprecated use import { boolean } from @firestitch/common/util; instead
2003
+ */
2004
+ FsUtil.prototype.boolean = function (value) {
2005
+ console.warn('@deprecated use import { boolean } from @firestitch/common/util; instead');
2006
+ return this.string(value).toLowerCase() !== 'false' && !!value;
2007
+ };
2008
+ /**
2009
+ * @deprecated use import { stringify } from @firestitch/common/util; instead
2010
+ */
2011
+ FsUtil.prototype.stringify = function (value) {
2012
+ console.warn('@deprecated use import { stringify } from @firestitch/common/util; instead');
2013
+ return JSON.stringify(value);
2014
+ };
2015
+ return FsUtil;
2016
+ }());
2017
+ FsUtil.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtil, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
2018
+ FsUtil.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtil });
2019
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsUtil, decorators: [{
2020
+ type: i0.Injectable
2021
+ }] });
1996
2022
 
1997
- var FsFormatBytesPipe = /** @class */ (function () {
1998
- function FsFormatBytesPipe() {
2023
+ var FsValidate = /** @class */ (function () {
2024
+ function FsValidate(fsUtil) {
2025
+ this.fsUtil = fsUtil;
1999
2026
  }
2000
- FsFormatBytesPipe.prototype.transform = function (value, decimals, unit) {
2001
- return bytes(value, decimals, unit);
2027
+ /**
2028
+ * @deprecated use import { email } from @firestitch/common/validate; instead
2029
+ */
2030
+ FsValidate.prototype.phone = function (value) {
2031
+ var valid = /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/.test(value);
2032
+ return valid || !String(value).length;
2002
2033
  };
2003
- return FsFormatBytesPipe;
2034
+ /**
2035
+ * @deprecated use import { email } from @firestitch/common/validate; instead
2036
+ */
2037
+ FsValidate.prototype.email = function (value) {
2038
+ 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,}))$/);
2039
+ };
2040
+ return FsValidate;
2004
2041
  }());
2005
- FsFormatBytesPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatBytesPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
2006
- FsFormatBytesPipepipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatBytesPipe, name: "fsFormatBytes" });
2007
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatBytesPipe, decorators: [{
2008
- type: i0.Pipe,
2009
- args: [{
2010
- name: 'fsFormatBytes',
2011
- }]
2012
- }] });
2042
+ FsValidate.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsValidate, deps: [{ token: FsUtil }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
2043
+ FsValidateprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsValidate });
2044
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsValidate, decorators: [{
2045
+ type: i0.Injectable
2046
+ }], ctorParameters: function () { return [{ type: FsUtil }]; } });
2013
2047
 
2014
2048
  var FsCommonModule = /** @class */ (function () {
2015
2049
  function FsCommonModule() {
@@ -2021,8 +2055,8 @@
2021
2055
  FsArray,
2022
2056
  FsMath,
2023
2057
  FsUtil,
2024
- FsValidate
2025
- ]
2058
+ FsValidate,
2059
+ ],
2026
2060
  };
2027
2061
  };
2028
2062
  return FsCommonModule;
@@ -2039,7 +2073,8 @@
2039
2073
  FsFormatCurrencyPipe,
2040
2074
  FsFormatTruncatePipe,
2041
2075
  FsFormatBytesPipe,
2042
- FsFormatOrdinalNumberPipe], imports: [common.CommonModule], exports: [FsStopPropagationDirective,
2076
+ FsFormatOrdinalNumberPipe,
2077
+ FsModelChangeDirective], imports: [common.CommonModule], exports: [FsStopPropagationDirective,
2043
2078
  FsPreventDefaultDirective,
2044
2079
  FsAutofocusDirective,
2045
2080
  FsUtilGuidPipe,
@@ -2050,6 +2085,7 @@
2050
2085
  FsUtilIsEmptyPipe,
2051
2086
  FsUtilIsNotEmptyPipe,
2052
2087
  FsFormatBytesPipe,
2088
+ FsModelChangeDirective,
2053
2089
  FsFormatOrdinalNumberPipe] });
2054
2090
  FsCommonModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsCommonModule, imports: [[
2055
2091
  common.CommonModule,
@@ -2073,6 +2109,7 @@
2073
2109
  FsFormatTruncatePipe,
2074
2110
  FsFormatBytesPipe,
2075
2111
  FsFormatOrdinalNumberPipe,
2112
+ FsModelChangeDirective,
2076
2113
  ],
2077
2114
  exports: [
2078
2115
  FsStopPropagationDirective,
@@ -2086,6 +2123,7 @@
2086
2123
  FsUtilIsEmptyPipe,
2087
2124
  FsUtilIsNotEmptyPipe,
2088
2125
  FsFormatBytesPipe,
2126
+ FsModelChangeDirective,
2089
2127
  FsFormatOrdinalNumberPipe,
2090
2128
  ],
2091
2129
  }]
@@ -2122,6 +2160,7 @@
2122
2160
  exports.FsFormatOrdinalNumberPipe = FsFormatOrdinalNumberPipe;
2123
2161
  exports.FsFormatTruncatePipe = FsFormatTruncatePipe;
2124
2162
  exports.FsMath = FsMath;
2163
+ exports.FsModelChangeDirective = FsModelChangeDirective;
2125
2164
  exports.FsPreventDefaultDirective = FsPreventDefaultDirective;
2126
2165
  exports.FsStopPropagationDirective = FsStopPropagationDirective;
2127
2166
  exports.FsUtil = FsUtil;
@@ -2130,43 +2169,43 @@
2130
2169
  exports.FsUtilIsNotEmptyPipe = FsUtilIsNotEmptyPipe;
2131
2170
  exports.FsUtilStringifyPipe = FsUtilStringifyPipe;
2132
2171
  exports.FsValidate = FsValidate;
2133
- exports.KEY_0 = KEY_0;
2134
- exports.KEY_1 = KEY_1;
2135
- exports.KEY_2 = KEY_2;
2136
- exports.KEY_3 = KEY_3;
2137
- exports.KEY_4 = KEY_4;
2138
- exports.KEY_5 = KEY_5;
2139
- exports.KEY_6 = KEY_6;
2140
- exports.KEY_7 = KEY_7;
2141
- exports.KEY_8 = KEY_8;
2142
- exports.KEY_9 = KEY_9;
2143
- exports.KEY_ALT = KEY_ALT;
2144
- exports.KEY_BACKSPACE = KEY_BACKSPACE;
2145
- exports.KEY_CANCEL = KEY_CANCEL;
2146
- exports.KEY_CAPS_LOCK = KEY_CAPS_LOCK;
2147
- exports.KEY_CLEAR = KEY_CLEAR;
2148
- exports.KEY_CONTROL = KEY_CONTROL;
2149
- exports.KEY_DELETE = KEY_DELETE;
2150
- exports.KEY_DOWN = KEY_DOWN;
2151
- exports.KEY_END = KEY_END;
2152
- exports.KEY_ENTER = KEY_ENTER;
2153
- exports.KEY_EQUALS = KEY_EQUALS;
2154
- exports.KEY_ESCAPE = KEY_ESCAPE;
2155
- exports.KEY_HELP = KEY_HELP;
2156
- exports.KEY_HOME = KEY_HOME;
2157
- exports.KEY_INSERT = KEY_INSERT;
2158
- exports.KEY_LEFT = KEY_LEFT;
2159
- exports.KEY_PAGE_DOWN = KEY_PAGE_DOWN;
2160
- exports.KEY_PAGE_UP = KEY_PAGE_UP;
2161
- exports.KEY_PAUSE = KEY_PAUSE;
2162
- exports.KEY_PRINTSCREEN = KEY_PRINTSCREEN;
2163
- exports.KEY_RETURN = KEY_RETURN;
2164
- exports.KEY_RIGHT = KEY_RIGHT;
2165
- exports.KEY_SEMICOLON = KEY_SEMICOLON;
2166
- exports.KEY_SHIFT = KEY_SHIFT;
2167
- exports.KEY_SPACE = KEY_SPACE;
2168
- exports.KEY_TAB = KEY_TAB;
2169
- exports.KEY_UP = KEY_UP;
2172
+ exports.KEY_0 = KEY_0$1;
2173
+ exports.KEY_1 = KEY_1$1;
2174
+ exports.KEY_2 = KEY_2$1;
2175
+ exports.KEY_3 = KEY_3$1;
2176
+ exports.KEY_4 = KEY_4$1;
2177
+ exports.KEY_5 = KEY_5$1;
2178
+ exports.KEY_6 = KEY_6$1;
2179
+ exports.KEY_7 = KEY_7$1;
2180
+ exports.KEY_8 = KEY_8$1;
2181
+ exports.KEY_9 = KEY_9$1;
2182
+ exports.KEY_ALT = KEY_ALT$1;
2183
+ exports.KEY_BACKSPACE = KEY_BACKSPACE$1;
2184
+ exports.KEY_CANCEL = KEY_CANCEL$1;
2185
+ exports.KEY_CAPS_LOCK = KEY_CAPS_LOCK$1;
2186
+ exports.KEY_CLEAR = KEY_CLEAR$1;
2187
+ exports.KEY_CONTROL = KEY_CONTROL$1;
2188
+ exports.KEY_DELETE = KEY_DELETE$1;
2189
+ exports.KEY_DOWN = KEY_DOWN$1;
2190
+ exports.KEY_END = KEY_END$1;
2191
+ exports.KEY_ENTER = KEY_ENTER$1;
2192
+ exports.KEY_EQUALS = KEY_EQUALS$1;
2193
+ exports.KEY_ESCAPE = KEY_ESCAPE$1;
2194
+ exports.KEY_HELP = KEY_HELP$1;
2195
+ exports.KEY_HOME = KEY_HOME$1;
2196
+ exports.KEY_INSERT = KEY_INSERT$1;
2197
+ exports.KEY_LEFT = KEY_LEFT$1;
2198
+ exports.KEY_PAGE_DOWN = KEY_PAGE_DOWN$1;
2199
+ exports.KEY_PAGE_UP = KEY_PAGE_UP$1;
2200
+ exports.KEY_PAUSE = KEY_PAUSE$1;
2201
+ exports.KEY_PRINTSCREEN = KEY_PRINTSCREEN$1;
2202
+ exports.KEY_RETURN = KEY_RETURN$1;
2203
+ exports.KEY_RIGHT = KEY_RIGHT$1;
2204
+ exports.KEY_SEMICOLON = KEY_SEMICOLON$1;
2205
+ exports.KEY_SHIFT = KEY_SHIFT$1;
2206
+ exports.KEY_SPACE = KEY_SPACE$1;
2207
+ exports.KEY_TAB = KEY_TAB$1;
2208
+ exports.KEY_UP = KEY_UP$1;
2170
2209
  exports.Queue = Queue;
2171
2210
  exports.acronym = acronym;
2172
2211
  exports.boolean = boolean;