@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-47941.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/{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
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const snkGuidesViewer = require('./snk-guides-viewer-
|
|
5
|
+
const snkGuidesViewer = require('./snk-guides-viewer-66dd6949.js');
|
|
6
6
|
require('./index-f9e81701.js');
|
|
7
7
|
require('@sankhyalabs/core');
|
|
8
|
-
require('./SnkFormConfigManager-
|
|
8
|
+
require('./SnkFormConfigManager-7b222c78.js');
|
|
9
9
|
require('./ConfigStorage-9a53a42c.js');
|
|
10
10
|
require('./form-config-fetcher-3f430aee.js');
|
|
11
11
|
require('./DataFetcher-515bda03.js');
|
|
@@ -21,7 +21,7 @@ require('./constants-35ddd366.js');
|
|
|
21
21
|
require('./pesquisa-fetcher-916a935c.js');
|
|
22
22
|
require('./ISave-e91b70a7.js');
|
|
23
23
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
24
|
-
require('./dataunit-fetcher-
|
|
24
|
+
require('./dataunit-fetcher-7a08e4dd.js');
|
|
25
25
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
|
26
26
|
require('@sankhyalabs/core/dist/utils/SortingUtils');
|
|
27
27
|
require('./ResourceIDUtils-5ff86aa7.js');
|
|
@@ -9,17 +9,17 @@ const constants = require('./constants-35ddd366.js');
|
|
|
9
9
|
const taskbarElements = require('./taskbar-elements-d9392685.js');
|
|
10
10
|
require('./DataFetcher-515bda03.js');
|
|
11
11
|
require('./pesquisa-fetcher-916a935c.js');
|
|
12
|
-
const IExporterProvider = require('./IExporterProvider-
|
|
12
|
+
const IExporterProvider = require('./IExporterProvider-e286ef6a.js');
|
|
13
13
|
const index = require('./index-0922807b.js');
|
|
14
14
|
require('./ISave-e91b70a7.js');
|
|
15
15
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
16
16
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
17
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
|
17
|
+
const dataunitFetcher = require('./dataunit-fetcher-7a08e4dd.js');
|
|
18
18
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
19
19
|
const formConfigFetcher = require('./form-config-fetcher-3f430aee.js');
|
|
20
20
|
const fieldSearch = require('./field-search-f56aa7d6.js');
|
|
21
21
|
const ConfigStorage = require('./ConfigStorage-9a53a42c.js');
|
|
22
|
-
const SnkFormConfigManager = require('./SnkFormConfigManager-
|
|
22
|
+
const SnkFormConfigManager = require('./SnkFormConfigManager-7b222c78.js');
|
|
23
23
|
const RecordIDUtils = require('./RecordIDUtils-3735135c.js');
|
|
24
24
|
const index$2 = require('./index-102ba62d.js');
|
|
25
25
|
require('./PrintUtils-bcaeb82f.js');
|
|
@@ -100,6 +100,8 @@ const SnkSimpleCrud = class {
|
|
|
100
100
|
this._multiSelectionListDataSource = new IExporterProvider.SnkMultiSelectionListDataSource();
|
|
101
101
|
this._keyDownHandler = (event) => this.keyDownListener(event);
|
|
102
102
|
this._formConfigFetcher = new formConfigFetcher.FormConfigFetcher();
|
|
103
|
+
this._customEditors = new Map();
|
|
104
|
+
this._customRenders = new Map();
|
|
103
105
|
this._taskbarProcessor = new fieldSearch.TaskbarProcessor({
|
|
104
106
|
"snkSimpleCrudTaskbar.form_regular": this.getButtons(false, [taskbarElements.TaskbarElement.GRID_MODE]),
|
|
105
107
|
"snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, [taskbarElements.TaskbarElement.DATA_EXPORTER, taskbarElements.TaskbarElement.FORM_MODE]),
|
|
@@ -134,6 +136,32 @@ const SnkSimpleCrud = class {
|
|
|
134
136
|
this.gridLegacyConfigName = undefined;
|
|
135
137
|
this.formLegacyConfigName = undefined;
|
|
136
138
|
this.ignoreReadOnlyFormFields = false;
|
|
139
|
+
this.autoLoad = undefined;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Registra um editor customizado para campos da grade e formulário.
|
|
143
|
+
*/
|
|
144
|
+
async addCustomEditor(fieldName, customEditor) {
|
|
145
|
+
if (this._grid && this._form) {
|
|
146
|
+
this._grid.addCustomEditor(fieldName, customEditor);
|
|
147
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const newCustomEditors = new Map(this._customEditors);
|
|
151
|
+
newCustomEditors.set(fieldName, customEditor);
|
|
152
|
+
this._customEditors = newCustomEditors;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Registra um render customizado para colunas da grid.
|
|
156
|
+
*/
|
|
157
|
+
async addGridCustomRender(fieldName, customRender) {
|
|
158
|
+
if (this._grid) {
|
|
159
|
+
this._grid.addGridCustomRender(fieldName, customRender);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const newCustomRenders = new Map(this._customRenders);
|
|
163
|
+
newCustomRenders.set(fieldName, customRender);
|
|
164
|
+
this._customRenders = newCustomRenders;
|
|
137
165
|
}
|
|
138
166
|
handleResourceIDChanged(newValue, oldValue) {
|
|
139
167
|
if (core.StringUtils.isEmpty(newValue)) {
|
|
@@ -242,7 +270,7 @@ const SnkSimpleCrud = class {
|
|
|
242
270
|
continue;
|
|
243
271
|
}
|
|
244
272
|
const rmPrecision = (_b = (_a = this.dataState) === null || _a === void 0 ? void 0 : _a.rowMetadata) === null || _b === void 0 ? void 0 : _b.getProp('rm_precision', field);
|
|
245
|
-
if (!rmPrecision) {
|
|
273
|
+
if (!rmPrecision && rmPrecision !== 0) {
|
|
246
274
|
continue;
|
|
247
275
|
}
|
|
248
276
|
await this.setFieldProp(field, 'precision', rmPrecision);
|
|
@@ -362,6 +390,8 @@ const SnkSimpleCrud = class {
|
|
|
362
390
|
this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
|
|
363
391
|
this.addGridCustomValueFormattters();
|
|
364
392
|
this.setFieldsProps();
|
|
393
|
+
this.setCustomRenders();
|
|
394
|
+
this.setCustomEditors();
|
|
365
395
|
}
|
|
366
396
|
componentWillLoad() {
|
|
367
397
|
this.processMetadata();
|
|
@@ -372,6 +402,25 @@ const SnkSimpleCrud = class {
|
|
|
372
402
|
componentDidLoad() {
|
|
373
403
|
utils.CSSVarsUtils.applyVarsGrid(this._element, this._grid);
|
|
374
404
|
}
|
|
405
|
+
setCustomRenders() {
|
|
406
|
+
if (!this._grid) {
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
for (const [fieldName, customRender] of this._customRenders) {
|
|
410
|
+
this._grid.addGridCustomRender(fieldName, customRender);
|
|
411
|
+
this._customRenders.delete(fieldName);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
setCustomEditors() {
|
|
415
|
+
if (!this._grid || !this._form) {
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
for (const [fieldName, customEditor] of this._customEditors) {
|
|
419
|
+
this._grid.addCustomEditor(fieldName, customEditor);
|
|
420
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
|
421
|
+
this._customEditors.delete(fieldName);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
375
424
|
configDatasource() {
|
|
376
425
|
this._multiSelectionListDataSource.setApplication(this.application);
|
|
377
426
|
this._multiSelectionListDataSource.setDataUnit(this.dataUnit);
|
|
@@ -400,7 +449,7 @@ const SnkSimpleCrud = class {
|
|
|
400
449
|
return this._currentViewMode === constants.VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
|
|
401
450
|
}
|
|
402
451
|
initInMemoryDataUnit() {
|
|
403
|
-
this._inMemoryLoader = new dataunitFetcher.InMemoryLoader(this._metadata);
|
|
452
|
+
this._inMemoryLoader = new dataunitFetcher.InMemoryLoader(this._metadata, undefined, { autoLoad: this.autoLoad });
|
|
404
453
|
this.dataUnit = this._inMemoryLoader.dataUnit;
|
|
405
454
|
this.dataUnitReady.emit(this.dataUnit);
|
|
406
455
|
}
|
|
@@ -706,15 +755,23 @@ const SnkSimpleCrud = class {
|
|
|
706
755
|
}
|
|
707
756
|
return configFromManager;
|
|
708
757
|
}
|
|
758
|
+
updateFormConfig() {
|
|
759
|
+
const newConfig = Object.assign(Object.assign({}, this.formConfig), { fields: this.dataUnit.metadata.fields });
|
|
760
|
+
this.setFormConfig(newConfig, true);
|
|
761
|
+
if (this._formConfigManager == undefined) {
|
|
762
|
+
this._formConfigManager = new SnkFormConfigManager.SnkFormConfigManager(this.configName, this.resolveResourceID());
|
|
763
|
+
}
|
|
764
|
+
this._formConfigManager.setConfig(this.formConfig);
|
|
765
|
+
}
|
|
709
766
|
/* istanbul ignore next */
|
|
710
767
|
render() {
|
|
711
768
|
var _a;
|
|
712
769
|
if (this.dataUnit == undefined) {
|
|
713
770
|
return;
|
|
714
771
|
}
|
|
715
|
-
return (index$1.h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: () => this.goToView(constants.VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, index$1.h("header", null, index$1.h("slot", { name: "snkSimpleCrudHeader" })), index$1.h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, index$1.h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: index.PresentationMode.SECONDARY }, index$1.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), index$1.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index$1.h("stack-item", null, index$1.h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(constants.VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(dataunitFetcher.InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
|
772
|
+
return (index$1.h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: () => this.goToView(constants.VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this) }, index$1.h("header", null, index$1.h("slot", { name: "snkSimpleCrudHeader" })), index$1.h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, index$1.h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: index.PresentationMode.SECONDARY }, index$1.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), index$1.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index$1.h("stack-item", null, index$1.h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(constants.VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(dataunitFetcher.InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
|
716
773
|
? undefined
|
|
717
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, index$1.h("div", { slot: "footer" }, index$1.h("slot", { name: "snkSimpleCrudFooter" })))), index$1.h("stack-item", null, index$1.h("ez-form", { ref: ref => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && index$1.h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && index$1.h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), index$1.h("div", { id: `${this._customContainerId}` }, index$1.h("slot", { name: "SnkConfigContainerSlot" }))), index$1.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index$1.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
|
774
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, index$1.h("div", { slot: "footer" }, index$1.h("slot", { name: "snkSimpleCrudFooter" })))), index$1.h("stack-item", null, index$1.h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && index$1.h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && index$1.h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), index$1.h("div", { id: `${this._customContainerId}` }, index$1.h("slot", { name: "SnkConfigContainerSlot" }))), index$1.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index$1.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
|
718
775
|
}
|
|
719
776
|
get _element() { return index$1.getElement(this); }
|
|
720
777
|
static get watchers() { return {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { h } from
|
|
2
|
-
import {
|
|
3
|
-
import { AnexoSistemaFetcher, AttachFetcher, DataUnitFetcher } from
|
|
4
|
-
import { VIEW_MODE } from
|
|
5
|
-
import { AnexoSistemaDataUnitFactory, AttachFetcherDataUnitFactory, buildTaskBarManager,
|
|
6
|
-
import InMemoryLoader from
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
|
+
import { Action, ApplicationContext, DataUnit } from '@sankhyalabs/core';
|
|
3
|
+
import { AnexoSistemaFetcher, AttachFetcher, DataUnitFetcher } from '../../lib';
|
|
4
|
+
import { VIEW_MODE } from '../../lib/utils/constants';
|
|
5
|
+
import { anexoSistemaCrudConfig, AnexoSistemaDataUnitFactory, attachCrudConfig, AttachFetcherDataUnitFactory, buildTaskBarManager, } from './structure';
|
|
6
|
+
import InMemoryLoader from '../../lib/dataUnit/InMemoryLoader';
|
|
7
7
|
const RESOURCE_ID = 'AnexoSistema';
|
|
8
8
|
const DATA_UNIT_NAME = 'br.com.sankhya.core.v3.anexoSistema';
|
|
9
9
|
export class SnkAttach {
|
|
@@ -40,25 +40,22 @@ export class SnkAttach {
|
|
|
40
40
|
this._currentDataUnit = undefined;
|
|
41
41
|
this.crudConfig = undefined;
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
async initAttach() {
|
|
44
44
|
var _a, _b, _c, _d, _e, _f;
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
await this.loadAttachmentDataUnit();
|
|
46
|
+
this.returnToGridMode();
|
|
47
|
+
if (this.fetcherType === "AnexoSistema") {
|
|
48
|
+
this._currentFetcher = new AnexoSistemaFetcher(this.entityName, this.registerKey, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
|
|
49
|
+
(_b = this._currentDataUnitBuilder) === null || _b === void 0 ? void 0 : _b.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
|
|
50
|
+
await ((_c = this._currentDataUnit) === null || _c === void 0 ? void 0 : _c.loadData());
|
|
51
|
+
return;
|
|
47
52
|
}
|
|
48
|
-
if (
|
|
49
|
-
this.
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
(_b = this._currentDataUnitBuilder) === null || _b === void 0 ? void 0 : _b.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
|
|
53
|
-
return (_c = this._currentDataUnit) === null || _c === void 0 ? void 0 : _c.loadData();
|
|
54
|
-
}
|
|
55
|
-
if (this.fetcherType === "Attach") {
|
|
56
|
-
const hasMoreOneItem = ((_d = this.registerKey) === null || _d === void 0 ? void 0 : _d.split("_").length) > 1;
|
|
57
|
-
if (hasMoreOneItem)
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
return (_f = (_e = this._currentDataUnit) === null || _e === void 0 ? void 0 : _e.loadMetadata()) === null || _f === void 0 ? void 0 : _f.then(this._currentDataUnit.loadData.bind(undefined, undefined, true, this.registerKey));
|
|
53
|
+
if (this.fetcherType === "Attach") {
|
|
54
|
+
const hasMoreOneItem = ((_d = this.registerKey) === null || _d === void 0 ? void 0 : _d.split("_").length) > 1;
|
|
55
|
+
if (hasMoreOneItem)
|
|
56
|
+
return;
|
|
61
57
|
}
|
|
58
|
+
(_f = (_e = this._currentDataUnit) === null || _e === void 0 ? void 0 : _e.loadMetadata()) === null || _f === void 0 ? void 0 : _f.then(this._currentDataUnit.loadData.bind(undefined, undefined, true, this.registerKey));
|
|
62
59
|
}
|
|
63
60
|
/**
|
|
64
61
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
@@ -180,8 +177,9 @@ export class SnkAttach {
|
|
|
180
177
|
}
|
|
181
178
|
});
|
|
182
179
|
}
|
|
183
|
-
componentWillLoad() {
|
|
180
|
+
async componentWillLoad() {
|
|
184
181
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
182
|
+
await this.initAttach();
|
|
185
183
|
}
|
|
186
184
|
componentWillRender() {
|
|
187
185
|
if (!this.fetcherType) {
|
|
@@ -386,10 +384,4 @@ export class SnkAttach {
|
|
|
386
384
|
}
|
|
387
385
|
}];
|
|
388
386
|
}
|
|
389
|
-
static get watchers() {
|
|
390
|
-
return [{
|
|
391
|
-
"propName": "registerKey",
|
|
392
|
-
"methodName": "registerKeyWatcher"
|
|
393
|
-
}];
|
|
394
|
-
}
|
|
395
387
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -13,6 +13,8 @@ export class SnkCrud {
|
|
|
13
13
|
constructor() {
|
|
14
14
|
this._keyDownHandler = async (event) => this.keyDownListener(event);
|
|
15
15
|
this._viewHistory = [];
|
|
16
|
+
this._customEditors = new Map();
|
|
17
|
+
this._customRenders = new Map();
|
|
16
18
|
this._dataUnit = undefined;
|
|
17
19
|
this._dataState = undefined;
|
|
18
20
|
this.attachmentRegisterKey = undefined;
|
|
@@ -35,6 +37,7 @@ export class SnkCrud {
|
|
|
35
37
|
this.filterBarLegacyConfigName = undefined;
|
|
36
38
|
this.formLegacyConfigName = undefined;
|
|
37
39
|
this.disablePersonalizedFilter = undefined;
|
|
40
|
+
this.autoLoad = undefined;
|
|
38
41
|
this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
|
|
39
42
|
}
|
|
40
43
|
/**
|
|
@@ -70,6 +73,31 @@ export class SnkCrud {
|
|
|
70
73
|
async getFilterBar() {
|
|
71
74
|
return await this._snkGrid.getFilterBar();
|
|
72
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Registra um editor customizado para campos da grade e formulário.
|
|
78
|
+
*/
|
|
79
|
+
async addCustomEditor(fieldName, customEditor) {
|
|
80
|
+
if (this._guidesViewer && this._snkGrid) {
|
|
81
|
+
this._guidesViewer.addCustomEditor(fieldName, customEditor);
|
|
82
|
+
this._snkGrid.addCustomEditor(fieldName, customEditor);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const newCustomEditors = new Map(this._customEditors);
|
|
86
|
+
newCustomEditors.set(fieldName, customEditor);
|
|
87
|
+
this._customEditors = newCustomEditors;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Registra um render customizado para colunas da grid.
|
|
91
|
+
*/
|
|
92
|
+
async addGridCustomRender(fieldName, customRender) {
|
|
93
|
+
if (this._snkGrid) {
|
|
94
|
+
this._snkGrid.addGridCustomRender(fieldName, customRender);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const newCustomRenders = new Map(this._customRenders);
|
|
98
|
+
newCustomRenders.set(fieldName, customRender);
|
|
99
|
+
this._customRenders = newCustomRenders;
|
|
100
|
+
}
|
|
73
101
|
/**
|
|
74
102
|
* Registra um formatador de valores para uma coluna da grid.
|
|
75
103
|
*/
|
|
@@ -141,6 +169,29 @@ export class SnkCrud {
|
|
|
141
169
|
const joinedPrimaryKeys = recordCriteria.map(({ value }) => value).join('_');
|
|
142
170
|
return joinedPrimaryKeys;
|
|
143
171
|
}
|
|
172
|
+
setCustomRenders() {
|
|
173
|
+
if (!this._snkGrid) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
for (const [fieldName, customRender] of this._customRenders) {
|
|
177
|
+
this._snkGrid.addGridCustomRender(fieldName, customRender);
|
|
178
|
+
this._customRenders.delete(fieldName);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
setCustomEditors() {
|
|
182
|
+
if (!this._snkGrid || !this._guidesViewer) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
for (const [fieldName, customEditor] of this._customEditors) {
|
|
186
|
+
this._guidesViewer.addCustomEditor(fieldName, customEditor);
|
|
187
|
+
this._snkGrid.addCustomEditor(fieldName, customEditor);
|
|
188
|
+
this._customEditors.delete(fieldName);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
componentDidRender() {
|
|
192
|
+
this.setCustomRenders();
|
|
193
|
+
this.setCustomEditors();
|
|
194
|
+
}
|
|
144
195
|
componentWillLoad() {
|
|
145
196
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
146
197
|
let parent = this._element.parentElement;
|
|
@@ -191,7 +242,7 @@ export class SnkCrud {
|
|
|
191
242
|
continue;
|
|
192
243
|
}
|
|
193
244
|
const rmPrecision = (_a = this._dataState.rowMetadata) === null || _a === void 0 ? void 0 : _a.getProp('rm_precision', field);
|
|
194
|
-
if (!rmPrecision) {
|
|
245
|
+
if (!rmPrecision && rmPrecision !== 0) {
|
|
195
246
|
continue;
|
|
196
247
|
}
|
|
197
248
|
await this.setFieldProp(field, 'precision', rmPrecision);
|
|
@@ -318,7 +369,7 @@ export class SnkCrud {
|
|
|
318
369
|
return;
|
|
319
370
|
}
|
|
320
371
|
this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
|
|
321
|
-
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" }))));
|
|
372
|
+
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" }))));
|
|
322
373
|
}
|
|
323
374
|
static get is() { return "snk-crud"; }
|
|
324
375
|
static get encapsulation() { return "scoped"; }
|
|
@@ -639,6 +690,23 @@ export class SnkCrud {
|
|
|
639
690
|
},
|
|
640
691
|
"attribute": "disable-personalized-filter",
|
|
641
692
|
"reflect": false
|
|
693
|
+
},
|
|
694
|
+
"autoLoad": {
|
|
695
|
+
"type": "boolean",
|
|
696
|
+
"mutable": false,
|
|
697
|
+
"complexType": {
|
|
698
|
+
"original": "boolean",
|
|
699
|
+
"resolved": "boolean",
|
|
700
|
+
"references": {}
|
|
701
|
+
},
|
|
702
|
+
"required": false,
|
|
703
|
+
"optional": true,
|
|
704
|
+
"docs": {
|
|
705
|
+
"tags": [],
|
|
706
|
+
"text": "Define se a carga dos dados ser\u00E1 feita assim que o componente for carregado."
|
|
707
|
+
},
|
|
708
|
+
"attribute": "auto-load",
|
|
709
|
+
"reflect": false
|
|
642
710
|
}
|
|
643
711
|
};
|
|
644
712
|
}
|
|
@@ -811,6 +879,58 @@ export class SnkCrud {
|
|
|
811
879
|
"tags": []
|
|
812
880
|
}
|
|
813
881
|
},
|
|
882
|
+
"addCustomEditor": {
|
|
883
|
+
"complexType": {
|
|
884
|
+
"signature": "(fieldName: string, customEditor: ICustomEditor) => Promise<void>",
|
|
885
|
+
"parameters": [{
|
|
886
|
+
"tags": [],
|
|
887
|
+
"text": ""
|
|
888
|
+
}, {
|
|
889
|
+
"tags": [],
|
|
890
|
+
"text": ""
|
|
891
|
+
}],
|
|
892
|
+
"references": {
|
|
893
|
+
"Promise": {
|
|
894
|
+
"location": "global"
|
|
895
|
+
},
|
|
896
|
+
"ICustomEditor": {
|
|
897
|
+
"location": "import",
|
|
898
|
+
"path": "@sankhyalabs/ezui/dist/types/utils"
|
|
899
|
+
}
|
|
900
|
+
},
|
|
901
|
+
"return": "Promise<void>"
|
|
902
|
+
},
|
|
903
|
+
"docs": {
|
|
904
|
+
"text": "Registra um editor customizado para campos da grade e formul\u00E1rio.",
|
|
905
|
+
"tags": []
|
|
906
|
+
}
|
|
907
|
+
},
|
|
908
|
+
"addGridCustomRender": {
|
|
909
|
+
"complexType": {
|
|
910
|
+
"signature": "(fieldName: string, customRender: ICustomRender) => Promise<void>",
|
|
911
|
+
"parameters": [{
|
|
912
|
+
"tags": [],
|
|
913
|
+
"text": ""
|
|
914
|
+
}, {
|
|
915
|
+
"tags": [],
|
|
916
|
+
"text": ""
|
|
917
|
+
}],
|
|
918
|
+
"references": {
|
|
919
|
+
"Promise": {
|
|
920
|
+
"location": "global"
|
|
921
|
+
},
|
|
922
|
+
"ICustomRender": {
|
|
923
|
+
"location": "import",
|
|
924
|
+
"path": "@sankhyalabs/ezui/dist/types/utils"
|
|
925
|
+
}
|
|
926
|
+
},
|
|
927
|
+
"return": "Promise<void>"
|
|
928
|
+
},
|
|
929
|
+
"docs": {
|
|
930
|
+
"text": "Registra um render customizado para colunas da grid.",
|
|
931
|
+
"tags": []
|
|
932
|
+
}
|
|
933
|
+
},
|
|
814
934
|
"addCustomValueFormatter": {
|
|
815
935
|
"complexType": {
|
|
816
936
|
"signature": "(columnName: string, customFormatter: ICustomFormatter) => Promise<void>",
|
package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js
CHANGED
|
@@ -26,6 +26,8 @@ export class SnkDetailView {
|
|
|
26
26
|
this.branchGuide = undefined;
|
|
27
27
|
this.canEdit = true;
|
|
28
28
|
this.taskbarCustomContainerId = undefined;
|
|
29
|
+
this.customEditors = undefined;
|
|
30
|
+
this.customRenders = undefined;
|
|
29
31
|
}
|
|
30
32
|
observeDataUnit(newDataUnit, oldDataUnit) {
|
|
31
33
|
newDataUnit === null || newDataUnit === void 0 ? void 0 : newDataUnit.subscribe(this.dataUnitActionHandler.bind(this));
|
|
@@ -93,10 +95,38 @@ export class SnkDetailView {
|
|
|
93
95
|
this._snkGrid.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
94
96
|
}
|
|
95
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Registra um editor customizado para campos da grade e formulário.
|
|
100
|
+
*/
|
|
101
|
+
async addCustomEditor(fieldName, customEditor) {
|
|
102
|
+
var _a;
|
|
103
|
+
const detailContext = this.normalizeBranchGuideId((_a = this.branchGuide) === null || _a === void 0 ? void 0 : _a.id);
|
|
104
|
+
this._snkGrid.addCustomEditor(fieldName, customEditor, detailContext);
|
|
105
|
+
this._snkFormView.addCustomEditor(fieldName, customEditor, detailContext);
|
|
106
|
+
}
|
|
107
|
+
async observerPropsCustomEditor(newValue) {
|
|
108
|
+
for (const fieldName in newValue) {
|
|
109
|
+
await this.addCustomEditor(fieldName, newValue[fieldName]);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Registra um render customizado para colunas da grid.
|
|
114
|
+
*/
|
|
115
|
+
async addGridCustomRender(fieldName, customRender) {
|
|
116
|
+
var _a;
|
|
117
|
+
const detailContext = this.normalizeBranchGuideId((_a = this.branchGuide) === null || _a === void 0 ? void 0 : _a.id);
|
|
118
|
+
await this._snkGrid.addGridCustomRender(fieldName, customRender, detailContext);
|
|
119
|
+
}
|
|
96
120
|
onContentCardChanged(evt) {
|
|
97
121
|
SnkGuidesViewer.updateContentCard(evt.detail.formName, evt.detail.cardConfig, evt.detail.propertyChanged, this.formConfigManager).then(() => forceUpdate(this));
|
|
98
122
|
evt.stopPropagation();
|
|
99
123
|
}
|
|
124
|
+
async observeCustomRenders(newValue) {
|
|
125
|
+
for (const field in newValue) {
|
|
126
|
+
const customRender = newValue[field];
|
|
127
|
+
await this.addGridCustomRender(field, customRender);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
100
130
|
updateLabel() {
|
|
101
131
|
const guideItemPathSize = this.guideItemPath ? this.guideItemPath.length : 0;
|
|
102
132
|
if (guideItemPathSize > 0) {
|
|
@@ -199,6 +229,10 @@ export class SnkDetailView {
|
|
|
199
229
|
this.messagesBuilder = new SnkMessageBuilder(this.entityName);
|
|
200
230
|
}
|
|
201
231
|
}
|
|
232
|
+
async componentDidLoad() {
|
|
233
|
+
await this.observerPropsCustomEditor(this.customEditors);
|
|
234
|
+
await this.observeCustomRenders(this.customRenders);
|
|
235
|
+
}
|
|
202
236
|
async dataUnitActionHandler(action) {
|
|
203
237
|
if (action.type === Action.FIELD_INVALIDATED) {
|
|
204
238
|
this.addErrorBadgeToBranchGuide();
|
|
@@ -208,6 +242,9 @@ export class SnkDetailView {
|
|
|
208
242
|
this.branchGuide = Object.assign(Object.assign({}, this.branchGuide), { badge: 'error' });
|
|
209
243
|
this.snkDetailGuidesChange.emit(new GuideBuilder(this.branchGuide, this._formMetadata, this.dataUnit));
|
|
210
244
|
}
|
|
245
|
+
normalizeBranchGuideId(id) {
|
|
246
|
+
return id === null || id === void 0 ? void 0 : id.replace(/child\[(.*?)\]/g, '$1').replace(/::/g, '>');
|
|
247
|
+
}
|
|
211
248
|
render() {
|
|
212
249
|
this.updateLabel();
|
|
213
250
|
//const cardConfig: IFormCardConfig = this._cardsState?.get(this.selectedForm);
|
|
@@ -469,6 +506,46 @@ export class SnkDetailView {
|
|
|
469
506
|
},
|
|
470
507
|
"attribute": "taskbar-custom-container-id",
|
|
471
508
|
"reflect": false
|
|
509
|
+
},
|
|
510
|
+
"customEditors": {
|
|
511
|
+
"type": "unknown",
|
|
512
|
+
"mutable": false,
|
|
513
|
+
"complexType": {
|
|
514
|
+
"original": "PropsCustomEditor",
|
|
515
|
+
"resolved": "PropsCustomEditor",
|
|
516
|
+
"references": {
|
|
517
|
+
"PropsCustomEditor": {
|
|
518
|
+
"location": "import",
|
|
519
|
+
"path": "../../interfaces/PropsCustomEditor"
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
},
|
|
523
|
+
"required": false,
|
|
524
|
+
"optional": false,
|
|
525
|
+
"docs": {
|
|
526
|
+
"tags": [],
|
|
527
|
+
"text": "Registra um editor customizado para campos da grade e formul\u00E1rio."
|
|
528
|
+
}
|
|
529
|
+
},
|
|
530
|
+
"customRenders": {
|
|
531
|
+
"type": "unknown",
|
|
532
|
+
"mutable": false,
|
|
533
|
+
"complexType": {
|
|
534
|
+
"original": "PropsCustomRender",
|
|
535
|
+
"resolved": "PropsCustomRender",
|
|
536
|
+
"references": {
|
|
537
|
+
"PropsCustomRender": {
|
|
538
|
+
"location": "import",
|
|
539
|
+
"path": "../../interfaces/PropsCustomRender"
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
},
|
|
543
|
+
"required": false,
|
|
544
|
+
"optional": false,
|
|
545
|
+
"docs": {
|
|
546
|
+
"tags": [],
|
|
547
|
+
"text": "Render customizados da grade."
|
|
548
|
+
}
|
|
472
549
|
}
|
|
473
550
|
};
|
|
474
551
|
}
|
|
@@ -601,6 +678,58 @@ export class SnkDetailView {
|
|
|
601
678
|
"text": "",
|
|
602
679
|
"tags": []
|
|
603
680
|
}
|
|
681
|
+
},
|
|
682
|
+
"addCustomEditor": {
|
|
683
|
+
"complexType": {
|
|
684
|
+
"signature": "(fieldName: string, customEditor: ICustomEditor) => Promise<void>",
|
|
685
|
+
"parameters": [{
|
|
686
|
+
"tags": [],
|
|
687
|
+
"text": ""
|
|
688
|
+
}, {
|
|
689
|
+
"tags": [],
|
|
690
|
+
"text": ""
|
|
691
|
+
}],
|
|
692
|
+
"references": {
|
|
693
|
+
"Promise": {
|
|
694
|
+
"location": "global"
|
|
695
|
+
},
|
|
696
|
+
"ICustomEditor": {
|
|
697
|
+
"location": "import",
|
|
698
|
+
"path": "@sankhyalabs/ezui/dist/types/utils"
|
|
699
|
+
}
|
|
700
|
+
},
|
|
701
|
+
"return": "Promise<void>"
|
|
702
|
+
},
|
|
703
|
+
"docs": {
|
|
704
|
+
"text": "Registra um editor customizado para campos da grade e formul\u00E1rio.",
|
|
705
|
+
"tags": []
|
|
706
|
+
}
|
|
707
|
+
},
|
|
708
|
+
"addGridCustomRender": {
|
|
709
|
+
"complexType": {
|
|
710
|
+
"signature": "(fieldName: string, customRender: ICustomRender) => Promise<void>",
|
|
711
|
+
"parameters": [{
|
|
712
|
+
"tags": [],
|
|
713
|
+
"text": ""
|
|
714
|
+
}, {
|
|
715
|
+
"tags": [],
|
|
716
|
+
"text": ""
|
|
717
|
+
}],
|
|
718
|
+
"references": {
|
|
719
|
+
"Promise": {
|
|
720
|
+
"location": "global"
|
|
721
|
+
},
|
|
722
|
+
"ICustomRender": {
|
|
723
|
+
"location": "import",
|
|
724
|
+
"path": "@sankhyalabs/ezui/dist/types/utils"
|
|
725
|
+
}
|
|
726
|
+
},
|
|
727
|
+
"return": "Promise<void>"
|
|
728
|
+
},
|
|
729
|
+
"docs": {
|
|
730
|
+
"text": "Registra um render customizado para colunas da grid.",
|
|
731
|
+
"tags": []
|
|
732
|
+
}
|
|
604
733
|
}
|
|
605
734
|
};
|
|
606
735
|
}
|
|
@@ -611,6 +740,12 @@ export class SnkDetailView {
|
|
|
611
740
|
}, {
|
|
612
741
|
"propName": "dataState",
|
|
613
742
|
"methodName": "observerDataState"
|
|
743
|
+
}, {
|
|
744
|
+
"propName": "customEditors",
|
|
745
|
+
"methodName": "observerPropsCustomEditor"
|
|
746
|
+
}, {
|
|
747
|
+
"propName": "customRenders",
|
|
748
|
+
"methodName": "observeCustomRenders"
|
|
614
749
|
}];
|
|
615
750
|
}
|
|
616
751
|
static get listeners() {
|