@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-57523.0 → 0.0.0-bugfix-dev-59880.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{ConfigStorage-7df9d3bb.js → ConfigStorage-9a53a42c.js} +12 -11
- package/dist/cjs/{form-config-fetcher-3c4daeb5.js → DataFetcher-515bda03.js} +0 -251
- package/dist/cjs/{IExporterProvider-c307e2b1.js → IExporterProvider-e286ef6a.js} +55 -12
- package/dist/cjs/{SnkFormConfigManager-4259edbe.js → SnkFormConfigManager-7b222c78.js} +4 -4
- package/dist/cjs/{SnkMessageBuilder-66aa2557.js → SnkMessageBuilder-4a95fe86.js} +6 -12
- package/dist/cjs/{auth-fetcher-e6112be7.js → auth-fetcher-5acb0335.js} +1 -1
- package/dist/cjs/{pesquisa-fetcher-cbdaba63.js → dataunit-fetcher-7a08e4dd.js} +74 -175
- package/dist/cjs/form-config-fetcher-3f430aee.js +256 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pesquisa-fetcher-916a935c.js +166 -0
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +10 -8
- package/dist/cjs/snk-application.cjs.entry.js +49 -39
- package/dist/cjs/snk-attach.cjs.entry.js +19 -17
- package/dist/cjs/snk-crud.cjs.entry.js +95 -10
- package/dist/cjs/snk-data-exporter.cjs.entry.js +11 -9
- package/dist/cjs/snk-data-unit-3718477f.js +670 -0
- package/dist/cjs/snk-data-unit.cjs.entry.js +10 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +48 -7
- package/dist/cjs/snk-filter-bar.cjs.entry.js +8 -3
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -2
- package/dist/cjs/snk-form-config.cjs.entry.js +2 -1
- package/dist/cjs/snk-form-view.cjs.entry.js +67 -0
- package/dist/cjs/snk-form.cjs.entry.js +53 -7
- package/dist/cjs/snk-grid.cjs.entry.js +103 -11
- package/dist/cjs/{snk-guides-viewer-b0c44e0c.js → snk-guides-viewer-66dd6949.js} +36 -7
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -6
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -2
- package/dist/cjs/snk-simple-crud.cjs.entry.js +153 -14
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/snk-application/snk-application.js +37 -17
- package/dist/collection/components/snk-crud/interfaces/PropsCustomEditor.js +1 -0
- package/dist/collection/components/snk-crud/interfaces/PropsCustomRender.js +1 -0
- package/dist/collection/components/snk-crud/snk-crud.js +230 -7
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +135 -0
- package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +161 -0
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +112 -5
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +14 -8
- package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +5 -0
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +2 -2
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +499 -176
- package/dist/collection/components/snk-data-unit/test/resources/metadataMock.js +24 -0
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +22 -1
- package/dist/collection/components/snk-form/snk-form.js +101 -4
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +2 -2
- package/dist/collection/components/snk-grid/snk-grid.js +219 -8
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +283 -9
- package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +35 -0
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +6 -2
- package/dist/collection/lib/dataUnit/ValueFormatter.js +4 -0
- package/dist/collection/lib/dataUnit/interfaces/InMemoryLoaderConfig.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +51 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.js +22 -0
- package/dist/collection/lib/message/SnkMessageBuilder.js +25 -32
- package/dist/collection/lib/message/resources/snk-data-unit.msg.js +1 -0
- package/dist/components/ConfigStorage.js +2 -1
- package/dist/components/DataFetcher.js +7024 -0
- package/dist/components/IExporterProvider.js +54 -12
- package/dist/components/SnkFormConfigManager.js +2 -2
- package/dist/components/SnkMessageBuilder.js +6 -12
- package/dist/components/dataunit-fetcher.js +64 -166
- package/dist/components/form-config-fetcher.js +3 -7023
- package/dist/components/pesquisa-fetcher.js +164 -0
- package/dist/components/snk-actions-button2.js +4 -2
- package/dist/components/snk-application2.js +26 -17
- package/dist/components/snk-attach2.js +4 -2
- package/dist/components/snk-crud.js +101 -10
- package/dist/components/snk-data-exporter2.js +6 -4
- package/dist/components/snk-data-unit2.js +424 -177
- package/dist/components/snk-detail-view2.js +87 -9
- package/dist/components/snk-filter-bar2.js +6 -1
- package/dist/components/snk-form-config2.js +1 -1
- package/dist/components/snk-form-view2.js +72 -1
- package/dist/components/snk-form.js +52 -5
- package/dist/components/snk-grid2.js +109 -12
- package/dist/components/snk-simple-crud2.js +157 -11
- package/dist/esm/{ConfigStorage-928c3bf4.js → ConfigStorage-174101b9.js} +2 -1
- package/dist/esm/{form-config-fetcher-e3094014.js → DataFetcher-4b4b7beb.js} +1 -250
- package/dist/esm/{IExporterProvider-e2a1195d.js → IExporterProvider-cf5a56ee.js} +54 -12
- package/dist/esm/{SnkFormConfigManager-a87ade7a.js → SnkFormConfigManager-3bdb3e1f.js} +4 -4
- package/dist/esm/{SnkMessageBuilder-0a4becdd.js → SnkMessageBuilder-3a767111.js} +6 -12
- package/dist/esm/{auth-fetcher-e1cb288f.js → auth-fetcher-9f86c346.js} +1 -1
- package/dist/esm/{pesquisa-fetcher-6d8e50bb.js → dataunit-fetcher-f3fa35b9.js} +63 -165
- package/dist/esm/form-config-fetcher-5d72aaf1.js +253 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pesquisa-fetcher-9cfab836.js +164 -0
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +5 -3
- package/dist/esm/snk-application.entry.js +30 -20
- package/dist/esm/snk-attach.entry.js +5 -3
- package/dist/esm/snk-crud.entry.js +95 -10
- package/dist/esm/snk-data-exporter.entry.js +8 -6
- package/dist/esm/snk-data-unit-8d6afa43.js +668 -0
- package/dist/esm/snk-data-unit.entry.js +10 -2
- package/dist/esm/snk-detail-view.entry.js +48 -7
- package/dist/esm/snk-filter-bar.entry.js +8 -3
- package/dist/esm/snk-filter-modal-item.entry.js +3 -2
- package/dist/esm/snk-form-config.entry.js +2 -1
- package/dist/esm/snk-form-view.entry.js +67 -0
- package/dist/esm/snk-form.entry.js +53 -7
- package/dist/esm/snk-grid.entry.js +104 -12
- package/dist/esm/{snk-guides-viewer-1fd41a25.js → snk-guides-viewer-11cf8dc7.js} +36 -7
- package/dist/esm/snk-guides-viewer.entry.js +8 -6
- package/dist/esm/snk-personalized-filter.entry.js +3 -2
- package/dist/esm/snk-simple-crud.entry.js +153 -14
- package/dist/sankhyablocks/p-010d475f.js +1 -0
- package/dist/sankhyablocks/p-0a28cb19.entry.js +1 -0
- package/dist/sankhyablocks/p-188e1432.entry.js +1 -0
- package/dist/sankhyablocks/p-1c6debe6.entry.js +1 -0
- package/dist/sankhyablocks/p-1db45d26.entry.js +1 -0
- package/dist/sankhyablocks/p-2a84e45b.entry.js +1 -0
- package/dist/sankhyablocks/p-2cc2d8fd.entry.js +1 -0
- package/dist/sankhyablocks/p-3e4c2cfe.entry.js +11 -0
- package/dist/sankhyablocks/p-4a8a149d.entry.js +1 -0
- package/dist/sankhyablocks/p-4ce73e88.js +1 -0
- package/dist/sankhyablocks/p-50e72d6c.js +1 -0
- package/dist/sankhyablocks/{p-e27496ed.js → p-566f5f50.js} +6 -6
- package/dist/sankhyablocks/p-59dccb7a.entry.js +1 -0
- package/dist/sankhyablocks/p-5bd78e4c.entry.js +1 -0
- package/dist/sankhyablocks/p-6b2be902.js +6 -0
- package/dist/sankhyablocks/p-8171e586.entry.js +1 -0
- package/dist/sankhyablocks/p-a6dfa396.js +1 -0
- package/dist/sankhyablocks/p-a97060b0.js +1 -0
- package/dist/sankhyablocks/p-aa854fa8.entry.js +1 -0
- package/dist/sankhyablocks/p-b27114c4.js +1 -0
- package/dist/sankhyablocks/p-b643f746.entry.js +1 -0
- package/dist/sankhyablocks/p-b68918fc.entry.js +1 -0
- package/dist/sankhyablocks/p-da7c81d6.entry.js +1 -0
- package/dist/sankhyablocks/p-e0c27486.js +26 -0
- package/dist/sankhyablocks/p-e238279a.entry.js +1 -0
- package/dist/sankhyablocks/p-eae66367.js +1 -0
- package/dist/sankhyablocks/p-fde91811.js +60 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +6 -2
- package/dist/types/components/snk-crud/interfaces/PropsCustomEditor.d.ts +4 -0
- package/dist/types/components/snk-crud/interfaces/PropsCustomRender.d.ts +4 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +32 -1
- package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +23 -0
- package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +28 -3
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +19 -0
- package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +3 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +61 -2
- package/dist/types/components/snk-data-unit/test/resources/metadataMock.d.ts +3 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
- package/dist/types/components/snk-form/snk-form.d.ts +14 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +42 -3
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +40 -2
- package/dist/types/components.d.ts +180 -4
- package/dist/types/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.d.ts +11 -0
- package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +2 -1
- package/dist/types/lib/dataUnit/ValueFormatter.d.ts +2 -0
- package/dist/types/lib/dataUnit/interfaces/InMemoryLoaderConfig.d.ts +3 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.d.ts +10 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.d.ts +7 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +6 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.d.ts +20 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.d.ts +2 -0
- package/package.json +1 -1
- package/dist/cjs/snk-data-unit-abd2113f.js +0 -427
- package/dist/esm/snk-data-unit-29eba11a.js +0 -425
- package/dist/sankhyablocks/p-029bfc09.js +0 -1
- package/dist/sankhyablocks/p-03dcc5ff.entry.js +0 -1
- package/dist/sankhyablocks/p-07825198.js +0 -1
- package/dist/sankhyablocks/p-0e8702f0.js +0 -1
- package/dist/sankhyablocks/p-13ea113d.entry.js +0 -1
- package/dist/sankhyablocks/p-314e2d1a.entry.js +0 -1
- package/dist/sankhyablocks/p-32556aa6.js +0 -1
- package/dist/sankhyablocks/p-3357af48.js +0 -1
- package/dist/sankhyablocks/p-3c2a1f4d.js +0 -65
- package/dist/sankhyablocks/p-3e7167dd.js +0 -1
- package/dist/sankhyablocks/p-536eeb16.js +0 -26
- package/dist/sankhyablocks/p-587f9dcf.entry.js +0 -1
- package/dist/sankhyablocks/p-61984566.entry.js +0 -1
- package/dist/sankhyablocks/p-61b6126e.entry.js +0 -1
- package/dist/sankhyablocks/p-65b6dba3.entry.js +0 -1
- package/dist/sankhyablocks/p-6a7bc5c8.entry.js +0 -1
- package/dist/sankhyablocks/p-6c9edfd8.entry.js +0 -1
- package/dist/sankhyablocks/p-89bde7d3.entry.js +0 -1
- package/dist/sankhyablocks/p-91dceecf.entry.js +0 -1
- package/dist/sankhyablocks/p-a40cbad8.entry.js +0 -1
- package/dist/sankhyablocks/p-b86ea293.entry.js +0 -1
- package/dist/sankhyablocks/p-d8ddb2a4.entry.js +0 -11
- package/dist/sankhyablocks/p-f92f1f5f.entry.js +0 -1
- package/dist/sankhyablocks/p-fa84e72f.entry.js +0 -1
|
@@ -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,49 @@ 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
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Registra um formatador de valores para uma coluna da grid.
|
|
103
|
+
*/
|
|
104
|
+
async addCustomValueFormatter(columnName, customFormatter) {
|
|
105
|
+
this._snkGrid.addCustomValueFormatter(columnName, customFormatter);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Remove o formatador de valores de uma coluna da grid.
|
|
109
|
+
*/
|
|
110
|
+
async removeCustomValueFormatter(columnName) {
|
|
111
|
+
this._snkGrid.removeCustomValueFormatter(columnName);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
|
115
|
+
*/
|
|
116
|
+
async setFieldProp(fieldName, propName, value) {
|
|
117
|
+
await this._guidesViewer.setFieldProp(fieldName, propName, value);
|
|
118
|
+
}
|
|
73
119
|
currentViewModeWatcher(currentView) {
|
|
74
120
|
this._viewHistory = [...this._viewHistory.slice(-1), currentView];
|
|
75
121
|
}
|
|
@@ -123,6 +169,29 @@ export class SnkCrud {
|
|
|
123
169
|
const joinedPrimaryKeys = recordCriteria.map(({ value }) => value).join('_');
|
|
124
170
|
return joinedPrimaryKeys;
|
|
125
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
|
+
}
|
|
126
195
|
componentWillLoad() {
|
|
127
196
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
128
197
|
let parent = this._element.parentElement;
|
|
@@ -145,12 +214,7 @@ export class SnkCrud {
|
|
|
145
214
|
else {
|
|
146
215
|
this.initDataUnit();
|
|
147
216
|
}
|
|
148
|
-
this._snkDataUnit.addEventListener("dataStateChange",
|
|
149
|
-
this._dataState = dataState;
|
|
150
|
-
if (dataState.selectedRecord !== undefined) {
|
|
151
|
-
this.attachmentRegisterKey = await this.getAttachmentRegisterKey();
|
|
152
|
-
}
|
|
153
|
-
});
|
|
217
|
+
this._snkDataUnit.addEventListener("dataStateChange", this.handleDataStateChange.bind(this));
|
|
154
218
|
break;
|
|
155
219
|
}
|
|
156
220
|
parent = parent.parentElement;
|
|
@@ -166,6 +230,26 @@ export class SnkCrud {
|
|
|
166
230
|
this.removeShortcuts();
|
|
167
231
|
window.removeEventListener("keydown", this._keyDownHandler);
|
|
168
232
|
}
|
|
233
|
+
async handleDataStateChange(evt) {
|
|
234
|
+
var _a;
|
|
235
|
+
this._dataState = evt.detail;
|
|
236
|
+
if (this._dataState.selectedRecord !== undefined) {
|
|
237
|
+
this.attachmentRegisterKey = await this.getAttachmentRegisterKey();
|
|
238
|
+
}
|
|
239
|
+
const fieldsWithRmPrecision = await this._snkDataUnit.getFieldsWithRmPrecision();
|
|
240
|
+
for (const field of fieldsWithRmPrecision || []) {
|
|
241
|
+
if (!field) {
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
const rmPrecision = (_a = this._dataState.rowMetadata) === null || _a === void 0 ? void 0 : _a.getProp('rm_precision', field);
|
|
245
|
+
if (!rmPrecision && rmPrecision !== 0) {
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
await this.setFieldProp(field, 'precision', rmPrecision);
|
|
249
|
+
await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
|
|
250
|
+
}
|
|
251
|
+
;
|
|
252
|
+
}
|
|
169
253
|
async initKeyboardManager() {
|
|
170
254
|
var _a;
|
|
171
255
|
const keyboardManager = await ((_a = this._application) === null || _a === void 0 ? void 0 : _a.getKeyboardManager());
|
|
@@ -285,7 +369,7 @@ export class SnkCrud {
|
|
|
285
369
|
return;
|
|
286
370
|
}
|
|
287
371
|
this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
|
|
288
|
-
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" }))));
|
|
289
373
|
}
|
|
290
374
|
static get is() { return "snk-crud"; }
|
|
291
375
|
static get encapsulation() { return "scoped"; }
|
|
@@ -606,6 +690,23 @@ export class SnkCrud {
|
|
|
606
690
|
},
|
|
607
691
|
"attribute": "disable-personalized-filter",
|
|
608
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
|
|
609
710
|
}
|
|
610
711
|
};
|
|
611
712
|
}
|
|
@@ -777,6 +878,128 @@ export class SnkCrud {
|
|
|
777
878
|
"text": "Retorna o elemento da filter-bar da grade.",
|
|
778
879
|
"tags": []
|
|
779
880
|
}
|
|
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
|
+
},
|
|
934
|
+
"addCustomValueFormatter": {
|
|
935
|
+
"complexType": {
|
|
936
|
+
"signature": "(columnName: string, customFormatter: ICustomFormatter) => Promise<void>",
|
|
937
|
+
"parameters": [{
|
|
938
|
+
"tags": [],
|
|
939
|
+
"text": ""
|
|
940
|
+
}, {
|
|
941
|
+
"tags": [],
|
|
942
|
+
"text": ""
|
|
943
|
+
}],
|
|
944
|
+
"references": {
|
|
945
|
+
"Promise": {
|
|
946
|
+
"location": "global"
|
|
947
|
+
},
|
|
948
|
+
"ICustomFormatter": {
|
|
949
|
+
"location": "import",
|
|
950
|
+
"path": "@sankhyalabs/ezui/dist/types/components/ez-grid/interfaces"
|
|
951
|
+
}
|
|
952
|
+
},
|
|
953
|
+
"return": "Promise<void>"
|
|
954
|
+
},
|
|
955
|
+
"docs": {
|
|
956
|
+
"text": "Registra um formatador de valores para uma coluna da grid.",
|
|
957
|
+
"tags": []
|
|
958
|
+
}
|
|
959
|
+
},
|
|
960
|
+
"removeCustomValueFormatter": {
|
|
961
|
+
"complexType": {
|
|
962
|
+
"signature": "(columnName: string) => Promise<void>",
|
|
963
|
+
"parameters": [{
|
|
964
|
+
"tags": [],
|
|
965
|
+
"text": ""
|
|
966
|
+
}],
|
|
967
|
+
"references": {
|
|
968
|
+
"Promise": {
|
|
969
|
+
"location": "global"
|
|
970
|
+
}
|
|
971
|
+
},
|
|
972
|
+
"return": "Promise<void>"
|
|
973
|
+
},
|
|
974
|
+
"docs": {
|
|
975
|
+
"text": "Remove o formatador de valores de uma coluna da grid.",
|
|
976
|
+
"tags": []
|
|
977
|
+
}
|
|
978
|
+
},
|
|
979
|
+
"setFieldProp": {
|
|
980
|
+
"complexType": {
|
|
981
|
+
"signature": "(fieldName: string, propName: string, value: any) => Promise<void>",
|
|
982
|
+
"parameters": [{
|
|
983
|
+
"tags": [],
|
|
984
|
+
"text": ""
|
|
985
|
+
}, {
|
|
986
|
+
"tags": [],
|
|
987
|
+
"text": ""
|
|
988
|
+
}, {
|
|
989
|
+
"tags": [],
|
|
990
|
+
"text": ""
|
|
991
|
+
}],
|
|
992
|
+
"references": {
|
|
993
|
+
"Promise": {
|
|
994
|
+
"location": "global"
|
|
995
|
+
}
|
|
996
|
+
},
|
|
997
|
+
"return": "Promise<void>"
|
|
998
|
+
},
|
|
999
|
+
"docs": {
|
|
1000
|
+
"text": "Altera/adiciona uma propriedade nos metadados do campo.",
|
|
1001
|
+
"tags": []
|
|
1002
|
+
}
|
|
780
1003
|
}
|
|
781
1004
|
};
|
|
782
1005
|
}
|
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() {
|