@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
@@ -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';
|
@@ -75,6 +76,9 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
75
76
|
this._formEditorConfigManager = undefined;
|
76
77
|
this._formEditorDataUnit = undefined;
|
77
78
|
this._fieldToGetFocus = undefined;
|
79
|
+
this._customEditors = undefined;
|
80
|
+
this._customRenders = undefined;
|
81
|
+
this._fieldsProps = {};
|
78
82
|
}
|
79
83
|
observeDataUnit() {
|
80
84
|
this.loadGuides(true);
|
@@ -105,6 +109,28 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
105
109
|
async findField() {
|
106
110
|
await openFieldSearch(this._moreOptions, this._fieldSearch);
|
107
111
|
}
|
112
|
+
/**
|
113
|
+
* Registra um editor customizado para campos da grade e formulário
|
114
|
+
*/
|
115
|
+
async addCustomEditor(fieldName, customEditor) {
|
116
|
+
this._customEditors = Object.assign(Object.assign({}, this._customEditors), { [fieldName]: customEditor });
|
117
|
+
}
|
118
|
+
/**
|
119
|
+
* Registra um render customizado para colunas da grid.
|
120
|
+
*/
|
121
|
+
async addGridCustomRender(fieldName, customRender) {
|
122
|
+
this._customRenders = Object.assign(Object.assign({}, this._customRenders), { [fieldName]: customRender });
|
123
|
+
}
|
124
|
+
;
|
125
|
+
/**
|
126
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
127
|
+
*/
|
128
|
+
async setFieldProp(fieldName, propName, value) {
|
129
|
+
const newFieldsProps = {
|
130
|
+
[fieldName]: Object.assign(Object.assign({}, this._fieldsProps[fieldName]), { [propName]: value })
|
131
|
+
};
|
132
|
+
this._fieldsProps = Object.assign(Object.assign({}, this._fieldsProps), newFieldsProps);
|
133
|
+
}
|
108
134
|
/**
|
109
135
|
* Atribui o foco para o componente.
|
110
136
|
*/
|
@@ -253,7 +279,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
253
279
|
if (sheet == undefined) {
|
254
280
|
return;
|
255
281
|
}
|
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); } });
|
282
|
+
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
283
|
})));
|
258
284
|
}
|
259
285
|
wrapDetail(levels, content) {
|
@@ -295,14 +321,14 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
295
321
|
else {
|
296
322
|
detailBranch = this.selectedGuide;
|
297
323
|
}
|
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 }));
|
324
|
+
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
325
|
}
|
300
326
|
else {
|
301
327
|
const cardId = this.selectedGuide.id;
|
302
328
|
const sheet = this._masterFormMetadata.getSheet(cardId);
|
303
329
|
if (sheet) {
|
304
330
|
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());
|
331
|
+
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
332
|
}
|
307
333
|
}
|
308
334
|
return content;
|
@@ -505,7 +531,9 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
505
531
|
dataUnit: this.dataUnit,
|
506
532
|
recordsValidator: this.recordsValidator,
|
507
533
|
fieldToFocus: this._fieldToGetFocus,
|
508
|
-
onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this)
|
534
|
+
onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this),
|
535
|
+
propsCustomEditor: this._customEditors,
|
536
|
+
fieldsProps: this._fieldsProps
|
509
537
|
}), 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
538
|
}
|
511
539
|
static get watchers() { return {
|
@@ -536,8 +564,14 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
536
564
|
"_formEditorConfigManager": [32],
|
537
565
|
"_formEditorDataUnit": [32],
|
538
566
|
"_fieldToGetFocus": [32],
|
567
|
+
"_customEditors": [32],
|
568
|
+
"_customRenders": [32],
|
569
|
+
"_fieldsProps": [32],
|
539
570
|
"showFormConfig": [64],
|
540
571
|
"findField": [64],
|
572
|
+
"addCustomEditor": [64],
|
573
|
+
"addGridCustomRender": [64],
|
574
|
+
"setFieldProp": [64],
|
541
575
|
"setFocus": [64]
|
542
576
|
}, [[2, "actionClick", "onActionClick"], [0, "snkContentCardChanged", "onContentCardChanged"]]]);
|
543
577
|
function defineCustomElement$1() {
|
@@ -772,6 +806,8 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
772
806
|
this.branchGuide = undefined;
|
773
807
|
this.canEdit = true;
|
774
808
|
this.taskbarCustomContainerId = undefined;
|
809
|
+
this.customEditors = undefined;
|
810
|
+
this.customRenders = undefined;
|
775
811
|
}
|
776
812
|
observeDataUnit(newDataUnit, oldDataUnit) {
|
777
813
|
newDataUnit === null || newDataUnit === void 0 ? void 0 : newDataUnit.subscribe(this.dataUnitActionHandler.bind(this));
|
@@ -839,10 +875,38 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
839
875
|
this._snkGrid.scrollIntoView({ behavior: "smooth", block: "start" });
|
840
876
|
}
|
841
877
|
}
|
878
|
+
/**
|
879
|
+
* Registra um editor customizado para campos da grade e formulário.
|
880
|
+
*/
|
881
|
+
async addCustomEditor(fieldName, customEditor) {
|
882
|
+
var _a;
|
883
|
+
const detailContext = this.normalizeBranchGuideId((_a = this.branchGuide) === null || _a === void 0 ? void 0 : _a.id);
|
884
|
+
this._snkGrid.addCustomEditor(fieldName, customEditor, detailContext);
|
885
|
+
this._snkFormView.addCustomEditor(fieldName, customEditor, detailContext);
|
886
|
+
}
|
887
|
+
async observerPropsCustomEditor(newValue) {
|
888
|
+
for (const fieldName in newValue) {
|
889
|
+
await this.addCustomEditor(fieldName, newValue[fieldName]);
|
890
|
+
}
|
891
|
+
}
|
892
|
+
/**
|
893
|
+
* Registra um render customizado para colunas da grid.
|
894
|
+
*/
|
895
|
+
async addGridCustomRender(fieldName, customRender) {
|
896
|
+
var _a;
|
897
|
+
const detailContext = this.normalizeBranchGuideId((_a = this.branchGuide) === null || _a === void 0 ? void 0 : _a.id);
|
898
|
+
await this._snkGrid.addGridCustomRender(fieldName, customRender, detailContext);
|
899
|
+
}
|
842
900
|
onContentCardChanged(evt) {
|
843
901
|
SnkGuidesViewer.updateContentCard(evt.detail.formName, evt.detail.cardConfig, evt.detail.propertyChanged, this.formConfigManager).then(() => forceUpdate(this));
|
844
902
|
evt.stopPropagation();
|
845
903
|
}
|
904
|
+
async observeCustomRenders(newValue) {
|
905
|
+
for (const field in newValue) {
|
906
|
+
const customRender = newValue[field];
|
907
|
+
await this.addGridCustomRender(field, customRender);
|
908
|
+
}
|
909
|
+
}
|
846
910
|
updateLabel() {
|
847
911
|
const guideItemPathSize = this.guideItemPath ? this.guideItemPath.length : 0;
|
848
912
|
if (guideItemPathSize > 0) {
|
@@ -945,6 +1009,10 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
945
1009
|
this.messagesBuilder = new SnkMessageBuilder(this.entityName);
|
946
1010
|
}
|
947
1011
|
}
|
1012
|
+
async componentDidLoad() {
|
1013
|
+
await this.observerPropsCustomEditor(this.customEditors);
|
1014
|
+
await this.observeCustomRenders(this.customRenders);
|
1015
|
+
}
|
948
1016
|
async dataUnitActionHandler(action) {
|
949
1017
|
if (action.type === Action.FIELD_INVALIDATED) {
|
950
1018
|
this.addErrorBadgeToBranchGuide();
|
@@ -954,6 +1022,9 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
954
1022
|
this.branchGuide = Object.assign(Object.assign({}, this.branchGuide), { badge: 'error' });
|
955
1023
|
this.snkDetailGuidesChange.emit(new GuideBuilder(this.branchGuide, this._formMetadata, this.dataUnit));
|
956
1024
|
}
|
1025
|
+
normalizeBranchGuideId(id) {
|
1026
|
+
return id === null || id === void 0 ? void 0 : id.replace(/child\[(.*?)\]/g, '$1').replace(/::/g, '>');
|
1027
|
+
}
|
957
1028
|
render() {
|
958
1029
|
this.updateLabel();
|
959
1030
|
//const cardConfig: IFormCardConfig = this._cardsState?.get(this.selectedForm);
|
@@ -961,7 +1032,9 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
961
1032
|
}
|
962
1033
|
static get watchers() { return {
|
963
1034
|
"dataUnit": ["observeDataUnit"],
|
964
|
-
"dataState": ["observerDataState"]
|
1035
|
+
"dataState": ["observerDataState"],
|
1036
|
+
"customEditors": ["observerPropsCustomEditor"],
|
1037
|
+
"customRenders": ["observeCustomRenders"]
|
965
1038
|
}; }
|
966
1039
|
static get style() { return snkDetailViewCss; }
|
967
1040
|
}, [6, "snk-detail-view", {
|
@@ -978,12 +1051,16 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
978
1051
|
"branchGuide": [1040],
|
979
1052
|
"canEdit": [4, "can-edit"],
|
980
1053
|
"taskbarCustomContainerId": [1, "taskbar-custom-container-id"],
|
1054
|
+
"customEditors": [16],
|
1055
|
+
"customRenders": [16],
|
981
1056
|
"_disabledButtons": [32],
|
982
1057
|
"_currentView": [32],
|
983
1058
|
"attachmentRegisterKey": [32],
|
984
1059
|
"changeViewMode": [64],
|
985
1060
|
"configGrid": [64],
|
986
|
-
"showUp": [64]
|
1061
|
+
"showUp": [64],
|
1062
|
+
"addCustomEditor": [64],
|
1063
|
+
"addGridCustomRender": [64]
|
987
1064
|
}, [[0, "snkContentCardChanged", "onContentCardChanged"]]]);
|
988
1065
|
SnkDetailView.REGEX_FORM_ID = /__FORM:[^:]+/g;
|
989
1066
|
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],
|
@@ -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") {
|