@sankhyalabs/sankhyablocks 8.15.1 → 8.16.0-dev.1
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/{SnkMultiSelectionListDataSource-303e85d1.js → IExporterProvider-c78cb1b8.js} +94 -4
- package/dist/cjs/RecordIDUtils-3735135c.js +43 -0
- package/dist/cjs/{SnkFormConfigManager-f9dc0d28.js → SnkFormConfigManager-1b13bacd.js} +6 -3
- package/dist/cjs/{SnkMessageBuilder-66aa2557.js → SnkMessageBuilder-722b104e.js} +8 -12
- package/dist/cjs/{pesquisa-fetcher-213797ec.js → dataunit-fetcher-620b29a1.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 +4 -2
- package/dist/cjs/snk-application.cjs.entry.js +34 -11
- package/dist/cjs/snk-attach.cjs.entry.js +71 -46
- package/dist/cjs/snk-crud.cjs.entry.js +96 -10
- package/dist/cjs/snk-data-exporter.cjs.entry.js +315 -85
- package/dist/cjs/snk-data-unit-82dea87e.js +679 -0
- package/dist/cjs/snk-data-unit.cjs.entry.js +12 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +48 -7
- package/dist/cjs/snk-filter-bar.cjs.entry.js +5 -1
- package/dist/cjs/snk-form-view.cjs.entry.js +67 -0
- package/dist/cjs/snk-form.cjs.entry.js +51 -6
- package/dist/cjs/snk-grid.cjs.entry.js +164 -107
- package/dist/cjs/{snk-guides-viewer-4b6ecda8.js → snk-guides-viewer-05a1ba27.js} +36 -8
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -6
- package/dist/cjs/snk-simple-crud.cjs.entry.js +264 -37
- 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 +249 -7
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +135 -0
- package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +161 -0
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +112 -5
- 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 +507 -214
- 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 +6 -3
- package/dist/collection/components/snk-grid/snk-grid.js +240 -101
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +386 -18
- 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/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 +1 -0
- package/dist/components/{field-search.js → IExporterProvider.js} +93 -6
- package/dist/components/ISave.js +47 -0
- package/dist/components/SnkFormConfigManager.js +6 -3
- package/dist/components/SnkMessageBuilder.js +8 -12
- 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 +103 -11
- package/dist/components/snk-data-exporter2.js +309 -85
- package/dist/components/snk-data-unit2.js +470 -212
- package/dist/components/snk-detail-view2.js +87 -10
- package/dist/components/snk-expression-item2.js +1 -1
- package/dist/components/snk-filter-bar2.js +6 -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 +259 -23
- package/dist/components/snk-taskbar2.js +6 -5
- package/dist/esm/{SnkMultiSelectionListDataSource-36918dbf.js → IExporterProvider-343272b3.js} +93 -5
- package/dist/esm/RecordIDUtils-87d02110.js +41 -0
- package/dist/esm/{SnkFormConfigManager-f53f9f87.js → SnkFormConfigManager-d4554df9.js} +6 -3
- package/dist/esm/{SnkMessageBuilder-0a4becdd.js → SnkMessageBuilder-89925609.js} +8 -12
- package/dist/esm/{pesquisa-fetcher-fe6f3826.js → dataunit-fetcher-3fbf9d12.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 +4 -2
- package/dist/esm/snk-application.entry.js +33 -10
- package/dist/esm/snk-attach.entry.js +66 -41
- package/dist/esm/snk-crud.entry.js +96 -10
- package/dist/esm/snk-data-exporter.entry.js +316 -86
- package/dist/esm/snk-data-unit-8f98b45f.js +677 -0
- package/dist/esm/snk-data-unit.entry.js +12 -2
- package/dist/esm/snk-detail-view.entry.js +48 -7
- package/dist/esm/snk-filter-bar.entry.js +5 -1
- package/dist/esm/snk-form-view.entry.js +67 -0
- package/dist/esm/snk-form.entry.js +51 -6
- package/dist/esm/snk-grid.entry.js +162 -105
- package/dist/esm/{snk-guides-viewer-113be3fd.js → snk-guides-viewer-aee2cafe.js} +36 -8
- package/dist/esm/snk-guides-viewer.entry.js +8 -6
- package/dist/esm/snk-simple-crud.entry.js +252 -25
- 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-0d91b10f.entry.js +1 -0
- package/dist/sankhyablocks/p-1db45d26.entry.js +1 -0
- package/dist/sankhyablocks/p-26394a01.entry.js +1 -0
- package/dist/sankhyablocks/p-2d649237.entry.js +1 -0
- package/dist/sankhyablocks/p-30cf616e.js +1 -0
- package/dist/sankhyablocks/p-44767378.entry.js +1 -0
- package/dist/sankhyablocks/p-47b60deb.entry.js +1 -0
- package/dist/sankhyablocks/p-4f72727a.entry.js +1 -0
- package/dist/sankhyablocks/p-550fee49.entry.js +1 -0
- package/dist/sankhyablocks/p-5539ecb4.entry.js +1 -0
- package/dist/sankhyablocks/p-672302c3.js +60 -0
- package/dist/sankhyablocks/p-7a337364.js +1 -0
- package/dist/sankhyablocks/{p-ae4fc9a9.js → p-7e7a7473.js} +1 -1
- package/dist/sankhyablocks/p-829d4045.js +1 -0
- package/dist/sankhyablocks/p-8a5910a7.entry.js +1 -0
- package/dist/sankhyablocks/p-8cc64963.entry.js +1 -0
- package/dist/sankhyablocks/p-8fc470e5.entry.js +1 -0
- package/dist/sankhyablocks/p-9863d682.js +1 -0
- package/dist/sankhyablocks/p-9e99a92a.js +1 -0
- package/dist/sankhyablocks/p-af8efd95.js +6 -0
- package/dist/sankhyablocks/p-be603a24.js +1 -0
- package/dist/sankhyablocks/p-d09feef1.js +1 -0
- package/dist/sankhyablocks/p-e95b3b93.entry.js +11 -0
- package/dist/sankhyablocks/p-f2809746.entry.js +1 -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 +36 -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 +19 -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 +61 -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-grid/snk-grid.d.ts +46 -6
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +58 -4
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +1 -1
- package/dist/types/components.d.ts +220 -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-07a61550.entry.js +0 -1
- package/dist/sankhyablocks/p-0899e0b5.entry.js +0 -1
- package/dist/sankhyablocks/p-154a7f33.entry.js +0 -1
- package/dist/sankhyablocks/p-15802c59.entry.js +0 -1
- package/dist/sankhyablocks/p-164666b1.js +0 -65
- package/dist/sankhyablocks/p-32556aa6.js +0 -1
- package/dist/sankhyablocks/p-328585d0.entry.js +0 -1
- package/dist/sankhyablocks/p-38289a55.js +0 -1
- package/dist/sankhyablocks/p-52c8e589.js +0 -1
- package/dist/sankhyablocks/p-5cb07080.js +0 -1
- package/dist/sankhyablocks/p-74d349c3.entry.js +0 -1
- package/dist/sankhyablocks/p-7fe120b8.entry.js +0 -11
- package/dist/sankhyablocks/p-add17f6a.entry.js +0 -1
- package/dist/sankhyablocks/p-af1ac81f.entry.js +0 -1
- package/dist/sankhyablocks/p-b4525fc0.entry.js +0 -1
- package/dist/sankhyablocks/p-cce0865d.js +0 -1
- package/dist/sankhyablocks/p-dec65f6c.entry.js +0 -1
- package/dist/sankhyablocks/p-ee9536bc.entry.js +0 -1
- package/dist/sankhyablocks/p-f13f7616.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,33 @@ export class SnkSimpleCrud {
|
|
47
55
|
this.gridLegacyConfigName = undefined;
|
48
56
|
this.formLegacyConfigName = undefined;
|
49
57
|
this.ignoreReadOnlyFormFields = false;
|
58
|
+
this.autoFocus = true;
|
59
|
+
this.autoLoad = undefined;
|
60
|
+
}
|
61
|
+
/**
|
62
|
+
* Registra um editor customizado para campos da grade e formulário.
|
63
|
+
*/
|
64
|
+
async addCustomEditor(fieldName, customEditor) {
|
65
|
+
if (this._grid && this._form) {
|
66
|
+
this._grid.addCustomEditor(fieldName, customEditor);
|
67
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
68
|
+
return;
|
69
|
+
}
|
70
|
+
const newCustomEditors = new Map(this._customEditors);
|
71
|
+
newCustomEditors.set(fieldName, customEditor);
|
72
|
+
this._customEditors = newCustomEditors;
|
73
|
+
}
|
74
|
+
/**
|
75
|
+
* Registra um render customizado para colunas da grid.
|
76
|
+
*/
|
77
|
+
async addGridCustomRender(fieldName, customRender) {
|
78
|
+
if (this._grid) {
|
79
|
+
this._grid.addGridCustomRender(fieldName, customRender);
|
80
|
+
return;
|
81
|
+
}
|
82
|
+
const newCustomRenders = new Map(this._customRenders);
|
83
|
+
newCustomRenders.set(fieldName, customRender);
|
84
|
+
this._customRenders = newCustomRenders;
|
50
85
|
}
|
51
86
|
handleResourceIDChanged(newValue, oldValue) {
|
52
87
|
if (StringUtils.isEmpty(newValue)) {
|
@@ -58,9 +93,30 @@ export class SnkSimpleCrud {
|
|
58
93
|
this.loadFormConfig(true);
|
59
94
|
this.loadGridConfig(true);
|
60
95
|
}
|
61
|
-
|
96
|
+
/**
|
97
|
+
* Registra um formatador de valores para uma coluna da grid.
|
98
|
+
*/
|
99
|
+
async addCustomValueFormatter(columnName, customFormatter) {
|
100
|
+
this._grid.addCustomValueFormatter(columnName, customFormatter);
|
101
|
+
}
|
102
|
+
/**
|
103
|
+
* Remove o formatador de valores de uma coluna da grid.
|
104
|
+
*/
|
105
|
+
async removeCustomValueFormatter(columnName) {
|
106
|
+
this._grid.removeCustomValueFormatter(columnName);
|
107
|
+
}
|
108
|
+
/**
|
109
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
110
|
+
*/
|
111
|
+
async setFieldProp(fieldName, propName, value) {
|
112
|
+
const newCustomFieldProps = new Map(this._fieldsProps);
|
113
|
+
const currentProps = this._fieldsProps.get(fieldName);
|
114
|
+
newCustomFieldProps.set(fieldName, Object.assign(Object.assign({}, currentProps), { [propName]: value }));
|
115
|
+
this._fieldsProps = newCustomFieldProps;
|
116
|
+
}
|
117
|
+
getButtons(selected, extraButtons) {
|
62
118
|
return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
|
63
|
-
.concat(
|
119
|
+
.concat(extraButtons));
|
64
120
|
}
|
65
121
|
addConfigButton(buttons) {
|
66
122
|
if (this.configName === undefined) {
|
@@ -100,15 +156,19 @@ export class SnkSimpleCrud {
|
|
100
156
|
}
|
101
157
|
evt.stopPropagation();
|
102
158
|
}
|
159
|
+
async onChangeEntityName(newValue) {
|
160
|
+
if (this.dataUnit)
|
161
|
+
return;
|
162
|
+
const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
163
|
+
this.dataUnit = await application.getDataUnit(newValue, null, null, this.configName);
|
164
|
+
}
|
103
165
|
onModeChange() {
|
104
166
|
if (this.mode == SIMPLE_CRUD_MODE.IN_MEMORY) {
|
105
167
|
this.initInMemoryDataUnit();
|
106
168
|
}
|
107
169
|
}
|
108
170
|
observeDataState(newValue, oldValue) {
|
109
|
-
|
110
|
-
this.dataStateChange.emit(newValue);
|
111
|
-
}
|
171
|
+
this.handleDataStateChange(newValue, oldValue);
|
112
172
|
}
|
113
173
|
async observeFormLegacy(newValue, oldValue) {
|
114
174
|
await this.handleUpdateFormLegacyConfig(newValue, oldValue);
|
@@ -116,6 +176,29 @@ export class SnkSimpleCrud {
|
|
116
176
|
async observeGridLegacy(newValue, oldValue) {
|
117
177
|
await this.handleUpdateGridLegacyConfig(newValue, oldValue);
|
118
178
|
}
|
179
|
+
async handleDataStateChange(newValue, oldValue) {
|
180
|
+
if (ObjectUtils.objectToString(oldValue) != ObjectUtils.objectToString(newValue)) {
|
181
|
+
this.dataStateChange.emit(newValue);
|
182
|
+
}
|
183
|
+
await this.processRmPrecision();
|
184
|
+
}
|
185
|
+
async processRmPrecision() {
|
186
|
+
var _a, _b;
|
187
|
+
const fieldsWithRmPrecision = await this._snkDataUnit.getFieldsWithRmPrecision();
|
188
|
+
for (const field of fieldsWithRmPrecision || []) {
|
189
|
+
if (!field) {
|
190
|
+
continue;
|
191
|
+
}
|
192
|
+
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);
|
193
|
+
if (!rmPrecision && rmPrecision !== 0) {
|
194
|
+
continue;
|
195
|
+
}
|
196
|
+
await this.setFieldProp(field, 'precision', rmPrecision);
|
197
|
+
await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
|
198
|
+
}
|
199
|
+
;
|
200
|
+
this._rmPrecisionCustomValueFormatter.setDataState(this.dataState);
|
201
|
+
}
|
119
202
|
async handleUpdateGridLegacyConfig(newValue, oldValue) {
|
120
203
|
if (newValue == undefined || newValue == oldValue) {
|
121
204
|
return;
|
@@ -212,6 +295,7 @@ export class SnkSimpleCrud {
|
|
212
295
|
}
|
213
296
|
async componentWillRender() {
|
214
297
|
this._resourceID = await this.application.getResourceID();
|
298
|
+
this.dataExporterProviderStore();
|
215
299
|
this._taskbarProcessor.process(this.getTaskBarId(), this.taskbarManager, this.dataState, this.getTaskBarDisabledButtons());
|
216
300
|
if (this.configName === undefined) {
|
217
301
|
return;
|
@@ -223,32 +307,70 @@ export class SnkSimpleCrud {
|
|
223
307
|
this.loadGridConfig();
|
224
308
|
this.loadFormConfig();
|
225
309
|
}
|
310
|
+
componentDidRender() {
|
311
|
+
this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
|
312
|
+
this.addGridCustomValueFormattters();
|
313
|
+
this.setFieldsProps();
|
314
|
+
this.setCustomRenders();
|
315
|
+
this.setCustomEditors();
|
316
|
+
}
|
226
317
|
componentWillLoad() {
|
227
318
|
this.processMetadata();
|
228
319
|
this.onModeChange();
|
229
320
|
this.configDatasource();
|
321
|
+
this._rmPrecisionCustomValueFormatter = new RmPrecisionCustomValueFormatter();
|
230
322
|
}
|
231
323
|
componentDidLoad() {
|
232
324
|
CSSVarsUtils.applyVarsGrid(this._element, this._grid);
|
233
325
|
}
|
326
|
+
setCustomRenders() {
|
327
|
+
if (!this._grid) {
|
328
|
+
return;
|
329
|
+
}
|
330
|
+
for (const [fieldName, customRender] of this._customRenders) {
|
331
|
+
this._grid.addGridCustomRender(fieldName, customRender);
|
332
|
+
this._customRenders.delete(fieldName);
|
333
|
+
}
|
334
|
+
}
|
335
|
+
setCustomEditors() {
|
336
|
+
if (!this._grid || !this._form) {
|
337
|
+
return;
|
338
|
+
}
|
339
|
+
for (const [fieldName, customEditor] of this._customEditors) {
|
340
|
+
this._grid.addCustomEditor(fieldName, customEditor);
|
341
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
342
|
+
this._customEditors.delete(fieldName);
|
343
|
+
}
|
344
|
+
}
|
234
345
|
configDatasource() {
|
235
346
|
this._multiSelectionListDataSource.setApplication(this.application);
|
236
347
|
this._multiSelectionListDataSource.setDataUnit(this.dataUnit);
|
237
348
|
}
|
349
|
+
setFieldsProps() {
|
350
|
+
if (!this._form) {
|
351
|
+
return;
|
352
|
+
}
|
353
|
+
for (const [fieldName, props] of this._fieldsProps) {
|
354
|
+
for (const prop in props) {
|
355
|
+
this._form.setFieldProp(fieldName, prop, props[prop]);
|
356
|
+
}
|
357
|
+
this._fieldsProps.delete(fieldName);
|
358
|
+
}
|
359
|
+
}
|
238
360
|
getTaskBarId() {
|
239
|
-
var _a, _b
|
361
|
+
var _a, _b;
|
240
362
|
if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
|
241
363
|
return "snkSimpleCrudTaskbar.finish_edition";
|
242
364
|
}
|
243
365
|
if (((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.selectionInfo) &&
|
244
366
|
!this.dataState.selectionInfo.isAllRecords() &&
|
245
|
-
|
367
|
+
this.dataState.selectionInfo.length > 0) {
|
246
368
|
return this._currentViewMode === VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_selected" : "snkSimpleCrudTaskbar.form_selected";
|
247
369
|
}
|
248
370
|
return this._currentViewMode === VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
|
249
371
|
}
|
250
372
|
initInMemoryDataUnit() {
|
251
|
-
this._inMemoryLoader = new InMemoryLoader(this._metadata);
|
373
|
+
this._inMemoryLoader = new InMemoryLoader(this._metadata, undefined, { autoLoad: this.autoLoad });
|
252
374
|
this.dataUnit = this._inMemoryLoader.dataUnit;
|
253
375
|
this.dataUnitReady.emit(this.dataUnit);
|
254
376
|
}
|
@@ -287,12 +409,11 @@ export class SnkSimpleCrud {
|
|
287
409
|
var _a;
|
288
410
|
(_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.close();
|
289
411
|
}
|
290
|
-
updateConfig() {
|
412
|
+
async updateConfig() {
|
291
413
|
if (this._formConfigManager == undefined) {
|
292
414
|
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
293
415
|
}
|
294
416
|
this._formConfigManager.setConfig(this.formConfig);
|
295
|
-
return;
|
296
417
|
}
|
297
418
|
processMetadata() {
|
298
419
|
const fieldsMetadataElem = this._element.querySelectorAll("snk-field-metadata");
|
@@ -324,11 +445,28 @@ export class SnkSimpleCrud {
|
|
324
445
|
};
|
325
446
|
}
|
326
447
|
}
|
448
|
+
addGridCustomValueFormattters() {
|
449
|
+
var _a, _b, _c;
|
450
|
+
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);
|
451
|
+
if (!metadataFields) {
|
452
|
+
return;
|
453
|
+
}
|
454
|
+
const fieldsWithRmPrecision = [];
|
455
|
+
metadataFields.forEach((field) => {
|
456
|
+
var _a;
|
457
|
+
if (((_a = field.properties) === null || _a === void 0 ? void 0 : _a.rm_precision) && !fieldsWithRmPrecision.includes(field.name)) {
|
458
|
+
fieldsWithRmPrecision.push(field.name);
|
459
|
+
}
|
460
|
+
});
|
461
|
+
fieldsWithRmPrecision.forEach(field => {
|
462
|
+
this.addCustomValueFormatter(field, this._rmPrecisionCustomValueFormatter);
|
463
|
+
});
|
464
|
+
}
|
327
465
|
onDataStateChange(evt) {
|
328
466
|
this.dataState = Object.assign({}, evt.detail);
|
329
467
|
}
|
330
468
|
getTaskBarDisabledButtons() {
|
331
|
-
var _a, _b, _c, _d;
|
469
|
+
var _a, _b, _c, _d, _e, _f;
|
332
470
|
const disabledButtons = [];
|
333
471
|
if (!((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.hasNext)) {
|
334
472
|
disabledButtons.push(TaskbarElement.NEXT);
|
@@ -339,6 +477,9 @@ export class SnkSimpleCrud {
|
|
339
477
|
if ((_d = (_c = this.dataState) === null || _c === void 0 ? void 0 : _c.selectionInfo) === null || _d === void 0 ? void 0 : _d.isEmpty()) {
|
340
478
|
disabledButtons.push(TaskbarElement.FORM_MODE);
|
341
479
|
}
|
480
|
+
if (((_f = (_e = this.dataState) === null || _e === void 0 ? void 0 : _e.selectionInfo) === null || _f === void 0 ? void 0 : _f.length) > 1) {
|
481
|
+
disabledButtons.push(TaskbarElement.CLONE);
|
482
|
+
}
|
342
483
|
return disabledButtons;
|
343
484
|
}
|
344
485
|
handleCancelEdit() {
|
@@ -482,9 +623,23 @@ export class SnkSimpleCrud {
|
|
482
623
|
.then(() => {
|
483
624
|
this.setGridConfig(config);
|
484
625
|
this.closeGridConfig();
|
626
|
+
this.dataExporterProviderStore();
|
485
627
|
});
|
486
628
|
evt.stopPropagation();
|
487
629
|
}
|
630
|
+
async dataExporterProviderStore() {
|
631
|
+
if (this.dataUnit == undefined) {
|
632
|
+
return;
|
633
|
+
}
|
634
|
+
if (this._grid == undefined) {
|
635
|
+
return;
|
636
|
+
}
|
637
|
+
const dataExporterProvider = new ClientSideExporterProvider(this.dataUnit, this._grid);
|
638
|
+
store.set("exporterProviders", Object.assign(Object.assign({}, store.get("exporterProviders")), { [this.getDataExporterStoreKey()]: dataExporterProvider }));
|
639
|
+
}
|
640
|
+
getDataExporterStoreKey() {
|
641
|
+
return `SnkSimpleCrudDataExporter:${this.configName == undefined ? this.dataUnit.name : this.configName}`;
|
642
|
+
}
|
488
643
|
setGridConfig(config) {
|
489
644
|
this.gridConfig = config;
|
490
645
|
CrudUtils.assertDefaultSorting(this.gridConfig, this.dataUnit);
|
@@ -500,6 +655,15 @@ export class SnkSimpleCrud {
|
|
500
655
|
closeFormConfig() {
|
501
656
|
this._showFormConfig = false;
|
502
657
|
}
|
658
|
+
getPageSize() {
|
659
|
+
if (this.mode === SIMPLE_CRUD_MODE.IN_MEMORY) {
|
660
|
+
return 0;
|
661
|
+
}
|
662
|
+
if (this.pageSize == undefined) {
|
663
|
+
return 150;
|
664
|
+
}
|
665
|
+
return this.pageSize;
|
666
|
+
}
|
503
667
|
//No momento não daremos suporte para configuração de formulário quando houver formLegacyConfigName
|
504
668
|
handleShowFormConfig() {
|
505
669
|
return this._showFormConfig && !this.formLegacyConfigName;
|
@@ -515,15 +679,23 @@ export class SnkSimpleCrud {
|
|
515
679
|
}
|
516
680
|
return configFromManager;
|
517
681
|
}
|
682
|
+
updateFormConfig() {
|
683
|
+
const newConfig = Object.assign(Object.assign({}, this.formConfig), { fields: this.dataUnit.metadata.fields });
|
684
|
+
this.setFormConfig(newConfig, true);
|
685
|
+
if (this._formConfigManager == undefined) {
|
686
|
+
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
687
|
+
}
|
688
|
+
this._formConfigManager.setConfig(this.formConfig);
|
689
|
+
}
|
518
690
|
/* istanbul ignore next */
|
519
691
|
render() {
|
520
692
|
var _a;
|
521
693
|
if (this.dataUnit == undefined) {
|
522
694
|
return;
|
523
695
|
}
|
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)
|
696
|
+
return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this) }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
525
697
|
? 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() }))));
|
698
|
+
: 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
699
|
}
|
528
700
|
static get is() { return "snk-simple-crud"; }
|
529
701
|
static get encapsulation() { return "scoped"; }
|
@@ -579,6 +751,23 @@ export class SnkSimpleCrud {
|
|
579
751
|
"text": ""
|
580
752
|
}
|
581
753
|
},
|
754
|
+
"entityName": {
|
755
|
+
"type": "string",
|
756
|
+
"mutable": false,
|
757
|
+
"complexType": {
|
758
|
+
"original": "string",
|
759
|
+
"resolved": "string",
|
760
|
+
"references": {}
|
761
|
+
},
|
762
|
+
"required": false,
|
763
|
+
"optional": false,
|
764
|
+
"docs": {
|
765
|
+
"tags": [],
|
766
|
+
"text": "Define o nome da entidade que o componente vai utilizar para fazer as opera\u00E7\u00F5es de CRUD"
|
767
|
+
},
|
768
|
+
"attribute": "entity-name",
|
769
|
+
"reflect": false
|
770
|
+
},
|
582
771
|
"mode": {
|
583
772
|
"type": "number",
|
584
773
|
"mutable": false,
|
@@ -677,6 +866,24 @@ export class SnkSimpleCrud {
|
|
677
866
|
"reflect": false,
|
678
867
|
"defaultValue": "true"
|
679
868
|
},
|
869
|
+
"pageSize": {
|
870
|
+
"type": "number",
|
871
|
+
"mutable": false,
|
872
|
+
"complexType": {
|
873
|
+
"original": "number",
|
874
|
+
"resolved": "number",
|
875
|
+
"references": {}
|
876
|
+
},
|
877
|
+
"required": false,
|
878
|
+
"optional": false,
|
879
|
+
"docs": {
|
880
|
+
"tags": [],
|
881
|
+
"text": "Determina quantas linhas s\u00E3o retornadas por p\u00E1gina."
|
882
|
+
},
|
883
|
+
"attribute": "page-size",
|
884
|
+
"reflect": false,
|
885
|
+
"defaultValue": "150"
|
886
|
+
},
|
680
887
|
"resourceID": {
|
681
888
|
"type": "string",
|
682
889
|
"mutable": false,
|
@@ -860,6 +1067,41 @@ export class SnkSimpleCrud {
|
|
860
1067
|
"attribute": "ignore-read-only-form-fields",
|
861
1068
|
"reflect": false,
|
862
1069
|
"defaultValue": "false"
|
1070
|
+
},
|
1071
|
+
"autoFocus": {
|
1072
|
+
"type": "boolean",
|
1073
|
+
"mutable": false,
|
1074
|
+
"complexType": {
|
1075
|
+
"original": "boolean",
|
1076
|
+
"resolved": "boolean",
|
1077
|
+
"references": {}
|
1078
|
+
},
|
1079
|
+
"required": false,
|
1080
|
+
"optional": true,
|
1081
|
+
"docs": {
|
1082
|
+
"tags": [],
|
1083
|
+
"text": "Define se a grid ser\u00E1 focada ao ser carregada."
|
1084
|
+
},
|
1085
|
+
"attribute": "auto-focus",
|
1086
|
+
"reflect": false,
|
1087
|
+
"defaultValue": "true"
|
1088
|
+
},
|
1089
|
+
"autoLoad": {
|
1090
|
+
"type": "boolean",
|
1091
|
+
"mutable": false,
|
1092
|
+
"complexType": {
|
1093
|
+
"original": "boolean",
|
1094
|
+
"resolved": "boolean",
|
1095
|
+
"references": {}
|
1096
|
+
},
|
1097
|
+
"required": false,
|
1098
|
+
"optional": true,
|
1099
|
+
"docs": {
|
1100
|
+
"tags": [],
|
1101
|
+
"text": "Define se a carga dos dados ser\u00E1 feita assim que o componente for carregado."
|
1102
|
+
},
|
1103
|
+
"attribute": "auto-load",
|
1104
|
+
"reflect": false
|
863
1105
|
}
|
864
1106
|
};
|
865
1107
|
}
|
@@ -871,7 +1113,8 @@ export class SnkSimpleCrud {
|
|
871
1113
|
"_config": {},
|
872
1114
|
"_fieldToGetFocus": {},
|
873
1115
|
"_customContainerId": {},
|
874
|
-
"_formFields": {}
|
1116
|
+
"_formFields": {},
|
1117
|
+
"_fieldsProps": {}
|
875
1118
|
};
|
876
1119
|
}
|
877
1120
|
static get events() {
|
@@ -986,6 +1229,128 @@ export class SnkSimpleCrud {
|
|
986
1229
|
}
|
987
1230
|
static get methods() {
|
988
1231
|
return {
|
1232
|
+
"addCustomEditor": {
|
1233
|
+
"complexType": {
|
1234
|
+
"signature": "(fieldName: string, customEditor: ICustomEditor) => Promise<void>",
|
1235
|
+
"parameters": [{
|
1236
|
+
"tags": [],
|
1237
|
+
"text": ""
|
1238
|
+
}, {
|
1239
|
+
"tags": [],
|
1240
|
+
"text": ""
|
1241
|
+
}],
|
1242
|
+
"references": {
|
1243
|
+
"Promise": {
|
1244
|
+
"location": "global"
|
1245
|
+
},
|
1246
|
+
"ICustomEditor": {
|
1247
|
+
"location": "import",
|
1248
|
+
"path": "@sankhyalabs/ezui/dist/types/utils"
|
1249
|
+
}
|
1250
|
+
},
|
1251
|
+
"return": "Promise<void>"
|
1252
|
+
},
|
1253
|
+
"docs": {
|
1254
|
+
"text": "Registra um editor customizado para campos da grade e formul\u00E1rio.",
|
1255
|
+
"tags": []
|
1256
|
+
}
|
1257
|
+
},
|
1258
|
+
"addGridCustomRender": {
|
1259
|
+
"complexType": {
|
1260
|
+
"signature": "(fieldName: string, customRender: ICustomRender) => Promise<void>",
|
1261
|
+
"parameters": [{
|
1262
|
+
"tags": [],
|
1263
|
+
"text": ""
|
1264
|
+
}, {
|
1265
|
+
"tags": [],
|
1266
|
+
"text": ""
|
1267
|
+
}],
|
1268
|
+
"references": {
|
1269
|
+
"Promise": {
|
1270
|
+
"location": "global"
|
1271
|
+
},
|
1272
|
+
"ICustomRender": {
|
1273
|
+
"location": "import",
|
1274
|
+
"path": "@sankhyalabs/ezui/dist/types/utils"
|
1275
|
+
}
|
1276
|
+
},
|
1277
|
+
"return": "Promise<void>"
|
1278
|
+
},
|
1279
|
+
"docs": {
|
1280
|
+
"text": "Registra um render customizado para colunas da grid.",
|
1281
|
+
"tags": []
|
1282
|
+
}
|
1283
|
+
},
|
1284
|
+
"addCustomValueFormatter": {
|
1285
|
+
"complexType": {
|
1286
|
+
"signature": "(columnName: string, customFormatter: ICustomFormatter) => Promise<void>",
|
1287
|
+
"parameters": [{
|
1288
|
+
"tags": [],
|
1289
|
+
"text": ""
|
1290
|
+
}, {
|
1291
|
+
"tags": [],
|
1292
|
+
"text": ""
|
1293
|
+
}],
|
1294
|
+
"references": {
|
1295
|
+
"Promise": {
|
1296
|
+
"location": "global"
|
1297
|
+
},
|
1298
|
+
"ICustomFormatter": {
|
1299
|
+
"location": "import",
|
1300
|
+
"path": "@sankhyalabs/ezui/dist/types/components/ez-grid/interfaces"
|
1301
|
+
}
|
1302
|
+
},
|
1303
|
+
"return": "Promise<void>"
|
1304
|
+
},
|
1305
|
+
"docs": {
|
1306
|
+
"text": "Registra um formatador de valores para uma coluna da grid.",
|
1307
|
+
"tags": []
|
1308
|
+
}
|
1309
|
+
},
|
1310
|
+
"removeCustomValueFormatter": {
|
1311
|
+
"complexType": {
|
1312
|
+
"signature": "(columnName: string) => Promise<void>",
|
1313
|
+
"parameters": [{
|
1314
|
+
"tags": [],
|
1315
|
+
"text": ""
|
1316
|
+
}],
|
1317
|
+
"references": {
|
1318
|
+
"Promise": {
|
1319
|
+
"location": "global"
|
1320
|
+
}
|
1321
|
+
},
|
1322
|
+
"return": "Promise<void>"
|
1323
|
+
},
|
1324
|
+
"docs": {
|
1325
|
+
"text": "Remove o formatador de valores de uma coluna da grid.",
|
1326
|
+
"tags": []
|
1327
|
+
}
|
1328
|
+
},
|
1329
|
+
"setFieldProp": {
|
1330
|
+
"complexType": {
|
1331
|
+
"signature": "(fieldName: string, propName: string, value: any) => Promise<void>",
|
1332
|
+
"parameters": [{
|
1333
|
+
"tags": [],
|
1334
|
+
"text": ""
|
1335
|
+
}, {
|
1336
|
+
"tags": [],
|
1337
|
+
"text": ""
|
1338
|
+
}, {
|
1339
|
+
"tags": [],
|
1340
|
+
"text": ""
|
1341
|
+
}],
|
1342
|
+
"references": {
|
1343
|
+
"Promise": {
|
1344
|
+
"location": "global"
|
1345
|
+
}
|
1346
|
+
},
|
1347
|
+
"return": "Promise<void>"
|
1348
|
+
},
|
1349
|
+
"docs": {
|
1350
|
+
"text": "Altera/adiciona uma propriedade nos metadados do campo.",
|
1351
|
+
"tags": []
|
1352
|
+
}
|
1353
|
+
},
|
989
1354
|
"goToView": {
|
990
1355
|
"complexType": {
|
991
1356
|
"signature": "(view: VIEW_MODE) => Promise<void>",
|
@@ -1136,6 +1501,9 @@ export class SnkSimpleCrud {
|
|
1136
1501
|
return [{
|
1137
1502
|
"propName": "resourceID",
|
1138
1503
|
"methodName": "handleResourceIDChanged"
|
1504
|
+
}, {
|
1505
|
+
"propName": "entityName",
|
1506
|
+
"methodName": "onChangeEntityName"
|
1139
1507
|
}, {
|
1140
1508
|
"propName": "mode",
|
1141
1509
|
"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));
|
@@ -9,8 +9,11 @@ export var DataExporterOption;
|
|
9
9
|
DataExporterOption["EXPORT_TO_PDF"] = "exportToPDF";
|
10
10
|
DataExporterOption["EXPORT_TO_XLS"] = "exportToXLS";
|
11
11
|
DataExporterOption["EXPORT_CURRENT_PAGE"] = "exportCurrentPage";
|
12
|
+
DataExporterOption["EXPORT_ALL_RECORDS"] = "exportAllRecords";
|
12
13
|
DataExporterOption["EXPORT_PAGE_TO_PDF"] = "exportPageToPDF";
|
13
14
|
DataExporterOption["EXPORT_PAGE_TO_XLS"] = "exportPageToXLS";
|
15
|
+
DataExporterOption["EXPORT_ALL_RECORDS_TO_PDF"] = "exportAllRecordsToPDF";
|
16
|
+
DataExporterOption["EXPORT_ALL_RECORDS_TO_XLS"] = "exportAllRecordsToXLS";
|
14
17
|
DataExporterOption["EXPORT_BY_EMAIL"] = "exportToEmail";
|
15
18
|
DataExporterOption["EXPORT_PDF_TO_EMAIL"] = "exportPDFToEmail";
|
16
19
|
DataExporterOption["EXPORT_XLS_TO_EMAIL"] = "exportXLSToEmail";
|
@@ -27,6 +30,8 @@ export var DataExporterType;
|
|
27
30
|
DataExporterType["EXPORT_TO_XLS"] = "XLS";
|
28
31
|
DataExporterType["EXPORT_PAGE_TO_PDF"] = "PDF";
|
29
32
|
DataExporterType["EXPORT_PAGE_TO_XLS"] = "XLS";
|
33
|
+
DataExporterType["EXPORT_ALL_RECORDS_TO_PDF"] = "PDF";
|
34
|
+
DataExporterType["EXPORT_ALL_RECORDS_TO_XLS"] = "XLS";
|
30
35
|
DataExporterType["EXPORT_PDF_TO_EMAIL"] = "PDF";
|
31
36
|
DataExporterType["EXPORT_XLS_TO_EMAIL"] = "XLS";
|
32
37
|
})(DataExporterType || (DataExporterType = {}));
|