@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-49699.1 → 0.0.0-bugfix-dev-KB-50737.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-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 +18 -6
- package/dist/cjs/snk-filter-detail.cjs.entry.js +4 -1
- package/dist/cjs/snk-filter-item.cjs.entry.js +2 -1
- 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 +60 -48
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +22 -1
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +20 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +2 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +15 -3
- package/dist/collection/components/snk-grid/snk-grid.js +1 -4
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +76 -45
- 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-filter-bar2.js +16 -4
- package/dist/components/snk-filter-detail2.js +5 -1
- package/dist/components/snk-filter-item2.js +3 -1
- package/dist/components/snk-grid2.js +1 -4
- package/dist/components/snk-simple-crud2.js +58 -45
- 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 +18 -6
- package/dist/esm/snk-filter-detail.entry.js +4 -1
- package/dist/esm/snk-filter-item.entry.js +2 -1
- 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 +60 -48
- 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-1fa5a18c.entry.js → p-400097f2.entry.js} +1 -1
- package/dist/sankhyablocks/p-54a5d52a.entry.js +1 -0
- package/dist/sankhyablocks/p-5c8b136d.entry.js +1 -0
- package/dist/sankhyablocks/{p-2897fb8c.js → p-6c9adfca.js} +1 -1
- package/dist/sankhyablocks/p-85af23fe.entry.js +1 -0
- 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-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-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-fad4c2fe.js → p-efeca7ba.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +4 -0
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +4 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +2 -0
- 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 -4
- package/dist/types/components.d.ts +24 -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-1f3174cb.entry.js +0 -1
- package/dist/sankhyablocks/p-50783a8b.js +0 -1
- package/dist/sankhyablocks/p-7c501259.entry.js +0 -1
- package/dist/sankhyablocks/p-86801b08.entry.js +0 -1
- package/dist/sankhyablocks/p-a13ccb86.js +0 -26
- package/dist/sankhyablocks/p-d6317851.entry.js +0 -1
|
@@ -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,45 +109,29 @@ 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
|
+
if (!this._gridConfigAlreadyLoaded) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
await this.loadGridConfig(true);
|
|
113
126
|
}
|
|
114
|
-
async handleUpdateFormLegacyConfig() {
|
|
115
|
-
|
|
116
|
-
if (!this.formLegacyConfigName) {
|
|
127
|
+
async handleUpdateFormLegacyConfig(newValue, oldValue) {
|
|
128
|
+
if (newValue == undefined || newValue == oldValue) {
|
|
117
129
|
return;
|
|
118
130
|
}
|
|
119
|
-
|
|
120
|
-
if (!legacyConfig)
|
|
131
|
+
if (!this._formConfigAlreadyLoaded) {
|
|
121
132
|
return;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
const newConfig = { emptyConfig: false, fields: fields };
|
|
125
|
-
this.setFormConfig(newConfig, true);
|
|
126
|
-
const formConfigManager = this.getFormConfigManger();
|
|
127
|
-
formConfigManager.setConfig(this.formConfig);
|
|
128
|
-
}
|
|
129
|
-
async fetchFormLegacyConfig() {
|
|
130
|
-
const payload = {
|
|
131
|
-
'requestBody': {
|
|
132
|
-
'config': {
|
|
133
|
-
'chave': this.formLegacyConfigName,
|
|
134
|
-
'tipo': 'T',
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
};
|
|
138
|
-
return await this.application.callServiceBroker('SystemUtilsSP.getConf', JSON.stringify(payload));
|
|
133
|
+
}
|
|
134
|
+
this.loadFormConfig(true);
|
|
139
135
|
}
|
|
140
136
|
openConfig(viewMode) {
|
|
141
137
|
this._snkConfigurator.close();
|
|
@@ -166,12 +162,16 @@ export class SnkSimpleCrud {
|
|
|
166
162
|
}
|
|
167
163
|
}
|
|
168
164
|
loadGridConfig(forceUpdate) {
|
|
165
|
+
if (this.configName === undefined) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
169
168
|
if ((this.gridConfig != undefined || this._gridConfigAlreadyLoaded) && !forceUpdate) {
|
|
170
169
|
return;
|
|
171
170
|
}
|
|
171
|
+
this.addGridLegacyConfigName();
|
|
172
172
|
this._gridConfigAlreadyLoaded = true;
|
|
173
173
|
return new Promise((accept, reject) => {
|
|
174
|
-
ConfigStorage.loadGridConfig(this.configName, this.
|
|
174
|
+
ConfigStorage.loadGridConfig(this.configName, this.resolveResourceID())
|
|
175
175
|
.then(config => {
|
|
176
176
|
this.setGridConfig(config);
|
|
177
177
|
accept();
|
|
@@ -181,20 +181,28 @@ export class SnkSimpleCrud {
|
|
|
181
181
|
});
|
|
182
182
|
});
|
|
183
183
|
}
|
|
184
|
-
|
|
184
|
+
formConfigIsLoaded() {
|
|
185
|
+
return this.formConfig != undefined || this._formConfigAlreadyLoaded;
|
|
186
|
+
}
|
|
187
|
+
async loadFormConfig(forceLoad = false) {
|
|
188
|
+
if (this.configName === undefined) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
185
191
|
if (this._formConfigManager == undefined) {
|
|
186
|
-
this._formConfigManager = new SnkFormConfigManager(this.configName, this.
|
|
192
|
+
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
|
193
|
+
this._formConfigManager.setConfig(this.formConfig);
|
|
187
194
|
}
|
|
188
|
-
|
|
189
|
-
}
|
|
190
|
-
async loadFormConfig() {
|
|
191
|
-
const formConfigManager = this.getFormConfigManger();
|
|
192
|
-
formConfigManager.setConfig(this.formConfig);
|
|
193
|
-
if (this.formConfig != undefined || this._formConfigAlreadyLoaded) {
|
|
195
|
+
if (this.formConfigIsLoaded() && !forceLoad) {
|
|
194
196
|
return;
|
|
195
197
|
}
|
|
196
198
|
this._formConfigAlreadyLoaded = true;
|
|
197
|
-
this.
|
|
199
|
+
let loadedLegacyConfig = await this._formConfigFetcher.fetchLegacyConfigurableForm(this.formLegacyConfigName);
|
|
200
|
+
if (loadedLegacyConfig != undefined) {
|
|
201
|
+
this._formConfigManager.setConfig(loadedLegacyConfig);
|
|
202
|
+
this.setFormConfig(loadedLegacyConfig);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
this.setFormConfig(await this._formConfigManager.loadConfig());
|
|
198
206
|
}
|
|
199
207
|
async componentWillRender() {
|
|
200
208
|
this._resourceID = await this.application.getResourceID();
|
|
@@ -449,7 +457,7 @@ export class SnkSimpleCrud {
|
|
|
449
457
|
}
|
|
450
458
|
gridConfigChangeHandler(evt) {
|
|
451
459
|
const config = evt.detail;
|
|
452
|
-
ConfigStorage.saveGridConfig(config, this.configName, this.
|
|
460
|
+
ConfigStorage.saveGridConfig(config, this.configName, this.resolveResourceID());
|
|
453
461
|
evt.stopPropagation();
|
|
454
462
|
}
|
|
455
463
|
modalConfigChangeHandler(evt) {
|
|
@@ -480,6 +488,9 @@ export class SnkSimpleCrud {
|
|
|
480
488
|
handleShowFormConfig() {
|
|
481
489
|
return this._showFormConfig && !this.formLegacyConfigName;
|
|
482
490
|
}
|
|
491
|
+
resolveResourceID() {
|
|
492
|
+
return StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
|
|
493
|
+
}
|
|
483
494
|
/* istanbul ignore next */
|
|
484
495
|
render() {
|
|
485
496
|
var _a, _b, _c;
|
|
@@ -488,7 +499,7 @@ export class SnkSimpleCrud {
|
|
|
488
499
|
}
|
|
489
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)
|
|
490
501
|
? undefined
|
|
491
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: (_b = this._formConfigManager) === null || _b === void 0 ? void 0 : _b.getConfig((_c = this.dataState) === null || _c === void 0 ? void 0 : _c.insertionMode, this.dataUnit, this.ignoreReadOnlyFormFields), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.
|
|
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() }))));
|
|
492
503
|
}
|
|
493
504
|
static get is() { return "snk-simple-crud"; }
|
|
494
505
|
static get encapsulation() { return "scoped"; }
|
|
@@ -642,6 +653,23 @@ export class SnkSimpleCrud {
|
|
|
642
653
|
"reflect": false,
|
|
643
654
|
"defaultValue": "true"
|
|
644
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
|
+
},
|
|
645
673
|
"taskbarManager": {
|
|
646
674
|
"type": "unknown",
|
|
647
675
|
"mutable": false,
|
|
@@ -1066,6 +1094,9 @@ export class SnkSimpleCrud {
|
|
|
1066
1094
|
static get elementRef() { return "_element"; }
|
|
1067
1095
|
static get watchers() {
|
|
1068
1096
|
return [{
|
|
1097
|
+
"propName": "resourceID",
|
|
1098
|
+
"methodName": "handleResourceIDChanged"
|
|
1099
|
+
}, {
|
|
1069
1100
|
"propName": "mode",
|
|
1070
1101
|
"methodName": "onModeChange"
|
|
1071
1102
|
}, {
|
|
@@ -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) {
|
|
@@ -253,7 +253,7 @@ class SnkFilterModalFactory {
|
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
const snkFilterBarCss = ".sc-snk-filter-bar-h{display:grid;grid-template-columns:1fr minmax(100px, 100%) 1fr 1fr;--snk-personalized-filter--z-index:var(--elevation--20, 20);--snk-personalized-filter--background-color:var(--background--xlight, #fff)}.snk-filter-bar__title.sc-snk-filter-bar{max-width:260px;display:inline-block;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:16px;font-family:var(--font-pattern, Arial);font-weight:var(--text-weight--large, 600);color:var(--color--title-primary, #2B3A54);margin-top:8px}[data-mode=\"hidden\"].sc-snk-filter-bar-h{
|
|
256
|
+
const snkFilterBarCss = ".sc-snk-filter-bar-h{display:grid;grid-template-columns:1fr minmax(100px, 100%) 1fr 1fr;--snk-personalized-filter--z-index:var(--elevation--20, 20);--snk-personalized-filter--background-color:var(--background--xlight, #fff)}.snk-filter-bar__title.sc-snk-filter-bar{max-width:260px;display:inline-block;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:16px;font-family:var(--font-pattern, Arial);font-weight:var(--text-weight--large, 600);color:var(--color--title-primary, #2B3A54);margin-top:8px}[data-mode=\"hidden\"].sc-snk-filter-bar-h{width:0px;height:0px}[data-mode=\"button\"].sc-snk-filter-bar-h{grid-template-columns:1fr;width:fit-content}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.filter-bar__personalized-filter.sc-snk-filter-bar{display:flex;flex-direction:column;position:fixed;top:0;left:0;width:100%;height:100%;overflow:auto;z-index:var(--snk-personalized-filter--z-index);background-color:var(--snk-personalized-filter--background-color)}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;background-color:var(--background--xlight, #fff);border-radius:var(--border--radius-medium, 12px);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.snk-filter-item__editor-header.sc-snk-filter-bar{flex-grow:1;font-weight:var(--text-weight--medium, 400);color:var(--color--title-primary, #2B3A54)}.snk-filter__popover-rule.sc-snk-filter-bar{border-style:solid;border-color:var(--color--disable-secondary, #F2F5F8);border-radius:1px;border-width:1px;width:100%}.editor__ez-check.sc-snk-filter-bar{--ez-check__label--padding-left:0}.snk-filter-item__editor-header-button.sc-snk-filter-bar{cursor:pointer;background-color:transparent;border:none;padding:3px;outline-color:var(--color--primary)}.snk-filter-bar__divider.sc-snk-filter-bar{margin-bottom:var(--space--small)}.snk-filter-bar__scroller.sc-snk-filter-bar{height:calc(100% + var(--space-extra-small, 3px))}.snk-filter-bar__filter-item-container.sc-snk-filter-bar{display:flex;align-self:center}.snk-filter-bar__scroller.sc-snk-filter-bar .sc-snk-filter-bar:first-child{margin-left:var(--space-extra-small, 3px)}.snk-filter-bar__filter-list-items-container.sc-snk-filter-bar{overflow-y:auto;max-height:360px;margin-top:var(--space--small, 6px)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar{cursor:pointer;border-radius:var(--border--radius-small, 6px);border:none;background-color:transparent}.snk-filter-bar__filter-list-item__label.sc-snk-filter-bar{color:var(--title--primary)}.snk-filter-bar__filter-list-item__label--secondary.sc-snk-filter-bar{color:var(--text--primary)}.snk-filter-bar__filter-list-item__icon.sc-snk-filter-bar{--ez-icon--color:var(--title--primary)}.snk-filter-bar__filter-list-item__icon--secondary.sc-snk-filter-bar{--ez-icon--color:var(--text--secondary)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:focus-visible{outline:none;background-color:var(--background--medium)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:hover{background-color:var(--background--medium)}.snk-filter-bar__filter-list-items-container--empty.sc-snk-filter-bar{width:100%;height:100px;display:flex;justify-content:center;align-self:center;align-items:center}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar{position:relative}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar::after{display:flex;position:absolute;content:\"\";width:8px;height:8px;top:7px;left:17px;background-color:var(--icon--alert--color, #008561);border-radius:50%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar{--modal-item-border-width:2px;display:flex;flex-direction:row;margin-left:var(--modal-item-border-width);border-radius:var(--border--radius-medium, 12px);background-color:var(--background--medium, #f0f3f7);border:none;width:100%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar:focus-visible{outline:var(--color--primary) solid var(--modal-item-border-width)}.snk-filter-bar__filter-modal-item__check.sc-snk-filter-bar{width:auto}.snk-filter-bar__filter-modal-item__label.sc-snk-filter-bar{font-weight:var(--text-weight--medium)}.snk-filter-bar__filter-modal-content.sc-snk-filter-bar{display:grid;grid-template-rows:auto auto 1fr auto;width:99%;height:100%}";
|
|
257
257
|
|
|
258
258
|
const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
259
259
|
constructor() {
|
|
@@ -496,6 +496,17 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
496
496
|
filterActiveFilter(item) {
|
|
497
497
|
return item.visible || item.removalBlocked;
|
|
498
498
|
}
|
|
499
|
+
filterPersonalizedItems(item) {
|
|
500
|
+
return item.type === FilterItemType.PERSONALIZED;
|
|
501
|
+
}
|
|
502
|
+
getPersonalizedFilterVariableItems() {
|
|
503
|
+
return this.filterConfig
|
|
504
|
+
.filter(this.filterPersonalizedItems)
|
|
505
|
+
.map(item => {
|
|
506
|
+
const itemId = `filter-${item.id}`;
|
|
507
|
+
return (h("snk-filter-item", { key: item.id, id: itemId, config: Object.assign({}, item), onFocusin: () => this.itemFocused(itemId), onVisibleChanged: (evt) => this.scrollerLocked = evt.detail, onFilterChange: (event) => this.updateFilter(event.detail), getMessage: (key, props) => this.getMessage(key, props), showChips: false }));
|
|
508
|
+
});
|
|
509
|
+
}
|
|
499
510
|
getFilterItems() {
|
|
500
511
|
const pinnedItems = [];
|
|
501
512
|
const unpinnedItems = [];
|
|
@@ -681,9 +692,10 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
681
692
|
if (this.showPersonalizedFilter) {
|
|
682
693
|
return h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, onEzCancel: () => this.handleHidePersonalizedFilter(false), onEzAfterSave: () => this.handleHidePersonalizedFilter(true), entityUri: this.dataUnit.name, configName: this.configName, resourceID: this.resourceID });
|
|
683
694
|
}
|
|
684
|
-
if (this.mode
|
|
685
|
-
return (h(Host, { "data-mode": this.mode }, h("ez-button", { class: "ez-margin-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) })));
|
|
686
|
-
|
|
695
|
+
if (this.mode !== "regular") {
|
|
696
|
+
return (h(Host, { "data-mode": this.mode }, this.getPersonalizedFilterVariableItems(), this.mode === 'button' && (h("ez-button", { class: "ez-margin-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }))));
|
|
697
|
+
}
|
|
698
|
+
return (h(Host, null, h("div", null, h("span", { class: "snk-filter-bar__title", title: this.title, "data-tooltip": this.title, "data-flow": "bottom" }, this.title)), h("ez-scroller", { class: "snk-filter-bar__scroller", direction: EzScrollDirection.HORIZONTAL, activeShadow: true, locked: this.scrollerLocked }, h("section", { class: "snk-filter-bar__filter-item-container" }, this.getFilterItems())), h("ez-button", { class: "ez-padding-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }, h("ez-icon", { slot: "leftIcon", iconName: "plus", class: "ez-padding-right--small" }))));
|
|
687
699
|
}
|
|
688
700
|
get _element() { return this; }
|
|
689
701
|
static get watchers() { return {
|
|
@@ -12,6 +12,7 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
12
12
|
this.filterChange = createEvent(this, "filterChange", 7);
|
|
13
13
|
this.config = undefined;
|
|
14
14
|
this.getMessage = undefined;
|
|
15
|
+
this.showHardFixed = true;
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* Exibe o componente snk-filter-detail.
|
|
@@ -89,7 +90,9 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
89
90
|
return Object.assign(Object.assign({}, item), { visible: false, fixed: false, value: undefined });
|
|
90
91
|
}
|
|
91
92
|
getPopUpHeaderButtons() {
|
|
92
|
-
return (h(Fragment, null, !this.config.removalBlocked &&
|
|
93
|
+
return (h(Fragment, null, !this.config.removalBlocked &&
|
|
94
|
+
this.buildIcon(this.getMessage("snkFilterBar.removeFilter"), "delete", () => this.removeItem()), this.showHardFixed && !this.config.hardFixed &&
|
|
95
|
+
this.buildIcon(this.getMessage(this.config.fixed ? "snkFilterBar.unpinFilter" : "snkFilterBar.pinFilter"), this.config.fixed ? "un-pin" : "push-pin", () => this.changeConfig(Object.assign(Object.assign({}, this.config), { fixed: !this.config.fixed })))));
|
|
93
96
|
}
|
|
94
97
|
buildIcon(title, iconName, action) {
|
|
95
98
|
return (h("button", { onClick: () => action(), class: "sc-snk-filter-bar snk-filter-item__editor-header-button", ref: elem => elem && this.buildIdButton(elem, title) }, h("ez-icon", Object.assign({ title: title, iconName: iconName }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo(`_${title}`)}` }))));
|
|
@@ -170,6 +173,7 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
170
173
|
}, [0, "snk-filter-detail", {
|
|
171
174
|
"config": [1040],
|
|
172
175
|
"getMessage": [16],
|
|
176
|
+
"showHardFixed": [4, "show-hard-fixed"],
|
|
173
177
|
"show": [64]
|
|
174
178
|
}]);
|
|
175
179
|
function defineCustomElement() {
|
|
@@ -20,6 +20,7 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
20
20
|
this.detailIsVisible = undefined;
|
|
21
21
|
this.config = undefined;
|
|
22
22
|
this.getMessage = undefined;
|
|
23
|
+
this.showChips = true;
|
|
23
24
|
}
|
|
24
25
|
observeDetailIsVisible(value) {
|
|
25
26
|
this.visibleChanged.emit(value);
|
|
@@ -295,7 +296,7 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
295
296
|
}
|
|
296
297
|
render() {
|
|
297
298
|
const leftIcon = this.getLeftIconName();
|
|
298
|
-
return (h(Host, null, h("ez-chip", { id: this.config.id, ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.getEnabledChip() }, leftIcon
|
|
299
|
+
return (h(Host, null, this.showChips && (h("ez-chip", { id: this.config.id, ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.getEnabledChip() }, leftIcon && (h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" })), h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon", id: "removeFilter" }))), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small ez-elevation--16", ref: elem => this._popover = elem, key: this.config.id, "data-element-id": this._idSnkFilterDetail, showHardFixed: this.showChips }))));
|
|
299
300
|
}
|
|
300
301
|
get _filterItemElement() { return this; }
|
|
301
302
|
static get watchers() { return {
|
|
@@ -304,6 +305,7 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
304
305
|
}, [0, "snk-filter-item", {
|
|
305
306
|
"config": [1040],
|
|
306
307
|
"getMessage": [16],
|
|
308
|
+
"showChips": [4, "show-chips"],
|
|
307
309
|
"detailIsVisible": [32],
|
|
308
310
|
"showUp": [64],
|
|
309
311
|
"hideDetail": [64]
|
|
@@ -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 {
|
|
@@ -10,7 +10,7 @@ import { d as defineCustomElement$d } from './snk-actions-button2.js';
|
|
|
10
10
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
11
11
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
12
12
|
import './filter-item-type.enum.js';
|
|
13
|
-
import './form-config-fetcher.js';
|
|
13
|
+
import { F as FormConfigFetcher } from './form-config-fetcher.js';
|
|
14
14
|
import { C as ConfigStorage } from './ConfigStorage.js';
|
|
15
15
|
import { S as SnkFormConfigManager } from './SnkFormConfigManager.js';
|
|
16
16
|
import { d as defineCustomElement$c } from './snk-config-options2.js';
|
|
@@ -42,6 +42,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
42
42
|
this.configuratorCancel = createEvent(this, "configuratorCancel", 7);
|
|
43
43
|
this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
|
|
44
44
|
this._keyDownHandler = (event) => this.keyDownListener(event);
|
|
45
|
+
this._formConfigFetcher = new FormConfigFetcher();
|
|
45
46
|
this._taskbarProcessor = new TaskbarProcessor({
|
|
46
47
|
"snkSimpleCrudTaskbar.form_regular": this.getButtons(false, TaskbarElement.GRID_MODE),
|
|
47
48
|
"snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, TaskbarElement.FORM_MODE),
|
|
@@ -63,6 +64,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
63
64
|
this._formFields = [];
|
|
64
65
|
this.multipleSelection = undefined;
|
|
65
66
|
this.useCancelConfirm = true;
|
|
67
|
+
this.resourceID = undefined;
|
|
66
68
|
this.taskbarManager = undefined;
|
|
67
69
|
this.messagesBuilder = undefined;
|
|
68
70
|
this.useEnterLikeTab = false;
|
|
@@ -73,6 +75,16 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
73
75
|
this.formLegacyConfigName = undefined;
|
|
74
76
|
this.ignoreReadOnlyFormFields = false;
|
|
75
77
|
}
|
|
78
|
+
handleResourceIDChanged(newValue, oldValue) {
|
|
79
|
+
if (StringUtils.isEmpty(newValue)) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (newValue === oldValue) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
this.loadFormConfig(true);
|
|
86
|
+
this.loadGridConfig(true);
|
|
87
|
+
}
|
|
76
88
|
getButtons(selected, changeModeBtn) {
|
|
77
89
|
return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
|
|
78
90
|
.concat(changeModeBtn));
|
|
@@ -125,45 +137,29 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
125
137
|
this.dataStateChange.emit(newValue);
|
|
126
138
|
}
|
|
127
139
|
}
|
|
128
|
-
async observeFormLegacy() {
|
|
129
|
-
await this.handleUpdateFormLegacyConfig();
|
|
140
|
+
async observeFormLegacy(newValue, oldValue) {
|
|
141
|
+
await this.handleUpdateFormLegacyConfig(newValue, oldValue);
|
|
130
142
|
}
|
|
131
|
-
async observeGridLegacy() {
|
|
132
|
-
await this.handleUpdateGridLegacyConfig();
|
|
143
|
+
async observeGridLegacy(newValue, oldValue) {
|
|
144
|
+
await this.handleUpdateGridLegacyConfig(newValue, oldValue);
|
|
133
145
|
}
|
|
134
|
-
async handleUpdateGridLegacyConfig() {
|
|
135
|
-
if (
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
146
|
+
async handleUpdateGridLegacyConfig(newValue, oldValue) {
|
|
147
|
+
if (newValue == undefined || newValue == oldValue) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (!this._gridConfigAlreadyLoaded) {
|
|
151
|
+
return;
|
|
140
152
|
}
|
|
153
|
+
await this.loadGridConfig(true);
|
|
141
154
|
}
|
|
142
|
-
async handleUpdateFormLegacyConfig() {
|
|
143
|
-
|
|
144
|
-
if (!this.formLegacyConfigName) {
|
|
155
|
+
async handleUpdateFormLegacyConfig(newValue, oldValue) {
|
|
156
|
+
if (newValue == undefined || newValue == oldValue) {
|
|
145
157
|
return;
|
|
146
158
|
}
|
|
147
|
-
|
|
148
|
-
if (!legacyConfig)
|
|
159
|
+
if (!this._formConfigAlreadyLoaded) {
|
|
149
160
|
return;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const newConfig = { emptyConfig: false, fields: fields };
|
|
153
|
-
this.setFormConfig(newConfig, true);
|
|
154
|
-
const formConfigManager = this.getFormConfigManger();
|
|
155
|
-
formConfigManager.setConfig(this.formConfig);
|
|
156
|
-
}
|
|
157
|
-
async fetchFormLegacyConfig() {
|
|
158
|
-
const payload = {
|
|
159
|
-
'requestBody': {
|
|
160
|
-
'config': {
|
|
161
|
-
'chave': this.formLegacyConfigName,
|
|
162
|
-
'tipo': 'T',
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
|
-
};
|
|
166
|
-
return await this.application.callServiceBroker('SystemUtilsSP.getConf', JSON.stringify(payload));
|
|
161
|
+
}
|
|
162
|
+
this.loadFormConfig(true);
|
|
167
163
|
}
|
|
168
164
|
openConfig(viewMode) {
|
|
169
165
|
this._snkConfigurator.close();
|
|
@@ -194,12 +190,16 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
194
190
|
}
|
|
195
191
|
}
|
|
196
192
|
loadGridConfig(forceUpdate) {
|
|
193
|
+
if (this.configName === undefined) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
197
196
|
if ((this.gridConfig != undefined || this._gridConfigAlreadyLoaded) && !forceUpdate) {
|
|
198
197
|
return;
|
|
199
198
|
}
|
|
199
|
+
this.addGridLegacyConfigName();
|
|
200
200
|
this._gridConfigAlreadyLoaded = true;
|
|
201
201
|
return new Promise((accept, reject) => {
|
|
202
|
-
ConfigStorage.loadGridConfig(this.configName, this.
|
|
202
|
+
ConfigStorage.loadGridConfig(this.configName, this.resolveResourceID())
|
|
203
203
|
.then(config => {
|
|
204
204
|
this.setGridConfig(config);
|
|
205
205
|
accept();
|
|
@@ -209,20 +209,28 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
209
209
|
});
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
|
-
|
|
212
|
+
formConfigIsLoaded() {
|
|
213
|
+
return this.formConfig != undefined || this._formConfigAlreadyLoaded;
|
|
214
|
+
}
|
|
215
|
+
async loadFormConfig(forceLoad = false) {
|
|
216
|
+
if (this.configName === undefined) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
213
219
|
if (this._formConfigManager == undefined) {
|
|
214
|
-
this._formConfigManager = new SnkFormConfigManager(this.configName, this.
|
|
220
|
+
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
|
221
|
+
this._formConfigManager.setConfig(this.formConfig);
|
|
215
222
|
}
|
|
216
|
-
|
|
217
|
-
}
|
|
218
|
-
async loadFormConfig() {
|
|
219
|
-
const formConfigManager = this.getFormConfigManger();
|
|
220
|
-
formConfigManager.setConfig(this.formConfig);
|
|
221
|
-
if (this.formConfig != undefined || this._formConfigAlreadyLoaded) {
|
|
223
|
+
if (this.formConfigIsLoaded() && !forceLoad) {
|
|
222
224
|
return;
|
|
223
225
|
}
|
|
224
226
|
this._formConfigAlreadyLoaded = true;
|
|
225
|
-
this.
|
|
227
|
+
let loadedLegacyConfig = await this._formConfigFetcher.fetchLegacyConfigurableForm(this.formLegacyConfigName);
|
|
228
|
+
if (loadedLegacyConfig != undefined) {
|
|
229
|
+
this._formConfigManager.setConfig(loadedLegacyConfig);
|
|
230
|
+
this.setFormConfig(loadedLegacyConfig);
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
this.setFormConfig(await this._formConfigManager.loadConfig());
|
|
226
234
|
}
|
|
227
235
|
async componentWillRender() {
|
|
228
236
|
this._resourceID = await this.application.getResourceID();
|
|
@@ -477,7 +485,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
477
485
|
}
|
|
478
486
|
gridConfigChangeHandler(evt) {
|
|
479
487
|
const config = evt.detail;
|
|
480
|
-
ConfigStorage.saveGridConfig(config, this.configName, this.
|
|
488
|
+
ConfigStorage.saveGridConfig(config, this.configName, this.resolveResourceID());
|
|
481
489
|
evt.stopPropagation();
|
|
482
490
|
}
|
|
483
491
|
modalConfigChangeHandler(evt) {
|
|
@@ -508,6 +516,9 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
508
516
|
handleShowFormConfig() {
|
|
509
517
|
return this._showFormConfig && !this.formLegacyConfigName;
|
|
510
518
|
}
|
|
519
|
+
resolveResourceID() {
|
|
520
|
+
return StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
|
|
521
|
+
}
|
|
511
522
|
/* istanbul ignore next */
|
|
512
523
|
render() {
|
|
513
524
|
var _a, _b, _c;
|
|
@@ -516,10 +527,11 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
516
527
|
}
|
|
517
528
|
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)
|
|
518
529
|
? undefined
|
|
519
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: (_b = this._formConfigManager) === null || _b === void 0 ? void 0 : _b.getConfig((_c = this.dataState) === null || _c === void 0 ? void 0 : _c.insertionMode, this.dataUnit, this.ignoreReadOnlyFormFields), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.
|
|
530
|
+
: 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() }))));
|
|
520
531
|
}
|
|
521
532
|
get _element() { return this; }
|
|
522
533
|
static get watchers() { return {
|
|
534
|
+
"resourceID": ["handleResourceIDChanged"],
|
|
523
535
|
"mode": ["onModeChange"],
|
|
524
536
|
"dataState": ["observeDataState"],
|
|
525
537
|
"formLegacyConfigName": ["observeFormLegacy"],
|
|
@@ -534,6 +546,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
534
546
|
"formConfig": [16],
|
|
535
547
|
"multipleSelection": [4, "multiple-selection"],
|
|
536
548
|
"useCancelConfirm": [4, "use-cancel-confirm"],
|
|
549
|
+
"resourceID": [1, "resource-i-d"],
|
|
537
550
|
"taskbarManager": [16],
|
|
538
551
|
"messagesBuilder": [1040],
|
|
539
552
|
"useEnterLikeTab": [4, "use-enter-like-tab"],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as ResourceFetcher, F as FormConfigFetcher } from './form-config-fetcher-
|
|
1
|
+
import { R as ResourceFetcher, F as FormConfigFetcher } from './form-config-fetcher-765b8498.js';
|
|
2
2
|
import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
|
|
3
3
|
import { ObjectUtils } from '@sankhyalabs/core';
|
|
4
4
|
import { d as dist, D as DataFetcher } from './DataFetcher-a650ae58.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as ConfigStorage } from './ConfigStorage-
|
|
1
|
+
import { C as ConfigStorage } from './ConfigStorage-6e241cd7.js';
|
|
2
2
|
import { ObjectUtils, StringUtils } from '@sankhyalabs/core';
|
|
3
|
-
import { F as FormConfigFetcher } from './form-config-fetcher-
|
|
3
|
+
import { F as FormConfigFetcher } from './form-config-fetcher-765b8498.js';
|
|
4
4
|
|
|
5
5
|
class SnkFormConfigManager {
|
|
6
6
|
constructor(configName, resourceID, onConfigChange) {
|