@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-75070.0 → 0.0.0-bugfix-dev-KB-77074.0

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 (117) hide show
  1. package/dist/cjs/{SnkMessageBuilder-bae64d0d.js → SnkMessageBuilder-7691a2c1.js} +10 -0
  2. package/dist/cjs/index-f9e81701.js +8 -0
  3. package/dist/cjs/input-distinct-search_2.cjs.entry.js +469 -0
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  6. package/dist/cjs/snk-actions-button_4.cjs.entry.js +22 -25
  7. package/dist/cjs/snk-application.cjs.entry.js +1 -11
  8. package/dist/cjs/snk-crud.cjs.entry.js +2 -8
  9. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  10. package/dist/cjs/{snk-data-unit-3d9b6ed4.js → snk-data-unit-7dbdad0e.js} +14 -26
  11. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  12. package/dist/cjs/snk-detail-view.cjs.entry.js +1 -1
  13. package/dist/cjs/snk-distinct-search.cjs.entry.js +123 -0
  14. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +0 -3
  15. package/dist/cjs/snk-grid.cjs.entry.js +2 -10
  16. package/dist/cjs/snk-simple-crud.cjs.entry.js +4 -39
  17. package/dist/cjs/snk-taskbar.cjs.entry.js +35 -37
  18. package/dist/collection/collection-manifest.json +3 -0
  19. package/dist/collection/components/snk-actions-button/snk-actions-button.js +26 -27
  20. package/dist/collection/components/snk-application/snk-application.js +1 -41
  21. package/dist/collection/components/snk-crud/snk-crud.js +2 -26
  22. package/dist/collection/components/snk-data-unit/snk-data-unit.js +13 -25
  23. package/dist/collection/components/snk-distinct-search/snk-distinct-search.css +4 -0
  24. package/dist/collection/components/snk-distinct-search/snk-distinct-search.js +372 -0
  25. package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.css +109 -0
  26. package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.js +542 -0
  27. package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.css +27 -0
  28. package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.js +600 -0
  29. package/dist/collection/components/snk-distinct-search/utils/filter-distinct-search.js +13 -0
  30. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +0 -18
  31. package/dist/collection/components/snk-grid/snk-grid.js +2 -28
  32. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +5 -58
  33. package/dist/collection/components/snk-taskbar/snk-taskbar.js +36 -38
  34. package/dist/collection/lib/http/data-fetcher/fetchers/distinct-search-fetcher.js +25 -0
  35. package/dist/collection/lib/message/SnkMessageBuilder.js +2 -0
  36. package/dist/collection/lib/message/resources/snk-distinct-search.msg.js +9 -0
  37. package/dist/components/SnkMessageBuilder.js +10 -0
  38. package/dist/components/filter-distinct-search.js +15 -0
  39. package/dist/components/index.d.ts +3 -0
  40. package/dist/components/index.js +3 -0
  41. package/dist/components/input-distinct-search.d.ts +11 -0
  42. package/dist/components/input-distinct-search.js +6 -0
  43. package/dist/components/input-distinct-search2.js +262 -0
  44. package/dist/components/search-modal.d.ts +11 -0
  45. package/dist/components/search-modal.js +6 -0
  46. package/dist/components/search-modal2.js +264 -0
  47. package/dist/components/snk-actions-button2.js +26 -27
  48. package/dist/components/snk-application2.js +1 -12
  49. package/dist/components/snk-crud.js +2 -9
  50. package/dist/components/snk-data-unit2.js +13 -25
  51. package/dist/components/snk-distinct-search.d.ts +11 -0
  52. package/dist/components/snk-distinct-search.js +163 -0
  53. package/dist/components/snk-filter-bar2.js +0 -4
  54. package/dist/components/snk-grid2.js +2 -11
  55. package/dist/components/snk-simple-crud2.js +5 -41
  56. package/dist/components/snk-taskbar2.js +36 -38
  57. package/dist/esm/{SnkMessageBuilder-6fff4a4c.js → SnkMessageBuilder-7ace6803.js} +10 -0
  58. package/dist/esm/index-a7d3d3f1.js +8 -0
  59. package/dist/esm/input-distinct-search_2.entry.js +464 -0
  60. package/dist/esm/loader.js +1 -1
  61. package/dist/esm/sankhyablocks.js +1 -1
  62. package/dist/esm/snk-actions-button_4.entry.js +23 -26
  63. package/dist/esm/snk-application.entry.js +2 -12
  64. package/dist/esm/snk-crud.entry.js +2 -8
  65. package/dist/esm/snk-data-exporter.entry.js +2 -2
  66. package/dist/esm/{snk-data-unit-9fa7d2b9.js → snk-data-unit-7a579dbd.js} +14 -26
  67. package/dist/esm/snk-data-unit.entry.js +2 -2
  68. package/dist/esm/snk-detail-view.entry.js +1 -1
  69. package/dist/esm/snk-distinct-search.entry.js +119 -0
  70. package/dist/esm/snk-filter-bar_4.entry.js +0 -3
  71. package/dist/esm/snk-grid.entry.js +2 -10
  72. package/dist/esm/snk-simple-crud.entry.js +5 -40
  73. package/dist/esm/snk-taskbar.entry.js +36 -38
  74. package/dist/sankhyablocks/{p-7075b789.entry.js → p-00f9fe5c.entry.js} +1 -1
  75. package/dist/sankhyablocks/p-0e250436.entry.js +1 -0
  76. package/dist/sankhyablocks/p-154aa2a6.entry.js +11 -0
  77. package/dist/sankhyablocks/p-18cb1acb.entry.js +1 -0
  78. package/dist/sankhyablocks/p-1dbd5c18.entry.js +1 -0
  79. package/dist/sankhyablocks/p-2aae03a1.entry.js +1 -0
  80. package/dist/sankhyablocks/p-37074cc3.entry.js +1 -0
  81. package/dist/sankhyablocks/p-3858a2e4.entry.js +1 -0
  82. package/dist/sankhyablocks/p-563b7c28.entry.js +1 -0
  83. package/dist/sankhyablocks/{p-43353d86.entry.js → p-b389ed49.entry.js} +1 -1
  84. package/dist/sankhyablocks/p-c75fae8e.js +1 -0
  85. package/dist/sankhyablocks/p-d8665750.js +1 -0
  86. package/dist/sankhyablocks/p-f0aaad2b.entry.js +1 -0
  87. package/dist/sankhyablocks/{p-0d2a2e9e.entry.js → p-f4e221b2.entry.js} +1 -1
  88. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  89. package/dist/types/components/snk-actions-button/snk-actions-button.d.ts +2 -3
  90. package/dist/types/components/snk-application/snk-application.d.ts +1 -6
  91. package/dist/types/components/snk-crud/snk-crud.d.ts +0 -4
  92. package/dist/types/components/snk-distinct-search/snk-distinct-search.d.ts +83 -0
  93. package/dist/types/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.d.ts +105 -0
  94. package/dist/types/components/snk-distinct-search/subcomponents/search-modal/search-modal.d.ts +126 -0
  95. package/dist/types/components/snk-distinct-search/types/index.d.ts +8 -0
  96. package/dist/types/components/snk-distinct-search/utils/filter-distinct-search.d.ts +3 -0
  97. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +0 -4
  98. package/dist/types/components/snk-grid/snk-grid.d.ts +0 -4
  99. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +0 -3
  100. package/dist/types/components.d.ts +393 -31
  101. package/dist/types/lib/http/data-fetcher/fetchers/distinct-search-fetcher.d.ts +6 -0
  102. package/dist/types/lib/message/resources/snk-distinct-search.msg.d.ts +2 -0
  103. package/package.json +1 -1
  104. package/react/components.d.ts +3 -0
  105. package/react/components.js +3 -0
  106. package/react/components.js.map +1 -1
  107. package/dist/sankhyablocks/p-17425c72.js +0 -1
  108. package/dist/sankhyablocks/p-200a5481.entry.js +0 -11
  109. package/dist/sankhyablocks/p-342eeb3b.js +0 -1
  110. package/dist/sankhyablocks/p-520c7c38.entry.js +0 -1
  111. package/dist/sankhyablocks/p-83e71703.entry.js +0 -1
  112. package/dist/sankhyablocks/p-a3fadd0b.entry.js +0 -1
  113. package/dist/sankhyablocks/p-ac26df7a.entry.js +0 -1
  114. package/dist/sankhyablocks/p-af7f7b3e.entry.js +0 -1
  115. package/dist/sankhyablocks/p-c51ad0e7.entry.js +0 -1
  116. package/dist/types/components/snk-actions-button/interfaces/index.d.ts +0 -3
  117. /package/dist/collection/components/{snk-actions-button/interfaces → snk-distinct-search/types}/index.js +0 -0
@@ -146,7 +146,6 @@ const SnkGrid = class {
146
146
  this.autoLoad = undefined;
147
147
  this.autoFocus = true;
148
148
  this.enableGridInsert = false;
149
- this.enableLockManger = false;
150
149
  }
151
150
  /**
152
151
  * Exibe a janela de configurações da grade.
@@ -234,17 +233,10 @@ const SnkGrid = class {
234
233
  this._grid.setFocus();
235
234
  }
236
235
  async handleClick(event) {
237
- var _a;
238
236
  if (this.hasToBlockEvent(event)) {
239
237
  event.preventDefault();
240
238
  event.stopPropagation();
241
- if (!await this._dataUnit.cancelEdition())
242
- return;
243
- const newEvent = new event.constructor(event.type, event);
244
- (_a = event.target) === null || _a === void 0 ? void 0 : _a.dispatchEvent(newEvent);
245
- }
246
- if (this._grid && !this._grid.contains(event.target)) {
247
- this._grid.stopEdit();
239
+ await this._dataUnit.cancelEdition();
248
240
  }
249
241
  }
250
242
  hasToBlockEvent(event) {
@@ -535,7 +527,7 @@ const SnkGrid = class {
535
527
  return undefined;
536
528
  }
537
529
  return (index.h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, index.h("div", { class: "snk-grid__header ez-margin-bottom--extra-small" }, this._showSnkFilterBar &&
538
- index.h(index.Fragment, null, index.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, autoLoad: this.autoLoad }), index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), index.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' }, index.h("slot", { name: this.topTaskbarCustomSlotId }))), index.h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === index$1.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, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManger: this.enableLockManger }, index.h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this.getGridHeaderButtons(), 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 }, index.h("slot", { name: this.gridHeaderCustomSlotId }))), index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("slot", { name: "SnkGridFooter" })), index.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, 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 }))));
530
+ index.h(index.Fragment, null, index.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, autoLoad: this.autoLoad }), index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), index.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' }, index.h("slot", { name: this.topTaskbarCustomSlotId }))), index.h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === index$1.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, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert }, index.h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this.getGridHeaderButtons(), 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 }, index.h("slot", { name: this.gridHeaderCustomSlotId }))), index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("slot", { name: "SnkGridFooter" })), index.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, 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 }))));
539
531
  }
540
532
  get _element() { return index.getElement(this); }
541
533
  static get watchers() { return {
@@ -121,7 +121,6 @@ const SnkSimpleCrud = class {
121
121
  this.mode = constants.SIMPLE_CRUD_MODE.SERVER;
122
122
  this.gridConfig = undefined;
123
123
  this.formConfig = undefined;
124
- this.enableLockManger = false;
125
124
  this._formFields = [];
126
125
  this._fieldsProps = new Map();
127
126
  this._enableContinuousInsert = true;
@@ -421,7 +420,6 @@ const SnkSimpleCrud = class {
421
420
  }
422
421
  componentDidLoad() {
423
422
  utils.CSSVarsUtils.applyVarsGrid(this._element, this._grid);
424
- this.initKeyboardManager();
425
423
  }
426
424
  setCustomRenders() {
427
425
  if (!this._grid) {
@@ -807,49 +805,16 @@ const SnkSimpleCrud = class {
807
805
  return;
808
806
  this.goToView(constants.VIEW_MODE.FORM);
809
807
  }
810
- async initKeyboardManager() {
811
- const keyboardManager = new core.KeyboardManager();
812
- if (keyboardManager) {
813
- const dataUnit = this.dataUnit || await this._snkDataUnit.getDataUnit();
814
- async function saveDataUnitHandlingFocus() {
815
- const element = document.activeElement;
816
- const isDocumentBody = (element == document.body);
817
- if (!isDocumentBody)
818
- element.blur();
819
- await dataUnit.saveData();
820
- if (!isDocumentBody && element.setFocus != undefined) {
821
- element.setFocus();
822
- return;
823
- }
824
- if (!isDocumentBody)
825
- element.focus();
826
- }
827
- keyboardManager
828
- .bind("F7", saveDataUnitHandlingFocus.bind(this), { description: "Salva os dados.", element: this._element })
829
- .bind("F8", dataUnit.addRecord.bind(dataUnit), { description: "Adiciona um novo registro.", element: this._element })
830
- .bind("F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
831
- .bind("Escape", () => {
832
- if (dataUnit.isDirty()) {
833
- dataUnit.cancelEdition();
834
- }
835
- }, {
836
- debounceTime: 1000,
837
- description: "Cancela uma ação.", element: this._element
838
- });
839
- }
840
- }
841
- renderTaskbarContent() {
842
- var _a;
843
- return (index$1.h("snk-taskbar", { class: this._currentViewMode === constants.VIEW_MODE.FORM && "ez-box ez-box--shadow ez-padding--small", 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, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: index.PresentationMode.SECONDARY }, index$1.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })));
844
- }
845
808
  /* istanbul ignore next */
846
809
  render() {
810
+ var _a;
847
811
  if (this.dataUnit == undefined) {
848
812
  return;
849
813
  }
850
- return (index$1.h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: this.handleDataUnitOnInsertionMode.bind(this), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, index$1.h("header", null, index$1.h("slot", { name: "snkSimpleCrudHeader" })), index$1.h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, index$1.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index$1.h("stack-item", null, index$1.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(dataunitFetcher.InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
814
+ const taskbarContent = (index$1.h("snk-taskbar", { class: this._currentViewMode === constants.VIEW_MODE.FORM && "ez-box ez-box--shadow ez-padding--small", 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, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: index.PresentationMode.SECONDARY }, index$1.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })));
815
+ return (index$1.h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: this.handleDataUnitOnInsertionMode.bind(this), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID && !this.enableGridInsert, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, index$1.h("header", null, index$1.h("slot", { name: "snkSimpleCrudHeader" })), index$1.h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, this._currentViewMode === constants.VIEW_MODE.FORM && taskbarContent, index$1.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index$1.h("stack-item", null, index$1.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(dataunitFetcher.InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
851
816
  ? undefined
852
- : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManger: this.enableLockManger }, this.renderTaskbarContent(), index$1.h("div", { slot: "footer" }, index$1.h("slot", { name: "snkSimpleCrudFooter" })))), index$1.h("stack-item", null, this.renderTaskbarContent(), index$1.h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && index$1.h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && index$1.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$1.h("div", { id: `${this._customContainerId}` }, index$1.h("slot", { name: "SnkConfigContainerSlot" }))), index$1.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index$1.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() }))));
817
+ : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert }, this._currentViewMode === constants.VIEW_MODE.GRID && taskbarContent, index$1.h("div", { slot: "footer" }, index$1.h("slot", { name: "snkSimpleCrudFooter" })))), index$1.h("stack-item", null, index$1.h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && index$1.h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && index$1.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$1.h("div", { id: `${this._customContainerId}` }, index$1.h("slot", { name: "SnkConfigContainerSlot" }))), index$1.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index$1.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() }))));
853
818
  }
854
819
  get _element() { return index$1.getElement(this); }
855
820
  static get watchers() { return {
@@ -160,44 +160,42 @@ const SnkTaskbar = class {
160
160
  return key ? (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, {}) : "";
161
161
  }
162
162
  elementClick(elem) {
163
- core.LockManager.whenResolve(this._element, core.LockManagerOperation.TASKBAR_CLICK).then(() => {
164
- if (this.dataUnit) {
165
- switch (elem) {
166
- case taskbarElements.TaskbarElement.PREVIOUS:
167
- this.dataUnit.previousRecord();
168
- break;
169
- case taskbarElements.TaskbarElement.NEXT:
170
- this.dataUnit.nextRecord();
171
- break;
172
- case taskbarElements.TaskbarElement.REFRESH:
173
- this.dataUnit.loadData();
174
- break;
175
- case taskbarElements.TaskbarElement.CLONE:
176
- this.dataUnit.copySelected();
177
- break;
178
- case taskbarElements.TaskbarElement.REMOVE:
179
- this.dataUnit.removeSelectedRecords();
180
- break;
181
- case taskbarElements.TaskbarElement.INSERT:
182
- this.dataUnit.addRecord();
183
- break;
184
- case taskbarElements.TaskbarElement.CANCEL:
185
- this.dataUnit.cancelEdition();
186
- break;
187
- case taskbarElements.TaskbarElement.SAVE:
188
- if (!this._isWaitingForSave) {
189
- this._isWaitingForSave = true;
190
- this.dataUnit.saveData()
191
- .finally(() => {
192
- this._isWaitingForSave = false;
193
- });
194
- }
195
- break;
196
- }
163
+ if (this.dataUnit) {
164
+ switch (elem) {
165
+ case taskbarElements.TaskbarElement.PREVIOUS:
166
+ this.dataUnit.previousRecord();
167
+ break;
168
+ case taskbarElements.TaskbarElement.NEXT:
169
+ this.dataUnit.nextRecord();
170
+ break;
171
+ case taskbarElements.TaskbarElement.REFRESH:
172
+ this.dataUnit.loadData();
173
+ break;
174
+ case taskbarElements.TaskbarElement.CLONE:
175
+ this.dataUnit.copySelected();
176
+ break;
177
+ case taskbarElements.TaskbarElement.REMOVE:
178
+ this.dataUnit.removeSelectedRecords();
179
+ break;
180
+ case taskbarElements.TaskbarElement.INSERT:
181
+ this.dataUnit.addRecord();
182
+ break;
183
+ case taskbarElements.TaskbarElement.CANCEL:
184
+ this.dataUnit.cancelEdition();
185
+ break;
186
+ case taskbarElements.TaskbarElement.SAVE:
187
+ if (!this._isWaitingForSave) {
188
+ this._isWaitingForSave = true;
189
+ this.dataUnit.saveData()
190
+ .finally(() => {
191
+ this._isWaitingForSave = false;
192
+ });
193
+ }
194
+ break;
197
195
  }
198
- if (this.isEnabled(elem))
199
- this.actionClick.emit(elem);
200
- });
196
+ }
197
+ if (this.isEnabled(elem))
198
+ this.actionClick.emit(elem);
201
199
  }
202
200
  isEnabled(elem) {
203
201
  if (!this.isAllowed(elem)) {
@@ -19,6 +19,9 @@
19
19
  "./components/snk-custom-slot-elements/snk-custom-slot-elements.js",
20
20
  "./components/snk-data-exporter/snk-data-exporter.js",
21
21
  "./components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender.js",
22
+ "./components/snk-distinct-search/snk-distinct-search.js",
23
+ "./components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.js",
24
+ "./components/snk-distinct-search/subcomponents/search-modal/search-modal.js",
22
25
  "./components/snk-entity-list/snk-entity-list.js",
23
26
  "./components/snk-filter-bar/snk-filter-bar.js",
24
27
  "./components/snk-filter-bar/filter-item/editors/snk-personalized-filter-editor/snk-personalized-filter-editor.js",
@@ -1,5 +1,5 @@
1
1
  import { h, Host } from '@stencil/core';
2
- import { ApplicationContext, ArrayUtils, ElementIDUtils, ServiceUtils, StorageType } from '@sankhyalabs/core';
2
+ import { ApplicationContext, ArrayUtils, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { DataFetcher } from '../../lib/http/data-fetcher/DataFetcher';
4
4
  import ExecutorFactory from './actions/factory/executor.factory';
5
5
  import Actions from './actions';
@@ -8,7 +8,6 @@ import ResourceIDUtils from '../../lib/resourceid/ResourceIDUtils';
8
8
  export class SnkActionsButton {
9
9
  constructor() {
10
10
  this.CLIENT_EVENT_CONFIRM_NAME = "br.com.sankhya.actionbutton.clientconfirm";
11
- this._actions = [];
12
11
  this.handleClick = (evt) => {
13
12
  const selectedAction = this._actions.find((action) => action.actionID == evt.detail.id);
14
13
  const executor = new ExecutorFactory(selectedAction.type).executor;
@@ -18,22 +17,27 @@ export class SnkActionsButton {
18
17
  };
19
18
  this._items = [];
20
19
  this._showDropdown = false;
20
+ this._actions = [];
21
+ this._isOrderActions = false;
21
22
  }
22
23
  async getActions() {
23
- const actions = await ServiceUtils.useCacheWithService(`SnkActionsButton_${this._entityName}-${this._resourceID}`, async () => {
24
+ let param = {
25
+ param: {
26
+ entityName: this._entityName,
27
+ resourceID: this._resourceID
28
+ }
29
+ };
30
+ return DataFetcher.get().callServiceBroker('ActionButtonsSP.getActions', param).then((result) => {
24
31
  var _a;
25
- const param = {
26
- param: {
27
- entityName: this._entityName,
28
- resourceID: this._resourceID,
29
- },
30
- };
31
- const result = await DataFetcher.get().callServiceBroker('ActionButtonsSP.getActions', param);
32
- return ((_a = result.actions) === null || _a === void 0 ? void 0 : _a.action) || [];
33
- }, StorageType.IN_MEMORY_CACHE);
34
- this._actions = SnkActionsButton.parameters.isOrderActions
35
- ? ArrayUtils.sortAlphabetically(actions, 'description')
36
- : actions;
32
+ if (!((_a = result.actions) === null || _a === void 0 ? void 0 : _a.action))
33
+ return;
34
+ if (this._isOrderActions) {
35
+ this._actions = ArrayUtils.sortAlphabetically(result.actions.action, 'description');
36
+ }
37
+ else {
38
+ this._actions = result.actions.action;
39
+ }
40
+ });
37
41
  }
38
42
  controlDropdown() {
39
43
  this._showDropdown = !this._showDropdown;
@@ -66,7 +70,7 @@ export class SnkActionsButton {
66
70
  }
67
71
  async componentWillLoad() {
68
72
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
69
- await this.loadParameters();
73
+ this._isOrderActions = await this._application.getBooleanParam('global.ordenar.acoes.personalizadas');
70
74
  const snkDataUnit = this._element.parentElement;
71
75
  this._dataUnit = snkDataUnit === null || snkDataUnit === void 0 ? void 0 : snkDataUnit.dataUnit;
72
76
  this._resourceID = snkDataUnit === null || snkDataUnit === void 0 ? void 0 : snkDataUnit.resourceID;
@@ -75,8 +79,9 @@ export class SnkActionsButton {
75
79
  this._resourceID = await ResourceIDUtils.getResourceID();
76
80
  }
77
81
  this.setEvents();
78
- await this.getActions();
79
- this.loadItems();
82
+ this.getActions().then(() => {
83
+ this.loadItems();
84
+ });
80
85
  }
81
86
  async componentDidLoad() {
82
87
  if (!this._element)
@@ -103,11 +108,6 @@ export class SnkActionsButton {
103
108
  [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(sufix)
104
109
  };
105
110
  }
106
- async loadParameters() {
107
- if (SnkActionsButton.parameters.isOrderActions != null)
108
- return;
109
- SnkActionsButton.parameters.isOrderActions = await this._application.getBooleanParam('global.ordenar.acoes.personalizadas');
110
- }
111
111
  render() {
112
112
  return (h(Host, null, (this._actions && this._actions.length > 0) &&
113
113
  (h("div", { class: `ez-padding-left--medium snk-actions-button
@@ -134,11 +134,10 @@ export class SnkActionsButton {
134
134
  static get states() {
135
135
  return {
136
136
  "_items": {},
137
- "_showDropdown": {}
137
+ "_showDropdown": {},
138
+ "_actions": {},
139
+ "_isOrderActions": {}
138
140
  };
139
141
  }
140
142
  static get elementRef() { return "_element"; }
141
143
  }
142
- SnkActionsButton.parameters = {
143
- isOrderActions: null
144
- };
@@ -16,7 +16,6 @@ import UrlUtils from "../../lib/utils/urlutils";
16
16
  import Workspace from "../../lib/workspace/workspace";
17
17
  import { SnkErrorHandler } from "./errorhandler/snk-error-handler";
18
18
  import RequestListenerFactory from "./request-listener/RequestListenerFactory";
19
- import PreloadManager from "../../lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager";
20
19
  /**
21
20
  * É possível customizar as mensagens dos blocos de construção através de um pequeno modulo na estrutura da aplicação:
22
21
  * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
@@ -518,16 +517,6 @@ export class SnkApplication {
518
517
  async isLoadedByPk() {
519
518
  return Promise.resolve(this._isLoadedByPk);
520
519
  }
521
- /**
522
- * Remove registro do cache do PreLoader do dataunit.
523
- * Deve ser usado quando existe um dataunit usando loader do application, mas o removeLoader está sendo sobrescrito.
524
- */
525
- async preloadMangerRemoveRecord(dataUnit, recordsIDs) {
526
- const records = recordsIDs.map(id => {
527
- return { "__record__id__": id };
528
- });
529
- PreloadManager.removeRecords(dataUnit, records);
530
- }
531
520
  async getAuthList(auth) {
532
521
  return await (new MGEAuthorization()).parseFromJSON(auth);
533
522
  }
@@ -1108,7 +1097,7 @@ export class SnkApplication {
1108
1097
  "mutable": false,
1109
1098
  "complexType": {
1110
1099
  "original": "LoadByPkHandler",
1111
- "resolved": "(objPK: { pk: any; }, redirectFrom?: string) => void",
1100
+ "resolved": "(objPK: { pk: Record<string, any>; }, redirectFrom?: string) => void",
1112
1101
  "references": {
1113
1102
  "LoadByPkHandler": {
1114
1103
  "location": "global"
@@ -2212,35 +2201,6 @@ export class SnkApplication {
2212
2201
  }]
2213
2202
  }
2214
2203
  },
2215
- "preloadMangerRemoveRecord": {
2216
- "complexType": {
2217
- "signature": "(dataUnit: DataUnit, recordsIDs: Array<string>) => Promise<void>",
2218
- "parameters": [{
2219
- "tags": [],
2220
- "text": ""
2221
- }, {
2222
- "tags": [],
2223
- "text": ""
2224
- }],
2225
- "references": {
2226
- "Promise": {
2227
- "location": "global"
2228
- },
2229
- "DataUnit": {
2230
- "location": "import",
2231
- "path": "@sankhyalabs/core"
2232
- },
2233
- "Array": {
2234
- "location": "global"
2235
- }
2236
- },
2237
- "return": "Promise<void>"
2238
- },
2239
- "docs": {
2240
- "text": "Remove registro do cache do PreLoader do dataunit.\nDeve ser usado quando existe um dataunit usando loader do application, mas o removeLoader est\u00E1 sendo sobrescrito.",
2241
- "tags": []
2242
- }
2243
- },
2244
2204
  "executeSearch": {
2245
2205
  "complexType": {
2246
2206
  "signature": "(searchArgument: ISearchArgument, fieldName: string, dataUnit: DataUnit) => Promise<Array<IOption> | IOption>",
@@ -42,7 +42,6 @@ export class SnkCrud {
42
42
  this.enableGridInsert = false;
43
43
  this.domainMessagesBuilder = undefined;
44
44
  this.ignoreReadOnlyFormFields = undefined;
45
- this.enableLockManger = false;
46
45
  this.setCustomFormTitle = undefined;
47
46
  this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
48
47
  }
@@ -284,16 +283,11 @@ export class SnkCrud {
284
283
  if (!isDocumentBody)
285
284
  element.focus();
286
285
  }
287
- async function handleAddRecord() {
288
- if (!dataUnit.hasNewRecord()) {
289
- dataUnit.addRecord();
290
- }
291
- }
292
286
  keyboardManager
293
287
  .bind("F6", this.toggleView.bind(this), { description: "Alterna entre modo formulário e grade.", element: this._element })
294
288
  .bind("F7", saveDataUnitHandlingFocus.bind(this), { description: "Salva os dados.", element: this._element })
295
289
  .bind("ctrl + \\", saveDataUnitHandlingFocus.bind(this), { description: "Salva os dados.", element: this._element })
296
- .bind("F8", handleAddRecord.bind(this), { description: "Adiciona um novo registro.", element: this._element })
290
+ .bind("F8", dataUnit.addRecord.bind(dataUnit), { description: "Adiciona um novo registro.", element: this._element })
297
291
  .bind("F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
298
292
  .bind("ctrl + F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
299
293
  .bind("ctrl + .", () => {
@@ -390,7 +384,7 @@ export class SnkCrud {
390
384
  return;
391
385
  }
392
386
  this._snkDataUnit.ignoreSaveMessage = (this._currentViewMode === VIEW_MODE.GRID && !this.enableGridInsert);
393
- 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, autoLoad: this.autoLoad, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableLockManger: this.enableLockManger }, 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, enableGridInsert: this.enableGridInsert, getCustomTitle: this.setCustomFormTitle, ignoreReadOnlyFormFields: this.ignoreReadOnlyFormFields }, 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" }))));
387
+ 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, autoLoad: this.autoLoad, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert }, 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, enableGridInsert: this.enableGridInsert, getCustomTitle: this.setCustomFormTitle, ignoreReadOnlyFormFields: this.ignoreReadOnlyFormFields }, 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" }))));
394
388
  }
395
389
  static get is() { return "snk-crud"; }
396
390
  static get encapsulation() { return "scoped"; }
@@ -799,24 +793,6 @@ export class SnkCrud {
799
793
  "attribute": "ignore-read-only-form-fields",
800
794
  "reflect": false
801
795
  },
802
- "enableLockManger": {
803
- "type": "boolean",
804
- "mutable": false,
805
- "complexType": {
806
- "original": "boolean",
807
- "resolved": "boolean",
808
- "references": {}
809
- },
810
- "required": false,
811
- "optional": true,
812
- "docs": {
813
- "tags": [],
814
- "text": "Ativa o gerenciamento de locks na grade."
815
- },
816
- "attribute": "enable-lock-manger",
817
- "reflect": false,
818
- "defaultValue": "false"
819
- },
820
796
  "setCustomFormTitle": {
821
797
  "type": "unknown",
822
798
  "mutable": false,
@@ -16,7 +16,7 @@ export class SnkDataUnit {
16
16
  this._rowMetadataCache = new Map();
17
17
  this.REGEX_DATAUNIT_NAME = /dd:\/\/(.+?)\//;
18
18
  this._dataUnitObserver = async (action) => {
19
- const duState = await this.buildDataState(action.type);
19
+ const duState = this.buildDataState(action.type);
20
20
  this.dataState = duState;
21
21
  this.messagesBuilder.currentOperation = this.getMessageOperation();
22
22
  switch (action.type) {
@@ -130,22 +130,14 @@ export class SnkDataUnit {
130
130
  async getRowMetadata(record) {
131
131
  return this.doGetRowMetadata(record);
132
132
  }
133
- async doGetRowMetadata(record) {
133
+ doGetRowMetadata(record) {
134
134
  const selectedRecord = this.dataUnit.getSelectedRecord();
135
135
  if (!record && !selectedRecord) {
136
136
  return;
137
137
  }
138
138
  const currentRecord = record || selectedRecord;
139
139
  const recordId = typeof currentRecord === 'string' ? currentRecord : currentRecord.__record__id__;
140
- let rowMetadata = this._metadataByRow.get(recordId);
141
- /*
142
- Nao fazemos cache de metadataByRow pra registros novos, pois a chave do mesmo
143
- muda ao ser salvo, por isso essa tratativa é necessária para que o dataState fique com metadados
144
- corretos nao confiando apenas no _metadataByRow
145
- */
146
- if (this.dataUnit.isNewRecord(recordId) && !rowMetadata) {
147
- rowMetadata = await this.handleLoadRowMetadata(selectedRecord);
148
- }
140
+ const rowMetadata = this._metadataByRow.get(recordId);
149
141
  if (!rowMetadata) {
150
142
  return;
151
143
  }
@@ -339,7 +331,7 @@ export class SnkDataUnit {
339
331
  case Action.RECORDS_COPIED:
340
332
  return this.interceptRecordsCopied(action);
341
333
  case Action.DATA_CHANGED:
342
- await this.handleLoadRowMetadata(action.payload);
334
+ await this.handleLoadRowMetadata(action);
343
335
  return await this.interceptDataChange(action);
344
336
  case Action.CHANGING_DATA:
345
337
  return await this.interceptDataChange(action);
@@ -359,9 +351,8 @@ export class SnkDataUnit {
359
351
  return action;
360
352
  }
361
353
  }
362
- async handleLoadRowMetadata(record) {
363
- if (!record)
364
- return;
354
+ async handleLoadRowMetadata(action) {
355
+ const record = action.type === Action.DATA_CHANGED ? action.payload : action.payload.changes[0].record;
365
356
  const keysPayload = Object.keys(record);
366
357
  const rmpField = keysPayload.find((field) => this._fieldsWithRmp.includes(field));
367
358
  if (rmpField) {
@@ -440,7 +431,7 @@ export class SnkDataUnit {
440
431
  isAllowed(flag) {
441
432
  return this._permissions ? this._permissions.isSup || this._permissions[flag] : false;
442
433
  }
443
- async buildDataState(actionType) {
434
+ buildDataState(actionType) {
444
435
  var _a;
445
436
  const selectionInfo = this.dataUnit.getSelectionInfo();
446
437
  const isStartingInsertionMode = (this.dataUnit.hasDirtyRecords() || this.dataUnit.hasWaitingChanges()) && (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isEmpty());
@@ -448,7 +439,7 @@ export class SnkDataUnit {
448
439
  let rowMetadata = (_a = this.dataState) === null || _a === void 0 ? void 0 : _a.rowMetadata;
449
440
  const allowedOverwrite = [Action.SELECTION_CHANGED, Action.EDITION_CANCELED, Action.NEXT_SELECTED, Action.PREVIOUS_SELECTED];
450
441
  if (selectedRecord && (!rowMetadata || allowedOverwrite.includes(actionType))) {
451
- rowMetadata = await this.doGetRowMetadata(selectedRecord);
442
+ rowMetadata = this.doGetRowMetadata(selectedRecord);
452
443
  }
453
444
  else if (rowMetadata) {
454
445
  rowMetadata.getProp = this.buildGetPropRowMetadata(rowMetadata);
@@ -470,20 +461,17 @@ export class SnkDataUnit {
470
461
  });
471
462
  }
472
463
  async handleDataSaved(action) {
473
- var _a, _b, _c;
474
- const newRowMetadata = await this.handleLoadRowMetadata((_c = (_b = (_a = action === null || action === void 0 ? void 0 : action.payload) === null || _a === void 0 ? void 0 : _a.changes) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.record);
464
+ const newRowMetadata = await this.handleLoadRowMetadata(action);
475
465
  if (newRowMetadata) {
476
466
  newRowMetadata.getProp = this.buildGetPropRowMetadata(newRowMetadata);
477
467
  }
478
468
  const recordId = action.payload.records[0].__record__id__;
479
469
  this._metadataByRow.set(recordId, newRowMetadata);
480
- this.dataState = await this.buildDataState();
481
- let saveOperation = action.payload.changes[0]._operation.toLowerCase();
482
- if (saveOperation == 'copy')
483
- saveOperation = OperationMap.CLONE;
484
- if (this.ignoreSaveMessage && ![OperationMap.CLONE, OperationMap.INSERT].includes(saveOperation)) {
470
+ this.dataState = this.buildDataState();
471
+ if (this.ignoreSaveMessage) {
485
472
  return;
486
473
  }
474
+ const saveOperation = action.payload.changes[0]._operation.toLowerCase();
487
475
  const msg = this.getMessage("snkDataUnit.saveInfo", action.payload.records[0], saveOperation);
488
476
  if (msg != undefined) {
489
477
  this.showSuccessMessage(msg);
@@ -576,7 +564,7 @@ export class SnkDataUnit {
576
564
  const { records } = this.getMetadataByRow(this.dataUnit);
577
565
  this.dataUnit.records = records;
578
566
  }
579
- this.dataState = await this.buildDataState();
567
+ this.dataState = this.buildDataState();
580
568
  let resolver;
581
569
  while (resolver = this._onDataUnitResolve.pop()) {
582
570
  resolver(this.dataUnit);
@@ -0,0 +1,4 @@
1
+ :host {
2
+ display: block;
3
+ width: 100%;
4
+ }