@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-49448.0 → 0.0.0-bugfix-dev-KB-50122.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{ConfigStorage-34be11ce.js → ConfigStorage-8d4e9d53.js} +1 -1
- package/dist/cjs/{SnkFormConfigManager-6211fb28.js → SnkFormConfigManager-33995e92.js} +16 -13
- 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-508bb6fe.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 +85 -48
- package/dist/cjs/snk-taskbar.cjs.entry.js +24 -2
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +14 -11
- package/dist/collection/components/snk-grid/snk-grid.js +1 -4
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +119 -45
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +28 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +12 -0
- package/dist/components/SnkFormConfigManager.js +14 -11
- package/dist/components/form-config-fetcher.js +12 -0
- package/dist/components/snk-grid2.js +1 -4
- package/dist/components/snk-simple-crud2.js +84 -45
- package/dist/components/snk-taskbar2.js +27 -3
- package/dist/esm/{ConfigStorage-101a2b4c.js → ConfigStorage-6e241cd7.js} +1 -1
- package/dist/esm/{SnkFormConfigManager-d86ba46f.js → SnkFormConfigManager-7a4e678f.js} +16 -13
- 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-18859840.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 +85 -48
- package/dist/esm/snk-taskbar.entry.js +24 -2
- 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-64c1b368.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-5dbc1a3f.js → p-88b29791.js} +1 -1
- package/dist/sankhyablocks/{p-ba4871b5.entry.js → p-9e8618ec.entry.js} +1 -1
- package/dist/sankhyablocks/p-a043314f.entry.js +1 -0
- 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-b10b9934.entry.js +1 -0
- package/dist/sankhyablocks/{p-b4de81ac.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-e4fb3308.entry.js → p-d5cb4b5a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-60fa6c7a.js → p-efeca7ba.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 +0 -1
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +17 -6
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +6 -0
- package/dist/types/components.d.ts +16 -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-42ea9a35.entry.js +0 -1
- package/dist/sankhyablocks/p-50783a8b.js +0 -1
- package/dist/sankhyablocks/p-a13ccb86.js +0 -26
- package/dist/sankhyablocks/p-d304659d.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;
|
|
@@ -69,6 +71,17 @@ const SnkSimpleCrud = class {
|
|
|
69
71
|
this.showConfiguratorButtons = undefined;
|
|
70
72
|
this.gridLegacyConfigName = undefined;
|
|
71
73
|
this.formLegacyConfigName = undefined;
|
|
74
|
+
this.ignoreReadOnlyFormFields = false;
|
|
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);
|
|
72
85
|
}
|
|
73
86
|
getButtons(selected, changeModeBtn) {
|
|
74
87
|
return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
|
|
@@ -122,38 +135,29 @@ const SnkSimpleCrud = class {
|
|
|
122
135
|
this.dataStateChange.emit(newValue);
|
|
123
136
|
}
|
|
124
137
|
}
|
|
125
|
-
async observeFormLegacy() {
|
|
126
|
-
await this.handleUpdateFormLegacyConfig();
|
|
138
|
+
async observeFormLegacy(newValue, oldValue) {
|
|
139
|
+
await this.handleUpdateFormLegacyConfig(newValue, oldValue);
|
|
127
140
|
}
|
|
128
|
-
async observeGridLegacy() {
|
|
129
|
-
await this.handleUpdateGridLegacyConfig();
|
|
141
|
+
async observeGridLegacy(newValue, oldValue) {
|
|
142
|
+
await this.handleUpdateGridLegacyConfig(newValue, oldValue);
|
|
130
143
|
}
|
|
131
|
-
async handleUpdateGridLegacyConfig() {
|
|
132
|
-
if (
|
|
133
|
-
|
|
144
|
+
async handleUpdateGridLegacyConfig(newValue, oldValue) {
|
|
145
|
+
if (newValue == undefined || newValue == oldValue) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (!this._gridConfigAlreadyLoaded) {
|
|
149
|
+
return;
|
|
134
150
|
}
|
|
151
|
+
await this.loadGridConfig(true);
|
|
135
152
|
}
|
|
136
|
-
async handleUpdateFormLegacyConfig() {
|
|
137
|
-
if (
|
|
153
|
+
async handleUpdateFormLegacyConfig(newValue, oldValue) {
|
|
154
|
+
if (newValue == undefined || newValue == oldValue) {
|
|
138
155
|
return;
|
|
139
|
-
|
|
140
|
-
if (!
|
|
156
|
+
}
|
|
157
|
+
if (!this._formConfigAlreadyLoaded) {
|
|
141
158
|
return;
|
|
142
|
-
const legacyConfig = this.buildLegacyConfig(rawLegacyConfig);
|
|
143
|
-
this.setFormConfig(legacyConfig, true);
|
|
144
|
-
if (!this._formConfigManager) {
|
|
145
|
-
this._formConfigManager = new SnkFormConfigManager.SnkFormConfigManager(this.configName, this._resourceID);
|
|
146
159
|
}
|
|
147
|
-
this.
|
|
148
|
-
}
|
|
149
|
-
buildLegacyConfig(config) {
|
|
150
|
-
var _a, _b, _c;
|
|
151
|
-
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 : [];
|
|
152
|
-
return { emptyConfig: false, fields: Array.isArray(rawFields) ? rawFields : [rawFields] };
|
|
153
|
-
}
|
|
154
|
-
async fetchFormLegacyConfig() {
|
|
155
|
-
const payload = { 'requestBody': { 'config': { 'chave': this.formLegacyConfigName, 'tipo': 'T' } } };
|
|
156
|
-
return await this.application.callServiceBroker('SystemUtilsSP.getConf', JSON.stringify(payload));
|
|
160
|
+
this.loadFormConfig(true);
|
|
157
161
|
}
|
|
158
162
|
openConfig(viewMode) {
|
|
159
163
|
this._snkConfigurator.close();
|
|
@@ -183,32 +187,61 @@ const SnkSimpleCrud = class {
|
|
|
183
187
|
ConfigStorage.ConfigStorage.addGridLegacyConfig(this.configName, this.gridLegacyConfigName);
|
|
184
188
|
}
|
|
185
189
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
190
|
+
loadGridConfig(forceUpdate) {
|
|
191
|
+
if (this.configName === undefined) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
if ((this.gridConfig != undefined || this._gridConfigAlreadyLoaded) && !forceUpdate) {
|
|
189
195
|
return;
|
|
190
|
-
|
|
196
|
+
}
|
|
197
|
+
this.addGridLegacyConfigName();
|
|
198
|
+
this._gridConfigAlreadyLoaded = true;
|
|
199
|
+
return new Promise((accept, reject) => {
|
|
200
|
+
ConfigStorage.ConfigStorage.loadGridConfig(this.configName, this.resolveResourceID())
|
|
201
|
+
.then(config => {
|
|
202
|
+
this.setGridConfig(config);
|
|
203
|
+
accept();
|
|
204
|
+
})
|
|
205
|
+
.catch(reason => {
|
|
206
|
+
reject(reason);
|
|
207
|
+
});
|
|
208
|
+
});
|
|
191
209
|
}
|
|
192
|
-
|
|
193
|
-
return this.
|
|
210
|
+
formConfigIsLoaded() {
|
|
211
|
+
return this.formConfig != undefined || this._formConfigAlreadyLoaded;
|
|
194
212
|
}
|
|
195
|
-
async loadFormConfig() {
|
|
196
|
-
if (this.
|
|
213
|
+
async loadFormConfig(forceLoad = false) {
|
|
214
|
+
if (this.configName === undefined) {
|
|
197
215
|
return;
|
|
198
|
-
|
|
199
|
-
this._formConfigManager
|
|
216
|
+
}
|
|
217
|
+
if (this._formConfigManager == undefined) {
|
|
218
|
+
this._formConfigManager = new SnkFormConfigManager.SnkFormConfigManager(this.configName, this.resolveResourceID());
|
|
219
|
+
this._formConfigManager.setConfig(this.formConfig);
|
|
220
|
+
}
|
|
221
|
+
if (this.formConfigIsLoaded() && !forceLoad) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
this._formConfigAlreadyLoaded = true;
|
|
225
|
+
let loadedLegacyConfig = await this._formConfigFetcher.fetchLegacyConfigurableForm(this.formLegacyConfigName);
|
|
226
|
+
if (loadedLegacyConfig != undefined) {
|
|
227
|
+
this._formConfigManager.setConfig(loadedLegacyConfig);
|
|
228
|
+
this.setFormConfig(loadedLegacyConfig);
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
200
231
|
this.setFormConfig(await this._formConfigManager.loadConfig());
|
|
201
232
|
}
|
|
202
|
-
isFormConfigLoaded() {
|
|
203
|
-
return (this._formConfigManager && this.formConfig);
|
|
204
|
-
}
|
|
205
233
|
async componentWillRender() {
|
|
206
234
|
this._resourceID = await this.application.getResourceID();
|
|
207
235
|
this._taskbarProcessor.process(this.getTaskBarId(), this.taskbarManager, this.dataState, this.getTaskBarDisabledButtons());
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
236
|
+
if (this.configName === undefined) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
if (this.gridConfig != undefined || this._gridConfigAlreadyLoaded) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
await this.addGridLegacyConfigName();
|
|
243
|
+
this.loadGridConfig();
|
|
244
|
+
this.loadFormConfig();
|
|
212
245
|
}
|
|
213
246
|
componentWillLoad() {
|
|
214
247
|
this.processMetadata();
|
|
@@ -450,7 +483,7 @@ const SnkSimpleCrud = class {
|
|
|
450
483
|
}
|
|
451
484
|
gridConfigChangeHandler(evt) {
|
|
452
485
|
const config = evt.detail;
|
|
453
|
-
ConfigStorage.ConfigStorage.saveGridConfig(config, this.configName, this.
|
|
486
|
+
ConfigStorage.ConfigStorage.saveGridConfig(config, this.configName, this.resolveResourceID());
|
|
454
487
|
evt.stopPropagation();
|
|
455
488
|
}
|
|
456
489
|
modalConfigChangeHandler(evt) {
|
|
@@ -481,6 +514,9 @@ const SnkSimpleCrud = class {
|
|
|
481
514
|
handleShowFormConfig() {
|
|
482
515
|
return this._showFormConfig && !this.formLegacyConfigName;
|
|
483
516
|
}
|
|
517
|
+
resolveResourceID() {
|
|
518
|
+
return core.StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
|
|
519
|
+
}
|
|
484
520
|
/* istanbul ignore next */
|
|
485
521
|
render() {
|
|
486
522
|
var _a, _b, _c;
|
|
@@ -489,10 +525,11 @@ const SnkSimpleCrud = class {
|
|
|
489
525
|
}
|
|
490
526
|
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)
|
|
491
527
|
? undefined
|
|
492
|
-
: 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), 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.
|
|
528
|
+
: 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() }))));
|
|
493
529
|
}
|
|
494
530
|
get _element() { return index.getElement(this); }
|
|
495
531
|
static get watchers() { return {
|
|
532
|
+
"resourceID": ["handleResourceIDChanged"],
|
|
496
533
|
"mode": ["onModeChange"],
|
|
497
534
|
"dataState": ["observeDataState"],
|
|
498
535
|
"formLegacyConfigName": ["observeFormLegacy"],
|
|
@@ -41,6 +41,8 @@ const SnkTaskbar = class {
|
|
|
41
41
|
this._customElementsId = undefined;
|
|
42
42
|
this._slotContainer = undefined;
|
|
43
43
|
this._hiddenActionsList = [];
|
|
44
|
+
this._lastWidth = undefined;
|
|
45
|
+
this._hasToUpdateOverFlow = false;
|
|
44
46
|
this.alignRigth = false;
|
|
45
47
|
this.customSlotId = "TASKBAR_CUSTOM_ELEMENTS";
|
|
46
48
|
this.customContainerId = undefined;
|
|
@@ -66,6 +68,11 @@ const SnkTaskbar = class {
|
|
|
66
68
|
var _a;
|
|
67
69
|
(_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.forceUpdate();
|
|
68
70
|
}
|
|
71
|
+
observeLastWidth(newValue, oldValue) {
|
|
72
|
+
if (oldValue === 0 && newValue !== 0) {
|
|
73
|
+
this._hasToUpdateOverFlow = true;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
69
76
|
// Internal methods
|
|
70
77
|
elementsFromString(strButtons) {
|
|
71
78
|
const elements = [];
|
|
@@ -249,10 +256,20 @@ const SnkTaskbar = class {
|
|
|
249
256
|
this.getCustomElements();
|
|
250
257
|
}
|
|
251
258
|
componentWillRender() {
|
|
259
|
+
this.handleDefinitions();
|
|
260
|
+
this.validatePresentationMode();
|
|
261
|
+
this.updateOverFlowIfNeeded();
|
|
262
|
+
}
|
|
263
|
+
handleDefinitions() {
|
|
252
264
|
if (this._definitions == undefined && this._permissions) {
|
|
253
265
|
this._definitions = this.elementsFromString(this.buttons);
|
|
254
266
|
}
|
|
255
|
-
|
|
267
|
+
}
|
|
268
|
+
updateOverFlowIfNeeded() {
|
|
269
|
+
if (this._hasToUpdateOverFlow) {
|
|
270
|
+
requestAnimationFrame(() => { var _a; return (_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.forceUpdate(); });
|
|
271
|
+
this._hasToUpdateOverFlow = false;
|
|
272
|
+
}
|
|
256
273
|
}
|
|
257
274
|
handleOverFlow(overFlowingElements) {
|
|
258
275
|
const elementsToHandle = overFlowingElements.filter(element => !this.hasToIgnoreOverFlow(element));
|
|
@@ -319,6 +336,10 @@ const SnkTaskbar = class {
|
|
|
319
336
|
}
|
|
320
337
|
componentDidRender() {
|
|
321
338
|
this.appendCustomElementsInTaskbar();
|
|
339
|
+
this.updateLastWidth();
|
|
340
|
+
}
|
|
341
|
+
updateLastWidth() {
|
|
342
|
+
this._lastWidth = this._element.getBoundingClientRect().width;
|
|
322
343
|
}
|
|
323
344
|
disconnectedCallback() {
|
|
324
345
|
var _a;
|
|
@@ -365,7 +386,8 @@ const SnkTaskbar = class {
|
|
|
365
386
|
get _element() { return index.getElement(this); }
|
|
366
387
|
static get watchers() { return {
|
|
367
388
|
"buttons": ["observeButtons"],
|
|
368
|
-
"disabledButtons": ["observeDisabledButtons"]
|
|
389
|
+
"disabledButtons": ["observeDisabledButtons"],
|
|
390
|
+
"_lastWidth": ["observeLastWidth"]
|
|
369
391
|
}; }
|
|
370
392
|
};
|
|
371
393
|
SnkTaskbar.style = snkTaskbarCss;
|
|
@@ -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) {
|
|
@@ -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;
|
|
@@ -43,6 +45,17 @@ export class SnkSimpleCrud {
|
|
|
43
45
|
this.showConfiguratorButtons = undefined;
|
|
44
46
|
this.gridLegacyConfigName = undefined;
|
|
45
47
|
this.formLegacyConfigName = undefined;
|
|
48
|
+
this.ignoreReadOnlyFormFields = false;
|
|
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);
|
|
46
59
|
}
|
|
47
60
|
getButtons(selected, changeModeBtn) {
|
|
48
61
|
return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
|
|
@@ -96,38 +109,29 @@ export class SnkSimpleCrud {
|
|
|
96
109
|
this.dataStateChange.emit(newValue);
|
|
97
110
|
}
|
|
98
111
|
}
|
|
99
|
-
async observeFormLegacy() {
|
|
100
|
-
await this.handleUpdateFormLegacyConfig();
|
|
112
|
+
async observeFormLegacy(newValue, oldValue) {
|
|
113
|
+
await this.handleUpdateFormLegacyConfig(newValue, oldValue);
|
|
101
114
|
}
|
|
102
|
-
async observeGridLegacy() {
|
|
103
|
-
await this.handleUpdateGridLegacyConfig();
|
|
115
|
+
async observeGridLegacy(newValue, oldValue) {
|
|
116
|
+
await this.handleUpdateGridLegacyConfig(newValue, oldValue);
|
|
104
117
|
}
|
|
105
|
-
async handleUpdateGridLegacyConfig() {
|
|
106
|
-
if (
|
|
107
|
-
|
|
118
|
+
async handleUpdateGridLegacyConfig(newValue, oldValue) {
|
|
119
|
+
if (newValue == undefined || newValue == oldValue) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (!this._gridConfigAlreadyLoaded) {
|
|
123
|
+
return;
|
|
108
124
|
}
|
|
125
|
+
await this.loadGridConfig(true);
|
|
109
126
|
}
|
|
110
|
-
async handleUpdateFormLegacyConfig() {
|
|
111
|
-
if (
|
|
127
|
+
async handleUpdateFormLegacyConfig(newValue, oldValue) {
|
|
128
|
+
if (newValue == undefined || newValue == oldValue) {
|
|
112
129
|
return;
|
|
113
|
-
|
|
114
|
-
if (!
|
|
130
|
+
}
|
|
131
|
+
if (!this._formConfigAlreadyLoaded) {
|
|
115
132
|
return;
|
|
116
|
-
const legacyConfig = this.buildLegacyConfig(rawLegacyConfig);
|
|
117
|
-
this.setFormConfig(legacyConfig, true);
|
|
118
|
-
if (!this._formConfigManager) {
|
|
119
|
-
this._formConfigManager = new SnkFormConfigManager(this.configName, this._resourceID);
|
|
120
133
|
}
|
|
121
|
-
this.
|
|
122
|
-
}
|
|
123
|
-
buildLegacyConfig(config) {
|
|
124
|
-
var _a, _b, _c;
|
|
125
|
-
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 : [];
|
|
126
|
-
return { emptyConfig: false, fields: Array.isArray(rawFields) ? rawFields : [rawFields] };
|
|
127
|
-
}
|
|
128
|
-
async fetchFormLegacyConfig() {
|
|
129
|
-
const payload = { 'requestBody': { 'config': { 'chave': this.formLegacyConfigName, 'tipo': 'T' } } };
|
|
130
|
-
return await this.application.callServiceBroker('SystemUtilsSP.getConf', JSON.stringify(payload));
|
|
134
|
+
this.loadFormConfig(true);
|
|
131
135
|
}
|
|
132
136
|
openConfig(viewMode) {
|
|
133
137
|
this._snkConfigurator.close();
|
|
@@ -157,32 +161,61 @@ export class SnkSimpleCrud {
|
|
|
157
161
|
ConfigStorage.addGridLegacyConfig(this.configName, this.gridLegacyConfigName);
|
|
158
162
|
}
|
|
159
163
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
164
|
+
loadGridConfig(forceUpdate) {
|
|
165
|
+
if (this.configName === undefined) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if ((this.gridConfig != undefined || this._gridConfigAlreadyLoaded) && !forceUpdate) {
|
|
163
169
|
return;
|
|
164
|
-
|
|
170
|
+
}
|
|
171
|
+
this.addGridLegacyConfigName();
|
|
172
|
+
this._gridConfigAlreadyLoaded = true;
|
|
173
|
+
return new Promise((accept, reject) => {
|
|
174
|
+
ConfigStorage.loadGridConfig(this.configName, this.resolveResourceID())
|
|
175
|
+
.then(config => {
|
|
176
|
+
this.setGridConfig(config);
|
|
177
|
+
accept();
|
|
178
|
+
})
|
|
179
|
+
.catch(reason => {
|
|
180
|
+
reject(reason);
|
|
181
|
+
});
|
|
182
|
+
});
|
|
165
183
|
}
|
|
166
|
-
|
|
167
|
-
return this.
|
|
184
|
+
formConfigIsLoaded() {
|
|
185
|
+
return this.formConfig != undefined || this._formConfigAlreadyLoaded;
|
|
168
186
|
}
|
|
169
|
-
async loadFormConfig() {
|
|
170
|
-
if (this.
|
|
187
|
+
async loadFormConfig(forceLoad = false) {
|
|
188
|
+
if (this.configName === undefined) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
if (this._formConfigManager == undefined) {
|
|
192
|
+
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
|
193
|
+
this._formConfigManager.setConfig(this.formConfig);
|
|
194
|
+
}
|
|
195
|
+
if (this.formConfigIsLoaded() && !forceLoad) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
this._formConfigAlreadyLoaded = true;
|
|
199
|
+
let loadedLegacyConfig = await this._formConfigFetcher.fetchLegacyConfigurableForm(this.formLegacyConfigName);
|
|
200
|
+
if (loadedLegacyConfig != undefined) {
|
|
201
|
+
this._formConfigManager.setConfig(loadedLegacyConfig);
|
|
202
|
+
this.setFormConfig(loadedLegacyConfig);
|
|
171
203
|
return;
|
|
172
|
-
|
|
173
|
-
this._formConfigManager.setConfig(this.formConfig);
|
|
204
|
+
}
|
|
174
205
|
this.setFormConfig(await this._formConfigManager.loadConfig());
|
|
175
206
|
}
|
|
176
|
-
isFormConfigLoaded() {
|
|
177
|
-
return (this._formConfigManager && this.formConfig);
|
|
178
|
-
}
|
|
179
207
|
async componentWillRender() {
|
|
180
208
|
this._resourceID = await this.application.getResourceID();
|
|
181
209
|
this._taskbarProcessor.process(this.getTaskBarId(), this.taskbarManager, this.dataState, this.getTaskBarDisabledButtons());
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
210
|
+
if (this.configName === undefined) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (this.gridConfig != undefined || this._gridConfigAlreadyLoaded) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
await this.addGridLegacyConfigName();
|
|
217
|
+
this.loadGridConfig();
|
|
218
|
+
this.loadFormConfig();
|
|
186
219
|
}
|
|
187
220
|
componentWillLoad() {
|
|
188
221
|
this.processMetadata();
|
|
@@ -424,7 +457,7 @@ export class SnkSimpleCrud {
|
|
|
424
457
|
}
|
|
425
458
|
gridConfigChangeHandler(evt) {
|
|
426
459
|
const config = evt.detail;
|
|
427
|
-
ConfigStorage.saveGridConfig(config, this.configName, this.
|
|
460
|
+
ConfigStorage.saveGridConfig(config, this.configName, this.resolveResourceID());
|
|
428
461
|
evt.stopPropagation();
|
|
429
462
|
}
|
|
430
463
|
modalConfigChangeHandler(evt) {
|
|
@@ -455,6 +488,9 @@ export class SnkSimpleCrud {
|
|
|
455
488
|
handleShowFormConfig() {
|
|
456
489
|
return this._showFormConfig && !this.formLegacyConfigName;
|
|
457
490
|
}
|
|
491
|
+
resolveResourceID() {
|
|
492
|
+
return StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
|
|
493
|
+
}
|
|
458
494
|
/* istanbul ignore next */
|
|
459
495
|
render() {
|
|
460
496
|
var _a, _b, _c;
|
|
@@ -463,7 +499,7 @@ export class SnkSimpleCrud {
|
|
|
463
499
|
}
|
|
464
500
|
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)
|
|
465
501
|
? undefined
|
|
466
|
-
: 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), 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.
|
|
502
|
+
: 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() }))));
|
|
467
503
|
}
|
|
468
504
|
static get is() { return "snk-simple-crud"; }
|
|
469
505
|
static get encapsulation() { return "scoped"; }
|
|
@@ -617,6 +653,23 @@ export class SnkSimpleCrud {
|
|
|
617
653
|
"reflect": false,
|
|
618
654
|
"defaultValue": "true"
|
|
619
655
|
},
|
|
656
|
+
"resourceID": {
|
|
657
|
+
"type": "string",
|
|
658
|
+
"mutable": false,
|
|
659
|
+
"complexType": {
|
|
660
|
+
"original": "string",
|
|
661
|
+
"resolved": "string",
|
|
662
|
+
"references": {}
|
|
663
|
+
},
|
|
664
|
+
"required": false,
|
|
665
|
+
"optional": false,
|
|
666
|
+
"docs": {
|
|
667
|
+
"tags": [],
|
|
668
|
+
"text": "Identificador de recursos como configura\u00E7\u00F5es e acesso."
|
|
669
|
+
},
|
|
670
|
+
"attribute": "resource-i-d",
|
|
671
|
+
"reflect": false
|
|
672
|
+
},
|
|
620
673
|
"taskbarManager": {
|
|
621
674
|
"type": "unknown",
|
|
622
675
|
"mutable": false,
|
|
@@ -765,6 +818,24 @@ export class SnkSimpleCrud {
|
|
|
765
818
|
},
|
|
766
819
|
"attribute": "form-legacy-config-name",
|
|
767
820
|
"reflect": false
|
|
821
|
+
},
|
|
822
|
+
"ignoreReadOnlyFormFields": {
|
|
823
|
+
"type": "boolean",
|
|
824
|
+
"mutable": false,
|
|
825
|
+
"complexType": {
|
|
826
|
+
"original": "boolean",
|
|
827
|
+
"resolved": "boolean",
|
|
828
|
+
"references": {}
|
|
829
|
+
},
|
|
830
|
+
"required": false,
|
|
831
|
+
"optional": false,
|
|
832
|
+
"docs": {
|
|
833
|
+
"tags": [],
|
|
834
|
+
"text": "Ignora os campos \"somente leitura\" no modo de inser\u00E7\u00E3o."
|
|
835
|
+
},
|
|
836
|
+
"attribute": "ignore-read-only-form-fields",
|
|
837
|
+
"reflect": false,
|
|
838
|
+
"defaultValue": "false"
|
|
768
839
|
}
|
|
769
840
|
};
|
|
770
841
|
}
|
|
@@ -1023,6 +1094,9 @@ export class SnkSimpleCrud {
|
|
|
1023
1094
|
static get elementRef() { return "_element"; }
|
|
1024
1095
|
static get watchers() {
|
|
1025
1096
|
return [{
|
|
1097
|
+
"propName": "resourceID",
|
|
1098
|
+
"methodName": "handleResourceIDChanged"
|
|
1099
|
+
}, {
|
|
1026
1100
|
"propName": "mode",
|
|
1027
1101
|
"methodName": "onModeChange"
|
|
1028
1102
|
}, {
|