@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-78242.2 → 0.0.0-bugfix-dev-KB-80932.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-f079f5fd.js → ConfigStorage-d024aec8.js} +2 -2
- package/dist/cjs/{ContinuousInsertUtils-64e47516.js → ContinuousInsertUtils-54d44192.js} +5 -5
- package/dist/cjs/{DataFetcher-e059eb72.js → DataFetcher-65879b2c.js} +188 -56
- package/dist/cjs/{SnkFormConfigManager-63369164.js → SnkFormConfigManager-ae3185b2.js} +2 -2
- package/dist/cjs/{auth-fetcher-4f853233.js → auth-fetcher-8480751c.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-228016f4.js → dataunit-fetcher-8ea97d88.js} +2 -2
- package/dist/cjs/{form-config-fetcher-39397ac5.js → form-config-fetcher-90126e4c.js} +38 -1
- package/dist/cjs/index-f9e81701.js +8 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-a9bfeb22.js → pesquisa-fetcher-f3454c23.js} +179 -1
- package/dist/cjs/pesquisa-grid_2.cjs.entry.js +133 -0
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/{snk-actions-button_4.cjs.entry.js → snk-actions-button_5.cjs.entry.js} +99 -9
- package/dist/cjs/snk-application.cjs.entry.js +144 -21
- package/dist/cjs/snk-attach.cjs.entry.js +13 -9
- package/dist/cjs/snk-config-options_3.cjs.entry.js +4 -4
- package/dist/cjs/snk-crud.cjs.entry.js +8 -7
- package/dist/cjs/snk-data-exporter.cjs.entry.js +29 -18
- package/dist/cjs/{snk-data-unit-3d9b6ed4.js → snk-data-unit-72ef8777.js} +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
- package/dist/cjs/snk-detail-view.cjs.entry.js +7 -7
- package/dist/cjs/snk-filter-bar_4.cjs.entry.js +27 -11
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
- package/dist/cjs/snk-grid.cjs.entry.js +9 -8
- package/dist/cjs/{snk-guides-viewer-2139481c.js → snk-guides-viewer-ea5d0907.js} +5 -5
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
- package/dist/cjs/snk-pesquisa.cjs.entry.js +105 -31
- package/dist/cjs/snk-simple-crud.cjs.entry.js +27 -29
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/snk-actions-button/actions/index.js +4 -4
- package/dist/collection/components/snk-application/request-listener/DebouncedRequestListener.js +4 -3
- package/dist/collection/components/snk-application/snk-application.css +34 -0
- package/dist/collection/components/snk-application/snk-application.js +197 -14
- package/dist/collection/components/snk-attach/structure/builder/taskbar-builder.js +8 -4
- package/dist/collection/components/snk-crud/snk-crud.js +39 -20
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +11 -5
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +11 -4
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +1 -1
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +1 -3
- package/dist/collection/components/snk-data-exporter/utils/ParserExport.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +3 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +40 -8
- package/dist/collection/components/snk-grid/snk-grid.js +39 -20
- package/dist/collection/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.css +10 -0
- package/dist/collection/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.js +190 -0
- package/dist/collection/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.css +25 -0
- package/dist/collection/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.js +179 -0
- package/dist/collection/components/snk-pesquisa/pesquisaHelper.js +89 -0
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +24 -5
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +168 -32
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +56 -41
- package/dist/collection/components/snk-simple-form-config/snk-simple-form-config.css +22 -0
- package/dist/collection/components/snk-simple-form-config/snk-simple-form-config.js +181 -0
- package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +1 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +41 -4
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +92 -3
- package/dist/components/ContinuousInsertUtils.js +2 -3
- package/dist/components/DataFetcher.js +188 -56
- package/dist/components/ISave.js +346 -1
- package/dist/components/dataunit-fetcher.js +1 -1
- package/dist/components/form-config-fetcher.js +37 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +3 -0
- package/dist/components/pesquisa-grid.d.ts +11 -0
- package/dist/components/pesquisa-grid.js +6 -0
- package/dist/components/pesquisa-grid2.js +86 -0
- package/dist/components/pesquisa-tree.d.ts +11 -0
- package/dist/components/pesquisa-tree.js +6 -0
- package/dist/components/pesquisa-tree2.js +82 -0
- package/dist/components/snk-actions-button2.js +4 -5
- package/dist/components/snk-application2.js +159 -20
- package/dist/components/snk-attach2.js +20 -35
- package/dist/components/snk-crud.js +66 -59
- package/dist/components/snk-data-exporter2.js +25 -15
- package/dist/components/snk-detail-view2.js +84 -94
- package/dist/components/snk-filter-bar2.js +23 -8
- package/dist/components/snk-filter-modal.js +3 -1
- package/dist/components/snk-grid2.js +5 -4
- package/dist/components/snk-pesquisa2.js +118 -33
- package/dist/components/snk-simple-crud2.js +35 -56
- package/dist/components/snk-simple-form-config.d.ts +11 -0
- package/dist/components/snk-simple-form-config.js +6 -0
- package/dist/components/snk-simple-form-config2.js +120 -0
- package/dist/components/teste-pesquisa.js +13 -1
- package/dist/esm/{ConfigStorage-6514d66e.js → ConfigStorage-373bb440.js} +2 -2
- package/dist/esm/{ContinuousInsertUtils-b62906f9.js → ContinuousInsertUtils-25e7bd9a.js} +5 -5
- package/dist/esm/{DataFetcher-5034df59.js → DataFetcher-5221b992.js} +188 -56
- package/dist/esm/{SnkFormConfigManager-b409c745.js → SnkFormConfigManager-b65e6db0.js} +2 -2
- package/dist/esm/{auth-fetcher-ca5d3a49.js → auth-fetcher-e32fe8a4.js} +1 -1
- package/dist/esm/{dataunit-fetcher-56cb648b.js → dataunit-fetcher-8dd93d8b.js} +2 -2
- package/dist/esm/{form-config-fetcher-a7d3e277.js → form-config-fetcher-126e2471.js} +38 -1
- package/dist/esm/index-a7d3d3f1.js +8 -4
- package/dist/esm/loader.js +1 -1
- package/dist/{components/pesquisa-fetcher.js → esm/pesquisa-fetcher-0af41f09.js} +180 -3
- package/dist/esm/pesquisa-grid_2.entry.js +128 -0
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/{snk-actions-button_4.entry.js → snk-actions-button_5.entry.js} +99 -10
- package/dist/esm/snk-application.entry.js +146 -23
- package/dist/esm/snk-attach.entry.js +13 -9
- package/dist/esm/snk-config-options_3.entry.js +4 -4
- package/dist/esm/snk-crud.entry.js +8 -7
- package/dist/esm/snk-data-exporter.entry.js +29 -18
- package/dist/esm/{snk-data-unit-9fa7d2b9.js → snk-data-unit-11a49fc3.js} +1 -1
- package/dist/esm/snk-data-unit.entry.js +3 -3
- package/dist/esm/snk-detail-view.entry.js +7 -7
- package/dist/esm/snk-filter-bar_4.entry.js +28 -12
- package/dist/esm/snk-filter-modal-item.entry.js +3 -3
- package/dist/esm/snk-grid.entry.js +9 -8
- package/dist/esm/{snk-guides-viewer-b7ed39eb.js → snk-guides-viewer-830f5fb9.js} +5 -5
- package/dist/esm/snk-guides-viewer.entry.js +7 -7
- package/dist/esm/snk-personalized-filter.entry.js +3 -3
- package/dist/esm/snk-pesquisa.entry.js +105 -31
- package/dist/esm/snk-simple-crud.entry.js +27 -29
- package/dist/sankhyablocks/{p-0e206e62.js → p-05b6ff91.js} +1 -1
- package/dist/sankhyablocks/p-09067bee.entry.js +1 -0
- package/dist/sankhyablocks/p-0cda2226.entry.js +11 -0
- package/dist/sankhyablocks/p-1435701f.js +26 -0
- package/dist/sankhyablocks/{p-e97be1c8.js → p-171b7623.js} +1 -1
- package/dist/sankhyablocks/{p-9ffd9fc7.js → p-19dc71e9.js} +1 -1
- package/dist/sankhyablocks/{p-0d2a2e9e.entry.js → p-1a91d1f3.entry.js} +1 -1
- package/dist/sankhyablocks/{p-aa003d4e.entry.js → p-1cf39cfd.entry.js} +1 -1
- package/dist/sankhyablocks/{p-bb8ef149.entry.js → p-254c59d2.entry.js} +1 -1
- package/dist/sankhyablocks/p-422eb699.entry.js +1 -0
- package/dist/sankhyablocks/{p-a2c790ac.entry.js → p-469384a2.entry.js} +1 -1
- package/dist/sankhyablocks/p-54f5354a.entry.js +1 -0
- package/dist/sankhyablocks/{p-342eeb3b.js → p-60e4db34.js} +1 -1
- package/dist/sankhyablocks/p-618a29ed.entry.js +1 -0
- package/dist/sankhyablocks/p-798386c7.js +6 -0
- package/dist/sankhyablocks/{p-fca0e5cc.entry.js → p-82ee6dc3.entry.js} +1 -1
- package/dist/sankhyablocks/{p-e4391e16.js → p-8a1ee5b5.js} +1 -1
- package/dist/sankhyablocks/p-8bd86610.entry.js +1 -0
- package/dist/sankhyablocks/p-b50a0753.entry.js +1 -0
- package/dist/sankhyablocks/p-d62228fb.js +1 -0
- package/dist/sankhyablocks/p-d92d4f91.entry.js +1 -0
- package/dist/sankhyablocks/{p-47d24ac8.js → p-ddefbbc7.js} +1 -1
- package/dist/sankhyablocks/p-e5430b29.entry.js +1 -0
- package/dist/sankhyablocks/p-f0b9303b.js +1 -0
- package/dist/sankhyablocks/p-f258690a.entry.js +1 -0
- package/dist/sankhyablocks/{p-ec43fcc8.entry.js → p-f975370f.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +22 -4
- package/dist/types/components/snk-crud/snk-crud.d.ts +8 -4
- package/dist/types/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.d.ts +1 -0
- package/dist/types/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.d.ts +1 -0
- package/dist/types/components/snk-data-exporter/utils/ParserExport.d.ts +1 -1
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +6 -1
- package/dist/types/components/snk-grid/snk-grid.d.ts +8 -4
- package/dist/types/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.d.ts +38 -0
- package/dist/types/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.d.ts +29 -0
- package/dist/types/components/snk-pesquisa/pesquisaHelper.d.ts +19 -0
- package/dist/types/components/snk-pesquisa/snk-pesquisa.d.ts +35 -1
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +10 -4
- package/dist/types/components/snk-simple-form-config/snk-simple-form-config.d.ts +34 -0
- package/dist/types/components.d.ts +244 -23
- package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +8 -2
- package/dist/types/lib/http/data-fetcher/fetchers/pesquisa-fetcher.d.ts +10 -1
- package/package.json +1 -1
- package/react/components.d.ts +3 -0
- package/react/components.js +3 -0
- package/react/components.js.map +1 -1
- package/dist/esm/pesquisa-fetcher-6bc2e41a.js +0 -169
- package/dist/sankhyablocks/p-00278e07.js +0 -1
- package/dist/sankhyablocks/p-0387d9d7.entry.js +0 -1
- package/dist/sankhyablocks/p-126c58ea.js +0 -26
- package/dist/sankhyablocks/p-1d3ce0d9.entry.js +0 -1
- package/dist/sankhyablocks/p-341465ce.js +0 -6
- package/dist/sankhyablocks/p-3728d2aa.entry.js +0 -11
- package/dist/sankhyablocks/p-4138da61.entry.js +0 -1
- package/dist/sankhyablocks/p-5d9788b3.entry.js +0 -1
- package/dist/sankhyablocks/p-7075b789.entry.js +0 -1
- package/dist/sankhyablocks/p-aaf94476.js +0 -1
- package/dist/sankhyablocks/p-af7f7b3e.entry.js +0 -1
- package/dist/sankhyablocks/p-d1791da2.entry.js +0 -1
- package/dist/sankhyablocks/p-eb7c9cf4.entry.js +0 -1
|
@@ -30,18 +30,18 @@ export class SnkSimpleCrud {
|
|
|
30
30
|
"snkSimpleCrudTaskbar.finish_edition": this.getFinishEditionButtonsCallback.bind(this)
|
|
31
31
|
});
|
|
32
32
|
this._showPopUpGridConfig = false;
|
|
33
|
-
this._showFormConfig = false;
|
|
34
33
|
this._currentViewMode = VIEW_MODE.GRID;
|
|
35
34
|
this._config = undefined;
|
|
36
35
|
this._fieldToGetFocus = undefined;
|
|
37
36
|
this._customContainerId = `SNK-SIMPLE-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
|
|
37
|
+
this.enableLockManagerLoadingComp = false;
|
|
38
|
+
this.enableLockManagerTaskbarClick = false;
|
|
38
39
|
this.dataState = undefined;
|
|
39
40
|
this.dataUnit = undefined;
|
|
40
41
|
this.entityName = undefined;
|
|
41
42
|
this.mode = SIMPLE_CRUD_MODE.SERVER;
|
|
42
43
|
this.gridConfig = undefined;
|
|
43
44
|
this.formConfig = undefined;
|
|
44
|
-
this.enableLockManger = false;
|
|
45
45
|
this._formFields = [];
|
|
46
46
|
this._fieldsProps = new Map();
|
|
47
47
|
this._enableContinuousInsert = true;
|
|
@@ -251,15 +251,9 @@ export class SnkSimpleCrud {
|
|
|
251
251
|
});
|
|
252
252
|
}
|
|
253
253
|
async openFormConfig() {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
if (this.formLegacyConfigName) {
|
|
257
|
-
const title = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.formConfigUnavaliable.title", undefined);
|
|
258
|
-
const message = (_b = this.messagesBuilder) === null || _b === void 0 ? void 0 : _b.getMessage("snkSimpleCrud.formConfigUnavaliable.message", undefined);
|
|
259
|
-
await this.application.alert(title, message);
|
|
260
|
-
return;
|
|
254
|
+
if (this.formLegacyConfigName || this.configName) {
|
|
255
|
+
await this._snkSimpleFormConfig.show();
|
|
261
256
|
}
|
|
262
|
-
this._showFormConfig = true;
|
|
263
257
|
}
|
|
264
258
|
addGridLegacyConfigName() {
|
|
265
259
|
if (this.gridLegacyConfigName && this.configName) {
|
|
@@ -289,7 +283,7 @@ export class SnkSimpleCrud {
|
|
|
289
283
|
formConfigIsLoaded() {
|
|
290
284
|
return this.formConfig != undefined || this._formConfigAlreadyLoaded;
|
|
291
285
|
}
|
|
292
|
-
async loadFormConfig(forceLoad = false) {
|
|
286
|
+
async loadFormConfig(forceLoad = false, forceSetNewConfig = false) {
|
|
293
287
|
if (this.configName === undefined) {
|
|
294
288
|
return;
|
|
295
289
|
}
|
|
@@ -304,7 +298,7 @@ export class SnkSimpleCrud {
|
|
|
304
298
|
let loadedLegacyConfig = await this._formConfigFetcher.fetchLegacyConfigurableForm(this.formLegacyConfigName);
|
|
305
299
|
if (loadedLegacyConfig != undefined) {
|
|
306
300
|
this._formConfigManager.setConfig(loadedLegacyConfig);
|
|
307
|
-
this.setFormConfig(loadedLegacyConfig);
|
|
301
|
+
this.setFormConfig(loadedLegacyConfig, forceSetNewConfig);
|
|
308
302
|
return;
|
|
309
303
|
}
|
|
310
304
|
this.setFormConfig(await this._formConfigManager.loadConfig());
|
|
@@ -688,9 +682,6 @@ export class SnkSimpleCrud {
|
|
|
688
682
|
closeGridConfig() {
|
|
689
683
|
this._showPopUpGridConfig = false;
|
|
690
684
|
}
|
|
691
|
-
closeFormConfig() {
|
|
692
|
-
this._showFormConfig = false;
|
|
693
|
-
}
|
|
694
685
|
getPageSize() {
|
|
695
686
|
if (this.mode === SIMPLE_CRUD_MODE.IN_MEMORY) {
|
|
696
687
|
return 0;
|
|
@@ -700,10 +691,6 @@ export class SnkSimpleCrud {
|
|
|
700
691
|
}
|
|
701
692
|
return this.pageSize;
|
|
702
693
|
}
|
|
703
|
-
//No momento não daremos suporte para configuração de formulário quando houver formLegacyConfigName
|
|
704
|
-
handleShowFormConfig() {
|
|
705
|
-
return this._showFormConfig && !this.formLegacyConfigName;
|
|
706
|
-
}
|
|
707
694
|
resolveResourceID() {
|
|
708
695
|
return StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
|
|
709
696
|
}
|
|
@@ -716,7 +703,10 @@ export class SnkSimpleCrud {
|
|
|
716
703
|
return configFromManager;
|
|
717
704
|
}
|
|
718
705
|
updateFormConfig() {
|
|
719
|
-
|
|
706
|
+
let newConfig = this.formConfig;
|
|
707
|
+
if (this.formLegacyConfigName == undefined) {
|
|
708
|
+
newConfig = Object.assign(Object.assign({}, this.formConfig), { fields: this.dataUnit.metadata.fields });
|
|
709
|
+
}
|
|
720
710
|
this.setFormConfig(newConfig, true);
|
|
721
711
|
if (this._formConfigManager == undefined) {
|
|
722
712
|
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
|
@@ -729,8 +719,12 @@ export class SnkSimpleCrud {
|
|
|
729
719
|
this.goToView(VIEW_MODE.FORM);
|
|
730
720
|
}
|
|
731
721
|
async initKeyboardManager() {
|
|
722
|
+
var _a;
|
|
732
723
|
const keyboardManager = new KeyboardManager();
|
|
733
|
-
const dataUnit = this.dataUnit || await this._snkDataUnit.getDataUnit();
|
|
724
|
+
const dataUnit = this.dataUnit || await ((_a = this._snkDataUnit) === null || _a === void 0 ? void 0 : _a.getDataUnit());
|
|
725
|
+
if (dataUnit == undefined) {
|
|
726
|
+
return;
|
|
727
|
+
}
|
|
734
728
|
keyboardManager
|
|
735
729
|
.bind("F7", () => dataUnit.saveData(), { description: "Salva os dados.", element: this._element })
|
|
736
730
|
.bind("F8", dataUnit.addRecord.bind(dataUnit), { description: "Adiciona um novo registro.", element: this._element })
|
|
@@ -744,18 +738,22 @@ export class SnkSimpleCrud {
|
|
|
744
738
|
description: "Cancela uma ação.", element: this._element
|
|
745
739
|
});
|
|
746
740
|
}
|
|
741
|
+
async handleFormConfigSaved() {
|
|
742
|
+
await this.loadFormConfig(true, true);
|
|
743
|
+
}
|
|
747
744
|
renderTaskbarContent() {
|
|
748
745
|
var _a;
|
|
749
746
|
return (h("snk-taskbar", { class: this._currentViewMode === VIEW_MODE.FORM && `ez-box ${this.outlineMode ? 'ez-box--outline' : 'ez-box--shadow-xsmall'} ez-padding--small`, 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" })));
|
|
750
747
|
}
|
|
751
748
|
/* istanbul ignore next */
|
|
752
749
|
render() {
|
|
750
|
+
var _a;
|
|
753
751
|
if (this.dataUnit == undefined) {
|
|
754
752
|
return;
|
|
755
753
|
}
|
|
756
754
|
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.handleDataUnitOnInsertionMode.bind(this), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: `ez-box ${this.outlineMode ? 'ez-box--outline' : 'ez-box--shadow'} simple-crud__container-section` }, 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)
|
|
757
755
|
? undefined
|
|
758
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert,
|
|
756
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManagerTaskbarClick: this.enableLockManagerTaskbarClick, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp, outlineMode: this.outlineMode }, this.renderTaskbarContent(), h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, this.renderTaskbarContent(), h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), h("snk-simple-form-config", { ref: (ref) => this._snkSimpleFormConfig = ref, dataUnit: this.dataUnit, onSnkConfigSaved: this.handleFormConfigSaved.bind(this), configName: (_a = this.formLegacyConfigName) !== null && _a !== void 0 ? _a : this.configName })), 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() }))));
|
|
759
757
|
}
|
|
760
758
|
static get is() { return "snk-simple-crud"; }
|
|
761
759
|
static get encapsulation() { return "scoped"; }
|
|
@@ -771,6 +769,42 @@ export class SnkSimpleCrud {
|
|
|
771
769
|
}
|
|
772
770
|
static get properties() {
|
|
773
771
|
return {
|
|
772
|
+
"enableLockManagerLoadingComp": {
|
|
773
|
+
"type": "boolean",
|
|
774
|
+
"mutable": false,
|
|
775
|
+
"complexType": {
|
|
776
|
+
"original": "boolean",
|
|
777
|
+
"resolved": "boolean",
|
|
778
|
+
"references": {}
|
|
779
|
+
},
|
|
780
|
+
"required": false,
|
|
781
|
+
"optional": true,
|
|
782
|
+
"docs": {
|
|
783
|
+
"tags": [],
|
|
784
|
+
"text": "Define se o componente deve usar o LockManager para controle de carregamento da aplica\u00E7\u00E3o"
|
|
785
|
+
},
|
|
786
|
+
"attribute": "enable-lock-manager-loading-comp",
|
|
787
|
+
"reflect": false,
|
|
788
|
+
"defaultValue": "false"
|
|
789
|
+
},
|
|
790
|
+
"enableLockManagerTaskbarClick": {
|
|
791
|
+
"type": "boolean",
|
|
792
|
+
"mutable": false,
|
|
793
|
+
"complexType": {
|
|
794
|
+
"original": "boolean",
|
|
795
|
+
"resolved": "boolean",
|
|
796
|
+
"references": {}
|
|
797
|
+
},
|
|
798
|
+
"required": false,
|
|
799
|
+
"optional": true,
|
|
800
|
+
"docs": {
|
|
801
|
+
"tags": [],
|
|
802
|
+
"text": "Ativa o gerenciamento de locks na grade pela Taskbar."
|
|
803
|
+
},
|
|
804
|
+
"attribute": "enable-lock-manager-taskbar-click",
|
|
805
|
+
"reflect": false,
|
|
806
|
+
"defaultValue": "false"
|
|
807
|
+
},
|
|
774
808
|
"dataState": {
|
|
775
809
|
"type": "unknown",
|
|
776
810
|
"mutable": false,
|
|
@@ -891,24 +925,6 @@ export class SnkSimpleCrud {
|
|
|
891
925
|
"text": ""
|
|
892
926
|
}
|
|
893
927
|
},
|
|
894
|
-
"enableLockManger": {
|
|
895
|
-
"type": "boolean",
|
|
896
|
-
"mutable": false,
|
|
897
|
-
"complexType": {
|
|
898
|
-
"original": "boolean",
|
|
899
|
-
"resolved": "boolean",
|
|
900
|
-
"references": {}
|
|
901
|
-
},
|
|
902
|
-
"required": false,
|
|
903
|
-
"optional": true,
|
|
904
|
-
"docs": {
|
|
905
|
-
"tags": [],
|
|
906
|
-
"text": ""
|
|
907
|
-
},
|
|
908
|
-
"attribute": "enable-lock-manger",
|
|
909
|
-
"reflect": false,
|
|
910
|
-
"defaultValue": "false"
|
|
911
|
-
},
|
|
912
928
|
"multipleSelection": {
|
|
913
929
|
"type": "boolean",
|
|
914
930
|
"mutable": false,
|
|
@@ -1239,7 +1255,6 @@ export class SnkSimpleCrud {
|
|
|
1239
1255
|
static get states() {
|
|
1240
1256
|
return {
|
|
1241
1257
|
"_showPopUpGridConfig": {},
|
|
1242
|
-
"_showFormConfig": {},
|
|
1243
1258
|
"_currentViewMode": {},
|
|
1244
1259
|
"_config": {},
|
|
1245
1260
|
"_fieldToGetFocus": {},
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.config-container {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.config-lists {
|
|
13
|
+
margin-bottom: 12px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.config-actions {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: row;
|
|
19
|
+
justify-content: flex-end;
|
|
20
|
+
width: 100%;
|
|
21
|
+
gap: 12px;
|
|
22
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
|
+
import { FormConfigFetcher } from '../../lib';
|
|
3
|
+
export class SnkSimpleFormConfig {
|
|
4
|
+
constructor() {
|
|
5
|
+
this._formConfigFetcher = new FormConfigFetcher();
|
|
6
|
+
this.fieldsToSave = [];
|
|
7
|
+
this.dataUnit = undefined;
|
|
8
|
+
this.configName = undefined;
|
|
9
|
+
this.avaliableFields = [];
|
|
10
|
+
this.selectedFields = [];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Responsável por abrir o configurador.
|
|
14
|
+
*/
|
|
15
|
+
async show() {
|
|
16
|
+
var _a;
|
|
17
|
+
await ((_a = this.ezDoubleListRef) === null || _a === void 0 ? void 0 : _a.resetSelectedLists());
|
|
18
|
+
await this.initializeFormConfig();
|
|
19
|
+
this.ezPopupRef.opened = true;
|
|
20
|
+
}
|
|
21
|
+
;
|
|
22
|
+
async initializeFormConfig() {
|
|
23
|
+
if (!this.configName)
|
|
24
|
+
return;
|
|
25
|
+
const allFields = this.getAllVisibleFieldsFromDataUnit();
|
|
26
|
+
const displayedFieldNameList = await this.getConfig();
|
|
27
|
+
//Quando não retorna dados, é por quê não existe configuração do usuário salva.
|
|
28
|
+
if (displayedFieldNameList.length === 0) {
|
|
29
|
+
this.avaliableFields = [];
|
|
30
|
+
this.selectedFields = [...allFields];
|
|
31
|
+
this.fieldsToSave = [...this.selectedFields];
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const selectedFieldsAux = this.sortDisplayedFields(displayedFieldNameList, allFields);
|
|
35
|
+
const avaliableFieldsAux = allFields.filter(field => !displayedFieldNameList.includes(field.id));
|
|
36
|
+
this.avaliableFields = [...avaliableFieldsAux];
|
|
37
|
+
this.selectedFields = [...selectedFieldsAux];
|
|
38
|
+
this.fieldsToSave = [...this.selectedFields];
|
|
39
|
+
}
|
|
40
|
+
async getConfig() {
|
|
41
|
+
const fieldList = await this._formConfigFetcher.fetchSimpleFormConfig(this.configName);
|
|
42
|
+
return [...this.removeDuplicates(fieldList)];
|
|
43
|
+
}
|
|
44
|
+
removeDuplicates(strings) {
|
|
45
|
+
return strings.filter((item, index) => strings.indexOf(item) === index);
|
|
46
|
+
}
|
|
47
|
+
sortDisplayedFields(displayedFieldNameList, allFields) {
|
|
48
|
+
const selectedFieldsAux = [];
|
|
49
|
+
//É preciso garantir a ordem na qual os campos vieram na resposta do fetchSimpleFormConfig.
|
|
50
|
+
displayedFieldNameList.forEach(fieldName => {
|
|
51
|
+
const field = allFields.find(field => field.id === fieldName);
|
|
52
|
+
if (!field)
|
|
53
|
+
return;
|
|
54
|
+
selectedFieldsAux.push(field);
|
|
55
|
+
});
|
|
56
|
+
return selectedFieldsAux;
|
|
57
|
+
}
|
|
58
|
+
getAllVisibleFieldsFromDataUnit() {
|
|
59
|
+
var _a, _b, _c;
|
|
60
|
+
const visibleFields = ((_c = (_b = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.fields) !== null && _c !== void 0 ? _c : []).filter(field => field.visible);
|
|
61
|
+
return visibleFields.map(field => {
|
|
62
|
+
return { id: field.name, label: field.label };
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
close() {
|
|
66
|
+
this.ezPopupRef.opened = false;
|
|
67
|
+
}
|
|
68
|
+
async handleResetConfigs() {
|
|
69
|
+
await this._formConfigFetcher.restoreFormConfig(this.configName);
|
|
70
|
+
await this.initializeFormConfig();
|
|
71
|
+
await this.handleSave();
|
|
72
|
+
}
|
|
73
|
+
handleCancel() {
|
|
74
|
+
this.close();
|
|
75
|
+
}
|
|
76
|
+
async handleSave() {
|
|
77
|
+
const saveList = this.fieldsToSave.map(field => field.id);
|
|
78
|
+
await this._formConfigFetcher.saveSimpleFormConfig(this.configName, saveList);
|
|
79
|
+
this.close();
|
|
80
|
+
this.snkConfigSaved.emit();
|
|
81
|
+
}
|
|
82
|
+
render() {
|
|
83
|
+
return (h("ez-popup", { ref: (ref) => this.ezPopupRef = ref, heightMode: 'auto', size: 'auto', ezTitle: 'Configurar formul\u00E1rio' }, h("div", { class: 'config-container' }, h("div", { class: 'config-lists' }, h("ez-double-list", { ref: (ref) => this.ezDoubleListRef = ref, leftList: this.avaliableFields, leftTitle: 'Campos disponíveis', rightList: this.selectedFields, rightTitle: 'Campos selecionados', onEzRightListChanged: ({ detail }) => this.fieldsToSave = [...detail], entityLabel: 'campo', entityLabelPlural: 'campos' })), h("div", { class: 'config-actions' }, h("ez-button", { label: 'Restaurar', onClick: this.handleResetConfigs.bind(this), size: 'small' }), h("ez-button", { label: 'Cancelar', onClick: this.handleCancel.bind(this), size: 'small' }), h("ez-button", { label: 'Salvar', class: 'ez-button--primary', onClick: this.handleSave.bind(this), size: 'small' })))));
|
|
84
|
+
}
|
|
85
|
+
static get is() { return "snk-simple-form-config"; }
|
|
86
|
+
static get originalStyleUrls() {
|
|
87
|
+
return {
|
|
88
|
+
"$": ["snk-simple-form-config.css"]
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
static get styleUrls() {
|
|
92
|
+
return {
|
|
93
|
+
"$": ["snk-simple-form-config.css"]
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
static get properties() {
|
|
97
|
+
return {
|
|
98
|
+
"dataUnit": {
|
|
99
|
+
"type": "unknown",
|
|
100
|
+
"mutable": false,
|
|
101
|
+
"complexType": {
|
|
102
|
+
"original": "DataUnit",
|
|
103
|
+
"resolved": "DataUnit",
|
|
104
|
+
"references": {
|
|
105
|
+
"DataUnit": {
|
|
106
|
+
"location": "import",
|
|
107
|
+
"path": "@sankhyalabs/core"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"required": false,
|
|
112
|
+
"optional": false,
|
|
113
|
+
"docs": {
|
|
114
|
+
"tags": [],
|
|
115
|
+
"text": "Data unit respons\u00E1vel pelos campos dispon\u00EDveis"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"configName": {
|
|
119
|
+
"type": "string",
|
|
120
|
+
"mutable": false,
|
|
121
|
+
"complexType": {
|
|
122
|
+
"original": "string",
|
|
123
|
+
"resolved": "string",
|
|
124
|
+
"references": {}
|
|
125
|
+
},
|
|
126
|
+
"required": false,
|
|
127
|
+
"optional": false,
|
|
128
|
+
"docs": {
|
|
129
|
+
"tags": [],
|
|
130
|
+
"text": "Chave que representa a configura\u00E7\u00E3o do formul\u00E1rio"
|
|
131
|
+
},
|
|
132
|
+
"attribute": "config-name",
|
|
133
|
+
"reflect": false
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
static get states() {
|
|
138
|
+
return {
|
|
139
|
+
"avaliableFields": {},
|
|
140
|
+
"selectedFields": {}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
static get events() {
|
|
144
|
+
return [{
|
|
145
|
+
"method": "snkConfigSaved",
|
|
146
|
+
"name": "snkConfigSaved",
|
|
147
|
+
"bubbles": true,
|
|
148
|
+
"cancelable": true,
|
|
149
|
+
"composed": true,
|
|
150
|
+
"docs": {
|
|
151
|
+
"tags": [],
|
|
152
|
+
"text": ""
|
|
153
|
+
},
|
|
154
|
+
"complexType": {
|
|
155
|
+
"original": "void",
|
|
156
|
+
"resolved": "void",
|
|
157
|
+
"references": {}
|
|
158
|
+
}
|
|
159
|
+
}];
|
|
160
|
+
}
|
|
161
|
+
static get methods() {
|
|
162
|
+
return {
|
|
163
|
+
"show": {
|
|
164
|
+
"complexType": {
|
|
165
|
+
"signature": "() => Promise<void>",
|
|
166
|
+
"parameters": [],
|
|
167
|
+
"references": {
|
|
168
|
+
"Promise": {
|
|
169
|
+
"location": "global"
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
"return": "Promise<void>"
|
|
173
|
+
},
|
|
174
|
+
"docs": {
|
|
175
|
+
"text": "Respons\u00E1vel por abrir o configurador.",
|
|
176
|
+
"tags": []
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
@@ -23,7 +23,7 @@ export function buildLoadDataResponse(recordsIn, dataUnit, request) {
|
|
|
23
23
|
};
|
|
24
24
|
return Promise.resolve({
|
|
25
25
|
records: getPagesByRecords(records, offset, limit),
|
|
26
|
-
paginationInfo: buildPaginationInfo(paginationInfoBuilderParams),
|
|
26
|
+
paginationInfo: dataUnit.pageSize ? buildPaginationInfo(paginationInfoBuilderParams) : undefined,
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
export function applySorting(records, dataUnit, sorting) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { gql } from
|
|
2
|
-
import { ObjectUtils } from
|
|
3
|
-
import { ResourceFetcher } from
|
|
4
|
-
import { DataFetcher } from
|
|
1
|
+
import { gql } from 'graphql-request';
|
|
2
|
+
import { ObjectUtils } from '@sankhyalabs/core';
|
|
3
|
+
import { ResourceFetcher } from './resource-fetcher';
|
|
4
|
+
import { DataFetcher } from '../DataFetcher';
|
|
5
5
|
export class FormConfigFetcher extends ResourceFetcher {
|
|
6
6
|
constructor() {
|
|
7
7
|
super();
|
|
@@ -178,6 +178,43 @@ export class FormConfigFetcher extends ResourceFetcher {
|
|
|
178
178
|
return undefined;
|
|
179
179
|
return this.buildLegacyConfigurableForm(response);
|
|
180
180
|
}
|
|
181
|
+
async fetchSimpleFormConfig(configName) {
|
|
182
|
+
const payload = { 'requestBody': { 'formConfig': { 'configName': configName } } };
|
|
183
|
+
const response = await DataFetcher.get().callServiceBroker('FormConfig.getFormConfig', JSON.stringify(payload));
|
|
184
|
+
return this.processConfig(response);
|
|
185
|
+
}
|
|
186
|
+
async saveSimpleFormConfig(configName, fieldList) {
|
|
187
|
+
const payload = this.buildSaveSimpleFormConfigPayload(configName, fieldList);
|
|
188
|
+
const response = await DataFetcher.get().callServiceBroker('FormConfig.saveFormConfig', JSON.stringify(payload));
|
|
189
|
+
this.processConfig(response);
|
|
190
|
+
}
|
|
191
|
+
processConfig(response) {
|
|
192
|
+
if (ObjectUtils.isEmpty(response))
|
|
193
|
+
return [];
|
|
194
|
+
const fields = this.getResponseAsArray(response);
|
|
195
|
+
return fields.map(field => field.name);
|
|
196
|
+
}
|
|
197
|
+
getResponseAsArray(response) {
|
|
198
|
+
var _a, _b, _c;
|
|
199
|
+
const rawFields = (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.formConfig) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : [];
|
|
200
|
+
return Array.isArray(rawFields) ? rawFields : [rawFields];
|
|
201
|
+
}
|
|
202
|
+
buildSaveSimpleFormConfigPayload(configName, fieldNameList) {
|
|
203
|
+
const fieldList = fieldNameList.map(fieldName => { return { name: fieldName }; });
|
|
204
|
+
return {
|
|
205
|
+
formConfig: {
|
|
206
|
+
configName,
|
|
207
|
+
layout: {
|
|
208
|
+
field: fieldList,
|
|
209
|
+
},
|
|
210
|
+
metadata: { field: [] },
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
async restoreFormConfig(configName) {
|
|
215
|
+
const payload = { 'requestBody': { 'formConfig': { 'configName': configName } } };
|
|
216
|
+
await DataFetcher.get().callServiceBroker('FormConfig.restoreFormConfig', JSON.stringify(payload));
|
|
217
|
+
}
|
|
181
218
|
buildLegacyConfigurableForm(config) {
|
|
182
219
|
var _a, _b, _c;
|
|
183
220
|
const rawFields = (_c = (_b = (_a = config === null || config === void 0 ? void 0 : config.formConfig) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : [];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { parseGridConfig, parseLegacyTree } from '../../../../components/snk-pesquisa/pesquisaHelper';
|
|
2
|
+
import { ApplicationContext, DataType, ErrorException } from '@sankhyalabs/core';
|
|
3
|
+
import { gql } from 'graphql-request';
|
|
4
|
+
import { DataFetcher } from '../DataFetcher';
|
|
4
5
|
export class PesquisaFetcher {
|
|
5
6
|
constructor() {
|
|
6
7
|
this._defaultPageSize = 100;
|
|
@@ -73,6 +74,9 @@ export class PesquisaFetcher {
|
|
|
73
74
|
value = ApplicationContext.getContextValue(`__SNK__APPLICATION__FILTER__CONTEXT(${match[1]})__`);
|
|
74
75
|
}
|
|
75
76
|
}
|
|
77
|
+
if (param.dataType === DataType.NUMBER && value === undefined) {
|
|
78
|
+
throw new ErrorException("Falha detectada", `O campo ${param.name} deve ser informado.`);
|
|
79
|
+
}
|
|
76
80
|
let type = param.dataType;
|
|
77
81
|
if (type === DataType.OBJECT) {
|
|
78
82
|
value = value.value;
|
|
@@ -147,6 +151,91 @@ export class PesquisaFetcher {
|
|
|
147
151
|
return;
|
|
148
152
|
return listener[listenerType]({ argument, criteria, searchOptions });
|
|
149
153
|
}
|
|
154
|
+
async loadPresentationConfig(entityName) {
|
|
155
|
+
var _a, _b;
|
|
156
|
+
let payload = buildLoadConfig(entityName);
|
|
157
|
+
const response = await DataFetcher.get().callServiceBroker("SystemUtilsSP.getConf", JSON.stringify(payload));
|
|
158
|
+
return (_b = (_a = response === null || response === void 0 ? void 0 : response.config) === null || _a === void 0 ? void 0 : _a.lastUsedMode) !== null && _b !== void 0 ? _b : 'list';
|
|
159
|
+
}
|
|
160
|
+
async savePresentationConfig(entityName, lastUsedMode) {
|
|
161
|
+
let payload = buildSaveConfig(entityName, lastUsedMode);
|
|
162
|
+
await DataFetcher.get().callServiceBroker("SystemUtilsSP.saveConf", JSON.stringify(payload));
|
|
163
|
+
}
|
|
164
|
+
async loadPesquisaGridConfig(entityName) {
|
|
165
|
+
const payload = buildLoadGridConfigPayload(entityName);
|
|
166
|
+
const response = await DataFetcher.get().callServiceBroker("GridConfig.getGridConfigFromJson", JSON.stringify(payload));
|
|
167
|
+
return parseGridConfig(response);
|
|
168
|
+
}
|
|
169
|
+
async savePesquisaGridConfig(entityName, columns) {
|
|
170
|
+
const payload = buildSaveGridConfigPayload(entityName, columns);
|
|
171
|
+
await DataFetcher.get().callServiceBroker("GridConfig.saveGridConfigFromJSON", JSON.stringify(payload));
|
|
172
|
+
}
|
|
173
|
+
async loadTree(entityName, argument, criteria, searchOptions) {
|
|
174
|
+
const requestBody = this.buildLoadTreeRequestBody(entityName, argument, criteria, searchOptions);
|
|
175
|
+
const response = await DataFetcher.get().callServiceBroker("Pesquisa.getStructuredData", JSON.stringify(requestBody));
|
|
176
|
+
return parseLegacyTree(response);
|
|
177
|
+
}
|
|
178
|
+
buildLoadTreeRequestBody(entityName, argument, criteria, searchOptions) {
|
|
179
|
+
var _a, _b, _c;
|
|
180
|
+
const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, searchOptions);
|
|
181
|
+
console.log("criteria: ", criteria);
|
|
182
|
+
const incomeSearchOptions = (_a = listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions) !== null && _a !== void 0 ? _a : searchOptions;
|
|
183
|
+
const rootEntity = incomeSearchOptions === null || incomeSearchOptions === void 0 ? void 0 : incomeSearchOptions.rootEntity;
|
|
184
|
+
const codeFieldName = incomeSearchOptions === null || incomeSearchOptions === void 0 ? void 0 : incomeSearchOptions.codeFieldName;
|
|
185
|
+
const expression = (_b = listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.criteria) === null || _b === void 0 ? void 0 : _b.expression;
|
|
186
|
+
const params = (_c = listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.criteria) === null || _c === void 0 ? void 0 : _c.params;
|
|
187
|
+
const instancia = {
|
|
188
|
+
'nome': entityName,
|
|
189
|
+
'nomeInstanciaLocal': rootEntity,
|
|
190
|
+
'codeFieldName': codeFieldName,
|
|
191
|
+
};
|
|
192
|
+
if (expression) {
|
|
193
|
+
instancia['criterioLiteral'] = {
|
|
194
|
+
'expressao': {
|
|
195
|
+
'$': expression,
|
|
196
|
+
},
|
|
197
|
+
'parametro': params,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
'instancia': instancia,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
function buildLoadGridConfigPayload(entityName) {
|
|
206
|
+
return {
|
|
207
|
+
'gridConfig': {
|
|
208
|
+
'configName': `GrdCfgHtml5:grdcfg.dynaform.pesquisa.${entityName}`,
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function buildSaveGridConfigPayload(entityName, columns) {
|
|
213
|
+
const field = {};
|
|
214
|
+
columns === null || columns === void 0 ? void 0 : columns.forEach((col, index) => field[`field${index}`] = col);
|
|
215
|
+
return {
|
|
216
|
+
'gridConfig': {
|
|
217
|
+
'compactMode': true,
|
|
218
|
+
'configName': `GrdCfgHtml5:grdcfg.dynaform.pesquisa.${entityName}`,
|
|
219
|
+
field,
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
function buildLoadConfig(entityName) {
|
|
224
|
+
return {
|
|
225
|
+
'config': {
|
|
226
|
+
'chave': `PesquisaContent:${entityName}`,
|
|
227
|
+
'tipo': 'T',
|
|
228
|
+
},
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
function buildSaveConfig(entityName, lastUsedMode) {
|
|
232
|
+
return {
|
|
233
|
+
'config': {
|
|
234
|
+
lastUsedMode,
|
|
235
|
+
'chave': `PesquisaContent:${entityName}`,
|
|
236
|
+
'tipo': 'T',
|
|
237
|
+
}
|
|
238
|
+
};
|
|
150
239
|
}
|
|
151
240
|
function convertParamType(dataType) {
|
|
152
241
|
//Alerta: Cuidado pra não contaminar o DataType com a implementação
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { D as DataFetcher } from './DataFetcher.js';
|
|
2
|
-
import './pesquisa-fetcher.js';
|
|
3
|
-
import { SortMode, ApplicationContext, UserInterface, DateUtils, ObjectUtils, StringUtils, NumberUtils, DataType } from '@sankhyalabs/core';
|
|
4
2
|
import './ISave.js';
|
|
3
|
+
import { SortMode, ApplicationContext, UserInterface, DateUtils, ObjectUtils, StringUtils, NumberUtils, DataType } from '@sankhyalabs/core';
|
|
5
4
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
6
5
|
import { UserInterface as UserInterface$1 } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
7
6
|
import { P as PreloadManager } from './dataunit-fetcher.js';
|
|
@@ -284,7 +283,7 @@ class CommonsExporter {
|
|
|
284
283
|
const columnData = {
|
|
285
284
|
label: column.label,
|
|
286
285
|
id: column.name,
|
|
287
|
-
width: column.width,
|
|
286
|
+
width: (fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface) === UserInterface$1.SEARCH ? 60 : column.width,
|
|
288
287
|
type: fieldData === null || fieldData === void 0 ? void 0 : fieldData.dataType,
|
|
289
288
|
userInterface: fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface,
|
|
290
289
|
customFormatter
|