@sankhyalabs/sankhyablocks 8.15.0-dev.36 → 8.15.0-dev.37

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 (87) hide show
  1. package/dist/cjs/{ConfigStorage-d4c99a5e.js → ConfigStorage-34be11ce.js} +68 -5
  2. package/dist/cjs/{SnkFormConfigManager-0ffd098d.js → SnkFormConfigManager-6211fb28.js} +6 -1
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  5. package/dist/cjs/snk-actions-button_4.cjs.entry.js +1 -1
  6. package/dist/cjs/snk-application.cjs.entry.js +8 -2
  7. package/dist/cjs/snk-crud.cjs.entry.js +4 -1
  8. package/dist/cjs/snk-detail-view.cjs.entry.js +3 -3
  9. package/dist/cjs/snk-filter-bar.cjs.entry.js +8 -1
  10. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +1 -1
  11. package/dist/cjs/snk-form.cjs.entry.js +9 -2
  12. package/dist/cjs/snk-grid.cjs.entry.js +11 -2
  13. package/dist/cjs/{snk-guides-viewer-75047f22.js → snk-guides-viewer-508bb6fe.js} +8 -1
  14. package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -3
  15. package/dist/cjs/snk-personalized-filter.cjs.entry.js +1 -1
  16. package/dist/cjs/snk-simple-crud.cjs.entry.js +64 -7
  17. package/dist/collection/components/snk-application/snk-application.js +42 -2
  18. package/dist/collection/components/snk-crud/snk-crud.js +55 -1
  19. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +24 -0
  20. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +24 -0
  21. package/dist/collection/components/snk-form/snk-form.js +24 -0
  22. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +6 -1
  23. package/dist/collection/components/snk-grid/snk-grid.js +44 -1
  24. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +99 -4
  25. package/dist/collection/lib/configs/ConfigStorage.js +63 -3
  26. package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +6 -3
  27. package/dist/components/ConfigStorage.js +68 -5
  28. package/dist/components/SnkFormConfigManager.js +5 -0
  29. package/dist/components/snk-application2.js +9 -1
  30. package/dist/components/snk-crud.js +7 -1
  31. package/dist/components/snk-detail-view2.js +8 -0
  32. package/dist/components/snk-filter-bar2.js +8 -0
  33. package/dist/components/snk-form.js +8 -0
  34. package/dist/components/snk-grid2.js +12 -1
  35. package/dist/components/snk-simple-crud2.js +64 -5
  36. package/dist/esm/{ConfigStorage-39ed8aeb.js → ConfigStorage-101a2b4c.js} +68 -5
  37. package/dist/esm/{SnkFormConfigManager-dd450734.js → SnkFormConfigManager-d86ba46f.js} +6 -1
  38. package/dist/esm/loader.js +1 -1
  39. package/dist/esm/sankhyablocks.js +1 -1
  40. package/dist/esm/snk-actions-button_4.entry.js +1 -1
  41. package/dist/esm/snk-application.entry.js +8 -2
  42. package/dist/esm/snk-crud.entry.js +4 -1
  43. package/dist/esm/snk-detail-view.entry.js +3 -3
  44. package/dist/esm/snk-filter-bar.entry.js +8 -1
  45. package/dist/esm/snk-filter-modal-item.entry.js +1 -1
  46. package/dist/esm/snk-form.entry.js +9 -2
  47. package/dist/esm/snk-grid.entry.js +11 -2
  48. package/dist/esm/{snk-guides-viewer-8b679ee6.js → snk-guides-viewer-18859840.js} +8 -1
  49. package/dist/esm/snk-guides-viewer.entry.js +3 -3
  50. package/dist/esm/snk-personalized-filter.entry.js +1 -1
  51. package/dist/esm/snk-simple-crud.entry.js +64 -7
  52. package/dist/sankhyablocks/p-1f3174cb.entry.js +1 -0
  53. package/dist/sankhyablocks/p-1fa5a18c.entry.js +11 -0
  54. package/dist/sankhyablocks/p-2b909f08.entry.js +1 -0
  55. package/dist/sankhyablocks/p-5c0b53ce.js +56 -0
  56. package/dist/sankhyablocks/p-5dbc1a3f.js +1 -0
  57. package/dist/sankhyablocks/p-60fa6c7a.js +1 -0
  58. package/dist/sankhyablocks/p-64c1b368.entry.js +1 -0
  59. package/dist/sankhyablocks/p-650f7216.entry.js +1 -0
  60. package/dist/sankhyablocks/{p-9d608b62.entry.js → p-6b28cc74.entry.js} +1 -1
  61. package/dist/sankhyablocks/{p-827e4b01.entry.js → p-7ddd95b6.entry.js} +1 -1
  62. package/dist/sankhyablocks/{p-9fb97691.entry.js → p-b41a622a.entry.js} +1 -1
  63. package/dist/sankhyablocks/{p-d0bc5ef3.entry.js → p-b4de81ac.entry.js} +1 -1
  64. package/dist/sankhyablocks/p-d01ceda6.entry.js +1 -0
  65. package/dist/sankhyablocks/{p-a1c630fb.entry.js → p-e4fb3308.entry.js} +1 -1
  66. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  67. package/dist/types/components/snk-application/snk-application.d.ts +8 -0
  68. package/dist/types/components/snk-crud/snk-crud.d.ts +12 -0
  69. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +5 -0
  70. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +5 -0
  71. package/dist/types/components/snk-form/snk-form.d.ts +5 -0
  72. package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +1 -0
  73. package/dist/types/components/snk-grid/snk-grid.d.ts +9 -0
  74. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +15 -0
  75. package/dist/types/components.d.ts +96 -0
  76. package/dist/types/lib/configs/ConfigStorage.d.ts +21 -1
  77. package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +2 -1
  78. package/package.json +1 -1
  79. package/dist/sankhyablocks/p-3e2e2424.entry.js +0 -1
  80. package/dist/sankhyablocks/p-4b0c5921.entry.js +0 -1
  81. package/dist/sankhyablocks/p-5eaecd30.entry.js +0 -1
  82. package/dist/sankhyablocks/p-67aedbe0.js +0 -56
  83. package/dist/sankhyablocks/p-746fc99e.entry.js +0 -1
  84. package/dist/sankhyablocks/p-8a00836e.js +0 -1
  85. package/dist/sankhyablocks/p-9ea14b61.js +0 -1
  86. package/dist/sankhyablocks/p-a8f1f870.entry.js +0 -1
  87. package/dist/sankhyablocks/p-c4bcdd4b.entry.js +0 -11
@@ -55,6 +55,8 @@ export class SnkGrid {
55
55
  this.gridHeaderCustomSlotId = 'GRID_HEADER_CUSTOM_ELEMENTS';
56
56
  this.topTaskbarCustomSlotId = 'GRID_TASKBAR_CUSTOM_ELEMENTS';
57
57
  this.disablePersonalizedFilter = undefined;
58
+ this.gridLegacyConfigName = undefined;
59
+ this.filterBarLegacyConfigName = undefined;
58
60
  }
59
61
  /**
60
62
  * Exibe a janela de configurações da grade.
@@ -123,6 +125,11 @@ export class SnkGrid {
123
125
  console.warn(error);
124
126
  });
125
127
  }
128
+ addGridLegacyConfigName() {
129
+ if (this.gridLegacyConfigName && this.configName) {
130
+ ConfigStorage.addGridLegacyConfig(this.configName, this.gridLegacyConfigName);
131
+ }
132
+ }
126
133
  gridConfigChangeHandler(evt) {
127
134
  const config = evt.detail;
128
135
  ConfigStorage.saveGridConfig(config, this.configName, this.resourceID);
@@ -247,6 +254,7 @@ export class SnkGrid {
247
254
  }
248
255
  componentWillLoad() {
249
256
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
257
+ //TODO: substituir pelo metodo nativo closest
250
258
  let parent = this._element.parentElement;
251
259
  while (parent) {
252
260
  if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
@@ -276,6 +284,7 @@ export class SnkGrid {
276
284
  }
277
285
  parent = parent.parentElement;
278
286
  }
287
+ this.addGridLegacyConfigName();
279
288
  this.loadConfig();
280
289
  }
281
290
  getHeaderDisabledButtons() {
@@ -390,7 +399,7 @@ export class SnkGrid {
390
399
  return undefined;
391
400
  }
392
401
  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 &&
393
- 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 }), 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 }))));
402
+ 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 }))));
394
403
  }
395
404
  static get is() { return "snk-grid"; }
396
405
  static get encapsulation() { return "scoped"; }
@@ -767,6 +776,40 @@ export class SnkGrid {
767
776
  },
768
777
  "attribute": "disable-personalized-filter",
769
778
  "reflect": false
779
+ },
780
+ "gridLegacyConfigName": {
781
+ "type": "string",
782
+ "mutable": false,
783
+ "complexType": {
784
+ "original": "string",
785
+ "resolved": "string",
786
+ "references": {}
787
+ },
788
+ "required": false,
789
+ "optional": false,
790
+ "docs": {
791
+ "tags": [],
792
+ "text": "Chave da configura\u00E7\u00E3o legado da grade."
793
+ },
794
+ "attribute": "grid-legacy-config-name",
795
+ "reflect": false
796
+ },
797
+ "filterBarLegacyConfigName": {
798
+ "type": "string",
799
+ "mutable": false,
800
+ "complexType": {
801
+ "original": "string",
802
+ "resolved": "string",
803
+ "references": {}
804
+ },
805
+ "required": false,
806
+ "optional": false,
807
+ "docs": {
808
+ "tags": [],
809
+ "text": "Chave da configura\u00E7\u00E3o legado da barra de filtros."
810
+ },
811
+ "attribute": "filter-bar-legacy-config-name",
812
+ "reflect": false
770
813
  }
771
814
  };
772
815
  }
@@ -41,6 +41,8 @@ export class SnkSimpleCrud {
41
41
  this.actionsList = undefined;
42
42
  this.configName = undefined;
43
43
  this.showConfiguratorButtons = undefined;
44
+ this.gridLegacyConfigName = undefined;
45
+ this.formLegacyConfigName = undefined;
44
46
  }
45
47
  getButtons(selected, changeModeBtn) {
46
48
  return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
@@ -94,6 +96,44 @@ export class SnkSimpleCrud {
94
96
  this.dataStateChange.emit(newValue);
95
97
  }
96
98
  }
99
+ async observeFormLegacy() {
100
+ await this.handleUpdateFormLegacyConfig();
101
+ }
102
+ async observeGridLegacy() {
103
+ await this.handleUpdateGridLegacyConfig();
104
+ }
105
+ async handleUpdateGridLegacyConfig() {
106
+ if (this.gridLegacyConfigName) {
107
+ this.addGridLegacyConfigName();
108
+ if (this._gridConfigAlreadyLoaded) {
109
+ await this.loadGridConfig(true);
110
+ }
111
+ }
112
+ }
113
+ async handleUpdateFormLegacyConfig() {
114
+ var _a, _b, _c;
115
+ if (this.formLegacyConfigName) {
116
+ const legacyConfig = await this.fetchFormLegacyConfig();
117
+ if (!legacyConfig)
118
+ return;
119
+ 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 : [];
120
+ const fields = Array.isArray(rawFields) ? rawFields : [rawFields];
121
+ const newConfig = { emptyConfig: false, fields: fields };
122
+ this.setFormConfig(newConfig, true);
123
+ this._formConfigManager.setConfig(this.formConfig);
124
+ }
125
+ }
126
+ async fetchFormLegacyConfig() {
127
+ const payload = {
128
+ 'requestBody': {
129
+ 'config': {
130
+ 'chave': this.formLegacyConfigName,
131
+ 'tipo': 'T',
132
+ },
133
+ },
134
+ };
135
+ return await this.application.callServiceBroker('SystemUtilsSP.getConf', JSON.stringify(payload));
136
+ }
97
137
  openConfig(viewMode) {
98
138
  this._snkConfigurator.close();
99
139
  if (viewMode === VIEW_MODE.GRID) {
@@ -112,10 +152,18 @@ export class SnkSimpleCrud {
112
152
  });
113
153
  }
114
154
  openFormConfig() {
155
+ //No momento não daremos suporte para configuraçao de formulário quando houver legacy config
156
+ if (this.formLegacyConfigName)
157
+ return;
115
158
  this._showFormConfig = true;
116
159
  }
117
- loadGridConfig() {
118
- if (this.gridConfig != undefined || this._gridConfigAlreadyLoaded) {
160
+ addGridLegacyConfigName() {
161
+ if (this.gridLegacyConfigName && this.configName) {
162
+ ConfigStorage.addGridLegacyConfig(this.configName, this.gridLegacyConfigName);
163
+ }
164
+ }
165
+ loadGridConfig(forceUpdate) {
166
+ if ((this.gridConfig != undefined || this._gridConfigAlreadyLoaded) && !forceUpdate) {
119
167
  return;
120
168
  }
121
169
  this._gridConfigAlreadyLoaded = true;
@@ -150,6 +198,7 @@ export class SnkSimpleCrud {
150
198
  if (this.gridConfig != undefined || this._gridConfigAlreadyLoaded) {
151
199
  return;
152
200
  }
201
+ await this.addGridLegacyConfigName();
153
202
  this.loadGridConfig();
154
203
  this.loadFormConfig();
155
204
  }
@@ -409,7 +458,9 @@ export class SnkSimpleCrud {
409
458
  this.gridConfig = config;
410
459
  CrudUtils.assertDefaultSorting(this.gridConfig, this.dataUnit);
411
460
  }
412
- setFormConfig(config) {
461
+ setFormConfig(config, forceUpdate) {
462
+ if (this.formConfig && !forceUpdate)
463
+ return;
413
464
  this.formConfig = config;
414
465
  }
415
466
  closeGridConfig() {
@@ -418,6 +469,10 @@ export class SnkSimpleCrud {
418
469
  closeFormConfig() {
419
470
  this._showFormConfig = false;
420
471
  }
472
+ //No momento não daremos suporte para configuração de formulário quando houver formLegacyConfigName
473
+ handleShowFormConfig() {
474
+ return this._showFormConfig && !this.formLegacyConfigName;
475
+ }
421
476
  /* istanbul ignore next */
422
477
  render() {
423
478
  var _a, _b, _c;
@@ -426,7 +481,7 @@ export class SnkSimpleCrud {
426
481
  }
427
482
  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)
428
483
  ? undefined
429
- : 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._showFormConfig ? "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), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this._showFormConfig && 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 }))));
484
+ : 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), 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 }))));
430
485
  }
431
486
  static get is() { return "snk-simple-crud"; }
432
487
  static get encapsulation() { return "scoped"; }
@@ -694,6 +749,40 @@ export class SnkSimpleCrud {
694
749
  },
695
750
  "attribute": "show-configurator-buttons",
696
751
  "reflect": false
752
+ },
753
+ "gridLegacyConfigName": {
754
+ "type": "string",
755
+ "mutable": false,
756
+ "complexType": {
757
+ "original": "string",
758
+ "resolved": "string",
759
+ "references": {}
760
+ },
761
+ "required": false,
762
+ "optional": false,
763
+ "docs": {
764
+ "tags": [],
765
+ "text": "Chave da configura\u00E7\u00E3o legado da grade."
766
+ },
767
+ "attribute": "grid-legacy-config-name",
768
+ "reflect": false
769
+ },
770
+ "formLegacyConfigName": {
771
+ "type": "string",
772
+ "mutable": false,
773
+ "complexType": {
774
+ "original": "string",
775
+ "resolved": "string",
776
+ "references": {}
777
+ },
778
+ "required": false,
779
+ "optional": false,
780
+ "docs": {
781
+ "tags": [],
782
+ "text": "Chave da configura\u00E7\u00E3o legado do formul\u00E1rio."
783
+ },
784
+ "attribute": "form-legacy-config-name",
785
+ "reflect": false
697
786
  }
698
787
  };
699
788
  }
@@ -957,6 +1046,12 @@ export class SnkSimpleCrud {
957
1046
  }, {
958
1047
  "propName": "dataState",
959
1048
  "methodName": "observeDataState"
1049
+ }, {
1050
+ "propName": "formLegacyConfigName",
1051
+ "methodName": "observeFormLegacy"
1052
+ }, {
1053
+ "propName": "gridLegacyConfigName",
1054
+ "methodName": "observeGridLegacy"
960
1055
  }];
961
1056
  }
962
1057
  static get listeners() {
@@ -2,18 +2,37 @@ import { FormConfigFetcher } from "../http/data-fetcher/fetchers/form-config-fet
2
2
  import GridConfigFetcher from "../http/data-fetcher/fetchers/grid-config-fetcher";
3
3
  import FilterBarConfigFetcher from "../http/data-fetcher/fetchers/filter-bar-config-fetcher";
4
4
  import PersonalizedFilterFetcher from "../http/data-fetcher/fetchers/personalized-filter-fetcher";
5
- var CONFIG_SOURCE;
5
+ export var CONFIG_SOURCE;
6
6
  (function (CONFIG_SOURCE) {
7
7
  CONFIG_SOURCE["form"] = "form";
8
8
  CONFIG_SOURCE["grid"] = "grid";
9
9
  CONFIG_SOURCE["filterBar"] = "filterBar";
10
10
  })(CONFIG_SOURCE || (CONFIG_SOURCE = {}));
11
11
  export class ConfigStorage {
12
- static preload(resourceID, configName) {
12
+ static addFilterBarLegacyConfig(configName, legacyConfigName) {
13
+ this.validateConfigName(configName, legacyConfigName);
14
+ this.filterBarLegacyConfig.set(configName, legacyConfigName);
15
+ }
16
+ static addFormLegacyConfig(configName, legacyConfigName) {
17
+ this.validateConfigName(configName, legacyConfigName);
18
+ this.formLegacyConfig.set(configName, legacyConfigName);
19
+ }
20
+ static addGridLegacyConfig(configName, legacyConfigName) {
21
+ this.validateConfigName(configName, legacyConfigName);
22
+ this.gridLegacyConfig.set(configName, legacyConfigName);
23
+ }
24
+ static preload(resourceID, configName, legacyConfigs) {
25
+ if (configName && (legacyConfigs === null || legacyConfigs === void 0 ? void 0 : legacyConfigs.gridLegacyConfig)) {
26
+ ConfigStorage.addGridLegacyConfig(configName, legacyConfigs.gridLegacyConfig);
27
+ }
28
+ if (configName && (legacyConfigs === null || legacyConfigs === void 0 ? void 0 : legacyConfigs.formLegacyConfig)) {
29
+ ConfigStorage.addFormLegacyConfig(configName, legacyConfigs.formLegacyConfig);
30
+ }
13
31
  ConfigStorage.loadFormConfig(configName, resourceID);
14
32
  ConfigStorage.loadGridConfig(configName, resourceID);
15
33
  }
16
34
  static async loadFilterBarConfig(name, resourceID, urlParams) {
35
+ urlParams = this.handleLegacyConfig(name, CONFIG_SOURCE.filterBar, urlParams);
17
36
  const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar, resourceID);
18
37
  if (!ConfigStorage.configById.has(cacheID)) {
19
38
  ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(resourceID, name, urlParams));
@@ -21,6 +40,7 @@ export class ConfigStorage {
21
40
  return ConfigStorage.configById.get(cacheID);
22
41
  }
23
42
  static async loadFormConfig(name, resourceID) {
43
+ name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.form);
24
44
  const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form, resourceID);
25
45
  if (!ConfigStorage.configById.has(cacheID)) {
26
46
  ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name, resourceID));
@@ -28,6 +48,7 @@ export class ConfigStorage {
28
48
  return ConfigStorage.configById.get(cacheID);
29
49
  }
30
50
  static async loadGridConfig(name, resourceID) {
51
+ name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.grid);
31
52
  const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid, resourceID);
32
53
  if (!ConfigStorage.configById.has(cacheID)) {
33
54
  ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name, resourceID));
@@ -39,6 +60,7 @@ export class ConfigStorage {
39
60
  return this.filterBarConfigFetcher.saveConfig(config, resourceID, name);
40
61
  }
41
62
  static async saveFormConfig(config, name, resourceID) {
63
+ name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.form);
42
64
  await this.deleteFormConfigCache(name, resourceID);
43
65
  return this.formConfigFetcher.saveConfig(config, name, resourceID);
44
66
  }
@@ -53,7 +75,8 @@ export class ConfigStorage {
53
75
  return this.gridConfigFetcher.saveConfig(config, name, resourceID);
54
76
  }
55
77
  static async loadPersonalizedFilter(filterId, resourceID, configName) {
56
- return this.personalizedFilterFetcher.loadPersonalizedFilter(resourceID, filterId, configName);
78
+ const legacyConfigName = this.filterBarLegacyConfig.get(configName);
79
+ return this.personalizedFilterFetcher.loadPersonalizedFilter(resourceID, filterId, configName, legacyConfigName);
57
80
  }
58
81
  static async savePersonalizedFilter(personalizedFilter, resourceID, configName) {
59
82
  //Ao criar ou alterar um filtro personalizado,
@@ -76,6 +99,38 @@ export class ConfigStorage {
76
99
  static async deleteFilterBarConfigCache(name, resourceID) {
77
100
  await this.deleteConfigCache(name, resourceID, CONFIG_SOURCE.filterBar);
78
101
  }
102
+ static validateConfigName(configName, legacyConfigName) {
103
+ if (!configName)
104
+ throw Error(this.CONFIG_NAME_ERROR_MESSAGE);
105
+ if (!legacyConfigName)
106
+ throw Error(this.LEGACY_CONFIG_NAME_ERROR_MESSAGE);
107
+ }
108
+ static handleLegacyConfig(configName, configSource, urlParams) {
109
+ let legacyConfigName;
110
+ switch (configSource) {
111
+ case CONFIG_SOURCE.filterBar:
112
+ legacyConfigName = this.filterBarLegacyConfig.get(configName);
113
+ break;
114
+ case CONFIG_SOURCE.grid:
115
+ legacyConfigName = this.gridLegacyConfig.get(configName);
116
+ break;
117
+ case CONFIG_SOURCE.form:
118
+ legacyConfigName = this.formLegacyConfig.get(configName);
119
+ }
120
+ const params = urlParams ? Object.assign({}, urlParams) : {};
121
+ if (legacyConfigName) {
122
+ params['legacyResourceID'] = legacyConfigName;
123
+ }
124
+ return params;
125
+ }
126
+ static handleLegacyConfigAsString(name, source) {
127
+ const params = this.handleLegacyConfig(name, source);
128
+ const legacyResourceID = params['legacyResourceID'];
129
+ if (legacyResourceID) {
130
+ name = name + `?legacyResourceID=${legacyResourceID}`;
131
+ }
132
+ return name;
133
+ }
79
134
  static async deleteConfigCache(name, resourceID, source) {
80
135
  const cacheID = ConfigStorage.buildCacheID(name, source, resourceID);
81
136
  this.configById.delete(cacheID);
@@ -87,6 +142,11 @@ export class ConfigStorage {
87
142
  return `req_${source}_${name}_${resourceID}`;
88
143
  }
89
144
  }
145
+ ConfigStorage.CONFIG_NAME_ERROR_MESSAGE = "ConfigName precisa ser informado.";
146
+ ConfigStorage.LEGACY_CONFIG_NAME_ERROR_MESSAGE = "LegacyConfigName precisa ser informado.";
147
+ ConfigStorage.filterBarLegacyConfig = new Map();
148
+ ConfigStorage.formLegacyConfig = new Map();
149
+ ConfigStorage.gridLegacyConfig = new Map();
90
150
  ConfigStorage.configById = new Map();
91
151
  ConfigStorage.filterBarConfigFetcher = new FilterBarConfigFetcher();
92
152
  ConfigStorage.formConfigFetcher = new FormConfigFetcher();
@@ -52,7 +52,7 @@ export default class PersonalizedFilterFetcher {
52
52
  assistent
53
53
  }
54
54
  }`);
55
- this.templateByQuery.set("savePersonalizedFilter", gql `
55
+ this.templateByQuery.set("savePersonalizedFilter", gql `
56
56
  mutation($name: String!, $filterAssistent: InputFilterAssistent!) {
57
57
  $queryAlias$: savePersonalizedFilter(name: $name, filterAssistent: $filterAssistent) {
58
58
  id
@@ -74,11 +74,11 @@ export default class PersonalizedFilterFetcher {
74
74
  }
75
75
  }`);
76
76
  }
77
- async loadPersonalizedFilter(resourceID, filterID, configName) {
77
+ async loadPersonalizedFilter(resourceID, filterID, configName, legacyConfigName) {
78
78
  return new Promise((resolve, reject) => {
79
79
  DataFetcher.get()
80
80
  .callGraphQL({
81
- values: { name: this.resolveURI(resourceID, configName) + "/" + filterID },
81
+ values: { name: this.resolveURI(resourceID, configName) + "/" + filterID + this.resolveLegacyConfigName(legacyConfigName) },
82
82
  query: this.templateByQuery.get("fetchFilterAssistent"),
83
83
  })
84
84
  .then((resp) => {
@@ -90,6 +90,9 @@ export default class PersonalizedFilterFetcher {
90
90
  });
91
91
  });
92
92
  }
93
+ resolveLegacyConfigName(legacyConfigName) {
94
+ return legacyConfigName ? `?legacyResourceID=${legacyConfigName}` : '';
95
+ }
93
96
  async savePersonalizedFilter(personalizedFilter, resourceID, configName) {
94
97
  if (!personalizedFilter || Object.keys(personalizedFilter).length == 0) {
95
98
  return Promise.reject(new Error("personalizedFilter não pode ser vazio"));
@@ -232,7 +232,7 @@ class PersonalizedFilterFetcher {
232
232
  assistent
233
233
  }
234
234
  }`);
235
- this.templateByQuery.set("savePersonalizedFilter", dist.gql `
235
+ this.templateByQuery.set("savePersonalizedFilter", dist.gql `
236
236
  mutation($name: String!, $filterAssistent: InputFilterAssistent!) {
237
237
  $queryAlias$: savePersonalizedFilter(name: $name, filterAssistent: $filterAssistent) {
238
238
  id
@@ -254,11 +254,11 @@ class PersonalizedFilterFetcher {
254
254
  }
255
255
  }`);
256
256
  }
257
- async loadPersonalizedFilter(resourceID, filterID, configName) {
257
+ async loadPersonalizedFilter(resourceID, filterID, configName, legacyConfigName) {
258
258
  return new Promise((resolve, reject) => {
259
259
  DataFetcher.get()
260
260
  .callGraphQL({
261
- values: { name: this.resolveURI(resourceID, configName) + "/" + filterID },
261
+ values: { name: this.resolveURI(resourceID, configName) + "/" + filterID + this.resolveLegacyConfigName(legacyConfigName) },
262
262
  query: this.templateByQuery.get("fetchFilterAssistent"),
263
263
  })
264
264
  .then((resp) => {
@@ -270,6 +270,9 @@ class PersonalizedFilterFetcher {
270
270
  });
271
271
  });
272
272
  }
273
+ resolveLegacyConfigName(legacyConfigName) {
274
+ return legacyConfigName ? `?legacyResourceID=${legacyConfigName}` : '';
275
+ }
273
276
  async savePersonalizedFilter(personalizedFilter, resourceID, configName) {
274
277
  if (!personalizedFilter || Object.keys(personalizedFilter).length == 0) {
275
278
  return Promise.reject(new Error("personalizedFilter não pode ser vazio"));
@@ -358,11 +361,30 @@ var CONFIG_SOURCE;
358
361
  CONFIG_SOURCE["filterBar"] = "filterBar";
359
362
  })(CONFIG_SOURCE || (CONFIG_SOURCE = {}));
360
363
  class ConfigStorage {
361
- static preload(resourceID, configName) {
364
+ static addFilterBarLegacyConfig(configName, legacyConfigName) {
365
+ this.validateConfigName(configName, legacyConfigName);
366
+ this.filterBarLegacyConfig.set(configName, legacyConfigName);
367
+ }
368
+ static addFormLegacyConfig(configName, legacyConfigName) {
369
+ this.validateConfigName(configName, legacyConfigName);
370
+ this.formLegacyConfig.set(configName, legacyConfigName);
371
+ }
372
+ static addGridLegacyConfig(configName, legacyConfigName) {
373
+ this.validateConfigName(configName, legacyConfigName);
374
+ this.gridLegacyConfig.set(configName, legacyConfigName);
375
+ }
376
+ static preload(resourceID, configName, legacyConfigs) {
377
+ if (configName && (legacyConfigs === null || legacyConfigs === void 0 ? void 0 : legacyConfigs.gridLegacyConfig)) {
378
+ ConfigStorage.addGridLegacyConfig(configName, legacyConfigs.gridLegacyConfig);
379
+ }
380
+ if (configName && (legacyConfigs === null || legacyConfigs === void 0 ? void 0 : legacyConfigs.formLegacyConfig)) {
381
+ ConfigStorage.addFormLegacyConfig(configName, legacyConfigs.formLegacyConfig);
382
+ }
362
383
  ConfigStorage.loadFormConfig(configName, resourceID);
363
384
  ConfigStorage.loadGridConfig(configName, resourceID);
364
385
  }
365
386
  static async loadFilterBarConfig(name, resourceID, urlParams) {
387
+ urlParams = this.handleLegacyConfig(name, CONFIG_SOURCE.filterBar, urlParams);
366
388
  const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar, resourceID);
367
389
  if (!ConfigStorage.configById.has(cacheID)) {
368
390
  ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(resourceID, name, urlParams));
@@ -370,6 +392,7 @@ class ConfigStorage {
370
392
  return ConfigStorage.configById.get(cacheID);
371
393
  }
372
394
  static async loadFormConfig(name, resourceID) {
395
+ name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.form);
373
396
  const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form, resourceID);
374
397
  if (!ConfigStorage.configById.has(cacheID)) {
375
398
  ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name, resourceID));
@@ -377,6 +400,7 @@ class ConfigStorage {
377
400
  return ConfigStorage.configById.get(cacheID);
378
401
  }
379
402
  static async loadGridConfig(name, resourceID) {
403
+ name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.grid);
380
404
  const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid, resourceID);
381
405
  if (!ConfigStorage.configById.has(cacheID)) {
382
406
  ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name, resourceID));
@@ -388,6 +412,7 @@ class ConfigStorage {
388
412
  return this.filterBarConfigFetcher.saveConfig(config, resourceID, name);
389
413
  }
390
414
  static async saveFormConfig(config, name, resourceID) {
415
+ name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.form);
391
416
  await this.deleteFormConfigCache(name, resourceID);
392
417
  return this.formConfigFetcher.saveConfig(config, name, resourceID);
393
418
  }
@@ -402,7 +427,8 @@ class ConfigStorage {
402
427
  return this.gridConfigFetcher.saveConfig(config, name, resourceID);
403
428
  }
404
429
  static async loadPersonalizedFilter(filterId, resourceID, configName) {
405
- return this.personalizedFilterFetcher.loadPersonalizedFilter(resourceID, filterId, configName);
430
+ const legacyConfigName = this.filterBarLegacyConfig.get(configName);
431
+ return this.personalizedFilterFetcher.loadPersonalizedFilter(resourceID, filterId, configName, legacyConfigName);
406
432
  }
407
433
  static async savePersonalizedFilter(personalizedFilter, resourceID, configName) {
408
434
  //Ao criar ou alterar um filtro personalizado,
@@ -425,6 +451,38 @@ class ConfigStorage {
425
451
  static async deleteFilterBarConfigCache(name, resourceID) {
426
452
  await this.deleteConfigCache(name, resourceID, CONFIG_SOURCE.filterBar);
427
453
  }
454
+ static validateConfigName(configName, legacyConfigName) {
455
+ if (!configName)
456
+ throw Error(this.CONFIG_NAME_ERROR_MESSAGE);
457
+ if (!legacyConfigName)
458
+ throw Error(this.LEGACY_CONFIG_NAME_ERROR_MESSAGE);
459
+ }
460
+ static handleLegacyConfig(configName, configSource, urlParams) {
461
+ let legacyConfigName;
462
+ switch (configSource) {
463
+ case CONFIG_SOURCE.filterBar:
464
+ legacyConfigName = this.filterBarLegacyConfig.get(configName);
465
+ break;
466
+ case CONFIG_SOURCE.grid:
467
+ legacyConfigName = this.gridLegacyConfig.get(configName);
468
+ break;
469
+ case CONFIG_SOURCE.form:
470
+ legacyConfigName = this.formLegacyConfig.get(configName);
471
+ }
472
+ const params = urlParams ? Object.assign({}, urlParams) : {};
473
+ if (legacyConfigName) {
474
+ params['legacyResourceID'] = legacyConfigName;
475
+ }
476
+ return params;
477
+ }
478
+ static handleLegacyConfigAsString(name, source) {
479
+ const params = this.handleLegacyConfig(name, source);
480
+ const legacyResourceID = params['legacyResourceID'];
481
+ if (legacyResourceID) {
482
+ name = name + `?legacyResourceID=${legacyResourceID}`;
483
+ }
484
+ return name;
485
+ }
428
486
  static async deleteConfigCache(name, resourceID, source) {
429
487
  const cacheID = ConfigStorage.buildCacheID(name, source, resourceID);
430
488
  this.configById.delete(cacheID);
@@ -436,6 +494,11 @@ class ConfigStorage {
436
494
  return `req_${source}_${name}_${resourceID}`;
437
495
  }
438
496
  }
497
+ ConfigStorage.CONFIG_NAME_ERROR_MESSAGE = "ConfigName precisa ser informado.";
498
+ ConfigStorage.LEGACY_CONFIG_NAME_ERROR_MESSAGE = "LegacyConfigName precisa ser informado.";
499
+ ConfigStorage.filterBarLegacyConfig = new Map();
500
+ ConfigStorage.formLegacyConfig = new Map();
501
+ ConfigStorage.gridLegacyConfig = new Map();
439
502
  ConfigStorage.configById = new Map();
440
503
  ConfigStorage.filterBarConfigFetcher = new FilterBarConfigFetcher();
441
504
  ConfigStorage.formConfigFetcher = new FormConfigFetcher();
@@ -8,6 +8,11 @@ class SnkFormConfigManager {
8
8
  this._configName = configName;
9
9
  this._onConfigChange = onConfigChange;
10
10
  }
11
+ addFormLegacyConfig(legacyConfigName) {
12
+ if (this._configName) {
13
+ ConfigStorage.addFormLegacyConfig(this._configName, legacyConfigName);
14
+ }
15
+ }
11
16
  async loadConfig() {
12
17
  return new Promise(resolve => {
13
18
  ConfigStorage.loadFormConfig(this._configName, this._resourceID)
@@ -292,6 +292,8 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
292
292
  this._isLoadedByPk = false;
293
293
  this.messagesBuilder = undefined;
294
294
  this.configName = undefined;
295
+ this.gridLegacyConfigName = undefined;
296
+ this.formLegacyConfigName = undefined;
295
297
  this.loadByPK = undefined;
296
298
  }
297
299
  async processPendingActions(actionsLocker) {
@@ -1198,7 +1200,11 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
1198
1200
  ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
1199
1201
  this.registerPkChangeListener();
1200
1202
  ErrorTracking.init();
1201
- ConfigStorage.preload(this.applicationResourceID, this.configName);
1203
+ let legacyConfig = {
1204
+ gridLegacyConfig: this.gridLegacyConfigName,
1205
+ formLegacyConfig: this.formLegacyConfigName
1206
+ };
1207
+ ConfigStorage.preload(this.applicationResourceID, this.configName, legacyConfig);
1202
1208
  document.addEventListener("click", () => Workspace.applicationClick());
1203
1209
  this._waitingAppReady.forEach(resolve => resolve());
1204
1210
  }
@@ -1241,6 +1247,8 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
1241
1247
  }, [2, "snk-application", {
1242
1248
  "messagesBuilder": [1040],
1243
1249
  "configName": [1, "config-name"],
1250
+ "gridLegacyConfigName": [1, "grid-legacy-config-name"],
1251
+ "formLegacyConfigName": [1, "form-legacy-config-name"],
1244
1252
  "loadByPK": [16],
1245
1253
  "getKeyboardManager": [64],
1246
1254
  "isUserSup": [64],
@@ -70,6 +70,9 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
70
70
  this.presentationMode = PresentationMode.PRIMARY;
71
71
  this.messagesBuilder = undefined;
72
72
  this.useEnterLikeTab = false;
73
+ this.gridLegacyConfigName = undefined;
74
+ this.filterBarLegacyConfigName = undefined;
75
+ this.formLegacyConfigName = undefined;
73
76
  this.disablePersonalizedFilter = undefined;
74
77
  this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
75
78
  }
@@ -321,7 +324,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
321
324
  return;
322
325
  }
323
326
  this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
324
- return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, 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("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
327
+ return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, 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("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
325
328
  }
326
329
  get _element() { return this; }
327
330
  static get watchers() { return {
@@ -341,6 +344,9 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
341
344
  "presentationMode": [1, "presentation-mode"],
342
345
  "messagesBuilder": [1040],
343
346
  "useEnterLikeTab": [4, "use-enter-like-tab"],
347
+ "gridLegacyConfigName": [1, "grid-legacy-config-name"],
348
+ "filterBarLegacyConfigName": [1, "filter-bar-legacy-config-name"],
349
+ "formLegacyConfigName": [1, "form-legacy-config-name"],
344
350
  "disablePersonalizedFilter": [4, "disable-personalized-filter"],
345
351
  "_dataUnit": [32],
346
352
  "_dataState": [32],