@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-50737.1 → 0.0.0-bugfix-dev-KB-53946.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-8d4e9d53.js → ConfigStorage-085c7117.js} +11 -12
- package/dist/cjs/{SnkMultiSelectionListDataSource-1438f8f2.js → IExporterProvider-f50b6846.js} +52 -5
- package/dist/cjs/RecordIDUtils-3735135c.js +43 -0
- package/dist/cjs/{SnkFormConfigManager-33995e92.js → SnkFormConfigManager-8986431f.js} +2 -2
- package/dist/cjs/{SnkMessageBuilder-141aa18d.js → SnkMessageBuilder-66aa2557.js} +4 -0
- package/dist/cjs/{auth-fetcher-bb8e9ae4.js → auth-fetcher-eddaf17f.js} +1 -1
- package/dist/cjs/{DataFetcher-99f0f6ed.js → form-config-fetcher-cdd644a7.js} +251 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-94f6b316.js → pesquisa-fetcher-90b801fb.js} +79 -55
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +9 -9
- package/dist/cjs/snk-application.cjs.entry.js +24 -24
- package/dist/cjs/snk-attach.cjs.entry.js +73 -52
- package/dist/cjs/snk-crud.cjs.entry.js +5 -5
- package/dist/cjs/snk-data-exporter.cjs.entry.js +199 -81
- package/dist/cjs/{snk-data-unit-6026a9f7.js → snk-data-unit-abd2113f.js} +3 -38
- package/dist/cjs/snk-data-unit.cjs.entry.js +3 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +8 -8
- package/dist/cjs/snk-filter-bar.cjs.entry.js +7 -3
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +2 -3
- package/dist/cjs/snk-form-config.cjs.entry.js +1 -2
- package/dist/cjs/snk-form.cjs.entry.js +3 -4
- package/dist/cjs/snk-grid.cjs.entry.js +66 -102
- package/dist/cjs/{snk-guides-viewer-25721856.js → snk-guides-viewer-e4c8ee66.js} +4 -5
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +2 -3
- package/dist/cjs/snk-simple-crud.cjs.entry.js +144 -36
- package/dist/cjs/snk-taskbar.cjs.entry.js +27 -4
- package/dist/cjs/{taskbar-elements-3ecd1278.js → taskbar-elements-d9392685.js} +2 -2
- package/dist/collection/components/snk-attach/snk-attach.js +39 -24
- package/dist/collection/components/snk-attach/structure/builder/attach-crud-config.builder.js +1 -1
- package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +29 -22
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +90 -0
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +68 -0
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +48 -1
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterStrategy.js +1 -0
- package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +53 -0
- package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +55 -0
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +37 -47
- package/dist/collection/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.js +88 -0
- package/dist/collection/components/snk-data-exporter/utils/RecordIDUtils.js +38 -0
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +3 -42
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +5 -0
- package/dist/collection/components/snk-grid/snk-grid.js +3 -94
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.css +5 -2
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +126 -14
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +2 -2
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +30 -3
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +10 -41
- package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +33 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +3 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.js +4 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +10 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +1 -0
- package/dist/collection/lib/message/resources/snk-simple-crud.msg.js +4 -0
- package/dist/components/ConfigStorage.js +1 -2
- package/dist/components/{field-search.js → IExporterProvider.js} +52 -7
- package/dist/components/ISave.js +42 -0
- package/dist/components/SnkMessageBuilder.js +4 -0
- package/dist/components/dataunit-fetcher.js +61 -44
- package/dist/components/form-config-fetcher.js +7022 -3
- package/dist/components/index2.js +198 -33
- package/dist/components/snk-actions-button2.js +3 -12
- package/dist/components/snk-application2.js +1 -1
- package/dist/components/snk-attach2.js +64 -44
- package/dist/components/snk-crud.js +3 -4
- package/dist/components/snk-data-exporter2.js +194 -81
- package/dist/components/snk-data-unit2.js +41 -39
- package/dist/components/snk-detail-view2.js +4 -5
- package/dist/components/snk-expression-item2.js +1 -1
- package/dist/components/snk-filter-bar2.js +5 -0
- package/dist/components/snk-form-config2.js +1 -1
- package/dist/components/snk-grid2.js +63 -100
- package/dist/components/snk-personalized-filter2.js +1 -1
- package/dist/components/snk-simple-crud2.js +133 -23
- package/dist/components/snk-taskbar2.js +33 -8
- package/dist/esm/{ConfigStorage-6e241cd7.js → ConfigStorage-cc3f3dd3.js} +1 -2
- package/dist/esm/{SnkMultiSelectionListDataSource-aad5d4ff.js → IExporterProvider-9e6e0071.js} +52 -6
- package/dist/esm/RecordIDUtils-87d02110.js +41 -0
- package/dist/esm/{SnkFormConfigManager-7a4e678f.js → SnkFormConfigManager-7edda7eb.js} +2 -2
- package/dist/esm/{SnkMessageBuilder-9747ddd2.js → SnkMessageBuilder-0a4becdd.js} +4 -0
- package/dist/esm/{auth-fetcher-8ec448b0.js → auth-fetcher-11dd9cae.js} +1 -1
- package/dist/esm/{DataFetcher-a650ae58.js → form-config-fetcher-13cd3285.js} +250 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-f05a12ca.js → pesquisa-fetcher-d785663b.js} +61 -44
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +4 -4
- package/dist/esm/snk-application.entry.js +6 -6
- package/dist/esm/snk-attach.entry.js +65 -44
- package/dist/esm/snk-crud.entry.js +5 -5
- package/dist/esm/snk-data-exporter.entry.js +199 -81
- package/dist/esm/{snk-data-unit-4c343635.js → snk-data-unit-29eba11a.js} +4 -39
- package/dist/esm/snk-data-unit.entry.js +3 -2
- package/dist/esm/snk-detail-view.entry.js +8 -8
- package/dist/esm/snk-filter-bar.entry.js +7 -3
- package/dist/esm/snk-filter-modal-item.entry.js +2 -3
- package/dist/esm/snk-form-config.entry.js +1 -2
- package/dist/esm/snk-form.entry.js +3 -4
- package/dist/esm/snk-grid.entry.js +64 -100
- package/dist/esm/{snk-guides-viewer-b94752f2.js → snk-guides-viewer-8fc16590.js} +4 -5
- package/dist/esm/snk-guides-viewer.entry.js +7 -7
- package/dist/esm/snk-personalized-filter.entry.js +2 -3
- package/dist/esm/snk-simple-crud.entry.js +132 -24
- package/dist/esm/snk-taskbar.entry.js +27 -4
- package/dist/esm/{taskbar-elements-2473c8ac.js → taskbar-elements-ad766858.js} +2 -2
- package/dist/sankhyablocks/p-07825198.js +1 -0
- package/dist/sankhyablocks/p-0ba97458.js +65 -0
- package/dist/sankhyablocks/p-1650f66b.entry.js +1 -0
- package/dist/sankhyablocks/p-1d1aa052.js +1 -0
- package/dist/sankhyablocks/p-1d9d07b4.entry.js +1 -0
- package/dist/sankhyablocks/p-250149af.entry.js +1 -0
- package/dist/sankhyablocks/p-2cfa05b0.entry.js +1 -0
- package/dist/sankhyablocks/{p-400097f2.entry.js → p-2daa70f9.entry.js} +3 -3
- package/dist/sankhyablocks/p-32556aa6.js +1 -0
- package/dist/sankhyablocks/p-33a6728e.js +26 -0
- package/dist/sankhyablocks/p-5b6c4f46.entry.js +1 -0
- package/dist/sankhyablocks/p-5d9456dc.js +1 -0
- package/dist/sankhyablocks/{p-0624f62d.js → p-8a4c4b54.js} +6 -6
- package/dist/sankhyablocks/p-9863d682.js +1 -0
- package/dist/sankhyablocks/{p-125bb902.js → p-99b51d06.js} +1 -1
- package/dist/sankhyablocks/p-9c283890.entry.js +1 -0
- package/dist/sankhyablocks/p-9ee96756.entry.js +1 -0
- package/dist/sankhyablocks/p-a4c94582.entry.js +1 -0
- package/dist/sankhyablocks/p-c2e3a71c.entry.js +1 -0
- package/dist/sankhyablocks/p-c2f3ebf3.entry.js +1 -0
- package/dist/sankhyablocks/p-ce37e3d3.entry.js +1 -0
- package/dist/sankhyablocks/p-cfb98f51.entry.js +1 -0
- package/dist/sankhyablocks/{p-efeca7ba.js → p-d24c9dc6.js} +1 -1
- package/dist/sankhyablocks/p-edd9dd1c.entry.js +1 -0
- package/dist/sankhyablocks/p-f51af6dd.entry.js +1 -0
- package/dist/sankhyablocks/p-fa84e72f.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-attach/snk-attach.d.ts +2 -1
- package/dist/types/components/snk-attach/structure/builder/attach-crud-config.builder.d.ts +10 -1
- package/dist/types/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.d.ts +5 -4
- package/dist/types/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.d.ts +13 -0
- package/dist/types/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.d.ts +11 -0
- package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +21 -4
- package/dist/types/components/snk-data-exporter/interfaces/IExporterStrategy.d.ts +5 -0
- package/dist/types/components/snk-data-exporter/providers/ClientSideExporterProvider.d.ts +17 -0
- package/dist/types/components/snk-data-exporter/providers/ServerSideExporterProvider.d.ts +17 -0
- package/dist/types/components/snk-data-exporter/snk-data-exporter.d.ts +3 -1
- package/dist/types/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.d.ts +77 -0
- package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +3 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +1 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +0 -3
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +17 -2
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +1 -1
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +6 -0
- package/dist/types/components.d.ts +17 -0
- package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +0 -2
- package/dist/types/lib/dataUnit/dataUnitInMemoryUtils.d.ts +4 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.d.ts +2 -1
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/form-config-fetcher-d73f4449.js +0 -256
- package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/index.js +0 -34
- package/dist/components/DataFetcher.js +0 -7023
- package/dist/components/index3.js +0 -199
- package/dist/esm/form-config-fetcher-765b8498.js +0 -253
- package/dist/sankhyablocks/p-004c356e.js +0 -26
- package/dist/sankhyablocks/p-0bba5c9f.entry.js +0 -1
- package/dist/sankhyablocks/p-1048bd26.entry.js +0 -1
- package/dist/sankhyablocks/p-20b46647.entry.js +0 -1
- package/dist/sankhyablocks/p-24ed6ad6.entry.js +0 -1
- package/dist/sankhyablocks/p-2936303b.js +0 -1
- package/dist/sankhyablocks/p-6c9adfca.js +0 -1
- package/dist/sankhyablocks/p-85af23fe.entry.js +0 -1
- package/dist/sankhyablocks/p-85ba3d6b.entry.js +0 -1
- package/dist/sankhyablocks/p-88b29791.js +0 -1
- package/dist/sankhyablocks/p-9a5d1b39.js +0 -1
- package/dist/sankhyablocks/p-9e8618ec.entry.js +0 -1
- package/dist/sankhyablocks/p-a043314f.entry.js +0 -1
- package/dist/sankhyablocks/p-a1642e7c.entry.js +0 -1
- package/dist/sankhyablocks/p-ac77949b.entry.js +0 -1
- package/dist/sankhyablocks/p-b47c2963.entry.js +0 -1
- package/dist/sankhyablocks/p-be75153c.js +0 -1
- package/dist/sankhyablocks/p-bf39bdb8.entry.js +0 -1
- package/dist/sankhyablocks/p-d304659d.entry.js +0 -1
- package/dist/sankhyablocks/p-d5cb4b5a.entry.js +0 -1
- package/dist/sankhyablocks/p-d78d4062.js +0 -65
- package/dist/sankhyablocks/p-e7dbe53a.entry.js +0 -1
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/index.d.ts +0 -3
- /package/dist/sankhyablocks/{p-ae4fc9a9.js → p-61dd89eb.js} +0 -0
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Fragment } from '@stencil/core/internal/client';
|
|
2
|
-
import { ElementIDUtils, ApplicationContext, StringUtils
|
|
3
|
-
import { UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
2
|
+
import { ElementIDUtils, ApplicationContext, StringUtils } from '@sankhyalabs/core';
|
|
4
3
|
import { d as defineCustomElement$2, T as TaskbarElement } from './snk-taskbar2.js';
|
|
5
4
|
import { C as ConfigStorage } from './ConfigStorage.js';
|
|
6
|
-
import { P as PresentationMode } from './
|
|
7
|
-
import { T as TaskbarProcessor, S as SnkMultiSelectionListDataSource, o as openFieldSearch,
|
|
8
|
-
import { s as store } from './
|
|
5
|
+
import { P as PresentationMode } from './ISave.js';
|
|
6
|
+
import { C as CommonsExporter, T as TaskbarProcessor, S as SnkMultiSelectionListDataSource, o as openFieldSearch, a as CrudUtils, b as buildFieldSearch } from './IExporterProvider.js';
|
|
7
|
+
import { s as store } from './index2.js';
|
|
9
8
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
|
10
|
-
import './
|
|
9
|
+
import './form-config-fetcher.js';
|
|
11
10
|
import './dataunit-fetcher.js';
|
|
12
|
-
import { d as defineCustomElement$i } from './snk-actions-button2.js';
|
|
13
11
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
12
|
+
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
14
13
|
import './filter-item-type.enum.js';
|
|
15
|
-
import './
|
|
14
|
+
import { g as getSelectedIDs } from './snk-data-unit2.js';
|
|
15
|
+
import { d as defineCustomElement$i } from './snk-actions-button2.js';
|
|
16
16
|
import { d as defineCustomElement$h } from './snk-data-exporter2.js';
|
|
17
17
|
import { d as defineCustomElement$g } from './snk-exporter-email-sender2.js';
|
|
18
18
|
import { d as defineCustomElement$f } from './snk-expression-group2.js';
|
|
@@ -30,6 +30,60 @@ import { d as defineCustomElement$4 } from './snk-select-box2.js';
|
|
|
30
30
|
import { d as defineCustomElement$3 } from './snk-simple-bar2.js';
|
|
31
31
|
import { d as defineCustomElement$1 } from './taskbar-actions-button2.js';
|
|
32
32
|
|
|
33
|
+
class ServerSideExporterProvider extends CommonsExporter {
|
|
34
|
+
getFilters() {
|
|
35
|
+
var _a;
|
|
36
|
+
return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getAppliedFilters();
|
|
37
|
+
}
|
|
38
|
+
getOrders() {
|
|
39
|
+
var _a;
|
|
40
|
+
return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSort();
|
|
41
|
+
}
|
|
42
|
+
getResourceURI() {
|
|
43
|
+
var _a;
|
|
44
|
+
return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.name;
|
|
45
|
+
}
|
|
46
|
+
getSelectedNumber() {
|
|
47
|
+
return this.dataUnit.getSelectionInfo().length;
|
|
48
|
+
}
|
|
49
|
+
getTotalRecords() {
|
|
50
|
+
var _a, _b, _c;
|
|
51
|
+
const { total } = ((_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo()) || {};
|
|
52
|
+
return total !== null && total !== void 0 ? total : (_c = (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.records) === null || _c === void 0 ? void 0 : _c.length;
|
|
53
|
+
}
|
|
54
|
+
getSelectedIDs() {
|
|
55
|
+
return getSelectedIDs(this.dataUnit);
|
|
56
|
+
}
|
|
57
|
+
getOffset() {
|
|
58
|
+
return this.getExporterOffset(this.getPaginationInfo());
|
|
59
|
+
}
|
|
60
|
+
getPageSize() {
|
|
61
|
+
var _a;
|
|
62
|
+
return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.pageSize;
|
|
63
|
+
}
|
|
64
|
+
getExportLimit() {
|
|
65
|
+
return 5000;
|
|
66
|
+
}
|
|
67
|
+
getRecordID() {
|
|
68
|
+
var _a, _b, _c;
|
|
69
|
+
return (_c = (_b = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.records) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.__record__id__;
|
|
70
|
+
}
|
|
71
|
+
getPaginationInfo() {
|
|
72
|
+
var _a;
|
|
73
|
+
return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo();
|
|
74
|
+
}
|
|
75
|
+
getExporterOffset(paginationInfo) {
|
|
76
|
+
if (paginationInfo == undefined) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const offset = paginationInfo.firstRecord;
|
|
80
|
+
if (offset > 0) {
|
|
81
|
+
return (offset - 1);
|
|
82
|
+
}
|
|
83
|
+
return offset;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
33
87
|
const snkGridCss = ".sc-snk-grid-h{--snk-grid-min-height:300px}.snk-grid__container.sc-snk-grid{display:flex;height:100%;width:100%}.snk-grid__header.sc-snk-grid{width:100%;display:flex;flex-wrap:nowrap;justify-content:flex-end}.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:var(--snk-grid-min-height)}.snk-grid-container__without-shadow.sc-snk-grid{--ezgrid__container--shadow:unset}";
|
|
34
88
|
|
|
35
89
|
const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
@@ -181,99 +235,8 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
181
235
|
});
|
|
182
236
|
evt.stopPropagation();
|
|
183
237
|
}
|
|
184
|
-
buildColumnsMetadata(gridColumns) {
|
|
185
|
-
const columnsMetadata = [];
|
|
186
|
-
gridColumns === null || gridColumns === void 0 ? void 0 : gridColumns.forEach((column) => {
|
|
187
|
-
var _a, _b;
|
|
188
|
-
/**
|
|
189
|
-
* TODO: Analisar e criar uma melhor forma de tratar essa validação do "RECDESP".
|
|
190
|
-
*/
|
|
191
|
-
if (column.hidden && column.name !== "RECDESP") {
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
const fieldData = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getField(column.name);
|
|
195
|
-
const columnData = {
|
|
196
|
-
label: column.label,
|
|
197
|
-
id: column.name,
|
|
198
|
-
width: column.width,
|
|
199
|
-
type: fieldData === null || fieldData === void 0 ? void 0 : fieldData.dataType,
|
|
200
|
-
userInterface: fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface
|
|
201
|
-
};
|
|
202
|
-
columnsMetadata.push(columnData);
|
|
203
|
-
if (((_b = fieldData === null || fieldData === void 0 ? void 0 : fieldData.properties) === null || _b === void 0 ? void 0 : _b.DESCRIPTIONFIELD) != undefined) {
|
|
204
|
-
const mergedFrom = fieldData.properties.mergedFrom;
|
|
205
|
-
const descriptionField = `${fieldData.properties.ENTITYNAME}.${fieldData.properties.DESCRIPTIONFIELD}`;
|
|
206
|
-
const descriptionColumn = {
|
|
207
|
-
label: fieldData.properties.DESCRIPTIONENTITY,
|
|
208
|
-
id: `${mergedFrom ? (mergedFrom + ".") : ""}${descriptionField}`,
|
|
209
|
-
width: 200,
|
|
210
|
-
type: DataType.TEXT,
|
|
211
|
-
userInterface: UserInterface.LONGTEXT
|
|
212
|
-
};
|
|
213
|
-
columnsMetadata.push(descriptionColumn);
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
return columnsMetadata || [];
|
|
217
|
-
}
|
|
218
|
-
getPaginationInfo() {
|
|
219
|
-
var _a;
|
|
220
|
-
return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo();
|
|
221
|
-
}
|
|
222
|
-
getExporterOffset(paginationInfo) {
|
|
223
|
-
if (paginationInfo == undefined) {
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
const offset = paginationInfo.firstRecord;
|
|
227
|
-
if (offset > 0) {
|
|
228
|
-
return (offset - 1);
|
|
229
|
-
}
|
|
230
|
-
return offset;
|
|
231
|
-
}
|
|
232
238
|
async dataExporterProviderStore() {
|
|
233
|
-
|
|
234
|
-
const selectedIDs = await ((_a = this._snkDataUnit) === null || _a === void 0 ? void 0 : _a.getSelectedRecordsIDsInfo());
|
|
235
|
-
const dataExporterProvider = {
|
|
236
|
-
getFilters: () => {
|
|
237
|
-
var _a;
|
|
238
|
-
return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getAppliedFilters();
|
|
239
|
-
},
|
|
240
|
-
getColumnsMetadata: async () => {
|
|
241
|
-
var _a;
|
|
242
|
-
const columnsState = await ((_a = this._grid) === null || _a === void 0 ? void 0 : _a.getColumnsState());
|
|
243
|
-
return this.buildColumnsMetadata(columnsState);
|
|
244
|
-
},
|
|
245
|
-
getOrders: () => {
|
|
246
|
-
var _a;
|
|
247
|
-
return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getSort();
|
|
248
|
-
},
|
|
249
|
-
getResourceURI: () => {
|
|
250
|
-
var _a;
|
|
251
|
-
return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.name;
|
|
252
|
-
},
|
|
253
|
-
getSelectedNumber: () => {
|
|
254
|
-
var _a, _b;
|
|
255
|
-
return (_b = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectionInfo) === null || _b === void 0 ? void 0 : _b.length;
|
|
256
|
-
},
|
|
257
|
-
getTotalRecords: () => {
|
|
258
|
-
var _a, _b, _c;
|
|
259
|
-
const { total } = ((_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo()) || {};
|
|
260
|
-
return total !== null && total !== void 0 ? total : (_c = (_b = this._dataUnit) === null || _b === void 0 ? void 0 : _b.records) === null || _c === void 0 ? void 0 : _c.length;
|
|
261
|
-
},
|
|
262
|
-
getSelectedIDs: () => {
|
|
263
|
-
return selectedIDs || [];
|
|
264
|
-
},
|
|
265
|
-
getOffset: () => {
|
|
266
|
-
return this.getExporterOffset(this.getPaginationInfo());
|
|
267
|
-
},
|
|
268
|
-
getLimit: () => {
|
|
269
|
-
var _a;
|
|
270
|
-
return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.pageSize;
|
|
271
|
-
},
|
|
272
|
-
getRecordID: () => {
|
|
273
|
-
var _a, _b, _c;
|
|
274
|
-
return (_c = (_b = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.records) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.__record__id__;
|
|
275
|
-
}
|
|
276
|
-
};
|
|
239
|
+
const dataExporterProvider = new ServerSideExporterProvider(this._dataUnit, this._grid);
|
|
277
240
|
store.set("exporterProviders", Object.assign(Object.assign({}, store.get("exporterProviders")), { [this.configName]: dataExporterProvider }));
|
|
278
241
|
}
|
|
279
242
|
addElementID() {
|
|
@@ -3,7 +3,7 @@ import { StringUtils, ObjectUtils, ApplicationContext, ElementIDUtils } from '@s
|
|
|
3
3
|
import { F as FilterGroupCondition, P as PersonalizedFilterUtils } from './PersonalizedFilterUtils.js';
|
|
4
4
|
import { P as PersonalizedFilterFetcher, C as ConfigStorage } from './ConfigStorage.js';
|
|
5
5
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
6
|
-
import { s as store } from './
|
|
6
|
+
import { s as store } from './index2.js';
|
|
7
7
|
import { d as defineCustomElement$7 } from './snk-expression-group2.js';
|
|
8
8
|
import { d as defineCustomElement$6 } from './snk-expression-item2.js';
|
|
9
9
|
import { d as defineCustomElement$5 } from './snk-filter-advanced-mode2.js';
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import { StringUtils, ApplicationContext, ObjectUtils, DataType,
|
|
2
|
+
import { UserInterface, StringUtils, ApplicationContext, ObjectUtils, DataType, JSUtils, FloatingManager, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
|
+
import { CSSVarsUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
3
4
|
import { V as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants.js';
|
|
4
5
|
import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
|
|
5
|
-
import './
|
|
6
|
+
import { F as FormConfigFetcher } from './form-config-fetcher.js';
|
|
6
7
|
import { I as InMemoryLoader } from './dataunit-fetcher.js';
|
|
7
|
-
import { S as SnkMultiSelectionListDataSource, T as TaskbarProcessor, b as buildFieldSearch, o as openFieldSearch,
|
|
8
|
-
import { P as PresentationMode } from './
|
|
9
|
-
import { d as defineCustomElement$d } from './snk-actions-button2.js';
|
|
8
|
+
import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, T as TaskbarProcessor, b as buildFieldSearch, o as openFieldSearch, a as CrudUtils } from './IExporterProvider.js';
|
|
9
|
+
import { D as DataExporterOption, P as PresentationMode } from './ISave.js';
|
|
10
10
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
11
11
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
12
12
|
import './filter-item-type.enum.js';
|
|
13
|
-
import { F as FormConfigFetcher } from './form-config-fetcher.js';
|
|
14
13
|
import { C as ConfigStorage } from './ConfigStorage.js';
|
|
15
14
|
import { S as SnkFormConfigManager } from './SnkFormConfigManager.js';
|
|
15
|
+
import { g as getSelectedIDs, d as defineCustomElement$9 } from './snk-data-unit2.js';
|
|
16
|
+
import { s as store } from './index2.js';
|
|
17
|
+
import { d as defineCustomElement$d } from './snk-actions-button2.js';
|
|
16
18
|
import { d as defineCustomElement$c } from './snk-config-options2.js';
|
|
17
19
|
import { d as defineCustomElement$b } from './snk-configurator2.js';
|
|
18
20
|
import { d as defineCustomElement$a } from './snk-data-exporter2.js';
|
|
19
|
-
import { d as defineCustomElement$9 } from './snk-data-unit2.js';
|
|
20
21
|
import { d as defineCustomElement$8 } from './snk-exporter-email-sender2.js';
|
|
21
22
|
import { d as defineCustomElement$7 } from './snk-field-config2.js';
|
|
22
23
|
import { d as defineCustomElement$6 } from './snk-form-config2.js';
|
|
@@ -28,7 +29,57 @@ import { d as defineCustomElement$1 } from './taskbar-actions-button2.js';
|
|
|
28
29
|
const REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "MORE_OPTIONS"];
|
|
29
30
|
const REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER", "MORE_OPTIONS"];
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
class ClientSideExporterProvider extends CommonsExporter {
|
|
33
|
+
getSelectedNumber() {
|
|
34
|
+
return this.dataUnit.getSelectionInfo().length;
|
|
35
|
+
}
|
|
36
|
+
getTotalRecords() {
|
|
37
|
+
var _a, _b, _c;
|
|
38
|
+
const { total } = ((_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo()) || {};
|
|
39
|
+
return total !== null && total !== void 0 ? total : (_c = (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.records) === null || _c === void 0 ? void 0 : _c.length;
|
|
40
|
+
}
|
|
41
|
+
getSelectedIDs() {
|
|
42
|
+
return getSelectedIDs(this.dataUnit);
|
|
43
|
+
}
|
|
44
|
+
getRecordID() {
|
|
45
|
+
var _a, _b, _c;
|
|
46
|
+
return (_c = (_b = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.records) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.__record__id__;
|
|
47
|
+
}
|
|
48
|
+
async getRecords() {
|
|
49
|
+
if (this.dataUnit.records.length === 0) {
|
|
50
|
+
return Promise.resolve([]);
|
|
51
|
+
}
|
|
52
|
+
const selectionInfo = this.dataUnit.getSelectionInfo();
|
|
53
|
+
const records = selectionInfo.isEmpty() || selectionInfo.isAllRecords() ? await selectionInfo.getAllRecords() : selectionInfo.records;
|
|
54
|
+
return Promise.resolve(records == undefined ? [] : records);
|
|
55
|
+
}
|
|
56
|
+
getHiddenOptions() {
|
|
57
|
+
return [
|
|
58
|
+
DataExporterOption.EXPORT_BY_EMAIL,
|
|
59
|
+
DataExporterOption.EXPORT_PDF_TO_EMAIL,
|
|
60
|
+
DataExporterOption.EXPORT_XLS_TO_EMAIL,
|
|
61
|
+
DataExporterOption.EXPORT_PAGE_TO_PDF,
|
|
62
|
+
DataExporterOption.EXPORT_PAGE_TO_XLS
|
|
63
|
+
];
|
|
64
|
+
}
|
|
65
|
+
formatValue(record, column) {
|
|
66
|
+
const { id, descriptionFrom } = column;
|
|
67
|
+
const value = record[descriptionFrom || id];
|
|
68
|
+
if (value == undefined) {
|
|
69
|
+
return "";
|
|
70
|
+
}
|
|
71
|
+
if (descriptionFrom != undefined) {
|
|
72
|
+
return value.label;
|
|
73
|
+
}
|
|
74
|
+
const fieldDescriptor = this.dataUnit.getField(id);
|
|
75
|
+
if (fieldDescriptor.userInterface === UserInterface.SEARCH) {
|
|
76
|
+
return value.value;
|
|
77
|
+
}
|
|
78
|
+
return this.dataUnit.getFormattedValue(id, value);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const snkSimpleCrudCss = ".sc-snk-simple-crud-h{display:flex;height:100%;width:100%;--snk-simple-crud-grid--min-height:300px}.simple-crud__container.sc-snk-simple-crud{display:grid;grid-template-rows:auto 1fr;row-gap:12px;height:100%;width:100%}.simple-crud__container-section.sc-snk-simple-crud{flex-wrap:unset;flex-direction:column}.simple-crud__form--hidden.sc-snk-simple-crud{display:none}ez-grid.sc-snk-simple-crud{--ez-grid__container--shadow:none;--ez-grid--min-height:var(--snk-simple-crud-grid--min-height)}ez-form.sc-snk-simple-crud{min-height:300px}";
|
|
32
83
|
|
|
33
84
|
const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
34
85
|
constructor() {
|
|
@@ -44,10 +95,10 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
44
95
|
this._keyDownHandler = (event) => this.keyDownListener(event);
|
|
45
96
|
this._formConfigFetcher = new FormConfigFetcher();
|
|
46
97
|
this._taskbarProcessor = new TaskbarProcessor({
|
|
47
|
-
"snkSimpleCrudTaskbar.form_regular": this.getButtons(false, TaskbarElement.GRID_MODE),
|
|
48
|
-
"snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, TaskbarElement.FORM_MODE),
|
|
49
|
-
"snkSimpleCrudTaskbar.form_selected": this.getButtons(true, TaskbarElement.GRID_MODE),
|
|
50
|
-
"snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, TaskbarElement.FORM_MODE),
|
|
98
|
+
"snkSimpleCrudTaskbar.form_regular": this.getButtons(false, [TaskbarElement.GRID_MODE]),
|
|
99
|
+
"snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]),
|
|
100
|
+
"snkSimpleCrudTaskbar.form_selected": this.getButtons(true, [TaskbarElement.GRID_MODE]),
|
|
101
|
+
"snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]),
|
|
51
102
|
"snkSimpleCrudTaskbar.finish_edition": ["CANCEL", "SAVE"]
|
|
52
103
|
});
|
|
53
104
|
this._showPopUpGridConfig = false;
|
|
@@ -58,12 +109,14 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
58
109
|
this._customContainerId = `SNK-SIMPLE-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
|
|
59
110
|
this.dataState = undefined;
|
|
60
111
|
this.dataUnit = undefined;
|
|
112
|
+
this.entityName = undefined;
|
|
61
113
|
this.mode = SIMPLE_CRUD_MODE.SERVER;
|
|
62
114
|
this.gridConfig = undefined;
|
|
63
115
|
this.formConfig = undefined;
|
|
64
116
|
this._formFields = [];
|
|
65
117
|
this.multipleSelection = undefined;
|
|
66
118
|
this.useCancelConfirm = true;
|
|
119
|
+
this.pageSize = 150;
|
|
67
120
|
this.resourceID = undefined;
|
|
68
121
|
this.taskbarManager = undefined;
|
|
69
122
|
this.messagesBuilder = undefined;
|
|
@@ -85,9 +138,9 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
85
138
|
this.loadFormConfig(true);
|
|
86
139
|
this.loadGridConfig(true);
|
|
87
140
|
}
|
|
88
|
-
getButtons(selected,
|
|
141
|
+
getButtons(selected, extraButtons) {
|
|
89
142
|
return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
|
|
90
|
-
.concat(
|
|
143
|
+
.concat(extraButtons));
|
|
91
144
|
}
|
|
92
145
|
addConfigButton(buttons) {
|
|
93
146
|
if (this.configName === undefined) {
|
|
@@ -127,6 +180,12 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
127
180
|
}
|
|
128
181
|
evt.stopPropagation();
|
|
129
182
|
}
|
|
183
|
+
async onChangeEntityName(newValue) {
|
|
184
|
+
if (this.dataUnit)
|
|
185
|
+
return;
|
|
186
|
+
const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
187
|
+
this.dataUnit = await application.getDataUnit(newValue, null, null, this.configName);
|
|
188
|
+
}
|
|
130
189
|
onModeChange() {
|
|
131
190
|
if (this.mode == SIMPLE_CRUD_MODE.IN_MEMORY) {
|
|
132
191
|
this.initInMemoryDataUnit();
|
|
@@ -178,10 +237,15 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
178
237
|
this._showPopUpGridConfig = true;
|
|
179
238
|
});
|
|
180
239
|
}
|
|
181
|
-
openFormConfig() {
|
|
240
|
+
async openFormConfig() {
|
|
241
|
+
var _a, _b;
|
|
182
242
|
//No momento não daremos suporte para configuraçao de formulário quando houver legacy config
|
|
183
|
-
if (this.formLegacyConfigName)
|
|
243
|
+
if (this.formLegacyConfigName) {
|
|
244
|
+
const title = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.formConfigUnavaliable.title", undefined);
|
|
245
|
+
const message = (_b = this.messagesBuilder) === null || _b === void 0 ? void 0 : _b.getMessage("snkSimpleCrud.formConfigUnavaliable.message", undefined);
|
|
246
|
+
await this.application.alert(title, message);
|
|
184
247
|
return;
|
|
248
|
+
}
|
|
185
249
|
this._showFormConfig = true;
|
|
186
250
|
}
|
|
187
251
|
addGridLegacyConfigName() {
|
|
@@ -234,6 +298,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
234
298
|
}
|
|
235
299
|
async componentWillRender() {
|
|
236
300
|
this._resourceID = await this.application.getResourceID();
|
|
301
|
+
this.dataExporterProviderStore();
|
|
237
302
|
this._taskbarProcessor.process(this.getTaskBarId(), this.taskbarManager, this.dataState, this.getTaskBarDisabledButtons());
|
|
238
303
|
if (this.configName === undefined) {
|
|
239
304
|
return;
|
|
@@ -250,18 +315,21 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
250
315
|
this.onModeChange();
|
|
251
316
|
this.configDatasource();
|
|
252
317
|
}
|
|
318
|
+
componentDidLoad() {
|
|
319
|
+
CSSVarsUtils.applyVarsGrid(this._element, this._grid);
|
|
320
|
+
}
|
|
253
321
|
configDatasource() {
|
|
254
322
|
this._multiSelectionListDataSource.setApplication(this.application);
|
|
255
323
|
this._multiSelectionListDataSource.setDataUnit(this.dataUnit);
|
|
256
324
|
}
|
|
257
325
|
getTaskBarId() {
|
|
258
|
-
var _a, _b
|
|
326
|
+
var _a, _b;
|
|
259
327
|
if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
|
|
260
328
|
return "snkSimpleCrudTaskbar.finish_edition";
|
|
261
329
|
}
|
|
262
330
|
if (((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.selectionInfo) &&
|
|
263
331
|
!this.dataState.selectionInfo.isAllRecords() &&
|
|
264
|
-
|
|
332
|
+
this.dataState.selectionInfo.length > 0) {
|
|
265
333
|
return this._currentViewMode === VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_selected" : "snkSimpleCrudTaskbar.form_selected";
|
|
266
334
|
}
|
|
267
335
|
return this._currentViewMode === VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
|
|
@@ -306,6 +374,13 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
306
374
|
var _a;
|
|
307
375
|
(_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.close();
|
|
308
376
|
}
|
|
377
|
+
updateConfig() {
|
|
378
|
+
if (this._formConfigManager == undefined) {
|
|
379
|
+
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
|
380
|
+
}
|
|
381
|
+
this._formConfigManager.setConfig(this.formConfig);
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
309
384
|
processMetadata() {
|
|
310
385
|
const fieldsMetadataElem = this._element.querySelectorAll("snk-field-metadata");
|
|
311
386
|
const fieldMetadata = [];
|
|
@@ -494,9 +569,23 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
494
569
|
.then(() => {
|
|
495
570
|
this.setGridConfig(config);
|
|
496
571
|
this.closeGridConfig();
|
|
572
|
+
this.dataExporterProviderStore();
|
|
497
573
|
});
|
|
498
574
|
evt.stopPropagation();
|
|
499
575
|
}
|
|
576
|
+
async dataExporterProviderStore() {
|
|
577
|
+
if (this.dataUnit == undefined) {
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
if (this._grid == undefined) {
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
const dataExporterProvider = new ClientSideExporterProvider(this.dataUnit, this._grid);
|
|
584
|
+
store.set("exporterProviders", Object.assign(Object.assign({}, store.get("exporterProviders")), { [this.getDataExporterStoreKey()]: dataExporterProvider }));
|
|
585
|
+
}
|
|
586
|
+
getDataExporterStoreKey() {
|
|
587
|
+
return `SnkSimpleCrudDataExporter:${this.configName == undefined ? this.dataUnit.name : this.configName}`;
|
|
588
|
+
}
|
|
500
589
|
setGridConfig(config) {
|
|
501
590
|
this.gridConfig = config;
|
|
502
591
|
CrudUtils.assertDefaultSorting(this.gridConfig, this.dataUnit);
|
|
@@ -512,6 +601,15 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
512
601
|
closeFormConfig() {
|
|
513
602
|
this._showFormConfig = false;
|
|
514
603
|
}
|
|
604
|
+
getPageSize() {
|
|
605
|
+
if (this.mode === SIMPLE_CRUD_MODE.IN_MEMORY) {
|
|
606
|
+
return 0;
|
|
607
|
+
}
|
|
608
|
+
if (this.pageSize == undefined) {
|
|
609
|
+
return 150;
|
|
610
|
+
}
|
|
611
|
+
return this.pageSize;
|
|
612
|
+
}
|
|
515
613
|
//No momento não daremos suporte para configuração de formulário quando houver formLegacyConfigName
|
|
516
614
|
handleShowFormConfig() {
|
|
517
615
|
return this._showFormConfig && !this.formLegacyConfigName;
|
|
@@ -519,19 +617,28 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
519
617
|
resolveResourceID() {
|
|
520
618
|
return StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
|
|
521
619
|
}
|
|
620
|
+
getFormConfig() {
|
|
621
|
+
var _a, _b;
|
|
622
|
+
const configFromManager = (_a = this._formConfigManager) === null || _a === void 0 ? void 0 : _a.getConfig((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.insertionMode, this.dataUnit, this.ignoreReadOnlyFormFields);
|
|
623
|
+
if (!this.configName && !configFromManager) {
|
|
624
|
+
return this.formConfig;
|
|
625
|
+
}
|
|
626
|
+
return configFromManager;
|
|
627
|
+
}
|
|
522
628
|
/* istanbul ignore next */
|
|
523
629
|
render() {
|
|
524
|
-
var _a
|
|
630
|
+
var _a;
|
|
525
631
|
if (this.dataUnit == undefined) {
|
|
526
632
|
return;
|
|
527
633
|
}
|
|
528
|
-
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), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
|
634
|
+
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), pageSize: this.getPageSize(), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
|
529
635
|
? undefined
|
|
530
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config:
|
|
636
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
|
531
637
|
}
|
|
532
638
|
get _element() { return this; }
|
|
533
639
|
static get watchers() { return {
|
|
534
640
|
"resourceID": ["handleResourceIDChanged"],
|
|
641
|
+
"entityName": ["onChangeEntityName"],
|
|
535
642
|
"mode": ["onModeChange"],
|
|
536
643
|
"dataState": ["observeDataState"],
|
|
537
644
|
"formLegacyConfigName": ["observeFormLegacy"],
|
|
@@ -541,11 +648,13 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
541
648
|
}, [6, "snk-simple-crud", {
|
|
542
649
|
"dataState": [16],
|
|
543
650
|
"dataUnit": [16],
|
|
651
|
+
"entityName": [1, "entity-name"],
|
|
544
652
|
"mode": [2],
|
|
545
653
|
"gridConfig": [1040],
|
|
546
|
-
"formConfig": [
|
|
654
|
+
"formConfig": [1040],
|
|
547
655
|
"multipleSelection": [4, "multiple-selection"],
|
|
548
656
|
"useCancelConfirm": [4, "use-cancel-confirm"],
|
|
657
|
+
"pageSize": [2, "page-size"],
|
|
549
658
|
"resourceID": [1, "resource-i-d"],
|
|
550
659
|
"taskbarManager": [16],
|
|
551
660
|
"messagesBuilder": [1040],
|
|
@@ -568,7 +677,8 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
568
677
|
"setRecords": [64],
|
|
569
678
|
"getRecords": [64],
|
|
570
679
|
"openConfigurator": [64],
|
|
571
|
-
"closeConfigurator": [64]
|
|
680
|
+
"closeConfigurator": [64],
|
|
681
|
+
"updateConfig": [64]
|
|
572
682
|
}, [[0, "actionClick", "actionClickListener"]]]);
|
|
573
683
|
function defineCustomElement() {
|
|
574
684
|
if (typeof customElements === "undefined") {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { h, proxyCustomElement, HTMLElement, createEvent, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { StringUtils, ApplicationContext, OVERFLOWED_CLASS_NAME, OverflowWatcher, OverflowDirection, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { A as AuthorizationConfig } from './AuthorizationConfig.js';
|
|
4
|
-
import { P as PresentationMode } from './
|
|
5
|
-
import { s as store } from './
|
|
4
|
+
import { P as PresentationMode } from './ISave.js';
|
|
5
|
+
import { s as store } from './index2.js';
|
|
6
6
|
import { d as defineCustomElement$4 } from './snk-actions-button2.js';
|
|
7
7
|
import { d as defineCustomElement$3 } from './snk-data-exporter2.js';
|
|
8
8
|
import { d as defineCustomElement$2 } from './snk-exporter-email-sender2.js';
|
|
@@ -54,7 +54,7 @@ const buildCustomButton = (def, className, dataElementId, action, isEnabled) =>
|
|
|
54
54
|
return textButton(def.name, className, dataElementId, text, hint, action, isEnabled);
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
|
-
const buildElem = (element, className, dataElementId, getTitle, action, isEnabled, actions,
|
|
57
|
+
const buildElem = (element, className, dataElementId, getTitle, action, isEnabled, actions, dataExporterStoreKey, presentationMode) => {
|
|
58
58
|
var _a;
|
|
59
59
|
const title = getTitle(element);
|
|
60
60
|
switch (element) {
|
|
@@ -97,7 +97,7 @@ const buildElem = (element, className, dataElementId, getTitle, action, isEnable
|
|
|
97
97
|
case TaskbarElement.DIVIDER:
|
|
98
98
|
return h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin--none ez-margin-left--medium", "data-taskbar-divider": true });
|
|
99
99
|
case TaskbarElement.DATA_EXPORTER:
|
|
100
|
-
const provider = (_a = store.get("exporterProviders")) === null || _a === void 0 ? void 0 : _a[
|
|
100
|
+
const provider = (_a = store.get("exporterProviders")) === null || _a === void 0 ? void 0 : _a[dataExporterStoreKey];
|
|
101
101
|
return h("snk-data-exporter", { class: className, provider: provider, "data-element-id": dataElementId, "data-taskbar-element": element });
|
|
102
102
|
case TaskbarElement.ATTACH:
|
|
103
103
|
return iconButton("anexo", element, className, dataElementId, title, action, isEnabled);
|
|
@@ -154,6 +154,8 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
154
154
|
this._customElementsId = undefined;
|
|
155
155
|
this._slotContainer = undefined;
|
|
156
156
|
this._hiddenActionsList = [];
|
|
157
|
+
this._lastWidth = undefined;
|
|
158
|
+
this._hasToUpdateOverFlow = false;
|
|
157
159
|
this.alignRigth = false;
|
|
158
160
|
this.customSlotId = "TASKBAR_CUSTOM_ELEMENTS";
|
|
159
161
|
this.customContainerId = undefined;
|
|
@@ -179,6 +181,11 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
179
181
|
var _a;
|
|
180
182
|
(_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.forceUpdate();
|
|
181
183
|
}
|
|
184
|
+
observeLastWidth(newValue, oldValue) {
|
|
185
|
+
if (oldValue === 0 && newValue !== 0) {
|
|
186
|
+
this._hasToUpdateOverFlow = true;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
182
189
|
// Internal methods
|
|
183
190
|
elementsFromString(strButtons) {
|
|
184
191
|
const elements = [];
|
|
@@ -272,8 +279,9 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
272
279
|
className += "ez-padding-left--medium";
|
|
273
280
|
}
|
|
274
281
|
const taskbarElement = TaskbarElement[def.toString()];
|
|
282
|
+
const dataExporterStoreKey = this._element.dataset.exporterStoreKey || this.configName;
|
|
275
283
|
if (taskbarElement) {
|
|
276
|
-
return buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.buildDynamicActionsList(),
|
|
284
|
+
return buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.buildDynamicActionsList(), dataExporterStoreKey, this.presentationMode);
|
|
277
285
|
}
|
|
278
286
|
else {
|
|
279
287
|
return buildCustomButton(def, className, this.getIdElemBtnCustom(def), elem => this.elementClick(elem), elem => this.isEnabled(elem));
|
|
@@ -362,10 +370,20 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
362
370
|
this.getCustomElements();
|
|
363
371
|
}
|
|
364
372
|
componentWillRender() {
|
|
373
|
+
this.handleDefinitions();
|
|
374
|
+
this.validatePresentationMode();
|
|
375
|
+
this.updateOverFlowIfNeeded();
|
|
376
|
+
}
|
|
377
|
+
handleDefinitions() {
|
|
365
378
|
if (this._definitions == undefined && this._permissions) {
|
|
366
379
|
this._definitions = this.elementsFromString(this.buttons);
|
|
367
380
|
}
|
|
368
|
-
|
|
381
|
+
}
|
|
382
|
+
updateOverFlowIfNeeded() {
|
|
383
|
+
if (this._hasToUpdateOverFlow) {
|
|
384
|
+
requestAnimationFrame(() => { var _a; return (_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.forceUpdate(); });
|
|
385
|
+
this._hasToUpdateOverFlow = false;
|
|
386
|
+
}
|
|
369
387
|
}
|
|
370
388
|
handleOverFlow(overFlowingElements) {
|
|
371
389
|
const elementsToHandle = overFlowingElements.filter(element => !this.hasToIgnoreOverFlow(element));
|
|
@@ -432,6 +450,10 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
432
450
|
}
|
|
433
451
|
componentDidRender() {
|
|
434
452
|
this.appendCustomElementsInTaskbar();
|
|
453
|
+
this.updateLastWidth();
|
|
454
|
+
}
|
|
455
|
+
updateLastWidth() {
|
|
456
|
+
this._lastWidth = this._element.getBoundingClientRect().width;
|
|
435
457
|
}
|
|
436
458
|
disconnectedCallback() {
|
|
437
459
|
var _a;
|
|
@@ -478,7 +500,8 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
478
500
|
get _element() { return this; }
|
|
479
501
|
static get watchers() { return {
|
|
480
502
|
"buttons": ["observeButtons"],
|
|
481
|
-
"disabledButtons": ["observeDisabledButtons"]
|
|
503
|
+
"disabledButtons": ["observeDisabledButtons"],
|
|
504
|
+
"_lastWidth": ["observeLastWidth"]
|
|
482
505
|
}; }
|
|
483
506
|
static get style() { return snkTaskbarCss; }
|
|
484
507
|
}, [6, "snk-taskbar", {
|
|
@@ -501,7 +524,9 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
501
524
|
"_customElements": [32],
|
|
502
525
|
"_customElementsId": [32],
|
|
503
526
|
"_slotContainer": [32],
|
|
504
|
-
"_hiddenActionsList": [32]
|
|
527
|
+
"_hiddenActionsList": [32],
|
|
528
|
+
"_lastWidth": [32],
|
|
529
|
+
"_hasToUpdateOverFlow": [32]
|
|
505
530
|
}]);
|
|
506
531
|
function defineCustomElement() {
|
|
507
532
|
if (typeof customElements === "undefined") {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { R as ResourceFetcher, F as FormConfigFetcher } from './form-config-fetcher-
|
|
1
|
+
import { R as ResourceFetcher, d as dist, D as DataFetcher, F as FormConfigFetcher } from './form-config-fetcher-13cd3285.js';
|
|
2
2
|
import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
|
|
3
3
|
import { ObjectUtils } from '@sankhyalabs/core';
|
|
4
|
-
import { d as dist, D as DataFetcher } from './DataFetcher-a650ae58.js';
|
|
5
4
|
|
|
6
5
|
class GridConfigFetcher extends ResourceFetcher {
|
|
7
6
|
constructor() {
|