@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-57523.0 → 0.0.0-bugfix-dev-59880.0
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-7df9d3bb.js → ConfigStorage-9a53a42c.js} +12 -11
- package/dist/cjs/{form-config-fetcher-3c4daeb5.js → DataFetcher-515bda03.js} +0 -251
- package/dist/cjs/{IExporterProvider-c307e2b1.js → IExporterProvider-e286ef6a.js} +55 -12
- package/dist/cjs/{SnkFormConfigManager-4259edbe.js → SnkFormConfigManager-7b222c78.js} +4 -4
- package/dist/cjs/{SnkMessageBuilder-66aa2557.js → SnkMessageBuilder-4a95fe86.js} +6 -12
- package/dist/cjs/{auth-fetcher-e6112be7.js → auth-fetcher-5acb0335.js} +1 -1
- package/dist/cjs/{pesquisa-fetcher-cbdaba63.js → dataunit-fetcher-7a08e4dd.js} +74 -175
- package/dist/cjs/form-config-fetcher-3f430aee.js +256 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pesquisa-fetcher-916a935c.js +166 -0
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +10 -8
- package/dist/cjs/snk-application.cjs.entry.js +49 -39
- package/dist/cjs/snk-attach.cjs.entry.js +19 -17
- package/dist/cjs/snk-crud.cjs.entry.js +95 -10
- package/dist/cjs/snk-data-exporter.cjs.entry.js +11 -9
- package/dist/cjs/snk-data-unit-3718477f.js +670 -0
- package/dist/cjs/snk-data-unit.cjs.entry.js +10 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +48 -7
- package/dist/cjs/snk-filter-bar.cjs.entry.js +8 -3
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -2
- package/dist/cjs/snk-form-config.cjs.entry.js +2 -1
- package/dist/cjs/snk-form-view.cjs.entry.js +67 -0
- package/dist/cjs/snk-form.cjs.entry.js +53 -7
- package/dist/cjs/snk-grid.cjs.entry.js +103 -11
- package/dist/cjs/{snk-guides-viewer-b0c44e0c.js → snk-guides-viewer-66dd6949.js} +36 -7
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -6
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -2
- package/dist/cjs/snk-simple-crud.cjs.entry.js +153 -14
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/snk-application/snk-application.js +37 -17
- 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 +230 -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/interfaces/IExporterProvider.js +14 -8
- package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +5 -0
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +2 -2
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +499 -176
- package/dist/collection/components/snk-data-unit/test/resources/metadataMock.js +24 -0
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +22 -1
- package/dist/collection/components/snk-form/snk-form.js +101 -4
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +2 -2
- package/dist/collection/components/snk-grid/snk-grid.js +219 -8
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +283 -9
- package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +35 -0
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +6 -2
- 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/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 +51 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.js +22 -0
- package/dist/collection/lib/message/SnkMessageBuilder.js +25 -32
- package/dist/collection/lib/message/resources/snk-data-unit.msg.js +1 -0
- package/dist/components/ConfigStorage.js +2 -1
- package/dist/components/DataFetcher.js +7024 -0
- package/dist/components/IExporterProvider.js +54 -12
- package/dist/components/SnkFormConfigManager.js +2 -2
- package/dist/components/SnkMessageBuilder.js +6 -12
- package/dist/components/dataunit-fetcher.js +64 -166
- package/dist/components/form-config-fetcher.js +3 -7023
- package/dist/components/pesquisa-fetcher.js +164 -0
- package/dist/components/snk-actions-button2.js +4 -2
- package/dist/components/snk-application2.js +26 -17
- package/dist/components/snk-attach2.js +4 -2
- package/dist/components/snk-crud.js +101 -10
- package/dist/components/snk-data-exporter2.js +6 -4
- package/dist/components/snk-data-unit2.js +424 -177
- package/dist/components/snk-detail-view2.js +87 -9
- 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 +52 -5
- package/dist/components/snk-grid2.js +109 -12
- package/dist/components/snk-simple-crud2.js +157 -11
- package/dist/esm/{ConfigStorage-928c3bf4.js → ConfigStorage-174101b9.js} +2 -1
- package/dist/esm/{form-config-fetcher-e3094014.js → DataFetcher-4b4b7beb.js} +1 -250
- package/dist/esm/{IExporterProvider-e2a1195d.js → IExporterProvider-cf5a56ee.js} +54 -12
- package/dist/esm/{SnkFormConfigManager-a87ade7a.js → SnkFormConfigManager-3bdb3e1f.js} +4 -4
- package/dist/esm/{SnkMessageBuilder-0a4becdd.js → SnkMessageBuilder-3a767111.js} +6 -12
- package/dist/esm/{auth-fetcher-e1cb288f.js → auth-fetcher-9f86c346.js} +1 -1
- package/dist/esm/{pesquisa-fetcher-6d8e50bb.js → dataunit-fetcher-f3fa35b9.js} +63 -165
- package/dist/esm/form-config-fetcher-5d72aaf1.js +253 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pesquisa-fetcher-9cfab836.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 +30 -20
- package/dist/esm/snk-attach.entry.js +5 -3
- package/dist/esm/snk-crud.entry.js +95 -10
- package/dist/esm/snk-data-exporter.entry.js +8 -6
- package/dist/esm/snk-data-unit-8d6afa43.js +668 -0
- package/dist/esm/snk-data-unit.entry.js +10 -2
- package/dist/esm/snk-detail-view.entry.js +48 -7
- package/dist/esm/snk-filter-bar.entry.js +8 -3
- package/dist/esm/snk-filter-modal-item.entry.js +3 -2
- package/dist/esm/snk-form-config.entry.js +2 -1
- package/dist/esm/snk-form-view.entry.js +67 -0
- package/dist/esm/snk-form.entry.js +53 -7
- package/dist/esm/snk-grid.entry.js +104 -12
- package/dist/esm/{snk-guides-viewer-1fd41a25.js → snk-guides-viewer-11cf8dc7.js} +36 -7
- package/dist/esm/snk-guides-viewer.entry.js +8 -6
- package/dist/esm/snk-personalized-filter.entry.js +3 -2
- package/dist/esm/snk-simple-crud.entry.js +153 -14
- package/dist/sankhyablocks/p-010d475f.js +1 -0
- package/dist/sankhyablocks/p-0a28cb19.entry.js +1 -0
- package/dist/sankhyablocks/p-188e1432.entry.js +1 -0
- package/dist/sankhyablocks/p-1c6debe6.entry.js +1 -0
- package/dist/sankhyablocks/p-1db45d26.entry.js +1 -0
- package/dist/sankhyablocks/p-2a84e45b.entry.js +1 -0
- package/dist/sankhyablocks/p-2cc2d8fd.entry.js +1 -0
- package/dist/sankhyablocks/p-3e4c2cfe.entry.js +11 -0
- package/dist/sankhyablocks/p-4a8a149d.entry.js +1 -0
- package/dist/sankhyablocks/p-4ce73e88.js +1 -0
- package/dist/sankhyablocks/p-50e72d6c.js +1 -0
- package/dist/sankhyablocks/{p-e27496ed.js → p-566f5f50.js} +6 -6
- package/dist/sankhyablocks/p-59dccb7a.entry.js +1 -0
- package/dist/sankhyablocks/p-5bd78e4c.entry.js +1 -0
- package/dist/sankhyablocks/p-6b2be902.js +6 -0
- package/dist/sankhyablocks/p-8171e586.entry.js +1 -0
- package/dist/sankhyablocks/p-a6dfa396.js +1 -0
- package/dist/sankhyablocks/p-a97060b0.js +1 -0
- package/dist/sankhyablocks/p-aa854fa8.entry.js +1 -0
- package/dist/sankhyablocks/p-b27114c4.js +1 -0
- package/dist/sankhyablocks/p-b643f746.entry.js +1 -0
- package/dist/sankhyablocks/p-b68918fc.entry.js +1 -0
- package/dist/sankhyablocks/p-da7c81d6.entry.js +1 -0
- package/dist/sankhyablocks/p-e0c27486.js +26 -0
- package/dist/sankhyablocks/p-e238279a.entry.js +1 -0
- package/dist/sankhyablocks/p-eae66367.js +1 -0
- package/dist/sankhyablocks/p-fde91811.js +60 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +6 -2
- 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 +32 -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/interfaces/IExporterProvider.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-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 +42 -3
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +40 -2
- package/dist/types/components.d.ts +180 -4
- 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/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 +2 -0
- package/package.json +1 -1
- package/dist/cjs/snk-data-unit-abd2113f.js +0 -427
- package/dist/esm/snk-data-unit-29eba11a.js +0 -425
- package/dist/sankhyablocks/p-029bfc09.js +0 -1
- package/dist/sankhyablocks/p-03dcc5ff.entry.js +0 -1
- package/dist/sankhyablocks/p-07825198.js +0 -1
- package/dist/sankhyablocks/p-0e8702f0.js +0 -1
- package/dist/sankhyablocks/p-13ea113d.entry.js +0 -1
- package/dist/sankhyablocks/p-314e2d1a.entry.js +0 -1
- package/dist/sankhyablocks/p-32556aa6.js +0 -1
- package/dist/sankhyablocks/p-3357af48.js +0 -1
- package/dist/sankhyablocks/p-3c2a1f4d.js +0 -65
- package/dist/sankhyablocks/p-3e7167dd.js +0 -1
- package/dist/sankhyablocks/p-536eeb16.js +0 -26
- package/dist/sankhyablocks/p-587f9dcf.entry.js +0 -1
- package/dist/sankhyablocks/p-61984566.entry.js +0 -1
- package/dist/sankhyablocks/p-61b6126e.entry.js +0 -1
- package/dist/sankhyablocks/p-65b6dba3.entry.js +0 -1
- package/dist/sankhyablocks/p-6a7bc5c8.entry.js +0 -1
- package/dist/sankhyablocks/p-6c9edfd8.entry.js +0 -1
- package/dist/sankhyablocks/p-89bde7d3.entry.js +0 -1
- package/dist/sankhyablocks/p-91dceecf.entry.js +0 -1
- package/dist/sankhyablocks/p-a40cbad8.entry.js +0 -1
- package/dist/sankhyablocks/p-b86ea293.entry.js +0 -1
- package/dist/sankhyablocks/p-d8ddb2a4.entry.js +0 -11
- package/dist/sankhyablocks/p-f92f1f5f.entry.js +0 -1
- package/dist/sankhyablocks/p-fa84e72f.entry.js +0 -1
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, F as Fragment } from './index-a7d3d3f1.js';
|
|
2
2
|
import { Action, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
|
-
import { S as SnkFormConfigManager } from './SnkFormConfigManager-
|
|
3
|
+
import { S as SnkFormConfigManager } from './SnkFormConfigManager-3bdb3e1f.js';
|
|
4
4
|
import { buildFormMetadata, FormMetadata } from '@sankhyalabs/ezui/dist/collection/utils/form';
|
|
5
5
|
import { o as openFieldSearch, T as TaskbarProcessor, b as buildFieldSearch } from './field-search-efbe307f.js';
|
|
6
6
|
import { T as TaskbarElement } from './taskbar-elements-ad766858.js';
|
|
7
7
|
import { d as VIEW_MODE } from './constants-8457af36.js';
|
|
8
|
-
import './
|
|
9
|
-
import './pesquisa-fetcher-
|
|
8
|
+
import './DataFetcher-4b4b7beb.js';
|
|
9
|
+
import './pesquisa-fetcher-9cfab836.js';
|
|
10
10
|
import { P as PresentationMode } from './index-0ece87a6.js';
|
|
11
11
|
import './ISave-d8c8bc59.js';
|
|
12
12
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
13
13
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
14
|
+
import './dataunit-fetcher-f3fa35b9.js';
|
|
14
15
|
import './filter-item-type.enum-d45e026f.js';
|
|
16
|
+
import './form-config-fetcher-5d72aaf1.js';
|
|
15
17
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
|
16
18
|
|
|
17
19
|
const snkGuidesViewerCss = ".sc-snk-guides-viewer-h{--snk-guides-viewer--space-large:var(--space--large, 24px);--snk-guides-viewer--space-medium:var(--space--medium, 12px);--snk-guides-viewer__header--min-height:94px;--snk-guides-viewer__header--z-index:var(--more-visible, 2);--snk-guides-viewer__header--background-color:var(--background--body, #fafcff);--snk-guides-viewer__guide-navigator--width:340px;display:block}snk-form-view.sc-snk-guides-viewer{width:100%}.snk-guides-viewer.sc-snk-guides-viewer{position:relative;padding-left:0px;padding-top:0px;padding-right:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__detail-container.sc-snk-guides-viewer{display:flex;row-gap:24px;flex-direction:column}.snk-guides-viewer__header.sc-snk-guides-viewer{position:sticky;align-items:center;top:0;z-index:var(--snk-guides-viewer__header--z-index);background-color:var(--snk-guides-viewer__header--background-color);min-height:var(--snk-guides-viewer__header--min-height);width:calc(100% + (var(--snk-guides-viewer--space-large) * 2));padding-left:var(--snk-guides-viewer--space-large);padding-right:var(--snk-guides-viewer--space-large);padding-top:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-medium);margin-left:calc(var(--snk-guides-viewer--space-large) * -1);margin-right:calc(var(--snk-guides-viewer--space-large) * -1);margin-bottom:var(--snk-guides-viewer--space-medium)}.snk-guides-viewer__header-breadcrumb.sc-snk-guides-viewer{width:25%;display:flex}.snk-guides-viewer__header-taskbar.sc-snk-guides-viewer{width:75%}.snk-guides-viewer__container.sc-snk-guides-viewer{display:grid;grid-template-columns:minmax(0, auto) minmax(0, 100%);height:100%;column-gap:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__guide-navigator.sc-snk-guides-viewer{position:sticky;top:calc(var(--snk-guides-viewer__header--min-height) + var(--snk-guides-viewer--space-medium));height:calc(100vh - var(--snk-guides-viewer__header--min-height) - var(--snk-guides-viewer--space-large) - var(--snk-guides-viewer--space-medium))}.snk-guides-viewer__guide-navigator[open].sc-snk-guides-viewer{width:var(--snk-guides-viewer__guide-navigator--width);max-width:var(--snk-guides-viewer__guide-navigator--width);min-width:var(--snk-guides-viewer__guide-navigator--width)}.snk-guides-viewer__detail-content.sc-snk-guides-viewer{min-height:100%;align-items:flex-start;align-content:flex-start}";
|
|
@@ -45,6 +47,9 @@ const SnkGuidesViewer = class {
|
|
|
45
47
|
this._formEditorConfigManager = undefined;
|
|
46
48
|
this._formEditorDataUnit = undefined;
|
|
47
49
|
this._fieldToGetFocus = undefined;
|
|
50
|
+
this._customEditors = undefined;
|
|
51
|
+
this._customRenders = undefined;
|
|
52
|
+
this._fieldsProps = {};
|
|
48
53
|
}
|
|
49
54
|
observeDataUnit() {
|
|
50
55
|
this.loadGuides(true);
|
|
@@ -75,6 +80,28 @@ const SnkGuidesViewer = class {
|
|
|
75
80
|
async findField() {
|
|
76
81
|
await openFieldSearch(this._moreOptions, this._fieldSearch);
|
|
77
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Registra um editor customizado para campos da grade e formulário
|
|
85
|
+
*/
|
|
86
|
+
async addCustomEditor(fieldName, customEditor) {
|
|
87
|
+
this._customEditors = Object.assign(Object.assign({}, this._customEditors), { [fieldName]: customEditor });
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Registra um render customizado para colunas da grid.
|
|
91
|
+
*/
|
|
92
|
+
async addGridCustomRender(fieldName, customRender) {
|
|
93
|
+
this._customRenders = Object.assign(Object.assign({}, this._customRenders), { [fieldName]: customRender });
|
|
94
|
+
}
|
|
95
|
+
;
|
|
96
|
+
/**
|
|
97
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
|
98
|
+
*/
|
|
99
|
+
async setFieldProp(fieldName, propName, value) {
|
|
100
|
+
const newFieldsProps = {
|
|
101
|
+
[fieldName]: Object.assign(Object.assign({}, this._fieldsProps[fieldName]), { [propName]: value })
|
|
102
|
+
};
|
|
103
|
+
this._fieldsProps = Object.assign(Object.assign({}, this._fieldsProps), newFieldsProps);
|
|
104
|
+
}
|
|
78
105
|
exitViewer() {
|
|
79
106
|
if (this.dataUnit.isDirty()) {
|
|
80
107
|
this.dataUnit.cancelEdition({ after: () => this.exit.emit() });
|
|
@@ -217,7 +244,7 @@ const SnkGuidesViewer = class {
|
|
|
217
244
|
if (sheet == undefined) {
|
|
218
245
|
return;
|
|
219
246
|
}
|
|
220
|
-
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); } });
|
|
247
|
+
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 });
|
|
221
248
|
})));
|
|
222
249
|
}
|
|
223
250
|
wrapDetail(levels, content) {
|
|
@@ -259,14 +286,14 @@ const SnkGuidesViewer = class {
|
|
|
259
286
|
else {
|
|
260
287
|
detailBranch = this.selectedGuide;
|
|
261
288
|
}
|
|
262
|
-
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 }));
|
|
289
|
+
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 }));
|
|
263
290
|
}
|
|
264
291
|
else {
|
|
265
292
|
const cardId = this.selectedGuide.id;
|
|
266
293
|
const sheet = this._masterFormMetadata.getSheet(cardId);
|
|
267
294
|
if (sheet) {
|
|
268
295
|
const cardConfig = (_c = (_b = this.masterFormConfig) === null || _b === void 0 ? void 0 : _b.cardsState) === null || _c === void 0 ? void 0 : _c.get(cardId);
|
|
269
|
-
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());
|
|
296
|
+
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());
|
|
270
297
|
}
|
|
271
298
|
}
|
|
272
299
|
return content;
|
|
@@ -472,7 +499,9 @@ const SnkGuidesViewer = class {
|
|
|
472
499
|
dataUnit: this.dataUnit,
|
|
473
500
|
recordsValidator: this.recordsValidator,
|
|
474
501
|
fieldToFocus: this._fieldToGetFocus,
|
|
475
|
-
onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this)
|
|
502
|
+
onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this),
|
|
503
|
+
propsCustomEditor: this._customEditors,
|
|
504
|
+
fieldsProps: this._fieldsProps
|
|
476
505
|
}), 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 })));
|
|
477
506
|
}
|
|
478
507
|
static get watchers() { return {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export { S as snk_guides_viewer } from './snk-guides-viewer-
|
|
1
|
+
export { S as snk_guides_viewer } from './snk-guides-viewer-11cf8dc7.js';
|
|
2
2
|
import './index-a7d3d3f1.js';
|
|
3
3
|
import '@sankhyalabs/core';
|
|
4
|
-
import './SnkFormConfigManager-
|
|
5
|
-
import './ConfigStorage-
|
|
6
|
-
import './form-config-fetcher-
|
|
4
|
+
import './SnkFormConfigManager-3bdb3e1f.js';
|
|
5
|
+
import './ConfigStorage-174101b9.js';
|
|
6
|
+
import './form-config-fetcher-5d72aaf1.js';
|
|
7
|
+
import './DataFetcher-4b4b7beb.js';
|
|
7
8
|
import './PrintUtils-3e4ff0f5.js';
|
|
8
9
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
9
10
|
import './filter-item-type.enum-d45e026f.js';
|
|
@@ -13,10 +14,11 @@ import './taskbar-elements-ad766858.js';
|
|
|
13
14
|
import './index-0ece87a6.js';
|
|
14
15
|
import './index-bdf75557.js';
|
|
15
16
|
import './constants-8457af36.js';
|
|
16
|
-
import './pesquisa-fetcher-
|
|
17
|
+
import './pesquisa-fetcher-9cfab836.js';
|
|
18
|
+
import './ISave-d8c8bc59.js';
|
|
17
19
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
20
|
+
import './dataunit-fetcher-f3fa35b9.js';
|
|
18
21
|
import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
|
|
19
22
|
import '@sankhyalabs/core/dist/utils/SortingUtils';
|
|
20
23
|
import './ResourceIDUtils-a114189a.js';
|
|
21
|
-
import './ISave-d8c8bc59.js';
|
|
22
24
|
import '@sankhyalabs/core/dist/dataunit/DataUnit';
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host } from './index-a7d3d3f1.js';
|
|
2
2
|
import { StringUtils, ObjectUtils, ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-e2b38ef7.js';
|
|
4
|
-
import { P as PersonalizedFilterFetcher, C as ConfigStorage } from './ConfigStorage-
|
|
4
|
+
import { P as PersonalizedFilterFetcher, C as ConfigStorage } from './ConfigStorage-174101b9.js';
|
|
5
5
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
6
6
|
import { a as FilterGroupCondition } from './index-ae591a44.js';
|
|
7
7
|
import { s as store } from './index-bdf75557.js';
|
|
8
8
|
import './filter-item-type.enum-d45e026f.js';
|
|
9
|
-
import './form-config-fetcher-
|
|
9
|
+
import './form-config-fetcher-5d72aaf1.js';
|
|
10
|
+
import './DataFetcher-4b4b7beb.js';
|
|
10
11
|
import './PrintUtils-3e4ff0f5.js';
|
|
11
12
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
12
13
|
|
|
@@ -3,24 +3,26 @@ import { UserInterface, StringUtils, ApplicationContext, ObjectUtils, DataType,
|
|
|
3
3
|
import { CSSVarsUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
4
|
import { d as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants-8457af36.js';
|
|
5
5
|
import { T as TaskbarElement } from './taskbar-elements-ad766858.js';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, a as CrudUtils } from './IExporterProvider-
|
|
6
|
+
import './DataFetcher-4b4b7beb.js';
|
|
7
|
+
import './pesquisa-fetcher-9cfab836.js';
|
|
8
|
+
import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, R as RmPrecisionCustomValueFormatter, a as CrudUtils } from './IExporterProvider-cf5a56ee.js';
|
|
9
9
|
import { D as DataExporterOption, P as PresentationMode } from './index-0ece87a6.js';
|
|
10
10
|
import './ISave-d8c8bc59.js';
|
|
11
11
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
12
12
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
13
|
+
import { I as InMemoryLoader } from './dataunit-fetcher-f3fa35b9.js';
|
|
13
14
|
import './filter-item-type.enum-d45e026f.js';
|
|
15
|
+
import { F as FormConfigFetcher } from './form-config-fetcher-5d72aaf1.js';
|
|
14
16
|
import { T as TaskbarProcessor, b as buildFieldSearch, o as openFieldSearch } from './field-search-efbe307f.js';
|
|
15
|
-
import { C as ConfigStorage } from './ConfigStorage-
|
|
16
|
-
import { S as SnkFormConfigManager } from './SnkFormConfigManager-
|
|
17
|
+
import { C as ConfigStorage } from './ConfigStorage-174101b9.js';
|
|
18
|
+
import { S as SnkFormConfigManager } from './SnkFormConfigManager-3bdb3e1f.js';
|
|
17
19
|
import { g as getSelectedIDs } from './RecordIDUtils-87d02110.js';
|
|
18
20
|
import { s as store } from './index-bdf75557.js';
|
|
19
21
|
import './PrintUtils-3e4ff0f5.js';
|
|
22
|
+
import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
|
|
20
23
|
import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
|
|
21
24
|
import '@sankhyalabs/core/dist/utils/SortingUtils';
|
|
22
25
|
import './ResourceIDUtils-a114189a.js';
|
|
23
|
-
import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
|
|
24
26
|
|
|
25
27
|
const REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "MORE_OPTIONS"];
|
|
26
28
|
const REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER", "MORE_OPTIONS"];
|
|
@@ -71,6 +73,11 @@ class ClientSideExporterProvider extends CommonsExporter {
|
|
|
71
73
|
if (fieldDescriptor.userInterface === UserInterface.SEARCH) {
|
|
72
74
|
return value.value;
|
|
73
75
|
}
|
|
76
|
+
if (column.customFormatter) {
|
|
77
|
+
const ezGridColumn = this.getColumnsState().find(columnState => column.id === columnState.name);
|
|
78
|
+
const formattedValue = column.customFormatter.format(value, ezGridColumn, record.__record__id__);
|
|
79
|
+
return formattedValue;
|
|
80
|
+
}
|
|
74
81
|
return this.dataUnit.getFormattedValue(id, value);
|
|
75
82
|
}
|
|
76
83
|
}
|
|
@@ -89,6 +96,8 @@ const SnkSimpleCrud = class {
|
|
|
89
96
|
this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
|
|
90
97
|
this._keyDownHandler = (event) => this.keyDownListener(event);
|
|
91
98
|
this._formConfigFetcher = new FormConfigFetcher();
|
|
99
|
+
this._customEditors = new Map();
|
|
100
|
+
this._customRenders = new Map();
|
|
92
101
|
this._taskbarProcessor = new TaskbarProcessor({
|
|
93
102
|
"snkSimpleCrudTaskbar.form_regular": this.getButtons(false, [TaskbarElement.GRID_MODE]),
|
|
94
103
|
"snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]),
|
|
@@ -109,6 +118,7 @@ const SnkSimpleCrud = class {
|
|
|
109
118
|
this.gridConfig = undefined;
|
|
110
119
|
this.formConfig = undefined;
|
|
111
120
|
this._formFields = [];
|
|
121
|
+
this._fieldsProps = new Map();
|
|
112
122
|
this.multipleSelection = undefined;
|
|
113
123
|
this.useCancelConfirm = true;
|
|
114
124
|
this.pageSize = 150;
|
|
@@ -122,6 +132,32 @@ const SnkSimpleCrud = class {
|
|
|
122
132
|
this.gridLegacyConfigName = undefined;
|
|
123
133
|
this.formLegacyConfigName = undefined;
|
|
124
134
|
this.ignoreReadOnlyFormFields = false;
|
|
135
|
+
this.autoLoad = undefined;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Registra um editor customizado para campos da grade e formulário.
|
|
139
|
+
*/
|
|
140
|
+
async addCustomEditor(fieldName, customEditor) {
|
|
141
|
+
if (this._grid && this._form) {
|
|
142
|
+
this._grid.addCustomEditor(fieldName, customEditor);
|
|
143
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const newCustomEditors = new Map(this._customEditors);
|
|
147
|
+
newCustomEditors.set(fieldName, customEditor);
|
|
148
|
+
this._customEditors = newCustomEditors;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Registra um render customizado para colunas da grid.
|
|
152
|
+
*/
|
|
153
|
+
async addGridCustomRender(fieldName, customRender) {
|
|
154
|
+
if (this._grid) {
|
|
155
|
+
this._grid.addGridCustomRender(fieldName, customRender);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const newCustomRenders = new Map(this._customRenders);
|
|
159
|
+
newCustomRenders.set(fieldName, customRender);
|
|
160
|
+
this._customRenders = newCustomRenders;
|
|
125
161
|
}
|
|
126
162
|
handleResourceIDChanged(newValue, oldValue) {
|
|
127
163
|
if (StringUtils.isEmpty(newValue)) {
|
|
@@ -133,6 +169,27 @@ const SnkSimpleCrud = class {
|
|
|
133
169
|
this.loadFormConfig(true);
|
|
134
170
|
this.loadGridConfig(true);
|
|
135
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* Registra um formatador de valores para uma coluna da grid.
|
|
174
|
+
*/
|
|
175
|
+
async addCustomValueFormatter(columnName, customFormatter) {
|
|
176
|
+
this._grid.addCustomValueFormatter(columnName, customFormatter);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Remove o formatador de valores de uma coluna da grid.
|
|
180
|
+
*/
|
|
181
|
+
async removeCustomValueFormatter(columnName) {
|
|
182
|
+
this._grid.removeCustomValueFormatter(columnName);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
|
186
|
+
*/
|
|
187
|
+
async setFieldProp(fieldName, propName, value) {
|
|
188
|
+
const newCustomFieldProps = new Map(this._fieldsProps);
|
|
189
|
+
const currentProps = this._fieldsProps.get(fieldName);
|
|
190
|
+
newCustomFieldProps.set(fieldName, Object.assign(Object.assign({}, currentProps), { [propName]: value }));
|
|
191
|
+
this._fieldsProps = newCustomFieldProps;
|
|
192
|
+
}
|
|
136
193
|
getButtons(selected, extraButtons) {
|
|
137
194
|
return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
|
|
138
195
|
.concat(extraButtons));
|
|
@@ -187,9 +244,7 @@ const SnkSimpleCrud = class {
|
|
|
187
244
|
}
|
|
188
245
|
}
|
|
189
246
|
observeDataState(newValue, oldValue) {
|
|
190
|
-
|
|
191
|
-
this.dataStateChange.emit(newValue);
|
|
192
|
-
}
|
|
247
|
+
this.handleDataStateChange(newValue, oldValue);
|
|
193
248
|
}
|
|
194
249
|
async observeFormLegacy(newValue, oldValue) {
|
|
195
250
|
await this.handleUpdateFormLegacyConfig(newValue, oldValue);
|
|
@@ -197,6 +252,28 @@ const SnkSimpleCrud = class {
|
|
|
197
252
|
async observeGridLegacy(newValue, oldValue) {
|
|
198
253
|
await this.handleUpdateGridLegacyConfig(newValue, oldValue);
|
|
199
254
|
}
|
|
255
|
+
async handleDataStateChange(newValue, oldValue) {
|
|
256
|
+
if (ObjectUtils.objectToString(oldValue) != ObjectUtils.objectToString(newValue)) {
|
|
257
|
+
this.dataStateChange.emit(newValue);
|
|
258
|
+
}
|
|
259
|
+
await this.processRmPrecision();
|
|
260
|
+
}
|
|
261
|
+
async processRmPrecision() {
|
|
262
|
+
var _a, _b;
|
|
263
|
+
const fieldsWithRmPrecision = await this._snkDataUnit.getFieldsWithRmPrecision();
|
|
264
|
+
for (const field of fieldsWithRmPrecision || []) {
|
|
265
|
+
if (!field) {
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
const rmPrecision = (_b = (_a = this.dataState) === null || _a === void 0 ? void 0 : _a.rowMetadata) === null || _b === void 0 ? void 0 : _b.getProp('rm_precision', field);
|
|
269
|
+
if (!rmPrecision && rmPrecision !== 0) {
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
await this.setFieldProp(field, 'precision', rmPrecision);
|
|
273
|
+
await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
|
|
274
|
+
}
|
|
275
|
+
this._rmPrecisionCustomValueFormatter.setDataState(this.dataState);
|
|
276
|
+
}
|
|
200
277
|
async handleUpdateGridLegacyConfig(newValue, oldValue) {
|
|
201
278
|
if (newValue == undefined || newValue == oldValue) {
|
|
202
279
|
return;
|
|
@@ -305,18 +382,56 @@ const SnkSimpleCrud = class {
|
|
|
305
382
|
this.loadGridConfig();
|
|
306
383
|
this.loadFormConfig();
|
|
307
384
|
}
|
|
385
|
+
componentDidRender() {
|
|
386
|
+
this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
|
|
387
|
+
this.addGridCustomValueFormattters();
|
|
388
|
+
this.setFieldsProps();
|
|
389
|
+
this.setCustomRenders();
|
|
390
|
+
this.setCustomEditors();
|
|
391
|
+
}
|
|
308
392
|
componentWillLoad() {
|
|
309
393
|
this.processMetadata();
|
|
310
394
|
this.onModeChange();
|
|
311
395
|
this.configDatasource();
|
|
396
|
+
this._rmPrecisionCustomValueFormatter = new RmPrecisionCustomValueFormatter();
|
|
312
397
|
}
|
|
313
398
|
componentDidLoad() {
|
|
314
399
|
CSSVarsUtils.applyVarsGrid(this._element, this._grid);
|
|
315
400
|
}
|
|
401
|
+
setCustomRenders() {
|
|
402
|
+
if (!this._grid) {
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
for (const [fieldName, customRender] of this._customRenders) {
|
|
406
|
+
this._grid.addGridCustomRender(fieldName, customRender);
|
|
407
|
+
this._customRenders.delete(fieldName);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
setCustomEditors() {
|
|
411
|
+
if (!this._grid || !this._form) {
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
for (const [fieldName, customEditor] of this._customEditors) {
|
|
415
|
+
this._grid.addCustomEditor(fieldName, customEditor);
|
|
416
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
|
417
|
+
this._customEditors.delete(fieldName);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
316
420
|
configDatasource() {
|
|
317
421
|
this._multiSelectionListDataSource.setApplication(this.application);
|
|
318
422
|
this._multiSelectionListDataSource.setDataUnit(this.dataUnit);
|
|
319
423
|
}
|
|
424
|
+
setFieldsProps() {
|
|
425
|
+
if (!this._form) {
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
for (const [fieldName, props] of this._fieldsProps) {
|
|
429
|
+
for (const prop in props) {
|
|
430
|
+
this._form.setFieldProp(fieldName, prop, props[prop]);
|
|
431
|
+
}
|
|
432
|
+
this._fieldsProps.delete(fieldName);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
320
435
|
getTaskBarId() {
|
|
321
436
|
var _a, _b;
|
|
322
437
|
if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
|
|
@@ -330,7 +445,7 @@ const SnkSimpleCrud = class {
|
|
|
330
445
|
return this._currentViewMode === VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
|
|
331
446
|
}
|
|
332
447
|
initInMemoryDataUnit() {
|
|
333
|
-
this._inMemoryLoader = new InMemoryLoader(this._metadata);
|
|
448
|
+
this._inMemoryLoader = new InMemoryLoader(this._metadata, undefined, { autoLoad: this.autoLoad });
|
|
334
449
|
this.dataUnit = this._inMemoryLoader.dataUnit;
|
|
335
450
|
this.dataUnitReady.emit(this.dataUnit);
|
|
336
451
|
}
|
|
@@ -369,12 +484,11 @@ const SnkSimpleCrud = class {
|
|
|
369
484
|
var _a;
|
|
370
485
|
(_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.close();
|
|
371
486
|
}
|
|
372
|
-
updateConfig() {
|
|
487
|
+
async updateConfig() {
|
|
373
488
|
if (this._formConfigManager == undefined) {
|
|
374
489
|
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
|
375
490
|
}
|
|
376
491
|
this._formConfigManager.setConfig(this.formConfig);
|
|
377
|
-
return;
|
|
378
492
|
}
|
|
379
493
|
processMetadata() {
|
|
380
494
|
const fieldsMetadataElem = this._element.querySelectorAll("snk-field-metadata");
|
|
@@ -406,6 +520,23 @@ const SnkSimpleCrud = class {
|
|
|
406
520
|
};
|
|
407
521
|
}
|
|
408
522
|
}
|
|
523
|
+
addGridCustomValueFormattters() {
|
|
524
|
+
var _a, _b, _c;
|
|
525
|
+
const metadataFields = ((_a = this._metadata) === null || _a === void 0 ? void 0 : _a.fields) || ((_c = (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.metadata) === null || _c === void 0 ? void 0 : _c.fields);
|
|
526
|
+
if (!metadataFields) {
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
const fieldsWithRmPrecision = [];
|
|
530
|
+
metadataFields.forEach((field) => {
|
|
531
|
+
var _a;
|
|
532
|
+
if (((_a = field.properties) === null || _a === void 0 ? void 0 : _a.rm_precision) && !fieldsWithRmPrecision.includes(field.name)) {
|
|
533
|
+
fieldsWithRmPrecision.push(field.name);
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
fieldsWithRmPrecision.forEach(field => {
|
|
537
|
+
this.addCustomValueFormatter(field, this._rmPrecisionCustomValueFormatter);
|
|
538
|
+
});
|
|
539
|
+
}
|
|
409
540
|
onDataStateChange(evt) {
|
|
410
541
|
this.dataState = Object.assign({}, evt.detail);
|
|
411
542
|
}
|
|
@@ -620,15 +751,23 @@ const SnkSimpleCrud = class {
|
|
|
620
751
|
}
|
|
621
752
|
return configFromManager;
|
|
622
753
|
}
|
|
754
|
+
updateFormConfig() {
|
|
755
|
+
const newConfig = Object.assign(Object.assign({}, this.formConfig), { fields: this.dataUnit.metadata.fields });
|
|
756
|
+
this.setFormConfig(newConfig, true);
|
|
757
|
+
if (this._formConfigManager == undefined) {
|
|
758
|
+
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
|
759
|
+
}
|
|
760
|
+
this._formConfigManager.setConfig(this.formConfig);
|
|
761
|
+
}
|
|
623
762
|
/* istanbul ignore next */
|
|
624
763
|
render() {
|
|
625
764
|
var _a;
|
|
626
765
|
if (this.dataUnit == undefined) {
|
|
627
766
|
return;
|
|
628
767
|
}
|
|
629
|
-
return (h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
|
768
|
+
return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this) }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
|
630
769
|
? undefined
|
|
631
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
|
770
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
|
632
771
|
}
|
|
633
772
|
get _element() { return getElement(this); }
|
|
634
773
|
static get watchers() { return {
|