@sankhyalabs/sankhyablocks 8.15.3 → 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/{SnkMultiSelectionListDataSource-3c08d25c.js → IExporterProvider-597949f9.js} +94 -4
- package/dist/cjs/RecordIDUtils-3735135c.js +43 -0
- package/dist/cjs/{SnkFormConfigManager-f9dc0d28.js → SnkFormConfigManager-166cbd1f.js} +8 -7
- package/dist/cjs/{SnkMessageBuilder-66aa2557.js → SnkMessageBuilder-897ffd08.js} +9 -13
- package/dist/cjs/{pesquisa-fetcher-562d281f.js → dataunit-fetcher-688d3f05.js} +87 -180
- package/dist/cjs/{index-0922807b.js → index-1dfc7a6e.js} +5 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pesquisa-fetcher-680e198f.js +166 -0
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +5 -3
- package/dist/cjs/snk-application.cjs.entry.js +35 -12
- package/dist/cjs/snk-attach.cjs.entry.js +71 -46
- package/dist/cjs/snk-crud.cjs.entry.js +101 -10
- package/dist/cjs/snk-data-exporter.cjs.entry.js +315 -85
- package/dist/cjs/snk-data-unit-8fa7917a.js +689 -0
- package/dist/cjs/snk-data-unit.cjs.entry.js +12 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +50 -10
- package/dist/cjs/snk-filter-bar.cjs.entry.js +6 -2
- 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-view.cjs.entry.js +67 -0
- package/dist/cjs/snk-form.cjs.entry.js +52 -7
- package/dist/cjs/snk-grid.cjs.entry.js +165 -108
- package/dist/cjs/{snk-guides-viewer-bb6087cd.js → snk-guides-viewer-9c682034.js} +43 -10
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +9 -7
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +268 -40
- package/dist/cjs/snk-taskbar.cjs.entry.js +4 -3
- package/dist/cjs/{taskbar-elements-3ecd1278.js → taskbar-elements-9ad1f9c0.js} +3 -3
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/snk-application/snk-application.js +35 -11
- package/dist/collection/components/snk-attach/snk-attach.js +67 -44
- package/dist/collection/components/snk-crud/interfaces/PropsCustomEditor.js +1 -0
- package/dist/collection/components/snk-crud/interfaces/PropsCustomRender.js +1 -0
- package/dist/collection/components/snk-crud/snk-crud.js +305 -7
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +136 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +161 -0
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +134 -7
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +97 -0
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +74 -0
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +54 -1
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterStrategy.js +1 -0
- package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +58 -0
- package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +55 -0
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +59 -52
- package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +62 -0
- package/dist/collection/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.js +88 -0
- package/dist/collection/components/snk-data-exporter/utils/ParserExport.js +20 -0
- package/dist/collection/components/snk-data-exporter/utils/RecordIDUtils.js +38 -0
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +538 -218
- package/dist/collection/components/snk-data-unit/test/resources/metadataMock.js +24 -0
- package/dist/collection/components/snk-data-unit/test/resources/parentMetadataMock.js +18 -0
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +22 -1
- package/dist/collection/components/snk-form/snk-form.js +102 -5
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +7 -6
- package/dist/collection/components/snk-form-config/snk-form-config.js +1 -1
- package/dist/collection/components/snk-grid/snk-grid.js +240 -101
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +406 -20
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +2 -2
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +2 -1
- package/dist/collection/lib/@types/index.js +5 -0
- package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +35 -0
- package/dist/collection/lib/configs/ConfigStorage.js +1 -0
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +7 -3
- package/dist/collection/lib/dataUnit/ValueFormatter.js +4 -0
- package/dist/collection/lib/dataUnit/interfaces/InMemoryLoaderConfig.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +3 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.js +4 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +11 -13
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +53 -4
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.js +22 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +4 -4
- package/dist/collection/lib/message/SnkMessageBuilder.js +5 -12
- package/dist/collection/lib/message/resources/snk-data-exporter.msg.js +2 -0
- package/dist/collection/lib/message/resources/snk-data-unit.msg.js +2 -1
- package/dist/components/ConfigStorage.js +1 -0
- package/dist/components/{field-search.js → IExporterProvider.js} +93 -6
- package/dist/components/ISave.js +47 -0
- package/dist/components/SnkFormConfigManager.js +7 -6
- package/dist/components/SnkMessageBuilder.js +9 -13
- package/dist/components/dataunit-fetcher.js +84 -182
- package/dist/components/index2.js +198 -33
- package/dist/components/pesquisa-fetcher.js +164 -0
- package/dist/components/snk-actions-button2.js +4 -11
- package/dist/components/snk-application2.js +31 -9
- package/dist/components/snk-attach2.js +65 -41
- package/dist/components/snk-crud.js +110 -11
- package/dist/components/snk-data-exporter2.js +309 -85
- package/dist/components/snk-data-unit2.js +485 -216
- package/dist/components/snk-detail-view2.js +96 -14
- package/dist/components/snk-expression-item2.js +1 -1
- package/dist/components/snk-filter-bar2.js +6 -1
- package/dist/components/snk-form-config2.js +1 -1
- package/dist/components/snk-form-view2.js +72 -1
- package/dist/components/snk-form.js +53 -6
- package/dist/components/snk-grid2.js +168 -106
- package/dist/components/snk-personalized-filter2.js +1 -1
- package/dist/components/snk-simple-crud2.js +263 -25
- package/dist/components/snk-taskbar2.js +6 -5
- package/dist/esm/{ConfigStorage-86187da3.js → ConfigStorage-3806514e.js} +1 -0
- package/dist/esm/{SnkMultiSelectionListDataSource-6a879955.js → IExporterProvider-63a188b6.js} +93 -5
- package/dist/esm/RecordIDUtils-87d02110.js +41 -0
- package/dist/esm/{SnkFormConfigManager-f53f9f87.js → SnkFormConfigManager-31b24066.js} +8 -7
- package/dist/esm/{SnkMessageBuilder-0a4becdd.js → SnkMessageBuilder-571462fb.js} +9 -13
- package/dist/esm/{pesquisa-fetcher-c7ce8ee7.js → dataunit-fetcher-264191b2.js} +83 -181
- package/dist/esm/{index-0ece87a6.js → index-3aa4977a.js} +6 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pesquisa-fetcher-03c8f919.js +164 -0
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +5 -3
- package/dist/esm/snk-application.entry.js +34 -11
- package/dist/esm/snk-attach.entry.js +66 -41
- package/dist/esm/snk-crud.entry.js +101 -10
- package/dist/esm/snk-data-exporter.entry.js +316 -86
- package/dist/esm/snk-data-unit-f5cbe64b.js +687 -0
- package/dist/esm/snk-data-unit.entry.js +12 -2
- package/dist/esm/snk-detail-view.entry.js +50 -10
- package/dist/esm/snk-filter-bar.entry.js +6 -2
- 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-view.entry.js +67 -0
- package/dist/esm/snk-form.entry.js +52 -7
- package/dist/esm/snk-grid.entry.js +163 -106
- package/dist/esm/{snk-guides-viewer-1d95ebf2.js → snk-guides-viewer-8f6960a2.js} +43 -10
- package/dist/esm/snk-guides-viewer.entry.js +9 -7
- package/dist/esm/snk-personalized-filter.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +256 -28
- package/dist/esm/snk-taskbar.entry.js +4 -3
- package/dist/esm/{taskbar-elements-2473c8ac.js → taskbar-elements-d59867f1.js} +3 -3
- package/dist/sankhyablocks/p-17def7cd.js +1 -0
- package/dist/sankhyablocks/p-1db45d26.entry.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-30cf616e.js +1 -0
- package/dist/sankhyablocks/p-3a212712.js +1 -0
- 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-4e5e1313.entry.js +1 -0
- package/dist/sankhyablocks/{p-aff76a53.js → p-52920496.js} +1 -1
- package/dist/sankhyablocks/p-62ba211a.entry.js +1 -0
- package/dist/sankhyablocks/p-6bb2f3e9.entry.js +1 -0
- package/dist/sankhyablocks/p-7505da04.entry.js +1 -0
- package/dist/sankhyablocks/p-7619bdb1.entry.js +11 -0
- package/dist/sankhyablocks/p-7a85fd49.entry.js +1 -0
- package/dist/sankhyablocks/{p-ae4fc9a9.js → p-7e7a7473.js} +1 -1
- package/dist/sankhyablocks/p-7ef9c55c.js +1 -0
- package/dist/sankhyablocks/p-80042dc6.entry.js +1 -0
- package/dist/sankhyablocks/p-8c59edd7.entry.js +1 -0
- package/dist/sankhyablocks/p-9606509c.entry.js +1 -0
- package/dist/sankhyablocks/p-9863d682.js +1 -0
- package/dist/sankhyablocks/p-ae93d46a.entry.js +1 -0
- package/dist/sankhyablocks/p-af8efd95.js +6 -0
- package/dist/sankhyablocks/p-d6e26ea8.entry.js +1 -0
- package/dist/sankhyablocks/p-f2809746.entry.js +1 -0
- package/dist/sankhyablocks/p-f4450320.entry.js +1 -0
- package/dist/sankhyablocks/p-fe79f83a.js +60 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +7 -3
- package/dist/types/components/snk-attach/snk-attach.d.ts +11 -9
- package/dist/types/components/snk-crud/interfaces/PropsCustomEditor.d.ts +4 -0
- package/dist/types/components/snk-crud/interfaces/PropsCustomRender.d.ts +4 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +45 -1
- package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +23 -0
- package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +28 -3
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +24 -0
- package/dist/types/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.d.ts +14 -0
- package/dist/types/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.d.ts +12 -0
- package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +24 -4
- package/dist/types/components/snk-data-exporter/interfaces/IExporterStrategy.d.ts +5 -0
- package/dist/types/components/snk-data-exporter/providers/ClientSideExporterProvider.d.ts +17 -0
- package/dist/types/components/snk-data-exporter/providers/ServerSideExporterProvider.d.ts +17 -0
- package/dist/types/components/snk-data-exporter/snk-data-exporter.d.ts +4 -1
- package/dist/types/components/snk-data-exporter/structure/ItemBuilder.d.ts +21 -0
- package/dist/types/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.d.ts +77 -0
- package/dist/types/components/snk-data-exporter/utils/ParserExport.d.ts +4 -0
- package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +3 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +66 -2
- package/dist/types/components/snk-data-unit/test/resources/metadataMock.d.ts +3 -0
- package/dist/types/components/snk-data-unit/test/resources/parentMetadataMock.d.ts +3 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
- package/dist/types/components/snk-form/snk-form.d.ts +14 -0
- package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +2 -2
- package/dist/types/components/snk-grid/snk-grid.d.ts +46 -6
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +62 -4
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +1 -1
- package/dist/types/components.d.ts +261 -4
- package/dist/types/lib/@types/index.d.ts +5 -0
- package/dist/types/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.d.ts +11 -0
- package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +2 -1
- package/dist/types/lib/dataUnit/ValueFormatter.d.ts +2 -0
- package/dist/types/lib/dataUnit/interfaces/InMemoryLoaderConfig.d.ts +3 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.d.ts +2 -1
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.d.ts +10 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.d.ts +7 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +6 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.d.ts +20 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.d.ts +3 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.d.ts +2 -1
- package/dist/types/lib/http/data-fetcher/fetchers/pesquisa-fetcher.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/snk-data-unit-41c29713.js +0 -462
- package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/index.js +0 -34
- package/dist/components/index3.js +0 -199
- package/dist/esm/snk-data-unit-de1d140d.js +0 -460
- package/dist/sankhyablocks/p-032fe52e.js +0 -1
- package/dist/sankhyablocks/p-03dcc5ff.entry.js +0 -1
- package/dist/sankhyablocks/p-0594db5a.entry.js +0 -1
- package/dist/sankhyablocks/p-06e13db2.js +0 -1
- package/dist/sankhyablocks/p-07a61550.entry.js +0 -1
- package/dist/sankhyablocks/p-1403a4b6.entry.js +0 -1
- package/dist/sankhyablocks/p-14a08904.entry.js +0 -1
- package/dist/sankhyablocks/p-15802c59.entry.js +0 -1
- package/dist/sankhyablocks/p-235dc7b1.js +0 -65
- package/dist/sankhyablocks/p-32556aa6.js +0 -1
- package/dist/sankhyablocks/p-38289a55.js +0 -1
- package/dist/sankhyablocks/p-3c632d48.js +0 -1
- package/dist/sankhyablocks/p-3f833983.entry.js +0 -1
- package/dist/sankhyablocks/p-52c8e589.js +0 -1
- package/dist/sankhyablocks/p-5e1502b6.entry.js +0 -11
- package/dist/sankhyablocks/p-74d349c3.entry.js +0 -1
- package/dist/sankhyablocks/p-93167e28.entry.js +0 -1
- package/dist/sankhyablocks/p-add17f6a.entry.js +0 -1
- package/dist/sankhyablocks/p-bd47dd16.entry.js +0 -1
- package/dist/sankhyablocks/p-c1f88236.entry.js +0 -1
- package/dist/sankhyablocks/p-ccdd5332.entry.js +0 -1
- package/dist/sankhyablocks/p-ee9536bc.entry.js +0 -1
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/index.d.ts +0 -3
@@ -11,16 +11,21 @@ import { buildFieldSearch, openFieldSearch } from '../snk-taskbar/subcomponents/
|
|
11
11
|
import { ConfigStorage } from '../../lib/configs/ConfigStorage';
|
12
12
|
import { SnkFormConfigManager } from '../snk-form-config/SnkFormConfigManager';
|
13
13
|
import { REGULAR_DEFAULT_BTNS, REGULAR_SELECTED_BTNS } from './regular-buttons';
|
14
|
+
import RmPrecisionCustomValueFormatter from '../../lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter';
|
15
|
+
import ClientSideExporterProvider from '../snk-data-exporter/providers/ClientSideExporterProvider';
|
16
|
+
import store from "../../lib/store";
|
14
17
|
export class SnkSimpleCrud {
|
15
18
|
constructor() {
|
16
19
|
this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
|
17
20
|
this._keyDownHandler = (event) => this.keyDownListener(event);
|
18
21
|
this._formConfigFetcher = new FormConfigFetcher();
|
22
|
+
this._customEditors = new Map();
|
23
|
+
this._customRenders = new Map();
|
19
24
|
this._taskbarProcessor = new TaskbarProcessor({
|
20
|
-
"snkSimpleCrudTaskbar.form_regular": this.getButtons(false, TaskbarElement.GRID_MODE),
|
21
|
-
"snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, TaskbarElement.FORM_MODE),
|
22
|
-
"snkSimpleCrudTaskbar.form_selected": this.getButtons(true, TaskbarElement.GRID_MODE),
|
23
|
-
"snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, TaskbarElement.FORM_MODE),
|
25
|
+
"snkSimpleCrudTaskbar.form_regular": this.getButtons(false, [TaskbarElement.GRID_MODE]),
|
26
|
+
"snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]),
|
27
|
+
"snkSimpleCrudTaskbar.form_selected": this.getButtons(true, [TaskbarElement.GRID_MODE]),
|
28
|
+
"snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]),
|
24
29
|
"snkSimpleCrudTaskbar.finish_edition": ["CANCEL", "SAVE"]
|
25
30
|
});
|
26
31
|
this._showPopUpGridConfig = false;
|
@@ -31,12 +36,15 @@ export class SnkSimpleCrud {
|
|
31
36
|
this._customContainerId = `SNK-SIMPLE-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
|
32
37
|
this.dataState = undefined;
|
33
38
|
this.dataUnit = undefined;
|
39
|
+
this.entityName = undefined;
|
34
40
|
this.mode = SIMPLE_CRUD_MODE.SERVER;
|
35
41
|
this.gridConfig = undefined;
|
36
42
|
this.formConfig = undefined;
|
37
43
|
this._formFields = [];
|
44
|
+
this._fieldsProps = new Map();
|
38
45
|
this.multipleSelection = undefined;
|
39
46
|
this.useCancelConfirm = true;
|
47
|
+
this.pageSize = 150;
|
40
48
|
this.resourceID = undefined;
|
41
49
|
this.taskbarManager = undefined;
|
42
50
|
this.messagesBuilder = undefined;
|
@@ -47,6 +55,34 @@ export class SnkSimpleCrud {
|
|
47
55
|
this.gridLegacyConfigName = undefined;
|
48
56
|
this.formLegacyConfigName = undefined;
|
49
57
|
this.ignoreReadOnlyFormFields = false;
|
58
|
+
this.autoFocus = true;
|
59
|
+
this.domainMessagesBuilder = undefined;
|
60
|
+
this.autoLoad = undefined;
|
61
|
+
}
|
62
|
+
/**
|
63
|
+
* Registra um editor customizado para campos da grade e formulário.
|
64
|
+
*/
|
65
|
+
async addCustomEditor(fieldName, customEditor) {
|
66
|
+
if (this._grid && this._form) {
|
67
|
+
this._grid.addCustomEditor(fieldName, customEditor);
|
68
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
69
|
+
return;
|
70
|
+
}
|
71
|
+
const newCustomEditors = new Map(this._customEditors);
|
72
|
+
newCustomEditors.set(fieldName, customEditor);
|
73
|
+
this._customEditors = newCustomEditors;
|
74
|
+
}
|
75
|
+
/**
|
76
|
+
* Registra um render customizado para colunas da grid.
|
77
|
+
*/
|
78
|
+
async addGridCustomRender(fieldName, customRender) {
|
79
|
+
if (this._grid) {
|
80
|
+
this._grid.addGridCustomRender(fieldName, customRender);
|
81
|
+
return;
|
82
|
+
}
|
83
|
+
const newCustomRenders = new Map(this._customRenders);
|
84
|
+
newCustomRenders.set(fieldName, customRender);
|
85
|
+
this._customRenders = newCustomRenders;
|
50
86
|
}
|
51
87
|
handleResourceIDChanged(newValue, oldValue) {
|
52
88
|
if (StringUtils.isEmpty(newValue)) {
|
@@ -58,9 +94,30 @@ export class SnkSimpleCrud {
|
|
58
94
|
this.loadFormConfig(true);
|
59
95
|
this.loadGridConfig(true);
|
60
96
|
}
|
61
|
-
|
97
|
+
/**
|
98
|
+
* Registra um formatador de valores para uma coluna da grid.
|
99
|
+
*/
|
100
|
+
async addCustomValueFormatter(columnName, customFormatter) {
|
101
|
+
this._grid.addCustomValueFormatter(columnName, customFormatter);
|
102
|
+
}
|
103
|
+
/**
|
104
|
+
* Remove o formatador de valores de uma coluna da grid.
|
105
|
+
*/
|
106
|
+
async removeCustomValueFormatter(columnName) {
|
107
|
+
this._grid.removeCustomValueFormatter(columnName);
|
108
|
+
}
|
109
|
+
/**
|
110
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
111
|
+
*/
|
112
|
+
async setFieldProp(fieldName, propName, value) {
|
113
|
+
const newCustomFieldProps = new Map(this._fieldsProps);
|
114
|
+
const currentProps = this._fieldsProps.get(fieldName);
|
115
|
+
newCustomFieldProps.set(fieldName, Object.assign(Object.assign({}, currentProps), { [propName]: value }));
|
116
|
+
this._fieldsProps = newCustomFieldProps;
|
117
|
+
}
|
118
|
+
getButtons(selected, extraButtons) {
|
62
119
|
return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
|
63
|
-
.concat(
|
120
|
+
.concat(extraButtons));
|
64
121
|
}
|
65
122
|
addConfigButton(buttons) {
|
66
123
|
if (this.configName === undefined) {
|
@@ -100,15 +157,19 @@ export class SnkSimpleCrud {
|
|
100
157
|
}
|
101
158
|
evt.stopPropagation();
|
102
159
|
}
|
160
|
+
async onChangeEntityName(newValue) {
|
161
|
+
if (this.dataUnit)
|
162
|
+
return;
|
163
|
+
const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
164
|
+
this.dataUnit = await application.getDataUnit(newValue, null, null, this.configName);
|
165
|
+
}
|
103
166
|
onModeChange() {
|
104
167
|
if (this.mode == SIMPLE_CRUD_MODE.IN_MEMORY) {
|
105
168
|
this.initInMemoryDataUnit();
|
106
169
|
}
|
107
170
|
}
|
108
171
|
observeDataState(newValue, oldValue) {
|
109
|
-
|
110
|
-
this.dataStateChange.emit(newValue);
|
111
|
-
}
|
172
|
+
this.handleDataStateChange(newValue, oldValue);
|
112
173
|
}
|
113
174
|
async observeFormLegacy(newValue, oldValue) {
|
114
175
|
await this.handleUpdateFormLegacyConfig(newValue, oldValue);
|
@@ -116,6 +177,29 @@ export class SnkSimpleCrud {
|
|
116
177
|
async observeGridLegacy(newValue, oldValue) {
|
117
178
|
await this.handleUpdateGridLegacyConfig(newValue, oldValue);
|
118
179
|
}
|
180
|
+
async handleDataStateChange(newValue, oldValue) {
|
181
|
+
if (ObjectUtils.objectToString(oldValue) != ObjectUtils.objectToString(newValue)) {
|
182
|
+
this.dataStateChange.emit(newValue);
|
183
|
+
}
|
184
|
+
await this.processRmPrecision();
|
185
|
+
}
|
186
|
+
async processRmPrecision() {
|
187
|
+
var _a, _b;
|
188
|
+
const fieldsWithRmPrecision = await this._snkDataUnit.getFieldsWithRmPrecision();
|
189
|
+
for (const field of fieldsWithRmPrecision || []) {
|
190
|
+
if (!field) {
|
191
|
+
continue;
|
192
|
+
}
|
193
|
+
const rmPrecision = (_b = (_a = this.dataState) === null || _a === void 0 ? void 0 : _a.rowMetadata) === null || _b === void 0 ? void 0 : _b.getProp('rm_precision', field);
|
194
|
+
if (!rmPrecision && rmPrecision !== 0) {
|
195
|
+
continue;
|
196
|
+
}
|
197
|
+
await this.setFieldProp(field, 'precision', rmPrecision);
|
198
|
+
await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
|
199
|
+
}
|
200
|
+
;
|
201
|
+
this._rmPrecisionCustomValueFormatter.setDataState(this.dataState);
|
202
|
+
}
|
119
203
|
async handleUpdateGridLegacyConfig(newValue, oldValue) {
|
120
204
|
if (newValue == undefined || newValue == oldValue) {
|
121
205
|
return;
|
@@ -212,6 +296,7 @@ export class SnkSimpleCrud {
|
|
212
296
|
}
|
213
297
|
async componentWillRender() {
|
214
298
|
this._resourceID = await this.application.getResourceID();
|
299
|
+
this.dataExporterProviderStore();
|
215
300
|
this._taskbarProcessor.process(this.getTaskBarId(), this.taskbarManager, this.dataState, this.getTaskBarDisabledButtons());
|
216
301
|
if (this.configName === undefined) {
|
217
302
|
return;
|
@@ -223,32 +308,70 @@ export class SnkSimpleCrud {
|
|
223
308
|
this.loadGridConfig();
|
224
309
|
this.loadFormConfig();
|
225
310
|
}
|
311
|
+
componentDidRender() {
|
312
|
+
this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
|
313
|
+
this.addGridCustomValueFormattters();
|
314
|
+
this.setFieldsProps();
|
315
|
+
this.setCustomRenders();
|
316
|
+
this.setCustomEditors();
|
317
|
+
}
|
226
318
|
componentWillLoad() {
|
227
319
|
this.processMetadata();
|
228
320
|
this.onModeChange();
|
229
321
|
this.configDatasource();
|
322
|
+
this._rmPrecisionCustomValueFormatter = new RmPrecisionCustomValueFormatter();
|
230
323
|
}
|
231
324
|
componentDidLoad() {
|
232
325
|
CSSVarsUtils.applyVarsGrid(this._element, this._grid);
|
233
326
|
}
|
327
|
+
setCustomRenders() {
|
328
|
+
if (!this._grid) {
|
329
|
+
return;
|
330
|
+
}
|
331
|
+
for (const [fieldName, customRender] of this._customRenders) {
|
332
|
+
this._grid.addGridCustomRender(fieldName, customRender);
|
333
|
+
this._customRenders.delete(fieldName);
|
334
|
+
}
|
335
|
+
}
|
336
|
+
setCustomEditors() {
|
337
|
+
if (!this._grid || !this._form) {
|
338
|
+
return;
|
339
|
+
}
|
340
|
+
for (const [fieldName, customEditor] of this._customEditors) {
|
341
|
+
this._grid.addCustomEditor(fieldName, customEditor);
|
342
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
343
|
+
this._customEditors.delete(fieldName);
|
344
|
+
}
|
345
|
+
}
|
234
346
|
configDatasource() {
|
235
347
|
this._multiSelectionListDataSource.setApplication(this.application);
|
236
348
|
this._multiSelectionListDataSource.setDataUnit(this.dataUnit);
|
237
349
|
}
|
350
|
+
setFieldsProps() {
|
351
|
+
if (!this._form) {
|
352
|
+
return;
|
353
|
+
}
|
354
|
+
for (const [fieldName, props] of this._fieldsProps) {
|
355
|
+
for (const prop in props) {
|
356
|
+
this._form.setFieldProp(fieldName, prop, props[prop]);
|
357
|
+
}
|
358
|
+
this._fieldsProps.delete(fieldName);
|
359
|
+
}
|
360
|
+
}
|
238
361
|
getTaskBarId() {
|
239
|
-
var _a, _b
|
362
|
+
var _a, _b;
|
240
363
|
if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
|
241
364
|
return "snkSimpleCrudTaskbar.finish_edition";
|
242
365
|
}
|
243
366
|
if (((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.selectionInfo) &&
|
244
367
|
!this.dataState.selectionInfo.isAllRecords() &&
|
245
|
-
|
368
|
+
this.dataState.selectionInfo.length > 0) {
|
246
369
|
return this._currentViewMode === VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_selected" : "snkSimpleCrudTaskbar.form_selected";
|
247
370
|
}
|
248
371
|
return this._currentViewMode === VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
|
249
372
|
}
|
250
373
|
initInMemoryDataUnit() {
|
251
|
-
this._inMemoryLoader = new InMemoryLoader(this._metadata);
|
374
|
+
this._inMemoryLoader = new InMemoryLoader(this._metadata, undefined, { autoLoad: this.autoLoad });
|
252
375
|
this.dataUnit = this._inMemoryLoader.dataUnit;
|
253
376
|
this.dataUnitReady.emit(this.dataUnit);
|
254
377
|
}
|
@@ -287,12 +410,11 @@ export class SnkSimpleCrud {
|
|
287
410
|
var _a;
|
288
411
|
(_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.close();
|
289
412
|
}
|
290
|
-
updateConfig() {
|
413
|
+
async updateConfig() {
|
291
414
|
if (this._formConfigManager == undefined) {
|
292
415
|
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
293
416
|
}
|
294
417
|
this._formConfigManager.setConfig(this.formConfig);
|
295
|
-
return;
|
296
418
|
}
|
297
419
|
processMetadata() {
|
298
420
|
const fieldsMetadataElem = this._element.querySelectorAll("snk-field-metadata");
|
@@ -324,11 +446,28 @@ export class SnkSimpleCrud {
|
|
324
446
|
};
|
325
447
|
}
|
326
448
|
}
|
449
|
+
addGridCustomValueFormattters() {
|
450
|
+
var _a, _b, _c;
|
451
|
+
const metadataFields = ((_a = this._metadata) === null || _a === void 0 ? void 0 : _a.fields) || ((_c = (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.metadata) === null || _c === void 0 ? void 0 : _c.fields);
|
452
|
+
if (!metadataFields) {
|
453
|
+
return;
|
454
|
+
}
|
455
|
+
const fieldsWithRmPrecision = [];
|
456
|
+
metadataFields.forEach((field) => {
|
457
|
+
var _a;
|
458
|
+
if (((_a = field.properties) === null || _a === void 0 ? void 0 : _a.rm_precision) && !fieldsWithRmPrecision.includes(field.name)) {
|
459
|
+
fieldsWithRmPrecision.push(field.name);
|
460
|
+
}
|
461
|
+
});
|
462
|
+
fieldsWithRmPrecision.forEach(field => {
|
463
|
+
this.addCustomValueFormatter(field, this._rmPrecisionCustomValueFormatter);
|
464
|
+
});
|
465
|
+
}
|
327
466
|
onDataStateChange(evt) {
|
328
467
|
this.dataState = Object.assign({}, evt.detail);
|
329
468
|
}
|
330
469
|
getTaskBarDisabledButtons() {
|
331
|
-
var _a, _b, _c, _d;
|
470
|
+
var _a, _b, _c, _d, _e, _f;
|
332
471
|
const disabledButtons = [];
|
333
472
|
if (!((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.hasNext)) {
|
334
473
|
disabledButtons.push(TaskbarElement.NEXT);
|
@@ -339,6 +478,9 @@ export class SnkSimpleCrud {
|
|
339
478
|
if ((_d = (_c = this.dataState) === null || _c === void 0 ? void 0 : _c.selectionInfo) === null || _d === void 0 ? void 0 : _d.isEmpty()) {
|
340
479
|
disabledButtons.push(TaskbarElement.FORM_MODE);
|
341
480
|
}
|
481
|
+
if (((_f = (_e = this.dataState) === null || _e === void 0 ? void 0 : _e.selectionInfo) === null || _f === void 0 ? void 0 : _f.length) > 1) {
|
482
|
+
disabledButtons.push(TaskbarElement.CLONE);
|
483
|
+
}
|
342
484
|
return disabledButtons;
|
343
485
|
}
|
344
486
|
handleCancelEdit() {
|
@@ -482,9 +624,23 @@ export class SnkSimpleCrud {
|
|
482
624
|
.then(() => {
|
483
625
|
this.setGridConfig(config);
|
484
626
|
this.closeGridConfig();
|
627
|
+
this.dataExporterProviderStore();
|
485
628
|
});
|
486
629
|
evt.stopPropagation();
|
487
630
|
}
|
631
|
+
async dataExporterProviderStore() {
|
632
|
+
if (this.dataUnit == undefined) {
|
633
|
+
return;
|
634
|
+
}
|
635
|
+
if (this._grid == undefined) {
|
636
|
+
return;
|
637
|
+
}
|
638
|
+
const dataExporterProvider = new ClientSideExporterProvider(this.dataUnit, this._grid);
|
639
|
+
store.set("exporterProviders", Object.assign(Object.assign({}, store.get("exporterProviders")), { [this.getDataExporterStoreKey()]: dataExporterProvider }));
|
640
|
+
}
|
641
|
+
getDataExporterStoreKey() {
|
642
|
+
return `SnkSimpleCrudDataExporter:${this.configName == undefined ? this.dataUnit.name : this.configName}`;
|
643
|
+
}
|
488
644
|
setGridConfig(config) {
|
489
645
|
this.gridConfig = config;
|
490
646
|
CrudUtils.assertDefaultSorting(this.gridConfig, this.dataUnit);
|
@@ -500,6 +656,15 @@ export class SnkSimpleCrud {
|
|
500
656
|
closeFormConfig() {
|
501
657
|
this._showFormConfig = false;
|
502
658
|
}
|
659
|
+
getPageSize() {
|
660
|
+
if (this.mode === SIMPLE_CRUD_MODE.IN_MEMORY) {
|
661
|
+
return 0;
|
662
|
+
}
|
663
|
+
if (this.pageSize == undefined) {
|
664
|
+
return 150;
|
665
|
+
}
|
666
|
+
return this.pageSize;
|
667
|
+
}
|
503
668
|
//No momento não daremos suporte para configuração de formulário quando houver formLegacyConfigName
|
504
669
|
handleShowFormConfig() {
|
505
670
|
return this._showFormConfig && !this.formLegacyConfigName;
|
@@ -508,22 +673,30 @@ export class SnkSimpleCrud {
|
|
508
673
|
return StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
|
509
674
|
}
|
510
675
|
getFormConfig() {
|
511
|
-
var _a
|
512
|
-
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);
|
513
678
|
if (!this.configName && !configFromManager) {
|
514
679
|
return this.formConfig;
|
515
680
|
}
|
516
681
|
return configFromManager;
|
517
682
|
}
|
683
|
+
updateFormConfig() {
|
684
|
+
const newConfig = Object.assign(Object.assign({}, this.formConfig), { fields: this.dataUnit.metadata.fields });
|
685
|
+
this.setFormConfig(newConfig, true);
|
686
|
+
if (this._formConfigManager == undefined) {
|
687
|
+
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
688
|
+
}
|
689
|
+
this._formConfigManager.setConfig(this.formConfig);
|
690
|
+
}
|
518
691
|
/* istanbul ignore next */
|
519
692
|
render() {
|
520
693
|
var _a;
|
521
694
|
if (this.dataUnit == undefined) {
|
522
695
|
return;
|
523
696
|
}
|
524
|
-
return (h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
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)
|
525
698
|
? undefined
|
526
|
-
: 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() }))));
|
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() }))));
|
527
700
|
}
|
528
701
|
static get is() { return "snk-simple-crud"; }
|
529
702
|
static get encapsulation() { return "scoped"; }
|
@@ -579,6 +752,23 @@ export class SnkSimpleCrud {
|
|
579
752
|
"text": ""
|
580
753
|
}
|
581
754
|
},
|
755
|
+
"entityName": {
|
756
|
+
"type": "string",
|
757
|
+
"mutable": false,
|
758
|
+
"complexType": {
|
759
|
+
"original": "string",
|
760
|
+
"resolved": "string",
|
761
|
+
"references": {}
|
762
|
+
},
|
763
|
+
"required": false,
|
764
|
+
"optional": false,
|
765
|
+
"docs": {
|
766
|
+
"tags": [],
|
767
|
+
"text": "Define o nome da entidade que o componente vai utilizar para fazer as opera\u00E7\u00F5es de CRUD"
|
768
|
+
},
|
769
|
+
"attribute": "entity-name",
|
770
|
+
"reflect": false
|
771
|
+
},
|
582
772
|
"mode": {
|
583
773
|
"type": "number",
|
584
774
|
"mutable": false,
|
@@ -677,6 +867,24 @@ export class SnkSimpleCrud {
|
|
677
867
|
"reflect": false,
|
678
868
|
"defaultValue": "true"
|
679
869
|
},
|
870
|
+
"pageSize": {
|
871
|
+
"type": "number",
|
872
|
+
"mutable": false,
|
873
|
+
"complexType": {
|
874
|
+
"original": "number",
|
875
|
+
"resolved": "number",
|
876
|
+
"references": {}
|
877
|
+
},
|
878
|
+
"required": false,
|
879
|
+
"optional": false,
|
880
|
+
"docs": {
|
881
|
+
"tags": [],
|
882
|
+
"text": "Determina quantas linhas s\u00E3o retornadas por p\u00E1gina."
|
883
|
+
},
|
884
|
+
"attribute": "page-size",
|
885
|
+
"reflect": false,
|
886
|
+
"defaultValue": "150"
|
887
|
+
},
|
680
888
|
"resourceID": {
|
681
889
|
"type": "string",
|
682
890
|
"mutable": false,
|
@@ -860,6 +1068,58 @@ export class SnkSimpleCrud {
|
|
860
1068
|
"attribute": "ignore-read-only-form-fields",
|
861
1069
|
"reflect": false,
|
862
1070
|
"defaultValue": "false"
|
1071
|
+
},
|
1072
|
+
"autoFocus": {
|
1073
|
+
"type": "boolean",
|
1074
|
+
"mutable": false,
|
1075
|
+
"complexType": {
|
1076
|
+
"original": "boolean",
|
1077
|
+
"resolved": "boolean",
|
1078
|
+
"references": {}
|
1079
|
+
},
|
1080
|
+
"required": false,
|
1081
|
+
"optional": true,
|
1082
|
+
"docs": {
|
1083
|
+
"tags": [],
|
1084
|
+
"text": "Define se a grid ser\u00E1 focada ao ser carregada."
|
1085
|
+
},
|
1086
|
+
"attribute": "auto-focus",
|
1087
|
+
"reflect": false,
|
1088
|
+
"defaultValue": "true"
|
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
|
+
},
|
1107
|
+
"autoLoad": {
|
1108
|
+
"type": "boolean",
|
1109
|
+
"mutable": false,
|
1110
|
+
"complexType": {
|
1111
|
+
"original": "boolean",
|
1112
|
+
"resolved": "boolean",
|
1113
|
+
"references": {}
|
1114
|
+
},
|
1115
|
+
"required": false,
|
1116
|
+
"optional": true,
|
1117
|
+
"docs": {
|
1118
|
+
"tags": [],
|
1119
|
+
"text": "Define se a carga dos dados ser\u00E1 feita assim que o componente for carregado."
|
1120
|
+
},
|
1121
|
+
"attribute": "auto-load",
|
1122
|
+
"reflect": false
|
863
1123
|
}
|
864
1124
|
};
|
865
1125
|
}
|
@@ -871,7 +1131,8 @@ export class SnkSimpleCrud {
|
|
871
1131
|
"_config": {},
|
872
1132
|
"_fieldToGetFocus": {},
|
873
1133
|
"_customContainerId": {},
|
874
|
-
"_formFields": {}
|
1134
|
+
"_formFields": {},
|
1135
|
+
"_fieldsProps": {}
|
875
1136
|
};
|
876
1137
|
}
|
877
1138
|
static get events() {
|
@@ -986,6 +1247,128 @@ export class SnkSimpleCrud {
|
|
986
1247
|
}
|
987
1248
|
static get methods() {
|
988
1249
|
return {
|
1250
|
+
"addCustomEditor": {
|
1251
|
+
"complexType": {
|
1252
|
+
"signature": "(fieldName: string, customEditor: ICustomEditor) => Promise<void>",
|
1253
|
+
"parameters": [{
|
1254
|
+
"tags": [],
|
1255
|
+
"text": ""
|
1256
|
+
}, {
|
1257
|
+
"tags": [],
|
1258
|
+
"text": ""
|
1259
|
+
}],
|
1260
|
+
"references": {
|
1261
|
+
"Promise": {
|
1262
|
+
"location": "global"
|
1263
|
+
},
|
1264
|
+
"ICustomEditor": {
|
1265
|
+
"location": "import",
|
1266
|
+
"path": "@sankhyalabs/ezui/dist/types/utils"
|
1267
|
+
}
|
1268
|
+
},
|
1269
|
+
"return": "Promise<void>"
|
1270
|
+
},
|
1271
|
+
"docs": {
|
1272
|
+
"text": "Registra um editor customizado para campos da grade e formul\u00E1rio.",
|
1273
|
+
"tags": []
|
1274
|
+
}
|
1275
|
+
},
|
1276
|
+
"addGridCustomRender": {
|
1277
|
+
"complexType": {
|
1278
|
+
"signature": "(fieldName: string, customRender: ICustomRender) => Promise<void>",
|
1279
|
+
"parameters": [{
|
1280
|
+
"tags": [],
|
1281
|
+
"text": ""
|
1282
|
+
}, {
|
1283
|
+
"tags": [],
|
1284
|
+
"text": ""
|
1285
|
+
}],
|
1286
|
+
"references": {
|
1287
|
+
"Promise": {
|
1288
|
+
"location": "global"
|
1289
|
+
},
|
1290
|
+
"ICustomRender": {
|
1291
|
+
"location": "import",
|
1292
|
+
"path": "@sankhyalabs/ezui/dist/types/utils"
|
1293
|
+
}
|
1294
|
+
},
|
1295
|
+
"return": "Promise<void>"
|
1296
|
+
},
|
1297
|
+
"docs": {
|
1298
|
+
"text": "Registra um render customizado para colunas da grid.",
|
1299
|
+
"tags": []
|
1300
|
+
}
|
1301
|
+
},
|
1302
|
+
"addCustomValueFormatter": {
|
1303
|
+
"complexType": {
|
1304
|
+
"signature": "(columnName: string, customFormatter: ICustomFormatter) => Promise<void>",
|
1305
|
+
"parameters": [{
|
1306
|
+
"tags": [],
|
1307
|
+
"text": ""
|
1308
|
+
}, {
|
1309
|
+
"tags": [],
|
1310
|
+
"text": ""
|
1311
|
+
}],
|
1312
|
+
"references": {
|
1313
|
+
"Promise": {
|
1314
|
+
"location": "global"
|
1315
|
+
},
|
1316
|
+
"ICustomFormatter": {
|
1317
|
+
"location": "import",
|
1318
|
+
"path": "@sankhyalabs/ezui/dist/types/components/ez-grid/interfaces"
|
1319
|
+
}
|
1320
|
+
},
|
1321
|
+
"return": "Promise<void>"
|
1322
|
+
},
|
1323
|
+
"docs": {
|
1324
|
+
"text": "Registra um formatador de valores para uma coluna da grid.",
|
1325
|
+
"tags": []
|
1326
|
+
}
|
1327
|
+
},
|
1328
|
+
"removeCustomValueFormatter": {
|
1329
|
+
"complexType": {
|
1330
|
+
"signature": "(columnName: string) => Promise<void>",
|
1331
|
+
"parameters": [{
|
1332
|
+
"tags": [],
|
1333
|
+
"text": ""
|
1334
|
+
}],
|
1335
|
+
"references": {
|
1336
|
+
"Promise": {
|
1337
|
+
"location": "global"
|
1338
|
+
}
|
1339
|
+
},
|
1340
|
+
"return": "Promise<void>"
|
1341
|
+
},
|
1342
|
+
"docs": {
|
1343
|
+
"text": "Remove o formatador de valores de uma coluna da grid.",
|
1344
|
+
"tags": []
|
1345
|
+
}
|
1346
|
+
},
|
1347
|
+
"setFieldProp": {
|
1348
|
+
"complexType": {
|
1349
|
+
"signature": "(fieldName: string, propName: string, value: any) => Promise<void>",
|
1350
|
+
"parameters": [{
|
1351
|
+
"tags": [],
|
1352
|
+
"text": ""
|
1353
|
+
}, {
|
1354
|
+
"tags": [],
|
1355
|
+
"text": ""
|
1356
|
+
}, {
|
1357
|
+
"tags": [],
|
1358
|
+
"text": ""
|
1359
|
+
}],
|
1360
|
+
"references": {
|
1361
|
+
"Promise": {
|
1362
|
+
"location": "global"
|
1363
|
+
}
|
1364
|
+
},
|
1365
|
+
"return": "Promise<void>"
|
1366
|
+
},
|
1367
|
+
"docs": {
|
1368
|
+
"text": "Altera/adiciona uma propriedade nos metadados do campo.",
|
1369
|
+
"tags": []
|
1370
|
+
}
|
1371
|
+
},
|
989
1372
|
"goToView": {
|
990
1373
|
"complexType": {
|
991
1374
|
"signature": "(view: VIEW_MODE) => Promise<void>",
|
@@ -1136,6 +1519,9 @@ export class SnkSimpleCrud {
|
|
1136
1519
|
return [{
|
1137
1520
|
"propName": "resourceID",
|
1138
1521
|
"methodName": "handleResourceIDChanged"
|
1522
|
+
}, {
|
1523
|
+
"propName": "entityName",
|
1524
|
+
"methodName": "onChangeEntityName"
|
1139
1525
|
}, {
|
1140
1526
|
"propName": "mode",
|
1141
1527
|
"methodName": "onModeChange"
|
@@ -47,7 +47,7 @@ export const buildCustomButton = (def, className, dataElementId, action, isEnabl
|
|
47
47
|
return textButton(def.name, className, dataElementId, text, hint, action, isEnabled);
|
48
48
|
}
|
49
49
|
};
|
50
|
-
export const buildElem = (element, className, dataElementId, getTitle, action, isEnabled, actions,
|
50
|
+
export const buildElem = (element, className, dataElementId, getTitle, action, isEnabled, actions, dataExporterStoreKey, presentationMode) => {
|
51
51
|
var _a;
|
52
52
|
const title = getTitle(element);
|
53
53
|
switch (element) {
|
@@ -90,7 +90,7 @@ export const buildElem = (element, className, dataElementId, getTitle, action, i
|
|
90
90
|
case TaskbarElement.DIVIDER:
|
91
91
|
return h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin--none ez-margin-left--medium", "data-taskbar-divider": true });
|
92
92
|
case TaskbarElement.DATA_EXPORTER:
|
93
|
-
const provider = (_a = store.get("exporterProviders")) === null || _a === void 0 ? void 0 : _a[
|
93
|
+
const provider = (_a = store.get("exporterProviders")) === null || _a === void 0 ? void 0 : _a[dataExporterStoreKey];
|
94
94
|
return h("snk-data-exporter", { class: className, provider: provider, "data-element-id": dataElementId, "data-taskbar-element": element });
|
95
95
|
case TaskbarElement.ATTACH:
|
96
96
|
return iconButton("anexo", element, className, dataElementId, title, action, isEnabled);
|
@@ -184,8 +184,9 @@ export class SnkTaskbar {
|
|
184
184
|
className += "ez-padding-left--medium";
|
185
185
|
}
|
186
186
|
const taskbarElement = TaskbarElement[def.toString()];
|
187
|
+
const dataExporterStoreKey = this._element.dataset.exporterStoreKey || this.configName;
|
187
188
|
if (taskbarElement) {
|
188
|
-
return buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.buildDynamicActionsList(),
|
189
|
+
return buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.buildDynamicActionsList(), dataExporterStoreKey, this.presentationMode);
|
189
190
|
}
|
190
191
|
else {
|
191
192
|
return buildCustomButton(def, className, this.getIdElemBtnCustom(def), elem => this.elementClick(elem), elem => this.isEnabled(elem));
|