@sankhyalabs/sankhyablocks 8.16.0-dev.3 → 8.16.0-dev.30
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-942ce74b.js → ConfigStorage-ecc0ed20.js} +3 -2
- package/dist/cjs/{IExporterProvider-597949f9.js → ContinuousInsertUtils-807730a8.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-1b13bacd.js → SnkFormConfigManager-f1c92f79.js} +74 -20
- package/dist/cjs/{SnkMessageBuilder-722b104e.js → SnkMessageBuilder-bae64d0d.js} +7 -3
- 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 +37 -28
- package/dist/cjs/snk-crud.cjs.entry.js +14 -6
- package/dist/cjs/snk-data-exporter.cjs.entry.js +9 -9
- package/dist/cjs/{snk-data-unit-685272e7.js → snk-data-unit-668dc5e8.js} +42 -22
- package/dist/cjs/snk-data-unit.cjs.entry.js +5 -5
- package/dist/cjs/snk-detail-view.cjs.entry.js +12 -13
- package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-bar.cjs.entry.js +37 -25
- 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 -6
- package/dist/cjs/snk-form.cjs.entry.js +7 -6
- package/dist/cjs/snk-grid.cjs.entry.js +61 -21
- package/dist/cjs/{snk-guides-viewer-67605336.js → snk-guides-viewer-68777d37.js} +24 -12
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +9 -9
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
- package/dist/cjs/snk-simple-bar.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +64 -26
- package/dist/cjs/snk-taskbar.cjs.entry.js +23 -1
- package/dist/collection/components/snk-actions-button/actions/index.js +12 -9
- package/dist/collection/components/snk-attach/snk-attach.js +24 -15
- 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 -1
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +3 -4
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +51 -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 +57 -20
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.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 +59 -21
- package/dist/collection/components/snk-form/snk-form.js +2 -2
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +72 -18
- package/dist/collection/components/snk-form-config/snk-form-config.css +8 -3
- package/dist/collection/components/snk-form-config/snk-form-config.js +14 -3
- package/dist/collection/components/snk-grid/snk-grid.css +2 -0
- package/dist/collection/components/snk-grid/snk-grid.js +68 -8
- 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 +89 -15
- package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +5 -1
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +64 -0
- package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +3 -3
- package/dist/collection/lib/configs/ConfigStorage.js +1 -0
- 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-data-unit.msg.js +1 -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/ConfigStorage.js +1 -0
- 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 +72 -18
- package/dist/components/SnkMessageBuilder.js +7 -3
- 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 +33 -24
- package/dist/components/snk-crud.js +12 -1
- package/dist/components/snk-data-exporter2.js +2 -2
- package/dist/components/snk-data-unit2.js +44 -60
- package/dist/components/snk-detail-view2.js +24 -11
- package/dist/components/snk-exporter-email-sender2.js +1 -1
- package/dist/components/snk-filter-bar2.js +35 -22
- package/dist/components/snk-filter-checkbox-list.js +1 -1
- package/dist/components/snk-form-config2.js +15 -4
- package/dist/components/snk-form.js +2 -2
- package/dist/components/snk-grid2.js +53 -11
- package/dist/components/snk-simple-bar2.js +1 -1
- package/dist/components/snk-simple-crud2.js +57 -15
- package/dist/components/snk-taskbar2.js +24 -2
- package/dist/esm/{ConfigStorage-86187da3.js → ConfigStorage-7b36d041.js} +3 -2
- package/dist/esm/{IExporterProvider-63a188b6.js → ContinuousInsertUtils-1a82a768.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-d4554df9.js → SnkFormConfigManager-139f09fa.js} +74 -20
- package/dist/esm/{SnkMessageBuilder-89925609.js → SnkMessageBuilder-6fff4a4c.js} +7 -3
- 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 +37 -28
- package/dist/esm/snk-crud.entry.js +14 -6
- package/dist/esm/snk-data-exporter.entry.js +9 -9
- package/dist/esm/{snk-data-unit-63f83504.js → snk-data-unit-0fdfb6c2.js} +42 -22
- package/dist/esm/snk-data-unit.entry.js +5 -5
- package/dist/esm/snk-detail-view.entry.js +12 -13
- package/dist/esm/snk-exporter-email-sender.entry.js +1 -1
- package/dist/esm/snk-filter-bar.entry.js +37 -25
- 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 -6
- package/dist/esm/snk-form.entry.js +7 -6
- package/dist/esm/snk-grid.entry.js +56 -16
- package/dist/esm/{snk-guides-viewer-151f6091.js → snk-guides-viewer-b5dd30e6.js} +24 -12
- package/dist/esm/snk-guides-viewer.entry.js +9 -9
- package/dist/esm/snk-personalized-filter.entry.js +3 -3
- package/dist/esm/snk-simple-bar.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +60 -22
- package/dist/esm/snk-taskbar.entry.js +23 -1
- package/dist/sankhyablocks/p-0035ad6e.entry.js +1 -0
- 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-18ed15f4.entry.js +1 -0
- package/dist/sankhyablocks/{p-af8efd95.js → p-1bf06cd3.js} +2 -2
- package/dist/sankhyablocks/p-1e4c25e3.entry.js +1 -0
- package/dist/sankhyablocks/{p-a1d72395.entry.js → p-212213d9.entry.js} +1 -1
- package/dist/sankhyablocks/p-23736d75.js +1 -0
- package/dist/sankhyablocks/p-3ae9d08a.js +1 -0
- package/dist/sankhyablocks/p-3e3cc017.js +1 -0
- package/dist/sankhyablocks/{p-aff76a53.js → p-4d9549cf.js} +2 -2
- package/dist/sankhyablocks/p-50779ad3.entry.js +1 -0
- package/dist/sankhyablocks/p-5dd8cf4f.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-694e1c4a.entry.js +1 -0
- package/dist/sankhyablocks/p-7ac7932c.js +60 -0
- package/dist/sankhyablocks/p-7dd49d15.js +1 -0
- package/dist/sankhyablocks/p-7eef0898.entry.js +1 -0
- package/dist/sankhyablocks/{p-82a0bfb0.entry.js → p-a42e7a1e.entry.js} +2 -2
- package/dist/sankhyablocks/p-afbb070d.js +1 -0
- package/dist/sankhyablocks/p-b9679243.entry.js +1 -0
- package/dist/sankhyablocks/p-b9c67e45.entry.js +1 -0
- package/dist/sankhyablocks/p-c2e468c9.entry.js +1 -0
- package/dist/sankhyablocks/{p-913a9979.js → p-ca5ec380.js} +1 -1
- package/dist/sankhyablocks/p-d80a84fd.entry.js +1 -0
- package/dist/sankhyablocks/p-d836f72b.entry.js +1 -0
- package/dist/sankhyablocks/p-e16e87fc.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-eae7a817.entry.js → p-fb34e0cf.entry.js} +1 -1
- 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 +11 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +7 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +5 -0
- package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +9 -4
- package/dist/types/components/snk-grid/snk-grid.d.ts +12 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +14 -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 +89 -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-14a08904.entry.js +0 -1
- package/dist/sankhyablocks/p-14b9f964.entry.js +0 -1
- package/dist/sankhyablocks/p-219f888d.entry.js +0 -1
- package/dist/sankhyablocks/p-3a212712.js +0 -1
- package/dist/sankhyablocks/p-3a216b81.entry.js +0 -1
- package/dist/sankhyablocks/p-47b60deb.entry.js +0 -1
- package/dist/sankhyablocks/p-7505da04.entry.js +0 -1
- package/dist/sankhyablocks/p-75f83d1d.entry.js +0 -1
- package/dist/sankhyablocks/p-7a337364.js +0 -1
- package/dist/sankhyablocks/p-829d4045.js +0 -1
- package/dist/sankhyablocks/p-88aa931b.entry.js +0 -1
- package/dist/sankhyablocks/p-8fc470e5.entry.js +0 -1
- package/dist/sankhyablocks/p-941bf3ef.entry.js +0 -1
- package/dist/sankhyablocks/p-9863d682.js +0 -1
- package/dist/sankhyablocks/p-b4b21558.entry.js +0 -1
- package/dist/sankhyablocks/p-bad55caa.entry.js +0 -1
- package/dist/sankhyablocks/p-c053256c.entry.js +0 -1
- package/dist/sankhyablocks/p-c2495304.js +0 -1
- package/dist/sankhyablocks/p-c5268346.entry.js +0 -1
- package/dist/sankhyablocks/p-cefba299.js +0 -1
- package/dist/sankhyablocks/p-dc7c9047.js +0 -1
- package/dist/sankhyablocks/p-f2809746.entry.js +0 -1
- package/dist/sankhyablocks/p-fcac4dfc.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,8 @@ export class SnkGuidesViewer {
|
|
|
27
27
|
this.resourceID = undefined;
|
|
28
28
|
this.detailTaskbarCustomContainerId = undefined;
|
|
29
29
|
this.formLegacyConfigName = undefined;
|
|
30
|
+
this.enableGridInsert = false;
|
|
31
|
+
this.getCustomTitle = undefined;
|
|
30
32
|
this._hasToCreateFieldSearch = true;
|
|
31
33
|
this._breadcrumbItems = [];
|
|
32
34
|
this._guides = undefined;
|
|
@@ -95,7 +97,7 @@ export class SnkGuidesViewer {
|
|
|
95
97
|
this._container.focus();
|
|
96
98
|
}
|
|
97
99
|
exitViewer() {
|
|
98
|
-
if (this.dataUnit.isDirty()) {
|
|
100
|
+
if (!this.enableGridInsert && this.dataUnit.isDirty()) {
|
|
99
101
|
this.dataUnit.cancelEdition({ after: () => this.exit.emit() });
|
|
100
102
|
}
|
|
101
103
|
else {
|
|
@@ -113,7 +115,7 @@ export class SnkGuidesViewer {
|
|
|
113
115
|
}
|
|
114
116
|
onContentCardChanged(evt) {
|
|
115
117
|
SnkGuidesViewer.updateContentCard(evt.detail.formName, evt.detail.cardConfig, evt.detail.propertyChanged, this._configManager)
|
|
116
|
-
.then(() => this.masterFormConfig = this._configManager.getConfig(this.
|
|
118
|
+
.then(() => this.masterFormConfig = this._configManager.getConfig(this.dataUnit));
|
|
117
119
|
}
|
|
118
120
|
/**
|
|
119
121
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
@@ -204,10 +206,13 @@ export class SnkGuidesViewer {
|
|
|
204
206
|
const invisibleButtons = this.getInvisibleButtons();
|
|
205
207
|
this._taskbarProcessor = new TaskbarProcessor({
|
|
206
208
|
"snkGuideViewer.regular": btnsRegularMode,
|
|
207
|
-
"snkGuideViewer.finish_edition": ["CANCEL", "SAVE"],
|
|
209
|
+
"snkGuideViewer.finish_edition": ["CANCEL", "SAVE", this.handleAddGridMode()],
|
|
208
210
|
});
|
|
209
211
|
this._taskbarProcessor.process(taskbarId, this.taskbarManager, this.dataState, disabledButtons, invisibleButtons);
|
|
210
212
|
}
|
|
213
|
+
handleAddGridMode() {
|
|
214
|
+
return this.enableGridInsert ? TaskbarElement.GRID_MODE : "";
|
|
215
|
+
}
|
|
211
216
|
getInvisibleButtons() {
|
|
212
217
|
const invisibleButtons = [];
|
|
213
218
|
if (this.dataState && this.dataState.selectionInfo.mode === SelectionMode.ALL_RECORDS)
|
|
@@ -360,11 +365,14 @@ export class SnkGuidesViewer {
|
|
|
360
365
|
this._configManager.addFormLegacyConfig(this.formLegacyConfigName);
|
|
361
366
|
}
|
|
362
367
|
}
|
|
368
|
+
setMasterFormConfig(config) {
|
|
369
|
+
this.masterFormConfig = config;
|
|
370
|
+
}
|
|
363
371
|
componentWillLoad() {
|
|
364
372
|
if (this.resourceID == undefined) {
|
|
365
373
|
throw new Error("Erro interno: resourceID não informado");
|
|
366
374
|
}
|
|
367
|
-
this._configManager = new SnkFormConfigManager(this.configName, this.resourceID,
|
|
375
|
+
this._configManager = new SnkFormConfigManager(this.configName, this.resourceID, this.setMasterFormConfig.bind(this), this.dataUnit);
|
|
368
376
|
this.addFormLegacyConfigName();
|
|
369
377
|
this._configManager.loadConfig();
|
|
370
378
|
}
|
|
@@ -392,7 +400,7 @@ export class SnkGuidesViewer {
|
|
|
392
400
|
return this._fieldSearch;
|
|
393
401
|
}
|
|
394
402
|
fieldsOptionLoader(argument) {
|
|
395
|
-
return Promise.resolve(this._configManager.getFieldsList(
|
|
403
|
+
return Promise.resolve(this._configManager.getFieldsList(argument)
|
|
396
404
|
.map(field => ({ value: field.name, label: field.label })));
|
|
397
405
|
}
|
|
398
406
|
onSelectField(option, actionButton) {
|
|
@@ -464,6 +472,10 @@ export class SnkGuidesViewer {
|
|
|
464
472
|
}
|
|
465
473
|
return "";
|
|
466
474
|
}
|
|
475
|
+
getTitle() {
|
|
476
|
+
var _a, _b;
|
|
477
|
+
return (_b = (_a = this.getCustomTitle) === null || _a === void 0 ? void 0 : _a.call(this)) !== null && _b !== void 0 ? _b : this.getMessage("snkCrud.title");
|
|
478
|
+
}
|
|
467
479
|
componentDidLoad() {
|
|
468
480
|
this.dataUnit.subscribe(this.dataUnitActionHandler.bind(this));
|
|
469
481
|
}
|
|
@@ -477,7 +489,7 @@ export class SnkGuidesViewer {
|
|
|
477
489
|
}
|
|
478
490
|
this.loadTaskbarProcessor();
|
|
479
491
|
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.
|
|
492
|
+
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
493
|
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
494
|
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
495
|
:
|
|
@@ -794,6 +806,39 @@ export class SnkGuidesViewer {
|
|
|
794
806
|
},
|
|
795
807
|
"attribute": "form-legacy-config-name",
|
|
796
808
|
"reflect": false
|
|
809
|
+
},
|
|
810
|
+
"enableGridInsert": {
|
|
811
|
+
"type": "boolean",
|
|
812
|
+
"mutable": false,
|
|
813
|
+
"complexType": {
|
|
814
|
+
"original": "boolean",
|
|
815
|
+
"resolved": "boolean",
|
|
816
|
+
"references": {}
|
|
817
|
+
},
|
|
818
|
+
"required": false,
|
|
819
|
+
"optional": true,
|
|
820
|
+
"docs": {
|
|
821
|
+
"tags": [],
|
|
822
|
+
"text": "Ativa inser\u00E7\u00E3o de registros no modo grade."
|
|
823
|
+
},
|
|
824
|
+
"attribute": "enable-grid-insert",
|
|
825
|
+
"reflect": false,
|
|
826
|
+
"defaultValue": "false"
|
|
827
|
+
},
|
|
828
|
+
"getCustomTitle": {
|
|
829
|
+
"type": "unknown",
|
|
830
|
+
"mutable": false,
|
|
831
|
+
"complexType": {
|
|
832
|
+
"original": "() => string",
|
|
833
|
+
"resolved": "() => string",
|
|
834
|
+
"references": {}
|
|
835
|
+
},
|
|
836
|
+
"required": false,
|
|
837
|
+
"optional": false,
|
|
838
|
+
"docs": {
|
|
839
|
+
"tags": [],
|
|
840
|
+
"text": "Fornece uma fun\u00E7\u00E3o para obter um t\u00EDtulo customizado do formul\u00E1rio."
|
|
841
|
+
}
|
|
797
842
|
}
|
|
798
843
|
};
|
|
799
844
|
}
|
|
@@ -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 = [];
|
|
@@ -54,6 +54,7 @@ export class SnkDataUnit {
|
|
|
54
54
|
this.ignoreSaveMessage = undefined;
|
|
55
55
|
this.configName = undefined;
|
|
56
56
|
this.resourceID = undefined;
|
|
57
|
+
this.domainMessagesBuilder = undefined;
|
|
57
58
|
}
|
|
58
59
|
observePageSize() {
|
|
59
60
|
if (this.dataUnit) {
|
|
@@ -109,7 +110,7 @@ export class SnkDataUnit {
|
|
|
109
110
|
* @returns Retorna a lista de IDs dos registros selecionados.
|
|
110
111
|
*/
|
|
111
112
|
async getSelectedRecordsIDsInfo() {
|
|
112
|
-
return
|
|
113
|
+
return getSelectedRecordsIDsInfo(this.dataUnit);
|
|
113
114
|
}
|
|
114
115
|
/**
|
|
115
116
|
* Retorna os campos que possuem a propriedade "rmp" (Row Metadata Provider).
|
|
@@ -470,21 +471,15 @@ export class SnkDataUnit {
|
|
|
470
471
|
if (this.ignoreSaveMessage) {
|
|
471
472
|
return;
|
|
472
473
|
}
|
|
473
|
-
const
|
|
474
|
+
const saveOperation = action.payload.changes[0]._operation.toLowerCase();
|
|
475
|
+
const msg = this.getMessage("snkDataUnit.saveInfo", action.payload.records[0], saveOperation);
|
|
474
476
|
if (msg != undefined) {
|
|
475
477
|
this.showSuccessMessage(msg);
|
|
476
478
|
}
|
|
477
479
|
}
|
|
478
480
|
handleRecordsRemoved(action) {
|
|
479
481
|
var _a, _b;
|
|
480
|
-
|
|
481
|
-
let removeFinishMsg;
|
|
482
|
-
if ((cachedRecords === null || cachedRecords === void 0 ? void 0 : cachedRecords.length) > 1) {
|
|
483
|
-
removeFinishMsg = this.getMessage("snkDataUnit.removeAllInfo", { size: cachedRecords.length });
|
|
484
|
-
}
|
|
485
|
-
else {
|
|
486
|
-
removeFinishMsg = this.getMessage("snkDataUnit.removeInfo", action.payload.cachedRecords[0]);
|
|
487
|
-
}
|
|
482
|
+
let removeFinishMsg = this.buildRemoveFinishMessage(action);
|
|
488
483
|
if (removeFinishMsg != undefined) {
|
|
489
484
|
this.showSuccessMessage(removeFinishMsg);
|
|
490
485
|
}
|
|
@@ -495,16 +490,27 @@ export class SnkDataUnit {
|
|
|
495
490
|
this.dataUnit.gotoPage(page);
|
|
496
491
|
}
|
|
497
492
|
}
|
|
493
|
+
buildRemoveFinishMessage(action) {
|
|
494
|
+
const records = action.payload.records;
|
|
495
|
+
if (!records || !records.length)
|
|
496
|
+
return undefined;
|
|
497
|
+
if ((records === null || records === void 0 ? void 0 : records.length) > 1)
|
|
498
|
+
return this.getMessage('snkDataUnit.removeAllInfo', { size: records.length });
|
|
499
|
+
return this.getMessage('snkDataUnit.removeInfo', records);
|
|
500
|
+
}
|
|
498
501
|
/**
|
|
499
502
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
500
503
|
* através de um pequeno modulo na estrutura da aplicação:
|
|
501
504
|
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
|
502
505
|
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-data-unit.msg.ts"
|
|
503
506
|
*/
|
|
504
|
-
getMessage(key, params = undefined) {
|
|
507
|
+
getMessage(key, params = undefined, customOperation) {
|
|
505
508
|
if (!params) {
|
|
506
509
|
params = this.getMessageParams();
|
|
507
510
|
}
|
|
511
|
+
if (customOperation) {
|
|
512
|
+
this.messagesBuilder.currentOperation = customOperation;
|
|
513
|
+
}
|
|
508
514
|
return this.messagesBuilder.getMessage(key, params);
|
|
509
515
|
}
|
|
510
516
|
getMessageParams() {
|
|
@@ -535,19 +541,28 @@ export class SnkDataUnit {
|
|
|
535
541
|
return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName, this.resourceID);
|
|
536
542
|
}
|
|
537
543
|
}
|
|
544
|
+
updateMetadataWithRMP() {
|
|
545
|
+
this.fillFieldsWithRmp(this.dataUnit.metadata);
|
|
546
|
+
this.fillFieldsWithRmPrecision(this.dataUnit.metadata);
|
|
547
|
+
const dataUnitUpdatedMetadata = this.handleDULinksOnMetadataLoaded(this.dataUnit.metadata);
|
|
548
|
+
this.dataUnit.metadata = dataUnitUpdatedMetadata;
|
|
549
|
+
}
|
|
538
550
|
async loadDataUnit() {
|
|
539
|
-
var _a;
|
|
551
|
+
var _a, _b;
|
|
540
552
|
if (this.dataUnit == null && this._application && this.entityName) {
|
|
541
553
|
this.dataUnit = await this.getDataUnitParentOrChild();
|
|
542
554
|
}
|
|
543
555
|
if (this.dataUnit) {
|
|
544
556
|
this.dataUnit.pageSize = this.pageSize;
|
|
545
557
|
this.dataUnit.unsubscribe(this._dataUnitObserver);
|
|
546
|
-
this.dataUnit.addInterceptor(this);
|
|
547
558
|
this.dataUnit.subscribe(this._dataUnitObserver);
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
559
|
+
if ((_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.metadata) {
|
|
560
|
+
this.updateMetadataWithRMP();
|
|
561
|
+
}
|
|
562
|
+
this.dataUnit.addInterceptor(this);
|
|
563
|
+
if ((_b = this.dataUnit.records) === null || _b === void 0 ? void 0 : _b.length) {
|
|
564
|
+
const { records } = this.getMetadataByRow(this.dataUnit);
|
|
565
|
+
this.dataUnit.records = records;
|
|
551
566
|
}
|
|
552
567
|
this.dataState = this.buildDataState();
|
|
553
568
|
let resolver;
|
|
@@ -611,6 +626,13 @@ export class SnkDataUnit {
|
|
|
611
626
|
parent = parent.parentElement;
|
|
612
627
|
}
|
|
613
628
|
}
|
|
629
|
+
instanceMessagesBuilder() {
|
|
630
|
+
var _a;
|
|
631
|
+
if (this.messagesBuilder) {
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
this.messagesBuilder = new SnkMessageBuilder((_a = this.domainMessagesBuilder) !== null && _a !== void 0 ? _a : this.entityName);
|
|
635
|
+
}
|
|
614
636
|
//---------------------------------------------
|
|
615
637
|
// Lifecycle web component
|
|
616
638
|
//---------------------------------------------
|
|
@@ -618,9 +640,7 @@ export class SnkDataUnit {
|
|
|
618
640
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
619
641
|
this._application.getAllAccess(this.resourceID).then(access => this._permissions = access);
|
|
620
642
|
this._parentSnkDataUnit = this.getParentSnkDataUnit();
|
|
621
|
-
|
|
622
|
-
this.messagesBuilder = new SnkMessageBuilder(this.entityName);
|
|
623
|
-
}
|
|
643
|
+
this.instanceMessagesBuilder();
|
|
624
644
|
}
|
|
625
645
|
disconnectedCallback() {
|
|
626
646
|
if (this.dataUnit) {
|
|
@@ -860,6 +880,23 @@ export class SnkDataUnit {
|
|
|
860
880
|
},
|
|
861
881
|
"attribute": "resource-i-d",
|
|
862
882
|
"reflect": false
|
|
883
|
+
},
|
|
884
|
+
"domainMessagesBuilder": {
|
|
885
|
+
"type": "string",
|
|
886
|
+
"mutable": false,
|
|
887
|
+
"complexType": {
|
|
888
|
+
"original": "string",
|
|
889
|
+
"resolved": "string",
|
|
890
|
+
"references": {}
|
|
891
|
+
},
|
|
892
|
+
"required": false,
|
|
893
|
+
"optional": false,
|
|
894
|
+
"docs": {
|
|
895
|
+
"tags": [],
|
|
896
|
+
"text": "Define a chave customizada para sobrescrever as mensagens (N\u00E3o pegando pela entidade)"
|
|
897
|
+
},
|
|
898
|
+
"attribute": "domain-messages-builder",
|
|
899
|
+
"reflect": false
|
|
863
900
|
}
|
|
864
901
|
};
|
|
865
902
|
}
|
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;
|
|
@@ -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;
|
|
@@ -42,6 +43,13 @@ export class SnkFilterBar {
|
|
|
42
43
|
this.showPersonalizedFilter = false;
|
|
43
44
|
this.personalizedFilterId = undefined;
|
|
44
45
|
}
|
|
46
|
+
hasValidValue(item) {
|
|
47
|
+
if (item.value === undefined || item.value === null)
|
|
48
|
+
return false;
|
|
49
|
+
if (!Array.isArray(item.value))
|
|
50
|
+
return true;
|
|
51
|
+
return item.value.some(filterItem => filterItem.check === true);
|
|
52
|
+
}
|
|
45
53
|
observeFilterConfig(newValue, oldValue) {
|
|
46
54
|
if (ObjectUtils.equals(newValue, oldValue))
|
|
47
55
|
return;
|
|
@@ -268,7 +276,7 @@ export class SnkFilterBar {
|
|
|
268
276
|
getFilterItems() {
|
|
269
277
|
const pinnedItems = [];
|
|
270
278
|
const unpinnedItems = [];
|
|
271
|
-
this.filterConfig
|
|
279
|
+
this.filterConfig.sort((a, b) => this._filtersComparator(a, b))
|
|
272
280
|
.filter(this.filterActiveFilter)
|
|
273
281
|
.forEach((item, index) => {
|
|
274
282
|
item = ObjectUtils.copy(item);
|
|
@@ -330,19 +338,23 @@ export class SnkFilterBar {
|
|
|
330
338
|
}
|
|
331
339
|
}
|
|
332
340
|
async loadConfigFromStorage(clearCache) {
|
|
333
|
-
|
|
334
|
-
|
|
341
|
+
try {
|
|
342
|
+
if (clearCache) {
|
|
343
|
+
await ConfigStorage.deleteFilterBarConfigCache(this.configName, this.resourceID);
|
|
344
|
+
}
|
|
345
|
+
let config;
|
|
346
|
+
if (this.customFilterBarConfig) {
|
|
347
|
+
config = await this.customFilterBarConfig(this.configName, this.resourceID, { contextURI: this.dataUnit.name });
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
config = await ConfigStorage.loadFilterBarConfig(this.configName, this.resourceID, { contextURI: this.dataUnit.name });
|
|
351
|
+
}
|
|
352
|
+
this.filterConfig = config.map(item => this.normalizeItem(item));
|
|
353
|
+
this.filterConfig.sort((a, b) => this._filtersComparator(a, b));
|
|
354
|
+
}
|
|
355
|
+
catch (e) {
|
|
356
|
+
throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), e);
|
|
335
357
|
}
|
|
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
358
|
}
|
|
347
359
|
attachDataUnit() {
|
|
348
360
|
if (this.dataUnit == undefined) {
|
|
@@ -469,6 +481,32 @@ export class SnkFilterBar {
|
|
|
469
481
|
}
|
|
470
482
|
static get properties() {
|
|
471
483
|
return {
|
|
484
|
+
"customFilterBarConfig": {
|
|
485
|
+
"type": "unknown",
|
|
486
|
+
"mutable": false,
|
|
487
|
+
"complexType": {
|
|
488
|
+
"original": "(configName: string, resourceId: string, options: any) => Promise<Array<SnkFilterItemConfig>>",
|
|
489
|
+
"resolved": "(configName: string, resourceId: string, options: any) => Promise<SnkFilterItemConfig[]>",
|
|
490
|
+
"references": {
|
|
491
|
+
"Promise": {
|
|
492
|
+
"location": "global"
|
|
493
|
+
},
|
|
494
|
+
"Array": {
|
|
495
|
+
"location": "global"
|
|
496
|
+
},
|
|
497
|
+
"SnkFilterItemConfig": {
|
|
498
|
+
"location": "import",
|
|
499
|
+
"path": "./filter-item/snk-filter-item"
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
},
|
|
503
|
+
"required": false,
|
|
504
|
+
"optional": true,
|
|
505
|
+
"docs": {
|
|
506
|
+
"tags": [],
|
|
507
|
+
"text": "Loader customizado para carregar as configura\u00E7\u00F5es"
|
|
508
|
+
}
|
|
509
|
+
},
|
|
472
510
|
"dataUnit": {
|
|
473
511
|
"type": "unknown",
|
|
474
512
|
"mutable": true,
|
|
@@ -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,27 +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
|
-
|
|
77
|
-
|
|
78
|
-
visible,
|
|
79
|
-
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 });
|
|
80
95
|
}
|
|
81
|
-
return { name, label, readOnly, visible, required };
|
|
96
|
+
return { name, label, readOnly, visible, required, tab };
|
|
82
97
|
})
|
|
83
98
|
.filter(field => this.isFieldVisible(field, descriptionFilter));
|
|
84
99
|
}
|
|
85
|
-
if (
|
|
86
|
-
return
|
|
87
|
-
.filter(field => this.isFieldVisible(field, descriptionFilter))
|
|
88
|
-
.map(({ label, name, readOnly }) => { return { label, name, readOnly }; });
|
|
100
|
+
if (!this._dataUnit) {
|
|
101
|
+
return [];
|
|
89
102
|
}
|
|
90
|
-
|
|
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;
|
|
91
107
|
}
|
|
92
108
|
isFieldVisible(field, descriptionFilter) {
|
|
93
109
|
if (field.visible === false) {
|
|
@@ -100,8 +116,8 @@ export class SnkFormConfigManager {
|
|
|
100
116
|
const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
|
|
101
117
|
return normalizedText.includes(normalizedFilter);
|
|
102
118
|
}
|
|
103
|
-
|
|
104
|
-
let fields = this.getFieldsList(
|
|
119
|
+
getFormConfig(dataUnit, ignoreReadOnlyFormFields, forceEmptyConfig = false) {
|
|
120
|
+
let fields = this.getFieldsList(undefined, forceEmptyConfig);
|
|
105
121
|
if (ignoreReadOnlyFormFields) {
|
|
106
122
|
fields = fields.filter(field => {
|
|
107
123
|
if (dataUnit) {
|
|
@@ -132,8 +148,8 @@ export class SnkFormConfigManager {
|
|
|
132
148
|
this._onConfigChange(Object.assign({}, this._config));
|
|
133
149
|
}
|
|
134
150
|
}
|
|
135
|
-
getConfig(
|
|
136
|
-
return
|
|
151
|
+
getConfig(dataUnit, ignoreReadOnlyFormFields) {
|
|
152
|
+
return this.getFormConfig(dataUnit, ignoreReadOnlyFormFields !== null && ignoreReadOnlyFormFields !== void 0 ? ignoreReadOnlyFormFields : true);
|
|
137
153
|
}
|
|
138
154
|
getFormConfigFetcher() {
|
|
139
155
|
if (this._formConfigFetcher == undefined) {
|
|
@@ -154,4 +170,42 @@ export class SnkFormConfigManager {
|
|
|
154
170
|
async fetchDefaultConfig() {
|
|
155
171
|
return this.getFormConfigFetcher().fetchDefaultConfig(this._configName, this._resourceID);
|
|
156
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
|
+
}
|
|
157
211
|
}
|