@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
@@ -309,7 +309,7 @@ export class SnkGrid {
|
|
309
309
|
const disabledButtons = [];
|
310
310
|
if ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectionInfo) {
|
311
311
|
if (this._dataState.selectionInfo.length > 1) {
|
312
|
-
disabledButtons.push(TaskbarElement.CLONE, "ATTACH");
|
312
|
+
disabledButtons.push(TaskbarElement.CLONE, "ATTACH", TaskbarElement.UPDATE);
|
313
313
|
}
|
314
314
|
if (this._dataState.selectionInfo.isAllRecords()) {
|
315
315
|
disabledButtons.push("REMOVE");
|
@@ -415,7 +415,7 @@ export class SnkGrid {
|
|
415
415
|
if (!this._dataUnit) {
|
416
416
|
return undefined;
|
417
417
|
}
|
418
|
-
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto
|
418
|
+
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto" }, h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, this._showSnkFilterBar &&
|
419
419
|
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit, autoFocus: this.autoFocus }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
420
420
|
}
|
421
421
|
static get is() { return "snk-grid"; }
|
@@ -56,6 +56,7 @@ export class SnkSimpleCrud {
|
|
56
56
|
this.formLegacyConfigName = undefined;
|
57
57
|
this.ignoreReadOnlyFormFields = false;
|
58
58
|
this.autoFocus = true;
|
59
|
+
this.domainMessagesBuilder = undefined;
|
59
60
|
this.autoLoad = undefined;
|
60
61
|
}
|
61
62
|
/**
|
@@ -278,7 +279,7 @@ export class SnkSimpleCrud {
|
|
278
279
|
return;
|
279
280
|
}
|
280
281
|
if (this._formConfigManager == undefined) {
|
281
|
-
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
282
|
+
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID(), undefined, this.dataUnit);
|
282
283
|
this._formConfigManager.setConfig(this.formConfig);
|
283
284
|
}
|
284
285
|
if (this.formConfigIsLoaded() && !forceLoad) {
|
@@ -672,8 +673,8 @@ export class SnkSimpleCrud {
|
|
672
673
|
return StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
|
673
674
|
}
|
674
675
|
getFormConfig() {
|
675
|
-
var _a
|
676
|
-
const configFromManager = (_a = this._formConfigManager) === null || _a === void 0 ? void 0 : _a.getConfig(
|
676
|
+
var _a;
|
677
|
+
const configFromManager = (_a = this._formConfigManager) === null || _a === void 0 ? void 0 : _a.getConfig(this.dataUnit, this.ignoreReadOnlyFormFields);
|
677
678
|
if (!this.configName && !configFromManager) {
|
678
679
|
return this.formConfig;
|
679
680
|
}
|
@@ -693,9 +694,10 @@ export class SnkSimpleCrud {
|
|
693
694
|
if (this.dataUnit == undefined) {
|
694
695
|
return;
|
695
696
|
}
|
696
|
-
|
697
|
+
const taskbarContent = (h("snk-taskbar", { class: this._currentViewMode === VIEW_MODE.FORM && "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })));
|
698
|
+
return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, this._currentViewMode === VIEW_MODE.FORM && taskbarContent, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
697
699
|
? undefined
|
698
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
700
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus }, this._currentViewMode === VIEW_MODE.GRID && taskbarContent, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
699
701
|
}
|
700
702
|
static get is() { return "snk-simple-crud"; }
|
701
703
|
static get encapsulation() { return "scoped"; }
|
@@ -1086,6 +1088,23 @@ export class SnkSimpleCrud {
|
|
1086
1088
|
"reflect": false,
|
1087
1089
|
"defaultValue": "true"
|
1088
1090
|
},
|
1091
|
+
"domainMessagesBuilder": {
|
1092
|
+
"type": "string",
|
1093
|
+
"mutable": false,
|
1094
|
+
"complexType": {
|
1095
|
+
"original": "string",
|
1096
|
+
"resolved": "string",
|
1097
|
+
"references": {}
|
1098
|
+
},
|
1099
|
+
"required": false,
|
1100
|
+
"optional": false,
|
1101
|
+
"docs": {
|
1102
|
+
"tags": [],
|
1103
|
+
"text": "Define a chave customizada para sobrescrever as mensagens (N\u00E3o pegando pela entidade)"
|
1104
|
+
},
|
1105
|
+
"attribute": "domain-messages-builder",
|
1106
|
+
"reflect": false
|
1107
|
+
},
|
1089
1108
|
"autoLoad": {
|
1090
1109
|
"type": "boolean",
|
1091
1110
|
"mutable": false,
|
@@ -29,6 +29,7 @@ export class SnkTaskbar {
|
|
29
29
|
this.onSaveEvent = (action) => {
|
30
30
|
switch (action.type) {
|
31
31
|
case DUAction.FIELD_INVALIDATED:
|
32
|
+
case DUAction.INVALIDATE_CLEAN:
|
32
33
|
case DUAction.DATA_SAVED:
|
33
34
|
case DUAction.SAVING_ERROR:
|
34
35
|
this._isWaitingForSave = false;
|
@@ -67,6 +68,16 @@ export class SnkTaskbar {
|
|
67
68
|
this.getCustomElements(true);
|
68
69
|
}
|
69
70
|
}
|
71
|
+
handleTaskbarSaveLocker() {
|
72
|
+
if (this._isWaitingForSave !== true) {
|
73
|
+
this._isWaitingForSave = true;
|
74
|
+
}
|
75
|
+
}
|
76
|
+
handleTaskbarSaveUnlocker() {
|
77
|
+
if (this._isWaitingForSave === true) {
|
78
|
+
this._isWaitingForSave = false;
|
79
|
+
}
|
80
|
+
}
|
70
81
|
hasToSearchCustomElements(event) {
|
71
82
|
return this.customSlotId === event.detail && !this._slotContainer;
|
72
83
|
}
|
@@ -85,6 +96,14 @@ export class SnkTaskbar {
|
|
85
96
|
this._hasToUpdateOverFlow = true;
|
86
97
|
}
|
87
98
|
}
|
99
|
+
observeIsWaitingForSave(newValue, oldValue) {
|
100
|
+
if (newValue == true && oldValue == false) {
|
101
|
+
this.taskbarSaveLocker.emit();
|
102
|
+
}
|
103
|
+
if (newValue == false && oldValue == true) {
|
104
|
+
this.taskbarSaveUnlocker.emit();
|
105
|
+
}
|
106
|
+
}
|
88
107
|
// Internal methods
|
89
108
|
elementsFromString(strButtons) {
|
90
109
|
const elements = [];
|
@@ -719,6 +738,36 @@ export class SnkTaskbar {
|
|
719
738
|
"resolved": "string",
|
720
739
|
"references": {}
|
721
740
|
}
|
741
|
+
}, {
|
742
|
+
"method": "taskbarSaveLocker",
|
743
|
+
"name": "taskbarSaveLocker",
|
744
|
+
"bubbles": true,
|
745
|
+
"cancelable": true,
|
746
|
+
"composed": true,
|
747
|
+
"docs": {
|
748
|
+
"tags": [],
|
749
|
+
"text": "Emitido sempre que um save \u00E9 iniciado pela taskbar."
|
750
|
+
},
|
751
|
+
"complexType": {
|
752
|
+
"original": "void",
|
753
|
+
"resolved": "void",
|
754
|
+
"references": {}
|
755
|
+
}
|
756
|
+
}, {
|
757
|
+
"method": "taskbarSaveUnlocker",
|
758
|
+
"name": "taskbarSaveUnlocker",
|
759
|
+
"bubbles": true,
|
760
|
+
"cancelable": true,
|
761
|
+
"composed": true,
|
762
|
+
"docs": {
|
763
|
+
"tags": [],
|
764
|
+
"text": "Emitido sempre que o ocorre alguma action que libera o save."
|
765
|
+
},
|
766
|
+
"complexType": {
|
767
|
+
"original": "void",
|
768
|
+
"resolved": "void",
|
769
|
+
"references": {}
|
770
|
+
}
|
722
771
|
}];
|
723
772
|
}
|
724
773
|
static get elementRef() { return "_element"; }
|
@@ -732,6 +781,9 @@ export class SnkTaskbar {
|
|
732
781
|
}, {
|
733
782
|
"propName": "_lastWidth",
|
734
783
|
"methodName": "observeLastWidth"
|
784
|
+
}, {
|
785
|
+
"propName": "_isWaitingForSave",
|
786
|
+
"methodName": "observeIsWaitingForSave"
|
735
787
|
}];
|
736
788
|
}
|
737
789
|
static get listeners() {
|
@@ -741,6 +793,18 @@ export class SnkTaskbar {
|
|
741
793
|
"target": "window",
|
742
794
|
"capture": false,
|
743
795
|
"passive": false
|
796
|
+
}, {
|
797
|
+
"name": "taskbarSaveLocker",
|
798
|
+
"method": "handleTaskbarSaveLocker",
|
799
|
+
"target": "window",
|
800
|
+
"capture": false,
|
801
|
+
"passive": false
|
802
|
+
}, {
|
803
|
+
"name": "taskbarSaveUnlocker",
|
804
|
+
"method": "handleTaskbarSaveUnlocker",
|
805
|
+
"target": "window",
|
806
|
+
"capture": false,
|
807
|
+
"passive": false
|
744
808
|
}];
|
745
809
|
}
|
746
810
|
}
|
@@ -71,6 +71,7 @@ export class ConfigStorage {
|
|
71
71
|
if (config == undefined) {
|
72
72
|
return;
|
73
73
|
}
|
74
|
+
name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.grid);
|
74
75
|
await this.deleteGridConfigCache(name, resourceID);
|
75
76
|
return this.gridConfigFetcher.saveConfig(config, name, resourceID);
|
76
77
|
}
|
@@ -22,12 +22,16 @@ export function applySorting(records, dataUnit, sorting) {
|
|
22
22
|
return records.sort(sortingFunction);
|
23
23
|
}
|
24
24
|
export function buildPaginationInfo(records, offset = 0, limit = 0) {
|
25
|
-
|
25
|
+
if (records === undefined) {
|
26
|
+
return undefined;
|
27
|
+
}
|
28
|
+
const total = (records === null || records === void 0 ? void 0 : records.length) || 0;
|
29
|
+
const lastRecord = Math.min(offset + limit, total);
|
26
30
|
return {
|
27
31
|
currentPage: limit === 0 ? 0 : Math.ceil(offset / limit),
|
28
32
|
firstRecord: offset,
|
29
33
|
lastRecord: lastRecord,
|
30
|
-
total:
|
31
|
-
hasMore: !!(
|
34
|
+
total: total,
|
35
|
+
hasMore: !!(total - lastRecord),
|
32
36
|
};
|
33
37
|
}
|
@@ -6,7 +6,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
6
6
|
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
7
7
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
8
8
|
};
|
9
|
-
import { ApplicationContext, ErrorException, ObjectUtils, StringUtils, WarningException } from '@sankhyalabs/core';
|
9
|
+
import { ApplicationContext, ErrorException, ServiceCanceledException, ObjectUtils, StringUtils, WarningException } from '@sankhyalabs/core';
|
10
10
|
import { batchRequests } from 'graphql-request';
|
11
11
|
import UrlUtils from "../../../lib/utils/urlutils";
|
12
12
|
import { PrintUtils } from '../../utils/PrintUtils';
|
@@ -352,6 +352,7 @@ export class DataFetcher {
|
|
352
352
|
}
|
353
353
|
}
|
354
354
|
async executePendingRequest(watingRequestsById) {
|
355
|
+
var _a, _b;
|
355
356
|
const requestsBatch = [];
|
356
357
|
let quietMode = true;
|
357
358
|
watingRequestsById.forEach((waitingReq) => {
|
@@ -362,31 +363,36 @@ export class DataFetcher {
|
|
362
363
|
const response = await this.fecthGraphQL(requestsBatch, quietMode);
|
363
364
|
const { data: dataResponse, errors: errorsResponse, extensions } = response;
|
364
365
|
//Reject promises with errors from query
|
365
|
-
|
366
|
-
Object.
|
367
|
-
|
366
|
+
for (const errorResponse of errorsResponse) {
|
367
|
+
const values = Object.values(errorResponse);
|
368
|
+
for (const value of values) {
|
369
|
+
const waitingRequest = watingRequestsById.get(value.request.variables[value.index].queryID);
|
368
370
|
const hasClientEvent = await this.proccesGraphQLClientEvents(extensions, waitingRequest.request, waitingRequest.resolve, waitingRequest.reject);
|
369
|
-
Promise.race([
|
371
|
+
const data = await Promise.race([
|
370
372
|
waitingRequest.promise,
|
371
373
|
new Promise((resolve) => {
|
372
374
|
resolve(false);
|
373
375
|
})
|
374
|
-
])
|
375
|
-
|
376
|
-
if (
|
377
|
-
(((_a = watingRequestsById.get(
|
376
|
+
]);
|
377
|
+
if (!hasClientEvent || data === false) {
|
378
|
+
if (Object.keys(errorResponse[0].extensions).includes("SERVICE_CANCELED") || Object.keys(extensions).includes("isServiceCancelled")) {
|
379
|
+
(((_a = watingRequestsById.get(value.request.variables[value.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new ServiceCanceledException("Service canceled", value.message));
|
378
380
|
}
|
379
|
-
|
380
|
-
|
381
|
-
|
381
|
+
else {
|
382
|
+
(((_b = watingRequestsById.get(value.request.variables[value.index].queryID)) === null || _b === void 0 ? void 0 : _b.reject) || Promise.reject)(new ErrorException("Falha detectada", value.message));
|
383
|
+
}
|
384
|
+
}
|
385
|
+
}
|
386
|
+
}
|
382
387
|
//Resolve promises with data from query
|
383
|
-
|
384
|
-
Object.entries(data)
|
388
|
+
for (const data of dataResponse) {
|
389
|
+
const entries = Object.entries(data);
|
390
|
+
for (const [key, val] of entries) {
|
385
391
|
const waitingRequest = watingRequestsById.get(key);
|
386
392
|
await this.proccesGraphQLClientEvents(extensions, waitingRequest.request, waitingRequest.resolve, waitingRequest.reject);
|
387
393
|
((waitingRequest === null || waitingRequest === void 0 ? void 0 : waitingRequest.resolve) || Promise.resolve)(val);
|
388
|
-
}
|
389
|
-
}
|
394
|
+
}
|
395
|
+
}
|
390
396
|
}
|
391
397
|
buildGraphQlURL(quietMode) {
|
392
398
|
const urlParams = UrlUtils.getQueryParams(location.search);
|
package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.js
CHANGED
@@ -6,21 +6,23 @@ const SERVICE = {
|
|
6
6
|
download: "AnexoSistemaSP.baixar",
|
7
7
|
};
|
8
8
|
export class AnexoSistemaFetcher {
|
9
|
-
constructor(entityName,
|
9
|
+
constructor(entityName, dataUnitName) {
|
10
10
|
var _a;
|
11
11
|
this.entityName = entityName;
|
12
|
-
this.registerKey = registerKey;
|
13
12
|
this.dataUnitName = dataUnitName;
|
14
13
|
this.validateFields = (fields) => {
|
15
14
|
if (!!fields.LINK && !!fields.NOMEARQUIVO)
|
16
15
|
throw new Error(SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME);
|
17
16
|
if (!fields.LINK && !fields.NOMEARQUIVO)
|
18
17
|
throw new Error(SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED);
|
19
|
-
if (!this.
|
18
|
+
if (!this._registerKey)
|
20
19
|
throw new Error('Register key can not be null');
|
21
20
|
};
|
22
21
|
this.resourceID = (window["resourceID"] || ((_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.resourceID));
|
23
22
|
}
|
23
|
+
set registerKey(registerKey) {
|
24
|
+
this._registerKey = registerKey;
|
25
|
+
}
|
24
26
|
async save(change) {
|
25
27
|
var _a, _b;
|
26
28
|
let { updatingFields: fields } = change;
|
@@ -39,7 +41,7 @@ export class AnexoSistemaFetcher {
|
|
39
41
|
nameAttach: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name,
|
40
42
|
link: fields.LINK,
|
41
43
|
nameEntity: this.entityName,
|
42
|
-
pkEntity: this.
|
44
|
+
pkEntity: this._registerKey,
|
43
45
|
typeAcess: fields.TIPOACESSO,
|
44
46
|
typeApres: fields.TIPOAPRES,
|
45
47
|
}
|
@@ -79,7 +81,7 @@ export class AnexoSistemaFetcher {
|
|
79
81
|
nameAttach: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name,
|
80
82
|
link: fields.LINK,
|
81
83
|
nameEntity: this.entityName,
|
82
|
-
pkEntity: this.
|
84
|
+
pkEntity: this._registerKey,
|
83
85
|
typeAcess: fields.TIPOACESSO,
|
84
86
|
typeApres: fields.TIPOAPRES,
|
85
87
|
}
|
@@ -155,7 +155,10 @@ export class FormConfigFetcher extends ResourceFetcher {
|
|
155
155
|
query: this.queryConfig.get("fetchDefaultConfig"),
|
156
156
|
})
|
157
157
|
.then((result) => {
|
158
|
-
|
158
|
+
if (!(result === null || result === void 0 ? void 0 : result.resource)) {
|
159
|
+
resolve(null);
|
160
|
+
}
|
161
|
+
resolve(ObjectUtils.stringToObject(result === null || result === void 0 ? void 0 : result.resource));
|
159
162
|
})
|
160
163
|
.catch((error) => {
|
161
164
|
reject(error);
|
@@ -7,7 +7,7 @@ const snkExporterMessages = {
|
|
7
7
|
emailSenderOptStep_subtitle: "Primeiro, escolha o formato do arquivo",
|
8
8
|
emailSenderOptStep_lblFormat: "Formato:",
|
9
9
|
emailSenderOptStep_formatPDF: "PDF (.pdf)",
|
10
|
-
|
10
|
+
emailSenderOptStep_formatXLS: "Planilha (.xls)",
|
11
11
|
emailSenderOptStep_export: "Exportar:",
|
12
12
|
emailSenderOptStep_allData: "Toda a grade",
|
13
13
|
emailSenderOptStep_currentPage: "Somente a página atual",
|
@@ -423,6 +423,7 @@ class ConfigStorage {
|
|
423
423
|
if (config == undefined) {
|
424
424
|
return;
|
425
425
|
}
|
426
|
+
name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.grid);
|
426
427
|
await this.deleteGridConfigCache(name, resourceID);
|
427
428
|
return this.gridConfigFetcher.saveConfig(config, name, resourceID);
|
428
429
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { DataType, ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils } from '@sankhyalabs/core';
|
1
|
+
import { DataType, ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils, ServiceCanceledException } from '@sankhyalabs/core';
|
2
2
|
import { P as PrintUtils } from './PrintUtils.js';
|
3
3
|
import { DataUnitTransient } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
4
4
|
|
@@ -6863,6 +6863,7 @@ class DataFetcher {
|
|
6863
6863
|
}
|
6864
6864
|
}
|
6865
6865
|
async executePendingRequest(watingRequestsById) {
|
6866
|
+
var _a, _b;
|
6866
6867
|
const requestsBatch = [];
|
6867
6868
|
let quietMode = true;
|
6868
6869
|
watingRequestsById.forEach((waitingReq) => {
|
@@ -6873,31 +6874,36 @@ class DataFetcher {
|
|
6873
6874
|
const response = await this.fecthGraphQL(requestsBatch, quietMode);
|
6874
6875
|
const { data: dataResponse, errors: errorsResponse, extensions } = response;
|
6875
6876
|
//Reject promises with errors from query
|
6876
|
-
|
6877
|
-
Object.
|
6878
|
-
|
6877
|
+
for (const errorResponse of errorsResponse) {
|
6878
|
+
const values = Object.values(errorResponse);
|
6879
|
+
for (const value of values) {
|
6880
|
+
const waitingRequest = watingRequestsById.get(value.request.variables[value.index].queryID);
|
6879
6881
|
const hasClientEvent = await this.proccesGraphQLClientEvents(extensions, waitingRequest.request, waitingRequest.resolve, waitingRequest.reject);
|
6880
|
-
Promise.race([
|
6882
|
+
const data = await Promise.race([
|
6881
6883
|
waitingRequest.promise,
|
6882
6884
|
new Promise((resolve) => {
|
6883
6885
|
resolve(false);
|
6884
6886
|
})
|
6885
|
-
])
|
6886
|
-
|
6887
|
-
if (
|
6888
|
-
(((_a = watingRequestsById.get(
|
6887
|
+
]);
|
6888
|
+
if (!hasClientEvent || data === false) {
|
6889
|
+
if (Object.keys(errorResponse[0].extensions).includes("SERVICE_CANCELED") || Object.keys(extensions).includes("isServiceCancelled")) {
|
6890
|
+
(((_a = watingRequestsById.get(value.request.variables[value.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new ServiceCanceledException("Service canceled", value.message));
|
6889
6891
|
}
|
6890
|
-
|
6891
|
-
|
6892
|
-
|
6892
|
+
else {
|
6893
|
+
(((_b = watingRequestsById.get(value.request.variables[value.index].queryID)) === null || _b === void 0 ? void 0 : _b.reject) || Promise.reject)(new ErrorException("Falha detectada", value.message));
|
6894
|
+
}
|
6895
|
+
}
|
6896
|
+
}
|
6897
|
+
}
|
6893
6898
|
//Resolve promises with data from query
|
6894
|
-
|
6895
|
-
Object.entries(data)
|
6899
|
+
for (const data of dataResponse) {
|
6900
|
+
const entries = Object.entries(data);
|
6901
|
+
for (const [key, val] of entries) {
|
6896
6902
|
const waitingRequest = watingRequestsById.get(key);
|
6897
6903
|
await this.proccesGraphQLClientEvents(extensions, waitingRequest.request, waitingRequest.resolve, waitingRequest.reject);
|
6898
6904
|
((waitingRequest === null || waitingRequest === void 0 ? void 0 : waitingRequest.resolve) || Promise.resolve)(val);
|
6899
|
-
}
|
6900
|
-
}
|
6905
|
+
}
|
6906
|
+
}
|
6901
6907
|
}
|
6902
6908
|
buildGraphQlURL(quietMode) {
|
6903
6909
|
const urlParams = UrlUtils.getQueryParams(location.search);
|
@@ -1,12 +1,14 @@
|
|
1
1
|
import { C as ConfigStorage } from './ConfigStorage.js';
|
2
2
|
import { ObjectUtils, StringUtils } from '@sankhyalabs/core';
|
3
3
|
import { F as FormConfigFetcher } from './form-config-fetcher.js';
|
4
|
+
import { c as TAB_NAMES } from './constants.js';
|
4
5
|
|
5
6
|
class SnkFormConfigManager {
|
6
|
-
constructor(configName, resourceID, onConfigChange) {
|
7
|
+
constructor(configName, resourceID, onConfigChange, dataUnit) {
|
7
8
|
this._resourceID = resourceID;
|
8
9
|
this._configName = configName;
|
9
10
|
this._onConfigChange = onConfigChange;
|
11
|
+
this._dataUnit = dataUnit;
|
10
12
|
}
|
11
13
|
addFormLegacyConfig(legacyConfigName) {
|
12
14
|
if (this._configName) {
|
@@ -17,6 +19,7 @@ class SnkFormConfigManager {
|
|
17
19
|
return new Promise(resolve => {
|
18
20
|
ConfigStorage.loadFormConfig(this._configName, this._resourceID)
|
19
21
|
.then((config) => {
|
22
|
+
config = this.buildFormMetadataUITabs(config);
|
20
23
|
this.setConfig(config);
|
21
24
|
resolve(config);
|
22
25
|
})
|
@@ -25,6 +28,10 @@ class SnkFormConfigManager {
|
|
25
28
|
});
|
26
29
|
});
|
27
30
|
}
|
31
|
+
getEmptyConfig() {
|
32
|
+
const config = this.buildFormMetadataUITabs({ fields: [], emptyConfig: true }, true);
|
33
|
+
return config;
|
34
|
+
}
|
28
35
|
saveConfig(config) {
|
29
36
|
const configToSave = ObjectUtils.copy(config);
|
30
37
|
return new Promise(accept => {
|
@@ -68,27 +75,36 @@ class SnkFormConfigManager {
|
|
68
75
|
}
|
69
76
|
return updatingCardConfig;
|
70
77
|
}
|
71
|
-
|
78
|
+
hasConfig(config) {
|
79
|
+
var _a;
|
80
|
+
const currentConfig = config !== null && config !== void 0 ? config : this._config;
|
81
|
+
if (currentConfig && ((_a = currentConfig.fields) === null || _a === void 0 ? void 0 : _a.length)) {
|
82
|
+
return true;
|
83
|
+
}
|
84
|
+
return false;
|
85
|
+
}
|
86
|
+
getFieldsList(descriptionFilter, forceEmptyConfig = false) {
|
72
87
|
var _a;
|
73
88
|
const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
|
74
|
-
|
75
|
-
|
89
|
+
const hasConfig = this.hasConfig();
|
90
|
+
if (hasConfig && !forceEmptyConfig) {
|
91
|
+
return fields.map(({ label, name, readOnly, visible, required, tab }) => {
|
92
|
+
var _a;
|
76
93
|
if (label == undefined) {
|
77
|
-
|
78
|
-
|
79
|
-
visible,
|
80
|
-
required });
|
94
|
+
const currentField = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
|
95
|
+
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 });
|
81
96
|
}
|
82
|
-
return { name, label, readOnly, visible, required };
|
97
|
+
return { name, label, readOnly, visible, required, tab };
|
83
98
|
})
|
84
99
|
.filter(field => this.isFieldVisible(field, descriptionFilter));
|
85
100
|
}
|
86
|
-
if (
|
87
|
-
return
|
88
|
-
.filter(field => this.isFieldVisible(field, descriptionFilter))
|
89
|
-
.map(({ label, name, readOnly }) => { return { label, name, readOnly }; });
|
101
|
+
if (!this._dataUnit) {
|
102
|
+
return [];
|
90
103
|
}
|
91
|
-
|
104
|
+
const filteredFields = this._dataUnit.metadata.fields
|
105
|
+
.filter(field => this.isFieldVisible(field, descriptionFilter))
|
106
|
+
.map(({ label, name, readOnly, visible, required, properties }) => ({ label, name, readOnly, visible, required, tab: properties === null || properties === void 0 ? void 0 : properties.UITabName }));
|
107
|
+
return filteredFields;
|
92
108
|
}
|
93
109
|
isFieldVisible(field, descriptionFilter) {
|
94
110
|
if (field.visible === false) {
|
@@ -101,8 +117,8 @@ class SnkFormConfigManager {
|
|
101
117
|
const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
|
102
118
|
return normalizedText.includes(normalizedFilter);
|
103
119
|
}
|
104
|
-
|
105
|
-
let fields = this.getFieldsList(
|
120
|
+
getFormConfig(dataUnit, ignoreReadOnlyFormFields, forceEmptyConfig = false) {
|
121
|
+
let fields = this.getFieldsList(undefined, forceEmptyConfig);
|
106
122
|
if (ignoreReadOnlyFormFields) {
|
107
123
|
fields = fields.filter(field => {
|
108
124
|
if (dataUnit) {
|
@@ -133,8 +149,8 @@ class SnkFormConfigManager {
|
|
133
149
|
this._onConfigChange(Object.assign({}, this._config));
|
134
150
|
}
|
135
151
|
}
|
136
|
-
getConfig(
|
137
|
-
return
|
152
|
+
getConfig(dataUnit, ignoreReadOnlyFormFields) {
|
153
|
+
return this.getFormConfig(dataUnit, ignoreReadOnlyFormFields !== null && ignoreReadOnlyFormFields !== void 0 ? ignoreReadOnlyFormFields : true);
|
138
154
|
}
|
139
155
|
getFormConfigFetcher() {
|
140
156
|
if (this._formConfigFetcher == undefined) {
|
@@ -155,6 +171,44 @@ class SnkFormConfigManager {
|
|
155
171
|
async fetchDefaultConfig() {
|
156
172
|
return this.getFormConfigFetcher().fetchDefaultConfig(this._configName, this._resourceID);
|
157
173
|
}
|
174
|
+
parseObjectList(object) {
|
175
|
+
if (!object) {
|
176
|
+
return [];
|
177
|
+
}
|
178
|
+
return Array.isArray(object) ? object : [object];
|
179
|
+
}
|
180
|
+
buildFormMetadataUITabs(config, forceEmptyConfig = false) {
|
181
|
+
var _a;
|
182
|
+
const hasConfig = this.hasConfig(config);
|
183
|
+
if (!forceEmptyConfig && (!this._dataUnit || hasConfig)) {
|
184
|
+
return config;
|
185
|
+
}
|
186
|
+
config = this.getFormConfig(this._dataUnit, false, true);
|
187
|
+
config.tabs = this.parseObjectList(config.tabs);
|
188
|
+
config.emptyConfig = false;
|
189
|
+
config.defaultConfiguration = true;
|
190
|
+
const fields = this._dataUnit.metadata.fields;
|
191
|
+
for (const currentField of fields) {
|
192
|
+
const field = config.fields.find(field => field.name === currentField.name);
|
193
|
+
const uiTabName = (_a = currentField.properties) === null || _a === void 0 ? void 0 : _a.UITabName;
|
194
|
+
if (!uiTabName || uiTabName === TAB_NAMES.main) {
|
195
|
+
continue;
|
196
|
+
}
|
197
|
+
const haveTab = config.tabs.some((tab) => tab.label === uiTabName);
|
198
|
+
if (!haveTab) {
|
199
|
+
config.tabs.push({
|
200
|
+
label: uiTabName,
|
201
|
+
name: uiTabName,
|
202
|
+
order: 0,
|
203
|
+
visible: true,
|
204
|
+
});
|
205
|
+
}
|
206
|
+
if (field) {
|
207
|
+
field.tab = uiTabName;
|
208
|
+
}
|
209
|
+
}
|
210
|
+
return config;
|
211
|
+
}
|
158
212
|
}
|
159
213
|
|
160
214
|
export { SnkFormConfigManager as S };
|
@@ -8,7 +8,7 @@ const snkDataUnitMessages = {
|
|
8
8
|
},
|
9
9
|
cancelInfo: {
|
10
10
|
clone: "Duplicação descartada!",
|
11
|
-
insert: "A inclusão descartada!",
|
11
|
+
insert: "A inclusão foi descartada!",
|
12
12
|
update: "A edição foi descartada!"
|
13
13
|
},
|
14
14
|
confirm: {
|
@@ -122,7 +122,7 @@ const snkExporterMessages = {
|
|
122
122
|
emailSenderOptStep_subtitle: "Primeiro, escolha o formato do arquivo",
|
123
123
|
emailSenderOptStep_lblFormat: "Formato:",
|
124
124
|
emailSenderOptStep_formatPDF: "PDF (.pdf)",
|
125
|
-
|
125
|
+
emailSenderOptStep_formatXLS: "Planilha (.xls)",
|
126
126
|
emailSenderOptStep_export: "Exportar:",
|
127
127
|
emailSenderOptStep_allData: "Toda a grade",
|
128
128
|
emailSenderOptStep_currentPage: "Somente a página atual",
|