@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,19 +1,21 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, f as forceUpdate, h, H as Host } from './index-a7d3d3f1.js';
|
|
2
2
|
import { Action } from '@sankhyalabs/core';
|
|
3
|
-
import { S as SnkFormConfigManager } from './SnkFormConfigManager-
|
|
3
|
+
import { S as SnkFormConfigManager } from './SnkFormConfigManager-3bdb3e1f.js';
|
|
4
4
|
import { FormMetadata, buildFormMetadata } from '@sankhyalabs/ezui/dist/collection/utils/form';
|
|
5
|
-
import './
|
|
6
|
-
import './pesquisa-fetcher-
|
|
5
|
+
import './DataFetcher-4b4b7beb.js';
|
|
6
|
+
import './pesquisa-fetcher-9cfab836.js';
|
|
7
7
|
import { P as PresentationMode } from './index-0ece87a6.js';
|
|
8
8
|
import './ISave-d8c8bc59.js';
|
|
9
9
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
10
10
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
11
|
+
import './dataunit-fetcher-f3fa35b9.js';
|
|
11
12
|
import './filter-item-type.enum-d45e026f.js';
|
|
13
|
+
import './form-config-fetcher-5d72aaf1.js';
|
|
12
14
|
import { T as TaskbarElement } from './taskbar-elements-ad766858.js';
|
|
13
15
|
import { d as VIEW_MODE } from './constants-8457af36.js';
|
|
14
|
-
import { S as SnkGuidesViewer } from './snk-guides-viewer-
|
|
15
|
-
import { S as SnkMessageBuilder } from './SnkMessageBuilder-
|
|
16
|
-
import './ConfigStorage-
|
|
16
|
+
import { S as SnkGuidesViewer } from './snk-guides-viewer-11cf8dc7.js';
|
|
17
|
+
import { S as SnkMessageBuilder } from './SnkMessageBuilder-3a767111.js';
|
|
18
|
+
import './ConfigStorage-174101b9.js';
|
|
17
19
|
import './PrintUtils-3e4ff0f5.js';
|
|
18
20
|
import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
|
|
19
21
|
import '@sankhyalabs/core/dist/utils/SortingUtils';
|
|
@@ -89,6 +91,8 @@ const SnkDetailView = class {
|
|
|
89
91
|
this.branchGuide = undefined;
|
|
90
92
|
this.canEdit = true;
|
|
91
93
|
this.taskbarCustomContainerId = undefined;
|
|
94
|
+
this.customEditors = undefined;
|
|
95
|
+
this.customRenders = undefined;
|
|
92
96
|
}
|
|
93
97
|
observeDataUnit(newDataUnit, oldDataUnit) {
|
|
94
98
|
newDataUnit === null || newDataUnit === void 0 ? void 0 : newDataUnit.subscribe(this.dataUnitActionHandler.bind(this));
|
|
@@ -156,10 +160,38 @@ const SnkDetailView = class {
|
|
|
156
160
|
this._snkGrid.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
157
161
|
}
|
|
158
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Registra um editor customizado para campos da grade e formulário.
|
|
165
|
+
*/
|
|
166
|
+
async addCustomEditor(fieldName, customEditor) {
|
|
167
|
+
var _a;
|
|
168
|
+
const detailContext = this.normalizeBranchGuideId((_a = this.branchGuide) === null || _a === void 0 ? void 0 : _a.id);
|
|
169
|
+
this._snkGrid.addCustomEditor(fieldName, customEditor, detailContext);
|
|
170
|
+
this._snkFormView.addCustomEditor(fieldName, customEditor, detailContext);
|
|
171
|
+
}
|
|
172
|
+
async observerPropsCustomEditor(newValue) {
|
|
173
|
+
for (const fieldName in newValue) {
|
|
174
|
+
await this.addCustomEditor(fieldName, newValue[fieldName]);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Registra um render customizado para colunas da grid.
|
|
179
|
+
*/
|
|
180
|
+
async addGridCustomRender(fieldName, customRender) {
|
|
181
|
+
var _a;
|
|
182
|
+
const detailContext = this.normalizeBranchGuideId((_a = this.branchGuide) === null || _a === void 0 ? void 0 : _a.id);
|
|
183
|
+
await this._snkGrid.addGridCustomRender(fieldName, customRender, detailContext);
|
|
184
|
+
}
|
|
159
185
|
onContentCardChanged(evt) {
|
|
160
186
|
SnkGuidesViewer.updateContentCard(evt.detail.formName, evt.detail.cardConfig, evt.detail.propertyChanged, this.formConfigManager).then(() => forceUpdate(this));
|
|
161
187
|
evt.stopPropagation();
|
|
162
188
|
}
|
|
189
|
+
async observeCustomRenders(newValue) {
|
|
190
|
+
for (const field in newValue) {
|
|
191
|
+
const customRender = newValue[field];
|
|
192
|
+
await this.addGridCustomRender(field, customRender);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
163
195
|
updateLabel() {
|
|
164
196
|
const guideItemPathSize = this.guideItemPath ? this.guideItemPath.length : 0;
|
|
165
197
|
if (guideItemPathSize > 0) {
|
|
@@ -262,6 +294,10 @@ const SnkDetailView = class {
|
|
|
262
294
|
this.messagesBuilder = new SnkMessageBuilder(this.entityName);
|
|
263
295
|
}
|
|
264
296
|
}
|
|
297
|
+
async componentDidLoad() {
|
|
298
|
+
await this.observerPropsCustomEditor(this.customEditors);
|
|
299
|
+
await this.observeCustomRenders(this.customRenders);
|
|
300
|
+
}
|
|
265
301
|
async dataUnitActionHandler(action) {
|
|
266
302
|
if (action.type === Action.FIELD_INVALIDATED) {
|
|
267
303
|
this.addErrorBadgeToBranchGuide();
|
|
@@ -271,6 +307,9 @@ const SnkDetailView = class {
|
|
|
271
307
|
this.branchGuide = Object.assign(Object.assign({}, this.branchGuide), { badge: 'error' });
|
|
272
308
|
this.snkDetailGuidesChange.emit(new GuideBuilder(this.branchGuide, this._formMetadata, this.dataUnit));
|
|
273
309
|
}
|
|
310
|
+
normalizeBranchGuideId(id) {
|
|
311
|
+
return id === null || id === void 0 ? void 0 : id.replace(/child\[(.*?)\]/g, '$1').replace(/::/g, '>');
|
|
312
|
+
}
|
|
274
313
|
render() {
|
|
275
314
|
this.updateLabel();
|
|
276
315
|
//const cardConfig: IFormCardConfig = this._cardsState?.get(this.selectedForm);
|
|
@@ -278,7 +317,9 @@ const SnkDetailView = class {
|
|
|
278
317
|
}
|
|
279
318
|
static get watchers() { return {
|
|
280
319
|
"dataUnit": ["observeDataUnit"],
|
|
281
|
-
"dataState": ["observerDataState"]
|
|
320
|
+
"dataState": ["observerDataState"],
|
|
321
|
+
"customEditors": ["observerPropsCustomEditor"],
|
|
322
|
+
"customRenders": ["observeCustomRenders"]
|
|
282
323
|
}; }
|
|
283
324
|
};
|
|
284
325
|
SnkDetailView.REGEX_FORM_ID = /__FORM:[^:]+/g;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a7d3d3f1.js';
|
|
2
2
|
import { DataType, StringUtils, ObjectUtils, ElementIDUtils, ErrorException, ApplicationContext } from '@sankhyalabs/core';
|
|
3
3
|
import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection';
|
|
4
|
-
import { C as ConfigStorage } from './ConfigStorage-
|
|
4
|
+
import { C as ConfigStorage } from './ConfigStorage-174101b9.js';
|
|
5
5
|
import { toString } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
|
|
6
6
|
import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
|
|
7
7
|
import { F as FilterOperand } from './index-ae591a44.js';
|
|
8
8
|
import { F as FilterNumberVariation } from './filterNumberVariation-8cee02ea.js';
|
|
9
9
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
10
10
|
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-e2b38ef7.js';
|
|
11
|
-
import './form-config-fetcher-
|
|
11
|
+
import './form-config-fetcher-5d72aaf1.js';
|
|
12
|
+
import './DataFetcher-4b4b7beb.js';
|
|
12
13
|
import './PrintUtils-3e4ff0f5.js';
|
|
13
14
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
14
15
|
|
|
@@ -281,6 +282,7 @@ const SnkFilterBar = class {
|
|
|
281
282
|
this.messagesBuilder = undefined;
|
|
282
283
|
this.disablePersonalizedFilter = undefined;
|
|
283
284
|
this.filterBarLegacyConfigName = undefined;
|
|
285
|
+
this.autoLoad = undefined;
|
|
284
286
|
this.allowDefault = undefined;
|
|
285
287
|
this.scrollerLocked = false;
|
|
286
288
|
this.showPersonalizedFilter = false;
|
|
@@ -427,7 +429,10 @@ const SnkFilterBar = class {
|
|
|
427
429
|
}
|
|
428
430
|
async doLoadData(forceReload = false) {
|
|
429
431
|
try {
|
|
430
|
-
if (this._firstLoad &&
|
|
432
|
+
if (this._firstLoad && this.autoLoad === false) {
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
if (this._firstLoad && !forceReload && this.autoLoad === undefined) {
|
|
431
436
|
let autoLoad = await this._application.getBooleanParam("global.carregar.registros.iniciar.tela");
|
|
432
437
|
if (!autoLoad) {
|
|
433
438
|
return;
|
|
@@ -2,9 +2,10 @@ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement
|
|
|
2
2
|
import { ElementIDUtils, ObjectUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
|
|
4
4
|
import { E as EPresentationMode } from './presentationMode-783bbf9d.js';
|
|
5
|
-
import { C as ConfigStorage } from './ConfigStorage-
|
|
5
|
+
import { C as ConfigStorage } from './ConfigStorage-174101b9.js';
|
|
6
6
|
import { F as FilterType } from './filter-type.enum-a80c1b6b.js';
|
|
7
|
-
import './form-config-fetcher-
|
|
7
|
+
import './form-config-fetcher-5d72aaf1.js';
|
|
8
|
+
import './DataFetcher-4b4b7beb.js';
|
|
8
9
|
import './PrintUtils-3e4ff0f5.js';
|
|
9
10
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
10
11
|
|
|
@@ -3,8 +3,9 @@ import { S as Sortable } from './Sortable-83960219.js';
|
|
|
3
3
|
import { ObjectUtils, ElementIDUtils, ArrayUtils, ApplicationContext } from '@sankhyalabs/core';
|
|
4
4
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
5
5
|
import { C as CONFIG_EVENTS, a as CONFIG_SORTABLE_EVENTS, T as TAB_NAMES, A as ACTION_CONFIG, D as DEFAULT_TYPE } from './constants-8457af36.js';
|
|
6
|
-
import {
|
|
6
|
+
import { U as UserConfigType } from './form-config-fetcher-5d72aaf1.js';
|
|
7
7
|
import { buildFormConfigFromDataUnit } from '@sankhyalabs/ezui/dist/collection/utils/form';
|
|
8
|
+
import './DataFetcher-4b4b7beb.js';
|
|
8
9
|
import './PrintUtils-3e4ff0f5.js';
|
|
9
10
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
10
11
|
|
|
@@ -10,6 +10,8 @@ const SnkFormView = class {
|
|
|
10
10
|
this.snkContentCardChanged = createEvent(this, "snkContentCardChanged", 7);
|
|
11
11
|
this.snkRequestClearFieldToFocus = createEvent(this, "snkRequestClearFieldToFocus", 7);
|
|
12
12
|
this.formItemsReady = createEvent(this, "formItemsReady", 7);
|
|
13
|
+
this._customEditors = new Map();
|
|
14
|
+
this._fieldProps = new Map();
|
|
13
15
|
this.levelPath = undefined;
|
|
14
16
|
this.label = undefined;
|
|
15
17
|
this.name = undefined;
|
|
@@ -23,12 +25,47 @@ const SnkFormView = class {
|
|
|
23
25
|
this.canFix = true;
|
|
24
26
|
this.recordsValidator = undefined;
|
|
25
27
|
this.fieldToFocus = undefined;
|
|
28
|
+
this.customEditors = undefined;
|
|
29
|
+
this.fieldsProps = undefined;
|
|
26
30
|
}
|
|
27
31
|
async showUp() {
|
|
28
32
|
if (this._formView) {
|
|
29
33
|
this._formView.showUp();
|
|
30
34
|
}
|
|
31
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Registra um editor customizado para campos da grade e formulário
|
|
38
|
+
*/
|
|
39
|
+
async addCustomEditor(fieldName, customEditor, detailContext) {
|
|
40
|
+
if (this._formView) {
|
|
41
|
+
this._formView.addCustomEditor(fieldName, customEditor, detailContext);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const newCustomEditors = new Map(this._customEditors);
|
|
45
|
+
newCustomEditors.set(fieldName, { customEditor, detailContext });
|
|
46
|
+
this._customEditors = newCustomEditors;
|
|
47
|
+
}
|
|
48
|
+
observePropsCustomEditor(newValue) {
|
|
49
|
+
for (const fieldName in newValue) {
|
|
50
|
+
this.addCustomEditor(fieldName, newValue[fieldName]);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
|
55
|
+
*/
|
|
56
|
+
async setFieldProp(fieldName, propName, value) {
|
|
57
|
+
const props = this._fieldProps.get(fieldName) || [];
|
|
58
|
+
this._fieldProps.set(fieldName, [...props, { propName, value }]);
|
|
59
|
+
}
|
|
60
|
+
async observeFieldsProps(newValue) {
|
|
61
|
+
for (const field in newValue) {
|
|
62
|
+
const fieldProps = newValue[field];
|
|
63
|
+
const propNames = Object.keys(fieldProps);
|
|
64
|
+
for (const propName of propNames) {
|
|
65
|
+
await this.setFieldProp(field, propName, fieldProps[propName]);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
32
69
|
changeFix() {
|
|
33
70
|
this.fixed = !this.fixed;
|
|
34
71
|
this.emitEvent("fixed");
|
|
@@ -87,7 +124,13 @@ const SnkFormView = class {
|
|
|
87
124
|
this._dataBinder.onDisconnectedCallback();
|
|
88
125
|
}
|
|
89
126
|
}
|
|
127
|
+
componentDidLoad() {
|
|
128
|
+
this.observePropsCustomEditor(this.customEditors);
|
|
129
|
+
this.observeFieldsProps(this.fieldsProps);
|
|
130
|
+
}
|
|
90
131
|
componentDidRender() {
|
|
132
|
+
this.setCustomEditors();
|
|
133
|
+
this.setFieldProps();
|
|
91
134
|
if (this.fieldToFocus == undefined) {
|
|
92
135
|
return;
|
|
93
136
|
}
|
|
@@ -99,6 +142,26 @@ const SnkFormView = class {
|
|
|
99
142
|
this.snkRequestClearFieldToFocus.emit();
|
|
100
143
|
});
|
|
101
144
|
}
|
|
145
|
+
setCustomEditors() {
|
|
146
|
+
if (!this._formView) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
for (const [fieldName, customEditorProps] of this._customEditors) {
|
|
150
|
+
this._formView.addCustomEditor(fieldName, customEditorProps.customEditor, customEditorProps.detailContext);
|
|
151
|
+
this._customEditors.delete(fieldName);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
setFieldProps() {
|
|
155
|
+
if (!this._formView) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
for (const [fieldName, propsToChange] of this._fieldProps) {
|
|
159
|
+
propsToChange.forEach(prop => {
|
|
160
|
+
this._formView.setFieldProp(fieldName, prop.propName, prop.value);
|
|
161
|
+
this._fieldProps.delete(fieldName);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
102
165
|
render() {
|
|
103
166
|
return (h(Host, { class: "ez-box__container" }, h("div", { class: "summary-header ez-flex ez-size-width--full" }, h("div", { class: "ez-flex ez-text ez-title--primary ez-text--bold ez-flex--justify-start ez-flex--align-items-center ez-col--sd-9" }, this.levelPath ? h("span", { class: "level-path" }, this.levelPath + " /") : undefined, this.label), h("div", { class: "ez-flex ez-flex--justify-end ez-col--sd-3" }, this.canFix &&
|
|
104
167
|
h("ez-button", { class: "ez-padding-left--medium", mode: "icon", size: "small", iconName: this.fixed ? "un-pin" : "push-pin", "data-element-id": ElementIDUtils.getInternalIDInfo("toggleFixed_ezFormCard"), onClick: () => this.changeFix(), title: this.fixed ? "Desafixar" : "Fixar" }), this.canExpand &&
|
|
@@ -108,6 +171,10 @@ const SnkFormView = class {
|
|
|
108
171
|
:
|
|
109
172
|
h("ez-form-view", { ref: ref => this._formView = ref, fields: this.fields, onEzContentReady: evt => this.bindFields(evt.detail), onFormItemsReady: (event) => this.handleFormItemsReady(event) })));
|
|
110
173
|
}
|
|
174
|
+
static get watchers() { return {
|
|
175
|
+
"customEditors": ["observePropsCustomEditor"],
|
|
176
|
+
"fieldsProps": ["observeFieldsProps"]
|
|
177
|
+
}; }
|
|
111
178
|
};
|
|
112
179
|
SnkFormView.style = snkFormViewCss;
|
|
113
180
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-a7d3d3f1.js';
|
|
2
2
|
import { ElementIDUtils } from '@sankhyalabs/core';
|
|
3
|
-
import { S as SnkFormConfigManager } from './SnkFormConfigManager-
|
|
3
|
+
import { S as SnkFormConfigManager } from './SnkFormConfigManager-3bdb3e1f.js';
|
|
4
4
|
import { R as ResourceIDUtils } from './ResourceIDUtils-a114189a.js';
|
|
5
|
-
import './ConfigStorage-
|
|
6
|
-
import './form-config-fetcher-
|
|
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';
|
|
@@ -16,6 +17,7 @@ const SnkForm = class {
|
|
|
16
17
|
this.exit = createEvent(this, "exit", 7);
|
|
17
18
|
this.actionClick = createEvent(this, "actionClick", 7);
|
|
18
19
|
this.formItemsReady = createEvent(this, "formItemsReady", 7);
|
|
20
|
+
this._customEditors = new Map();
|
|
19
21
|
this._dataUnit = undefined;
|
|
20
22
|
this._dataState = undefined;
|
|
21
23
|
this._showFormConfig = false;
|
|
@@ -38,6 +40,24 @@ const SnkForm = class {
|
|
|
38
40
|
async hideConfig() {
|
|
39
41
|
this._showFormConfig = false;
|
|
40
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Registra um editor customizado para campos da grade e formulário.
|
|
45
|
+
*/
|
|
46
|
+
async addCustomEditor(fieldName, customEditor) {
|
|
47
|
+
if (this._form) {
|
|
48
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const newCustomEditors = new Map(this._customEditors);
|
|
52
|
+
newCustomEditors.set(fieldName, customEditor);
|
|
53
|
+
this._customEditors = newCustomEditors;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
|
57
|
+
*/
|
|
58
|
+
async setFieldProp(fieldName, propName, value) {
|
|
59
|
+
await this._form.setFieldProp(fieldName, propName, value);
|
|
60
|
+
}
|
|
41
61
|
closeConfig() {
|
|
42
62
|
this.hideConfig();
|
|
43
63
|
}
|
|
@@ -45,6 +65,18 @@ const SnkForm = class {
|
|
|
45
65
|
const dataInfo = { dataUnit: this._dataUnit };
|
|
46
66
|
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
47
67
|
}
|
|
68
|
+
setCustomEditors() {
|
|
69
|
+
if (!this._form) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
for (const [fieldName, customEditor] of this._customEditors) {
|
|
73
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
|
74
|
+
this._customEditors.delete(fieldName);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async componentDidRender() {
|
|
78
|
+
this.setCustomEditors();
|
|
79
|
+
}
|
|
48
80
|
async componentWillLoad() {
|
|
49
81
|
let parent = this._element.parentElement;
|
|
50
82
|
while (parent) {
|
|
@@ -60,9 +92,7 @@ const SnkForm = class {
|
|
|
60
92
|
this._dataUnit = evt.detail;
|
|
61
93
|
});
|
|
62
94
|
}
|
|
63
|
-
this._snkDataUnit.addEventListener("dataStateChange", (
|
|
64
|
-
this._dataState = evt.detail;
|
|
65
|
-
});
|
|
95
|
+
this._snkDataUnit.addEventListener("dataStateChange", this.handleDataStateChange.bind(this));
|
|
66
96
|
break;
|
|
67
97
|
}
|
|
68
98
|
parent = parent.parentElement;
|
|
@@ -74,6 +104,22 @@ const SnkForm = class {
|
|
|
74
104
|
this.addFormLegacyConfig();
|
|
75
105
|
this._configManager.loadConfig();
|
|
76
106
|
}
|
|
107
|
+
async handleDataStateChange(evt) {
|
|
108
|
+
var _a;
|
|
109
|
+
this._dataState = evt.detail;
|
|
110
|
+
const fieldsWithRmPrecision = await this._snkDataUnit.getFieldsWithRmPrecision();
|
|
111
|
+
for (const field of fieldsWithRmPrecision || []) {
|
|
112
|
+
if (!field) {
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
const rmPrecision = (_a = this._dataState.rowMetadata) === null || _a === void 0 ? void 0 : _a.getProp('rm_precision', field);
|
|
116
|
+
if (!rmPrecision && rmPrecision !== 0) {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
await this.setFieldProp(field, 'precision', rmPrecision);
|
|
120
|
+
await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
77
123
|
addFormLegacyConfig() {
|
|
78
124
|
if (this.formLegacyConfigName) {
|
|
79
125
|
this._configManager.addFormLegacyConfig(this.formLegacyConfigName);
|
|
@@ -83,7 +129,7 @@ const SnkForm = class {
|
|
|
83
129
|
if (!this._dataUnit || !this._dataState) {
|
|
84
130
|
return undefined;
|
|
85
131
|
}
|
|
86
|
-
return (h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { key: "ezForm" + this._snkDataUnit.entityName, "data-element-id": "embedded", dataUnit: this._dataUnit, config: this._configManager.getConfig(this._dataState.insertionMode, this._dataUnit), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
|
|
132
|
+
return (h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { ref: (ref) => this._form = ref, key: "ezForm" + this._snkDataUnit.entityName, "data-element-id": "embedded", dataUnit: this._dataUnit, config: this._configManager.getConfig(this._dataState.insertionMode, this._dataUnit), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
|
|
87
133
|
h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this._dataUnit, configManager: this._configManager, onConfigClose: () => this.closeConfig() })))));
|
|
88
134
|
}
|
|
89
135
|
get _element() { return getElement(this); }
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, F as Fragment, g as getElement } from './index-a7d3d3f1.js';
|
|
2
|
-
import { ElementIDUtils, ApplicationContext, StringUtils } from '@sankhyalabs/core';
|
|
2
|
+
import { Action, ElementIDUtils, ApplicationContext, StringUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { T as TaskbarElement } from './taskbar-elements-ad766858.js';
|
|
4
|
-
import { C as ConfigStorage } from './ConfigStorage-
|
|
4
|
+
import { C as ConfigStorage } from './ConfigStorage-174101b9.js';
|
|
5
5
|
import { P as PresentationMode } from './index-0ece87a6.js';
|
|
6
6
|
import { T as TaskbarProcessor, o as openFieldSearch, b as buildFieldSearch } from './field-search-efbe307f.js';
|
|
7
7
|
import { s as store } from './index-bdf75557.js';
|
|
8
|
-
import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, a as CrudUtils } from './IExporterProvider-
|
|
8
|
+
import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, a as CrudUtils, R as RmPrecisionCustomValueFormatter } from './IExporterProvider-cf5a56ee.js';
|
|
9
9
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
|
10
|
-
import './
|
|
11
|
-
import './pesquisa-fetcher-
|
|
10
|
+
import './DataFetcher-4b4b7beb.js';
|
|
11
|
+
import './pesquisa-fetcher-9cfab836.js';
|
|
12
12
|
import './ISave-d8c8bc59.js';
|
|
13
13
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
14
14
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
15
|
+
import './dataunit-fetcher-f3fa35b9.js';
|
|
15
16
|
import './filter-item-type.enum-d45e026f.js';
|
|
17
|
+
import './form-config-fetcher-5d72aaf1.js';
|
|
16
18
|
import { g as getSelectedIDs } from './RecordIDUtils-87d02110.js';
|
|
17
19
|
import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
|
|
18
20
|
import './PrintUtils-3e4ff0f5.js';
|
|
@@ -81,6 +83,8 @@ const SnkGrid = class {
|
|
|
81
83
|
registerInstance(this, hostRef);
|
|
82
84
|
this.actionClick = createEvent(this, "actionClick", 7);
|
|
83
85
|
this.gridDoubleClick = createEvent(this, "gridDoubleClick", 7);
|
|
86
|
+
this._customEditors = new Map();
|
|
87
|
+
this._customRenders = new Map();
|
|
84
88
|
this._topTaskbarProcessor = new TaskbarProcessor({
|
|
85
89
|
"snkGridTopTaskbar.regular": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
|
|
86
90
|
"snkGridTopTaskbar.regular.secondary": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
|
|
@@ -100,6 +104,14 @@ const SnkGrid = class {
|
|
|
100
104
|
"snkGridHeaderTaskbar.singleTaskbar.detail.selected": ["UPDATE", "ATTACH", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "FORM_MODE", "CONFIGURATOR", "REFRESH"],
|
|
101
105
|
"snkGridHeaderTaskbar.singleTaskbar.finish_edition": ["CANCEL", "SAVE"]
|
|
102
106
|
});
|
|
107
|
+
this.dataUnitInterceptor = {
|
|
108
|
+
interceptAction: async (action) => {
|
|
109
|
+
if (action.type === Action.METADATA_LOADED) {
|
|
110
|
+
return await this.interceptMetadataLoaded(action);
|
|
111
|
+
}
|
|
112
|
+
return action;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
103
115
|
this._dataUnit = undefined;
|
|
104
116
|
this._dataState = undefined;
|
|
105
117
|
this._gridConfig = undefined;
|
|
@@ -126,6 +138,7 @@ const SnkGrid = class {
|
|
|
126
138
|
this.disablePersonalizedFilter = undefined;
|
|
127
139
|
this.gridLegacyConfigName = undefined;
|
|
128
140
|
this.filterBarLegacyConfigName = undefined;
|
|
141
|
+
this.autoLoad = undefined;
|
|
129
142
|
}
|
|
130
143
|
/**
|
|
131
144
|
* Exibe a janela de configurações da grade.
|
|
@@ -170,6 +183,42 @@ const SnkGrid = class {
|
|
|
170
183
|
async findColumn() {
|
|
171
184
|
await openFieldSearch(this._moreOptions, this._columnSearch);
|
|
172
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Registra um editor customizado para campos da grade e formulário
|
|
188
|
+
*/
|
|
189
|
+
async addCustomEditor(fieldName, customEditor, detailContext) {
|
|
190
|
+
if (this._grid) {
|
|
191
|
+
this._grid.addCustomEditor(fieldName, customEditor, detailContext);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const newCustomEditors = new Map(this._customEditors);
|
|
195
|
+
newCustomEditors.set(fieldName, { customEditor, detailContext });
|
|
196
|
+
this._customEditors = newCustomEditors;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Registra um render customizado para colunas da grid.
|
|
200
|
+
*/
|
|
201
|
+
async addGridCustomRender(fieldName, customRender, detailContext) {
|
|
202
|
+
if (this._grid) {
|
|
203
|
+
this._grid.addGridCustomRender(fieldName, customRender, detailContext);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
const newCustomRenders = new Map(this._customRenders);
|
|
207
|
+
newCustomRenders.set(fieldName, { customRender, detailContext });
|
|
208
|
+
this._customRenders = newCustomRenders;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Registra um formatador de valores para uma coluna da grid.
|
|
212
|
+
*/
|
|
213
|
+
async addCustomValueFormatter(columnName, customFormatter) {
|
|
214
|
+
this._grid.addCustomValueFormatter(columnName, customFormatter);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Remove o formatador de valores de uma coluna da grid.
|
|
218
|
+
*/
|
|
219
|
+
async removeCustomValueFormatter(columnName) {
|
|
220
|
+
this._grid.removeCustomValueFormatter(columnName);
|
|
221
|
+
}
|
|
173
222
|
async handleGridLegacyConfigName(newLegacyConfig, oldLegacyConfig) {
|
|
174
223
|
if (!newLegacyConfig) {
|
|
175
224
|
return;
|
|
@@ -232,7 +281,23 @@ const SnkGrid = class {
|
|
|
232
281
|
const dataInfo = { dataUnit: this._dataUnit };
|
|
233
282
|
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
234
283
|
}
|
|
235
|
-
|
|
284
|
+
loadGridCustomFormatters(fields) {
|
|
285
|
+
if (!fields || !this._grid) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
fields.forEach((field) => {
|
|
289
|
+
var _a;
|
|
290
|
+
if ((_a = field.properties) === null || _a === void 0 ? void 0 : _a.rm_precision) {
|
|
291
|
+
this.addCustomValueFormatter(field.name, this._rmPrecisionCustomValueFormatter);
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
async interceptMetadataLoaded(action) {
|
|
296
|
+
this.loadGridCustomFormatters(action.payload.fields);
|
|
297
|
+
return action;
|
|
298
|
+
}
|
|
299
|
+
finishLoading() {
|
|
300
|
+
this._dataUnit.addInterceptor(this.dataUnitInterceptor);
|
|
236
301
|
CrudUtils.assertDefaultSorting(this._gridConfig, this._dataUnit);
|
|
237
302
|
this.addElementID();
|
|
238
303
|
if (this.columnFilterDataSource != undefined) {
|
|
@@ -240,6 +305,24 @@ const SnkGrid = class {
|
|
|
240
305
|
this.columnFilterDataSource.setDataUnit(this._dataUnit);
|
|
241
306
|
}
|
|
242
307
|
}
|
|
308
|
+
setCustomRenders() {
|
|
309
|
+
if (!this._grid) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
for (const [fieldName, customRenderProps] of this._customRenders) {
|
|
313
|
+
this._grid.addGridCustomRender(fieldName, customRenderProps.customRender, customRenderProps.detailContext);
|
|
314
|
+
this._customRenders.delete(fieldName);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
setCustomEditors() {
|
|
318
|
+
if (!this._grid) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
for (const [fieldName, customEditorProps] of this._customEditors) {
|
|
322
|
+
this._grid.addCustomEditor(fieldName, customEditorProps.customEditor, customEditorProps.detailContext);
|
|
323
|
+
this._customEditors.delete(fieldName);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
243
326
|
componentWillLoad() {
|
|
244
327
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
245
328
|
//TODO: substituir pelo metodo nativo closest
|
|
@@ -251,17 +334,15 @@ const SnkGrid = class {
|
|
|
251
334
|
if (!this._dataUnit) {
|
|
252
335
|
this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
|
253
336
|
this._dataUnit = evt.detail;
|
|
254
|
-
this.
|
|
337
|
+
this.finishLoading();
|
|
255
338
|
});
|
|
256
339
|
}
|
|
257
340
|
else {
|
|
258
|
-
this.
|
|
341
|
+
this.finishLoading();
|
|
259
342
|
}
|
|
260
343
|
if (!this.messagesBuilder)
|
|
261
344
|
this.messagesBuilder = this._snkDataUnit.messagesBuilder;
|
|
262
|
-
this._snkDataUnit.addEventListener("dataStateChange", (
|
|
263
|
-
this._dataState = evt.detail;
|
|
264
|
-
});
|
|
345
|
+
this._snkDataUnit.addEventListener("dataStateChange", this.handleDataStateChange.bind(this));
|
|
265
346
|
this._snkDataUnit.addEventListener("cancelEdition", () => {
|
|
266
347
|
var _a;
|
|
267
348
|
if ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.recordsIsEmpty) {
|
|
@@ -272,9 +353,20 @@ const SnkGrid = class {
|
|
|
272
353
|
}
|
|
273
354
|
parent = parent.parentElement;
|
|
274
355
|
}
|
|
356
|
+
this._rmPrecisionCustomValueFormatter = new RmPrecisionCustomValueFormatter();
|
|
275
357
|
this.addGridLegacyConfigName();
|
|
276
358
|
this.loadConfig();
|
|
277
359
|
}
|
|
360
|
+
componentDidRender() {
|
|
361
|
+
this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
|
|
362
|
+
this.loadGridCustomFormatters(this._dataUnit.metadata.fields);
|
|
363
|
+
this.setCustomRenders();
|
|
364
|
+
this.setCustomEditors();
|
|
365
|
+
}
|
|
366
|
+
async handleDataStateChange(evt) {
|
|
367
|
+
this._dataState = evt.detail;
|
|
368
|
+
this._rmPrecisionCustomValueFormatter.setDataState(this._dataState);
|
|
369
|
+
}
|
|
278
370
|
getHeaderDisabledButtons() {
|
|
279
371
|
var _a;
|
|
280
372
|
const disabledButtons = [];
|
|
@@ -387,7 +479,7 @@ const SnkGrid = class {
|
|
|
387
479
|
return undefined;
|
|
388
480
|
}
|
|
389
481
|
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, this._showSnkFilterBar &&
|
|
390
|
-
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, 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.resourceID }))));
|
|
482
|
+
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, 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.resourceID }))));
|
|
391
483
|
}
|
|
392
484
|
get _element() { return getElement(this); }
|
|
393
485
|
static get watchers() { return {
|