@sankhyalabs/sankhyablocks 8.2.0-dev.1 → 8.2.0
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-12397f18.js → ConfigStorage-e9d7fa82.js} +51 -163
- package/dist/cjs/{DataFetcher-f2da1f79.js → DataFetcher-39b63a1e.js} +29 -67
- package/dist/cjs/{SnkFormConfigManager-13f79e37.js → SnkFormConfigManager-2f8eccd9.js} +21 -19
- package/dist/cjs/{dataunit-fetcher-e72068c1.js → dataunit-fetcher-15a7cc88.js} +1 -1
- package/dist/cjs/filter-bar-config-fetcher-24548cec.js +155 -0
- package/dist/cjs/{form-config-fetcher-5d62ab62.js → form-config-fetcher-ab3ce222.js} +3 -66
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-8c363096.js → pesquisa-fetcher-96c042aa.js} +1 -1
- package/dist/cjs/resource-fetcher-64102551.js +68 -0
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button.cjs.entry.js +11 -18
- package/dist/cjs/snk-application.cjs.entry.js +73 -51
- package/dist/cjs/snk-attach.cjs.entry.js +13 -7
- package/dist/cjs/snk-configurator.cjs.entry.js +1 -2
- package/dist/cjs/snk-crud.cjs.entry.js +9 -28
- package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
- package/dist/cjs/{snk-data-unit-80a00ae4.js → snk-data-unit-d5109a08.js} +6 -8
- package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
- package/dist/cjs/snk-detail-view.cjs.entry.js +25 -18
- package/dist/cjs/snk-entity-list.cjs.entry.js +4 -0
- package/dist/cjs/snk-filter-bar.cjs.entry.js +17 -14
- package/dist/cjs/snk-filter-detail.cjs.entry.js +15 -1
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +19 -5
- package/dist/cjs/snk-form-config.cjs.entry.js +17 -6
- package/dist/cjs/snk-form-view.cjs.entry.js +1 -6
- package/dist/cjs/snk-form.cjs.entry.js +8 -12
- package/dist/cjs/snk-grid-config.cjs.entry.js +6 -5
- package/dist/cjs/snk-grid.cjs.entry.js +20 -20
- package/dist/cjs/{snk-guides-viewer-a7cd6fda.js → snk-guides-viewer-8c9693aa.js} +9 -18
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -8
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +16 -13
- package/dist/cjs/snk-print-selector.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +80 -22
- package/dist/cjs/snk-taskbar.cjs.entry.js +1 -2
- package/dist/collection/components/snk-actions-button/actions/index.js +4 -3
- package/dist/collection/components/snk-actions-button/snk-actions-button.js +4 -8
- package/dist/collection/components/snk-application/snk-application.js +65 -60
- package/dist/collection/components/snk-configurator/snk-configurator.js +1 -19
- package/dist/collection/components/snk-crud/snk-crud.js +8 -63
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +15 -65
- package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +1 -27
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +30 -66
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +7 -42
- package/dist/collection/components/snk-entity-list/snk-entity-list.js +23 -0
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +12 -2
- 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 +16 -21
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +12 -28
- package/dist/collection/components/snk-form/SnkFormConfigManager.js +19 -17
- package/dist/collection/components/snk-form/snk-form.js +2 -46
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +15 -5
- package/dist/collection/components/snk-grid/snk-grid.js +16 -110
- package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js +1 -19
- package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +12 -28
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +9 -43
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +1 -19
- package/dist/collection/lib/configs/ConfigStorage.js +44 -33
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +59 -2
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +29 -38
- package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +24 -0
- package/dist/collection/lib/index.js +0 -10
- package/dist/collection/lib/utils/urlutils.js +0 -29
- package/dist/components/ConfigStorage.js +48 -161
- package/dist/components/DataFetcher.js +29 -67
- package/dist/components/SnkFormConfigManager.js +19 -17
- package/dist/components/filter-bar-config-fetcher.js +153 -0
- package/dist/components/form-config-fetcher.js +2 -64
- package/dist/components/resource-fetcher.js +66 -0
- package/dist/components/snk-actions-button2.js +9 -23
- package/dist/components/snk-application2.js +154 -132
- package/dist/components/snk-attach2.js +8 -1
- package/dist/components/snk-configurator2.js +1 -3
- package/dist/components/snk-crud.js +7 -29
- package/dist/components/snk-data-unit2.js +6 -10
- package/dist/components/snk-detail-view2.js +23 -28
- package/dist/components/snk-entity-list.js +4 -0
- package/dist/components/snk-filter-bar2.js +12 -12
- package/dist/components/snk-filter-detail2.js +12 -2
- package/dist/components/snk-filter-modal-item2.js +16 -5
- package/dist/components/snk-form-config2.js +15 -5
- package/dist/components/snk-form-view2.js +1 -6
- package/dist/components/snk-form.js +2 -9
- package/dist/components/snk-grid-config2.js +2 -4
- package/dist/components/snk-grid2.js +16 -23
- package/dist/components/snk-personalized-filter2.js +11 -11
- package/dist/components/snk-simple-crud2.js +69 -12
- package/dist/components/snk-taskbar2.js +1 -3
- package/dist/esm/{ConfigStorage-932ab366.js → ConfigStorage-1090289a.js} +49 -162
- package/dist/esm/{DataFetcher-7e18aa30.js → DataFetcher-a4ed43e7.js} +29 -67
- package/dist/esm/{SnkFormConfigManager-bb9afc3f.js → SnkFormConfigManager-de537eca.js} +21 -19
- package/dist/esm/{dataunit-fetcher-91a4eb82.js → dataunit-fetcher-8d0bfa4a.js} +1 -1
- package/dist/esm/filter-bar-config-fetcher-2417b8cf.js +153 -0
- package/dist/esm/{form-config-fetcher-aaaa79a6.js → form-config-fetcher-4065db9a.js} +3 -65
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-56b30fb4.js → pesquisa-fetcher-7460b876.js} +1 -1
- package/dist/esm/resource-fetcher-45a70066.js +66 -0
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button.entry.js +11 -18
- package/dist/esm/snk-application.entry.js +71 -49
- package/dist/esm/snk-attach.entry.js +9 -3
- package/dist/esm/snk-configurator.entry.js +1 -2
- package/dist/esm/snk-crud.entry.js +9 -28
- package/dist/esm/snk-data-exporter.entry.js +2 -2
- package/dist/esm/{snk-data-unit-3ab57d1a.js → snk-data-unit-3a0bbfcb.js} +6 -8
- package/dist/esm/snk-data-unit.entry.js +1 -1
- package/dist/esm/snk-detail-view.entry.js +25 -18
- package/dist/esm/snk-entity-list.entry.js +4 -0
- package/dist/esm/snk-filter-bar.entry.js +17 -14
- package/dist/esm/snk-filter-detail.entry.js +16 -2
- package/dist/esm/snk-filter-modal-item.entry.js +20 -6
- package/dist/esm/snk-form-config.entry.js +18 -7
- package/dist/esm/snk-form-view.entry.js +1 -6
- package/dist/esm/snk-form.entry.js +8 -12
- package/dist/esm/snk-grid-config.entry.js +6 -5
- package/dist/esm/snk-grid.entry.js +20 -20
- package/dist/esm/{snk-guides-viewer-cc709b5f.js → snk-guides-viewer-a6d39c18.js} +9 -18
- package/dist/esm/snk-guides-viewer.entry.js +8 -8
- package/dist/esm/snk-personalized-filter.entry.js +16 -13
- package/dist/esm/snk-print-selector.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +71 -13
- package/dist/esm/snk-taskbar.entry.js +1 -2
- package/dist/sankhyablocks/p-0fb83448.js +1 -0
- package/dist/sankhyablocks/p-15aba6fb.entry.js +11 -0
- package/dist/sankhyablocks/p-216f081a.entry.js +1 -0
- package/dist/sankhyablocks/p-21e7c08e.entry.js +1 -0
- package/dist/sankhyablocks/p-2861d44f.entry.js +1 -0
- package/dist/sankhyablocks/p-2d883fe9.entry.js +1 -0
- package/dist/sankhyablocks/{p-d13c00b6.entry.js → p-3d6f91c2.entry.js} +1 -1
- package/dist/sankhyablocks/{p-f8e6b97e.js → p-44e66c8d.js} +1 -1
- package/dist/sankhyablocks/p-4514fc6a.entry.js +1 -0
- package/dist/sankhyablocks/p-4f4cd005.entry.js +1 -0
- package/dist/sankhyablocks/p-50c13cc8.entry.js +1 -0
- package/dist/sankhyablocks/p-52c6b2e7.js +1 -0
- package/dist/sankhyablocks/p-5994af77.js +56 -0
- package/dist/sankhyablocks/p-5df17074.js +1 -0
- package/dist/sankhyablocks/p-6bb904bb.entry.js +1 -0
- package/dist/sankhyablocks/p-6f0795c8.entry.js +1 -0
- package/dist/sankhyablocks/p-7588f006.entry.js +1 -0
- package/dist/sankhyablocks/p-847e6c20.js +17 -0
- package/dist/sankhyablocks/p-9471cbc9.entry.js +1 -0
- package/dist/sankhyablocks/{p-14eac6fe.js → p-9d18017a.js} +1 -1
- package/dist/sankhyablocks/p-9edad923.js +1 -0
- package/dist/sankhyablocks/p-a42dd503.entry.js +1 -0
- package/dist/sankhyablocks/{p-2d333d22.js → p-b978da60.js} +1 -1
- package/dist/sankhyablocks/p-befbc9ee.entry.js +1 -0
- package/dist/sankhyablocks/p-c6380ea2.entry.js +1 -0
- package/dist/sankhyablocks/{p-03bb1aea.entry.js → p-c6feb995.entry.js} +1 -1
- package/dist/sankhyablocks/p-c945318c.entry.js +1 -0
- package/dist/sankhyablocks/p-ccbfb1cf.entry.js +1 -0
- package/dist/sankhyablocks/p-d7c7a289.entry.js +1 -0
- package/dist/sankhyablocks/p-de69b4b0.entry.js +1 -0
- package/dist/sankhyablocks/p-f3b7b69e.js +10 -0
- package/dist/sankhyablocks/p-f7eded3a.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/actions/index.d.ts +1 -2
- package/dist/types/components/snk-application/snk-application.d.ts +13 -8
- package/dist/types/components/snk-configurator/snk-configurator.d.ts +0 -4
- package/dist/types/components/snk-crud/snk-crud.d.ts +0 -10
- package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +0 -13
- package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +0 -5
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +2 -13
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +0 -8
- package/dist/types/components/snk-entity-list/snk-entity-list.d.ts +4 -0
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +3 -0
- 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 +4 -5
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +0 -4
- package/dist/types/components/snk-form/SnkFormConfigManager.d.ts +4 -5
- package/dist/types/components/snk-form/snk-form.d.ts +1 -9
- package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +2 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +1 -18
- package/dist/types/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.d.ts +0 -4
- package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +1 -5
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +0 -8
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +0 -4
- package/dist/types/components.d.ts +21 -189
- package/dist/types/lib/configs/ConfigStorage.d.ts +13 -11
- package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +7 -0
- 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 +1 -0
- package/dist/types/lib/index.d.ts +0 -11
- package/dist/types/lib/utils/urlutils.d.ts +0 -14
- package/package.json +2 -2
- package/dist/cjs/ISave-d68ce3cd.js +0 -8
- package/dist/cjs/ResourceIDUtils-5ff86aa7.js +0 -12
- package/dist/cjs/auth-fetcher-319a4cb2.js +0 -34
- package/dist/collection/lib/resourceid/ResourceIDUtils.js +0 -7
- package/dist/components/ResourceIDUtils.js +0 -10
- package/dist/components/auth-fetcher.js +0 -32
- package/dist/esm/ISave-4412b20c.js +0 -8
- package/dist/esm/ResourceIDUtils-a114189a.js +0 -10
- package/dist/esm/auth-fetcher-6d9664b7.js +0 -32
- package/dist/sankhyablocks/p-01739b21.entry.js +0 -1
- package/dist/sankhyablocks/p-05dbc70e.entry.js +0 -1
- package/dist/sankhyablocks/p-41e897f1.js +0 -56
- package/dist/sankhyablocks/p-48a40939.js +0 -1
- package/dist/sankhyablocks/p-611aa624.entry.js +0 -1
- package/dist/sankhyablocks/p-66bb8c20.entry.js +0 -1
- package/dist/sankhyablocks/p-688dcb4c.js +0 -1
- package/dist/sankhyablocks/p-6f154396.entry.js +0 -1
- package/dist/sankhyablocks/p-787071a8.js +0 -1
- package/dist/sankhyablocks/p-8481bb59.entry.js +0 -1
- package/dist/sankhyablocks/p-8818d8f6.entry.js +0 -1
- package/dist/sankhyablocks/p-93f6ca04.entry.js +0 -1
- package/dist/sankhyablocks/p-9a270401.entry.js +0 -1
- package/dist/sankhyablocks/p-9e7d65a4.js +0 -1
- package/dist/sankhyablocks/p-a52a6c9d.js +0 -26
- package/dist/sankhyablocks/p-b6003974.entry.js +0 -1
- package/dist/sankhyablocks/p-c555075c.entry.js +0 -1
- package/dist/sankhyablocks/p-d4f9ee17.entry.js +0 -1
- package/dist/sankhyablocks/p-d53a9169.entry.js +0 -1
- package/dist/sankhyablocks/p-d7638f45.entry.js +0 -11
- package/dist/sankhyablocks/p-e086cc2a.entry.js +0 -1
- package/dist/sankhyablocks/p-e64f3e17.entry.js +0 -1
- package/dist/sankhyablocks/p-ed41b38c.js +0 -1
- package/dist/sankhyablocks/p-ed705cbb.entry.js +0 -1
- package/dist/sankhyablocks/p-efc10705.entry.js +0 -1
- package/dist/sankhyablocks/p-f74fe358.js +0 -1
- package/dist/sankhyablocks/p-f91e0c5d.entry.js +0 -1
- package/dist/sankhyablocks/p-fa523d6b.entry.js +0 -1
- package/dist/types/lib/resourceid/ResourceIDUtils.d.ts +0 -3
@@ -8,8 +8,10 @@ import TaskbarProcessor from '../snk-taskbar/processor/taskbar-processor';
|
|
8
8
|
import store from "../../lib/store";
|
9
9
|
import SnkMultiSelectionListDataSource from './filtercolumn/SnkMultiSelectionListDataSource';
|
10
10
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
11
|
+
// import { IRecordValidator } from '@sankhyalabs/ezui/dist/types/utils/form/interfaces';
|
11
12
|
export class SnkGrid {
|
12
13
|
constructor() {
|
14
|
+
this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
|
13
15
|
this._topTaskbarProcessor = new TaskbarProcessor({
|
14
16
|
"snkGridTopTaskbar.regular": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
|
15
17
|
"snkGridTopTaskbar.regular.secondary": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
|
@@ -26,9 +28,7 @@ export class SnkGrid {
|
|
26
28
|
this._dataState = undefined;
|
27
29
|
this._gridConfig = undefined;
|
28
30
|
this._popUpGridConfig = false;
|
29
|
-
this.columnFilterDataSource = new SnkMultiSelectionListDataSource();
|
30
31
|
this.configName = undefined;
|
31
|
-
this.resourceID = undefined;
|
32
32
|
this.selectionToastConfig = undefined;
|
33
33
|
this.actionsList = undefined;
|
34
34
|
this.isDetail = undefined;
|
@@ -37,9 +37,6 @@ export class SnkGrid {
|
|
37
37
|
this.multipleSelection = undefined;
|
38
38
|
this.presentationMode = PresentationMode.PRIMARY;
|
39
39
|
this.messagesBuilder = undefined;
|
40
|
-
this.useEnterLikeTab = false;
|
41
|
-
this.recordsValidator = undefined;
|
42
|
-
this.canEdit = true;
|
43
40
|
}
|
44
41
|
/**
|
45
42
|
* Exibe a janela de configurações da grade.
|
@@ -87,17 +84,20 @@ export class SnkGrid {
|
|
87
84
|
this._gridConfig = config;
|
88
85
|
}
|
89
86
|
loadConfig() {
|
90
|
-
ConfigStorage.
|
91
|
-
.then((
|
92
|
-
this.
|
93
|
-
|
94
|
-
|
95
|
-
|
87
|
+
ConfigStorage.get()
|
88
|
+
.then((instance) => {
|
89
|
+
instance.loadGridConfig(this.configName)
|
90
|
+
.then((config) => {
|
91
|
+
this.setGridConfig(config);
|
92
|
+
})
|
93
|
+
.catch((error) => {
|
94
|
+
console.warn(error);
|
95
|
+
});
|
96
96
|
});
|
97
97
|
}
|
98
98
|
gridConfigChangeHandler(evt) {
|
99
99
|
const config = evt.detail;
|
100
|
-
ConfigStorage.saveGridConfig(config, this.configName
|
100
|
+
ConfigStorage.saveGridConfig(config, this.configName);
|
101
101
|
evt.stopPropagation();
|
102
102
|
}
|
103
103
|
modalConfigChangeHandler(evt) {
|
@@ -210,11 +210,10 @@ export class SnkGrid {
|
|
210
210
|
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
211
211
|
}
|
212
212
|
finshLoading() {
|
213
|
-
var _a, _b;
|
214
213
|
this._dataUnitLoadLockerResolver = this._dataUnit.addLoadingLocker();
|
215
214
|
this.addElementID();
|
216
|
-
|
217
|
-
|
215
|
+
this._multiSelectionListDataSource.setApplication(this._application);
|
216
|
+
this._multiSelectionListDataSource.setDataUnit(this._dataUnit);
|
218
217
|
}
|
219
218
|
componentWillLoad() {
|
220
219
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
@@ -305,8 +304,8 @@ export class SnkGrid {
|
|
305
304
|
if (!this._dataUnit) {
|
306
305
|
return undefined;
|
307
306
|
}
|
308
|
-
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder
|
309
|
-
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()
|
307
|
+
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder }), ((_b = (_a = this._snkFilterBar) === null || _a === void 0 ? void 0 : _a.filterConfig) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
|
308
|
+
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() })), 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: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, onComponentReady: () => this.onEzGridReady(), columnfilterDataSource: this._multiSelectionListDataSource, selectionToastConfig: this.selectionToastConfig }, h("snk-taskbar", { dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList })), 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), application: this._application, selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig() }))));
|
310
309
|
}
|
311
310
|
static get is() { return "snk-grid"; }
|
312
311
|
static get encapsulation() { return "scoped"; }
|
@@ -322,26 +321,6 @@ export class SnkGrid {
|
|
322
321
|
}
|
323
322
|
static get properties() {
|
324
323
|
return {
|
325
|
-
"columnFilterDataSource": {
|
326
|
-
"type": "unknown",
|
327
|
-
"mutable": true,
|
328
|
-
"complexType": {
|
329
|
-
"original": "SnkMultiSelectionListDataSource",
|
330
|
-
"resolved": "SnkMultiSelectionListDataSource",
|
331
|
-
"references": {
|
332
|
-
"SnkMultiSelectionListDataSource": {
|
333
|
-
"location": "global"
|
334
|
-
}
|
335
|
-
}
|
336
|
-
},
|
337
|
-
"required": false,
|
338
|
-
"optional": false,
|
339
|
-
"docs": {
|
340
|
-
"tags": [],
|
341
|
-
"text": ""
|
342
|
-
},
|
343
|
-
"defaultValue": "new SnkMultiSelectionListDataSource()"
|
344
|
-
},
|
345
324
|
"configName": {
|
346
325
|
"type": "string",
|
347
326
|
"mutable": false,
|
@@ -359,23 +338,6 @@ export class SnkGrid {
|
|
359
338
|
"attribute": "config-name",
|
360
339
|
"reflect": false
|
361
340
|
},
|
362
|
-
"resourceID": {
|
363
|
-
"type": "string",
|
364
|
-
"mutable": false,
|
365
|
-
"complexType": {
|
366
|
-
"original": "string",
|
367
|
-
"resolved": "string",
|
368
|
-
"references": {}
|
369
|
-
},
|
370
|
-
"required": false,
|
371
|
-
"optional": false,
|
372
|
-
"docs": {
|
373
|
-
"tags": [],
|
374
|
-
"text": "Identificador de recursos como configura\u00E7\u00F5es e acesso."
|
375
|
-
},
|
376
|
-
"attribute": "resource-i-d",
|
377
|
-
"reflect": false
|
378
|
-
},
|
379
341
|
"selectionToastConfig": {
|
380
342
|
"type": "unknown",
|
381
343
|
"mutable": false,
|
@@ -539,62 +501,6 @@ export class SnkGrid {
|
|
539
501
|
"tags": [],
|
540
502
|
"text": "Respons\u00E1vel por flexibilizar e padronizar o uso de mensagens nos blocos de constru\u00E7\u00E3o."
|
541
503
|
}
|
542
|
-
},
|
543
|
-
"useEnterLikeTab": {
|
544
|
-
"type": "boolean",
|
545
|
-
"mutable": false,
|
546
|
-
"complexType": {
|
547
|
-
"original": "boolean",
|
548
|
-
"resolved": "boolean",
|
549
|
-
"references": {}
|
550
|
-
},
|
551
|
-
"required": false,
|
552
|
-
"optional": false,
|
553
|
-
"docs": {
|
554
|
-
"tags": [],
|
555
|
-
"text": "Quando verdadeiro, o ENTER far\u00E1 a navega\u00E7\u00E3o como se fosse a tecla TAB na grade."
|
556
|
-
},
|
557
|
-
"attribute": "use-enter-like-tab",
|
558
|
-
"reflect": false,
|
559
|
-
"defaultValue": "false"
|
560
|
-
},
|
561
|
-
"recordsValidator": {
|
562
|
-
"type": "unknown",
|
563
|
-
"mutable": false,
|
564
|
-
"complexType": {
|
565
|
-
"original": "IRecordValidator",
|
566
|
-
"resolved": "IRecordValidator",
|
567
|
-
"references": {
|
568
|
-
"IRecordValidator": {
|
569
|
-
"location": "import",
|
570
|
-
"path": "@sankhyalabs/ezui/dist/types/utils/form/interfaces"
|
571
|
-
}
|
572
|
-
}
|
573
|
-
},
|
574
|
-
"required": false,
|
575
|
-
"optional": false,
|
576
|
-
"docs": {
|
577
|
-
"tags": [],
|
578
|
-
"text": "Validador respons\u00E1vel por checar a integridade das informa\u00E7\u00F5es do registro."
|
579
|
-
}
|
580
|
-
},
|
581
|
-
"canEdit": {
|
582
|
-
"type": "boolean",
|
583
|
-
"mutable": false,
|
584
|
-
"complexType": {
|
585
|
-
"original": "boolean",
|
586
|
-
"resolved": "boolean",
|
587
|
-
"references": {}
|
588
|
-
},
|
589
|
-
"required": false,
|
590
|
-
"optional": false,
|
591
|
-
"docs": {
|
592
|
-
"tags": [],
|
593
|
-
"text": "Define se a edi\u00E7\u00E3o est\u00E1 habilitada na grid."
|
594
|
-
},
|
595
|
-
"attribute": "can-edit",
|
596
|
-
"reflect": false,
|
597
|
-
"defaultValue": "true"
|
598
504
|
}
|
599
505
|
};
|
600
506
|
}
|
package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js
CHANGED
@@ -17,7 +17,6 @@ export class SnkGridConfig {
|
|
17
17
|
this.columns = undefined;
|
18
18
|
this.config = undefined;
|
19
19
|
this.configName = undefined;
|
20
|
-
this.resourceID = undefined;
|
21
20
|
}
|
22
21
|
/* Creation Methods */
|
23
22
|
/**
|
@@ -241,7 +240,7 @@ export class SnkGridConfig {
|
|
241
240
|
}
|
242
241
|
}
|
243
242
|
_newConfig.columns = _newColumnConfigList;
|
244
|
-
ConfigStorage.saveGridConfig(_newConfig, this.configName
|
243
|
+
ConfigStorage.saveGridConfig(_newConfig, this.configName)
|
245
244
|
.then((savedConfig) => {
|
246
245
|
this.configChange.emit(savedConfig);
|
247
246
|
this._orderList.clearHistory();
|
@@ -572,23 +571,6 @@ export class SnkGridConfig {
|
|
572
571
|
},
|
573
572
|
"attribute": "config-name",
|
574
573
|
"reflect": false
|
575
|
-
},
|
576
|
-
"resourceID": {
|
577
|
-
"type": "string",
|
578
|
-
"mutable": false,
|
579
|
-
"complexType": {
|
580
|
-
"original": "string",
|
581
|
-
"resolved": "string",
|
582
|
-
"references": {}
|
583
|
-
},
|
584
|
-
"required": false,
|
585
|
-
"optional": false,
|
586
|
-
"docs": {
|
587
|
-
"tags": [],
|
588
|
-
"text": "Nome usado para salvar/recuperar a configura\u00E7\u00E3o."
|
589
|
-
},
|
590
|
-
"attribute": "resource-i-d",
|
591
|
-
"reflect": false
|
592
574
|
}
|
593
575
|
};
|
594
576
|
}
|
@@ -30,7 +30,6 @@ export class SnkPersonalizedFilter {
|
|
30
30
|
this.entityUri = undefined;
|
31
31
|
this.filterId = undefined;
|
32
32
|
this.configName = undefined;
|
33
|
-
this.resourceID = undefined;
|
34
33
|
}
|
35
34
|
/*
|
36
35
|
* Cria um novo filtro se não houver nenhum filtro existente
|
@@ -67,15 +66,17 @@ export class SnkPersonalizedFilter {
|
|
67
66
|
this._filterAssistent = ObjectUtils.copy(newPersonalizedFilter);
|
68
67
|
}
|
69
68
|
loadFilter(newValue, oldValue) {
|
70
|
-
if (newValue == null || oldValue == newValue
|
69
|
+
if (newValue == null || oldValue == newValue) {
|
71
70
|
return;
|
72
71
|
}
|
73
|
-
ConfigStorage.
|
74
|
-
.
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
72
|
+
ConfigStorage.get().then((_instance) => {
|
73
|
+
ConfigStorage.loadPersonalizedFilter(newValue, this.configName)
|
74
|
+
.then((resp) => {
|
75
|
+
const personalizedFilter = this.addLabelToItems(resp);
|
76
|
+
this._filterAssistent = personalizedFilter;
|
77
|
+
this._originalFilterAssistent = ObjectUtils.copy(personalizedFilter);
|
78
|
+
this._filterAssistentMode = this._filterAssistent.hasOwnProperty("assistent") && this._filterAssistent.assistent != undefined;
|
79
|
+
});
|
79
80
|
});
|
80
81
|
}
|
81
82
|
componentWillLoad() {
|
@@ -100,7 +101,7 @@ export class SnkPersonalizedFilter {
|
|
100
101
|
return this._application.messagesBuilder.getMessage(key, params);
|
101
102
|
}
|
102
103
|
saveFilter() {
|
103
|
-
ConfigStorage.savePersonalizedFilter(this._filterAssistent, this.
|
104
|
+
ConfigStorage.savePersonalizedFilter(this._filterAssistent, this.configName).then((personalizedFilter) => {
|
104
105
|
this._elButtonSave.enabled = false;
|
105
106
|
const messageToken = !!this._filterAssistent.id ? 'confirmEdit' : 'confirmSave';
|
106
107
|
ApplicationUtils.info(this.getMessage(`snkPersonalizedFilter.${messageToken}.title`), { iconName: "check" });
|
@@ -111,7 +112,7 @@ export class SnkPersonalizedFilter {
|
|
111
112
|
});
|
112
113
|
}
|
113
114
|
removeFilter() {
|
114
|
-
ConfigStorage.removePersonalizedFilter(this._filterAssistent, this.
|
115
|
+
ConfigStorage.removePersonalizedFilter(this._filterAssistent, this.configName);
|
115
116
|
}
|
116
117
|
hasChangesToSave() {
|
117
118
|
return JSON.stringify(this._filterAssistent) === JSON.stringify(this._originalFilterAssistent);
|
@@ -360,27 +361,10 @@ export class SnkPersonalizedFilter {
|
|
360
361
|
"optional": false,
|
361
362
|
"docs": {
|
362
363
|
"tags": [],
|
363
|
-
"text": "Nome da
|
364
|
+
"text": "Nome da config para buscar no resourceId"
|
364
365
|
},
|
365
366
|
"attribute": "config-name",
|
366
367
|
"reflect": false
|
367
|
-
},
|
368
|
-
"resourceID": {
|
369
|
-
"type": "string",
|
370
|
-
"mutable": false,
|
371
|
-
"complexType": {
|
372
|
-
"original": "string",
|
373
|
-
"resolved": "string",
|
374
|
-
"references": {}
|
375
|
-
},
|
376
|
-
"required": false,
|
377
|
-
"optional": false,
|
378
|
-
"docs": {
|
379
|
-
"tags": [],
|
380
|
-
"text": "Nome da configura\u00E7\u00E3o. Serve para distinguir v\u00E1rias inst\u00E2ncias do componente."
|
381
|
-
},
|
382
|
-
"attribute": "resource-i-d",
|
383
|
-
"reflect": false
|
384
368
|
}
|
385
369
|
};
|
386
370
|
}
|
@@ -11,6 +11,11 @@ export class SnkSimpleCrud {
|
|
11
11
|
this.REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER"];
|
12
12
|
this.REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER"];
|
13
13
|
this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
|
14
|
+
// /**
|
15
|
+
// * Quando verdadeiro, o ENTER fará a navegação como se fosse a tecla TAB na grade.
|
16
|
+
// */
|
17
|
+
// @Prop()
|
18
|
+
// useEnterLikeTab: boolean = false;
|
14
19
|
this._taskbarProcessor = new TaskbarProcessor({
|
15
20
|
"snkSimpleCrudTaskbar.form_regular": this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(TaskbarElement.GRID_MODE),
|
16
21
|
"snkSimpleCrudTaskbar.grid_regular": this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(TaskbarElement.FORM_MODE),
|
@@ -29,7 +34,6 @@ export class SnkSimpleCrud {
|
|
29
34
|
this.useCancelConfirm = true;
|
30
35
|
this.taskbarManager = undefined;
|
31
36
|
this.messagesBuilder = undefined;
|
32
|
-
this.useEnterLikeTab = false;
|
33
37
|
}
|
34
38
|
resolveInMemoryBtns(taskbarButtons) {
|
35
39
|
const newTaskBarConfig = [...taskbarButtons];
|
@@ -174,9 +178,11 @@ export class SnkSimpleCrud {
|
|
174
178
|
}
|
175
179
|
render() {
|
176
180
|
var _a;
|
177
|
-
return (h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail),
|
181
|
+
return (h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail),
|
182
|
+
// ignoreSaveMessage={this._currentViewMode === VIEW_MODE.GRID}
|
183
|
+
onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-flex ez-box ez-box--shadow" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium ez-margin-bottom--large", 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, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }), h("ez-view-stack", { class: "ez-flex ez-flex--column", ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), columnfilterDataSource: this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
178
184
|
? undefined
|
179
|
-
: this._multiSelectionListDataSource
|
185
|
+
: this._multiSelectionListDataSource }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { dataUnit: this.dataUnit, config: this.formConfig }))))));
|
180
186
|
}
|
181
187
|
static get is() { return "snk-simple-crud"; }
|
182
188
|
static get encapsulation() { return "scoped"; }
|
@@ -369,24 +375,6 @@ export class SnkSimpleCrud {
|
|
369
375
|
"tags": [],
|
370
376
|
"text": "Respons\u00E1vel por flexibilizar e padronizar o uso de mensagens nos blocos de constru\u00E7\u00E3o."
|
371
377
|
}
|
372
|
-
},
|
373
|
-
"useEnterLikeTab": {
|
374
|
-
"type": "boolean",
|
375
|
-
"mutable": false,
|
376
|
-
"complexType": {
|
377
|
-
"original": "boolean",
|
378
|
-
"resolved": "boolean",
|
379
|
-
"references": {}
|
380
|
-
},
|
381
|
-
"required": false,
|
382
|
-
"optional": false,
|
383
|
-
"docs": {
|
384
|
-
"tags": [],
|
385
|
-
"text": "Quando verdadeiro, o ENTER far\u00E1 a navega\u00E7\u00E3o como se fosse a tecla TAB na grade."
|
386
|
-
},
|
387
|
-
"attribute": "use-enter-like-tab",
|
388
|
-
"reflect": false,
|
389
|
-
"defaultValue": "false"
|
390
378
|
}
|
391
379
|
};
|
392
380
|
}
|
@@ -452,28 +440,6 @@ export class SnkSimpleCrud {
|
|
452
440
|
"resolved": "string",
|
453
441
|
"references": {}
|
454
442
|
}
|
455
|
-
}, {
|
456
|
-
"method": "formItemsReady",
|
457
|
-
"name": "formItemsReady",
|
458
|
-
"bubbles": true,
|
459
|
-
"cancelable": true,
|
460
|
-
"composed": true,
|
461
|
-
"docs": {
|
462
|
-
"tags": [],
|
463
|
-
"text": "Respons\u00E1vel por notificar quando ocorrer a renderiza\u00E7\u00E3o de itens do formul\u00E1rio."
|
464
|
-
},
|
465
|
-
"complexType": {
|
466
|
-
"original": "Array<HTMLElement>",
|
467
|
-
"resolved": "HTMLElement[]",
|
468
|
-
"references": {
|
469
|
-
"Array": {
|
470
|
-
"location": "global"
|
471
|
-
},
|
472
|
-
"HTMLElement": {
|
473
|
-
"location": "global"
|
474
|
-
}
|
475
|
-
}
|
476
|
-
}
|
477
443
|
}];
|
478
444
|
}
|
479
445
|
static get methods() {
|
@@ -23,7 +23,6 @@ export class SnkTaskbar {
|
|
23
23
|
};
|
24
24
|
this._permissions = undefined;
|
25
25
|
this.configName = undefined;
|
26
|
-
this.resourceID = undefined;
|
27
26
|
this.buttons = undefined;
|
28
27
|
this.customButtons = undefined;
|
29
28
|
this.actionsList = undefined;
|
@@ -165,7 +164,7 @@ export class SnkTaskbar {
|
|
165
164
|
componentWillLoad() {
|
166
165
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
167
166
|
if (this._application) {
|
168
|
-
this._application.getAllAccess(
|
167
|
+
this._application.getAllAccess().then(access => this._permissions = access);
|
169
168
|
}
|
170
169
|
else {
|
171
170
|
this._permissions = {};
|
@@ -233,23 +232,6 @@ export class SnkTaskbar {
|
|
233
232
|
"attribute": "config-name",
|
234
233
|
"reflect": false
|
235
234
|
},
|
236
|
-
"resourceID": {
|
237
|
-
"type": "string",
|
238
|
-
"mutable": false,
|
239
|
-
"complexType": {
|
240
|
-
"original": "string",
|
241
|
-
"resolved": "string",
|
242
|
-
"references": {}
|
243
|
-
},
|
244
|
-
"required": false,
|
245
|
-
"optional": false,
|
246
|
-
"docs": {
|
247
|
-
"tags": [],
|
248
|
-
"text": "Identificador de recursos como configura\u00E7\u00F5es e acesso."
|
249
|
-
},
|
250
|
-
"attribute": "resource-i-d",
|
251
|
-
"reflect": false
|
252
|
-
},
|
253
235
|
"buttons": {
|
254
236
|
"type": "string",
|
255
237
|
"mutable": false,
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { ApplicationContext } from "@sankhyalabs/core";
|
1
2
|
import { FormConfigFetcher } from "../http/data-fetcher/fetchers/form-config-fetcher";
|
2
3
|
import GridConfigFetcher from "../http/data-fetcher/fetchers/grid-config-fetcher";
|
3
4
|
import FilterBarConfigFetcher from "../http/data-fetcher/fetchers/filter-bar-config-fetcher";
|
@@ -8,73 +9,83 @@ const CONFIG_SOURCE = {
|
|
8
9
|
filterBar: "filterBar"
|
9
10
|
};
|
10
11
|
export class ConfigStorage {
|
11
|
-
static
|
12
|
-
ConfigStorage.
|
13
|
-
|
12
|
+
static async get() {
|
13
|
+
if (!ConfigStorage.instance) {
|
14
|
+
const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
15
|
+
if (application != undefined) {
|
16
|
+
const configName = application.configName;
|
17
|
+
const resourceID = await application.getResourceID();
|
18
|
+
ConfigStorage.instance = new ConfigStorage();
|
19
|
+
ConfigStorage.resourceID = resourceID;
|
20
|
+
ConfigStorage.instance.loadFormConfig(configName);
|
21
|
+
ConfigStorage.instance.loadGridConfig(configName);
|
22
|
+
}
|
23
|
+
}
|
24
|
+
return this.instance;
|
14
25
|
}
|
15
|
-
|
16
|
-
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar
|
26
|
+
async loadFilterBarConfig(name, urlParams) {
|
27
|
+
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar);
|
17
28
|
if (!ConfigStorage.configById.has(cacheID)) {
|
18
|
-
ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(resourceID, name, urlParams));
|
29
|
+
ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(ConfigStorage.resourceID, name, urlParams));
|
19
30
|
}
|
20
31
|
return ConfigStorage.configById.get(cacheID);
|
21
32
|
}
|
22
|
-
|
23
|
-
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form
|
33
|
+
async loadFormConfig(name) {
|
34
|
+
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form);
|
24
35
|
if (!ConfigStorage.configById.has(cacheID)) {
|
25
|
-
ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name, resourceID));
|
36
|
+
ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name, ConfigStorage.resourceID));
|
26
37
|
}
|
27
38
|
return ConfigStorage.configById.get(cacheID);
|
28
39
|
}
|
29
|
-
|
30
|
-
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid
|
40
|
+
async loadGridConfig(name) {
|
41
|
+
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid);
|
31
42
|
if (!ConfigStorage.configById.has(cacheID)) {
|
32
|
-
ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name, resourceID));
|
43
|
+
ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name, ConfigStorage.resourceID));
|
33
44
|
}
|
34
45
|
return ConfigStorage.configById.get(cacheID);
|
35
46
|
}
|
36
|
-
static async saveFilterBarConfig(config, name
|
37
|
-
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.filterBar
|
47
|
+
static async saveFilterBarConfig(config, name) {
|
48
|
+
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.filterBar);
|
38
49
|
this.configById.delete(cacheID);
|
39
|
-
return this.filterBarConfigFetcher.saveConfig(config, resourceID, name);
|
50
|
+
return this.filterBarConfigFetcher.saveConfig(config, this.resourceID, name);
|
40
51
|
}
|
41
|
-
static async saveFormConfig(config, name
|
42
|
-
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.form
|
52
|
+
static async saveFormConfig(config, name) {
|
53
|
+
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.form);
|
43
54
|
this.configById.delete(cacheID);
|
44
|
-
return this.formConfigFetcher.saveConfig(config, name, resourceID);
|
55
|
+
return this.formConfigFetcher.saveConfig(config, name, this.resourceID);
|
45
56
|
}
|
46
|
-
static async saveCardState(config, name
|
47
|
-
return this.formConfigFetcher.saveCardState(config, name, resourceID);
|
57
|
+
static async saveCardState(config, name) {
|
58
|
+
return this.formConfigFetcher.saveCardState(config, name, this.resourceID);
|
48
59
|
}
|
49
|
-
static async saveGridConfig(config, name
|
60
|
+
static async saveGridConfig(config, name) {
|
50
61
|
if (config == undefined) {
|
51
62
|
return;
|
52
63
|
}
|
53
|
-
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.grid
|
64
|
+
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.grid);
|
54
65
|
this.configById.delete(cacheID);
|
55
|
-
return this.gridConfigFetcher.saveConfig(config, name, resourceID);
|
66
|
+
return this.gridConfigFetcher.saveConfig(config, name, this.resourceID);
|
56
67
|
}
|
57
|
-
static async loadPersonalizedFilter(filterId,
|
58
|
-
return this.personalizedFilterFetcher.loadPersonalizedFilter(resourceID, filterId, configName);
|
68
|
+
static async loadPersonalizedFilter(filterId, configName) {
|
69
|
+
return this.personalizedFilterFetcher.loadPersonalizedFilter(this.resourceID, filterId, configName);
|
59
70
|
}
|
60
|
-
static async savePersonalizedFilter(personalizedFilter,
|
71
|
+
static async savePersonalizedFilter(personalizedFilter, configName) {
|
61
72
|
//Ao criar ou alterar um filtro personalizado,
|
62
73
|
//precisamos remover o cache do status da filterbar.
|
63
|
-
const cacheID = this.buildCacheID(configName, CONFIG_SOURCE.filterBar
|
74
|
+
const cacheID = this.buildCacheID(configName, CONFIG_SOURCE.filterBar);
|
64
75
|
this.configById.delete(cacheID);
|
65
|
-
return this.personalizedFilterFetcher.savePersonalizedFilter(personalizedFilter, resourceID, configName);
|
76
|
+
return this.personalizedFilterFetcher.savePersonalizedFilter(personalizedFilter, this.resourceID, configName);
|
66
77
|
}
|
67
|
-
static async removePersonalizedFilter(personalizedFilter,
|
68
|
-
return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter, resourceID, configName);
|
78
|
+
static async removePersonalizedFilter(personalizedFilter, configName) {
|
79
|
+
return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter, this.resourceID, configName);
|
69
80
|
}
|
70
81
|
static async validatePersonalizedFilter(dataUnitName, expression) {
|
71
82
|
return this.personalizedFilterFetcher.validatePersonalizedFilter(dataUnitName, expression);
|
72
83
|
}
|
73
|
-
static buildCacheID(name, source
|
84
|
+
static buildCacheID(name, source) {
|
74
85
|
if (name == undefined) {
|
75
|
-
return `req_${source}_${resourceID}`;
|
86
|
+
return `req_${source}_${this.resourceID}`;
|
76
87
|
}
|
77
|
-
return `req_${source}_${name}_${resourceID}`;
|
88
|
+
return `req_${source}_${name}_${this.resourceID}`;
|
78
89
|
}
|
79
90
|
}
|
80
91
|
ConfigStorage.configById = new Map();
|
@@ -1,11 +1,12 @@
|
|
1
|
-
import { ChangeOperation, DataUnit,
|
1
|
+
import { ChangeOperation, DataType, DataUnit, SortMode, StringUtils, } from '@sankhyalabs/core';
|
2
|
+
import { DISTINCT_FILTER_NAME_PREFIX } from "@sankhyalabs/ezui/dist/collection/utils/constants";
|
2
3
|
export default class InMemoryLoader {
|
3
4
|
constructor(metadata, records) {
|
4
5
|
this.records = records || [];
|
5
6
|
this.metadata = metadata;
|
6
7
|
this._dataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
|
7
8
|
this._dataUnit.metadataLoader = () => this.metadaLoader();
|
8
|
-
this._dataUnit.dataLoader = (dataUnit, request) =>
|
9
|
+
this._dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
|
9
10
|
this._dataUnit.saveLoader = (_dataUnit, changes) => this.saveLoader(_dataUnit, changes);
|
10
11
|
this._dataUnit.removeLoader = (_dataUnit, recordIds) => this.removeLoader(_dataUnit, recordIds);
|
11
12
|
this.dataUnit.loadMetadata().then(() => this.dataUnit.loadData());
|
@@ -42,6 +43,62 @@ export default class InMemoryLoader {
|
|
42
43
|
metadaLoader() {
|
43
44
|
return Promise.resolve(this._metadata);
|
44
45
|
}
|
46
|
+
dataLoader(dataUnit, request) {
|
47
|
+
const filters = this.getColumnFilters(dataUnit);
|
48
|
+
let records = this.applyFilters(filters);
|
49
|
+
if (request.sort) {
|
50
|
+
request.sort.forEach(sort => {
|
51
|
+
records = records.sort((recordA, recordB) => {
|
52
|
+
const fieldA = recordA[sort.field];
|
53
|
+
const fieldB = recordB[sort.field];
|
54
|
+
const sortFn = this.getSortFn(sort.dataType);
|
55
|
+
return sortFn(fieldA, fieldB) * (sort.mode == SortMode.ASC ? 1 : -1);
|
56
|
+
});
|
57
|
+
});
|
58
|
+
}
|
59
|
+
return Promise.resolve({ records: records });
|
60
|
+
}
|
61
|
+
applyFilters(filters) {
|
62
|
+
let records = [...this._records];
|
63
|
+
filters.forEach(filter => {
|
64
|
+
records = records.filter(record => { var _a; return filter.values.includes((_a = record[filter.column]) === null || _a === void 0 ? void 0 : _a.toString()); });
|
65
|
+
});
|
66
|
+
return records;
|
67
|
+
}
|
68
|
+
getColumnFilters(dataUnit) {
|
69
|
+
var _a, _b;
|
70
|
+
const allFilters = (_a = dataUnit.getFilters()) !== null && _a !== void 0 ? _a : [];
|
71
|
+
const columnFilters = (_b = allFilters.filter(filter => { var _a; return (_a = filter.name) === null || _a === void 0 ? void 0 : _a.includes(DISTINCT_FILTER_NAME_PREFIX); })) !== null && _b !== void 0 ? _b : [];
|
72
|
+
return columnFilters.map(filter => {
|
73
|
+
var _a, _b;
|
74
|
+
return {
|
75
|
+
column: (_b = (_a = filter.name) === null || _a === void 0 ? void 0 : _a.replace(DISTINCT_FILTER_NAME_PREFIX, "")) !== null && _b !== void 0 ? _b : "",
|
76
|
+
values: filter.params.map(param => param.value),
|
77
|
+
};
|
78
|
+
});
|
79
|
+
}
|
80
|
+
getSortFn(type) {
|
81
|
+
switch (type) {
|
82
|
+
case DataType.NUMBER:
|
83
|
+
return this.sortNumber;
|
84
|
+
case DataType.DATE:
|
85
|
+
return this.sortDate;
|
86
|
+
case DataType.OBJECT:
|
87
|
+
return this.sortObject;
|
88
|
+
default:
|
89
|
+
return StringUtils.compare;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
sortObject(a, b) {
|
93
|
+
return StringUtils.compare(a === null || a === void 0 ? void 0 : a["label"], b === null || b === void 0 ? void 0 : b["label"]);
|
94
|
+
}
|
95
|
+
sortNumber(a, b) {
|
96
|
+
return a - b;
|
97
|
+
}
|
98
|
+
sortDate(a, b) {
|
99
|
+
let timeA = a.getTime(), timeB = b.getTime();
|
100
|
+
return timeA === timeB ? 0 : (timeA < timeB ? -1 : 1);
|
101
|
+
}
|
45
102
|
saveLoader(_dataUnit, changes) {
|
46
103
|
return new Promise((resolve) => {
|
47
104
|
let dataUnitRecords = [];
|