@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-kb-67792.0 → 0.0.0-bugfix-dev-kb-67792.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/{ConfigStorage-0a690675.js → ConfigStorage-e49214c6.js} +1 -0
- package/dist/cjs/{SnkMultiSelectionListDataSource-f79d220c.js → IExporterProvider-10b7fed5.js} +94 -4
- package/dist/cjs/RecordIDUtils-3735135c.js +43 -0
- package/dist/cjs/{SnkFormConfigManager-d6d5db6d.js → SnkFormConfigManager-beebf47a.js} +8 -7
- package/dist/cjs/{SnkMessageBuilder-96b0f549.js → SnkMessageBuilder-cceebbae.js} +9 -13
- package/dist/cjs/{pesquisa-fetcher-cba1b3d0.js → dataunit-fetcher-d4873076.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-a1d0353f.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-f0221097.js +690 -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 +168 -111
- package/dist/cjs/{snk-guides-viewer-bfcad2d6.js → snk-guides-viewer-aafc3073.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 +269 -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 +540 -219
- 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.css +2 -0
- package/dist/collection/components/snk-grid/snk-grid.js +242 -103
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +407 -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 +487 -217
- 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 +171 -109
- package/dist/components/snk-personalized-filter2.js +1 -1
- package/dist/components/snk-simple-crud2.js +264 -25
- package/dist/components/snk-taskbar2.js +6 -5
- package/dist/esm/{ConfigStorage-8c2ddac8.js → ConfigStorage-e476378d.js} +1 -0
- package/dist/esm/{SnkMultiSelectionListDataSource-a4805051.js → IExporterProvider-d597f27d.js} +93 -5
- package/dist/esm/RecordIDUtils-87d02110.js +41 -0
- package/dist/esm/{SnkFormConfigManager-c01b9d9d.js → SnkFormConfigManager-298cd647.js} +8 -7
- package/dist/esm/{SnkMessageBuilder-72423074.js → SnkMessageBuilder-ae87b754.js} +9 -13
- package/dist/esm/{pesquisa-fetcher-34a8b8be.js → dataunit-fetcher-3d2ec959.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-a87445a0.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-1ef94aef.js +688 -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 +166 -109
- package/dist/esm/{snk-guides-viewer-edeac29f.js → snk-guides-viewer-62124f3d.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 +257 -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-08c28ddd.entry.js +1 -0
- package/dist/sankhyablocks/p-091ce761.js +60 -0
- package/dist/sankhyablocks/p-094eebf6.entry.js +1 -0
- package/dist/sankhyablocks/p-0c68f40f.entry.js +1 -0
- package/dist/sankhyablocks/p-162b9a59.entry.js +11 -0
- package/dist/sankhyablocks/p-1db45d26.entry.js +1 -0
- package/dist/sankhyablocks/p-25f1fc39.js +6 -0
- package/dist/sankhyablocks/p-2e9c764c.entry.js +1 -0
- package/dist/sankhyablocks/p-30cf616e.js +1 -0
- package/dist/sankhyablocks/{p-96621231.js → p-3287a6cc.js} +1 -1
- package/dist/sankhyablocks/p-421bec84.entry.js +1 -0
- package/dist/sankhyablocks/p-42f7b05d.entry.js +1 -0
- package/dist/sankhyablocks/p-51999ab5.entry.js +1 -0
- package/dist/sankhyablocks/p-5f016aed.js +1 -0
- package/dist/sankhyablocks/p-6c364d25.entry.js +1 -0
- package/dist/sankhyablocks/p-70001ac1.js +1 -0
- package/dist/sankhyablocks/p-74c665d5.entry.js +1 -0
- package/dist/sankhyablocks/p-76a65660.js +1 -0
- package/dist/sankhyablocks/p-7c4aabe2.js +1 -0
- package/dist/sankhyablocks/{p-ae4fc9a9.js → p-7e7a7473.js} +1 -1
- package/dist/sankhyablocks/p-8c1ff936.entry.js +1 -0
- package/dist/sankhyablocks/p-939e15d3.entry.js +1 -0
- package/dist/sankhyablocks/p-9863d682.js +1 -0
- package/dist/sankhyablocks/{p-41c2c191.entry.js → p-9dfda04a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-c2ae0fab.entry.js → p-bd008859.entry.js} +1 -1
- package/dist/sankhyablocks/p-c273d6ee.js +1 -0
- package/dist/sankhyablocks/p-d65d98ed.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 +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 +67 -3
- 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-559ac55c.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-44215df7.js +0 -460
- package/dist/sankhyablocks/p-03dcc5ff.entry.js +0 -1
- package/dist/sankhyablocks/p-176c3491.entry.js +0 -1
- package/dist/sankhyablocks/p-37e5d563.js +0 -65
- package/dist/sankhyablocks/p-38289a55.js +0 -1
- package/dist/sankhyablocks/p-46e55a95.entry.js +0 -1
- package/dist/sankhyablocks/p-4e728357.entry.js +0 -1
- package/dist/sankhyablocks/p-5571bdfe.js +0 -1
- package/dist/sankhyablocks/p-5630574e.js +0 -1
- package/dist/sankhyablocks/p-5f8c0426.entry.js +0 -1
- package/dist/sankhyablocks/p-80c64add.entry.js +0 -1
- package/dist/sankhyablocks/p-86af4cc2.js +0 -1
- package/dist/sankhyablocks/p-8b690717.js +0 -1
- package/dist/sankhyablocks/p-a1832166.entry.js +0 -1
- package/dist/sankhyablocks/p-a809d944.entry.js +0 -1
- package/dist/sankhyablocks/p-a97226f6.entry.js +0 -1
- package/dist/sankhyablocks/p-add17f6a.entry.js +0 -1
- package/dist/sankhyablocks/p-c5a9a5d9.entry.js +0 -1
- package/dist/sankhyablocks/p-c5aa7d70.entry.js +0 -11
- package/dist/sankhyablocks/p-cb0147ab.entry.js +0 -1
- package/dist/sankhyablocks/p-f0145e3b.js +0 -1
- package/dist/sankhyablocks/p-f03e4199.entry.js +0 -1
- package/dist/sankhyablocks/p-f607db63.entry.js +0 -1
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/index.d.ts +0 -3
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DataType } from "@sankhyalabs/core";
|
|
2
|
+
const metadataMock = {
|
|
3
|
+
label: 'metadataMock',
|
|
4
|
+
name: 'metadataMock',
|
|
5
|
+
fields: [
|
|
6
|
+
{
|
|
7
|
+
name: 'TESTE',
|
|
8
|
+
label: 'Teste',
|
|
9
|
+
dataType: DataType.TEXT,
|
|
10
|
+
properties: {
|
|
11
|
+
rm_precision: 'TESTERMP.PRODUTORMP.decVlr'
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'TESTERMP',
|
|
16
|
+
label: 'Teste com RMP',
|
|
17
|
+
dataType: DataType.TEXT,
|
|
18
|
+
properties: {
|
|
19
|
+
rmp: 'PRODUTORMP'
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
};
|
|
24
|
+
export default metadataMock;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DataType } from "@sankhyalabs/core";
|
|
2
|
+
const parentMetadataMock = {
|
|
3
|
+
label: 'parentMetadataMock',
|
|
4
|
+
name: 'parentMetadataMock',
|
|
5
|
+
fields: [
|
|
6
|
+
{
|
|
7
|
+
name: 'PARENT',
|
|
8
|
+
label: 'Parent',
|
|
9
|
+
dataType: DataType.TEXT,
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
name: 'TESTEPARENT',
|
|
13
|
+
label: 'Teste com Parent',
|
|
14
|
+
dataType: DataType.TEXT,
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
};
|
|
18
|
+
export default parentMetadataMock;
|
|
@@ -36,6 +36,7 @@ export class SnkFilterBar {
|
|
|
36
36
|
this.messagesBuilder = undefined;
|
|
37
37
|
this.disablePersonalizedFilter = undefined;
|
|
38
38
|
this.filterBarLegacyConfigName = undefined;
|
|
39
|
+
this.autoLoad = undefined;
|
|
39
40
|
this.allowDefault = undefined;
|
|
40
41
|
this.scrollerLocked = false;
|
|
41
42
|
this.showPersonalizedFilter = false;
|
|
@@ -191,7 +192,10 @@ export class SnkFilterBar {
|
|
|
191
192
|
}
|
|
192
193
|
async doLoadData(forceReload = false) {
|
|
193
194
|
try {
|
|
194
|
-
if (this._firstLoad &&
|
|
195
|
+
if (this._firstLoad && this.autoLoad === false) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (this._firstLoad && !forceReload && this.autoLoad === undefined) {
|
|
195
199
|
let autoLoad = await this._application.getBooleanParam("global.carregar.registros.iniciar.tela");
|
|
196
200
|
if (!autoLoad) {
|
|
197
201
|
return;
|
|
@@ -639,6 +643,23 @@ export class SnkFilterBar {
|
|
|
639
643
|
},
|
|
640
644
|
"attribute": "filter-bar-legacy-config-name",
|
|
641
645
|
"reflect": false
|
|
646
|
+
},
|
|
647
|
+
"autoLoad": {
|
|
648
|
+
"type": "boolean",
|
|
649
|
+
"mutable": false,
|
|
650
|
+
"complexType": {
|
|
651
|
+
"original": "boolean",
|
|
652
|
+
"resolved": "boolean",
|
|
653
|
+
"references": {}
|
|
654
|
+
},
|
|
655
|
+
"required": false,
|
|
656
|
+
"optional": true,
|
|
657
|
+
"docs": {
|
|
658
|
+
"tags": [],
|
|
659
|
+
"text": "Define se a carga dos dados ser\u00E1 feita assim que o componente for carregado."
|
|
660
|
+
},
|
|
661
|
+
"attribute": "auto-load",
|
|
662
|
+
"reflect": false
|
|
642
663
|
}
|
|
643
664
|
};
|
|
644
665
|
}
|
|
@@ -4,6 +4,7 @@ import { SnkFormConfigManager } from '../snk-form-config/SnkFormConfigManager';
|
|
|
4
4
|
import ResourceIDUtils from '../../lib/resourceid/ResourceIDUtils';
|
|
5
5
|
export class SnkForm {
|
|
6
6
|
constructor() {
|
|
7
|
+
this._customEditors = new Map();
|
|
7
8
|
this._dataUnit = undefined;
|
|
8
9
|
this._dataState = undefined;
|
|
9
10
|
this._showFormConfig = false;
|
|
@@ -26,6 +27,24 @@ export class SnkForm {
|
|
|
26
27
|
async hideConfig() {
|
|
27
28
|
this._showFormConfig = false;
|
|
28
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Registra um editor customizado para campos da grade e formulário.
|
|
32
|
+
*/
|
|
33
|
+
async addCustomEditor(fieldName, customEditor) {
|
|
34
|
+
if (this._form) {
|
|
35
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const newCustomEditors = new Map(this._customEditors);
|
|
39
|
+
newCustomEditors.set(fieldName, customEditor);
|
|
40
|
+
this._customEditors = newCustomEditors;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
|
44
|
+
*/
|
|
45
|
+
async setFieldProp(fieldName, propName, value) {
|
|
46
|
+
await this._form.setFieldProp(fieldName, propName, value);
|
|
47
|
+
}
|
|
29
48
|
closeConfig() {
|
|
30
49
|
this.hideConfig();
|
|
31
50
|
}
|
|
@@ -33,6 +52,18 @@ export class SnkForm {
|
|
|
33
52
|
const dataInfo = { dataUnit: this._dataUnit };
|
|
34
53
|
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
35
54
|
}
|
|
55
|
+
setCustomEditors() {
|
|
56
|
+
if (!this._form) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
for (const [fieldName, customEditor] of this._customEditors) {
|
|
60
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
|
61
|
+
this._customEditors.delete(fieldName);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async componentDidRender() {
|
|
65
|
+
this.setCustomEditors();
|
|
66
|
+
}
|
|
36
67
|
async componentWillLoad() {
|
|
37
68
|
let parent = this._element.parentElement;
|
|
38
69
|
while (parent) {
|
|
@@ -48,9 +79,7 @@ export class SnkForm {
|
|
|
48
79
|
this._dataUnit = evt.detail;
|
|
49
80
|
});
|
|
50
81
|
}
|
|
51
|
-
this._snkDataUnit.addEventListener("dataStateChange", (
|
|
52
|
-
this._dataState = evt.detail;
|
|
53
|
-
});
|
|
82
|
+
this._snkDataUnit.addEventListener("dataStateChange", this.handleDataStateChange.bind(this));
|
|
54
83
|
break;
|
|
55
84
|
}
|
|
56
85
|
parent = parent.parentElement;
|
|
@@ -60,7 +89,24 @@ export class SnkForm {
|
|
|
60
89
|
}
|
|
61
90
|
this._configManager = new SnkFormConfigManager(this.configName, this.resourceID);
|
|
62
91
|
this.addFormLegacyConfig();
|
|
63
|
-
this._configManager.loadConfig();
|
|
92
|
+
await this._configManager.loadConfig();
|
|
93
|
+
}
|
|
94
|
+
async handleDataStateChange(evt) {
|
|
95
|
+
var _a;
|
|
96
|
+
this._dataState = evt.detail;
|
|
97
|
+
const fieldsWithRmPrecision = await this._snkDataUnit.getFieldsWithRmPrecision();
|
|
98
|
+
for (const field of fieldsWithRmPrecision || []) {
|
|
99
|
+
if (!field) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
const rmPrecision = (_a = this._dataState.rowMetadata) === null || _a === void 0 ? void 0 : _a.getProp('rm_precision', field);
|
|
103
|
+
if (!rmPrecision && rmPrecision !== 0) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
await this.setFieldProp(field, 'precision', rmPrecision);
|
|
107
|
+
await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
|
|
108
|
+
}
|
|
109
|
+
;
|
|
64
110
|
}
|
|
65
111
|
addFormLegacyConfig() {
|
|
66
112
|
if (this.formLegacyConfigName) {
|
|
@@ -71,7 +117,7 @@ export class SnkForm {
|
|
|
71
117
|
if (!this._dataUnit || !this._dataState) {
|
|
72
118
|
return undefined;
|
|
73
119
|
}
|
|
74
|
-
return (h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { key: "ezForm" + this._snkDataUnit.entityName, "data-element-id": "embedded", dataUnit: this._dataUnit, config: this._configManager.getConfig(this._dataState.insertionMode, this._dataUnit), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
|
|
120
|
+
return (h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { ref: (ref) => this._form = ref, key: "ezForm" + this._snkDataUnit.entityName, "data-element-id": "embedded", dataUnit: this._dataUnit, config: this._configManager.getConfig(this._dataState.insertionMode, this._dataUnit), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
|
|
75
121
|
h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this._dataUnit, configManager: this._configManager, onConfigClose: () => this.closeConfig() })))));
|
|
76
122
|
}
|
|
77
123
|
static get is() { return "snk-form"; }
|
|
@@ -277,6 +323,57 @@ export class SnkForm {
|
|
|
277
323
|
"text": "Fecha a janela de configura\u00E7\u00F5es do formul\u00E1rio.",
|
|
278
324
|
"tags": []
|
|
279
325
|
}
|
|
326
|
+
},
|
|
327
|
+
"addCustomEditor": {
|
|
328
|
+
"complexType": {
|
|
329
|
+
"signature": "(fieldName: string, customEditor: ICustomEditor) => Promise<void>",
|
|
330
|
+
"parameters": [{
|
|
331
|
+
"tags": [],
|
|
332
|
+
"text": ""
|
|
333
|
+
}, {
|
|
334
|
+
"tags": [],
|
|
335
|
+
"text": ""
|
|
336
|
+
}],
|
|
337
|
+
"references": {
|
|
338
|
+
"Promise": {
|
|
339
|
+
"location": "global"
|
|
340
|
+
},
|
|
341
|
+
"ICustomEditor": {
|
|
342
|
+
"location": "import",
|
|
343
|
+
"path": "@sankhyalabs/ezui/dist/types/utils"
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
"return": "Promise<void>"
|
|
347
|
+
},
|
|
348
|
+
"docs": {
|
|
349
|
+
"text": "Registra um editor customizado para campos da grade e formul\u00E1rio.",
|
|
350
|
+
"tags": []
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
"setFieldProp": {
|
|
354
|
+
"complexType": {
|
|
355
|
+
"signature": "(fieldName: string, propName: string, value: any) => Promise<void>",
|
|
356
|
+
"parameters": [{
|
|
357
|
+
"tags": [],
|
|
358
|
+
"text": ""
|
|
359
|
+
}, {
|
|
360
|
+
"tags": [],
|
|
361
|
+
"text": ""
|
|
362
|
+
}, {
|
|
363
|
+
"tags": [],
|
|
364
|
+
"text": ""
|
|
365
|
+
}],
|
|
366
|
+
"references": {
|
|
367
|
+
"Promise": {
|
|
368
|
+
"location": "global"
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
"return": "Promise<void>"
|
|
372
|
+
},
|
|
373
|
+
"docs": {
|
|
374
|
+
"text": "Altera/adiciona uma propriedade nos metadados do campo.",
|
|
375
|
+
"tags": []
|
|
376
|
+
}
|
|
280
377
|
}
|
|
281
378
|
};
|
|
282
379
|
}
|
|
@@ -71,11 +71,12 @@ export class SnkFormConfigManager {
|
|
|
71
71
|
var _a;
|
|
72
72
|
const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
|
|
73
73
|
if (fields != undefined && fields.length > 0) {
|
|
74
|
-
return fields.map(({ label, name, readOnly }) => {
|
|
74
|
+
return fields.map(({ label, name, readOnly, visible, required }) => {
|
|
75
75
|
if (label == undefined) {
|
|
76
|
-
|
|
76
|
+
const currentField = dataUnit.getField(name);
|
|
77
|
+
return Object.assign(Object.assign({}, currentField), { name: name !== null && name !== void 0 ? name : currentField.name, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : currentField.readOnly, visible: visible !== null && visible !== void 0 ? visible : currentField.visible, required: required !== null && required !== void 0 ? required : currentField.required });
|
|
77
78
|
}
|
|
78
|
-
return { name, label, readOnly };
|
|
79
|
+
return { name, label, readOnly, visible, required };
|
|
79
80
|
})
|
|
80
81
|
.filter(field => this.isFieldVisible(field, descriptionFilter));
|
|
81
82
|
}
|
|
@@ -97,7 +98,7 @@ export class SnkFormConfigManager {
|
|
|
97
98
|
const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
|
|
98
99
|
return normalizedText.includes(normalizedFilter);
|
|
99
100
|
}
|
|
100
|
-
|
|
101
|
+
getFormConfig(dataUnit, ignoreReadOnlyFormFields) {
|
|
101
102
|
let fields = this.getFieldsList(dataUnit);
|
|
102
103
|
if (ignoreReadOnlyFormFields) {
|
|
103
104
|
fields = fields.filter(field => {
|
|
@@ -129,8 +130,8 @@ export class SnkFormConfigManager {
|
|
|
129
130
|
this._onConfigChange(Object.assign({}, this._config));
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
|
-
getConfig(
|
|
133
|
-
return
|
|
133
|
+
getConfig(dataUnit, ignoreReadOnlyFormFields) {
|
|
134
|
+
return this.getFormConfig(dataUnit, ignoreReadOnlyFormFields !== null && ignoreReadOnlyFormFields !== void 0 ? ignoreReadOnlyFormFields : true);
|
|
134
135
|
}
|
|
135
136
|
getFormConfigFetcher() {
|
|
136
137
|
if (this._formConfigFetcher == undefined) {
|
|
@@ -67,7 +67,7 @@ export class SnkFormConfig {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
getConfig() {
|
|
70
|
-
let config = this.configManager.getConfig(
|
|
70
|
+
let config = this.configManager.getConfig(this.dataUnit);
|
|
71
71
|
if (config.fields && config.fields.length === 0) {
|
|
72
72
|
config = undefined;
|
|
73
73
|
}
|