@sankhyalabs/sankhyablocks 8.1.0-rc.3 → 8.2.0-dev.1
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-73e7afff.js → ConfigStorage-12397f18.js} +163 -51
- package/dist/cjs/{DataFetcher-004811c6.js → DataFetcher-f2da1f79.js} +68 -30
- package/dist/cjs/ISave-d68ce3cd.js +8 -0
- package/dist/cjs/ResourceIDUtils-5ff86aa7.js +12 -0
- package/dist/cjs/{SnkFormConfigManager-d1f1a222.js → SnkFormConfigManager-13f79e37.js} +19 -21
- package/dist/cjs/{auth-fetcher-58237931.js → auth-fetcher-319a4cb2.js} +2 -2
- package/dist/cjs/{dataunit-fetcher-029eafbd.js → dataunit-fetcher-e72068c1.js} +1 -1
- package/dist/cjs/{form-config-fetcher-181767c9.js → form-config-fetcher-5d62ab62.js} +66 -3
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-9a97994a.js → pesquisa-fetcher-8c363096.js} +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button.cjs.entry.js +18 -11
- package/dist/cjs/snk-application.cjs.entry.js +49 -44
- package/dist/cjs/snk-attach.cjs.entry.js +7 -13
- package/dist/cjs/snk-configurator.cjs.entry.js +2 -1
- package/dist/cjs/snk-crud.cjs.entry.js +25 -10
- package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
- package/dist/cjs/{snk-data-unit-e89e07bd.js → snk-data-unit-80a00ae4.js} +4 -3
- package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
- package/dist/cjs/snk-detail-view.cjs.entry.js +14 -12
- package/dist/cjs/snk-entity-list.cjs.entry.js +0 -4
- package/dist/cjs/snk-filter-bar.cjs.entry.js +14 -17
- package/dist/cjs/snk-filter-detail.cjs.entry.js +1 -15
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +5 -19
- package/dist/cjs/snk-form-config.cjs.entry.js +6 -17
- package/dist/cjs/snk-form-view.cjs.entry.js +6 -1
- package/dist/cjs/snk-form.cjs.entry.js +12 -8
- package/dist/cjs/snk-grid-config.cjs.entry.js +5 -6
- package/dist/cjs/snk-grid.cjs.entry.js +17 -20
- package/dist/cjs/{snk-guides-viewer-27f87d90.js → snk-guides-viewer-a7cd6fda.js} +17 -7
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -8
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +13 -16
- package/dist/cjs/snk-print-selector.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +20 -72
- package/dist/cjs/snk-taskbar.cjs.entry.js +2 -1
- package/dist/collection/components/snk-actions-button/actions/index.js +3 -4
- package/dist/collection/components/snk-actions-button/snk-actions-button.js +8 -4
- package/dist/collection/components/snk-application/snk-application.js +60 -65
- package/dist/collection/components/snk-configurator/snk-configurator.js +19 -1
- package/dist/collection/components/snk-crud/snk-crud.js +40 -6
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +42 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +27 -1
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +47 -28
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +21 -4
- package/dist/collection/components/snk-entity-list/snk-entity-list.js +0 -23
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +2 -12
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +21 -16
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +28 -12
- package/dist/collection/components/snk-form/SnkFormConfigManager.js +17 -19
- package/dist/collection/components/snk-form/snk-form.js +46 -2
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +5 -15
- package/dist/collection/components/snk-grid/snk-grid.js +51 -15
- package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js +19 -1
- package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +28 -12
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +22 -0
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +19 -1
- package/dist/collection/lib/configs/ConfigStorage.js +33 -44
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +2 -59
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +39 -30
- package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +0 -24
- package/dist/collection/lib/index.js +10 -0
- package/dist/collection/lib/resourceid/ResourceIDUtils.js +7 -0
- package/dist/collection/lib/utils/urlutils.js +29 -0
- package/dist/components/ConfigStorage.js +161 -48
- package/dist/components/DataFetcher.js +68 -30
- package/dist/components/ResourceIDUtils.js +10 -0
- package/dist/components/SnkFormConfigManager.js +17 -19
- package/dist/components/auth-fetcher.js +1 -1
- package/dist/components/form-config-fetcher.js +64 -2
- package/dist/components/snk-actions-button2.js +23 -9
- package/dist/components/snk-application2.js +134 -128
- package/dist/components/snk-attach2.js +1 -8
- package/dist/components/snk-configurator2.js +3 -1
- package/dist/components/snk-crud.js +23 -6
- package/dist/components/snk-data-unit2.js +5 -3
- package/dist/components/snk-detail-view2.js +20 -8
- package/dist/components/snk-entity-list.js +0 -4
- package/dist/components/snk-filter-bar2.js +12 -12
- package/dist/components/snk-filter-detail2.js +2 -12
- package/dist/components/snk-filter-modal-item2.js +5 -16
- package/dist/components/snk-form-config2.js +5 -15
- package/dist/components/snk-form-view2.js +6 -1
- package/dist/components/snk-form.js +9 -2
- package/dist/components/snk-grid-config2.js +4 -2
- package/dist/components/snk-grid2.js +17 -16
- package/dist/components/snk-personalized-filter2.js +11 -11
- package/dist/components/snk-simple-crud2.js +8 -60
- package/dist/components/snk-taskbar2.js +3 -1
- package/dist/esm/{ConfigStorage-19a7260b.js → ConfigStorage-932ab366.js} +162 -49
- package/dist/esm/{DataFetcher-e0fc5549.js → DataFetcher-7e18aa30.js} +68 -30
- package/dist/esm/ISave-4412b20c.js +8 -0
- package/dist/esm/ResourceIDUtils-a114189a.js +10 -0
- package/dist/esm/{SnkFormConfigManager-1a42eb02.js → SnkFormConfigManager-bb9afc3f.js} +19 -21
- package/dist/esm/{auth-fetcher-83a946f8.js → auth-fetcher-6d9664b7.js} +1 -1
- package/dist/esm/{dataunit-fetcher-6a695723.js → dataunit-fetcher-91a4eb82.js} +1 -1
- package/dist/esm/{form-config-fetcher-9e167008.js → form-config-fetcher-aaaa79a6.js} +65 -3
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-9118eb7a.js → pesquisa-fetcher-56b30fb4.js} +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button.entry.js +18 -11
- package/dist/esm/snk-application.entry.js +49 -44
- package/dist/esm/snk-attach.entry.js +3 -9
- package/dist/esm/snk-configurator.entry.js +2 -1
- package/dist/esm/snk-crud.entry.js +25 -10
- package/dist/esm/snk-data-exporter.entry.js +2 -2
- package/dist/esm/{snk-data-unit-8c4d944d.js → snk-data-unit-3ab57d1a.js} +4 -3
- package/dist/esm/snk-data-unit.entry.js +1 -1
- package/dist/esm/snk-detail-view.entry.js +14 -12
- package/dist/esm/snk-entity-list.entry.js +0 -4
- package/dist/esm/snk-filter-bar.entry.js +14 -17
- package/dist/esm/snk-filter-detail.entry.js +2 -16
- package/dist/esm/snk-filter-modal-item.entry.js +6 -20
- package/dist/esm/snk-form-config.entry.js +7 -18
- package/dist/esm/snk-form-view.entry.js +6 -1
- package/dist/esm/snk-form.entry.js +12 -8
- package/dist/esm/snk-grid-config.entry.js +5 -6
- package/dist/esm/snk-grid.entry.js +17 -20
- package/dist/esm/{snk-guides-viewer-c47cd45e.js → snk-guides-viewer-cc709b5f.js} +17 -7
- package/dist/esm/snk-guides-viewer.entry.js +8 -8
- package/dist/esm/snk-personalized-filter.entry.js +13 -16
- package/dist/esm/snk-print-selector.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +10 -62
- package/dist/esm/snk-taskbar.entry.js +2 -1
- package/dist/sankhyablocks/p-01739b21.entry.js +1 -0
- package/dist/sankhyablocks/{p-e7e54737.entry.js → p-03bb1aea.entry.js} +1 -1
- package/dist/sankhyablocks/p-05dbc70e.entry.js +1 -0
- package/dist/sankhyablocks/{p-0a4c753d.js → p-14eac6fe.js} +1 -1
- package/dist/sankhyablocks/{p-2ac9c585.js → p-2d333d22.js} +1 -1
- package/dist/sankhyablocks/p-41e897f1.js +56 -0
- package/dist/sankhyablocks/p-48a40939.js +1 -0
- package/dist/sankhyablocks/p-611aa624.entry.js +1 -0
- package/dist/sankhyablocks/p-66bb8c20.entry.js +1 -0
- package/dist/sankhyablocks/p-688dcb4c.js +1 -0
- package/dist/sankhyablocks/p-6f154396.entry.js +1 -0
- package/dist/sankhyablocks/p-787071a8.js +1 -0
- package/dist/sankhyablocks/p-8481bb59.entry.js +1 -0
- package/dist/sankhyablocks/p-8818d8f6.entry.js +1 -0
- package/dist/sankhyablocks/p-93f6ca04.entry.js +1 -0
- package/dist/sankhyablocks/p-9a270401.entry.js +1 -0
- package/dist/sankhyablocks/p-9e7d65a4.js +1 -0
- package/dist/sankhyablocks/p-a52a6c9d.js +26 -0
- package/dist/sankhyablocks/p-b6003974.entry.js +1 -0
- package/dist/sankhyablocks/p-c555075c.entry.js +1 -0
- package/dist/sankhyablocks/{p-e5845241.entry.js → p-d13c00b6.entry.js} +1 -1
- package/dist/sankhyablocks/p-d4f9ee17.entry.js +1 -0
- package/dist/sankhyablocks/p-d53a9169.entry.js +1 -0
- package/dist/sankhyablocks/p-d7638f45.entry.js +11 -0
- package/dist/sankhyablocks/p-e086cc2a.entry.js +1 -0
- package/dist/sankhyablocks/p-e64f3e17.entry.js +1 -0
- package/dist/sankhyablocks/p-ed41b38c.js +1 -0
- package/dist/sankhyablocks/p-ed705cbb.entry.js +1 -0
- package/dist/sankhyablocks/p-efc10705.entry.js +1 -0
- package/dist/sankhyablocks/p-f74fe358.js +1 -0
- package/dist/sankhyablocks/{p-df8621b4.js → p-f8e6b97e.js} +1 -1
- package/dist/sankhyablocks/p-f91e0c5d.entry.js +1 -0
- package/dist/sankhyablocks/p-fa523d6b.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/actions/index.d.ts +2 -1
- package/dist/types/components/snk-application/snk-application.d.ts +8 -13
- package/dist/types/components/snk-configurator/snk-configurator.d.ts +4 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +5 -0
- package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +8 -0
- package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +5 -0
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +9 -2
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +4 -0
- package/dist/types/components/snk-entity-list/snk-entity-list.d.ts +0 -4
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +0 -3
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +1 -1
- package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +5 -4
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
- package/dist/types/components/snk-form/SnkFormConfigManager.d.ts +5 -4
- package/dist/types/components/snk-form/snk-form.d.ts +9 -1
- package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +0 -2
- package/dist/types/components/snk-grid/snk-grid.d.ts +5 -1
- package/dist/types/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.d.ts +4 -0
- package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +5 -1
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +4 -0
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +4 -0
- package/dist/types/components.d.ts +125 -21
- package/dist/types/lib/configs/ConfigStorage.d.ts +11 -13
- package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +0 -7
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -1
- package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +0 -1
- package/dist/types/lib/index.d.ts +11 -0
- package/dist/types/lib/resourceid/ResourceIDUtils.d.ts +3 -0
- package/dist/types/lib/utils/urlutils.d.ts +14 -0
- package/package.json +2 -2
- package/dist/cjs/filter-bar-config-fetcher-2b8ed9d0.js +0 -155
- package/dist/cjs/resource-fetcher-c0332609.js +0 -68
- package/dist/components/filter-bar-config-fetcher.js +0 -153
- package/dist/components/resource-fetcher.js +0 -66
- package/dist/esm/filter-bar-config-fetcher-06e02851.js +0 -153
- package/dist/esm/resource-fetcher-768d5556.js +0 -66
- package/dist/sankhyablocks/p-0ed0fc02.entry.js +0 -1
- package/dist/sankhyablocks/p-216f081a.entry.js +0 -1
- package/dist/sankhyablocks/p-22c6fe1a.entry.js +0 -1
- package/dist/sankhyablocks/p-34a1357a.entry.js +0 -1
- package/dist/sankhyablocks/p-4721c3db.js +0 -1
- package/dist/sankhyablocks/p-564efc43.js +0 -1
- package/dist/sankhyablocks/p-6759adae.entry.js +0 -1
- package/dist/sankhyablocks/p-7b8b8ae9.js +0 -10
- package/dist/sankhyablocks/p-7e285d6c.entry.js +0 -11
- package/dist/sankhyablocks/p-815a42c0.entry.js +0 -1
- package/dist/sankhyablocks/p-8a41172a.entry.js +0 -1
- package/dist/sankhyablocks/p-8f8184ff.js +0 -56
- package/dist/sankhyablocks/p-976e56e9.js +0 -1
- package/dist/sankhyablocks/p-98f9d076.js +0 -17
- package/dist/sankhyablocks/p-bc735728.entry.js +0 -1
- package/dist/sankhyablocks/p-be684b38.entry.js +0 -1
- package/dist/sankhyablocks/p-befbc9ee.entry.js +0 -1
- package/dist/sankhyablocks/p-c0f656af.entry.js +0 -1
- package/dist/sankhyablocks/p-c32b9d7c.entry.js +0 -1
- package/dist/sankhyablocks/p-c57bd935.entry.js +0 -1
- package/dist/sankhyablocks/p-c6380ea2.entry.js +0 -1
- package/dist/sankhyablocks/p-cfd7da4a.entry.js +0 -1
- package/dist/sankhyablocks/p-d1b89765.js +0 -1
- package/dist/sankhyablocks/p-de69b4b0.entry.js +0 -1
- package/dist/sankhyablocks/p-e28129aa.entry.js +0 -1
- package/dist/sankhyablocks/p-f31bfdee.entry.js +0 -1
- package/dist/sankhyablocks/p-f88c45bf.js +0 -1
- package/dist/sankhyablocks/p-fe010e54.entry.js +0 -1
@@ -23,6 +23,7 @@ export class SnkGuidesViewer {
|
|
23
23
|
this.messagesBuilder = undefined;
|
24
24
|
this.canEdit = true;
|
25
25
|
this.presentationMode = undefined;
|
26
|
+
this.resourceID = undefined;
|
26
27
|
this._breadcrumbItems = [];
|
27
28
|
this._guides = undefined;
|
28
29
|
this._formEditorConfigManager = undefined;
|
@@ -224,7 +225,7 @@ export class SnkGuidesViewer {
|
|
224
225
|
else {
|
225
226
|
detailBranch = this.selectedGuide;
|
226
227
|
}
|
227
|
-
content = this.wrapDetail(levels, h("snk-detail-view", { ref: (ref) => this._currentDetail = ref, dataUnitName: this.getDataUnitName(levels, childEntityName), onSnkDetailGuidesChange: (evt) => this.updateGuide(evt.detail), entityName: childEntityName, selectedForm: formName, branchGuide: detailBranch, guideItemPath: this._breadcrumbItems, key: `detail${detailId}`, canEdit: this.canEdit, onSnkSwitchGuide: evt => this._guideNavigator.selectGuide(evt.detail) }));
|
228
|
+
content = this.wrapDetail(levels, h("snk-detail-view", { ref: (ref) => this._currentDetail = ref, dataUnitName: this.getDataUnitName(levels, childEntityName), onSnkDetailGuidesChange: (evt) => this.updateGuide(evt.detail), entityName: childEntityName, selectedForm: formName, branchGuide: detailBranch, guideItemPath: this._breadcrumbItems, key: `detail${detailId}`, canEdit: this.canEdit, onSnkSwitchGuide: evt => this._guideNavigator.selectGuide(evt.detail), resourceID: this.resourceID }));
|
228
229
|
}
|
229
230
|
else {
|
230
231
|
const cardId = this.selectedGuide.id;
|
@@ -273,7 +274,10 @@ export class SnkGuidesViewer {
|
|
273
274
|
return this.selectedGuide === undefined || '__main' === ((_a = this.selectedGuide) === null || _a === void 0 ? void 0 : _a.id);
|
274
275
|
}
|
275
276
|
componentWillLoad() {
|
276
|
-
|
277
|
+
if (this.resourceID == undefined) {
|
278
|
+
throw new Error("Erro interno: resourceID não informado");
|
279
|
+
}
|
280
|
+
this._configManager = new SnkFormConfigManager(this.configName, this.resourceID, config => this.masterFormConfig = config);
|
277
281
|
this._configManager.loadConfig();
|
278
282
|
}
|
279
283
|
componentDidRender() {
|
@@ -292,7 +296,7 @@ export class SnkGuidesViewer {
|
|
292
296
|
}
|
293
297
|
buildTaskBar() {
|
294
298
|
var _a;
|
295
|
-
return h("div", { class: `ez-col ez-flex-item--align-center ez-col--sd-6 ez-col--tb-6 ${this.presentationMode != PresentationMode.SECONDARY ? 'ez-align--right' : 'ez-padding-bottom--medium'}` }, h("snk-taskbar", { key: "guideViewerTaskbar", "data-element-id": "guideViewer", configName: this.configName, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, actionsList: this.actionsList, messagesBuilder: this.messagesBuilder, presentationMode: this.presentationMode, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-taskbar-owner": "master", dataUnit: this.dataUnit }));
|
299
|
+
return h("div", { class: `ez-col ez-flex-item--align-center ez-col--sd-6 ez-col--tb-6 ${this.presentationMode != PresentationMode.SECONDARY ? 'ez-align--right' : 'ez-padding-bottom--medium'}` }, h("snk-taskbar", { key: "guideViewerTaskbar", "data-element-id": "guideViewer", configName: this.configName, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, actionsList: this.actionsList, messagesBuilder: this.messagesBuilder, presentationMode: this.presentationMode, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-taskbar-owner": "master", dataUnit: this.dataUnit, resourceID: this.resourceID }));
|
296
300
|
}
|
297
301
|
render() {
|
298
302
|
var _a, _b;
|
@@ -311,7 +315,7 @@ export class SnkGuidesViewer {
|
|
311
315
|
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 ?
|
312
316
|
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) })
|
313
317
|
:
|
314
|
-
h("div", null), h("div", { class: "snk-guides-viewer__detail-container" }, SnkGuidesViewer.buildFixedForms(this.masterFormConfig, this._masterFormMetadata, (_b = this.selectedGuide) === null || _b === void 0 ? void 0 : _b.id, this.dataUnit, this.recordsValidator), this.getContent())), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this.getConfigViewMode(), onConfigSelected: (evt) => this.changeConfigViewMode(evt.detail), messagesBuilder: this.messagesBuilder, onOpenConfig: (evt) => this.openConfig(evt.detail) })));
|
318
|
+
h("div", null), h("div", { class: "snk-guides-viewer__detail-container" }, SnkGuidesViewer.buildFixedForms(this.masterFormConfig, this._masterFormMetadata, (_b = this.selectedGuide) === null || _b === void 0 ? void 0 : _b.id, this.dataUnit, this.recordsValidator), this.getContent())), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this.getConfigViewMode(), onConfigSelected: (evt) => this.changeConfigViewMode(evt.detail), messagesBuilder: this.messagesBuilder, onOpenConfig: (evt) => this.openConfig(evt.detail), resourceID: this.resourceID })));
|
315
319
|
}
|
316
320
|
static get is() { return "snk-guides-viewer"; }
|
317
321
|
static get encapsulation() { return "scoped"; }
|
@@ -327,30 +331,6 @@ export class SnkGuidesViewer {
|
|
327
331
|
}
|
328
332
|
static get properties() {
|
329
333
|
return {
|
330
|
-
"_guideBuilders": {
|
331
|
-
"type": "unknown",
|
332
|
-
"mutable": false,
|
333
|
-
"complexType": {
|
334
|
-
"original": "Map<string, GuideBuilder>",
|
335
|
-
"resolved": "Map<string, GuideBuilder>",
|
336
|
-
"references": {
|
337
|
-
"Map": {
|
338
|
-
"location": "global"
|
339
|
-
},
|
340
|
-
"GuideBuilder": {
|
341
|
-
"location": "import",
|
342
|
-
"path": "./GuideBuilder"
|
343
|
-
}
|
344
|
-
}
|
345
|
-
},
|
346
|
-
"required": false,
|
347
|
-
"optional": false,
|
348
|
-
"docs": {
|
349
|
-
"tags": [],
|
350
|
-
"text": ""
|
351
|
-
},
|
352
|
-
"defaultValue": "new Map()"
|
353
|
-
},
|
354
334
|
"dataUnit": {
|
355
335
|
"type": "unknown",
|
356
336
|
"mutable": false,
|
@@ -587,6 +567,23 @@ export class SnkGuidesViewer {
|
|
587
567
|
},
|
588
568
|
"attribute": "presentation-mode",
|
589
569
|
"reflect": false
|
570
|
+
},
|
571
|
+
"resourceID": {
|
572
|
+
"type": "string",
|
573
|
+
"mutable": false,
|
574
|
+
"complexType": {
|
575
|
+
"original": "string",
|
576
|
+
"resolved": "string",
|
577
|
+
"references": {}
|
578
|
+
},
|
579
|
+
"required": false,
|
580
|
+
"optional": false,
|
581
|
+
"docs": {
|
582
|
+
"tags": [],
|
583
|
+
"text": "Identificador de recursos como configura\u00E7\u00F5es e acesso."
|
584
|
+
},
|
585
|
+
"attribute": "resource-i-d",
|
586
|
+
"reflect": false
|
590
587
|
}
|
591
588
|
};
|
592
589
|
}
|
@@ -629,6 +626,28 @@ export class SnkGuidesViewer {
|
|
629
626
|
"resolved": "string",
|
630
627
|
"references": {}
|
631
628
|
}
|
629
|
+
}, {
|
630
|
+
"method": "formItemsReady",
|
631
|
+
"name": "formItemsReady",
|
632
|
+
"bubbles": true,
|
633
|
+
"cancelable": true,
|
634
|
+
"composed": true,
|
635
|
+
"docs": {
|
636
|
+
"tags": [],
|
637
|
+
"text": "Respons\u00E1vel por notificar quando ocorrer a renderiza\u00E7\u00E3o de itens do formul\u00E1rio."
|
638
|
+
},
|
639
|
+
"complexType": {
|
640
|
+
"original": "Array<HTMLElement>",
|
641
|
+
"resolved": "HTMLElement[]",
|
642
|
+
"references": {
|
643
|
+
"Array": {
|
644
|
+
"location": "global"
|
645
|
+
},
|
646
|
+
"HTMLElement": {
|
647
|
+
"location": "global"
|
648
|
+
}
|
649
|
+
}
|
650
|
+
}
|
632
651
|
}];
|
633
652
|
}
|
634
653
|
static get methods() {
|
@@ -61,6 +61,7 @@ export class SnkDataUnit {
|
|
61
61
|
this.useCancelConfirm = true;
|
62
62
|
this.ignoreSaveMessage = undefined;
|
63
63
|
this.configName = undefined;
|
64
|
+
this.resourceID = undefined;
|
64
65
|
}
|
65
66
|
observePageSize() {
|
66
67
|
if (this.dataUnit) {
|
@@ -180,7 +181,6 @@ export class SnkDataUnit {
|
|
180
181
|
return resolve(action);
|
181
182
|
if (this._openedAlert)
|
182
183
|
return this.dataUnit.cancelEdition();
|
183
|
-
;
|
184
184
|
this._openedAlert = true;
|
185
185
|
this.dataUnit.cancelEdition();
|
186
186
|
ApplicationUtils.alert(this.getMessage("snkDataUnit.forbidden"), this.getMessage("snkDataUnit.forbiddenUpdate")).then(() => {
|
@@ -325,10 +325,10 @@ export class SnkDataUnit {
|
|
325
325
|
const cacheName = this.dataUnitName ? this.dataUnitName : this.entityName;
|
326
326
|
if (this._parentSnkDataUnit) {
|
327
327
|
this._parentDataUnit = await ((_a = this._parentSnkDataUnit) === null || _a === void 0 ? void 0 : _a.getDataUnit());
|
328
|
-
return await this._application.getDataUnit(this.entityName, cacheName, this._parentDataUnit, this.configName);
|
328
|
+
return await this._application.getDataUnit(this.entityName, cacheName, this._parentDataUnit, this.configName, this.resourceID);
|
329
329
|
}
|
330
330
|
else {
|
331
|
-
return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName);
|
331
|
+
return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName, this.resourceID);
|
332
332
|
}
|
333
333
|
}
|
334
334
|
async loadDataUnit() {
|
@@ -387,7 +387,7 @@ export class SnkDataUnit {
|
|
387
387
|
//---------------------------------------------
|
388
388
|
componentWillLoad() {
|
389
389
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
390
|
-
this._application.getAllAccess().then(access => this._permissions = access);
|
390
|
+
this._application.getAllAccess(this.resourceID).then(access => this._permissions = access);
|
391
391
|
this._parentSnkDataUnit = this.getParentSnkDataUnit();
|
392
392
|
if (this.messagesBuilder == undefined) {
|
393
393
|
this.messagesBuilder = new SnkMessageBuilder(this.entityName);
|
@@ -624,6 +624,23 @@ export class SnkDataUnit {
|
|
624
624
|
},
|
625
625
|
"attribute": "config-name",
|
626
626
|
"reflect": false
|
627
|
+
},
|
628
|
+
"resourceID": {
|
629
|
+
"type": "string",
|
630
|
+
"mutable": false,
|
631
|
+
"complexType": {
|
632
|
+
"original": "string",
|
633
|
+
"resolved": "string",
|
634
|
+
"references": {}
|
635
|
+
},
|
636
|
+
"required": false,
|
637
|
+
"optional": false,
|
638
|
+
"docs": {
|
639
|
+
"tags": [],
|
640
|
+
"text": "Identificador de recursos como configura\u00E7\u00F5es e acesso."
|
641
|
+
},
|
642
|
+
"attribute": "resource-i-d",
|
643
|
+
"reflect": false
|
627
644
|
}
|
628
645
|
};
|
629
646
|
}
|
@@ -10,7 +10,6 @@ export class SnkEntityList {
|
|
10
10
|
}
|
11
11
|
async reloadList() {
|
12
12
|
this.loadListSource();
|
13
|
-
this.saveConfig.emit(this.config);
|
14
13
|
}
|
15
14
|
observeConfig() {
|
16
15
|
var _a, _b;
|
@@ -26,7 +25,6 @@ export class SnkEntityList {
|
|
26
25
|
}
|
27
26
|
});
|
28
27
|
this.config = ObjectUtils.copy(configCopy);
|
29
|
-
this.saveConfig.emit(this.config);
|
30
28
|
this.valueChanged.emit((_b = this.config) === null || _b === void 0 ? void 0 : _b.value);
|
31
29
|
}
|
32
30
|
loadListSource() {
|
@@ -83,7 +81,6 @@ export class SnkEntityList {
|
|
83
81
|
}
|
84
82
|
] });
|
85
83
|
this.loadListSource();
|
86
|
-
this.saveConfig.emit(this.config);
|
87
84
|
this.valueChanged.emit((_d = this.config) === null || _d === void 0 ? void 0 : _d.value);
|
88
85
|
}
|
89
86
|
}
|
@@ -206,26 +203,6 @@ export class SnkEntityList {
|
|
206
203
|
}
|
207
204
|
}
|
208
205
|
}
|
209
|
-
}, {
|
210
|
-
"method": "saveConfig",
|
211
|
-
"name": "saveConfig",
|
212
|
-
"bubbles": true,
|
213
|
-
"cancelable": true,
|
214
|
-
"composed": true,
|
215
|
-
"docs": {
|
216
|
-
"tags": [],
|
217
|
-
"text": "Evento emitido ao realizar alguma a\u00E7\u00E3o que altera os dados do config.value permitindo salvar estas informa\u00E7\u00F5es"
|
218
|
-
},
|
219
|
-
"complexType": {
|
220
|
-
"original": "SnkFilterItemConfig",
|
221
|
-
"resolved": "SnkFilterItemConfig",
|
222
|
-
"references": {
|
223
|
-
"SnkFilterItemConfig": {
|
224
|
-
"location": "import",
|
225
|
-
"path": "../snk-filter-bar/filter-item/snk-filter-item"
|
226
|
-
}
|
227
|
-
}
|
228
|
-
}
|
229
206
|
}];
|
230
207
|
}
|
231
208
|
static get methods() {
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import { h, Host, Fragment } from '@stencil/core';
|
2
2
|
import { ApplicationUtils } from "@sankhyalabs/ezui/dist/collection/utils";
|
3
3
|
import FilterItemType from './filter-item-type.enum';
|
4
|
-
import { ElementIDUtils,
|
5
|
-
import FilterBarConfigFetcher from '../../../lib/http/data-fetcher/fetchers/filter-bar-config-fetcher';
|
4
|
+
import { ElementIDUtils, ObjectUtils } from '@sankhyalabs/core';
|
6
5
|
import { EPresentationMode } from './editors/enum/presentationMode';
|
7
6
|
import { PersonalizedFilterUtils } from '../../snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils';
|
8
7
|
export class SnkFilterDetail {
|
@@ -24,7 +23,6 @@ export class SnkFilterDetail {
|
|
24
23
|
}
|
25
24
|
componentDidLoad() {
|
26
25
|
if (this._element) {
|
27
|
-
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
28
26
|
ElementIDUtils.addIDInfo(this._element);
|
29
27
|
const dataElementIdDoFilterItem = this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
|
30
28
|
this._idContentEditor = `${dataElementIdDoFilterItem}_${this.config.id}`;
|
@@ -142,20 +140,12 @@ export class SnkFilterDetail {
|
|
142
140
|
this.config = ObjectUtils.copy(configCopy);
|
143
141
|
}
|
144
142
|
}
|
145
|
-
saveConfig(newConfig) {
|
146
|
-
var _a;
|
147
|
-
(_a = this._application) === null || _a === void 0 ? void 0 : _a.getResourceID().then(resourceId => {
|
148
|
-
const fetcher = new FilterBarConfigFetcher();
|
149
|
-
fetcher.saveEntityListConfig(newConfig, resourceId, this._application.configName);
|
150
|
-
this.config = newConfig;
|
151
|
-
});
|
152
|
-
}
|
153
143
|
componentWillLoad() {
|
154
144
|
this.originalConfig = ObjectUtils.copy(this.config);
|
155
145
|
}
|
156
146
|
render() {
|
157
147
|
const { tag: CustomElement, props } = this.getContentEditor();
|
158
|
-
return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(CustomElement, Object.assign({ maxHeightList: '240px', ref: ref => this._editor = ref, value: this.config.value, config: this.config, onKeyDown: evt => this.onKeyDonwListener(evt), "data-element-id": this._idContentEditor, getMessage: this.getMessage,
|
148
|
+
return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(CustomElement, Object.assign({ maxHeightList: '240px', ref: ref => this._editor = ref, value: this.config.value, config: this.config, onKeyDown: evt => this.onKeyDonwListener(evt), "data-element-id": this._idContentEditor, getMessage: this.getMessage, rightListSlotBuilder: item => this.buildRightSlot(item) }, props)), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, this.filterCanBeCleared() && (h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" })), h("ez-button", { ref: ref => this._applyButton = ref, label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
|
159
149
|
}
|
160
150
|
static get is() { return "snk-filter-detail"; }
|
161
151
|
static get properties() {
|
@@ -244,7 +244,7 @@ export class SnkFilterModal {
|
|
244
244
|
"optional": false,
|
245
245
|
"docs": {
|
246
246
|
"tags": [],
|
247
|
-
"text": "Nome da
|
247
|
+
"text": "Nome da configura\u00E7\u00E3o. Serve para distinguir v\u00E1rias inst\u00E2ncias do componente."
|
248
248
|
},
|
249
249
|
"attribute": "config-name",
|
250
250
|
"reflect": false
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { h, Host } from '@stencil/core';
|
2
|
-
import {
|
2
|
+
import { ElementIDUtils, ObjectUtils } from '@sankhyalabs/core';
|
3
3
|
import FilterItemType from '../../filter-item/filter-item-type.enum';
|
4
4
|
import { EPresentationMode } from '../../filter-item/editors/enum/presentationMode';
|
5
5
|
import { ConfigStorage } from '../../../../lib/configs/ConfigStorage';
|
@@ -8,14 +8,13 @@ export class SnkFilterModalItem {
|
|
8
8
|
constructor() {
|
9
9
|
this.filterItem = undefined;
|
10
10
|
this.configName = undefined;
|
11
|
+
this.resourceID = undefined;
|
11
12
|
}
|
12
13
|
observeFilterItem(newValue) {
|
13
14
|
var _a, _b;
|
14
15
|
this._editor && (this._editor["config"] = newValue);
|
15
16
|
(_b = (_a = this._editor) === null || _a === void 0 ? void 0 : _a['reloadList']) === null || _b === void 0 ? void 0 : _b.call(_a);
|
16
17
|
this.filterChange.emit(newValue);
|
17
|
-
//isso faz o filtro salvar o estado precocemente. Caso: Botão limpar filtro dispara dezenas de vezes
|
18
|
-
//this.saveConfig();
|
19
18
|
}
|
20
19
|
getContentEditorConfig() {
|
21
20
|
const props = { presentationMode: EPresentationMode.MODAL };
|
@@ -57,11 +56,10 @@ export class SnkFilterModalItem {
|
|
57
56
|
else {
|
58
57
|
this.filterItem = Object.assign(Object.assign({}, this.filterItem), { value: this.filterItem.type === FilterItemType.SEARCH ? data : newValue, visible: this.isVisible(newValue) });
|
59
58
|
}
|
60
|
-
this.saveConfig();
|
61
59
|
}
|
62
60
|
handleDeleteFilter(filter, filterItemType) {
|
63
61
|
if (filterItemType === FilterItemType.PERSONALIZED) {
|
64
|
-
ConfigStorage.removePersonalizedFilter(filter, this.configName);
|
62
|
+
ConfigStorage.removePersonalizedFilter(filter, this.resourceID, this.configName);
|
65
63
|
}
|
66
64
|
}
|
67
65
|
componentDidLoad() {
|
@@ -69,7 +67,6 @@ export class SnkFilterModalItem {
|
|
69
67
|
ElementIDUtils.addIDInfo(this._element);
|
70
68
|
const dataElementIdDoFilterItem = this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
|
71
69
|
this._idContentEditor = `${dataElementIdDoFilterItem}_${this.filterItem.id}`;
|
72
|
-
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
73
70
|
}
|
74
71
|
}
|
75
72
|
buildRightSlot(item) {
|
@@ -86,15 +83,6 @@ export class SnkFilterModalItem {
|
|
86
83
|
const { CUSTOM_FILTER, OTHER_FILTERS } = FilterType;
|
87
84
|
return ![CUSTOM_FILTER, OTHER_FILTERS].includes(this.filterItem.filterType) && this.filterItem.type !== FilterItemType.BINARY_SELECT;
|
88
85
|
}
|
89
|
-
saveConfig() {
|
90
|
-
//Precisa ser rediscutido... não podemos salvar configuração por conta própria. Não temos autonomia pra isso.
|
91
|
-
/*if(FilterItemType.MULTI_LIST !== this.filterItem.type) return;
|
92
|
-
|
93
|
-
this._application?.getResourceID().then(resourceId => {
|
94
|
-
const fetcher = new FilterBarConfigFetcher();
|
95
|
-
fetcher.saveEntityListConfig(this.filterItem, resourceId, this._application.configName);
|
96
|
-
});*/
|
97
|
-
}
|
98
86
|
render() {
|
99
87
|
const { tag: ContentEditor, props } = this.getContentEditorConfig();
|
100
88
|
return (h(Host, null, h("div", { class: "ez-flex ez-flex--column grow" }, this.canShowDetailModal() && (h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-title ez-title--small ez-title--primary grow" }, this.filterItem.detailModal))), h(ContentEditor, Object.assign({ ref: ref => this._editor = ref, config: this.filterItem, value: this.filterItem.value, onValueChanged: (event) => this.updateFilterValue(event.detail), "data-element-id": this._idContentEditor }, props)))));
|
@@ -144,10 +132,27 @@ export class SnkFilterModalItem {
|
|
144
132
|
"optional": false,
|
145
133
|
"docs": {
|
146
134
|
"tags": [],
|
147
|
-
"text": "Nome da
|
135
|
+
"text": "Nome da configura\u00E7\u00E3o. Serve para distinguir v\u00E1rias inst\u00E2ncias do componente."
|
148
136
|
},
|
149
137
|
"attribute": "config-name",
|
150
138
|
"reflect": false
|
139
|
+
},
|
140
|
+
"resourceID": {
|
141
|
+
"type": "string",
|
142
|
+
"mutable": false,
|
143
|
+
"complexType": {
|
144
|
+
"original": "string",
|
145
|
+
"resolved": "string",
|
146
|
+
"references": {}
|
147
|
+
},
|
148
|
+
"required": false,
|
149
|
+
"optional": false,
|
150
|
+
"docs": {
|
151
|
+
"tags": [],
|
152
|
+
"text": "Identificador de recursos como configura\u00E7\u00F5es e acesso."
|
153
|
+
},
|
154
|
+
"attribute": "resource-i-d",
|
155
|
+
"reflect": false
|
151
156
|
}
|
152
157
|
};
|
153
158
|
}
|
@@ -28,6 +28,7 @@ export class SnkFilterBar {
|
|
28
28
|
};
|
29
29
|
this.dataUnit = undefined;
|
30
30
|
this.configName = undefined;
|
31
|
+
this.resourceID = undefined;
|
31
32
|
this.filterConfig = undefined;
|
32
33
|
this.messagesBuilder = undefined;
|
33
34
|
this.allowDefault = undefined;
|
@@ -103,11 +104,11 @@ export class SnkFilterBar {
|
|
103
104
|
return;
|
104
105
|
}
|
105
106
|
this._loadingPending = false;
|
106
|
-
this.dataUnit.loadData();
|
107
|
+
this.dataUnit.loadData(undefined, undefined, true);
|
107
108
|
}
|
108
109
|
if (this._configUpdated) {
|
109
110
|
this._configUpdated = false;
|
110
|
-
ConfigStorage.saveFilterBarConfig(this.filterConfig, this.configName);
|
111
|
+
ConfigStorage.saveFilterBarConfig(this.filterConfig, this.configName, this.resourceID);
|
111
112
|
}
|
112
113
|
}
|
113
114
|
/**
|
@@ -223,15 +224,13 @@ export class SnkFilterBar {
|
|
223
224
|
}
|
224
225
|
loadConfigFromStorage() {
|
225
226
|
return new Promise(accept => {
|
226
|
-
ConfigStorage.
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
|
234
|
-
});
|
227
|
+
ConfigStorage.loadFilterBarConfig(this.configName, this.resourceID, { contextURI: this.dataUnit.name })
|
228
|
+
.then((filters) => {
|
229
|
+
accept();
|
230
|
+
this.filterConfig = filters.map(item => this.normalizeItem(item));
|
231
|
+
})
|
232
|
+
.catch(reason => {
|
233
|
+
throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
|
235
234
|
});
|
236
235
|
});
|
237
236
|
}
|
@@ -316,7 +315,7 @@ export class SnkFilterBar {
|
|
316
315
|
return undefined;
|
317
316
|
}
|
318
317
|
if (this.showPersonalizedFilter) {
|
319
|
-
return h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, onEzCancel: () => this.hidePersonalizedFilter(), entityUri: this.dataUnit.name, configName: this.configName });
|
318
|
+
return h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, onEzCancel: () => this.hidePersonalizedFilter(), entityUri: this.dataUnit.name, configName: this.configName, resourceID: this.resourceID });
|
320
319
|
}
|
321
320
|
return (h(Host, null, h("ez-scroller", { class: "snk-filter-bar__scroller", direction: EzScrollDirection.HORIZONTAL, activeShadow: true, locked: this.scrollerLocked }, h("section", { class: "snk-filter-bar__filter-item-container" }, this.getFilterItems())), h("ez-button", { class: "ez-padding-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }, h("ez-icon", { slot: "leftIcon", iconName: "plus", class: "ez-padding-right--small" }))));
|
322
321
|
}
|
@@ -371,6 +370,23 @@ export class SnkFilterBar {
|
|
371
370
|
"attribute": "config-name",
|
372
371
|
"reflect": false
|
373
372
|
},
|
373
|
+
"resourceID": {
|
374
|
+
"type": "string",
|
375
|
+
"mutable": false,
|
376
|
+
"complexType": {
|
377
|
+
"original": "string",
|
378
|
+
"resolved": "string",
|
379
|
+
"references": {}
|
380
|
+
},
|
381
|
+
"required": false,
|
382
|
+
"optional": false,
|
383
|
+
"docs": {
|
384
|
+
"tags": [],
|
385
|
+
"text": "Identificador de recursos como configura\u00E7\u00F5es e acesso."
|
386
|
+
},
|
387
|
+
"attribute": "resource-i-d",
|
388
|
+
"reflect": false
|
389
|
+
},
|
374
390
|
"filterConfig": {
|
375
391
|
"type": "unknown",
|
376
392
|
"mutable": true,
|
@@ -2,29 +2,27 @@ import { ConfigStorage } from "../../lib/configs/ConfigStorage";
|
|
2
2
|
import { ObjectUtils } from "@sankhyalabs/core";
|
3
3
|
import { FormConfigFetcher } from "../../lib/http/data-fetcher/fetchers/form-config-fetcher";
|
4
4
|
export class SnkFormConfigManager {
|
5
|
-
constructor(configName, onConfigChange) {
|
5
|
+
constructor(configName, resourceID, onConfigChange) {
|
6
|
+
this._resourceID = resourceID;
|
6
7
|
this._configName = configName;
|
7
8
|
this._onConfigChange = onConfigChange;
|
8
9
|
}
|
9
10
|
async loadConfig() {
|
10
11
|
return new Promise(resolve => {
|
11
|
-
ConfigStorage.
|
12
|
-
.then((
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
.catch((error) => {
|
19
|
-
console.warn(error);
|
20
|
-
});
|
12
|
+
ConfigStorage.loadFormConfig(this._configName, this._resourceID)
|
13
|
+
.then((config) => {
|
14
|
+
this.setConfig(config);
|
15
|
+
resolve(config);
|
16
|
+
})
|
17
|
+
.catch((error) => {
|
18
|
+
console.warn(error);
|
21
19
|
});
|
22
20
|
});
|
23
21
|
}
|
24
22
|
saveConfig(config) {
|
25
23
|
const configToSave = ObjectUtils.copy(config);
|
26
24
|
return new Promise(accept => {
|
27
|
-
ConfigStorage.saveFormConfig(config, this._configName)
|
25
|
+
ConfigStorage.saveFormConfig(config, this._configName, this._resourceID)
|
28
26
|
.then((response) => {
|
29
27
|
this.setConfig(Object.assign(Object.assign({}, configToSave), response));
|
30
28
|
accept(Object.assign(Object.assign({}, configToSave), response));
|
@@ -39,7 +37,7 @@ export class SnkFormConfigManager {
|
|
39
37
|
cardsState.set(cardId, propertyChanged === "fixed" ?
|
40
38
|
this.updateFixSequence(Object.assign(Object.assign({}, currentConfig), { fixed: cardConfig.fixed }), cardsState)
|
41
39
|
: Object.assign(Object.assign({}, currentConfig), { [propertyChanged]: cardConfig[propertyChanged] }));
|
42
|
-
ConfigStorage.saveCardState(cardsState, this._configName)
|
40
|
+
ConfigStorage.saveCardState(cardsState, this._configName, this._resourceID)
|
43
41
|
.then(savedCardConfig => {
|
44
42
|
this._config = Object.assign(Object.assign({}, this._config), { cardsState });
|
45
43
|
resolve(savedCardConfig);
|
@@ -115,17 +113,17 @@ export class SnkFormConfigManager {
|
|
115
113
|
}
|
116
114
|
return this._formConfigFetcher;
|
117
115
|
}
|
118
|
-
async fetchUserAvailableConfigs(
|
116
|
+
async fetchUserAvailableConfigs() {
|
119
117
|
if (this._configName != undefined) {
|
120
118
|
//FIXME: Precisamos preparar o backend para retornar as configurações disponíveis para details;
|
121
119
|
return Promise.resolve(undefined);
|
122
120
|
}
|
123
|
-
return this.getFormConfigFetcher().fetchUserAvailableConfigs(this._configName,
|
121
|
+
return this.getFormConfigFetcher().fetchUserAvailableConfigs(this._configName, this._resourceID);
|
124
122
|
}
|
125
|
-
async fetchLegacyConfig(
|
126
|
-
return this.getFormConfigFetcher().fetchLegacyConfig(this._configName,
|
123
|
+
async fetchLegacyConfig() {
|
124
|
+
return this.getFormConfigFetcher().fetchLegacyConfig(this._configName, this._resourceID);
|
127
125
|
}
|
128
|
-
async fetchDefaultConfig(
|
129
|
-
return this.getFormConfigFetcher().fetchDefaultConfig(this._configName,
|
126
|
+
async fetchDefaultConfig() {
|
127
|
+
return this.getFormConfigFetcher().fetchDefaultConfig(this._configName, this._resourceID);
|
130
128
|
}
|
131
129
|
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { ElementIDUtils } from '@sankhyalabs/core';
|
2
2
|
import { h } from '@stencil/core';
|
3
3
|
import { SnkFormConfigManager } from './SnkFormConfigManager';
|
4
|
+
import ResourceIDUtils from '../../lib/resourceid/ResourceIDUtils';
|
4
5
|
export class SnkForm {
|
5
6
|
constructor() {
|
6
7
|
this._dataUnit = undefined;
|
@@ -10,6 +11,7 @@ export class SnkForm {
|
|
10
11
|
this.configName = undefined;
|
11
12
|
this.recordsValidator = undefined;
|
12
13
|
this.messagesBuilder = undefined;
|
14
|
+
this.resourceID = undefined;
|
13
15
|
}
|
14
16
|
/**
|
15
17
|
* Exibe a janela de configurações do formulário.
|
@@ -30,7 +32,7 @@ export class SnkForm {
|
|
30
32
|
const dataInfo = { dataUnit: this._dataUnit };
|
31
33
|
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
32
34
|
}
|
33
|
-
componentWillLoad() {
|
35
|
+
async componentWillLoad() {
|
34
36
|
let parent = this._element.parentElement;
|
35
37
|
while (parent) {
|
36
38
|
if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
|
@@ -52,7 +54,10 @@ export class SnkForm {
|
|
52
54
|
}
|
53
55
|
parent = parent.parentElement;
|
54
56
|
}
|
55
|
-
this.
|
57
|
+
if (this.resourceID == undefined) {
|
58
|
+
this.resourceID = await ResourceIDUtils.getResourceID();
|
59
|
+
}
|
60
|
+
this._configManager = new SnkFormConfigManager(this.configName, this.resourceID);
|
56
61
|
this._configManager.loadConfig();
|
57
62
|
}
|
58
63
|
render() {
|
@@ -132,6 +137,23 @@ export class SnkForm {
|
|
132
137
|
"tags": [],
|
133
138
|
"text": "Respons\u00E1vel por flexibilizar e padronizar o uso de mensagens nos blocos de constru\u00E7\u00E3o."
|
134
139
|
}
|
140
|
+
},
|
141
|
+
"resourceID": {
|
142
|
+
"type": "string",
|
143
|
+
"mutable": false,
|
144
|
+
"complexType": {
|
145
|
+
"original": "string",
|
146
|
+
"resolved": "string",
|
147
|
+
"references": {}
|
148
|
+
},
|
149
|
+
"required": false,
|
150
|
+
"optional": false,
|
151
|
+
"docs": {
|
152
|
+
"tags": [],
|
153
|
+
"text": "Identificador de recursos como configura\u00E7\u00F5es e acesso."
|
154
|
+
},
|
155
|
+
"attribute": "resource-i-d",
|
156
|
+
"reflect": false
|
135
157
|
}
|
136
158
|
};
|
137
159
|
}
|
@@ -174,6 +196,28 @@ export class SnkForm {
|
|
174
196
|
"resolved": "string",
|
175
197
|
"references": {}
|
176
198
|
}
|
199
|
+
}, {
|
200
|
+
"method": "formItemsReady",
|
201
|
+
"name": "formItemsReady",
|
202
|
+
"bubbles": true,
|
203
|
+
"cancelable": true,
|
204
|
+
"composed": true,
|
205
|
+
"docs": {
|
206
|
+
"tags": [],
|
207
|
+
"text": "Respons\u00E1vel por notificar quando ocorrer a renderiza\u00E7\u00E3o de itens do formul\u00E1rio."
|
208
|
+
},
|
209
|
+
"complexType": {
|
210
|
+
"original": "Array<HTMLElement>",
|
211
|
+
"resolved": "HTMLElement[]",
|
212
|
+
"references": {
|
213
|
+
"Array": {
|
214
|
+
"location": "global"
|
215
|
+
},
|
216
|
+
"HTMLElement": {
|
217
|
+
"location": "global"
|
218
|
+
}
|
219
|
+
}
|
220
|
+
}
|
177
221
|
}];
|
178
222
|
}
|
179
223
|
static get methods() {
|