@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-72074.0 → 0.0.0-bugfix-dev-KB-74246.1

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 (138) hide show
  1. package/dist/cjs/{ConfigStorage-ecc0ed20.js → ConfigStorage-f079f5fd.js} +2 -2
  2. package/dist/cjs/{ContinuousInsertUtils-29b65619.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-bff848f1.js} +5 -5
  5. package/dist/cjs/{auth-fetcher-d68841bc.js → auth-fetcher-4f853233.js} +1 -1
  6. package/dist/cjs/{dataunit-fetcher-f89461c1.js → dataunit-fetcher-228016f4.js} +3 -3
  7. package/dist/cjs/{form-config-fetcher-ed497282.js → form-config-fetcher-39397ac5.js} +1 -1
  8. package/dist/cjs/index-f9e81701.js +8 -28
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/cjs/{pesquisa-fetcher-ca89181c.js → pesquisa-fetcher-a9bfeb22.js} +7 -2
  11. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  12. package/dist/cjs/snk-actions-button_4.cjs.entry.js +5 -5
  13. package/dist/cjs/snk-application.cjs.entry.js +101 -59
  14. package/dist/cjs/snk-attach.cjs.entry.js +5 -5
  15. package/dist/cjs/{snk-form-config.cjs.entry.js → snk-config-options_3.cjs.entry.js} +365 -3
  16. package/dist/cjs/snk-crud.cjs.entry.js +5 -5
  17. package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -5
  18. package/dist/cjs/{snk-data-unit-668dc5e8.js → snk-data-unit-3d4d0e2a.js} +1 -1
  19. package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
  20. package/dist/cjs/snk-detail-view.cjs.entry.js +7 -7
  21. package/dist/cjs/{snk-filter-bar.cjs.entry.js → snk-filter-bar_4.cjs.entry.js} +688 -3
  22. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
  23. package/dist/cjs/snk-grid.cjs.entry.js +6 -6
  24. package/dist/cjs/{snk-guides-viewer-4236cb9d.js → snk-guides-viewer-2b44c804.js} +8 -5
  25. package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
  26. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
  27. package/dist/cjs/snk-simple-crud.cjs.entry.js +10 -8
  28. package/dist/collection/collection-manifest.json +11 -31
  29. package/dist/collection/components/snk-application/request-listener/DebouncedRequestListener.js +28 -0
  30. package/dist/collection/components/snk-application/request-listener/RequestListenerFactory.js +16 -0
  31. package/dist/collection/components/snk-application/request-listener/RequestListenerLoadingBar.js +52 -0
  32. package/dist/collection/components/snk-application/snk-application.js +3 -53
  33. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +3 -0
  34. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +3 -3
  35. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +3 -1
  36. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +8 -6
  37. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +2 -2
  38. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +6 -1
  39. package/dist/collection/lib/utils/CrudUtils.js +25 -16
  40. package/dist/collection/sw.js +46 -0
  41. package/dist/components/ContinuousInsertUtils.js +25 -16
  42. package/dist/components/DataFetcher.js +7 -5
  43. package/dist/components/SnkFormConfigManager.js +3 -3
  44. package/dist/components/dataunit-fetcher.js +2 -2
  45. package/dist/components/pesquisa-fetcher.js +6 -1
  46. package/dist/components/snk-application2.js +95 -53
  47. package/dist/components/snk-detail-view2.js +3 -0
  48. package/dist/components/snk-simple-crud2.js +3 -1
  49. package/dist/esm/{ConfigStorage-7b36d041.js → ConfigStorage-6514d66e.js} +2 -2
  50. package/dist/esm/{ContinuousInsertUtils-30caa626.js → ContinuousInsertUtils-b62906f9.js} +29 -20
  51. package/dist/esm/{DataFetcher-a9c598f2.js → DataFetcher-5034df59.js} +7 -5
  52. package/dist/esm/{SnkFormConfigManager-139f09fa.js → SnkFormConfigManager-f0532f7d.js} +6 -6
  53. package/dist/esm/{auth-fetcher-749d880f.js → auth-fetcher-ca5d3a49.js} +1 -1
  54. package/dist/esm/{constants-8457af36.js → constants-7302ee87.js} +1 -1
  55. package/dist/esm/{dataunit-fetcher-c24c76c6.js → dataunit-fetcher-56cb648b.js} +3 -3
  56. package/dist/esm/{form-config-fetcher-adbe5d34.js → form-config-fetcher-a7d3e277.js} +1 -1
  57. package/dist/esm/index-a7d3d3f1.js +8 -28
  58. package/dist/esm/loader.js +1 -1
  59. package/dist/esm/{pesquisa-fetcher-8edaa8cd.js → pesquisa-fetcher-6bc2e41a.js} +7 -2
  60. package/dist/esm/sankhyablocks.js +1 -1
  61. package/dist/esm/snk-actions-button_4.entry.js +6 -6
  62. package/dist/esm/snk-application.entry.js +101 -59
  63. package/dist/esm/snk-attach.entry.js +6 -6
  64. package/dist/esm/{snk-form-config.entry.js → snk-config-options_3.entry.js} +366 -6
  65. package/dist/esm/snk-configurator.entry.js +1 -1
  66. package/dist/esm/snk-crud.entry.js +6 -6
  67. package/dist/esm/snk-data-exporter.entry.js +6 -6
  68. package/dist/esm/{snk-data-unit-0fdfb6c2.js → snk-data-unit-618e0b80.js} +1 -1
  69. package/dist/esm/snk-data-unit.entry.js +3 -3
  70. package/dist/esm/snk-detail-view.entry.js +8 -8
  71. package/dist/esm/snk-field-config.entry.js +1 -1
  72. package/dist/esm/{snk-filter-bar.entry.js → snk-filter-bar_4.entry.js} +687 -5
  73. package/dist/esm/snk-filter-modal-item.entry.js +3 -3
  74. package/dist/esm/snk-grid.entry.js +6 -6
  75. package/dist/esm/{snk-guides-viewer-8934c537.js → snk-guides-viewer-15c916a3.js} +9 -6
  76. package/dist/esm/snk-guides-viewer.entry.js +8 -8
  77. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  78. package/dist/esm/snk-simple-crud.entry.js +11 -9
  79. package/dist/esm/snk-tab-config.entry.js +1 -1
  80. package/dist/sankhyablocks/{p-f3434fc4.js → p-00278e07.js} +1 -1
  81. package/dist/sankhyablocks/{p-06421fdb.js → p-126c58ea.js} +1 -1
  82. package/dist/sankhyablocks/{p-a75d242d.entry.js → p-1dbd5c18.entry.js} +1 -1
  83. package/dist/sankhyablocks/{p-8eb67fa4.entry.js → p-2d3f9482.entry.js} +1 -1
  84. package/dist/sankhyablocks/{p-1bf06cd3.js → p-341465ce.js} +2 -2
  85. package/dist/sankhyablocks/p-3858a2e4.entry.js +1 -0
  86. package/dist/sankhyablocks/{p-7663f597.entry.js → p-41793e17.entry.js} +1 -1
  87. package/dist/sankhyablocks/{p-7ac7932c.js → p-47d24ac8.js} +2 -2
  88. package/dist/sankhyablocks/{p-eb9f0407.entry.js → p-563b7c28.entry.js} +1 -1
  89. package/dist/sankhyablocks/{p-95df461f.entry.js → p-8b4fc28f.entry.js} +1 -1
  90. package/dist/sankhyablocks/{p-b0ef4383.js → p-95ce311a.js} +1 -1
  91. package/dist/sankhyablocks/{p-430e4d3c.entry.js → p-9c3138f5.entry.js} +1 -1
  92. package/dist/sankhyablocks/{p-4d9549cf.js → p-9ffd9fc7.js} +1 -1
  93. package/dist/sankhyablocks/p-a0ebd886.js +1 -0
  94. package/dist/sankhyablocks/{p-dcead955.entry.js → p-a2c790ac.entry.js} +1 -1
  95. package/dist/sankhyablocks/{p-5dd8cf4f.js → p-a75e9dcc.js} +1 -1
  96. package/dist/sankhyablocks/{p-212213d9.entry.js → p-aa003d4e.entry.js} +1 -1
  97. package/dist/sankhyablocks/p-aaf94476.js +1 -0
  98. package/dist/sankhyablocks/{p-16869f77.js → p-ae50d69f.js} +1 -1
  99. package/dist/sankhyablocks/p-bab79110.entry.js +1 -0
  100. package/dist/sankhyablocks/{p-b9c67e45.entry.js → p-c1adf0dd.entry.js} +1 -1
  101. package/dist/sankhyablocks/p-c88ad28e.entry.js +1 -0
  102. package/dist/sankhyablocks/p-d1da52e1.entry.js +1 -0
  103. package/dist/sankhyablocks/p-da87e42c.entry.js +11 -0
  104. package/dist/sankhyablocks/{p-be5d8fcb.entry.js → p-e41bd8ee.entry.js} +1 -1
  105. package/dist/sankhyablocks/p-e4391e16.js +1 -0
  106. package/dist/sankhyablocks/{p-92eadb1c.entry.js → p-f0aaad2b.entry.js} +1 -1
  107. package/dist/sankhyablocks/{p-fb34e0cf.entry.js → p-fca0e5cc.entry.js} +1 -1
  108. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  109. package/dist/types/components/snk-application/request-listener/DebouncedRequestListener.d.ts +11 -0
  110. package/dist/types/components/snk-application/request-listener/RequestListenerFactory.d.ts +12 -0
  111. package/dist/types/components/snk-application/request-listener/RequestListenerLoadingBar.d.ts +13 -0
  112. package/dist/types/components/snk-application/snk-application.d.ts +3 -12
  113. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -0
  114. package/dist/types/lib/utils/CrudUtils.d.ts +1 -0
  115. package/package.json +3 -2
  116. package/dist/cjs/snk-config-options.cjs.entry.js +0 -239
  117. package/dist/cjs/snk-filter-item.cjs.entry.js +0 -312
  118. package/dist/cjs/snk-filter-list.cjs.entry.js +0 -152
  119. package/dist/cjs/snk-filter-modal.cjs.entry.js +0 -249
  120. package/dist/cjs/snk-form.cjs.entry.js +0 -144
  121. package/dist/esm/snk-config-options.entry.js +0 -235
  122. package/dist/esm/snk-filter-item.entry.js +0 -308
  123. package/dist/esm/snk-filter-list.entry.js +0 -148
  124. package/dist/esm/snk-filter-modal.entry.js +0 -245
  125. package/dist/esm/snk-form.entry.js +0 -140
  126. package/dist/sankhyablocks/p-01086ff7.entry.js +0 -1
  127. package/dist/sankhyablocks/p-2923c1b5.js +0 -1
  128. package/dist/sankhyablocks/p-3b60db06.entry.js +0 -1
  129. package/dist/sankhyablocks/p-49f1c9be.entry.js +0 -1
  130. package/dist/sankhyablocks/p-60b29483.entry.js +0 -1
  131. package/dist/sankhyablocks/p-70a4af56.entry.js +0 -1
  132. package/dist/sankhyablocks/p-a42e7a1e.entry.js +0 -11
  133. package/dist/sankhyablocks/p-afbb070d.js +0 -1
  134. package/dist/sankhyablocks/p-b9679243.entry.js +0 -1
  135. package/dist/sankhyablocks/p-ca5ec380.js +0 -1
  136. package/dist/sankhyablocks/p-d3f53df2.entry.js +0 -1
  137. package/dist/sankhyablocks/p-e8763234.entry.js +0 -1
  138. package/dist/sankhyablocks/p-feba9d4b.entry.js +0 -1
@@ -0,0 +1,46 @@
1
+ import { precacheAndRoute, createHandlerBoundToURL } from 'workbox-precaching';
2
+ import { registerRoute } from 'workbox-routing';
3
+ import { StaleWhileRevalidate, CacheFirst } from 'workbox-strategies';
4
+ import { CacheableResponsePlugin } from 'workbox-cacheable-response';
5
+ import { ExpirationPlugin } from 'workbox-expiration';
6
+
7
+ // Placeholder for Workbox to inject the precache manifest
8
+ precacheAndRoute([]);
9
+
10
+ // Additional custom logic follows...
11
+ registerRoute(
12
+ ({ url }) =>
13
+ url.pathname.endsWith('/service.sbr') &&
14
+ url.searchParams.has('serviceName'),
15
+ new StaleWhileRevalidate({
16
+ cacheName: 'api-cache',
17
+ plugins: [new CacheableResponsePlugin({ statuses: [200] })],
18
+ })
19
+ );
20
+
21
+ registerRoute(
22
+ ({ request }) =>
23
+ ['image', 'font', 'style'].includes(request.destination),
24
+ new CacheFirst({
25
+ cacheName: 'assets-cache',
26
+ plugins: [
27
+ new CacheableResponsePlugin({ statuses: [0, 200] }),
28
+ new ExpirationPlugin({ maxEntries: 50, maxAgeSeconds: 30 * 24 * 60 * 60 }),
29
+ ],
30
+ })
31
+ );
32
+
33
+ registerRoute(
34
+ ({ request }) => request.mode === 'navigate',
35
+ createHandlerBoundToURL('/index.html')
36
+ );
37
+
38
+ self.addEventListener('install', (event) => {
39
+ console.log('Service Worker installing.');
40
+ self.skipWaiting();
41
+ });
42
+
43
+ self.addEventListener('activate', (event) => {
44
+ console.log('Service Worker activating.');
45
+ clients.claim();
46
+ });
@@ -23,6 +23,28 @@ class CrudUtils {
23
23
  });
24
24
  }
25
25
  }
26
+ static parseCrudResults(entities, onlyFirst) {
27
+ if (!Array.isArray(entities)) {
28
+ entities = [entities];
29
+ }
30
+ const crudFindResults = [];
31
+ for (const entity of entities) {
32
+ let crudFindResult = {
33
+ fields: new Map()
34
+ };
35
+ for (let key in entity) {
36
+ let fieldValue = entity[key];
37
+ if (fieldValue.hasOwnProperty('$')) {
38
+ crudFindResult.fields.set(key, fieldValue.$);
39
+ }
40
+ if (onlyFirst) {
41
+ break;
42
+ }
43
+ }
44
+ crudFindResults.push(crudFindResult);
45
+ }
46
+ return crudFindResults.length > 1 ? crudFindResults : crudFindResults[0];
47
+ }
26
48
  static find(entityName, fields, criteria, onlyFirst = true, criteriaExpression, orderBy) {
27
49
  const SERVICE_CRUD_FIND = "mge@crud.find";
28
50
  let parsedFields = [];
@@ -70,24 +92,11 @@ class CrudUtils {
70
92
  DataFetcher.get().callServiceBroker(SERVICE_CRUD_FIND, JSON.stringify(request)).then((result) => {
71
93
  var _a;
72
94
  let entities = (_a = result.entidades) === null || _a === void 0 ? void 0 : _a.entidade;
73
- if (entities != undefined) {
74
- let crudFindResult = {
75
- fields: new Map()
76
- };
77
- for (let key in entities) {
78
- let fieldValue = entities[key];
79
- if (fieldValue.hasOwnProperty('$')) {
80
- crudFindResult.fields.set(key, fieldValue.$);
81
- }
82
- if (onlyFirst) {
83
- break;
84
- }
85
- }
86
- resolve(crudFindResult);
87
- }
88
- else {
95
+ if (!entities) {
89
96
  resolve(null);
90
97
  }
98
+ const crudFindResults = this.parseCrudResults(entities, onlyFirst);
99
+ resolve(crudFindResults);
91
100
  });
92
101
  });
93
102
  }
@@ -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) {
@@ -88,13 +88,13 @@ class SnkFormConfigManager {
88
88
  const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
89
89
  const hasConfig = this.hasConfig();
90
90
  if (hasConfig && !forceEmptyConfig) {
91
- return fields.map(({ label, name, readOnly, visible, required, tab }) => {
91
+ return fields.map(({ label, name, readOnly, visible, required, tab, group }) => {
92
92
  var _a;
93
93
  if (label == undefined) {
94
94
  const currentField = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
95
- return Object.assign(Object.assign({}, currentField), { name: name !== null && name !== void 0 ? name : currentField.name, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : currentField.readOnly, visible: visible !== null && visible !== void 0 ? visible : currentField.visible, required: required !== null && required !== void 0 ? required : currentField.required, tab: tab });
95
+ return Object.assign(Object.assign({}, currentField), { name: name !== null && name !== void 0 ? name : currentField.name, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : currentField.readOnly, visible: visible !== null && visible !== void 0 ? visible : currentField.visible, required: required !== null && required !== void 0 ? required : currentField.required, tab: tab, group: group });
96
96
  }
97
- return { name, label, readOnly, visible, required, tab };
97
+ return { name, label, readOnly, visible, required, tab, group };
98
98
  })
99
99
  .filter(field => this.isFieldVisible(field, descriptionFilter));
100
100
  }
@@ -712,7 +712,7 @@ class DataUnitDataLoader {
712
712
  }
713
713
  const count = loadingInfo.count;
714
714
  if (loadingInfo.loadingInProgress) {
715
- dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { count }));
715
+ dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { count, loadingInProgress: true }));
716
716
  return;
717
717
  }
718
718
  if (loadingInfo.needReload) {
@@ -720,7 +720,7 @@ class DataUnitDataLoader {
720
720
  dataUnit.gotoPage(0);
721
721
  return;
722
722
  }
723
- dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { total: count, count }));
723
+ dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { total: count, count, loadingInProgress: false }));
724
724
  }
725
725
  static registryLoading(dataUnit, loadingInfo) {
726
726
  if (loadingInfo == undefined) {
@@ -96,9 +96,14 @@ class PesquisaFetcher {
96
96
  }
97
97
  }
98
98
  };
99
+ const urlOptions = {
100
+ urlParams: {
101
+ "quietMode": true
102
+ }
103
+ };
99
104
  return new Promise((resolve, reject) => {
100
105
  DataFetcher.get()
101
- .callServiceBroker("PesquisaSP.getSuggestion", JSON.stringify(reqBody))
106
+ .callServiceBroker("PesquisaSP.getSuggestion", JSON.stringify(reqBody), urlOptions)
102
107
  .then(result => resolve(result))
103
108
  .catch(error => reject(error));
104
109
  });
@@ -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;
@@ -482,6 +482,9 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
482
482
  await this.addErrorBadgeToGuide(guideName);
483
483
  await this.openGuideNavigator(guideName);
484
484
  }
485
+ if (action.type === Action.METADATA_LOADED) {
486
+ this.loadGuides(false);
487
+ }
485
488
  }
486
489
  async addErrorBadgeToGuide(guideName) {
487
490
  var _a;
@@ -726,9 +726,11 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
726
726
  window.removeEventListener("keydown", this._keyDownHandler);
727
727
  }
728
728
  gridConfigChangeHandler(evt) {
729
+ evt.stopPropagation();
730
+ if (!this.configName)
731
+ return;
729
732
  const config = evt.detail;
730
733
  ConfigStorage.saveGridConfig(config, this.configName, this.resolveResourceID());
731
- evt.stopPropagation();
732
734
  }
733
735
  modalConfigChangeHandler(evt) {
734
736
  const config = evt.detail;
@@ -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-8edaa8cd.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-c24c76c6.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,7 +1,7 @@
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';
4
- import { T as TAB_NAMES } from './constants-8457af36.js';
3
+ import { F as FormConfigFetcher } from './form-config-fetcher-a7d3e277.js';
4
+ import { b as TAB_NAMES } from './constants-7302ee87.js';
5
5
 
6
6
  class SnkFormConfigManager {
7
7
  constructor(configName, resourceID, onConfigChange, dataUnit) {
@@ -88,13 +88,13 @@ class SnkFormConfigManager {
88
88
  const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
89
89
  const hasConfig = this.hasConfig();
90
90
  if (hasConfig && !forceEmptyConfig) {
91
- return fields.map(({ label, name, readOnly, visible, required, tab }) => {
91
+ return fields.map(({ label, name, readOnly, visible, required, tab, group }) => {
92
92
  var _a;
93
93
  if (label == undefined) {
94
94
  const currentField = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
95
- return Object.assign(Object.assign({}, currentField), { name: name !== null && name !== void 0 ? name : currentField.name, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : currentField.readOnly, visible: visible !== null && visible !== void 0 ? visible : currentField.visible, required: required !== null && required !== void 0 ? required : currentField.required, tab: tab });
95
+ return Object.assign(Object.assign({}, currentField), { name: name !== null && name !== void 0 ? name : currentField.name, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : currentField.readOnly, visible: visible !== null && visible !== void 0 ? visible : currentField.visible, required: required !== null && required !== void 0 ? required : currentField.required, tab: tab, group: group });
96
96
  }
97
- return { name, label, readOnly, visible, required, tab };
97
+ return { name, label, readOnly, visible, required, tab, group };
98
98
  })
99
99
  .filter(field => this.isFieldVisible(field, descriptionFilter));
100
100
  }
@@ -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) {
@@ -90,4 +90,4 @@ var SIMPLE_CRUD_MODE;
90
90
  SIMPLE_CRUD_MODE[SIMPLE_CRUD_MODE["IN_MEMORY"] = 1] = "IN_MEMORY";
91
91
  })(SIMPLE_CRUD_MODE || (SIMPLE_CRUD_MODE = {}));
92
92
 
93
- export { ACTION_CONFIG as A, CONFIG_EVENTS as C, DEFAULT_TYPE as D, KEY_EVENTS as K, ORDER_VALUES as O, REPORT_LAUNCHER_RESOURCE_ID as R, SIMPLE_CRUD_MODE as S, TAB_NAMES as T, VARS_BY_TYPE as V, CONFIG_SORTABLE_EVENTS as a, TAGS_BY_TYPE as b, TYPE_ACTIONS as c, VIEW_MODE as d };
93
+ export { ACTION_CONFIG as A, CONFIG_EVENTS as C, DEFAULT_TYPE as D, KEY_EVENTS as K, ORDER_VALUES as O, REPORT_LAUNCHER_RESOURCE_ID as R, SIMPLE_CRUD_MODE as S, TYPE_ACTIONS as T, VIEW_MODE as V, CONFIG_SORTABLE_EVENTS as a, TAB_NAMES as b, VARS_BY_TYPE as c, TAGS_BY_TYPE as d };
@@ -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';
@@ -712,7 +712,7 @@ class DataUnitDataLoader {
712
712
  }
713
713
  const count = loadingInfo.count;
714
714
  if (loadingInfo.loadingInProgress) {
715
- dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { count }));
715
+ dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { count, loadingInProgress: true }));
716
716
  return;
717
717
  }
718
718
  if (loadingInfo.needReload) {
@@ -720,7 +720,7 @@ class DataUnitDataLoader {
720
720
  dataUnit.gotoPage(0);
721
721
  return;
722
722
  }
723
- dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { total: count, count }));
723
+ dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { total: count, count, loadingInProgress: false }));
724
724
  }
725
725
  static registryLoading(dataUnit, loadingInfo) {
726
726
  if (loadingInfo == undefined) {
@@ -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 {
@@ -2034,18 +2034,6 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
2034
2034
  return import(
2035
2035
  /* webpackMode: "lazy" */
2036
2036
  './snk-application.entry.js').then(processMod, consoleError);
2037
- case 'snk-form':
2038
- return import(
2039
- /* webpackMode: "lazy" */
2040
- './snk-form.entry.js').then(processMod, consoleError);
2041
- case 'snk-form-config':
2042
- return import(
2043
- /* webpackMode: "lazy" */
2044
- './snk-form-config.entry.js').then(processMod, consoleError);
2045
- case 'snk-config-options':
2046
- return import(
2047
- /* webpackMode: "lazy" */
2048
- './snk-config-options.entry.js').then(processMod, consoleError);
2049
2037
  case 'snk-tab-config':
2050
2038
  return import(
2051
2039
  /* webpackMode: "lazy" */
@@ -2086,22 +2074,6 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
2086
2074
  return import(
2087
2075
  /* webpackMode: "lazy" */
2088
2076
  './snk-data-unit.entry.js').then(processMod, consoleError);
2089
- case 'snk-filter-bar':
2090
- return import(
2091
- /* webpackMode: "lazy" */
2092
- './snk-filter-bar.entry.js').then(processMod, consoleError);
2093
- case 'snk-filter-item':
2094
- return import(
2095
- /* webpackMode: "lazy" */
2096
- './snk-filter-item.entry.js').then(processMod, consoleError);
2097
- case 'snk-filter-list':
2098
- return import(
2099
- /* webpackMode: "lazy" */
2100
- './snk-filter-list.entry.js').then(processMod, consoleError);
2101
- case 'snk-filter-modal':
2102
- return import(
2103
- /* webpackMode: "lazy" */
2104
- './snk-filter-modal.entry.js').then(processMod, consoleError);
2105
2077
  case 'snk-field-config':
2106
2078
  return import(
2107
2079
  /* webpackMode: "lazy" */
@@ -2118,6 +2090,14 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
2118
2090
  return import(
2119
2091
  /* webpackMode: "lazy" */
2120
2092
  './snk-taskbar.entry.js').then(processMod, consoleError);
2093
+ case 'snk-config-options_3':
2094
+ return import(
2095
+ /* webpackMode: "lazy" */
2096
+ './snk-config-options_3.entry.js').then(processMod, consoleError);
2097
+ case 'snk-filter-bar_4':
2098
+ return import(
2099
+ /* webpackMode: "lazy" */
2100
+ './snk-filter-bar_4.entry.js').then(processMod, consoleError);
2121
2101
  case 'snk-actions-form':
2122
2102
  return import(
2123
2103
  /* webpackMode: "lazy" */