@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-68936.0 → 0.0.0-bugfix-dev-KB-38445.1
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/{ConfigStorage-a343e418.js → ConfigStorage-942ce74b.js} +0 -1
- package/dist/cjs/{IExporterProvider-d2a04ee7.js → IExporterProvider-597949f9.js} +2 -2
- package/dist/cjs/{SnkFormConfigManager-166cbd1f.js → SnkFormConfigManager-1b13bacd.js} +8 -6
- package/dist/cjs/{SnkMessageBuilder-28ceaaed.js → SnkMessageBuilder-722b104e.js} +1 -5
- package/dist/cjs/{dataunit-fetcher-75f89355.js → dataunit-fetcher-688d3f05.js} +2 -9
- package/dist/cjs/{field-search-68e34bf4.js → field-search-f56aa7d6.js} +1 -5
- 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 +2 -2
- package/dist/cjs/snk-application.cjs.entry.js +3 -3
- package/dist/cjs/snk-attach.cjs.entry.js +1 -1
- package/dist/cjs/snk-crud.cjs.entry.js +2 -5
- package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
- package/dist/cjs/{snk-data-unit-bf418767.js → snk-data-unit-685272e7.js} +2 -2
- package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
- package/dist/cjs/snk-detail-view.cjs.entry.js +8 -7
- package/dist/cjs/snk-filter-bar.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +1 -1
- package/dist/cjs/snk-form-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-form.cjs.entry.js +2 -2
- package/dist/cjs/snk-grid.cjs.entry.js +10 -35
- package/dist/cjs/{snk-guides-viewer-14c27834.js → snk-guides-viewer-67605336.js} +6 -10
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +5 -5
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +10 -28
- package/dist/collection/components/snk-crud/snk-crud.js +1 -22
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +2 -1
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +3 -25
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +7 -5
- package/dist/collection/components/snk-form-config/snk-form-config.js +1 -1
- package/dist/collection/components/snk-grid/snk-grid.css +2 -0
- package/dist/collection/components/snk-grid/snk-grid.js +6 -58
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +8 -43
- package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +1 -5
- package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +1 -1
- package/dist/collection/lib/configs/ConfigStorage.js +0 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +2 -9
- package/dist/collection/lib/message/resources/snk-grid.msg.js +1 -5
- package/dist/components/ConfigStorage.js +0 -1
- package/dist/components/IExporterProvider.js +2 -6
- package/dist/components/SnkFormConfigManager.js +7 -5
- package/dist/components/SnkMessageBuilder.js +1 -5
- package/dist/components/dataunit-fetcher.js +2 -9
- package/dist/components/snk-crud.js +1 -5
- package/dist/components/snk-detail-view2.js +5 -9
- package/dist/components/snk-form-config2.js +1 -1
- package/dist/components/snk-grid2.js +8 -34
- package/dist/components/snk-simple-crud2.js +5 -24
- package/dist/esm/{ConfigStorage-3806514e.js → ConfigStorage-86187da3.js} +0 -1
- package/dist/esm/{IExporterProvider-b2e244b3.js → IExporterProvider-63a188b6.js} +2 -2
- package/dist/esm/{SnkFormConfigManager-31b24066.js → SnkFormConfigManager-d4554df9.js} +8 -6
- package/dist/esm/{SnkMessageBuilder-0485b99a.js → SnkMessageBuilder-89925609.js} +1 -5
- package/dist/esm/{dataunit-fetcher-6463ac8d.js → dataunit-fetcher-264191b2.js} +2 -9
- package/dist/esm/{field-search-f8b1d91e.js → field-search-efbe307f.js} +1 -5
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +2 -2
- package/dist/esm/snk-application.entry.js +3 -3
- package/dist/esm/snk-attach.entry.js +1 -1
- package/dist/esm/snk-crud.entry.js +2 -5
- package/dist/esm/snk-data-exporter.entry.js +3 -3
- package/dist/esm/{snk-data-unit-20860cfc.js → snk-data-unit-63f83504.js} +2 -2
- package/dist/esm/snk-data-unit.entry.js +3 -3
- package/dist/esm/snk-detail-view.entry.js +8 -7
- package/dist/esm/snk-filter-bar.entry.js +1 -1
- package/dist/esm/snk-filter-modal-item.entry.js +1 -1
- package/dist/esm/snk-form-config.entry.js +1 -1
- package/dist/esm/snk-form.entry.js +2 -2
- package/dist/esm/snk-grid.entry.js +10 -35
- package/dist/esm/{snk-guides-viewer-b82ec79a.js → snk-guides-viewer-151f6091.js} +6 -10
- package/dist/esm/snk-guides-viewer.entry.js +5 -5
- package/dist/esm/snk-personalized-filter.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +10 -28
- package/dist/sankhyablocks/p-14a08904.entry.js +1 -0
- package/dist/sankhyablocks/{p-ebc4011a.entry.js → p-14b9f964.entry.js} +1 -1
- package/dist/sankhyablocks/p-19c18d06.entry.js +1 -0
- package/dist/sankhyablocks/{p-0e85d9ba.js → p-3a212712.js} +1 -1
- package/dist/sankhyablocks/{p-d6e26ea8.entry.js → p-47b60deb.entry.js} +1 -1
- package/dist/sankhyablocks/{p-249adf8b.entry.js → p-7505da04.entry.js} +1 -1
- package/dist/sankhyablocks/p-75f83d1d.entry.js +1 -0
- package/dist/sankhyablocks/p-7a337364.js +1 -0
- package/dist/sankhyablocks/p-829d4045.js +1 -0
- package/dist/sankhyablocks/{p-74fafa0d.entry.js → p-82a0bfb0.entry.js} +2 -2
- package/dist/sankhyablocks/{p-62ba211a.entry.js → p-8fc470e5.entry.js} +1 -1
- package/dist/sankhyablocks/{p-95e44a9c.entry.js → p-941bf3ef.entry.js} +1 -1
- package/dist/sankhyablocks/{p-47db7e88.entry.js → p-a1d72395.entry.js} +1 -1
- package/dist/sankhyablocks/{p-52920496.js → p-aff76a53.js} +1 -1
- package/dist/sankhyablocks/p-b4b21558.entry.js +1 -0
- package/dist/sankhyablocks/{p-d0bec13f.entry.js → p-bad55caa.entry.js} +1 -1
- package/dist/sankhyablocks/p-c053256c.entry.js +1 -0
- package/dist/sankhyablocks/p-c2495304.js +1 -0
- package/dist/sankhyablocks/{p-2f978e29.entry.js → p-c5268346.entry.js} +1 -1
- package/dist/sankhyablocks/p-cefba299.js +1 -0
- package/dist/sankhyablocks/{p-2c68b3ae.entry.js → p-eae7a817.entry.js} +1 -1
- package/dist/sankhyablocks/{p-950037cb.js → p-fcac4dfc.js} +1 -1
- package/dist/sankhyablocks/{p-b4d016a3.js → p-fe79f83a.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-crud/snk-crud.d.ts +0 -4
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +0 -5
- package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +2 -2
- package/dist/types/components/snk-grid/snk-grid.d.ts +0 -9
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +0 -7
- package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +0 -1
- package/dist/types/components.d.ts +0 -32
- package/package.json +2 -2
- package/dist/sankhyablocks/p-14c2056a.js +0 -1
- package/dist/sankhyablocks/p-23736d75.js +0 -1
- package/dist/sankhyablocks/p-2a408684.js +0 -1
- package/dist/sankhyablocks/p-4111c6ce.entry.js +0 -1
- package/dist/sankhyablocks/p-4238fcd4.entry.js +0 -1
- package/dist/sankhyablocks/p-450c60e4.entry.js +0 -1
- package/dist/sankhyablocks/p-6614c578.js +0 -1
- package/dist/sankhyablocks/p-6fede3d4.entry.js +0 -1
- package/dist/sankhyablocks/p-701442ef.entry.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h, Fragment
|
|
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"],
|
|
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"]
|
|
36
36
|
});
|
|
37
37
|
this.dataUnitInterceptor = {
|
|
38
38
|
interceptAction: async (action) => {
|
|
@@ -70,7 +70,6 @@ export class SnkGrid {
|
|
|
70
70
|
this.filterBarLegacyConfigName = undefined;
|
|
71
71
|
this.autoLoad = undefined;
|
|
72
72
|
this.autoFocus = true;
|
|
73
|
-
this.enableGridInsert = false;
|
|
74
73
|
}
|
|
75
74
|
/**
|
|
76
75
|
* Exibe a janela de configurações da grade.
|
|
@@ -157,16 +156,6 @@ export class SnkGrid {
|
|
|
157
156
|
async setFocus() {
|
|
158
157
|
this._grid.setFocus();
|
|
159
158
|
}
|
|
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
|
-
}
|
|
170
159
|
async handleGridLegacyConfigName(newLegacyConfig, oldLegacyConfig) {
|
|
171
160
|
if (!newLegacyConfig) {
|
|
172
161
|
return;
|
|
@@ -177,9 +166,6 @@ export class SnkGrid {
|
|
|
177
166
|
this.addGridLegacyConfigName();
|
|
178
167
|
this.loadConfig();
|
|
179
168
|
}
|
|
180
|
-
handleAddFormMode() {
|
|
181
|
-
return this.enableGridInsert ? TaskbarElement.FORM_MODE : "";
|
|
182
|
-
}
|
|
183
169
|
openGridConfig() {
|
|
184
170
|
this._grid.getColumnsState()
|
|
185
171
|
.then((gridColumns) => {
|
|
@@ -309,9 +295,8 @@ export class SnkGrid {
|
|
|
309
295
|
this.loadConfig();
|
|
310
296
|
}
|
|
311
297
|
componentDidRender() {
|
|
312
|
-
var _a, _b;
|
|
313
298
|
this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
|
|
314
|
-
this.loadGridCustomFormatters(
|
|
299
|
+
this.loadGridCustomFormatters(this._dataUnit.metadata.fields);
|
|
315
300
|
this.setCustomRenders();
|
|
316
301
|
this.setCustomEditors();
|
|
317
302
|
}
|
|
@@ -409,8 +394,6 @@ export class SnkGrid {
|
|
|
409
394
|
eagerInitialize: true,
|
|
410
395
|
itemBuilder: (actionButton, item) => this.getColumnSearch(actionButton, item)
|
|
411
396
|
}];
|
|
412
|
-
if (this.isGridInsertActive())
|
|
413
|
-
return hardList;
|
|
414
397
|
if (this.taskbarManager != undefined && this.taskbarManager.getMoreOptions != undefined) {
|
|
415
398
|
const taskbarID = this.getTopTaskBarId();
|
|
416
399
|
return hardList.concat(this.taskbarManager.getMoreOptions(taskbarID, this.configName, this._dataState, this.actionsList));
|
|
@@ -428,20 +411,12 @@ export class SnkGrid {
|
|
|
428
411
|
}
|
|
429
412
|
this._showSnkFilterBar = true;
|
|
430
413
|
}
|
|
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
|
-
}
|
|
439
414
|
render() {
|
|
440
415
|
if (!this._dataUnit) {
|
|
441
416
|
return undefined;
|
|
442
417
|
}
|
|
443
|
-
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto
|
|
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
|
|
418
|
+
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto" }, 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._headerTaskbarProcessor.buttons, presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
|
445
420
|
}
|
|
446
421
|
static get is() { return "snk-grid"; }
|
|
447
422
|
static get encapsulation() { return "scoped"; }
|
|
@@ -887,24 +862,6 @@ export class SnkGrid {
|
|
|
887
862
|
"attribute": "auto-focus",
|
|
888
863
|
"reflect": false,
|
|
889
864
|
"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"
|
|
908
865
|
}
|
|
909
866
|
};
|
|
910
867
|
}
|
|
@@ -1186,13 +1143,4 @@ export class SnkGrid {
|
|
|
1186
1143
|
"methodName": "handleGridLegacyConfigName"
|
|
1187
1144
|
}];
|
|
1188
1145
|
}
|
|
1189
|
-
static get listeners() {
|
|
1190
|
-
return [{
|
|
1191
|
-
"name": "click",
|
|
1192
|
-
"method": "handleClick",
|
|
1193
|
-
"target": undefined,
|
|
1194
|
-
"capture": true,
|
|
1195
|
-
"passive": false
|
|
1196
|
-
}];
|
|
1197
|
-
}
|
|
1198
1146
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApplicationContext, DataType, ElementIDUtils, FloatingManager, JSUtils, ObjectUtils, StringUtils, UserInterface, } from '@sankhyalabs/core';
|
|
2
|
-
import { CSSVarsUtils } from
|
|
2
|
+
import { CSSVarsUtils } from "@sankhyalabs/ezui/dist/collection/utils";
|
|
3
3
|
import { h } from '@stencil/core';
|
|
4
4
|
import { SIMPLE_CRUD_MODE, VIEW_MODE } from '../../lib/utils/constants';
|
|
5
5
|
import { TaskbarElement } from '../snk-taskbar/elements/taskbar-elements';
|
|
@@ -13,7 +13,7 @@ import { SnkFormConfigManager } from '../snk-form-config/SnkFormConfigManager';
|
|
|
13
13
|
import { REGULAR_DEFAULT_BTNS, REGULAR_SELECTED_BTNS } from './regular-buttons';
|
|
14
14
|
import RmPrecisionCustomValueFormatter from '../../lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter';
|
|
15
15
|
import ClientSideExporterProvider from '../snk-data-exporter/providers/ClientSideExporterProvider';
|
|
16
|
-
import store from
|
|
16
|
+
import store from "../../lib/store";
|
|
17
17
|
export class SnkSimpleCrud {
|
|
18
18
|
constructor() {
|
|
19
19
|
this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
|
|
@@ -26,7 +26,7 @@ export class SnkSimpleCrud {
|
|
|
26
26
|
"snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]),
|
|
27
27
|
"snkSimpleCrudTaskbar.form_selected": this.getButtons(true, [TaskbarElement.GRID_MODE]),
|
|
28
28
|
"snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]),
|
|
29
|
-
"snkSimpleCrudTaskbar.finish_edition":
|
|
29
|
+
"snkSimpleCrudTaskbar.finish_edition": ["CANCEL", "SAVE"]
|
|
30
30
|
});
|
|
31
31
|
this._showPopUpGridConfig = false;
|
|
32
32
|
this._showFormConfig = false;
|
|
@@ -46,7 +46,6 @@ export class SnkSimpleCrud {
|
|
|
46
46
|
this.useCancelConfirm = true;
|
|
47
47
|
this.pageSize = 150;
|
|
48
48
|
this.resourceID = undefined;
|
|
49
|
-
this.enableGridInsert = false;
|
|
50
49
|
this.taskbarManager = undefined;
|
|
51
50
|
this.messagesBuilder = undefined;
|
|
52
51
|
this.useEnterLikeTab = false;
|
|
@@ -115,13 +114,6 @@ export class SnkSimpleCrud {
|
|
|
115
114
|
newCustomFieldProps.set(fieldName, Object.assign(Object.assign({}, currentProps), { [propName]: value }));
|
|
116
115
|
this._fieldsProps = newCustomFieldProps;
|
|
117
116
|
}
|
|
118
|
-
getFinishEditionButtonsCallback() {
|
|
119
|
-
const btns = ["CANCEL", "SAVE"];
|
|
120
|
-
if (this.enableGridInsert && this._currentViewMode !== VIEW_MODE.ATTACHMENT) {
|
|
121
|
-
btns.push(this._currentViewMode === VIEW_MODE.GRID ? TaskbarElement.FORM_MODE : TaskbarElement.GRID_MODE);
|
|
122
|
-
}
|
|
123
|
-
return btns;
|
|
124
|
-
}
|
|
125
117
|
getButtons(selected, extraButtons) {
|
|
126
118
|
return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
|
|
127
119
|
.concat(extraButtons));
|
|
@@ -204,6 +196,7 @@ export class SnkSimpleCrud {
|
|
|
204
196
|
await this.setFieldProp(field, 'precision', rmPrecision);
|
|
205
197
|
await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
|
|
206
198
|
}
|
|
199
|
+
;
|
|
207
200
|
this._rmPrecisionCustomValueFormatter.setDataState(this.dataState);
|
|
208
201
|
}
|
|
209
202
|
async handleUpdateGridLegacyConfig(newValue, oldValue) {
|
|
@@ -560,9 +553,6 @@ export class SnkSimpleCrud {
|
|
|
560
553
|
const options = filteredFields.map(field => ({ value: field.name, label: field.label }));
|
|
561
554
|
return Promise.resolve(options);
|
|
562
555
|
}
|
|
563
|
-
isGridInsertActive() {
|
|
564
|
-
return this.enableGridInsert && this.dataUnit.hasNewRecord();
|
|
565
|
-
}
|
|
566
556
|
getActionsList() {
|
|
567
557
|
var _a, _b;
|
|
568
558
|
const hardList = [{
|
|
@@ -574,8 +564,6 @@ export class SnkSimpleCrud {
|
|
|
574
564
|
? this.getColumnSearch(actionButton, item)
|
|
575
565
|
: this.getFieldSearch(actionButton, item)
|
|
576
566
|
}];
|
|
577
|
-
if (this.isGridInsertActive())
|
|
578
|
-
return hardList;
|
|
579
567
|
if (this.taskbarManager != undefined && this.taskbarManager.getMoreOptions != undefined) {
|
|
580
568
|
const taskbarID = this.getTopTaskBarId();
|
|
581
569
|
return hardList.concat(this.taskbarManager.getMoreOptions(taskbarID, this.configName, this.dataState, this.actionsList));
|
|
@@ -684,8 +672,8 @@ export class SnkSimpleCrud {
|
|
|
684
672
|
return StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
|
|
685
673
|
}
|
|
686
674
|
getFormConfig() {
|
|
687
|
-
var _a;
|
|
688
|
-
const configFromManager = (_a = this._formConfigManager) === null || _a === void 0 ? void 0 : _a.getConfig(this.dataUnit, this.ignoreReadOnlyFormFields);
|
|
675
|
+
var _a, _b;
|
|
676
|
+
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);
|
|
689
677
|
if (!this.configName && !configFromManager) {
|
|
690
678
|
return this.formConfig;
|
|
691
679
|
}
|
|
@@ -699,20 +687,15 @@ export class SnkSimpleCrud {
|
|
|
699
687
|
}
|
|
700
688
|
this._formConfigManager.setConfig(this.formConfig);
|
|
701
689
|
}
|
|
702
|
-
handleDataUnitOnInsertionMode() {
|
|
703
|
-
if (this.enableGridInsert)
|
|
704
|
-
return;
|
|
705
|
-
this.goToView(VIEW_MODE.FORM);
|
|
706
|
-
}
|
|
707
690
|
/* istanbul ignore next */
|
|
708
691
|
render() {
|
|
709
692
|
var _a;
|
|
710
693
|
if (this.dataUnit == undefined) {
|
|
711
694
|
return;
|
|
712
695
|
}
|
|
713
|
-
return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: this.
|
|
696
|
+
return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this) }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
|
714
697
|
? undefined
|
|
715
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus
|
|
698
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
|
716
699
|
}
|
|
717
700
|
static get is() { return "snk-simple-crud"; }
|
|
718
701
|
static get encapsulation() { return "scoped"; }
|
|
@@ -918,24 +901,6 @@ export class SnkSimpleCrud {
|
|
|
918
901
|
"attribute": "resource-i-d",
|
|
919
902
|
"reflect": false
|
|
920
903
|
},
|
|
921
|
-
"enableGridInsert": {
|
|
922
|
-
"type": "boolean",
|
|
923
|
-
"mutable": false,
|
|
924
|
-
"complexType": {
|
|
925
|
-
"original": "boolean",
|
|
926
|
-
"resolved": "boolean",
|
|
927
|
-
"references": {}
|
|
928
|
-
},
|
|
929
|
-
"required": false,
|
|
930
|
-
"optional": true,
|
|
931
|
-
"docs": {
|
|
932
|
-
"tags": [],
|
|
933
|
-
"text": "Ativa inser\u00E7\u00E3o de registros no modo grade."
|
|
934
|
-
},
|
|
935
|
-
"attribute": "enable-grid-insert",
|
|
936
|
-
"reflect": false,
|
|
937
|
-
"defaultValue": "false"
|
|
938
|
-
},
|
|
939
904
|
"taskbarManager": {
|
|
940
905
|
"type": "unknown",
|
|
941
906
|
"mutable": false,
|
|
@@ -29,16 +29,12 @@ export default class TaskbarProcessor {
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
getButtonsArray(taskbarId, taskbarManager, dataState) {
|
|
32
|
-
const defaults = this.
|
|
32
|
+
const defaults = this._defaultButtons[taskbarId];
|
|
33
33
|
if (taskbarManager) {
|
|
34
34
|
return taskbarManager.getButtons(taskbarId, dataState, [...defaults]);
|
|
35
35
|
}
|
|
36
36
|
return defaults;
|
|
37
37
|
}
|
|
38
|
-
getButtonsFromKey(taskbarId) {
|
|
39
|
-
const btnsValue = this._defaultButtons[taskbarId];
|
|
40
|
-
return typeof btnsValue === 'function' ? btnsValue() : btnsValue;
|
|
41
|
-
}
|
|
42
38
|
isEnabled(taskbarId, taskbarManager, buttonName, dataState, disabled) {
|
|
43
39
|
const originalValue = disabled.includes(buttonName) ? false : true;
|
|
44
40
|
if (taskbarManager && taskbarManager.isEnabled) {
|
|
@@ -8,7 +8,7 @@ export default class RmPrecisionCustomValueFormatter {
|
|
|
8
8
|
this.refreshSelectedRows();
|
|
9
9
|
}
|
|
10
10
|
setDataState(dataState) {
|
|
11
|
-
if (
|
|
11
|
+
if (ObjectUtils.objectToString(dataState) === ObjectUtils.objectToString(this._dataState)) {
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
this._dataState = dataState;
|
|
@@ -71,7 +71,6 @@ export class ConfigStorage {
|
|
|
71
71
|
if (config == undefined) {
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
|
-
name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.grid);
|
|
75
74
|
await this.deleteGridConfigCache(name, resourceID);
|
|
76
75
|
return this.gridConfigFetcher.saveConfig(config, name, resourceID);
|
|
77
76
|
}
|
package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js
CHANGED
|
@@ -44,19 +44,12 @@ export class DatasetStrategy {
|
|
|
44
44
|
const records = this.processRecords(dataUnit, fields, responseRecords);
|
|
45
45
|
const loadingInProgress = pagerId != undefined;
|
|
46
46
|
const count = loadingInfo.count + records.length;
|
|
47
|
-
const isInsertingNewRecord = dataUnit.hasNewRecord();
|
|
48
47
|
const needReload = !loadingInProgress && localSorting.length > 0;
|
|
49
|
-
/**
|
|
50
|
-
* Caso precise recarregar dados, porém está no meio de uma inserção, os dados não devem recarregados instantaneamente,
|
|
51
|
-
* Mas sim, sinalizar que o dataUnit está aguardando para der recarregado.
|
|
52
|
-
*/
|
|
53
|
-
if (needReload && isInsertingNewRecord) {
|
|
54
|
-
dataUnit.setWaitingToReload(true);
|
|
55
|
-
}
|
|
56
48
|
return Promise.resolve({
|
|
57
49
|
records,
|
|
58
50
|
loadingInfo: Object.assign(Object.assign({}, loadingInfo), { pagerId,
|
|
59
|
-
loadingInProgress, total: loadingInProgress ? undefined : count, count,
|
|
51
|
+
loadingInProgress, total: loadingInProgress ? undefined : count, count,
|
|
52
|
+
needReload })
|
|
60
53
|
});
|
|
61
54
|
}
|
|
62
55
|
catch (error) {
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
export const snkGridMessages = {
|
|
2
|
-
findColumn: "Busca de colunas"
|
|
3
|
-
cancelConfirmation: {
|
|
4
|
-
title: "Aviso",
|
|
5
|
-
message: "As alterações realizadas serão descartadas<br/><br/><b>Você realmente gostaria de cancelar?</b>",
|
|
6
|
-
}
|
|
2
|
+
findColumn: "Busca de colunas"
|
|
7
3
|
};
|
|
8
4
|
export const snkGridConfigMessages = {
|
|
9
5
|
gridConfiguration: "Configuração da Grade",
|
|
@@ -423,7 +423,6 @@ class ConfigStorage {
|
|
|
423
423
|
if (config == undefined) {
|
|
424
424
|
return;
|
|
425
425
|
}
|
|
426
|
-
name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.grid);
|
|
427
426
|
await this.deleteGridConfigCache(name, resourceID);
|
|
428
427
|
return this.gridConfigFetcher.saveConfig(config, name, resourceID);
|
|
429
428
|
}
|
|
@@ -124,16 +124,12 @@ class TaskbarProcessor {
|
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
126
|
getButtonsArray(taskbarId, taskbarManager, dataState) {
|
|
127
|
-
const defaults = this.
|
|
127
|
+
const defaults = this._defaultButtons[taskbarId];
|
|
128
128
|
if (taskbarManager) {
|
|
129
129
|
return taskbarManager.getButtons(taskbarId, dataState, [...defaults]);
|
|
130
130
|
}
|
|
131
131
|
return defaults;
|
|
132
132
|
}
|
|
133
|
-
getButtonsFromKey(taskbarId) {
|
|
134
|
-
const btnsValue = this._defaultButtons[taskbarId];
|
|
135
|
-
return typeof btnsValue === 'function' ? btnsValue() : btnsValue;
|
|
136
|
-
}
|
|
137
133
|
isEnabled(taskbarId, taskbarManager, buttonName, dataState, disabled) {
|
|
138
134
|
const originalValue = disabled.includes(buttonName) ? false : true;
|
|
139
135
|
if (taskbarManager && taskbarManager.isEnabled) {
|
|
@@ -221,7 +217,7 @@ class RmPrecisionCustomValueFormatter {
|
|
|
221
217
|
this.refreshSelectedRows();
|
|
222
218
|
}
|
|
223
219
|
setDataState(dataState) {
|
|
224
|
-
if (
|
|
220
|
+
if (ObjectUtils.objectToString(dataState) === ObjectUtils.objectToString(this._dataState)) {
|
|
225
221
|
return;
|
|
226
222
|
}
|
|
227
223
|
this._dataState = dataState;
|
|
@@ -74,8 +74,10 @@ class SnkFormConfigManager {
|
|
|
74
74
|
if (fields != undefined && fields.length > 0) {
|
|
75
75
|
return fields.map(({ label, name, readOnly, visible, required }) => {
|
|
76
76
|
if (label == undefined) {
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
return Object.assign(Object.assign({}, dataUnit.getField(name)), { name,
|
|
78
|
+
readOnly,
|
|
79
|
+
visible,
|
|
80
|
+
required });
|
|
79
81
|
}
|
|
80
82
|
return { name, label, readOnly, visible, required };
|
|
81
83
|
})
|
|
@@ -99,7 +101,7 @@ class SnkFormConfigManager {
|
|
|
99
101
|
const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
|
|
100
102
|
return normalizedText.includes(normalizedFilter);
|
|
101
103
|
}
|
|
102
|
-
|
|
104
|
+
getInsertionConfig(dataUnit, ignoreReadOnlyFormFields) {
|
|
103
105
|
let fields = this.getFieldsList(dataUnit);
|
|
104
106
|
if (ignoreReadOnlyFormFields) {
|
|
105
107
|
fields = fields.filter(field => {
|
|
@@ -131,8 +133,8 @@ class SnkFormConfigManager {
|
|
|
131
133
|
this._onConfigChange(Object.assign({}, this._config));
|
|
132
134
|
}
|
|
133
135
|
}
|
|
134
|
-
getConfig(dataUnit, ignoreReadOnlyFormFields) {
|
|
135
|
-
return this.
|
|
136
|
+
getConfig(insertionMode, dataUnit, ignoreReadOnlyFormFields) {
|
|
137
|
+
return insertionMode ? this.getInsertionConfig(dataUnit, ignoreReadOnlyFormFields !== null && ignoreReadOnlyFormFields !== void 0 ? ignoreReadOnlyFormFields : true) : Object.assign({}, this._config);
|
|
136
138
|
}
|
|
137
139
|
getFormConfigFetcher() {
|
|
138
140
|
if (this._formConfigFetcher == undefined) {
|
|
@@ -245,11 +245,7 @@ const snkConfiguratorMessages = {
|
|
|
245
245
|
};
|
|
246
246
|
|
|
247
247
|
const snkGridMessages = {
|
|
248
|
-
findColumn: "Busca de colunas"
|
|
249
|
-
cancelConfirmation: {
|
|
250
|
-
title: "Aviso",
|
|
251
|
-
message: "As alterações realizadas serão descartadas<br/><br/><b>Você realmente gostaria de cancelar?</b>",
|
|
252
|
-
}
|
|
248
|
+
findColumn: "Busca de colunas"
|
|
253
249
|
};
|
|
254
250
|
const snkGridConfigMessages = {
|
|
255
251
|
gridConfiguration: "Configuração da Grade",
|
|
@@ -424,19 +424,12 @@ class DatasetStrategy {
|
|
|
424
424
|
const records = this.processRecords(dataUnit, fields, responseRecords);
|
|
425
425
|
const loadingInProgress = pagerId != undefined;
|
|
426
426
|
const count = loadingInfo.count + records.length;
|
|
427
|
-
const isInsertingNewRecord = dataUnit.hasNewRecord();
|
|
428
427
|
const needReload = !loadingInProgress && localSorting.length > 0;
|
|
429
|
-
/**
|
|
430
|
-
* Caso precise recarregar dados, porém está no meio de uma inserção, os dados não devem recarregados instantaneamente,
|
|
431
|
-
* Mas sim, sinalizar que o dataUnit está aguardando para der recarregado.
|
|
432
|
-
*/
|
|
433
|
-
if (needReload && isInsertingNewRecord) {
|
|
434
|
-
dataUnit.setWaitingToReload(true);
|
|
435
|
-
}
|
|
436
428
|
return Promise.resolve({
|
|
437
429
|
records,
|
|
438
430
|
loadingInfo: Object.assign(Object.assign({}, loadingInfo), { pagerId,
|
|
439
|
-
loadingInProgress, total: loadingInProgress ? undefined : count, count,
|
|
431
|
+
loadingInProgress, total: loadingInProgress ? undefined : count, count,
|
|
432
|
+
needReload })
|
|
440
433
|
});
|
|
441
434
|
}
|
|
442
435
|
catch (error) {
|
|
@@ -79,7 +79,6 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
79
79
|
this.disablePersonalizedFilter = undefined;
|
|
80
80
|
this.autoLoad = undefined;
|
|
81
81
|
this.autoFocus = true;
|
|
82
|
-
this.enableGridInsert = false;
|
|
83
82
|
this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
|
|
84
83
|
}
|
|
85
84
|
/**
|
|
@@ -203,8 +202,6 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
203
202
|
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
204
203
|
}
|
|
205
204
|
insertionModeHandler() {
|
|
206
|
-
if (this.enableGridInsert)
|
|
207
|
-
return;
|
|
208
205
|
this.gridToForm();
|
|
209
206
|
}
|
|
210
207
|
cancelHandler() {
|
|
@@ -418,7 +415,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
418
415
|
return;
|
|
419
416
|
}
|
|
420
417
|
this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
|
|
421
|
-
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
|
|
418
|
+
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" }))));
|
|
422
419
|
}
|
|
423
420
|
get _element() { return this; }
|
|
424
421
|
static get watchers() { return {
|
|
@@ -444,7 +441,6 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
444
441
|
"disablePersonalizedFilter": [4, "disable-personalized-filter"],
|
|
445
442
|
"autoLoad": [4, "auto-load"],
|
|
446
443
|
"autoFocus": [4, "auto-focus"],
|
|
447
|
-
"enableGridInsert": [4, "enable-grid-insert"],
|
|
448
444
|
"_dataUnit": [32],
|
|
449
445
|
"_dataState": [32],
|
|
450
446
|
"attachmentRegisterKey": [32],
|
|
@@ -70,7 +70,6 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
70
70
|
this.resourceID = undefined;
|
|
71
71
|
this.detailTaskbarCustomContainerId = undefined;
|
|
72
72
|
this.formLegacyConfigName = undefined;
|
|
73
|
-
this.enableGridInsert = false;
|
|
74
73
|
this._hasToCreateFieldSearch = true;
|
|
75
74
|
this._breadcrumbItems = [];
|
|
76
75
|
this._guides = undefined;
|
|
@@ -139,7 +138,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
139
138
|
this._container.focus();
|
|
140
139
|
}
|
|
141
140
|
exitViewer() {
|
|
142
|
-
if (
|
|
141
|
+
if (this.dataUnit.isDirty()) {
|
|
143
142
|
this.dataUnit.cancelEdition({ after: () => this.exit.emit() });
|
|
144
143
|
}
|
|
145
144
|
else {
|
|
@@ -157,7 +156,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
157
156
|
}
|
|
158
157
|
onContentCardChanged(evt) {
|
|
159
158
|
SnkGuidesViewer.updateContentCard(evt.detail.formName, evt.detail.cardConfig, evt.detail.propertyChanged, this._configManager)
|
|
160
|
-
.then(() => this.masterFormConfig = this._configManager.getConfig(this.dataUnit));
|
|
159
|
+
.then(() => this.masterFormConfig = this._configManager.getConfig(this.dataState.insertionMode, this.dataUnit));
|
|
161
160
|
}
|
|
162
161
|
/**
|
|
163
162
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
@@ -248,13 +247,10 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
248
247
|
const invisibleButtons = this.getInvisibleButtons();
|
|
249
248
|
this._taskbarProcessor = new TaskbarProcessor({
|
|
250
249
|
"snkGuideViewer.regular": btnsRegularMode,
|
|
251
|
-
"snkGuideViewer.finish_edition": ["CANCEL", "SAVE"
|
|
250
|
+
"snkGuideViewer.finish_edition": ["CANCEL", "SAVE"],
|
|
252
251
|
});
|
|
253
252
|
this._taskbarProcessor.process(taskbarId, this.taskbarManager, this.dataState, disabledButtons, invisibleButtons);
|
|
254
253
|
}
|
|
255
|
-
handleAddGridMode() {
|
|
256
|
-
return this.enableGridInsert ? TaskbarElement.GRID_MODE : "";
|
|
257
|
-
}
|
|
258
254
|
getInvisibleButtons() {
|
|
259
255
|
const invisibleButtons = [];
|
|
260
256
|
if (this.dataState && this.dataState.selectionInfo.mode === SelectionMode.ALL_RECORDS)
|
|
@@ -562,7 +558,6 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
562
558
|
"resourceID": [1, "resource-i-d"],
|
|
563
559
|
"detailTaskbarCustomContainerId": [1, "detail-taskbar-custom-container-id"],
|
|
564
560
|
"formLegacyConfigName": [1, "form-legacy-config-name"],
|
|
565
|
-
"enableGridInsert": [4, "enable-grid-insert"],
|
|
566
561
|
"_hasToCreateFieldSearch": [32],
|
|
567
562
|
"_breadcrumbItems": [32],
|
|
568
563
|
"_guides": [32],
|
|
@@ -943,13 +938,14 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
943
938
|
return guideId.replace(SnkDetailView.REGEX_FORM_ID, "");
|
|
944
939
|
}
|
|
945
940
|
loadMetadata() {
|
|
941
|
+
var _a;
|
|
946
942
|
if (!this.dataUnit) {
|
|
947
943
|
return;
|
|
948
944
|
}
|
|
949
945
|
if (!this.formConfigManager.isLoaded) {
|
|
950
946
|
return;
|
|
951
947
|
}
|
|
952
|
-
const formConfig = this.formConfigManager.getConfig(this.dataUnit);
|
|
948
|
+
const formConfig = this.formConfigManager.getConfig((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.insertionMode, this.dataUnit);
|
|
953
949
|
//this._cardsState = formConfig?.cardsState;
|
|
954
950
|
this._formMetadata = buildFormMetadata(formConfig == undefined || formConfig.fields.length === 0 ? undefined : formConfig, this.dataUnit, true);
|
|
955
951
|
}
|
|
@@ -76,7 +76,7 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
getConfig() {
|
|
79
|
-
let config = this.configManager.getConfig(this.dataUnit);
|
|
79
|
+
let config = this.configManager.getConfig(false, this.dataUnit);
|
|
80
80
|
if (config.fields && config.fields.length === 0) {
|
|
81
81
|
config = undefined;
|
|
82
82
|
}
|