@sankhyalabs/sankhyablocks 8.16.0-dev.40 → 8.16.0-dev.42

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. package/dist/cjs/{ConfigStorage-ecc0ed20.js → ConfigStorage-f079f5fd.js} +2 -2
  2. package/dist/cjs/{ContinuousInsertUtils-c7e35e3b.js → ContinuousInsertUtils-64e47516.js} +29 -20
  3. package/dist/cjs/{DataFetcher-cadeef8e.js → DataFetcher-e059eb72.js} +7 -5
  4. package/dist/cjs/{SnkFormConfigManager-f1c92f79.js → SnkFormConfigManager-63369164.js} +2 -2
  5. package/dist/cjs/{auth-fetcher-d68841bc.js → auth-fetcher-4f853233.js} +1 -1
  6. package/dist/cjs/{dataunit-fetcher-a36ae041.js → dataunit-fetcher-228016f4.js} +1 -1
  7. package/dist/cjs/{form-config-fetcher-ed497282.js → form-config-fetcher-39397ac5.js} +1 -1
  8. package/dist/cjs/{pesquisa-fetcher-490a86c3.js → pesquisa-fetcher-a9bfeb22.js} +1 -1
  9. package/dist/cjs/snk-actions-button_4.cjs.entry.js +5 -5
  10. package/dist/cjs/snk-application.cjs.entry.js +101 -59
  11. package/dist/cjs/snk-attach.cjs.entry.js +5 -5
  12. package/dist/cjs/snk-config-options_3.cjs.entry.js +4 -4
  13. package/dist/cjs/snk-crud.cjs.entry.js +5 -5
  14. package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -5
  15. package/dist/cjs/{snk-data-unit-b460f1da.js → snk-data-unit-3d4d0e2a.js} +1 -1
  16. package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
  17. package/dist/cjs/snk-detail-view.cjs.entry.js +7 -7
  18. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +3 -3
  19. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
  20. package/dist/cjs/snk-grid.cjs.entry.js +6 -6
  21. package/dist/cjs/{snk-guides-viewer-de0a5c57.js → snk-guides-viewer-0419911a.js} +5 -5
  22. package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
  23. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
  24. package/dist/cjs/snk-simple-crud.cjs.entry.js +7 -7
  25. package/dist/collection/components/snk-application/request-listener/DebouncedRequestListener.js +28 -0
  26. package/dist/collection/components/snk-application/request-listener/RequestListenerFactory.js +16 -0
  27. package/dist/collection/components/snk-application/request-listener/RequestListenerLoadingBar.js +52 -0
  28. package/dist/collection/components/snk-application/snk-application.js +3 -53
  29. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +8 -6
  30. package/dist/collection/lib/utils/CrudUtils.js +25 -16
  31. package/dist/components/ContinuousInsertUtils.js +25 -16
  32. package/dist/components/DataFetcher.js +7 -5
  33. package/dist/components/snk-application2.js +95 -53
  34. package/dist/esm/{ConfigStorage-7b36d041.js → ConfigStorage-6514d66e.js} +2 -2
  35. package/dist/esm/{ContinuousInsertUtils-3e520a07.js → ContinuousInsertUtils-b62906f9.js} +29 -20
  36. package/dist/esm/{DataFetcher-a9c598f2.js → DataFetcher-5034df59.js} +7 -5
  37. package/dist/esm/{SnkFormConfigManager-f1a0fc92.js → SnkFormConfigManager-b409c745.js} +2 -2
  38. package/dist/esm/{auth-fetcher-749d880f.js → auth-fetcher-ca5d3a49.js} +1 -1
  39. package/dist/esm/{dataunit-fetcher-fd58c640.js → dataunit-fetcher-56cb648b.js} +1 -1
  40. package/dist/esm/{form-config-fetcher-adbe5d34.js → form-config-fetcher-a7d3e277.js} +1 -1
  41. package/dist/esm/{pesquisa-fetcher-50fc7e6b.js → pesquisa-fetcher-6bc2e41a.js} +1 -1
  42. package/dist/esm/snk-actions-button_4.entry.js +5 -5
  43. package/dist/esm/snk-application.entry.js +101 -59
  44. package/dist/esm/snk-attach.entry.js +5 -5
  45. package/dist/esm/snk-config-options_3.entry.js +4 -4
  46. package/dist/esm/snk-crud.entry.js +5 -5
  47. package/dist/esm/snk-data-exporter.entry.js +5 -5
  48. package/dist/esm/{snk-data-unit-590225b5.js → snk-data-unit-618e0b80.js} +1 -1
  49. package/dist/esm/snk-data-unit.entry.js +3 -3
  50. package/dist/esm/snk-detail-view.entry.js +7 -7
  51. package/dist/esm/snk-filter-bar_4.entry.js +3 -3
  52. package/dist/esm/snk-filter-modal-item.entry.js +3 -3
  53. package/dist/esm/snk-grid.entry.js +6 -6
  54. package/dist/esm/{snk-guides-viewer-2f4dcdc5.js → snk-guides-viewer-18453d98.js} +5 -5
  55. package/dist/esm/snk-guides-viewer.entry.js +7 -7
  56. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  57. package/dist/esm/snk-simple-crud.entry.js +7 -7
  58. package/dist/sankhyablocks/{p-f3434fc4.js → p-00278e07.js} +1 -1
  59. package/dist/sankhyablocks/{p-fadc8339.js → p-0e206e62.js} +1 -1
  60. package/dist/sankhyablocks/{p-0e320bd2.entry.js → p-0e250436.entry.js} +1 -1
  61. package/dist/sankhyablocks/{p-06421fdb.js → p-126c58ea.js} +1 -1
  62. package/dist/sankhyablocks/{p-656f0e51.entry.js → p-1dbd5c18.entry.js} +1 -1
  63. package/dist/sankhyablocks/{p-7bd9683d.js → p-2aebe5b6.js} +1 -1
  64. package/dist/sankhyablocks/{p-fa6c5826.entry.js → p-30ebcbe0.entry.js} +1 -1
  65. package/dist/sankhyablocks/{p-8a9638ae.js → p-341465ce.js} +2 -2
  66. package/dist/sankhyablocks/{p-052213ba.entry.js → p-3858a2e4.entry.js} +1 -1
  67. package/dist/sankhyablocks/{p-47bce500.js → p-47d24ac8.js} +1 -1
  68. package/dist/sankhyablocks/p-4fd06221.entry.js +1 -0
  69. package/dist/sankhyablocks/{p-275de842.entry.js → p-563b7c28.entry.js} +1 -1
  70. package/dist/sankhyablocks/{p-72c10005.entry.js → p-9c3138f5.entry.js} +1 -1
  71. package/dist/sankhyablocks/{p-4d9549cf.js → p-9ffd9fc7.js} +1 -1
  72. package/dist/sankhyablocks/{p-0b6cd238.entry.js → p-a2c790ac.entry.js} +1 -1
  73. package/dist/sankhyablocks/{p-fd13b4d2.js → p-a75e9dcc.js} +1 -1
  74. package/dist/sankhyablocks/{p-212213d9.entry.js → p-aa003d4e.entry.js} +1 -1
  75. package/dist/sankhyablocks/p-aaf94476.js +1 -0
  76. package/dist/sankhyablocks/{p-583517ba.entry.js → p-c1adf0dd.entry.js} +1 -1
  77. package/dist/sankhyablocks/p-da87e42c.entry.js +11 -0
  78. package/dist/sankhyablocks/p-e4391e16.js +1 -0
  79. package/dist/sankhyablocks/{p-5e51e833.entry.js → p-f0aaad2b.entry.js} +1 -1
  80. package/dist/sankhyablocks/{p-cefb0ee1.entry.js → p-f7d76646.entry.js} +1 -1
  81. package/dist/sankhyablocks/{p-fb34e0cf.entry.js → p-fca0e5cc.entry.js} +1 -1
  82. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  83. package/dist/types/components/snk-application/request-listener/DebouncedRequestListener.d.ts +11 -0
  84. package/dist/types/components/snk-application/request-listener/RequestListenerFactory.d.ts +12 -0
  85. package/dist/types/components/snk-application/request-listener/RequestListenerLoadingBar.d.ts +13 -0
  86. package/dist/types/components/snk-application/snk-application.d.ts +3 -12
  87. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -0
  88. package/dist/types/lib/utils/CrudUtils.d.ts +1 -0
  89. package/package.json +1 -1
  90. package/dist/sankhyablocks/p-9f9b99d9.js +0 -1
  91. package/dist/sankhyablocks/p-ab1645fb.entry.js +0 -1
  92. package/dist/sankhyablocks/p-ca5ec380.js +0 -1
  93. package/dist/sankhyablocks/p-dbe6174a.entry.js +0 -11
@@ -274,6 +274,99 @@ class SnkErrorHandler {
274
274
  }
275
275
  }
276
276
 
277
+ class DebouncedRequestListener {
278
+ constructor() {
279
+ this._debounceTime = 1500;
280
+ this.requests = new Map();
281
+ this.requestsLoadingBar = [];
282
+ }
283
+ onRequestStart(param) {
284
+ if (param.url.includes("quietMode=true")) {
285
+ return;
286
+ }
287
+ this.requestsLoadingBar.push(param.requestId);
288
+ const timeout = setTimeout(() => {
289
+ this.ezLoadingBar.show();
290
+ }, this._debounceTime);
291
+ this.requests.set(param.requestId, timeout);
292
+ }
293
+ ;
294
+ onRequestEnd(param) {
295
+ const timeoutId = this.requests.get(param.requestId);
296
+ clearTimeout(timeoutId);
297
+ if (this.requestsLoadingBar.includes(param.requestId)) {
298
+ this.requestsLoadingBar = this.requestsLoadingBar.filter(id => id !== param.requestId);
299
+ !this.requestsLoadingBar.length && this.ezLoadingBar.hide();
300
+ }
301
+ }
302
+ ;
303
+ }
304
+
305
+ class RequestListenerLoadingBar {
306
+ constructor() {
307
+ this._debounceTime = 1000;
308
+ this._ignoredNameTypes = ["totals"];
309
+ this._countRequest = 0;
310
+ }
311
+ onRequestStart(param) {
312
+ if (this.isIgnoreLoadingOnRequest(param)) {
313
+ return;
314
+ }
315
+ this._countRequest++;
316
+ this.ezLoadingBar.show();
317
+ if (this._timerLoading) {
318
+ clearTimeout(this._timerLoading);
319
+ }
320
+ }
321
+ ;
322
+ onRequestEnd(param) {
323
+ if (this.isIgnoreLoadingOnRequest(param)) {
324
+ return;
325
+ }
326
+ this._countRequest--;
327
+ this._timerLoading = setTimeout(() => {
328
+ if (this._countRequest <= 0) {
329
+ this.ezLoadingBar.hide();
330
+ }
331
+ }, this._debounceTime);
332
+ }
333
+ ;
334
+ isIgnoreLoadingOnRequest(param) {
335
+ if (param == undefined) {
336
+ return false;
337
+ }
338
+ if (param.url.includes("quietMode=true")) {
339
+ return true;
340
+ }
341
+ if (param.requestBody == undefined) {
342
+ return false;
343
+ }
344
+ if (param.requestBody.length == 1) {
345
+ const { name } = param.requestBody[0].variables;
346
+ if (name) {
347
+ const nameParts = name.split(":");
348
+ const nameType = nameParts[0];
349
+ return this._ignoredNameTypes.indexOf(nameType) >= 0;
350
+ }
351
+ }
352
+ return false;
353
+ }
354
+ ;
355
+ }
356
+
357
+ class RequestListenerFactory {
358
+ static create({ strategy }) {
359
+ switch (strategy) {
360
+ case 'request_name':
361
+ return new RequestListenerLoadingBar();
362
+ case 'request_time':
363
+ return new DebouncedRequestListener();
364
+ default:
365
+ throw new Error('Strategy not found');
366
+ }
367
+ }
368
+ }
369
+
277
370
  const snkApplicationCss = ".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";
278
371
 
279
372
  const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
@@ -288,7 +381,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
288
381
  this._waitingAppReady = new Array();
289
382
  this._duCache = new Map();
290
383
  this._duPromises = new Map();
291
- this._requestListener = new RequestListenerLoadingBar();
384
+ this._requestListener = RequestListenerFactory.create({ strategy: 'request_time' });
292
385
  this._pendingActions = new Map;
293
386
  this._loadPkParameter = null;
294
387
  this._isLoadedByPk = false;
@@ -1262,7 +1355,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
1262
1355
  .unbind("F1");
1263
1356
  }
1264
1357
  render() {
1265
- return (h("div", null, h("ez-loading-bar", { ref: (ref) => this._requestListener.loadingBar = ref }), h("ez-popup", { opened: false, ref: (ref) => this._popUp = ref, onEzClosePopup: () => this.closePopUp() }), h("ez-modal", { opened: false, ref: (ref) => this._rightModal = ref, "modal-size": "small", closeOutsideClick: true, closeEsc: true })));
1358
+ return (h("div", null, h("ez-loading-bar", { ref: (ref) => this._requestListener.ezLoadingBar = ref }), h("ez-popup", { opened: false, ref: (ref) => this._popUp = ref, onEzClosePopup: () => this.closePopUp() }), h("ez-modal", { opened: false, ref: (ref) => this._rightModal = ref, "modal-size": "small", closeOutsideClick: true, closeEsc: true })));
1266
1359
  }
1267
1360
  get _element() { return this; }
1268
1361
  static get watchers() { return {
@@ -1326,57 +1419,6 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
1326
1419
  "whenApplicationReady": [64],
1327
1420
  "setSearchFilterContext": [64]
1328
1421
  }]);
1329
- class RequestListenerLoadingBar {
1330
- constructor() {
1331
- this._debounceTime = 1000;
1332
- this._ignoredNameTypes = ["totals"];
1333
- this._countRequest = 0;
1334
- }
1335
- onRequestStart(param) {
1336
- if (this.isIgnoreLoadingOnRequest(param)) {
1337
- return;
1338
- }
1339
- this._countRequest++;
1340
- this.loadingBar.show();
1341
- if (this._timerLoading) {
1342
- clearTimeout(this._timerLoading);
1343
- }
1344
- }
1345
- ;
1346
- onRequestEnd(param) {
1347
- if (this.isIgnoreLoadingOnRequest(param)) {
1348
- return;
1349
- }
1350
- this._countRequest--;
1351
- this._timerLoading = setTimeout(() => {
1352
- if (this._countRequest <= 0) {
1353
- this.loadingBar.hide();
1354
- }
1355
- }, this._debounceTime);
1356
- }
1357
- ;
1358
- isIgnoreLoadingOnRequest(param) {
1359
- if (param == undefined) {
1360
- return false;
1361
- }
1362
- if (param.url.includes("quietMode=true")) {
1363
- return true;
1364
- }
1365
- if (param.requestBody == undefined) {
1366
- return false;
1367
- }
1368
- if (param.requestBody.length == 1) {
1369
- const { name } = param.requestBody[0].variables;
1370
- if (name) {
1371
- const nameParts = name.split(":");
1372
- const nameType = nameParts[0];
1373
- return this._ignoredNameTypes.indexOf(nameType) >= 0;
1374
- }
1375
- }
1376
- return false;
1377
- }
1378
- ;
1379
- }
1380
1422
  class PendingPromise {
1381
1423
  constructor(resolve, reject) {
1382
1424
  this.resolve = resolve;
@@ -1,7 +1,7 @@
1
- import { R as ResourceFetcher, F as FormConfigFetcher } from './form-config-fetcher-adbe5d34.js';
1
+ import { R as ResourceFetcher, F as FormConfigFetcher } from './form-config-fetcher-a7d3e277.js';
2
2
  import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
3
3
  import { ObjectUtils } from '@sankhyalabs/core';
4
- import { d as dist, D as DataFetcher } from './DataFetcher-a9c598f2.js';
4
+ import { d as dist, D as DataFetcher } from './DataFetcher-5034df59.js';
5
5
 
6
6
  class GridConfigFetcher extends ResourceFetcher {
7
7
  constructor() {
@@ -1,13 +1,13 @@
1
- import { D as DataFetcher } from './DataFetcher-a9c598f2.js';
2
- import './pesquisa-fetcher-50fc7e6b.js';
1
+ import { D as DataFetcher } from './DataFetcher-5034df59.js';
2
+ import './pesquisa-fetcher-6bc2e41a.js';
3
3
  import { SortMode, ApplicationContext, UserInterface, DateUtils, ObjectUtils, StringUtils, NumberUtils, DataType } from '@sankhyalabs/core';
4
4
  import './index-3aa4977a.js';
5
5
  import './ISave-d8c8bc59.js';
6
6
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
7
7
  import { UserInterface as UserInterface$1 } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
8
- import { P as PreloadManager } from './dataunit-fetcher-fd58c640.js';
8
+ import { P as PreloadManager } from './dataunit-fetcher-56cb648b.js';
9
9
  import './filter-item-type.enum-d45e026f.js';
10
- import './form-config-fetcher-adbe5d34.js';
10
+ import './form-config-fetcher-a7d3e277.js';
11
11
  import InMemoryFilterColumnDataSource from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
12
12
  import { h } from './index-a7d3d3f1.js';
13
13
 
@@ -24,6 +24,28 @@ class CrudUtils {
24
24
  });
25
25
  }
26
26
  }
27
+ static parseCrudResults(entities, onlyFirst) {
28
+ if (!Array.isArray(entities)) {
29
+ entities = [entities];
30
+ }
31
+ const crudFindResults = [];
32
+ for (const entity of entities) {
33
+ let crudFindResult = {
34
+ fields: new Map()
35
+ };
36
+ for (let key in entity) {
37
+ let fieldValue = entity[key];
38
+ if (fieldValue.hasOwnProperty('$')) {
39
+ crudFindResult.fields.set(key, fieldValue.$);
40
+ }
41
+ if (onlyFirst) {
42
+ break;
43
+ }
44
+ }
45
+ crudFindResults.push(crudFindResult);
46
+ }
47
+ return crudFindResults.length > 1 ? crudFindResults : crudFindResults[0];
48
+ }
27
49
  static find(entityName, fields, criteria, onlyFirst = true, criteriaExpression, orderBy) {
28
50
  const SERVICE_CRUD_FIND = "mge@crud.find";
29
51
  let parsedFields = [];
@@ -71,24 +93,11 @@ class CrudUtils {
71
93
  DataFetcher.get().callServiceBroker(SERVICE_CRUD_FIND, JSON.stringify(request)).then((result) => {
72
94
  var _a;
73
95
  let entities = (_a = result.entidades) === null || _a === void 0 ? void 0 : _a.entidade;
74
- if (entities != undefined) {
75
- let crudFindResult = {
76
- fields: new Map()
77
- };
78
- for (let key in entities) {
79
- let fieldValue = entities[key];
80
- if (fieldValue.hasOwnProperty('$')) {
81
- crudFindResult.fields.set(key, fieldValue.$);
82
- }
83
- if (onlyFirst) {
84
- break;
85
- }
86
- }
87
- resolve(crudFindResult);
88
- }
89
- else {
96
+ if (!entities) {
90
97
  resolve(null);
91
98
  }
99
+ const crudFindResults = this.parseCrudResults(entities, onlyFirst);
100
+ resolve(crudFindResults);
92
101
  });
93
102
  });
94
103
  }
@@ -6777,7 +6777,8 @@ class DataFetcher {
6777
6777
  }
6778
6778
  payloadJson['requestBody']['clientEventList'].clientEvent.push({ $: key });
6779
6779
  }
6780
- DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: payload }));
6780
+ const requestId = StringUtils.generateUUID();
6781
+ DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: payload, requestId }));
6781
6782
  http.open("POST", url, true);
6782
6783
  http.withCredentials = true;
6783
6784
  http.send(ObjectUtils.objectToString(payloadJson));
@@ -6817,7 +6818,7 @@ class DataFetcher {
6817
6818
  else if (http.readyState == 4 && http.status != 200) {
6818
6819
  reject(new ErrorException(`Erro ao executar serviço: ${serviceName}`, http.responseText));
6819
6820
  }
6820
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: payload }));
6821
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: payload, requestId }));
6821
6822
  };
6822
6823
  });
6823
6824
  }
@@ -6922,7 +6923,8 @@ class DataFetcher {
6922
6923
  const errorsResponse = [];
6923
6924
  const responseExtensions = [];
6924
6925
  const url = this.buildGraphQlURL(quietMode);
6925
- DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url, requestBody: request }));
6926
+ const requestId = StringUtils.generateUUID();
6927
+ DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url, requestBody: request, requestId }));
6926
6928
  try {
6927
6929
  const response = await dist.batchRequests(url, request, { 'Content-Type': `application/json; charset=${window['SERVER_ENCODING'] || 'UTF-8'}` });
6928
6930
  response.forEach((resItem, index) => {
@@ -6956,11 +6958,11 @@ class DataFetcher {
6956
6958
  });
6957
6959
  }
6958
6960
  else {
6959
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request }));
6961
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request, requestId }));
6960
6962
  throw new ErrorException("Falha de comunicação", err.message);
6961
6963
  }
6962
6964
  }
6963
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request }));
6965
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request, requestId }));
6964
6966
  return { data: dataResponse, errors: errorsResponse, extensions: responseExtensions };
6965
6967
  }
6966
6968
  isHttpError(err) {
@@ -1,6 +1,6 @@
1
- import { C as ConfigStorage } from './ConfigStorage-7b36d041.js';
1
+ import { C as ConfigStorage } from './ConfigStorage-6514d66e.js';
2
2
  import { ObjectUtils, StringUtils } from '@sankhyalabs/core';
3
- import { F as FormConfigFetcher } from './form-config-fetcher-adbe5d34.js';
3
+ import { F as FormConfigFetcher } from './form-config-fetcher-a7d3e277.js';
4
4
  import { b as TAB_NAMES } from './constants-7302ee87.js';
5
5
 
6
6
  class SnkFormConfigManager {
@@ -1,5 +1,5 @@
1
1
  import { ObjectUtils } from '@sankhyalabs/core';
2
- import { R as ResourceFetcher } from './form-config-fetcher-adbe5d34.js';
2
+ import { R as ResourceFetcher } from './form-config-fetcher-a7d3e277.js';
3
3
 
4
4
  class AuthFetcher extends ResourceFetcher {
5
5
  getData(resourceID) {
@@ -1,5 +1,5 @@
1
1
  import { ObjectUtils, DataUnit, DataType, DateUtils, StringUtils, ChangeOperation, ApplicationContext, UserInterface, DataUnitStorage } from '@sankhyalabs/core';
2
- import { D as DataFetcher, d as dist } from './DataFetcher-a9c598f2.js';
2
+ import { D as DataFetcher, d as dist } from './DataFetcher-5034df59.js';
3
3
  import { DISTINCT_FILTER_NAME_PREFIX } from '@sankhyalabs/ezui/dist/collection/utils/constants';
4
4
  import { DataUnitTransient } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
5
5
  import { ColumnFilterManager } from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
@@ -1,4 +1,4 @@
1
- import { d as dist, D as DataFetcher } from './DataFetcher-a9c598f2.js';
1
+ import { d as dist, D as DataFetcher } from './DataFetcher-5034df59.js';
2
2
  import { ObjectUtils } from '@sankhyalabs/core';
3
3
 
4
4
  class ResourceFetcher {
@@ -1,5 +1,5 @@
1
1
  import { DataType, ApplicationContext } from '@sankhyalabs/core';
2
- import { d as dist, D as DataFetcher } from './DataFetcher-a9c598f2.js';
2
+ import { d as dist, D as DataFetcher } from './DataFetcher-5034df59.js';
3
3
 
4
4
  class PesquisaFetcher {
5
5
  constructor() {
@@ -1,20 +1,20 @@
1
1
  import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-a7d3d3f1.js';
2
2
  import { ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils, DateUtils, ArrayUtils, ElementIDUtils } from '@sankhyalabs/core';
3
- import { D as DataFetcher } from './DataFetcher-a9c598f2.js';
3
+ import { D as DataFetcher } from './DataFetcher-5034df59.js';
4
4
  import { P as ParamType } from './ParamType-d5152b06.js';
5
- import './pesquisa-fetcher-50fc7e6b.js';
5
+ import './pesquisa-fetcher-6bc2e41a.js';
6
6
  import './index-3aa4977a.js';
7
7
  import './ISave-d8c8bc59.js';
8
8
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
9
9
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
10
- import './dataunit-fetcher-fd58c640.js';
10
+ import './dataunit-fetcher-56cb648b.js';
11
11
  import './filter-item-type.enum-d45e026f.js';
12
- import './form-config-fetcher-adbe5d34.js';
12
+ import './form-config-fetcher-a7d3e277.js';
13
13
  import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo-9fa41508.js';
14
14
  import { R as ResourceIDUtils } from './ResourceIDUtils-a114189a.js';
15
15
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
16
16
  import { CheckMode } from '@sankhyalabs/ezui/dist/collection/components/ez-check/CheckMode';
17
- import { C as ConfigStorage } from './ConfigStorage-7b36d041.js';
17
+ import { C as ConfigStorage } from './ConfigStorage-6514d66e.js';
18
18
  import { O as ORDER_VALUES } from './constants-7302ee87.js';
19
19
  import './PrintUtils-3e4ff0f5.js';
20
20
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
@@ -1,13 +1,13 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement } from './index-a7d3d3f1.js';
2
2
  import { DateUtils, StringUtils, ObjectUtils, WaitingChangeException, WarningException, ErrorException, KeyboardManager, OnboardingUtils, DependencyType, ArrayUtils, SearchUtils, ElementIDUtils, ApplicationContext, DataType, ErrorTracking } from '@sankhyalabs/core';
3
3
  import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
4
- import { C as ConfigStorage } from './ConfigStorage-7b36d041.js';
5
- import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher-a9c598f2.js';
6
- import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher-749d880f.js';
7
- import { D as DataUnitFetcher } from './dataunit-fetcher-fd58c640.js';
8
- import { P as PesquisaFetcher } from './pesquisa-fetcher-50fc7e6b.js';
4
+ import { C as ConfigStorage } from './ConfigStorage-6514d66e.js';
5
+ import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher-5034df59.js';
6
+ import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher-ca5d3a49.js';
7
+ import { D as DataUnitFetcher } from './dataunit-fetcher-56cb648b.js';
8
+ import { P as PesquisaFetcher } from './pesquisa-fetcher-6bc2e41a.js';
9
9
  import { S as SnkMessageBuilder } from './SnkMessageBuilder-6fff4a4c.js';
10
- import './form-config-fetcher-adbe5d34.js';
10
+ import './form-config-fetcher-a7d3e277.js';
11
11
  import './filter-item-type.enum-d45e026f.js';
12
12
  import './PrintUtils-3e4ff0f5.js';
13
13
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
@@ -281,6 +281,99 @@ class SnkErrorHandler {
281
281
  }
282
282
  }
283
283
 
284
+ class DebouncedRequestListener {
285
+ constructor() {
286
+ this._debounceTime = 1500;
287
+ this.requests = new Map();
288
+ this.requestsLoadingBar = [];
289
+ }
290
+ onRequestStart(param) {
291
+ if (param.url.includes("quietMode=true")) {
292
+ return;
293
+ }
294
+ this.requestsLoadingBar.push(param.requestId);
295
+ const timeout = setTimeout(() => {
296
+ this.ezLoadingBar.show();
297
+ }, this._debounceTime);
298
+ this.requests.set(param.requestId, timeout);
299
+ }
300
+ ;
301
+ onRequestEnd(param) {
302
+ const timeoutId = this.requests.get(param.requestId);
303
+ clearTimeout(timeoutId);
304
+ if (this.requestsLoadingBar.includes(param.requestId)) {
305
+ this.requestsLoadingBar = this.requestsLoadingBar.filter(id => id !== param.requestId);
306
+ !this.requestsLoadingBar.length && this.ezLoadingBar.hide();
307
+ }
308
+ }
309
+ ;
310
+ }
311
+
312
+ class RequestListenerLoadingBar {
313
+ constructor() {
314
+ this._debounceTime = 1000;
315
+ this._ignoredNameTypes = ["totals"];
316
+ this._countRequest = 0;
317
+ }
318
+ onRequestStart(param) {
319
+ if (this.isIgnoreLoadingOnRequest(param)) {
320
+ return;
321
+ }
322
+ this._countRequest++;
323
+ this.ezLoadingBar.show();
324
+ if (this._timerLoading) {
325
+ clearTimeout(this._timerLoading);
326
+ }
327
+ }
328
+ ;
329
+ onRequestEnd(param) {
330
+ if (this.isIgnoreLoadingOnRequest(param)) {
331
+ return;
332
+ }
333
+ this._countRequest--;
334
+ this._timerLoading = setTimeout(() => {
335
+ if (this._countRequest <= 0) {
336
+ this.ezLoadingBar.hide();
337
+ }
338
+ }, this._debounceTime);
339
+ }
340
+ ;
341
+ isIgnoreLoadingOnRequest(param) {
342
+ if (param == undefined) {
343
+ return false;
344
+ }
345
+ if (param.url.includes("quietMode=true")) {
346
+ return true;
347
+ }
348
+ if (param.requestBody == undefined) {
349
+ return false;
350
+ }
351
+ if (param.requestBody.length == 1) {
352
+ const { name } = param.requestBody[0].variables;
353
+ if (name) {
354
+ const nameParts = name.split(":");
355
+ const nameType = nameParts[0];
356
+ return this._ignoredNameTypes.indexOf(nameType) >= 0;
357
+ }
358
+ }
359
+ return false;
360
+ }
361
+ ;
362
+ }
363
+
364
+ class RequestListenerFactory {
365
+ static create({ strategy }) {
366
+ switch (strategy) {
367
+ case 'request_name':
368
+ return new RequestListenerLoadingBar();
369
+ case 'request_time':
370
+ return new DebouncedRequestListener();
371
+ default:
372
+ throw new Error('Strategy not found');
373
+ }
374
+ }
375
+ }
376
+
284
377
  const snkApplicationCss = ".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";
285
378
 
286
379
  const SnkApplication = class {
@@ -294,7 +387,7 @@ const SnkApplication = class {
294
387
  this._waitingAppReady = new Array();
295
388
  this._duCache = new Map();
296
389
  this._duPromises = new Map();
297
- this._requestListener = new RequestListenerLoadingBar();
390
+ this._requestListener = RequestListenerFactory.create({ strategy: 'request_time' });
298
391
  this._pendingActions = new Map;
299
392
  this._loadPkParameter = null;
300
393
  this._isLoadedByPk = false;
@@ -1268,64 +1361,13 @@ const SnkApplication = class {
1268
1361
  .unbind("F1");
1269
1362
  }
1270
1363
  render() {
1271
- return (h("div", null, h("ez-loading-bar", { ref: (ref) => this._requestListener.loadingBar = ref }), h("ez-popup", { opened: false, ref: (ref) => this._popUp = ref, onEzClosePopup: () => this.closePopUp() }), h("ez-modal", { opened: false, ref: (ref) => this._rightModal = ref, "modal-size": "small", closeOutsideClick: true, closeEsc: true })));
1364
+ return (h("div", null, h("ez-loading-bar", { ref: (ref) => this._requestListener.ezLoadingBar = ref }), h("ez-popup", { opened: false, ref: (ref) => this._popUp = ref, onEzClosePopup: () => this.closePopUp() }), h("ez-modal", { opened: false, ref: (ref) => this._rightModal = ref, "modal-size": "small", closeOutsideClick: true, closeEsc: true })));
1272
1365
  }
1273
1366
  get _element() { return getElement(this); }
1274
1367
  static get watchers() { return {
1275
1368
  "loadByPK": ["watchPropHandler"]
1276
1369
  }; }
1277
1370
  };
1278
- class RequestListenerLoadingBar {
1279
- constructor() {
1280
- this._debounceTime = 1000;
1281
- this._ignoredNameTypes = ["totals"];
1282
- this._countRequest = 0;
1283
- }
1284
- onRequestStart(param) {
1285
- if (this.isIgnoreLoadingOnRequest(param)) {
1286
- return;
1287
- }
1288
- this._countRequest++;
1289
- this.loadingBar.show();
1290
- if (this._timerLoading) {
1291
- clearTimeout(this._timerLoading);
1292
- }
1293
- }
1294
- ;
1295
- onRequestEnd(param) {
1296
- if (this.isIgnoreLoadingOnRequest(param)) {
1297
- return;
1298
- }
1299
- this._countRequest--;
1300
- this._timerLoading = setTimeout(() => {
1301
- if (this._countRequest <= 0) {
1302
- this.loadingBar.hide();
1303
- }
1304
- }, this._debounceTime);
1305
- }
1306
- ;
1307
- isIgnoreLoadingOnRequest(param) {
1308
- if (param == undefined) {
1309
- return false;
1310
- }
1311
- if (param.url.includes("quietMode=true")) {
1312
- return true;
1313
- }
1314
- if (param.requestBody == undefined) {
1315
- return false;
1316
- }
1317
- if (param.requestBody.length == 1) {
1318
- const { name } = param.requestBody[0].variables;
1319
- if (name) {
1320
- const nameParts = name.split(":");
1321
- const nameType = nameParts[0];
1322
- return this._ignoredNameTypes.indexOf(nameType) >= 0;
1323
- }
1324
- }
1325
- return false;
1326
- }
1327
- ;
1328
- }
1329
1371
  class PendingPromise {
1330
1372
  constructor(resolve, reject) {
1331
1373
  this.resolve = resolve;
@@ -1,14 +1,14 @@
1
1
  import { r as registerInstance, c as createEvent, h } from './index-a7d3d3f1.js';
2
2
  import { ApplicationContext, DataType, Action, UserInterface, StringUtils, DataUnit } from '@sankhyalabs/core';
3
- import { D as DataFetcher } from './DataFetcher-a9c598f2.js';
4
- import './pesquisa-fetcher-50fc7e6b.js';
3
+ import { D as DataFetcher } from './DataFetcher-5034df59.js';
4
+ import './pesquisa-fetcher-6bc2e41a.js';
5
5
  import './index-3aa4977a.js';
6
6
  import { S as SaveErrorsEnum } from './ISave-d8c8bc59.js';
7
- import { P as PreloadManager, b as buildLoadDataResponse, D as DataUnitFetcher, I as InMemoryLoader } from './dataunit-fetcher-fd58c640.js';
7
+ import { P as PreloadManager, b as buildLoadDataResponse, D as DataUnitFetcher, I as InMemoryLoader } from './dataunit-fetcher-56cb648b.js';
8
8
  import './filter-item-type.enum-d45e026f.js';
9
- import './form-config-fetcher-adbe5d34.js';
9
+ import './form-config-fetcher-a7d3e277.js';
10
10
  import { V as VIEW_MODE } from './constants-7302ee87.js';
11
- import { A as AutorizationType } from './auth-fetcher-749d880f.js';
11
+ import { A as AutorizationType } from './auth-fetcher-ca5d3a49.js';
12
12
  import { T as TaskbarElement } from './taskbar-elements-d59867f1.js';
13
13
  import './PrintUtils-3e4ff0f5.js';
14
14
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
@@ -3,14 +3,14 @@ import { UserInterface, ObjectUtils, StringUtils, ApplicationContext, ElementIDU
3
3
  import { DataType, getConvertedValue } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
4
4
  import { CheckMode, ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
5
5
  import { c as VARS_BY_TYPE, D as DEFAULT_TYPE, d as TAGS_BY_TYPE, C as CONFIG_EVENTS, a as CONFIG_SORTABLE_EVENTS, b as TAB_NAMES, A as ACTION_CONFIG } from './constants-7302ee87.js';
6
- import { S as SnkFormConfigManager } from './SnkFormConfigManager-f1a0fc92.js';
6
+ import { S as SnkFormConfigManager } from './SnkFormConfigManager-b409c745.js';
7
7
  import { R as ResourceIDUtils } from './ResourceIDUtils-a114189a.js';
8
8
  import { S as Sortable } from './Sortable-83960219.js';
9
- import { U as UserConfigType } from './form-config-fetcher-adbe5d34.js';
9
+ import { U as UserConfigType } from './form-config-fetcher-a7d3e277.js';
10
10
  import { buildFormConfigFromDataUnit } from '@sankhyalabs/ezui/dist/collection/utils/form';
11
- import './ConfigStorage-7b36d041.js';
11
+ import './ConfigStorage-6514d66e.js';
12
12
  import './filter-item-type.enum-d45e026f.js';
13
- import './DataFetcher-a9c598f2.js';
13
+ import './DataFetcher-5034df59.js';
14
14
  import './PrintUtils-3e4ff0f5.js';
15
15
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
16
16
 
@@ -1,17 +1,17 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a7d3d3f1.js';
2
2
  import { StringUtils, ElementIDUtils, ApplicationContext, JSUtils, FloatingManager } from '@sankhyalabs/core';
3
3
  import { T as TaskbarElement } from './taskbar-elements-d59867f1.js';
4
- import './DataFetcher-a9c598f2.js';
5
- import './pesquisa-fetcher-50fc7e6b.js';
4
+ import './DataFetcher-5034df59.js';
5
+ import './pesquisa-fetcher-6bc2e41a.js';
6
6
  import { P as PresentationMode } from './index-3aa4977a.js';
7
7
  import './ISave-d8c8bc59.js';
8
8
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
9
9
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
10
- import './dataunit-fetcher-fd58c640.js';
10
+ import './dataunit-fetcher-56cb648b.js';
11
11
  import './filter-item-type.enum-d45e026f.js';
12
- import './form-config-fetcher-adbe5d34.js';
12
+ import './form-config-fetcher-a7d3e277.js';
13
13
  import { V as VIEW_MODE } from './constants-7302ee87.js';
14
- import { A as AutorizationType } from './auth-fetcher-749d880f.js';
14
+ import { A as AutorizationType } from './auth-fetcher-ca5d3a49.js';
15
15
  import './index-bdf75557.js';
16
16
  import './PrintUtils-3e4ff0f5.js';
17
17
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
@@ -3,15 +3,15 @@ import { ApplicationContext, ObjectUtils, UserInterface, DataType, ElementIDUtil
3
3
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  import { D as DataExporterOption, a as DataExporterType, b as DataExporterFormat } from './index-3aa4977a.js';
5
5
  import { R as REPORT_LAUNCHER_RESOURCE_ID } from './constants-7302ee87.js';
6
- import { D as DataFetcher } from './DataFetcher-a9c598f2.js';
7
- import { S as SnkDataUnit } from './snk-data-unit-590225b5.js';
8
- import './pesquisa-fetcher-50fc7e6b.js';
6
+ import { D as DataFetcher } from './DataFetcher-5034df59.js';
7
+ import { S as SnkDataUnit } from './snk-data-unit-618e0b80.js';
8
+ import './pesquisa-fetcher-6bc2e41a.js';
9
9
  import './ISave-d8c8bc59.js';
10
10
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
11
11
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
12
- import './dataunit-fetcher-fd58c640.js';
12
+ import './dataunit-fetcher-56cb648b.js';
13
13
  import './filter-item-type.enum-d45e026f.js';
14
- import './form-config-fetcher-adbe5d34.js';
14
+ import './form-config-fetcher-a7d3e277.js';
15
15
  import './PrintUtils-3e4ff0f5.js';
16
16
  import './SnkMessageBuilder-6fff4a4c.js';
17
17
  import '@sankhyalabs/core/dist/dataunit/metadata/DataType';
@@ -2,7 +2,7 @@ import { r as registerInstance, c as createEvent, h, g as getElement, H as Host
2
2
  import { Action, ObjectUtils, DataUnitAction, StringUtils, ApplicationContext } from '@sankhyalabs/core';
3
3
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  import { O as OperationMap, S as SnkMessageBuilder } from './SnkMessageBuilder-6fff4a4c.js';
5
- import { g as getRecordValue, a as DatasetStrategy } from './dataunit-fetcher-fd58c640.js';
5
+ import { g as getRecordValue, a as DatasetStrategy } from './dataunit-fetcher-56cb648b.js';
6
6
  import { convertType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
7
7
  import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo-9fa41508.js';
8
8