@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-68300.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.
- package/dist/cjs/{IExporterProvider-597949f9.js → IExporterProvider-d2a04ee7.js} +2 -2
- package/dist/cjs/{SnkMessageBuilder-722b104e.js → SnkMessageBuilder-28ceaaed.js} +5 -1
- package/dist/cjs/{dataunit-fetcher-688d3f05.js → dataunit-fetcher-75f89355.js} +9 -2
- package/dist/cjs/{field-search-f56aa7d6.js → field-search-68e34bf4.js} +5 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +2 -2
- package/dist/cjs/snk-attach.cjs.entry.js +1 -1
- package/dist/cjs/snk-crud.cjs.entry.js +5 -2
- package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
- package/dist/cjs/{snk-data-unit-eb7e29ca.js → snk-data-unit-bf418767.js} +6 -7
- package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
- package/dist/cjs/snk-detail-view.cjs.entry.js +4 -4
- package/dist/cjs/snk-grid.cjs.entry.js +32 -7
- package/dist/cjs/{snk-guides-viewer-bdc41281.js → snk-guides-viewer-14c27834.js} +8 -4
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -3
- package/dist/cjs/snk-simple-crud.cjs.entry.js +24 -6
- package/dist/collection/components/snk-crud/snk-crud.js +22 -1
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +24 -2
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +4 -5
- package/dist/collection/components/snk-grid/snk-grid.js +57 -5
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +41 -6
- package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +5 -1
- package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +1 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +9 -2
- package/dist/collection/lib/message/resources/snk-grid.msg.js +5 -1
- package/dist/components/IExporterProvider.js +6 -2
- package/dist/components/SnkMessageBuilder.js +5 -1
- package/dist/components/dataunit-fetcher.js +9 -2
- package/dist/components/snk-crud.js +5 -1
- package/dist/components/snk-data-unit2.js +4 -5
- package/dist/components/snk-detail-view2.js +7 -2
- package/dist/components/snk-grid2.js +32 -6
- package/dist/components/snk-simple-crud2.js +22 -3
- package/dist/esm/{IExporterProvider-63a188b6.js → IExporterProvider-b2e244b3.js} +2 -2
- package/dist/esm/{SnkMessageBuilder-89925609.js → SnkMessageBuilder-0485b99a.js} +5 -1
- package/dist/esm/{dataunit-fetcher-264191b2.js → dataunit-fetcher-6463ac8d.js} +9 -2
- package/dist/esm/{field-search-efbe307f.js → field-search-f8b1d91e.js} +5 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +1 -1
- package/dist/esm/snk-application.entry.js +2 -2
- package/dist/esm/snk-attach.entry.js +1 -1
- package/dist/esm/snk-crud.entry.js +5 -2
- package/dist/esm/snk-data-exporter.entry.js +3 -3
- package/dist/esm/{snk-data-unit-2e5021e9.js → snk-data-unit-20860cfc.js} +6 -7
- package/dist/esm/snk-data-unit.entry.js +3 -3
- package/dist/esm/snk-detail-view.entry.js +4 -4
- package/dist/esm/snk-grid.entry.js +32 -7
- package/dist/esm/{snk-guides-viewer-dda0fede.js → snk-guides-viewer-b82ec79a.js} +8 -4
- package/dist/esm/snk-guides-viewer.entry.js +3 -3
- package/dist/esm/snk-simple-crud.entry.js +24 -6
- package/dist/sankhyablocks/{p-3a212712.js → p-0e85d9ba.js} +1 -1
- package/dist/sankhyablocks/p-14c2056a.js +1 -0
- package/dist/sankhyablocks/p-23736d75.js +1 -0
- package/dist/sankhyablocks/{p-7505da04.entry.js → p-249adf8b.entry.js} +1 -1
- package/dist/sankhyablocks/{p-8fb7d19d.entry.js → p-2f978e29.entry.js} +1 -1
- package/dist/sankhyablocks/{p-c1d57831.entry.js → p-4111c6ce.entry.js} +1 -1
- package/dist/sankhyablocks/p-4238fcd4.entry.js +1 -0
- package/dist/sankhyablocks/p-6614c578.js +1 -0
- package/dist/sankhyablocks/p-6fede3d4.entry.js +1 -0
- package/dist/sankhyablocks/p-701442ef.entry.js +1 -0
- package/dist/sankhyablocks/{p-045eae4d.entry.js → p-74fafa0d.entry.js} +2 -2
- package/dist/sankhyablocks/p-950037cb.js +1 -0
- package/dist/sankhyablocks/{p-70791b3c.entry.js → p-95e44a9c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-fe79f83a.js → p-b4d016a3.js} +1 -1
- package/dist/sankhyablocks/{p-4e5e1313.entry.js → p-d0bec13f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-75e674ed.entry.js → p-ebc4011a.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-crud/snk-crud.d.ts +4 -0
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +5 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +1 -1
- package/dist/types/components/snk-grid/snk-grid.d.ts +9 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +7 -0
- package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +1 -0
- package/dist/types/components.d.ts +32 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-4f3717df.entry.js +0 -1
- package/dist/sankhyablocks/p-61bf5b79.js +0 -1
- package/dist/sankhyablocks/p-75f83d1d.entry.js +0 -1
- package/dist/sankhyablocks/p-7a337364.js +0 -1
- package/dist/sankhyablocks/p-7a85fd49.entry.js +0 -1
- package/dist/sankhyablocks/p-c2495304.js +0 -1
- package/dist/sankhyablocks/p-fa4d8cb4.js +0 -1
|
@@ -7,16 +7,16 @@ const core = require('@sankhyalabs/core');
|
|
|
7
7
|
const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
|
|
8
8
|
const ConfigStorage = require('./ConfigStorage-a343e418.js');
|
|
9
9
|
const index$1 = require('./index-1dfc7a6e.js');
|
|
10
|
-
const fieldSearch = require('./field-search-
|
|
10
|
+
const fieldSearch = require('./field-search-68e34bf4.js');
|
|
11
11
|
const index$2 = require('./index-102ba62d.js');
|
|
12
|
-
const IExporterProvider = require('./IExporterProvider-
|
|
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-
|
|
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');
|
|
@@ -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
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 &&
|
|
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.
|
|
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 {
|
|
@@ -4,7 +4,7 @@ const index = require('./index-f9e81701.js');
|
|
|
4
4
|
const core = require('@sankhyalabs/core');
|
|
5
5
|
const SnkFormConfigManager = require('./SnkFormConfigManager-166cbd1f.js');
|
|
6
6
|
const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
|
|
7
|
-
const fieldSearch = require('./field-search-
|
|
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-
|
|
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 {
|
|
@@ -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,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const snkGuidesViewer = require('./snk-guides-viewer-
|
|
5
|
+
const snkGuidesViewer = require('./snk-guides-viewer-14c27834.js');
|
|
6
6
|
require('./index-f9e81701.js');
|
|
7
7
|
require('@sankhyalabs/core');
|
|
8
8
|
require('./SnkFormConfigManager-166cbd1f.js');
|
|
@@ -13,7 +13,7 @@ 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-
|
|
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-
|
|
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');
|
|
@@ -9,15 +9,15 @@ 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-
|
|
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-
|
|
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-
|
|
20
|
+
const fieldSearch = require('./field-search-68e34bf4.js');
|
|
21
21
|
const ConfigStorage = require('./ConfigStorage-a343e418.js');
|
|
22
22
|
const SnkFormConfigManager = require('./SnkFormConfigManager-166cbd1f.js');
|
|
23
23
|
const RecordIDUtils = require('./RecordIDUtils-3735135c.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":
|
|
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));
|
|
@@ -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:
|
|
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
|
}
|
|
@@ -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 {
|
|
@@ -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
|
}
|
|
@@ -66,7 +66,7 @@ export class SnkDataUnit {
|
|
|
66
66
|
this._application.updateDataunitCache(oldValue, this.dataUnitName, this.dataUnit);
|
|
67
67
|
}
|
|
68
68
|
else {
|
|
69
|
-
this.loadDataUnit(
|
|
69
|
+
this.loadDataUnit();
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -74,7 +74,7 @@ export class SnkDataUnit {
|
|
|
74
74
|
if (oldValue != newValue) {
|
|
75
75
|
this.dataUnit = undefined;
|
|
76
76
|
this.entityName = newValue;
|
|
77
|
-
this.loadDataUnit(
|
|
77
|
+
this.loadDataUnit();
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
observeDataState(newValue, oldValue) {
|
|
@@ -535,7 +535,7 @@ export class SnkDataUnit {
|
|
|
535
535
|
return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName, this.resourceID);
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
|
-
async loadDataUnit(
|
|
538
|
+
async loadDataUnit() {
|
|
539
539
|
var _a;
|
|
540
540
|
if (this.dataUnit == null && this._application && this.entityName) {
|
|
541
541
|
this.dataUnit = await this.getDataUnitParentOrChild();
|
|
@@ -545,8 +545,7 @@ export class SnkDataUnit {
|
|
|
545
545
|
this.dataUnit.unsubscribe(this._dataUnitObserver);
|
|
546
546
|
this.dataUnit.addInterceptor(this);
|
|
547
547
|
this.dataUnit.subscribe(this._dataUnitObserver);
|
|
548
|
-
|
|
549
|
-
await this.dataUnit.loadMetadata();
|
|
548
|
+
await this.dataUnit.loadMetadata();
|
|
550
549
|
if ((_a = this.dataUnit.records) === null || _a === void 0 ? void 0 : _a.length) {
|
|
551
550
|
this.getMetadataByRow(this.dataUnit);
|
|
552
551
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h, Fragment } from '@stencil/core';
|
|
1
|
+
import { h, Fragment, } from '@stencil/core';
|
|
2
2
|
import { Action as DUAction, ApplicationContext, ElementIDUtils, StringUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { TaskbarElement } from '../snk-taskbar/elements/taskbar-elements';
|
|
4
4
|
import { ConfigStorage } from '../../lib/configs/ConfigStorage';
|
|
@@ -19,7 +19,7 @@ export class SnkGrid {
|
|
|
19
19
|
"snkGridTopTaskbar.regular": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
|
|
20
20
|
"snkGridTopTaskbar.regular.secondary": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
|
|
21
21
|
"snkGridTopTaskbar.regular.singleTaskbar": [],
|
|
22
|
-
"snkGridTopTaskbar.finish_edition": ["CANCEL", "SAVE"],
|
|
22
|
+
"snkGridTopTaskbar.finish_edition": ["CANCEL", "SAVE", this.handleAddFormMode()],
|
|
23
23
|
"snkGridTopTaskbar.finish_edition.secondary": [],
|
|
24
24
|
"snkGridTopTaskbar.finish_edition.singleTaskbar": [],
|
|
25
25
|
});
|
|
@@ -32,7 +32,7 @@ export class SnkGrid {
|
|
|
32
32
|
"snkGridHeaderTaskbar.singleTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "ATTACH", "FORM_MODE", "CONFIGURATOR", "REFRESH", "DATA_EXPORTER", "ACTIONS_BUTTON"],
|
|
33
33
|
"snkGridHeaderTaskbar.singleTaskbar.detail.unselected": ["INSERT", "FORM_MODE", "CONFIGURATOR", "REFRESH", "MORE_OPTIONS"],
|
|
34
34
|
"snkGridHeaderTaskbar.singleTaskbar.detail.selected": ["UPDATE", "ATTACH", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "FORM_MODE", "CONFIGURATOR", "REFRESH"],
|
|
35
|
-
"snkGridHeaderTaskbar.singleTaskbar.finish_edition": ["CANCEL", "SAVE"]
|
|
35
|
+
"snkGridHeaderTaskbar.singleTaskbar.finish_edition": ["CANCEL", "SAVE", this.handleAddFormMode()]
|
|
36
36
|
});
|
|
37
37
|
this.dataUnitInterceptor = {
|
|
38
38
|
interceptAction: async (action) => {
|
|
@@ -70,6 +70,7 @@ export class SnkGrid {
|
|
|
70
70
|
this.filterBarLegacyConfigName = undefined;
|
|
71
71
|
this.autoLoad = undefined;
|
|
72
72
|
this.autoFocus = true;
|
|
73
|
+
this.enableGridInsert = false;
|
|
73
74
|
}
|
|
74
75
|
/**
|
|
75
76
|
* Exibe a janela de configurações da grade.
|
|
@@ -156,6 +157,16 @@ export class SnkGrid {
|
|
|
156
157
|
async setFocus() {
|
|
157
158
|
this._grid.setFocus();
|
|
158
159
|
}
|
|
160
|
+
async handleClick(event) {
|
|
161
|
+
if (this.hasToBlockEvent(event)) {
|
|
162
|
+
event.preventDefault();
|
|
163
|
+
event.stopPropagation();
|
|
164
|
+
await this._dataUnit.cancelEdition();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
hasToBlockEvent(event) {
|
|
168
|
+
return this._snkFilterBar.contains(event.target) && this.enableGridInsert && this._dataUnit.hasNewRecord();
|
|
169
|
+
}
|
|
159
170
|
async handleGridLegacyConfigName(newLegacyConfig, oldLegacyConfig) {
|
|
160
171
|
if (!newLegacyConfig) {
|
|
161
172
|
return;
|
|
@@ -166,6 +177,9 @@ export class SnkGrid {
|
|
|
166
177
|
this.addGridLegacyConfigName();
|
|
167
178
|
this.loadConfig();
|
|
168
179
|
}
|
|
180
|
+
handleAddFormMode() {
|
|
181
|
+
return this.enableGridInsert ? TaskbarElement.FORM_MODE : "";
|
|
182
|
+
}
|
|
169
183
|
openGridConfig() {
|
|
170
184
|
this._grid.getColumnsState()
|
|
171
185
|
.then((gridColumns) => {
|
|
@@ -295,8 +309,9 @@ export class SnkGrid {
|
|
|
295
309
|
this.loadConfig();
|
|
296
310
|
}
|
|
297
311
|
componentDidRender() {
|
|
312
|
+
var _a, _b;
|
|
298
313
|
this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
|
|
299
|
-
this.loadGridCustomFormatters(this._dataUnit.metadata.fields);
|
|
314
|
+
this.loadGridCustomFormatters((_b = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.fields);
|
|
300
315
|
this.setCustomRenders();
|
|
301
316
|
this.setCustomEditors();
|
|
302
317
|
}
|
|
@@ -394,6 +409,8 @@ export class SnkGrid {
|
|
|
394
409
|
eagerInitialize: true,
|
|
395
410
|
itemBuilder: (actionButton, item) => this.getColumnSearch(actionButton, item)
|
|
396
411
|
}];
|
|
412
|
+
if (this.isGridInsertActive())
|
|
413
|
+
return hardList;
|
|
397
414
|
if (this.taskbarManager != undefined && this.taskbarManager.getMoreOptions != undefined) {
|
|
398
415
|
const taskbarID = this.getTopTaskBarId();
|
|
399
416
|
return hardList.concat(this.taskbarManager.getMoreOptions(taskbarID, this.configName, this._dataState, this.actionsList));
|
|
@@ -411,12 +428,20 @@ export class SnkGrid {
|
|
|
411
428
|
}
|
|
412
429
|
this._showSnkFilterBar = true;
|
|
413
430
|
}
|
|
431
|
+
getGridHeaderButtons() {
|
|
432
|
+
if (this.isGridInsertActive())
|
|
433
|
+
return TaskbarElement.MORE_OPTIONS;
|
|
434
|
+
return this._headerTaskbarProcessor.buttons;
|
|
435
|
+
}
|
|
436
|
+
isGridInsertActive() {
|
|
437
|
+
return this.enableGridInsert && this._dataUnit.hasNewRecord();
|
|
438
|
+
}
|
|
414
439
|
render() {
|
|
415
440
|
if (!this._dataUnit) {
|
|
416
441
|
return undefined;
|
|
417
442
|
}
|
|
418
443
|
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 &&
|
|
419
|
-
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, autoFocus: this.autoFocus }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this.
|
|
444
|
+
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, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert }, 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 }, 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 }))));
|
|
420
445
|
}
|
|
421
446
|
static get is() { return "snk-grid"; }
|
|
422
447
|
static get encapsulation() { return "scoped"; }
|
|
@@ -862,6 +887,24 @@ export class SnkGrid {
|
|
|
862
887
|
"attribute": "auto-focus",
|
|
863
888
|
"reflect": false,
|
|
864
889
|
"defaultValue": "true"
|
|
890
|
+
},
|
|
891
|
+
"enableGridInsert": {
|
|
892
|
+
"type": "boolean",
|
|
893
|
+
"mutable": false,
|
|
894
|
+
"complexType": {
|
|
895
|
+
"original": "boolean",
|
|
896
|
+
"resolved": "boolean",
|
|
897
|
+
"references": {}
|
|
898
|
+
},
|
|
899
|
+
"required": false,
|
|
900
|
+
"optional": true,
|
|
901
|
+
"docs": {
|
|
902
|
+
"tags": [],
|
|
903
|
+
"text": "Ativa inser\u00E7\u00E3o de registros no modo grade."
|
|
904
|
+
},
|
|
905
|
+
"attribute": "enable-grid-insert",
|
|
906
|
+
"reflect": false,
|
|
907
|
+
"defaultValue": "false"
|
|
865
908
|
}
|
|
866
909
|
};
|
|
867
910
|
}
|
|
@@ -1143,4 +1186,13 @@ export class SnkGrid {
|
|
|
1143
1186
|
"methodName": "handleGridLegacyConfigName"
|
|
1144
1187
|
}];
|
|
1145
1188
|
}
|
|
1189
|
+
static get listeners() {
|
|
1190
|
+
return [{
|
|
1191
|
+
"name": "click",
|
|
1192
|
+
"method": "handleClick",
|
|
1193
|
+
"target": undefined,
|
|
1194
|
+
"capture": true,
|
|
1195
|
+
"passive": false
|
|
1196
|
+
}];
|
|
1197
|
+
}
|
|
1146
1198
|
}
|