@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
@@ -2,15 +2,17 @@ import { r as registerInstance, c as createEvent, h, g as getElement } from './i
|
|
2
2
|
import { ElementIDUtils, ApplicationContext, DataType } from '@sankhyalabs/core';
|
3
3
|
import { UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
4
4
|
import { T as TaskbarElement } from './taskbar-elements-2c761819.js';
|
5
|
-
import { C as ConfigStorage } from './ConfigStorage-
|
5
|
+
import { C as ConfigStorage } from './ConfigStorage-1090289a.js';
|
6
6
|
import { P as PresentationMode } from './index-1564817d.js';
|
7
7
|
import { T as TaskbarProcessor } from './taskbar-processor-94402e6e.js';
|
8
8
|
import { s as store } from './index-bdf75557.js';
|
9
9
|
import { S as SnkMultiSelectionListDataSource } from './SnkMultiSelectionListDataSource-892f37f9.js';
|
10
10
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
11
|
-
import './form-config-fetcher-
|
12
|
-
import './DataFetcher-
|
11
|
+
import './form-config-fetcher-4065db9a.js';
|
12
|
+
import './DataFetcher-a4ed43e7.js';
|
13
13
|
import './_commonjsHelpers-9943807e.js';
|
14
|
+
import './resource-fetcher-45a70066.js';
|
15
|
+
import './filter-bar-config-fetcher-2417b8cf.js';
|
14
16
|
import './filter-item-type.enum-5028ed3f.js';
|
15
17
|
|
16
18
|
const snkGridCss = ".snk-grid__container.sc-snk-grid{display:flex;height:100%;width:100%}.snk-grid__header.sc-snk-grid{display:flex;flex-wrap:nowrap;width:100%}.snk-grid__filter-bar.sc-snk-grid{width:100%}.snk-grid__header-divider.sc-snk-grid{margin-bottom:var(--space--medium)}.snk-grid__table.sc-snk-grid{min-height:300px}.snk-grid-container__without-shadow.sc-snk-grid{--ezgrid__container--shadow:unset}";
|
@@ -20,6 +22,7 @@ const SnkGrid = class {
|
|
20
22
|
registerInstance(this, hostRef);
|
21
23
|
this.actionClick = createEvent(this, "actionClick", 7);
|
22
24
|
this.gridDoubleClick = createEvent(this, "gridDoubleClick", 7);
|
25
|
+
this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
|
23
26
|
this._topTaskbarProcessor = new TaskbarProcessor({
|
24
27
|
"snkGridTopTaskbar.regular": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
|
25
28
|
"snkGridTopTaskbar.regular.secondary": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
|
@@ -36,9 +39,7 @@ const SnkGrid = class {
|
|
36
39
|
this._dataState = undefined;
|
37
40
|
this._gridConfig = undefined;
|
38
41
|
this._popUpGridConfig = false;
|
39
|
-
this.columnFilterDataSource = new SnkMultiSelectionListDataSource();
|
40
42
|
this.configName = undefined;
|
41
|
-
this.resourceID = undefined;
|
42
43
|
this.selectionToastConfig = undefined;
|
43
44
|
this.actionsList = undefined;
|
44
45
|
this.isDetail = undefined;
|
@@ -47,9 +48,6 @@ const SnkGrid = class {
|
|
47
48
|
this.multipleSelection = undefined;
|
48
49
|
this.presentationMode = PresentationMode.PRIMARY;
|
49
50
|
this.messagesBuilder = undefined;
|
50
|
-
this.useEnterLikeTab = false;
|
51
|
-
this.recordsValidator = undefined;
|
52
|
-
this.canEdit = true;
|
53
51
|
}
|
54
52
|
/**
|
55
53
|
* Exibe a janela de configurações da grade.
|
@@ -97,17 +95,20 @@ const SnkGrid = class {
|
|
97
95
|
this._gridConfig = config;
|
98
96
|
}
|
99
97
|
loadConfig() {
|
100
|
-
ConfigStorage.
|
101
|
-
.then((
|
102
|
-
this.
|
103
|
-
|
104
|
-
|
105
|
-
|
98
|
+
ConfigStorage.get()
|
99
|
+
.then((instance) => {
|
100
|
+
instance.loadGridConfig(this.configName)
|
101
|
+
.then((config) => {
|
102
|
+
this.setGridConfig(config);
|
103
|
+
})
|
104
|
+
.catch((error) => {
|
105
|
+
console.warn(error);
|
106
|
+
});
|
106
107
|
});
|
107
108
|
}
|
108
109
|
gridConfigChangeHandler(evt) {
|
109
110
|
const config = evt.detail;
|
110
|
-
ConfigStorage.saveGridConfig(config, this.configName
|
111
|
+
ConfigStorage.saveGridConfig(config, this.configName);
|
111
112
|
evt.stopPropagation();
|
112
113
|
}
|
113
114
|
modalConfigChangeHandler(evt) {
|
@@ -220,11 +221,10 @@ const SnkGrid = class {
|
|
220
221
|
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
221
222
|
}
|
222
223
|
finshLoading() {
|
223
|
-
var _a, _b;
|
224
224
|
this._dataUnitLoadLockerResolver = this._dataUnit.addLoadingLocker();
|
225
225
|
this.addElementID();
|
226
|
-
|
227
|
-
|
226
|
+
this._multiSelectionListDataSource.setApplication(this._application);
|
227
|
+
this._multiSelectionListDataSource.setDataUnit(this._dataUnit);
|
228
228
|
}
|
229
229
|
componentWillLoad() {
|
230
230
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
@@ -315,8 +315,8 @@ const SnkGrid = class {
|
|
315
315
|
if (!this._dataUnit) {
|
316
316
|
return undefined;
|
317
317
|
}
|
318
|
-
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
|
319
|
-
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()
|
318
|
+
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 &&
|
319
|
+
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() }))));
|
320
320
|
}
|
321
321
|
get _element() { return getElement(this); }
|
322
322
|
};
|
@@ -1,18 +1,13 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, F as Fragment } from './index-a7d3d3f1.js';
|
2
2
|
import { ElementIDUtils } from '@sankhyalabs/core';
|
3
|
-
import { S as SnkFormConfigManager } from './SnkFormConfigManager-
|
3
|
+
import { S as SnkFormConfigManager } from './SnkFormConfigManager-de537eca.js';
|
4
4
|
import { buildFormMetadata, FormMetadata } from '@sankhyalabs/ezui/dist/collection/utils/form';
|
5
5
|
import { T as TaskbarProcessor } from './taskbar-processor-94402e6e.js';
|
6
6
|
import { T as TaskbarElement } from './taskbar-elements-2c761819.js';
|
7
7
|
import { c as VIEW_MODE } from './constants-3644f1b6.js';
|
8
|
-
import './DataFetcher-
|
9
|
-
import './pesquisa-fetcher-
|
8
|
+
import './DataFetcher-a4ed43e7.js';
|
9
|
+
import './pesquisa-fetcher-7460b876.js';
|
10
10
|
import { P as PresentationMode } from './index-1564817d.js';
|
11
|
-
import './ISave-4412b20c.js';
|
12
|
-
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
13
|
-
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
14
|
-
import './filter-item-type.enum-5028ed3f.js';
|
15
|
-
import './form-config-fetcher-aaaa79a6.js';
|
16
11
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
17
12
|
|
18
13
|
const snkGuidesViewerCss = ".sc-snk-guides-viewer-h{--snk-guides-viewer--space-large:var(--space--large, 24px);--snk-guides-viewer--space-medium:var(--space--medium, 12px);--snk-guides-viewer__header--min-height:94px;--snk-guides-viewer__header--z-index:var(--more-visible, 2);--snk-guides-viewer__header--background-color:var(--background--body, #fafcff);--snk-guides-viewer__guide-navigator--width:340px;display:block}snk-form-view.sc-snk-guides-viewer{width:100%}.snk-guides-viewer.sc-snk-guides-viewer{position:relative;padding-left:0px;padding-top:0px;padding-right:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__detail-container.sc-snk-guides-viewer{display:flex;row-gap:24px;flex-direction:column}.snk-guides-viewer__header.sc-snk-guides-viewer{position:sticky;align-items:center;top:0;z-index:var(--snk-guides-viewer__header--z-index);background-color:var(--snk-guides-viewer__header--background-color);min-height:var(--snk-guides-viewer__header--min-height);width:calc(100% + (var(--snk-guides-viewer--space-large) * 2));padding-left:var(--snk-guides-viewer--space-large);padding-right:var(--snk-guides-viewer--space-large);padding-top:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-medium);margin-left:calc(var(--snk-guides-viewer--space-large) * -1);margin-right:calc(var(--snk-guides-viewer--space-large) * -1);margin-bottom:var(--snk-guides-viewer--space-medium)}.snk-guides-viewer__container.sc-snk-guides-viewer{display:grid;grid-template-columns:minmax(0, auto) minmax(0, 100%);height:100%;column-gap:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__guide-navigator.sc-snk-guides-viewer{position:sticky;top:calc(var(--snk-guides-viewer__header--min-height) + var(--snk-guides-viewer--space-medium));height:calc(100vh - var(--snk-guides-viewer__header--min-height) - var(--snk-guides-viewer--space-large) - var(--snk-guides-viewer--space-medium))}.snk-guides-viewer__guide-navigator[open].sc-snk-guides-viewer{width:var(--snk-guides-viewer__guide-navigator--width);max-width:var(--snk-guides-viewer__guide-navigator--width);min-width:var(--snk-guides-viewer__guide-navigator--width)}.snk-guides-viewer__detail-content.sc-snk-guides-viewer{min-height:100%;align-items:flex-start;align-content:flex-start}";
|
@@ -23,7 +18,6 @@ const SnkGuidesViewer = class {
|
|
23
18
|
registerInstance(this, hostRef);
|
24
19
|
this.exit = createEvent(this, "exit", 7);
|
25
20
|
this.actionClick = createEvent(this, "actionClick", 7);
|
26
|
-
this.formItemsReady = createEvent(this, "formItemsReady", 7);
|
27
21
|
this._guideBuilders = new Map();
|
28
22
|
this.dataUnit = undefined;
|
29
23
|
this.dataState = undefined;
|
@@ -35,9 +29,7 @@ const SnkGuidesViewer = class {
|
|
35
29
|
this.selectedGuide = undefined;
|
36
30
|
this.taskbarManager = undefined;
|
37
31
|
this.messagesBuilder = undefined;
|
38
|
-
this.canEdit = true;
|
39
32
|
this.presentationMode = undefined;
|
40
|
-
this.resourceID = undefined;
|
41
33
|
this._breadcrumbItems = [];
|
42
34
|
this._guides = undefined;
|
43
35
|
this._formEditorConfigManager = undefined;
|
@@ -239,7 +231,9 @@ const SnkGuidesViewer = class {
|
|
239
231
|
else {
|
240
232
|
detailBranch = this.selectedGuide;
|
241
233
|
}
|
242
|
-
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}`,
|
234
|
+
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}`,
|
235
|
+
// canEdit={this.canEdit}
|
236
|
+
onSnkSwitchGuide: evt => this._guideNavigator.selectGuide(evt.detail) }));
|
243
237
|
}
|
244
238
|
else {
|
245
239
|
const cardId = this.selectedGuide.id;
|
@@ -288,10 +282,7 @@ const SnkGuidesViewer = class {
|
|
288
282
|
return this.selectedGuide === undefined || '__main' === ((_a = this.selectedGuide) === null || _a === void 0 ? void 0 : _a.id);
|
289
283
|
}
|
290
284
|
componentWillLoad() {
|
291
|
-
|
292
|
-
throw new Error("Erro interno: resourceID não informado");
|
293
|
-
}
|
294
|
-
this._configManager = new SnkFormConfigManager(this.configName, this.resourceID, config => this.masterFormConfig = config);
|
285
|
+
this._configManager = new SnkFormConfigManager(this.configName, config => this.masterFormConfig = config);
|
295
286
|
this._configManager.loadConfig();
|
296
287
|
}
|
297
288
|
componentDidRender() {
|
@@ -310,7 +301,7 @@ const SnkGuidesViewer = class {
|
|
310
301
|
}
|
311
302
|
buildTaskBar() {
|
312
303
|
var _a;
|
313
|
-
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
|
304
|
+
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 }));
|
314
305
|
}
|
315
306
|
render() {
|
316
307
|
var _a, _b;
|
@@ -329,7 +320,7 @@ const SnkGuidesViewer = class {
|
|
329
320
|
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 ?
|
330
321
|
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) })
|
331
322
|
:
|
332
|
-
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)
|
323
|
+
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) })));
|
333
324
|
}
|
334
325
|
static get watchers() { return {
|
335
326
|
"dataUnit": ["observeDataUnit"],
|
@@ -1,12 +1,14 @@
|
|
1
|
-
export { S as snk_guides_viewer } from './snk-guides-viewer-
|
1
|
+
export { S as snk_guides_viewer } from './snk-guides-viewer-a6d39c18.js';
|
2
2
|
import './index-a7d3d3f1.js';
|
3
3
|
import '@sankhyalabs/core';
|
4
|
-
import './SnkFormConfigManager-
|
5
|
-
import './ConfigStorage-
|
6
|
-
import './form-config-fetcher-
|
7
|
-
import './DataFetcher-
|
4
|
+
import './SnkFormConfigManager-de537eca.js';
|
5
|
+
import './ConfigStorage-1090289a.js';
|
6
|
+
import './form-config-fetcher-4065db9a.js';
|
7
|
+
import './DataFetcher-a4ed43e7.js';
|
8
8
|
import './_commonjsHelpers-9943807e.js';
|
9
9
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
10
|
+
import './resource-fetcher-45a70066.js';
|
11
|
+
import './filter-bar-config-fetcher-2417b8cf.js';
|
10
12
|
import './filter-item-type.enum-5028ed3f.js';
|
11
13
|
import '@sankhyalabs/ezui/dist/collection/utils/form';
|
12
14
|
import './taskbar-processor-94402e6e.js';
|
@@ -14,7 +16,5 @@ import './taskbar-elements-2c761819.js';
|
|
14
16
|
import './index-1564817d.js';
|
15
17
|
import './index-bdf75557.js';
|
16
18
|
import './constants-3644f1b6.js';
|
17
|
-
import './pesquisa-fetcher-
|
18
|
-
import './ISave-4412b20c.js';
|
19
|
-
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
19
|
+
import './pesquisa-fetcher-7460b876.js';
|
20
20
|
import '@sankhyalabs/core/dist/dataunit/DataUnit';
|
@@ -1,15 +1,17 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host } from './index-a7d3d3f1.js';
|
2
2
|
import { StringUtils, ObjectUtils, ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
|
3
3
|
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-75fb0106.js';
|
4
|
-
import { P as PersonalizedFilterFetcher, C as ConfigStorage } from './ConfigStorage-
|
4
|
+
import { P as PersonalizedFilterFetcher, C as ConfigStorage } from './ConfigStorage-1090289a.js';
|
5
5
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
6
6
|
import { a as FilterGroupCondition } from './index-ae591a44.js';
|
7
7
|
import { s as store } from './index-bdf75557.js';
|
8
8
|
import './filter-item-type.enum-5028ed3f.js';
|
9
|
-
import './form-config-fetcher-
|
10
|
-
import './DataFetcher-
|
9
|
+
import './form-config-fetcher-4065db9a.js';
|
10
|
+
import './DataFetcher-a4ed43e7.js';
|
11
11
|
import './_commonjsHelpers-9943807e.js';
|
12
12
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
13
|
+
import './resource-fetcher-45a70066.js';
|
14
|
+
import './filter-bar-config-fetcher-2417b8cf.js';
|
13
15
|
|
14
16
|
const snkPersonalizedFilterCss = ".sc-snk-personalized-filter-h{display:flex;height:100%;padding:var(--space--large, 24px);--snk-personalized-filter--width:100%;--snk-personalized-filter--height:100%;--snk-personalized-filter--background-color-line:var(--color--disable-secondary);--snk-personalized-filter--margin-line:var(--border--radius-medium, 12px)}.snk-personalized-filter.sc-snk-personalized-filter{height:var(--snk-personalized-filter--width);width:var(--snk-personalized-filter--height)}.snk-personalized-filter__header-actions.sc-snk-personalized-filter{display:flex;gap:var(--space--medium)}.snk-personalized-filter__group.sc-snk-personalized-filter{flex:1}.snk-personalized-filter__expression-input--line.sc-snk-personalized-filter{width:100%;height:2px;background-color:var(--snk-personalized-filter--background-color-line);margin-top:var(--snk-personalized-filter--margin-line);margin-bottom:var(--snk-personalized-filter--margin-line)}.ez-box__main.sc-snk-personalized-filter{height:90%}.snk-personalized-filter__button-mode.sc-snk-personalized-filter{height:35px}";
|
15
17
|
|
@@ -39,7 +41,6 @@ const SnkPersonalizedFilter = class {
|
|
39
41
|
this.entityUri = undefined;
|
40
42
|
this.filterId = undefined;
|
41
43
|
this.configName = undefined;
|
42
|
-
this.resourceID = undefined;
|
43
44
|
}
|
44
45
|
/*
|
45
46
|
* Cria um novo filtro se não houver nenhum filtro existente
|
@@ -76,15 +77,17 @@ const SnkPersonalizedFilter = class {
|
|
76
77
|
this._filterAssistent = ObjectUtils.copy(newPersonalizedFilter);
|
77
78
|
}
|
78
79
|
loadFilter(newValue, oldValue) {
|
79
|
-
if (newValue == null || oldValue == newValue
|
80
|
+
if (newValue == null || oldValue == newValue) {
|
80
81
|
return;
|
81
82
|
}
|
82
|
-
ConfigStorage.
|
83
|
-
.
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
83
|
+
ConfigStorage.get().then((_instance) => {
|
84
|
+
ConfigStorage.loadPersonalizedFilter(newValue, this.configName)
|
85
|
+
.then((resp) => {
|
86
|
+
const personalizedFilter = this.addLabelToItems(resp);
|
87
|
+
this._filterAssistent = personalizedFilter;
|
88
|
+
this._originalFilterAssistent = ObjectUtils.copy(personalizedFilter);
|
89
|
+
this._filterAssistentMode = this._filterAssistent.hasOwnProperty("assistent") && this._filterAssistent.assistent != undefined;
|
90
|
+
});
|
88
91
|
});
|
89
92
|
}
|
90
93
|
componentWillLoad() {
|
@@ -109,7 +112,7 @@ const SnkPersonalizedFilter = class {
|
|
109
112
|
return this._application.messagesBuilder.getMessage(key, params);
|
110
113
|
}
|
111
114
|
saveFilter() {
|
112
|
-
ConfigStorage.savePersonalizedFilter(this._filterAssistent, this.
|
115
|
+
ConfigStorage.savePersonalizedFilter(this._filterAssistent, this.configName).then((personalizedFilter) => {
|
113
116
|
this._elButtonSave.enabled = false;
|
114
117
|
const messageToken = !!this._filterAssistent.id ? 'confirmEdit' : 'confirmSave';
|
115
118
|
ApplicationUtils.info(this.getMessage(`snkPersonalizedFilter.${messageToken}.title`), { iconName: "check" });
|
@@ -120,7 +123,7 @@ const SnkPersonalizedFilter = class {
|
|
120
123
|
});
|
121
124
|
}
|
122
125
|
removeFilter() {
|
123
|
-
ConfigStorage.removePersonalizedFilter(this._filterAssistent, this.
|
126
|
+
ConfigStorage.removePersonalizedFilter(this._filterAssistent, this.configName);
|
124
127
|
}
|
125
128
|
hasChangesToSave() {
|
126
129
|
return JSON.stringify(this._filterAssistent) === JSON.stringify(this._originalFilterAssistent);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { r as registerInstance, h, H as Host, g as getElement } from './index-a7d3d3f1.js';
|
2
|
-
import { P as PrintUtils } from './DataFetcher-
|
2
|
+
import { P as PrintUtils } from './DataFetcher-a4ed43e7.js';
|
3
3
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
4
4
|
import { ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
|
5
5
|
import ModalButtonStatus from '@sankhyalabs/ezui/dist/collection/components/ez-modal-container/modal-button-status';
|
@@ -1,19 +1,16 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-a7d3d3f1.js';
|
2
|
-
import { DataUnit,
|
2
|
+
import { DataUnit, StringUtils, SortMode, DataType, ChangeOperation, ObjectUtils, ApplicationContext, UserInterface } from '@sankhyalabs/core';
|
3
3
|
import { c as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants-3644f1b6.js';
|
4
4
|
import { T as TaskbarElement } from './taskbar-elements-2c761819.js';
|
5
|
-
import './DataFetcher-
|
6
|
-
import './pesquisa-fetcher-
|
5
|
+
import './DataFetcher-a4ed43e7.js';
|
6
|
+
import './pesquisa-fetcher-7460b876.js';
|
7
7
|
import { P as PresentationMode } from './index-1564817d.js';
|
8
|
-
import './ISave-4412b20c.js';
|
9
|
-
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
10
|
-
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
11
|
-
import './filter-item-type.enum-5028ed3f.js';
|
12
|
-
import './form-config-fetcher-aaaa79a6.js';
|
13
8
|
import { T as TaskbarProcessor } from './taskbar-processor-94402e6e.js';
|
9
|
+
import { DISTINCT_FILTER_NAME_PREFIX } from '@sankhyalabs/ezui/dist/collection/utils/constants';
|
14
10
|
import { S as SnkMultiSelectionListDataSource } from './SnkMultiSelectionListDataSource-892f37f9.js';
|
15
11
|
import './index-bdf75557.js';
|
16
12
|
import './_commonjsHelpers-9943807e.js';
|
13
|
+
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
17
14
|
|
18
15
|
class InMemoryLoader {
|
19
16
|
constructor(metadata, records) {
|
@@ -21,7 +18,7 @@ class InMemoryLoader {
|
|
21
18
|
this.metadata = metadata;
|
22
19
|
this._dataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
|
23
20
|
this._dataUnit.metadataLoader = () => this.metadaLoader();
|
24
|
-
this._dataUnit.dataLoader = (dataUnit, request) =>
|
21
|
+
this._dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
|
25
22
|
this._dataUnit.saveLoader = (_dataUnit, changes) => this.saveLoader(_dataUnit, changes);
|
26
23
|
this._dataUnit.removeLoader = (_dataUnit, recordIds) => this.removeLoader(_dataUnit, recordIds);
|
27
24
|
this.dataUnit.loadMetadata().then(() => this.dataUnit.loadData());
|
@@ -58,6 +55,62 @@ class InMemoryLoader {
|
|
58
55
|
metadaLoader() {
|
59
56
|
return Promise.resolve(this._metadata);
|
60
57
|
}
|
58
|
+
dataLoader(dataUnit, request) {
|
59
|
+
const filters = this.getColumnFilters(dataUnit);
|
60
|
+
let records = this.applyFilters(filters);
|
61
|
+
if (request.sort) {
|
62
|
+
request.sort.forEach(sort => {
|
63
|
+
records = records.sort((recordA, recordB) => {
|
64
|
+
const fieldA = recordA[sort.field];
|
65
|
+
const fieldB = recordB[sort.field];
|
66
|
+
const sortFn = this.getSortFn(sort.dataType);
|
67
|
+
return sortFn(fieldA, fieldB) * (sort.mode == SortMode.ASC ? 1 : -1);
|
68
|
+
});
|
69
|
+
});
|
70
|
+
}
|
71
|
+
return Promise.resolve({ records: records });
|
72
|
+
}
|
73
|
+
applyFilters(filters) {
|
74
|
+
let records = [...this._records];
|
75
|
+
filters.forEach(filter => {
|
76
|
+
records = records.filter(record => { var _a; return filter.values.includes((_a = record[filter.column]) === null || _a === void 0 ? void 0 : _a.toString()); });
|
77
|
+
});
|
78
|
+
return records;
|
79
|
+
}
|
80
|
+
getColumnFilters(dataUnit) {
|
81
|
+
var _a, _b;
|
82
|
+
const allFilters = (_a = dataUnit.getFilters()) !== null && _a !== void 0 ? _a : [];
|
83
|
+
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 : [];
|
84
|
+
return columnFilters.map(filter => {
|
85
|
+
var _a, _b;
|
86
|
+
return {
|
87
|
+
column: (_b = (_a = filter.name) === null || _a === void 0 ? void 0 : _a.replace(DISTINCT_FILTER_NAME_PREFIX, "")) !== null && _b !== void 0 ? _b : "",
|
88
|
+
values: filter.params.map(param => param.value),
|
89
|
+
};
|
90
|
+
});
|
91
|
+
}
|
92
|
+
getSortFn(type) {
|
93
|
+
switch (type) {
|
94
|
+
case DataType.NUMBER:
|
95
|
+
return this.sortNumber;
|
96
|
+
case DataType.DATE:
|
97
|
+
return this.sortDate;
|
98
|
+
case DataType.OBJECT:
|
99
|
+
return this.sortObject;
|
100
|
+
default:
|
101
|
+
return StringUtils.compare;
|
102
|
+
}
|
103
|
+
}
|
104
|
+
sortObject(a, b) {
|
105
|
+
return StringUtils.compare(a === null || a === void 0 ? void 0 : a["label"], b === null || b === void 0 ? void 0 : b["label"]);
|
106
|
+
}
|
107
|
+
sortNumber(a, b) {
|
108
|
+
return a - b;
|
109
|
+
}
|
110
|
+
sortDate(a, b) {
|
111
|
+
let timeA = a.getTime(), timeB = b.getTime();
|
112
|
+
return timeA === timeB ? 0 : (timeA < timeB ? -1 : 1);
|
113
|
+
}
|
61
114
|
saveLoader(_dataUnit, changes) {
|
62
115
|
return new Promise((resolve) => {
|
63
116
|
let dataUnitRecords = [];
|
@@ -100,10 +153,14 @@ const SnkSimpleCrud = class {
|
|
100
153
|
this.dataStateChange = createEvent(this, "dataStateChange", 3);
|
101
154
|
this.dataUnitReady = createEvent(this, "dataUnitReady", 3);
|
102
155
|
this.actionClick = createEvent(this, "actionClick", 7);
|
103
|
-
this.formItemsReady = createEvent(this, "formItemsReady", 7);
|
104
156
|
this.REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER"];
|
105
157
|
this.REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER"];
|
106
158
|
this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
|
159
|
+
// /**
|
160
|
+
// * Quando verdadeiro, o ENTER fará a navegação como se fosse a tecla TAB na grade.
|
161
|
+
// */
|
162
|
+
// @Prop()
|
163
|
+
// useEnterLikeTab: boolean = false;
|
107
164
|
this._taskbarProcessor = new TaskbarProcessor({
|
108
165
|
"snkSimpleCrudTaskbar.form_regular": this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(TaskbarElement.GRID_MODE),
|
109
166
|
"snkSimpleCrudTaskbar.grid_regular": this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(TaskbarElement.FORM_MODE),
|
@@ -122,7 +179,6 @@ const SnkSimpleCrud = class {
|
|
122
179
|
this.useCancelConfirm = true;
|
123
180
|
this.taskbarManager = undefined;
|
124
181
|
this.messagesBuilder = undefined;
|
125
|
-
this.useEnterLikeTab = false;
|
126
182
|
}
|
127
183
|
resolveInMemoryBtns(taskbarButtons) {
|
128
184
|
const newTaskBarConfig = [...taskbarButtons];
|
@@ -267,9 +323,11 @@ const SnkSimpleCrud = class {
|
|
267
323
|
}
|
268
324
|
render() {
|
269
325
|
var _a;
|
270
|
-
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),
|
326
|
+
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),
|
327
|
+
// ignoreSaveMessage={this._currentViewMode === VIEW_MODE.GRID}
|
328
|
+
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)
|
271
329
|
? undefined
|
272
|
-
: this._multiSelectionListDataSource
|
330
|
+
: this._multiSelectionListDataSource }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { dataUnit: this.dataUnit, config: this.formConfig }))))));
|
273
331
|
}
|
274
332
|
get _element() { return getElement(this); }
|
275
333
|
static get watchers() { return {
|
@@ -29,7 +29,6 @@ const SnkTaskbar = class {
|
|
29
29
|
};
|
30
30
|
this._permissions = undefined;
|
31
31
|
this.configName = undefined;
|
32
|
-
this.resourceID = undefined;
|
33
32
|
this.buttons = undefined;
|
34
33
|
this.customButtons = undefined;
|
35
34
|
this.actionsList = undefined;
|
@@ -171,7 +170,7 @@ const SnkTaskbar = class {
|
|
171
170
|
componentWillLoad() {
|
172
171
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
173
172
|
if (this._application) {
|
174
|
-
this._application.getAllAccess(
|
173
|
+
this._application.getAllAccess().then(access => this._permissions = access);
|
175
174
|
}
|
176
175
|
else {
|
177
176
|
this._permissions = {};
|
@@ -0,0 +1 @@
|
|
1
|
+
import{F as e}from"./p-584d7212.js";import{R as t}from"./p-f3b7b69e.js";function i(t,r){if(null==t)return t;if(t instanceof Date)return t.toISOString();if("object"==typeof t){if(t instanceof Array)return t.map((t=>i(e.MULTI_LIST===r?function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i}(t,["label"]):t)));{const e=Object.assign({},t);return Object.keys(t).forEach((n=>{void 0!==t[n]?e[n]=i(t[n],r):delete e[n]})),e}}return t}class r extends t{normalize(e){return e.map((e=>{const{id:t,value:r,fixed:n,visible:s,type:l,groupedItems:u}=e,o={id:t};if(r&&(o.value=i(r,l)),n&&(o.fixed=n),u){if(0===u.length)return;u.filter((e=>e.visible)).length>0&&(o.visible=!0),o.groupedItems=this.normalize(u)}else s&&(o.visible=!0);return o})).filter((e=>null!=e))}saveConfig(e,t,i){return this.saveResource(this.normalize(e),this.getPath(t,i))}getConfig(e,t,i){return new Promise(((r,n)=>{this.loadResource(this.getPath(e,t,i)).then((e=>{let t;if(e){const i=JSON.parse(e);t=this.buildFieldList(i.items)}r(t||[])})).catch((e=>{n(e)}))}))}saveEntityListConfig(e,t,r){return new Promise(((n,s)=>{this.getConfig(t,r).then((l=>{const u=l.map((({id:e,value:t,fixed:r,visible:n,type:s,groupedItems:l})=>Object.assign(Object.assign(Object.assign(Object.assign({id:e},t&&{value:i(t,s)}),r&&{fixed:r}),n&&{visible:!0}),{groupedItems:l}))),o=u.findIndex((({id:t})=>t===e.id)),f={id:e.id,value:i(e.value,e.type),fixed:e.fixed,visible:!0};o>-1?u[o]=f:u.push(f),this.saveResource(u,this.getPath(t,r)).then((e=>{n(e)})).catch((e=>{s(e)}))})).catch((e=>{s(e)}))}))}buildFieldList(t){return t.map((t=>{var i,r;if(t.type===e.MULTI_LIST){const e=t.value;t.value=null!==(r=null!==(i=null==e?void 0:e.elements)&&void 0!==i?i:null==e?void 0:e.members)&&void 0!==r?r:e}return t}))}getPath(e,t,i){let r=`cfg://filter/FilterBarState:${e}`;return t&&(r+=`.${t}`),i&&(r+=this.buildQueryString(i)),r}buildQueryString(e){let t="?";for(let i in e)e.hasOwnProperty(i)&&(t.length>1&&(t+="&"),t+=i+"="+e[i]);return t}}export{r as F}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import{r as t,c as e,h as s,g as i}from"./p-d2d301a6.js";import{WaitingChangeException as r,WarningException as n,ErrorException as a,ObjectUtils as o,DateUtils as c,StringUtils as h,OnboardingUtils as u,DependencyType as l,ElementIDUtils as p,ApplicationContext as d,ErrorTracking as m,DataType as w}from"@sankhyalabs/core";import{d as f,D as y,U as g}from"./p-44e66c8d.js";import{ApplicationUtils as P}from"@sankhyalabs/ezui/dist/collection/utils";import{P as v}from"./p-9d18017a.js";import{G as I,C as A}from"./p-5994af77.js";import{D as S}from"./p-b978da60.js";import{R as _}from"./p-f3b7b69e.js";import{S as E}from"./p-ae6aff81.js";import"./p-112455b1.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-847e6c20.js";import"./p-0fb83448.js";import"./p-584d7212.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";class C{constructor(t){this._app=t,window.addEventListener("error",(t=>this.errorHandler(t))),window.addEventListener("unhandledrejection",(t=>this.rejectionHandler(t)))}rejectionHandler(t){const e=t.reason;e instanceof r||(e?this.processException(e):this._app.isDebugMode().then((t=>{t&&this._app.error("Promise rejeitada","Erro interno: Uma promise foi rejeitada sem razão determinada.")})))}errorHandler(t){this.processException(t.error)}buildErrorCodeHTML(t){return'<br><a href="#" onclick="try{window.workspace.openHelp(\'_tbcode:'+t+"')} catch(e){alert('Não é possível abrir a ajuda fora do workspace Sankhya');}\">Código: "+t+"</a>"}processException(t){t.errorCode&&(t.message+=this.buildErrorCodeHTML(t.errorCode)),t instanceof r||t instanceof n?this._app.alert(t.title,t.message):t instanceof a?this._app.error(t.title,t.message):this._app.isDebugMode().then((e=>{if(e)if(t instanceof Error)this._app.error(t.name,t.message);else{const e=(null==t?void 0:t.title)||"Erro detectado",s="string"==typeof t?t:t.message||`Erro interno "${o.objectToString(t)}"`;this._app.error(e,s)}}))}}function D(){const t=["2909523kXwted","CompanyName=Sankhya Jiva Tecnologia e Inovao Ltda,LicensedApplication=Sankhya Gestao,LicenseType=SingleApplication,LicensedConcurrentDeveloperCount=2,LicensedProductionInstancesCount=0,AssetReference=AG-019460,ExpiryDate=9_November_2022_[v2]_MTY2Nzk1MjAwMDAwMA==10487151e296ee4360f80961ca960869","1131048CARoeW","502909mLEPmu","447255iQEXuN","428UHbJwW","270AFTxAV","194369jhGqTI","1540nWuTrj","2044062GicUQI","30CkXPWg"];return(D=function(){return t})()}const T=b;function b(t,e){const s=D();return(b=function(t){return s[t-=392]})(t,e)}!function(){const t=b,e=D();for(;;)try{if(951926==-parseInt(t(398))/1+-parseInt(t(393))/2+parseInt(t(395))/3+-parseInt(t(400))/4*(parseInt(t(392))/5)+-parseInt(t(401))/6*(-parseInt(t(402))/7)+parseInt(t(397))/8+-parseInt(t(399))/9*(-parseInt(t(394))/10))break;e.push(e.shift())}catch(t){e.push(e.shift())}}();const N=T(396);class j{constructor(){this.templateByQuery=new Map,this.cancel=[],this.buildTemplates()}buildTemplates(){this.templateByQuery.set("fetchTotals",f.gql`query($filters: [InputFilter!] $name: String!) {
|
2
|
+
$queryAlias$: fetchTotals(name: $name, filters: $filters ){
|
3
|
+
name
|
4
|
+
value
|
5
|
+
}
|
6
|
+
}`)}fetchTotals(t,e,s=[]){const i=`${t}_${e}`,r=this.cancel.findIndex((t=>t[i]));return r>=0&&(this.cancel[r][i](),this.cancel.splice(r,1)),Promise.race([new Promise((t=>this.cancel.push({[i]:t}))),this.getTotals(t,e,s)]).then((t=>{let e=new Map;if(t){e=t;const s=this.cancel.findIndex((t=>t[i]));s>=0&&this.cancel.splice(s,1)}return e}))}getTotals(t,e,s=[]){return new Promise(((i,r)=>{y.get().callGraphQL({query:this.templateByQuery.get("fetchTotals"),values:{name:`totals://${t}/${e}`,filters:s}}).then((t=>{if(t.length>0){const e=new Map;return t.forEach((t=>e.set(t.name,parseFloat(t.value)))),i(e)}return r("Não foi possível recuperar os totalizadores")})).catch(r)}))}}var k;class O{static openAppActivity(t,e){var s;null===(s=window.workspace)||void 0===s||s.openAppActivity(t,e)}static getAppLabel(t){if(null!=(null===window||void 0===window?void 0:window.workspace))return null==window.workspace.getAppLabel&&(window.workspace.getAppLabel=t=>(t||"").split(".").pop()),window.workspace.getAppLabel(t)}}O.resourceID=null===(k=window.workspace)||void 0===k?void 0:k.resourceID;class L{static webConnectionCaller(t,e,s){var i;null===(i=window.AppletCaller)||void 0===i||i.webConnectionCaller(t,e,s)}}class U{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchParam",f.gql`query($name: String!) {
|
7
|
+
$queryAlias$: fetchResource(name: $name){
|
8
|
+
name
|
9
|
+
resource
|
10
|
+
}
|
11
|
+
}`)}async getParam(t){const e=`param://application?params=${t}`;return y.get().callGraphQL({values:{name:e},query:this.templateByQuery.get("fetchParam")})}async asString(t){const e=await this.getParam(t);return this.getValue(e)}async asInteger(t){const e=await this.getParam(t);return parseInt(this.getValue(e))}async asFloat(t){const e=await this.getParam(t);return parseFloat(this.getValue(e))}async asBoolean(t){const e=await this.getParam(t);return"S"===this.getValue(e)}async asDate(t){const e=await this.getParam(t);return c.strToDate(this.getValue(e))}async getBatchParams(t){const e=await this.getParam(t.join(",")),s={};return e.forEach((t=>s[t.name]=t.resource)),s}getValue(t={}){if(Array.isArray(t)&&t.length>0&&(t=t[0]),h.isEmpty(t.resource))return"";try{const e=o.stringToObject(t.resource),[s]=Object.keys(e);return e[s]}catch(t){console.warn("Erro ao converter string JSON.")}}}const $=R;function R(t,e){const s=M();return(R=function(t){return s[t-=378]})(t,e)}function M(){const t=["true","863GKWjmo","parse","56355fjjjAm","isSup","putAccess","4324480sjuCdS","hasOwnProperty","239748okvJLB","name","6055770tXeRaU","actions","forEach","7RPRvzn","1042CHxkUw","2988126NIwRMm","20MTNzmH","authorizationSf","item","string","hasAccess","isArray","Objeto não pode ser indefinido.","3071943fWslZp","parseFromJSON"];return(M=function(){return t})()}!function(){const t=R,e=M();for(;;)try{if(281287==parseInt(t(399))/1*(-parseInt(t(387))/2)+-parseInt(t(401))/3+parseInt(t(381))/4*(-parseInt(t(389))/5)+parseInt(t(388))/6*(-parseInt(t(386))/7)+parseInt(t(379))/8+parseInt(t(396))/9+parseInt(t(383))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class F{[$(397)](t){const e=$;if(typeof(t=utxt(t[e(390)]))==e(392)&&(t=JSON[e(400)](t)),null==t)throw Error(e(395));const s=new q("S"===t[e(402)]||!0===t[e(402)]);return Array[e(394)](t[e(391)])&&t[e(391)][e(385)]((t=>s.putAccess(t[e(382)],String(t.status)==e(398)))),s}}class q{constructor(t){const e=$;this.isSup=t,this[e(384)]={}}[$(378)](t,e){this[$(384)][t]=e}[$(393)](t){const e=$;if(this[e(402)])return!0;let s=!0;return this[e(384)][e(380)](t)&&(s=this.actions[t]),s}isUserSup(){return this.isSup}}class x extends _{getData(t){const e=`cfg://auth/${t}`;return new Promise(((t,s)=>{this.loadResource(e).then((e=>{let s=o.stringToObject(e);s&&"object"==typeof s&&t(s)})).catch((t=>{s(t)}))}))}}var z;!function(t){t.INSERT="I",t.UPDATE="A",t.REMOVE="E",t.SHOW="C",t.CONFIG="F",t.CONFIG_NUMBER="N",t.CLONE="D",t.CONFIG_GRID="G"}(z||(z={}));const G=class{constructor(s){t(this,s),this.applicationLoaded=e(this,"applicationLoaded",7),this.applicationLoading=e(this,"applicationLoading",7),this._authPromises=[],this._duCache=new Map,this._duPromises=new Map,this._requestListener=new H,this.messagesBuilder=void 0,this.configName=void 0}get parameters(){return this._parameters||(this._parameters=new U),this._parameters}get resourceID(){return this._resourceID||(this._resourceID=this.urlParams.get("workspaceResourceID")||this.urlParams.get("resourceID")||O.resourceID||"unknown.resource.id"),this._resourceID}get auth(){return this._auth?Promise.resolve(this._auth):new Promise(((t,e)=>{const s=this._authPromises.length>0;this._authPromises.push(new J(t,e)),s||this.authFetcher.getData(this.resourceID).then((t=>{for(this._auth=t;this._authPromises.length>0;)this._authPromises.pop().resolve(this._auth)})).catch((t=>{for(;this._authPromises.length>0;)this._authPromises.pop().reject(t)}))}))}async isUserSup(){return new Promise(((t,e)=>{this.auth.then((s=>{this.getAuthList(s).then((e=>{t(e.isSup)})).catch((t=>e(t)))}))}))}initOnboarding(t){return u.getInstance().init(t,window.envContext),Promise.resolve()}async hasAccess(t){return new Promise(((e,s)=>{this.auth.then((i=>{this.getAuthList(i).then((s=>{e(s.isSup||s.actions[t])})).catch((t=>s(t)))}))}))}async getAllAccess(){return new Promise(((t,e)=>{this.auth.then((s=>{this.getAuthList(s).then((e=>{const s={};s.isSup=e.isSup,Object.entries(z).forEach((t=>{s[t[0]]=e.actions[t[1]]||!1})),t(s)})).catch((t=>e(t)))}))}))}async getStringParam(t){return this.parameters.asString(t)}async getIntParam(t){return this.parameters.asInteger(t)}async getFloatParam(t){return this.parameters.asFloat(t)}async getBooleanParam(t){return this.parameters.asBoolean(t)}async getDateParam(t){return this.parameters.asDate(t)}async showPopUp(t,e="full",s=!0){this.clearContent(this._popUp),this._popUp.appendChild(t),this._popUp.opened=!0,this._popUp.heightMode=e,this._popUp.useHeader=s,"EZ-MODAL-CONTAINER"===t.tagName&&(this._popUp.useHeader=!1)}async showModal(t){this.clearContent(this._rightModal),this._rightModal.appendChild(t),this._rightModal.opened=!0}async closeModal(){this.clearContent(this._rightModal),this._rightModal.opened=!1}async closePopUp(){this.clearContent(this._popUp),this._popUp.opened=!1,this._popUp.useHeader=!0,this._popUp.heightMode="full"}async temOpcional(t){const e=t.split(",");return new Promise(((t,s)=>{this.getAttributeFromHTMLWrapper("opc0009").then((i=>{"1"===i?t(!0):Promise.all(e.map((t=>this.getAttributeFromHTMLWrapper("opc"+t)))).then((e=>{t(e.includes("1"))})).catch((t=>{s(t)}))})).catch((t=>{s(t)}))}))}async getConfig(t){let e={serviceName:"SystemUtilsSP.getConf",requestBody:{config:{chave:t,tipo:"T"}}};return new Promise(((t,s)=>{y.get().callServiceBroker("SystemUtilsSP.getConf",JSON.stringify(e)).then((e=>{var s;return t(null===(s=e.config)||void 0===s?void 0:s.data)})).catch((t=>s(t)))}))}async saveConfig(t,e){let s={serviceName:"SystemUtilsSP.saveConf",requestBody:{config:{chave:t,tipo:"T",data:e}}};return new Promise(((t,e)=>{y.get().callServiceBroker("SystemUtilsSP.saveConf",JSON.stringify(s)).then((e=>t(e))).catch((t=>e(t)))}))}async getAttributeFromHTMLWrapper(t){return Promise.resolve(window[t])}async openApp(t,e){O.openAppActivity(t,e)}async webConnection(t,e,s){this.getStringParam(t).then((t=>{L.webConnectionCaller(t,e,s)}))}getDuPromissesStack(t){let e;return t&&(e=this._duPromises.get(t),e||(e=[],this._duPromises.set(t,e))),e||[]}async createDataunit(t,e,s,i){return new Promise(((r,n)=>{const a=this.getDuPromissesStack(e),o=a.length>0;if(a.push(new J(r,n)),!o){const r=this.dataUnitFetcher.getDataUnit(t,this.resourceID,s,i);r.loadMetadata().then((()=>{for(e&&this.updateDataunitCache(void 0,e,r);a.length>0;)a.pop().resolve(r)})).catch((t=>{for(;a.length>0;)a.pop().reject(t)}))}}))}async updateDataunitCache(t,e,s){t&&this._duCache.delete(t),this._duCache.set(e,s)}async getDataUnit(t,e,s,i){return new Promise(((r,n)=>{const a=this._duCache.get(e);a?r(a):this.createDataunit(t,e,s,i).then((t=>{r(t)})).catch((t=>n(t)))}))}async addClientEvent(t,e){return new Promise((s=>{y.addClientEvent(t,e),s()}))}async removeClientEvent(t){return new Promise((e=>{y.removeClientEvent(t),e()}))}async hasClientEvent(t){return new Promise((e=>{e(y.hasClientEvent(t))}))}async callServiceBroker(t,e,s){return y.get().callServiceBroker(t,e,s)}async getResourceID(){return Promise.resolve(this.resourceID)}async getUserID(){return Promise.resolve(window.UID)}async alert(t,e,s,i){return P.alert(t,e,s,i)}async error(t,e,s,i){return P.error(t,e,s,i)}async success(t,e,s,i){return P.success(t,e,s,i)}async message(t,e,s,i){return P.message(t,e,s,i)}async confirm(t,e,s,i,r){return P.confirm(t,e,s,i,r)}async info(t,e){return P.info(t,e)}async loadGridConfig(t){return this.gridConfigFetcher.getConfig(t,this.resourceID)}async loadTotals(t,e,s){return this.totalsFetcher.fetchTotals(t,e,s)}async getAuthList(t){return await(new F).parseFromJSON(t)}get urlParams(){return this._urlParams||(this._urlParams=g.getQueryParams(location.search)),this._urlParams}get dataUnitFetcher(){return this._dataUnitFetcher||(this._dataUnitFetcher=new S),this._dataUnitFetcher}get gridConfigFetcher(){return this._gridConfigFetcher||(this._gridConfigFetcher=new I),this._gridConfigFetcher}get totalsFetcher(){return this._totalsFetcher||(this._totalsFetcher=new j),this._totalsFetcher}get pesquisaFetcher(){return this._pesquisaFetcher||(this._pesquisaFetcher=new v),this._pesquisaFetcher}get authFetcher(){return this._authFetcher||(this._authFetcher=new x),this._authFetcher}async executeSearch(t,e,s){const i=null==s?void 0:s.getField(e);if(i){const{mode:e,argument:r}=t,{ENTITYNAME:n,CODEFIELD:a,DESCRIPTIONFIELD:o,ROOTENTITY:c,DESCRIPTIONENTITY:h}=i.properties,u=i.dependencies;let p;const d={rootEntity:c,descriptionFieldName:o,codeFieldName:a,showInactives:!1,dataUnitId:s.dataUnitId};return null==u||u.filter((t=>t.masterFields)).forEach((t=>{var e;t.type===l.SEARCHING&&(null===(e=t.masterFields)||void 0===e?void 0:e.length)>0&&(p={expression:t.expression,params:t.masterFields.map((t=>{const e=s.getField(t),i=(null==e?void 0:e.dataType)||w.TEXT,r=s.getFieldValue(t);if(null==r)throw this.alert("Erro ao pesquisar",`É necessario informar o campo ${e.label} para executar a pesquisa.`),new Error(`É necessario informar o campo ${e.label} para executar a pesquisa.`);return{name:t,value:r,dataType:i}}))})})),this.executePreparedSearch(e,r,{entity:n,entityDescription:h,criteria:p,searchOptions:d})}}async executePreparedSearch(t,e,s){const{entity:i,entityDescription:r,criteria:n,searchOptions:a}=s;return"ADVANCED"===t?new Promise((t=>{const s=document.createElement("snk-pesquisa");s[p.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=`entity_${i}`,s.argument=e,s.searchLoader=t=>this.pesquisaFetcher.loadAdvancedSearch(i,t,n,a),s.selectItem=e=>{t(e),this.clearPopUpTitle(),this.closePopUp()},this.setPopUpTitle(r),this.showPopUp(s)})):this.pesquisaFetcher.loadSearchOptions(i,e,n,a)}async isDebugMode(){return new Promise((t=>{t(window.isDebugMode)}))}async getAppLabel(){return O.getAppLabel(this._resourceID)}addSearchListener(t,e,s){return new Promise((i=>{i(this.pesquisaFetcher.addSearchListener(t,e.dataUnitId,s))}))}importScript(t){return new Promise((e=>{this.getApplicationPath().then((s=>{let i=[];Array.isArray(t)||(i=[t]),i.forEach((t=>{const e=document.createElement("script");e.src=`${s}/${t}`,e.async=!0,document.body.appendChild(e)})),e()}))}))}getApplicationPath(){return new Promise((t=>{"dev"!==window.applicationenv&&t(`/${window.MGE_MODULE_NAME}/labsApps/${window.APPLICATION_NAME}/build`),t("")}))}executeSelectDistinct(t,e,s){return this.dataUnitFetcher.loadSelectDistinct(t,e,s)}getDataFetcher(){return Promise.resolve(y.get())}clearContent(t){t&&Array.from(t.children).forEach((e=>{t.removeChild(e)}))}clearPopUpTitle(){this._popUp.ezTitle=""}setPopUpTitle(t){this._popUp.ezTitle=t}componentWillLoad(){this._errorHandler=new C(this),this.messagesBuilder=new E,d.setContextValue("__EZUI__UPLOAD__ADD__URL__",`${g.getUrlBase()}/mge/upload/file`),d.setContextValue("__EZUI__SEARCH__OPTION__LOADER__",((t,e,s)=>this.executeSearch(t,e,s))),d.setContextValue("__EZUI__GRID_LICENSE__",N),m.init(),A.get()}connectedCallback(){d.setContextValue("__SNK__APPLICATION__",this),y.addRequestListener(this._requestListener)}disconnectedCallback(){y.removeRequestListener(this._requestListener)}componentDidLoad(){this.applicationLoading.emit(!0),window.requestAnimationFrame((()=>{this.applicationLoaded.emit(!0)})),p.addIDInfo(this._element,`resource_${this._resourceID}`)}render(){return s("div",null,s("ez-loading-bar",{ref:t=>this._requestListener.loadingBar=t}),s("ez-popup",{opened:!1,ref:t=>this._popUp=t,onEzClosePopup:()=>this.closePopUp()}),s("ez-modal",{opened:!1,ref:t=>this._rightModal=t,"modal-size":"small",closeOutsideClick:!0,closeEsc:!0}))}get _element(){return i(this)}};class H{constructor(){this._debounceTime=1e3,this._ignoredNameTypes=["totals"],this._countRequest=0}onRequestStart(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest++,this.loadingBar.show(),this._timerLoading&&clearTimeout(this._timerLoading))}onRequestEnd(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest--,this._timerLoading=setTimeout((()=>{this._countRequest<=0&&this.loadingBar.hide()}),this._debounceTime))}isIgnoreLoadingOnRequest(t){var e;if(1==(null===(e=null==t?void 0:t.requestBody)||void 0===e?void 0:e.length)){const{name:e}=t.requestBody[0].variables;if(e){const t=e.split(":");return this._ignoredNameTypes.indexOf(t[0])>=0}}return!1}}class J{constructor(t,e){this.resolve=t,this.reject=e}}G.style=".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";export{G as snk_application}
|
@@ -0,0 +1 @@
|
|
1
|
+
import{r as i,c as t,h as e,H as s}from"./p-d2d301a6.js";import{ElementIDUtils as r}from"@sankhyalabs/core";import{DataBinder as a}from"@sankhyalabs/ezui/dist/collection/utils/form";const o=class{constructor(e){i(this,e),this.snkContentCardChanged=t(this,"snkContentCardChanged",7),this.levelPath=void 0,this.label=void 0,this.name=void 0,this.fields=void 0,this.formMetadata=void 0,this.dataUnit=void 0,this.contracted=void 0,this.fixed=!1,this.summaryFields=void 0,this.canExpand=!0,this.canFix=!0,this.recordsValidator=void 0}async showUp(){this._formView&&this._formView.showUp()}changeFix(){this.fixed=!this.fixed,this.emitEvent("fixed")}changeContracted(){this.contracted=!this.contracted,this.emitEvent("presentation")}emitEvent(i){this.snkContentCardChanged.emit({formName:this.name,cardConfig:{fixed:this.fixed,presentation:this.contracted?"CONTRACTED":"EXPANDED"},propertyChanged:i})}getCardSummary(){const i={};return this.getSummaryFields().forEach((({field:t,label:e})=>{var s;const r=this.dataUnit.getFormattedValue(t);""!==r&&(null==e&&(e=null===(s=this.dataUnit.getField(t))||void 0===s?void 0:s.label),i[e]=r)})),i}getSummaryFields(){return null==this.summaryFields?this.fields.map((i=>{const t=this.dataUnit.getField(i.name);return{field:i.name,label:i.label||(null==t?void 0:t.label)}})):this.summaryFields}bindFields(i){null==this._dataBinder&&null!=this.dataUnit&&(this._dataBinder=new a(this.dataUnit)),this._dataBinder&&this._dataBinder.bind(i,this.dataUnit.dataUnitId,this.formMetadata,this.recordsValidator)}disconnectedCallback(){null!=this._dataBinder&&this._dataBinder.onDisconnectedCallback()}render(){return e(s,{class:"ez-box__container"},e("div",{class:"summary-header ez-flex ez-size-width--full"},e("div",{class:"ez-flex ez-text ez-title--primary ez-text--bold ez-flex--justify-start ez-flex--align-items-center ez-col--sd-9"},this.levelPath?e("span",{class:"level-path"},this.levelPath+" /"):void 0,this.label),e("div",{class:"ez-flex ez-flex--justify-end ez-col--sd-3"},this.canFix&&e("ez-button",{class:"ez-padding-left--medium",mode:"icon",size:"small",iconName:this.fixed?"un-pin":"push-pin","data-element-id":r.getInternalIDInfo("toggleFixed_ezFormCard"),onClick:()=>this.changeFix(),title:this.fixed?"Desafixar":"Fixar"}),this.canExpand&&e("ez-button",{class:"ez-padding-left--medium",mode:"icon",size:"small",iconName:this.contracted?"chevron-down":"chevron-up","data-element-id":r.getInternalIDInfo("toggleExpand_ezFormCard"),onClick:()=>this.changeContracted(),title:this.contracted?"Expandir":"Resumir"}))),e("slot",null),this.contracted?e("snk-form-summary",{summary:this.getCardSummary()}):e("ez-form-view",{ref:i=>this._formView=i,fields:this.fields,onEzContentReady:i=>this.bindFields(i.detail)}))}};o.style=".sc-snk-form-view-h{display:flex;width:100%;--ez-form-card-summary-field-content-weight:700}.level-path.sc-snk-form-view{color:var(--color--title-primary, #2B3A54);font-weight:var(--text-weight--medium, 400);padding-right:3px}.summary-wrapper.sc-snk-form-view{display:flex;overflow:hidden}.summary-header.sc-snk-form-view{border-bottom:1px solid var(--color--strokes);margin-bottom:var(--space--medium);padding-bottom:var(--space--medium)}.summary-container.sc-snk-form-view{display:flex;flex-direction:column}.summary-container.sc-snk-form-view{padding-right:calc(var(--space--extra-large) / 1.5)}.summary-field.sc-snk-form-view{min-width:30px;max-width:200px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.summary-field__title.sc-snk-form-view{color:var(--text--primary, #626e82);font-size:var(--title--small);white-space:nowrap;font-weight:var(--text-weight--medium)}.summary-field__content.sc-snk-form-view{color:var(--title--primary, #2b3a54);font-size:var(--text--large);font-weight:var(--ez-form-card-summary-field-content-weight)}";export{o as snk_form_view}
|
@@ -0,0 +1 @@
|
|
1
|
+
import{r as t,c as i,h as s,g as e}from"./p-d2d301a6.js";import{ElementIDUtils as a,ApplicationContext as h}from"@sankhyalabs/core";import{T as n}from"./p-a2493d11.js";import"./p-44e66c8d.js";import"./p-9d18017a.js";import{P as o}from"./p-5534e08c.js";import{c as r}from"./p-4a78e118.js";import"./p-6dc031de.js";import"./p-112455b1.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";const d=class{constructor(s){t(this,s),this.actionClick=i(this,"actionClick",7),this.configuratorSave=i(this,"configuratorSave",7),this.configuratorCancel=i(this,"configuratorCancel",7),this._viewHistory=[],this._dataUnit=void 0,this._dataState=void 0,this.attachmentRegisterKey=void 0,this._currentViewMode=r.GRID,this.configName=void 0,this.selectionToastConfig=void 0,this.showActionButtons=!1,this.actionsList=void 0,this.taskbarManager=void 0,this.recordsValidator=void 0,this.statusResolver=void 0,this.multipleSelection=!0,this.presentationMode=o.PRIMARY,this.messagesBuilder=void 0}async goToView(t){this.executeAction(t)}async openConfigurator(){var t;null===(t=this._snkConfigurator)||void 0===t||t.open()}async closeConfigurator(){var t;null===(t=this._snkConfigurator)||void 0===t||t.close()}async reloadFilterBar(){var t;null===(t=this._snkGrid)||void 0===t||t.reloadFilterBar()}currentViewModeWatcher(t){this._viewHistory=[...this._viewHistory.slice(-1),t]}async gridToForm(t=!1){this._backToGrid=!t&&await this._viewStack.getSelectedIndex()===r.GRID,this.setViewMode(r.FORM)}async executeAction(t){return t===n.GRID_MODE?this.setViewMode(r.GRID):t===n.FORM_MODE||t===n.UPDATE?this.gridToForm(t!==n.UPDATE):t===n.CONFIGURATOR?this._snkConfigurator.open():"ATTACH"===t?this.setViewMode(r.ATTACHMENT):void 0}backView(){const t=this._viewHistory.at(-2)||r.GRID;this.setViewMode(t)}setViewMode(t){this._viewStack.show(t),this._currentViewMode=t}openConfig(t){this._snkConfigurator.close(),t===r.GRID?this._snkGrid.showConfig():t===r.FORM&&this._guidesViewer.showFormConfig()}addDataElementID(){a.addIDInfo(this._element,null,{dataUnit:this._dataUnit})}insertionModeHandler(){this.gridToForm()}cancelHandler(){this._backToGrid&&this.setViewMode(r.GRID)}async getAttachmentRegisterKey(){if(this._snkDataUnit)return(await this._snkDataUnit.getSelectedRecordsIDsInfo()).map((({value:t})=>t)).join("_")}componentWillLoad(){const t=h.getContextValue("__SNK__APPLICATION__");let i=this._element.parentElement;for(;i;){if("SNK-DATA-UNIT"===i.tagName.toUpperCase()){this._snkDataUnit=i,this._snkDataUnit.addEventListener("insertionMode",(()=>this.insertionModeHandler())),this._snkDataUnit.addEventListener("cancelEdition",(()=>this.cancelHandler())),this._dataUnit=this._snkDataUnit.dataUnit,this._dataState=this._snkDataUnit.dataState,this._dataUnit?this.initDataUnit():this._snkDataUnit.addEventListener("dataUnitReady",(t=>{this._dataUnit=t.detail,this.initDataUnit()})),this._snkDataUnit.addEventListener("dataStateChange",(async({detail:t})=>{this._dataState=t,void 0!==t.selectedRecord&&(this.attachmentRegisterKey=await this.getAttachmentRegisterKey())}));break}i=i.parentElement}this.configName||(this.configName=t.configName)}initDataUnit(){this.addDataElementID(),this.messagesBuilder||(this.messagesBuilder=this._snkDataUnit.messagesBuilder)}handleConfiguratorEvent(t,i){t.stopImmediatePropagation(),"SAVE"!==i?this.configuratorCancel.emit():this.configuratorSave.emit()}render(){return s("ez-view-stack",{ref:t=>this._viewStack=t,"data-element-id":"crud"},s("stack-item",null,s("snk-grid",{ref:t=>this._snkGrid=t,"data-element-id":"crud_grid",configName:this.configName,onGridDoubleClick:()=>this.gridToForm(!0),taskbarManager:this.taskbarManager,onActionClick:t=>this.executeAction(t.detail),messagesBuilder:this.messagesBuilder,actionsList:this.actionsList,statusResolver:this.statusResolver,multipleSelection:this.multipleSelection,presentationMode:this.presentationMode,selectionToastConfig:this.selectionToastConfig},s("slot",{name:"SnkGridHeader"}),s("slot",{name:"SnkGridFooter"}),s("slot",{name:"SnkGridTaskBar"}))),s("stack-item",null,s("snk-guides-viewer",{ref:t=>this._guidesViewer=t,entityPath:this._snkDataUnit.entityName,messagesBuilder:this.messagesBuilder,onExit:()=>this.setViewMode(r.GRID),dataState:this._dataState,dataUnit:this._dataUnit,actionsList:this.actionsList,taskbarManager:this.taskbarManager,configName:this.configName,onActionClick:t=>this.executeAction(t.detail),presentationMode:this.presentationMode,"data-element-id":"crud_form"},s("slot",{name:"SnkFormTaskBar"}))),s("stack-item",null,s("snk-attach",{registerKey:this.attachmentRegisterKey,messagesBuilder:this.messagesBuilder,entityName:this._snkDataUnit.entityName,onBack:this.backView.bind(this)})),s("snk-configurator",{ref:t=>this._snkConfigurator=t,viewMode:this._currentViewMode,messagesBuilder:this.messagesBuilder,onConfigSelected:t=>this.setViewMode(t.detail),onOpenConfig:t=>this.openConfig(t.detail),showActionButtons:this.showActionButtons,onSave:t=>this.handleConfiguratorEvent(t,"SAVE"),onCancel:t=>this.handleConfiguratorEvent(t,"CANCEL")},s("div",{slot:"SnkConfigContainerSlot"},s("slot",{name:"SnkConfigContainerSlot"}))))}get _element(){return e(this)}static get watchers(){return{_currentViewMode:["currentViewModeWatcher"]}}};d.style=".sc-snk-crud-h{display:flex;flex-direction:column;height:100%;width:100%}";export{d as snk_crud}
|
@@ -0,0 +1 @@
|
|
1
|
+
import{r as i,c as t,h as s,g as e}from"./p-d2d301a6.js";import{ElementIDUtils as d,ApplicationContext as r,DataType as a}from"@sankhyalabs/core";import{UserInterface as n}from"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import{T as o}from"./p-a2493d11.js";import{C as l}from"./p-5994af77.js";import{P as h}from"./p-5534e08c.js";import{T as c}from"./p-c2beb95c.js";import{s as u}from"./p-6dc031de.js";import{S as v}from"./p-fa9d3f73.js";import{SelectionMode as g}from"@sankhyalabs/core/dist/dataunit/DataUnit";import"./p-847e6c20.js";import"./p-44e66c8d.js";import"./p-112455b1.js";import"./p-f3b7b69e.js";import"./p-0fb83448.js";import"./p-584d7212.js";const m=class{constructor(s){i(this,s),this.actionClick=t(this,"actionClick",7),this.gridDoubleClick=t(this,"gridDoubleClick",7),this._multiSelectionListDataSource=new v,this._topTaskbarProcessor=new c({"snkGridTopTaskbar.regular":["FORM_MODE","CONFIGURATOR","INSERT"],"snkGridTopTaskbar.regular.secondary":["FORM_MODE","CONFIGURATOR","INSERT"],"snkGridTopTaskbar.finish_edition":["CANCEL","SAVE"],"snkGridTopTaskbar.finish_edition.secondary":[]}),this._headerTaskbarProcessor=new c({"snkGridHeaderTaskbar.unselected":["REFRESH","DATA_EXPORTER","ACTIONS_BUTTON"],"snkGridHeaderTaskbar.selected":["UPDATE","CLONE","REMOVE","MORE_OPTIONS","DIVIDER","ATTACH","REFRESH","DATA_EXPORTER","ACTIONS_BUTTON"],"snkGridHeaderTaskbar.detail.unselected":["REFRESH"],"snkGridHeaderTaskbar.detail.selected":["UPDATE","ATTACH","CLONE","REMOVE","MORE_OPTIONS","DIVIDER","REFRESH"]}),this._dataUnit=void 0,this._dataState=void 0,this._gridConfig=void 0,this._popUpGridConfig=!1,this.configName=void 0,this.selectionToastConfig=void 0,this.actionsList=void 0,this.isDetail=void 0,this.taskbarManager=void 0,this.statusResolver=void 0,this.multipleSelection=void 0,this.presentationMode=h.PRIMARY,this.messagesBuilder=void 0}async showConfig(){null!=this._grid&&this.openGridConfig()}async hideConfig(){null!=this._grid&&this.closeGridConfig()}async setConfig(i){this.setGridConfig(i)}async reloadFilterBar(){var i;null===(i=this._snkFilterBar)||void 0===i||i.reload()}openGridConfig(){this._grid.getColumnsState().then((i=>{this._snkGridConfig.columns=i.filter((i=>i.name)),this._snkGridConfig.selectedIndex=0,this._popUpGridConfig=!0}))}closeGridConfig(){this._popUpGridConfig=!1}setGridConfig(i){this._gridConfig=i}loadConfig(){l.get().then((i=>{i.loadGridConfig(this.configName).then((i=>{this.setGridConfig(i)})).catch((i=>{console.warn(i)}))}))}gridConfigChangeHandler(i){l.saveGridConfig(i.detail,this.configName),i.stopPropagation()}modalConfigChangeHandler(i){const t=i.detail;this._grid.setColumnsState(t.columns).then((()=>{this.setGridConfig(t),this.closeGridConfig(),this.dataExporterProviderStore()})),i.stopPropagation()}buildColumnsMetadata(i){const t=[];return null==i||i.forEach((i=>{var s,e;if(i.hidden&&"RECDESP"!==i.name)return;const d=null===(s=this._dataUnit)||void 0===s?void 0:s.getField(i.name);if(t.push({label:i.label,id:i.name,width:i.width,type:null==d?void 0:d.dataType,userInterface:null==d?void 0:d.userInterface}),null!=(null===(e=null==d?void 0:d.properties)||void 0===e?void 0:e.DESCRIPTIONFIELD)){const i=d.properties.mergedFrom;t.push({label:d.properties.DESCRIPTIONENTITY,id:`${i?i+".":""}${d.properties.ENTITYNAME}.${d.properties.DESCRIPTIONFIELD}`,width:200,type:a.TEXT,userInterface:n.LONGTEXT})}})),t||[]}getPaginationInfo(){var i;return null===(i=this._dataUnit)||void 0===i?void 0:i.getPaginationInfo()}getExporterOffset(i){if(null==i)return;const t=i.firstRecord;return t>0?t-1:t}async dataExporterProviderStore(){var i;const t=await(null===(i=this._snkDataUnit)||void 0===i?void 0:i.getSelectedRecordsIDsInfo()),s={getFilters:()=>{var i;return null===(i=this._dataUnit)||void 0===i?void 0:i.getAppliedFilters()},getColumnsMetadata:async()=>{var i;const t=await(null===(i=this._grid)||void 0===i?void 0:i.getColumnsState());return this.buildColumnsMetadata(t)},getOrders:()=>{var i;return null===(i=this._dataUnit)||void 0===i?void 0:i.getSort()},getResourceURI:()=>{var i;return null===(i=this._dataUnit)||void 0===i?void 0:i.name},getSelectedNumber:()=>{var i,t;return null===(t=null===(i=this._dataState)||void 0===i?void 0:i.selectionInfo)||void 0===t?void 0:t.length},getTotalRecords:()=>{var i,t,s;const{total:e}=(null===(i=this._dataUnit)||void 0===i?void 0:i.getPaginationInfo())||{};return null!=e?e:null===(s=null===(t=this._dataUnit)||void 0===t?void 0:t.records)||void 0===s?void 0:s.length},getSelectedIDs:()=>t||[],getOffset:()=>this.getExporterOffset(this.getPaginationInfo()),getLimit:()=>{var i;return null===(i=this._dataUnit)||void 0===i?void 0:i.pageSize},getRecordID:()=>{var i,t,s;return null===(s=null===(t=null===(i=this._dataUnit)||void 0===i?void 0:i.records)||void 0===t?void 0:t[0])||void 0===s?void 0:s.__record__id__}};u.set("exporterProviders",Object.assign(Object.assign({},u.get("exporterProviders")),{[this.configName]:s}))}addElementID(){d.addIDInfo(this._element,null,{dataUnit:this._dataUnit})}finshLoading(){this._dataUnitLoadLockerResolver=this._dataUnit.addLoadingLocker(),this.addElementID(),this._multiSelectionListDataSource.setApplication(this._application),this._multiSelectionListDataSource.setDataUnit(this._dataUnit)}componentWillLoad(){this._application=r.getContextValue("__SNK__APPLICATION__");let i=this._element.parentElement;for(;i;){if("SNK-DATA-UNIT"===i.tagName.toUpperCase()){this._snkDataUnit=i,this._dataUnit=this._snkDataUnit.dataUnit,this._dataUnit?this.finshLoading():this._snkDataUnit.addEventListener("dataUnitReady",(i=>{this._dataUnit=i.detail,this.finshLoading()})),this.messagesBuilder||(this.messagesBuilder=this._snkDataUnit.messagesBuilder),this._snkDataUnit.addEventListener("dataStateChange",(i=>{this._dataState=i.detail})),this._snkDataUnit.addEventListener("cancelEdition",(()=>{var i;(null===(i=this._dataState)||void 0===i?void 0:i.recordsIsEmpty)&&this._dataUnit.clearSelection()}));break}i=i.parentElement}this.loadConfig()}getHeaderDisabledButtons(){var i;const t=[];return(null===(i=this._dataState)||void 0===i?void 0:i.selectionInfo)&&(this._dataState.selectionInfo.length>1&&t.push(o.CLONE,"ATTACH"),this._dataState.selectionInfo.isAllRecords()&&t.push("REMOVE")),t}getInvisibleButtons(){let i=[];return this._dataUnit&&0!==this._dataUnit.records.length||i.push("DATA_EXPORTER"),this._dataState&&this._dataState.selectionInfo.mode===g.ALL_RECORDS&&i.push("ACTIONS_BUTTON"),i}componentWillRender(){var i;const t=this.getInvisibleButtons();let s;s=this._dataState&&(null===(i=this._dataState.selectionInfo)||void 0===i?void 0:i.length)?this.isDetail?"snkGridHeaderTaskbar.detail.selected":"snkGridHeaderTaskbar.selected":this.isDetail?"snkGridHeaderTaskbar.detail.unselected":"snkGridHeaderTaskbar.unselected",this._headerTaskbarProcessor.process(s,this.taskbarManager,this._dataState,this.getHeaderDisabledButtons(),t),this._topTaskbarProcessor.process(this.getTopTaskBarId(this.presentationMode===h.SECONDARY?".secondary":""),this.taskbarManager,this._dataState,void 0,t),this.dataExporterProviderStore()}getTopTaskBarId(i){var t;return(null===(t=this._dataState)||void 0===t?void 0:t.isDirty)?`snkGridTopTaskbar.finish_edition${i}`:`snkGridTopTaskbar.regular${i}`}getPrimaryButton(){return this.presentationMode===h.PRIMARY?"INSERT":""}onEzGridReady(){var i;null===(i=this._dataUnitLoadLockerResolver)||void 0===i||i.call(this),this._dataUnitLoadLockerResolver=void 0}render(){var i,t;if(this._dataUnit)return s("div",{class:"snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large"},s("div",{class:"snk-grid__header ez-margin-bottom--medium"},s("snk-filter-bar",{ref:i=>this._snkFilterBar=i,dataUnit:this._dataUnit,"data-element-id":"gridFilter",class:"snk-grid__filter-bar ez-align--top",configName:this.configName,messagesBuilder:this.messagesBuilder}),(null===(t=null===(i=this._snkFilterBar)||void 0===i?void 0:i.filterConfig)||void 0===t?void 0:t.length)>0&&s("hr",{class:"ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider"}),s("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()})),s("ez-grid",{ref:i=>this._grid=i,class:(this.presentationMode===h.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:i=>{this.gridConfigChangeHandler(i)},onEzDoubleClick:()=>this.gridDoubleClick.emit(),statusResolver:this.statusResolver,multipleSelection:this.multipleSelection,onComponentReady:()=>this.onEzGridReady(),columnfilterDataSource:this._multiSelectionListDataSource,selectionToastConfig:this.selectionToastConfig},s("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})),s("div",{class:"ez-col ez-col--sd-12"},s("slot",{name:"SnkGridFooter"})),s("ez-modal",{modalSize:"small",closeEsc:!1,closeOutsideClick:!1,opened:this._popUpGridConfig,onEzCloseModal:()=>this.closeGridConfig()},s("snk-grid-config",{ref:i=>this._snkGridConfig=i,config:this._gridConfig,"data-element-id":this._element.getAttribute(d.DATA_ELEMENT_ID_ATTRIBUTE_NAME),application:this._application,selectedIndex:0,configName:this.configName,onConfigChange:i=>this.modalConfigChangeHandler(i),onConfigCancel:()=>this.closeGridConfig()})))}get _element(){return e(this)}};m.style=".snk-grid__container.sc-snk-grid{display:flex;height:100%;width:100%}.snk-grid__header.sc-snk-grid{display:flex;flex-wrap:nowrap;width:100%}.snk-grid__filter-bar.sc-snk-grid{width:100%}.snk-grid__header-divider.sc-snk-grid{margin-bottom:var(--space--medium)}.snk-grid__table.sc-snk-grid{min-height:300px}.snk-grid-container__without-shadow.sc-snk-grid{--ezgrid__container--shadow:unset}";export{m as snk_grid}
|
@@ -0,0 +1 @@
|
|
1
|
+
export{S as snk_guides_viewer}from"./p-5df17074.js";import"./p-d2d301a6.js";import"@sankhyalabs/core";import"./p-52c6b2e7.js";import"./p-5994af77.js";import"./p-847e6c20.js";import"./p-44e66c8d.js";import"./p-112455b1.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-f3b7b69e.js";import"./p-0fb83448.js";import"./p-584d7212.js";import"@sankhyalabs/ezui/dist/collection/utils/form";import"./p-c2beb95c.js";import"./p-a2493d11.js";import"./p-5534e08c.js";import"./p-6dc031de.js";import"./p-4a78e118.js";import"./p-9d18017a.js";import"@sankhyalabs/core/dist/dataunit/DataUnit";
|