@theseam/ui-common 1.0.0-beta.0 → 1.0.0-beta.10

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 (153) hide show
  1. package/breadcrumbs/index.d.ts +1 -2
  2. package/buttons/index.d.ts +20 -13
  3. package/datatable/index.d.ts +77 -39
  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 +727 -420
  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 +129 -76
  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 +311 -254
  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 +178 -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 +149 -159
  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 +63 -39
  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 +62 -41
  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 +80 -53
  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/form-field/index.d.ts +1 -1
  110. package/framework/base-layout/base-layout.component.scss +9 -4
  111. package/framework/base-layout/styles/_variables.scss +4 -9
  112. package/framework/dashboard/dashboard-widgets/dashboard-widgets.component.scss +6 -4
  113. package/framework/index.d.ts +6 -6
  114. package/framework/nav/nav-item/nav-item.component.scss +7 -6
  115. package/framework/nav/styles/_themes/light/_variables.scss +21 -5
  116. package/framework/nav/styles/_themes/primary/_variables.scss +21 -5
  117. package/framework/side-nav/side-nav-item/side-nav-item.component.scss +5 -2
  118. package/framework/side-nav/styles/_themes/light/_variables.scss +5 -1
  119. package/framework/side-nav/styles/_themes/primary/_variables.scss +25 -5
  120. package/graphql/index.d.ts +49 -7
  121. package/modal/README.md +5 -5
  122. package/modal/index.d.ts +1 -1
  123. package/models/index.d.ts +1 -1
  124. package/package.json +59 -60
  125. package/popover/index.d.ts +0 -2
  126. package/progress/progress-circle/styles/_variables.scss +15 -3
  127. package/shared/index.d.ts +0 -13
  128. package/story-helpers/index.d.ts +11 -1
  129. package/styles/bootstrap/_bootstrap.scss +34 -34
  130. package/styles/bootstrap/_bs-styles.scss +4 -8
  131. package/styles/bootstrap/_bs-utilities.scss +4 -4
  132. package/styles/bootstrap/_bs-variables.scss +65 -70
  133. package/styles/common/_forms.scss +9 -10
  134. package/styles/common/_global.scss +0 -1
  135. package/styles/common/_hacks.scss +1 -1
  136. package/styles/common/_table.scss +0 -1
  137. package/styles/common/_text.scss +3 -1
  138. package/styles/theme.scss +1 -1
  139. package/styles/vendor/ng-select/_ng-select-bs4.scss +292 -294
  140. package/styles/vendor/ngx-datatable/_ngx-datatable.scss +63 -32
  141. package/styles/vendor/ngx-datatable/_themes/bootstrap/_variables.scss +37 -10
  142. package/styles/vendor/ngx-datatable/_themes/material/_variables.scss +3 -1
  143. package/styles/vendor/quill/_quill.scss +15 -9
  144. package/table/index.d.ts +4 -1
  145. package/table-cell-type/index.d.ts +27 -2
  146. package/tel-input/README.md +27 -27
  147. package/utils/index.d.ts +3 -3
  148. package/viewers/index.d.ts +9 -2
  149. package/widget/_widget-theme.scss +1 -1
  150. package/widget/styles/_variables.scss +2 -2
  151. package/widget/widget/widget.component.scss +0 -2
  152. package/widget/widget-content-components/widget-tile/widget-tile.component.scss +1 -3
  153. package/widget/widget-footer/widget-footer.component.scss +0 -1
@@ -19,7 +19,7 @@ function containsVariable(node, variableName) {
19
19
  found = true;
20
20
  return BREAK;
21
21
  }
22
- }
22
+ },
23
23
  });
24
24
  return found;
25
25
  }
@@ -46,7 +46,8 @@ function inlineVariable(query, variableName, variableValue) {
46
46
  // })
47
47
  // console.log('~inlineVariable', variableName, variableValue)
48
48
  // TODO: Decide if this is a good solution.
49
- if (hasProperty(variableValue, 'value') && variableValue.value === 'undefined') {
49
+ if (hasProperty(variableValue, 'value') &&
50
+ variableValue.value === 'undefined') {
50
51
  if (isDevMode()) {
51
52
  // eslint-disable-next-line no-console
52
53
  console.warn(`Ignoring attempt to inline '${variableName}', because it is undefined.`);
@@ -58,9 +59,9 @@ function inlineVariable(query, variableName, variableValue) {
58
59
  if (variableName === variableNode.name.value) {
59
60
  return null;
60
61
  }
61
- }
62
+ },
62
63
  });
63
- }
64
+ },
64
65
  });
65
66
  }
66
67
  return visit$1(query, {
@@ -70,9 +71,9 @@ function inlineVariable(query, variableName, variableValue) {
70
71
  if (variableName === variableNode.name.value) {
71
72
  return variableValue;
72
73
  }
73
- }
74
+ },
74
75
  });
75
- }
76
+ },
76
77
  });
77
78
  }
78
79
 
@@ -91,7 +92,7 @@ function parseComments(ast) {
91
92
  Object.assign(next, {
92
93
  // The Comment token's column starts _after_ the `#`,
93
94
  // but we need to make sure the node captures the `#`
94
- column: next.column - 1
95
+ column: next.column - 1,
95
96
  });
96
97
  comments.push(next);
97
98
  }
@@ -148,20 +149,24 @@ function isCommentToken(token) {
148
149
  return token.kind === 'Comment';
149
150
  }
150
151
  function isHintToken(token) {
151
- return (isCommentToken(token) &&
152
- (token.value?.match(HINT_PREFIX_REGEX)?.length || 0) > 0) || false;
152
+ return ((isCommentToken(token) &&
153
+ (token.value?.match(HINT_PREFIX_REGEX)?.length || 0) > 0) ||
154
+ false);
153
155
  }
154
156
  function isInlineComment(token) {
155
- return isCommentToken(token) &&
157
+ return (isCommentToken(token) &&
156
158
  token.prev !== null &&
157
- token.prev.line === token.line;
159
+ token.prev.line === token.line);
158
160
  }
159
161
  function hintNamesFromHintToken(token) {
160
162
  const grp = token.value?.match(HINT_NAMES_CAPTURE_REGEX);
161
163
  if (grp === null || grp === undefined || grp.length === 0) {
162
164
  return [];
163
165
  }
164
- return grp[1].split(' ').map(x => x.trim()).filter(x => x.length > 0);
166
+ return grp[1]
167
+ .split(' ')
168
+ .map((x) => x.trim())
169
+ .filter((x) => x.length > 0);
165
170
  }
166
171
  function getTokenAppliesTo(token) {
167
172
  if (isInlineComment(token)) {
@@ -177,7 +182,7 @@ function createHintsToken(token, node, kind) {
177
182
  return {
178
183
  node,
179
184
  hints: hintNamesFromHintToken(token),
180
- kind
185
+ kind,
181
186
  };
182
187
  }
183
188
  function getHintsToken(token, ast) {
@@ -217,7 +222,7 @@ function getHintsToken(token, ast) {
217
222
  appliesToNode = createHintsToken(token, node, HintsKind.Field);
218
223
  return BREAK$1;
219
224
  }
220
- }
225
+ },
221
226
  });
222
227
  return appliesToNode;
223
228
  }
@@ -226,7 +231,7 @@ function parseHints(ast) {
226
231
  // console.log('_ast', _ast)
227
232
  return parseComments(_ast)
228
233
  .filter(isHintToken)
229
- .map(r => getHintsToken(r, _ast))
234
+ .map((r) => getHintsToken(r, _ast))
230
235
  .filter(notNullOrUndefined);
231
236
  }
232
237
 
@@ -238,8 +243,8 @@ function removeVariableDefinition(query, variableName) {
238
243
  if (name === variableName) {
239
244
  return null;
240
245
  }
241
- }
242
- }
246
+ },
247
+ },
243
248
  });
244
249
  }
245
250
 
@@ -253,10 +258,10 @@ function removeVariableDefinitionsNotDefined(query, node, variables) {
253
258
  if (isNullOrUndefined(variables[name])) {
254
259
  return null;
255
260
  }
256
- }
261
+ },
257
262
  });
258
263
  }
259
- }
264
+ },
260
265
  });
261
266
  }
262
267
 
@@ -268,7 +273,7 @@ function removeVariable(query, variableName) {
268
273
  if (name === variableName) {
269
274
  return null;
270
275
  }
271
- }
276
+ },
272
277
  },
273
278
  Argument: {
274
279
  enter(variable) {
@@ -276,8 +281,8 @@ function removeVariable(query, variableName) {
276
281
  if (name === variableName) {
277
282
  return null;
278
283
  }
279
- }
280
- }
284
+ },
285
+ },
281
286
  });
282
287
  }
283
288
 
@@ -289,7 +294,7 @@ function removeVariable(query, variableName) {
289
294
  // type-safe one, but that is becoming surprisingly harder to find than I
290
295
  // expected for GraphQL.
291
296
  function toGQL(json) {
292
- const props = Object.keys(json).map(prop => {
297
+ const props = Object.keys(json).map((prop) => {
293
298
  const value = json[prop];
294
299
  let resultValue;
295
300
  if (typeof value === 'string') {
@@ -299,7 +304,7 @@ function toGQL(json) {
299
304
  resultValue = `${value.direction}`;
300
305
  }
301
306
  else if (Array.isArray(value)) {
302
- resultValue = `[${value.map(v => toGQL(v)).join(',')}]`;
307
+ resultValue = `[${value.map((v) => toGQL(v)).join(',')}]`;
303
308
  }
304
309
  else if (typeof value === 'object') {
305
310
  if (Object.prototype.hasOwnProperty.call(value, 'gqlVar')) {
@@ -321,7 +326,7 @@ function toGQL(json) {
321
326
  }
322
327
 
323
328
  function hintsTokensContainingHint(hintsTokens, hint) {
324
- return hintsTokens.filter(r => r.hints.indexOf(hint) !== -1);
329
+ return hintsTokens.filter((r) => r.hints.indexOf(hint) !== -1);
325
330
  }
326
331
 
327
332
  const DEFAULT_PAGE_SIZE = 20;
@@ -330,7 +335,7 @@ function getPageInfo(datatable, defaultPageSize = DEFAULT_PAGE_SIZE) {
330
335
  offset: datatable?.ngxDatatable?.offset ?? 0,
331
336
  pageSize: datatable?.ngxDatatable?.pageSize ?? defaultPageSize,
332
337
  limit: datatable?.ngxDatatable?.limit,
333
- count: datatable?.ngxDatatable?.count ?? 0
338
+ count: datatable?.ngxDatatable?.count ?? 0,
334
339
  };
335
340
  }
336
341
 
@@ -345,14 +350,16 @@ function createPageInfoObservable(datatable$, defaultPageSize = 20) {
345
350
  prev = pageInfo;
346
351
  }
347
352
  };
348
- const dtSub = datatable$.pipe(switchMap(dt => {
353
+ const dtSub = datatable$
354
+ .pipe(switchMap((dt) => {
349
355
  if (!notNullOrUndefined(dt)) {
350
356
  handlePageInfo(null);
351
357
  return EMPTY;
352
358
  }
353
359
  handlePageInfo(getPageInfo(dt, defaultPageSize));
354
- return dt.page.pipe(tap(p => handlePageInfo(p)));
355
- })).subscribe();
360
+ return dt.page.pipe(tap((p) => handlePageInfo(p)));
361
+ }))
362
+ .subscribe();
356
363
  return () => {
357
364
  dtSub.unsubscribe();
358
365
  };
@@ -378,7 +385,7 @@ function resolveMapper(filterState, filterStateMappers, context) {
378
385
  take(1));
379
386
  }
380
387
  function resolveMappers(filterStates, filterStateMappers, context) {
381
- return from(filterStates).pipe(concatMap(filterState => resolveMapper(filterState, filterStateMappers, context)), filter(notNullOrUndefined), toArray());
388
+ return from(filterStates).pipe(concatMap((filterState) => resolveMapper(filterState, filterStateMappers, context)), filter(notNullOrUndefined), toArray());
382
389
  }
383
390
  function mergeFilters(filters) {
384
391
  return { or: filters };
@@ -420,13 +427,13 @@ async function mapFilterStates(filterStates, filterStateMappers, context) {
420
427
  const filters = results
421
428
  .map((r) => r.filter)
422
429
  .filter(notNullOrUndefined)
423
- .filter(mapperFilter => !isEmptyFilter(mapperFilter));
430
+ .filter((mapperFilter) => !isEmptyFilter(mapperFilter));
424
431
  const variableObjs = results
425
432
  .map((r) => r.variables)
426
433
  .filter(notNullOrUndefined);
427
434
  return {
428
435
  filter: mergeFilters(filters),
429
- variables: mergeVariables(variableObjs)
436
+ variables: mergeVariables(variableObjs),
430
437
  };
431
438
  }
432
439
 
@@ -440,7 +447,7 @@ function mapPageInfo(pageInfo) {
440
447
  const takeOffset = skipWithWindowOffset < 0 ? skipWithWindowOffset : 0;
441
448
  return {
442
449
  skip: Math.max(skipWithWindowOffset, 0),
443
- take: Math.max((pageInfo.pageSize * 3) + takeOffset, 0)
450
+ take: Math.max(pageInfo.pageSize * 3 + takeOffset, 0),
444
451
  };
445
452
  }
446
453
 
@@ -448,9 +455,9 @@ function observeRowsWithGqlInputsHandling(queryRef, rows, datatable, extraVariab
448
455
  return new Observable((subscriber) => {
449
456
  const datatable$ = wrapIntoObservable(datatable);
450
457
  const extraVariables$ = wrapIntoObservable(extraVariables);
451
- const context$ = extraVariables$.pipe(map(_extraVariables => {
458
+ const context$ = extraVariables$.pipe(map((_extraVariables) => {
452
459
  const context = {
453
- extraVariables: _extraVariables
460
+ extraVariables: _extraVariables,
454
461
  };
455
462
  return context;
456
463
  }), shareReplay({ bufferSize: 1, refCount: true }));
@@ -460,13 +467,13 @@ function observeRowsWithGqlInputsHandling(queryRef, rows, datatable, extraVariab
460
467
  filters: filterStateMappers,
461
468
  };
462
469
  const datatableResults$ = _createDatatableResultsObservable(datatable$, datatableMappers, context$);
463
- const queryVariablesChanged$ = datatableResults$.pipe(tap(results => {
470
+ const queryVariablesChanged$ = datatableResults$.pipe(tap((results) => {
464
471
  queryRef.setVariables({
465
472
  ...(results.context || {}),
466
473
  ...results.pageInfo,
467
474
  ...(results.sorts.length > 0 ? { order: results.sorts } : {}),
468
475
  ...(results.filter?.variables || {}),
469
- ...(results.filter?.filter ? { where: results.filter.filter } : {})
476
+ ...(results.filter?.filter ? { where: results.filter.filter } : {}),
470
477
  });
471
478
  }));
472
479
  // const _emitSubject = new Subject<void>()
@@ -567,42 +574,38 @@ function observeRowsWithGqlInputsHandling(queryRef, rows, datatable, extraVariab
567
574
  function _createSortsObservable(datatable$) {
568
575
  return datatable$.pipe(
569
576
  // tap(v => console.log('sorts got dt', v)),
570
- switchMap(dt => dt
571
- ? dt.sort.pipe(map(v => v.sorts), startWith(dt.sorts)) // .pipe(tap(v => console.log('sorts 1', v)))
572
- : of([]) // .pipe(tap(v => console.log('sorts 2', v)))
573
- ), shareReplay({ bufferSize: 1, refCount: true }));
577
+ switchMap((dt) => dt
578
+ ? dt.sort.pipe(map((v) => v.sorts), startWith(dt.sorts)) // .pipe(tap(v => console.log('sorts 1', v)))
579
+ : of([])), shareReplay({ bufferSize: 1, refCount: true }));
574
580
  }
575
581
  function _createFilterStatesObservable(datatable$) {
576
582
  return datatable$.pipe(
577
583
  // tap(v => console.log('filters got dt', v)),
578
- switchMap(dt => dt
584
+ switchMap((dt) => dt
579
585
  ? dt.filterStates // .pipe(tap(v => console.log('filterStates 1', v)))
580
- : of([]) // .pipe(tap(v => console.log('filterStates 2', v)))
581
- ),
586
+ : of([])),
582
587
  // TODO: Remove when the datatable fixes the bug causing it to emit more than it should.
583
588
  distinctUntilChanged((x, y) => JSON.stringify(x) === JSON.stringify(y)));
584
589
  }
585
590
  function _createDatatableResultsObservable(datatable$, mappers, context$) {
586
591
  return new Observable((subscriber) => {
587
592
  const datatableSubject = new ReplaySubject();
588
- const dtSub = datatable$.subscribe(dt => datatableSubject.next(dt), err => datatableSubject.error(err), () => datatableSubject.complete());
589
- const ctxSub = context$.pipe(switchMap(context => {
593
+ const dtSub = datatable$.subscribe((dt) => datatableSubject.next(dt), (err) => datatableSubject.error(err), () => datatableSubject.complete());
594
+ const ctxSub = context$
595
+ .pipe(switchMap((context) => {
590
596
  // TODO: Decide if the disabled paging feature will be reimplemented in a way
591
597
  // that it should be considered here. `_isPagingDisabled(queryRef)`
592
- const pageInfo$ = createPageInfoObservable(datatable$).pipe(map(info => mappers.pageInfo(info)));
593
- const sorts$ = _createSortsObservable(datatable$).pipe(switchMap(m => wrapIntoObservable(mappers.sorts(m, context))));
594
- const filterInfo$ = _createFilterStatesObservable(datatable$).pipe(switchMap(x => mapFilterStates(x, mappers.filters, context)));
595
- return combineLatest([
596
- pageInfo$,
597
- sorts$,
598
- filterInfo$,
599
- ]).pipe(map(([pageInfo, sorts, filterInfo]) => ({
598
+ const pageInfo$ = createPageInfoObservable(datatable$).pipe(map((info) => mappers.pageInfo(info)));
599
+ const sorts$ = _createSortsObservable(datatable$).pipe(switchMap((m) => wrapIntoObservable(mappers.sorts(m, context))));
600
+ const filterInfo$ = _createFilterStatesObservable(datatable$).pipe(switchMap((x) => mapFilterStates(x, mappers.filters, context)));
601
+ return combineLatest([pageInfo$, sorts$, filterInfo$]).pipe(map(([pageInfo, sorts, filterInfo]) => ({
600
602
  pageInfo,
601
603
  sorts,
602
604
  filter: filterInfo,
603
- context
605
+ context,
604
606
  })));
605
- })).subscribe(subscriber);
607
+ }))
608
+ .subscribe(subscriber);
606
609
  return () => {
607
610
  dtSub.unsubscribe();
608
611
  ctxSub.unsubscribe();
@@ -627,13 +630,21 @@ class DatatableGraphQLQueryRef {
627
630
  * Temporary way of tracking total count when paging is disabled.
628
631
  */
629
632
  _totalCount = DEFAULT_PAGE_SIZE;
630
- get _observingChanges() { return this._observingChangesSubject.value; }
631
- set _observingChanges(value) { this._observingChangesSubject.next(value); }
633
+ get _observingChanges() {
634
+ return this._observingChangesSubject.value;
635
+ }
636
+ set _observingChanges(value) {
637
+ this._observingChangesSubject.next(value);
638
+ }
632
639
  _variablesUpdatePending = false;
633
640
  _valueChanges;
634
641
  loading$;
635
- get updatesPollDelay() { return this._updatesPollDelay; }
636
- get variablesUpdatePending() { return this._variablesUpdatePending; }
642
+ get updatesPollDelay() {
643
+ return this._updatesPollDelay;
644
+ }
645
+ get variablesUpdatePending() {
646
+ return this._variablesUpdatePending;
647
+ }
637
648
  constructor(
638
649
  /** Original ApolloClient's QueryRef. */
639
650
  _queryRef,
@@ -647,7 +658,8 @@ class DatatableGraphQLQueryRef {
647
658
  // this._getValueChanges().subscribe(v => this._logNetworkStatus(v.networkStatus))
648
659
  this._valueChanges = defer(() => {
649
660
  // console.log('Observing value changes')
650
- const varChangesSub = this._variablesSubject.pipe(skip(1), tap(() => {
661
+ const varChangesSub = this._variablesSubject
662
+ .pipe(skip(1), tap(() => {
651
663
  this._variablesUpdatePending = true;
652
664
  }), auditTime(this._updatesPollDelay), finalize(() => {
653
665
  // If the query stopped being observed before setting the pending
@@ -656,7 +668,8 @@ class DatatableGraphQLQueryRef {
656
668
  this.refetch();
657
669
  this._variablesUpdatePending = false;
658
670
  }
659
- })).subscribe(variables => {
671
+ }))
672
+ .subscribe((variables) => {
660
673
  // console.log('set vars', variables)
661
674
  this._setVariablesImmediate(variables);
662
675
  // this.refetch()
@@ -667,7 +680,7 @@ class DatatableGraphQLQueryRef {
667
680
  // tap(v => {
668
681
  // console.log('v', v)
669
682
  // }),
670
- filter(v => v.networkStatus === NetworkStatus.ready), finalize(() => {
683
+ filter((v) => v.networkStatus === NetworkStatus.ready), finalize(() => {
671
684
  // console.log('Done observing value changes')
672
685
  varChangesSub.unsubscribe();
673
686
  this._observingChanges = false;
@@ -675,11 +688,11 @@ class DatatableGraphQLQueryRef {
675
688
  }).pipe(
676
689
  // share()
677
690
  shareReplay({ bufferSize: 1, refCount: true }));
678
- this.loading$ = this._observingChangesSubject.pipe(switchMap(observingChanges => {
691
+ this.loading$ = this._observingChangesSubject.pipe(switchMap((observingChanges) => {
679
692
  if (!observingChanges) {
680
693
  return of(false);
681
694
  }
682
- return this._valueChanges.pipe(map(result => result.loading), startWith(this._queryRef.getCurrentResult().loading), auditTime(0), shareReplay({ bufferSize: 1, refCount: true }));
695
+ return this._valueChanges.pipe(map((result) => result.loading), startWith(this._queryRef.getCurrentResult().loading), auditTime(0), shareReplay({ bufferSize: 1, refCount: true }));
683
696
  }));
684
697
  }
685
698
  rows(mapper) {
@@ -692,11 +705,12 @@ class DatatableGraphQLQueryRef {
692
705
  let rowsBuffer = [];
693
706
  // const rowsBufferSubject = new ReplaySubject<TRow[]>()
694
707
  const rowsBufferSubject = new Subject();
695
- const querySub = this._valueChanges.pipe(switchMap(result => {
708
+ const querySub = this._valueChanges
709
+ .pipe(switchMap((result) => {
696
710
  if (result.data === undefined) {
697
711
  return of([]);
698
712
  }
699
- return this._resolveRowMapper(mapper(result.data)).pipe(tap(mapperResult => {
713
+ return this._resolveRowMapper(mapper(result.data)).pipe(tap((mapperResult) => {
700
714
  // console.log('mapperResult', mapperResult)
701
715
  if (this._needsToRequeryWithAllRecords(mapperResult)) {
702
716
  this.patchVariables({ take: mapperResult.totalCount });
@@ -706,7 +720,8 @@ class DatatableGraphQLQueryRef {
706
720
  }
707
721
  // let rows = rowsBufferSubject.value || []
708
722
  let rows = rowsBuffer || [];
709
- const hasTotalCount = mapperResult.totalCount !== undefined && mapperResult.totalCount !== null;
723
+ const hasTotalCount = mapperResult.totalCount !== undefined &&
724
+ mapperResult.totalCount !== null;
710
725
  // If the rows buffer is not the same size as the totalCount, create a
711
726
  // new buffer.
712
727
  //
@@ -730,7 +745,8 @@ class DatatableGraphQLQueryRef {
730
745
  rowsBuffer = rows;
731
746
  rowsBufferSubject.next(rows);
732
747
  }));
733
- })).subscribe();
748
+ }))
749
+ .subscribe();
734
750
  const rowsSub = rowsBufferSubject.subscribe(subscriber);
735
751
  return () => {
736
752
  // console.log('unsub')
@@ -742,14 +758,14 @@ class DatatableGraphQLQueryRef {
742
758
  });
743
759
  }
744
760
  _needsToRequeryWithAllRecords(data) {
745
- if (!(this.getQueryProcessingConfig()?.disablePaging)) {
761
+ if (!this.getQueryProcessingConfig()?.disablePaging) {
746
762
  return false;
747
763
  }
748
- return hasProperty(data, 'totalCount') &&
764
+ return (hasProperty(data, 'totalCount') &&
749
765
  hasProperty(data, 'rows') &&
750
766
  Array.isArray(data.rows) &&
751
767
  data.totalCount > data.rows.length &&
752
- this._totalCount !== data.totalCount;
768
+ this._totalCount !== data.totalCount);
753
769
  }
754
770
  _resolveRowMapper(mapperReturn) {
755
771
  if (isObservable(mapperReturn)) {
@@ -770,7 +786,7 @@ class DatatableGraphQLQueryRef {
770
786
  _patchVariablesImmediate(variables) {
771
787
  const _variables = {
772
788
  ...this.getVariables(),
773
- ...variables
789
+ ...variables,
774
790
  };
775
791
  const _vars = this._withVariableOverrides(_variables);
776
792
  return this._queryRef.setVariables(_vars || {});
@@ -784,7 +800,7 @@ class DatatableGraphQLQueryRef {
784
800
  patchVariables(variables) {
785
801
  const _variables = {
786
802
  ...this.getVariables(),
787
- ...variables
803
+ ...variables,
788
804
  };
789
805
  this._variablesSubject.next(_variables);
790
806
  if (!this._observingChanges) {
@@ -813,7 +829,8 @@ class DatatableGraphQLQueryRef {
813
829
  return this.getOptions()?.context?.queryProcessingConfig;
814
830
  }
815
831
  _withVariableOverrides(variables) {
816
- if (!notNullOrUndefined(variables) && !(this.getQueryProcessingConfig()?.disablePaging)) {
832
+ if (!notNullOrUndefined(variables) &&
833
+ !this.getQueryProcessingConfig()?.disablePaging) {
817
834
  return undefined;
818
835
  }
819
836
  const _vars = { ...(variables || {}) };
@@ -826,7 +843,7 @@ class DatatableGraphQLQueryRef {
826
843
 
827
844
  const DATATABLE_GRAPHQL_SERVICE_CONFIG = new InjectionToken('DATATABLE_GRAPHQL_SERVICE_CONFIG');
828
845
  const _CONFIG_DEFAULTS = {
829
- pollingIntervalTime: 1 * 60 * 1000
846
+ pollingIntervalTime: 1 * 60 * 1000,
830
847
  };
831
848
  class DatatableGraphqlService {
832
849
  _apollo;
@@ -835,7 +852,7 @@ class DatatableGraphqlService {
835
852
  this._apollo = _apollo;
836
853
  this._config = {
837
854
  ..._CONFIG_DEFAULTS,
838
- ...(_config || {})
855
+ ...(_config || {}),
839
856
  };
840
857
  }
841
858
  watchQuery(options, queryProcessingConfig) {
@@ -843,27 +860,27 @@ class DatatableGraphqlService {
843
860
  useInitialLoading: true,
844
861
  ..._CONFIG_DEFAULTS,
845
862
  pollInterval: this._config.pollingIntervalTime,
846
- ...options
863
+ ...options,
847
864
  };
848
865
  if (queryProcessingConfig) {
849
866
  _options.context = {
850
867
  ...(_options.context || {}),
851
868
  queryProcessingConfig: {
852
869
  ...(_options.context?.queryProcessingConfig || {}),
853
- ...queryProcessingConfig
854
- }
870
+ ...queryProcessingConfig,
871
+ },
855
872
  };
856
873
  }
857
874
  const queryRef = this._apollo.watchQuery(_options);
858
875
  return new DatatableGraphQLQueryRef(queryRef);
859
876
  }
860
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: DatatableGraphqlService, deps: [{ token: i1.Apollo }, { token: DATATABLE_GRAPHQL_SERVICE_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
861
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: DatatableGraphqlService, providedIn: 'root' });
877
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: DatatableGraphqlService, deps: [{ token: i1.Apollo }, { token: DATATABLE_GRAPHQL_SERVICE_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
878
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: DatatableGraphqlService, providedIn: 'root' });
862
879
  }
863
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: DatatableGraphqlService, decorators: [{
880
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: DatatableGraphqlService, decorators: [{
864
881
  type: Injectable,
865
882
  args: [{
866
- providedIn: 'root'
883
+ providedIn: 'root',
867
884
  }]
868
885
  }], ctorParameters: () => [{ type: i1.Apollo }, { type: undefined, decorators: [{
869
886
  type: Optional
@@ -876,10 +893,14 @@ const mapSearchDateColumnsDataFilterStateToGql = (filterState, context) => {
876
893
  const formValue = filterState.state.formValue;
877
894
  const options = filterState.state.options;
878
895
  let filter = null;
879
- if (isNullOrUndefined(filterState.state.prop) || isNullOrUndefined(options) || isNullOrUndefined(formValue) || isNullOrUndefined(formValue.searchType)) {
896
+ if (isNullOrUndefined(filterState.state.prop) ||
897
+ isNullOrUndefined(options) ||
898
+ isNullOrUndefined(formValue) ||
899
+ isNullOrUndefined(formValue.searchType)) {
880
900
  return filter;
881
901
  }
882
- if (THESEAM_COLUMNS_DATA_FILTER_DATE_TEXT_SEARCH_TYPES.includes(formValue.searchType) && notNullOrUndefined(formValue.searchText)) {
902
+ if (THESEAM_COLUMNS_DATA_FILTER_DATE_TEXT_SEARCH_TYPES.includes(formValue.searchType) &&
903
+ notNullOrUndefined(formValue.searchText)) {
883
904
  const searchDate = getFormattedDateForComparison(formValue.searchText, options.dateType, true);
884
905
  if (!isNaN(searchDate.valueOf())) {
885
906
  switch (formValue.searchType) {
@@ -897,18 +918,28 @@ const mapSearchDateColumnsDataFilterStateToGql = (filterState, context) => {
897
918
  filter = {
898
919
  filter: {
899
920
  and: [
900
- { [filterState.state.prop]: { gte: searchDate.toISOString() } },
901
- { [filterState.state.prop]: { lt: searchDateEnd.toISOString() } }
902
- ]
921
+ {
922
+ [filterState.state.prop]: { gte: searchDate.toISOString() },
923
+ },
924
+ {
925
+ [filterState.state.prop]: {
926
+ lt: searchDateEnd.toISOString(),
927
+ },
928
+ },
929
+ ],
903
930
  },
904
- variables: {}
931
+ variables: {},
905
932
  };
906
933
  }
907
934
  break;
908
935
  }
909
936
  case 'gt':
910
937
  case 'lte': {
911
- const comparator = formValue.searchType === 'gt' ? 'gte' : formValue.searchType === 'lte' ? 'lt' : null;
938
+ const comparator = formValue.searchType === 'gt'
939
+ ? 'gte'
940
+ : formValue.searchType === 'lte'
941
+ ? 'lt'
942
+ : null;
912
943
  let searchDateEnd;
913
944
  if (options.dateType === 'datetime-local') {
914
945
  searchDateEnd = new Date(searchDate);
@@ -918,14 +949,19 @@ const mapSearchDateColumnsDataFilterStateToGql = (filterState, context) => {
918
949
  searchDateEnd = new Date(searchDate);
919
950
  searchDateEnd.setDate(searchDateEnd.getDate() + 1);
920
951
  }
921
- if (notNullOrUndefined(comparator) && notNullOrUndefined(searchDateEnd)) {
952
+ if (notNullOrUndefined(comparator) &&
953
+ notNullOrUndefined(searchDateEnd)) {
922
954
  filter = {
923
955
  filter: {
924
956
  and: [
925
- { [filterState.state.prop]: { [comparator]: searchDateEnd.toISOString() } },
926
- ]
957
+ {
958
+ [filterState.state.prop]: {
959
+ [comparator]: searchDateEnd.toISOString(),
960
+ },
961
+ },
962
+ ],
927
963
  },
928
- variables: {}
964
+ variables: {},
929
965
  };
930
966
  }
931
967
  break;
@@ -935,10 +971,14 @@ const mapSearchDateColumnsDataFilterStateToGql = (filterState, context) => {
935
971
  filter = {
936
972
  filter: {
937
973
  and: [
938
- { [filterState.state.prop]: { [formValue.searchType]: searchDate.toISOString() } },
939
- ]
974
+ {
975
+ [filterState.state.prop]: {
976
+ [formValue.searchType]: searchDate.toISOString(),
977
+ },
978
+ },
979
+ ],
940
980
  },
941
- variables: {}
981
+ variables: {},
942
982
  };
943
983
  break;
944
984
  }
@@ -947,7 +987,9 @@ const mapSearchDateColumnsDataFilterStateToGql = (filterState, context) => {
947
987
  }
948
988
  }
949
989
  }
950
- else if (THESEAM_COLUMNS_DATA_FILTER_DATE_RANGE_SEARCH_TYPES.includes(formValue.searchType) && notNullOrUndefined(formValue.fromText) && notNullOrUndefined(formValue.toText)) {
990
+ else if (THESEAM_COLUMNS_DATA_FILTER_DATE_RANGE_SEARCH_TYPES.includes(formValue.searchType) &&
991
+ notNullOrUndefined(formValue.fromText) &&
992
+ notNullOrUndefined(formValue.toText)) {
951
993
  const fromDate = getFormattedDateForComparison(formValue.fromText, options.dateType, true);
952
994
  const toDate = getFormattedDateForComparison(formValue.toText, options.dateType, true);
953
995
  if (!isNaN(fromDate.valueOf()) && !isNaN(toDate.valueOf())) {
@@ -967,9 +1009,9 @@ const mapSearchDateColumnsDataFilterStateToGql = (filterState, context) => {
967
1009
  and: [
968
1010
  { [filterState.state.prop]: { gte: fromDate.toISOString() } },
969
1011
  { [filterState.state.prop]: { lt: toDateEnd.toISOString() } },
970
- ]
1012
+ ],
971
1013
  },
972
- variables: {}
1014
+ variables: {},
973
1015
  };
974
1016
  }
975
1017
  else if (formValue.searchType === 'not-between') {
@@ -978,9 +1020,9 @@ const mapSearchDateColumnsDataFilterStateToGql = (filterState, context) => {
978
1020
  or: [
979
1021
  { [filterState.state.prop]: { lt: fromDate.toISOString() } },
980
1022
  { [filterState.state.prop]: { gt: toDateEnd.toISOString() } },
981
- ]
1023
+ ],
982
1024
  },
983
- variables: {}
1025
+ variables: {},
984
1026
  };
985
1027
  }
986
1028
  }
@@ -989,21 +1031,17 @@ const mapSearchDateColumnsDataFilterStateToGql = (filterState, context) => {
989
1031
  else if (formValue.searchType === 'blank') {
990
1032
  filter = {
991
1033
  filter: {
992
- or: [
993
- { [filterState.state.prop]: { eq: null } }
994
- ]
1034
+ or: [{ [filterState.state.prop]: { eq: null } }],
995
1035
  },
996
- variables: {}
1036
+ variables: {},
997
1037
  };
998
1038
  }
999
1039
  else if (formValue.searchType === 'not-blank') {
1000
1040
  filter = {
1001
1041
  filter: {
1002
- and: [
1003
- { [filterState.state.prop]: { neq: null } }
1004
- ]
1042
+ and: [{ [filterState.state.prop]: { neq: null } }],
1005
1043
  },
1006
- variables: {}
1044
+ variables: {},
1007
1045
  };
1008
1046
  }
1009
1047
  return filter;
@@ -1014,21 +1052,29 @@ const mapSearchNumericColumnsDataFilterStateToGql = (filterState, context) => {
1014
1052
  if (isNullOrUndefined(filterState.state.prop)) {
1015
1053
  return filter;
1016
1054
  }
1017
- if (notNullOrUndefined(filterState.state.formValue) && notNullOrUndefined(filterState.state.formValue.searchType)) {
1018
- if (THESEAM_COLUMNS_DATA_FILTER_NUMERIC_TEXT_SEARCH_TYPES.includes(filterState.state.formValue.searchType) && notNullOrUndefined(filterState.state.formValue.searchText)) {
1055
+ if (notNullOrUndefined(filterState.state.formValue) &&
1056
+ notNullOrUndefined(filterState.state.formValue.searchType)) {
1057
+ if (THESEAM_COLUMNS_DATA_FILTER_NUMERIC_TEXT_SEARCH_TYPES.includes(filterState.state.formValue.searchType) &&
1058
+ notNullOrUndefined(filterState.state.formValue.searchText)) {
1019
1059
  const searchNumeric = parseFloat(filterState.state.formValue.searchText);
1020
1060
  if (!isNaN(searchNumeric)) {
1021
1061
  filter = {
1022
1062
  filter: {
1023
1063
  and: [
1024
- { [filterState.state.prop]: { [filterState.state.formValue.searchType]: searchNumeric } }
1025
- ]
1064
+ {
1065
+ [filterState.state.prop]: {
1066
+ [filterState.state.formValue.searchType]: searchNumeric,
1067
+ },
1068
+ },
1069
+ ],
1026
1070
  },
1027
- variables: {}
1071
+ variables: {},
1028
1072
  };
1029
1073
  }
1030
1074
  }
1031
- else if (THESEAM_COLUMNS_DATA_FILTER_NUMERIC_RANGE_SEARCH_TYPES.includes(filterState.state.formValue.searchType) && notNullOrUndefined(filterState.state.formValue.fromText) && notNullOrUndefined(filterState.state.formValue.toText)) {
1075
+ else if (THESEAM_COLUMNS_DATA_FILTER_NUMERIC_RANGE_SEARCH_TYPES.includes(filterState.state.formValue.searchType) &&
1076
+ notNullOrUndefined(filterState.state.formValue.fromText) &&
1077
+ notNullOrUndefined(filterState.state.formValue.toText)) {
1032
1078
  const fromNumeric = parseFloat(filterState.state.formValue.fromText);
1033
1079
  const toNumeric = parseFloat(filterState.state.formValue.toText);
1034
1080
  if (!isNaN(fromNumeric) && !isNaN(toNumeric)) {
@@ -1036,22 +1082,22 @@ const mapSearchNumericColumnsDataFilterStateToGql = (filterState, context) => {
1036
1082
  filter = {
1037
1083
  filter: {
1038
1084
  and: [
1039
- { [filterState.state.prop]: { 'gte': fromNumeric } },
1040
- { [filterState.state.prop]: { 'lte': toNumeric } },
1041
- ]
1085
+ { [filterState.state.prop]: { gte: fromNumeric } },
1086
+ { [filterState.state.prop]: { lte: toNumeric } },
1087
+ ],
1042
1088
  },
1043
- variables: {}
1089
+ variables: {},
1044
1090
  };
1045
1091
  }
1046
1092
  else if (filterState.state.formValue.searchType === 'not-between') {
1047
1093
  filter = {
1048
1094
  filter: {
1049
1095
  or: [
1050
- { [filterState.state.prop]: { 'lt': fromNumeric } },
1051
- { [filterState.state.prop]: { 'gt': toNumeric } },
1052
- ]
1096
+ { [filterState.state.prop]: { lt: fromNumeric } },
1097
+ { [filterState.state.prop]: { gt: toNumeric } },
1098
+ ],
1053
1099
  },
1054
- variables: {}
1100
+ variables: {},
1055
1101
  };
1056
1102
  }
1057
1103
  }
@@ -1062,9 +1108,9 @@ const mapSearchNumericColumnsDataFilterStateToGql = (filterState, context) => {
1062
1108
  or: [
1063
1109
  { [filterState.state.prop]: { eq: null } },
1064
1110
  { [filterState.state.prop]: { eq: '' } },
1065
- ]
1111
+ ],
1066
1112
  },
1067
- variables: {}
1113
+ variables: {},
1068
1114
  };
1069
1115
  }
1070
1116
  else if (filterState.state.formValue.searchType === 'not-blank') {
@@ -1072,10 +1118,10 @@ const mapSearchNumericColumnsDataFilterStateToGql = (filterState, context) => {
1072
1118
  filter: {
1073
1119
  and: [
1074
1120
  { [filterState.state.prop]: { neq: null } },
1075
- { [filterState.state.prop]: { neq: '' } }
1076
- ]
1121
+ { [filterState.state.prop]: { neq: '' } },
1122
+ ],
1077
1123
  },
1078
- variables: {}
1124
+ variables: {},
1079
1125
  };
1080
1126
  }
1081
1127
  }
@@ -1087,15 +1133,21 @@ const mapSearchTextColumnsDataFilterStateToGql = (filterState, context) => {
1087
1133
  if (isNullOrUndefined(filterState.state.prop)) {
1088
1134
  return filter;
1089
1135
  }
1090
- if (notNullOrUndefined(filterState.state.formValue) && notNullOrUndefined(filterState.state.formValue.searchType)) {
1091
- if (THESEAM_COLUMNS_DATA_FILTER_TEXT_TEXT_SEARCH_TYPES.includes(filterState.state.formValue.searchType) && notNullOrUndefined(filterState.state.formValue.searchText)) {
1136
+ if (notNullOrUndefined(filterState.state.formValue) &&
1137
+ notNullOrUndefined(filterState.state.formValue.searchType)) {
1138
+ if (THESEAM_COLUMNS_DATA_FILTER_TEXT_TEXT_SEARCH_TYPES.includes(filterState.state.formValue.searchType) &&
1139
+ notNullOrUndefined(filterState.state.formValue.searchText)) {
1092
1140
  filter = {
1093
1141
  filter: {
1094
1142
  and: [
1095
- { [filterState.state.prop]: { [filterState.state.formValue.searchType]: filterState.state.formValue.searchText } }
1096
- ]
1143
+ {
1144
+ [filterState.state.prop]: {
1145
+ [filterState.state.formValue.searchType]: filterState.state.formValue.searchText,
1146
+ },
1147
+ },
1148
+ ],
1097
1149
  },
1098
- variables: {}
1150
+ variables: {},
1099
1151
  };
1100
1152
  }
1101
1153
  else if (filterState.state.formValue.searchType === 'blank') {
@@ -1104,9 +1156,9 @@ const mapSearchTextColumnsDataFilterStateToGql = (filterState, context) => {
1104
1156
  or: [
1105
1157
  { [filterState.state.prop]: { eq: null } },
1106
1158
  { [filterState.state.prop]: { eq: '' } },
1107
- ]
1159
+ ],
1108
1160
  },
1109
- variables: {}
1161
+ variables: {},
1110
1162
  };
1111
1163
  }
1112
1164
  else if (filterState.state.formValue.searchType === 'not-blank') {
@@ -1114,16 +1166,78 @@ const mapSearchTextColumnsDataFilterStateToGql = (filterState, context) => {
1114
1166
  filter: {
1115
1167
  and: [
1116
1168
  { [filterState.state.prop]: { neq: null } },
1117
- { [filterState.state.prop]: { neq: '' } }
1118
- ]
1169
+ { [filterState.state.prop]: { neq: '' } },
1170
+ ],
1119
1171
  },
1120
- variables: {}
1172
+ variables: {},
1121
1173
  };
1122
1174
  }
1123
1175
  }
1124
1176
  return filter;
1125
1177
  };
1126
1178
 
1179
+ const inlineVariableTransformer = (operation, hintsToken) => {
1180
+ const query = operation.query;
1181
+ const variables = operation.variables;
1182
+ return {
1183
+ query,
1184
+ variables,
1185
+ };
1186
+ };
1187
+
1188
+ const removeNotDefinedTransformer = (operation, hintsToken) => {
1189
+ const query = operation.query;
1190
+ const variables = operation.variables;
1191
+ return {
1192
+ query,
1193
+ variables,
1194
+ };
1195
+ };
1196
+
1197
+ /**
1198
+ * Maps variable value to gql and inlines it into the query.
1199
+ */
1200
+ const inlineVariableHintDef = {
1201
+ name: 'inline-variable',
1202
+ appliesTo: [HintsKind.Variable, HintsKind.VariableDefinition],
1203
+ transformer: inlineVariableTransformer,
1204
+ };
1205
+
1206
+ /**
1207
+ * Remove the variable from the query if it is not defined in the operation
1208
+ * variables.
1209
+ */
1210
+ const removeNotDefinedHintDef = {
1211
+ name: 'remove-not-defined',
1212
+ appliesTo: [HintsKind.OperationDefinition],
1213
+ transformer: removeNotDefinedTransformer,
1214
+ };
1215
+
1216
+ // /**
1217
+ // * Remove the variable from the query if it is not defined in the operation
1218
+ // * variables.
1219
+ // *
1220
+ // * Applies to: OperationDefinition
1221
+ // */
1222
+ // export const GQL_HINT_REMOVE_NOT_DEFINED = 'remove-not-defined'
1223
+ // /**
1224
+ // * Maps variable value to gql and inlines it into the query.
1225
+ // *
1226
+ // * Applies to: Variable, VariableDefinition
1227
+ // */
1228
+ // export const GQL_HINT_INLINE_VARIABLE = 'inline-variable'
1229
+ // /**
1230
+ // * Remove variable definition from the query if it is not used by the operation.
1231
+ // *
1232
+ // * Applies to: VariableDefinition
1233
+ // */
1234
+ // // export const GQL_HINT_REMOVE_IF_NOT_USED = 'remove-if-not-used'
1235
+ // export const GQL_HINTS = [
1236
+ // // GQL_HINT_REMOVE_IF_NOT_USED,
1237
+ // GQL_HINT_REMOVE_NOT_DEFINED,
1238
+ // GQL_HINT_INLINE_VARIABLE
1239
+ // ]
1240
+
1127
1241
  const baseSchemaFragment = gql `
1128
1242
  input ComparableInt32OperationFilterInput {
1129
1243
  eq: Int
@@ -1195,19 +1309,21 @@ const baseSchemaFragment = gql `
1195
1309
  objectContains: String
1196
1310
  }
1197
1311
 
1198
-
1199
1312
  enum SortEnumType {
1200
1313
  ASC
1201
1314
  DESC
1202
1315
  }
1203
1316
 
1204
-
1205
- """The \`DateTime\` scalar represents an ISO-8601 compliant date time type."""
1317
+ """
1318
+ The \`DateTime\` scalar represents an ISO-8601 compliant date time type.
1319
+ """
1206
1320
  scalar DateTime
1207
1321
 
1208
1322
  scalar Uuid
1209
1323
 
1210
- """The built-in \`Decimal\` scalar type."""
1324
+ """
1325
+ The built-in \`Decimal\` scalar type.
1326
+ """
1211
1327
  scalar Decimal
1212
1328
 
1213
1329
  """
@@ -1215,8 +1331,9 @@ const baseSchemaFragment = gql `
1215
1331
  """
1216
1332
  scalar Long
1217
1333
 
1218
-
1219
- """Information about the offset pagination."""
1334
+ """
1335
+ Information about the offset pagination.
1336
+ """
1220
1337
  type CollectionSegmentInfo {
1221
1338
  """
1222
1339
  Indicates whether more items exist following the set defined by the clients arguments.
@@ -1259,7 +1376,7 @@ function _getWhereCondition(x) {
1259
1376
  function _parseWhereItems(where) {
1260
1377
  const conditions = [];
1261
1378
  const keys = Object.keys(where);
1262
- if (keys.find(k => _whereItemCollectionKinds.find(k2 => k === k2) !== undefined) !== undefined) {
1379
+ if (keys.find((k) => _whereItemCollectionKinds.find((k2) => k === k2) !== undefined) !== undefined) {
1263
1380
  // TODO: Implement
1264
1381
  }
1265
1382
  else {
@@ -1275,7 +1392,7 @@ function _parseWhereItems(where) {
1275
1392
  }
1276
1393
  function filterWhere(data, where) {
1277
1394
  const items = _parseWhereItems(where);
1278
- const filteredClaims = data.filter(c => {
1395
+ const filteredClaims = data.filter((c) => {
1279
1396
  // const idx = items.indexOf(itm => itm(c))
1280
1397
  // return idx !== -1
1281
1398
  let found = false;
@@ -1318,7 +1435,7 @@ function filteredResults(items, args) {
1318
1435
  _items = skipAndTake(_items, skip, take);
1319
1436
  }
1320
1437
  const pageInfo = {
1321
- hasNextPage: (skip + take) < totalCount,
1438
+ hasNextPage: skip + take < totalCount,
1322
1439
  hasPreviousPage: skip > 0,
1323
1440
  };
1324
1441
  return {
@@ -1338,22 +1455,26 @@ class MockDatatable {
1338
1455
  _scrolledPosV = 0;
1339
1456
  page = new EventEmitter();
1340
1457
  sort = new EventEmitter();
1341
- get sorts() { return this._sorts; }
1342
- set sorts(value) { this._sorts = value; }
1458
+ get sorts() {
1459
+ return this._sorts;
1460
+ }
1461
+ set sorts(value) {
1462
+ this._sorts = value;
1463
+ }
1343
1464
  filterStates = this._filterStatesSubject.asObservable();
1344
1465
  static pageDefaults(dt, defaultPageSize = 20) {
1345
1466
  return {
1346
1467
  offset: dt.ngxDatatable?.offset ?? 0,
1347
1468
  pageSize: dt.ngxDatatable?.pageSize ?? defaultPageSize,
1348
1469
  limit: dt.ngxDatatable?.limit,
1349
- count: dt.ngxDatatable?.count ?? 0
1470
+ count: dt.ngxDatatable?.count ?? 0,
1350
1471
  };
1351
1472
  }
1352
1473
  get ngxDatatable() {
1353
1474
  return {
1354
1475
  offset: this.getPage(),
1355
1476
  pageSize: this.getPageSize(),
1356
- count: this._rows.length
1477
+ count: this._rows.length,
1357
1478
  };
1358
1479
  }
1359
1480
  setSorts(v) {
@@ -1378,7 +1499,7 @@ class MockDatatable {
1378
1499
  const bodyHeight = this._rowHeight * this.getPageSize();
1379
1500
  const visibleHeight = this._bodyHeight + this._scrolledPosV;
1380
1501
  const pages = Math.floor(visibleHeight / bodyHeight);
1381
- const overflow = visibleHeight - (pages * bodyHeight);
1502
+ const overflow = visibleHeight - pages * bodyHeight;
1382
1503
  const page = overflow > 1 ? pages + 1 : pages;
1383
1504
  return page - 1;
1384
1505
  }
@@ -1480,7 +1601,7 @@ function _isOneOfIndices(indices, index) {
1480
1601
 
1481
1602
  function graphQLLink(options) {
1482
1603
  return new ApolloLink((operation, forward) => {
1483
- return new Observable$1(subscriber => {
1604
+ return new Observable$1((subscriber) => {
1484
1605
  // console.log('graphQLLink', operation.variables)
1485
1606
  const response = graphqlSync({
1486
1607
  schema: options.schema,
@@ -1501,68 +1622,6 @@ function graphQLLink(options) {
1501
1622
  });
1502
1623
  }
1503
1624
 
1504
- const inlineVariableTransformer = (operation, hintsToken) => {
1505
- const query = operation.query;
1506
- const variables = operation.variables;
1507
- return {
1508
- query,
1509
- variables
1510
- };
1511
- };
1512
-
1513
- const removeNotDefinedTransformer = (operation, hintsToken) => {
1514
- const query = operation.query;
1515
- const variables = operation.variables;
1516
- return {
1517
- query,
1518
- variables
1519
- };
1520
- };
1521
-
1522
- /**
1523
- * Maps variable value to gql and inlines it into the query.
1524
- */
1525
- const inlineVariableHintDef = {
1526
- name: 'inline-variable',
1527
- appliesTo: [HintsKind.Variable, HintsKind.VariableDefinition],
1528
- transformer: inlineVariableTransformer
1529
- };
1530
-
1531
- /**
1532
- * Remove the variable from the query if it is not defined in the operation
1533
- * variables.
1534
- */
1535
- const removeNotDefinedHintDef = {
1536
- name: 'remove-not-defined',
1537
- appliesTo: [HintsKind.OperationDefinition],
1538
- transformer: removeNotDefinedTransformer
1539
- };
1540
-
1541
- // /**
1542
- // * Remove the variable from the query if it is not defined in the operation
1543
- // * variables.
1544
- // *
1545
- // * Applies to: OperationDefinition
1546
- // */
1547
- // export const GQL_HINT_REMOVE_NOT_DEFINED = 'remove-not-defined'
1548
- // /**
1549
- // * Maps variable value to gql and inlines it into the query.
1550
- // *
1551
- // * Applies to: Variable, VariableDefinition
1552
- // */
1553
- // export const GQL_HINT_INLINE_VARIABLE = 'inline-variable'
1554
- // /**
1555
- // * Remove variable definition from the query if it is not used by the operation.
1556
- // *
1557
- // * Applies to: VariableDefinition
1558
- // */
1559
- // // export const GQL_HINT_REMOVE_IF_NOT_USED = 'remove-if-not-used'
1560
- // export const GQL_HINTS = [
1561
- // // GQL_HINT_REMOVE_IF_NOT_USED,
1562
- // GQL_HINT_REMOVE_NOT_DEFINED,
1563
- // GQL_HINT_INLINE_VARIABLE
1564
- // ]
1565
-
1566
1625
  const queryProcessingLink = new ApolloLink((operation, forward) => {
1567
1626
  // console.log('~link operation', operation)
1568
1627
  const context = operation.getContext();
@@ -1582,7 +1641,7 @@ const queryProcessingLink = new ApolloLink((operation, forward) => {
1582
1641
  }
1583
1642
  const result = removeNotDefinedHintDef.transformer({
1584
1643
  query: operation.query,
1585
- variables: operation.variables
1644
+ variables: operation.variables,
1586
1645
  }, rulesToken);
1587
1646
  operation.query = result.query;
1588
1647
  operation.variables = result.variables;
@@ -1606,7 +1665,7 @@ const queryProcessingLink = new ApolloLink((operation, forward) => {
1606
1665
  const varValue = operation.variables[varName];
1607
1666
  operation.variables = withoutProperty(operation.variables, varName);
1608
1667
  _ast = removeVariableDefinition(_ast, varName);
1609
- const varValueNode = _ast = inlineVariable(_ast, varName, parseValue(toGQL(varValue)));
1668
+ const varValueNode = (_ast = inlineVariable(_ast, varName, parseValue(toGQL(varValue))));
1610
1669
  }
1611
1670
  // const removeIfNotDefined = hintsTokensContainingHint(rules, GQL_HINT_REMOVE_IF_NOT_USED)
1612
1671
  // console.log('removeIfNotDefined', removeIfNotDefined)
@@ -1667,9 +1726,9 @@ function createApolloTestingProvider(schema, rootValue) {
1667
1726
  fetchPolicy: 'network-only',
1668
1727
  errorPolicy: 'all',
1669
1728
  },
1670
- }
1729
+ },
1671
1730
  };
1672
- }
1731
+ },
1673
1732
  };
1674
1733
  }
1675
1734
 
@@ -1677,44 +1736,46 @@ function createSimpleGqlTestRecord(num) {
1677
1736
  return { id: num, name: `Item_${num}` };
1678
1737
  }
1679
1738
  const simpleGqlTestSchema = buildSchema(print(gql `
1680
- ${baseSchemaFragment}
1739
+ ${baseSchemaFragment}
1681
1740
 
1682
- type SimpleGqlTestRecordCollectionSegment {
1683
- items: [SimpleGqlTestRecord!]
1741
+ type SimpleGqlTestRecordCollectionSegment {
1742
+ items: [SimpleGqlTestRecord!]
1684
1743
 
1685
- """Information to aid in pagination."""
1686
- pageInfo: CollectionSegmentInfo!
1687
- totalCount: Int!
1688
- }
1744
+ """
1745
+ Information to aid in pagination.
1746
+ """
1747
+ pageInfo: CollectionSegmentInfo!
1748
+ totalCount: Int!
1749
+ }
1689
1750
 
1690
- input SimpleGqlTestRecordFilterInput {
1691
- and: [SimpleGqlTestRecordFilterInput!]
1692
- or: [SimpleGqlTestRecordFilterInput!]
1693
- objectContains: String
1694
- id: ComparableInt32OperationFilterInput
1695
- name: StringOperationFilterInput
1696
- }
1751
+ input SimpleGqlTestRecordFilterInput {
1752
+ and: [SimpleGqlTestRecordFilterInput!]
1753
+ or: [SimpleGqlTestRecordFilterInput!]
1754
+ objectContains: String
1755
+ id: ComparableInt32OperationFilterInput
1756
+ name: StringOperationFilterInput
1757
+ }
1697
1758
 
1698
- type SimpleGqlTestRecord {
1699
- id: Int
1700
- name: String
1701
- }
1759
+ type SimpleGqlTestRecord {
1760
+ id: Int
1761
+ name: String
1762
+ }
1702
1763
 
1703
- type Query {
1704
- simpleGqlTestRecords(
1705
- skip: Int
1706
- take: Int
1707
- where: SimpleGqlTestRecordFilterInput
1708
- ): SimpleGqlTestRecordCollectionSegment
1709
- }
1710
- `));
1764
+ type Query {
1765
+ simpleGqlTestRecords(
1766
+ skip: Int
1767
+ take: Int
1768
+ where: SimpleGqlTestRecordFilterInput
1769
+ ): SimpleGqlTestRecordCollectionSegment
1770
+ }
1771
+ `));
1711
1772
  function createSimpleGqlTestRoot(numRecords) {
1712
1773
  const _records = [];
1713
1774
  for (let i = 0; i < numRecords; i++) {
1714
1775
  _records.push(createSimpleGqlTestRecord(i));
1715
1776
  }
1716
1777
  return {
1717
- simpleGqlTestRecords: (args) => filteredResults([..._records], args)
1778
+ simpleGqlTestRecords: (args) => filteredResults([..._records], args),
1718
1779
  };
1719
1780
  }
1720
1781
  const SIMPLE_GQL_TEST_QUERY = gql `
@@ -1723,11 +1784,7 @@ const SIMPLE_GQL_TEST_QUERY = gql `
1723
1784
  $take: Int
1724
1785
  $where: SimpleGqlTestRecordFilterInput
1725
1786
  ) {
1726
- simpleGqlTestRecords(
1727
- skip: $skip
1728
- take: $take
1729
- where: $where
1730
- ) {
1787
+ simpleGqlTestRecords(skip: $skip, take: $take, where: $where) {
1731
1788
  items {
1732
1789
  id
1733
1790
  name
@@ -1741,5 +1798,5 @@ const SIMPLE_GQL_TEST_QUERY = gql `
1741
1798
  * Generated bundle index. Do not edit.
1742
1799
  */
1743
1800
 
1744
- export { DATATABLE_GRAPHQL_SERVICE_CONFIG, DEFAULT_PAGE_SIZE, DatatableGraphQLQueryRef, DatatableGraphqlService, HINT_NAMES_CAPTURE_REGEX, HINT_PREFIX_REGEX, MockDatatable, SIMPLE_GQL_TEST_QUERY, baseSchemaFragment, checkRecordsHaveValue, containsVariable, createApolloTestingProvider, createHintsToken, createSimpleGqlTestRecord, createSimpleGqlTestRoot, filterWhere, filteredResults, getHintsToken, getPageInfo, getTokenAppliesTo, gqlVar, hintNamesFromHintToken, hintsTokensContainingHint, inlineVariable, isCommentToken, isHintToken, isInlineComment, mapFilterStates, mapSearchDateColumnsDataFilterStateToGql, mapSearchNumericColumnsDataFilterStateToGql, mapSearchTextColumnsDataFilterStateToGql, observeRowsWithGqlInputsHandling, parseAst, parseComments, parseHints, removeVariable, removeVariableDefinition, removeVariableDefinitionsNotDefined, simpleGqlTestSchema, skipAndTake, toGQL };
1801
+ export { DATATABLE_GRAPHQL_SERVICE_CONFIG, DEFAULT_PAGE_SIZE, DEFAULT_TO_REMOVE_ON_UNDEFINED, DatatableGraphQLQueryRef, DatatableGraphqlService, GQLDirection, GQLVariable, HINT_NAMES_CAPTURE_REGEX, HINT_PREFIX_REGEX, HintsKind, MockDatatable, SIMPLE_GQL_TEST_QUERY, baseSchemaFragment, checkRecordsHaveValue, containsVariable, createApolloTestingProvider, createHintsToken, createSimpleGqlTestRecord, createSimpleGqlTestRoot, filterWhere, filteredResults, getHintsToken, getPageInfo, getTokenAppliesTo, gqlVar, hintNamesFromHintToken, hintsTokensContainingHint, inlineVariable, inlineVariableHintDef, inlineVariableTransformer, isCommentToken, isHintToken, isInlineComment, mapFilterStates, mapSearchDateColumnsDataFilterStateToGql, mapSearchNumericColumnsDataFilterStateToGql, mapSearchTextColumnsDataFilterStateToGql, observeRowsWithGqlInputsHandling, parseAst, parseComments, parseHints, removeNotDefinedHintDef, removeNotDefinedTransformer, removeVariable, removeVariableDefinition, removeVariableDefinitionsNotDefined, simpleGqlTestSchema, skipAndTake, toGQL };
1745
1802
  //# sourceMappingURL=theseam-ui-common-graphql.mjs.map