@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
|
@@ -13,6 +13,8 @@ import RmPrecisionCustomValueFormatter from '../../lib/DefaultCustomFormatters/R
|
|
|
13
13
|
import ServerSideExporterProvider from '../snk-data-exporter/providers/ServerSideExporterProvider';
|
|
14
14
|
export class SnkGrid {
|
|
15
15
|
constructor() {
|
|
16
|
+
this._customEditors = new Map();
|
|
17
|
+
this._customRenders = new Map();
|
|
16
18
|
this._topTaskbarProcessor = new TaskbarProcessor({
|
|
17
19
|
"snkGridTopTaskbar.regular": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
|
|
18
20
|
"snkGridTopTaskbar.regular.secondary": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
|
|
@@ -66,6 +68,7 @@ export class SnkGrid {
|
|
|
66
68
|
this.disablePersonalizedFilter = undefined;
|
|
67
69
|
this.gridLegacyConfigName = undefined;
|
|
68
70
|
this.filterBarLegacyConfigName = undefined;
|
|
71
|
+
this.autoLoad = undefined;
|
|
69
72
|
}
|
|
70
73
|
/**
|
|
71
74
|
* Exibe a janela de configurações da grade.
|
|
@@ -110,6 +113,30 @@ export class SnkGrid {
|
|
|
110
113
|
async findColumn() {
|
|
111
114
|
await openFieldSearch(this._moreOptions, this._columnSearch);
|
|
112
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Registra um editor customizado para campos da grade e formulário
|
|
118
|
+
*/
|
|
119
|
+
async addCustomEditor(fieldName, customEditor, detailContext) {
|
|
120
|
+
if (this._grid) {
|
|
121
|
+
this._grid.addCustomEditor(fieldName, customEditor, detailContext);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const newCustomEditors = new Map(this._customEditors);
|
|
125
|
+
newCustomEditors.set(fieldName, { customEditor, detailContext });
|
|
126
|
+
this._customEditors = newCustomEditors;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Registra um render customizado para colunas da grid.
|
|
130
|
+
*/
|
|
131
|
+
async addGridCustomRender(fieldName, customRender, detailContext) {
|
|
132
|
+
if (this._grid) {
|
|
133
|
+
this._grid.addGridCustomRender(fieldName, customRender, detailContext);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const newCustomRenders = new Map(this._customRenders);
|
|
137
|
+
newCustomRenders.set(fieldName, { customRender, detailContext });
|
|
138
|
+
this._customRenders = newCustomRenders;
|
|
139
|
+
}
|
|
113
140
|
/**
|
|
114
141
|
* Registra um formatador de valores para uma coluna da grid.
|
|
115
142
|
*/
|
|
@@ -208,6 +235,24 @@ export class SnkGrid {
|
|
|
208
235
|
this.columnFilterDataSource.setDataUnit(this._dataUnit);
|
|
209
236
|
}
|
|
210
237
|
}
|
|
238
|
+
setCustomRenders() {
|
|
239
|
+
if (!this._grid) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
for (const [fieldName, customRenderProps] of this._customRenders) {
|
|
243
|
+
this._grid.addGridCustomRender(fieldName, customRenderProps.customRender, customRenderProps.detailContext);
|
|
244
|
+
this._customRenders.delete(fieldName);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
setCustomEditors() {
|
|
248
|
+
if (!this._grid) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
for (const [fieldName, customEditorProps] of this._customEditors) {
|
|
252
|
+
this._grid.addCustomEditor(fieldName, customEditorProps.customEditor, customEditorProps.detailContext);
|
|
253
|
+
this._customEditors.delete(fieldName);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
211
256
|
componentWillLoad() {
|
|
212
257
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
213
258
|
//TODO: substituir pelo metodo nativo closest
|
|
@@ -245,6 +290,8 @@ export class SnkGrid {
|
|
|
245
290
|
componentDidRender() {
|
|
246
291
|
this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
|
|
247
292
|
this.loadGridCustomFormatters(this._dataUnit.metadata.fields);
|
|
293
|
+
this.setCustomRenders();
|
|
294
|
+
this.setCustomEditors();
|
|
248
295
|
}
|
|
249
296
|
async handleDataStateChange(evt) {
|
|
250
297
|
this._dataState = evt.detail;
|
|
@@ -362,7 +409,7 @@ export class SnkGrid {
|
|
|
362
409
|
return undefined;
|
|
363
410
|
}
|
|
364
411
|
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, this._showSnkFilterBar &&
|
|
365
|
-
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
|
412
|
+
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
|
366
413
|
}
|
|
367
414
|
static get is() { return "snk-grid"; }
|
|
368
415
|
static get encapsulation() { return "scoped"; }
|
|
@@ -773,6 +820,23 @@ export class SnkGrid {
|
|
|
773
820
|
},
|
|
774
821
|
"attribute": "filter-bar-legacy-config-name",
|
|
775
822
|
"reflect": false
|
|
823
|
+
},
|
|
824
|
+
"autoLoad": {
|
|
825
|
+
"type": "boolean",
|
|
826
|
+
"mutable": false,
|
|
827
|
+
"complexType": {
|
|
828
|
+
"original": "boolean",
|
|
829
|
+
"resolved": "boolean",
|
|
830
|
+
"references": {}
|
|
831
|
+
},
|
|
832
|
+
"required": false,
|
|
833
|
+
"optional": true,
|
|
834
|
+
"docs": {
|
|
835
|
+
"tags": [],
|
|
836
|
+
"text": "Define se a carga dos dados ser\u00E1 feita assim que o componente for carregado."
|
|
837
|
+
},
|
|
838
|
+
"attribute": "auto-load",
|
|
839
|
+
"reflect": false
|
|
776
840
|
}
|
|
777
841
|
};
|
|
778
842
|
}
|
|
@@ -926,6 +990,64 @@ export class SnkGrid {
|
|
|
926
990
|
"tags": []
|
|
927
991
|
}
|
|
928
992
|
},
|
|
993
|
+
"addCustomEditor": {
|
|
994
|
+
"complexType": {
|
|
995
|
+
"signature": "(fieldName: string, customEditor: ICustomEditor, detailContext?: string) => Promise<void>",
|
|
996
|
+
"parameters": [{
|
|
997
|
+
"tags": [],
|
|
998
|
+
"text": ""
|
|
999
|
+
}, {
|
|
1000
|
+
"tags": [],
|
|
1001
|
+
"text": ""
|
|
1002
|
+
}, {
|
|
1003
|
+
"tags": [],
|
|
1004
|
+
"text": ""
|
|
1005
|
+
}],
|
|
1006
|
+
"references": {
|
|
1007
|
+
"Promise": {
|
|
1008
|
+
"location": "global"
|
|
1009
|
+
},
|
|
1010
|
+
"ICustomEditor": {
|
|
1011
|
+
"location": "import",
|
|
1012
|
+
"path": "@sankhyalabs/ezui/dist/types/utils"
|
|
1013
|
+
}
|
|
1014
|
+
},
|
|
1015
|
+
"return": "Promise<void>"
|
|
1016
|
+
},
|
|
1017
|
+
"docs": {
|
|
1018
|
+
"text": "Registra um editor customizado para campos da grade e formul\u00E1rio",
|
|
1019
|
+
"tags": []
|
|
1020
|
+
}
|
|
1021
|
+
},
|
|
1022
|
+
"addGridCustomRender": {
|
|
1023
|
+
"complexType": {
|
|
1024
|
+
"signature": "(fieldName: string, customRender: ICustomRender, detailContext?: string) => Promise<void>",
|
|
1025
|
+
"parameters": [{
|
|
1026
|
+
"tags": [],
|
|
1027
|
+
"text": ""
|
|
1028
|
+
}, {
|
|
1029
|
+
"tags": [],
|
|
1030
|
+
"text": ""
|
|
1031
|
+
}, {
|
|
1032
|
+
"tags": [],
|
|
1033
|
+
"text": ""
|
|
1034
|
+
}],
|
|
1035
|
+
"references": {
|
|
1036
|
+
"Promise": {
|
|
1037
|
+
"location": "global"
|
|
1038
|
+
},
|
|
1039
|
+
"ICustomRender": {
|
|
1040
|
+
"location": "import",
|
|
1041
|
+
"path": "@sankhyalabs/ezui/dist/types/utils"
|
|
1042
|
+
}
|
|
1043
|
+
},
|
|
1044
|
+
"return": "Promise<void>"
|
|
1045
|
+
},
|
|
1046
|
+
"docs": {
|
|
1047
|
+
"text": "Registra um render customizado para colunas da grid.",
|
|
1048
|
+
"tags": []
|
|
1049
|
+
}
|
|
1050
|
+
},
|
|
929
1051
|
"addCustomValueFormatter": {
|
|
930
1052
|
"complexType": {
|
|
931
1053
|
"signature": "(columnName: string, customFormatter: ICustomFormatter) => Promise<void>",
|
|
@@ -19,6 +19,8 @@ export class SnkSimpleCrud {
|
|
|
19
19
|
this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
|
|
20
20
|
this._keyDownHandler = (event) => this.keyDownListener(event);
|
|
21
21
|
this._formConfigFetcher = new FormConfigFetcher();
|
|
22
|
+
this._customEditors = new Map();
|
|
23
|
+
this._customRenders = new Map();
|
|
22
24
|
this._taskbarProcessor = new TaskbarProcessor({
|
|
23
25
|
"snkSimpleCrudTaskbar.form_regular": this.getButtons(false, [TaskbarElement.GRID_MODE]),
|
|
24
26
|
"snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]),
|
|
@@ -53,6 +55,32 @@ export class SnkSimpleCrud {
|
|
|
53
55
|
this.gridLegacyConfigName = undefined;
|
|
54
56
|
this.formLegacyConfigName = undefined;
|
|
55
57
|
this.ignoreReadOnlyFormFields = false;
|
|
58
|
+
this.autoLoad = undefined;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Registra um editor customizado para campos da grade e formulário.
|
|
62
|
+
*/
|
|
63
|
+
async addCustomEditor(fieldName, customEditor) {
|
|
64
|
+
if (this._grid && this._form) {
|
|
65
|
+
this._grid.addCustomEditor(fieldName, customEditor);
|
|
66
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const newCustomEditors = new Map(this._customEditors);
|
|
70
|
+
newCustomEditors.set(fieldName, customEditor);
|
|
71
|
+
this._customEditors = newCustomEditors;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Registra um render customizado para colunas da grid.
|
|
75
|
+
*/
|
|
76
|
+
async addGridCustomRender(fieldName, customRender) {
|
|
77
|
+
if (this._grid) {
|
|
78
|
+
this._grid.addGridCustomRender(fieldName, customRender);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const newCustomRenders = new Map(this._customRenders);
|
|
82
|
+
newCustomRenders.set(fieldName, customRender);
|
|
83
|
+
this._customRenders = newCustomRenders;
|
|
56
84
|
}
|
|
57
85
|
handleResourceIDChanged(newValue, oldValue) {
|
|
58
86
|
if (StringUtils.isEmpty(newValue)) {
|
|
@@ -161,7 +189,7 @@ export class SnkSimpleCrud {
|
|
|
161
189
|
continue;
|
|
162
190
|
}
|
|
163
191
|
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);
|
|
164
|
-
if (!rmPrecision) {
|
|
192
|
+
if (!rmPrecision && rmPrecision !== 0) {
|
|
165
193
|
continue;
|
|
166
194
|
}
|
|
167
195
|
await this.setFieldProp(field, 'precision', rmPrecision);
|
|
@@ -282,6 +310,8 @@ export class SnkSimpleCrud {
|
|
|
282
310
|
this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
|
|
283
311
|
this.addGridCustomValueFormattters();
|
|
284
312
|
this.setFieldsProps();
|
|
313
|
+
this.setCustomRenders();
|
|
314
|
+
this.setCustomEditors();
|
|
285
315
|
}
|
|
286
316
|
componentWillLoad() {
|
|
287
317
|
this.processMetadata();
|
|
@@ -292,6 +322,25 @@ export class SnkSimpleCrud {
|
|
|
292
322
|
componentDidLoad() {
|
|
293
323
|
CSSVarsUtils.applyVarsGrid(this._element, this._grid);
|
|
294
324
|
}
|
|
325
|
+
setCustomRenders() {
|
|
326
|
+
if (!this._grid) {
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
for (const [fieldName, customRender] of this._customRenders) {
|
|
330
|
+
this._grid.addGridCustomRender(fieldName, customRender);
|
|
331
|
+
this._customRenders.delete(fieldName);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
setCustomEditors() {
|
|
335
|
+
if (!this._grid || !this._form) {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
for (const [fieldName, customEditor] of this._customEditors) {
|
|
339
|
+
this._grid.addCustomEditor(fieldName, customEditor);
|
|
340
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
|
341
|
+
this._customEditors.delete(fieldName);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
295
344
|
configDatasource() {
|
|
296
345
|
this._multiSelectionListDataSource.setApplication(this.application);
|
|
297
346
|
this._multiSelectionListDataSource.setDataUnit(this.dataUnit);
|
|
@@ -320,7 +369,7 @@ export class SnkSimpleCrud {
|
|
|
320
369
|
return this._currentViewMode === VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
|
|
321
370
|
}
|
|
322
371
|
initInMemoryDataUnit() {
|
|
323
|
-
this._inMemoryLoader = new InMemoryLoader(this._metadata);
|
|
372
|
+
this._inMemoryLoader = new InMemoryLoader(this._metadata, undefined, { autoLoad: this.autoLoad });
|
|
324
373
|
this.dataUnit = this._inMemoryLoader.dataUnit;
|
|
325
374
|
this.dataUnitReady.emit(this.dataUnit);
|
|
326
375
|
}
|
|
@@ -626,15 +675,23 @@ export class SnkSimpleCrud {
|
|
|
626
675
|
}
|
|
627
676
|
return configFromManager;
|
|
628
677
|
}
|
|
678
|
+
updateFormConfig() {
|
|
679
|
+
const newConfig = Object.assign(Object.assign({}, this.formConfig), { fields: this.dataUnit.metadata.fields });
|
|
680
|
+
this.setFormConfig(newConfig, true);
|
|
681
|
+
if (this._formConfigManager == undefined) {
|
|
682
|
+
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
|
683
|
+
}
|
|
684
|
+
this._formConfigManager.setConfig(this.formConfig);
|
|
685
|
+
}
|
|
629
686
|
/* istanbul ignore next */
|
|
630
687
|
render() {
|
|
631
688
|
var _a;
|
|
632
689
|
if (this.dataUnit == undefined) {
|
|
633
690
|
return;
|
|
634
691
|
}
|
|
635
|
-
return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
|
692
|
+
return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this) }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
|
636
693
|
? undefined
|
|
637
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { ref: ref => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
|
694
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
|
638
695
|
}
|
|
639
696
|
static get is() { return "snk-simple-crud"; }
|
|
640
697
|
static get encapsulation() { return "scoped"; }
|
|
@@ -1006,6 +1063,23 @@ export class SnkSimpleCrud {
|
|
|
1006
1063
|
"attribute": "ignore-read-only-form-fields",
|
|
1007
1064
|
"reflect": false,
|
|
1008
1065
|
"defaultValue": "false"
|
|
1066
|
+
},
|
|
1067
|
+
"autoLoad": {
|
|
1068
|
+
"type": "boolean",
|
|
1069
|
+
"mutable": false,
|
|
1070
|
+
"complexType": {
|
|
1071
|
+
"original": "boolean",
|
|
1072
|
+
"resolved": "boolean",
|
|
1073
|
+
"references": {}
|
|
1074
|
+
},
|
|
1075
|
+
"required": false,
|
|
1076
|
+
"optional": true,
|
|
1077
|
+
"docs": {
|
|
1078
|
+
"tags": [],
|
|
1079
|
+
"text": "Define se a carga dos dados ser\u00E1 feita assim que o componente for carregado."
|
|
1080
|
+
},
|
|
1081
|
+
"attribute": "auto-load",
|
|
1082
|
+
"reflect": false
|
|
1009
1083
|
}
|
|
1010
1084
|
};
|
|
1011
1085
|
}
|
|
@@ -1133,6 +1207,58 @@ export class SnkSimpleCrud {
|
|
|
1133
1207
|
}
|
|
1134
1208
|
static get methods() {
|
|
1135
1209
|
return {
|
|
1210
|
+
"addCustomEditor": {
|
|
1211
|
+
"complexType": {
|
|
1212
|
+
"signature": "(fieldName: string, customEditor: ICustomEditor) => Promise<void>",
|
|
1213
|
+
"parameters": [{
|
|
1214
|
+
"tags": [],
|
|
1215
|
+
"text": ""
|
|
1216
|
+
}, {
|
|
1217
|
+
"tags": [],
|
|
1218
|
+
"text": ""
|
|
1219
|
+
}],
|
|
1220
|
+
"references": {
|
|
1221
|
+
"Promise": {
|
|
1222
|
+
"location": "global"
|
|
1223
|
+
},
|
|
1224
|
+
"ICustomEditor": {
|
|
1225
|
+
"location": "import",
|
|
1226
|
+
"path": "@sankhyalabs/ezui/dist/types/utils"
|
|
1227
|
+
}
|
|
1228
|
+
},
|
|
1229
|
+
"return": "Promise<void>"
|
|
1230
|
+
},
|
|
1231
|
+
"docs": {
|
|
1232
|
+
"text": "Registra um editor customizado para campos da grade e formul\u00E1rio.",
|
|
1233
|
+
"tags": []
|
|
1234
|
+
}
|
|
1235
|
+
},
|
|
1236
|
+
"addGridCustomRender": {
|
|
1237
|
+
"complexType": {
|
|
1238
|
+
"signature": "(fieldName: string, customRender: ICustomRender) => Promise<void>",
|
|
1239
|
+
"parameters": [{
|
|
1240
|
+
"tags": [],
|
|
1241
|
+
"text": ""
|
|
1242
|
+
}, {
|
|
1243
|
+
"tags": [],
|
|
1244
|
+
"text": ""
|
|
1245
|
+
}],
|
|
1246
|
+
"references": {
|
|
1247
|
+
"Promise": {
|
|
1248
|
+
"location": "global"
|
|
1249
|
+
},
|
|
1250
|
+
"ICustomRender": {
|
|
1251
|
+
"location": "import",
|
|
1252
|
+
"path": "@sankhyalabs/ezui/dist/types/utils"
|
|
1253
|
+
}
|
|
1254
|
+
},
|
|
1255
|
+
"return": "Promise<void>"
|
|
1256
|
+
},
|
|
1257
|
+
"docs": {
|
|
1258
|
+
"text": "Registra um render customizado para colunas da grid.",
|
|
1259
|
+
"tags": []
|
|
1260
|
+
}
|
|
1261
|
+
},
|
|
1136
1262
|
"addCustomValueFormatter": {
|
|
1137
1263
|
"complexType": {
|
|
1138
1264
|
"signature": "(columnName: string, customFormatter: ICustomFormatter) => Promise<void>",
|
|
@@ -21,7 +21,7 @@ export default class RmPrecisionCustomValueFormatter {
|
|
|
21
21
|
}
|
|
22
22
|
const rowMetadata = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.metadataByRow.get(recordId);
|
|
23
23
|
const rmPrecision = rowMetadata === null || rowMetadata === void 0 ? void 0 : rowMetadata.getProp('rm_precision', column.name);
|
|
24
|
-
if (rmPrecision) {
|
|
24
|
+
if (rmPrecision || rmPrecision === 0) {
|
|
25
25
|
return NumberUtils.format(currentValue, rmPrecision, rmPrecision);
|
|
26
26
|
}
|
|
27
27
|
else {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChangeOperation, DataType, DataUnit, DateUtils, StringUtils, } from '@sankhyalabs/core';
|
|
2
2
|
import { applyFilter, applySorting, buildPaginationInfo } from './dataUnitInMemoryUtils';
|
|
3
3
|
export default class InMemoryLoader {
|
|
4
|
-
constructor(metadata, records) {
|
|
4
|
+
constructor(metadata, records, config) {
|
|
5
5
|
this.metadata = metadata;
|
|
6
6
|
this.records = records;
|
|
7
7
|
this._dataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
|
|
@@ -9,7 +9,11 @@ export default class InMemoryLoader {
|
|
|
9
9
|
this._dataUnit.dataLoader = (dataUnit, request) => this.inMemoryLoader(dataUnit, request, this.getRecordsToLoad());
|
|
10
10
|
this._dataUnit.saveLoader = (_dataUnit, changes) => this.saveLoader(_dataUnit, changes);
|
|
11
11
|
this._dataUnit.removeLoader = (_dataUnit, recordIds) => this.removeLoader(_dataUnit, recordIds);
|
|
12
|
-
this.dataUnit.loadMetadata().then(() =>
|
|
12
|
+
this.dataUnit.loadMetadata().then(() => {
|
|
13
|
+
if ((config === null || config === void 0 ? void 0 : config.autoLoad) !== false) {
|
|
14
|
+
this.dataUnit.loadData();
|
|
15
|
+
}
|
|
16
|
+
});
|
|
13
17
|
}
|
|
14
18
|
getRecordsToLoad() {
|
|
15
19
|
if (this._initialRecords == undefined && this.dataUnit.records.length > 0) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -230,7 +230,7 @@ class RmPrecisionCustomValueFormatter {
|
|
|
230
230
|
}
|
|
231
231
|
const rowMetadata = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.metadataByRow.get(recordId);
|
|
232
232
|
const rmPrecision = rowMetadata === null || rowMetadata === void 0 ? void 0 : rowMetadata.getProp('rm_precision', column.name);
|
|
233
|
-
if (rmPrecision) {
|
|
233
|
+
if (rmPrecision || rmPrecision === 0) {
|
|
234
234
|
return NumberUtils.format(currentValue, rmPrecision, rmPrecision);
|
|
235
235
|
}
|
|
236
236
|
else {
|
|
@@ -250,7 +250,7 @@ class CommonsExporter {
|
|
|
250
250
|
}
|
|
251
251
|
async getColumnsMetadata() {
|
|
252
252
|
var _a;
|
|
253
|
-
this.columnsState = await ((_a = this.grid) === null || _a === void 0 ? void 0 : _a.getColumnsState());
|
|
253
|
+
this.columnsState = await ((_a = this.grid) === null || _a === void 0 ? void 0 : _a.getColumnsState()) || [];
|
|
254
254
|
return await this.buildColumnsMetadata(this.columnsState);
|
|
255
255
|
}
|
|
256
256
|
getColumnsState() {
|
|
@@ -72,11 +72,11 @@ class SnkFormConfigManager {
|
|
|
72
72
|
var _a;
|
|
73
73
|
const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
|
|
74
74
|
if (fields != undefined && fields.length > 0) {
|
|
75
|
-
return fields.map(({ label, name, readOnly }) => {
|
|
75
|
+
return fields.map(({ label, name, readOnly, visible }) => {
|
|
76
76
|
if (label == undefined) {
|
|
77
77
|
return dataUnit.getField(name);
|
|
78
78
|
}
|
|
79
|
-
return { name, label, readOnly };
|
|
79
|
+
return { name, label, readOnly, visible };
|
|
80
80
|
})
|
|
81
81
|
.filter(field => this.isFieldVisible(field, descriptionFilter));
|
|
82
82
|
}
|
|
@@ -257,7 +257,7 @@ function buildPaginationInfo(records, offset = 0, limit = 0) {
|
|
|
257
257
|
}
|
|
258
258
|
|
|
259
259
|
class InMemoryLoader {
|
|
260
|
-
constructor(metadata, records) {
|
|
260
|
+
constructor(metadata, records, config) {
|
|
261
261
|
this.metadata = metadata;
|
|
262
262
|
this.records = records;
|
|
263
263
|
this._dataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
|
|
@@ -265,7 +265,11 @@ class InMemoryLoader {
|
|
|
265
265
|
this._dataUnit.dataLoader = (dataUnit, request) => this.inMemoryLoader(dataUnit, request, this.getRecordsToLoad());
|
|
266
266
|
this._dataUnit.saveLoader = (_dataUnit, changes) => this.saveLoader(_dataUnit, changes);
|
|
267
267
|
this._dataUnit.removeLoader = (_dataUnit, recordIds) => this.removeLoader(_dataUnit, recordIds);
|
|
268
|
-
this.dataUnit.loadMetadata().then(() =>
|
|
268
|
+
this.dataUnit.loadMetadata().then(() => {
|
|
269
|
+
if ((config === null || config === void 0 ? void 0 : config.autoLoad) !== false) {
|
|
270
|
+
this.dataUnit.loadData();
|
|
271
|
+
}
|
|
272
|
+
});
|
|
269
273
|
}
|
|
270
274
|
getRecordsToLoad() {
|
|
271
275
|
if (this._initialRecords == undefined && this.dataUnit.records.length > 0) {
|
|
@@ -657,25 +657,22 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
657
657
|
this._currentDataUnit = undefined;
|
|
658
658
|
this.crudConfig = undefined;
|
|
659
659
|
}
|
|
660
|
-
|
|
660
|
+
async initAttach() {
|
|
661
661
|
var _a, _b, _c, _d, _e, _f;
|
|
662
|
-
|
|
663
|
-
|
|
662
|
+
await this.loadAttachmentDataUnit();
|
|
663
|
+
this.returnToGridMode();
|
|
664
|
+
if (this.fetcherType === "AnexoSistema") {
|
|
665
|
+
this._currentFetcher = new AnexoSistemaFetcher(this.entityName, this.registerKey, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
|
|
666
|
+
(_b = this._currentDataUnitBuilder) === null || _b === void 0 ? void 0 : _b.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
|
|
667
|
+
await ((_c = this._currentDataUnit) === null || _c === void 0 ? void 0 : _c.loadData());
|
|
668
|
+
return;
|
|
664
669
|
}
|
|
665
|
-
if (
|
|
666
|
-
this.
|
|
667
|
-
if (
|
|
668
|
-
|
|
669
|
-
(_b = this._currentDataUnitBuilder) === null || _b === void 0 ? void 0 : _b.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
|
|
670
|
-
return (_c = this._currentDataUnit) === null || _c === void 0 ? void 0 : _c.loadData();
|
|
671
|
-
}
|
|
672
|
-
if (this.fetcherType === "Attach") {
|
|
673
|
-
const hasMoreOneItem = ((_d = this.registerKey) === null || _d === void 0 ? void 0 : _d.split("_").length) > 1;
|
|
674
|
-
if (hasMoreOneItem)
|
|
675
|
-
return;
|
|
676
|
-
}
|
|
677
|
-
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));
|
|
670
|
+
if (this.fetcherType === "Attach") {
|
|
671
|
+
const hasMoreOneItem = ((_d = this.registerKey) === null || _d === void 0 ? void 0 : _d.split("_").length) > 1;
|
|
672
|
+
if (hasMoreOneItem)
|
|
673
|
+
return;
|
|
678
674
|
}
|
|
675
|
+
(_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));
|
|
679
676
|
}
|
|
680
677
|
/**
|
|
681
678
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
@@ -797,8 +794,9 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
797
794
|
}
|
|
798
795
|
});
|
|
799
796
|
}
|
|
800
|
-
componentWillLoad() {
|
|
797
|
+
async componentWillLoad() {
|
|
801
798
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
799
|
+
await this.initAttach();
|
|
802
800
|
}
|
|
803
801
|
componentWillRender() {
|
|
804
802
|
if (!this.fetcherType) {
|
|
@@ -826,9 +824,6 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
826
824
|
return null;
|
|
827
825
|
return (h("main", { class: "snk-attach__main" }, h("header", { class: "snk-attach__header" }, h("snk-simple-bar", { onExit: this.handleBack, messagesBuilder: this.messagesBuilder }, h("div", { slot: "rightSlot" }, h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })))), h("div", { class: "snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column" }, h("div", { class: "ez-box__container" }, h("snk-simple-crud", { ref: (el) => this._crudElement = el, dataUnit: this._currentDataUnit, taskbarManager: buildTaskBarManager(), gridConfig: (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid, formConfig: (_b = this.crudConfig) === null || _b === void 0 ? void 0 : _b.form, useCancelConfirm: false, onActionClick: this.handleTaskbarClick, messagesBuilder: this.messagesBuilder, onDataStateChange: this.handleOnDataStateChange.bind(this) }, h("div", { slot: "snkSimpleCrudHeader" }, h("div", { class: "ez-flex ez-flex--column" }, h("span", { class: "ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium" }, this.getMessage("snkAttach.title")), h("span", { class: "ez-text ez-text--medium ez-text--secondary" }, this.getMessage("snkAttach.description")))))))));
|
|
828
826
|
}
|
|
829
|
-
static get watchers() { return {
|
|
830
|
-
"registerKey": ["registerKeyWatcher"]
|
|
831
|
-
}; }
|
|
832
827
|
static get style() { return snkAttachCss; }
|
|
833
828
|
}, [2, "snk-attach", {
|
|
834
829
|
"fetcherType": [1, "fetcher-type"],
|