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