@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
|
@@ -2,18 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
const index = require('./index-f9e81701.js');
|
|
4
4
|
const core = require('@sankhyalabs/core');
|
|
5
|
-
const SnkFormConfigManager = require('./SnkFormConfigManager-
|
|
5
|
+
const SnkFormConfigManager = require('./SnkFormConfigManager-7b222c78.js');
|
|
6
6
|
const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
|
|
7
7
|
const fieldSearch = require('./field-search-f56aa7d6.js');
|
|
8
8
|
const taskbarElements = require('./taskbar-elements-d9392685.js');
|
|
9
9
|
const constants = require('./constants-35ddd366.js');
|
|
10
|
-
require('./
|
|
11
|
-
require('./pesquisa-fetcher-
|
|
10
|
+
require('./DataFetcher-515bda03.js');
|
|
11
|
+
require('./pesquisa-fetcher-916a935c.js');
|
|
12
12
|
const index$1 = require('./index-0922807b.js');
|
|
13
13
|
require('./ISave-e91b70a7.js');
|
|
14
14
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
15
15
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
16
|
+
require('./dataunit-fetcher-7a08e4dd.js');
|
|
16
17
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
18
|
+
require('./form-config-fetcher-3f430aee.js');
|
|
17
19
|
const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
|
|
18
20
|
|
|
19
21
|
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}";
|
|
@@ -47,6 +49,9 @@ const SnkGuidesViewer = class {
|
|
|
47
49
|
this._formEditorConfigManager = undefined;
|
|
48
50
|
this._formEditorDataUnit = undefined;
|
|
49
51
|
this._fieldToGetFocus = undefined;
|
|
52
|
+
this._customEditors = undefined;
|
|
53
|
+
this._customRenders = undefined;
|
|
54
|
+
this._fieldsProps = {};
|
|
50
55
|
}
|
|
51
56
|
observeDataUnit() {
|
|
52
57
|
this.loadGuides(true);
|
|
@@ -77,6 +82,28 @@ const SnkGuidesViewer = class {
|
|
|
77
82
|
async findField() {
|
|
78
83
|
await fieldSearch.openFieldSearch(this._moreOptions, this._fieldSearch);
|
|
79
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Registra um editor customizado para campos da grade e formulário
|
|
87
|
+
*/
|
|
88
|
+
async addCustomEditor(fieldName, customEditor) {
|
|
89
|
+
this._customEditors = Object.assign(Object.assign({}, this._customEditors), { [fieldName]: customEditor });
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Registra um render customizado para colunas da grid.
|
|
93
|
+
*/
|
|
94
|
+
async addGridCustomRender(fieldName, customRender) {
|
|
95
|
+
this._customRenders = Object.assign(Object.assign({}, this._customRenders), { [fieldName]: customRender });
|
|
96
|
+
}
|
|
97
|
+
;
|
|
98
|
+
/**
|
|
99
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
|
100
|
+
*/
|
|
101
|
+
async setFieldProp(fieldName, propName, value) {
|
|
102
|
+
const newFieldsProps = {
|
|
103
|
+
[fieldName]: Object.assign(Object.assign({}, this._fieldsProps[fieldName]), { [propName]: value })
|
|
104
|
+
};
|
|
105
|
+
this._fieldsProps = Object.assign(Object.assign({}, this._fieldsProps), newFieldsProps);
|
|
106
|
+
}
|
|
80
107
|
exitViewer() {
|
|
81
108
|
if (this.dataUnit.isDirty()) {
|
|
82
109
|
this.dataUnit.cancelEdition({ after: () => this.exit.emit() });
|
|
@@ -219,7 +246,7 @@ const SnkGuidesViewer = class {
|
|
|
219
246
|
if (sheet == undefined) {
|
|
220
247
|
return;
|
|
221
248
|
}
|
|
222
|
-
return index.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); } });
|
|
249
|
+
return index.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 });
|
|
223
250
|
})));
|
|
224
251
|
}
|
|
225
252
|
wrapDetail(levels, content) {
|
|
@@ -261,14 +288,14 @@ const SnkGuidesViewer = class {
|
|
|
261
288
|
else {
|
|
262
289
|
detailBranch = this.selectedGuide;
|
|
263
290
|
}
|
|
264
|
-
content = this.wrapDetail(levels, index.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 }));
|
|
291
|
+
content = this.wrapDetail(levels, index.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 }));
|
|
265
292
|
}
|
|
266
293
|
else {
|
|
267
294
|
const cardId = this.selectedGuide.id;
|
|
268
295
|
const sheet = this._masterFormMetadata.getSheet(cardId);
|
|
269
296
|
if (sheet) {
|
|
270
297
|
const cardConfig = (_c = (_b = this.masterFormConfig) === null || _b === void 0 ? void 0 : _b.cardsState) === null || _c === void 0 ? void 0 : _c.get(cardId);
|
|
271
|
-
content = index.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 == index$1.PresentationMode.SECONDARY && this.buildTaskBar());
|
|
298
|
+
content = index.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 == index$1.PresentationMode.SECONDARY && this.buildTaskBar());
|
|
272
299
|
}
|
|
273
300
|
}
|
|
274
301
|
return content;
|
|
@@ -474,7 +501,9 @@ const SnkGuidesViewer = class {
|
|
|
474
501
|
dataUnit: this.dataUnit,
|
|
475
502
|
recordsValidator: this.recordsValidator,
|
|
476
503
|
fieldToFocus: this._fieldToGetFocus,
|
|
477
|
-
onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this)
|
|
504
|
+
onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this),
|
|
505
|
+
propsCustomEditor: this._customEditors,
|
|
506
|
+
fieldsProps: this._fieldsProps
|
|
478
507
|
}), this.getContent())), index.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 })));
|
|
479
508
|
}
|
|
480
509
|
static get watchers() { return {
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const snkGuidesViewer = require('./snk-guides-viewer-
|
|
5
|
+
const snkGuidesViewer = require('./snk-guides-viewer-66dd6949.js');
|
|
6
6
|
require('./index-f9e81701.js');
|
|
7
7
|
require('@sankhyalabs/core');
|
|
8
|
-
require('./SnkFormConfigManager-
|
|
9
|
-
require('./ConfigStorage-
|
|
10
|
-
require('./form-config-fetcher-
|
|
8
|
+
require('./SnkFormConfigManager-7b222c78.js');
|
|
9
|
+
require('./ConfigStorage-9a53a42c.js');
|
|
10
|
+
require('./form-config-fetcher-3f430aee.js');
|
|
11
|
+
require('./DataFetcher-515bda03.js');
|
|
11
12
|
require('./PrintUtils-bcaeb82f.js');
|
|
12
13
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
13
14
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
@@ -17,12 +18,13 @@ require('./taskbar-elements-d9392685.js');
|
|
|
17
18
|
require('./index-0922807b.js');
|
|
18
19
|
require('./index-102ba62d.js');
|
|
19
20
|
require('./constants-35ddd366.js');
|
|
20
|
-
require('./pesquisa-fetcher-
|
|
21
|
+
require('./pesquisa-fetcher-916a935c.js');
|
|
22
|
+
require('./ISave-e91b70a7.js');
|
|
21
23
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
24
|
+
require('./dataunit-fetcher-7a08e4dd.js');
|
|
22
25
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
|
23
26
|
require('@sankhyalabs/core/dist/utils/SortingUtils');
|
|
24
27
|
require('./ResourceIDUtils-5ff86aa7.js');
|
|
25
|
-
require('./ISave-e91b70a7.js');
|
|
26
28
|
require('@sankhyalabs/core/dist/dataunit/DataUnit');
|
|
27
29
|
|
|
28
30
|
|
|
@@ -5,12 +5,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-f9e81701.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
7
|
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-0184ffbb.js');
|
|
8
|
-
const ConfigStorage = require('./ConfigStorage-
|
|
8
|
+
const ConfigStorage = require('./ConfigStorage-9a53a42c.js');
|
|
9
9
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
10
10
|
const index$1 = require('./index-c5771aba.js');
|
|
11
11
|
const index$2 = require('./index-102ba62d.js');
|
|
12
12
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
13
|
-
require('./form-config-fetcher-
|
|
13
|
+
require('./form-config-fetcher-3f430aee.js');
|
|
14
|
+
require('./DataFetcher-515bda03.js');
|
|
14
15
|
require('./PrintUtils-bcaeb82f.js');
|
|
15
16
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
16
17
|
|
|
@@ -7,24 +7,26 @@ const core = require('@sankhyalabs/core');
|
|
|
7
7
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
8
8
|
const constants = require('./constants-35ddd366.js');
|
|
9
9
|
const taskbarElements = require('./taskbar-elements-d9392685.js');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const IExporterProvider = require('./IExporterProvider-
|
|
10
|
+
require('./DataFetcher-515bda03.js');
|
|
11
|
+
require('./pesquisa-fetcher-916a935c.js');
|
|
12
|
+
const IExporterProvider = require('./IExporterProvider-e286ef6a.js');
|
|
13
13
|
const index = require('./index-0922807b.js');
|
|
14
14
|
require('./ISave-e91b70a7.js');
|
|
15
15
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
16
16
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
17
|
+
const dataunitFetcher = require('./dataunit-fetcher-7a08e4dd.js');
|
|
17
18
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
19
|
+
const formConfigFetcher = require('./form-config-fetcher-3f430aee.js');
|
|
18
20
|
const fieldSearch = require('./field-search-f56aa7d6.js');
|
|
19
|
-
const ConfigStorage = require('./ConfigStorage-
|
|
20
|
-
const SnkFormConfigManager = require('./SnkFormConfigManager-
|
|
21
|
+
const ConfigStorage = require('./ConfigStorage-9a53a42c.js');
|
|
22
|
+
const SnkFormConfigManager = require('./SnkFormConfigManager-7b222c78.js');
|
|
21
23
|
const RecordIDUtils = require('./RecordIDUtils-3735135c.js');
|
|
22
24
|
const index$2 = require('./index-102ba62d.js');
|
|
23
25
|
require('./PrintUtils-bcaeb82f.js');
|
|
26
|
+
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource');
|
|
24
27
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
|
25
28
|
require('@sankhyalabs/core/dist/utils/SortingUtils');
|
|
26
29
|
require('./ResourceIDUtils-5ff86aa7.js');
|
|
27
|
-
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource');
|
|
28
30
|
|
|
29
31
|
const REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "MORE_OPTIONS"];
|
|
30
32
|
const REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER", "MORE_OPTIONS"];
|
|
@@ -75,6 +77,11 @@ class ClientSideExporterProvider extends IExporterProvider.CommonsExporter {
|
|
|
75
77
|
if (fieldDescriptor.userInterface === core.UserInterface.SEARCH) {
|
|
76
78
|
return value.value;
|
|
77
79
|
}
|
|
80
|
+
if (column.customFormatter) {
|
|
81
|
+
const ezGridColumn = this.getColumnsState().find(columnState => column.id === columnState.name);
|
|
82
|
+
const formattedValue = column.customFormatter.format(value, ezGridColumn, record.__record__id__);
|
|
83
|
+
return formattedValue;
|
|
84
|
+
}
|
|
78
85
|
return this.dataUnit.getFormattedValue(id, value);
|
|
79
86
|
}
|
|
80
87
|
}
|
|
@@ -93,6 +100,8 @@ const SnkSimpleCrud = class {
|
|
|
93
100
|
this._multiSelectionListDataSource = new IExporterProvider.SnkMultiSelectionListDataSource();
|
|
94
101
|
this._keyDownHandler = (event) => this.keyDownListener(event);
|
|
95
102
|
this._formConfigFetcher = new formConfigFetcher.FormConfigFetcher();
|
|
103
|
+
this._customEditors = new Map();
|
|
104
|
+
this._customRenders = new Map();
|
|
96
105
|
this._taskbarProcessor = new fieldSearch.TaskbarProcessor({
|
|
97
106
|
"snkSimpleCrudTaskbar.form_regular": this.getButtons(false, [taskbarElements.TaskbarElement.GRID_MODE]),
|
|
98
107
|
"snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, [taskbarElements.TaskbarElement.DATA_EXPORTER, taskbarElements.TaskbarElement.FORM_MODE]),
|
|
@@ -113,6 +122,7 @@ const SnkSimpleCrud = class {
|
|
|
113
122
|
this.gridConfig = undefined;
|
|
114
123
|
this.formConfig = undefined;
|
|
115
124
|
this._formFields = [];
|
|
125
|
+
this._fieldsProps = new Map();
|
|
116
126
|
this.multipleSelection = undefined;
|
|
117
127
|
this.useCancelConfirm = true;
|
|
118
128
|
this.pageSize = 150;
|
|
@@ -126,6 +136,32 @@ const SnkSimpleCrud = class {
|
|
|
126
136
|
this.gridLegacyConfigName = undefined;
|
|
127
137
|
this.formLegacyConfigName = undefined;
|
|
128
138
|
this.ignoreReadOnlyFormFields = false;
|
|
139
|
+
this.autoLoad = undefined;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Registra um editor customizado para campos da grade e formulário.
|
|
143
|
+
*/
|
|
144
|
+
async addCustomEditor(fieldName, customEditor) {
|
|
145
|
+
if (this._grid && this._form) {
|
|
146
|
+
this._grid.addCustomEditor(fieldName, customEditor);
|
|
147
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const newCustomEditors = new Map(this._customEditors);
|
|
151
|
+
newCustomEditors.set(fieldName, customEditor);
|
|
152
|
+
this._customEditors = newCustomEditors;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Registra um render customizado para colunas da grid.
|
|
156
|
+
*/
|
|
157
|
+
async addGridCustomRender(fieldName, customRender) {
|
|
158
|
+
if (this._grid) {
|
|
159
|
+
this._grid.addGridCustomRender(fieldName, customRender);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const newCustomRenders = new Map(this._customRenders);
|
|
163
|
+
newCustomRenders.set(fieldName, customRender);
|
|
164
|
+
this._customRenders = newCustomRenders;
|
|
129
165
|
}
|
|
130
166
|
handleResourceIDChanged(newValue, oldValue) {
|
|
131
167
|
if (core.StringUtils.isEmpty(newValue)) {
|
|
@@ -137,6 +173,27 @@ const SnkSimpleCrud = class {
|
|
|
137
173
|
this.loadFormConfig(true);
|
|
138
174
|
this.loadGridConfig(true);
|
|
139
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Registra um formatador de valores para uma coluna da grid.
|
|
178
|
+
*/
|
|
179
|
+
async addCustomValueFormatter(columnName, customFormatter) {
|
|
180
|
+
this._grid.addCustomValueFormatter(columnName, customFormatter);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Remove o formatador de valores de uma coluna da grid.
|
|
184
|
+
*/
|
|
185
|
+
async removeCustomValueFormatter(columnName) {
|
|
186
|
+
this._grid.removeCustomValueFormatter(columnName);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
|
190
|
+
*/
|
|
191
|
+
async setFieldProp(fieldName, propName, value) {
|
|
192
|
+
const newCustomFieldProps = new Map(this._fieldsProps);
|
|
193
|
+
const currentProps = this._fieldsProps.get(fieldName);
|
|
194
|
+
newCustomFieldProps.set(fieldName, Object.assign(Object.assign({}, currentProps), { [propName]: value }));
|
|
195
|
+
this._fieldsProps = newCustomFieldProps;
|
|
196
|
+
}
|
|
140
197
|
getButtons(selected, extraButtons) {
|
|
141
198
|
return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
|
|
142
199
|
.concat(extraButtons));
|
|
@@ -191,9 +248,7 @@ const SnkSimpleCrud = class {
|
|
|
191
248
|
}
|
|
192
249
|
}
|
|
193
250
|
observeDataState(newValue, oldValue) {
|
|
194
|
-
|
|
195
|
-
this.dataStateChange.emit(newValue);
|
|
196
|
-
}
|
|
251
|
+
this.handleDataStateChange(newValue, oldValue);
|
|
197
252
|
}
|
|
198
253
|
async observeFormLegacy(newValue, oldValue) {
|
|
199
254
|
await this.handleUpdateFormLegacyConfig(newValue, oldValue);
|
|
@@ -201,6 +256,28 @@ const SnkSimpleCrud = class {
|
|
|
201
256
|
async observeGridLegacy(newValue, oldValue) {
|
|
202
257
|
await this.handleUpdateGridLegacyConfig(newValue, oldValue);
|
|
203
258
|
}
|
|
259
|
+
async handleDataStateChange(newValue, oldValue) {
|
|
260
|
+
if (core.ObjectUtils.objectToString(oldValue) != core.ObjectUtils.objectToString(newValue)) {
|
|
261
|
+
this.dataStateChange.emit(newValue);
|
|
262
|
+
}
|
|
263
|
+
await this.processRmPrecision();
|
|
264
|
+
}
|
|
265
|
+
async processRmPrecision() {
|
|
266
|
+
var _a, _b;
|
|
267
|
+
const fieldsWithRmPrecision = await this._snkDataUnit.getFieldsWithRmPrecision();
|
|
268
|
+
for (const field of fieldsWithRmPrecision || []) {
|
|
269
|
+
if (!field) {
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
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);
|
|
273
|
+
if (!rmPrecision && rmPrecision !== 0) {
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
await this.setFieldProp(field, 'precision', rmPrecision);
|
|
277
|
+
await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
|
|
278
|
+
}
|
|
279
|
+
this._rmPrecisionCustomValueFormatter.setDataState(this.dataState);
|
|
280
|
+
}
|
|
204
281
|
async handleUpdateGridLegacyConfig(newValue, oldValue) {
|
|
205
282
|
if (newValue == undefined || newValue == oldValue) {
|
|
206
283
|
return;
|
|
@@ -309,18 +386,56 @@ const SnkSimpleCrud = class {
|
|
|
309
386
|
this.loadGridConfig();
|
|
310
387
|
this.loadFormConfig();
|
|
311
388
|
}
|
|
389
|
+
componentDidRender() {
|
|
390
|
+
this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
|
|
391
|
+
this.addGridCustomValueFormattters();
|
|
392
|
+
this.setFieldsProps();
|
|
393
|
+
this.setCustomRenders();
|
|
394
|
+
this.setCustomEditors();
|
|
395
|
+
}
|
|
312
396
|
componentWillLoad() {
|
|
313
397
|
this.processMetadata();
|
|
314
398
|
this.onModeChange();
|
|
315
399
|
this.configDatasource();
|
|
400
|
+
this._rmPrecisionCustomValueFormatter = new IExporterProvider.RmPrecisionCustomValueFormatter();
|
|
316
401
|
}
|
|
317
402
|
componentDidLoad() {
|
|
318
403
|
utils.CSSVarsUtils.applyVarsGrid(this._element, this._grid);
|
|
319
404
|
}
|
|
405
|
+
setCustomRenders() {
|
|
406
|
+
if (!this._grid) {
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
for (const [fieldName, customRender] of this._customRenders) {
|
|
410
|
+
this._grid.addGridCustomRender(fieldName, customRender);
|
|
411
|
+
this._customRenders.delete(fieldName);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
setCustomEditors() {
|
|
415
|
+
if (!this._grid || !this._form) {
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
for (const [fieldName, customEditor] of this._customEditors) {
|
|
419
|
+
this._grid.addCustomEditor(fieldName, customEditor);
|
|
420
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
|
421
|
+
this._customEditors.delete(fieldName);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
320
424
|
configDatasource() {
|
|
321
425
|
this._multiSelectionListDataSource.setApplication(this.application);
|
|
322
426
|
this._multiSelectionListDataSource.setDataUnit(this.dataUnit);
|
|
323
427
|
}
|
|
428
|
+
setFieldsProps() {
|
|
429
|
+
if (!this._form) {
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
for (const [fieldName, props] of this._fieldsProps) {
|
|
433
|
+
for (const prop in props) {
|
|
434
|
+
this._form.setFieldProp(fieldName, prop, props[prop]);
|
|
435
|
+
}
|
|
436
|
+
this._fieldsProps.delete(fieldName);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
324
439
|
getTaskBarId() {
|
|
325
440
|
var _a, _b;
|
|
326
441
|
if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
|
|
@@ -334,7 +449,7 @@ const SnkSimpleCrud = class {
|
|
|
334
449
|
return this._currentViewMode === constants.VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
|
|
335
450
|
}
|
|
336
451
|
initInMemoryDataUnit() {
|
|
337
|
-
this._inMemoryLoader = new
|
|
452
|
+
this._inMemoryLoader = new dataunitFetcher.InMemoryLoader(this._metadata, undefined, { autoLoad: this.autoLoad });
|
|
338
453
|
this.dataUnit = this._inMemoryLoader.dataUnit;
|
|
339
454
|
this.dataUnitReady.emit(this.dataUnit);
|
|
340
455
|
}
|
|
@@ -373,12 +488,11 @@ const SnkSimpleCrud = class {
|
|
|
373
488
|
var _a;
|
|
374
489
|
(_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.close();
|
|
375
490
|
}
|
|
376
|
-
updateConfig() {
|
|
491
|
+
async updateConfig() {
|
|
377
492
|
if (this._formConfigManager == undefined) {
|
|
378
493
|
this._formConfigManager = new SnkFormConfigManager.SnkFormConfigManager(this.configName, this.resolveResourceID());
|
|
379
494
|
}
|
|
380
495
|
this._formConfigManager.setConfig(this.formConfig);
|
|
381
|
-
return;
|
|
382
496
|
}
|
|
383
497
|
processMetadata() {
|
|
384
498
|
const fieldsMetadataElem = this._element.querySelectorAll("snk-field-metadata");
|
|
@@ -410,6 +524,23 @@ const SnkSimpleCrud = class {
|
|
|
410
524
|
};
|
|
411
525
|
}
|
|
412
526
|
}
|
|
527
|
+
addGridCustomValueFormattters() {
|
|
528
|
+
var _a, _b, _c;
|
|
529
|
+
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);
|
|
530
|
+
if (!metadataFields) {
|
|
531
|
+
return;
|
|
532
|
+
}
|
|
533
|
+
const fieldsWithRmPrecision = [];
|
|
534
|
+
metadataFields.forEach((field) => {
|
|
535
|
+
var _a;
|
|
536
|
+
if (((_a = field.properties) === null || _a === void 0 ? void 0 : _a.rm_precision) && !fieldsWithRmPrecision.includes(field.name)) {
|
|
537
|
+
fieldsWithRmPrecision.push(field.name);
|
|
538
|
+
}
|
|
539
|
+
});
|
|
540
|
+
fieldsWithRmPrecision.forEach(field => {
|
|
541
|
+
this.addCustomValueFormatter(field, this._rmPrecisionCustomValueFormatter);
|
|
542
|
+
});
|
|
543
|
+
}
|
|
413
544
|
onDataStateChange(evt) {
|
|
414
545
|
this.dataState = Object.assign({}, evt.detail);
|
|
415
546
|
}
|
|
@@ -624,15 +755,23 @@ const SnkSimpleCrud = class {
|
|
|
624
755
|
}
|
|
625
756
|
return configFromManager;
|
|
626
757
|
}
|
|
758
|
+
updateFormConfig() {
|
|
759
|
+
const newConfig = Object.assign(Object.assign({}, this.formConfig), { fields: this.dataUnit.metadata.fields });
|
|
760
|
+
this.setFormConfig(newConfig, true);
|
|
761
|
+
if (this._formConfigManager == undefined) {
|
|
762
|
+
this._formConfigManager = new SnkFormConfigManager.SnkFormConfigManager(this.configName, this.resolveResourceID());
|
|
763
|
+
}
|
|
764
|
+
this._formConfigManager.setConfig(this.formConfig);
|
|
765
|
+
}
|
|
627
766
|
/* istanbul ignore next */
|
|
628
767
|
render() {
|
|
629
768
|
var _a;
|
|
630
769
|
if (this.dataUnit == undefined) {
|
|
631
770
|
return;
|
|
632
771
|
}
|
|
633
|
-
return (index$1.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(constants.VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, index$1.h("header", null, index$1.h("slot", { name: "snkSimpleCrudHeader" })), index$1.h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, index$1.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: index.PresentationMode.SECONDARY }, index$1.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), index$1.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index$1.h("stack-item", null, index$1.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(constants.VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(
|
|
772
|
+
return (index$1.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(constants.VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this) }, index$1.h("header", null, index$1.h("slot", { name: "snkSimpleCrudHeader" })), index$1.h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, index$1.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: index.PresentationMode.SECONDARY }, index$1.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), index$1.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index$1.h("stack-item", null, index$1.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(constants.VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(dataunitFetcher.InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
|
634
773
|
? undefined
|
|
635
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, index$1.h("div", { slot: "footer" }, index$1.h("slot", { name: "snkSimpleCrudFooter" })))), index$1.h("stack-item", null, index$1.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() && index$1.h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && index$1.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 })), index$1.h("div", { id: `${this._customContainerId}` }, index$1.h("slot", { name: "SnkConfigContainerSlot" }))), index$1.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index$1.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
|
774
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, index$1.h("div", { slot: "footer" }, index$1.h("slot", { name: "snkSimpleCrudFooter" })))), index$1.h("stack-item", null, index$1.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() && index$1.h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && index$1.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 })), index$1.h("div", { id: `${this._customContainerId}` }, index$1.h("slot", { name: "SnkConfigContainerSlot" }))), index$1.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index$1.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
|
636
775
|
}
|
|
637
776
|
get _element() { return index$1.getElement(this); }
|
|
638
777
|
static get watchers() { return {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"entries": [
|
|
3
3
|
"./components/snk-filter-bar/filter-item/snk-filter-item.js",
|
|
4
|
-
"./components/snk-application/snk-application.js",
|
|
5
4
|
"./components/snk-data-unit/snk-data-unit.js",
|
|
5
|
+
"./components/snk-application/snk-application.js",
|
|
6
6
|
"./components/snk-taskbar/snk-taskbar.js",
|
|
7
7
|
"./components/snk-filter-bar/filter-list/snk-filter-list.js",
|
|
8
8
|
"./components/snk-print-selector/snk-print-selector.js",
|
|
@@ -347,7 +347,7 @@ export class SnkApplication {
|
|
|
347
347
|
* Cria o DataUnit a partir do nome da entidade. É possível armazená-lo no cache
|
|
348
348
|
* passando o dataUnitName, assim, se mais de uma chamada for feita, o mesmo DataUnit será usado.
|
|
349
349
|
*/
|
|
350
|
-
async createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID) {
|
|
350
|
+
async createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID, options) {
|
|
351
351
|
if (resourceID == undefined) {
|
|
352
352
|
resourceID = this.applicationResourceID;
|
|
353
353
|
}
|
|
@@ -357,21 +357,29 @@ export class SnkApplication {
|
|
|
357
357
|
duPromisses.push(new PendingPromise(resolve, reject));
|
|
358
358
|
if (!waitingDu) {
|
|
359
359
|
const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, resourceID, parentDataUnit, configName);
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
}
|
|
371
|
-
}
|
|
360
|
+
if (options === null || options === void 0 ? void 0 : options.skipLoadMetadata) {
|
|
361
|
+
this.processResolveDataUnit(dataUnit, dataUnitName, duPromisses);
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
dataUnit.loadMetadata().then(() => {
|
|
365
|
+
this.processResolveDataUnit(dataUnit, dataUnitName, duPromisses);
|
|
366
|
+
}).catch(reason => {
|
|
367
|
+
while (duPromisses.length > 0) {
|
|
368
|
+
duPromisses.pop().reject(reason);
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
372
|
}
|
|
373
373
|
});
|
|
374
374
|
}
|
|
375
|
+
processResolveDataUnit(dataUnit, dataUnitName, duPromisses) {
|
|
376
|
+
if (dataUnitName) {
|
|
377
|
+
this.updateDataunitCache(undefined, dataUnitName, dataUnit);
|
|
378
|
+
}
|
|
379
|
+
while (duPromisses.length > 0) {
|
|
380
|
+
duPromisses.pop().resolve(dataUnit);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
375
383
|
/**
|
|
376
384
|
* Atualiza o cache de dataunits da aplicação.
|
|
377
385
|
* @param oldName - Nome do dataunit que está em cache.
|
|
@@ -387,14 +395,14 @@ export class SnkApplication {
|
|
|
387
395
|
/**
|
|
388
396
|
* Obtem um DataUnit do cache ou cria um caso ainda não tenha sido criado.
|
|
389
397
|
*/
|
|
390
|
-
async getDataUnit(entityName, dataUnitName, parentDataUnit, configName, resourceID) {
|
|
398
|
+
async getDataUnit(entityName, dataUnitName, parentDataUnit, configName, resourceID, options) {
|
|
391
399
|
return new Promise((resolve, reject) => {
|
|
392
400
|
const dataUnit = this._duCache.get(dataUnitName);
|
|
393
401
|
if (dataUnit) {
|
|
394
402
|
resolve(dataUnit);
|
|
395
403
|
}
|
|
396
404
|
else {
|
|
397
|
-
this.createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID).then(dataUnit => {
|
|
405
|
+
this.createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID, options).then(dataUnit => {
|
|
398
406
|
resolve(dataUnit);
|
|
399
407
|
}).catch(reason => reject(reason));
|
|
400
408
|
}
|
|
@@ -1678,7 +1686,7 @@ export class SnkApplication {
|
|
|
1678
1686
|
},
|
|
1679
1687
|
"createDataunit": {
|
|
1680
1688
|
"complexType": {
|
|
1681
|
-
"signature": "(entityName: string, dataUnitName?: string, parentDataUnit?: DataUnit, configName?: string, resourceID?: string) => Promise<DataUnit>",
|
|
1689
|
+
"signature": "(entityName: string, dataUnitName?: string, parentDataUnit?: DataUnit, configName?: string, resourceID?: string, options?: GetDataUnitOptions) => Promise<DataUnit>",
|
|
1682
1690
|
"parameters": [{
|
|
1683
1691
|
"tags": [],
|
|
1684
1692
|
"text": ""
|
|
@@ -1694,6 +1702,9 @@ export class SnkApplication {
|
|
|
1694
1702
|
}, {
|
|
1695
1703
|
"tags": [],
|
|
1696
1704
|
"text": ""
|
|
1705
|
+
}, {
|
|
1706
|
+
"tags": [],
|
|
1707
|
+
"text": ""
|
|
1697
1708
|
}],
|
|
1698
1709
|
"references": {
|
|
1699
1710
|
"Promise": {
|
|
@@ -1702,6 +1713,9 @@ export class SnkApplication {
|
|
|
1702
1713
|
"DataUnit": {
|
|
1703
1714
|
"location": "import",
|
|
1704
1715
|
"path": "@sankhyalabs/core"
|
|
1716
|
+
},
|
|
1717
|
+
"GetDataUnitOptions": {
|
|
1718
|
+
"location": "global"
|
|
1705
1719
|
}
|
|
1706
1720
|
},
|
|
1707
1721
|
"return": "Promise<DataUnit>"
|
|
@@ -1760,7 +1774,7 @@ export class SnkApplication {
|
|
|
1760
1774
|
},
|
|
1761
1775
|
"getDataUnit": {
|
|
1762
1776
|
"complexType": {
|
|
1763
|
-
"signature": "(entityName: string, dataUnitName: string, parentDataUnit?: DataUnit, configName?: string, resourceID?: string) => Promise<DataUnit>",
|
|
1777
|
+
"signature": "(entityName: string, dataUnitName: string, parentDataUnit?: DataUnit, configName?: string, resourceID?: string, options?: GetDataUnitOptions) => Promise<DataUnit>",
|
|
1764
1778
|
"parameters": [{
|
|
1765
1779
|
"tags": [],
|
|
1766
1780
|
"text": ""
|
|
@@ -1776,6 +1790,9 @@ export class SnkApplication {
|
|
|
1776
1790
|
}, {
|
|
1777
1791
|
"tags": [],
|
|
1778
1792
|
"text": ""
|
|
1793
|
+
}, {
|
|
1794
|
+
"tags": [],
|
|
1795
|
+
"text": ""
|
|
1779
1796
|
}],
|
|
1780
1797
|
"references": {
|
|
1781
1798
|
"Promise": {
|
|
@@ -1784,6 +1801,9 @@ export class SnkApplication {
|
|
|
1784
1801
|
"DataUnit": {
|
|
1785
1802
|
"location": "import",
|
|
1786
1803
|
"path": "@sankhyalabs/core"
|
|
1804
|
+
},
|
|
1805
|
+
"GetDataUnitOptions": {
|
|
1806
|
+
"location": "global"
|
|
1787
1807
|
}
|
|
1788
1808
|
},
|
|
1789
1809
|
"return": "Promise<DataUnit>"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|