@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-38445.0 → 0.0.0-bugfix-dev-KB-68936.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 (114) hide show
  1. package/dist/cjs/{ConfigStorage-942ce74b.js → ConfigStorage-a343e418.js} +1 -0
  2. package/dist/cjs/{IExporterProvider-597949f9.js → IExporterProvider-d2a04ee7.js} +2 -2
  3. package/dist/cjs/{SnkFormConfigManager-1b13bacd.js → SnkFormConfigManager-166cbd1f.js} +6 -8
  4. package/dist/cjs/{SnkMessageBuilder-722b104e.js → SnkMessageBuilder-28ceaaed.js} +5 -1
  5. package/dist/cjs/{dataunit-fetcher-688d3f05.js → dataunit-fetcher-75f89355.js} +9 -2
  6. package/dist/cjs/{field-search-f56aa7d6.js → field-search-68e34bf4.js} +5 -1
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  9. package/dist/cjs/snk-actions-button_4.cjs.entry.js +2 -2
  10. package/dist/cjs/snk-application.cjs.entry.js +3 -3
  11. package/dist/cjs/snk-attach.cjs.entry.js +1 -1
  12. package/dist/cjs/snk-crud.cjs.entry.js +5 -2
  13. package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
  14. package/dist/cjs/{snk-data-unit-685272e7.js → snk-data-unit-bf418767.js} +2 -2
  15. package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
  16. package/dist/cjs/snk-detail-view.cjs.entry.js +7 -8
  17. package/dist/cjs/snk-filter-bar.cjs.entry.js +1 -1
  18. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +1 -1
  19. package/dist/cjs/snk-form-config.cjs.entry.js +1 -1
  20. package/dist/cjs/snk-form.cjs.entry.js +2 -2
  21. package/dist/cjs/snk-grid.cjs.entry.js +35 -10
  22. package/dist/cjs/{snk-guides-viewer-67605336.js → snk-guides-viewer-14c27834.js} +10 -6
  23. package/dist/cjs/snk-guides-viewer.cjs.entry.js +5 -5
  24. package/dist/cjs/snk-personalized-filter.cjs.entry.js +1 -1
  25. package/dist/cjs/snk-simple-crud.cjs.entry.js +28 -10
  26. package/dist/collection/components/snk-crud/snk-crud.js +22 -1
  27. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +1 -2
  28. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +25 -3
  29. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +5 -7
  30. package/dist/collection/components/snk-form-config/snk-form-config.js +1 -1
  31. package/dist/collection/components/snk-grid/snk-grid.css +0 -2
  32. package/dist/collection/components/snk-grid/snk-grid.js +58 -6
  33. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +43 -8
  34. package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +5 -1
  35. package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +1 -1
  36. package/dist/collection/lib/configs/ConfigStorage.js +1 -0
  37. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +9 -2
  38. package/dist/collection/lib/message/resources/snk-grid.msg.js +5 -1
  39. package/dist/components/ConfigStorage.js +1 -0
  40. package/dist/components/IExporterProvider.js +6 -2
  41. package/dist/components/SnkFormConfigManager.js +5 -7
  42. package/dist/components/SnkMessageBuilder.js +5 -1
  43. package/dist/components/dataunit-fetcher.js +9 -2
  44. package/dist/components/snk-crud.js +5 -1
  45. package/dist/components/snk-detail-view2.js +9 -5
  46. package/dist/components/snk-form-config2.js +1 -1
  47. package/dist/components/snk-grid2.js +34 -8
  48. package/dist/components/snk-simple-crud2.js +24 -5
  49. package/dist/esm/{ConfigStorage-86187da3.js → ConfigStorage-3806514e.js} +1 -0
  50. package/dist/esm/{IExporterProvider-63a188b6.js → IExporterProvider-b2e244b3.js} +2 -2
  51. package/dist/esm/{SnkFormConfigManager-d4554df9.js → SnkFormConfigManager-31b24066.js} +6 -8
  52. package/dist/esm/{SnkMessageBuilder-89925609.js → SnkMessageBuilder-0485b99a.js} +5 -1
  53. package/dist/esm/{dataunit-fetcher-264191b2.js → dataunit-fetcher-6463ac8d.js} +9 -2
  54. package/dist/esm/{field-search-efbe307f.js → field-search-f8b1d91e.js} +5 -1
  55. package/dist/esm/loader.js +1 -1
  56. package/dist/esm/sankhyablocks.js +1 -1
  57. package/dist/esm/snk-actions-button_4.entry.js +2 -2
  58. package/dist/esm/snk-application.entry.js +3 -3
  59. package/dist/esm/snk-attach.entry.js +1 -1
  60. package/dist/esm/snk-crud.entry.js +5 -2
  61. package/dist/esm/snk-data-exporter.entry.js +3 -3
  62. package/dist/esm/{snk-data-unit-63f83504.js → snk-data-unit-20860cfc.js} +2 -2
  63. package/dist/esm/snk-data-unit.entry.js +3 -3
  64. package/dist/esm/snk-detail-view.entry.js +7 -8
  65. package/dist/esm/snk-filter-bar.entry.js +1 -1
  66. package/dist/esm/snk-filter-modal-item.entry.js +1 -1
  67. package/dist/esm/snk-form-config.entry.js +1 -1
  68. package/dist/esm/snk-form.entry.js +2 -2
  69. package/dist/esm/snk-grid.entry.js +35 -10
  70. package/dist/esm/{snk-guides-viewer-151f6091.js → snk-guides-viewer-b82ec79a.js} +10 -6
  71. package/dist/esm/snk-guides-viewer.entry.js +5 -5
  72. package/dist/esm/snk-personalized-filter.entry.js +1 -1
  73. package/dist/esm/snk-simple-crud.entry.js +28 -10
  74. package/dist/sankhyablocks/{p-3a212712.js → p-0e85d9ba.js} +1 -1
  75. package/dist/sankhyablocks/p-14c2056a.js +1 -0
  76. package/dist/sankhyablocks/p-23736d75.js +1 -0
  77. package/dist/sankhyablocks/{p-7505da04.entry.js → p-249adf8b.entry.js} +1 -1
  78. package/dist/sankhyablocks/p-2a408684.js +1 -0
  79. package/dist/sankhyablocks/{p-eae7a817.entry.js → p-2c68b3ae.entry.js} +1 -1
  80. package/dist/sankhyablocks/{p-c5268346.entry.js → p-2f978e29.entry.js} +1 -1
  81. package/dist/sankhyablocks/p-4111c6ce.entry.js +1 -0
  82. package/dist/sankhyablocks/p-4238fcd4.entry.js +1 -0
  83. package/dist/sankhyablocks/p-450c60e4.entry.js +1 -0
  84. package/dist/sankhyablocks/{p-a1d72395.entry.js → p-47db7e88.entry.js} +1 -1
  85. package/dist/sankhyablocks/{p-aff76a53.js → p-52920496.js} +1 -1
  86. package/dist/sankhyablocks/{p-8fc470e5.entry.js → p-62ba211a.entry.js} +1 -1
  87. package/dist/sankhyablocks/p-6614c578.js +1 -0
  88. package/dist/sankhyablocks/p-6fede3d4.entry.js +1 -0
  89. package/dist/sankhyablocks/p-701442ef.entry.js +1 -0
  90. package/dist/sankhyablocks/{p-82a0bfb0.entry.js → p-74fafa0d.entry.js} +2 -2
  91. package/dist/sankhyablocks/{p-fcac4dfc.js → p-950037cb.js} +1 -1
  92. package/dist/sankhyablocks/{p-941bf3ef.entry.js → p-95e44a9c.entry.js} +1 -1
  93. package/dist/sankhyablocks/{p-fe79f83a.js → p-b4d016a3.js} +1 -1
  94. package/dist/sankhyablocks/{p-bad55caa.entry.js → p-d0bec13f.entry.js} +1 -1
  95. package/dist/sankhyablocks/{p-47b60deb.entry.js → p-d6e26ea8.entry.js} +1 -1
  96. package/dist/sankhyablocks/{p-14b9f964.entry.js → p-ebc4011a.entry.js} +1 -1
  97. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  98. package/dist/types/components/snk-crud/snk-crud.d.ts +4 -0
  99. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +5 -0
  100. package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +2 -2
  101. package/dist/types/components/snk-grid/snk-grid.d.ts +9 -0
  102. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +7 -0
  103. package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +1 -0
  104. package/dist/types/components.d.ts +32 -0
  105. package/package.json +1 -1
  106. package/dist/sankhyablocks/p-14a08904.entry.js +0 -1
  107. package/dist/sankhyablocks/p-19c18d06.entry.js +0 -1
  108. package/dist/sankhyablocks/p-75f83d1d.entry.js +0 -1
  109. package/dist/sankhyablocks/p-7a337364.js +0 -1
  110. package/dist/sankhyablocks/p-829d4045.js +0 -1
  111. package/dist/sankhyablocks/p-b4b21558.entry.js +0 -1
  112. package/dist/sankhyablocks/p-c053256c.entry.js +0 -1
  113. package/dist/sankhyablocks/p-c2495304.js +0 -1
  114. package/dist/sankhyablocks/p-cefba299.js +0 -1
@@ -80,7 +80,7 @@ const SnkFormConfig = class {
80
80
  }
81
81
  }
82
82
  getConfig() {
83
- let config = this.configManager.getConfig(false, this.dataUnit);
83
+ let config = this.configManager.getConfig(this.dataUnit);
84
84
  if (config.fields && config.fields.length === 0) {
85
85
  config = undefined;
86
86
  }
@@ -4,9 +4,9 @@ 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-1b13bacd.js');
7
+ const SnkFormConfigManager = require('./SnkFormConfigManager-166cbd1f.js');
8
8
  const ResourceIDUtils = require('./ResourceIDUtils-5ff86aa7.js');
9
- require('./ConfigStorage-942ce74b.js');
9
+ require('./ConfigStorage-a343e418.js');
10
10
  require('./form-config-fetcher-2dd00e5b.js');
11
11
  require('./DataFetcher-313debd8.js');
12
12
  require('./PrintUtils-bcaeb82f.js');
@@ -5,18 +5,18 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-f9e81701.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
8
- const ConfigStorage = require('./ConfigStorage-942ce74b.js');
8
+ const ConfigStorage = require('./ConfigStorage-a343e418.js');
9
9
  const index$1 = require('./index-1dfc7a6e.js');
10
- const fieldSearch = require('./field-search-f56aa7d6.js');
10
+ const fieldSearch = require('./field-search-68e34bf4.js');
11
11
  const index$2 = require('./index-102ba62d.js');
12
- const IExporterProvider = require('./IExporterProvider-597949f9.js');
12
+ const IExporterProvider = require('./IExporterProvider-d2a04ee7.js');
13
13
  const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
14
14
  require('./DataFetcher-313debd8.js');
15
15
  require('./pesquisa-fetcher-680e198f.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-688d3f05.js');
19
+ require('./dataunit-fetcher-75f89355.js');
20
20
  require('./filter-item-type.enum-a7ffdaa6.js');
21
21
  require('./form-config-fetcher-2dd00e5b.js');
22
22
  const RecordIDUtils = require('./RecordIDUtils-3735135c.js');
@@ -80,7 +80,7 @@ class ServerSideExporterProvider extends IExporterProvider.CommonsExporter {
80
80
  }
81
81
  }
82
82
 
83
- const snkGridCss = ".sc-snk-grid-h{--snk-grid-min-height:300px;--snk-grid-padding:var(--space--lg)}.snk-grid__container.sc-snk-grid{display:flex;height:100%;width:100%;padding:var(--snk-grid-padding)}.snk-grid__header.sc-snk-grid{width:100%;display:flex;flex-wrap:nowrap;justify-content:flex-end}.snk-grid__filter-bar.sc-snk-grid{width:100%}.snk-grid__header-divider.sc-snk-grid{margin-bottom:var(--space--medium)}.snk-grid__table.sc-snk-grid{min-height:var(--snk-grid-min-height)}.snk-grid-container__without-shadow.sc-snk-grid{--ezgrid__container--shadow:unset}";
83
+ const snkGridCss = ".sc-snk-grid-h{--snk-grid-min-height:300px}.snk-grid__container.sc-snk-grid{display:flex;height:100%;width:100%}.snk-grid__header.sc-snk-grid{width:100%;display:flex;flex-wrap:nowrap;justify-content:flex-end}.snk-grid__filter-bar.sc-snk-grid{width:100%}.snk-grid__header-divider.sc-snk-grid{margin-bottom:var(--space--medium)}.snk-grid__table.sc-snk-grid{min-height:var(--snk-grid-min-height)}.snk-grid-container__without-shadow.sc-snk-grid{--ezgrid__container--shadow:unset}";
84
84
 
85
85
  const SnkGrid = class {
86
86
  constructor(hostRef) {
@@ -93,7 +93,7 @@ const SnkGrid = class {
93
93
  "snkGridTopTaskbar.regular": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
94
94
  "snkGridTopTaskbar.regular.secondary": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
95
95
  "snkGridTopTaskbar.regular.singleTaskbar": [],
96
- "snkGridTopTaskbar.finish_edition": ["CANCEL", "SAVE"],
96
+ "snkGridTopTaskbar.finish_edition": ["CANCEL", "SAVE", this.handleAddFormMode()],
97
97
  "snkGridTopTaskbar.finish_edition.secondary": [],
98
98
  "snkGridTopTaskbar.finish_edition.singleTaskbar": [],
99
99
  });
@@ -106,7 +106,7 @@ const SnkGrid = class {
106
106
  "snkGridHeaderTaskbar.singleTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "ATTACH", "FORM_MODE", "CONFIGURATOR", "REFRESH", "DATA_EXPORTER", "ACTIONS_BUTTON"],
107
107
  "snkGridHeaderTaskbar.singleTaskbar.detail.unselected": ["INSERT", "FORM_MODE", "CONFIGURATOR", "REFRESH", "MORE_OPTIONS"],
108
108
  "snkGridHeaderTaskbar.singleTaskbar.detail.selected": ["UPDATE", "ATTACH", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "FORM_MODE", "CONFIGURATOR", "REFRESH"],
109
- "snkGridHeaderTaskbar.singleTaskbar.finish_edition": ["CANCEL", "SAVE"]
109
+ "snkGridHeaderTaskbar.singleTaskbar.finish_edition": ["CANCEL", "SAVE", this.handleAddFormMode()]
110
110
  });
111
111
  this.dataUnitInterceptor = {
112
112
  interceptAction: async (action) => {
@@ -144,6 +144,7 @@ const SnkGrid = class {
144
144
  this.filterBarLegacyConfigName = undefined;
145
145
  this.autoLoad = undefined;
146
146
  this.autoFocus = true;
147
+ this.enableGridInsert = false;
147
148
  }
148
149
  /**
149
150
  * Exibe a janela de configurações da grade.
@@ -230,6 +231,16 @@ const SnkGrid = class {
230
231
  async setFocus() {
231
232
  this._grid.setFocus();
232
233
  }
234
+ async handleClick(event) {
235
+ if (this.hasToBlockEvent(event)) {
236
+ event.preventDefault();
237
+ event.stopPropagation();
238
+ await this._dataUnit.cancelEdition();
239
+ }
240
+ }
241
+ hasToBlockEvent(event) {
242
+ return this._snkFilterBar.contains(event.target) && this.enableGridInsert && this._dataUnit.hasNewRecord();
243
+ }
233
244
  async handleGridLegacyConfigName(newLegacyConfig, oldLegacyConfig) {
234
245
  if (!newLegacyConfig) {
235
246
  return;
@@ -240,6 +251,9 @@ const SnkGrid = class {
240
251
  this.addGridLegacyConfigName();
241
252
  this.loadConfig();
242
253
  }
254
+ handleAddFormMode() {
255
+ return this.enableGridInsert ? taskbarElements.TaskbarElement.FORM_MODE : "";
256
+ }
243
257
  openGridConfig() {
244
258
  this._grid.getColumnsState()
245
259
  .then((gridColumns) => {
@@ -369,8 +383,9 @@ const SnkGrid = class {
369
383
  this.loadConfig();
370
384
  }
371
385
  componentDidRender() {
386
+ var _a, _b;
372
387
  this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
373
- this.loadGridCustomFormatters(this._dataUnit.metadata.fields);
388
+ this.loadGridCustomFormatters((_b = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.fields);
374
389
  this.setCustomRenders();
375
390
  this.setCustomEditors();
376
391
  }
@@ -468,6 +483,8 @@ const SnkGrid = class {
468
483
  eagerInitialize: true,
469
484
  itemBuilder: (actionButton, item) => this.getColumnSearch(actionButton, item)
470
485
  }];
486
+ if (this.isGridInsertActive())
487
+ return hardList;
471
488
  if (this.taskbarManager != undefined && this.taskbarManager.getMoreOptions != undefined) {
472
489
  const taskbarID = this.getTopTaskBarId();
473
490
  return hardList.concat(this.taskbarManager.getMoreOptions(taskbarID, this.configName, this._dataState, this.actionsList));
@@ -485,12 +502,20 @@ const SnkGrid = class {
485
502
  }
486
503
  this._showSnkFilterBar = true;
487
504
  }
505
+ getGridHeaderButtons() {
506
+ if (this.isGridInsertActive())
507
+ return taskbarElements.TaskbarElement.MORE_OPTIONS;
508
+ return this._headerTaskbarProcessor.buttons;
509
+ }
510
+ isGridInsertActive() {
511
+ return this.enableGridInsert && this._dataUnit.hasNewRecord();
512
+ }
488
513
  render() {
489
514
  if (!this._dataUnit) {
490
515
  return undefined;
491
516
  }
492
- return (index.h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto" }, index.h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, this._showSnkFilterBar &&
493
- 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 }, 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 }))));
517
+ 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 &&
518
+ 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 }, 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 }))));
494
519
  }
495
520
  get _element() { return index.getElement(this); }
496
521
  static get watchers() { return {
@@ -2,9 +2,9 @@
2
2
 
3
3
  const index = require('./index-f9e81701.js');
4
4
  const core = require('@sankhyalabs/core');
5
- const SnkFormConfigManager = require('./SnkFormConfigManager-1b13bacd.js');
5
+ const SnkFormConfigManager = require('./SnkFormConfigManager-166cbd1f.js');
6
6
  const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
7
- const fieldSearch = require('./field-search-f56aa7d6.js');
7
+ const fieldSearch = require('./field-search-68e34bf4.js');
8
8
  const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
9
9
  const constants = require('./constants-35ddd366.js');
10
10
  require('./DataFetcher-313debd8.js');
@@ -13,7 +13,7 @@ const index$1 = require('./index-1dfc7a6e.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-688d3f05.js');
16
+ require('./dataunit-fetcher-75f89355.js');
17
17
  require('./filter-item-type.enum-a7ffdaa6.js');
18
18
  require('./form-config-fetcher-2dd00e5b.js');
19
19
  const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
@@ -43,6 +43,7 @@ const SnkGuidesViewer = class {
43
43
  this.resourceID = undefined;
44
44
  this.detailTaskbarCustomContainerId = undefined;
45
45
  this.formLegacyConfigName = undefined;
46
+ this.enableGridInsert = false;
46
47
  this._hasToCreateFieldSearch = true;
47
48
  this._breadcrumbItems = [];
48
49
  this._guides = undefined;
@@ -111,7 +112,7 @@ const SnkGuidesViewer = class {
111
112
  this._container.focus();
112
113
  }
113
114
  exitViewer() {
114
- if (this.dataUnit.isDirty()) {
115
+ if (!this.enableGridInsert && this.dataUnit.isDirty()) {
115
116
  this.dataUnit.cancelEdition({ after: () => this.exit.emit() });
116
117
  }
117
118
  else {
@@ -129,7 +130,7 @@ const SnkGuidesViewer = class {
129
130
  }
130
131
  onContentCardChanged(evt) {
131
132
  SnkGuidesViewer.updateContentCard(evt.detail.formName, evt.detail.cardConfig, evt.detail.propertyChanged, this._configManager)
132
- .then(() => this.masterFormConfig = this._configManager.getConfig(this.dataState.insertionMode, this.dataUnit));
133
+ .then(() => this.masterFormConfig = this._configManager.getConfig(this.dataUnit));
133
134
  }
134
135
  /**
135
136
  * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
@@ -220,10 +221,13 @@ const SnkGuidesViewer = class {
220
221
  const invisibleButtons = this.getInvisibleButtons();
221
222
  this._taskbarProcessor = new fieldSearch.TaskbarProcessor({
222
223
  "snkGuideViewer.regular": btnsRegularMode,
223
- "snkGuideViewer.finish_edition": ["CANCEL", "SAVE"],
224
+ "snkGuideViewer.finish_edition": ["CANCEL", "SAVE", this.handleAddGridMode()],
224
225
  });
225
226
  this._taskbarProcessor.process(taskbarId, this.taskbarManager, this.dataState, disabledButtons, invisibleButtons);
226
227
  }
228
+ handleAddGridMode() {
229
+ return this.enableGridInsert ? taskbarElements.TaskbarElement.GRID_MODE : "";
230
+ }
227
231
  getInvisibleButtons() {
228
232
  const invisibleButtons = [];
229
233
  if (this.dataState && this.dataState.selectionInfo.mode === DataUnit.SelectionMode.ALL_RECORDS)
@@ -2,18 +2,18 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const snkGuidesViewer = require('./snk-guides-viewer-67605336.js');
5
+ const snkGuidesViewer = require('./snk-guides-viewer-14c27834.js');
6
6
  require('./index-f9e81701.js');
7
7
  require('@sankhyalabs/core');
8
- require('./SnkFormConfigManager-1b13bacd.js');
9
- require('./ConfigStorage-942ce74b.js');
8
+ require('./SnkFormConfigManager-166cbd1f.js');
9
+ require('./ConfigStorage-a343e418.js');
10
10
  require('./form-config-fetcher-2dd00e5b.js');
11
11
  require('./DataFetcher-313debd8.js');
12
12
  require('./PrintUtils-bcaeb82f.js');
13
13
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
14
14
  require('./filter-item-type.enum-a7ffdaa6.js');
15
15
  require('@sankhyalabs/ezui/dist/collection/utils/form');
16
- require('./field-search-f56aa7d6.js');
16
+ require('./field-search-68e34bf4.js');
17
17
  require('./taskbar-elements-9ad1f9c0.js');
18
18
  require('./index-1dfc7a6e.js');
19
19
  require('./index-102ba62d.js');
@@ -21,7 +21,7 @@ require('./constants-35ddd366.js');
21
21
  require('./pesquisa-fetcher-680e198f.js');
22
22
  require('./ISave-e91b70a7.js');
23
23
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
24
- require('./dataunit-fetcher-688d3f05.js');
24
+ require('./dataunit-fetcher-75f89355.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');
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-f9e81701.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-0184ffbb.js');
8
- const ConfigStorage = require('./ConfigStorage-942ce74b.js');
8
+ const ConfigStorage = require('./ConfigStorage-a343e418.js');
9
9
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
10
10
  const index$1 = require('./index-c5771aba.js');
11
11
  const index$2 = require('./index-102ba62d.js');
@@ -9,17 +9,17 @@ const constants = require('./constants-35ddd366.js');
9
9
  const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
10
10
  require('./DataFetcher-313debd8.js');
11
11
  require('./pesquisa-fetcher-680e198f.js');
12
- const IExporterProvider = require('./IExporterProvider-597949f9.js');
12
+ const IExporterProvider = require('./IExporterProvider-d2a04ee7.js');
13
13
  const index = require('./index-1dfc7a6e.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-688d3f05.js');
17
+ const dataunitFetcher = require('./dataunit-fetcher-75f89355.js');
18
18
  require('./filter-item-type.enum-a7ffdaa6.js');
19
19
  const formConfigFetcher = require('./form-config-fetcher-2dd00e5b.js');
20
- const fieldSearch = require('./field-search-f56aa7d6.js');
21
- const ConfigStorage = require('./ConfigStorage-942ce74b.js');
22
- const SnkFormConfigManager = require('./SnkFormConfigManager-1b13bacd.js');
20
+ const fieldSearch = require('./field-search-68e34bf4.js');
21
+ const ConfigStorage = require('./ConfigStorage-a343e418.js');
22
+ const SnkFormConfigManager = require('./SnkFormConfigManager-166cbd1f.js');
23
23
  const RecordIDUtils = require('./RecordIDUtils-3735135c.js');
24
24
  const index$2 = require('./index-102ba62d.js');
25
25
  require('./PrintUtils-bcaeb82f.js');
@@ -107,7 +107,7 @@ const SnkSimpleCrud = class {
107
107
  "snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, [taskbarElements.TaskbarElement.DATA_EXPORTER, taskbarElements.TaskbarElement.FORM_MODE]),
108
108
  "snkSimpleCrudTaskbar.form_selected": this.getButtons(true, [taskbarElements.TaskbarElement.GRID_MODE]),
109
109
  "snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, [taskbarElements.TaskbarElement.DATA_EXPORTER, taskbarElements.TaskbarElement.FORM_MODE]),
110
- "snkSimpleCrudTaskbar.finish_edition": ["CANCEL", "SAVE"]
110
+ "snkSimpleCrudTaskbar.finish_edition": this.getFinishEditionButtonsCallback.bind(this)
111
111
  });
112
112
  this._showPopUpGridConfig = false;
113
113
  this._showFormConfig = false;
@@ -127,6 +127,7 @@ const SnkSimpleCrud = class {
127
127
  this.useCancelConfirm = true;
128
128
  this.pageSize = 150;
129
129
  this.resourceID = undefined;
130
+ this.enableGridInsert = false;
130
131
  this.taskbarManager = undefined;
131
132
  this.messagesBuilder = undefined;
132
133
  this.useEnterLikeTab = false;
@@ -195,6 +196,13 @@ const SnkSimpleCrud = class {
195
196
  newCustomFieldProps.set(fieldName, Object.assign(Object.assign({}, currentProps), { [propName]: value }));
196
197
  this._fieldsProps = newCustomFieldProps;
197
198
  }
199
+ getFinishEditionButtonsCallback() {
200
+ const btns = ["CANCEL", "SAVE"];
201
+ if (this.enableGridInsert && this._currentViewMode !== constants.VIEW_MODE.ATTACHMENT) {
202
+ btns.push(this._currentViewMode === constants.VIEW_MODE.GRID ? taskbarElements.TaskbarElement.FORM_MODE : taskbarElements.TaskbarElement.GRID_MODE);
203
+ }
204
+ return btns;
205
+ }
198
206
  getButtons(selected, extraButtons) {
199
207
  return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
200
208
  .concat(extraButtons));
@@ -633,6 +641,9 @@ const SnkSimpleCrud = class {
633
641
  const options = filteredFields.map(field => ({ value: field.name, label: field.label }));
634
642
  return Promise.resolve(options);
635
643
  }
644
+ isGridInsertActive() {
645
+ return this.enableGridInsert && this.dataUnit.hasNewRecord();
646
+ }
636
647
  getActionsList() {
637
648
  var _a, _b;
638
649
  const hardList = [{
@@ -644,6 +655,8 @@ const SnkSimpleCrud = class {
644
655
  ? this.getColumnSearch(actionButton, item)
645
656
  : this.getFieldSearch(actionButton, item)
646
657
  }];
658
+ if (this.isGridInsertActive())
659
+ return hardList;
647
660
  if (this.taskbarManager != undefined && this.taskbarManager.getMoreOptions != undefined) {
648
661
  const taskbarID = this.getTopTaskBarId();
649
662
  return hardList.concat(this.taskbarManager.getMoreOptions(taskbarID, this.configName, this.dataState, this.actionsList));
@@ -752,8 +765,8 @@ const SnkSimpleCrud = class {
752
765
  return core.StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
753
766
  }
754
767
  getFormConfig() {
755
- var _a, _b;
756
- const configFromManager = (_a = this._formConfigManager) === null || _a === void 0 ? void 0 : _a.getConfig((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.insertionMode, this.dataUnit, this.ignoreReadOnlyFormFields);
768
+ var _a;
769
+ const configFromManager = (_a = this._formConfigManager) === null || _a === void 0 ? void 0 : _a.getConfig(this.dataUnit, this.ignoreReadOnlyFormFields);
757
770
  if (!this.configName && !configFromManager) {
758
771
  return this.formConfig;
759
772
  }
@@ -767,15 +780,20 @@ const SnkSimpleCrud = class {
767
780
  }
768
781
  this._formConfigManager.setConfig(this.formConfig);
769
782
  }
783
+ handleDataUnitOnInsertionMode() {
784
+ if (this.enableGridInsert)
785
+ return;
786
+ this.goToView(constants.VIEW_MODE.FORM);
787
+ }
770
788
  /* istanbul ignore next */
771
789
  render() {
772
790
  var _a;
773
791
  if (this.dataUnit == undefined) {
774
792
  return;
775
793
  }
776
- 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)
794
+ 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) }, 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)
777
795
  ? undefined
778
- : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus }, 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() }))));
796
+ : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert }, 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() }))));
779
797
  }
780
798
  get _element() { return index$1.getElement(this); }
781
799
  static get watchers() { return {
@@ -39,6 +39,7 @@ export class SnkCrud {
39
39
  this.disablePersonalizedFilter = undefined;
40
40
  this.autoLoad = undefined;
41
41
  this.autoFocus = true;
42
+ this.enableGridInsert = false;
42
43
  this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
43
44
  }
44
45
  /**
@@ -162,6 +163,8 @@ export class SnkCrud {
162
163
  ElementIDUtils.addIDInfo(this._element, null, dataInfo);
163
164
  }
164
165
  insertionModeHandler() {
166
+ if (this.enableGridInsert)
167
+ return;
165
168
  this.gridToForm();
166
169
  }
167
170
  cancelHandler() {
@@ -376,7 +379,7 @@ export class SnkCrud {
376
379
  return;
377
380
  }
378
381
  this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
379
- 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 }, 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" }))));
382
+ 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 }, 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" }))));
380
383
  }
381
384
  static get is() { return "snk-crud"; }
382
385
  static get encapsulation() { return "scoped"; }
@@ -732,6 +735,24 @@ export class SnkCrud {
732
735
  "attribute": "auto-focus",
733
736
  "reflect": false,
734
737
  "defaultValue": "true"
738
+ },
739
+ "enableGridInsert": {
740
+ "type": "boolean",
741
+ "mutable": false,
742
+ "complexType": {
743
+ "original": "boolean",
744
+ "resolved": "boolean",
745
+ "references": {}
746
+ },
747
+ "required": false,
748
+ "optional": true,
749
+ "docs": {
750
+ "tags": [],
751
+ "text": "Ativa inser\u00E7\u00E3o de registros no modo grade."
752
+ },
753
+ "attribute": "enable-grid-insert",
754
+ "reflect": false,
755
+ "defaultValue": "false"
735
756
  }
736
757
  };
737
758
  }
@@ -158,14 +158,13 @@ export class SnkDetailView {
158
158
  return guideId.replace(SnkDetailView.REGEX_FORM_ID, "");
159
159
  }
160
160
  loadMetadata() {
161
- var _a;
162
161
  if (!this.dataUnit) {
163
162
  return;
164
163
  }
165
164
  if (!this.formConfigManager.isLoaded) {
166
165
  return;
167
166
  }
168
- const formConfig = this.formConfigManager.getConfig((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.insertionMode, this.dataUnit);
167
+ const formConfig = this.formConfigManager.getConfig(this.dataUnit);
169
168
  //this._cardsState = formConfig?.cardsState;
170
169
  this._formMetadata = buildFormMetadata(formConfig == undefined || formConfig.fields.length === 0 ? undefined : formConfig, this.dataUnit, true);
171
170
  }
@@ -27,6 +27,7 @@ export class SnkGuidesViewer {
27
27
  this.resourceID = undefined;
28
28
  this.detailTaskbarCustomContainerId = undefined;
29
29
  this.formLegacyConfigName = undefined;
30
+ this.enableGridInsert = false;
30
31
  this._hasToCreateFieldSearch = true;
31
32
  this._breadcrumbItems = [];
32
33
  this._guides = undefined;
@@ -95,7 +96,7 @@ export class SnkGuidesViewer {
95
96
  this._container.focus();
96
97
  }
97
98
  exitViewer() {
98
- if (this.dataUnit.isDirty()) {
99
+ if (!this.enableGridInsert && this.dataUnit.isDirty()) {
99
100
  this.dataUnit.cancelEdition({ after: () => this.exit.emit() });
100
101
  }
101
102
  else {
@@ -113,7 +114,7 @@ export class SnkGuidesViewer {
113
114
  }
114
115
  onContentCardChanged(evt) {
115
116
  SnkGuidesViewer.updateContentCard(evt.detail.formName, evt.detail.cardConfig, evt.detail.propertyChanged, this._configManager)
116
- .then(() => this.masterFormConfig = this._configManager.getConfig(this.dataState.insertionMode, this.dataUnit));
117
+ .then(() => this.masterFormConfig = this._configManager.getConfig(this.dataUnit));
117
118
  }
118
119
  /**
119
120
  * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
@@ -204,10 +205,13 @@ export class SnkGuidesViewer {
204
205
  const invisibleButtons = this.getInvisibleButtons();
205
206
  this._taskbarProcessor = new TaskbarProcessor({
206
207
  "snkGuideViewer.regular": btnsRegularMode,
207
- "snkGuideViewer.finish_edition": ["CANCEL", "SAVE"],
208
+ "snkGuideViewer.finish_edition": ["CANCEL", "SAVE", this.handleAddGridMode()],
208
209
  });
209
210
  this._taskbarProcessor.process(taskbarId, this.taskbarManager, this.dataState, disabledButtons, invisibleButtons);
210
211
  }
212
+ handleAddGridMode() {
213
+ return this.enableGridInsert ? TaskbarElement.GRID_MODE : "";
214
+ }
211
215
  getInvisibleButtons() {
212
216
  const invisibleButtons = [];
213
217
  if (this.dataState && this.dataState.selectionInfo.mode === SelectionMode.ALL_RECORDS)
@@ -794,6 +798,24 @@ export class SnkGuidesViewer {
794
798
  },
795
799
  "attribute": "form-legacy-config-name",
796
800
  "reflect": false
801
+ },
802
+ "enableGridInsert": {
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 inser\u00E7\u00E3o de registros no modo grade."
815
+ },
816
+ "attribute": "enable-grid-insert",
817
+ "reflect": false,
818
+ "defaultValue": "false"
797
819
  }
798
820
  };
799
821
  }
@@ -73,10 +73,8 @@ export class SnkFormConfigManager {
73
73
  if (fields != undefined && fields.length > 0) {
74
74
  return fields.map(({ label, name, readOnly, visible, required }) => {
75
75
  if (label == undefined) {
76
- return Object.assign(Object.assign({}, dataUnit.getField(name)), { name,
77
- readOnly,
78
- visible,
79
- required });
76
+ const currentField = dataUnit.getField(name);
77
+ return Object.assign(Object.assign({}, currentField), { name: name !== null && name !== void 0 ? name : currentField.name, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : currentField.readOnly, visible: visible !== null && visible !== void 0 ? visible : currentField.visible, required: required !== null && required !== void 0 ? required : currentField.required });
80
78
  }
81
79
  return { name, label, readOnly, visible, required };
82
80
  })
@@ -100,7 +98,7 @@ export class SnkFormConfigManager {
100
98
  const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
101
99
  return normalizedText.includes(normalizedFilter);
102
100
  }
103
- getInsertionConfig(dataUnit, ignoreReadOnlyFormFields) {
101
+ getFormConfig(dataUnit, ignoreReadOnlyFormFields) {
104
102
  let fields = this.getFieldsList(dataUnit);
105
103
  if (ignoreReadOnlyFormFields) {
106
104
  fields = fields.filter(field => {
@@ -132,8 +130,8 @@ export class SnkFormConfigManager {
132
130
  this._onConfigChange(Object.assign({}, this._config));
133
131
  }
134
132
  }
135
- getConfig(insertionMode, dataUnit, ignoreReadOnlyFormFields) {
136
- return insertionMode ? this.getInsertionConfig(dataUnit, ignoreReadOnlyFormFields !== null && ignoreReadOnlyFormFields !== void 0 ? ignoreReadOnlyFormFields : true) : Object.assign({}, this._config);
133
+ getConfig(dataUnit, ignoreReadOnlyFormFields) {
134
+ return this.getFormConfig(dataUnit, ignoreReadOnlyFormFields !== null && ignoreReadOnlyFormFields !== void 0 ? ignoreReadOnlyFormFields : true);
137
135
  }
138
136
  getFormConfigFetcher() {
139
137
  if (this._formConfigFetcher == undefined) {
@@ -67,7 +67,7 @@ export class SnkFormConfig {
67
67
  }
68
68
  }
69
69
  getConfig() {
70
- let config = this.configManager.getConfig(false, this.dataUnit);
70
+ let config = this.configManager.getConfig(this.dataUnit);
71
71
  if (config.fields && config.fields.length === 0) {
72
72
  config = undefined;
73
73
  }
@@ -1,13 +1,11 @@
1
1
  :host {
2
2
  --snk-grid-min-height: 300px;
3
- --snk-grid-padding: var(--space--lg);
4
3
  }
5
4
 
6
5
  .snk-grid__container {
7
6
  display: flex;
8
7
  height: 100%;
9
8
  width: 100%;
10
- padding: var(--snk-grid-padding);
11
9
  }
12
10
 
13
11
  .snk-grid__header {