@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-49699.0 → 0.0.0-bugfix-dev-KB-49699.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/{SnkFormConfigManager-6211fb28.js → SnkFormConfigManager-531a191c.js} +14 -11
- package/dist/cjs/snk-detail-view.cjs.entry.js +2 -2
- package/dist/cjs/snk-form.cjs.entry.js +1 -1
- package/dist/cjs/snk-grid.cjs.entry.js +17 -1
- package/dist/cjs/{snk-guides-viewer-508bb6fe.js → snk-guides-viewer-76b4c346.js} +1 -1
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +2 -2
- package/dist/cjs/snk-simple-crud.cjs.entry.js +20 -14
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +14 -11
- package/dist/collection/components/snk-grid/snk-grid.js +20 -1
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +19 -13
- package/dist/components/SnkFormConfigManager.js +14 -11
- package/dist/components/snk-grid2.js +17 -1
- package/dist/components/snk-simple-crud2.js +19 -13
- package/dist/esm/{SnkFormConfigManager-d86ba46f.js → SnkFormConfigManager-02ecf57f.js} +14 -11
- package/dist/esm/snk-detail-view.entry.js +2 -2
- package/dist/esm/snk-form.entry.js +1 -1
- package/dist/esm/snk-grid.entry.js +17 -1
- package/dist/esm/{snk-guides-viewer-18859840.js → snk-guides-viewer-90ca9105.js} +1 -1
- package/dist/esm/snk-guides-viewer.entry.js +2 -2
- package/dist/esm/snk-simple-crud.entry.js +20 -14
- package/dist/sankhyablocks/{p-b4de81ac.entry.js → p-2cfe0c2c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-5dbc1a3f.js → p-384fd6ae.js} +1 -1
- package/dist/sankhyablocks/{p-64c1b368.entry.js → p-663ff67b.entry.js} +1 -1
- package/dist/sankhyablocks/p-7c501259.entry.js +1 -0
- package/dist/sankhyablocks/p-7f97fee2.entry.js +1 -0
- package/dist/sankhyablocks/{p-e4fb3308.entry.js → p-8111f63f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-60fa6c7a.js → p-fad4c2fe.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +1 -1
- package/dist/types/components/snk-grid/snk-grid.d.ts +2 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +1 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-650f7216.entry.js +0 -1
- package/dist/sankhyablocks/p-fbfab20b.entry.js +0 -1
|
@@ -100,16 +100,19 @@ class SnkFormConfigManager {
|
|
|
100
100
|
const normalizedFilter = core.StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
|
|
101
101
|
return normalizedText.includes(normalizedFilter);
|
|
102
102
|
}
|
|
103
|
-
getInsertionConfig(dataUnit) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (
|
|
108
|
-
|
|
103
|
+
getInsertionConfig(dataUnit, ignoreReadOnlyFormFields) {
|
|
104
|
+
let fields = this.getFieldsList(dataUnit);
|
|
105
|
+
if (ignoreReadOnlyFormFields) {
|
|
106
|
+
fields = fields.filter(field => {
|
|
107
|
+
if (dataUnit) {
|
|
108
|
+
const def = dataUnit.getField(field.name);
|
|
109
|
+
if (def && def.readOnly) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
109
112
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
+
return !field.readOnly;
|
|
114
|
+
});
|
|
115
|
+
}
|
|
113
116
|
return Object.assign(Object.assign({}, this._config), { fields });
|
|
114
117
|
}
|
|
115
118
|
setConfig(config) {
|
|
@@ -129,8 +132,8 @@ class SnkFormConfigManager {
|
|
|
129
132
|
this._onConfigChange(Object.assign({}, this._config));
|
|
130
133
|
}
|
|
131
134
|
}
|
|
132
|
-
getConfig(insertionMode, dataUnit) {
|
|
133
|
-
return insertionMode ? this.getInsertionConfig(dataUnit) : Object.assign({}, this._config);
|
|
135
|
+
getConfig(insertionMode, dataUnit, ignoreReadOnlyFormFields) {
|
|
136
|
+
return insertionMode ? this.getInsertionConfig(dataUnit, ignoreReadOnlyFormFields !== null && ignoreReadOnlyFormFields !== void 0 ? ignoreReadOnlyFormFields : true) : Object.assign({}, this._config);
|
|
134
137
|
}
|
|
135
138
|
getFormConfigFetcher() {
|
|
136
139
|
if (this._formConfigFetcher == undefined) {
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-f9e81701.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
|
-
const SnkFormConfigManager = require('./SnkFormConfigManager-
|
|
7
|
+
const SnkFormConfigManager = require('./SnkFormConfigManager-531a191c.js');
|
|
8
8
|
const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
|
|
9
9
|
require('./DataFetcher-99f0f6ed.js');
|
|
10
10
|
require('./pesquisa-fetcher-94f6b316.js');
|
|
@@ -16,7 +16,7 @@ require('./filter-item-type.enum-a7ffdaa6.js');
|
|
|
16
16
|
require('./form-config-fetcher-9f1a13ca.js');
|
|
17
17
|
const taskbarElements = require('./taskbar-elements-3ecd1278.js');
|
|
18
18
|
const constants = require('./constants-35ddd366.js');
|
|
19
|
-
const snkGuidesViewer = require('./snk-guides-viewer-
|
|
19
|
+
const snkGuidesViewer = require('./snk-guides-viewer-76b4c346.js');
|
|
20
20
|
const SnkMessageBuilder = require('./SnkMessageBuilder-141aa18d.js');
|
|
21
21
|
require('./ConfigStorage-34be11ce.js');
|
|
22
22
|
require('./PrintUtils-bcaeb82f.js');
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-f9e81701.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
|
-
const SnkFormConfigManager = require('./SnkFormConfigManager-
|
|
7
|
+
const SnkFormConfigManager = require('./SnkFormConfigManager-531a191c.js');
|
|
8
8
|
const ResourceIDUtils = require('./ResourceIDUtils-5ff86aa7.js');
|
|
9
9
|
require('./ConfigStorage-34be11ce.js');
|
|
10
10
|
require('./form-config-fetcher-9f1a13ca.js');
|
|
@@ -119,6 +119,16 @@ const SnkGrid = class {
|
|
|
119
119
|
async findColumn() {
|
|
120
120
|
await fieldSearch.openFieldSearch(this._moreOptions, this._columnSearch);
|
|
121
121
|
}
|
|
122
|
+
async handleGridLegacyConfigName(newLegacyConfig, oldLegacyConfig) {
|
|
123
|
+
if (!newLegacyConfig) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (newLegacyConfig === oldLegacyConfig) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
this.addGridLegacyConfigName();
|
|
130
|
+
this.loadConfig();
|
|
131
|
+
}
|
|
122
132
|
openGridConfig() {
|
|
123
133
|
this._grid.getColumnsState()
|
|
124
134
|
.then((gridColumns) => {
|
|
@@ -412,14 +422,20 @@ const SnkGrid = class {
|
|
|
412
422
|
}
|
|
413
423
|
this._showSnkFilterBar = true;
|
|
414
424
|
}
|
|
425
|
+
getConfig() {
|
|
426
|
+
return this._gridConfig == undefined ? undefined : Object.assign({}, this._gridConfig);
|
|
427
|
+
}
|
|
415
428
|
render() {
|
|
416
429
|
if (!this._dataUnit) {
|
|
417
430
|
return undefined;
|
|
418
431
|
}
|
|
419
432
|
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 &&
|
|
420
|
-
index.h(index.Fragment, null, index.h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName }), index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), index.h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, index.h("slot", { name: this.topTaskbarCustomSlotId }))), index.h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === index$1.PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this.
|
|
433
|
+
index.h(index.Fragment, null, index.h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName }), index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), index.h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, index.h("slot", { name: this.topTaskbarCustomSlotId }))), index.h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === index$1.PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this.getConfig(), onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, index.h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, index.h("slot", { name: this.gridHeaderCustomSlotId }))), index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("slot", { name: "SnkGridFooter" })), index.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
|
421
434
|
}
|
|
422
435
|
get _element() { return index.getElement(this); }
|
|
436
|
+
static get watchers() { return {
|
|
437
|
+
"gridLegacyConfigName": ["handleGridLegacyConfigName"]
|
|
438
|
+
}; }
|
|
423
439
|
};
|
|
424
440
|
SnkGrid.style = snkGridCss;
|
|
425
441
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const index = require('./index-f9e81701.js');
|
|
4
4
|
const core = require('@sankhyalabs/core');
|
|
5
|
-
const SnkFormConfigManager = require('./SnkFormConfigManager-
|
|
5
|
+
const SnkFormConfigManager = require('./SnkFormConfigManager-531a191c.js');
|
|
6
6
|
const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
|
|
7
7
|
const fieldSearch = require('./field-search-f56aa7d6.js');
|
|
8
8
|
const taskbarElements = require('./taskbar-elements-3ecd1278.js');
|
|
@@ -2,10 +2,10 @@
|
|
|
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-76b4c346.js');
|
|
6
6
|
require('./index-f9e81701.js');
|
|
7
7
|
require('@sankhyalabs/core');
|
|
8
|
-
require('./SnkFormConfigManager-
|
|
8
|
+
require('./SnkFormConfigManager-531a191c.js');
|
|
9
9
|
require('./ConfigStorage-34be11ce.js');
|
|
10
10
|
require('./form-config-fetcher-9f1a13ca.js');
|
|
11
11
|
require('./DataFetcher-99f0f6ed.js');
|
|
@@ -17,7 +17,7 @@ require('./filter-item-type.enum-a7ffdaa6.js');
|
|
|
17
17
|
require('./form-config-fetcher-9f1a13ca.js');
|
|
18
18
|
const fieldSearch = require('./field-search-f56aa7d6.js');
|
|
19
19
|
const ConfigStorage = require('./ConfigStorage-34be11ce.js');
|
|
20
|
-
const SnkFormConfigManager = require('./SnkFormConfigManager-
|
|
20
|
+
const SnkFormConfigManager = require('./SnkFormConfigManager-531a191c.js');
|
|
21
21
|
require('./index-102ba62d.js');
|
|
22
22
|
require('./PrintUtils-bcaeb82f.js');
|
|
23
23
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
|
@@ -139,16 +139,18 @@ const SnkSimpleCrud = class {
|
|
|
139
139
|
}
|
|
140
140
|
async handleUpdateFormLegacyConfig() {
|
|
141
141
|
var _a, _b, _c;
|
|
142
|
-
if (this.formLegacyConfigName) {
|
|
143
|
-
|
|
144
|
-
if (!legacyConfig)
|
|
145
|
-
return;
|
|
146
|
-
const rawFields = (_c = (_b = (_a = legacyConfig === null || legacyConfig === void 0 ? void 0 : legacyConfig.formConfig) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : [];
|
|
147
|
-
const fields = Array.isArray(rawFields) ? rawFields : [rawFields];
|
|
148
|
-
const newConfig = { emptyConfig: false, fields: fields };
|
|
149
|
-
this.setFormConfig(newConfig, true);
|
|
150
|
-
this._formConfigManager.setConfig(this.formConfig);
|
|
142
|
+
if (!this.formLegacyConfigName) {
|
|
143
|
+
return;
|
|
151
144
|
}
|
|
145
|
+
const legacyConfig = await this.fetchFormLegacyConfig();
|
|
146
|
+
if (!legacyConfig)
|
|
147
|
+
return;
|
|
148
|
+
const rawFields = (_c = (_b = (_a = legacyConfig === null || legacyConfig === void 0 ? void 0 : legacyConfig.formConfig) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : [];
|
|
149
|
+
const fields = Array.isArray(rawFields) ? rawFields : [rawFields];
|
|
150
|
+
const newConfig = { emptyConfig: false, fields: fields };
|
|
151
|
+
this.setFormConfig(newConfig, true);
|
|
152
|
+
const formConfigManager = this.getFormConfigManger();
|
|
153
|
+
formConfigManager.setConfig(this.formConfig);
|
|
152
154
|
}
|
|
153
155
|
async fetchFormLegacyConfig() {
|
|
154
156
|
const payload = {
|
|
@@ -205,16 +207,20 @@ const SnkSimpleCrud = class {
|
|
|
205
207
|
});
|
|
206
208
|
});
|
|
207
209
|
}
|
|
208
|
-
|
|
210
|
+
getFormConfigManger() {
|
|
209
211
|
if (this._formConfigManager == undefined) {
|
|
210
212
|
this._formConfigManager = new SnkFormConfigManager.SnkFormConfigManager(this.configName, this._resourceID);
|
|
211
|
-
this._formConfigManager.setConfig(this.formConfig);
|
|
212
213
|
}
|
|
214
|
+
return this._formConfigManager;
|
|
215
|
+
}
|
|
216
|
+
async loadFormConfig() {
|
|
217
|
+
const formConfigManager = this.getFormConfigManger();
|
|
218
|
+
formConfigManager.setConfig(this.formConfig);
|
|
213
219
|
if (this.formConfig != undefined || this._formConfigAlreadyLoaded) {
|
|
214
220
|
return;
|
|
215
221
|
}
|
|
216
222
|
this._formConfigAlreadyLoaded = true;
|
|
217
|
-
this.setFormConfig(await
|
|
223
|
+
this.setFormConfig(await formConfigManager.loadConfig());
|
|
218
224
|
}
|
|
219
225
|
async componentWillRender() {
|
|
220
226
|
this._resourceID = await this.application.getResourceID();
|
|
@@ -508,7 +514,7 @@ const SnkSimpleCrud = class {
|
|
|
508
514
|
}
|
|
509
515
|
return (index.h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), onInsertionMode: () => this.goToView(constants.VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, index.h("header", null, index.h("slot", { name: "snkSimpleCrudHeader" })), index.h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, index.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, slot: "leftButtons", presentationMode: index$1.PresentationMode.SECONDARY }, index.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index.h("stack-item", null, index.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(pesquisaFetcher.InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
|
510
516
|
? undefined
|
|
511
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, index.h("div", { slot: "footer" }, index.h("slot", { name: "snkSimpleCrudFooter" })))), index.h("stack-item", null, index.h("ez-form", { class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: (_b = this._formConfigManager) === null || _b === void 0 ? void 0 : _b.getConfig(
|
|
517
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, index.h("div", { slot: "footer" }, index.h("slot", { name: "snkSimpleCrudFooter" })))), index.h("stack-item", null, index.h("ez-form", { class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: (_b = this._formConfigManager) === null || _b === void 0 ? void 0 : _b.getConfig((_c = this.dataState) === null || _c === void 0 ? void 0 : _c.insertionMode, this.dataUnit, this.ignoreReadOnlyFormFields), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && index.h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && index.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._resourceID, customContainerId: this._customContainerId })), index.h("div", { id: `${this._customContainerId}` }, index.h("slot", { name: "SnkConfigContainerSlot" }))), index.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, 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 }))));
|
|
512
518
|
}
|
|
513
519
|
get _element() { return index.getElement(this); }
|
|
514
520
|
static get watchers() { return {
|
|
@@ -97,16 +97,19 @@ export class SnkFormConfigManager {
|
|
|
97
97
|
const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
|
|
98
98
|
return normalizedText.includes(normalizedFilter);
|
|
99
99
|
}
|
|
100
|
-
getInsertionConfig(dataUnit) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (
|
|
105
|
-
|
|
100
|
+
getInsertionConfig(dataUnit, ignoreReadOnlyFormFields) {
|
|
101
|
+
let fields = this.getFieldsList(dataUnit);
|
|
102
|
+
if (ignoreReadOnlyFormFields) {
|
|
103
|
+
fields = fields.filter(field => {
|
|
104
|
+
if (dataUnit) {
|
|
105
|
+
const def = dataUnit.getField(field.name);
|
|
106
|
+
if (def && def.readOnly) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
106
109
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
+
return !field.readOnly;
|
|
111
|
+
});
|
|
112
|
+
}
|
|
110
113
|
return Object.assign(Object.assign({}, this._config), { fields });
|
|
111
114
|
}
|
|
112
115
|
setConfig(config) {
|
|
@@ -126,8 +129,8 @@ export class SnkFormConfigManager {
|
|
|
126
129
|
this._onConfigChange(Object.assign({}, this._config));
|
|
127
130
|
}
|
|
128
131
|
}
|
|
129
|
-
getConfig(insertionMode, dataUnit) {
|
|
130
|
-
return insertionMode ? this.getInsertionConfig(dataUnit) : Object.assign({}, this._config);
|
|
132
|
+
getConfig(insertionMode, dataUnit, ignoreReadOnlyFormFields) {
|
|
133
|
+
return insertionMode ? this.getInsertionConfig(dataUnit, ignoreReadOnlyFormFields !== null && ignoreReadOnlyFormFields !== void 0 ? ignoreReadOnlyFormFields : true) : Object.assign({}, this._config);
|
|
131
134
|
}
|
|
132
135
|
getFormConfigFetcher() {
|
|
133
136
|
if (this._formConfigFetcher == undefined) {
|
|
@@ -101,6 +101,16 @@ export class SnkGrid {
|
|
|
101
101
|
async findColumn() {
|
|
102
102
|
await openFieldSearch(this._moreOptions, this._columnSearch);
|
|
103
103
|
}
|
|
104
|
+
async handleGridLegacyConfigName(newLegacyConfig, oldLegacyConfig) {
|
|
105
|
+
if (!newLegacyConfig) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (newLegacyConfig === oldLegacyConfig) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
this.addGridLegacyConfigName();
|
|
112
|
+
this.loadConfig();
|
|
113
|
+
}
|
|
104
114
|
openGridConfig() {
|
|
105
115
|
this._grid.getColumnsState()
|
|
106
116
|
.then((gridColumns) => {
|
|
@@ -394,12 +404,15 @@ export class SnkGrid {
|
|
|
394
404
|
}
|
|
395
405
|
this._showSnkFilterBar = true;
|
|
396
406
|
}
|
|
407
|
+
getConfig() {
|
|
408
|
+
return this._gridConfig == undefined ? undefined : Object.assign({}, this._gridConfig);
|
|
409
|
+
}
|
|
397
410
|
render() {
|
|
398
411
|
if (!this._dataUnit) {
|
|
399
412
|
return undefined;
|
|
400
413
|
}
|
|
401
414
|
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 &&
|
|
402
|
-
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this.
|
|
415
|
+
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this.getConfig(), onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
|
403
416
|
}
|
|
404
417
|
static get is() { return "snk-grid"; }
|
|
405
418
|
static get encapsulation() { return "scoped"; }
|
|
@@ -966,4 +979,10 @@ export class SnkGrid {
|
|
|
966
979
|
};
|
|
967
980
|
}
|
|
968
981
|
static get elementRef() { return "_element"; }
|
|
982
|
+
static get watchers() {
|
|
983
|
+
return [{
|
|
984
|
+
"propName": "gridLegacyConfigName",
|
|
985
|
+
"methodName": "handleGridLegacyConfigName"
|
|
986
|
+
}];
|
|
987
|
+
}
|
|
969
988
|
}
|
|
@@ -113,16 +113,18 @@ export class SnkSimpleCrud {
|
|
|
113
113
|
}
|
|
114
114
|
async handleUpdateFormLegacyConfig() {
|
|
115
115
|
var _a, _b, _c;
|
|
116
|
-
if (this.formLegacyConfigName) {
|
|
117
|
-
|
|
118
|
-
if (!legacyConfig)
|
|
119
|
-
return;
|
|
120
|
-
const rawFields = (_c = (_b = (_a = legacyConfig === null || legacyConfig === void 0 ? void 0 : legacyConfig.formConfig) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : [];
|
|
121
|
-
const fields = Array.isArray(rawFields) ? rawFields : [rawFields];
|
|
122
|
-
const newConfig = { emptyConfig: false, fields: fields };
|
|
123
|
-
this.setFormConfig(newConfig, true);
|
|
124
|
-
this._formConfigManager.setConfig(this.formConfig);
|
|
116
|
+
if (!this.formLegacyConfigName) {
|
|
117
|
+
return;
|
|
125
118
|
}
|
|
119
|
+
const legacyConfig = await this.fetchFormLegacyConfig();
|
|
120
|
+
if (!legacyConfig)
|
|
121
|
+
return;
|
|
122
|
+
const rawFields = (_c = (_b = (_a = legacyConfig === null || legacyConfig === void 0 ? void 0 : legacyConfig.formConfig) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : [];
|
|
123
|
+
const fields = Array.isArray(rawFields) ? rawFields : [rawFields];
|
|
124
|
+
const newConfig = { emptyConfig: false, fields: fields };
|
|
125
|
+
this.setFormConfig(newConfig, true);
|
|
126
|
+
const formConfigManager = this.getFormConfigManger();
|
|
127
|
+
formConfigManager.setConfig(this.formConfig);
|
|
126
128
|
}
|
|
127
129
|
async fetchFormLegacyConfig() {
|
|
128
130
|
const payload = {
|
|
@@ -179,16 +181,20 @@ export class SnkSimpleCrud {
|
|
|
179
181
|
});
|
|
180
182
|
});
|
|
181
183
|
}
|
|
182
|
-
|
|
184
|
+
getFormConfigManger() {
|
|
183
185
|
if (this._formConfigManager == undefined) {
|
|
184
186
|
this._formConfigManager = new SnkFormConfigManager(this.configName, this._resourceID);
|
|
185
|
-
this._formConfigManager.setConfig(this.formConfig);
|
|
186
187
|
}
|
|
188
|
+
return this._formConfigManager;
|
|
189
|
+
}
|
|
190
|
+
async loadFormConfig() {
|
|
191
|
+
const formConfigManager = this.getFormConfigManger();
|
|
192
|
+
formConfigManager.setConfig(this.formConfig);
|
|
187
193
|
if (this.formConfig != undefined || this._formConfigAlreadyLoaded) {
|
|
188
194
|
return;
|
|
189
195
|
}
|
|
190
196
|
this._formConfigAlreadyLoaded = true;
|
|
191
|
-
this.setFormConfig(await
|
|
197
|
+
this.setFormConfig(await formConfigManager.loadConfig());
|
|
192
198
|
}
|
|
193
199
|
async componentWillRender() {
|
|
194
200
|
this._resourceID = await this.application.getResourceID();
|
|
@@ -482,7 +488,7 @@ export class SnkSimpleCrud {
|
|
|
482
488
|
}
|
|
483
489
|
return (h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, 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)
|
|
484
490
|
? undefined
|
|
485
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: (_b = this._formConfigManager) === null || _b === void 0 ? void 0 : _b.getConfig(
|
|
491
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: (_b = this._formConfigManager) === null || _b === void 0 ? void 0 : _b.getConfig((_c = this.dataState) === null || _c === void 0 ? void 0 : _c.insertionMode, this.dataUnit, this.ignoreReadOnlyFormFields), 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._resourceID, 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._resourceID }))));
|
|
486
492
|
}
|
|
487
493
|
static get is() { return "snk-simple-crud"; }
|
|
488
494
|
static get encapsulation() { return "scoped"; }
|
|
@@ -98,16 +98,19 @@ class SnkFormConfigManager {
|
|
|
98
98
|
const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
|
|
99
99
|
return normalizedText.includes(normalizedFilter);
|
|
100
100
|
}
|
|
101
|
-
getInsertionConfig(dataUnit) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (
|
|
106
|
-
|
|
101
|
+
getInsertionConfig(dataUnit, ignoreReadOnlyFormFields) {
|
|
102
|
+
let fields = this.getFieldsList(dataUnit);
|
|
103
|
+
if (ignoreReadOnlyFormFields) {
|
|
104
|
+
fields = fields.filter(field => {
|
|
105
|
+
if (dataUnit) {
|
|
106
|
+
const def = dataUnit.getField(field.name);
|
|
107
|
+
if (def && def.readOnly) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
107
110
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
+
return !field.readOnly;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
111
114
|
return Object.assign(Object.assign({}, this._config), { fields });
|
|
112
115
|
}
|
|
113
116
|
setConfig(config) {
|
|
@@ -127,8 +130,8 @@ class SnkFormConfigManager {
|
|
|
127
130
|
this._onConfigChange(Object.assign({}, this._config));
|
|
128
131
|
}
|
|
129
132
|
}
|
|
130
|
-
getConfig(insertionMode, dataUnit) {
|
|
131
|
-
return insertionMode ? this.getInsertionConfig(dataUnit) : Object.assign({}, this._config);
|
|
133
|
+
getConfig(insertionMode, dataUnit, ignoreReadOnlyFormFields) {
|
|
134
|
+
return insertionMode ? this.getInsertionConfig(dataUnit, ignoreReadOnlyFormFields !== null && ignoreReadOnlyFormFields !== void 0 ? ignoreReadOnlyFormFields : true) : Object.assign({}, this._config);
|
|
132
135
|
}
|
|
133
136
|
getFormConfigFetcher() {
|
|
134
137
|
if (this._formConfigFetcher == undefined) {
|
|
@@ -127,6 +127,16 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
127
127
|
async findColumn() {
|
|
128
128
|
await openFieldSearch(this._moreOptions, this._columnSearch);
|
|
129
129
|
}
|
|
130
|
+
async handleGridLegacyConfigName(newLegacyConfig, oldLegacyConfig) {
|
|
131
|
+
if (!newLegacyConfig) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
if (newLegacyConfig === oldLegacyConfig) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
this.addGridLegacyConfigName();
|
|
138
|
+
this.loadConfig();
|
|
139
|
+
}
|
|
130
140
|
openGridConfig() {
|
|
131
141
|
this._grid.getColumnsState()
|
|
132
142
|
.then((gridColumns) => {
|
|
@@ -420,14 +430,20 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
420
430
|
}
|
|
421
431
|
this._showSnkFilterBar = true;
|
|
422
432
|
}
|
|
433
|
+
getConfig() {
|
|
434
|
+
return this._gridConfig == undefined ? undefined : Object.assign({}, this._gridConfig);
|
|
435
|
+
}
|
|
423
436
|
render() {
|
|
424
437
|
if (!this._dataUnit) {
|
|
425
438
|
return undefined;
|
|
426
439
|
}
|
|
427
440
|
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 &&
|
|
428
|
-
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this.
|
|
441
|
+
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this.getConfig(), onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
|
429
442
|
}
|
|
430
443
|
get _element() { return this; }
|
|
444
|
+
static get watchers() { return {
|
|
445
|
+
"gridLegacyConfigName": ["handleGridLegacyConfigName"]
|
|
446
|
+
}; }
|
|
431
447
|
static get style() { return snkGridCss; }
|
|
432
448
|
}, [6, "snk-grid", {
|
|
433
449
|
"columnFilterDataSource": [1040],
|
|
@@ -141,16 +141,18 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
141
141
|
}
|
|
142
142
|
async handleUpdateFormLegacyConfig() {
|
|
143
143
|
var _a, _b, _c;
|
|
144
|
-
if (this.formLegacyConfigName) {
|
|
145
|
-
|
|
146
|
-
if (!legacyConfig)
|
|
147
|
-
return;
|
|
148
|
-
const rawFields = (_c = (_b = (_a = legacyConfig === null || legacyConfig === void 0 ? void 0 : legacyConfig.formConfig) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : [];
|
|
149
|
-
const fields = Array.isArray(rawFields) ? rawFields : [rawFields];
|
|
150
|
-
const newConfig = { emptyConfig: false, fields: fields };
|
|
151
|
-
this.setFormConfig(newConfig, true);
|
|
152
|
-
this._formConfigManager.setConfig(this.formConfig);
|
|
144
|
+
if (!this.formLegacyConfigName) {
|
|
145
|
+
return;
|
|
153
146
|
}
|
|
147
|
+
const legacyConfig = await this.fetchFormLegacyConfig();
|
|
148
|
+
if (!legacyConfig)
|
|
149
|
+
return;
|
|
150
|
+
const rawFields = (_c = (_b = (_a = legacyConfig === null || legacyConfig === void 0 ? void 0 : legacyConfig.formConfig) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : [];
|
|
151
|
+
const fields = Array.isArray(rawFields) ? rawFields : [rawFields];
|
|
152
|
+
const newConfig = { emptyConfig: false, fields: fields };
|
|
153
|
+
this.setFormConfig(newConfig, true);
|
|
154
|
+
const formConfigManager = this.getFormConfigManger();
|
|
155
|
+
formConfigManager.setConfig(this.formConfig);
|
|
154
156
|
}
|
|
155
157
|
async fetchFormLegacyConfig() {
|
|
156
158
|
const payload = {
|
|
@@ -207,16 +209,20 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
207
209
|
});
|
|
208
210
|
});
|
|
209
211
|
}
|
|
210
|
-
|
|
212
|
+
getFormConfigManger() {
|
|
211
213
|
if (this._formConfigManager == undefined) {
|
|
212
214
|
this._formConfigManager = new SnkFormConfigManager(this.configName, this._resourceID);
|
|
213
|
-
this._formConfigManager.setConfig(this.formConfig);
|
|
214
215
|
}
|
|
216
|
+
return this._formConfigManager;
|
|
217
|
+
}
|
|
218
|
+
async loadFormConfig() {
|
|
219
|
+
const formConfigManager = this.getFormConfigManger();
|
|
220
|
+
formConfigManager.setConfig(this.formConfig);
|
|
215
221
|
if (this.formConfig != undefined || this._formConfigAlreadyLoaded) {
|
|
216
222
|
return;
|
|
217
223
|
}
|
|
218
224
|
this._formConfigAlreadyLoaded = true;
|
|
219
|
-
this.setFormConfig(await
|
|
225
|
+
this.setFormConfig(await formConfigManager.loadConfig());
|
|
220
226
|
}
|
|
221
227
|
async componentWillRender() {
|
|
222
228
|
this._resourceID = await this.application.getResourceID();
|
|
@@ -510,7 +516,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
510
516
|
}
|
|
511
517
|
return (h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, 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)
|
|
512
518
|
? undefined
|
|
513
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: (_b = this._formConfigManager) === null || _b === void 0 ? void 0 : _b.getConfig(
|
|
519
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: (_b = this._formConfigManager) === null || _b === void 0 ? void 0 : _b.getConfig((_c = this.dataState) === null || _c === void 0 ? void 0 : _c.insertionMode, this.dataUnit, this.ignoreReadOnlyFormFields), 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._resourceID, 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._resourceID }))));
|
|
514
520
|
}
|
|
515
521
|
get _element() { return this; }
|
|
516
522
|
static get watchers() { return {
|
|
@@ -98,16 +98,19 @@ class SnkFormConfigManager {
|
|
|
98
98
|
const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
|
|
99
99
|
return normalizedText.includes(normalizedFilter);
|
|
100
100
|
}
|
|
101
|
-
getInsertionConfig(dataUnit) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (
|
|
106
|
-
|
|
101
|
+
getInsertionConfig(dataUnit, ignoreReadOnlyFormFields) {
|
|
102
|
+
let fields = this.getFieldsList(dataUnit);
|
|
103
|
+
if (ignoreReadOnlyFormFields) {
|
|
104
|
+
fields = fields.filter(field => {
|
|
105
|
+
if (dataUnit) {
|
|
106
|
+
const def = dataUnit.getField(field.name);
|
|
107
|
+
if (def && def.readOnly) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
107
110
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
+
return !field.readOnly;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
111
114
|
return Object.assign(Object.assign({}, this._config), { fields });
|
|
112
115
|
}
|
|
113
116
|
setConfig(config) {
|
|
@@ -127,8 +130,8 @@ class SnkFormConfigManager {
|
|
|
127
130
|
this._onConfigChange(Object.assign({}, this._config));
|
|
128
131
|
}
|
|
129
132
|
}
|
|
130
|
-
getConfig(insertionMode, dataUnit) {
|
|
131
|
-
return insertionMode ? this.getInsertionConfig(dataUnit) : Object.assign({}, this._config);
|
|
133
|
+
getConfig(insertionMode, dataUnit, ignoreReadOnlyFormFields) {
|
|
134
|
+
return insertionMode ? this.getInsertionConfig(dataUnit, ignoreReadOnlyFormFields !== null && ignoreReadOnlyFormFields !== void 0 ? ignoreReadOnlyFormFields : true) : Object.assign({}, this._config);
|
|
132
135
|
}
|
|
133
136
|
getFormConfigFetcher() {
|
|
134
137
|
if (this._formConfigFetcher == undefined) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, f as forceUpdate, h, H as Host } from './index-a7d3d3f1.js';
|
|
2
2
|
import { Action } from '@sankhyalabs/core';
|
|
3
|
-
import { S as SnkFormConfigManager } from './SnkFormConfigManager-
|
|
3
|
+
import { S as SnkFormConfigManager } from './SnkFormConfigManager-02ecf57f.js';
|
|
4
4
|
import { FormMetadata, buildFormMetadata } from '@sankhyalabs/ezui/dist/collection/utils/form';
|
|
5
5
|
import './DataFetcher-a650ae58.js';
|
|
6
6
|
import './pesquisa-fetcher-f05a12ca.js';
|
|
@@ -12,7 +12,7 @@ import './filter-item-type.enum-d45e026f.js';
|
|
|
12
12
|
import './form-config-fetcher-f121f880.js';
|
|
13
13
|
import { T as TaskbarElement } from './taskbar-elements-2473c8ac.js';
|
|
14
14
|
import { d as VIEW_MODE } from './constants-8457af36.js';
|
|
15
|
-
import { S as SnkGuidesViewer } from './snk-guides-viewer-
|
|
15
|
+
import { S as SnkGuidesViewer } from './snk-guides-viewer-90ca9105.js';
|
|
16
16
|
import { S as SnkMessageBuilder } from './SnkMessageBuilder-9747ddd2.js';
|
|
17
17
|
import './ConfigStorage-101a2b4c.js';
|
|
18
18
|
import './PrintUtils-3e4ff0f5.js';
|