@sankhyalabs/sankhyablocks 8.15.0-rc.11 → 8.15.0-rc.13
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-34be11ce.js → ConfigStorage-8d4e9d53.js} +1 -1
- package/dist/cjs/{SnkFormConfigManager-531a191c.js → SnkFormConfigManager-33995e92.js} +2 -2
- package/dist/cjs/{SnkMultiSelectionListDataSource-5213120b.js → SnkMultiSelectionListDataSource-1438f8f2.js} +1 -1
- package/dist/cjs/{auth-fetcher-5161d082.js → auth-fetcher-bb8e9ae4.js} +1 -1
- package/dist/cjs/{form-config-fetcher-9f1a13ca.js → form-config-fetcher-d73f4449.js} +12 -0
- 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 +2 -2
- package/dist/cjs/snk-crud.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +4 -4
- package/dist/cjs/snk-filter-bar.cjs.entry.js +2 -2
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +2 -2
- package/dist/cjs/snk-form-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-form.cjs.entry.js +3 -3
- package/dist/cjs/snk-grid.cjs.entry.js +4 -7
- package/dist/cjs/{snk-guides-viewer-76b4c346.js → snk-guides-viewer-25721856.js} +2 -2
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +4 -4
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +2 -2
- package/dist/cjs/snk-simple-crud.cjs.entry.js +54 -42
- package/dist/collection/components/snk-grid/snk-grid.js +1 -4
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +70 -39
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +12 -0
- package/dist/components/form-config-fetcher.js +12 -0
- package/dist/components/snk-grid2.js +1 -4
- package/dist/components/snk-simple-crud2.js +52 -39
- package/dist/esm/{ConfigStorage-101a2b4c.js → ConfigStorage-6e241cd7.js} +1 -1
- package/dist/esm/{SnkFormConfigManager-02ecf57f.js → SnkFormConfigManager-7a4e678f.js} +2 -2
- package/dist/esm/{SnkMultiSelectionListDataSource-7e7eada5.js → SnkMultiSelectionListDataSource-aad5d4ff.js} +1 -1
- package/dist/esm/{auth-fetcher-17dc5b5e.js → auth-fetcher-8ec448b0.js} +1 -1
- package/dist/esm/{form-config-fetcher-f121f880.js → form-config-fetcher-765b8498.js} +12 -0
- 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 +2 -2
- package/dist/esm/snk-crud.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +4 -4
- package/dist/esm/snk-filter-bar.entry.js +2 -2
- package/dist/esm/snk-filter-modal-item.entry.js +2 -2
- package/dist/esm/snk-form-config.entry.js +1 -1
- package/dist/esm/snk-form.entry.js +3 -3
- package/dist/esm/snk-grid.entry.js +4 -7
- package/dist/esm/{snk-guides-viewer-90ca9105.js → snk-guides-viewer-b94752f2.js} +2 -2
- package/dist/esm/snk-guides-viewer.entry.js +4 -4
- package/dist/esm/snk-personalized-filter.entry.js +2 -2
- package/dist/esm/snk-simple-crud.entry.js +54 -42
- package/dist/sankhyablocks/p-004c356e.js +26 -0
- package/dist/sankhyablocks/{p-5c0b53ce.js → p-0624f62d.js} +1 -1
- package/dist/sankhyablocks/{p-d01ceda6.entry.js → p-0bba5c9f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-663ff67b.entry.js → p-1048bd26.entry.js} +1 -1
- package/dist/sankhyablocks/p-125bb902.js +1 -0
- package/dist/sankhyablocks/{p-7ddd95b6.entry.js → p-24ed6ad6.entry.js} +1 -1
- package/dist/sankhyablocks/{p-1f3174cb.entry.js → p-2d919e32.entry.js} +1 -1
- package/dist/sankhyablocks/{p-1fa5a18c.entry.js → p-400097f2.entry.js} +1 -1
- package/dist/sankhyablocks/{p-2897fb8c.js → p-6c9adfca.js} +1 -1
- package/dist/sankhyablocks/{p-b41a622a.entry.js → p-85ba3d6b.entry.js} +1 -1
- package/dist/sankhyablocks/{p-384fd6ae.js → p-88b29791.js} +1 -1
- package/dist/sankhyablocks/{p-ba4871b5.entry.js → p-9e8618ec.entry.js} +1 -1
- package/dist/sankhyablocks/{p-7f97fee2.entry.js → p-a1642e7c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-6b28cc74.entry.js → p-ac77949b.entry.js} +1 -1
- package/dist/sankhyablocks/{p-2cfe0c2c.entry.js → p-b47c2963.entry.js} +1 -1
- package/dist/sankhyablocks/{p-7e05bd83.entry.js → p-bf39bdb8.entry.js} +1 -1
- package/dist/sankhyablocks/{p-8111f63f.entry.js → p-d5cb4b5a.entry.js} +1 -1
- package/dist/sankhyablocks/p-e8364f8c.entry.js +1 -0
- package/dist/sankhyablocks/{p-fad4c2fe.js → p-efeca7ba.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-grid/snk-grid.d.ts +0 -1
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +11 -3
- package/dist/types/components.d.ts +8 -0
- package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +2 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-50783a8b.js +0 -1
- package/dist/sankhyablocks/p-a13ccb86.js +0 -26
- package/dist/sankhyablocks/p-a83487a0.entry.js +0 -1
@@ -8,16 +8,16 @@ const constants = require('./constants-35ddd366.js');
|
|
8
8
|
const taskbarElements = require('./taskbar-elements-3ecd1278.js');
|
9
9
|
require('./DataFetcher-99f0f6ed.js');
|
10
10
|
const pesquisaFetcher = require('./pesquisa-fetcher-94f6b316.js');
|
11
|
-
const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-
|
11
|
+
const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-1438f8f2.js');
|
12
12
|
const index$1 = require('./index-0922807b.js');
|
13
13
|
require('./ISave-e91b70a7.js');
|
14
14
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
15
15
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
16
16
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
17
|
-
require('./form-config-fetcher-
|
17
|
+
const formConfigFetcher = require('./form-config-fetcher-d73f4449.js');
|
18
18
|
const fieldSearch = require('./field-search-f56aa7d6.js');
|
19
|
-
const ConfigStorage = require('./ConfigStorage-
|
20
|
-
const SnkFormConfigManager = require('./SnkFormConfigManager-
|
19
|
+
const ConfigStorage = require('./ConfigStorage-8d4e9d53.js');
|
20
|
+
const SnkFormConfigManager = require('./SnkFormConfigManager-33995e92.js');
|
21
21
|
require('./index-102ba62d.js');
|
22
22
|
require('./PrintUtils-bcaeb82f.js');
|
23
23
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
@@ -40,6 +40,7 @@ const SnkSimpleCrud = class {
|
|
40
40
|
this.configuratorCancel = index.createEvent(this, "configuratorCancel", 7);
|
41
41
|
this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource.SnkMultiSelectionListDataSource();
|
42
42
|
this._keyDownHandler = (event) => this.keyDownListener(event);
|
43
|
+
this._formConfigFetcher = new formConfigFetcher.FormConfigFetcher();
|
43
44
|
this._taskbarProcessor = new fieldSearch.TaskbarProcessor({
|
44
45
|
"snkSimpleCrudTaskbar.form_regular": this.getButtons(false, taskbarElements.TaskbarElement.GRID_MODE),
|
45
46
|
"snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, taskbarElements.TaskbarElement.FORM_MODE),
|
@@ -61,6 +62,7 @@ const SnkSimpleCrud = class {
|
|
61
62
|
this._formFields = [];
|
62
63
|
this.multipleSelection = undefined;
|
63
64
|
this.useCancelConfirm = true;
|
65
|
+
this.resourceID = undefined;
|
64
66
|
this.taskbarManager = undefined;
|
65
67
|
this.messagesBuilder = undefined;
|
66
68
|
this.useEnterLikeTab = false;
|
@@ -71,6 +73,16 @@ const SnkSimpleCrud = class {
|
|
71
73
|
this.formLegacyConfigName = undefined;
|
72
74
|
this.ignoreReadOnlyFormFields = false;
|
73
75
|
}
|
76
|
+
handleResourceIDChanged(newValue, oldValue) {
|
77
|
+
if (core.StringUtils.isEmpty(newValue)) {
|
78
|
+
return;
|
79
|
+
}
|
80
|
+
if (newValue === oldValue) {
|
81
|
+
return;
|
82
|
+
}
|
83
|
+
this.loadFormConfig(true);
|
84
|
+
this.loadGridConfig(true);
|
85
|
+
}
|
74
86
|
getButtons(selected, changeModeBtn) {
|
75
87
|
return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
|
76
88
|
.concat(changeModeBtn));
|
@@ -123,43 +135,23 @@ const SnkSimpleCrud = class {
|
|
123
135
|
this.dataStateChange.emit(newValue);
|
124
136
|
}
|
125
137
|
}
|
126
|
-
async observeFormLegacy() {
|
127
|
-
await this.handleUpdateFormLegacyConfig();
|
138
|
+
async observeFormLegacy(newValue, oldValue) {
|
139
|
+
await this.handleUpdateFormLegacyConfig(newValue, oldValue);
|
128
140
|
}
|
129
|
-
async observeGridLegacy() {
|
130
|
-
await this.handleUpdateGridLegacyConfig();
|
141
|
+
async observeGridLegacy(newValue, oldValue) {
|
142
|
+
await this.handleUpdateGridLegacyConfig(newValue, oldValue);
|
131
143
|
}
|
132
|
-
async handleUpdateGridLegacyConfig() {
|
133
|
-
if (
|
134
|
-
|
135
|
-
if (this._gridConfigAlreadyLoaded) {
|
136
|
-
await this.loadGridConfig(true);
|
137
|
-
}
|
144
|
+
async handleUpdateGridLegacyConfig(newValue, oldValue) {
|
145
|
+
if (newValue == undefined || newValue == oldValue) {
|
146
|
+
return;
|
138
147
|
}
|
148
|
+
await this.loadGridConfig(true);
|
139
149
|
}
|
140
|
-
async handleUpdateFormLegacyConfig() {
|
141
|
-
|
142
|
-
|
143
|
-
const legacyConfig = await this.fetchFormLegacyConfig();
|
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);
|
150
|
+
async handleUpdateFormLegacyConfig(newValue, oldValue) {
|
151
|
+
if (newValue == undefined || newValue == oldValue) {
|
152
|
+
return;
|
151
153
|
}
|
152
|
-
|
153
|
-
async fetchFormLegacyConfig() {
|
154
|
-
const payload = {
|
155
|
-
'requestBody': {
|
156
|
-
'config': {
|
157
|
-
'chave': this.formLegacyConfigName,
|
158
|
-
'tipo': 'T',
|
159
|
-
},
|
160
|
-
},
|
161
|
-
};
|
162
|
-
return await this.application.callServiceBroker('SystemUtilsSP.getConf', JSON.stringify(payload));
|
154
|
+
this.loadFormConfig(true);
|
163
155
|
}
|
164
156
|
openConfig(viewMode) {
|
165
157
|
this._snkConfigurator.close();
|
@@ -190,12 +182,16 @@ const SnkSimpleCrud = class {
|
|
190
182
|
}
|
191
183
|
}
|
192
184
|
loadGridConfig(forceUpdate) {
|
185
|
+
if (this.configName === undefined) {
|
186
|
+
return;
|
187
|
+
}
|
193
188
|
if ((this.gridConfig != undefined || this._gridConfigAlreadyLoaded) && !forceUpdate) {
|
194
189
|
return;
|
195
190
|
}
|
191
|
+
this.addGridLegacyConfigName();
|
196
192
|
this._gridConfigAlreadyLoaded = true;
|
197
193
|
return new Promise((accept, reject) => {
|
198
|
-
ConfigStorage.ConfigStorage.loadGridConfig(this.configName, this.
|
194
|
+
ConfigStorage.ConfigStorage.loadGridConfig(this.configName, this.resolveResourceID())
|
199
195
|
.then(config => {
|
200
196
|
this.setGridConfig(config);
|
201
197
|
accept();
|
@@ -205,15 +201,27 @@ const SnkSimpleCrud = class {
|
|
205
201
|
});
|
206
202
|
});
|
207
203
|
}
|
208
|
-
|
204
|
+
formConfigIsLoaded() {
|
205
|
+
return this.formConfig != undefined || this._formConfigAlreadyLoaded;
|
206
|
+
}
|
207
|
+
async loadFormConfig(forceLoad = false) {
|
208
|
+
if (this.configName === undefined) {
|
209
|
+
return;
|
210
|
+
}
|
209
211
|
if (this._formConfigManager == undefined) {
|
210
|
-
this._formConfigManager = new SnkFormConfigManager.SnkFormConfigManager(this.configName, this.
|
212
|
+
this._formConfigManager = new SnkFormConfigManager.SnkFormConfigManager(this.configName, this.resolveResourceID());
|
211
213
|
this._formConfigManager.setConfig(this.formConfig);
|
212
214
|
}
|
213
|
-
if (this.
|
215
|
+
if (this.formConfigIsLoaded() && !forceLoad) {
|
214
216
|
return;
|
215
217
|
}
|
216
218
|
this._formConfigAlreadyLoaded = true;
|
219
|
+
let loadedLegacyConfig = await this._formConfigFetcher.fetchLegacyConfigurableForm(this.formLegacyConfigName);
|
220
|
+
if (loadedLegacyConfig != undefined) {
|
221
|
+
this._formConfigManager.setConfig(loadedLegacyConfig);
|
222
|
+
this.setFormConfig(loadedLegacyConfig);
|
223
|
+
return;
|
224
|
+
}
|
217
225
|
this.setFormConfig(await this._formConfigManager.loadConfig());
|
218
226
|
}
|
219
227
|
async componentWillRender() {
|
@@ -469,7 +477,7 @@ const SnkSimpleCrud = class {
|
|
469
477
|
}
|
470
478
|
gridConfigChangeHandler(evt) {
|
471
479
|
const config = evt.detail;
|
472
|
-
ConfigStorage.ConfigStorage.saveGridConfig(config, this.configName, this.
|
480
|
+
ConfigStorage.ConfigStorage.saveGridConfig(config, this.configName, this.resolveResourceID());
|
473
481
|
evt.stopPropagation();
|
474
482
|
}
|
475
483
|
modalConfigChangeHandler(evt) {
|
@@ -500,6 +508,9 @@ const SnkSimpleCrud = class {
|
|
500
508
|
handleShowFormConfig() {
|
501
509
|
return this._showFormConfig && !this.formLegacyConfigName;
|
502
510
|
}
|
511
|
+
resolveResourceID() {
|
512
|
+
return core.StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
|
513
|
+
}
|
503
514
|
/* istanbul ignore next */
|
504
515
|
render() {
|
505
516
|
var _a, _b, _c;
|
@@ -508,10 +519,11 @@ const SnkSimpleCrud = class {
|
|
508
519
|
}
|
509
520
|
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
521
|
? 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((_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.
|
522
|
+
: 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.resolveResourceID(), 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.resolveResourceID() }))));
|
512
523
|
}
|
513
524
|
get _element() { return index.getElement(this); }
|
514
525
|
static get watchers() { return {
|
526
|
+
"resourceID": ["handleResourceIDChanged"],
|
515
527
|
"mode": ["onModeChange"],
|
516
528
|
"dataState": ["observeDataState"],
|
517
529
|
"formLegacyConfigName": ["observeFormLegacy"],
|
@@ -404,15 +404,12 @@ export class SnkGrid {
|
|
404
404
|
}
|
405
405
|
this._showSnkFilterBar = true;
|
406
406
|
}
|
407
|
-
getConfig() {
|
408
|
-
return this._gridConfig == undefined ? undefined : Object.assign({}, this._gridConfig);
|
409
|
-
}
|
410
407
|
render() {
|
411
408
|
if (!this._dataUnit) {
|
412
409
|
return undefined;
|
413
410
|
}
|
414
411
|
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 &&
|
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.
|
412
|
+
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
416
413
|
}
|
417
414
|
static get is() { return "snk-grid"; }
|
418
415
|
static get encapsulation() { return "scoped"; }
|
@@ -2,7 +2,7 @@ import { ApplicationContext, DataType, ElementIDUtils, FloatingManager, JSUtils,
|
|
2
2
|
import { h } from '@stencil/core';
|
3
3
|
import { SIMPLE_CRUD_MODE, VIEW_MODE } from '../../lib/utils/constants';
|
4
4
|
import { TaskbarElement } from '../snk-taskbar/elements/taskbar-elements';
|
5
|
-
import { CrudUtils, PresentationMode } from '../../lib';
|
5
|
+
import { CrudUtils, FormConfigFetcher, PresentationMode } from '../../lib';
|
6
6
|
import TaskbarProcessor from '../snk-taskbar/processor/taskbar-processor';
|
7
7
|
import InMemoryLoader from '../../lib/dataUnit/InMemoryLoader';
|
8
8
|
import SnkMultiSelectionListDataSource from '../snk-grid/filtercolumn/SnkMultiSelectionListDataSource';
|
@@ -14,6 +14,7 @@ export class SnkSimpleCrud {
|
|
14
14
|
constructor() {
|
15
15
|
this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
|
16
16
|
this._keyDownHandler = (event) => this.keyDownListener(event);
|
17
|
+
this._formConfigFetcher = new FormConfigFetcher();
|
17
18
|
this._taskbarProcessor = new TaskbarProcessor({
|
18
19
|
"snkSimpleCrudTaskbar.form_regular": this.getButtons(false, TaskbarElement.GRID_MODE),
|
19
20
|
"snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, TaskbarElement.FORM_MODE),
|
@@ -35,6 +36,7 @@ export class SnkSimpleCrud {
|
|
35
36
|
this._formFields = [];
|
36
37
|
this.multipleSelection = undefined;
|
37
38
|
this.useCancelConfirm = true;
|
39
|
+
this.resourceID = undefined;
|
38
40
|
this.taskbarManager = undefined;
|
39
41
|
this.messagesBuilder = undefined;
|
40
42
|
this.useEnterLikeTab = false;
|
@@ -45,6 +47,16 @@ export class SnkSimpleCrud {
|
|
45
47
|
this.formLegacyConfigName = undefined;
|
46
48
|
this.ignoreReadOnlyFormFields = false;
|
47
49
|
}
|
50
|
+
handleResourceIDChanged(newValue, oldValue) {
|
51
|
+
if (StringUtils.isEmpty(newValue)) {
|
52
|
+
return;
|
53
|
+
}
|
54
|
+
if (newValue === oldValue) {
|
55
|
+
return;
|
56
|
+
}
|
57
|
+
this.loadFormConfig(true);
|
58
|
+
this.loadGridConfig(true);
|
59
|
+
}
|
48
60
|
getButtons(selected, changeModeBtn) {
|
49
61
|
return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
|
50
62
|
.concat(changeModeBtn));
|
@@ -97,43 +109,23 @@ export class SnkSimpleCrud {
|
|
97
109
|
this.dataStateChange.emit(newValue);
|
98
110
|
}
|
99
111
|
}
|
100
|
-
async observeFormLegacy() {
|
101
|
-
await this.handleUpdateFormLegacyConfig();
|
112
|
+
async observeFormLegacy(newValue, oldValue) {
|
113
|
+
await this.handleUpdateFormLegacyConfig(newValue, oldValue);
|
102
114
|
}
|
103
|
-
async observeGridLegacy() {
|
104
|
-
await this.handleUpdateGridLegacyConfig();
|
115
|
+
async observeGridLegacy(newValue, oldValue) {
|
116
|
+
await this.handleUpdateGridLegacyConfig(newValue, oldValue);
|
105
117
|
}
|
106
|
-
async handleUpdateGridLegacyConfig() {
|
107
|
-
if (
|
108
|
-
|
109
|
-
if (this._gridConfigAlreadyLoaded) {
|
110
|
-
await this.loadGridConfig(true);
|
111
|
-
}
|
118
|
+
async handleUpdateGridLegacyConfig(newValue, oldValue) {
|
119
|
+
if (newValue == undefined || newValue == oldValue) {
|
120
|
+
return;
|
112
121
|
}
|
122
|
+
await this.loadGridConfig(true);
|
113
123
|
}
|
114
|
-
async handleUpdateFormLegacyConfig() {
|
115
|
-
|
116
|
-
|
117
|
-
const legacyConfig = await this.fetchFormLegacyConfig();
|
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);
|
124
|
+
async handleUpdateFormLegacyConfig(newValue, oldValue) {
|
125
|
+
if (newValue == undefined || newValue == oldValue) {
|
126
|
+
return;
|
125
127
|
}
|
126
|
-
|
127
|
-
async fetchFormLegacyConfig() {
|
128
|
-
const payload = {
|
129
|
-
'requestBody': {
|
130
|
-
'config': {
|
131
|
-
'chave': this.formLegacyConfigName,
|
132
|
-
'tipo': 'T',
|
133
|
-
},
|
134
|
-
},
|
135
|
-
};
|
136
|
-
return await this.application.callServiceBroker('SystemUtilsSP.getConf', JSON.stringify(payload));
|
128
|
+
this.loadFormConfig(true);
|
137
129
|
}
|
138
130
|
openConfig(viewMode) {
|
139
131
|
this._snkConfigurator.close();
|
@@ -164,12 +156,16 @@ export class SnkSimpleCrud {
|
|
164
156
|
}
|
165
157
|
}
|
166
158
|
loadGridConfig(forceUpdate) {
|
159
|
+
if (this.configName === undefined) {
|
160
|
+
return;
|
161
|
+
}
|
167
162
|
if ((this.gridConfig != undefined || this._gridConfigAlreadyLoaded) && !forceUpdate) {
|
168
163
|
return;
|
169
164
|
}
|
165
|
+
this.addGridLegacyConfigName();
|
170
166
|
this._gridConfigAlreadyLoaded = true;
|
171
167
|
return new Promise((accept, reject) => {
|
172
|
-
ConfigStorage.loadGridConfig(this.configName, this.
|
168
|
+
ConfigStorage.loadGridConfig(this.configName, this.resolveResourceID())
|
173
169
|
.then(config => {
|
174
170
|
this.setGridConfig(config);
|
175
171
|
accept();
|
@@ -179,15 +175,27 @@ export class SnkSimpleCrud {
|
|
179
175
|
});
|
180
176
|
});
|
181
177
|
}
|
182
|
-
|
178
|
+
formConfigIsLoaded() {
|
179
|
+
return this.formConfig != undefined || this._formConfigAlreadyLoaded;
|
180
|
+
}
|
181
|
+
async loadFormConfig(forceLoad = false) {
|
182
|
+
if (this.configName === undefined) {
|
183
|
+
return;
|
184
|
+
}
|
183
185
|
if (this._formConfigManager == undefined) {
|
184
|
-
this._formConfigManager = new SnkFormConfigManager(this.configName, this.
|
186
|
+
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
185
187
|
this._formConfigManager.setConfig(this.formConfig);
|
186
188
|
}
|
187
|
-
if (this.
|
189
|
+
if (this.formConfigIsLoaded() && !forceLoad) {
|
188
190
|
return;
|
189
191
|
}
|
190
192
|
this._formConfigAlreadyLoaded = true;
|
193
|
+
let loadedLegacyConfig = await this._formConfigFetcher.fetchLegacyConfigurableForm(this.formLegacyConfigName);
|
194
|
+
if (loadedLegacyConfig != undefined) {
|
195
|
+
this._formConfigManager.setConfig(loadedLegacyConfig);
|
196
|
+
this.setFormConfig(loadedLegacyConfig);
|
197
|
+
return;
|
198
|
+
}
|
191
199
|
this.setFormConfig(await this._formConfigManager.loadConfig());
|
192
200
|
}
|
193
201
|
async componentWillRender() {
|
@@ -443,7 +451,7 @@ export class SnkSimpleCrud {
|
|
443
451
|
}
|
444
452
|
gridConfigChangeHandler(evt) {
|
445
453
|
const config = evt.detail;
|
446
|
-
ConfigStorage.saveGridConfig(config, this.configName, this.
|
454
|
+
ConfigStorage.saveGridConfig(config, this.configName, this.resolveResourceID());
|
447
455
|
evt.stopPropagation();
|
448
456
|
}
|
449
457
|
modalConfigChangeHandler(evt) {
|
@@ -474,6 +482,9 @@ export class SnkSimpleCrud {
|
|
474
482
|
handleShowFormConfig() {
|
475
483
|
return this._showFormConfig && !this.formLegacyConfigName;
|
476
484
|
}
|
485
|
+
resolveResourceID() {
|
486
|
+
return StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
|
487
|
+
}
|
477
488
|
/* istanbul ignore next */
|
478
489
|
render() {
|
479
490
|
var _a, _b, _c;
|
@@ -482,7 +493,7 @@ export class SnkSimpleCrud {
|
|
482
493
|
}
|
483
494
|
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
495
|
? 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((_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.
|
496
|
+
: 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.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() }))));
|
486
497
|
}
|
487
498
|
static get is() { return "snk-simple-crud"; }
|
488
499
|
static get encapsulation() { return "scoped"; }
|
@@ -636,6 +647,23 @@ export class SnkSimpleCrud {
|
|
636
647
|
"reflect": false,
|
637
648
|
"defaultValue": "true"
|
638
649
|
},
|
650
|
+
"resourceID": {
|
651
|
+
"type": "string",
|
652
|
+
"mutable": false,
|
653
|
+
"complexType": {
|
654
|
+
"original": "string",
|
655
|
+
"resolved": "string",
|
656
|
+
"references": {}
|
657
|
+
},
|
658
|
+
"required": false,
|
659
|
+
"optional": false,
|
660
|
+
"docs": {
|
661
|
+
"tags": [],
|
662
|
+
"text": "Identificador de recursos como configura\u00E7\u00F5es e acesso."
|
663
|
+
},
|
664
|
+
"attribute": "resource-i-d",
|
665
|
+
"reflect": false
|
666
|
+
},
|
639
667
|
"taskbarManager": {
|
640
668
|
"type": "unknown",
|
641
669
|
"mutable": false,
|
@@ -1060,6 +1088,9 @@ export class SnkSimpleCrud {
|
|
1060
1088
|
static get elementRef() { return "_element"; }
|
1061
1089
|
static get watchers() {
|
1062
1090
|
return [{
|
1091
|
+
"propName": "resourceID",
|
1092
|
+
"methodName": "handleResourceIDChanged"
|
1093
|
+
}, {
|
1063
1094
|
"propName": "mode",
|
1064
1095
|
"methodName": "onModeChange"
|
1065
1096
|
}, {
|
@@ -168,6 +168,18 @@ export class FormConfigFetcher extends ResourceFetcher {
|
|
168
168
|
}
|
169
169
|
return `cfg://${authority}/${resourceID}`;
|
170
170
|
}
|
171
|
+
async fetchLegacyConfigurableForm(configName) {
|
172
|
+
const payload = { 'requestBody': { 'config': { 'chave': configName, 'tipo': 'T' } } };
|
173
|
+
const response = await DataFetcher.get().callServiceBroker('SystemUtilsSP.getConf', JSON.stringify(payload));
|
174
|
+
if (ObjectUtils.isEmpty(response))
|
175
|
+
return undefined;
|
176
|
+
return this.buildLegacyConfigurableForm(response);
|
177
|
+
}
|
178
|
+
buildLegacyConfigurableForm(config) {
|
179
|
+
var _a, _b, _c;
|
180
|
+
const rawFields = (_c = (_b = (_a = config === null || config === void 0 ? void 0 : config.formConfig) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : [];
|
181
|
+
return { emptyConfig: false, fields: Array.isArray(rawFields) ? rawFields : [rawFields] };
|
182
|
+
}
|
171
183
|
}
|
172
184
|
export var UserConfigType;
|
173
185
|
(function (UserConfigType) {
|
@@ -230,6 +230,18 @@ class FormConfigFetcher extends ResourceFetcher {
|
|
230
230
|
}
|
231
231
|
return `cfg://${authority}/${resourceID}`;
|
232
232
|
}
|
233
|
+
async fetchLegacyConfigurableForm(configName) {
|
234
|
+
const payload = { 'requestBody': { 'config': { 'chave': configName, 'tipo': 'T' } } };
|
235
|
+
const response = await DataFetcher.get().callServiceBroker('SystemUtilsSP.getConf', JSON.stringify(payload));
|
236
|
+
if (ObjectUtils.isEmpty(response))
|
237
|
+
return undefined;
|
238
|
+
return this.buildLegacyConfigurableForm(response);
|
239
|
+
}
|
240
|
+
buildLegacyConfigurableForm(config) {
|
241
|
+
var _a, _b, _c;
|
242
|
+
const rawFields = (_c = (_b = (_a = config === null || config === void 0 ? void 0 : config.formConfig) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : [];
|
243
|
+
return { emptyConfig: false, fields: Array.isArray(rawFields) ? rawFields : [rawFields] };
|
244
|
+
}
|
233
245
|
}
|
234
246
|
var UserConfigType;
|
235
247
|
(function (UserConfigType) {
|
@@ -430,15 +430,12 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
430
430
|
}
|
431
431
|
this._showSnkFilterBar = true;
|
432
432
|
}
|
433
|
-
getConfig() {
|
434
|
-
return this._gridConfig == undefined ? undefined : Object.assign({}, this._gridConfig);
|
435
|
-
}
|
436
433
|
render() {
|
437
434
|
if (!this._dataUnit) {
|
438
435
|
return undefined;
|
439
436
|
}
|
440
437
|
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 &&
|
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.
|
438
|
+
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
442
439
|
}
|
443
440
|
get _element() { return this; }
|
444
441
|
static get watchers() { return {
|