@sankhyalabs/sankhyablocks 8.15.0-dev.63 → 8.15.0-dev.65

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 (86) hide show
  1. package/dist/cjs/{IExporterProvider-98a012a4.js → IExporterProvider-90690372.js} +1 -1
  2. package/dist/cjs/{SnkFormConfigManager-dda10d75.js → SnkFormConfigManager-7b222c78.js} +2 -2
  3. package/dist/cjs/{dataunit-fetcher-e2109392.js → dataunit-fetcher-7a08e4dd.js} +6 -2
  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 +1 -1
  7. package/dist/cjs/snk-application.cjs.entry.js +1 -1
  8. package/dist/cjs/snk-attach.cjs.entry.js +1 -1
  9. package/dist/cjs/snk-crud.cjs.entry.js +3 -2
  10. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  11. package/dist/cjs/{snk-data-unit-dee38ccd.js → snk-data-unit-3718477f.js} +79 -23
  12. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  13. package/dist/cjs/snk-detail-view.cjs.entry.js +3 -3
  14. package/dist/cjs/snk-filter-bar.cjs.entry.js +5 -1
  15. package/dist/cjs/snk-form.cjs.entry.js +1 -1
  16. package/dist/cjs/snk-grid.cjs.entry.js +4 -3
  17. package/dist/cjs/{snk-guides-viewer-af4a6ae5.js → snk-guides-viewer-545dd904.js} +2 -2
  18. package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -3
  19. package/dist/cjs/snk-simple-crud.cjs.entry.js +14 -5
  20. package/dist/collection/components/snk-crud/snk-crud.js +19 -1
  21. package/dist/collection/components/snk-data-unit/snk-data-unit.js +98 -23
  22. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +22 -1
  23. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +2 -2
  24. package/dist/collection/components/snk-grid/snk-grid.js +19 -1
  25. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +28 -2
  26. package/dist/collection/lib/dataUnit/InMemoryLoader.js +6 -2
  27. package/dist/collection/lib/dataUnit/interfaces/InMemoryLoaderConfig.js +1 -0
  28. package/dist/components/SnkFormConfigManager.js +2 -2
  29. package/dist/components/dataunit-fetcher.js +6 -2
  30. package/dist/components/snk-crud.js +3 -1
  31. package/dist/components/snk-data-unit2.js +80 -23
  32. package/dist/components/snk-filter-bar2.js +6 -1
  33. package/dist/components/snk-grid2.js +3 -1
  34. package/dist/components/snk-simple-crud2.js +12 -2
  35. package/dist/esm/{IExporterProvider-8f085554.js → IExporterProvider-ce2ca127.js} +1 -1
  36. package/dist/esm/{SnkFormConfigManager-87bd8082.js → SnkFormConfigManager-3bdb3e1f.js} +2 -2
  37. package/dist/esm/{dataunit-fetcher-87ecba4a.js → dataunit-fetcher-f3fa35b9.js} +6 -2
  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 +1 -1
  42. package/dist/esm/snk-attach.entry.js +1 -1
  43. package/dist/esm/snk-crud.entry.js +3 -2
  44. package/dist/esm/snk-data-exporter.entry.js +2 -2
  45. package/dist/esm/{snk-data-unit-1132e40b.js → snk-data-unit-8d6afa43.js} +80 -24
  46. package/dist/esm/snk-data-unit.entry.js +2 -2
  47. package/dist/esm/snk-detail-view.entry.js +3 -3
  48. package/dist/esm/snk-filter-bar.entry.js +5 -1
  49. package/dist/esm/snk-form.entry.js +1 -1
  50. package/dist/esm/snk-grid.entry.js +4 -3
  51. package/dist/esm/{snk-guides-viewer-359e39a7.js → snk-guides-viewer-081bcf90.js} +2 -2
  52. package/dist/esm/snk-guides-viewer.entry.js +3 -3
  53. package/dist/esm/snk-simple-crud.entry.js +14 -5
  54. package/dist/sankhyablocks/{p-80031650.js → p-109e0551.js} +1 -1
  55. package/dist/sankhyablocks/{p-0bcc6e83.js → p-1122030d.js} +1 -1
  56. package/dist/sankhyablocks/{p-f72e8835.entry.js → p-24880828.entry.js} +1 -1
  57. package/dist/sankhyablocks/{p-b11921ca.entry.js → p-34935c5a.entry.js} +1 -1
  58. package/dist/sankhyablocks/p-39f8ebb3.entry.js +1 -0
  59. package/dist/sankhyablocks/{p-66a31d30.entry.js → p-3e4c2cfe.entry.js} +1 -1
  60. package/dist/sankhyablocks/p-5bd78e4c.entry.js +1 -0
  61. package/dist/sankhyablocks/{p-873d2e6a.entry.js → p-ad772831.entry.js} +1 -1
  62. package/dist/sankhyablocks/{p-d799aa7f.entry.js → p-af3e1265.entry.js} +1 -1
  63. package/dist/sankhyablocks/p-b27114c4.js +1 -0
  64. package/dist/sankhyablocks/{p-83950924.entry.js → p-b643f746.entry.js} +1 -1
  65. package/dist/sankhyablocks/{p-da6e3dcf.entry.js → p-e238279a.entry.js} +1 -1
  66. package/dist/sankhyablocks/p-e4e044cf.entry.js +1 -0
  67. package/dist/sankhyablocks/p-eae66367.js +1 -0
  68. package/dist/sankhyablocks/p-ecc666ef.entry.js +1 -0
  69. package/dist/sankhyablocks/{p-931343a1.entry.js → p-ee1d9c09.entry.js} +1 -1
  70. package/dist/sankhyablocks/{p-08fee6e8.js → p-fde91811.js} +1 -1
  71. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  72. package/dist/types/components/snk-crud/snk-crud.d.ts +4 -0
  73. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +16 -1
  74. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
  75. package/dist/types/components/snk-grid/snk-grid.d.ts +4 -0
  76. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +5 -0
  77. package/dist/types/components.d.ts +36 -0
  78. package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +2 -1
  79. package/dist/types/lib/dataUnit/interfaces/InMemoryLoaderConfig.d.ts +3 -0
  80. package/package.json +1 -1
  81. package/dist/sankhyablocks/p-00a7ede4.entry.js +0 -1
  82. package/dist/sankhyablocks/p-2eb90860.js +0 -1
  83. package/dist/sankhyablocks/p-4ef47eb8.entry.js +0 -1
  84. package/dist/sankhyablocks/p-7ecaaea2.entry.js +0 -1
  85. package/dist/sankhyablocks/p-cb91634d.js +0 -1
  86. package/dist/sankhyablocks/p-cf9d2d1e.entry.js +0 -1
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-f9e81701.js');
6
6
  const core = require('@sankhyalabs/core');
7
- const SnkFormConfigManager = require('./SnkFormConfigManager-dda10d75.js');
7
+ const SnkFormConfigManager = require('./SnkFormConfigManager-7b222c78.js');
8
8
  const ResourceIDUtils = require('./ResourceIDUtils-5ff86aa7.js');
9
9
  require('./ConfigStorage-9a53a42c.js');
10
10
  require('./form-config-fetcher-3f430aee.js');
@@ -9,14 +9,14 @@ const ConfigStorage = require('./ConfigStorage-9a53a42c.js');
9
9
  const index$1 = require('./index-0922807b.js');
10
10
  const fieldSearch = require('./field-search-f56aa7d6.js');
11
11
  const index$2 = require('./index-102ba62d.js');
12
- const IExporterProvider = require('./IExporterProvider-98a012a4.js');
12
+ const IExporterProvider = require('./IExporterProvider-90690372.js');
13
13
  const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
14
14
  require('./DataFetcher-515bda03.js');
15
15
  require('./pesquisa-fetcher-916a935c.js');
16
16
  require('./ISave-e91b70a7.js');
17
17
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
18
18
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
19
- require('./dataunit-fetcher-e2109392.js');
19
+ require('./dataunit-fetcher-7a08e4dd.js');
20
20
  require('./filter-item-type.enum-a7ffdaa6.js');
21
21
  require('./form-config-fetcher-3f430aee.js');
22
22
  const RecordIDUtils = require('./RecordIDUtils-3735135c.js');
@@ -140,6 +140,7 @@ const SnkGrid = class {
140
140
  this.disablePersonalizedFilter = undefined;
141
141
  this.gridLegacyConfigName = undefined;
142
142
  this.filterBarLegacyConfigName = undefined;
143
+ this.autoLoad = undefined;
143
144
  }
144
145
  /**
145
146
  * Exibe a janela de configurações da grade.
@@ -436,7 +437,7 @@ const SnkGrid = class {
436
437
  return undefined;
437
438
  }
438
439
  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--medium" }, this._showSnkFilterBar &&
439
- 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 }), 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 }, index.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 }, 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 }))));
440
+ 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 }, index.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 }, 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 }))));
440
441
  }
441
442
  get _element() { return index.getElement(this); }
442
443
  static get watchers() { return {
@@ -2,7 +2,7 @@
2
2
 
3
3
  const index = require('./index-f9e81701.js');
4
4
  const core = require('@sankhyalabs/core');
5
- const SnkFormConfigManager = require('./SnkFormConfigManager-dda10d75.js');
5
+ const SnkFormConfigManager = require('./SnkFormConfigManager-7b222c78.js');
6
6
  const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
7
7
  const fieldSearch = require('./field-search-f56aa7d6.js');
8
8
  const taskbarElements = require('./taskbar-elements-d9392685.js');
@@ -13,7 +13,7 @@ const index$1 = require('./index-0922807b.js');
13
13
  require('./ISave-e91b70a7.js');
14
14
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
15
15
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
16
- require('./dataunit-fetcher-e2109392.js');
16
+ require('./dataunit-fetcher-7a08e4dd.js');
17
17
  require('./filter-item-type.enum-a7ffdaa6.js');
18
18
  require('./form-config-fetcher-3f430aee.js');
19
19
  const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const snkGuidesViewer = require('./snk-guides-viewer-af4a6ae5.js');
5
+ const snkGuidesViewer = require('./snk-guides-viewer-545dd904.js');
6
6
  require('./index-f9e81701.js');
7
7
  require('@sankhyalabs/core');
8
- require('./SnkFormConfigManager-dda10d75.js');
8
+ require('./SnkFormConfigManager-7b222c78.js');
9
9
  require('./ConfigStorage-9a53a42c.js');
10
10
  require('./form-config-fetcher-3f430aee.js');
11
11
  require('./DataFetcher-515bda03.js');
@@ -21,7 +21,7 @@ require('./constants-35ddd366.js');
21
21
  require('./pesquisa-fetcher-916a935c.js');
22
22
  require('./ISave-e91b70a7.js');
23
23
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
24
- require('./dataunit-fetcher-e2109392.js');
24
+ require('./dataunit-fetcher-7a08e4dd.js');
25
25
  require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
26
26
  require('@sankhyalabs/core/dist/utils/SortingUtils');
27
27
  require('./ResourceIDUtils-5ff86aa7.js');
@@ -9,17 +9,17 @@ const constants = require('./constants-35ddd366.js');
9
9
  const taskbarElements = require('./taskbar-elements-d9392685.js');
10
10
  require('./DataFetcher-515bda03.js');
11
11
  require('./pesquisa-fetcher-916a935c.js');
12
- const IExporterProvider = require('./IExporterProvider-98a012a4.js');
12
+ const IExporterProvider = require('./IExporterProvider-90690372.js');
13
13
  const index = require('./index-0922807b.js');
14
14
  require('./ISave-e91b70a7.js');
15
15
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
16
16
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
17
- const dataunitFetcher = require('./dataunit-fetcher-e2109392.js');
17
+ const dataunitFetcher = require('./dataunit-fetcher-7a08e4dd.js');
18
18
  require('./filter-item-type.enum-a7ffdaa6.js');
19
19
  const formConfigFetcher = require('./form-config-fetcher-3f430aee.js');
20
20
  const fieldSearch = require('./field-search-f56aa7d6.js');
21
21
  const ConfigStorage = require('./ConfigStorage-9a53a42c.js');
22
- const SnkFormConfigManager = require('./SnkFormConfigManager-dda10d75.js');
22
+ const SnkFormConfigManager = require('./SnkFormConfigManager-7b222c78.js');
23
23
  const RecordIDUtils = require('./RecordIDUtils-3735135c.js');
24
24
  const index$2 = require('./index-102ba62d.js');
25
25
  require('./PrintUtils-bcaeb82f.js');
@@ -134,6 +134,7 @@ const SnkSimpleCrud = class {
134
134
  this.gridLegacyConfigName = undefined;
135
135
  this.formLegacyConfigName = undefined;
136
136
  this.ignoreReadOnlyFormFields = false;
137
+ this.autoLoad = undefined;
137
138
  }
138
139
  handleResourceIDChanged(newValue, oldValue) {
139
140
  if (core.StringUtils.isEmpty(newValue)) {
@@ -400,7 +401,7 @@ const SnkSimpleCrud = class {
400
401
  return this._currentViewMode === constants.VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
401
402
  }
402
403
  initInMemoryDataUnit() {
403
- this._inMemoryLoader = new dataunitFetcher.InMemoryLoader(this._metadata);
404
+ this._inMemoryLoader = new dataunitFetcher.InMemoryLoader(this._metadata, undefined, { autoLoad: this.autoLoad });
404
405
  this.dataUnit = this._inMemoryLoader.dataUnit;
405
406
  this.dataUnitReady.emit(this.dataUnit);
406
407
  }
@@ -706,13 +707,21 @@ const SnkSimpleCrud = class {
706
707
  }
707
708
  return configFromManager;
708
709
  }
710
+ updateFormConfig() {
711
+ const newConfig = Object.assign(Object.assign({}, this.formConfig), { fields: this.dataUnit.metadata.fields });
712
+ this.setFormConfig(newConfig, true);
713
+ if (this._formConfigManager == undefined) {
714
+ this._formConfigManager = new SnkFormConfigManager.SnkFormConfigManager(this.configName, this.resolveResourceID());
715
+ }
716
+ this._formConfigManager.setConfig(this.formConfig);
717
+ }
709
718
  /* istanbul ignore next */
710
719
  render() {
711
720
  var _a;
712
721
  if (this.dataUnit == undefined) {
713
722
  return;
714
723
  }
715
- 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.goToView(constants.VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, index$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("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, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: index.PresentationMode.SECONDARY }, index$1.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), 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)
724
+ 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.goToView(constants.VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this) }, 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("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, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: index.PresentationMode.SECONDARY }, index$1.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), 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)
716
725
  ? undefined
717
726
  : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, 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() }))));
718
727
  }
@@ -35,6 +35,7 @@ export class SnkCrud {
35
35
  this.filterBarLegacyConfigName = undefined;
36
36
  this.formLegacyConfigName = undefined;
37
37
  this.disablePersonalizedFilter = undefined;
38
+ this.autoLoad = undefined;
38
39
  this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
39
40
  }
40
41
  /**
@@ -318,7 +319,7 @@ export class SnkCrud {
318
319
  return;
319
320
  }
320
321
  this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
321
- 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" }))));
322
+ 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 }, 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" }))));
322
323
  }
323
324
  static get is() { return "snk-crud"; }
324
325
  static get encapsulation() { return "scoped"; }
@@ -639,6 +640,23 @@ export class SnkCrud {
639
640
  },
640
641
  "attribute": "disable-personalized-filter",
641
642
  "reflect": false
643
+ },
644
+ "autoLoad": {
645
+ "type": "boolean",
646
+ "mutable": false,
647
+ "complexType": {
648
+ "original": "boolean",
649
+ "resolved": "boolean",
650
+ "references": {}
651
+ },
652
+ "required": false,
653
+ "optional": true,
654
+ "docs": {
655
+ "tags": [],
656
+ "text": "Define se a carga dos dados ser\u00E1 feita assim que o componente for carregado."
657
+ },
658
+ "attribute": "auto-load",
659
+ "reflect": false
642
660
  }
643
661
  };
644
662
  }
@@ -1,5 +1,5 @@
1
1
  import { Host, h } from '@stencil/core';
2
- import { Action, ApplicationContext, DataUnitAction, ObjectUtils } from '@sankhyalabs/core';
2
+ import { Action, ApplicationContext, DataUnitAction, ObjectUtils, StringUtils } from '@sankhyalabs/core';
3
3
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  import { OperationMap, SnkMessageBuilder } from '../../lib/message/SnkMessageBuilder';
5
5
  import { DatasetStrategy } from '../../lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy';
@@ -13,6 +13,7 @@ export class SnkDataUnit {
13
13
  this._fieldsWithRmPrecision = [];
14
14
  this._metadataByRow = new Map();
15
15
  this._rowMetadataCache = new Map();
16
+ this.REGEX_DATAUNIT_NAME = /dd:\/\/(.+?)\//;
16
17
  this._dataUnitObserver = async (action) => {
17
18
  const duState = this.buildDataState(action.type);
18
19
  this.dataState = duState;
@@ -35,6 +36,7 @@ export class SnkDataUnit {
35
36
  break;
36
37
  }
37
38
  };
39
+ this.fieldsToLink = [];
38
40
  this.dataState = undefined;
39
41
  this.messagesBuilder = undefined;
40
42
  this.dataUnitName = undefined;
@@ -224,23 +226,14 @@ export class SnkDataUnit {
224
226
  ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenInsert"));
225
227
  return;
226
228
  }
227
- return action;
229
+ return new DataUnitAction(Action.RECORDS_ADDED, this.handleLinksWithParent(action.payload));
228
230
  }
229
231
  interceptRecordsCopied(action) {
230
232
  if (!this.isAllowed("CLONE")) {
231
233
  ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenClone"));
232
234
  return;
233
235
  }
234
- const cleanFields = this.getCleanOnCopyFields();
235
- if (cleanFields.length > 0) {
236
- const records = action.payload;
237
- action = new DataUnitAction(Action.RECORDS_COPIED, records.map(record => {
238
- const newRecord = Object.assign({}, record);
239
- cleanFields.forEach(fieldName => delete newRecord[fieldName]);
240
- return newRecord;
241
- }));
242
- }
243
- return action;
236
+ return new DataUnitAction(Action.RECORDS_COPIED, this.handleRecordsCopied(action.payload));
244
237
  }
245
238
  async interceptDataChange(action) {
246
239
  if (this.isAllowed("UPDATE")) {
@@ -322,7 +315,7 @@ export class SnkDataUnit {
322
315
  interceptMetadataLoaded(action) {
323
316
  this.fillFieldsWithRmp(action.payload);
324
317
  this.fillFieldsWithRmPrecision(action.payload);
325
- return action;
318
+ return new DataUnitAction(Action.METADATA_LOADED, this.handleDULinksOnMetadataLoaded(action.payload));
326
319
  }
327
320
  async interceptAction(action) {
328
321
  switch (action.type) {
@@ -381,6 +374,47 @@ export class SnkDataUnit {
381
374
  return Object.assign({}, response._rmd);
382
375
  }
383
376
  }
377
+ handleDULinksOnMetadataLoaded(payload) {
378
+ const metadata = Object.assign({}, payload);
379
+ this.processLinks(metadata);
380
+ return metadata;
381
+ }
382
+ handleRecordsCopied(initialRecords) {
383
+ let records = [...initialRecords];
384
+ records = this.handleCleanOnCopy(records);
385
+ return this.handleLinksWithParent(records);
386
+ }
387
+ handleLinksWithParent(records) {
388
+ var _a, _b;
389
+ const parentDataUnit = (_a = this._parentDataUnit) !== null && _a !== void 0 ? _a : (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.getParentDataUnit();
390
+ if (!parentDataUnit)
391
+ return records;
392
+ const parentSelectedRecord = parentDataUnit.getSelectedRecord();
393
+ const selfInfo = parentDataUnit === null || parentDataUnit === void 0 ? void 0 : parentDataUnit.getChildInfo(this.getCleanDataUnitName());
394
+ const { links } = selfInfo;
395
+ if (!links || links.length === 0)
396
+ return records;
397
+ return records.map(record => {
398
+ return this.buildRecordWithLinkedFields(record, links, parentSelectedRecord);
399
+ });
400
+ }
401
+ buildRecordWithLinkedFields(record, links, parentSelectedRecord) {
402
+ const newRecord = Object.assign({}, record);
403
+ links.forEach(link => newRecord[link.target] = parentSelectedRecord[link.source]);
404
+ return newRecord;
405
+ }
406
+ handleCleanOnCopy(records) {
407
+ const cleanFields = this.getCleanOnCopyFields();
408
+ if (cleanFields.length > 0) {
409
+ records = records.map(record => this.buildCopyWithCleanedFields(record, cleanFields));
410
+ }
411
+ return records;
412
+ }
413
+ buildCopyWithCleanedFields(record, cleanFields) {
414
+ const newRecord = Object.assign({}, record);
415
+ cleanFields.forEach(fieldName => delete newRecord[fieldName]);
416
+ return newRecord;
417
+ }
384
418
  showSuccessMessage(message) {
385
419
  ApplicationUtils.info(message, { iconName: "check" });
386
420
  }
@@ -524,20 +558,40 @@ export class SnkDataUnit {
524
558
  return;
525
559
  }
526
560
  handlerLinkFields() {
527
- var _a, _b;
528
- const metadata = Object.assign({}, this.dataUnit.metadata);
529
- if (!this._parentDataUnit)
561
+ var _a, _b, _c, _d;
562
+ const parentDU = (_a = this._parentDataUnit) !== null && _a !== void 0 ? _a : (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.getParentDataUnit();
563
+ if (!parentDU)
530
564
  return;
531
- const child = this._parentDataUnit.getChildInfo(this.entityName);
565
+ const childName = (_c = this.entityName) !== null && _c !== void 0 ? _c : this.getCleanDataUnitName();
566
+ const child = parentDU.getChildInfo(childName);
532
567
  if (!child)
533
568
  return;
534
- const fieldsLink = (_a = child === null || child === void 0 ? void 0 : child.links) === null || _a === void 0 ? void 0 : _a.map(link => link.target);
535
- (_b = metadata === null || metadata === void 0 ? void 0 : metadata.fields) === null || _b === void 0 ? void 0 : _b.forEach(field => {
536
- if (fieldsLink === null || fieldsLink === void 0 ? void 0 : fieldsLink.includes(field.name)) {
569
+ const links = (_d = child === null || child === void 0 ? void 0 : child.links) === null || _d === void 0 ? void 0 : _d.map(link => link.target);
570
+ this.handleDUWithLinks(links);
571
+ }
572
+ handleDUWithLinks(fieldsToLink) {
573
+ this.fieldsToLink = fieldsToLink;
574
+ const metadata = Object.assign({}, this.dataUnit.metadata);
575
+ this.processLinks(metadata);
576
+ this.dataUnit.metadata = metadata;
577
+ this.dataUnitFieldsHidded.emit();
578
+ }
579
+ processLinks(metadata) {
580
+ var _a;
581
+ (_a = metadata === null || metadata === void 0 ? void 0 : metadata.fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
582
+ var _a;
583
+ if ((_a = this.fieldsToLink) === null || _a === void 0 ? void 0 : _a.includes(field.name)) {
537
584
  field.visible = false;
538
585
  }
539
586
  });
540
- this.dataUnit.metadata = metadata;
587
+ }
588
+ getCleanDataUnitName() {
589
+ var _a;
590
+ const uri = this.dataUnit.name;
591
+ if (StringUtils.isEmpty(uri))
592
+ return uri;
593
+ const matcher = this.REGEX_DATAUNIT_NAME.exec(uri);
594
+ return (_a = matcher === null || matcher === void 0 ? void 0 : matcher[1]) !== null && _a !== void 0 ? _a : uri;
541
595
  }
542
596
  static getNearestInstance(element) {
543
597
  let parent = element.parentElement;
@@ -564,8 +618,9 @@ export class SnkDataUnit {
564
618
  this.dataUnit.releaseCallbacks();
565
619
  }
566
620
  }
567
- componentDidLoad() {
568
- this.loadDataUnit();
621
+ async componentDidLoad() {
622
+ await this.loadDataUnit();
623
+ this.handlerLinkFields();
569
624
  }
570
625
  render() {
571
626
  return (h(Host, null));
@@ -799,6 +854,11 @@ export class SnkDataUnit {
799
854
  }
800
855
  };
801
856
  }
857
+ static get states() {
858
+ return {
859
+ "fieldsToLink": {}
860
+ };
861
+ }
802
862
  static get events() {
803
863
  return [{
804
864
  "method": "dataStateChange",
@@ -859,6 +919,21 @@ export class SnkDataUnit {
859
919
  }
860
920
  }
861
921
  }
922
+ }, {
923
+ "method": "dataUnitFieldsHidded",
924
+ "name": "dataUnitFieldsHidded",
925
+ "bubbles": true,
926
+ "cancelable": true,
927
+ "composed": true,
928
+ "docs": {
929
+ "tags": [],
930
+ "text": "Emitido quando h\u00E1 campos no DataUnit que devem ser ocultados."
931
+ },
932
+ "complexType": {
933
+ "original": "void",
934
+ "resolved": "void",
935
+ "references": {}
936
+ }
862
937
  }, {
863
938
  "method": "insertionMode",
864
939
  "name": "insertionMode",
@@ -36,6 +36,7 @@ export class SnkFilterBar {
36
36
  this.messagesBuilder = undefined;
37
37
  this.disablePersonalizedFilter = undefined;
38
38
  this.filterBarLegacyConfigName = undefined;
39
+ this.autoLoad = undefined;
39
40
  this.allowDefault = undefined;
40
41
  this.scrollerLocked = false;
41
42
  this.showPersonalizedFilter = false;
@@ -183,7 +184,10 @@ export class SnkFilterBar {
183
184
  }
184
185
  async doLoadData(forceReload = false) {
185
186
  try {
186
- if (this._firstLoad && !forceReload) {
187
+ if (this._firstLoad && this.autoLoad === false) {
188
+ return;
189
+ }
190
+ if (this._firstLoad && !forceReload && this.autoLoad === undefined) {
187
191
  let autoLoad = await this._application.getBooleanParam("global.carregar.registros.iniciar.tela");
188
192
  if (!autoLoad) {
189
193
  return;
@@ -630,6 +634,23 @@ export class SnkFilterBar {
630
634
  },
631
635
  "attribute": "filter-bar-legacy-config-name",
632
636
  "reflect": false
637
+ },
638
+ "autoLoad": {
639
+ "type": "boolean",
640
+ "mutable": false,
641
+ "complexType": {
642
+ "original": "boolean",
643
+ "resolved": "boolean",
644
+ "references": {}
645
+ },
646
+ "required": false,
647
+ "optional": true,
648
+ "docs": {
649
+ "tags": [],
650
+ "text": "Define se a carga dos dados ser\u00E1 feita assim que o componente for carregado."
651
+ },
652
+ "attribute": "auto-load",
653
+ "reflect": false
633
654
  }
634
655
  };
635
656
  }
@@ -71,11 +71,11 @@ export class SnkFormConfigManager {
71
71
  var _a;
72
72
  const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
73
73
  if (fields != undefined && fields.length > 0) {
74
- return fields.map(({ label, name, readOnly }) => {
74
+ return fields.map(({ label, name, readOnly, visible }) => {
75
75
  if (label == undefined) {
76
76
  return dataUnit.getField(name);
77
77
  }
78
- return { name, label, readOnly };
78
+ return { name, label, readOnly, visible };
79
79
  })
80
80
  .filter(field => this.isFieldVisible(field, descriptionFilter));
81
81
  }
@@ -66,6 +66,7 @@ export class SnkGrid {
66
66
  this.disablePersonalizedFilter = undefined;
67
67
  this.gridLegacyConfigName = undefined;
68
68
  this.filterBarLegacyConfigName = undefined;
69
+ this.autoLoad = undefined;
69
70
  }
70
71
  /**
71
72
  * Exibe a janela de configurações da grade.
@@ -362,7 +363,7 @@ export class SnkGrid {
362
363
  return undefined;
363
364
  }
364
365
  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 &&
365
- 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 }))));
366
+ 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, autoLoad: this.autoLoad }), 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 }))));
366
367
  }
367
368
  static get is() { return "snk-grid"; }
368
369
  static get encapsulation() { return "scoped"; }
@@ -773,6 +774,23 @@ export class SnkGrid {
773
774
  },
774
775
  "attribute": "filter-bar-legacy-config-name",
775
776
  "reflect": false
777
+ },
778
+ "autoLoad": {
779
+ "type": "boolean",
780
+ "mutable": false,
781
+ "complexType": {
782
+ "original": "boolean",
783
+ "resolved": "boolean",
784
+ "references": {}
785
+ },
786
+ "required": false,
787
+ "optional": true,
788
+ "docs": {
789
+ "tags": [],
790
+ "text": "Define se a carga dos dados ser\u00E1 feita assim que o componente for carregado."
791
+ },
792
+ "attribute": "auto-load",
793
+ "reflect": false
776
794
  }
777
795
  };
778
796
  }
@@ -53,6 +53,7 @@ export class SnkSimpleCrud {
53
53
  this.gridLegacyConfigName = undefined;
54
54
  this.formLegacyConfigName = undefined;
55
55
  this.ignoreReadOnlyFormFields = false;
56
+ this.autoLoad = undefined;
56
57
  }
57
58
  handleResourceIDChanged(newValue, oldValue) {
58
59
  if (StringUtils.isEmpty(newValue)) {
@@ -320,7 +321,7 @@ export class SnkSimpleCrud {
320
321
  return this._currentViewMode === VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
321
322
  }
322
323
  initInMemoryDataUnit() {
323
- this._inMemoryLoader = new InMemoryLoader(this._metadata);
324
+ this._inMemoryLoader = new InMemoryLoader(this._metadata, undefined, { autoLoad: this.autoLoad });
324
325
  this.dataUnit = this._inMemoryLoader.dataUnit;
325
326
  this.dataUnitReady.emit(this.dataUnit);
326
327
  }
@@ -626,13 +627,21 @@ export class SnkSimpleCrud {
626
627
  }
627
628
  return configFromManager;
628
629
  }
630
+ updateFormConfig() {
631
+ const newConfig = Object.assign(Object.assign({}, this.formConfig), { fields: this.dataUnit.metadata.fields });
632
+ this.setFormConfig(newConfig, true);
633
+ if (this._formConfigManager == undefined) {
634
+ this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
635
+ }
636
+ this._formConfigManager.setConfig(this.formConfig);
637
+ }
629
638
  /* istanbul ignore next */
630
639
  render() {
631
640
  var _a;
632
641
  if (this.dataUnit == undefined) {
633
642
  return;
634
643
  }
635
- return (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.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, "data-exporter-store-key": this.getDataExporterStoreKey(), 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)
644
+ return (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.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this) }, 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, "data-exporter-store-key": this.getDataExporterStoreKey(), 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)
636
645
  ? undefined
637
646
  : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, 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() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
638
647
  }
@@ -1006,6 +1015,23 @@ export class SnkSimpleCrud {
1006
1015
  "attribute": "ignore-read-only-form-fields",
1007
1016
  "reflect": false,
1008
1017
  "defaultValue": "false"
1018
+ },
1019
+ "autoLoad": {
1020
+ "type": "boolean",
1021
+ "mutable": false,
1022
+ "complexType": {
1023
+ "original": "boolean",
1024
+ "resolved": "boolean",
1025
+ "references": {}
1026
+ },
1027
+ "required": false,
1028
+ "optional": true,
1029
+ "docs": {
1030
+ "tags": [],
1031
+ "text": "Define se a carga dos dados ser\u00E1 feita assim que o componente for carregado."
1032
+ },
1033
+ "attribute": "auto-load",
1034
+ "reflect": false
1009
1035
  }
1010
1036
  };
1011
1037
  }
@@ -1,7 +1,7 @@
1
1
  import { ChangeOperation, DataType, DataUnit, DateUtils, StringUtils, } from '@sankhyalabs/core';
2
2
  import { applyFilter, applySorting, buildPaginationInfo } from './dataUnitInMemoryUtils';
3
3
  export default class InMemoryLoader {
4
- constructor(metadata, records) {
4
+ constructor(metadata, records, config) {
5
5
  this.metadata = metadata;
6
6
  this.records = records;
7
7
  this._dataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
@@ -9,7 +9,11 @@ export default class InMemoryLoader {
9
9
  this._dataUnit.dataLoader = (dataUnit, request) => this.inMemoryLoader(dataUnit, request, this.getRecordsToLoad());
10
10
  this._dataUnit.saveLoader = (_dataUnit, changes) => this.saveLoader(_dataUnit, changes);
11
11
  this._dataUnit.removeLoader = (_dataUnit, recordIds) => this.removeLoader(_dataUnit, recordIds);
12
- this.dataUnit.loadMetadata().then(() => this.dataUnit.loadData());
12
+ this.dataUnit.loadMetadata().then(() => {
13
+ if ((config === null || config === void 0 ? void 0 : config.autoLoad) !== false) {
14
+ this.dataUnit.loadData();
15
+ }
16
+ });
13
17
  }
14
18
  getRecordsToLoad() {
15
19
  if (this._initialRecords == undefined && this.dataUnit.records.length > 0) {