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

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 (76) hide show
  1. package/dist/cjs/{ConfigStorage-34be11ce.js → ConfigStorage-8d4e9d53.js} +1 -1
  2. package/dist/cjs/{SnkFormConfigManager-531a191c.js → SnkFormConfigManager-33995e92.js} +2 -2
  3. package/dist/cjs/{SnkMultiSelectionListDataSource-5213120b.js → SnkMultiSelectionListDataSource-1438f8f2.js} +1 -1
  4. package/dist/cjs/{auth-fetcher-5161d082.js → auth-fetcher-bb8e9ae4.js} +1 -1
  5. package/dist/cjs/{form-config-fetcher-9f1a13ca.js → form-config-fetcher-d73f4449.js} +12 -0
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  8. package/dist/cjs/snk-actions-button_4.cjs.entry.js +2 -2
  9. package/dist/cjs/snk-application.cjs.entry.js +3 -3
  10. package/dist/cjs/snk-attach.cjs.entry.js +2 -2
  11. package/dist/cjs/snk-crud.cjs.entry.js +2 -2
  12. package/dist/cjs/snk-detail-view.cjs.entry.js +4 -4
  13. package/dist/cjs/snk-filter-bar.cjs.entry.js +2 -2
  14. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +2 -2
  15. package/dist/cjs/snk-form-config.cjs.entry.js +1 -1
  16. package/dist/cjs/snk-form.cjs.entry.js +3 -3
  17. package/dist/cjs/snk-grid.cjs.entry.js +4 -7
  18. package/dist/cjs/{snk-guides-viewer-76b4c346.js → snk-guides-viewer-25721856.js} +2 -2
  19. package/dist/cjs/snk-guides-viewer.cjs.entry.js +4 -4
  20. package/dist/cjs/snk-personalized-filter.cjs.entry.js +2 -2
  21. package/dist/cjs/snk-simple-crud.cjs.entry.js +55 -49
  22. package/dist/collection/components/snk-grid/snk-grid.js +1 -4
  23. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +71 -46
  24. package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +12 -0
  25. package/dist/components/form-config-fetcher.js +12 -0
  26. package/dist/components/snk-grid2.js +1 -4
  27. package/dist/components/snk-simple-crud2.js +53 -46
  28. package/dist/esm/{ConfigStorage-101a2b4c.js → ConfigStorage-6e241cd7.js} +1 -1
  29. package/dist/esm/{SnkFormConfigManager-02ecf57f.js → SnkFormConfigManager-7a4e678f.js} +2 -2
  30. package/dist/esm/{SnkMultiSelectionListDataSource-7e7eada5.js → SnkMultiSelectionListDataSource-aad5d4ff.js} +1 -1
  31. package/dist/esm/{auth-fetcher-17dc5b5e.js → auth-fetcher-8ec448b0.js} +1 -1
  32. package/dist/esm/{form-config-fetcher-f121f880.js → form-config-fetcher-765b8498.js} +12 -0
  33. package/dist/esm/loader.js +1 -1
  34. package/dist/esm/sankhyablocks.js +1 -1
  35. package/dist/esm/snk-actions-button_4.entry.js +2 -2
  36. package/dist/esm/snk-application.entry.js +3 -3
  37. package/dist/esm/snk-attach.entry.js +2 -2
  38. package/dist/esm/snk-crud.entry.js +2 -2
  39. package/dist/esm/snk-detail-view.entry.js +4 -4
  40. package/dist/esm/snk-filter-bar.entry.js +2 -2
  41. package/dist/esm/snk-filter-modal-item.entry.js +2 -2
  42. package/dist/esm/snk-form-config.entry.js +1 -1
  43. package/dist/esm/snk-form.entry.js +3 -3
  44. package/dist/esm/snk-grid.entry.js +4 -7
  45. package/dist/esm/{snk-guides-viewer-90ca9105.js → snk-guides-viewer-b94752f2.js} +2 -2
  46. package/dist/esm/snk-guides-viewer.entry.js +4 -4
  47. package/dist/esm/snk-personalized-filter.entry.js +2 -2
  48. package/dist/esm/snk-simple-crud.entry.js +55 -49
  49. package/dist/sankhyablocks/p-004c356e.js +26 -0
  50. package/dist/sankhyablocks/{p-5c0b53ce.js → p-0624f62d.js} +1 -1
  51. package/dist/sankhyablocks/{p-d01ceda6.entry.js → p-0bba5c9f.entry.js} +1 -1
  52. package/dist/sankhyablocks/{p-663ff67b.entry.js → p-1048bd26.entry.js} +1 -1
  53. package/dist/sankhyablocks/p-125bb902.js +1 -0
  54. package/dist/sankhyablocks/{p-7ddd95b6.entry.js → p-24ed6ad6.entry.js} +1 -1
  55. package/dist/sankhyablocks/{p-1f3174cb.entry.js → p-2d919e32.entry.js} +1 -1
  56. package/dist/sankhyablocks/{p-1fa5a18c.entry.js → p-400097f2.entry.js} +1 -1
  57. package/dist/sankhyablocks/{p-2897fb8c.js → p-6c9adfca.js} +1 -1
  58. package/dist/sankhyablocks/{p-b41a622a.entry.js → p-85ba3d6b.entry.js} +1 -1
  59. package/dist/sankhyablocks/{p-384fd6ae.js → p-88b29791.js} +1 -1
  60. package/dist/sankhyablocks/{p-ba4871b5.entry.js → p-9e8618ec.entry.js} +1 -1
  61. package/dist/sankhyablocks/{p-7f97fee2.entry.js → p-a1642e7c.entry.js} +1 -1
  62. package/dist/sankhyablocks/{p-6b28cc74.entry.js → p-ac77949b.entry.js} +1 -1
  63. package/dist/sankhyablocks/{p-2cfe0c2c.entry.js → p-b47c2963.entry.js} +1 -1
  64. package/dist/sankhyablocks/{p-7e05bd83.entry.js → p-bf39bdb8.entry.js} +1 -1
  65. package/dist/sankhyablocks/{p-8111f63f.entry.js → p-d5cb4b5a.entry.js} +1 -1
  66. package/dist/sankhyablocks/p-e8364f8c.entry.js +1 -0
  67. package/dist/sankhyablocks/{p-fad4c2fe.js → p-efeca7ba.js} +1 -1
  68. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  69. package/dist/types/components/snk-grid/snk-grid.d.ts +0 -1
  70. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +11 -4
  71. package/dist/types/components.d.ts +8 -0
  72. package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +2 -0
  73. package/package.json +1 -1
  74. package/dist/sankhyablocks/p-50783a8b.js +0 -1
  75. package/dist/sankhyablocks/p-7c501259.entry.js +0 -1
  76. package/dist/sankhyablocks/p-a13ccb86.js +0 -26
@@ -8,16 +8,16 @@ const constants = require('./constants-35ddd366.js');
8
8
  const taskbarElements = require('./taskbar-elements-3ecd1278.js');
9
9
  require('./DataFetcher-99f0f6ed.js');
10
10
  const pesquisaFetcher = require('./pesquisa-fetcher-94f6b316.js');
11
- const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-5213120b.js');
11
+ const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-1438f8f2.js');
12
12
  const index$1 = require('./index-0922807b.js');
13
13
  require('./ISave-e91b70a7.js');
14
14
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
15
15
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
16
16
  require('./filter-item-type.enum-a7ffdaa6.js');
17
- require('./form-config-fetcher-9f1a13ca.js');
17
+ const formConfigFetcher = require('./form-config-fetcher-d73f4449.js');
18
18
  const fieldSearch = require('./field-search-f56aa7d6.js');
19
- const ConfigStorage = require('./ConfigStorage-34be11ce.js');
20
- const SnkFormConfigManager = require('./SnkFormConfigManager-531a191c.js');
19
+ const ConfigStorage = require('./ConfigStorage-8d4e9d53.js');
20
+ const SnkFormConfigManager = require('./SnkFormConfigManager-33995e92.js');
21
21
  require('./index-102ba62d.js');
22
22
  require('./PrintUtils-bcaeb82f.js');
23
23
  require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
@@ -40,6 +40,7 @@ const SnkSimpleCrud = class {
40
40
  this.configuratorCancel = index.createEvent(this, "configuratorCancel", 7);
41
41
  this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource.SnkMultiSelectionListDataSource();
42
42
  this._keyDownHandler = (event) => this.keyDownListener(event);
43
+ this._formConfigFetcher = new formConfigFetcher.FormConfigFetcher();
43
44
  this._taskbarProcessor = new fieldSearch.TaskbarProcessor({
44
45
  "snkSimpleCrudTaskbar.form_regular": this.getButtons(false, taskbarElements.TaskbarElement.GRID_MODE),
45
46
  "snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, taskbarElements.TaskbarElement.FORM_MODE),
@@ -61,6 +62,7 @@ const SnkSimpleCrud = class {
61
62
  this._formFields = [];
62
63
  this.multipleSelection = undefined;
63
64
  this.useCancelConfirm = true;
65
+ this.resourceID = undefined;
64
66
  this.taskbarManager = undefined;
65
67
  this.messagesBuilder = undefined;
66
68
  this.useEnterLikeTab = false;
@@ -71,6 +73,16 @@ const SnkSimpleCrud = class {
71
73
  this.formLegacyConfigName = undefined;
72
74
  this.ignoreReadOnlyFormFields = false;
73
75
  }
76
+ handleResourceIDChanged(newValue, oldValue) {
77
+ if (core.StringUtils.isEmpty(newValue)) {
78
+ return;
79
+ }
80
+ if (newValue === oldValue) {
81
+ return;
82
+ }
83
+ this.loadFormConfig(true);
84
+ this.loadGridConfig(true);
85
+ }
74
86
  getButtons(selected, changeModeBtn) {
75
87
  return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
76
88
  .concat(changeModeBtn));
@@ -123,45 +135,23 @@ const SnkSimpleCrud = class {
123
135
  this.dataStateChange.emit(newValue);
124
136
  }
125
137
  }
126
- async observeFormLegacy() {
127
- await this.handleUpdateFormLegacyConfig();
138
+ async observeFormLegacy(newValue, oldValue) {
139
+ await this.handleUpdateFormLegacyConfig(newValue, oldValue);
128
140
  }
129
- async observeGridLegacy() {
130
- await this.handleUpdateGridLegacyConfig();
141
+ async observeGridLegacy(newValue, oldValue) {
142
+ await this.handleUpdateGridLegacyConfig(newValue, oldValue);
131
143
  }
132
- async handleUpdateGridLegacyConfig() {
133
- if (this.gridLegacyConfigName) {
134
- this.addGridLegacyConfigName();
135
- if (this._gridConfigAlreadyLoaded) {
136
- await this.loadGridConfig(true);
137
- }
144
+ async handleUpdateGridLegacyConfig(newValue, oldValue) {
145
+ if (newValue == undefined || newValue == oldValue) {
146
+ return;
138
147
  }
148
+ await this.loadGridConfig(true);
139
149
  }
140
- async handleUpdateFormLegacyConfig() {
141
- var _a, _b, _c;
142
- if (!this.formLegacyConfigName) {
150
+ async handleUpdateFormLegacyConfig(newValue, oldValue) {
151
+ if (newValue == undefined || newValue == oldValue) {
143
152
  return;
144
153
  }
145
- const legacyConfig = await this.fetchFormLegacyConfig();
146
- if (!legacyConfig)
147
- return;
148
- const rawFields = (_c = (_b = (_a = legacyConfig === null || legacyConfig === void 0 ? void 0 : legacyConfig.formConfig) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : [];
149
- const fields = Array.isArray(rawFields) ? rawFields : [rawFields];
150
- const newConfig = { emptyConfig: false, fields: fields };
151
- this.setFormConfig(newConfig, true);
152
- const formConfigManager = this.getFormConfigManger();
153
- formConfigManager.setConfig(this.formConfig);
154
- }
155
- async fetchFormLegacyConfig() {
156
- const payload = {
157
- 'requestBody': {
158
- 'config': {
159
- 'chave': this.formLegacyConfigName,
160
- 'tipo': 'T',
161
- },
162
- },
163
- };
164
- return await this.application.callServiceBroker('SystemUtilsSP.getConf', JSON.stringify(payload));
154
+ this.loadFormConfig(true);
165
155
  }
166
156
  openConfig(viewMode) {
167
157
  this._snkConfigurator.close();
@@ -192,12 +182,16 @@ const SnkSimpleCrud = class {
192
182
  }
193
183
  }
194
184
  loadGridConfig(forceUpdate) {
185
+ if (this.configName === undefined) {
186
+ return;
187
+ }
195
188
  if ((this.gridConfig != undefined || this._gridConfigAlreadyLoaded) && !forceUpdate) {
196
189
  return;
197
190
  }
191
+ this.addGridLegacyConfigName();
198
192
  this._gridConfigAlreadyLoaded = true;
199
193
  return new Promise((accept, reject) => {
200
- ConfigStorage.ConfigStorage.loadGridConfig(this.configName, this._resourceID)
194
+ ConfigStorage.ConfigStorage.loadGridConfig(this.configName, this.resolveResourceID())
201
195
  .then(config => {
202
196
  this.setGridConfig(config);
203
197
  accept();
@@ -207,20 +201,28 @@ const SnkSimpleCrud = class {
207
201
  });
208
202
  });
209
203
  }
210
- getFormConfigManger() {
204
+ formConfigIsLoaded() {
205
+ return this.formConfig != undefined || this._formConfigAlreadyLoaded;
206
+ }
207
+ async loadFormConfig(forceLoad = false) {
208
+ if (this.configName === undefined) {
209
+ return;
210
+ }
211
211
  if (this._formConfigManager == undefined) {
212
- this._formConfigManager = new SnkFormConfigManager.SnkFormConfigManager(this.configName, this._resourceID);
212
+ this._formConfigManager = new SnkFormConfigManager.SnkFormConfigManager(this.configName, this.resolveResourceID());
213
+ this._formConfigManager.setConfig(this.formConfig);
213
214
  }
214
- return this._formConfigManager;
215
- }
216
- async loadFormConfig() {
217
- const formConfigManager = this.getFormConfigManger();
218
- formConfigManager.setConfig(this.formConfig);
219
- if (this.formConfig != undefined || this._formConfigAlreadyLoaded) {
215
+ if (this.formConfigIsLoaded() && !forceLoad) {
220
216
  return;
221
217
  }
222
218
  this._formConfigAlreadyLoaded = true;
223
- this.setFormConfig(await formConfigManager.loadConfig());
219
+ let loadedLegacyConfig = await this._formConfigFetcher.fetchLegacyConfigurableForm(this.formLegacyConfigName);
220
+ if (loadedLegacyConfig != undefined) {
221
+ this._formConfigManager.setConfig(loadedLegacyConfig);
222
+ this.setFormConfig(loadedLegacyConfig);
223
+ return;
224
+ }
225
+ this.setFormConfig(await this._formConfigManager.loadConfig());
224
226
  }
225
227
  async componentWillRender() {
226
228
  this._resourceID = await this.application.getResourceID();
@@ -475,7 +477,7 @@ const SnkSimpleCrud = class {
475
477
  }
476
478
  gridConfigChangeHandler(evt) {
477
479
  const config = evt.detail;
478
- ConfigStorage.ConfigStorage.saveGridConfig(config, this.configName, this._resourceID);
480
+ ConfigStorage.ConfigStorage.saveGridConfig(config, this.configName, this.resolveResourceID());
479
481
  evt.stopPropagation();
480
482
  }
481
483
  modalConfigChangeHandler(evt) {
@@ -506,6 +508,9 @@ const SnkSimpleCrud = class {
506
508
  handleShowFormConfig() {
507
509
  return this._showFormConfig && !this.formLegacyConfigName;
508
510
  }
511
+ resolveResourceID() {
512
+ return core.StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
513
+ }
509
514
  /* istanbul ignore next */
510
515
  render() {
511
516
  var _a, _b, _c;
@@ -514,10 +519,11 @@ const SnkSimpleCrud = class {
514
519
  }
515
520
  return (index.h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), onInsertionMode: () => this.goToView(constants.VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, index.h("header", null, index.h("slot", { name: "snkSimpleCrudHeader" })), index.h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, index.h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: index$1.PresentationMode.SECONDARY }, index.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index.h("stack-item", null, index.h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(constants.VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(pesquisaFetcher.InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
516
521
  ? undefined
517
- : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, index.h("div", { slot: "footer" }, index.h("slot", { name: "snkSimpleCrudFooter" })))), index.h("stack-item", null, index.h("ez-form", { class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: (_b = this._formConfigManager) === null || _b === void 0 ? void 0 : _b.getConfig((_c = this.dataState) === null || _c === void 0 ? void 0 : _c.insertionMode, this.dataUnit, this.ignoreReadOnlyFormFields), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && index.h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && index.h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this._customContainerId })), index.h("div", { id: `${this._customContainerId}` }, index.h("slot", { name: "SnkConfigContainerSlot" }))), index.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this._resourceID }))));
522
+ : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, index.h("div", { slot: "footer" }, index.h("slot", { name: "snkSimpleCrudFooter" })))), index.h("stack-item", null, index.h("ez-form", { class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: (_b = this._formConfigManager) === null || _b === void 0 ? void 0 : _b.getConfig((_c = this.dataState) === null || _c === void 0 ? void 0 : _c.insertionMode, this.dataUnit, this.ignoreReadOnlyFormFields), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && index.h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && index.h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), index.h("div", { id: `${this._customContainerId}` }, index.h("slot", { name: "SnkConfigContainerSlot" }))), index.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
518
523
  }
519
524
  get _element() { return index.getElement(this); }
520
525
  static get watchers() { return {
526
+ "resourceID": ["handleResourceIDChanged"],
521
527
  "mode": ["onModeChange"],
522
528
  "dataState": ["observeDataState"],
523
529
  "formLegacyConfigName": ["observeFormLegacy"],
@@ -404,15 +404,12 @@ export class SnkGrid {
404
404
  }
405
405
  this._showSnkFilterBar = true;
406
406
  }
407
- getConfig() {
408
- return this._gridConfig == undefined ? undefined : Object.assign({}, this._gridConfig);
409
- }
410
407
  render() {
411
408
  if (!this._dataUnit) {
412
409
  return undefined;
413
410
  }
414
411
  return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, this._showSnkFilterBar &&
415
- h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this.getConfig(), onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
412
+ h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
416
413
  }
417
414
  static get is() { return "snk-grid"; }
418
415
  static get encapsulation() { return "scoped"; }
@@ -2,7 +2,7 @@ import { ApplicationContext, DataType, ElementIDUtils, FloatingManager, JSUtils,
2
2
  import { h } from '@stencil/core';
3
3
  import { SIMPLE_CRUD_MODE, VIEW_MODE } from '../../lib/utils/constants';
4
4
  import { TaskbarElement } from '../snk-taskbar/elements/taskbar-elements';
5
- import { CrudUtils, PresentationMode } from '../../lib';
5
+ import { CrudUtils, FormConfigFetcher, PresentationMode } from '../../lib';
6
6
  import TaskbarProcessor from '../snk-taskbar/processor/taskbar-processor';
7
7
  import InMemoryLoader from '../../lib/dataUnit/InMemoryLoader';
8
8
  import SnkMultiSelectionListDataSource from '../snk-grid/filtercolumn/SnkMultiSelectionListDataSource';
@@ -14,6 +14,7 @@ export class SnkSimpleCrud {
14
14
  constructor() {
15
15
  this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
16
16
  this._keyDownHandler = (event) => this.keyDownListener(event);
17
+ this._formConfigFetcher = new FormConfigFetcher();
17
18
  this._taskbarProcessor = new TaskbarProcessor({
18
19
  "snkSimpleCrudTaskbar.form_regular": this.getButtons(false, TaskbarElement.GRID_MODE),
19
20
  "snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, TaskbarElement.FORM_MODE),
@@ -35,6 +36,7 @@ export class SnkSimpleCrud {
35
36
  this._formFields = [];
36
37
  this.multipleSelection = undefined;
37
38
  this.useCancelConfirm = true;
39
+ this.resourceID = undefined;
38
40
  this.taskbarManager = undefined;
39
41
  this.messagesBuilder = undefined;
40
42
  this.useEnterLikeTab = false;
@@ -45,6 +47,16 @@ export class SnkSimpleCrud {
45
47
  this.formLegacyConfigName = undefined;
46
48
  this.ignoreReadOnlyFormFields = false;
47
49
  }
50
+ handleResourceIDChanged(newValue, oldValue) {
51
+ if (StringUtils.isEmpty(newValue)) {
52
+ return;
53
+ }
54
+ if (newValue === oldValue) {
55
+ return;
56
+ }
57
+ this.loadFormConfig(true);
58
+ this.loadGridConfig(true);
59
+ }
48
60
  getButtons(selected, changeModeBtn) {
49
61
  return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
50
62
  .concat(changeModeBtn));
@@ -97,45 +109,23 @@ export class SnkSimpleCrud {
97
109
  this.dataStateChange.emit(newValue);
98
110
  }
99
111
  }
100
- async observeFormLegacy() {
101
- await this.handleUpdateFormLegacyConfig();
112
+ async observeFormLegacy(newValue, oldValue) {
113
+ await this.handleUpdateFormLegacyConfig(newValue, oldValue);
102
114
  }
103
- async observeGridLegacy() {
104
- await this.handleUpdateGridLegacyConfig();
115
+ async observeGridLegacy(newValue, oldValue) {
116
+ await this.handleUpdateGridLegacyConfig(newValue, oldValue);
105
117
  }
106
- async handleUpdateGridLegacyConfig() {
107
- if (this.gridLegacyConfigName) {
108
- this.addGridLegacyConfigName();
109
- if (this._gridConfigAlreadyLoaded) {
110
- await this.loadGridConfig(true);
111
- }
118
+ async handleUpdateGridLegacyConfig(newValue, oldValue) {
119
+ if (newValue == undefined || newValue == oldValue) {
120
+ return;
112
121
  }
122
+ await this.loadGridConfig(true);
113
123
  }
114
- async handleUpdateFormLegacyConfig() {
115
- var _a, _b, _c;
116
- if (!this.formLegacyConfigName) {
124
+ async handleUpdateFormLegacyConfig(newValue, oldValue) {
125
+ if (newValue == undefined || newValue == oldValue) {
117
126
  return;
118
127
  }
119
- const legacyConfig = await this.fetchFormLegacyConfig();
120
- if (!legacyConfig)
121
- return;
122
- const rawFields = (_c = (_b = (_a = legacyConfig === null || legacyConfig === void 0 ? void 0 : legacyConfig.formConfig) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : [];
123
- const fields = Array.isArray(rawFields) ? rawFields : [rawFields];
124
- const newConfig = { emptyConfig: false, fields: fields };
125
- this.setFormConfig(newConfig, true);
126
- const formConfigManager = this.getFormConfigManger();
127
- formConfigManager.setConfig(this.formConfig);
128
- }
129
- async fetchFormLegacyConfig() {
130
- const payload = {
131
- 'requestBody': {
132
- 'config': {
133
- 'chave': this.formLegacyConfigName,
134
- 'tipo': 'T',
135
- },
136
- },
137
- };
138
- return await this.application.callServiceBroker('SystemUtilsSP.getConf', JSON.stringify(payload));
128
+ this.loadFormConfig(true);
139
129
  }
140
130
  openConfig(viewMode) {
141
131
  this._snkConfigurator.close();
@@ -166,12 +156,16 @@ export class SnkSimpleCrud {
166
156
  }
167
157
  }
168
158
  loadGridConfig(forceUpdate) {
159
+ if (this.configName === undefined) {
160
+ return;
161
+ }
169
162
  if ((this.gridConfig != undefined || this._gridConfigAlreadyLoaded) && !forceUpdate) {
170
163
  return;
171
164
  }
165
+ this.addGridLegacyConfigName();
172
166
  this._gridConfigAlreadyLoaded = true;
173
167
  return new Promise((accept, reject) => {
174
- ConfigStorage.loadGridConfig(this.configName, this._resourceID)
168
+ ConfigStorage.loadGridConfig(this.configName, this.resolveResourceID())
175
169
  .then(config => {
176
170
  this.setGridConfig(config);
177
171
  accept();
@@ -181,20 +175,28 @@ export class SnkSimpleCrud {
181
175
  });
182
176
  });
183
177
  }
184
- getFormConfigManger() {
178
+ formConfigIsLoaded() {
179
+ return this.formConfig != undefined || this._formConfigAlreadyLoaded;
180
+ }
181
+ async loadFormConfig(forceLoad = false) {
182
+ if (this.configName === undefined) {
183
+ return;
184
+ }
185
185
  if (this._formConfigManager == undefined) {
186
- this._formConfigManager = new SnkFormConfigManager(this.configName, this._resourceID);
186
+ this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
187
+ this._formConfigManager.setConfig(this.formConfig);
187
188
  }
188
- return this._formConfigManager;
189
- }
190
- async loadFormConfig() {
191
- const formConfigManager = this.getFormConfigManger();
192
- formConfigManager.setConfig(this.formConfig);
193
- if (this.formConfig != undefined || this._formConfigAlreadyLoaded) {
189
+ if (this.formConfigIsLoaded() && !forceLoad) {
194
190
  return;
195
191
  }
196
192
  this._formConfigAlreadyLoaded = true;
197
- this.setFormConfig(await formConfigManager.loadConfig());
193
+ let loadedLegacyConfig = await this._formConfigFetcher.fetchLegacyConfigurableForm(this.formLegacyConfigName);
194
+ if (loadedLegacyConfig != undefined) {
195
+ this._formConfigManager.setConfig(loadedLegacyConfig);
196
+ this.setFormConfig(loadedLegacyConfig);
197
+ return;
198
+ }
199
+ this.setFormConfig(await this._formConfigManager.loadConfig());
198
200
  }
199
201
  async componentWillRender() {
200
202
  this._resourceID = await this.application.getResourceID();
@@ -449,7 +451,7 @@ export class SnkSimpleCrud {
449
451
  }
450
452
  gridConfigChangeHandler(evt) {
451
453
  const config = evt.detail;
452
- ConfigStorage.saveGridConfig(config, this.configName, this._resourceID);
454
+ ConfigStorage.saveGridConfig(config, this.configName, this.resolveResourceID());
453
455
  evt.stopPropagation();
454
456
  }
455
457
  modalConfigChangeHandler(evt) {
@@ -480,6 +482,9 @@ export class SnkSimpleCrud {
480
482
  handleShowFormConfig() {
481
483
  return this._showFormConfig && !this.formLegacyConfigName;
482
484
  }
485
+ resolveResourceID() {
486
+ return StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
487
+ }
483
488
  /* istanbul ignore next */
484
489
  render() {
485
490
  var _a, _b, _c;
@@ -488,7 +493,7 @@ export class SnkSimpleCrud {
488
493
  }
489
494
  return (h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
490
495
  ? undefined
491
- : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: (_b = this._formConfigManager) === null || _b === void 0 ? void 0 : _b.getConfig((_c = this.dataState) === null || _c === void 0 ? void 0 : _c.insertionMode, this.dataUnit, this.ignoreReadOnlyFormFields), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this._resourceID }))));
496
+ : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: (_b = this._formConfigManager) === null || _b === void 0 ? void 0 : _b.getConfig((_c = this.dataState) === null || _c === void 0 ? void 0 : _c.insertionMode, this.dataUnit, this.ignoreReadOnlyFormFields), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
492
497
  }
493
498
  static get is() { return "snk-simple-crud"; }
494
499
  static get encapsulation() { return "scoped"; }
@@ -642,6 +647,23 @@ export class SnkSimpleCrud {
642
647
  "reflect": false,
643
648
  "defaultValue": "true"
644
649
  },
650
+ "resourceID": {
651
+ "type": "string",
652
+ "mutable": false,
653
+ "complexType": {
654
+ "original": "string",
655
+ "resolved": "string",
656
+ "references": {}
657
+ },
658
+ "required": false,
659
+ "optional": false,
660
+ "docs": {
661
+ "tags": [],
662
+ "text": "Identificador de recursos como configura\u00E7\u00F5es e acesso."
663
+ },
664
+ "attribute": "resource-i-d",
665
+ "reflect": false
666
+ },
645
667
  "taskbarManager": {
646
668
  "type": "unknown",
647
669
  "mutable": false,
@@ -1066,6 +1088,9 @@ export class SnkSimpleCrud {
1066
1088
  static get elementRef() { return "_element"; }
1067
1089
  static get watchers() {
1068
1090
  return [{
1091
+ "propName": "resourceID",
1092
+ "methodName": "handleResourceIDChanged"
1093
+ }, {
1069
1094
  "propName": "mode",
1070
1095
  "methodName": "onModeChange"
1071
1096
  }, {
@@ -168,6 +168,18 @@ export class FormConfigFetcher extends ResourceFetcher {
168
168
  }
169
169
  return `cfg://${authority}/${resourceID}`;
170
170
  }
171
+ async fetchLegacyConfigurableForm(configName) {
172
+ const payload = { 'requestBody': { 'config': { 'chave': configName, 'tipo': 'T' } } };
173
+ const response = await DataFetcher.get().callServiceBroker('SystemUtilsSP.getConf', JSON.stringify(payload));
174
+ if (ObjectUtils.isEmpty(response))
175
+ return undefined;
176
+ return this.buildLegacyConfigurableForm(response);
177
+ }
178
+ buildLegacyConfigurableForm(config) {
179
+ var _a, _b, _c;
180
+ const rawFields = (_c = (_b = (_a = config === null || config === void 0 ? void 0 : config.formConfig) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : [];
181
+ return { emptyConfig: false, fields: Array.isArray(rawFields) ? rawFields : [rawFields] };
182
+ }
171
183
  }
172
184
  export var UserConfigType;
173
185
  (function (UserConfigType) {
@@ -230,6 +230,18 @@ class FormConfigFetcher extends ResourceFetcher {
230
230
  }
231
231
  return `cfg://${authority}/${resourceID}`;
232
232
  }
233
+ async fetchLegacyConfigurableForm(configName) {
234
+ const payload = { 'requestBody': { 'config': { 'chave': configName, 'tipo': 'T' } } };
235
+ const response = await DataFetcher.get().callServiceBroker('SystemUtilsSP.getConf', JSON.stringify(payload));
236
+ if (ObjectUtils.isEmpty(response))
237
+ return undefined;
238
+ return this.buildLegacyConfigurableForm(response);
239
+ }
240
+ buildLegacyConfigurableForm(config) {
241
+ var _a, _b, _c;
242
+ const rawFields = (_c = (_b = (_a = config === null || config === void 0 ? void 0 : config.formConfig) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : [];
243
+ return { emptyConfig: false, fields: Array.isArray(rawFields) ? rawFields : [rawFields] };
244
+ }
233
245
  }
234
246
  var UserConfigType;
235
247
  (function (UserConfigType) {
@@ -430,15 +430,12 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
430
430
  }
431
431
  this._showSnkFilterBar = true;
432
432
  }
433
- getConfig() {
434
- return this._gridConfig == undefined ? undefined : Object.assign({}, this._gridConfig);
435
- }
436
433
  render() {
437
434
  if (!this._dataUnit) {
438
435
  return undefined;
439
436
  }
440
437
  return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, this._showSnkFilterBar &&
441
- h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this.getConfig(), onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
438
+ h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
442
439
  }
443
440
  get _element() { return this; }
444
441
  static get watchers() { return {