@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-56414.2 → 0.0.0-bugfix-dev-KB-55400.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/{IExporterProvider-91e8acd9.js → IExporterProvider-8687eea9.js} +1 -1
- package/dist/cjs/{SnkFormConfigManager-4259edbe.js → SnkFormConfigManager-df34d678.js} +2 -2
- package/dist/cjs/{SnkMessageBuilder-66aa2557.js → SnkMessageBuilder-9b3c2a2d.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-d15951b1.js → pesquisa-fetcher-610c2d29.js} +6 -11
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +2 -1
- package/dist/cjs/snk-application.cjs.entry.js +3 -2
- package/dist/cjs/snk-attach.cjs.entry.js +22 -12
- package/dist/cjs/snk-crud.cjs.entry.js +2 -1
- package/dist/cjs/snk-data-exporter.cjs.entry.js +4 -3
- package/dist/cjs/{snk-data-unit-7798c5c4.js → snk-data-unit-63589ae8.js} +81 -23
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +5 -4
- package/dist/cjs/snk-filter-bar.cjs.entry.js +0 -5
- package/dist/cjs/snk-form.cjs.entry.js +1 -1
- package/dist/cjs/snk-grid.cjs.entry.js +3 -2
- package/dist/cjs/{snk-guides-viewer-eee0b978.js → snk-guides-viewer-bef9ca55.js} +2 -2
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +4 -3
- package/dist/cjs/snk-simple-crud.cjs.entry.js +13 -4
- package/dist/collection/components/snk-attach/snk-attach.js +20 -11
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +100 -23
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +0 -5
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +2 -2
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +9 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +3 -12
- package/dist/collection/lib/message/SnkMessageBuilder.js +21 -21
- package/dist/components/SnkFormConfigManager.js +2 -2
- package/dist/components/SnkMessageBuilder.js +1 -1
- package/dist/components/dataunit-fetcher.js +3 -12
- package/dist/components/snk-attach2.js +20 -11
- package/dist/components/snk-data-unit2.js +82 -23
- package/dist/components/snk-filter-bar2.js +0 -5
- package/dist/components/snk-simple-crud2.js +9 -1
- package/dist/esm/{IExporterProvider-c3bd60f3.js → IExporterProvider-0af5ebd3.js} +1 -1
- package/dist/esm/{SnkFormConfigManager-a87ade7a.js → SnkFormConfigManager-02e9bdcd.js} +2 -2
- package/dist/esm/{SnkMessageBuilder-0a4becdd.js → SnkMessageBuilder-a26aa279.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-9e18940f.js → pesquisa-fetcher-253715e4.js} +3 -12
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +2 -1
- package/dist/esm/snk-application.entry.js +3 -2
- package/dist/esm/snk-attach.entry.js +22 -12
- package/dist/esm/snk-crud.entry.js +2 -1
- package/dist/esm/snk-data-exporter.entry.js +4 -3
- package/dist/esm/{snk-data-unit-592a8ed3.js → snk-data-unit-0252289c.js} +82 -24
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +5 -4
- package/dist/esm/snk-filter-bar.entry.js +0 -5
- package/dist/esm/snk-form.entry.js +1 -1
- package/dist/esm/snk-grid.entry.js +3 -2
- package/dist/esm/{snk-guides-viewer-4fd4e25a.js → snk-guides-viewer-96253964.js} +2 -2
- package/dist/esm/snk-guides-viewer.entry.js +4 -3
- package/dist/esm/snk-simple-crud.entry.js +13 -4
- package/dist/sankhyablocks/p-41c05011.js +1 -0
- package/dist/sankhyablocks/{p-65b6dba3.entry.js → p-4a16dc22.entry.js} +1 -1
- package/dist/sankhyablocks/p-4d10e705.entry.js +1 -0
- package/dist/sankhyablocks/p-5447a6a6.entry.js +1 -0
- package/dist/sankhyablocks/p-5e7fa584.entry.js +1 -0
- package/dist/sankhyablocks/p-61984566.entry.js +1 -0
- package/dist/sankhyablocks/p-674e142a.js +1 -0
- package/dist/sankhyablocks/p-69bf12f9.js +65 -0
- package/dist/sankhyablocks/p-74eed0fd.entry.js +1 -0
- package/dist/sankhyablocks/p-79bae662.entry.js +1 -0
- package/dist/sankhyablocks/p-89b544c9.entry.js +1 -0
- package/dist/sankhyablocks/{p-9b94aaa9.js → p-93b9da9b.js} +1 -1
- package/dist/sankhyablocks/{p-52ec26b8.entry.js → p-accfaecf.entry.js} +3 -3
- package/dist/sankhyablocks/p-ad73e9d7.entry.js +1 -0
- package/dist/sankhyablocks/{p-32556aa6.js → p-bc51e7ca.js} +1 -1
- package/dist/sankhyablocks/{p-e0649a17.js → p-e8bbd578.js} +1 -1
- package/dist/sankhyablocks/{p-388d00f5.entry.js → p-ea89c934.entry.js} +1 -1
- package/dist/sankhyablocks/p-ecfa87e8.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-attach/snk-attach.d.ts +1 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +16 -1
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +1 -0
- package/dist/types/components.d.ts +4 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-07d324ba.entry.js +0 -1
- package/dist/sankhyablocks/p-0e8702f0.js +0 -1
- package/dist/sankhyablocks/p-1e5dffbf.js +0 -1
- package/dist/sankhyablocks/p-2345687c.entry.js +0 -1
- package/dist/sankhyablocks/p-3de247d1.entry.js +0 -1
- package/dist/sankhyablocks/p-595e7068.entry.js +0 -1
- package/dist/sankhyablocks/p-775253f7.entry.js +0 -1
- package/dist/sankhyablocks/p-7d6897ec.entry.js +0 -1
- package/dist/sankhyablocks/p-81abd586.entry.js +0 -1
- package/dist/sankhyablocks/p-8fadeb65.entry.js +0 -1
- package/dist/sankhyablocks/p-ac2fc78d.entry.js +0 -1
- package/dist/sankhyablocks/p-f678bffa.js +0 -65
|
@@ -71,11 +71,11 @@ export class SnkFormConfigManager {
|
|
|
71
71
|
var _a;
|
|
72
72
|
const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
|
|
73
73
|
if (fields != undefined && fields.length > 0) {
|
|
74
|
-
return fields.map(({ label, name, readOnly }) => {
|
|
74
|
+
return fields.map(({ label, name, readOnly, visible }) => {
|
|
75
75
|
if (label == undefined) {
|
|
76
76
|
return dataUnit.getField(name);
|
|
77
77
|
}
|
|
78
|
-
return { name, label, readOnly };
|
|
78
|
+
return { name, label, readOnly, visible };
|
|
79
79
|
})
|
|
80
80
|
.filter(field => this.isFieldVisible(field, descriptionFilter));
|
|
81
81
|
}
|
|
@@ -549,13 +549,21 @@ export class SnkSimpleCrud {
|
|
|
549
549
|
}
|
|
550
550
|
return configFromManager;
|
|
551
551
|
}
|
|
552
|
+
updateFormConfig() {
|
|
553
|
+
const newConfig = Object.assign(Object.assign({}, this.formConfig), { fields: this.dataUnit.metadata.fields });
|
|
554
|
+
this.setFormConfig(newConfig, true);
|
|
555
|
+
if (this._formConfigManager == undefined) {
|
|
556
|
+
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
|
557
|
+
}
|
|
558
|
+
this._formConfigManager.setConfig(this.formConfig);
|
|
559
|
+
}
|
|
552
560
|
/* istanbul ignore next */
|
|
553
561
|
render() {
|
|
554
562
|
var _a;
|
|
555
563
|
if (this.dataUnit == undefined) {
|
|
556
564
|
return;
|
|
557
565
|
}
|
|
558
|
-
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), 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 }, 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)
|
|
566
|
+
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), 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)
|
|
559
567
|
? undefined
|
|
560
568
|
: 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: 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() }))));
|
|
561
569
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { DataUnit
|
|
1
|
+
import { DataUnit } from "@sankhyalabs/core";
|
|
2
2
|
import { ArrayRepository } from "./ArrayRepository";
|
|
3
3
|
import { ColumnFilterManager } from "@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";
|
|
4
|
+
import SortingUtils from "@sankhyalabs/core/dist/utils/SortingUtils";
|
|
4
5
|
export default class PreloadManager {
|
|
5
6
|
static setLoadingStatus(dataUnit, loadingInProgress) {
|
|
6
7
|
this._loadingStatus.set(dataUnit.name, loadingInProgress);
|
|
@@ -20,17 +21,7 @@ export default class PreloadManager {
|
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
static getSortingFunction(dataUnit, sorting) {
|
|
23
|
-
|
|
24
|
-
return undefined;
|
|
25
|
-
}
|
|
26
|
-
return (recordA, recordB) => {
|
|
27
|
-
for (const sort of sorting) {
|
|
28
|
-
const result = FieldComparator.compare(dataUnit.getField(sort.field), recordA, recordB, sort.mode === SortMode.ASC);
|
|
29
|
-
if (result != 0) {
|
|
30
|
-
return result;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
};
|
|
24
|
+
return SortingUtils.getSortingFunction(dataUnit, sorting);
|
|
34
25
|
}
|
|
35
26
|
static async getDistinct(dataUnit, fieldName) {
|
|
36
27
|
if (!PreloadManager.isCacheEnabled(dataUnit)) {
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import snkDataUnitMessages from "./resources/snk-data-unit.msg
|
|
2
|
-
import snkFilterBarMessages from "./resources/snk-filter-bar.msg
|
|
3
|
-
import snkTaskbarMessages from "./resources/snk-taskbar.msg
|
|
4
|
-
import crudUtilsMessages from "./resources/crud-utils.msg
|
|
5
|
-
import snkExporterMessages from "./resources/snk-exporter.msg
|
|
6
|
-
import snkCrudMessages from "./resources/snk-crud.msg
|
|
7
|
-
import snkSimpleCrudMessages from "./resources/snk-simple-crud.msg
|
|
8
|
-
import fileViewerMessages from "./resources/file-viewer.msg
|
|
9
|
-
import snkApplicationMessages from "./resources/snk-application.msg
|
|
10
|
-
import { snkFormConfigMessages, snkConfigOptionsMessages, snkFieldConfigMessages, snkTabConfigMessages } from "./resources/snk-form.msg
|
|
11
|
-
import { snkConfiguratorMessages } from "./resources/snk-configurator.msg
|
|
12
|
-
import { snkGridMessages, snkGridConfigMessages } from "./resources/snk-grid.msg
|
|
13
|
-
import { snkDataExporterMessages } from "./resources/snk-data-exporter.msg
|
|
14
|
-
import { snkFilterParamConfigMessages } from "./resources/snk-filter-param-config.msg
|
|
15
|
-
import { snkFilterFieldSearchMessages } from "./resources/snk-filter-field-search.msg
|
|
16
|
-
import { snkSimpleBarMessages } from './resources/snk-simple-bar.msg
|
|
1
|
+
import snkDataUnitMessages from "./resources/snk-data-unit.msg";
|
|
2
|
+
import snkFilterBarMessages from "./resources/snk-filter-bar.msg";
|
|
3
|
+
import snkTaskbarMessages from "./resources/snk-taskbar.msg";
|
|
4
|
+
import crudUtilsMessages from "./resources/crud-utils.msg";
|
|
5
|
+
import snkExporterMessages from "./resources/snk-exporter.msg";
|
|
6
|
+
import snkCrudMessages from "./resources/snk-crud.msg";
|
|
7
|
+
import snkSimpleCrudMessages from "./resources/snk-simple-crud.msg";
|
|
8
|
+
import fileViewerMessages from "./resources/file-viewer.msg";
|
|
9
|
+
import snkApplicationMessages from "./resources/snk-application.msg";
|
|
10
|
+
import { snkFormConfigMessages, snkConfigOptionsMessages, snkFieldConfigMessages, snkTabConfigMessages } from "./resources/snk-form.msg";
|
|
11
|
+
import { snkConfiguratorMessages } from "./resources/snk-configurator.msg";
|
|
12
|
+
import { snkGridMessages, snkGridConfigMessages } from "./resources/snk-grid.msg";
|
|
13
|
+
import { snkDataExporterMessages } from "./resources/snk-data-exporter.msg";
|
|
14
|
+
import { snkFilterParamConfigMessages } from "./resources/snk-filter-param-config.msg";
|
|
15
|
+
import { snkFilterFieldSearchMessages } from "./resources/snk-filter-field-search.msg";
|
|
16
|
+
import { snkSimpleBarMessages } from './resources/snk-simple-bar.msg';
|
|
17
17
|
import { snkAttachMessages } from "./resources/snk-attach.msg";
|
|
18
|
-
import { snkPersonalizedFilterMessages } from "./resources/snk-personalized-filter.msg
|
|
19
|
-
import { snkEntityListMessages } from "./resources/snk-entity-list.msg
|
|
20
|
-
import { snkActionsButtonMessages } from "./resources/snk-actions-button.msg
|
|
21
|
-
import { snkPrintSelectorMessages } from "./resources/snk-print-selector.msg
|
|
18
|
+
import { snkPersonalizedFilterMessages } from "./resources/snk-personalized-filter.msg";
|
|
19
|
+
import { snkEntityListMessages } from "./resources/snk-entity-list.msg";
|
|
20
|
+
import { snkActionsButtonMessages } from "./resources/snk-actions-button.msg";
|
|
21
|
+
import { snkPrintSelectorMessages } from "./resources/snk-print-selector.msg";
|
|
22
22
|
import { ApplicationContext } from "@sankhyalabs/core";
|
|
23
23
|
export class SnkMessageBuilder {
|
|
24
24
|
constructor(domainName) {
|
|
@@ -55,7 +55,7 @@ export class SnkMessageBuilder {
|
|
|
55
55
|
this.loadAppMessages().then((msgs) => {
|
|
56
56
|
this._appMessages = msgs;
|
|
57
57
|
}, error => {
|
|
58
|
-
console.info('O arquivo de mensagens personalizadas não foi encontrado no caminho /messages/appmessages
|
|
58
|
+
console.info('O arquivo de mensagens personalizadas não foi encontrado no caminho /messages/appmessages', error);
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
@@ -72,11 +72,11 @@ class SnkFormConfigManager {
|
|
|
72
72
|
var _a;
|
|
73
73
|
const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
|
|
74
74
|
if (fields != undefined && fields.length > 0) {
|
|
75
|
-
return fields.map(({ label, name, readOnly }) => {
|
|
75
|
+
return fields.map(({ label, name, readOnly, visible }) => {
|
|
76
76
|
if (label == undefined) {
|
|
77
77
|
return dataUnit.getField(name);
|
|
78
78
|
}
|
|
79
|
-
return { name, label, readOnly };
|
|
79
|
+
return { name, label, readOnly, visible };
|
|
80
80
|
})
|
|
81
81
|
.filter(field => this.isFieldVisible(field, descriptionFilter));
|
|
82
82
|
}
|
|
@@ -552,7 +552,7 @@ class SnkMessageBuilder {
|
|
|
552
552
|
this.loadAppMessages().then((msgs) => {
|
|
553
553
|
this._appMessages = msgs;
|
|
554
554
|
}, error => {
|
|
555
|
-
console.info('O arquivo de mensagens personalizadas não foi encontrado no caminho /messages/appmessages
|
|
555
|
+
console.info('O arquivo de mensagens personalizadas não foi encontrado no caminho /messages/appmessages', error);
|
|
556
556
|
});
|
|
557
557
|
}
|
|
558
558
|
/**
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { DataType, ApplicationContext, ObjectUtils,
|
|
1
|
+
import { DataType, ApplicationContext, ObjectUtils, DataUnit, DateUtils, StringUtils, ChangeOperation, UserInterface, DataUnitStorage } from '@sankhyalabs/core';
|
|
2
2
|
import { d as dist, D as DataFetcher } from './form-config-fetcher.js';
|
|
3
3
|
import { DISTINCT_FILTER_NAME_PREFIX } from '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
4
4
|
import { DataUnitTransient } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
5
5
|
import { ColumnFilterManager } from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
|
|
6
|
+
import SortingUtils from '@sankhyalabs/core/dist/utils/SortingUtils';
|
|
6
7
|
import { R as ResourceIDUtils } from './ResourceIDUtils.js';
|
|
7
8
|
|
|
8
9
|
class PesquisaFetcher {
|
|
@@ -268,17 +269,7 @@ class PreloadManager {
|
|
|
268
269
|
}
|
|
269
270
|
}
|
|
270
271
|
static getSortingFunction(dataUnit, sorting) {
|
|
271
|
-
|
|
272
|
-
return undefined;
|
|
273
|
-
}
|
|
274
|
-
return (recordA, recordB) => {
|
|
275
|
-
for (const sort of sorting) {
|
|
276
|
-
const result = FieldComparator.compare(dataUnit.getField(sort.field), recordA, recordB, sort.mode === SortMode.ASC);
|
|
277
|
-
if (result != 0) {
|
|
278
|
-
return result;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
};
|
|
272
|
+
return SortingUtils.getSortingFunction(dataUnit, sorting);
|
|
282
273
|
}
|
|
283
274
|
static async getDistinct(dataUnit, fieldName) {
|
|
284
275
|
if (!PreloadManager.isCacheEnabled(dataUnit)) {
|
|
@@ -732,15 +732,13 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
732
732
|
}
|
|
733
733
|
}
|
|
734
734
|
loadAnexoSistema() {
|
|
735
|
-
var _a;
|
|
736
735
|
this._currentDataUnit = this._currentDataUnit || new DataUnitFetcher().getDataUnit(RESOURCE_ID, DATA_UNIT_NAME);
|
|
737
|
-
this._currentFetcher = new AnexoSistemaFetcher(this.entityName, this.registerKey, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
|
|
738
736
|
if (!this._currentDataUnit.metadata) {
|
|
739
737
|
this._currentDataUnit
|
|
740
738
|
.loadMetadata()
|
|
741
739
|
.then(() => this.crudConfig = Object.assign({}, anexoSistemaCrudConfig));
|
|
742
740
|
}
|
|
743
|
-
this.
|
|
741
|
+
this.initDataUnitLoaders();
|
|
744
742
|
this._currentDataUnit.addFilterProvider({
|
|
745
743
|
getFilter: () => this._currentDataUnitBuilder.getFilters(this.registerKey)
|
|
746
744
|
});
|
|
@@ -750,9 +748,9 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
750
748
|
this._currentDataUnit.loadData().then(this.disableEditFieldsNotInForm.bind(this));
|
|
751
749
|
}
|
|
752
750
|
loadAttach() {
|
|
753
|
-
var _a, _b
|
|
754
|
-
this._currentFetcher = new AttachFetcher();
|
|
751
|
+
var _a, _b;
|
|
755
752
|
this._currentDataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
|
|
753
|
+
this.initDataUnitLoaders();
|
|
756
754
|
this._currentDataUnit.addInterceptor({
|
|
757
755
|
interceptAction: (action) => {
|
|
758
756
|
var _a;
|
|
@@ -763,19 +761,30 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
763
761
|
return this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement);
|
|
764
762
|
}
|
|
765
763
|
});
|
|
766
|
-
this._currentDataUnitBuilder = new AttachFetcherDataUnitFactory(this.getMessage.bind(this));
|
|
767
|
-
(_a = this._currentDataUnitBuilder) === null || _a === void 0 ? void 0 : _a.initLoaders(this._currentDataUnit, this._currentFetcher, async () => {
|
|
768
|
-
this.returnToGridMode();
|
|
769
|
-
await this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
|
|
770
|
-
});
|
|
771
764
|
if (!this._currentDataUnit.metadata) {
|
|
772
|
-
(
|
|
765
|
+
(_b = (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadMetadata()) === null || _b === void 0 ? void 0 : _b.then(() => {
|
|
773
766
|
var _a, _b;
|
|
774
767
|
this.crudConfig = Object.assign({}, attachCrudConfig);
|
|
775
768
|
(_b = (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadData(undefined, undefined, true, this.registerKey)) === null || _b === void 0 ? void 0 : _b.then(this.disableEditFieldsNotInForm.bind(this));
|
|
776
769
|
});
|
|
777
770
|
}
|
|
778
771
|
}
|
|
772
|
+
initDataUnitLoaders() {
|
|
773
|
+
var _a, _b, _c;
|
|
774
|
+
if (this.fetcherType === "AnexoSistema") {
|
|
775
|
+
this._currentFetcher = new AnexoSistemaFetcher(this.entityName, this.registerKey, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
|
|
776
|
+
this._currentDataUnitBuilder = new AnexoSistemaDataUnitFactory(this.entityName, this.getMessage.bind(this));
|
|
777
|
+
(_b = this._currentDataUnitBuilder) === null || _b === void 0 ? void 0 : _b.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
|
|
778
|
+
}
|
|
779
|
+
if (this.fetcherType === "Attach") {
|
|
780
|
+
this._currentFetcher = new AttachFetcher();
|
|
781
|
+
this._currentDataUnitBuilder = new AttachFetcherDataUnitFactory(this.getMessage.bind(this));
|
|
782
|
+
(_c = this._currentDataUnitBuilder) === null || _c === void 0 ? void 0 : _c.initLoaders(this._currentDataUnit, this._currentFetcher, async () => {
|
|
783
|
+
this.returnToGridMode();
|
|
784
|
+
await this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
|
|
785
|
+
});
|
|
786
|
+
}
|
|
787
|
+
}
|
|
779
788
|
disableEditFieldsNotInForm() {
|
|
780
789
|
var _a;
|
|
781
790
|
(_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid.columns.forEach(column => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import { JSUtils, DataType, Action, ObjectUtils, DataUnitAction, ApplicationContext } from '@sankhyalabs/core';
|
|
2
|
+
import { JSUtils, DataType, Action, ObjectUtils, DataUnitAction, StringUtils, ApplicationContext } from '@sankhyalabs/core';
|
|
3
3
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
4
|
import { O as OperationMap, S as SnkMessageBuilder } from './SnkMessageBuilder.js';
|
|
5
5
|
|
|
@@ -48,10 +48,12 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
48
48
|
this.dataStateChange = createEvent(this, "dataStateChange", 3);
|
|
49
49
|
this.dataUnitReady = createEvent(this, "dataUnitReady", 3);
|
|
50
50
|
this.messagesBuilderUpdated = createEvent(this, "messagesBuilderUpdated", 3);
|
|
51
|
+
this.dataUnitFieldsHidded = createEvent(this, "dataUnitFieldsHidded", 7);
|
|
51
52
|
this.insertionMode = createEvent(this, "insertionMode", 3);
|
|
52
53
|
this.cancelEdition = createEvent(this, "cancelEdition", 3);
|
|
53
54
|
this._onDataUnitResolve = [];
|
|
54
55
|
this._openedAlert = false;
|
|
56
|
+
this.REGEX_DATAUNIT_NAME = /dd:\/\/(.+?)\//;
|
|
55
57
|
this._dataUnitObserver = (action) => {
|
|
56
58
|
var _a, _b;
|
|
57
59
|
const duState = this.buildDataState();
|
|
@@ -96,6 +98,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
96
98
|
}
|
|
97
99
|
this.messagesBuilder.currentOperation = this.getMessageOperation();
|
|
98
100
|
};
|
|
101
|
+
this.fieldsToLink = [];
|
|
99
102
|
this.dataState = undefined;
|
|
100
103
|
this.messagesBuilder = undefined;
|
|
101
104
|
this.dataUnitName = undefined;
|
|
@@ -137,7 +140,6 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
137
140
|
}
|
|
138
141
|
}
|
|
139
142
|
observeDataUnit() {
|
|
140
|
-
this.loadDataUnit();
|
|
141
143
|
this.handlerLinkFields();
|
|
142
144
|
this.dataUnitReady.emit(this.dataUnit);
|
|
143
145
|
}
|
|
@@ -176,7 +178,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
176
178
|
switch (action.type) {
|
|
177
179
|
case Action.RECORDS_ADDED:
|
|
178
180
|
if (this.isAllowed("INSERT")) {
|
|
179
|
-
resolve(action);
|
|
181
|
+
resolve(new DataUnitAction(Action.RECORDS_ADDED, this.handleLinksWithParent(action.payload)));
|
|
180
182
|
}
|
|
181
183
|
else {
|
|
182
184
|
ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenInsert"));
|
|
@@ -184,21 +186,15 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
184
186
|
break;
|
|
185
187
|
case Action.RECORDS_COPIED:
|
|
186
188
|
if (this.isAllowed("CLONE")) {
|
|
187
|
-
|
|
188
|
-
if (cleanFields.length > 0) {
|
|
189
|
-
const records = action.payload;
|
|
190
|
-
action = new DataUnitAction(Action.RECORDS_COPIED, records.map(record => {
|
|
191
|
-
const newRecord = Object.assign({}, record);
|
|
192
|
-
cleanFields.forEach(fieldName => delete newRecord[fieldName]);
|
|
193
|
-
return newRecord;
|
|
194
|
-
}));
|
|
195
|
-
}
|
|
196
|
-
resolve(action);
|
|
189
|
+
resolve(new DataUnitAction(Action.RECORDS_COPIED, this.handleRecordsCopied(action.payload)));
|
|
197
190
|
}
|
|
198
191
|
else {
|
|
199
192
|
ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenClone"));
|
|
200
193
|
}
|
|
201
194
|
break;
|
|
195
|
+
case Action.METADATA_LOADED:
|
|
196
|
+
resolve(new DataUnitAction(Action.METADATA_LOADED, this.handleMetadataLoaded(action.payload)));
|
|
197
|
+
break;
|
|
202
198
|
case Action.DATA_CHANGED:
|
|
203
199
|
case Action.CHANGING_DATA:
|
|
204
200
|
if (this.isAllowed("UPDATE"))
|
|
@@ -292,6 +288,47 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
292
288
|
}
|
|
293
289
|
});
|
|
294
290
|
}
|
|
291
|
+
handleMetadataLoaded(payload) {
|
|
292
|
+
const metadata = Object.assign({}, payload);
|
|
293
|
+
this.processLinks(metadata);
|
|
294
|
+
return metadata;
|
|
295
|
+
}
|
|
296
|
+
handleRecordsCopied(initialRecords) {
|
|
297
|
+
let records = [...initialRecords];
|
|
298
|
+
records = this.handleCleanOnCopy(records);
|
|
299
|
+
return this.handleLinksWithParent(records);
|
|
300
|
+
}
|
|
301
|
+
handleLinksWithParent(records) {
|
|
302
|
+
var _a, _b;
|
|
303
|
+
const parentDataUnit = (_a = this._parentDataUnit) !== null && _a !== void 0 ? _a : (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.getParentDataUnit();
|
|
304
|
+
if (!parentDataUnit)
|
|
305
|
+
return records;
|
|
306
|
+
const parentSelectedRecord = parentDataUnit.getSelectedRecord();
|
|
307
|
+
const selfInfo = parentDataUnit === null || parentDataUnit === void 0 ? void 0 : parentDataUnit.getChildInfo(this.getCleanDataUnitName());
|
|
308
|
+
const { links } = selfInfo;
|
|
309
|
+
if (!links || links.length === 0)
|
|
310
|
+
return records;
|
|
311
|
+
return records.map(record => {
|
|
312
|
+
return this.buildRecordWithLinkedFields(record, links, parentSelectedRecord);
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
buildRecordWithLinkedFields(record, links, parentSelectedRecord) {
|
|
316
|
+
const newRecord = Object.assign({}, record);
|
|
317
|
+
links.forEach(link => newRecord[link.target] = parentSelectedRecord[link.source]);
|
|
318
|
+
return newRecord;
|
|
319
|
+
}
|
|
320
|
+
handleCleanOnCopy(records) {
|
|
321
|
+
const cleanFields = this.getCleanOnCopyFields();
|
|
322
|
+
if (cleanFields.length > 0) {
|
|
323
|
+
records = records.map(record => this.buildCopyWithCleanedFields(record, cleanFields));
|
|
324
|
+
}
|
|
325
|
+
return records;
|
|
326
|
+
}
|
|
327
|
+
buildCopyWithCleanedFields(record, cleanFields) {
|
|
328
|
+
const newRecord = Object.assign({}, record);
|
|
329
|
+
cleanFields.forEach(fieldName => delete newRecord[fieldName]);
|
|
330
|
+
return newRecord;
|
|
331
|
+
}
|
|
295
332
|
showSuccessMessage(message) {
|
|
296
333
|
ApplicationUtils.info(message, { iconName: "check" });
|
|
297
334
|
}
|
|
@@ -382,20 +419,40 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
382
419
|
return;
|
|
383
420
|
}
|
|
384
421
|
handlerLinkFields() {
|
|
385
|
-
var _a, _b;
|
|
386
|
-
const
|
|
387
|
-
if (!
|
|
422
|
+
var _a, _b, _c, _d;
|
|
423
|
+
const parentDU = (_a = this._parentDataUnit) !== null && _a !== void 0 ? _a : (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.getParentDataUnit();
|
|
424
|
+
if (!parentDU)
|
|
388
425
|
return;
|
|
389
|
-
const
|
|
426
|
+
const childName = (_c = this.entityName) !== null && _c !== void 0 ? _c : this.getCleanDataUnitName();
|
|
427
|
+
const child = parentDU.getChildInfo(childName);
|
|
390
428
|
if (!child)
|
|
391
429
|
return;
|
|
392
|
-
const
|
|
393
|
-
(
|
|
394
|
-
|
|
430
|
+
const links = (_d = child === null || child === void 0 ? void 0 : child.links) === null || _d === void 0 ? void 0 : _d.map(link => link.target);
|
|
431
|
+
this.handleDUWithLinks(links);
|
|
432
|
+
}
|
|
433
|
+
handleDUWithLinks(fieldsToLink) {
|
|
434
|
+
this.fieldsToLink = fieldsToLink;
|
|
435
|
+
const metadata = Object.assign({}, this.dataUnit.metadata);
|
|
436
|
+
this.processLinks(metadata);
|
|
437
|
+
this.dataUnit.metadata = metadata;
|
|
438
|
+
this.dataUnitFieldsHidded.emit();
|
|
439
|
+
}
|
|
440
|
+
processLinks(metadata) {
|
|
441
|
+
var _a;
|
|
442
|
+
(_a = metadata === null || metadata === void 0 ? void 0 : metadata.fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
|
|
443
|
+
var _a;
|
|
444
|
+
if ((_a = this.fieldsToLink) === null || _a === void 0 ? void 0 : _a.includes(field.name)) {
|
|
395
445
|
field.visible = false;
|
|
396
446
|
}
|
|
397
447
|
});
|
|
398
|
-
|
|
448
|
+
}
|
|
449
|
+
getCleanDataUnitName() {
|
|
450
|
+
var _a;
|
|
451
|
+
const uri = this.dataUnit.name;
|
|
452
|
+
if (StringUtils.isEmpty(uri))
|
|
453
|
+
return uri;
|
|
454
|
+
const matcher = this.REGEX_DATAUNIT_NAME.exec(uri);
|
|
455
|
+
return (_a = matcher === null || matcher === void 0 ? void 0 : matcher[1]) !== null && _a !== void 0 ? _a : uri;
|
|
399
456
|
}
|
|
400
457
|
static getNearestInstance(element) {
|
|
401
458
|
let parent = element.parentElement;
|
|
@@ -422,8 +479,9 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
422
479
|
this.dataUnit.releaseCallbacks();
|
|
423
480
|
}
|
|
424
481
|
}
|
|
425
|
-
componentDidLoad() {
|
|
426
|
-
this.loadDataUnit();
|
|
482
|
+
async componentDidLoad() {
|
|
483
|
+
await this.loadDataUnit();
|
|
484
|
+
this.handlerLinkFields();
|
|
427
485
|
}
|
|
428
486
|
render() {
|
|
429
487
|
return (h(Host, null));
|
|
@@ -450,6 +508,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
450
508
|
"ignoreSaveMessage": [4, "ignore-save-message"],
|
|
451
509
|
"configName": [1, "config-name"],
|
|
452
510
|
"resourceID": [1, "resource-i-d"],
|
|
511
|
+
"fieldsToLink": [32],
|
|
453
512
|
"getDataUnit": [64],
|
|
454
513
|
"getSelectedRecordsIDsInfo": [64]
|
|
455
514
|
}]);
|
|
@@ -299,11 +299,6 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
299
299
|
this.handleFilterConfigsChanged(oldValue, newValue);
|
|
300
300
|
}
|
|
301
301
|
handleFilterConfigsChanged(oldValue, newValue) {
|
|
302
|
-
const isEmptyPersonalizedFilter = newValue && newValue.length === 1 ? (newValue[0].id === 'PERSONALIZED_FILTER_GROUP' && newValue[0].groupedItems.length === 0) : false;
|
|
303
|
-
if (oldValue === undefined && isEmptyPersonalizedFilter) {
|
|
304
|
-
this.configUpdated.emit(newValue);
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
302
|
if (oldValue != undefined && newValue == undefined) {
|
|
308
303
|
this._loadingPending = true;
|
|
309
304
|
this._configUpdated = true;
|
|
@@ -625,13 +625,21 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
625
625
|
}
|
|
626
626
|
return configFromManager;
|
|
627
627
|
}
|
|
628
|
+
updateFormConfig() {
|
|
629
|
+
const newConfig = Object.assign(Object.assign({}, this.formConfig), { fields: this.dataUnit.metadata.fields });
|
|
630
|
+
this.setFormConfig(newConfig, true);
|
|
631
|
+
if (this._formConfigManager == undefined) {
|
|
632
|
+
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
|
633
|
+
}
|
|
634
|
+
this._formConfigManager.setConfig(this.formConfig);
|
|
635
|
+
}
|
|
628
636
|
/* istanbul ignore next */
|
|
629
637
|
render() {
|
|
630
638
|
var _a;
|
|
631
639
|
if (this.dataUnit == undefined) {
|
|
632
640
|
return;
|
|
633
641
|
}
|
|
634
|
-
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), 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 }, 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)
|
|
642
|
+
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), 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)
|
|
635
643
|
? undefined
|
|
636
644
|
: 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: 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() }))));
|
|
637
645
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { D as DataFetcher } from './form-config-fetcher-e3094014.js';
|
|
2
|
-
import { a as PreloadManager } from './pesquisa-fetcher-
|
|
2
|
+
import { a as PreloadManager } from './pesquisa-fetcher-253715e4.js';
|
|
3
3
|
import { SortMode, ApplicationContext, UserInterface, DateUtils, DataType } from '@sankhyalabs/core';
|
|
4
4
|
import './index-0ece87a6.js';
|
|
5
5
|
import './ISave-d8c8bc59.js';
|
|
@@ -72,11 +72,11 @@ class SnkFormConfigManager {
|
|
|
72
72
|
var _a;
|
|
73
73
|
const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
|
|
74
74
|
if (fields != undefined && fields.length > 0) {
|
|
75
|
-
return fields.map(({ label, name, readOnly }) => {
|
|
75
|
+
return fields.map(({ label, name, readOnly, visible }) => {
|
|
76
76
|
if (label == undefined) {
|
|
77
77
|
return dataUnit.getField(name);
|
|
78
78
|
}
|
|
79
|
-
return { name, label, readOnly };
|
|
79
|
+
return { name, label, readOnly, visible };
|
|
80
80
|
})
|
|
81
81
|
.filter(field => this.isFieldVisible(field, descriptionFilter));
|
|
82
82
|
}
|
|
@@ -552,7 +552,7 @@ class SnkMessageBuilder {
|
|
|
552
552
|
this.loadAppMessages().then((msgs) => {
|
|
553
553
|
this._appMessages = msgs;
|
|
554
554
|
}, error => {
|
|
555
|
-
console.info('O arquivo de mensagens personalizadas não foi encontrado no caminho /messages/appmessages
|
|
555
|
+
console.info('O arquivo de mensagens personalizadas não foi encontrado no caminho /messages/appmessages', error);
|
|
556
556
|
});
|
|
557
557
|
}
|
|
558
558
|
/**
|