@sankhyalabs/sankhyablocks 8.15.0-dev.53 → 8.15.0-dev.55
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-d15f7aac.js → IExporterProvider-955812ad.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/{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-bdbbe9ac.js → pesquisa-fetcher-6e934fb5.js} +30 -16
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +8 -9
- package/dist/cjs/snk-application.cjs.entry.js +22 -23
- package/dist/cjs/snk-attach.cjs.entry.js +12 -13
- package/dist/cjs/snk-crud.cjs.entry.js +4 -5
- package/dist/cjs/snk-data-exporter.cjs.entry.js +195 -78
- package/dist/cjs/{snk-data-unit-41c29713.js → snk-data-unit-abd2113f.js} +2 -37
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -1
- package/dist/cjs/snk-detail-view.cjs.entry.js +6 -7
- package/dist/cjs/snk-filter-bar.cjs.entry.js +2 -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 +65 -102
- package/dist/cjs/{snk-guides-viewer-a8dd24a3.js → snk-guides-viewer-4e8b517b.js} +4 -5
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +6 -7
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +2 -3
- package/dist/cjs/snk-simple-crud.cjs.entry.js +115 -32
- package/dist/cjs/snk-taskbar.cjs.entry.js +3 -2
- package/dist/cjs/{taskbar-elements-3ecd1278.js → taskbar-elements-d9392685.js} +2 -2
- 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 +35 -45
- 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-grid/snk-grid.js +3 -94
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +81 -9
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +2 -2
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +2 -1
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +1 -1
- 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 +8 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +1 -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/dataunit-fetcher.js +18 -4
- 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 +3 -4
- package/dist/components/snk-crud.js +3 -4
- package/dist/components/snk-data-exporter2.js +192 -79
- 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-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 +101 -16
- package/dist/components/snk-taskbar2.js +6 -5
- package/dist/esm/{ConfigStorage-6e241cd7.js → ConfigStorage-cc3f3dd3.js} +1 -2
- package/dist/esm/{SnkMultiSelectionListDataSource-7084f3b3.js → IExporterProvider-6ebf47ab.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/{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-96d2f351.js → pesquisa-fetcher-4eed47c6.js} +18 -4
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +3 -4
- package/dist/esm/snk-application.entry.js +4 -5
- package/dist/esm/snk-attach.entry.js +4 -5
- package/dist/esm/snk-crud.entry.js +4 -5
- package/dist/esm/snk-data-exporter.entry.js +195 -78
- package/dist/esm/{snk-data-unit-de1d140d.js → snk-data-unit-29eba11a.js} +3 -38
- package/dist/esm/snk-data-unit.entry.js +2 -1
- package/dist/esm/snk-detail-view.entry.js +6 -7
- package/dist/esm/snk-filter-bar.entry.js +2 -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 +63 -100
- package/dist/esm/{snk-guides-viewer-131e9660.js → snk-guides-viewer-2742a9db.js} +4 -5
- package/dist/esm/snk-guides-viewer.entry.js +6 -7
- package/dist/esm/snk-personalized-filter.entry.js +2 -3
- package/dist/esm/snk-simple-crud.entry.js +102 -19
- package/dist/esm/snk-taskbar.entry.js +3 -2
- 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-1d9d07b4.entry.js +1 -0
- package/dist/sankhyablocks/p-201e5588.entry.js +1 -0
- package/dist/sankhyablocks/p-33a6728e.js +26 -0
- package/dist/sankhyablocks/p-37afb96a.js +1 -0
- package/dist/sankhyablocks/p-411fe937.entry.js +1 -0
- package/dist/sankhyablocks/p-44d52fc6.js +1 -0
- package/dist/sankhyablocks/p-4ddf7add.entry.js +1 -0
- package/dist/sankhyablocks/p-7b797d8f.entry.js +1 -0
- package/dist/sankhyablocks/p-87cb937d.js +65 -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-9ee96756.entry.js +1 -0
- package/dist/sankhyablocks/p-a4c94582.entry.js +1 -0
- package/dist/sankhyablocks/p-bf209f48.entry.js +1 -0
- package/dist/sankhyablocks/p-c2f3ebf3.entry.js +1 -0
- package/dist/sankhyablocks/p-c3c0ad0b.entry.js +1 -0
- package/dist/sankhyablocks/{p-619c5f6f.entry.js → p-c801a38a.entry.js} +2 -2
- package/dist/sankhyablocks/p-cfb98f51.entry.js +1 -0
- package/dist/sankhyablocks/{p-efeca7ba.js → p-d24c9dc6.js} +1 -1
- package/dist/sankhyablocks/p-e4225e8b.entry.js +1 -0
- package/dist/sankhyablocks/p-edd9dd1c.entry.js +1 -0
- package/dist/sankhyablocks/p-fa84e72f.entry.js +1 -0
- package/dist/sankhyablocks/p-fd44c905.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- 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-grid/snk-grid.d.ts +0 -3
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +14 -2
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +1 -1
- package/dist/types/components.d.ts +16 -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-075bba4c.entry.js +0 -1
- package/dist/sankhyablocks/p-07a61550.entry.js +0 -1
- package/dist/sankhyablocks/p-103c5956.entry.js +0 -1
- package/dist/sankhyablocks/p-1048bd26.entry.js +0 -1
- package/dist/sankhyablocks/p-13ae1a89.entry.js +0 -1
- package/dist/sankhyablocks/p-24ed6ad6.entry.js +0 -1
- package/dist/sankhyablocks/p-34a7f2ab.js +0 -65
- package/dist/sankhyablocks/p-52c8e589.js +0 -1
- package/dist/sankhyablocks/p-5833cff9.js +0 -1
- package/dist/sankhyablocks/p-5a2e016a.entry.js +0 -1
- package/dist/sankhyablocks/p-6f560924.entry.js +0 -1
- package/dist/sankhyablocks/p-8967fa78.js +0 -1
- package/dist/sankhyablocks/p-9b1beac5.entry.js +0 -1
- package/dist/sankhyablocks/p-a87149e4.entry.js +0 -1
- package/dist/sankhyablocks/p-ac77949b.entry.js +0 -1
- package/dist/sankhyablocks/p-b10b9934.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-f7d0fab9.entry.js +0 -1
- package/dist/sankhyablocks/p-f7d9d148.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,23 +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
3
|
import { CSSVarsUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
4
4
|
import { V as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants.js';
|
5
5
|
import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
|
6
|
-
import './
|
6
|
+
import { F as FormConfigFetcher } from './form-config-fetcher.js';
|
7
7
|
import { I as InMemoryLoader } from './dataunit-fetcher.js';
|
8
|
-
import { S as SnkMultiSelectionListDataSource, T as TaskbarProcessor, b as buildFieldSearch, o as openFieldSearch,
|
9
|
-
import { P as PresentationMode } from './
|
10
|
-
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';
|
11
10
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
12
11
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
13
12
|
import './filter-item-type.enum.js';
|
14
|
-
import { F as FormConfigFetcher } from './form-config-fetcher.js';
|
15
13
|
import { C as ConfigStorage } from './ConfigStorage.js';
|
16
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';
|
17
18
|
import { d as defineCustomElement$c } from './snk-config-options2.js';
|
18
19
|
import { d as defineCustomElement$b } from './snk-configurator2.js';
|
19
20
|
import { d as defineCustomElement$a } from './snk-data-exporter2.js';
|
20
|
-
import { d as defineCustomElement$9 } from './snk-data-unit2.js';
|
21
21
|
import { d as defineCustomElement$8 } from './snk-exporter-email-sender2.js';
|
22
22
|
import { d as defineCustomElement$7 } from './snk-field-config2.js';
|
23
23
|
import { d as defineCustomElement$6 } from './snk-form-config2.js';
|
@@ -29,6 +29,56 @@ import { d as defineCustomElement$1 } from './taskbar-actions-button2.js';
|
|
29
29
|
const REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "MORE_OPTIONS"];
|
30
30
|
const REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER", "MORE_OPTIONS"];
|
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
|
+
|
32
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}";
|
33
83
|
|
34
84
|
const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
@@ -45,10 +95,10 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
45
95
|
this._keyDownHandler = (event) => this.keyDownListener(event);
|
46
96
|
this._formConfigFetcher = new FormConfigFetcher();
|
47
97
|
this._taskbarProcessor = new TaskbarProcessor({
|
48
|
-
"snkSimpleCrudTaskbar.form_regular": this.getButtons(false, TaskbarElement.GRID_MODE),
|
49
|
-
"snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, TaskbarElement.FORM_MODE),
|
50
|
-
"snkSimpleCrudTaskbar.form_selected": this.getButtons(true, TaskbarElement.GRID_MODE),
|
51
|
-
"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]),
|
52
102
|
"snkSimpleCrudTaskbar.finish_edition": ["CANCEL", "SAVE"]
|
53
103
|
});
|
54
104
|
this._showPopUpGridConfig = false;
|
@@ -59,12 +109,14 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
59
109
|
this._customContainerId = `SNK-SIMPLE-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
|
60
110
|
this.dataState = undefined;
|
61
111
|
this.dataUnit = undefined;
|
112
|
+
this.entityName = undefined;
|
62
113
|
this.mode = SIMPLE_CRUD_MODE.SERVER;
|
63
114
|
this.gridConfig = undefined;
|
64
115
|
this.formConfig = undefined;
|
65
116
|
this._formFields = [];
|
66
117
|
this.multipleSelection = undefined;
|
67
118
|
this.useCancelConfirm = true;
|
119
|
+
this.pageSize = 150;
|
68
120
|
this.resourceID = undefined;
|
69
121
|
this.taskbarManager = undefined;
|
70
122
|
this.messagesBuilder = undefined;
|
@@ -86,9 +138,9 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
86
138
|
this.loadFormConfig(true);
|
87
139
|
this.loadGridConfig(true);
|
88
140
|
}
|
89
|
-
getButtons(selected,
|
141
|
+
getButtons(selected, extraButtons) {
|
90
142
|
return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
|
91
|
-
.concat(
|
143
|
+
.concat(extraButtons));
|
92
144
|
}
|
93
145
|
addConfigButton(buttons) {
|
94
146
|
if (this.configName === undefined) {
|
@@ -128,6 +180,12 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
128
180
|
}
|
129
181
|
evt.stopPropagation();
|
130
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
|
+
}
|
131
189
|
onModeChange() {
|
132
190
|
if (this.mode == SIMPLE_CRUD_MODE.IN_MEMORY) {
|
133
191
|
this.initInMemoryDataUnit();
|
@@ -240,6 +298,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
240
298
|
}
|
241
299
|
async componentWillRender() {
|
242
300
|
this._resourceID = await this.application.getResourceID();
|
301
|
+
this.dataExporterProviderStore();
|
243
302
|
this._taskbarProcessor.process(this.getTaskBarId(), this.taskbarManager, this.dataState, this.getTaskBarDisabledButtons());
|
244
303
|
if (this.configName === undefined) {
|
245
304
|
return;
|
@@ -264,13 +323,13 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
264
323
|
this._multiSelectionListDataSource.setDataUnit(this.dataUnit);
|
265
324
|
}
|
266
325
|
getTaskBarId() {
|
267
|
-
var _a, _b
|
326
|
+
var _a, _b;
|
268
327
|
if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
|
269
328
|
return "snkSimpleCrudTaskbar.finish_edition";
|
270
329
|
}
|
271
330
|
if (((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.selectionInfo) &&
|
272
331
|
!this.dataState.selectionInfo.isAllRecords() &&
|
273
|
-
|
332
|
+
this.dataState.selectionInfo.length > 0) {
|
274
333
|
return this._currentViewMode === VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_selected" : "snkSimpleCrudTaskbar.form_selected";
|
275
334
|
}
|
276
335
|
return this._currentViewMode === VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
|
@@ -510,9 +569,23 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
510
569
|
.then(() => {
|
511
570
|
this.setGridConfig(config);
|
512
571
|
this.closeGridConfig();
|
572
|
+
this.dataExporterProviderStore();
|
513
573
|
});
|
514
574
|
evt.stopPropagation();
|
515
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
|
+
}
|
516
589
|
setGridConfig(config) {
|
517
590
|
this.gridConfig = config;
|
518
591
|
CrudUtils.assertDefaultSorting(this.gridConfig, this.dataUnit);
|
@@ -528,6 +601,15 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
528
601
|
closeFormConfig() {
|
529
602
|
this._showFormConfig = false;
|
530
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
|
+
}
|
531
613
|
//No momento não daremos suporte para configuração de formulário quando houver formLegacyConfigName
|
532
614
|
handleShowFormConfig() {
|
533
615
|
return this._showFormConfig && !this.formLegacyConfigName;
|
@@ -549,13 +631,14 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
549
631
|
if (this.dataUnit == undefined) {
|
550
632
|
return;
|
551
633
|
}
|
552
|
-
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)
|
553
635
|
? undefined
|
554
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() }))));
|
555
637
|
}
|
556
638
|
get _element() { return this; }
|
557
639
|
static get watchers() { return {
|
558
640
|
"resourceID": ["handleResourceIDChanged"],
|
641
|
+
"entityName": ["onChangeEntityName"],
|
559
642
|
"mode": ["onModeChange"],
|
560
643
|
"dataState": ["observeDataState"],
|
561
644
|
"formLegacyConfigName": ["observeFormLegacy"],
|
@@ -565,11 +648,13 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
565
648
|
}, [6, "snk-simple-crud", {
|
566
649
|
"dataState": [16],
|
567
650
|
"dataUnit": [16],
|
651
|
+
"entityName": [1, "entity-name"],
|
568
652
|
"mode": [2],
|
569
653
|
"gridConfig": [1040],
|
570
654
|
"formConfig": [1040],
|
571
655
|
"multipleSelection": [4, "multiple-selection"],
|
572
656
|
"useCancelConfirm": [4, "use-cancel-confirm"],
|
657
|
+
"pageSize": [2, "page-size"],
|
573
658
|
"resourceID": [1, "resource-i-d"],
|
574
659
|
"taskbarManager": [16],
|
575
660
|
"messagesBuilder": [1040],
|
@@ -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);
|
@@ -279,8 +279,9 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
279
279
|
className += "ez-padding-left--medium";
|
280
280
|
}
|
281
281
|
const taskbarElement = TaskbarElement[def.toString()];
|
282
|
+
const dataExporterStoreKey = this._element.dataset.exporterStoreKey || this.configName;
|
282
283
|
if (taskbarElement) {
|
283
|
-
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);
|
284
285
|
}
|
285
286
|
else {
|
286
287
|
return buildCustomButton(def, className, this.getIdElemBtnCustom(def), elem => this.elementClick(elem), elem => this.isEnabled(elem));
|
@@ -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() {
|
package/dist/esm/{SnkMultiSelectionListDataSource-7084f3b3.js → IExporterProvider-6ebf47ab.js}
RENAMED
@@ -1,12 +1,11 @@
|
|
1
|
-
import { D as DataFetcher } from './
|
2
|
-
import { a as PreloadManager } from './pesquisa-fetcher-
|
3
|
-
import { SortMode, ApplicationContext, UserInterface, DateUtils } from '@sankhyalabs/core';
|
1
|
+
import { D as DataFetcher } from './form-config-fetcher-13cd3285.js';
|
2
|
+
import { a as PreloadManager } from './pesquisa-fetcher-4eed47c6.js';
|
3
|
+
import { SortMode, ApplicationContext, UserInterface, DateUtils, DataType } from '@sankhyalabs/core';
|
4
4
|
import './index-0ece87a6.js';
|
5
5
|
import './ISave-d8c8bc59.js';
|
6
6
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
7
|
-
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
7
|
+
import { UserInterface as UserInterface$1 } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
8
8
|
import './filter-item-type.enum-d45e026f.js';
|
9
|
-
import './form-config-fetcher-765b8498.js';
|
10
9
|
import InMemoryFilterColumnDataSource from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
|
11
10
|
|
12
11
|
class CrudUtils {
|
@@ -130,4 +129,51 @@ class SnkMultiSelectionListDataSource {
|
|
130
129
|
}
|
131
130
|
}
|
132
131
|
|
133
|
-
|
132
|
+
class CommonsExporter {
|
133
|
+
constructor(dataUnit, grid) {
|
134
|
+
this.dataUnit = dataUnit;
|
135
|
+
this.grid = grid;
|
136
|
+
}
|
137
|
+
async getColumnsMetadata() {
|
138
|
+
var _a;
|
139
|
+
const columnsState = await ((_a = this.grid) === null || _a === void 0 ? void 0 : _a.getColumnsState());
|
140
|
+
return this.buildColumnsMetadata(columnsState);
|
141
|
+
}
|
142
|
+
buildColumnsMetadata(gridColumns) {
|
143
|
+
const columnsMetadata = [];
|
144
|
+
gridColumns === null || gridColumns === void 0 ? void 0 : gridColumns.forEach((column) => {
|
145
|
+
var _a, _b;
|
146
|
+
/**
|
147
|
+
* TODO: Analisar e criar uma melhor forma de tratar essa validação do "RECDESP".
|
148
|
+
*/
|
149
|
+
if (column.hidden && column.name !== "RECDESP") {
|
150
|
+
return;
|
151
|
+
}
|
152
|
+
const fieldData = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(column.name);
|
153
|
+
const columnData = {
|
154
|
+
label: column.label,
|
155
|
+
id: column.name,
|
156
|
+
width: (fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface) === UserInterface$1.SEARCH ? 30 : column.width,
|
157
|
+
type: fieldData === null || fieldData === void 0 ? void 0 : fieldData.dataType,
|
158
|
+
userInterface: fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface
|
159
|
+
};
|
160
|
+
columnsMetadata.push(columnData);
|
161
|
+
if (((_b = fieldData === null || fieldData === void 0 ? void 0 : fieldData.properties) === null || _b === void 0 ? void 0 : _b.DESCRIPTIONFIELD) != undefined) {
|
162
|
+
const mergedFrom = fieldData.properties.mergedFrom;
|
163
|
+
const descriptionField = `${fieldData.properties.ENTITYNAME}.${fieldData.properties.DESCRIPTIONFIELD}`;
|
164
|
+
const descriptionColumn = {
|
165
|
+
label: fieldData.properties.DESCRIPTIONENTITY,
|
166
|
+
id: `${mergedFrom ? (mergedFrom + ".") : ""}${descriptionField}`,
|
167
|
+
width: 200,
|
168
|
+
type: DataType.TEXT,
|
169
|
+
userInterface: UserInterface$1.LONGTEXT,
|
170
|
+
descriptionFrom: fieldData.name
|
171
|
+
};
|
172
|
+
columnsMetadata.push(descriptionColumn);
|
173
|
+
}
|
174
|
+
});
|
175
|
+
return columnsMetadata || [];
|
176
|
+
}
|
177
|
+
}
|
178
|
+
|
179
|
+
export { CommonsExporter as C, SnkMultiSelectionListDataSource as S, CrudUtils as a };
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import { JSUtils, DataType } from '@sankhyalabs/core';
|
2
|
+
|
3
|
+
const getSelectedIDs = (dataUnit) => {
|
4
|
+
const selectionInfo = dataUnit.getSelectionInfo();
|
5
|
+
if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
|
6
|
+
return [];
|
7
|
+
}
|
8
|
+
const selectedRecordsIDsInfo = [];
|
9
|
+
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.recordIds;
|
10
|
+
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
11
|
+
selectedRecords.forEach(recordId => {
|
12
|
+
if (!dataUnit.isNewRecord(recordId)) {
|
13
|
+
/*
|
14
|
+
Esse if foi necessário para tratar corretamente o ID
|
15
|
+
do record quando está sendo utilizado no modo standAlone
|
16
|
+
isso não faz a exportação da grid funcionar no modo standAlone
|
17
|
+
mas deixa de causar erro nas oprações de CRUD.
|
18
|
+
*/
|
19
|
+
if (!JSUtils.isBase64(recordId)) {
|
20
|
+
selectedRecordsIDsInfo.push({
|
21
|
+
name: "__record__id__",
|
22
|
+
type: DataType.TEXT,
|
23
|
+
value: recordId
|
24
|
+
});
|
25
|
+
return;
|
26
|
+
}
|
27
|
+
const revertBase64ToObject = JSON.parse(window.atob(recordId));
|
28
|
+
Object.entries(revertBase64ToObject).forEach(([name, value]) => {
|
29
|
+
const metadataField = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(name);
|
30
|
+
if (metadataField == undefined) {
|
31
|
+
return;
|
32
|
+
}
|
33
|
+
selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
|
34
|
+
});
|
35
|
+
}
|
36
|
+
});
|
37
|
+
}
|
38
|
+
return selectedRecordsIDsInfo;
|
39
|
+
};
|
40
|
+
|
41
|
+
export { getSelectedIDs as g };
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { C as ConfigStorage } from './ConfigStorage-
|
1
|
+
import { C as ConfigStorage } from './ConfigStorage-cc3f3dd3.js';
|
2
2
|
import { ObjectUtils, StringUtils } from '@sankhyalabs/core';
|
3
|
-
import { F as FormConfigFetcher } from './form-config-fetcher-
|
3
|
+
import { F as FormConfigFetcher } from './form-config-fetcher-13cd3285.js';
|
4
4
|
|
5
5
|
class SnkFormConfigManager {
|
6
6
|
constructor(configName, resourceID, onConfigChange) {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ObjectUtils } from '@sankhyalabs/core';
|
2
|
-
import { R as ResourceFetcher } from './form-config-fetcher-
|
2
|
+
import { R as ResourceFetcher } from './form-config-fetcher-13cd3285.js';
|
3
3
|
|
4
4
|
class AuthFetcher extends ResourceFetcher {
|
5
5
|
getData(resourceID) {
|