@sankhyalabs/sankhyablocks 8.16.0-dev.2 → 8.16.0-dev.21
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/{DataFetcher-313debd8.js → DataFetcher-cadeef8e.js} +21 -15
- package/dist/cjs/{IExporterProvider-9479f618.js → IExporterProvider-9ac15aaf.js} +4 -4
- package/dist/cjs/{SnkFormConfigManager-1b13bacd.js → SnkFormConfigManager-f1c92f79.js} +74 -20
- package/dist/cjs/{SnkMessageBuilder-722b104e.js → SnkMessageBuilder-cceebbae.js} +2 -2
- package/dist/cjs/{auth-fetcher-54f5ff9d.js → auth-fetcher-d68841bc.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-0c7106a0.js → dataunit-fetcher-4b12f70c.js} +8 -4
- 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 +5 -5
- package/dist/cjs/snk-application.cjs.entry.js +7 -7
- package/dist/cjs/snk-attach.cjs.entry.js +36 -25
- package/dist/cjs/snk-crud.cjs.entry.js +11 -6
- package/dist/cjs/snk-data-exporter.cjs.entry.js +8 -8
- package/dist/cjs/{snk-data-unit-16791a2f.js → snk-data-unit-c095fb1a.js} +23 -11
- package/dist/cjs/snk-data-unit.cjs.entry.js +4 -4
- package/dist/cjs/snk-detail-view.cjs.entry.js +11 -12
- package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-bar.cjs.entry.js +19 -11
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
- package/dist/cjs/snk-form-config.cjs.entry.js +16 -5
- package/dist/cjs/snk-form.cjs.entry.js +7 -6
- package/dist/cjs/snk-grid.cjs.entry.js +9 -9
- package/dist/cjs/{snk-guides-viewer-d82746e8.js → snk-guides-viewer-866447ab.js} +17 -9
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -8
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
- package/dist/cjs/snk-simple-crud.cjs.entry.js +14 -12
- package/dist/cjs/snk-taskbar.cjs.entry.js +23 -1
- package/dist/collection/components/snk-attach/snk-attach.js +24 -15
- package/dist/collection/components/snk-crud/snk-crud.js +57 -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 +27 -4
- package/dist/collection/components/snk-data-exporter/exporter-email-sender/options-step.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 +38 -9
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +16 -8
- 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.js +14 -3
- package/dist/collection/components/snk-grid/snk-grid.css +2 -0
- package/dist/collection/components/snk-grid/snk-grid.js +2 -2
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +24 -5
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +64 -0
- package/dist/collection/lib/configs/ConfigStorage.js +1 -0
- package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +7 -3
- 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/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/components/ConfigStorage.js +1 -0
- package/dist/components/DataFetcher.js +22 -16
- package/dist/components/SnkFormConfigManager.js +72 -18
- package/dist/components/SnkMessageBuilder.js +2 -2
- package/dist/components/dataunit-fetcher.js +7 -3
- package/dist/components/form-config-fetcher.js +4 -1
- package/dist/components/snk-attach2.js +31 -20
- package/dist/components/snk-crud.js +8 -1
- package/dist/components/snk-data-exporter2.js +2 -2
- package/dist/components/snk-data-unit2.js +22 -9
- package/dist/components/snk-detail-view2.js +16 -8
- package/dist/components/snk-exporter-email-sender2.js +1 -1
- package/dist/components/snk-filter-bar2.js +16 -8
- package/dist/components/snk-form-config2.js +14 -3
- package/dist/components/snk-form.js +2 -2
- package/dist/components/snk-grid2.js +3 -3
- package/dist/components/snk-simple-crud2.js +8 -5
- package/dist/components/snk-taskbar2.js +24 -2
- package/dist/esm/{ConfigStorage-86187da3.js → ConfigStorage-7b36d041.js} +3 -2
- package/dist/esm/{DataFetcher-c1baf61d.js → DataFetcher-a9c598f2.js} +22 -16
- package/dist/esm/{IExporterProvider-5a858363.js → IExporterProvider-09df2e3e.js} +4 -4
- package/dist/esm/{SnkFormConfigManager-d4554df9.js → SnkFormConfigManager-139f09fa.js} +74 -20
- package/dist/esm/{SnkMessageBuilder-89925609.js → SnkMessageBuilder-ae87b754.js} +2 -2
- package/dist/esm/{auth-fetcher-039abba3.js → auth-fetcher-749d880f.js} +1 -1
- package/dist/esm/{dataunit-fetcher-f7e0ffc0.js → dataunit-fetcher-3aac1a53.js} +8 -4
- 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 +5 -5
- package/dist/esm/snk-application.entry.js +7 -7
- package/dist/esm/snk-attach.entry.js +36 -25
- package/dist/esm/snk-crud.entry.js +11 -6
- package/dist/esm/snk-data-exporter.entry.js +8 -8
- package/dist/esm/{snk-data-unit-a327d22c.js → snk-data-unit-75fc8910.js} +23 -11
- package/dist/esm/snk-data-unit.entry.js +4 -4
- package/dist/esm/snk-detail-view.entry.js +11 -12
- package/dist/esm/snk-exporter-email-sender.entry.js +1 -1
- package/dist/esm/snk-filter-bar.entry.js +19 -11
- package/dist/esm/snk-filter-modal-item.entry.js +3 -3
- package/dist/esm/snk-form-config.entry.js +16 -5
- package/dist/esm/snk-form.entry.js +7 -6
- package/dist/esm/snk-grid.entry.js +9 -9
- package/dist/esm/{snk-guides-viewer-874da66f.js → snk-guides-viewer-cb8a0b48.js} +17 -9
- package/dist/esm/snk-guides-viewer.entry.js +8 -8
- package/dist/esm/snk-personalized-filter.entry.js +3 -3
- package/dist/esm/snk-simple-crud.entry.js +14 -12
- package/dist/esm/snk-taskbar.entry.js +23 -1
- package/dist/sankhyablocks/{p-df5451c7.js → p-06421fdb.js} +2 -2
- package/dist/sankhyablocks/p-16969508.entry.js +1 -0
- package/dist/sankhyablocks/p-16a1dd18.entry.js +1 -0
- package/dist/sankhyablocks/p-17aba142.entry.js +1 -0
- package/dist/sankhyablocks/p-18ed15f4.entry.js +1 -0
- package/dist/sankhyablocks/{p-e6210aec.js → p-1ab19772.js} +1 -1
- package/dist/sankhyablocks/{p-af8efd95.js → p-1bf06cd3.js} +2 -2
- package/dist/sankhyablocks/p-1f47a0b2.entry.js +1 -0
- package/dist/sankhyablocks/{p-a1d72395.entry.js → p-212213d9.entry.js} +1 -1
- package/dist/sankhyablocks/p-3757394b.entry.js +1 -0
- package/dist/sankhyablocks/p-41556e8a.entry.js +1 -0
- package/dist/sankhyablocks/{p-aff76a53.js → p-4d9549cf.js} +2 -2
- package/dist/sankhyablocks/p-60b29483.entry.js +1 -0
- package/dist/sankhyablocks/{p-60e46675.entry.js → p-640140b3.entry.js} +2 -2
- package/dist/sankhyablocks/p-73185e58.entry.js +1 -0
- package/dist/sankhyablocks/p-7c4aabe2.js +1 -0
- package/dist/sankhyablocks/p-a31e761f.js +1 -0
- package/dist/sankhyablocks/p-afbb070d.js +1 -0
- package/dist/sankhyablocks/p-b2caaaf9.entry.js +1 -0
- package/dist/sankhyablocks/p-bc4b94d2.entry.js +1 -0
- package/dist/sankhyablocks/{p-913a9979.js → p-ca5ec380.js} +1 -1
- package/dist/sankhyablocks/{p-b7c4feeb.entry.js → p-d137ae48.entry.js} +1 -1
- package/dist/sankhyablocks/p-df8f4c4f.js +1 -0
- package/dist/sankhyablocks/{p-7d9baaf4.entry.js → p-e2a1273a.entry.js} +1 -1
- package/dist/sankhyablocks/p-f3434fc4.js +1 -0
- package/dist/sankhyablocks/{p-6d4f4614.js → p-f8698ad3.js} +1 -1
- package/dist/sankhyablocks/{p-b8cde0d8.entry.js → p-fb0313db.entry.js} +1 -1
- 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-attach/snk-attach.d.ts +1 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +9 -0
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +6 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +6 -1
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +1 -0
- package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +9 -4
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +4 -0
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +11 -0
- package/dist/types/components.d.ts +49 -0
- package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.d.ts +3 -2
- package/package.json +2 -2
- package/dist/sankhyablocks/p-0046959e.entry.js +0 -1
- package/dist/sankhyablocks/p-0e11ee18.entry.js +0 -1
- package/dist/sankhyablocks/p-14a08904.entry.js +0 -1
- package/dist/sankhyablocks/p-219f888d.entry.js +0 -1
- package/dist/sankhyablocks/p-47b60deb.entry.js +0 -1
- package/dist/sankhyablocks/p-6ded2076.entry.js +0 -1
- package/dist/sankhyablocks/p-7a337364.js +0 -1
- package/dist/sankhyablocks/p-829d4045.js +0 -1
- package/dist/sankhyablocks/p-8c6b44ea.entry.js +0 -1
- package/dist/sankhyablocks/p-8fc470e5.entry.js +0 -1
- package/dist/sankhyablocks/p-a4b1f1eb.js +0 -1
- package/dist/sankhyablocks/p-c7cbad38.js +0 -1
- package/dist/sankhyablocks/p-dc7c9047.js +0 -1
- package/dist/sankhyablocks/p-e0b9f59a.entry.js +0 -1
- package/dist/sankhyablocks/p-e9bbc3d5.entry.js +0 -1
- package/dist/sankhyablocks/p-f2809746.entry.js +0 -1
@@ -39,6 +39,8 @@ export class SnkCrud {
|
|
39
39
|
this.disablePersonalizedFilter = undefined;
|
40
40
|
this.autoLoad = undefined;
|
41
41
|
this.autoFocus = true;
|
42
|
+
this.domainMessagesBuilder = undefined;
|
43
|
+
this.setCustomFormTitle = undefined;
|
42
44
|
this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
|
43
45
|
}
|
44
46
|
/**
|
@@ -147,6 +149,7 @@ export class SnkCrud {
|
|
147
149
|
else if (viewMode === VIEW_MODE.FORM) {
|
148
150
|
this._guidesViewer.setFocus();
|
149
151
|
}
|
152
|
+
this.viewModeChanged.emit(viewMode);
|
150
153
|
}
|
151
154
|
openConfig(viewMode) {
|
152
155
|
this._snkConfigurator.close();
|
@@ -210,6 +213,7 @@ export class SnkCrud {
|
|
210
213
|
this._snkDataUnit = parent;
|
211
214
|
this._snkDataUnit.addEventListener("insertionMode", () => this.insertionModeHandler());
|
212
215
|
this._snkDataUnit.addEventListener("cancelEdition", () => this.cancelHandler());
|
216
|
+
this._snkDataUnit.domainMessagesBuilder = this.domainMessagesBuilder;
|
213
217
|
this._dataUnit = this._snkDataUnit.dataUnit;
|
214
218
|
this._dataState = this._snkDataUnit.dataState;
|
215
219
|
if (!this._dataUnit) {
|
@@ -376,7 +380,7 @@ export class SnkCrud {
|
|
376
380
|
return;
|
377
381
|
}
|
378
382
|
this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
|
379
|
-
return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, autoFocus: this.autoFocus }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
|
383
|
+
return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, autoFocus: this.autoFocus }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName, getCustomTitle: this.setCustomFormTitle }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
|
380
384
|
}
|
381
385
|
static get is() { return "snk-crud"; }
|
382
386
|
static get encapsulation() { return "scoped"; }
|
@@ -732,6 +736,38 @@ export class SnkCrud {
|
|
732
736
|
"attribute": "auto-focus",
|
733
737
|
"reflect": false,
|
734
738
|
"defaultValue": "true"
|
739
|
+
},
|
740
|
+
"domainMessagesBuilder": {
|
741
|
+
"type": "string",
|
742
|
+
"mutable": false,
|
743
|
+
"complexType": {
|
744
|
+
"original": "string",
|
745
|
+
"resolved": "string",
|
746
|
+
"references": {}
|
747
|
+
},
|
748
|
+
"required": false,
|
749
|
+
"optional": false,
|
750
|
+
"docs": {
|
751
|
+
"tags": [],
|
752
|
+
"text": "Define a chave customizada para sobrescrever as mensagens (N\u00E3o pegando pela entidade)"
|
753
|
+
},
|
754
|
+
"attribute": "domain-messages-builder",
|
755
|
+
"reflect": false
|
756
|
+
},
|
757
|
+
"setCustomFormTitle": {
|
758
|
+
"type": "unknown",
|
759
|
+
"mutable": false,
|
760
|
+
"complexType": {
|
761
|
+
"original": "() => string",
|
762
|
+
"resolved": "() => string",
|
763
|
+
"references": {}
|
764
|
+
},
|
765
|
+
"required": false,
|
766
|
+
"optional": false,
|
767
|
+
"docs": {
|
768
|
+
"tags": [],
|
769
|
+
"text": "Define uma fun\u00E7\u00E3o para configurar um t\u00EDtulo cusotmizado no modo formul\u00E1rio."
|
770
|
+
}
|
735
771
|
}
|
736
772
|
};
|
737
773
|
}
|
@@ -814,6 +850,26 @@ export class SnkCrud {
|
|
814
850
|
}
|
815
851
|
}
|
816
852
|
}
|
853
|
+
}, {
|
854
|
+
"method": "viewModeChanged",
|
855
|
+
"name": "viewModeChanged",
|
856
|
+
"bubbles": true,
|
857
|
+
"cancelable": true,
|
858
|
+
"composed": true,
|
859
|
+
"docs": {
|
860
|
+
"tags": [],
|
861
|
+
"text": ""
|
862
|
+
},
|
863
|
+
"complexType": {
|
864
|
+
"original": "VIEW_MODE",
|
865
|
+
"resolved": "VIEW_MODE.ATTACHMENT | VIEW_MODE.FORM | VIEW_MODE.GRID",
|
866
|
+
"references": {
|
867
|
+
"VIEW_MODE": {
|
868
|
+
"location": "import",
|
869
|
+
"path": "../../lib/utils/constants"
|
870
|
+
}
|
871
|
+
}
|
872
|
+
}
|
817
873
|
}];
|
818
874
|
}
|
819
875
|
static get methods() {
|
package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js
CHANGED
@@ -158,14 +158,13 @@ export class SnkDetailView {
|
|
158
158
|
return guideId.replace(SnkDetailView.REGEX_FORM_ID, "");
|
159
159
|
}
|
160
160
|
loadMetadata() {
|
161
|
-
var _a;
|
162
161
|
if (!this.dataUnit) {
|
163
162
|
return;
|
164
163
|
}
|
165
164
|
if (!this.formConfigManager.isLoaded) {
|
166
165
|
return;
|
167
166
|
}
|
168
|
-
const formConfig = this.formConfigManager.getConfig(
|
167
|
+
const formConfig = this.formConfigManager.getConfig(this.dataUnit);
|
169
168
|
//this._cardsState = formConfig?.cardsState;
|
170
169
|
this._formMetadata = buildFormMetadata(formConfig == undefined || formConfig.fields.length === 0 ? undefined : formConfig, this.dataUnit, true);
|
171
170
|
}
|
@@ -199,7 +198,7 @@ export class SnkDetailView {
|
|
199
198
|
this.emitSwitchEvent(VIEW_MODE.GRID);
|
200
199
|
evt.stopPropagation();
|
201
200
|
}
|
202
|
-
if (evt.detail === TaskbarElement.FORM_MODE) {
|
201
|
+
if (evt.detail === TaskbarElement.FORM_MODE || evt.detail === TaskbarElement.UPDATE) {
|
203
202
|
this.emitSwitchEvent(VIEW_MODE.FORM);
|
204
203
|
evt.stopPropagation();
|
205
204
|
}
|
@@ -223,7 +222,7 @@ export class SnkDetailView {
|
|
223
222
|
}
|
224
223
|
componentWillLoad() {
|
225
224
|
this._configName = `dynaform.${this.entityName}`;
|
226
|
-
this.formConfigManager = new SnkFormConfigManager(this._configName, this.resourceID, () => this.loadMetadata());
|
225
|
+
this.formConfigManager = new SnkFormConfigManager(this._configName, this.resourceID, () => this.loadMetadata(), this.dataUnit);
|
227
226
|
this.formConfigManager.loadConfig();
|
228
227
|
if (this.messagesBuilder == undefined) {
|
229
228
|
this.messagesBuilder = new SnkMessageBuilder(this.entityName);
|
@@ -27,6 +27,7 @@ export class SnkGuidesViewer {
|
|
27
27
|
this.resourceID = undefined;
|
28
28
|
this.detailTaskbarCustomContainerId = undefined;
|
29
29
|
this.formLegacyConfigName = undefined;
|
30
|
+
this.getCustomTitle = undefined;
|
30
31
|
this._hasToCreateFieldSearch = true;
|
31
32
|
this._breadcrumbItems = [];
|
32
33
|
this._guides = undefined;
|
@@ -113,7 +114,7 @@ export class SnkGuidesViewer {
|
|
113
114
|
}
|
114
115
|
onContentCardChanged(evt) {
|
115
116
|
SnkGuidesViewer.updateContentCard(evt.detail.formName, evt.detail.cardConfig, evt.detail.propertyChanged, this._configManager)
|
116
|
-
.then(() => this.masterFormConfig = this._configManager.getConfig(this.
|
117
|
+
.then(() => this.masterFormConfig = this._configManager.getConfig(this.dataUnit));
|
117
118
|
}
|
118
119
|
/**
|
119
120
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
@@ -360,11 +361,14 @@ export class SnkGuidesViewer {
|
|
360
361
|
this._configManager.addFormLegacyConfig(this.formLegacyConfigName);
|
361
362
|
}
|
362
363
|
}
|
364
|
+
setMasterFormConfig(config) {
|
365
|
+
this.masterFormConfig = config;
|
366
|
+
}
|
363
367
|
componentWillLoad() {
|
364
368
|
if (this.resourceID == undefined) {
|
365
369
|
throw new Error("Erro interno: resourceID não informado");
|
366
370
|
}
|
367
|
-
this._configManager = new SnkFormConfigManager(this.configName, this.resourceID,
|
371
|
+
this._configManager = new SnkFormConfigManager(this.configName, this.resourceID, this.setMasterFormConfig.bind(this), this.dataUnit);
|
368
372
|
this.addFormLegacyConfigName();
|
369
373
|
this._configManager.loadConfig();
|
370
374
|
}
|
@@ -392,7 +396,7 @@ export class SnkGuidesViewer {
|
|
392
396
|
return this._fieldSearch;
|
393
397
|
}
|
394
398
|
fieldsOptionLoader(argument) {
|
395
|
-
return Promise.resolve(this._configManager.getFieldsList(
|
399
|
+
return Promise.resolve(this._configManager.getFieldsList(argument)
|
396
400
|
.map(field => ({ value: field.name, label: field.label })));
|
397
401
|
}
|
398
402
|
onSelectField(option, actionButton) {
|
@@ -464,6 +468,10 @@ export class SnkGuidesViewer {
|
|
464
468
|
}
|
465
469
|
return "";
|
466
470
|
}
|
471
|
+
getTitle() {
|
472
|
+
var _a, _b;
|
473
|
+
return (_b = (_a = this.getCustomTitle) === null || _a === void 0 ? void 0 : _a.call(this)) !== null && _b !== void 0 ? _b : this.getMessage("snkCrud.title");
|
474
|
+
}
|
467
475
|
componentDidLoad() {
|
468
476
|
this.dataUnit.subscribe(this.dataUnitActionHandler.bind(this));
|
469
477
|
}
|
@@ -477,7 +485,7 @@ export class SnkGuidesViewer {
|
|
477
485
|
}
|
478
486
|
this.loadTaskbarProcessor();
|
479
487
|
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.
|
488
|
+
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
489
|
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
490
|
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
491
|
:
|
@@ -794,6 +802,21 @@ export class SnkGuidesViewer {
|
|
794
802
|
},
|
795
803
|
"attribute": "form-legacy-config-name",
|
796
804
|
"reflect": false
|
805
|
+
},
|
806
|
+
"getCustomTitle": {
|
807
|
+
"type": "unknown",
|
808
|
+
"mutable": false,
|
809
|
+
"complexType": {
|
810
|
+
"original": "() => string",
|
811
|
+
"resolved": "() => string",
|
812
|
+
"references": {}
|
813
|
+
},
|
814
|
+
"required": false,
|
815
|
+
"optional": false,
|
816
|
+
"docs": {
|
817
|
+
"tags": [],
|
818
|
+
"text": "Fornece uma fun\u00E7\u00E3o para obter um t\u00EDtulo customizado do formul\u00E1rio."
|
819
|
+
}
|
797
820
|
}
|
798
821
|
};
|
799
822
|
}
|
@@ -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" },
|
@@ -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
|
/**
|
@@ -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) {
|
@@ -470,7 +471,8 @@ 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
|
}
|
@@ -501,10 +503,13 @@ export class SnkDataUnit {
|
|
501
503
|
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
502
504
|
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-data-unit.msg.ts"
|
503
505
|
*/
|
504
|
-
getMessage(key, params = undefined) {
|
506
|
+
getMessage(key, params = undefined, customOperation) {
|
505
507
|
if (!params) {
|
506
508
|
params = this.getMessageParams();
|
507
509
|
}
|
510
|
+
if (customOperation) {
|
511
|
+
this.messagesBuilder.currentOperation = customOperation;
|
512
|
+
}
|
508
513
|
return this.messagesBuilder.getMessage(key, params);
|
509
514
|
}
|
510
515
|
getMessageParams() {
|
@@ -535,7 +540,7 @@ export class SnkDataUnit {
|
|
535
540
|
return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName, this.resourceID);
|
536
541
|
}
|
537
542
|
}
|
538
|
-
async loadDataUnit() {
|
543
|
+
async loadDataUnit(forceMetadataLoad = true) {
|
539
544
|
var _a;
|
540
545
|
if (this.dataUnit == null && this._application && this.entityName) {
|
541
546
|
this.dataUnit = await this.getDataUnitParentOrChild();
|
@@ -545,9 +550,11 @@ export class SnkDataUnit {
|
|
545
550
|
this.dataUnit.unsubscribe(this._dataUnitObserver);
|
546
551
|
this.dataUnit.addInterceptor(this);
|
547
552
|
this.dataUnit.subscribe(this._dataUnitObserver);
|
548
|
-
|
553
|
+
if (forceMetadataLoad || !this.dataUnit.metadata)
|
554
|
+
await this.dataUnit.loadMetadata();
|
549
555
|
if ((_a = this.dataUnit.records) === null || _a === void 0 ? void 0 : _a.length) {
|
550
|
-
this.getMetadataByRow(this.dataUnit);
|
556
|
+
const { records } = this.getMetadataByRow(this.dataUnit);
|
557
|
+
this.dataUnit.records = records;
|
551
558
|
}
|
552
559
|
this.dataState = this.buildDataState();
|
553
560
|
let resolver;
|
@@ -611,6 +618,13 @@ export class SnkDataUnit {
|
|
611
618
|
parent = parent.parentElement;
|
612
619
|
}
|
613
620
|
}
|
621
|
+
instanceMessagesBuilder() {
|
622
|
+
var _a;
|
623
|
+
if (this.messagesBuilder) {
|
624
|
+
return;
|
625
|
+
}
|
626
|
+
this.messagesBuilder = new SnkMessageBuilder((_a = this.domainMessagesBuilder) !== null && _a !== void 0 ? _a : this.entityName);
|
627
|
+
}
|
614
628
|
//---------------------------------------------
|
615
629
|
// Lifecycle web component
|
616
630
|
//---------------------------------------------
|
@@ -618,9 +632,7 @@ export class SnkDataUnit {
|
|
618
632
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
619
633
|
this._application.getAllAccess(this.resourceID).then(access => this._permissions = access);
|
620
634
|
this._parentSnkDataUnit = this.getParentSnkDataUnit();
|
621
|
-
|
622
|
-
this.messagesBuilder = new SnkMessageBuilder(this.entityName);
|
623
|
-
}
|
635
|
+
this.instanceMessagesBuilder();
|
624
636
|
}
|
625
637
|
disconnectedCallback() {
|
626
638
|
if (this.dataUnit) {
|
@@ -628,7 +640,7 @@ export class SnkDataUnit {
|
|
628
640
|
}
|
629
641
|
}
|
630
642
|
async componentDidLoad() {
|
631
|
-
await this.loadDataUnit();
|
643
|
+
await this.loadDataUnit(false);
|
632
644
|
this.handlerLinkFields();
|
633
645
|
}
|
634
646
|
render() {
|
@@ -860,6 +872,23 @@ export class SnkDataUnit {
|
|
860
872
|
},
|
861
873
|
"attribute": "resource-i-d",
|
862
874
|
"reflect": false
|
875
|
+
},
|
876
|
+
"domainMessagesBuilder": {
|
877
|
+
"type": "string",
|
878
|
+
"mutable": false,
|
879
|
+
"complexType": {
|
880
|
+
"original": "string",
|
881
|
+
"resolved": "string",
|
882
|
+
"references": {}
|
883
|
+
},
|
884
|
+
"required": false,
|
885
|
+
"optional": false,
|
886
|
+
"docs": {
|
887
|
+
"tags": [],
|
888
|
+
"text": "Define a chave customizada para sobrescrever as mensagens (N\u00E3o pegando pela entidade)"
|
889
|
+
},
|
890
|
+
"attribute": "domain-messages-builder",
|
891
|
+
"reflect": false
|
863
892
|
}
|
864
893
|
};
|
865
894
|
}
|
@@ -15,13 +15,13 @@ 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) => {
|
@@ -42,6 +42,13 @@ export class SnkFilterBar {
|
|
42
42
|
this.showPersonalizedFilter = false;
|
43
43
|
this.personalizedFilterId = undefined;
|
44
44
|
}
|
45
|
+
hasValidValue(item) {
|
46
|
+
if (item.value === undefined || item.value === null)
|
47
|
+
return false;
|
48
|
+
if (!Array.isArray(item.value))
|
49
|
+
return true;
|
50
|
+
return item.value.some(filterItem => filterItem.check === true);
|
51
|
+
}
|
45
52
|
observeFilterConfig(newValue, oldValue) {
|
46
53
|
if (ObjectUtils.equals(newValue, oldValue))
|
47
54
|
return;
|
@@ -268,7 +275,7 @@ export class SnkFilterBar {
|
|
268
275
|
getFilterItems() {
|
269
276
|
const pinnedItems = [];
|
270
277
|
const unpinnedItems = [];
|
271
|
-
this.filterConfig
|
278
|
+
this.filterConfig.sort((a, b) => this._filtersComparator(a, b))
|
272
279
|
.filter(this.filterActiveFilter)
|
273
280
|
.forEach((item, index) => {
|
274
281
|
item = ObjectUtils.copy(item);
|
@@ -338,6 +345,7 @@ export class SnkFilterBar {
|
|
338
345
|
.then((filters) => {
|
339
346
|
accept();
|
340
347
|
this.filterConfig = filters.map(item => this.normalizeItem(item));
|
348
|
+
this.filterConfig.sort((a, b) => this._filtersComparator(a, b));
|
341
349
|
})
|
342
350
|
.catch(reason => {
|
343
351
|
throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
|
@@ -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
|
}
|
@@ -67,7 +67,7 @@ export class SnkFormConfig {
|
|
67
67
|
}
|
68
68
|
}
|
69
69
|
getConfig() {
|
70
|
-
let config = this.configManager.getConfig(
|
70
|
+
let config = this.configManager.getConfig(this.dataUnit);
|
71
71
|
if (config.fields && config.fields.length === 0) {
|
72
72
|
config = undefined;
|
73
73
|
}
|
@@ -193,6 +193,11 @@ export class SnkFormConfig {
|
|
193
193
|
this.configManager.saveConfig(this.buildConfigToSave())
|
194
194
|
.then(savedConfig => {
|
195
195
|
ApplicationUtils.info(this.getMessage("snkFormConfig.info.successfullyConfigSaved"), { iconName: "check" });
|
196
|
+
const userOption = this._formConfigOptions
|
197
|
+
.find((config) => {
|
198
|
+
return config.origin === UserConfigType.USER;
|
199
|
+
});
|
200
|
+
this.setFormConfig(userOption);
|
196
201
|
this.configChange.emit(savedConfig);
|
197
202
|
});
|
198
203
|
}
|
@@ -529,9 +534,12 @@ export class SnkFormConfig {
|
|
529
534
|
switch (this._optionFormConfigSelected.origin) {
|
530
535
|
case UserConfigType.DEFAULT:
|
531
536
|
config = await this.configManager.fetchDefaultConfig();
|
537
|
+
if (!config) {
|
538
|
+
config = this.configManager.getEmptyConfig();
|
539
|
+
}
|
532
540
|
break;
|
533
|
-
|
534
|
-
config =
|
541
|
+
default:
|
542
|
+
config = this.getConfig();
|
535
543
|
break;
|
536
544
|
}
|
537
545
|
if (config != undefined) {
|
@@ -734,6 +742,9 @@ export class SnkFormConfig {
|
|
734
742
|
if (layoutFormConfig == undefined) {
|
735
743
|
layoutFormConfig = [];
|
736
744
|
}
|
745
|
+
if (this._formConfig.defaultConfiguration) {
|
746
|
+
return layoutFormConfig;
|
747
|
+
}
|
737
748
|
return this._formConfig.tabs.map((tab) => {
|
738
749
|
return layoutFormConfig.find(config => { var _a, _b; return ((_a = tab.label) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_b = config.tab) === null || _b === void 0 ? void 0 : _b.toLowerCase()); })
|
739
750
|
|| { tab: tab.label, groups: [], visible: tab.visible };
|