@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-72026.1 → 0.0.0-bugfix-dev-KB-71601.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-e49214c6.js} +2 -2
  2. package/dist/cjs/{DataFetcher-cadeef8e.js → DataFetcher-77729a93.js} +20 -21
  3. package/dist/cjs/{IExporterProvider-9ac15aaf.js → IExporterProvider-5d129ffd.js} +4 -4
  4. package/dist/cjs/{GetSelectedRecordsIDsInfo-bd50caf1.js → RecordIDUtils-3735135c.js} +10 -10
  5. package/dist/cjs/{SnkFormConfigManager-f1c92f79.js → SnkFormConfigManager-beebf47a.js} +16 -72
  6. package/dist/cjs/{auth-fetcher-d68841bc.js → auth-fetcher-29bb791c.js} +1 -1
  7. package/dist/cjs/{dataunit-fetcher-4b12f70c.js → dataunit-fetcher-0c2f5903.js} +37 -16
  8. package/dist/cjs/{form-config-fetcher-ed497282.js → form-config-fetcher-feb08214.js} +2 -5
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/cjs/{pesquisa-fetcher-ca89181c.js → pesquisa-fetcher-a1d0353f.js} +1 -1
  11. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  12. package/dist/cjs/snk-actions-button_4.cjs.entry.js +14 -17
  13. package/dist/cjs/snk-application.cjs.entry.js +6 -6
  14. package/dist/cjs/snk-attach.cjs.entry.js +6 -8
  15. package/dist/cjs/snk-crud.cjs.entry.js +5 -5
  16. package/dist/cjs/snk-data-exporter.cjs.entry.js +6 -6
  17. package/dist/cjs/{snk-data-unit-2f2e6f8c.js → snk-data-unit-610fb4bc.js} +3 -3
  18. package/dist/cjs/snk-data-unit.cjs.entry.js +4 -4
  19. package/dist/cjs/snk-detail-view.cjs.entry.js +9 -9
  20. package/dist/cjs/snk-filter-bar.cjs.entry.js +3 -3
  21. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
  22. package/dist/cjs/snk-form-config.cjs.entry.js +4 -15
  23. package/dist/cjs/snk-form.cjs.entry.js +6 -7
  24. package/dist/cjs/snk-grid.cjs.entry.js +8 -8
  25. package/dist/cjs/{snk-guides-viewer-866447ab.js → snk-guides-viewer-d6d543af.js} +7 -10
  26. package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -8
  27. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
  28. package/dist/cjs/snk-simple-crud.cjs.entry.js +10 -10
  29. package/dist/cjs/snk-taskbar.cjs.entry.js +1 -23
  30. package/dist/collection/components/snk-actions-button/actions/index.js +9 -12
  31. package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +2 -4
  32. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +2 -2
  33. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +2 -5
  34. package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +1 -1
  35. package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +1 -1
  36. package/dist/collection/{lib/utils/GetSelectedRecordsIDsInfo.js → components/snk-data-exporter/utils/RecordIDUtils.js} +9 -9
  37. package/dist/collection/components/snk-data-unit/snk-data-unit.js +2 -2
  38. package/dist/collection/components/snk-form/snk-form.js +2 -2
  39. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +14 -70
  40. package/dist/collection/components/snk-form-config/snk-form-config.js +2 -13
  41. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +1 -1
  42. package/dist/collection/components/snk-taskbar/snk-taskbar.js +0 -64
  43. package/dist/collection/lib/dataUnit/InMemoryLoader.js +2 -4
  44. package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +34 -9
  45. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +20 -21
  46. package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +1 -4
  47. package/dist/components/DataFetcher.js +20 -21
  48. package/dist/components/SnkFormConfigManager.js +14 -70
  49. package/dist/components/dataunit-fetcher.js +36 -13
  50. package/dist/components/form-config-fetcher.js +1 -4
  51. package/dist/components/snk-actions-button2.js +9 -12
  52. package/dist/components/snk-attach2.js +2 -4
  53. package/dist/components/snk-data-unit2.js +42 -5
  54. package/dist/components/snk-detail-view2.js +4 -7
  55. package/dist/components/snk-form-config2.js +2 -13
  56. package/dist/components/snk-form.js +2 -2
  57. package/dist/components/snk-grid2.js +2 -2
  58. package/dist/components/snk-simple-crud2.js +3 -4
  59. package/dist/components/snk-taskbar2.js +2 -24
  60. package/dist/esm/{ConfigStorage-7b36d041.js → ConfigStorage-e476378d.js} +2 -2
  61. package/dist/esm/{DataFetcher-a9c598f2.js → DataFetcher-773a3e4b.js} +20 -21
  62. package/dist/esm/{IExporterProvider-09df2e3e.js → IExporterProvider-24f1d5be.js} +4 -4
  63. package/dist/esm/{GetSelectedRecordsIDsInfo-9fa41508.js → RecordIDUtils-87d02110.js} +10 -10
  64. package/dist/esm/{SnkFormConfigManager-139f09fa.js → SnkFormConfigManager-298cd647.js} +16 -72
  65. package/dist/esm/{auth-fetcher-749d880f.js → auth-fetcher-a411f73c.js} +1 -1
  66. package/dist/esm/{dataunit-fetcher-3aac1a53.js → dataunit-fetcher-3308edba.js} +37 -14
  67. package/dist/esm/{form-config-fetcher-adbe5d34.js → form-config-fetcher-e0382e5a.js} +2 -5
  68. package/dist/esm/loader.js +1 -1
  69. package/dist/esm/{pesquisa-fetcher-8edaa8cd.js → pesquisa-fetcher-a87445a0.js} +1 -1
  70. package/dist/esm/sankhyablocks.js +1 -1
  71. package/dist/esm/snk-actions-button_4.entry.js +14 -17
  72. package/dist/esm/snk-application.entry.js +6 -6
  73. package/dist/esm/snk-attach.entry.js +6 -8
  74. package/dist/esm/snk-crud.entry.js +5 -5
  75. package/dist/esm/snk-data-exporter.entry.js +6 -6
  76. package/dist/esm/{snk-data-unit-acf3dd64.js → snk-data-unit-f4727294.js} +3 -3
  77. package/dist/esm/snk-data-unit.entry.js +4 -4
  78. package/dist/esm/snk-detail-view.entry.js +9 -9
  79. package/dist/esm/snk-filter-bar.entry.js +3 -3
  80. package/dist/esm/snk-filter-modal-item.entry.js +3 -3
  81. package/dist/esm/snk-form-config.entry.js +4 -15
  82. package/dist/esm/snk-form.entry.js +6 -7
  83. package/dist/esm/snk-grid.entry.js +8 -8
  84. package/dist/esm/{snk-guides-viewer-cb8a0b48.js → snk-guides-viewer-57cfa507.js} +7 -10
  85. package/dist/esm/snk-guides-viewer.entry.js +8 -8
  86. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  87. package/dist/esm/snk-simple-crud.entry.js +10 -10
  88. package/dist/esm/snk-taskbar.entry.js +1 -23
  89. package/dist/sankhyablocks/p-038f6a70.entry.js +1 -0
  90. package/dist/sankhyablocks/p-0611c5d4.js +1 -0
  91. package/dist/sankhyablocks/{p-ca5ec380.js → p-0cd3c0a9.js} +1 -1
  92. package/dist/sankhyablocks/p-0e7db332.entry.js +1 -0
  93. package/dist/sankhyablocks/{p-06421fdb.js → p-181975f1.js} +2 -2
  94. package/dist/sankhyablocks/{p-1ab19772.js → p-1d13de28.js} +1 -1
  95. package/dist/sankhyablocks/{p-0e9a872d.entry.js → p-1f2f07c2.entry.js} +1 -1
  96. package/dist/sankhyablocks/{p-8862ba4a.entry.js → p-212c54c1.entry.js} +1 -1
  97. package/dist/sankhyablocks/{p-1bf06cd3.js → p-25f1fc39.js} +2 -2
  98. package/dist/sankhyablocks/{p-640140b3.entry.js → p-29016f61.entry.js} +2 -2
  99. package/dist/sankhyablocks/p-2e9c764c.entry.js +1 -0
  100. package/dist/sankhyablocks/{p-4d9549cf.js → p-3287a6cc.js} +1 -1
  101. package/dist/sankhyablocks/p-4c92bf50.entry.js +1 -0
  102. package/dist/sankhyablocks/{p-1f47a0b2.entry.js → p-50d7d40b.entry.js} +1 -1
  103. package/dist/sankhyablocks/{p-f3434fc4.js → p-594bc21d.js} +1 -1
  104. package/dist/sankhyablocks/{p-b2caaaf9.entry.js → p-5b26cc7c.entry.js} +1 -1
  105. package/dist/sankhyablocks/p-5f016aed.js +1 -0
  106. package/dist/sankhyablocks/p-8ad41dcb.entry.js +1 -0
  107. package/dist/sankhyablocks/p-939e15d3.entry.js +1 -0
  108. package/dist/sankhyablocks/p-9863d682.js +1 -0
  109. package/dist/sankhyablocks/{p-212213d9.entry.js → p-9dfda04a.entry.js} +1 -1
  110. package/dist/sankhyablocks/{p-16969508.entry.js → p-a0e0c10f.entry.js} +1 -1
  111. package/dist/sankhyablocks/p-a875c5f2.js +60 -0
  112. package/dist/sankhyablocks/{p-fb34e0cf.entry.js → p-bd008859.entry.js} +1 -1
  113. package/dist/sankhyablocks/{p-a31e761f.js → p-c319fccd.js} +1 -1
  114. package/dist/sankhyablocks/p-cfb72d5e.entry.js +1 -0
  115. package/dist/sankhyablocks/p-f2809746.entry.js +1 -0
  116. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  117. package/dist/types/components/snk-actions-button/actions/index.d.ts +0 -1
  118. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +0 -1
  119. package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +3 -0
  120. package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +2 -7
  121. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +0 -11
  122. package/dist/types/components.d.ts +0 -8
  123. package/dist/types/lib/dataUnit/dataUnitInMemoryUtils.d.ts +12 -2
  124. package/package.json +1 -1
  125. package/dist/components/GetSelectedRecordsIDsInfo.js +0 -41
  126. package/dist/sankhyablocks/p-18ed15f4.entry.js +0 -1
  127. package/dist/sankhyablocks/p-3757394b.entry.js +0 -1
  128. package/dist/sankhyablocks/p-3d542b58.entry.js +0 -1
  129. package/dist/sankhyablocks/p-53c1d25d.entry.js +0 -1
  130. package/dist/sankhyablocks/p-60b29483.entry.js +0 -1
  131. package/dist/sankhyablocks/p-73185e58.entry.js +0 -1
  132. package/dist/sankhyablocks/p-7dd49d15.js +0 -1
  133. package/dist/sankhyablocks/p-8d7e2747.entry.js +0 -1
  134. package/dist/sankhyablocks/p-afbb070d.js +0 -1
  135. package/dist/sankhyablocks/p-bc4b94d2.entry.js +0 -1
  136. package/dist/sankhyablocks/p-ce6eed2c.js +0 -1
  137. package/dist/sankhyablocks/p-f8698ad3.js +0 -60
  138. package/dist/types/lib/utils/GetSelectedRecordsIDsInfo.d.ts +0 -3
@@ -1,10 +1,47 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
- import { Action, ObjectUtils, DataUnitAction, StringUtils, ApplicationContext } from '@sankhyalabs/core';
2
+ import { JSUtils, DataType, 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.js';
5
- import { g as getRecordValue, d as DatasetStrategy } from './dataunit-fetcher.js';
5
+ import { g as getRecordValue, a as DatasetStrategy } from './dataunit-fetcher.js';
6
6
  import { convertType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
7
- import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo.js';
7
+
8
+ const getSelectedIDs = (dataUnit) => {
9
+ const selectionInfo = dataUnit.getSelectionInfo();
10
+ if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
11
+ return [];
12
+ }
13
+ const selectedRecordsIDsInfo = [];
14
+ const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.recordIds;
15
+ if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
16
+ selectedRecords.forEach(recordId => {
17
+ if (!dataUnit.isNewRecord(recordId)) {
18
+ /*
19
+ Esse if foi necessário para tratar corretamente o ID
20
+ do record quando está sendo utilizado no modo standAlone
21
+ isso não faz a exportação da grid funcionar no modo standAlone
22
+ mas deixa de causar erro nas oprações de CRUD.
23
+ */
24
+ if (!JSUtils.isBase64(recordId)) {
25
+ selectedRecordsIDsInfo.push({
26
+ name: "__record__id__",
27
+ type: DataType.TEXT,
28
+ value: recordId
29
+ });
30
+ return;
31
+ }
32
+ const revertBase64ToObject = JSON.parse(window.atob(recordId));
33
+ Object.entries(revertBase64ToObject).forEach(([name, value]) => {
34
+ const metadataField = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(name);
35
+ if (metadataField == undefined) {
36
+ return;
37
+ }
38
+ selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
39
+ });
40
+ }
41
+ });
42
+ }
43
+ return selectedRecordsIDsInfo;
44
+ };
8
45
 
9
46
  const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
10
47
  constructor() {
@@ -116,7 +153,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
116
153
  * @returns Retorna a lista de IDs dos registros selecionados.
117
154
  */
118
155
  async getSelectedRecordsIDsInfo() {
119
- return getSelectedRecordsIDsInfo(this.dataUnit);
156
+ return Promise.resolve(getSelectedIDs(this.dataUnit));
120
157
  }
121
158
  /**
122
159
  * Retorna os campos que possuem a propriedade "rmp" (Row Metadata Provider).
@@ -720,4 +757,4 @@ function defineCustomElement() {
720
757
  } });
721
758
  }
722
759
 
723
- export { SnkDataUnit as S, defineCustomElement as d };
760
+ export { SnkDataUnit as S, defineCustomElement as d, getSelectedIDs as g };
@@ -404,14 +404,11 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
404
404
  this._configManager.addFormLegacyConfig(this.formLegacyConfigName);
405
405
  }
406
406
  }
407
- setMasterFormConfig(config) {
408
- this.masterFormConfig = config;
409
- }
410
407
  componentWillLoad() {
411
408
  if (this.resourceID == undefined) {
412
409
  throw new Error("Erro interno: resourceID não informado");
413
410
  }
414
- this._configManager = new SnkFormConfigManager(this.configName, this.resourceID, this.setMasterFormConfig.bind(this), this.dataUnit);
411
+ this._configManager = new SnkFormConfigManager(this.configName, this.resourceID, config => this.masterFormConfig = config);
415
412
  this.addFormLegacyConfigName();
416
413
  this._configManager.loadConfig();
417
414
  }
@@ -439,7 +436,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
439
436
  return this._fieldSearch;
440
437
  }
441
438
  fieldsOptionLoader(argument) {
442
- return Promise.resolve(this._configManager.getFieldsList(argument)
439
+ return Promise.resolve(this._configManager.getFieldsList(this.dataUnit, argument)
443
440
  .map(field => ({ value: field.name, label: field.label })));
444
441
  }
445
442
  onSelectField(option, actionButton) {
@@ -987,7 +984,7 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
987
984
  this.emitSwitchEvent(VIEW_MODE.GRID);
988
985
  evt.stopPropagation();
989
986
  }
990
- if (evt.detail === TaskbarElement.FORM_MODE || evt.detail === TaskbarElement.UPDATE) {
987
+ if (evt.detail === TaskbarElement.FORM_MODE) {
991
988
  this.emitSwitchEvent(VIEW_MODE.FORM);
992
989
  evt.stopPropagation();
993
990
  }
@@ -1011,7 +1008,7 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
1011
1008
  }
1012
1009
  componentWillLoad() {
1013
1010
  this._configName = `dynaform.${this.entityName}`;
1014
- this.formConfigManager = new SnkFormConfigManager(this._configName, this.resourceID, () => this.loadMetadata(), this.dataUnit);
1011
+ this.formConfigManager = new SnkFormConfigManager(this._configName, this.resourceID, () => this.loadMetadata());
1015
1012
  this.formConfigManager.loadConfig();
1016
1013
  if (this.messagesBuilder == undefined) {
1017
1014
  this.messagesBuilder = new SnkMessageBuilder(this.entityName);
@@ -202,11 +202,6 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
202
202
  this.configManager.saveConfig(this.buildConfigToSave())
203
203
  .then(savedConfig => {
204
204
  ApplicationUtils.info(this.getMessage("snkFormConfig.info.successfullyConfigSaved"), { iconName: "check" });
205
- const userOption = this._formConfigOptions
206
- .find((config) => {
207
- return config.origin === UserConfigType.USER;
208
- });
209
- this.setFormConfig(userOption);
210
205
  this.configChange.emit(savedConfig);
211
206
  });
212
207
  }
@@ -540,12 +535,9 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
540
535
  switch (this._optionFormConfigSelected.origin) {
541
536
  case UserConfigType.DEFAULT:
542
537
  config = await this.configManager.fetchDefaultConfig();
543
- if (!config) {
544
- config = this.configManager.getEmptyConfig();
545
- }
546
538
  break;
547
- default:
548
- config = this.getConfig();
539
+ case UserConfigType.DEFAULT:
540
+ config = await this.configManager.fetchDefaultConfig();
549
541
  break;
550
542
  }
551
543
  if (config != undefined) {
@@ -748,9 +740,6 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
748
740
  if (layoutFormConfig == undefined) {
749
741
  layoutFormConfig = [];
750
742
  }
751
- if (this._formConfig.defaultConfiguration) {
752
- return layoutFormConfig;
753
- }
754
743
  return this._formConfig.tabs.map((tab) => {
755
744
  return layoutFormConfig.find(config => { var _a, _b; return ((_a = tab.label) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_b = config.tab) === null || _b === void 0 ? void 0 : _b.toLowerCase()); })
756
745
  || { tab: tab.label, groups: [], visible: tab.visible };
@@ -99,7 +99,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
99
99
  if (this.resourceID == undefined) {
100
100
  this.resourceID = await ResourceIDUtils.getResourceID();
101
101
  }
102
- this._configManager = new SnkFormConfigManager(this.configName, this.resourceID, undefined, this._dataUnit);
102
+ this._configManager = new SnkFormConfigManager(this.configName, this.resourceID);
103
103
  this.addFormLegacyConfig();
104
104
  await this._configManager.loadConfig();
105
105
  }
@@ -128,7 +128,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
128
128
  if (!this._dataUnit || !this._dataState) {
129
129
  return undefined;
130
130
  }
131
- return (h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { ref: (ref) => this._form = ref, key: "ezForm" + this._snkDataUnit.entityName, "data-element-id": "embedded", dataUnit: this._dataUnit, config: this._configManager.getConfig(this._dataUnit), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
131
+ return (h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { ref: (ref) => this._form = ref, key: "ezForm" + this._snkDataUnit.entityName, "data-element-id": "embedded", dataUnit: this._dataUnit, config: this._configManager.getConfig(this._dataState.insertionMode, this._dataUnit), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
132
132
  h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this._dataUnit, configManager: this._configManager, onConfigClose: () => this.closeConfig() })))));
133
133
  }
134
134
  get _element() { return this; }
@@ -13,7 +13,7 @@ import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
13
13
  import './dataunit-fetcher.js';
14
14
  import './filter-item-type.enum.js';
15
15
  import './form-config-fetcher.js';
16
- import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo.js';
16
+ import { g as getSelectedIDs } from './snk-data-unit2.js';
17
17
  import { d as defineCustomElement$i } from './snk-actions-button2.js';
18
18
  import { d as defineCustomElement$h } from './snk-data-exporter2.js';
19
19
  import { d as defineCustomElement$g } from './snk-exporter-email-sender2.js';
@@ -54,7 +54,7 @@ class ServerSideExporterProvider extends CommonsExporter {
54
54
  return total !== null && total !== void 0 ? total : (_c = (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.records) === null || _c === void 0 ? void 0 : _c.length;
55
55
  }
56
56
  getSelectedIDs() {
57
- return getSelectedRecordsIDsInfo(this.dataUnit);
57
+ return getSelectedIDs(this.dataUnit);
58
58
  }
59
59
  getOffset() {
60
60
  return this.getExporterOffset(this.getPaginationInfo());
@@ -14,13 +14,12 @@ import './filter-item-type.enum.js';
14
14
  import { F as FormConfigFetcher } from './form-config-fetcher.js';
15
15
  import { C as ConfigStorage } from './ConfigStorage.js';
16
16
  import { S as SnkFormConfigManager } from './SnkFormConfigManager.js';
17
- import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo.js';
17
+ import { g as getSelectedIDs, d as defineCustomElement$9 } from './snk-data-unit2.js';
18
18
  import { s as store } from './index2.js';
19
19
  import { d as defineCustomElement$d } from './snk-actions-button2.js';
20
20
  import { d as defineCustomElement$c } from './snk-config-options2.js';
21
21
  import { d as defineCustomElement$b } from './snk-configurator2.js';
22
22
  import { d as defineCustomElement$a } from './snk-data-exporter2.js';
23
- import { d as defineCustomElement$9 } from './snk-data-unit2.js';
24
23
  import { d as defineCustomElement$8 } from './snk-exporter-email-sender2.js';
25
24
  import { d as defineCustomElement$7 } from './snk-field-config2.js';
26
25
  import { d as defineCustomElement$6 } from './snk-form-config2.js';
@@ -42,7 +41,7 @@ class ClientSideExporterProvider extends CommonsExporter {
42
41
  return total !== null && total !== void 0 ? total : (_c = (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.records) === null || _c === void 0 ? void 0 : _c.length;
43
42
  }
44
43
  getSelectedIDs() {
45
- return getSelectedRecordsIDsInfo(this.dataUnit);
44
+ return getSelectedIDs(this.dataUnit);
46
45
  }
47
46
  getRecordID() {
48
47
  var _a, _b, _c;
@@ -361,7 +360,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
361
360
  return;
362
361
  }
363
362
  if (this._formConfigManager == undefined) {
364
- this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID(), undefined, this.dataUnit);
363
+ this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
365
364
  this._formConfigManager.setConfig(this.formConfig);
366
365
  }
367
366
  if (this.formConfigIsLoaded() && !forceLoad) {
@@ -128,8 +128,6 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
128
128
  super();
129
129
  this.__registerHost();
130
130
  this.actionClick = createEvent(this, "actionClick", 7);
131
- this.taskbarSaveLocker = createEvent(this, "taskbarSaveLocker", 7);
132
- this.taskbarSaveUnlocker = createEvent(this, "taskbarSaveUnlocker", 7);
133
131
  this.TASKBAR_ITEM_ID_PREFIX = 'TASKBAR_ITEM_';
134
132
  this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME = 'taskbar-custom-elements-container';
135
133
  this.ACTIONS_BUTTON_TAG = 'TASKBAR-ACTIONS-BUTTON';
@@ -153,7 +151,6 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
153
151
  this.onSaveEvent = (action) => {
154
152
  switch (action.type) {
155
153
  case Action.FIELD_INVALIDATED:
156
- case Action.INVALIDATE_CLEAN:
157
154
  case Action.DATA_SAVED:
158
155
  case Action.SAVING_ERROR:
159
156
  this._isWaitingForSave = false;
@@ -192,16 +189,6 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
192
189
  this.getCustomElements(true);
193
190
  }
194
191
  }
195
- handleTaskbarSaveLocker() {
196
- if (this._isWaitingForSave !== true) {
197
- this._isWaitingForSave = true;
198
- }
199
- }
200
- handleTaskbarSaveUnlocker() {
201
- if (this._isWaitingForSave === true) {
202
- this._isWaitingForSave = false;
203
- }
204
- }
205
192
  hasToSearchCustomElements(event) {
206
193
  return this.customSlotId === event.detail && !this._slotContainer;
207
194
  }
@@ -220,14 +207,6 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
220
207
  this._hasToUpdateOverFlow = true;
221
208
  }
222
209
  }
223
- observeIsWaitingForSave(newValue, oldValue) {
224
- if (newValue == true && oldValue == false) {
225
- this.taskbarSaveLocker.emit();
226
- }
227
- if (newValue == false && oldValue == true) {
228
- this.taskbarSaveUnlocker.emit();
229
- }
230
- }
231
210
  // Internal methods
232
211
  elementsFromString(strButtons) {
233
212
  const elements = [];
@@ -556,8 +535,7 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
556
535
  static get watchers() { return {
557
536
  "buttons": ["observeButtons"],
558
537
  "disabledButtons": ["observeDisabledButtons"],
559
- "_lastWidth": ["observeLastWidth"],
560
- "_isWaitingForSave": ["observeIsWaitingForSave"]
538
+ "_lastWidth": ["observeLastWidth"]
561
539
  }; }
562
540
  static get style() { return snkTaskbarCss; }
563
541
  }, [6, "snk-taskbar", {
@@ -584,7 +562,7 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
584
562
  "_lastWidth": [32],
585
563
  "_hasToUpdateOverFlow": [32],
586
564
  "_isWaitingForSave": [32]
587
- }, [[8, "snkCustomSlotElementsLoaded", "handleCustomSlotElementsLoaded"], [8, "taskbarSaveLocker", "handleTaskbarSaveLocker"], [8, "taskbarSaveUnlocker", "handleTaskbarSaveUnlocker"]]]);
565
+ }, [[8, "snkCustomSlotElementsLoaded", "handleCustomSlotElementsLoaded"]]]);
588
566
  function defineCustomElement() {
589
567
  if (typeof customElements === "undefined") {
590
568
  return;
@@ -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-e0382e5a.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-773a3e4b.js';
5
5
 
6
6
  class GridConfigFetcher extends ResourceFetcher {
7
7
  constructor() {
@@ -6863,7 +6863,6 @@ class DataFetcher {
6863
6863
  }
6864
6864
  }
6865
6865
  async executePendingRequest(watingRequestsById) {
6866
- var _a, _b;
6867
6866
  const requestsBatch = [];
6868
6867
  let quietMode = true;
6869
6868
  watingRequestsById.forEach((waitingReq) => {
@@ -6874,36 +6873,36 @@ class DataFetcher {
6874
6873
  const response = await this.fecthGraphQL(requestsBatch, quietMode);
6875
6874
  const { data: dataResponse, errors: errorsResponse, extensions } = response;
6876
6875
  //Reject promises with errors from query
6877
- for (const errorResponse of errorsResponse) {
6878
- const values = Object.values(errorResponse);
6879
- for (const value of values) {
6880
- const waitingRequest = watingRequestsById.get(value.request.variables[value.index].queryID);
6876
+ errorsResponse.forEach((errorResponse) => {
6877
+ Object.entries(errorResponse).forEach(async ([key, val]) => {
6878
+ const waitingRequest = watingRequestsById.get(val.request.variables[val.index].queryID);
6881
6879
  const hasClientEvent = await this.proccesGraphQLClientEvents(extensions, waitingRequest.request, waitingRequest.resolve, waitingRequest.reject);
6882
- const data = await Promise.race([
6880
+ Promise.race([
6883
6881
  waitingRequest.promise,
6884
6882
  new Promise((resolve) => {
6885
6883
  resolve(false);
6886
6884
  })
6887
- ]);
6888
- if (!hasClientEvent || data === false) {
6889
- if (Object.keys(errorResponse[0].extensions).includes("SERVICE_CANCELED") || Object.keys(extensions).includes("isServiceCancelled")) {
6890
- (((_a = watingRequestsById.get(value.request.variables[value.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new ServiceCanceledException("Service canceled", value.message));
6891
- }
6892
- else {
6893
- (((_b = watingRequestsById.get(value.request.variables[value.index].queryID)) === null || _b === void 0 ? void 0 : _b.reject) || Promise.reject)(new ErrorException("Falha detectada", value.message));
6885
+ ]).then((data) => {
6886
+ var _a, _b;
6887
+ if (!hasClientEvent || data === false) {
6888
+ if (Object.keys(errorResponse[0].extensions).includes("SERVICE_CANCELED") || Object.keys(extensions).includes("isServiceCancelled")) {
6889
+ (((_a = watingRequestsById.get(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new ServiceCanceledException("Service canceled", val.message));
6890
+ }
6891
+ else {
6892
+ (((_b = watingRequestsById.get(val.request.variables[val.index].queryID)) === null || _b === void 0 ? void 0 : _b.reject) || Promise.reject)(new ErrorException("Falha detectada", val.message));
6893
+ }
6894
6894
  }
6895
- }
6896
- }
6897
- }
6895
+ });
6896
+ });
6897
+ });
6898
6898
  //Resolve promises with data from query
6899
- for (const data of dataResponse) {
6900
- const entries = Object.entries(data);
6901
- for (const [key, val] of entries) {
6899
+ dataResponse.forEach((data) => {
6900
+ Object.entries(data).forEach(async ([key, val]) => {
6902
6901
  const waitingRequest = watingRequestsById.get(key);
6903
6902
  await this.proccesGraphQLClientEvents(extensions, waitingRequest.request, waitingRequest.resolve, waitingRequest.reject);
6904
6903
  ((waitingRequest === null || waitingRequest === void 0 ? void 0 : waitingRequest.resolve) || Promise.resolve)(val);
6905
- }
6906
- }
6904
+ });
6905
+ });
6907
6906
  }
6908
6907
  buildGraphQlURL(quietMode) {
6909
6908
  const urlParams = UrlUtils.getQueryParams(location.search);
@@ -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-773a3e4b.js';
2
+ import './pesquisa-fetcher-a87445a0.js';
3
3
  import { SortMode, ApplicationContext, UserInterface, DateUtils, ObjectUtils, 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-3aac1a53.js';
8
+ import { P as PreloadManager } from './dataunit-fetcher-3308edba.js';
9
9
  import './filter-item-type.enum-d45e026f.js';
10
- import './form-config-fetcher-adbe5d34.js';
10
+ import './form-config-fetcher-e0382e5a.js';
11
11
  import InMemoryFilterColumnDataSource from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
12
12
 
13
13
  class CrudUtils {
@@ -1,30 +1,30 @@
1
1
  import { JSUtils, DataType } from '@sankhyalabs/core';
2
2
 
3
- function getSelectedRecordsIDsInfo(dataUnit) {
4
- const selectionInfo = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getSelectionInfo();
3
+ const getSelectedIDs = (dataUnit) => {
4
+ const selectionInfo = dataUnit.getSelectionInfo();
5
5
  if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
6
6
  return [];
7
7
  }
8
8
  const selectedRecordsIDsInfo = [];
9
- const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.records;
9
+ const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.recordIds;
10
10
  if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
11
- selectedRecords.forEach(({ __record__id__ }) => {
12
- if (!dataUnit.isNewRecord(__record__id__)) {
11
+ selectedRecords.forEach(recordId => {
12
+ if (!dataUnit.isNewRecord(recordId)) {
13
13
  /*
14
14
  Esse if foi necessário para tratar corretamente o ID
15
15
  do record quando está sendo utilizado no modo standAlone
16
16
  isso não faz a exportação da grid funcionar no modo standAlone
17
17
  mas deixa de causar erro nas oprações de CRUD.
18
18
  */
19
- if (!JSUtils.isBase64(__record__id__)) {
19
+ if (!JSUtils.isBase64(recordId)) {
20
20
  selectedRecordsIDsInfo.push({
21
21
  name: "__record__id__",
22
22
  type: DataType.TEXT,
23
- value: __record__id__
23
+ value: recordId
24
24
  });
25
25
  return;
26
26
  }
27
- const revertBase64ToObject = JSON.parse(window.atob(__record__id__));
27
+ const revertBase64ToObject = JSON.parse(window.atob(recordId));
28
28
  Object.entries(revertBase64ToObject).forEach(([name, value]) => {
29
29
  const metadataField = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(name);
30
30
  if (metadataField == undefined) {
@@ -36,6 +36,6 @@ function getSelectedRecordsIDsInfo(dataUnit) {
36
36
  });
37
37
  }
38
38
  return selectedRecordsIDsInfo;
39
- }
39
+ };
40
40
 
41
- export { getSelectedRecordsIDsInfo as g };
41
+ export { getSelectedIDs as g };
@@ -1,14 +1,12 @@
1
- import { C as ConfigStorage } from './ConfigStorage-7b36d041.js';
1
+ import { C as ConfigStorage } from './ConfigStorage-e476378d.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-e0382e5a.js';
5
4
 
6
5
  class SnkFormConfigManager {
7
- constructor(configName, resourceID, onConfigChange, dataUnit) {
6
+ constructor(configName, resourceID, onConfigChange) {
8
7
  this._resourceID = resourceID;
9
8
  this._configName = configName;
10
9
  this._onConfigChange = onConfigChange;
11
- this._dataUnit = dataUnit;
12
10
  }
13
11
  addFormLegacyConfig(legacyConfigName) {
14
12
  if (this._configName) {
@@ -19,7 +17,6 @@ class SnkFormConfigManager {
19
17
  return new Promise(resolve => {
20
18
  ConfigStorage.loadFormConfig(this._configName, this._resourceID)
21
19
  .then((config) => {
22
- config = this.buildFormMetadataUITabs(config);
23
20
  this.setConfig(config);
24
21
  resolve(config);
25
22
  })
@@ -28,10 +25,6 @@ class SnkFormConfigManager {
28
25
  });
29
26
  });
30
27
  }
31
- getEmptyConfig() {
32
- const config = this.buildFormMetadataUITabs({ fields: [], emptyConfig: true }, true);
33
- return config;
34
- }
35
28
  saveConfig(config) {
36
29
  const configToSave = ObjectUtils.copy(config);
37
30
  return new Promise(accept => {
@@ -75,36 +68,25 @@ class SnkFormConfigManager {
75
68
  }
76
69
  return updatingCardConfig;
77
70
  }
78
- hasConfig(config) {
79
- var _a;
80
- const currentConfig = config !== null && config !== void 0 ? config : this._config;
81
- if (currentConfig && ((_a = currentConfig.fields) === null || _a === void 0 ? void 0 : _a.length)) {
82
- return true;
83
- }
84
- return false;
85
- }
86
- getFieldsList(descriptionFilter, forceEmptyConfig = false) {
71
+ getFieldsList(dataUnit, descriptionFilter) {
87
72
  var _a;
88
73
  const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
89
- const hasConfig = this.hasConfig();
90
- if (hasConfig && !forceEmptyConfig) {
91
- return fields.map(({ label, name, readOnly, visible, required, tab }) => {
92
- var _a;
74
+ if (fields != undefined && fields.length > 0) {
75
+ return fields.map(({ label, name, readOnly, visible, required }) => {
93
76
  if (label == undefined) {
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 });
77
+ const currentField = dataUnit.getField(name);
78
+ 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 });
96
79
  }
97
- return { name, label, readOnly, visible, required, tab };
80
+ return { name, label, readOnly, visible, required };
98
81
  })
99
82
  .filter(field => this.isFieldVisible(field, descriptionFilter));
100
83
  }
101
- if (!this._dataUnit) {
102
- return [];
84
+ if (dataUnit != undefined) {
85
+ return dataUnit.metadata.fields
86
+ .filter(field => this.isFieldVisible(field, descriptionFilter))
87
+ .map(({ label, name, readOnly }) => { return { label, name, readOnly }; });
103
88
  }
104
- const filteredFields = this._dataUnit.metadata.fields
105
- .filter(field => this.isFieldVisible(field, descriptionFilter))
106
- .map(({ label, name, readOnly, visible, required, properties }) => ({ label, name, readOnly, visible, required, tab: properties === null || properties === void 0 ? void 0 : properties.UITabName }));
107
- return filteredFields;
89
+ return [];
108
90
  }
109
91
  isFieldVisible(field, descriptionFilter) {
110
92
  if (field.visible === false) {
@@ -117,8 +99,8 @@ class SnkFormConfigManager {
117
99
  const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
118
100
  return normalizedText.includes(normalizedFilter);
119
101
  }
120
- getFormConfig(dataUnit, ignoreReadOnlyFormFields, forceEmptyConfig = false) {
121
- let fields = this.getFieldsList(undefined, forceEmptyConfig);
102
+ getFormConfig(dataUnit, ignoreReadOnlyFormFields) {
103
+ let fields = this.getFieldsList(dataUnit);
122
104
  if (ignoreReadOnlyFormFields) {
123
105
  fields = fields.filter(field => {
124
106
  if (dataUnit) {
@@ -171,44 +153,6 @@ class SnkFormConfigManager {
171
153
  async fetchDefaultConfig() {
172
154
  return this.getFormConfigFetcher().fetchDefaultConfig(this._configName, this._resourceID);
173
155
  }
174
- parseObjectList(object) {
175
- if (!object) {
176
- return [];
177
- }
178
- return Array.isArray(object) ? object : [object];
179
- }
180
- buildFormMetadataUITabs(config, forceEmptyConfig = false) {
181
- var _a;
182
- const hasConfig = this.hasConfig(config);
183
- if (!forceEmptyConfig && (!this._dataUnit || hasConfig)) {
184
- return config;
185
- }
186
- config = this.getFormConfig(this._dataUnit, false, true);
187
- config.tabs = this.parseObjectList(config.tabs);
188
- config.emptyConfig = false;
189
- config.defaultConfiguration = true;
190
- const fields = this._dataUnit.metadata.fields;
191
- for (const currentField of fields) {
192
- const field = config.fields.find(field => field.name === currentField.name);
193
- const uiTabName = (_a = currentField.properties) === null || _a === void 0 ? void 0 : _a.UITabName;
194
- if (!uiTabName || uiTabName === TAB_NAMES.main) {
195
- continue;
196
- }
197
- const haveTab = config.tabs.some((tab) => tab.label === uiTabName);
198
- if (!haveTab) {
199
- config.tabs.push({
200
- label: uiTabName,
201
- name: uiTabName,
202
- order: 0,
203
- visible: true,
204
- });
205
- }
206
- if (field) {
207
- field.tab = uiTabName;
208
- }
209
- }
210
- return config;
211
- }
212
156
  }
213
157
 
214
158
  export { SnkFormConfigManager as S };
@@ -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-e0382e5a.js';
3
3
 
4
4
  class AuthFetcher extends ResourceFetcher {
5
5
  getData(resourceID) {