@sankhyalabs/sankhyablocks 8.16.0-dev.1 → 8.16.0-dev.10
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-942ce74b.js → ConfigStorage-a343e418.js} +1 -0
- package/dist/cjs/{IExporterProvider-c78cb1b8.js → IExporterProvider-597949f9.js} +1 -1
- package/dist/cjs/{SnkFormConfigManager-1b13bacd.js → SnkFormConfigManager-166cbd1f.js} +6 -8
- package/dist/cjs/{SnkMessageBuilder-722b104e.js → SnkMessageBuilder-897ffd08.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-620b29a1.js → dataunit-fetcher-688d3f05.js} +8 -3
- 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 +1 -1
- package/dist/cjs/snk-crud.cjs.entry.js +7 -2
- package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
- package/dist/cjs/{snk-data-unit-82dea87e.js → snk-data-unit-8fa7917a.js} +17 -7
- package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
- package/dist/cjs/snk-detail-view.cjs.entry.js +6 -7
- package/dist/cjs/snk-filter-bar.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +1 -1
- package/dist/cjs/snk-form-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-form.cjs.entry.js +2 -2
- package/dist/cjs/snk-grid.cjs.entry.js +3 -3
- package/dist/cjs/{snk-guides-viewer-05a1ba27.js → snk-guides-viewer-9c682034.js} +9 -4
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +4 -4
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +8 -7
- package/dist/collection/components/snk-crud/snk-crud.js +57 -1
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +1 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +22 -2
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +32 -5
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +5 -7
- package/dist/collection/components/snk-form-config/snk-form-config.js +1 -1
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +21 -3
- package/dist/collection/lib/configs/ConfigStorage.js +1 -0
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +1 -0
- package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +7 -3
- package/dist/collection/lib/message/resources/snk-data-unit.msg.js +1 -1
- package/dist/components/ConfigStorage.js +1 -0
- package/dist/components/SnkFormConfigManager.js +5 -7
- package/dist/components/SnkMessageBuilder.js +1 -1
- package/dist/components/dataunit-fetcher.js +8 -3
- package/dist/components/snk-crud.js +8 -1
- package/dist/components/snk-data-unit2.js +16 -5
- package/dist/components/snk-detail-view2.js +9 -4
- package/dist/components/snk-form-config2.js +1 -1
- package/dist/components/snk-simple-crud2.js +5 -3
- package/dist/esm/{ConfigStorage-86187da3.js → ConfigStorage-3806514e.js} +1 -0
- package/dist/esm/{IExporterProvider-343272b3.js → IExporterProvider-63a188b6.js} +1 -1
- package/dist/esm/{SnkFormConfigManager-d4554df9.js → SnkFormConfigManager-31b24066.js} +6 -8
- package/dist/esm/{SnkMessageBuilder-89925609.js → SnkMessageBuilder-571462fb.js} +1 -1
- package/dist/esm/{dataunit-fetcher-3fbf9d12.js → dataunit-fetcher-264191b2.js} +8 -3
- 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 +1 -1
- package/dist/esm/snk-crud.entry.js +7 -2
- package/dist/esm/snk-data-exporter.entry.js +3 -3
- package/dist/esm/{snk-data-unit-8f98b45f.js → snk-data-unit-f5cbe64b.js} +17 -7
- package/dist/esm/snk-data-unit.entry.js +3 -3
- package/dist/esm/snk-detail-view.entry.js +6 -7
- package/dist/esm/snk-filter-bar.entry.js +1 -1
- package/dist/esm/snk-filter-modal-item.entry.js +1 -1
- package/dist/esm/snk-form-config.entry.js +1 -1
- package/dist/esm/snk-form.entry.js +2 -2
- package/dist/esm/snk-grid.entry.js +3 -3
- package/dist/esm/{snk-guides-viewer-aee2cafe.js → snk-guides-viewer-8f6960a2.js} +9 -4
- package/dist/esm/snk-guides-viewer.entry.js +4 -4
- package/dist/esm/snk-personalized-filter.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +8 -7
- package/dist/sankhyablocks/p-17def7cd.js +1 -0
- package/dist/sankhyablocks/p-28ee0972.js +1 -0
- package/dist/sankhyablocks/p-2a408684.js +1 -0
- package/dist/sankhyablocks/{p-eae7a817.entry.js → p-2c68b3ae.entry.js} +1 -1
- package/dist/sankhyablocks/{p-9e99a92a.js → p-3a212712.js} +1 -1
- package/dist/sankhyablocks/p-450c60e4.entry.js +1 -0
- package/dist/sankhyablocks/{p-a1d72395.entry.js → p-47db7e88.entry.js} +1 -1
- package/dist/sankhyablocks/{p-4f72727a.entry.js → p-4e5e1313.entry.js} +1 -1
- package/dist/sankhyablocks/{p-aff76a53.js → p-52920496.js} +1 -1
- package/dist/sankhyablocks/{p-8fc470e5.entry.js → p-62ba211a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-44767378.entry.js → p-6bb2f3e9.entry.js} +1 -1
- package/dist/sankhyablocks/{p-2d649237.entry.js → p-7505da04.entry.js} +1 -1
- package/dist/sankhyablocks/{p-e95b3b93.entry.js → p-7619bdb1.entry.js} +1 -1
- package/dist/sankhyablocks/{p-8a5910a7.entry.js → p-7a85fd49.entry.js} +1 -1
- package/dist/sankhyablocks/p-7ef9c55c.js +1 -0
- package/dist/sankhyablocks/p-80042dc6.entry.js +1 -0
- package/dist/sankhyablocks/{p-5539ecb4.entry.js → p-8c59edd7.entry.js} +1 -1
- package/dist/sankhyablocks/p-9606509c.entry.js +1 -0
- package/dist/sankhyablocks/p-ae93d46a.entry.js +1 -0
- package/dist/sankhyablocks/{p-47b60deb.entry.js → p-d6e26ea8.entry.js} +1 -1
- package/dist/sankhyablocks/{p-26394a01.entry.js → p-f4450320.entry.js} +1 -1
- package/dist/sankhyablocks/{p-672302c3.js → p-fe79f83a.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-crud/snk-crud.d.ts +9 -0
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +5 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +5 -0
- package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +2 -2
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +4 -0
- package/dist/types/components.d.ts +41 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-0d91b10f.entry.js +0 -1
- package/dist/sankhyablocks/p-14a08904.entry.js +0 -1
- package/dist/sankhyablocks/p-550fee49.entry.js +0 -1
- package/dist/sankhyablocks/p-7a337364.js +0 -1
- package/dist/sankhyablocks/p-829d4045.js +0 -1
- package/dist/sankhyablocks/p-8cc64963.entry.js +0 -1
- package/dist/sankhyablocks/p-be603a24.js +0 -1
- package/dist/sankhyablocks/p-d09feef1.js +0 -1
@@ -56,6 +56,7 @@ export class SnkSimpleCrud {
|
|
56
56
|
this.formLegacyConfigName = undefined;
|
57
57
|
this.ignoreReadOnlyFormFields = false;
|
58
58
|
this.autoFocus = true;
|
59
|
+
this.domainMessagesBuilder = undefined;
|
59
60
|
this.autoLoad = undefined;
|
60
61
|
}
|
61
62
|
/**
|
@@ -672,8 +673,8 @@ export class SnkSimpleCrud {
|
|
672
673
|
return StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
|
673
674
|
}
|
674
675
|
getFormConfig() {
|
675
|
-
var _a
|
676
|
-
const configFromManager = (_a = this._formConfigManager) === null || _a === void 0 ? void 0 : _a.getConfig(
|
676
|
+
var _a;
|
677
|
+
const configFromManager = (_a = this._formConfigManager) === null || _a === void 0 ? void 0 : _a.getConfig(this.dataUnit, this.ignoreReadOnlyFormFields);
|
677
678
|
if (!this.configName && !configFromManager) {
|
678
679
|
return this.formConfig;
|
679
680
|
}
|
@@ -693,7 +694,7 @@ export class SnkSimpleCrud {
|
|
693
694
|
if (this.dataUnit == undefined) {
|
694
695
|
return;
|
695
696
|
}
|
696
|
-
return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), 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, onDataUnitFieldsHidded: this.updateFormConfig.bind(this) }, 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, "data-exporter-store-key": this.getDataExporterStoreKey(), 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)
|
697
|
+
return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), 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, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, 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, "data-exporter-store-key": this.getDataExporterStoreKey(), 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)
|
697
698
|
? undefined
|
698
699
|
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), 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() }))));
|
699
700
|
}
|
@@ -1086,6 +1087,23 @@ export class SnkSimpleCrud {
|
|
1086
1087
|
"reflect": false,
|
1087
1088
|
"defaultValue": "true"
|
1088
1089
|
},
|
1090
|
+
"domainMessagesBuilder": {
|
1091
|
+
"type": "string",
|
1092
|
+
"mutable": false,
|
1093
|
+
"complexType": {
|
1094
|
+
"original": "string",
|
1095
|
+
"resolved": "string",
|
1096
|
+
"references": {}
|
1097
|
+
},
|
1098
|
+
"required": false,
|
1099
|
+
"optional": false,
|
1100
|
+
"docs": {
|
1101
|
+
"tags": [],
|
1102
|
+
"text": "Define a chave customizada para sobrescrever as mensagens (N\u00E3o pegando pela entidade)"
|
1103
|
+
},
|
1104
|
+
"attribute": "domain-messages-builder",
|
1105
|
+
"reflect": false
|
1106
|
+
},
|
1089
1107
|
"autoLoad": {
|
1090
1108
|
"type": "boolean",
|
1091
1109
|
"mutable": false,
|
@@ -71,6 +71,7 @@ export class ConfigStorage {
|
|
71
71
|
if (config == undefined) {
|
72
72
|
return;
|
73
73
|
}
|
74
|
+
name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.grid);
|
74
75
|
await this.deleteGridConfigCache(name, resourceID);
|
75
76
|
return this.gridConfigFetcher.saveConfig(config, name, resourceID);
|
76
77
|
}
|
@@ -5,6 +5,7 @@ export default class InMemoryLoader {
|
|
5
5
|
this.metadata = metadata;
|
6
6
|
this.records = records;
|
7
7
|
this._dataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
|
8
|
+
this._dataUnit.pageSize = 150;
|
8
9
|
this._dataUnit.metadataLoader = () => this.metadaLoader();
|
9
10
|
this._dataUnit.dataLoader = (dataUnit, request) => this.inMemoryLoader(dataUnit, request, this.getRecordsToLoad());
|
10
11
|
this._dataUnit.saveLoader = (_dataUnit, changes) => this.saveLoader(_dataUnit, changes);
|
@@ -22,12 +22,16 @@ export function applySorting(records, dataUnit, sorting) {
|
|
22
22
|
return records.sort(sortingFunction);
|
23
23
|
}
|
24
24
|
export function buildPaginationInfo(records, offset = 0, limit = 0) {
|
25
|
-
|
25
|
+
if (records === undefined) {
|
26
|
+
return undefined;
|
27
|
+
}
|
28
|
+
const total = (records === null || records === void 0 ? void 0 : records.length) || 0;
|
29
|
+
const lastRecord = Math.min(offset + limit, total);
|
26
30
|
return {
|
27
31
|
currentPage: limit === 0 ? 0 : Math.ceil(offset / limit),
|
28
32
|
firstRecord: offset,
|
29
33
|
lastRecord: lastRecord,
|
30
|
-
total:
|
31
|
-
hasMore: !!(
|
34
|
+
total: total,
|
35
|
+
hasMore: !!(total - lastRecord),
|
32
36
|
};
|
33
37
|
}
|
@@ -423,6 +423,7 @@ class ConfigStorage {
|
|
423
423
|
if (config == undefined) {
|
424
424
|
return;
|
425
425
|
}
|
426
|
+
name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.grid);
|
426
427
|
await this.deleteGridConfigCache(name, resourceID);
|
427
428
|
return this.gridConfigFetcher.saveConfig(config, name, resourceID);
|
428
429
|
}
|
@@ -74,10 +74,8 @@ class SnkFormConfigManager {
|
|
74
74
|
if (fields != undefined && fields.length > 0) {
|
75
75
|
return fields.map(({ label, name, readOnly, visible, required }) => {
|
76
76
|
if (label == undefined) {
|
77
|
-
|
78
|
-
|
79
|
-
visible,
|
80
|
-
required });
|
77
|
+
const currentField = dataUnit.getField(name);
|
78
|
+
return Object.assign(Object.assign({}, currentField), { name: name !== null && name !== void 0 ? name : currentField.name, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : currentField.readOnly, visible: visible !== null && visible !== void 0 ? visible : currentField.visible, required: required !== null && required !== void 0 ? required : currentField.required });
|
81
79
|
}
|
82
80
|
return { name, label, readOnly, visible, required };
|
83
81
|
})
|
@@ -101,7 +99,7 @@ class SnkFormConfigManager {
|
|
101
99
|
const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
|
102
100
|
return normalizedText.includes(normalizedFilter);
|
103
101
|
}
|
104
|
-
|
102
|
+
getFormConfig(dataUnit, ignoreReadOnlyFormFields) {
|
105
103
|
let fields = this.getFieldsList(dataUnit);
|
106
104
|
if (ignoreReadOnlyFormFields) {
|
107
105
|
fields = fields.filter(field => {
|
@@ -133,8 +131,8 @@ class SnkFormConfigManager {
|
|
133
131
|
this._onConfigChange(Object.assign({}, this._config));
|
134
132
|
}
|
135
133
|
}
|
136
|
-
getConfig(
|
137
|
-
return
|
134
|
+
getConfig(dataUnit, ignoreReadOnlyFormFields) {
|
135
|
+
return this.getFormConfig(dataUnit, ignoreReadOnlyFormFields !== null && ignoreReadOnlyFormFields !== void 0 ? ignoreReadOnlyFormFields : true);
|
138
136
|
}
|
139
137
|
getFormConfigFetcher() {
|
140
138
|
if (this._formConfigFetcher == undefined) {
|
@@ -246,13 +246,17 @@ function applySorting(records, dataUnit, sorting) {
|
|
246
246
|
return records.sort(sortingFunction);
|
247
247
|
}
|
248
248
|
function buildPaginationInfo(records, offset = 0, limit = 0) {
|
249
|
-
|
249
|
+
if (records === undefined) {
|
250
|
+
return undefined;
|
251
|
+
}
|
252
|
+
const total = (records === null || records === void 0 ? void 0 : records.length) || 0;
|
253
|
+
const lastRecord = Math.min(offset + limit, total);
|
250
254
|
return {
|
251
255
|
currentPage: limit === 0 ? 0 : Math.ceil(offset / limit),
|
252
256
|
firstRecord: offset,
|
253
257
|
lastRecord: lastRecord,
|
254
|
-
total:
|
255
|
-
hasMore: !!(
|
258
|
+
total: total,
|
259
|
+
hasMore: !!(total - lastRecord),
|
256
260
|
};
|
257
261
|
}
|
258
262
|
|
@@ -261,6 +265,7 @@ class InMemoryLoader {
|
|
261
265
|
this.metadata = metadata;
|
262
266
|
this.records = records;
|
263
267
|
this._dataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
|
268
|
+
this._dataUnit.pageSize = 150;
|
264
269
|
this._dataUnit.metadataLoader = () => this.metadaLoader();
|
265
270
|
this._dataUnit.dataLoader = (dataUnit, request) => this.inMemoryLoader(dataUnit, request, this.getRecordsToLoad());
|
266
271
|
this._dataUnit.saveLoader = (_dataUnit, changes) => this.saveLoader(_dataUnit, changes);
|
@@ -51,6 +51,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
51
51
|
this.configuratorSave = createEvent(this, "configuratorSave", 7);
|
52
52
|
this.configuratorCancel = createEvent(this, "configuratorCancel", 7);
|
53
53
|
this.formItemsReady = createEvent(this, "formItemsReady", 7);
|
54
|
+
this.viewModeChanged = createEvent(this, "viewModeChanged", 7);
|
54
55
|
this._keyDownHandler = async (event) => this.keyDownListener(event);
|
55
56
|
this._viewHistory = [];
|
56
57
|
this._customEditors = new Map();
|
@@ -79,6 +80,8 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
79
80
|
this.disablePersonalizedFilter = undefined;
|
80
81
|
this.autoLoad = undefined;
|
81
82
|
this.autoFocus = true;
|
83
|
+
this.domainMessagesBuilder = undefined;
|
84
|
+
this.setCustomFormTitle = undefined;
|
82
85
|
this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
|
83
86
|
}
|
84
87
|
/**
|
@@ -187,6 +190,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
187
190
|
else if (viewMode === VIEW_MODE.FORM) {
|
188
191
|
this._guidesViewer.setFocus();
|
189
192
|
}
|
193
|
+
this.viewModeChanged.emit(viewMode);
|
190
194
|
}
|
191
195
|
openConfig(viewMode) {
|
192
196
|
this._snkConfigurator.close();
|
@@ -250,6 +254,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
250
254
|
this._snkDataUnit = parent;
|
251
255
|
this._snkDataUnit.addEventListener("insertionMode", () => this.insertionModeHandler());
|
252
256
|
this._snkDataUnit.addEventListener("cancelEdition", () => this.cancelHandler());
|
257
|
+
this._snkDataUnit.domainMessagesBuilder = this.domainMessagesBuilder;
|
253
258
|
this._dataUnit = this._snkDataUnit.dataUnit;
|
254
259
|
this._dataState = this._snkDataUnit.dataState;
|
255
260
|
if (!this._dataUnit) {
|
@@ -415,7 +420,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
415
420
|
return;
|
416
421
|
}
|
417
422
|
this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
|
418
|
-
return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, autoFocus: this.autoFocus }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
|
423
|
+
return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, autoFocus: this.autoFocus }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName, getCustomTitle: this.setCustomFormTitle }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
|
419
424
|
}
|
420
425
|
get _element() { return this; }
|
421
426
|
static get watchers() { return {
|
@@ -441,6 +446,8 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
441
446
|
"disablePersonalizedFilter": [4, "disable-personalized-filter"],
|
442
447
|
"autoLoad": [4, "auto-load"],
|
443
448
|
"autoFocus": [4, "auto-focus"],
|
449
|
+
"domainMessagesBuilder": [1, "domain-messages-builder"],
|
450
|
+
"setCustomFormTitle": [16],
|
444
451
|
"_dataUnit": [32],
|
445
452
|
"_dataState": [32],
|
446
453
|
"attachmentRegisterKey": [32],
|
@@ -97,6 +97,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
97
97
|
this.ignoreSaveMessage = undefined;
|
98
98
|
this.configName = undefined;
|
99
99
|
this.resourceID = undefined;
|
100
|
+
this.domainMessagesBuilder = undefined;
|
100
101
|
}
|
101
102
|
observePageSize() {
|
102
103
|
if (this.dataUnit) {
|
@@ -513,7 +514,8 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
513
514
|
if (this.ignoreSaveMessage) {
|
514
515
|
return;
|
515
516
|
}
|
516
|
-
const
|
517
|
+
const saveOperation = action.payload.changes[0]._operation.toLowerCase();
|
518
|
+
const msg = this.getMessage("snkDataUnit.saveInfo", action.payload.records[0], saveOperation);
|
517
519
|
if (msg != undefined) {
|
518
520
|
this.showSuccessMessage(msg);
|
519
521
|
}
|
@@ -544,10 +546,13 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
544
546
|
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
545
547
|
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-data-unit.msg.ts"
|
546
548
|
*/
|
547
|
-
getMessage(key, params = undefined) {
|
549
|
+
getMessage(key, params = undefined, customOperation) {
|
548
550
|
if (!params) {
|
549
551
|
params = this.getMessageParams();
|
550
552
|
}
|
553
|
+
if (customOperation) {
|
554
|
+
this.messagesBuilder.currentOperation = customOperation;
|
555
|
+
}
|
551
556
|
return this.messagesBuilder.getMessage(key, params);
|
552
557
|
}
|
553
558
|
getMessageParams() {
|
@@ -654,6 +659,13 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
654
659
|
parent = parent.parentElement;
|
655
660
|
}
|
656
661
|
}
|
662
|
+
instanceMessagesBuilder() {
|
663
|
+
var _a;
|
664
|
+
if (this.messagesBuilder) {
|
665
|
+
return;
|
666
|
+
}
|
667
|
+
this.messagesBuilder = new SnkMessageBuilder((_a = this.domainMessagesBuilder) !== null && _a !== void 0 ? _a : this.entityName);
|
668
|
+
}
|
657
669
|
//---------------------------------------------
|
658
670
|
// Lifecycle web component
|
659
671
|
//---------------------------------------------
|
@@ -661,9 +673,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
661
673
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
662
674
|
this._application.getAllAccess(this.resourceID).then(access => this._permissions = access);
|
663
675
|
this._parentSnkDataUnit = this.getParentSnkDataUnit();
|
664
|
-
|
665
|
-
this.messagesBuilder = new SnkMessageBuilder(this.entityName);
|
666
|
-
}
|
676
|
+
this.instanceMessagesBuilder();
|
667
677
|
}
|
668
678
|
disconnectedCallback() {
|
669
679
|
if (this.dataUnit) {
|
@@ -699,6 +709,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
699
709
|
"ignoreSaveMessage": [4, "ignore-save-message"],
|
700
710
|
"configName": [1, "config-name"],
|
701
711
|
"resourceID": [1, "resource-i-d"],
|
712
|
+
"domainMessagesBuilder": [1, "domain-messages-builder"],
|
702
713
|
"fieldsToLink": [32],
|
703
714
|
"getDataUnit": [64],
|
704
715
|
"getSelectedRecordsIDsInfo": [64],
|
@@ -70,6 +70,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
70
70
|
this.resourceID = undefined;
|
71
71
|
this.detailTaskbarCustomContainerId = undefined;
|
72
72
|
this.formLegacyConfigName = undefined;
|
73
|
+
this.getCustomTitle = undefined;
|
73
74
|
this._hasToCreateFieldSearch = true;
|
74
75
|
this._breadcrumbItems = [];
|
75
76
|
this._guides = undefined;
|
@@ -156,7 +157,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
156
157
|
}
|
157
158
|
onContentCardChanged(evt) {
|
158
159
|
SnkGuidesViewer.updateContentCard(evt.detail.formName, evt.detail.cardConfig, evt.detail.propertyChanged, this._configManager)
|
159
|
-
.then(() => this.masterFormConfig = this._configManager.getConfig(this.
|
160
|
+
.then(() => this.masterFormConfig = this._configManager.getConfig(this.dataUnit));
|
160
161
|
}
|
161
162
|
/**
|
162
163
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
@@ -507,6 +508,10 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
507
508
|
}
|
508
509
|
return "";
|
509
510
|
}
|
511
|
+
getTitle() {
|
512
|
+
var _a, _b;
|
513
|
+
return (_b = (_a = this.getCustomTitle) === null || _a === void 0 ? void 0 : _a.call(this)) !== null && _b !== void 0 ? _b : this.getMessage("snkCrud.title");
|
514
|
+
}
|
510
515
|
componentDidLoad() {
|
511
516
|
this.dataUnit.subscribe(this.dataUnitActionHandler.bind(this));
|
512
517
|
}
|
@@ -520,7 +525,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
520
525
|
}
|
521
526
|
this.loadTaskbarProcessor();
|
522
527
|
const showGuides = this._guides && (this._guides.length > 1);
|
523
|
-
return (h("section", { class: "snk-guides-viewer", ref: ref => this._container = ref, tabindex: -1 }, h("div", { class: "ez-row snk-guides-viewer__header" }, h("div", { class: "snk-guides-viewer__header-breadcrumb ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large", key: "header" }, h("ez-button", { onClick: () => this.exitViewer(), title: this.getMessage("snkCrud.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small" }), h("div", { class: "ez-flex ez-flex--column ez-flex-item--auto" }, h("h1", { class: "ez-title ez-title--primary ez-title--xlarge" }, this.
|
528
|
+
return (h("section", { class: "snk-guides-viewer", ref: ref => this._container = ref, tabindex: -1 }, h("div", { class: "ez-row snk-guides-viewer__header" }, h("div", { class: "snk-guides-viewer__header-breadcrumb ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large", key: "header" }, h("ez-button", { onClick: () => this.exitViewer(), title: this.getMessage("snkCrud.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small" }), h("div", { class: "ez-flex ez-flex--column ez-flex-item--auto" }, h("h1", { class: "ez-title ez-title--primary ez-title--xlarge" }, this.getTitle()), ((_a = this._breadcrumbItems) === null || _a === void 0 ? void 0 : _a.length) > 1 &&
|
524
529
|
h("div", { class: "ez-margin-top--extra-small" }, h("ez-breadcrumb", Object.assign({ items: this._breadcrumbItems, onSelectedItem: (evt) => this.onBreadcrumbClickHandler(evt === null || evt === void 0 ? void 0 : evt.detail) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("breadcrumb")}` }))))), this.presentationMode != PresentationMode.SECONDARY && this.buildTaskBar()), h("div", { class: "snk-guides-viewer__container" }, showGuides ?
|
525
530
|
h("ez-guide-navigator", { ref: (ref) => this._guideNavigator = ref, class: "snk-guides-viewer__guide-navigator", items: this._guides, selectedId: this.selectedGuide ? this.selectedGuide.id : undefined, onEzSelectionChange: evt => this.updateSelectedGuideHandler(evt.detail) })
|
526
531
|
:
|
@@ -558,6 +563,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
558
563
|
"resourceID": [1, "resource-i-d"],
|
559
564
|
"detailTaskbarCustomContainerId": [1, "detail-taskbar-custom-container-id"],
|
560
565
|
"formLegacyConfigName": [1, "form-legacy-config-name"],
|
566
|
+
"getCustomTitle": [16],
|
561
567
|
"_hasToCreateFieldSearch": [32],
|
562
568
|
"_breadcrumbItems": [32],
|
563
569
|
"_guides": [32],
|
@@ -938,14 +944,13 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
938
944
|
return guideId.replace(SnkDetailView.REGEX_FORM_ID, "");
|
939
945
|
}
|
940
946
|
loadMetadata() {
|
941
|
-
var _a;
|
942
947
|
if (!this.dataUnit) {
|
943
948
|
return;
|
944
949
|
}
|
945
950
|
if (!this.formConfigManager.isLoaded) {
|
946
951
|
return;
|
947
952
|
}
|
948
|
-
const formConfig = this.formConfigManager.getConfig(
|
953
|
+
const formConfig = this.formConfigManager.getConfig(this.dataUnit);
|
949
954
|
//this._cardsState = formConfig?.cardsState;
|
950
955
|
this._formMetadata = buildFormMetadata(formConfig == undefined || formConfig.fields.length === 0 ? undefined : formConfig, this.dataUnit, true);
|
951
956
|
}
|
@@ -76,7 +76,7 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
76
76
|
}
|
77
77
|
}
|
78
78
|
getConfig() {
|
79
|
-
let config = this.configManager.getConfig(
|
79
|
+
let config = this.configManager.getConfig(this.dataUnit);
|
80
80
|
if (config.fields && config.fields.length === 0) {
|
81
81
|
config = undefined;
|
82
82
|
}
|
@@ -138,6 +138,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
138
138
|
this.formLegacyConfigName = undefined;
|
139
139
|
this.ignoreReadOnlyFormFields = false;
|
140
140
|
this.autoFocus = true;
|
141
|
+
this.domainMessagesBuilder = undefined;
|
141
142
|
this.autoLoad = undefined;
|
142
143
|
}
|
143
144
|
/**
|
@@ -753,8 +754,8 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
753
754
|
return StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
|
754
755
|
}
|
755
756
|
getFormConfig() {
|
756
|
-
var _a
|
757
|
-
const configFromManager = (_a = this._formConfigManager) === null || _a === void 0 ? void 0 : _a.getConfig(
|
757
|
+
var _a;
|
758
|
+
const configFromManager = (_a = this._formConfigManager) === null || _a === void 0 ? void 0 : _a.getConfig(this.dataUnit, this.ignoreReadOnlyFormFields);
|
758
759
|
if (!this.configName && !configFromManager) {
|
759
760
|
return this.formConfig;
|
760
761
|
}
|
@@ -774,7 +775,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
774
775
|
if (this.dataUnit == undefined) {
|
775
776
|
return;
|
776
777
|
}
|
777
|
-
return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), 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, onDataUnitFieldsHidded: this.updateFormConfig.bind(this) }, 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, "data-exporter-store-key": this.getDataExporterStoreKey(), 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)
|
778
|
+
return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), 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, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, 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, "data-exporter-store-key": this.getDataExporterStoreKey(), 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)
|
778
779
|
? undefined
|
779
780
|
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), 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() }))));
|
780
781
|
}
|
@@ -809,6 +810,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
809
810
|
"formLegacyConfigName": [1, "form-legacy-config-name"],
|
810
811
|
"ignoreReadOnlyFormFields": [4, "ignore-read-only-form-fields"],
|
811
812
|
"autoFocus": [4, "auto-focus"],
|
813
|
+
"domainMessagesBuilder": [1, "domain-messages-builder"],
|
812
814
|
"autoLoad": [4, "auto-load"],
|
813
815
|
"_showPopUpGridConfig": [32],
|
814
816
|
"_showFormConfig": [32],
|
@@ -423,6 +423,7 @@ class ConfigStorage {
|
|
423
423
|
if (config == undefined) {
|
424
424
|
return;
|
425
425
|
}
|
426
|
+
name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.grid);
|
426
427
|
await this.deleteGridConfigCache(name, resourceID);
|
427
428
|
return this.gridConfigFetcher.saveConfig(config, name, resourceID);
|
428
429
|
}
|
@@ -5,7 +5,7 @@ import './index-3aa4977a.js';
|
|
5
5
|
import './ISave-d8c8bc59.js';
|
6
6
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
7
7
|
import { UserInterface as UserInterface$1 } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
8
|
-
import { P as PreloadManager } from './dataunit-fetcher-
|
8
|
+
import { P as PreloadManager } from './dataunit-fetcher-264191b2.js';
|
9
9
|
import './filter-item-type.enum-d45e026f.js';
|
10
10
|
import './form-config-fetcher-30fb808f.js';
|
11
11
|
import InMemoryFilterColumnDataSource from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { C as ConfigStorage } from './ConfigStorage-
|
1
|
+
import { C as ConfigStorage } from './ConfigStorage-3806514e.js';
|
2
2
|
import { ObjectUtils, StringUtils } from '@sankhyalabs/core';
|
3
3
|
import { F as FormConfigFetcher } from './form-config-fetcher-30fb808f.js';
|
4
4
|
|
@@ -74,10 +74,8 @@ class SnkFormConfigManager {
|
|
74
74
|
if (fields != undefined && fields.length > 0) {
|
75
75
|
return fields.map(({ label, name, readOnly, visible, required }) => {
|
76
76
|
if (label == undefined) {
|
77
|
-
|
78
|
-
|
79
|
-
visible,
|
80
|
-
required });
|
77
|
+
const currentField = dataUnit.getField(name);
|
78
|
+
return Object.assign(Object.assign({}, currentField), { name: name !== null && name !== void 0 ? name : currentField.name, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : currentField.readOnly, visible: visible !== null && visible !== void 0 ? visible : currentField.visible, required: required !== null && required !== void 0 ? required : currentField.required });
|
81
79
|
}
|
82
80
|
return { name, label, readOnly, visible, required };
|
83
81
|
})
|
@@ -101,7 +99,7 @@ class SnkFormConfigManager {
|
|
101
99
|
const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
|
102
100
|
return normalizedText.includes(normalizedFilter);
|
103
101
|
}
|
104
|
-
|
102
|
+
getFormConfig(dataUnit, ignoreReadOnlyFormFields) {
|
105
103
|
let fields = this.getFieldsList(dataUnit);
|
106
104
|
if (ignoreReadOnlyFormFields) {
|
107
105
|
fields = fields.filter(field => {
|
@@ -133,8 +131,8 @@ class SnkFormConfigManager {
|
|
133
131
|
this._onConfigChange(Object.assign({}, this._config));
|
134
132
|
}
|
135
133
|
}
|
136
|
-
getConfig(
|
137
|
-
return
|
134
|
+
getConfig(dataUnit, ignoreReadOnlyFormFields) {
|
135
|
+
return this.getFormConfig(dataUnit, ignoreReadOnlyFormFields !== null && ignoreReadOnlyFormFields !== void 0 ? ignoreReadOnlyFormFields : true);
|
138
136
|
}
|
139
137
|
getFormConfigFetcher() {
|
140
138
|
if (this._formConfigFetcher == undefined) {
|
@@ -246,13 +246,17 @@ function applySorting(records, dataUnit, sorting) {
|
|
246
246
|
return records.sort(sortingFunction);
|
247
247
|
}
|
248
248
|
function buildPaginationInfo(records, offset = 0, limit = 0) {
|
249
|
-
|
249
|
+
if (records === undefined) {
|
250
|
+
return undefined;
|
251
|
+
}
|
252
|
+
const total = (records === null || records === void 0 ? void 0 : records.length) || 0;
|
253
|
+
const lastRecord = Math.min(offset + limit, total);
|
250
254
|
return {
|
251
255
|
currentPage: limit === 0 ? 0 : Math.ceil(offset / limit),
|
252
256
|
firstRecord: offset,
|
253
257
|
lastRecord: lastRecord,
|
254
|
-
total:
|
255
|
-
hasMore: !!(
|
258
|
+
total: total,
|
259
|
+
hasMore: !!(total - lastRecord),
|
256
260
|
};
|
257
261
|
}
|
258
262
|
|
@@ -261,6 +265,7 @@ class InMemoryLoader {
|
|
261
265
|
this.metadata = metadata;
|
262
266
|
this.records = records;
|
263
267
|
this._dataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
|
268
|
+
this._dataUnit.pageSize = 150;
|
264
269
|
this._dataUnit.metadataLoader = () => this.metadaLoader();
|
265
270
|
this._dataUnit.dataLoader = (dataUnit, request) => this.inMemoryLoader(dataUnit, request, this.getRecordsToLoad());
|
266
271
|
this._dataUnit.saveLoader = (_dataUnit, changes) => this.saveLoader(_dataUnit, changes);
|