@sankhyalabs/sankhyablocks 8.15.1 → 8.16.0-dev.2
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-9479f618.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-0c7106a0.js} +88 -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-16791a2f.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-d82746e8.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 +8 -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 +85 -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-5a858363.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-f7e0ffc0.js} +84 -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-a327d22c.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-874da66f.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-0046959e.entry.js +1 -0
- package/dist/sankhyablocks/p-0e11ee18.entry.js +1 -0
- package/dist/sankhyablocks/p-1db45d26.entry.js +1 -0
- package/dist/sankhyablocks/p-30cf616e.js +1 -0
- package/dist/sankhyablocks/p-47b60deb.entry.js +1 -0
- package/dist/sankhyablocks/p-60e46675.entry.js +11 -0
- package/dist/sankhyablocks/p-6d4f4614.js +60 -0
- package/dist/sankhyablocks/p-6ded2076.entry.js +1 -0
- package/dist/sankhyablocks/p-7a337364.js +1 -0
- package/dist/sankhyablocks/p-7d9baaf4.entry.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-8c6b44ea.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-a4b1f1eb.js +1 -0
- package/dist/sankhyablocks/p-af8efd95.js +6 -0
- package/dist/sankhyablocks/p-b7c4feeb.entry.js +1 -0
- package/dist/sankhyablocks/p-b8cde0d8.entry.js +1 -0
- package/dist/sankhyablocks/p-c7cbad38.js +1 -0
- package/dist/sankhyablocks/p-e0b9f59a.entry.js +1 -0
- package/dist/sankhyablocks/p-e6210aec.js +1 -0
- package/dist/sankhyablocks/p-e9bbc3d5.entry.js +1 -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
@@ -1,6 +1,5 @@
|
|
1
1
|
import { h, Fragment } from '@stencil/core';
|
2
|
-
import {
|
3
|
-
import { UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
2
|
+
import { Action as DUAction, ApplicationContext, ElementIDUtils, StringUtils } from '@sankhyalabs/core';
|
4
3
|
import { TaskbarElement } from '../snk-taskbar/elements/taskbar-elements';
|
5
4
|
import { ConfigStorage } from '../../lib/configs/ConfigStorage';
|
6
5
|
import { PresentationMode } from '../../lib/@types';
|
@@ -10,8 +9,12 @@ import SnkMultiSelectionListDataSource from './filtercolumn/SnkMultiSelectionLis
|
|
10
9
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
11
10
|
import { buildFieldSearch, openFieldSearch } from '../snk-taskbar/subcomponents/field-search';
|
12
11
|
import { CrudUtils } from '../../lib';
|
12
|
+
import RmPrecisionCustomValueFormatter from '../../lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter';
|
13
|
+
import ServerSideExporterProvider from '../snk-data-exporter/providers/ServerSideExporterProvider';
|
13
14
|
export class SnkGrid {
|
14
15
|
constructor() {
|
16
|
+
this._customEditors = new Map();
|
17
|
+
this._customRenders = new Map();
|
15
18
|
this._topTaskbarProcessor = new TaskbarProcessor({
|
16
19
|
"snkGridTopTaskbar.regular": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
|
17
20
|
"snkGridTopTaskbar.regular.secondary": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
|
@@ -31,6 +34,14 @@ export class SnkGrid {
|
|
31
34
|
"snkGridHeaderTaskbar.singleTaskbar.detail.selected": ["UPDATE", "ATTACH", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "FORM_MODE", "CONFIGURATOR", "REFRESH"],
|
32
35
|
"snkGridHeaderTaskbar.singleTaskbar.finish_edition": ["CANCEL", "SAVE"]
|
33
36
|
});
|
37
|
+
this.dataUnitInterceptor = {
|
38
|
+
interceptAction: async (action) => {
|
39
|
+
if (action.type === DUAction.METADATA_LOADED) {
|
40
|
+
return await this.interceptMetadataLoaded(action);
|
41
|
+
}
|
42
|
+
return action;
|
43
|
+
}
|
44
|
+
};
|
34
45
|
this._dataUnit = undefined;
|
35
46
|
this._dataState = undefined;
|
36
47
|
this._gridConfig = undefined;
|
@@ -57,6 +68,8 @@ export class SnkGrid {
|
|
57
68
|
this.disablePersonalizedFilter = undefined;
|
58
69
|
this.gridLegacyConfigName = undefined;
|
59
70
|
this.filterBarLegacyConfigName = undefined;
|
71
|
+
this.autoLoad = undefined;
|
72
|
+
this.autoFocus = true;
|
60
73
|
}
|
61
74
|
/**
|
62
75
|
* Exibe a janela de configurações da grade.
|
@@ -101,6 +114,42 @@ export class SnkGrid {
|
|
101
114
|
async findColumn() {
|
102
115
|
await openFieldSearch(this._moreOptions, this._columnSearch);
|
103
116
|
}
|
117
|
+
/**
|
118
|
+
* Registra um editor customizado para campos da grade e formulário
|
119
|
+
*/
|
120
|
+
async addCustomEditor(fieldName, customEditor, detailContext) {
|
121
|
+
if (this._grid) {
|
122
|
+
this._grid.addCustomEditor(fieldName, customEditor, detailContext);
|
123
|
+
return;
|
124
|
+
}
|
125
|
+
const newCustomEditors = new Map(this._customEditors);
|
126
|
+
newCustomEditors.set(fieldName, { customEditor, detailContext });
|
127
|
+
this._customEditors = newCustomEditors;
|
128
|
+
}
|
129
|
+
/**
|
130
|
+
* Registra um render customizado para colunas da grid.
|
131
|
+
*/
|
132
|
+
async addGridCustomRender(fieldName, customRender, detailContext) {
|
133
|
+
if (this._grid) {
|
134
|
+
this._grid.addGridCustomRender(fieldName, customRender, detailContext);
|
135
|
+
return;
|
136
|
+
}
|
137
|
+
const newCustomRenders = new Map(this._customRenders);
|
138
|
+
newCustomRenders.set(fieldName, { customRender, detailContext });
|
139
|
+
this._customRenders = newCustomRenders;
|
140
|
+
}
|
141
|
+
/**
|
142
|
+
* Registra um formatador de valores para uma coluna da grid.
|
143
|
+
*/
|
144
|
+
async addCustomValueFormatter(columnName, customFormatter) {
|
145
|
+
this._grid.addCustomValueFormatter(columnName, customFormatter);
|
146
|
+
}
|
147
|
+
/**
|
148
|
+
* Remove o formatador de valores de uma coluna da grid.
|
149
|
+
*/
|
150
|
+
async removeCustomValueFormatter(columnName) {
|
151
|
+
this._grid.removeCustomValueFormatter(columnName);
|
152
|
+
}
|
104
153
|
/**
|
105
154
|
* Atribui o foco para a grade.
|
106
155
|
*/
|
@@ -161,106 +210,31 @@ export class SnkGrid {
|
|
161
210
|
});
|
162
211
|
evt.stopPropagation();
|
163
212
|
}
|
164
|
-
buildColumnsMetadata(gridColumns) {
|
165
|
-
const columnsMetadata = [];
|
166
|
-
gridColumns === null || gridColumns === void 0 ? void 0 : gridColumns.forEach((column) => {
|
167
|
-
var _a, _b;
|
168
|
-
/**
|
169
|
-
* TODO: Analisar e criar uma melhor forma de tratar essa validação do "RECDESP".
|
170
|
-
*/
|
171
|
-
if (column.hidden && column.name !== "RECDESP") {
|
172
|
-
return;
|
173
|
-
}
|
174
|
-
const fieldData = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getField(column.name);
|
175
|
-
const columnData = {
|
176
|
-
label: column.label,
|
177
|
-
id: column.name,
|
178
|
-
width: column.width,
|
179
|
-
type: fieldData === null || fieldData === void 0 ? void 0 : fieldData.dataType,
|
180
|
-
userInterface: fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface
|
181
|
-
};
|
182
|
-
columnsMetadata.push(columnData);
|
183
|
-
if (((_b = fieldData === null || fieldData === void 0 ? void 0 : fieldData.properties) === null || _b === void 0 ? void 0 : _b.DESCRIPTIONFIELD) != undefined) {
|
184
|
-
const mergedFrom = fieldData.properties.mergedFrom;
|
185
|
-
const descriptionField = `${fieldData.properties.ENTITYNAME}.${fieldData.properties.DESCRIPTIONFIELD}`;
|
186
|
-
const descriptionColumn = {
|
187
|
-
label: fieldData.properties.DESCRIPTIONENTITY,
|
188
|
-
id: `${mergedFrom ? (mergedFrom + ".") : ""}${descriptionField}`,
|
189
|
-
width: 200,
|
190
|
-
type: DataType.TEXT,
|
191
|
-
userInterface: UserInterface.LONGTEXT
|
192
|
-
};
|
193
|
-
columnsMetadata.push(descriptionColumn);
|
194
|
-
}
|
195
|
-
});
|
196
|
-
return columnsMetadata || [];
|
197
|
-
}
|
198
|
-
getPaginationInfo() {
|
199
|
-
var _a;
|
200
|
-
return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo();
|
201
|
-
}
|
202
|
-
getExporterOffset(paginationInfo) {
|
203
|
-
if (paginationInfo == undefined) {
|
204
|
-
return;
|
205
|
-
}
|
206
|
-
const offset = paginationInfo.firstRecord;
|
207
|
-
if (offset > 0) {
|
208
|
-
return (offset - 1);
|
209
|
-
}
|
210
|
-
return offset;
|
211
|
-
}
|
212
213
|
async dataExporterProviderStore() {
|
213
|
-
|
214
|
-
const selectedIDs = await ((_a = this._snkDataUnit) === null || _a === void 0 ? void 0 : _a.getSelectedRecordsIDsInfo());
|
215
|
-
const dataExporterProvider = {
|
216
|
-
getFilters: () => {
|
217
|
-
var _a;
|
218
|
-
return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getAppliedFilters();
|
219
|
-
},
|
220
|
-
getColumnsMetadata: async () => {
|
221
|
-
var _a;
|
222
|
-
const columnsState = await ((_a = this._grid) === null || _a === void 0 ? void 0 : _a.getColumnsState());
|
223
|
-
return this.buildColumnsMetadata(columnsState);
|
224
|
-
},
|
225
|
-
getOrders: () => {
|
226
|
-
var _a;
|
227
|
-
return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getSort();
|
228
|
-
},
|
229
|
-
getResourceURI: () => {
|
230
|
-
var _a;
|
231
|
-
return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.name;
|
232
|
-
},
|
233
|
-
getSelectedNumber: () => {
|
234
|
-
var _a, _b;
|
235
|
-
return (_b = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectionInfo) === null || _b === void 0 ? void 0 : _b.length;
|
236
|
-
},
|
237
|
-
getTotalRecords: () => {
|
238
|
-
var _a, _b, _c;
|
239
|
-
const { total } = ((_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo()) || {};
|
240
|
-
return total !== null && total !== void 0 ? total : (_c = (_b = this._dataUnit) === null || _b === void 0 ? void 0 : _b.records) === null || _c === void 0 ? void 0 : _c.length;
|
241
|
-
},
|
242
|
-
getSelectedIDs: () => {
|
243
|
-
return selectedIDs || [];
|
244
|
-
},
|
245
|
-
getOffset: () => {
|
246
|
-
return this.getExporterOffset(this.getPaginationInfo());
|
247
|
-
},
|
248
|
-
getLimit: () => {
|
249
|
-
var _a;
|
250
|
-
return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.pageSize;
|
251
|
-
},
|
252
|
-
getRecordID: () => {
|
253
|
-
var _a, _b, _c;
|
254
|
-
return (_c = (_b = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.records) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.__record__id__;
|
255
|
-
}
|
256
|
-
};
|
214
|
+
const dataExporterProvider = new ServerSideExporterProvider(this._dataUnit, this._grid);
|
257
215
|
store.set("exporterProviders", Object.assign(Object.assign({}, store.get("exporterProviders")), { [this.configName]: dataExporterProvider }));
|
258
216
|
}
|
259
217
|
addElementID() {
|
260
218
|
const dataInfo = { dataUnit: this._dataUnit };
|
261
219
|
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
262
220
|
}
|
263
|
-
|
221
|
+
loadGridCustomFormatters(fields) {
|
222
|
+
if (!fields || !this._grid) {
|
223
|
+
return;
|
224
|
+
}
|
225
|
+
fields.forEach((field) => {
|
226
|
+
var _a;
|
227
|
+
if ((_a = field.properties) === null || _a === void 0 ? void 0 : _a.rm_precision) {
|
228
|
+
this.addCustomValueFormatter(field.name, this._rmPrecisionCustomValueFormatter);
|
229
|
+
}
|
230
|
+
});
|
231
|
+
}
|
232
|
+
async interceptMetadataLoaded(action) {
|
233
|
+
this.loadGridCustomFormatters(action.payload.fields);
|
234
|
+
return action;
|
235
|
+
}
|
236
|
+
finishLoading() {
|
237
|
+
this._dataUnit.addInterceptor(this.dataUnitInterceptor);
|
264
238
|
CrudUtils.assertDefaultSorting(this._gridConfig, this._dataUnit);
|
265
239
|
this.addElementID();
|
266
240
|
if (this.columnFilterDataSource != undefined) {
|
@@ -268,6 +242,24 @@ export class SnkGrid {
|
|
268
242
|
this.columnFilterDataSource.setDataUnit(this._dataUnit);
|
269
243
|
}
|
270
244
|
}
|
245
|
+
setCustomRenders() {
|
246
|
+
if (!this._grid) {
|
247
|
+
return;
|
248
|
+
}
|
249
|
+
for (const [fieldName, customRenderProps] of this._customRenders) {
|
250
|
+
this._grid.addGridCustomRender(fieldName, customRenderProps.customRender, customRenderProps.detailContext);
|
251
|
+
this._customRenders.delete(fieldName);
|
252
|
+
}
|
253
|
+
}
|
254
|
+
setCustomEditors() {
|
255
|
+
if (!this._grid) {
|
256
|
+
return;
|
257
|
+
}
|
258
|
+
for (const [fieldName, customEditorProps] of this._customEditors) {
|
259
|
+
this._grid.addCustomEditor(fieldName, customEditorProps.customEditor, customEditorProps.detailContext);
|
260
|
+
this._customEditors.delete(fieldName);
|
261
|
+
}
|
262
|
+
}
|
271
263
|
componentWillLoad() {
|
272
264
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
273
265
|
//TODO: substituir pelo metodo nativo closest
|
@@ -279,17 +271,15 @@ export class SnkGrid {
|
|
279
271
|
if (!this._dataUnit) {
|
280
272
|
this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
281
273
|
this._dataUnit = evt.detail;
|
282
|
-
this.
|
274
|
+
this.finishLoading();
|
283
275
|
});
|
284
276
|
}
|
285
277
|
else {
|
286
|
-
this.
|
278
|
+
this.finishLoading();
|
287
279
|
}
|
288
280
|
if (!this.messagesBuilder)
|
289
281
|
this.messagesBuilder = this._snkDataUnit.messagesBuilder;
|
290
|
-
this._snkDataUnit.addEventListener("dataStateChange", (
|
291
|
-
this._dataState = evt.detail;
|
292
|
-
});
|
282
|
+
this._snkDataUnit.addEventListener("dataStateChange", this.handleDataStateChange.bind(this));
|
293
283
|
this._snkDataUnit.addEventListener("cancelEdition", () => {
|
294
284
|
var _a;
|
295
285
|
if ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.recordsIsEmpty) {
|
@@ -300,9 +290,20 @@ export class SnkGrid {
|
|
300
290
|
}
|
301
291
|
parent = parent.parentElement;
|
302
292
|
}
|
293
|
+
this._rmPrecisionCustomValueFormatter = new RmPrecisionCustomValueFormatter();
|
303
294
|
this.addGridLegacyConfigName();
|
304
295
|
this.loadConfig();
|
305
296
|
}
|
297
|
+
componentDidRender() {
|
298
|
+
this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
|
299
|
+
this.loadGridCustomFormatters(this._dataUnit.metadata.fields);
|
300
|
+
this.setCustomRenders();
|
301
|
+
this.setCustomEditors();
|
302
|
+
}
|
303
|
+
async handleDataStateChange(evt) {
|
304
|
+
this._dataState = evt.detail;
|
305
|
+
this._rmPrecisionCustomValueFormatter.setDataState(this._dataState);
|
306
|
+
}
|
306
307
|
getHeaderDisabledButtons() {
|
307
308
|
var _a;
|
308
309
|
const disabledButtons = [];
|
@@ -415,7 +416,7 @@ export class SnkGrid {
|
|
415
416
|
return undefined;
|
416
417
|
}
|
417
418
|
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, this._showSnkFilterBar &&
|
418
|
-
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
419
|
+
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit, autoFocus: this.autoFocus }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
419
420
|
}
|
420
421
|
static get is() { return "snk-grid"; }
|
421
422
|
static get encapsulation() { return "scoped"; }
|
@@ -826,6 +827,41 @@ export class SnkGrid {
|
|
826
827
|
},
|
827
828
|
"attribute": "filter-bar-legacy-config-name",
|
828
829
|
"reflect": false
|
830
|
+
},
|
831
|
+
"autoLoad": {
|
832
|
+
"type": "boolean",
|
833
|
+
"mutable": false,
|
834
|
+
"complexType": {
|
835
|
+
"original": "boolean",
|
836
|
+
"resolved": "boolean",
|
837
|
+
"references": {}
|
838
|
+
},
|
839
|
+
"required": false,
|
840
|
+
"optional": true,
|
841
|
+
"docs": {
|
842
|
+
"tags": [],
|
843
|
+
"text": "Define se a carga dos dados ser\u00E1 feita assim que o componente for carregado."
|
844
|
+
},
|
845
|
+
"attribute": "auto-load",
|
846
|
+
"reflect": false
|
847
|
+
},
|
848
|
+
"autoFocus": {
|
849
|
+
"type": "boolean",
|
850
|
+
"mutable": false,
|
851
|
+
"complexType": {
|
852
|
+
"original": "boolean",
|
853
|
+
"resolved": "boolean",
|
854
|
+
"references": {}
|
855
|
+
},
|
856
|
+
"required": false,
|
857
|
+
"optional": true,
|
858
|
+
"docs": {
|
859
|
+
"tags": [],
|
860
|
+
"text": "Define se a grid ser\u00E1 focada ao ser carregada."
|
861
|
+
},
|
862
|
+
"attribute": "auto-focus",
|
863
|
+
"reflect": false,
|
864
|
+
"defaultValue": "true"
|
829
865
|
}
|
830
866
|
};
|
831
867
|
}
|
@@ -979,6 +1015,109 @@ export class SnkGrid {
|
|
979
1015
|
"tags": []
|
980
1016
|
}
|
981
1017
|
},
|
1018
|
+
"addCustomEditor": {
|
1019
|
+
"complexType": {
|
1020
|
+
"signature": "(fieldName: string, customEditor: ICustomEditor, detailContext?: string) => Promise<void>",
|
1021
|
+
"parameters": [{
|
1022
|
+
"tags": [],
|
1023
|
+
"text": ""
|
1024
|
+
}, {
|
1025
|
+
"tags": [],
|
1026
|
+
"text": ""
|
1027
|
+
}, {
|
1028
|
+
"tags": [],
|
1029
|
+
"text": ""
|
1030
|
+
}],
|
1031
|
+
"references": {
|
1032
|
+
"Promise": {
|
1033
|
+
"location": "global"
|
1034
|
+
},
|
1035
|
+
"ICustomEditor": {
|
1036
|
+
"location": "import",
|
1037
|
+
"path": "@sankhyalabs/ezui/dist/types/utils"
|
1038
|
+
}
|
1039
|
+
},
|
1040
|
+
"return": "Promise<void>"
|
1041
|
+
},
|
1042
|
+
"docs": {
|
1043
|
+
"text": "Registra um editor customizado para campos da grade e formul\u00E1rio",
|
1044
|
+
"tags": []
|
1045
|
+
}
|
1046
|
+
},
|
1047
|
+
"addGridCustomRender": {
|
1048
|
+
"complexType": {
|
1049
|
+
"signature": "(fieldName: string, customRender: ICustomRender, detailContext?: string) => Promise<void>",
|
1050
|
+
"parameters": [{
|
1051
|
+
"tags": [],
|
1052
|
+
"text": ""
|
1053
|
+
}, {
|
1054
|
+
"tags": [],
|
1055
|
+
"text": ""
|
1056
|
+
}, {
|
1057
|
+
"tags": [],
|
1058
|
+
"text": ""
|
1059
|
+
}],
|
1060
|
+
"references": {
|
1061
|
+
"Promise": {
|
1062
|
+
"location": "global"
|
1063
|
+
},
|
1064
|
+
"ICustomRender": {
|
1065
|
+
"location": "import",
|
1066
|
+
"path": "@sankhyalabs/ezui/dist/types/utils"
|
1067
|
+
}
|
1068
|
+
},
|
1069
|
+
"return": "Promise<void>"
|
1070
|
+
},
|
1071
|
+
"docs": {
|
1072
|
+
"text": "Registra um render customizado para colunas da grid.",
|
1073
|
+
"tags": []
|
1074
|
+
}
|
1075
|
+
},
|
1076
|
+
"addCustomValueFormatter": {
|
1077
|
+
"complexType": {
|
1078
|
+
"signature": "(columnName: string, customFormatter: ICustomFormatter) => Promise<void>",
|
1079
|
+
"parameters": [{
|
1080
|
+
"tags": [],
|
1081
|
+
"text": ""
|
1082
|
+
}, {
|
1083
|
+
"tags": [],
|
1084
|
+
"text": ""
|
1085
|
+
}],
|
1086
|
+
"references": {
|
1087
|
+
"Promise": {
|
1088
|
+
"location": "global"
|
1089
|
+
},
|
1090
|
+
"ICustomFormatter": {
|
1091
|
+
"location": "import",
|
1092
|
+
"path": "@sankhyalabs/ezui/dist/types/components/ez-grid/interfaces"
|
1093
|
+
}
|
1094
|
+
},
|
1095
|
+
"return": "Promise<void>"
|
1096
|
+
},
|
1097
|
+
"docs": {
|
1098
|
+
"text": "Registra um formatador de valores para uma coluna da grid.",
|
1099
|
+
"tags": []
|
1100
|
+
}
|
1101
|
+
},
|
1102
|
+
"removeCustomValueFormatter": {
|
1103
|
+
"complexType": {
|
1104
|
+
"signature": "(columnName: string) => Promise<void>",
|
1105
|
+
"parameters": [{
|
1106
|
+
"tags": [],
|
1107
|
+
"text": ""
|
1108
|
+
}],
|
1109
|
+
"references": {
|
1110
|
+
"Promise": {
|
1111
|
+
"location": "global"
|
1112
|
+
}
|
1113
|
+
},
|
1114
|
+
"return": "Promise<void>"
|
1115
|
+
},
|
1116
|
+
"docs": {
|
1117
|
+
"text": "Remove o formatador de valores de uma coluna da grid.",
|
1118
|
+
"tags": []
|
1119
|
+
}
|
1120
|
+
},
|
982
1121
|
"setFocus": {
|
983
1122
|
"complexType": {
|
984
1123
|
"signature": "() => Promise<void>",
|