@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-47941.0 → 0.0.0-bugfix-dev-59880.1
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/{IExporterProvider-d3a3ccd1.js → IExporterProvider-e286ef6a.js} +3 -3
- package/dist/cjs/{SnkFormConfigManager-dda10d75.js → SnkFormConfigManager-7b222c78.js} +2 -2
- package/dist/cjs/{dataunit-fetcher-e2109392.js → dataunit-fetcher-7a08e4dd.js} +6 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +1 -1
- package/dist/cjs/snk-attach.cjs.entry.js +16 -21
- package/dist/cjs/snk-crud.cjs.entry.js +54 -3
- package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
- package/dist/cjs/{snk-data-unit-dee38ccd.js → snk-data-unit-3718477f.js} +79 -23
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +43 -4
- package/dist/cjs/snk-filter-bar.cjs.entry.js +5 -1
- package/dist/cjs/snk-form-view.cjs.entry.js +31 -0
- package/dist/cjs/snk-form.cjs.entry.js +28 -3
- package/dist/cjs/snk-grid.cjs.entry.js +50 -3
- package/dist/cjs/{snk-guides-viewer-af4a6ae5.js → snk-guides-viewer-66dd6949.js} +21 -5
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -3
- package/dist/cjs/snk-simple-crud.cjs.entry.js +64 -7
- package/dist/collection/components/snk-attach/snk-attach.js +21 -29
- 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 +122 -2
- 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 +82 -0
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +73 -3
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +1 -1
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +98 -23
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +22 -1
- package/dist/collection/components/snk-form/snk-form.js +53 -2
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +2 -2
- package/dist/collection/components/snk-grid/snk-grid.js +123 -1
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +130 -4
- package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +1 -1
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +6 -2
- package/dist/collection/lib/dataUnit/interfaces/InMemoryLoaderConfig.js +1 -0
- package/dist/components/IExporterProvider.js +2 -2
- package/dist/components/SnkFormConfigManager.js +2 -2
- package/dist/components/dataunit-fetcher.js +6 -2
- package/dist/components/snk-attach2.js +15 -20
- package/dist/components/snk-crud.js +56 -2
- package/dist/components/snk-data-unit2.js +80 -23
- package/dist/components/snk-detail-view2.js +68 -5
- package/dist/components/snk-filter-bar2.js +6 -1
- package/dist/components/snk-form-view2.js +33 -0
- package/dist/components/snk-form.js +28 -2
- package/dist/components/snk-grid2.js +51 -1
- package/dist/components/snk-simple-crud2.js +64 -4
- package/dist/esm/{IExporterProvider-640e1f6b.js → IExporterProvider-cf5a56ee.js} +3 -3
- package/dist/esm/{SnkFormConfigManager-87bd8082.js → SnkFormConfigManager-3bdb3e1f.js} +2 -2
- package/dist/esm/{dataunit-fetcher-87ecba4a.js → dataunit-fetcher-f3fa35b9.js} +6 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +1 -1
- package/dist/esm/snk-application.entry.js +1 -1
- package/dist/esm/snk-attach.entry.js +16 -21
- package/dist/esm/snk-crud.entry.js +54 -3
- package/dist/esm/snk-data-exporter.entry.js +2 -2
- package/dist/esm/{snk-data-unit-1132e40b.js → snk-data-unit-8d6afa43.js} +80 -24
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +43 -4
- package/dist/esm/snk-filter-bar.entry.js +5 -1
- package/dist/esm/snk-form-view.entry.js +31 -0
- package/dist/esm/snk-form.entry.js +28 -3
- package/dist/esm/snk-grid.entry.js +50 -3
- package/dist/esm/{snk-guides-viewer-359e39a7.js → snk-guides-viewer-11cf8dc7.js} +21 -5
- package/dist/esm/snk-guides-viewer.entry.js +3 -3
- package/dist/esm/snk-simple-crud.entry.js +64 -7
- 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-2cc2d8fd.entry.js +1 -0
- package/dist/sankhyablocks/{p-66a31d30.entry.js → p-3e4c2cfe.entry.js} +1 -1
- package/dist/sankhyablocks/{p-9c70f37e.entry.js → p-4a8a149d.entry.js} +1 -1
- package/dist/sankhyablocks/p-50e72d6c.js +1 -0
- package/dist/sankhyablocks/p-5bd78e4c.entry.js +1 -0
- package/dist/sankhyablocks/{p-b11921ca.entry.js → p-8171e586.entry.js} +1 -1
- package/dist/sankhyablocks/{p-d29a252c.js → p-a97060b0.js} +1 -1
- package/dist/sankhyablocks/p-b27114c4.js +1 -0
- package/dist/sankhyablocks/{p-83950924.entry.js → p-b643f746.entry.js} +1 -1
- package/dist/sankhyablocks/{p-d799aa7f.entry.js → p-b68918fc.entry.js} +1 -1
- package/dist/sankhyablocks/p-da7c81d6.entry.js +1 -0
- package/dist/sankhyablocks/{p-da6e3dcf.entry.js → p-e238279a.entry.js} +1 -1
- package/dist/sankhyablocks/p-eae66367.js +1 -0
- package/dist/sankhyablocks/{p-08fee6e8.js → p-fde91811.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-attach/snk-attach.d.ts +9 -9
- package/dist/types/components/snk-crud/interfaces/PropsCustomEditor.d.ts +4 -0
- package/dist/types/components/snk-crud/interfaces/PropsCustomRender.d.ts +4 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +18 -0
- 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 +15 -2
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +13 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +16 -1
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
- package/dist/types/components/snk-form/snk-form.d.ts +8 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +23 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +18 -2
- package/dist/types/components.d.ts +112 -0
- package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +2 -1
- package/dist/types/lib/dataUnit/interfaces/InMemoryLoaderConfig.d.ts +3 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-0bcc6e83.js +0 -1
- package/dist/sankhyablocks/p-2eb90860.js +0 -1
- package/dist/sankhyablocks/p-33f695d6.entry.js +0 -1
- package/dist/sankhyablocks/p-3519a984.entry.js +0 -1
- package/dist/sankhyablocks/p-5c8a9e27.entry.js +0 -1
- package/dist/sankhyablocks/p-7ecaaea2.entry.js +0 -1
- package/dist/sankhyablocks/p-931343a1.entry.js +0 -1
- package/dist/sankhyablocks/p-cb91634d.js +0 -1
- package/dist/sankhyablocks/p-cf9d2d1e.entry.js +0 -1
- package/dist/sankhyablocks/p-f72e8835.entry.js +0 -1
|
@@ -53,6 +53,8 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
53
53
|
this.formItemsReady = createEvent(this, "formItemsReady", 7);
|
|
54
54
|
this._keyDownHandler = async (event) => this.keyDownListener(event);
|
|
55
55
|
this._viewHistory = [];
|
|
56
|
+
this._customEditors = new Map();
|
|
57
|
+
this._customRenders = new Map();
|
|
56
58
|
this._dataUnit = undefined;
|
|
57
59
|
this._dataState = undefined;
|
|
58
60
|
this.attachmentRegisterKey = undefined;
|
|
@@ -75,6 +77,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
75
77
|
this.filterBarLegacyConfigName = undefined;
|
|
76
78
|
this.formLegacyConfigName = undefined;
|
|
77
79
|
this.disablePersonalizedFilter = undefined;
|
|
80
|
+
this.autoLoad = undefined;
|
|
78
81
|
this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
|
|
79
82
|
}
|
|
80
83
|
/**
|
|
@@ -110,6 +113,31 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
110
113
|
async getFilterBar() {
|
|
111
114
|
return await this._snkGrid.getFilterBar();
|
|
112
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Registra um editor customizado para campos da grade e formulário.
|
|
118
|
+
*/
|
|
119
|
+
async addCustomEditor(fieldName, customEditor) {
|
|
120
|
+
if (this._guidesViewer && this._snkGrid) {
|
|
121
|
+
this._guidesViewer.addCustomEditor(fieldName, customEditor);
|
|
122
|
+
this._snkGrid.addCustomEditor(fieldName, customEditor);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const newCustomEditors = new Map(this._customEditors);
|
|
126
|
+
newCustomEditors.set(fieldName, customEditor);
|
|
127
|
+
this._customEditors = newCustomEditors;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Registra um render customizado para colunas da grid.
|
|
131
|
+
*/
|
|
132
|
+
async addGridCustomRender(fieldName, customRender) {
|
|
133
|
+
if (this._snkGrid) {
|
|
134
|
+
this._snkGrid.addGridCustomRender(fieldName, customRender);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const newCustomRenders = new Map(this._customRenders);
|
|
138
|
+
newCustomRenders.set(fieldName, customRender);
|
|
139
|
+
this._customRenders = newCustomRenders;
|
|
140
|
+
}
|
|
113
141
|
/**
|
|
114
142
|
* Registra um formatador de valores para uma coluna da grid.
|
|
115
143
|
*/
|
|
@@ -181,6 +209,29 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
181
209
|
const joinedPrimaryKeys = recordCriteria.map(({ value }) => value).join('_');
|
|
182
210
|
return joinedPrimaryKeys;
|
|
183
211
|
}
|
|
212
|
+
setCustomRenders() {
|
|
213
|
+
if (!this._snkGrid) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
for (const [fieldName, customRender] of this._customRenders) {
|
|
217
|
+
this._snkGrid.addGridCustomRender(fieldName, customRender);
|
|
218
|
+
this._customRenders.delete(fieldName);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
setCustomEditors() {
|
|
222
|
+
if (!this._snkGrid || !this._guidesViewer) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
for (const [fieldName, customEditor] of this._customEditors) {
|
|
226
|
+
this._guidesViewer.addCustomEditor(fieldName, customEditor);
|
|
227
|
+
this._snkGrid.addCustomEditor(fieldName, customEditor);
|
|
228
|
+
this._customEditors.delete(fieldName);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
componentDidRender() {
|
|
232
|
+
this.setCustomRenders();
|
|
233
|
+
this.setCustomEditors();
|
|
234
|
+
}
|
|
184
235
|
componentWillLoad() {
|
|
185
236
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
186
237
|
let parent = this._element.parentElement;
|
|
@@ -231,7 +282,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
231
282
|
continue;
|
|
232
283
|
}
|
|
233
284
|
const rmPrecision = (_a = this._dataState.rowMetadata) === null || _a === void 0 ? void 0 : _a.getProp('rm_precision', field);
|
|
234
|
-
if (!rmPrecision) {
|
|
285
|
+
if (!rmPrecision && rmPrecision !== 0) {
|
|
235
286
|
continue;
|
|
236
287
|
}
|
|
237
288
|
await this.setFieldProp(field, 'precision', rmPrecision);
|
|
@@ -357,7 +408,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
357
408
|
return;
|
|
358
409
|
}
|
|
359
410
|
this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
|
|
360
|
-
return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
|
|
411
|
+
return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
|
|
361
412
|
}
|
|
362
413
|
get _element() { return this; }
|
|
363
414
|
static get watchers() { return {
|
|
@@ -381,6 +432,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
381
432
|
"filterBarLegacyConfigName": [1, "filter-bar-legacy-config-name"],
|
|
382
433
|
"formLegacyConfigName": [1, "form-legacy-config-name"],
|
|
383
434
|
"disablePersonalizedFilter": [4, "disable-personalized-filter"],
|
|
435
|
+
"autoLoad": [4, "auto-load"],
|
|
384
436
|
"_dataUnit": [32],
|
|
385
437
|
"_dataState": [32],
|
|
386
438
|
"attachmentRegisterKey": [32],
|
|
@@ -393,6 +445,8 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
393
445
|
"closeConfigurator": [64],
|
|
394
446
|
"reloadFilterBar": [64],
|
|
395
447
|
"getFilterBar": [64],
|
|
448
|
+
"addCustomEditor": [64],
|
|
449
|
+
"addGridCustomRender": [64],
|
|
396
450
|
"addCustomValueFormatter": [64],
|
|
397
451
|
"removeCustomValueFormatter": [64],
|
|
398
452
|
"setFieldProp": [64]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import { JSUtils, DataType, Action, ObjectUtils, DataUnitAction, ApplicationContext } from '@sankhyalabs/core';
|
|
2
|
+
import { JSUtils, DataType, Action, ObjectUtils, DataUnitAction, StringUtils, ApplicationContext } from '@sankhyalabs/core';
|
|
3
3
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
4
|
import { O as OperationMap, S as SnkMessageBuilder } from './SnkMessageBuilder.js';
|
|
5
5
|
import { g as getRecordValue, d as DatasetStrategy } from './dataunit-fetcher.js';
|
|
@@ -49,6 +49,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
49
49
|
this.dataStateChange = createEvent(this, "dataStateChange", 3);
|
|
50
50
|
this.dataUnitReady = createEvent(this, "dataUnitReady", 3);
|
|
51
51
|
this.messagesBuilderUpdated = createEvent(this, "messagesBuilderUpdated", 3);
|
|
52
|
+
this.dataUnitFieldsHidded = createEvent(this, "dataUnitFieldsHidded", 7);
|
|
52
53
|
this.insertionMode = createEvent(this, "insertionMode", 3);
|
|
53
54
|
this.cancelEdition = createEvent(this, "cancelEdition", 3);
|
|
54
55
|
this._onDataUnitResolve = [];
|
|
@@ -57,6 +58,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
57
58
|
this._fieldsWithRmPrecision = [];
|
|
58
59
|
this._metadataByRow = new Map();
|
|
59
60
|
this._rowMetadataCache = new Map();
|
|
61
|
+
this.REGEX_DATAUNIT_NAME = /dd:\/\/(.+?)\//;
|
|
60
62
|
this._dataUnitObserver = async (action) => {
|
|
61
63
|
const duState = this.buildDataState(action.type);
|
|
62
64
|
this.dataState = duState;
|
|
@@ -77,6 +79,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
77
79
|
break;
|
|
78
80
|
}
|
|
79
81
|
};
|
|
82
|
+
this.fieldsToLink = [];
|
|
80
83
|
this.dataState = undefined;
|
|
81
84
|
this.messagesBuilder = undefined;
|
|
82
85
|
this.dataUnitName = undefined;
|
|
@@ -266,23 +269,14 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
266
269
|
ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenInsert"));
|
|
267
270
|
return;
|
|
268
271
|
}
|
|
269
|
-
return action;
|
|
272
|
+
return new DataUnitAction(Action.RECORDS_ADDED, this.handleLinksWithParent(action.payload));
|
|
270
273
|
}
|
|
271
274
|
interceptRecordsCopied(action) {
|
|
272
275
|
if (!this.isAllowed("CLONE")) {
|
|
273
276
|
ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenClone"));
|
|
274
277
|
return;
|
|
275
278
|
}
|
|
276
|
-
|
|
277
|
-
if (cleanFields.length > 0) {
|
|
278
|
-
const records = action.payload;
|
|
279
|
-
action = new DataUnitAction(Action.RECORDS_COPIED, records.map(record => {
|
|
280
|
-
const newRecord = Object.assign({}, record);
|
|
281
|
-
cleanFields.forEach(fieldName => delete newRecord[fieldName]);
|
|
282
|
-
return newRecord;
|
|
283
|
-
}));
|
|
284
|
-
}
|
|
285
|
-
return action;
|
|
279
|
+
return new DataUnitAction(Action.RECORDS_COPIED, this.handleRecordsCopied(action.payload));
|
|
286
280
|
}
|
|
287
281
|
async interceptDataChange(action) {
|
|
288
282
|
if (this.isAllowed("UPDATE")) {
|
|
@@ -364,7 +358,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
364
358
|
interceptMetadataLoaded(action) {
|
|
365
359
|
this.fillFieldsWithRmp(action.payload);
|
|
366
360
|
this.fillFieldsWithRmPrecision(action.payload);
|
|
367
|
-
return action;
|
|
361
|
+
return new DataUnitAction(Action.METADATA_LOADED, this.handleDULinksOnMetadataLoaded(action.payload));
|
|
368
362
|
}
|
|
369
363
|
async interceptAction(action) {
|
|
370
364
|
switch (action.type) {
|
|
@@ -423,6 +417,47 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
423
417
|
return Object.assign({}, response._rmd);
|
|
424
418
|
}
|
|
425
419
|
}
|
|
420
|
+
handleDULinksOnMetadataLoaded(payload) {
|
|
421
|
+
const metadata = Object.assign({}, payload);
|
|
422
|
+
this.processLinks(metadata);
|
|
423
|
+
return metadata;
|
|
424
|
+
}
|
|
425
|
+
handleRecordsCopied(initialRecords) {
|
|
426
|
+
let records = [...initialRecords];
|
|
427
|
+
records = this.handleCleanOnCopy(records);
|
|
428
|
+
return this.handleLinksWithParent(records);
|
|
429
|
+
}
|
|
430
|
+
handleLinksWithParent(records) {
|
|
431
|
+
var _a, _b;
|
|
432
|
+
const parentDataUnit = (_a = this._parentDataUnit) !== null && _a !== void 0 ? _a : (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.getParentDataUnit();
|
|
433
|
+
if (!parentDataUnit)
|
|
434
|
+
return records;
|
|
435
|
+
const parentSelectedRecord = parentDataUnit.getSelectedRecord();
|
|
436
|
+
const selfInfo = parentDataUnit === null || parentDataUnit === void 0 ? void 0 : parentDataUnit.getChildInfo(this.getCleanDataUnitName());
|
|
437
|
+
const { links } = selfInfo;
|
|
438
|
+
if (!links || links.length === 0)
|
|
439
|
+
return records;
|
|
440
|
+
return records.map(record => {
|
|
441
|
+
return this.buildRecordWithLinkedFields(record, links, parentSelectedRecord);
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
buildRecordWithLinkedFields(record, links, parentSelectedRecord) {
|
|
445
|
+
const newRecord = Object.assign({}, record);
|
|
446
|
+
links.forEach(link => newRecord[link.target] = parentSelectedRecord[link.source]);
|
|
447
|
+
return newRecord;
|
|
448
|
+
}
|
|
449
|
+
handleCleanOnCopy(records) {
|
|
450
|
+
const cleanFields = this.getCleanOnCopyFields();
|
|
451
|
+
if (cleanFields.length > 0) {
|
|
452
|
+
records = records.map(record => this.buildCopyWithCleanedFields(record, cleanFields));
|
|
453
|
+
}
|
|
454
|
+
return records;
|
|
455
|
+
}
|
|
456
|
+
buildCopyWithCleanedFields(record, cleanFields) {
|
|
457
|
+
const newRecord = Object.assign({}, record);
|
|
458
|
+
cleanFields.forEach(fieldName => delete newRecord[fieldName]);
|
|
459
|
+
return newRecord;
|
|
460
|
+
}
|
|
426
461
|
showSuccessMessage(message) {
|
|
427
462
|
ApplicationUtils.info(message, { iconName: "check" });
|
|
428
463
|
}
|
|
@@ -566,20 +601,40 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
566
601
|
return;
|
|
567
602
|
}
|
|
568
603
|
handlerLinkFields() {
|
|
569
|
-
var _a, _b;
|
|
570
|
-
const
|
|
571
|
-
if (!
|
|
604
|
+
var _a, _b, _c, _d;
|
|
605
|
+
const parentDU = (_a = this._parentDataUnit) !== null && _a !== void 0 ? _a : (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.getParentDataUnit();
|
|
606
|
+
if (!parentDU)
|
|
572
607
|
return;
|
|
573
|
-
const
|
|
608
|
+
const childName = (_c = this.entityName) !== null && _c !== void 0 ? _c : this.getCleanDataUnitName();
|
|
609
|
+
const child = parentDU.getChildInfo(childName);
|
|
574
610
|
if (!child)
|
|
575
611
|
return;
|
|
576
|
-
const
|
|
577
|
-
(
|
|
578
|
-
|
|
612
|
+
const links = (_d = child === null || child === void 0 ? void 0 : child.links) === null || _d === void 0 ? void 0 : _d.map(link => link.target);
|
|
613
|
+
this.handleDUWithLinks(links);
|
|
614
|
+
}
|
|
615
|
+
handleDUWithLinks(fieldsToLink) {
|
|
616
|
+
this.fieldsToLink = fieldsToLink;
|
|
617
|
+
const metadata = Object.assign({}, this.dataUnit.metadata);
|
|
618
|
+
this.processLinks(metadata);
|
|
619
|
+
this.dataUnit.metadata = metadata;
|
|
620
|
+
this.dataUnitFieldsHidded.emit();
|
|
621
|
+
}
|
|
622
|
+
processLinks(metadata) {
|
|
623
|
+
var _a;
|
|
624
|
+
(_a = metadata === null || metadata === void 0 ? void 0 : metadata.fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
|
|
625
|
+
var _a;
|
|
626
|
+
if ((_a = this.fieldsToLink) === null || _a === void 0 ? void 0 : _a.includes(field.name)) {
|
|
579
627
|
field.visible = false;
|
|
580
628
|
}
|
|
581
629
|
});
|
|
582
|
-
|
|
630
|
+
}
|
|
631
|
+
getCleanDataUnitName() {
|
|
632
|
+
var _a;
|
|
633
|
+
const uri = this.dataUnit.name;
|
|
634
|
+
if (StringUtils.isEmpty(uri))
|
|
635
|
+
return uri;
|
|
636
|
+
const matcher = this.REGEX_DATAUNIT_NAME.exec(uri);
|
|
637
|
+
return (_a = matcher === null || matcher === void 0 ? void 0 : matcher[1]) !== null && _a !== void 0 ? _a : uri;
|
|
583
638
|
}
|
|
584
639
|
static getNearestInstance(element) {
|
|
585
640
|
let parent = element.parentElement;
|
|
@@ -606,8 +661,9 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
606
661
|
this.dataUnit.releaseCallbacks();
|
|
607
662
|
}
|
|
608
663
|
}
|
|
609
|
-
componentDidLoad() {
|
|
610
|
-
this.loadDataUnit();
|
|
664
|
+
async componentDidLoad() {
|
|
665
|
+
await this.loadDataUnit();
|
|
666
|
+
this.handlerLinkFields();
|
|
611
667
|
}
|
|
612
668
|
render() {
|
|
613
669
|
return (h(Host, null));
|
|
@@ -634,6 +690,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
634
690
|
"ignoreSaveMessage": [4, "ignore-save-message"],
|
|
635
691
|
"configName": [1, "config-name"],
|
|
636
692
|
"resourceID": [1, "resource-i-d"],
|
|
693
|
+
"fieldsToLink": [32],
|
|
637
694
|
"getDataUnit": [64],
|
|
638
695
|
"getSelectedRecordsIDsInfo": [64],
|
|
639
696
|
"getFieldsWithRmp": [64],
|
|
@@ -76,6 +76,8 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
76
76
|
this._formEditorConfigManager = undefined;
|
|
77
77
|
this._formEditorDataUnit = undefined;
|
|
78
78
|
this._fieldToGetFocus = undefined;
|
|
79
|
+
this._customEditors = undefined;
|
|
80
|
+
this._customRenders = undefined;
|
|
79
81
|
this._fieldsProps = {};
|
|
80
82
|
}
|
|
81
83
|
observeDataUnit() {
|
|
@@ -107,6 +109,19 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
107
109
|
async findField() {
|
|
108
110
|
await openFieldSearch(this._moreOptions, this._fieldSearch);
|
|
109
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Registra um editor customizado para campos da grade e formulário
|
|
114
|
+
*/
|
|
115
|
+
async addCustomEditor(fieldName, customEditor) {
|
|
116
|
+
this._customEditors = Object.assign(Object.assign({}, this._customEditors), { [fieldName]: customEditor });
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Registra um render customizado para colunas da grid.
|
|
120
|
+
*/
|
|
121
|
+
async addGridCustomRender(fieldName, customRender) {
|
|
122
|
+
this._customRenders = Object.assign(Object.assign({}, this._customRenders), { [fieldName]: customRender });
|
|
123
|
+
}
|
|
124
|
+
;
|
|
110
125
|
/**
|
|
111
126
|
* Altera/adiciona uma propriedade nos metadados do campo.
|
|
112
127
|
*/
|
|
@@ -258,7 +273,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
258
273
|
if (sheet == undefined) {
|
|
259
274
|
return;
|
|
260
275
|
}
|
|
261
|
-
return h("snk-form-view", { levelPath: params.levelPath, label: sheet.label, name: formName, fields: sheet.fields, formMetadata: params.formMetadata, dataUnit: params.dataUnit, recordsValidator: params.recordsValidator, contracted: (cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.presentation) === "CONTRACTED", fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_b = (_a = params.formConfig) === null || _a === void 0 ? void 0 : _a.summary) === null || _b === void 0 ? void 0 : _b.get(formName), fieldToFocus: params.fieldToFocus, key: formName, onSnkRequestClearFieldToFocus: _ => { var _a; return (_a = params.onRequestClearFieldToFocus) === null || _a === void 0 ? void 0 : _a.call(params); }, fieldsProps: params.fieldsProps });
|
|
276
|
+
return h("snk-form-view", { levelPath: params.levelPath, label: sheet.label, name: formName, fields: sheet.fields, formMetadata: params.formMetadata, dataUnit: params.dataUnit, recordsValidator: params.recordsValidator, contracted: (cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.presentation) === "CONTRACTED", fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_b = (_a = params.formConfig) === null || _a === void 0 ? void 0 : _a.summary) === null || _b === void 0 ? void 0 : _b.get(formName), fieldToFocus: params.fieldToFocus, key: formName, onSnkRequestClearFieldToFocus: _ => { var _a; return (_a = params.onRequestClearFieldToFocus) === null || _a === void 0 ? void 0 : _a.call(params); }, customEditors: params.propsCustomEditor, fieldsProps: params.fieldsProps });
|
|
262
277
|
})));
|
|
263
278
|
}
|
|
264
279
|
wrapDetail(levels, content) {
|
|
@@ -300,14 +315,14 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
300
315
|
else {
|
|
301
316
|
detailBranch = this.selectedGuide;
|
|
302
317
|
}
|
|
303
|
-
content = this.wrapDetail(levels, h("snk-detail-view", { ref: (ref) => this._currentDetail = ref, dataUnitName: this.getDataUnitName(levels, childEntityName), onSnkDetailGuidesChange: (evt) => this.updateGuide(evt.detail), entityName: childEntityName, selectedForm: formName, branchGuide: detailBranch, guideItemPath: this._breadcrumbItems, key: `detail${detailId}`, canEdit: this.canEdit, onSnkSwitchGuide: evt => this._guideNavigator.selectGuide(evt.detail), resourceID: this.resourceID, taskbarCustomContainerId: this.detailTaskbarCustomContainerId }));
|
|
318
|
+
content = this.wrapDetail(levels, h("snk-detail-view", { ref: (ref) => this._currentDetail = ref, dataUnitName: this.getDataUnitName(levels, childEntityName), onSnkDetailGuidesChange: (evt) => this.updateGuide(evt.detail), entityName: childEntityName, selectedForm: formName, branchGuide: detailBranch, guideItemPath: this._breadcrumbItems, key: `detail${detailId}`, canEdit: this.canEdit, onSnkSwitchGuide: evt => this._guideNavigator.selectGuide(evt.detail), resourceID: this.resourceID, taskbarCustomContainerId: this.detailTaskbarCustomContainerId, customEditors: this._customEditors, customRenders: this._customRenders }));
|
|
304
319
|
}
|
|
305
320
|
else {
|
|
306
321
|
const cardId = this.selectedGuide.id;
|
|
307
322
|
const sheet = this._masterFormMetadata.getSheet(cardId);
|
|
308
323
|
if (sheet) {
|
|
309
324
|
const cardConfig = (_c = (_b = this.masterFormConfig) === null || _b === void 0 ? void 0 : _b.cardsState) === null || _c === void 0 ? void 0 : _c.get(cardId);
|
|
310
|
-
content = h("snk-form-view", { ref: ref => this._mainForm = ref, fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_e = (_d = this.masterFormConfig) === null || _d === void 0 ? void 0 : _d.summary) === null || _e === void 0 ? void 0 : _e.get(cardId), name: cardId, label: sheet.label, fields: sheet.fields, dataUnit: this.dataUnit, formMetadata: this._masterFormMetadata, recordsValidator: this.recordsValidator, fieldToFocus: this._fieldToGetFocus, key: guideId, onSnkRequestClearFieldToFocus: _ => this.clearFieldToFocusHandler(), fieldsProps: this._fieldsProps }, this.presentationMode == PresentationMode.SECONDARY && this.buildTaskBar());
|
|
325
|
+
content = h("snk-form-view", { ref: ref => this._mainForm = ref, fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_e = (_d = this.masterFormConfig) === null || _d === void 0 ? void 0 : _d.summary) === null || _e === void 0 ? void 0 : _e.get(cardId), name: cardId, label: sheet.label, fields: sheet.fields, dataUnit: this.dataUnit, formMetadata: this._masterFormMetadata, recordsValidator: this.recordsValidator, fieldToFocus: this._fieldToGetFocus, key: guideId, onSnkRequestClearFieldToFocus: _ => this.clearFieldToFocusHandler(), customEditors: this._customEditors, fieldsProps: this._fieldsProps }, this.presentationMode == PresentationMode.SECONDARY && this.buildTaskBar());
|
|
311
326
|
}
|
|
312
327
|
}
|
|
313
328
|
return content;
|
|
@@ -514,6 +529,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
514
529
|
recordsValidator: this.recordsValidator,
|
|
515
530
|
fieldToFocus: this._fieldToGetFocus,
|
|
516
531
|
onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this),
|
|
532
|
+
propsCustomEditor: this._customEditors,
|
|
517
533
|
fieldsProps: this._fieldsProps
|
|
518
534
|
}), this.getContent())), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this.getConfigViewMode(), onConfigSelected: (evt) => this.changeConfigViewMode(evt.detail), messagesBuilder: this.messagesBuilder, onOpenConfig: (evt) => this.openConfig(evt.detail), resourceID: this.resourceID })));
|
|
519
535
|
}
|
|
@@ -545,9 +561,13 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
545
561
|
"_formEditorConfigManager": [32],
|
|
546
562
|
"_formEditorDataUnit": [32],
|
|
547
563
|
"_fieldToGetFocus": [32],
|
|
564
|
+
"_customEditors": [32],
|
|
565
|
+
"_customRenders": [32],
|
|
548
566
|
"_fieldsProps": [32],
|
|
549
567
|
"showFormConfig": [64],
|
|
550
568
|
"findField": [64],
|
|
569
|
+
"addCustomEditor": [64],
|
|
570
|
+
"addGridCustomRender": [64],
|
|
551
571
|
"setFieldProp": [64]
|
|
552
572
|
}, [[2, "actionClick", "onActionClick"], [0, "snkContentCardChanged", "onContentCardChanged"]]]);
|
|
553
573
|
function defineCustomElement$1() {
|
|
@@ -782,6 +802,8 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
782
802
|
this.branchGuide = undefined;
|
|
783
803
|
this.canEdit = true;
|
|
784
804
|
this.taskbarCustomContainerId = undefined;
|
|
805
|
+
this.customEditors = undefined;
|
|
806
|
+
this.customRenders = undefined;
|
|
785
807
|
}
|
|
786
808
|
observeDataUnit(newDataUnit, oldDataUnit) {
|
|
787
809
|
newDataUnit === null || newDataUnit === void 0 ? void 0 : newDataUnit.subscribe(this.dataUnitActionHandler.bind(this));
|
|
@@ -849,10 +871,38 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
849
871
|
this._snkGrid.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
850
872
|
}
|
|
851
873
|
}
|
|
874
|
+
/**
|
|
875
|
+
* Registra um editor customizado para campos da grade e formulário.
|
|
876
|
+
*/
|
|
877
|
+
async addCustomEditor(fieldName, customEditor) {
|
|
878
|
+
var _a;
|
|
879
|
+
const detailContext = this.normalizeBranchGuideId((_a = this.branchGuide) === null || _a === void 0 ? void 0 : _a.id);
|
|
880
|
+
this._snkGrid.addCustomEditor(fieldName, customEditor, detailContext);
|
|
881
|
+
this._snkFormView.addCustomEditor(fieldName, customEditor, detailContext);
|
|
882
|
+
}
|
|
883
|
+
async observerPropsCustomEditor(newValue) {
|
|
884
|
+
for (const fieldName in newValue) {
|
|
885
|
+
await this.addCustomEditor(fieldName, newValue[fieldName]);
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* Registra um render customizado para colunas da grid.
|
|
890
|
+
*/
|
|
891
|
+
async addGridCustomRender(fieldName, customRender) {
|
|
892
|
+
var _a;
|
|
893
|
+
const detailContext = this.normalizeBranchGuideId((_a = this.branchGuide) === null || _a === void 0 ? void 0 : _a.id);
|
|
894
|
+
await this._snkGrid.addGridCustomRender(fieldName, customRender, detailContext);
|
|
895
|
+
}
|
|
852
896
|
onContentCardChanged(evt) {
|
|
853
897
|
SnkGuidesViewer.updateContentCard(evt.detail.formName, evt.detail.cardConfig, evt.detail.propertyChanged, this.formConfigManager).then(() => forceUpdate(this));
|
|
854
898
|
evt.stopPropagation();
|
|
855
899
|
}
|
|
900
|
+
async observeCustomRenders(newValue) {
|
|
901
|
+
for (const field in newValue) {
|
|
902
|
+
const customRender = newValue[field];
|
|
903
|
+
await this.addGridCustomRender(field, customRender);
|
|
904
|
+
}
|
|
905
|
+
}
|
|
856
906
|
updateLabel() {
|
|
857
907
|
const guideItemPathSize = this.guideItemPath ? this.guideItemPath.length : 0;
|
|
858
908
|
if (guideItemPathSize > 0) {
|
|
@@ -955,6 +1005,10 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
955
1005
|
this.messagesBuilder = new SnkMessageBuilder(this.entityName);
|
|
956
1006
|
}
|
|
957
1007
|
}
|
|
1008
|
+
async componentDidLoad() {
|
|
1009
|
+
await this.observerPropsCustomEditor(this.customEditors);
|
|
1010
|
+
await this.observeCustomRenders(this.customRenders);
|
|
1011
|
+
}
|
|
958
1012
|
async dataUnitActionHandler(action) {
|
|
959
1013
|
if (action.type === Action.FIELD_INVALIDATED) {
|
|
960
1014
|
this.addErrorBadgeToBranchGuide();
|
|
@@ -964,6 +1018,9 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
964
1018
|
this.branchGuide = Object.assign(Object.assign({}, this.branchGuide), { badge: 'error' });
|
|
965
1019
|
this.snkDetailGuidesChange.emit(new GuideBuilder(this.branchGuide, this._formMetadata, this.dataUnit));
|
|
966
1020
|
}
|
|
1021
|
+
normalizeBranchGuideId(id) {
|
|
1022
|
+
return id === null || id === void 0 ? void 0 : id.replace(/child\[(.*?)\]/g, '$1').replace(/::/g, '>');
|
|
1023
|
+
}
|
|
967
1024
|
render() {
|
|
968
1025
|
this.updateLabel();
|
|
969
1026
|
//const cardConfig: IFormCardConfig = this._cardsState?.get(this.selectedForm);
|
|
@@ -971,7 +1028,9 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
971
1028
|
}
|
|
972
1029
|
static get watchers() { return {
|
|
973
1030
|
"dataUnit": ["observeDataUnit"],
|
|
974
|
-
"dataState": ["observerDataState"]
|
|
1031
|
+
"dataState": ["observerDataState"],
|
|
1032
|
+
"customEditors": ["observerPropsCustomEditor"],
|
|
1033
|
+
"customRenders": ["observeCustomRenders"]
|
|
975
1034
|
}; }
|
|
976
1035
|
static get style() { return snkDetailViewCss; }
|
|
977
1036
|
}, [6, "snk-detail-view", {
|
|
@@ -988,12 +1047,16 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
988
1047
|
"branchGuide": [1040],
|
|
989
1048
|
"canEdit": [4, "can-edit"],
|
|
990
1049
|
"taskbarCustomContainerId": [1, "taskbar-custom-container-id"],
|
|
1050
|
+
"customEditors": [16],
|
|
1051
|
+
"customRenders": [16],
|
|
991
1052
|
"_disabledButtons": [32],
|
|
992
1053
|
"_currentView": [32],
|
|
993
1054
|
"attachmentRegisterKey": [32],
|
|
994
1055
|
"changeViewMode": [64],
|
|
995
1056
|
"configGrid": [64],
|
|
996
|
-
"showUp": [64]
|
|
1057
|
+
"showUp": [64],
|
|
1058
|
+
"addCustomEditor": [64],
|
|
1059
|
+
"addGridCustomRender": [64]
|
|
997
1060
|
}, [[0, "snkContentCardChanged", "onContentCardChanged"]]]);
|
|
998
1061
|
SnkDetailView.REGEX_FORM_ID = /__FORM:[^:]+/g;
|
|
999
1062
|
function defineCustomElement() {
|
|
@@ -288,6 +288,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
288
288
|
this.messagesBuilder = undefined;
|
|
289
289
|
this.disablePersonalizedFilter = undefined;
|
|
290
290
|
this.filterBarLegacyConfigName = undefined;
|
|
291
|
+
this.autoLoad = undefined;
|
|
291
292
|
this.allowDefault = undefined;
|
|
292
293
|
this.scrollerLocked = false;
|
|
293
294
|
this.showPersonalizedFilter = false;
|
|
@@ -434,7 +435,10 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
434
435
|
}
|
|
435
436
|
async doLoadData(forceReload = false) {
|
|
436
437
|
try {
|
|
437
|
-
if (this._firstLoad &&
|
|
438
|
+
if (this._firstLoad && this.autoLoad === false) {
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
if (this._firstLoad && !forceReload && this.autoLoad === undefined) {
|
|
438
442
|
let autoLoad = await this._application.getBooleanParam("global.carregar.registros.iniciar.tela");
|
|
439
443
|
if (!autoLoad) {
|
|
440
444
|
return;
|
|
@@ -717,6 +721,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
717
721
|
"messagesBuilder": [1040],
|
|
718
722
|
"disablePersonalizedFilter": [4, "disable-personalized-filter"],
|
|
719
723
|
"filterBarLegacyConfigName": [1, "filter-bar-legacy-config-name"],
|
|
724
|
+
"autoLoad": [4, "auto-load"],
|
|
720
725
|
"allowDefault": [32],
|
|
721
726
|
"scrollerLocked": [32],
|
|
722
727
|
"showPersonalizedFilter": [32],
|
|
@@ -12,6 +12,7 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
12
12
|
this.snkContentCardChanged = createEvent(this, "snkContentCardChanged", 7);
|
|
13
13
|
this.snkRequestClearFieldToFocus = createEvent(this, "snkRequestClearFieldToFocus", 7);
|
|
14
14
|
this.formItemsReady = createEvent(this, "formItemsReady", 7);
|
|
15
|
+
this._customEditors = new Map();
|
|
15
16
|
this._fieldProps = new Map();
|
|
16
17
|
this.levelPath = undefined;
|
|
17
18
|
this.label = undefined;
|
|
@@ -26,6 +27,7 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
26
27
|
this.canFix = true;
|
|
27
28
|
this.recordsValidator = undefined;
|
|
28
29
|
this.fieldToFocus = undefined;
|
|
30
|
+
this.customEditors = undefined;
|
|
29
31
|
this.fieldsProps = undefined;
|
|
30
32
|
}
|
|
31
33
|
async showUp() {
|
|
@@ -33,6 +35,23 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
33
35
|
this._formView.showUp();
|
|
34
36
|
}
|
|
35
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Registra um editor customizado para campos da grade e formulário
|
|
40
|
+
*/
|
|
41
|
+
async addCustomEditor(fieldName, customEditor, detailContext) {
|
|
42
|
+
if (this._formView) {
|
|
43
|
+
this._formView.addCustomEditor(fieldName, customEditor, detailContext);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const newCustomEditors = new Map(this._customEditors);
|
|
47
|
+
newCustomEditors.set(fieldName, { customEditor, detailContext });
|
|
48
|
+
this._customEditors = newCustomEditors;
|
|
49
|
+
}
|
|
50
|
+
observePropsCustomEditor(newValue) {
|
|
51
|
+
for (const fieldName in newValue) {
|
|
52
|
+
this.addCustomEditor(fieldName, newValue[fieldName]);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
36
55
|
/**
|
|
37
56
|
* Altera/adiciona uma propriedade nos metadados do campo.
|
|
38
57
|
*/
|
|
@@ -108,9 +127,11 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
108
127
|
}
|
|
109
128
|
}
|
|
110
129
|
componentDidLoad() {
|
|
130
|
+
this.observePropsCustomEditor(this.customEditors);
|
|
111
131
|
this.observeFieldsProps(this.fieldsProps);
|
|
112
132
|
}
|
|
113
133
|
componentDidRender() {
|
|
134
|
+
this.setCustomEditors();
|
|
114
135
|
this.setFieldProps();
|
|
115
136
|
if (this.fieldToFocus == undefined) {
|
|
116
137
|
return;
|
|
@@ -123,6 +144,15 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
123
144
|
this.snkRequestClearFieldToFocus.emit();
|
|
124
145
|
});
|
|
125
146
|
}
|
|
147
|
+
setCustomEditors() {
|
|
148
|
+
if (!this._formView) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
for (const [fieldName, customEditorProps] of this._customEditors) {
|
|
152
|
+
this._formView.addCustomEditor(fieldName, customEditorProps.customEditor, customEditorProps.detailContext);
|
|
153
|
+
this._customEditors.delete(fieldName);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
126
156
|
setFieldProps() {
|
|
127
157
|
if (!this._formView) {
|
|
128
158
|
return;
|
|
@@ -144,6 +174,7 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
144
174
|
h("ez-form-view", { ref: ref => this._formView = ref, fields: this.fields, onEzContentReady: evt => this.bindFields(evt.detail), onFormItemsReady: (event) => this.handleFormItemsReady(event) })));
|
|
145
175
|
}
|
|
146
176
|
static get watchers() { return {
|
|
177
|
+
"customEditors": ["observePropsCustomEditor"],
|
|
147
178
|
"fieldsProps": ["observeFieldsProps"]
|
|
148
179
|
}; }
|
|
149
180
|
static get style() { return snkFormViewCss; }
|
|
@@ -161,8 +192,10 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
161
192
|
"canFix": [4, "can-fix"],
|
|
162
193
|
"recordsValidator": [16],
|
|
163
194
|
"fieldToFocus": [1, "field-to-focus"],
|
|
195
|
+
"customEditors": [16],
|
|
164
196
|
"fieldsProps": [16],
|
|
165
197
|
"showUp": [64],
|
|
198
|
+
"addCustomEditor": [64],
|
|
166
199
|
"setFieldProp": [64]
|
|
167
200
|
}]);
|
|
168
201
|
function defineCustomElement() {
|
|
@@ -16,6 +16,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
16
16
|
this.exit = createEvent(this, "exit", 7);
|
|
17
17
|
this.actionClick = createEvent(this, "actionClick", 7);
|
|
18
18
|
this.formItemsReady = createEvent(this, "formItemsReady", 7);
|
|
19
|
+
this._customEditors = new Map();
|
|
19
20
|
this._dataUnit = undefined;
|
|
20
21
|
this._dataState = undefined;
|
|
21
22
|
this._showFormConfig = false;
|
|
@@ -38,6 +39,18 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
38
39
|
async hideConfig() {
|
|
39
40
|
this._showFormConfig = false;
|
|
40
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Registra um editor customizado para campos da grade e formulário.
|
|
44
|
+
*/
|
|
45
|
+
async addCustomEditor(fieldName, customEditor) {
|
|
46
|
+
if (this._form) {
|
|
47
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const newCustomEditors = new Map(this._customEditors);
|
|
51
|
+
newCustomEditors.set(fieldName, customEditor);
|
|
52
|
+
this._customEditors = newCustomEditors;
|
|
53
|
+
}
|
|
41
54
|
/**
|
|
42
55
|
* Altera/adiciona uma propriedade nos metadados do campo.
|
|
43
56
|
*/
|
|
@@ -51,6 +64,18 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
51
64
|
const dataInfo = { dataUnit: this._dataUnit };
|
|
52
65
|
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
53
66
|
}
|
|
67
|
+
setCustomEditors() {
|
|
68
|
+
if (!this._form) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
for (const [fieldName, customEditor] of this._customEditors) {
|
|
72
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
|
73
|
+
this._customEditors.delete(fieldName);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async componentDidRender() {
|
|
77
|
+
this.setCustomEditors();
|
|
78
|
+
}
|
|
54
79
|
async componentWillLoad() {
|
|
55
80
|
let parent = this._element.parentElement;
|
|
56
81
|
while (parent) {
|
|
@@ -87,7 +112,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
87
112
|
continue;
|
|
88
113
|
}
|
|
89
114
|
const rmPrecision = (_a = this._dataState.rowMetadata) === null || _a === void 0 ? void 0 : _a.getProp('rm_precision', field);
|
|
90
|
-
if (!rmPrecision) {
|
|
115
|
+
if (!rmPrecision && rmPrecision !== 0) {
|
|
91
116
|
continue;
|
|
92
117
|
}
|
|
93
118
|
await this.setFieldProp(field, 'precision', rmPrecision);
|
|
@@ -103,7 +128,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
103
128
|
if (!this._dataUnit || !this._dataState) {
|
|
104
129
|
return undefined;
|
|
105
130
|
}
|
|
106
|
-
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 &&
|
|
131
|
+
return (h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { ref: (ref) => this._form = ref, key: "ezForm" + this._snkDataUnit.entityName, "data-element-id": "embedded", dataUnit: this._dataUnit, config: this._configManager.getConfig(this._dataState.insertionMode, this._dataUnit), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
|
|
107
132
|
h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this._dataUnit, configManager: this._configManager, onConfigClose: () => this.closeConfig() })))));
|
|
108
133
|
}
|
|
109
134
|
get _element() { return this; }
|
|
@@ -120,6 +145,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
120
145
|
"_configManager": [32],
|
|
121
146
|
"showConfig": [64],
|
|
122
147
|
"hideConfig": [64],
|
|
148
|
+
"addCustomEditor": [64],
|
|
123
149
|
"setFieldProp": [64]
|
|
124
150
|
}]);
|
|
125
151
|
function defineCustomElement$1() {
|