@sankhyalabs/sankhyablocks 8.15.3 → 8.16.0-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{ConfigStorage-942ce74b.js → ConfigStorage-a343e418.js} +1 -0
- package/dist/cjs/{SnkMultiSelectionListDataSource-3c08d25c.js → IExporterProvider-597949f9.js} +94 -4
- package/dist/cjs/RecordIDUtils-3735135c.js +43 -0
- package/dist/cjs/{SnkFormConfigManager-f9dc0d28.js → SnkFormConfigManager-166cbd1f.js} +8 -7
- package/dist/cjs/{SnkMessageBuilder-66aa2557.js → SnkMessageBuilder-897ffd08.js} +9 -13
- package/dist/cjs/{pesquisa-fetcher-562d281f.js → dataunit-fetcher-688d3f05.js} +87 -180
- package/dist/cjs/{index-0922807b.js → index-1dfc7a6e.js} +5 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pesquisa-fetcher-680e198f.js +166 -0
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +5 -3
- package/dist/cjs/snk-application.cjs.entry.js +35 -12
- package/dist/cjs/snk-attach.cjs.entry.js +71 -46
- package/dist/cjs/snk-crud.cjs.entry.js +101 -10
- package/dist/cjs/snk-data-exporter.cjs.entry.js +315 -85
- package/dist/cjs/snk-data-unit-8fa7917a.js +689 -0
- package/dist/cjs/snk-data-unit.cjs.entry.js +12 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +50 -10
- package/dist/cjs/snk-filter-bar.cjs.entry.js +6 -2
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +1 -1
- package/dist/cjs/snk-form-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-form-view.cjs.entry.js +67 -0
- package/dist/cjs/snk-form.cjs.entry.js +52 -7
- package/dist/cjs/snk-grid.cjs.entry.js +165 -108
- package/dist/cjs/{snk-guides-viewer-bb6087cd.js → snk-guides-viewer-9c682034.js} +43 -10
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +9 -7
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +268 -40
- package/dist/cjs/snk-taskbar.cjs.entry.js +4 -3
- package/dist/cjs/{taskbar-elements-3ecd1278.js → taskbar-elements-9ad1f9c0.js} +3 -3
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/snk-application/snk-application.js +35 -11
- package/dist/collection/components/snk-attach/snk-attach.js +67 -44
- package/dist/collection/components/snk-crud/interfaces/PropsCustomEditor.js +1 -0
- package/dist/collection/components/snk-crud/interfaces/PropsCustomRender.js +1 -0
- package/dist/collection/components/snk-crud/snk-crud.js +305 -7
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +136 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +161 -0
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +134 -7
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +97 -0
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +74 -0
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +54 -1
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterStrategy.js +1 -0
- package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +58 -0
- package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +55 -0
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +59 -52
- package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +62 -0
- package/dist/collection/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.js +88 -0
- package/dist/collection/components/snk-data-exporter/utils/ParserExport.js +20 -0
- package/dist/collection/components/snk-data-exporter/utils/RecordIDUtils.js +38 -0
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +538 -218
- package/dist/collection/components/snk-data-unit/test/resources/metadataMock.js +24 -0
- package/dist/collection/components/snk-data-unit/test/resources/parentMetadataMock.js +18 -0
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +22 -1
- package/dist/collection/components/snk-form/snk-form.js +102 -5
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +7 -6
- package/dist/collection/components/snk-form-config/snk-form-config.js +1 -1
- package/dist/collection/components/snk-grid/snk-grid.js +240 -101
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +406 -20
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +2 -2
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +2 -1
- package/dist/collection/lib/@types/index.js +5 -0
- package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +35 -0
- package/dist/collection/lib/configs/ConfigStorage.js +1 -0
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +7 -3
- package/dist/collection/lib/dataUnit/ValueFormatter.js +4 -0
- package/dist/collection/lib/dataUnit/interfaces/InMemoryLoaderConfig.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +3 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.js +4 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +11 -13
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +53 -4
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.js +22 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +4 -4
- package/dist/collection/lib/message/SnkMessageBuilder.js +5 -12
- package/dist/collection/lib/message/resources/snk-data-exporter.msg.js +2 -0
- package/dist/collection/lib/message/resources/snk-data-unit.msg.js +2 -1
- package/dist/components/ConfigStorage.js +1 -0
- package/dist/components/{field-search.js → IExporterProvider.js} +93 -6
- package/dist/components/ISave.js +47 -0
- package/dist/components/SnkFormConfigManager.js +7 -6
- package/dist/components/SnkMessageBuilder.js +9 -13
- package/dist/components/dataunit-fetcher.js +84 -182
- package/dist/components/index2.js +198 -33
- package/dist/components/pesquisa-fetcher.js +164 -0
- package/dist/components/snk-actions-button2.js +4 -11
- package/dist/components/snk-application2.js +31 -9
- package/dist/components/snk-attach2.js +65 -41
- package/dist/components/snk-crud.js +110 -11
- package/dist/components/snk-data-exporter2.js +309 -85
- package/dist/components/snk-data-unit2.js +485 -216
- package/dist/components/snk-detail-view2.js +96 -14
- package/dist/components/snk-expression-item2.js +1 -1
- package/dist/components/snk-filter-bar2.js +6 -1
- package/dist/components/snk-form-config2.js +1 -1
- package/dist/components/snk-form-view2.js +72 -1
- package/dist/components/snk-form.js +53 -6
- package/dist/components/snk-grid2.js +168 -106
- package/dist/components/snk-personalized-filter2.js +1 -1
- package/dist/components/snk-simple-crud2.js +263 -25
- package/dist/components/snk-taskbar2.js +6 -5
- package/dist/esm/{ConfigStorage-86187da3.js → ConfigStorage-3806514e.js} +1 -0
- package/dist/esm/{SnkMultiSelectionListDataSource-6a879955.js → IExporterProvider-63a188b6.js} +93 -5
- package/dist/esm/RecordIDUtils-87d02110.js +41 -0
- package/dist/esm/{SnkFormConfigManager-f53f9f87.js → SnkFormConfigManager-31b24066.js} +8 -7
- package/dist/esm/{SnkMessageBuilder-0a4becdd.js → SnkMessageBuilder-571462fb.js} +9 -13
- package/dist/esm/{pesquisa-fetcher-c7ce8ee7.js → dataunit-fetcher-264191b2.js} +83 -181
- package/dist/esm/{index-0ece87a6.js → index-3aa4977a.js} +6 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pesquisa-fetcher-03c8f919.js +164 -0
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +5 -3
- package/dist/esm/snk-application.entry.js +34 -11
- package/dist/esm/snk-attach.entry.js +66 -41
- package/dist/esm/snk-crud.entry.js +101 -10
- package/dist/esm/snk-data-exporter.entry.js +316 -86
- package/dist/esm/snk-data-unit-f5cbe64b.js +687 -0
- package/dist/esm/snk-data-unit.entry.js +12 -2
- package/dist/esm/snk-detail-view.entry.js +50 -10
- package/dist/esm/snk-filter-bar.entry.js +6 -2
- package/dist/esm/snk-filter-modal-item.entry.js +1 -1
- package/dist/esm/snk-form-config.entry.js +1 -1
- package/dist/esm/snk-form-view.entry.js +67 -0
- package/dist/esm/snk-form.entry.js +52 -7
- package/dist/esm/snk-grid.entry.js +163 -106
- package/dist/esm/{snk-guides-viewer-1d95ebf2.js → snk-guides-viewer-8f6960a2.js} +43 -10
- package/dist/esm/snk-guides-viewer.entry.js +9 -7
- package/dist/esm/snk-personalized-filter.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +256 -28
- package/dist/esm/snk-taskbar.entry.js +4 -3
- package/dist/esm/{taskbar-elements-2473c8ac.js → taskbar-elements-d59867f1.js} +3 -3
- package/dist/sankhyablocks/p-17def7cd.js +1 -0
- package/dist/sankhyablocks/p-1db45d26.entry.js +1 -0
- package/dist/sankhyablocks/p-28ee0972.js +1 -0
- package/dist/sankhyablocks/p-2a408684.js +1 -0
- package/dist/sankhyablocks/{p-eae7a817.entry.js → p-2c68b3ae.entry.js} +1 -1
- package/dist/sankhyablocks/p-30cf616e.js +1 -0
- package/dist/sankhyablocks/p-3a212712.js +1 -0
- package/dist/sankhyablocks/p-450c60e4.entry.js +1 -0
- package/dist/sankhyablocks/{p-a1d72395.entry.js → p-47db7e88.entry.js} +1 -1
- package/dist/sankhyablocks/p-4e5e1313.entry.js +1 -0
- package/dist/sankhyablocks/{p-aff76a53.js → p-52920496.js} +1 -1
- package/dist/sankhyablocks/p-62ba211a.entry.js +1 -0
- package/dist/sankhyablocks/p-6bb2f3e9.entry.js +1 -0
- package/dist/sankhyablocks/p-7505da04.entry.js +1 -0
- package/dist/sankhyablocks/p-7619bdb1.entry.js +11 -0
- package/dist/sankhyablocks/p-7a85fd49.entry.js +1 -0
- package/dist/sankhyablocks/{p-ae4fc9a9.js → p-7e7a7473.js} +1 -1
- package/dist/sankhyablocks/p-7ef9c55c.js +1 -0
- package/dist/sankhyablocks/p-80042dc6.entry.js +1 -0
- package/dist/sankhyablocks/p-8c59edd7.entry.js +1 -0
- package/dist/sankhyablocks/p-9606509c.entry.js +1 -0
- package/dist/sankhyablocks/p-9863d682.js +1 -0
- package/dist/sankhyablocks/p-ae93d46a.entry.js +1 -0
- package/dist/sankhyablocks/p-af8efd95.js +6 -0
- package/dist/sankhyablocks/p-d6e26ea8.entry.js +1 -0
- package/dist/sankhyablocks/p-f2809746.entry.js +1 -0
- package/dist/sankhyablocks/p-f4450320.entry.js +1 -0
- package/dist/sankhyablocks/p-fe79f83a.js +60 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +7 -3
- package/dist/types/components/snk-attach/snk-attach.d.ts +11 -9
- package/dist/types/components/snk-crud/interfaces/PropsCustomEditor.d.ts +4 -0
- package/dist/types/components/snk-crud/interfaces/PropsCustomRender.d.ts +4 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +45 -1
- package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +23 -0
- package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +28 -3
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +24 -0
- package/dist/types/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.d.ts +14 -0
- package/dist/types/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.d.ts +12 -0
- package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +24 -4
- package/dist/types/components/snk-data-exporter/interfaces/IExporterStrategy.d.ts +5 -0
- package/dist/types/components/snk-data-exporter/providers/ClientSideExporterProvider.d.ts +17 -0
- package/dist/types/components/snk-data-exporter/providers/ServerSideExporterProvider.d.ts +17 -0
- package/dist/types/components/snk-data-exporter/snk-data-exporter.d.ts +4 -1
- package/dist/types/components/snk-data-exporter/structure/ItemBuilder.d.ts +21 -0
- package/dist/types/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.d.ts +77 -0
- package/dist/types/components/snk-data-exporter/utils/ParserExport.d.ts +4 -0
- package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +3 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +66 -2
- package/dist/types/components/snk-data-unit/test/resources/metadataMock.d.ts +3 -0
- package/dist/types/components/snk-data-unit/test/resources/parentMetadataMock.d.ts +3 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
- package/dist/types/components/snk-form/snk-form.d.ts +14 -0
- package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +2 -2
- package/dist/types/components/snk-grid/snk-grid.d.ts +46 -6
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +62 -4
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +1 -1
- package/dist/types/components.d.ts +261 -4
- package/dist/types/lib/@types/index.d.ts +5 -0
- package/dist/types/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.d.ts +11 -0
- package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +2 -1
- package/dist/types/lib/dataUnit/ValueFormatter.d.ts +2 -0
- package/dist/types/lib/dataUnit/interfaces/InMemoryLoaderConfig.d.ts +3 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.d.ts +2 -1
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.d.ts +10 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.d.ts +7 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +6 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.d.ts +20 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.d.ts +3 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.d.ts +2 -1
- package/dist/types/lib/http/data-fetcher/fetchers/pesquisa-fetcher.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/snk-data-unit-41c29713.js +0 -462
- package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/index.js +0 -34
- package/dist/components/index3.js +0 -199
- package/dist/esm/snk-data-unit-de1d140d.js +0 -460
- package/dist/sankhyablocks/p-032fe52e.js +0 -1
- package/dist/sankhyablocks/p-03dcc5ff.entry.js +0 -1
- package/dist/sankhyablocks/p-0594db5a.entry.js +0 -1
- package/dist/sankhyablocks/p-06e13db2.js +0 -1
- package/dist/sankhyablocks/p-07a61550.entry.js +0 -1
- package/dist/sankhyablocks/p-1403a4b6.entry.js +0 -1
- package/dist/sankhyablocks/p-14a08904.entry.js +0 -1
- package/dist/sankhyablocks/p-15802c59.entry.js +0 -1
- package/dist/sankhyablocks/p-235dc7b1.js +0 -65
- package/dist/sankhyablocks/p-32556aa6.js +0 -1
- package/dist/sankhyablocks/p-38289a55.js +0 -1
- package/dist/sankhyablocks/p-3c632d48.js +0 -1
- package/dist/sankhyablocks/p-3f833983.entry.js +0 -1
- package/dist/sankhyablocks/p-52c8e589.js +0 -1
- package/dist/sankhyablocks/p-5e1502b6.entry.js +0 -11
- package/dist/sankhyablocks/p-74d349c3.entry.js +0 -1
- package/dist/sankhyablocks/p-93167e28.entry.js +0 -1
- package/dist/sankhyablocks/p-add17f6a.entry.js +0 -1
- package/dist/sankhyablocks/p-bd47dd16.entry.js +0 -1
- package/dist/sankhyablocks/p-c1f88236.entry.js +0 -1
- package/dist/sankhyablocks/p-ccdd5332.entry.js +0 -1
- package/dist/sankhyablocks/p-ee9536bc.entry.js +0 -1
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/index.d.ts +0 -3
@@ -3,17 +3,18 @@ import { Action, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { S as SnkFormConfigManager } from './SnkFormConfigManager.js';
|
4
4
|
import { buildFormMetadata, FormMetadata } from '@sankhyalabs/ezui/dist/collection/utils/form';
|
5
5
|
import './DataFetcher.js';
|
6
|
-
import './
|
7
|
-
import { P as PresentationMode } from './
|
8
|
-
import { d as defineCustomElement$u } from './snk-actions-button2.js';
|
6
|
+
import './pesquisa-fetcher.js';
|
7
|
+
import { P as PresentationMode } from './ISave.js';
|
9
8
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
10
9
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
10
|
+
import './dataunit-fetcher.js';
|
11
11
|
import './filter-item-type.enum.js';
|
12
12
|
import './form-config-fetcher.js';
|
13
13
|
import { T as TaskbarElement, d as defineCustomElement$3 } from './snk-taskbar2.js';
|
14
14
|
import { V as VIEW_MODE } from './constants.js';
|
15
|
-
import { o as openFieldSearch, T as TaskbarProcessor, b as buildFieldSearch } from './
|
15
|
+
import { o as openFieldSearch, T as TaskbarProcessor, b as buildFieldSearch } from './IExporterProvider.js';
|
16
16
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
17
|
+
import { d as defineCustomElement$u } from './snk-actions-button2.js';
|
17
18
|
import { d as defineCustomElement$t } from './snk-attach2.js';
|
18
19
|
import { d as defineCustomElement$s } from './snk-config-options2.js';
|
19
20
|
import { d as defineCustomElement$r } from './snk-configurator2.js';
|
@@ -69,12 +70,16 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
69
70
|
this.resourceID = undefined;
|
70
71
|
this.detailTaskbarCustomContainerId = undefined;
|
71
72
|
this.formLegacyConfigName = undefined;
|
73
|
+
this.getCustomTitle = undefined;
|
72
74
|
this._hasToCreateFieldSearch = true;
|
73
75
|
this._breadcrumbItems = [];
|
74
76
|
this._guides = undefined;
|
75
77
|
this._formEditorConfigManager = undefined;
|
76
78
|
this._formEditorDataUnit = undefined;
|
77
79
|
this._fieldToGetFocus = undefined;
|
80
|
+
this._customEditors = undefined;
|
81
|
+
this._customRenders = undefined;
|
82
|
+
this._fieldsProps = {};
|
78
83
|
}
|
79
84
|
observeDataUnit() {
|
80
85
|
this.loadGuides(true);
|
@@ -105,6 +110,28 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
105
110
|
async findField() {
|
106
111
|
await openFieldSearch(this._moreOptions, this._fieldSearch);
|
107
112
|
}
|
113
|
+
/**
|
114
|
+
* Registra um editor customizado para campos da grade e formulário
|
115
|
+
*/
|
116
|
+
async addCustomEditor(fieldName, customEditor) {
|
117
|
+
this._customEditors = Object.assign(Object.assign({}, this._customEditors), { [fieldName]: customEditor });
|
118
|
+
}
|
119
|
+
/**
|
120
|
+
* Registra um render customizado para colunas da grid.
|
121
|
+
*/
|
122
|
+
async addGridCustomRender(fieldName, customRender) {
|
123
|
+
this._customRenders = Object.assign(Object.assign({}, this._customRenders), { [fieldName]: customRender });
|
124
|
+
}
|
125
|
+
;
|
126
|
+
/**
|
127
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
128
|
+
*/
|
129
|
+
async setFieldProp(fieldName, propName, value) {
|
130
|
+
const newFieldsProps = {
|
131
|
+
[fieldName]: Object.assign(Object.assign({}, this._fieldsProps[fieldName]), { [propName]: value })
|
132
|
+
};
|
133
|
+
this._fieldsProps = Object.assign(Object.assign({}, this._fieldsProps), newFieldsProps);
|
134
|
+
}
|
108
135
|
/**
|
109
136
|
* Atribui o foco para o componente.
|
110
137
|
*/
|
@@ -130,7 +157,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
130
157
|
}
|
131
158
|
onContentCardChanged(evt) {
|
132
159
|
SnkGuidesViewer.updateContentCard(evt.detail.formName, evt.detail.cardConfig, evt.detail.propertyChanged, this._configManager)
|
133
|
-
.then(() => this.masterFormConfig = this._configManager.getConfig(this.
|
160
|
+
.then(() => this.masterFormConfig = this._configManager.getConfig(this.dataUnit));
|
134
161
|
}
|
135
162
|
/**
|
136
163
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
@@ -253,7 +280,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
253
280
|
if (sheet == undefined) {
|
254
281
|
return;
|
255
282
|
}
|
256
|
-
return h("snk-form-view", { levelPath: params.levelPath, label: sheet.label, name: formName, fields: sheet.fields, formMetadata: params.formMetadata, dataUnit: params.dataUnit, recordsValidator: params.recordsValidator, contracted: (cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.presentation) === "CONTRACTED", fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_b = (_a = params.formConfig) === null || _a === void 0 ? void 0 : _a.summary) === null || _b === void 0 ? void 0 : _b.get(formName), fieldToFocus: params.fieldToFocus, key: formName, onSnkRequestClearFieldToFocus: _ => { var _a; return (_a = params.onRequestClearFieldToFocus) === null || _a === void 0 ? void 0 : _a.call(params); } });
|
283
|
+
return h("snk-form-view", { levelPath: params.levelPath, label: sheet.label, name: formName, fields: sheet.fields, formMetadata: params.formMetadata, dataUnit: params.dataUnit, recordsValidator: params.recordsValidator, contracted: (cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.presentation) === "CONTRACTED", fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_b = (_a = params.formConfig) === null || _a === void 0 ? void 0 : _a.summary) === null || _b === void 0 ? void 0 : _b.get(formName), fieldToFocus: params.fieldToFocus, key: formName, onSnkRequestClearFieldToFocus: _ => { var _a; return (_a = params.onRequestClearFieldToFocus) === null || _a === void 0 ? void 0 : _a.call(params); }, customEditors: params.propsCustomEditor, fieldsProps: params.fieldsProps });
|
257
284
|
})));
|
258
285
|
}
|
259
286
|
wrapDetail(levels, content) {
|
@@ -295,14 +322,14 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
295
322
|
else {
|
296
323
|
detailBranch = this.selectedGuide;
|
297
324
|
}
|
298
|
-
content = this.wrapDetail(levels, h("snk-detail-view", { ref: (ref) => this._currentDetail = ref, dataUnitName: this.getDataUnitName(levels, childEntityName), onSnkDetailGuidesChange: (evt) => this.updateGuide(evt.detail), entityName: childEntityName, selectedForm: formName, branchGuide: detailBranch, guideItemPath: this._breadcrumbItems, key: `detail${detailId}`, canEdit: this.canEdit, onSnkSwitchGuide: evt => this._guideNavigator.selectGuide(evt.detail), resourceID: this.resourceID, taskbarCustomContainerId: this.detailTaskbarCustomContainerId }));
|
325
|
+
content = this.wrapDetail(levels, h("snk-detail-view", { ref: (ref) => this._currentDetail = ref, dataUnitName: this.getDataUnitName(levels, childEntityName), onSnkDetailGuidesChange: (evt) => this.updateGuide(evt.detail), entityName: childEntityName, selectedForm: formName, branchGuide: detailBranch, guideItemPath: this._breadcrumbItems, key: `detail${detailId}`, canEdit: this.canEdit, onSnkSwitchGuide: evt => this._guideNavigator.selectGuide(evt.detail), resourceID: this.resourceID, taskbarCustomContainerId: this.detailTaskbarCustomContainerId, customEditors: this._customEditors, customRenders: this._customRenders }));
|
299
326
|
}
|
300
327
|
else {
|
301
328
|
const cardId = this.selectedGuide.id;
|
302
329
|
const sheet = this._masterFormMetadata.getSheet(cardId);
|
303
330
|
if (sheet) {
|
304
331
|
const cardConfig = (_c = (_b = this.masterFormConfig) === null || _b === void 0 ? void 0 : _b.cardsState) === null || _c === void 0 ? void 0 : _c.get(cardId);
|
305
|
-
content = h("snk-form-view", { ref: ref => this._mainForm = ref, fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_e = (_d = this.masterFormConfig) === null || _d === void 0 ? void 0 : _d.summary) === null || _e === void 0 ? void 0 : _e.get(cardId), name: cardId, label: sheet.label, fields: sheet.fields, dataUnit: this.dataUnit, formMetadata: this._masterFormMetadata, recordsValidator: this.recordsValidator, fieldToFocus: this._fieldToGetFocus, key: guideId, onSnkRequestClearFieldToFocus: _ => this.clearFieldToFocusHandler() }, this.presentationMode == PresentationMode.SECONDARY && this.buildTaskBar());
|
332
|
+
content = h("snk-form-view", { ref: ref => this._mainForm = ref, fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_e = (_d = this.masterFormConfig) === null || _d === void 0 ? void 0 : _d.summary) === null || _e === void 0 ? void 0 : _e.get(cardId), name: cardId, label: sheet.label, fields: sheet.fields, dataUnit: this.dataUnit, formMetadata: this._masterFormMetadata, recordsValidator: this.recordsValidator, fieldToFocus: this._fieldToGetFocus, key: guideId, onSnkRequestClearFieldToFocus: _ => this.clearFieldToFocusHandler(), customEditors: this._customEditors, fieldsProps: this._fieldsProps }, this.presentationMode == PresentationMode.SECONDARY && this.buildTaskBar());
|
306
333
|
}
|
307
334
|
}
|
308
335
|
return content;
|
@@ -481,6 +508,10 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
481
508
|
}
|
482
509
|
return "";
|
483
510
|
}
|
511
|
+
getTitle() {
|
512
|
+
var _a, _b;
|
513
|
+
return (_b = (_a = this.getCustomTitle) === null || _a === void 0 ? void 0 : _a.call(this)) !== null && _b !== void 0 ? _b : this.getMessage("snkCrud.title");
|
514
|
+
}
|
484
515
|
componentDidLoad() {
|
485
516
|
this.dataUnit.subscribe(this.dataUnitActionHandler.bind(this));
|
486
517
|
}
|
@@ -494,7 +525,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
494
525
|
}
|
495
526
|
this.loadTaskbarProcessor();
|
496
527
|
const showGuides = this._guides && (this._guides.length > 1);
|
497
|
-
return (h("section", { class: "snk-guides-viewer", ref: ref => this._container = ref, tabindex: -1 }, h("div", { class: "ez-row snk-guides-viewer__header" }, h("div", { class: "snk-guides-viewer__header-breadcrumb ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large", key: "header" }, h("ez-button", { onClick: () => this.exitViewer(), title: this.getMessage("snkCrud.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small" }), h("div", { class: "ez-flex ez-flex--column ez-flex-item--auto" }, h("h1", { class: "ez-title ez-title--primary ez-title--xlarge" }, this.
|
528
|
+
return (h("section", { class: "snk-guides-viewer", ref: ref => this._container = ref, tabindex: -1 }, h("div", { class: "ez-row snk-guides-viewer__header" }, h("div", { class: "snk-guides-viewer__header-breadcrumb ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large", key: "header" }, h("ez-button", { onClick: () => this.exitViewer(), title: this.getMessage("snkCrud.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small" }), h("div", { class: "ez-flex ez-flex--column ez-flex-item--auto" }, h("h1", { class: "ez-title ez-title--primary ez-title--xlarge" }, this.getTitle()), ((_a = this._breadcrumbItems) === null || _a === void 0 ? void 0 : _a.length) > 1 &&
|
498
529
|
h("div", { class: "ez-margin-top--extra-small" }, h("ez-breadcrumb", Object.assign({ items: this._breadcrumbItems, onSelectedItem: (evt) => this.onBreadcrumbClickHandler(evt === null || evt === void 0 ? void 0 : evt.detail) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("breadcrumb")}` }))))), this.presentationMode != PresentationMode.SECONDARY && this.buildTaskBar()), h("div", { class: "snk-guides-viewer__container" }, showGuides ?
|
499
530
|
h("ez-guide-navigator", { ref: (ref) => this._guideNavigator = ref, class: "snk-guides-viewer__guide-navigator", items: this._guides, selectedId: this.selectedGuide ? this.selectedGuide.id : undefined, onEzSelectionChange: evt => this.updateSelectedGuideHandler(evt.detail) })
|
500
531
|
:
|
@@ -505,7 +536,9 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
505
536
|
dataUnit: this.dataUnit,
|
506
537
|
recordsValidator: this.recordsValidator,
|
507
538
|
fieldToFocus: this._fieldToGetFocus,
|
508
|
-
onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this)
|
539
|
+
onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this),
|
540
|
+
propsCustomEditor: this._customEditors,
|
541
|
+
fieldsProps: this._fieldsProps
|
509
542
|
}), this.getContent())), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this.getConfigViewMode(), onConfigSelected: (evt) => this.changeConfigViewMode(evt.detail), messagesBuilder: this.messagesBuilder, onOpenConfig: (evt) => this.openConfig(evt.detail), resourceID: this.resourceID })));
|
510
543
|
}
|
511
544
|
static get watchers() { return {
|
@@ -530,14 +563,21 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
530
563
|
"resourceID": [1, "resource-i-d"],
|
531
564
|
"detailTaskbarCustomContainerId": [1, "detail-taskbar-custom-container-id"],
|
532
565
|
"formLegacyConfigName": [1, "form-legacy-config-name"],
|
566
|
+
"getCustomTitle": [16],
|
533
567
|
"_hasToCreateFieldSearch": [32],
|
534
568
|
"_breadcrumbItems": [32],
|
535
569
|
"_guides": [32],
|
536
570
|
"_formEditorConfigManager": [32],
|
537
571
|
"_formEditorDataUnit": [32],
|
538
572
|
"_fieldToGetFocus": [32],
|
573
|
+
"_customEditors": [32],
|
574
|
+
"_customRenders": [32],
|
575
|
+
"_fieldsProps": [32],
|
539
576
|
"showFormConfig": [64],
|
540
577
|
"findField": [64],
|
578
|
+
"addCustomEditor": [64],
|
579
|
+
"addGridCustomRender": [64],
|
580
|
+
"setFieldProp": [64],
|
541
581
|
"setFocus": [64]
|
542
582
|
}, [[2, "actionClick", "onActionClick"], [0, "snkContentCardChanged", "onContentCardChanged"]]]);
|
543
583
|
function defineCustomElement$1() {
|
@@ -772,6 +812,8 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
772
812
|
this.branchGuide = undefined;
|
773
813
|
this.canEdit = true;
|
774
814
|
this.taskbarCustomContainerId = undefined;
|
815
|
+
this.customEditors = undefined;
|
816
|
+
this.customRenders = undefined;
|
775
817
|
}
|
776
818
|
observeDataUnit(newDataUnit, oldDataUnit) {
|
777
819
|
newDataUnit === null || newDataUnit === void 0 ? void 0 : newDataUnit.subscribe(this.dataUnitActionHandler.bind(this));
|
@@ -839,10 +881,38 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
839
881
|
this._snkGrid.scrollIntoView({ behavior: "smooth", block: "start" });
|
840
882
|
}
|
841
883
|
}
|
884
|
+
/**
|
885
|
+
* Registra um editor customizado para campos da grade e formulário.
|
886
|
+
*/
|
887
|
+
async addCustomEditor(fieldName, customEditor) {
|
888
|
+
var _a;
|
889
|
+
const detailContext = this.normalizeBranchGuideId((_a = this.branchGuide) === null || _a === void 0 ? void 0 : _a.id);
|
890
|
+
this._snkGrid.addCustomEditor(fieldName, customEditor, detailContext);
|
891
|
+
this._snkFormView.addCustomEditor(fieldName, customEditor, detailContext);
|
892
|
+
}
|
893
|
+
async observerPropsCustomEditor(newValue) {
|
894
|
+
for (const fieldName in newValue) {
|
895
|
+
await this.addCustomEditor(fieldName, newValue[fieldName]);
|
896
|
+
}
|
897
|
+
}
|
898
|
+
/**
|
899
|
+
* Registra um render customizado para colunas da grid.
|
900
|
+
*/
|
901
|
+
async addGridCustomRender(fieldName, customRender) {
|
902
|
+
var _a;
|
903
|
+
const detailContext = this.normalizeBranchGuideId((_a = this.branchGuide) === null || _a === void 0 ? void 0 : _a.id);
|
904
|
+
await this._snkGrid.addGridCustomRender(fieldName, customRender, detailContext);
|
905
|
+
}
|
842
906
|
onContentCardChanged(evt) {
|
843
907
|
SnkGuidesViewer.updateContentCard(evt.detail.formName, evt.detail.cardConfig, evt.detail.propertyChanged, this.formConfigManager).then(() => forceUpdate(this));
|
844
908
|
evt.stopPropagation();
|
845
909
|
}
|
910
|
+
async observeCustomRenders(newValue) {
|
911
|
+
for (const field in newValue) {
|
912
|
+
const customRender = newValue[field];
|
913
|
+
await this.addGridCustomRender(field, customRender);
|
914
|
+
}
|
915
|
+
}
|
846
916
|
updateLabel() {
|
847
917
|
const guideItemPathSize = this.guideItemPath ? this.guideItemPath.length : 0;
|
848
918
|
if (guideItemPathSize > 0) {
|
@@ -874,14 +944,13 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
874
944
|
return guideId.replace(SnkDetailView.REGEX_FORM_ID, "");
|
875
945
|
}
|
876
946
|
loadMetadata() {
|
877
|
-
var _a;
|
878
947
|
if (!this.dataUnit) {
|
879
948
|
return;
|
880
949
|
}
|
881
950
|
if (!this.formConfigManager.isLoaded) {
|
882
951
|
return;
|
883
952
|
}
|
884
|
-
const formConfig = this.formConfigManager.getConfig(
|
953
|
+
const formConfig = this.formConfigManager.getConfig(this.dataUnit);
|
885
954
|
//this._cardsState = formConfig?.cardsState;
|
886
955
|
this._formMetadata = buildFormMetadata(formConfig == undefined || formConfig.fields.length === 0 ? undefined : formConfig, this.dataUnit, true);
|
887
956
|
}
|
@@ -945,6 +1014,10 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
945
1014
|
this.messagesBuilder = new SnkMessageBuilder(this.entityName);
|
946
1015
|
}
|
947
1016
|
}
|
1017
|
+
async componentDidLoad() {
|
1018
|
+
await this.observerPropsCustomEditor(this.customEditors);
|
1019
|
+
await this.observeCustomRenders(this.customRenders);
|
1020
|
+
}
|
948
1021
|
async dataUnitActionHandler(action) {
|
949
1022
|
if (action.type === Action.FIELD_INVALIDATED) {
|
950
1023
|
this.addErrorBadgeToBranchGuide();
|
@@ -954,6 +1027,9 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
954
1027
|
this.branchGuide = Object.assign(Object.assign({}, this.branchGuide), { badge: 'error' });
|
955
1028
|
this.snkDetailGuidesChange.emit(new GuideBuilder(this.branchGuide, this._formMetadata, this.dataUnit));
|
956
1029
|
}
|
1030
|
+
normalizeBranchGuideId(id) {
|
1031
|
+
return id === null || id === void 0 ? void 0 : id.replace(/child\[(.*?)\]/g, '$1').replace(/::/g, '>');
|
1032
|
+
}
|
957
1033
|
render() {
|
958
1034
|
this.updateLabel();
|
959
1035
|
//const cardConfig: IFormCardConfig = this._cardsState?.get(this.selectedForm);
|
@@ -961,7 +1037,9 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
961
1037
|
}
|
962
1038
|
static get watchers() { return {
|
963
1039
|
"dataUnit": ["observeDataUnit"],
|
964
|
-
"dataState": ["observerDataState"]
|
1040
|
+
"dataState": ["observerDataState"],
|
1041
|
+
"customEditors": ["observerPropsCustomEditor"],
|
1042
|
+
"customRenders": ["observeCustomRenders"]
|
965
1043
|
}; }
|
966
1044
|
static get style() { return snkDetailViewCss; }
|
967
1045
|
}, [6, "snk-detail-view", {
|
@@ -978,12 +1056,16 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
978
1056
|
"branchGuide": [1040],
|
979
1057
|
"canEdit": [4, "can-edit"],
|
980
1058
|
"taskbarCustomContainerId": [1, "taskbar-custom-container-id"],
|
1059
|
+
"customEditors": [16],
|
1060
|
+
"customRenders": [16],
|
981
1061
|
"_disabledButtons": [32],
|
982
1062
|
"_currentView": [32],
|
983
1063
|
"attachmentRegisterKey": [32],
|
984
1064
|
"changeViewMode": [64],
|
985
1065
|
"configGrid": [64],
|
986
|
-
"showUp": [64]
|
1066
|
+
"showUp": [64],
|
1067
|
+
"addCustomEditor": [64],
|
1068
|
+
"addGridCustomRender": [64]
|
987
1069
|
}, [[0, "snkContentCardChanged", "onContentCardChanged"]]]);
|
988
1070
|
SnkDetailView.REGEX_FORM_ID = /__FORM:[^:]+/g;
|
989
1071
|
function defineCustomElement() {
|
@@ -4,7 +4,7 @@ import { a as SelectedItemType, d as defineCustomElement$2 } from './snk-filter-
|
|
4
4
|
import { ApplicationUtils, CheckMode } from '@sankhyalabs/ezui/dist/collection/utils';
|
5
5
|
import { fieldBuilder } from '@sankhyalabs/ezui/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder';
|
6
6
|
import { a as FilterOperand } from './PersonalizedFilterUtils.js';
|
7
|
-
import { s as store } from './
|
7
|
+
import { s as store } from './index2.js';
|
8
8
|
import { convertType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
|
9
9
|
import { d as defineCustomElement$1 } from './snk-filter-param-config2.js';
|
10
10
|
|
@@ -288,6 +288,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
288
288
|
this.messagesBuilder = undefined;
|
289
289
|
this.disablePersonalizedFilter = undefined;
|
290
290
|
this.filterBarLegacyConfigName = undefined;
|
291
|
+
this.autoLoad = undefined;
|
291
292
|
this.allowDefault = undefined;
|
292
293
|
this.scrollerLocked = false;
|
293
294
|
this.showPersonalizedFilter = false;
|
@@ -434,7 +435,10 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
434
435
|
}
|
435
436
|
async doLoadData(forceReload = false) {
|
436
437
|
try {
|
437
|
-
if (this._firstLoad &&
|
438
|
+
if (this._firstLoad && this.autoLoad === false) {
|
439
|
+
return;
|
440
|
+
}
|
441
|
+
if (this._firstLoad && !forceReload && this.autoLoad === undefined) {
|
438
442
|
let autoLoad = await this._application.getBooleanParam("global.carregar.registros.iniciar.tela");
|
439
443
|
if (!autoLoad) {
|
440
444
|
return;
|
@@ -717,6 +721,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
717
721
|
"messagesBuilder": [1040],
|
718
722
|
"disablePersonalizedFilter": [4, "disable-personalized-filter"],
|
719
723
|
"filterBarLegacyConfigName": [1, "filter-bar-legacy-config-name"],
|
724
|
+
"autoLoad": [4, "auto-load"],
|
720
725
|
"allowDefault": [32],
|
721
726
|
"scrollerLocked": [32],
|
722
727
|
"showPersonalizedFilter": [32],
|
@@ -76,7 +76,7 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
76
76
|
}
|
77
77
|
}
|
78
78
|
getConfig() {
|
79
|
-
let config = this.configManager.getConfig(
|
79
|
+
let config = this.configManager.getConfig(this.dataUnit);
|
80
80
|
if (config.fields && config.fields.length === 0) {
|
81
81
|
config = undefined;
|
82
82
|
}
|
@@ -12,6 +12,8 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
12
12
|
this.snkContentCardChanged = createEvent(this, "snkContentCardChanged", 7);
|
13
13
|
this.snkRequestClearFieldToFocus = createEvent(this, "snkRequestClearFieldToFocus", 7);
|
14
14
|
this.formItemsReady = createEvent(this, "formItemsReady", 7);
|
15
|
+
this._customEditors = new Map();
|
16
|
+
this._fieldProps = new Map();
|
15
17
|
this.levelPath = undefined;
|
16
18
|
this.label = undefined;
|
17
19
|
this.name = undefined;
|
@@ -25,12 +27,47 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
25
27
|
this.canFix = true;
|
26
28
|
this.recordsValidator = undefined;
|
27
29
|
this.fieldToFocus = undefined;
|
30
|
+
this.customEditors = undefined;
|
31
|
+
this.fieldsProps = undefined;
|
28
32
|
}
|
29
33
|
async showUp() {
|
30
34
|
if (this._formView) {
|
31
35
|
this._formView.showUp();
|
32
36
|
}
|
33
37
|
}
|
38
|
+
/**
|
39
|
+
* Registra um editor customizado para campos da grade e formulário
|
40
|
+
*/
|
41
|
+
async addCustomEditor(fieldName, customEditor, detailContext) {
|
42
|
+
if (this._formView) {
|
43
|
+
this._formView.addCustomEditor(fieldName, customEditor, detailContext);
|
44
|
+
return;
|
45
|
+
}
|
46
|
+
const newCustomEditors = new Map(this._customEditors);
|
47
|
+
newCustomEditors.set(fieldName, { customEditor, detailContext });
|
48
|
+
this._customEditors = newCustomEditors;
|
49
|
+
}
|
50
|
+
observePropsCustomEditor(newValue) {
|
51
|
+
for (const fieldName in newValue) {
|
52
|
+
this.addCustomEditor(fieldName, newValue[fieldName]);
|
53
|
+
}
|
54
|
+
}
|
55
|
+
/**
|
56
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
57
|
+
*/
|
58
|
+
async setFieldProp(fieldName, propName, value) {
|
59
|
+
const props = this._fieldProps.get(fieldName) || [];
|
60
|
+
this._fieldProps.set(fieldName, [...props, { propName, value }]);
|
61
|
+
}
|
62
|
+
async observeFieldsProps(newValue) {
|
63
|
+
for (const field in newValue) {
|
64
|
+
const fieldProps = newValue[field];
|
65
|
+
const propNames = Object.keys(fieldProps);
|
66
|
+
for (const propName of propNames) {
|
67
|
+
await this.setFieldProp(field, propName, fieldProps[propName]);
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
34
71
|
changeFix() {
|
35
72
|
this.fixed = !this.fixed;
|
36
73
|
this.emitEvent("fixed");
|
@@ -89,7 +126,13 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
89
126
|
this._dataBinder.onDisconnectedCallback();
|
90
127
|
}
|
91
128
|
}
|
129
|
+
componentDidLoad() {
|
130
|
+
this.observePropsCustomEditor(this.customEditors);
|
131
|
+
this.observeFieldsProps(this.fieldsProps);
|
132
|
+
}
|
92
133
|
componentDidRender() {
|
134
|
+
this.setCustomEditors();
|
135
|
+
this.setFieldProps();
|
93
136
|
if (this.fieldToFocus == undefined) {
|
94
137
|
return;
|
95
138
|
}
|
@@ -101,6 +144,26 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
101
144
|
this.snkRequestClearFieldToFocus.emit();
|
102
145
|
});
|
103
146
|
}
|
147
|
+
setCustomEditors() {
|
148
|
+
if (!this._formView) {
|
149
|
+
return;
|
150
|
+
}
|
151
|
+
for (const [fieldName, customEditorProps] of this._customEditors) {
|
152
|
+
this._formView.addCustomEditor(fieldName, customEditorProps.customEditor, customEditorProps.detailContext);
|
153
|
+
this._customEditors.delete(fieldName);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
setFieldProps() {
|
157
|
+
if (!this._formView) {
|
158
|
+
return;
|
159
|
+
}
|
160
|
+
for (const [fieldName, propsToChange] of this._fieldProps) {
|
161
|
+
propsToChange.forEach(prop => {
|
162
|
+
this._formView.setFieldProp(fieldName, prop.propName, prop.value);
|
163
|
+
this._fieldProps.delete(fieldName);
|
164
|
+
});
|
165
|
+
}
|
166
|
+
}
|
104
167
|
render() {
|
105
168
|
return (h(Host, { class: "ez-box__container" }, h("div", { class: "summary-header ez-flex ez-size-width--full" }, h("div", { class: "ez-flex ez-text ez-title--primary ez-text--bold ez-flex--justify-start ez-flex--align-items-center ez-col--sd-9" }, this.levelPath ? h("span", { class: "level-path" }, this.levelPath + " /") : undefined, this.label), h("div", { class: "ez-flex ez-flex--justify-end ez-col--sd-3" }, this.canFix &&
|
106
169
|
h("ez-button", { class: "ez-padding-left--medium", mode: "icon", size: "small", iconName: this.fixed ? "un-pin" : "push-pin", "data-element-id": ElementIDUtils.getInternalIDInfo("toggleFixed_ezFormCard"), onClick: () => this.changeFix(), title: this.fixed ? "Desafixar" : "Fixar" }), this.canExpand &&
|
@@ -110,6 +173,10 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
110
173
|
:
|
111
174
|
h("ez-form-view", { ref: ref => this._formView = ref, fields: this.fields, onEzContentReady: evt => this.bindFields(evt.detail), onFormItemsReady: (event) => this.handleFormItemsReady(event) })));
|
112
175
|
}
|
176
|
+
static get watchers() { return {
|
177
|
+
"customEditors": ["observePropsCustomEditor"],
|
178
|
+
"fieldsProps": ["observeFieldsProps"]
|
179
|
+
}; }
|
113
180
|
static get style() { return snkFormViewCss; }
|
114
181
|
}, [6, "snk-form-view", {
|
115
182
|
"levelPath": [1, "level-path"],
|
@@ -125,7 +192,11 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
125
192
|
"canFix": [4, "can-fix"],
|
126
193
|
"recordsValidator": [16],
|
127
194
|
"fieldToFocus": [1, "field-to-focus"],
|
128
|
-
"
|
195
|
+
"customEditors": [16],
|
196
|
+
"fieldsProps": [16],
|
197
|
+
"showUp": [64],
|
198
|
+
"addCustomEditor": [64],
|
199
|
+
"setFieldProp": [64]
|
129
200
|
}]);
|
130
201
|
function defineCustomElement() {
|
131
202
|
if (typeof customElements === "undefined") {
|
@@ -16,6 +16,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
16
16
|
this.exit = createEvent(this, "exit", 7);
|
17
17
|
this.actionClick = createEvent(this, "actionClick", 7);
|
18
18
|
this.formItemsReady = createEvent(this, "formItemsReady", 7);
|
19
|
+
this._customEditors = new Map();
|
19
20
|
this._dataUnit = undefined;
|
20
21
|
this._dataState = undefined;
|
21
22
|
this._showFormConfig = false;
|
@@ -38,6 +39,24 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
38
39
|
async hideConfig() {
|
39
40
|
this._showFormConfig = false;
|
40
41
|
}
|
42
|
+
/**
|
43
|
+
* Registra um editor customizado para campos da grade e formulário.
|
44
|
+
*/
|
45
|
+
async addCustomEditor(fieldName, customEditor) {
|
46
|
+
if (this._form) {
|
47
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
48
|
+
return;
|
49
|
+
}
|
50
|
+
const newCustomEditors = new Map(this._customEditors);
|
51
|
+
newCustomEditors.set(fieldName, customEditor);
|
52
|
+
this._customEditors = newCustomEditors;
|
53
|
+
}
|
54
|
+
/**
|
55
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
56
|
+
*/
|
57
|
+
async setFieldProp(fieldName, propName, value) {
|
58
|
+
await this._form.setFieldProp(fieldName, propName, value);
|
59
|
+
}
|
41
60
|
closeConfig() {
|
42
61
|
this.hideConfig();
|
43
62
|
}
|
@@ -45,6 +64,18 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
45
64
|
const dataInfo = { dataUnit: this._dataUnit };
|
46
65
|
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
47
66
|
}
|
67
|
+
setCustomEditors() {
|
68
|
+
if (!this._form) {
|
69
|
+
return;
|
70
|
+
}
|
71
|
+
for (const [fieldName, customEditor] of this._customEditors) {
|
72
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
73
|
+
this._customEditors.delete(fieldName);
|
74
|
+
}
|
75
|
+
}
|
76
|
+
async componentDidRender() {
|
77
|
+
this.setCustomEditors();
|
78
|
+
}
|
48
79
|
async componentWillLoad() {
|
49
80
|
let parent = this._element.parentElement;
|
50
81
|
while (parent) {
|
@@ -60,9 +91,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
60
91
|
this._dataUnit = evt.detail;
|
61
92
|
});
|
62
93
|
}
|
63
|
-
this._snkDataUnit.addEventListener("dataStateChange", (
|
64
|
-
this._dataState = evt.detail;
|
65
|
-
});
|
94
|
+
this._snkDataUnit.addEventListener("dataStateChange", this.handleDataStateChange.bind(this));
|
66
95
|
break;
|
67
96
|
}
|
68
97
|
parent = parent.parentElement;
|
@@ -72,7 +101,23 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
72
101
|
}
|
73
102
|
this._configManager = new SnkFormConfigManager(this.configName, this.resourceID);
|
74
103
|
this.addFormLegacyConfig();
|
75
|
-
this._configManager.loadConfig();
|
104
|
+
await this._configManager.loadConfig();
|
105
|
+
}
|
106
|
+
async handleDataStateChange(evt) {
|
107
|
+
var _a;
|
108
|
+
this._dataState = evt.detail;
|
109
|
+
const fieldsWithRmPrecision = await this._snkDataUnit.getFieldsWithRmPrecision();
|
110
|
+
for (const field of fieldsWithRmPrecision || []) {
|
111
|
+
if (!field) {
|
112
|
+
continue;
|
113
|
+
}
|
114
|
+
const rmPrecision = (_a = this._dataState.rowMetadata) === null || _a === void 0 ? void 0 : _a.getProp('rm_precision', field);
|
115
|
+
if (!rmPrecision && rmPrecision !== 0) {
|
116
|
+
continue;
|
117
|
+
}
|
118
|
+
await this.setFieldProp(field, 'precision', rmPrecision);
|
119
|
+
await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
|
120
|
+
}
|
76
121
|
}
|
77
122
|
addFormLegacyConfig() {
|
78
123
|
if (this.formLegacyConfigName) {
|
@@ -83,7 +128,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
83
128
|
if (!this._dataUnit || !this._dataState) {
|
84
129
|
return undefined;
|
85
130
|
}
|
86
|
-
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 &&
|
131
|
+
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 &&
|
87
132
|
h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this._dataUnit, configManager: this._configManager, onConfigClose: () => this.closeConfig() })))));
|
88
133
|
}
|
89
134
|
get _element() { return this; }
|
@@ -99,7 +144,9 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
99
144
|
"_showFormConfig": [32],
|
100
145
|
"_configManager": [32],
|
101
146
|
"showConfig": [64],
|
102
|
-
"hideConfig": [64]
|
147
|
+
"hideConfig": [64],
|
148
|
+
"addCustomEditor": [64],
|
149
|
+
"setFieldProp": [64]
|
103
150
|
}]);
|
104
151
|
function defineCustomElement$1() {
|
105
152
|
if (typeof customElements === "undefined") {
|