@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
|
@@ -31,6 +31,8 @@ export class SnkTaskbar {
|
|
|
31
31
|
this._customElementsId = undefined;
|
|
32
32
|
this._slotContainer = undefined;
|
|
33
33
|
this._hiddenActionsList = [];
|
|
34
|
+
this._lastWidth = undefined;
|
|
35
|
+
this._hasToUpdateOverFlow = false;
|
|
34
36
|
this.alignRigth = false;
|
|
35
37
|
this.customSlotId = "TASKBAR_CUSTOM_ELEMENTS";
|
|
36
38
|
this.customContainerId = undefined;
|
|
@@ -56,6 +58,11 @@ export class SnkTaskbar {
|
|
|
56
58
|
var _a;
|
|
57
59
|
(_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.forceUpdate();
|
|
58
60
|
}
|
|
61
|
+
observeLastWidth(newValue, oldValue) {
|
|
62
|
+
if (oldValue === 0 && newValue !== 0) {
|
|
63
|
+
this._hasToUpdateOverFlow = true;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
59
66
|
// Internal methods
|
|
60
67
|
elementsFromString(strButtons) {
|
|
61
68
|
const elements = [];
|
|
@@ -239,10 +246,20 @@ export class SnkTaskbar {
|
|
|
239
246
|
this.getCustomElements();
|
|
240
247
|
}
|
|
241
248
|
componentWillRender() {
|
|
249
|
+
this.handleDefinitions();
|
|
250
|
+
this.validatePresentationMode();
|
|
251
|
+
this.updateOverFlowIfNeeded();
|
|
252
|
+
}
|
|
253
|
+
handleDefinitions() {
|
|
242
254
|
if (this._definitions == undefined && this._permissions) {
|
|
243
255
|
this._definitions = this.elementsFromString(this.buttons);
|
|
244
256
|
}
|
|
245
|
-
|
|
257
|
+
}
|
|
258
|
+
updateOverFlowIfNeeded() {
|
|
259
|
+
if (this._hasToUpdateOverFlow) {
|
|
260
|
+
requestAnimationFrame(() => { var _a; return (_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.forceUpdate(); });
|
|
261
|
+
this._hasToUpdateOverFlow = false;
|
|
262
|
+
}
|
|
246
263
|
}
|
|
247
264
|
handleOverFlow(overFlowingElements) {
|
|
248
265
|
const elementsToHandle = overFlowingElements.filter(element => !this.hasToIgnoreOverFlow(element));
|
|
@@ -309,6 +326,10 @@ export class SnkTaskbar {
|
|
|
309
326
|
}
|
|
310
327
|
componentDidRender() {
|
|
311
328
|
this.appendCustomElementsInTaskbar();
|
|
329
|
+
this.updateLastWidth();
|
|
330
|
+
}
|
|
331
|
+
updateLastWidth() {
|
|
332
|
+
this._lastWidth = this._element.getBoundingClientRect().width;
|
|
312
333
|
}
|
|
313
334
|
disconnectedCallback() {
|
|
314
335
|
var _a;
|
|
@@ -640,7 +661,9 @@ export class SnkTaskbar {
|
|
|
640
661
|
"_customElements": {},
|
|
641
662
|
"_customElementsId": {},
|
|
642
663
|
"_slotContainer": {},
|
|
643
|
-
"_hiddenActionsList": {}
|
|
664
|
+
"_hiddenActionsList": {},
|
|
665
|
+
"_lastWidth": {},
|
|
666
|
+
"_hasToUpdateOverFlow": {}
|
|
644
667
|
};
|
|
645
668
|
}
|
|
646
669
|
static get events() {
|
|
@@ -669,6 +692,9 @@ export class SnkTaskbar {
|
|
|
669
692
|
}, {
|
|
670
693
|
"propName": "disabledButtons",
|
|
671
694
|
"methodName": "observeDisabledButtons"
|
|
695
|
+
}, {
|
|
696
|
+
"propName": "_lastWidth",
|
|
697
|
+
"methodName": "observeLastWidth"
|
|
672
698
|
}];
|
|
673
699
|
}
|
|
674
700
|
}
|
|
@@ -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) {
|
|
@@ -98,16 +98,19 @@ class SnkFormConfigManager {
|
|
|
98
98
|
const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
|
|
99
99
|
return normalizedText.includes(normalizedFilter);
|
|
100
100
|
}
|
|
101
|
-
getInsertionConfig(dataUnit) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (
|
|
106
|
-
|
|
101
|
+
getInsertionConfig(dataUnit, ignoreReadOnlyFormFields) {
|
|
102
|
+
let fields = this.getFieldsList(dataUnit);
|
|
103
|
+
if (ignoreReadOnlyFormFields) {
|
|
104
|
+
fields = fields.filter(field => {
|
|
105
|
+
if (dataUnit) {
|
|
106
|
+
const def = dataUnit.getField(field.name);
|
|
107
|
+
if (def && def.readOnly) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
107
110
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
+
return !field.readOnly;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
111
114
|
return Object.assign(Object.assign({}, this._config), { fields });
|
|
112
115
|
}
|
|
113
116
|
setConfig(config) {
|
|
@@ -127,8 +130,8 @@ class SnkFormConfigManager {
|
|
|
127
130
|
this._onConfigChange(Object.assign({}, this._config));
|
|
128
131
|
}
|
|
129
132
|
}
|
|
130
|
-
getConfig(insertionMode, dataUnit) {
|
|
131
|
-
return insertionMode ? this.getInsertionConfig(dataUnit) : Object.assign({}, this._config);
|
|
133
|
+
getConfig(insertionMode, dataUnit, ignoreReadOnlyFormFields) {
|
|
134
|
+
return insertionMode ? this.getInsertionConfig(dataUnit, ignoreReadOnlyFormFields !== null && ignoreReadOnlyFormFields !== void 0 ? ignoreReadOnlyFormFields : true) : Object.assign({}, this._config);
|
|
132
135
|
}
|
|
133
136
|
getFormConfigFetcher() {
|
|
134
137
|
if (this._formConfigFetcher == undefined) {
|
|
@@ -230,6 +230,18 @@ class FormConfigFetcher extends ResourceFetcher {
|
|
|
230
230
|
}
|
|
231
231
|
return `cfg://${authority}/${resourceID}`;
|
|
232
232
|
}
|
|
233
|
+
async fetchLegacyConfigurableForm(configName) {
|
|
234
|
+
const payload = { 'requestBody': { 'config': { 'chave': configName, 'tipo': 'T' } } };
|
|
235
|
+
const response = await DataFetcher.get().callServiceBroker('SystemUtilsSP.getConf', JSON.stringify(payload));
|
|
236
|
+
if (ObjectUtils.isEmpty(response))
|
|
237
|
+
return undefined;
|
|
238
|
+
return this.buildLegacyConfigurableForm(response);
|
|
239
|
+
}
|
|
240
|
+
buildLegacyConfigurableForm(config) {
|
|
241
|
+
var _a, _b, _c;
|
|
242
|
+
const rawFields = (_c = (_b = (_a = config === null || config === void 0 ? void 0 : config.formConfig) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : [];
|
|
243
|
+
return { emptyConfig: false, fields: Array.isArray(rawFields) ? rawFields : [rawFields] };
|
|
244
|
+
}
|
|
233
245
|
}
|
|
234
246
|
var UserConfigType;
|
|
235
247
|
(function (UserConfigType) {
|
|
@@ -430,15 +430,12 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
430
430
|
}
|
|
431
431
|
this._showSnkFilterBar = true;
|
|
432
432
|
}
|
|
433
|
-
getConfig() {
|
|
434
|
-
return this._gridConfig == undefined ? undefined : Object.assign({}, this._gridConfig);
|
|
435
|
-
}
|
|
436
433
|
render() {
|
|
437
434
|
if (!this._dataUnit) {
|
|
438
435
|
return undefined;
|
|
439
436
|
}
|
|
440
437
|
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, this._showSnkFilterBar &&
|
|
441
|
-
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this.
|
|
438
|
+
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
|
442
439
|
}
|
|
443
440
|
get _element() { return this; }
|
|
444
441
|
static get watchers() { return {
|
|
@@ -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;
|
|
@@ -71,6 +73,17 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
71
73
|
this.showConfiguratorButtons = undefined;
|
|
72
74
|
this.gridLegacyConfigName = undefined;
|
|
73
75
|
this.formLegacyConfigName = undefined;
|
|
76
|
+
this.ignoreReadOnlyFormFields = false;
|
|
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);
|
|
74
87
|
}
|
|
75
88
|
getButtons(selected, changeModeBtn) {
|
|
76
89
|
return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
|
|
@@ -124,38 +137,29 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
124
137
|
this.dataStateChange.emit(newValue);
|
|
125
138
|
}
|
|
126
139
|
}
|
|
127
|
-
async observeFormLegacy() {
|
|
128
|
-
await this.handleUpdateFormLegacyConfig();
|
|
140
|
+
async observeFormLegacy(newValue, oldValue) {
|
|
141
|
+
await this.handleUpdateFormLegacyConfig(newValue, oldValue);
|
|
129
142
|
}
|
|
130
|
-
async observeGridLegacy() {
|
|
131
|
-
await this.handleUpdateGridLegacyConfig();
|
|
143
|
+
async observeGridLegacy(newValue, oldValue) {
|
|
144
|
+
await this.handleUpdateGridLegacyConfig(newValue, oldValue);
|
|
132
145
|
}
|
|
133
|
-
async handleUpdateGridLegacyConfig() {
|
|
134
|
-
if (
|
|
135
|
-
|
|
146
|
+
async handleUpdateGridLegacyConfig(newValue, oldValue) {
|
|
147
|
+
if (newValue == undefined || newValue == oldValue) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (!this._gridConfigAlreadyLoaded) {
|
|
151
|
+
return;
|
|
136
152
|
}
|
|
153
|
+
await this.loadGridConfig(true);
|
|
137
154
|
}
|
|
138
|
-
async handleUpdateFormLegacyConfig() {
|
|
139
|
-
if (
|
|
155
|
+
async handleUpdateFormLegacyConfig(newValue, oldValue) {
|
|
156
|
+
if (newValue == undefined || newValue == oldValue) {
|
|
140
157
|
return;
|
|
141
|
-
|
|
142
|
-
if (!
|
|
158
|
+
}
|
|
159
|
+
if (!this._formConfigAlreadyLoaded) {
|
|
143
160
|
return;
|
|
144
|
-
const legacyConfig = this.buildLegacyConfig(rawLegacyConfig);
|
|
145
|
-
this.setFormConfig(legacyConfig, true);
|
|
146
|
-
if (!this._formConfigManager) {
|
|
147
|
-
this._formConfigManager = new SnkFormConfigManager(this.configName, this._resourceID);
|
|
148
161
|
}
|
|
149
|
-
this.
|
|
150
|
-
}
|
|
151
|
-
buildLegacyConfig(config) {
|
|
152
|
-
var _a, _b, _c;
|
|
153
|
-
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 : [];
|
|
154
|
-
return { emptyConfig: false, fields: Array.isArray(rawFields) ? rawFields : [rawFields] };
|
|
155
|
-
}
|
|
156
|
-
async fetchFormLegacyConfig() {
|
|
157
|
-
const payload = { 'requestBody': { 'config': { 'chave': this.formLegacyConfigName, 'tipo': 'T' } } };
|
|
158
|
-
return await this.application.callServiceBroker('SystemUtilsSP.getConf', JSON.stringify(payload));
|
|
162
|
+
this.loadFormConfig(true);
|
|
159
163
|
}
|
|
160
164
|
openConfig(viewMode) {
|
|
161
165
|
this._snkConfigurator.close();
|
|
@@ -185,32 +189,61 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
185
189
|
ConfigStorage.addGridLegacyConfig(this.configName, this.gridLegacyConfigName);
|
|
186
190
|
}
|
|
187
191
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
192
|
+
loadGridConfig(forceUpdate) {
|
|
193
|
+
if (this.configName === undefined) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
if ((this.gridConfig != undefined || this._gridConfigAlreadyLoaded) && !forceUpdate) {
|
|
191
197
|
return;
|
|
192
|
-
|
|
198
|
+
}
|
|
199
|
+
this.addGridLegacyConfigName();
|
|
200
|
+
this._gridConfigAlreadyLoaded = true;
|
|
201
|
+
return new Promise((accept, reject) => {
|
|
202
|
+
ConfigStorage.loadGridConfig(this.configName, this.resolveResourceID())
|
|
203
|
+
.then(config => {
|
|
204
|
+
this.setGridConfig(config);
|
|
205
|
+
accept();
|
|
206
|
+
})
|
|
207
|
+
.catch(reason => {
|
|
208
|
+
reject(reason);
|
|
209
|
+
});
|
|
210
|
+
});
|
|
193
211
|
}
|
|
194
|
-
|
|
195
|
-
return this.
|
|
212
|
+
formConfigIsLoaded() {
|
|
213
|
+
return this.formConfig != undefined || this._formConfigAlreadyLoaded;
|
|
196
214
|
}
|
|
197
|
-
async loadFormConfig() {
|
|
198
|
-
if (this.
|
|
215
|
+
async loadFormConfig(forceLoad = false) {
|
|
216
|
+
if (this.configName === undefined) {
|
|
199
217
|
return;
|
|
200
|
-
|
|
201
|
-
this._formConfigManager
|
|
218
|
+
}
|
|
219
|
+
if (this._formConfigManager == undefined) {
|
|
220
|
+
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
|
221
|
+
this._formConfigManager.setConfig(this.formConfig);
|
|
222
|
+
}
|
|
223
|
+
if (this.formConfigIsLoaded() && !forceLoad) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
this._formConfigAlreadyLoaded = true;
|
|
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
|
+
}
|
|
202
233
|
this.setFormConfig(await this._formConfigManager.loadConfig());
|
|
203
234
|
}
|
|
204
|
-
isFormConfigLoaded() {
|
|
205
|
-
return (this._formConfigManager && this.formConfig);
|
|
206
|
-
}
|
|
207
235
|
async componentWillRender() {
|
|
208
236
|
this._resourceID = await this.application.getResourceID();
|
|
209
237
|
this._taskbarProcessor.process(this.getTaskBarId(), this.taskbarManager, this.dataState, this.getTaskBarDisabledButtons());
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
238
|
+
if (this.configName === undefined) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
if (this.gridConfig != undefined || this._gridConfigAlreadyLoaded) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
await this.addGridLegacyConfigName();
|
|
245
|
+
this.loadGridConfig();
|
|
246
|
+
this.loadFormConfig();
|
|
214
247
|
}
|
|
215
248
|
componentWillLoad() {
|
|
216
249
|
this.processMetadata();
|
|
@@ -452,7 +485,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
452
485
|
}
|
|
453
486
|
gridConfigChangeHandler(evt) {
|
|
454
487
|
const config = evt.detail;
|
|
455
|
-
ConfigStorage.saveGridConfig(config, this.configName, this.
|
|
488
|
+
ConfigStorage.saveGridConfig(config, this.configName, this.resolveResourceID());
|
|
456
489
|
evt.stopPropagation();
|
|
457
490
|
}
|
|
458
491
|
modalConfigChangeHandler(evt) {
|
|
@@ -483,6 +516,9 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
483
516
|
handleShowFormConfig() {
|
|
484
517
|
return this._showFormConfig && !this.formLegacyConfigName;
|
|
485
518
|
}
|
|
519
|
+
resolveResourceID() {
|
|
520
|
+
return StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
|
|
521
|
+
}
|
|
486
522
|
/* istanbul ignore next */
|
|
487
523
|
render() {
|
|
488
524
|
var _a, _b, _c;
|
|
@@ -491,10 +527,11 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
491
527
|
}
|
|
492
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)
|
|
493
529
|
? undefined
|
|
494
|
-
: 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.
|
|
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() }))));
|
|
495
531
|
}
|
|
496
532
|
get _element() { return this; }
|
|
497
533
|
static get watchers() { return {
|
|
534
|
+
"resourceID": ["handleResourceIDChanged"],
|
|
498
535
|
"mode": ["onModeChange"],
|
|
499
536
|
"dataState": ["observeDataState"],
|
|
500
537
|
"formLegacyConfigName": ["observeFormLegacy"],
|
|
@@ -509,6 +546,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
509
546
|
"formConfig": [16],
|
|
510
547
|
"multipleSelection": [4, "multiple-selection"],
|
|
511
548
|
"useCancelConfirm": [4, "use-cancel-confirm"],
|
|
549
|
+
"resourceID": [1, "resource-i-d"],
|
|
512
550
|
"taskbarManager": [16],
|
|
513
551
|
"messagesBuilder": [1040],
|
|
514
552
|
"useEnterLikeTab": [4, "use-enter-like-tab"],
|
|
@@ -517,6 +555,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
517
555
|
"showConfiguratorButtons": [4, "show-configurator-buttons"],
|
|
518
556
|
"gridLegacyConfigName": [1, "grid-legacy-config-name"],
|
|
519
557
|
"formLegacyConfigName": [1, "form-legacy-config-name"],
|
|
558
|
+
"ignoreReadOnlyFormFields": [4, "ignore-read-only-form-fields"],
|
|
520
559
|
"_showPopUpGridConfig": [32],
|
|
521
560
|
"_showFormConfig": [32],
|
|
522
561
|
"_currentViewMode": [32],
|
|
@@ -154,6 +154,8 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
154
154
|
this._customElementsId = undefined;
|
|
155
155
|
this._slotContainer = undefined;
|
|
156
156
|
this._hiddenActionsList = [];
|
|
157
|
+
this._lastWidth = undefined;
|
|
158
|
+
this._hasToUpdateOverFlow = false;
|
|
157
159
|
this.alignRigth = false;
|
|
158
160
|
this.customSlotId = "TASKBAR_CUSTOM_ELEMENTS";
|
|
159
161
|
this.customContainerId = undefined;
|
|
@@ -179,6 +181,11 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
179
181
|
var _a;
|
|
180
182
|
(_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.forceUpdate();
|
|
181
183
|
}
|
|
184
|
+
observeLastWidth(newValue, oldValue) {
|
|
185
|
+
if (oldValue === 0 && newValue !== 0) {
|
|
186
|
+
this._hasToUpdateOverFlow = true;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
182
189
|
// Internal methods
|
|
183
190
|
elementsFromString(strButtons) {
|
|
184
191
|
const elements = [];
|
|
@@ -362,10 +369,20 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
362
369
|
this.getCustomElements();
|
|
363
370
|
}
|
|
364
371
|
componentWillRender() {
|
|
372
|
+
this.handleDefinitions();
|
|
373
|
+
this.validatePresentationMode();
|
|
374
|
+
this.updateOverFlowIfNeeded();
|
|
375
|
+
}
|
|
376
|
+
handleDefinitions() {
|
|
365
377
|
if (this._definitions == undefined && this._permissions) {
|
|
366
378
|
this._definitions = this.elementsFromString(this.buttons);
|
|
367
379
|
}
|
|
368
|
-
|
|
380
|
+
}
|
|
381
|
+
updateOverFlowIfNeeded() {
|
|
382
|
+
if (this._hasToUpdateOverFlow) {
|
|
383
|
+
requestAnimationFrame(() => { var _a; return (_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.forceUpdate(); });
|
|
384
|
+
this._hasToUpdateOverFlow = false;
|
|
385
|
+
}
|
|
369
386
|
}
|
|
370
387
|
handleOverFlow(overFlowingElements) {
|
|
371
388
|
const elementsToHandle = overFlowingElements.filter(element => !this.hasToIgnoreOverFlow(element));
|
|
@@ -432,6 +449,10 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
432
449
|
}
|
|
433
450
|
componentDidRender() {
|
|
434
451
|
this.appendCustomElementsInTaskbar();
|
|
452
|
+
this.updateLastWidth();
|
|
453
|
+
}
|
|
454
|
+
updateLastWidth() {
|
|
455
|
+
this._lastWidth = this._element.getBoundingClientRect().width;
|
|
435
456
|
}
|
|
436
457
|
disconnectedCallback() {
|
|
437
458
|
var _a;
|
|
@@ -478,7 +499,8 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
478
499
|
get _element() { return this; }
|
|
479
500
|
static get watchers() { return {
|
|
480
501
|
"buttons": ["observeButtons"],
|
|
481
|
-
"disabledButtons": ["observeDisabledButtons"]
|
|
502
|
+
"disabledButtons": ["observeDisabledButtons"],
|
|
503
|
+
"_lastWidth": ["observeLastWidth"]
|
|
482
504
|
}; }
|
|
483
505
|
static get style() { return snkTaskbarCss; }
|
|
484
506
|
}, [6, "snk-taskbar", {
|
|
@@ -501,7 +523,9 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
501
523
|
"_customElements": [32],
|
|
502
524
|
"_customElementsId": [32],
|
|
503
525
|
"_slotContainer": [32],
|
|
504
|
-
"_hiddenActionsList": [32]
|
|
526
|
+
"_hiddenActionsList": [32],
|
|
527
|
+
"_lastWidth": [32],
|
|
528
|
+
"_hasToUpdateOverFlow": [32]
|
|
505
529
|
}]);
|
|
506
530
|
function defineCustomElement() {
|
|
507
531
|
if (typeof customElements === "undefined") {
|
|
@@ -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) {
|
|
@@ -98,16 +98,19 @@ class SnkFormConfigManager {
|
|
|
98
98
|
const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
|
|
99
99
|
return normalizedText.includes(normalizedFilter);
|
|
100
100
|
}
|
|
101
|
-
getInsertionConfig(dataUnit) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (
|
|
106
|
-
|
|
101
|
+
getInsertionConfig(dataUnit, ignoreReadOnlyFormFields) {
|
|
102
|
+
let fields = this.getFieldsList(dataUnit);
|
|
103
|
+
if (ignoreReadOnlyFormFields) {
|
|
104
|
+
fields = fields.filter(field => {
|
|
105
|
+
if (dataUnit) {
|
|
106
|
+
const def = dataUnit.getField(field.name);
|
|
107
|
+
if (def && def.readOnly) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
107
110
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
+
return !field.readOnly;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
111
114
|
return Object.assign(Object.assign({}, this._config), { fields });
|
|
112
115
|
}
|
|
113
116
|
setConfig(config) {
|
|
@@ -127,8 +130,8 @@ class SnkFormConfigManager {
|
|
|
127
130
|
this._onConfigChange(Object.assign({}, this._config));
|
|
128
131
|
}
|
|
129
132
|
}
|
|
130
|
-
getConfig(insertionMode, dataUnit) {
|
|
131
|
-
return insertionMode ? this.getInsertionConfig(dataUnit) : Object.assign({}, this._config);
|
|
133
|
+
getConfig(insertionMode, dataUnit, ignoreReadOnlyFormFields) {
|
|
134
|
+
return insertionMode ? this.getInsertionConfig(dataUnit, ignoreReadOnlyFormFields !== null && ignoreReadOnlyFormFields !== void 0 ? ignoreReadOnlyFormFields : true) : Object.assign({}, this._config);
|
|
132
135
|
}
|
|
133
136
|
getFormConfigFetcher() {
|
|
134
137
|
if (this._formConfigFetcher == undefined) {
|
|
@@ -6,7 +6,7 @@ import './ISave-d8c8bc59.js';
|
|
|
6
6
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
7
7
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
8
8
|
import './filter-item-type.enum-d45e026f.js';
|
|
9
|
-
import './form-config-fetcher-
|
|
9
|
+
import './form-config-fetcher-765b8498.js';
|
|
10
10
|
import InMemoryFilterColumnDataSource from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
|
|
11
11
|
|
|
12
12
|
class CrudUtils {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ObjectUtils } from '@sankhyalabs/core';
|
|
2
|
-
import { R as ResourceFetcher } from './form-config-fetcher-
|
|
2
|
+
import { R as ResourceFetcher } from './form-config-fetcher-765b8498.js';
|
|
3
3
|
|
|
4
4
|
class AuthFetcher extends ResourceFetcher {
|
|
5
5
|
getData(resourceID) {
|
|
@@ -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) {
|