@sankhyalabs/sankhyablocks 8.16.0-rc.2 → 8.16.0-rc.20
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/{ConfigStorage-a343e418.js → ConfigStorage-ecc0ed20.js} +2 -2
- package/dist/cjs/{IExporterProvider-597949f9.js → ContinuousInsertUtils-29b65619.js} +39 -6
- package/dist/cjs/{DataFetcher-313debd8.js → DataFetcher-cadeef8e.js} +21 -15
- package/dist/cjs/{RecordIDUtils-3735135c.js → GetSelectedRecordsIDsInfo-bd50caf1.js} +10 -10
- package/dist/cjs/{SnkFormConfigManager-166cbd1f.js → SnkFormConfigManager-f1c92f79.js} +72 -16
- package/dist/cjs/{SnkMessageBuilder-897ffd08.js → SnkMessageBuilder-bae64d0d.js} +6 -2
- package/dist/cjs/{auth-fetcher-54f5ff9d.js → auth-fetcher-d68841bc.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-688d3f05.js → dataunit-fetcher-f89461c1.js} +46 -18
- package/dist/cjs/{field-search-f56aa7d6.js → field-search-68e34bf4.js} +5 -1
- package/dist/cjs/{form-config-fetcher-2dd00e5b.js → form-config-fetcher-ed497282.js} +5 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-680e198f.js → pesquisa-fetcher-ca89181c.js} +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +17 -14
- package/dist/cjs/snk-application.cjs.entry.js +7 -7
- package/dist/cjs/snk-attach.cjs.entry.js +38 -29
- package/dist/cjs/snk-crud.cjs.entry.js +14 -7
- package/dist/cjs/snk-data-exporter.cjs.entry.js +9 -9
- package/dist/cjs/{snk-data-unit-8fa7917a.js → snk-data-unit-47202e42.js} +18 -9
- package/dist/cjs/snk-data-unit.cjs.entry.js +5 -5
- package/dist/cjs/snk-detail-view.cjs.entry.js +11 -11
- package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-bar.cjs.entry.js +40 -25
- package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-checkbox-list.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
- package/dist/cjs/snk-form-config.cjs.entry.js +17 -5
- package/dist/cjs/snk-form.cjs.entry.js +7 -6
- package/dist/cjs/snk-grid.cjs.entry.js +58 -21
- package/dist/cjs/{snk-guides-viewer-bdc41281.js → snk-guides-viewer-b9920385.js} +29 -13
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +9 -9
- package/dist/cjs/snk-personalized-filter-editor.cjs.entry.js +1 -1
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
- package/dist/cjs/snk-print-selector.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-bar.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +55 -21
- package/dist/cjs/snk-taskbar.cjs.entry.js +24 -1
- package/dist/collection/components/snk-actions-button/actions/index.js +12 -9
- package/dist/collection/components/snk-attach/snk-attach.js +25 -16
- package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +2 -4
- package/dist/collection/components/snk-crud/snk-crud.js +78 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +2 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.css +6 -6
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +72 -6
- package/dist/collection/components/snk-data-exporter/exporter-email-sender/options-step.js +1 -1
- package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +1 -1
- package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +1 -1
- package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +2 -2
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +16 -7
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-personalized-filter-editor/snk-personalized-filter-editor.js +1 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +1 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +77 -21
- package/dist/collection/components/snk-form/snk-form.js +2 -2
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +70 -14
- package/dist/collection/components/snk-form-config/snk-form-config.js +32 -3
- package/dist/collection/components/snk-grid/snk-grid.css +2 -0
- package/dist/collection/components/snk-grid/snk-grid.js +74 -8
- package/dist/collection/components/snk-print-selector/snk-print-selector.js +1 -1
- package/dist/collection/components/snk-simple-bar/snk-simple-bar.js +1 -1
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.css +0 -1
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +63 -10
- package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +5 -1
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +65 -0
- package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +3 -3
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +2 -4
- package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +34 -9
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +22 -16
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.js +7 -5
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +9 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +4 -1
- package/dist/collection/lib/message/resources/snk-exporter.msg.js +1 -1
- package/dist/collection/lib/message/resources/snk-grid.msg.js +5 -1
- package/dist/collection/lib/utils/ContinuousInsertUtils.js +31 -0
- package/dist/collection/{components/snk-data-exporter/utils/RecordIDUtils.js → lib/utils/GetSelectedRecordsIDsInfo.js} +9 -9
- package/dist/components/{IExporterProvider.js → ContinuousInsertUtils.js} +40 -5
- package/dist/components/DataFetcher.js +22 -16
- package/dist/{esm/RecordIDUtils-87d02110.js → components/GetSelectedRecordsIDsInfo.js} +10 -10
- package/dist/components/SnkFormConfigManager.js +70 -14
- package/dist/components/SnkMessageBuilder.js +6 -2
- package/dist/components/dataunit-fetcher.js +45 -15
- package/dist/components/form-config-fetcher.js +4 -1
- package/dist/components/snk-actions-button2.js +12 -9
- package/dist/components/snk-attach2.js +34 -25
- package/dist/components/snk-crud.js +12 -2
- package/dist/components/snk-data-exporter2.js +2 -2
- package/dist/components/snk-data-unit2.js +19 -47
- package/dist/components/snk-detail-view2.js +29 -10
- package/dist/components/snk-exporter-email-sender2.js +1 -1
- package/dist/components/snk-filter-bar2.js +39 -22
- package/dist/components/snk-filter-binary-select.js +1 -1
- package/dist/components/snk-filter-checkbox-list.js +1 -1
- package/dist/components/snk-form-config2.js +16 -3
- package/dist/components/snk-form.js +2 -2
- package/dist/components/snk-grid2.js +51 -12
- package/dist/components/snk-personalized-filter-editor.js +1 -1
- package/dist/components/snk-print-selector.js +1 -1
- package/dist/components/snk-simple-bar2.js +1 -1
- package/dist/components/snk-simple-crud2.js +47 -10
- package/dist/components/snk-taskbar2.js +25 -2
- package/dist/esm/{ConfigStorage-3806514e.js → ConfigStorage-7b36d041.js} +2 -2
- package/dist/esm/{IExporterProvider-63a188b6.js → ContinuousInsertUtils-30caa626.js} +40 -8
- package/dist/esm/{DataFetcher-c1baf61d.js → DataFetcher-a9c598f2.js} +22 -16
- package/dist/esm/GetSelectedRecordsIDsInfo-9fa41508.js +41 -0
- package/dist/esm/{SnkFormConfigManager-31b24066.js → SnkFormConfigManager-139f09fa.js} +72 -16
- package/dist/esm/{SnkMessageBuilder-571462fb.js → SnkMessageBuilder-6fff4a4c.js} +6 -2
- package/dist/esm/{auth-fetcher-039abba3.js → auth-fetcher-749d880f.js} +1 -1
- package/dist/esm/{dataunit-fetcher-264191b2.js → dataunit-fetcher-c24c76c6.js} +46 -16
- package/dist/esm/{field-search-efbe307f.js → field-search-f8b1d91e.js} +5 -1
- package/dist/esm/{form-config-fetcher-30fb808f.js → form-config-fetcher-adbe5d34.js} +5 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-03c8f919.js → pesquisa-fetcher-8edaa8cd.js} +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +17 -14
- package/dist/esm/snk-application.entry.js +7 -7
- package/dist/esm/snk-attach.entry.js +38 -29
- package/dist/esm/snk-crud.entry.js +14 -7
- package/dist/esm/snk-data-exporter.entry.js +9 -9
- package/dist/esm/{snk-data-unit-f5cbe64b.js → snk-data-unit-de45e0e1.js} +18 -9
- package/dist/esm/snk-data-unit.entry.js +5 -5
- package/dist/esm/snk-detail-view.entry.js +11 -11
- package/dist/esm/snk-exporter-email-sender.entry.js +1 -1
- package/dist/esm/snk-filter-bar.entry.js +40 -25
- package/dist/esm/snk-filter-binary-select.entry.js +1 -1
- package/dist/esm/snk-filter-checkbox-list.entry.js +1 -1
- package/dist/esm/snk-filter-modal-item.entry.js +3 -3
- package/dist/esm/snk-form-config.entry.js +17 -5
- package/dist/esm/snk-form.entry.js +7 -6
- package/dist/esm/snk-grid.entry.js +53 -16
- package/dist/esm/{snk-guides-viewer-dda0fede.js → snk-guides-viewer-beb6baef.js} +29 -13
- package/dist/esm/snk-guides-viewer.entry.js +9 -9
- package/dist/esm/snk-personalized-filter-editor.entry.js +1 -1
- package/dist/esm/snk-personalized-filter.entry.js +3 -3
- package/dist/esm/snk-print-selector.entry.js +1 -1
- package/dist/esm/snk-simple-bar.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +51 -17
- package/dist/esm/snk-taskbar.entry.js +24 -1
- package/dist/sankhyablocks/{p-df5451c7.js → p-06421fdb.js} +2 -2
- package/dist/sankhyablocks/p-16a1dd18.entry.js +1 -0
- package/dist/sankhyablocks/p-17425c72.js +1 -0
- package/dist/sankhyablocks/{p-af8efd95.js → p-1bf06cd3.js} +2 -2
- package/dist/sankhyablocks/{p-47db7e88.entry.js → p-212213d9.entry.js} +1 -1
- package/dist/sankhyablocks/p-23736d75.js +1 -0
- package/dist/sankhyablocks/p-2923c1b5.js +1 -0
- package/dist/sankhyablocks/p-2aae03a1.entry.js +1 -0
- package/dist/sankhyablocks/{p-871aa14e.entry.js → p-31e74634.entry.js} +1 -1
- package/dist/sankhyablocks/p-38b85e5a.entry.js +1 -0
- package/dist/sankhyablocks/{p-72fc257b.entry.js → p-434817f0.entry.js} +1 -1
- package/dist/sankhyablocks/{p-52920496.js → p-4d9549cf.js} +1 -1
- package/dist/sankhyablocks/p-5b51491f.entry.js +1 -0
- package/dist/sankhyablocks/{p-aaa3ee68.entry.js → p-5f157b09.entry.js} +1 -1
- package/dist/sankhyablocks/p-60b29483.entry.js +1 -0
- package/dist/sankhyablocks/p-62e048c6.entry.js +1 -0
- package/dist/sankhyablocks/p-7ac7932c.js +60 -0
- package/dist/sankhyablocks/p-7dd49d15.js +1 -0
- package/dist/sankhyablocks/{p-41f8bfa3.entry.js → p-8c235d4c.entry.js} +1 -1
- package/dist/sankhyablocks/p-92eadb1c.entry.js +1 -0
- package/dist/sankhyablocks/{p-7619bdb1.entry.js → p-a42e7a1e.entry.js} +2 -2
- package/dist/sankhyablocks/p-a75d242d.entry.js +1 -0
- package/dist/sankhyablocks/p-afbb070d.js +1 -0
- package/dist/sankhyablocks/p-bccfc262.js +1 -0
- package/dist/sankhyablocks/p-c2e468c9.entry.js +1 -0
- package/dist/sankhyablocks/p-c5546f92.js +1 -0
- package/dist/sankhyablocks/p-c6db5eeb.entry.js +1 -0
- package/dist/sankhyablocks/{p-913a9979.js → p-ca5ec380.js} +1 -1
- package/dist/sankhyablocks/p-da34270e.entry.js +1 -0
- package/dist/sankhyablocks/p-dcead955.entry.js +1 -0
- package/dist/sankhyablocks/p-eb9f0407.entry.js +1 -0
- package/dist/sankhyablocks/p-f3434fc4.js +1 -0
- package/dist/sankhyablocks/{p-2c68b3ae.entry.js → p-fb34e0cf.entry.js} +1 -1
- package/dist/sankhyablocks/p-fbb1b675.entry.js +1 -0
- package/dist/sankhyablocks/p-fe7b6d1d.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/actions/index.d.ts +1 -0
- package/dist/types/components/snk-attach/snk-attach.d.ts +1 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +13 -0
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +15 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +1 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +9 -0
- package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +7 -2
- package/dist/types/components/snk-form-config/snk-form-config.d.ts +4 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +11 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +9 -0
- package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +1 -0
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +11 -0
- package/dist/types/components.d.ts +97 -0
- package/dist/types/lib/dataUnit/dataUnitInMemoryUtils.d.ts +12 -2
- package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.d.ts +3 -2
- package/dist/types/lib/utils/ContinuousInsertUtils.d.ts +10 -0
- package/dist/types/lib/utils/GetSelectedRecordsIDsInfo.d.ts +3 -0
- package/package.json +2 -2
- package/dist/sankhyablocks/p-17def7cd.js +0 -1
- package/dist/sankhyablocks/p-219f888d.entry.js +0 -1
- package/dist/sankhyablocks/p-2a408684.js +0 -1
- package/dist/sankhyablocks/p-3a212712.js +0 -1
- package/dist/sankhyablocks/p-450c60e4.entry.js +0 -1
- package/dist/sankhyablocks/p-4e5e1313.entry.js +0 -1
- package/dist/sankhyablocks/p-62ba211a.entry.js +0 -1
- package/dist/sankhyablocks/p-6bb2f3e9.entry.js +0 -1
- package/dist/sankhyablocks/p-7505da04.entry.js +0 -1
- package/dist/sankhyablocks/p-75e674ed.entry.js +0 -1
- package/dist/sankhyablocks/p-7a85fd49.entry.js +0 -1
- package/dist/sankhyablocks/p-7ef9c55c.js +0 -1
- package/dist/sankhyablocks/p-80042dc6.entry.js +0 -1
- package/dist/sankhyablocks/p-88aa931b.entry.js +0 -1
- package/dist/sankhyablocks/p-8c59edd7.entry.js +0 -1
- package/dist/sankhyablocks/p-9863d682.js +0 -1
- package/dist/sankhyablocks/p-b05d8893.entry.js +0 -1
- package/dist/sankhyablocks/p-b11aa1e0.entry.js +0 -1
- package/dist/sankhyablocks/p-c2495304.js +0 -1
- package/dist/sankhyablocks/p-d6e26ea8.entry.js +0 -1
- package/dist/sankhyablocks/p-dc7c9047.js +0 -1
- package/dist/sankhyablocks/p-f2809746.entry.js +0 -1
- package/dist/sankhyablocks/p-fa4d8cb4.js +0 -1
- package/dist/sankhyablocks/p-fe79f83a.js +0 -60
- package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +0 -3
@@ -27,6 +27,9 @@ export class SnkGuidesViewer {
|
|
27
27
|
this.resourceID = undefined;
|
28
28
|
this.detailTaskbarCustomContainerId = undefined;
|
29
29
|
this.formLegacyConfigName = undefined;
|
30
|
+
this.enableGridInsert = false;
|
31
|
+
this.ignoreReadOnlyFormFields = undefined;
|
32
|
+
this.getCustomTitle = undefined;
|
30
33
|
this._hasToCreateFieldSearch = true;
|
31
34
|
this._breadcrumbItems = [];
|
32
35
|
this._guides = undefined;
|
@@ -95,7 +98,7 @@ export class SnkGuidesViewer {
|
|
95
98
|
this._container.focus();
|
96
99
|
}
|
97
100
|
exitViewer() {
|
98
|
-
if (this.dataUnit.isDirty()) {
|
101
|
+
if (!this.enableGridInsert && this.dataUnit.isDirty()) {
|
99
102
|
this.dataUnit.cancelEdition({ after: () => this.exit.emit() });
|
100
103
|
}
|
101
104
|
else {
|
@@ -204,10 +207,13 @@ export class SnkGuidesViewer {
|
|
204
207
|
const invisibleButtons = this.getInvisibleButtons();
|
205
208
|
this._taskbarProcessor = new TaskbarProcessor({
|
206
209
|
"snkGuideViewer.regular": btnsRegularMode,
|
207
|
-
"snkGuideViewer.finish_edition": ["CANCEL", "SAVE"],
|
210
|
+
"snkGuideViewer.finish_edition": ["CANCEL", "SAVE", this.handleAddGridMode()],
|
208
211
|
});
|
209
212
|
this._taskbarProcessor.process(taskbarId, this.taskbarManager, this.dataState, disabledButtons, invisibleButtons);
|
210
213
|
}
|
214
|
+
handleAddGridMode() {
|
215
|
+
return this.enableGridInsert ? TaskbarElement.GRID_MODE : "";
|
216
|
+
}
|
211
217
|
getInvisibleButtons() {
|
212
218
|
const invisibleButtons = [];
|
213
219
|
if (this.dataState && this.dataState.selectionInfo.mode === SelectionMode.ALL_RECORDS)
|
@@ -360,11 +366,14 @@ export class SnkGuidesViewer {
|
|
360
366
|
this._configManager.addFormLegacyConfig(this.formLegacyConfigName);
|
361
367
|
}
|
362
368
|
}
|
369
|
+
setMasterFormConfig(config) {
|
370
|
+
this.masterFormConfig = config;
|
371
|
+
}
|
363
372
|
componentWillLoad() {
|
364
373
|
if (this.resourceID == undefined) {
|
365
374
|
throw new Error("Erro interno: resourceID não informado");
|
366
375
|
}
|
367
|
-
this._configManager = new SnkFormConfigManager(this.configName, this.resourceID,
|
376
|
+
this._configManager = new SnkFormConfigManager(this.configName, this.resourceID, this.setMasterFormConfig.bind(this), this.dataUnit);
|
368
377
|
this.addFormLegacyConfigName();
|
369
378
|
this._configManager.loadConfig();
|
370
379
|
}
|
@@ -392,7 +401,7 @@ export class SnkGuidesViewer {
|
|
392
401
|
return this._fieldSearch;
|
393
402
|
}
|
394
403
|
fieldsOptionLoader(argument) {
|
395
|
-
return Promise.resolve(this._configManager.getFieldsList(
|
404
|
+
return Promise.resolve(this._configManager.getFieldsList(argument)
|
396
405
|
.map(field => ({ value: field.name, label: field.label })));
|
397
406
|
}
|
398
407
|
onSelectField(option, actionButton) {
|
@@ -430,6 +439,9 @@ export class SnkGuidesViewer {
|
|
430
439
|
await this.addErrorBadgeToGuide(guideName);
|
431
440
|
await this.openGuideNavigator(guideName);
|
432
441
|
}
|
442
|
+
if (action.type === DUAction.METADATA_LOADED) {
|
443
|
+
this.loadGuides(false);
|
444
|
+
}
|
433
445
|
}
|
434
446
|
async addErrorBadgeToGuide(guideName) {
|
435
447
|
var _a;
|
@@ -464,20 +476,24 @@ export class SnkGuidesViewer {
|
|
464
476
|
}
|
465
477
|
return "";
|
466
478
|
}
|
479
|
+
getTitle() {
|
480
|
+
var _a, _b;
|
481
|
+
return (_b = (_a = this.getCustomTitle) === null || _a === void 0 ? void 0 : _a.call(this)) !== null && _b !== void 0 ? _b : this.getMessage("snkCrud.title");
|
482
|
+
}
|
467
483
|
componentDidLoad() {
|
468
484
|
this.dataUnit.subscribe(this.dataUnitActionHandler.bind(this));
|
469
485
|
}
|
470
486
|
render() {
|
471
487
|
var _a, _b;
|
472
488
|
if (this._formEditorConfigManager != undefined) {
|
473
|
-
return (h("snk-form-config", { ref: ref => this._container = ref, tabindex: -1, dataUnit: this._formEditorDataUnit, messagesBuilder: this.messagesBuilder, configManager: this._formEditorConfigManager, onConfigClose: () => this._formEditorConfigManager = null }));
|
489
|
+
return (h("snk-form-config", { ref: ref => this._container = ref, tabindex: -1, dataUnit: this._formEditorDataUnit, messagesBuilder: this.messagesBuilder, configManager: this._formEditorConfigManager, onConfigClose: () => this._formEditorConfigManager = null, ignoreReadOnlyFormFields: this.ignoreReadOnlyFormFields }));
|
474
490
|
}
|
475
491
|
if (!this.dataUnit || !this._configManager.isLoaded) {
|
476
492
|
return;
|
477
493
|
}
|
478
494
|
this.loadTaskbarProcessor();
|
479
495
|
const showGuides = this._guides && (this._guides.length > 1);
|
480
|
-
return (h("section", { class: "snk-guides-viewer", ref: ref => this._container = ref, tabindex: -1 }, h("div", { class: "ez-row snk-guides-viewer__header" }, h("div", { class: "snk-guides-viewer__header-breadcrumb ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large", key: "header" }, h("ez-button", { onClick: () => this.exitViewer(), title: this.getMessage("snkCrud.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small" }), h("div", { class: "ez-flex ez-flex--column ez-flex-item--auto" }, h("h1", { class: "ez-title ez-title--primary ez-title--xlarge" }, this.
|
496
|
+
return (h("section", { class: "snk-guides-viewer", ref: ref => this._container = ref, tabindex: -1 }, h("div", { class: "ez-row snk-guides-viewer__header" }, h("div", { class: "snk-guides-viewer__header-breadcrumb ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large", key: "header" }, h("ez-button", { onClick: () => this.exitViewer(), title: this.getMessage("snkCrud.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small" }), h("div", { class: "ez-flex ez-flex--column ez-flex-item--auto" }, h("h1", { class: "ez-title ez-title--primary ez-title--xlarge" }, this.getTitle()), ((_a = this._breadcrumbItems) === null || _a === void 0 ? void 0 : _a.length) > 1 &&
|
481
497
|
h("div", { class: "ez-margin-top--extra-small" }, h("ez-breadcrumb", Object.assign({ items: this._breadcrumbItems, onSelectedItem: (evt) => this.onBreadcrumbClickHandler(evt === null || evt === void 0 ? void 0 : evt.detail) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("breadcrumb")}` }))))), this.presentationMode != PresentationMode.SECONDARY && this.buildTaskBar()), h("div", { class: "snk-guides-viewer__container" }, showGuides ?
|
482
498
|
h("ez-guide-navigator", { ref: (ref) => this._guideNavigator = ref, class: "snk-guides-viewer__guide-navigator", items: this._guides, selectedId: this.selectedGuide ? this.selectedGuide.id : undefined, onEzSelectionChange: evt => this.updateSelectedGuideHandler(evt.detail) })
|
483
499
|
:
|
@@ -794,6 +810,56 @@ export class SnkGuidesViewer {
|
|
794
810
|
},
|
795
811
|
"attribute": "form-legacy-config-name",
|
796
812
|
"reflect": false
|
813
|
+
},
|
814
|
+
"enableGridInsert": {
|
815
|
+
"type": "boolean",
|
816
|
+
"mutable": false,
|
817
|
+
"complexType": {
|
818
|
+
"original": "boolean",
|
819
|
+
"resolved": "boolean",
|
820
|
+
"references": {}
|
821
|
+
},
|
822
|
+
"required": false,
|
823
|
+
"optional": true,
|
824
|
+
"docs": {
|
825
|
+
"tags": [],
|
826
|
+
"text": "Ativa inser\u00E7\u00E3o de registros no modo grade."
|
827
|
+
},
|
828
|
+
"attribute": "enable-grid-insert",
|
829
|
+
"reflect": false,
|
830
|
+
"defaultValue": "false"
|
831
|
+
},
|
832
|
+
"ignoreReadOnlyFormFields": {
|
833
|
+
"type": "boolean",
|
834
|
+
"mutable": false,
|
835
|
+
"complexType": {
|
836
|
+
"original": "boolean",
|
837
|
+
"resolved": "boolean",
|
838
|
+
"references": {}
|
839
|
+
},
|
840
|
+
"required": false,
|
841
|
+
"optional": true,
|
842
|
+
"docs": {
|
843
|
+
"tags": [],
|
844
|
+
"text": "Ignora os campos \"somente leitura\" no modo de inser\u00E7\u00E3o."
|
845
|
+
},
|
846
|
+
"attribute": "ignore-read-only-form-fields",
|
847
|
+
"reflect": false
|
848
|
+
},
|
849
|
+
"getCustomTitle": {
|
850
|
+
"type": "unknown",
|
851
|
+
"mutable": false,
|
852
|
+
"complexType": {
|
853
|
+
"original": "() => string",
|
854
|
+
"resolved": "() => string",
|
855
|
+
"references": {}
|
856
|
+
},
|
857
|
+
"required": false,
|
858
|
+
"optional": false,
|
859
|
+
"docs": {
|
860
|
+
"tags": [],
|
861
|
+
"text": "Fornece uma fun\u00E7\u00E3o para obter um t\u00EDtulo customizado do formul\u00E1rio."
|
862
|
+
}
|
797
863
|
}
|
798
864
|
};
|
799
865
|
}
|
@@ -4,7 +4,7 @@ export const OptionsStep = ({ getMessage, changeInfo, data }) => {
|
|
4
4
|
const selectionCount = (data === null || data === void 0 ? void 0 : data.selectedRows) || 0;
|
5
5
|
const formatOptions = [
|
6
6
|
{ label: getMessage("snkExporter.emailSenderOptStep_formatPDF"), value: "pdf" },
|
7
|
-
{ label: getMessage("snkExporter.
|
7
|
+
{ label: getMessage("snkExporter.emailSenderOptStep_formatXLS"), value: "xls" }
|
8
8
|
];
|
9
9
|
const typeOptions = [
|
10
10
|
{ label: getMessage("snkExporter.emailSenderOptStep_allData"), value: "all" },
|
package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { CommonsExporter } from "../interfaces/IExporterProvider";
|
2
2
|
import { UserInterface } from "@sankhyalabs/core";
|
3
|
-
import { getSelectedIDs } from
|
3
|
+
import { getSelectedRecordsIDsInfo as getSelectedIDs } from '../../../lib/utils/GetSelectedRecordsIDsInfo';
|
4
4
|
import { DataExporterOption } from "../../../lib/@types";
|
5
5
|
export default class ClientSideExporterProvider extends CommonsExporter {
|
6
6
|
getSelectedNumber() {
|
package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { CommonsExporter } from "../interfaces/IExporterProvider";
|
2
|
-
import { getSelectedIDs } from
|
2
|
+
import { getSelectedRecordsIDsInfo as getSelectedIDs } from '../../../lib/utils/GetSelectedRecordsIDsInfo';
|
3
3
|
export default class ServerSideExporterProvider extends CommonsExporter {
|
4
4
|
getFilters() {
|
5
5
|
var _a;
|
@@ -110,7 +110,7 @@ export class ItemBuilder {
|
|
110
110
|
getExportToXLS(groupName) {
|
111
111
|
return {
|
112
112
|
id: DataExporterOption.EXPORT_TO_XLS,
|
113
|
-
label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.
|
113
|
+
label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.xls)`,
|
114
114
|
group: groupName
|
115
115
|
};
|
116
116
|
}
|
@@ -153,7 +153,7 @@ export class ItemBuilder {
|
|
153
153
|
getExportPageToXLS() {
|
154
154
|
return {
|
155
155
|
id: DataExporterOption.EXPORT_PAGE_TO_XLS,
|
156
|
-
label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.
|
156
|
+
label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.xls)`
|
157
157
|
};
|
158
158
|
}
|
159
159
|
/**
|
@@ -4,8 +4,8 @@ import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/
|
|
4
4
|
import { OperationMap, SnkMessageBuilder } from '../../lib/message/SnkMessageBuilder';
|
5
5
|
import { DatasetStrategy } from '../../lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy';
|
6
6
|
import { getRecordValue } from '../../lib/dataUnit/ValueFormatter';
|
7
|
-
import { getSelectedIDs } from '../snk-data-exporter/utils/RecordIDUtils';
|
8
7
|
import { convertType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
|
8
|
+
import { getSelectedRecordsIDsInfo } from '../../lib/utils/GetSelectedRecordsIDsInfo';
|
9
9
|
export class SnkDataUnit {
|
10
10
|
constructor() {
|
11
11
|
this._onDataUnitResolve = [];
|
@@ -110,7 +110,7 @@ export class SnkDataUnit {
|
|
110
110
|
* @returns Retorna a lista de IDs dos registros selecionados.
|
111
111
|
*/
|
112
112
|
async getSelectedRecordsIDsInfo() {
|
113
|
-
return
|
113
|
+
return getSelectedRecordsIDsInfo(this.dataUnit);
|
114
114
|
}
|
115
115
|
/**
|
116
116
|
* Retorna os campos que possuem a propriedade "rmp" (Row Metadata Provider).
|
@@ -540,19 +540,28 @@ export class SnkDataUnit {
|
|
540
540
|
return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName, this.resourceID);
|
541
541
|
}
|
542
542
|
}
|
543
|
+
updateMetadataWithRMP() {
|
544
|
+
this.fillFieldsWithRmp(this.dataUnit.metadata);
|
545
|
+
this.fillFieldsWithRmPrecision(this.dataUnit.metadata);
|
546
|
+
const dataUnitUpdatedMetadata = this.handleDULinksOnMetadataLoaded(this.dataUnit.metadata);
|
547
|
+
this.dataUnit.metadata = dataUnitUpdatedMetadata;
|
548
|
+
}
|
543
549
|
async loadDataUnit() {
|
544
|
-
var _a;
|
550
|
+
var _a, _b;
|
545
551
|
if (this.dataUnit == null && this._application && this.entityName) {
|
546
552
|
this.dataUnit = await this.getDataUnitParentOrChild();
|
547
553
|
}
|
548
554
|
if (this.dataUnit) {
|
549
555
|
this.dataUnit.pageSize = this.pageSize;
|
550
556
|
this.dataUnit.unsubscribe(this._dataUnitObserver);
|
551
|
-
this.dataUnit.addInterceptor(this);
|
552
557
|
this.dataUnit.subscribe(this._dataUnitObserver);
|
553
|
-
|
554
|
-
|
555
|
-
|
558
|
+
if ((_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.metadata) {
|
559
|
+
this.updateMetadataWithRMP();
|
560
|
+
}
|
561
|
+
this.dataUnit.addInterceptor(this);
|
562
|
+
if ((_b = this.dataUnit.records) === null || _b === void 0 ? void 0 : _b.length) {
|
563
|
+
const { records } = this.getMetadataByRow(this.dataUnit);
|
564
|
+
this.dataUnit.records = records;
|
556
565
|
}
|
557
566
|
this.dataState = this.buildDataState();
|
558
567
|
let resolver;
|
package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js
CHANGED
@@ -74,7 +74,7 @@ export class SnkFilterBinarySelect {
|
|
74
74
|
}
|
75
75
|
const [optOne, optTwo] = this.config.props.options;
|
76
76
|
if (this.presentationMode === EPresentationMode.MODAL) {
|
77
|
-
return (h(Host, null, h("div", { class: "ez-row ez-size-height--full" }, h("label", { class: "ez-text ez-title--small ez-title--primary ez-size-height--full ez-flex ez-flex--row ez-flex--align-items-center ez-col ez-col--sd-4" }, this.config.detailModal), h("div", { class: "ez-col ez-col--sd-4" }, h("ez-check", { ref: (ref) => this._checkOne = ref, id: `${this.config.id}_${optOne.name || "option1"}`, class: "sc-snk-filter-bar editor__ez-check", label: optOne.label, value: this.isSelected(optOne.name)
|
77
|
+
return (h(Host, null, h("div", { class: "ez-row ez-size-height--full" }, h("label", { class: "ez-text ez-title--small ez-title--primary ez-size-height--full ez-flex ez-flex--row ez-flex--align-items-center ez-col ez-col--sd-4" }, this.config.detailModal), h("div", { class: "ez-col ez-col--sd-4" }, h("ez-check", { ref: (ref) => this._checkOne = ref, id: `${this.config.id}_${optOne.name || "option1"}`, class: "sc-snk-filter-bar editor__ez-check", label: optOne.label, value: this.isSelected(optOne.name) })), h("div", { class: "ez-col ez-col--sd-4" }, h("ez-check", { ref: (ref) => this._checkTwo = ref, id: `${this.config.id}_${optTwo.name || "option2"}`, class: "sc-snk-filter-bar editor__ez-check", label: optTwo.label, value: this.isSelected(optTwo.name) })))));
|
78
78
|
}
|
79
79
|
return (h(Host, null, h("ez-radio-button", { value: this._radioButtonValue }, h("ez-radio-button-option", { id: `${this.config.id}_${optOne.name || "option1"}`, class: "sc-snk-filter-bar editor__ez-check", label: optOne.label, value: optOne.name }), h("ez-radio-button-option", { id: `${this.config.id}_${optTwo.name || "option2"}`, class: "sc-snk-filter-bar editor__ez-check", label: optTwo.label, value: optTwo.name }), h("ez-radio-button-option", { id: `${this.config.id}_option3`, class: "sc-snk-filter-bar editor__ez-check", label: `${optOne.label} + ${optTwo.label}`, value: this._noOptionValue }))));
|
80
80
|
}
|
package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.js
CHANGED
@@ -19,7 +19,7 @@ export class SnkFilterCheckboxList {
|
|
19
19
|
this.valueChanged.emit((_b = this.config) === null || _b === void 0 ? void 0 : _b.value);
|
20
20
|
}
|
21
21
|
renderOptions() {
|
22
|
-
return this.optionsList.map(option => (h("ez-check", { label: option.label,
|
22
|
+
return this.optionsList.map(option => (h("ez-check", { label: option.label, onEzChange: (event) => this.handleToggleCheck(option, event.detail), value: !!this.isChecked(option.name) })));
|
23
23
|
}
|
24
24
|
isChecked(itemName) {
|
25
25
|
var _a;
|
@@ -39,7 +39,7 @@ export class SnkFilterPersonalized {
|
|
39
39
|
}
|
40
40
|
getItemContent(item) {
|
41
41
|
var _a, _b;
|
42
|
-
const CheckboxElement = () => (h("ez-check", Object.assign({ class: "SnkFilterPersonalized_checkbox", id: `param_${item.id}`, key: item.id,
|
42
|
+
const CheckboxElement = () => (h("ez-check", Object.assign({ class: "SnkFilterPersonalized_checkbox", id: `param_${item.id}`, key: item.id, value: item.visible, label: item.label, onEzChange: ({ detail: visible }) => this.handleItemChange.bind(this)(visible, item.id) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo(`checkboxFilter_${item.id}`)}` })));
|
43
43
|
const isVariable = !!((_b = (_a = item.props) === null || _a === void 0 ? void 0 : _a.personalizedFilter) === null || _b === void 0 ? void 0 : _b.parameters.length);
|
44
44
|
return (h("div", { class: `${!this.isModalMode() ? "SnkFilterPersonalized_list-item--chip" : ""}` }, h("li", { class: `${this.isModalMode() ? "SnkFilterPersonalized_list-item--modal" : ""}` }, h("div", { class: "ez-flex ez-flex--align-items-center ez-margin-right--small ez-size-width--full" }, h(CheckboxElement, null), this.buildModalListActions(item, isVariable))), (item.visible && isVariable) && (h("div", { class: "ez-row ez-padding--small" }, this.getFormField(item)))));
|
45
45
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ApplicationContext, ElementIDUtils,
|
1
|
+
import { ApplicationContext, ElementIDUtils, ObjectUtils, ErrorException } from '@sankhyalabs/core';
|
2
2
|
import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection';
|
3
3
|
import { h, Host } from '@stencil/core';
|
4
4
|
import { ConfigStorage } from '../../lib/configs/ConfigStorage';
|
@@ -15,18 +15,19 @@ export class SnkFilterBar {
|
|
15
15
|
this._pendingVariables = false;
|
16
16
|
this._customfiltersToBeUpdated = [];
|
17
17
|
this._calculateSortIndex = (item) => {
|
18
|
-
|
19
|
-
|
20
|
-
if (
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
if (!item.visible)
|
19
|
+
return 0;
|
20
|
+
if (item.hardFixed)
|
21
|
+
return 1000000; //campos Hard Fixed não variam a ordem
|
22
|
+
let index = item.fixed ? 100000 : 0;
|
23
|
+
index += this.hasValidValue(item) ? 10000 : 0;
|
24
|
+
index += this._updateSequence.lastIndexOf(item.id) + 1;
|
25
25
|
return index;
|
26
26
|
};
|
27
27
|
this._filtersComparator = (a, b) => {
|
28
28
|
return this._calculateSortIndex(b) - this._calculateSortIndex(a);
|
29
29
|
};
|
30
|
+
this.customFilterBarConfig = undefined;
|
30
31
|
this.dataUnit = undefined;
|
31
32
|
this.title = undefined;
|
32
33
|
this.configName = undefined;
|
@@ -37,11 +38,19 @@ export class SnkFilterBar {
|
|
37
38
|
this.disablePersonalizedFilter = undefined;
|
38
39
|
this.filterBarLegacyConfigName = undefined;
|
39
40
|
this.autoLoad = undefined;
|
41
|
+
this.afterFilterModalApply = undefined;
|
40
42
|
this.allowDefault = undefined;
|
41
43
|
this.scrollerLocked = false;
|
42
44
|
this.showPersonalizedFilter = false;
|
43
45
|
this.personalizedFilterId = undefined;
|
44
46
|
}
|
47
|
+
hasValidValue(item) {
|
48
|
+
if (item.value === undefined || item.value === null)
|
49
|
+
return false;
|
50
|
+
if (!Array.isArray(item.value))
|
51
|
+
return true;
|
52
|
+
return item.value.some(filterItem => filterItem.check === true);
|
53
|
+
}
|
45
54
|
observeFilterConfig(newValue, oldValue) {
|
46
55
|
if (ObjectUtils.equals(newValue, oldValue))
|
47
56
|
return;
|
@@ -268,7 +277,7 @@ export class SnkFilterBar {
|
|
268
277
|
getFilterItems() {
|
269
278
|
const pinnedItems = [];
|
270
279
|
const unpinnedItems = [];
|
271
|
-
this.filterConfig
|
280
|
+
this.filterConfig.sort((a, b) => this._filtersComparator(a, b))
|
272
281
|
.filter(this.filterActiveFilter)
|
273
282
|
.forEach((item, index) => {
|
274
283
|
item = ObjectUtils.copy(item);
|
@@ -330,19 +339,23 @@ export class SnkFilterBar {
|
|
330
339
|
}
|
331
340
|
}
|
332
341
|
async loadConfigFromStorage(clearCache) {
|
333
|
-
|
334
|
-
|
342
|
+
try {
|
343
|
+
if (clearCache) {
|
344
|
+
await ConfigStorage.deleteFilterBarConfigCache(this.configName, this.resourceID);
|
345
|
+
}
|
346
|
+
let config;
|
347
|
+
if (this.customFilterBarConfig) {
|
348
|
+
config = await this.customFilterBarConfig(this.configName, this.resourceID, { contextURI: this.dataUnit.name });
|
349
|
+
}
|
350
|
+
else {
|
351
|
+
config = await ConfigStorage.loadFilterBarConfig(this.configName, this.resourceID, { contextURI: this.dataUnit.name });
|
352
|
+
}
|
353
|
+
this.filterConfig = config.map(item => this.normalizeItem(item));
|
354
|
+
this.filterConfig.sort((a, b) => this._filtersComparator(a, b));
|
355
|
+
}
|
356
|
+
catch (e) {
|
357
|
+
throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), e);
|
335
358
|
}
|
336
|
-
return new Promise(accept => {
|
337
|
-
ConfigStorage.loadFilterBarConfig(this.configName, this.resourceID, { contextURI: this.dataUnit.name })
|
338
|
-
.then((filters) => {
|
339
|
-
accept();
|
340
|
-
this.filterConfig = filters.map(item => this.normalizeItem(item));
|
341
|
-
})
|
342
|
-
.catch(reason => {
|
343
|
-
throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
|
344
|
-
});
|
345
|
-
});
|
346
359
|
}
|
347
360
|
attachDataUnit() {
|
348
361
|
if (this.dataUnit == undefined) {
|
@@ -380,7 +393,9 @@ export class SnkFilterBar {
|
|
380
393
|
*/
|
381
394
|
async showFilterModal() {
|
382
395
|
const callbackOnApplyFilter = (filters) => {
|
396
|
+
var _a;
|
383
397
|
this.filterConfig = filters.map(this.normalizeItem).sort((a, b) => this._filtersComparator(a, b));
|
398
|
+
(_a = this.afterFilterModalApply) === null || _a === void 0 ? void 0 : _a.call(this);
|
384
399
|
};
|
385
400
|
let filtersConfigCopy = ObjectUtils.copy(this.filterConfig);
|
386
401
|
filtersConfigCopy = filtersConfigCopy.sort((itemA, itemB) => {
|
@@ -469,6 +484,32 @@ export class SnkFilterBar {
|
|
469
484
|
}
|
470
485
|
static get properties() {
|
471
486
|
return {
|
487
|
+
"customFilterBarConfig": {
|
488
|
+
"type": "unknown",
|
489
|
+
"mutable": false,
|
490
|
+
"complexType": {
|
491
|
+
"original": "(configName: string, resourceId: string, options: any) => Promise<Array<SnkFilterItemConfig>>",
|
492
|
+
"resolved": "(configName: string, resourceId: string, options: any) => Promise<SnkFilterItemConfig[]>",
|
493
|
+
"references": {
|
494
|
+
"Promise": {
|
495
|
+
"location": "global"
|
496
|
+
},
|
497
|
+
"Array": {
|
498
|
+
"location": "global"
|
499
|
+
},
|
500
|
+
"SnkFilterItemConfig": {
|
501
|
+
"location": "import",
|
502
|
+
"path": "./filter-item/snk-filter-item"
|
503
|
+
}
|
504
|
+
}
|
505
|
+
},
|
506
|
+
"required": false,
|
507
|
+
"optional": true,
|
508
|
+
"docs": {
|
509
|
+
"tags": [],
|
510
|
+
"text": "Loader customizado para carregar as configura\u00E7\u00F5es"
|
511
|
+
}
|
512
|
+
},
|
472
513
|
"dataUnit": {
|
473
514
|
"type": "unknown",
|
474
515
|
"mutable": true,
|
@@ -651,6 +692,21 @@ export class SnkFilterBar {
|
|
651
692
|
},
|
652
693
|
"attribute": "auto-load",
|
653
694
|
"reflect": false
|
695
|
+
},
|
696
|
+
"afterFilterModalApply": {
|
697
|
+
"type": "unknown",
|
698
|
+
"mutable": false,
|
699
|
+
"complexType": {
|
700
|
+
"original": "() => void",
|
701
|
+
"resolved": "() => void",
|
702
|
+
"references": {}
|
703
|
+
},
|
704
|
+
"required": false,
|
705
|
+
"optional": true,
|
706
|
+
"docs": {
|
707
|
+
"tags": [],
|
708
|
+
"text": "Fun\u00E7\u00E3o chamada depois de aplicar os filtros."
|
709
|
+
}
|
654
710
|
}
|
655
711
|
};
|
656
712
|
}
|
@@ -87,7 +87,7 @@ export class SnkForm {
|
|
87
87
|
if (this.resourceID == undefined) {
|
88
88
|
this.resourceID = await ResourceIDUtils.getResourceID();
|
89
89
|
}
|
90
|
-
this._configManager = new SnkFormConfigManager(this.configName, this.resourceID);
|
90
|
+
this._configManager = new SnkFormConfigManager(this.configName, this.resourceID, undefined, this._dataUnit);
|
91
91
|
this.addFormLegacyConfig();
|
92
92
|
await this._configManager.loadConfig();
|
93
93
|
}
|
@@ -117,7 +117,7 @@ export class SnkForm {
|
|
117
117
|
if (!this._dataUnit || !this._dataState) {
|
118
118
|
return undefined;
|
119
119
|
}
|
120
|
-
return (h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { ref: (ref) => this._form = ref, key: "ezForm" + this._snkDataUnit.entityName, "data-element-id": "embedded", dataUnit: this._dataUnit, config: this._configManager.getConfig(this.
|
120
|
+
return (h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { ref: (ref) => this._form = ref, key: "ezForm" + this._snkDataUnit.entityName, "data-element-id": "embedded", dataUnit: this._dataUnit, config: this._configManager.getConfig(this._dataUnit), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
|
121
121
|
h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this._dataUnit, configManager: this._configManager, onConfigClose: () => this.closeConfig() })))));
|
122
122
|
}
|
123
123
|
static get is() { return "snk-form"; }
|
@@ -1,11 +1,13 @@
|
|
1
1
|
import { ConfigStorage } from '../../lib/configs/ConfigStorage';
|
2
2
|
import { ObjectUtils, StringUtils } from "@sankhyalabs/core";
|
3
3
|
import { FormConfigFetcher } from "../../lib/http/data-fetcher/fetchers/form-config-fetcher";
|
4
|
+
import { TAB_NAMES } from "../../lib/utils/constants";
|
4
5
|
export class SnkFormConfigManager {
|
5
|
-
constructor(configName, resourceID, onConfigChange) {
|
6
|
+
constructor(configName, resourceID, onConfigChange, dataUnit) {
|
6
7
|
this._resourceID = resourceID;
|
7
8
|
this._configName = configName;
|
8
9
|
this._onConfigChange = onConfigChange;
|
10
|
+
this._dataUnit = dataUnit;
|
9
11
|
}
|
10
12
|
addFormLegacyConfig(legacyConfigName) {
|
11
13
|
if (this._configName) {
|
@@ -16,6 +18,7 @@ export class SnkFormConfigManager {
|
|
16
18
|
return new Promise(resolve => {
|
17
19
|
ConfigStorage.loadFormConfig(this._configName, this._resourceID)
|
18
20
|
.then((config) => {
|
21
|
+
config = this.buildFormMetadataUITabs(config);
|
19
22
|
this.setConfig(config);
|
20
23
|
resolve(config);
|
21
24
|
})
|
@@ -24,6 +27,10 @@ export class SnkFormConfigManager {
|
|
24
27
|
});
|
25
28
|
});
|
26
29
|
}
|
30
|
+
getEmptyConfig() {
|
31
|
+
const config = this.buildFormMetadataUITabs({ fields: [], emptyConfig: true }, true);
|
32
|
+
return config;
|
33
|
+
}
|
27
34
|
saveConfig(config) {
|
28
35
|
const configToSave = ObjectUtils.copy(config);
|
29
36
|
return new Promise(accept => {
|
@@ -67,25 +74,36 @@ export class SnkFormConfigManager {
|
|
67
74
|
}
|
68
75
|
return updatingCardConfig;
|
69
76
|
}
|
70
|
-
|
77
|
+
hasConfig(config) {
|
78
|
+
var _a;
|
79
|
+
const currentConfig = config !== null && config !== void 0 ? config : this._config;
|
80
|
+
if (currentConfig && ((_a = currentConfig.fields) === null || _a === void 0 ? void 0 : _a.length)) {
|
81
|
+
return true;
|
82
|
+
}
|
83
|
+
return false;
|
84
|
+
}
|
85
|
+
getFieldsList(descriptionFilter, forceEmptyConfig = false) {
|
71
86
|
var _a;
|
72
87
|
const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
|
73
|
-
|
74
|
-
|
88
|
+
const hasConfig = this.hasConfig();
|
89
|
+
if (hasConfig && !forceEmptyConfig) {
|
90
|
+
return fields.map(({ label, name, readOnly, visible, required, tab }) => {
|
91
|
+
var _a;
|
75
92
|
if (label == undefined) {
|
76
|
-
const currentField =
|
77
|
-
return Object.assign(Object.assign({}, currentField), { name: name !== null && name !== void 0 ? name : currentField.name, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : currentField.readOnly, visible: visible !== null && visible !== void 0 ? visible : currentField.visible, required: required !== null && required !== void 0 ? required : currentField.required });
|
93
|
+
const currentField = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
|
94
|
+
return Object.assign(Object.assign({}, currentField), { name: name !== null && name !== void 0 ? name : currentField.name, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : currentField.readOnly, visible: visible !== null && visible !== void 0 ? visible : currentField.visible, required: required !== null && required !== void 0 ? required : currentField.required, tab: tab });
|
78
95
|
}
|
79
|
-
return { name, label, readOnly, visible, required };
|
96
|
+
return { name, label, readOnly, visible, required, tab };
|
80
97
|
})
|
81
98
|
.filter(field => this.isFieldVisible(field, descriptionFilter));
|
82
99
|
}
|
83
|
-
if (
|
84
|
-
return
|
85
|
-
.filter(field => this.isFieldVisible(field, descriptionFilter))
|
86
|
-
.map(({ label, name, readOnly }) => { return { label, name, readOnly }; });
|
100
|
+
if (!this._dataUnit) {
|
101
|
+
return [];
|
87
102
|
}
|
88
|
-
|
103
|
+
const filteredFields = this._dataUnit.metadata.fields
|
104
|
+
.filter(field => this.isFieldVisible(field, descriptionFilter))
|
105
|
+
.map(({ label, name, readOnly, visible, required, properties }) => ({ label, name, readOnly, visible, required, tab: properties === null || properties === void 0 ? void 0 : properties.UITabName }));
|
106
|
+
return filteredFields;
|
89
107
|
}
|
90
108
|
isFieldVisible(field, descriptionFilter) {
|
91
109
|
if (field.visible === false) {
|
@@ -98,8 +116,8 @@ export class SnkFormConfigManager {
|
|
98
116
|
const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
|
99
117
|
return normalizedText.includes(normalizedFilter);
|
100
118
|
}
|
101
|
-
getFormConfig(dataUnit, ignoreReadOnlyFormFields) {
|
102
|
-
let fields = this.getFieldsList(
|
119
|
+
getFormConfig(dataUnit, ignoreReadOnlyFormFields, forceEmptyConfig = false) {
|
120
|
+
let fields = this.getFieldsList(undefined, forceEmptyConfig);
|
103
121
|
if (ignoreReadOnlyFormFields) {
|
104
122
|
fields = fields.filter(field => {
|
105
123
|
if (dataUnit) {
|
@@ -152,4 +170,42 @@ export class SnkFormConfigManager {
|
|
152
170
|
async fetchDefaultConfig() {
|
153
171
|
return this.getFormConfigFetcher().fetchDefaultConfig(this._configName, this._resourceID);
|
154
172
|
}
|
173
|
+
parseObjectList(object) {
|
174
|
+
if (!object) {
|
175
|
+
return [];
|
176
|
+
}
|
177
|
+
return Array.isArray(object) ? object : [object];
|
178
|
+
}
|
179
|
+
buildFormMetadataUITabs(config, forceEmptyConfig = false) {
|
180
|
+
var _a;
|
181
|
+
const hasConfig = this.hasConfig(config);
|
182
|
+
if (!forceEmptyConfig && (!this._dataUnit || hasConfig)) {
|
183
|
+
return config;
|
184
|
+
}
|
185
|
+
config = this.getFormConfig(this._dataUnit, false, true);
|
186
|
+
config.tabs = this.parseObjectList(config.tabs);
|
187
|
+
config.emptyConfig = false;
|
188
|
+
config.defaultConfiguration = true;
|
189
|
+
const fields = this._dataUnit.metadata.fields;
|
190
|
+
for (const currentField of fields) {
|
191
|
+
const field = config.fields.find(field => field.name === currentField.name);
|
192
|
+
const uiTabName = (_a = currentField.properties) === null || _a === void 0 ? void 0 : _a.UITabName;
|
193
|
+
if (!uiTabName || uiTabName === TAB_NAMES.main) {
|
194
|
+
continue;
|
195
|
+
}
|
196
|
+
const haveTab = config.tabs.some((tab) => tab.label === uiTabName);
|
197
|
+
if (!haveTab) {
|
198
|
+
config.tabs.push({
|
199
|
+
label: uiTabName,
|
200
|
+
name: uiTabName,
|
201
|
+
order: 0,
|
202
|
+
visible: true,
|
203
|
+
});
|
204
|
+
}
|
205
|
+
if (field) {
|
206
|
+
field.tab = uiTabName;
|
207
|
+
}
|
208
|
+
}
|
209
|
+
return config;
|
210
|
+
}
|
155
211
|
}
|