@theseam/ui-common 1.0.0-beta.6 → 1.0.0-beta.7

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 (149) hide show
  1. package/breadcrumbs/index.d.ts +1 -2
  2. package/buttons/index.d.ts +20 -13
  3. package/datatable/index.d.ts +8 -8
  4. package/dynamic/index.d.ts +5 -5
  5. package/fesm2022/theseam-ui-common-asset-reader.mjs +28 -29
  6. package/fesm2022/theseam-ui-common-asset-reader.mjs.map +1 -1
  7. package/fesm2022/theseam-ui-common-breadcrumbs.mjs +25 -31
  8. package/fesm2022/theseam-ui-common-breadcrumbs.mjs.map +1 -1
  9. package/fesm2022/theseam-ui-common-buttons.mjs +108 -66
  10. package/fesm2022/theseam-ui-common-buttons.mjs.map +1 -1
  11. package/fesm2022/theseam-ui-common-card.mjs +21 -21
  12. package/fesm2022/theseam-ui-common-card.mjs.map +1 -1
  13. package/fesm2022/theseam-ui-common-carousel.mjs +28 -30
  14. package/fesm2022/theseam-ui-common-carousel.mjs.map +1 -1
  15. package/fesm2022/theseam-ui-common-checkbox.mjs +27 -27
  16. package/fesm2022/theseam-ui-common-checkbox.mjs.map +1 -1
  17. package/fesm2022/theseam-ui-common-confirm-dialog.mjs +23 -27
  18. package/fesm2022/theseam-ui-common-confirm-dialog.mjs.map +1 -1
  19. package/fesm2022/theseam-ui-common-core.mjs +31 -11
  20. package/fesm2022/theseam-ui-common-core.mjs.map +1 -1
  21. package/fesm2022/theseam-ui-common-data-exporter.mjs +18 -19
  22. package/fesm2022/theseam-ui-common-data-exporter.mjs.map +1 -1
  23. package/fesm2022/theseam-ui-common-data-filters.mjs +80 -64
  24. package/fesm2022/theseam-ui-common-data-filters.mjs.map +1 -1
  25. package/fesm2022/theseam-ui-common-datatable-alterations-display.mjs +51 -49
  26. package/fesm2022/theseam-ui-common-datatable-alterations-display.mjs.map +1 -1
  27. package/fesm2022/theseam-ui-common-datatable-dynamic.mjs +145 -112
  28. package/fesm2022/theseam-ui-common-datatable-dynamic.mjs.map +1 -1
  29. package/fesm2022/theseam-ui-common-datatable.mjs +581 -385
  30. package/fesm2022/theseam-ui-common-datatable.mjs.map +1 -1
  31. package/fesm2022/theseam-ui-common-dynamic-component-loader.mjs +12 -14
  32. package/fesm2022/theseam-ui-common-dynamic-component-loader.mjs.map +1 -1
  33. package/fesm2022/theseam-ui-common-dynamic.mjs +60 -48
  34. package/fesm2022/theseam-ui-common-dynamic.mjs.map +1 -1
  35. package/fesm2022/theseam-ui-common-footer-bar.mjs +9 -15
  36. package/fesm2022/theseam-ui-common-footer-bar.mjs.map +1 -1
  37. package/fesm2022/theseam-ui-common-form-field-error.mjs +60 -43
  38. package/fesm2022/theseam-ui-common-form-field-error.mjs.map +1 -1
  39. package/fesm2022/theseam-ui-common-form-field.mjs +120 -74
  40. package/fesm2022/theseam-ui-common-form-field.mjs.map +1 -1
  41. package/fesm2022/theseam-ui-common-framework.mjs +669 -543
  42. package/fesm2022/theseam-ui-common-framework.mjs.map +1 -1
  43. package/fesm2022/theseam-ui-common-google-maps.mjs +206 -149
  44. package/fesm2022/theseam-ui-common-google-maps.mjs.map +1 -1
  45. package/fesm2022/theseam-ui-common-graphql.mjs +252 -195
  46. package/fesm2022/theseam-ui-common-graphql.mjs.map +1 -1
  47. package/fesm2022/theseam-ui-common-icon.mjs +125 -89
  48. package/fesm2022/theseam-ui-common-icon.mjs.map +1 -1
  49. package/fesm2022/theseam-ui-common-layout.mjs +18 -26
  50. package/fesm2022/theseam-ui-common-layout.mjs.map +1 -1
  51. package/fesm2022/theseam-ui-common-loading.mjs +19 -28
  52. package/fesm2022/theseam-ui-common-loading.mjs.map +1 -1
  53. package/fesm2022/theseam-ui-common-menu.mjs +124 -95
  54. package/fesm2022/theseam-ui-common-menu.mjs.map +1 -1
  55. package/fesm2022/theseam-ui-common-modal.mjs +177 -129
  56. package/fesm2022/theseam-ui-common-modal.mjs.map +1 -1
  57. package/fesm2022/theseam-ui-common-models.mjs +3 -3
  58. package/fesm2022/theseam-ui-common-models.mjs.map +1 -1
  59. package/fesm2022/theseam-ui-common-navigation-reload.mjs +13 -11
  60. package/fesm2022/theseam-ui-common-navigation-reload.mjs.map +1 -1
  61. package/fesm2022/theseam-ui-common-popover.mjs +81 -88
  62. package/fesm2022/theseam-ui-common-popover.mjs.map +1 -1
  63. package/fesm2022/theseam-ui-common-progress.mjs +15 -19
  64. package/fesm2022/theseam-ui-common-progress.mjs.map +1 -1
  65. package/fesm2022/theseam-ui-common-rich-text.mjs +65 -52
  66. package/fesm2022/theseam-ui-common-rich-text.mjs.map +1 -1
  67. package/fesm2022/theseam-ui-common-scrollbar.mjs +12 -9
  68. package/fesm2022/theseam-ui-common-scrollbar.mjs.map +1 -1
  69. package/fesm2022/theseam-ui-common-services.mjs +41 -26
  70. package/fesm2022/theseam-ui-common-services.mjs.map +1 -1
  71. package/fesm2022/theseam-ui-common-shared.mjs +123 -67
  72. package/fesm2022/theseam-ui-common-shared.mjs.map +1 -1
  73. package/fesm2022/theseam-ui-common-storage.mjs +9 -6
  74. package/fesm2022/theseam-ui-common-storage.mjs.map +1 -1
  75. package/fesm2022/theseam-ui-common-story-helpers.mjs +148 -86
  76. package/fesm2022/theseam-ui-common-story-helpers.mjs.map +1 -1
  77. package/fesm2022/theseam-ui-common-tabbed.mjs +43 -39
  78. package/fesm2022/theseam-ui-common-tabbed.mjs.map +1 -1
  79. package/fesm2022/theseam-ui-common-table-cell-type.mjs +34 -38
  80. package/fesm2022/theseam-ui-common-table-cell-type.mjs.map +1 -1
  81. package/fesm2022/theseam-ui-common-table-cell-types.mjs +182 -144
  82. package/fesm2022/theseam-ui-common-table-cell-types.mjs.map +1 -1
  83. package/fesm2022/theseam-ui-common-table.mjs +50 -39
  84. package/fesm2022/theseam-ui-common-table.mjs.map +1 -1
  85. package/fesm2022/theseam-ui-common-tel-input.mjs +98 -63
  86. package/fesm2022/theseam-ui-common-tel-input.mjs.map +1 -1
  87. package/fesm2022/theseam-ui-common-testing.mjs +13 -10
  88. package/fesm2022/theseam-ui-common-testing.mjs.map +1 -1
  89. package/fesm2022/theseam-ui-common-tiled-select.mjs +54 -50
  90. package/fesm2022/theseam-ui-common-tiled-select.mjs.map +1 -1
  91. package/fesm2022/theseam-ui-common-toggle-edit.mjs +41 -37
  92. package/fesm2022/theseam-ui-common-toggle-edit.mjs.map +1 -1
  93. package/fesm2022/theseam-ui-common-toggle-group.mjs +30 -31
  94. package/fesm2022/theseam-ui-common-toggle-group.mjs.map +1 -1
  95. package/fesm2022/theseam-ui-common-tooltip.mjs +225 -66
  96. package/fesm2022/theseam-ui-common-tooltip.mjs.map +1 -1
  97. package/fesm2022/theseam-ui-common-unsaved-changes-dialog.mjs +14 -12
  98. package/fesm2022/theseam-ui-common-unsaved-changes-dialog.mjs.map +1 -1
  99. package/fesm2022/theseam-ui-common-utils.mjs +113 -77
  100. package/fesm2022/theseam-ui-common-utils.mjs.map +1 -1
  101. package/fesm2022/theseam-ui-common-validators.mjs +10 -9
  102. package/fesm2022/theseam-ui-common-validators.mjs.map +1 -1
  103. package/fesm2022/theseam-ui-common-vertical-list-filter.mjs +39 -17
  104. package/fesm2022/theseam-ui-common-vertical-list-filter.mjs.map +1 -1
  105. package/fesm2022/theseam-ui-common-viewers.mjs +79 -56
  106. package/fesm2022/theseam-ui-common-viewers.mjs.map +1 -1
  107. package/fesm2022/theseam-ui-common-widget.mjs +288 -314
  108. package/fesm2022/theseam-ui-common-widget.mjs.map +1 -1
  109. package/framework/base-layout/base-layout.component.scss +9 -4
  110. package/framework/base-layout/styles/_variables.scss +4 -9
  111. package/framework/dashboard/dashboard-widgets/dashboard-widgets.component.scss +6 -4
  112. package/framework/index.d.ts +6 -6
  113. package/framework/nav/nav-item/nav-item.component.scss +7 -6
  114. package/framework/nav/styles/_themes/light/_variables.scss +21 -5
  115. package/framework/nav/styles/_themes/primary/_variables.scss +21 -5
  116. package/framework/side-nav/side-nav-item/side-nav-item.component.scss +5 -2
  117. package/framework/side-nav/styles/_themes/light/_variables.scss +5 -1
  118. package/framework/side-nav/styles/_themes/primary/_variables.scss +25 -5
  119. package/graphql/index.d.ts +5 -5
  120. package/modal/README.md +5 -5
  121. package/modal/index.d.ts +1 -1
  122. package/models/index.d.ts +1 -1
  123. package/package.json +59 -59
  124. package/popover/index.d.ts +0 -2
  125. package/progress/progress-circle/styles/_variables.scss +15 -3
  126. package/story-helpers/index.d.ts +11 -1
  127. package/styles/bootstrap/_bootstrap.scss +34 -34
  128. package/styles/bootstrap/_bs-styles.scss +4 -8
  129. package/styles/bootstrap/_bs-utilities.scss +4 -4
  130. package/styles/bootstrap/_bs-variables.scss +65 -70
  131. package/styles/common/_forms.scss +9 -10
  132. package/styles/common/_global.scss +0 -1
  133. package/styles/common/_hacks.scss +1 -1
  134. package/styles/common/_table.scss +0 -1
  135. package/styles/common/_text.scss +3 -1
  136. package/styles/theme.scss +1 -1
  137. package/styles/vendor/ng-select/_ng-select-bs4.scss +292 -294
  138. package/styles/vendor/ngx-datatable/_ngx-datatable.scss +63 -32
  139. package/styles/vendor/ngx-datatable/_themes/bootstrap/_variables.scss +37 -10
  140. package/styles/vendor/ngx-datatable/_themes/material/_variables.scss +3 -1
  141. package/styles/vendor/quill/_quill.scss +15 -9
  142. package/tel-input/README.md +27 -27
  143. package/utils/index.d.ts +3 -3
  144. package/viewers/index.d.ts +9 -2
  145. package/widget/_widget-theme.scss +1 -1
  146. package/widget/styles/_variables.scss +2 -2
  147. package/widget/widget/widget.component.scss +0 -2
  148. package/widget/widget-content-components/widget-tile/widget-tile.component.scss +1 -3
  149. package/widget/widget-footer/widget-footer.component.scss +0 -1
@@ -29,12 +29,14 @@ function hasAttribute(element, name) {
29
29
  */
30
30
  function getClosestWidgetCdkDrag(element, dragDirectives) {
31
31
  let parent = element.nativeElement.parentElement;
32
- while (parent && !(parent.classList.contains('cdk-drag') && hasAttribute(parent, 'data-widget-id'))) {
32
+ while (parent &&
33
+ !(parent.classList.contains('cdk-drag') &&
34
+ hasAttribute(parent, 'data-widget-id'))) {
33
35
  parent = parent.parentElement;
34
36
  }
35
37
  const parentId = parent ? getAttribute(parent, 'data-widget-id') : null;
36
38
  return parentId
37
- ? dragDirectives.find(drag => getAttribute(drag.getRootElement(), 'data-widget-id') === parentId)
39
+ ? dragDirectives.find((drag) => getAttribute(drag.getRootElement(), 'data-widget-id') === parentId)
38
40
  : null;
39
41
  }
40
42
 
@@ -66,7 +68,7 @@ function getControlName(c) {
66
68
  // array index type, but it works and we actually want the index as a string
67
69
  // anyway.
68
70
  const controls = c.parent.controls;
69
- return Object.keys(controls).find(name => c === controls[name]) || null;
71
+ return Object.keys(controls).find((name) => c === controls[name]) || null;
70
72
  }
71
73
 
72
74
  /**
@@ -110,9 +112,7 @@ function getControlPath(c, path = '') {
110
112
  * Observe the value of a control.
111
113
  */
112
114
  function observeControlValue(control) {
113
- return of(control)
114
- .pipe(switchMap(_control => _control.valueChanges
115
- .pipe(startWith(_control.value))));
115
+ return of(control).pipe(switchMap((_control) => _control.valueChanges.pipe(startWith(_control.value))));
116
116
  }
117
117
 
118
118
  /**
@@ -127,8 +127,7 @@ function observeControlValue(control) {
127
127
  */
128
128
  function observeControlIsDifferent(control) {
129
129
  const _initial = JSON.stringify(control.value);
130
- return observeControlValue(control)
131
- .pipe(map(value => JSON.stringify(value) !== _initial), distinctUntilChanged());
130
+ return observeControlValue(control).pipe(map((value) => JSON.stringify(value) !== _initial), distinctUntilChanged());
132
131
  }
133
132
 
134
133
  /**
@@ -141,9 +140,9 @@ function observeControlIsDifferent(control) {
141
140
  * if observable).
142
141
  */
143
142
  function waitOnNonPendingStatus(control) {
144
- return merge(control.statusChanges, interval(30).pipe(mapTo(control), map(c => c.status)))
143
+ return merge(control.statusChanges, interval(30).pipe(mapTo(control), map((c) => c.status)))
145
144
  .pipe(startWith(control.status))
146
- .pipe(filter(v => v !== 'PENDING'))
145
+ .pipe(filter((v) => v !== 'PENDING'))
147
146
  .pipe(take(1));
148
147
  }
149
148
 
@@ -152,12 +151,10 @@ function waitOnNonPendingStatus(control) {
152
151
  * after pending.
153
152
  */
154
153
  function observeControlStatus(control) {
155
- return of(control)
156
- .pipe(switchMap(_control => _control.statusChanges
154
+ return of(control).pipe(switchMap((_control) => _control.statusChanges
157
155
  .pipe(startWith(_control.status))
158
- .pipe(switchMap(status => status === 'PENDING'
159
- ? waitOnNonPendingStatus(control)
160
- .pipe(startWith(status))
156
+ .pipe(switchMap((status) => status === 'PENDING'
157
+ ? waitOnNonPendingStatus(control).pipe(startWith(status))
161
158
  : of(status)))));
162
159
  }
163
160
 
@@ -178,14 +175,14 @@ function observeControlValid(control, waitOnPending = false) {
178
175
  .pipe(distinctUntilChanged())
179
176
  .pipe(startWith(undefined))
180
177
  .pipe(pairwise())
181
- .pipe(map(v => ({ previous: v[0], current: v[1] })))
182
- .pipe(map(v => v.current === 'PENDING' ? v.previous : v.current))
183
- .pipe(map(status => status === 'VALID'));
178
+ .pipe(map((v) => ({ previous: v[0], current: v[1] })))
179
+ .pipe(map((v) => (v.current === 'PENDING' ? v.previous : v.current)))
180
+ .pipe(map((status) => status === 'VALID'));
184
181
  }
185
182
  else {
186
183
  return observeControlStatus(control)
187
184
  .pipe(distinctUntilChanged())
188
- .pipe(map(status => status === 'VALID'));
185
+ .pipe(map((status) => status === 'VALID'));
189
186
  }
190
187
  }
191
188
 
@@ -193,15 +190,13 @@ function observeControlValid(control, waitOnPending = false) {
193
190
  * Observe the value of a control with the previous.
194
191
  */
195
192
  function observeControlValueChange(control) {
196
- return observeControlValue(control)
197
- .pipe(startWith(undefined), pairwise(), map(v => ({ previous: v[0], current: v[1] })));
193
+ return observeControlValue(control).pipe(startWith(undefined), pairwise(), map((v) => ({ previous: v[0], current: v[1] })));
198
194
  }
199
195
 
200
196
  // Source: https://stackoverflow.com/a/59361497/7926298
201
- function hasProperty(style, prop
202
- // ): style is T & { [P in K]-?: Exclude<T[K], undefined> } {
203
- ) {
204
- return Object.prototype.hasOwnProperty.call(style, prop) && style[prop] !== undefined;
197
+ function hasProperty(style, prop) {
198
+ return (Object.prototype.hasOwnProperty.call(style, prop) &&
199
+ style[prop] !== undefined);
205
200
  }
206
201
 
207
202
  /**
@@ -260,7 +255,7 @@ function isEmptyInputValue(value) {
260
255
  }
261
256
 
262
257
  function mapEach(predicate) {
263
- return (source$) => source$.pipe(switchMap(v => from(v).pipe(map(m => predicate(m)), toArray())));
258
+ return (source$) => source$.pipe(switchMap((v) => from(v).pipe(map((m) => predicate(m)), toArray())));
264
259
  }
265
260
 
266
261
  /**
@@ -268,7 +263,7 @@ function mapEach(predicate) {
268
263
  */
269
264
  function tapFirst(predicate) {
270
265
  let _initialized = false;
271
- return (source$) => source$.pipe(tap(v => {
266
+ return (source$) => source$.pipe(tap((v) => {
272
267
  if (!_initialized) {
273
268
  predicate(v);
274
269
  _initialized = true;
@@ -285,19 +280,26 @@ function leafChildRoute(activatedRoute) {
285
280
  }
286
281
 
287
282
  function hasRouteConfigDataProp(route, prop) {
288
- return !!(route && route.routeConfig && route.routeConfig.data && Object.prototype.hasOwnProperty.call(route.routeConfig.data, prop));
283
+ return !!(route &&
284
+ route.routeConfig &&
285
+ route.routeConfig.data &&
286
+ Object.prototype.hasOwnProperty.call(route.routeConfig.data, prop));
289
287
  }
290
288
  function hasRouteConfigResolveProp(route, prop) {
291
- return !!(route && route.routeConfig && route.routeConfig.resolve && Object.prototype.hasOwnProperty.call(route.routeConfig.resolve, prop));
289
+ return !!(route &&
290
+ route.routeConfig &&
291
+ route.routeConfig.resolve &&
292
+ Object.prototype.hasOwnProperty.call(route.routeConfig.resolve, prop));
292
293
  }
293
294
  function willHaveDataProp(route, prop) {
294
- return hasRouteConfigDataProp(route, prop) || hasRouteConfigResolveProp(route, prop);
295
+ return (hasRouteConfigDataProp(route, prop) ||
296
+ hasRouteConfigResolveProp(route, prop));
295
297
  }
296
298
 
297
299
  function activatedRoutesWithDataProperty(prop, mustHaveDefined = false) {
298
- const _data = (r) => r.data.pipe(map(_d => ({ route: r, data: _d })));
299
- return (source$) => source$.pipe(map(route => leafChildRoute(route)), map(route => route.pathFromRoot), switchMap(routes => combineLatest(routes.map(r => _data(r)))), map(v => v.filter(_v => Object.prototype.hasOwnProperty.call(_v.data, prop))), map(v => mustHaveDefined
300
- ? v.filter(_v => willHaveDataProp(_v.route, prop))
300
+ const _data = (r) => r.data.pipe(map((_d) => ({ route: r, data: _d })));
301
+ return (source$) => source$.pipe(map((route) => leafChildRoute(route)), map((route) => route.pathFromRoot), switchMap((routes) => combineLatest(routes.map((r) => _data(r)))), map((v) => v.filter((_v) => Object.prototype.hasOwnProperty.call(_v.data, prop))), map((v) => mustHaveDefined
302
+ ? v.filter((_v) => willHaveDataProp(_v.route, prop))
301
303
  : v));
302
304
  }
303
305
 
@@ -378,7 +380,7 @@ function isFeatureCollectionValidator() {
378
380
  return {
379
381
  [IS_FEATURE_COLLECTION_VALIDATOR_NAME]: {
380
382
  reason: `Must be a FeatureCollection.`,
381
- }
383
+ },
382
384
  };
383
385
  }
384
386
  return null;
@@ -423,14 +425,14 @@ function isOnlyGeometryTypesValidator(types) {
423
425
  }
424
426
  if (!isOnlyGeometryTypes(value, types)) {
425
427
  const typesNotAllowed = value.features
426
- .map(f => f.geometry.type)
427
- .filter(t => types.indexOf(t) === -1);
428
+ .map((f) => f.geometry.type)
429
+ .filter((t) => types.indexOf(t) === -1);
428
430
  const distinctTypesNotAllowed = Array.from(new Set(typesNotAllowed));
429
431
  return {
430
432
  [IS_ONLY_GEOMETRY_TYPES_VALIDATOR_NAME]: {
431
- reason: `Only geometry type${(types.length === 1 ? '' : 's')} ${types.join(', ')} allowed.`,
433
+ reason: `Only geometry type${types.length === 1 ? '' : 's'} ${types.join(', ')} allowed.`,
432
434
  notAllowedGeometryTypesFound: distinctTypesNotAllowed,
433
- }
435
+ },
434
436
  };
435
437
  }
436
438
  return null;
@@ -493,8 +495,8 @@ function minMaxPointsValidator(min = 3, max) {
493
495
  : `A polygon must have at least ${min} points.`;
494
496
  return {
495
497
  [MIN_MAX_POINTS_VALIDATOR_NAME]: {
496
- reason
497
- }
498
+ reason,
499
+ },
498
500
  };
499
501
  }
500
502
  return null;
@@ -523,7 +525,8 @@ function collectionViolatesMinMax(featureCollection, min, max) {
523
525
  return false;
524
526
  }
525
527
  function polygonViolatesMinMax(coordinateLength, min, max) {
526
- if (coordinateLength < min || (notNullOrUndefined(max) && max > min && coordinateLength > max)) {
528
+ if (coordinateLength < min ||
529
+ (notNullOrUndefined(max) && max > min && coordinateLength > max)) {
527
530
  return true;
528
531
  }
529
532
  return false;
@@ -544,7 +547,7 @@ function noEmptyFeatureCollectionValidator() {
544
547
  return {
545
548
  [NO_EMPTY_FEATURE_COLLECTION_VALIDATOR_NAME]: {
546
549
  reason: `FeatureCollection must have a value.`,
547
- }
550
+ },
548
551
  };
549
552
  }
550
553
  return null;
@@ -574,8 +577,8 @@ function noInnerRingsValidator() {
574
577
  if (hasInnerRing(value)) {
575
578
  return {
576
579
  [NO_INNER_RINGS_VALIDATOR_NAME]: {
577
- reason: `A shape cannot have an inner ring.`
578
- }
580
+ reason: `A shape cannot have an inner ring.`,
581
+ },
579
582
  };
580
583
  }
581
584
  return null;
@@ -612,7 +615,12 @@ function hasInnerRing(featureCollection) {
612
615
  return false;
613
616
  }
614
617
 
615
- const kinkableGeometryTypes = ['LineString', 'MultiLineString', 'MultiPolygon', 'Polygon'];
618
+ const kinkableGeometryTypes = [
619
+ 'LineString',
620
+ 'MultiLineString',
621
+ 'MultiPolygon',
622
+ 'Polygon',
623
+ ];
616
624
  const NO_KINKS_VALIDATOR_NAME = 'no-kinks';
617
625
  function noKinksValidator() {
618
626
  return (control) => {
@@ -641,7 +649,7 @@ function noKinksValidator() {
641
649
  [NO_KINKS_VALIDATOR_NAME]: {
642
650
  reason: 'Paths should not intersect themselves.',
643
651
  featuresWithKink: kinksFound,
644
- }
652
+ },
645
653
  };
646
654
  }
647
655
  return null;
@@ -668,7 +676,7 @@ async function readFileAsDataUrlAsync(file) {
668
676
  }
669
677
  async function fileBufferToBlob(fileBuffer, defaultMime = 'application/octet-stream') {
670
678
  const fType = fileType(fileBuffer);
671
- const mime = (fType) ? fType.mime : defaultMime;
679
+ const mime = fType ? fType.mime : defaultMime;
672
680
  const blob = new Blob([fileBuffer], { type: mime });
673
681
  return blob;
674
682
  }
@@ -763,9 +771,11 @@ async function coerceFileOrBufferToBuffer(fileOrBuffer) {
763
771
  // NOTE: Our current version of file-type does not detect shp files. We can
764
772
  // remove this function when file-types is upgraded.
765
773
  function isShpFile(buffer) {
766
- const header = [0x27, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
774
+ const header = [
775
+ 0x27, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
776
+ ];
767
777
  const offset = 2;
768
- if (buffer.length < (header.length + offset)) {
778
+ if (buffer.length < header.length + offset) {
769
779
  return false;
770
780
  }
771
781
  for (let i = 0; i < header.length; i++) {
@@ -779,11 +789,11 @@ async function parseShpFile(buffer) {
779
789
  const geometries = await shp.parseShp(buffer, undefined);
780
790
  const featCollection = {
781
791
  type: 'FeatureCollection',
782
- features: geometries.map(geom => ({
792
+ features: geometries.map((geom) => ({
783
793
  type: 'Feature',
784
794
  geometry: geom,
785
- properties: {}
786
- }))
795
+ properties: {},
796
+ })),
787
797
  };
788
798
  return featCollection;
789
799
  }
@@ -819,7 +829,7 @@ function splitMultiPolygons(featureCollection) {
819
829
  if (featureCollection.features[i]) {
820
830
  const geometry = featureCollection.features[i].geometry;
821
831
  if (geometry.type === 'MultiPolygon') {
822
- const features = splitMultPolygon(geometry).map(p => ({
832
+ const features = splitMultPolygon(geometry).map((p) => ({
823
833
  type: 'Feature',
824
834
  geometry: p,
825
835
  properties: {},
@@ -831,7 +841,7 @@ function splitMultiPolygons(featureCollection) {
831
841
  }
832
842
  }
833
843
  function splitMultPolygon(multiPolygon) {
834
- return multiPolygon.coordinates.map(c => ({
844
+ return multiPolygon.coordinates.map((c) => ({
835
845
  type: 'Polygon',
836
846
  coordinates: c,
837
847
  }));
@@ -977,21 +987,38 @@ function toggleAttribute(element, name, force) {
977
987
  }
978
988
  }
979
989
 
980
- const phoneNumberMask = ['(', /[1-9]/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/];
990
+ const phoneNumberMask = [
991
+ '(',
992
+ /[1-9]/,
993
+ /\d/,
994
+ /\d/,
995
+ ')',
996
+ ' ',
997
+ /\d/,
998
+ /\d/,
999
+ /\d/,
1000
+ '-',
1001
+ /\d/,
1002
+ /\d/,
1003
+ /\d/,
1004
+ /\d/,
1005
+ ];
981
1006
 
982
1007
  function isNullOrUndefined(value) {
983
1008
  return value === undefined || value === null;
984
1009
  }
985
1010
 
986
1011
  function isNullOrUndefinedOrEmpty(value, trim = true) {
987
- return value === undefined || value === null || (trim ? value.trim() : value).length === 0;
1012
+ return (value === undefined ||
1013
+ value === null ||
1014
+ (trim ? value.trim() : value).length === 0);
988
1015
  }
989
1016
 
990
1017
  function loadStyle(content) {
991
1018
  return new Promise((resolve, reject) => {
992
1019
  const s = document.createElement('style');
993
1020
  s.onload = () => resolve(s);
994
- s.onerror = e => {
1021
+ s.onerror = (e) => {
995
1022
  document.head.removeChild(s);
996
1023
  reject(e);
997
1024
  };
@@ -1004,7 +1031,7 @@ function loadStyleSheet(path) {
1004
1031
  return new Promise((resolve, reject) => {
1005
1032
  const s = document.createElement('link');
1006
1033
  s.onload = () => resolve(s);
1007
- s.onerror = e => {
1034
+ s.onerror = (e) => {
1008
1035
  document.head.removeChild(s);
1009
1036
  reject(e);
1010
1037
  };
@@ -1015,7 +1042,9 @@ function loadStyleSheet(path) {
1015
1042
  }
1016
1043
 
1017
1044
  function notNullOrUndefinedOrEmpty(value, trim = true) {
1018
- return value !== null && value !== undefined && (trim ? value.trim() : value).length > 0;
1045
+ return (value !== null &&
1046
+ value !== undefined &&
1047
+ (trim ? value.trim() : value).length > 0);
1019
1048
  }
1020
1049
 
1021
1050
  async function waitOnConditionAsync(condition, timeoutDuration = -1, throwOnTimeout = true) {
@@ -1037,7 +1066,9 @@ async function waitOnConditionAsync(condition, timeoutDuration = -1, throwOnTime
1037
1066
  callbackFn(false);
1038
1067
  }
1039
1068
  }
1040
- setTimeout(() => { _waitFunc(callbackFn); }, 30);
1069
+ setTimeout(() => {
1070
+ _waitFunc(callbackFn);
1071
+ }, 30);
1041
1072
  }
1042
1073
  };
1043
1074
  return new Promise((resolve, reject) => {
@@ -1083,11 +1114,9 @@ class IntervalTimer {
1083
1114
  this.start();
1084
1115
  }
1085
1116
  }
1086
- // tslint:disable:no-inferrable-types
1087
1117
  class PollingTickerOptions {
1088
1118
  emitOnInit = true;
1089
1119
  }
1090
- // tslint:enable:no-inferrable-types
1091
1120
  // TODO: Simplify complexity.
1092
1121
  /**
1093
1122
  * Call an action and emits the result to its subscriber on an interval or when
@@ -1098,7 +1127,7 @@ class PollingTickerOptions {
1098
1127
  */
1099
1128
  function pollingTicker(action, pollingInterval, ticker, options) {
1100
1129
  return new Observable((subscriber) => {
1101
- const _opts = { ...(new PollingTickerOptions()), ...(options || {}) };
1130
+ const _opts = { ...new PollingTickerOptions(), ...(options || {}) };
1102
1131
  let timer = null;
1103
1132
  let actionSub = null;
1104
1133
  let tickerSub = null;
@@ -1112,9 +1141,14 @@ function pollingTicker(action, pollingInterval, ticker, options) {
1112
1141
  if (actionSub) {
1113
1142
  actionSub.unsubscribe();
1114
1143
  }
1115
- actionSub = actionResult.subscribe((v) => { subscriber.next(v); if (timer) {
1116
- timer.reset();
1117
- } }, err => { subscriber.error(err); }, () => {
1144
+ actionSub = actionResult.subscribe((v) => {
1145
+ subscriber.next(v);
1146
+ if (timer) {
1147
+ timer.reset();
1148
+ }
1149
+ }, (err) => {
1150
+ subscriber.error(err);
1151
+ }, () => {
1118
1152
  actionSub = null;
1119
1153
  if (timer) {
1120
1154
  timer.start();
@@ -1137,7 +1171,7 @@ function pollingTicker(action, pollingInterval, ticker, options) {
1137
1171
  }, pollingInterval);
1138
1172
  }
1139
1173
  if (ticker) {
1140
- tickerSub = ticker.subscribe(newPollingInterval => {
1174
+ tickerSub = ticker.subscribe((newPollingInterval) => {
1141
1175
  if (newPollingInterval && timer) {
1142
1176
  timer.stop();
1143
1177
  if (newPollingInterval) {
@@ -1179,12 +1213,14 @@ class Refreshable {
1179
1213
  if (pollingInterval !== null && pollingInterval !== undefined) {
1180
1214
  this._pollingInterval.next(pollingInterval);
1181
1215
  }
1182
- this.pending$ = this._pending.asObservable()
1216
+ this.pending$ = this._pending
1217
+ .asObservable()
1183
1218
  .pipe(distinctUntilChanged(), shareReplay(1));
1184
- this.data$ = pollingTicker(this._actionHandler(action), pollingInterval, this._ticker)
1185
- .pipe(tapFirst(() => this._initialized = true), publishReplay(), refCount());
1219
+ this.data$ = pollingTicker(this._actionHandler(action), pollingInterval, this._ticker).pipe(tapFirst(() => (this._initialized = true)), publishReplay(), refCount());
1220
+ }
1221
+ get initialized() {
1222
+ return this._initialized;
1186
1223
  }
1187
- get initialized() { return this._initialized; }
1188
1224
  /**
1189
1225
  * Intercepts the action call to monitor pending state
1190
1226
  */
@@ -1193,7 +1229,9 @@ class Refreshable {
1193
1229
  this._pending.next(true);
1194
1230
  const actionResult = action();
1195
1231
  if (isObservable(actionResult)) {
1196
- return actionResult.pipe(tap(() => { this._pending.next(false); }));
1232
+ return actionResult.pipe(tap(() => {
1233
+ this._pending.next(false);
1234
+ }));
1197
1235
  }
1198
1236
  else {
1199
1237
  this._pending.next(true);
@@ -1220,14 +1258,12 @@ class Refreshable {
1220
1258
  // each time `data$` is subscribed to, then this could fail if the data
1221
1259
  // emits one extra time before the ticker is triggered.
1222
1260
  let _polled = false;
1223
- result$ = this.data$
1224
- .pipe(tap(_ => !_polled && (_polled = true) && this._ticker.next()), skip(1));
1261
+ result$ = this.data$.pipe(tap((_) => !_polled && (_polled = true) && this._ticker.next()), skip(1));
1225
1262
  }
1226
1263
  else {
1227
1264
  result$ = this.data$;
1228
1265
  }
1229
- return result$
1230
- .pipe(take(1), mapTo(undefined));
1266
+ return result$.pipe(take(1), mapTo(undefined));
1231
1267
  }
1232
1268
  }
1233
1269
 
@@ -1300,7 +1336,7 @@ function setGlobalSubscriberCount(description, count) {
1300
1336
  }
1301
1337
 
1302
1338
  function observeQueryList(queryList, emitCurrentValue = true) {
1303
- return queryList.changes.pipe(startWith(queryList), map(v => v.toArray()));
1339
+ return queryList.changes.pipe(startWith(queryList), map((v) => v.toArray()));
1304
1340
  }
1305
1341
 
1306
1342
  function createPadding(len, chars) {