@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-50737.1 → 0.0.0-bugfix-dev-KB-53946.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{ConfigStorage-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,12 +1,10 @@
|
|
|
1
|
-
import { D as DataFetcher } from './
|
|
1
|
+
import { D as DataFetcher } from './form-config-fetcher.js';
|
|
2
2
|
import { a as PreloadManager } from './dataunit-fetcher.js';
|
|
3
|
-
import { SortMode, ApplicationContext, UserInterface, DateUtils } from '@sankhyalabs/core';
|
|
4
|
-
import './
|
|
5
|
-
import './snk-actions-button2.js';
|
|
3
|
+
import { SortMode, ApplicationContext, UserInterface, DateUtils, DataType } from '@sankhyalabs/core';
|
|
4
|
+
import './ISave.js';
|
|
6
5
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
7
|
-
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
6
|
+
import { UserInterface as UserInterface$1 } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
8
7
|
import './filter-item-type.enum.js';
|
|
9
|
-
import './form-config-fetcher.js';
|
|
10
8
|
import InMemoryFilterColumnDataSource from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
|
|
11
9
|
import { h } from '@stencil/core/internal/client';
|
|
12
10
|
|
|
@@ -208,4 +206,51 @@ const openFieldSearch = async (moreOptions, field) => {
|
|
|
208
206
|
await moreOptions.showActions();
|
|
209
207
|
};
|
|
210
208
|
|
|
211
|
-
|
|
209
|
+
class CommonsExporter {
|
|
210
|
+
constructor(dataUnit, grid) {
|
|
211
|
+
this.dataUnit = dataUnit;
|
|
212
|
+
this.grid = grid;
|
|
213
|
+
}
|
|
214
|
+
async getColumnsMetadata() {
|
|
215
|
+
var _a;
|
|
216
|
+
const columnsState = await ((_a = this.grid) === null || _a === void 0 ? void 0 : _a.getColumnsState());
|
|
217
|
+
return this.buildColumnsMetadata(columnsState);
|
|
218
|
+
}
|
|
219
|
+
buildColumnsMetadata(gridColumns) {
|
|
220
|
+
const columnsMetadata = [];
|
|
221
|
+
gridColumns === null || gridColumns === void 0 ? void 0 : gridColumns.forEach((column) => {
|
|
222
|
+
var _a, _b;
|
|
223
|
+
/**
|
|
224
|
+
* TODO: Analisar e criar uma melhor forma de tratar essa validação do "RECDESP".
|
|
225
|
+
*/
|
|
226
|
+
if (column.hidden && column.name !== "RECDESP") {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
const fieldData = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(column.name);
|
|
230
|
+
const columnData = {
|
|
231
|
+
label: column.label,
|
|
232
|
+
id: column.name,
|
|
233
|
+
width: (fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface) === UserInterface$1.SEARCH ? 30 : column.width,
|
|
234
|
+
type: fieldData === null || fieldData === void 0 ? void 0 : fieldData.dataType,
|
|
235
|
+
userInterface: fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface
|
|
236
|
+
};
|
|
237
|
+
columnsMetadata.push(columnData);
|
|
238
|
+
if (((_b = fieldData === null || fieldData === void 0 ? void 0 : fieldData.properties) === null || _b === void 0 ? void 0 : _b.DESCRIPTIONFIELD) != undefined) {
|
|
239
|
+
const mergedFrom = fieldData.properties.mergedFrom;
|
|
240
|
+
const descriptionField = `${fieldData.properties.ENTITYNAME}.${fieldData.properties.DESCRIPTIONFIELD}`;
|
|
241
|
+
const descriptionColumn = {
|
|
242
|
+
label: fieldData.properties.DESCRIPTIONENTITY,
|
|
243
|
+
id: `${mergedFrom ? (mergedFrom + ".") : ""}${descriptionField}`,
|
|
244
|
+
width: 200,
|
|
245
|
+
type: DataType.TEXT,
|
|
246
|
+
userInterface: UserInterface$1.LONGTEXT,
|
|
247
|
+
descriptionFrom: fieldData.name
|
|
248
|
+
};
|
|
249
|
+
columnsMetadata.push(descriptionColumn);
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
return columnsMetadata || [];
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export { CommonsExporter as C, SnkMultiSelectionListDataSource as S, TaskbarProcessor as T, CrudUtils as a, buildFieldSearch as b, openFieldSearch as o };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var PresentationMode;
|
|
2
|
+
(function (PresentationMode) {
|
|
3
|
+
PresentationMode["PRIMARY"] = "primary";
|
|
4
|
+
PresentationMode["SECONDARY"] = "secondary";
|
|
5
|
+
PresentationMode["SINGLE_TASKBAR"] = "singleTaskbar";
|
|
6
|
+
})(PresentationMode || (PresentationMode = {}));
|
|
7
|
+
var DataExporterOption;
|
|
8
|
+
(function (DataExporterOption) {
|
|
9
|
+
DataExporterOption["EXPORT_TO_PDF"] = "exportToPDF";
|
|
10
|
+
DataExporterOption["EXPORT_TO_XLS"] = "exportToXLS";
|
|
11
|
+
DataExporterOption["EXPORT_CURRENT_PAGE"] = "exportCurrentPage";
|
|
12
|
+
DataExporterOption["EXPORT_PAGE_TO_PDF"] = "exportPageToPDF";
|
|
13
|
+
DataExporterOption["EXPORT_PAGE_TO_XLS"] = "exportPageToXLS";
|
|
14
|
+
DataExporterOption["EXPORT_BY_EMAIL"] = "exportToEmail";
|
|
15
|
+
DataExporterOption["EXPORT_PDF_TO_EMAIL"] = "exportPDFToEmail";
|
|
16
|
+
DataExporterOption["EXPORT_XLS_TO_EMAIL"] = "exportXLSToEmail";
|
|
17
|
+
})(DataExporterOption || (DataExporterOption = {}));
|
|
18
|
+
var DataExporterFormat;
|
|
19
|
+
(function (DataExporterFormat) {
|
|
20
|
+
DataExporterFormat["PDF"] = "exportPDFToEmail";
|
|
21
|
+
DataExporterFormat["XLS"] = "exportXLSToEmail";
|
|
22
|
+
DataExporterFormat["XLSX"] = "exportXLSToEmail";
|
|
23
|
+
})(DataExporterFormat || (DataExporterFormat = {}));
|
|
24
|
+
var DataExporterType;
|
|
25
|
+
(function (DataExporterType) {
|
|
26
|
+
DataExporterType["EXPORT_TO_PDF"] = "PDF";
|
|
27
|
+
DataExporterType["EXPORT_TO_XLS"] = "XLS";
|
|
28
|
+
DataExporterType["EXPORT_PAGE_TO_PDF"] = "PDF";
|
|
29
|
+
DataExporterType["EXPORT_PAGE_TO_XLS"] = "XLS";
|
|
30
|
+
DataExporterType["EXPORT_PDF_TO_EMAIL"] = "PDF";
|
|
31
|
+
DataExporterType["EXPORT_XLS_TO_EMAIL"] = "XLS";
|
|
32
|
+
})(DataExporterType || (DataExporterType = {}));
|
|
33
|
+
|
|
34
|
+
var SaveErrorsEnum;
|
|
35
|
+
(function (SaveErrorsEnum) {
|
|
36
|
+
SaveErrorsEnum["LINK_AND_FILE_AT_THE_SAME_TIME"] = "LINK_AND_FILE_AT_THE_SAME_TIME";
|
|
37
|
+
SaveErrorsEnum["ANY_LINK_OR_FILE_FILLED"] = "ANY_LINK_OR_FILE_FILLED";
|
|
38
|
+
SaveErrorsEnum["UNKNOWN"] = "UNKNOWN";
|
|
39
|
+
SaveErrorsEnum["DESCRIPTION_CANNOT_BE_CHANGED"] = "DESCRIPTION_CANNOT_BE_CHANGED";
|
|
40
|
+
})(SaveErrorsEnum || (SaveErrorsEnum = {}));
|
|
41
|
+
|
|
42
|
+
export { DataExporterOption as D, PresentationMode as P, SaveErrorsEnum as S, DataExporterFormat as a, DataExporterType as b };
|
|
@@ -146,6 +146,10 @@ const snkCrudMessages = {
|
|
|
146
146
|
|
|
147
147
|
const snkSimpleCrudMessages = {
|
|
148
148
|
findColumn: "Busca de colunas",
|
|
149
|
+
formConfigUnavaliable: {
|
|
150
|
+
title: "Aviso",
|
|
151
|
+
message: 'A opção "Configurar formulário" será disponibilizada em breve. Enquanto isso, acesse a configuração do fomulário através dos layouts anteriores, HTML5 ou Flex.'
|
|
152
|
+
}
|
|
149
153
|
};
|
|
150
154
|
|
|
151
155
|
const fileViewerMessages = {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { DataType, ApplicationContext, FieldComparator, SortMode, DataUnit, DateUtils, StringUtils, ChangeOperation, UserInterface, DataUnitStorage } from '@sankhyalabs/core';
|
|
2
|
-
import { d as dist, D as DataFetcher } from './
|
|
1
|
+
import { DataType, ApplicationContext, ObjectUtils, FieldComparator, SortMode, DataUnit, DateUtils, StringUtils, ChangeOperation, UserInterface, DataUnitStorage } from '@sankhyalabs/core';
|
|
2
|
+
import { d as dist, D as DataFetcher } from './form-config-fetcher.js';
|
|
3
3
|
import { DISTINCT_FILTER_NAME_PREFIX } from '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
4
4
|
import { DataUnitTransient } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
5
5
|
import { ColumnFilterManager } from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
|
|
6
|
+
import SortingUtils from '@sankhyalabs/core/dist/utils/SortingUtils';
|
|
6
7
|
import { R as ResourceIDUtils } from './ResourceIDUtils.js';
|
|
7
8
|
|
|
8
9
|
class PesquisaFetcher {
|
|
@@ -244,6 +245,9 @@ class ArrayRepository {
|
|
|
244
245
|
async count() {
|
|
245
246
|
return Promise.resolve(this._list.length);
|
|
246
247
|
}
|
|
248
|
+
getFromCache() {
|
|
249
|
+
return ObjectUtils.copy(this._list);
|
|
250
|
+
}
|
|
247
251
|
}
|
|
248
252
|
|
|
249
253
|
class PreloadManager {
|
|
@@ -312,7 +316,11 @@ class PreloadManager {
|
|
|
312
316
|
static async loadData(dataUnit, request, loadFromServer) {
|
|
313
317
|
try {
|
|
314
318
|
if (PreloadManager.isCacheEnabled(dataUnit)) {
|
|
315
|
-
|
|
319
|
+
const useCache = [
|
|
320
|
+
"EZ_GRID_LOADING_SOURCE",
|
|
321
|
+
DataUnit.CHANGING_PAGE_LOADING_SOURCE,
|
|
322
|
+
DataUnit.ALL_RECORDS_SELECTION_SOURCE
|
|
323
|
+
].includes(request.source);
|
|
316
324
|
if (useCache) {
|
|
317
325
|
const isCacheEmpty = await PreloadManager.getRepository(dataUnit).isEmpty();
|
|
318
326
|
if (!isCacheEmpty) {
|
|
@@ -362,7 +370,7 @@ class PreloadManager {
|
|
|
362
370
|
const columnFilters = ColumnFilterManager.getColumnFilters(request.filters, "");
|
|
363
371
|
const { limit, offset, sort } = request;
|
|
364
372
|
PreloadManager.getRepository(dataUnit)
|
|
365
|
-
.load(ColumnFilterManager.getFilterFunction(dataUnit, Array.from(columnFilters.values())),
|
|
373
|
+
.load(ColumnFilterManager.getFilterFunction(dataUnit, Array.from(columnFilters.values())), SortingUtils.getSortingFunction(dataUnit, sort), offset, limit)
|
|
366
374
|
.then(loadResult => {
|
|
367
375
|
const stillLoading = PreloadManager._loadingStatus.get(dataUnit.name);
|
|
368
376
|
const { count, result: records } = loadResult;
|
|
@@ -379,10 +387,45 @@ class PreloadManager {
|
|
|
379
387
|
.catch(reason => reject(reason));
|
|
380
388
|
});
|
|
381
389
|
}
|
|
390
|
+
static getCachedRecords(dataUnit) {
|
|
391
|
+
return PreloadManager.getRepository(dataUnit).getFromCache();
|
|
392
|
+
}
|
|
382
393
|
}
|
|
383
394
|
PreloadManager._repositories = new Map();
|
|
384
395
|
PreloadManager._loadingStatus = new Map();
|
|
385
396
|
|
|
397
|
+
function applyFilter(records, dataUnit, filters) {
|
|
398
|
+
const columnFilters = ColumnFilterManager.getColumnFilters(filters, "");
|
|
399
|
+
if (!(columnFilters === null || columnFilters === void 0 ? void 0 : columnFilters.size)) {
|
|
400
|
+
return records;
|
|
401
|
+
}
|
|
402
|
+
const filterFunction = ColumnFilterManager.getFilterFunction(dataUnit, Array.from(columnFilters.values()));
|
|
403
|
+
if (filterFunction == undefined) {
|
|
404
|
+
return records;
|
|
405
|
+
}
|
|
406
|
+
return records.filter(filterFunction);
|
|
407
|
+
}
|
|
408
|
+
function applySorting(records, dataUnit, sorting) {
|
|
409
|
+
if (sorting == undefined || sorting.length == 0) {
|
|
410
|
+
return records;
|
|
411
|
+
}
|
|
412
|
+
const sortingFunction = SortingUtils.getSortingFunction(dataUnit, sorting);
|
|
413
|
+
if (sortingFunction == undefined) {
|
|
414
|
+
return records;
|
|
415
|
+
}
|
|
416
|
+
return records.sort(sortingFunction);
|
|
417
|
+
}
|
|
418
|
+
function buildPaginationInfo(records, offset = 0, limit = 0) {
|
|
419
|
+
const lastRecord = Math.min(offset + limit, records === null || records === void 0 ? void 0 : records.length);
|
|
420
|
+
return {
|
|
421
|
+
currentPage: limit === 0 ? 0 : Math.ceil(offset / limit),
|
|
422
|
+
firstRecord: offset,
|
|
423
|
+
lastRecord: lastRecord,
|
|
424
|
+
total: records === null || records === void 0 ? void 0 : records.length,
|
|
425
|
+
hasMore: !!((records === null || records === void 0 ? void 0 : records.length) - lastRecord),
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
|
|
386
429
|
class InMemoryLoader {
|
|
387
430
|
constructor(metadata, records) {
|
|
388
431
|
this.metadata = metadata;
|
|
@@ -395,9 +438,13 @@ class InMemoryLoader {
|
|
|
395
438
|
this.dataUnit.loadMetadata().then(() => this.dataUnit.loadData());
|
|
396
439
|
}
|
|
397
440
|
getRecordsToLoad() {
|
|
398
|
-
if (this._initialRecords == undefined
|
|
441
|
+
if (this._initialRecords == undefined && this.dataUnit.records.length > 0) {
|
|
399
442
|
this._initialRecords = this.dataUnit.records;
|
|
400
443
|
}
|
|
444
|
+
const addedRecords = this.dataUnit.getAddedRecords();
|
|
445
|
+
if (addedRecords) {
|
|
446
|
+
return [...this._initialRecords, ...addedRecords];
|
|
447
|
+
}
|
|
401
448
|
return this._initialRecords;
|
|
402
449
|
}
|
|
403
450
|
get dataUnit() {
|
|
@@ -440,7 +487,7 @@ class InMemoryLoader {
|
|
|
440
487
|
this._initialRecords = newRecords;
|
|
441
488
|
if (this._dataUnit) {
|
|
442
489
|
//Isso força o refresh internamente no datunit
|
|
443
|
-
this._dataUnit.
|
|
490
|
+
this._dataUnit.loadData();
|
|
444
491
|
}
|
|
445
492
|
}
|
|
446
493
|
get metadata() {
|
|
@@ -456,30 +503,9 @@ class InMemoryLoader {
|
|
|
456
503
|
return StringUtils.generateUUID();
|
|
457
504
|
}
|
|
458
505
|
inMemoryLoader(dataUnit, request, recordsIn) {
|
|
459
|
-
let records =
|
|
460
|
-
records =
|
|
461
|
-
return Promise.resolve({ records, paginationInfo: buildPaginationInfo(request,
|
|
462
|
-
}
|
|
463
|
-
applyFilter(records, dataUnit, filters) {
|
|
464
|
-
const columnFilters = ColumnFilterManager.getColumnFilters(filters, "");
|
|
465
|
-
if (columnFilters == undefined || columnFilters.size == 0) {
|
|
466
|
-
return records;
|
|
467
|
-
}
|
|
468
|
-
const filterFunciton = ColumnFilterManager.getFilterFunction(dataUnit, Array.from(columnFilters.values()));
|
|
469
|
-
if (filterFunciton == undefined) {
|
|
470
|
-
return records;
|
|
471
|
-
}
|
|
472
|
-
return records.filter(filterFunciton);
|
|
473
|
-
}
|
|
474
|
-
applySorting(records, dataUnit, sorting) {
|
|
475
|
-
if (sorting == undefined || sorting.length == 0) {
|
|
476
|
-
return records;
|
|
477
|
-
}
|
|
478
|
-
const sortingFunction = PreloadManager.getSortingFunction(dataUnit, sorting);
|
|
479
|
-
if (sortingFunction == undefined) {
|
|
480
|
-
return records;
|
|
481
|
-
}
|
|
482
|
-
return records.sort(sortingFunction);
|
|
506
|
+
let records = applyFilter(recordsIn, dataUnit, request.filters);
|
|
507
|
+
records = applySorting(records, dataUnit, request.sort);
|
|
508
|
+
return Promise.resolve({ records, paginationInfo: buildPaginationInfo(records, request.offset, request.limit) });
|
|
483
509
|
}
|
|
484
510
|
metadaLoader() {
|
|
485
511
|
return Promise.resolve(this._metadata);
|
|
@@ -512,19 +538,6 @@ class InMemoryLoader {
|
|
|
512
538
|
}
|
|
513
539
|
}
|
|
514
540
|
InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME = "InMemoryDataUnit";
|
|
515
|
-
function buildPaginationInfo({ offset, limit }, records) {
|
|
516
|
-
if (offset === undefined || limit === undefined) {
|
|
517
|
-
return undefined;
|
|
518
|
-
}
|
|
519
|
-
const lastRecord = Math.min(offset + limit, records.length);
|
|
520
|
-
return {
|
|
521
|
-
currentPage: Math.ceil(offset / limit),
|
|
522
|
-
firstRecord: offset,
|
|
523
|
-
lastRecord: lastRecord,
|
|
524
|
-
total: records.length,
|
|
525
|
-
hasMore: !!(records.length - lastRecord),
|
|
526
|
-
};
|
|
527
|
-
}
|
|
528
541
|
|
|
529
542
|
class DatasetStrategy {
|
|
530
543
|
canSlice() {
|
|
@@ -725,6 +738,9 @@ class DataUnitDataLoader {
|
|
|
725
738
|
});
|
|
726
739
|
});
|
|
727
740
|
}
|
|
741
|
+
static getCachedRecords(dataUnit) {
|
|
742
|
+
return PreloadManager.getCachedRecords(dataUnit);
|
|
743
|
+
}
|
|
728
744
|
static async loadFromServer(dataUnit, request, loadingInfo) {
|
|
729
745
|
try {
|
|
730
746
|
//Registramos a request com as informações de carga para determinarmos a última.
|
|
@@ -925,6 +941,7 @@ class DataUnitFetcher {
|
|
|
925
941
|
dataUnit.saveLoader = (_dataUnit, changes) => this.saveData(dataUnit, changes);
|
|
926
942
|
dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
|
|
927
943
|
dataUnit.recordLoader = (dataUnit, recordIds) => this.loadRecord(dataUnit, recordIds);
|
|
944
|
+
dataUnit.allRecordsLoader = (dataUnit) => DataUnitDataLoader.getCachedRecords(dataUnit);
|
|
928
945
|
return dataUnit;
|
|
929
946
|
}
|
|
930
947
|
loadMetadata(dataUnit) {
|
|
@@ -1143,4 +1160,4 @@ class DataUnitFetcher {
|
|
|
1143
1160
|
}
|
|
1144
1161
|
}
|
|
1145
1162
|
|
|
1146
|
-
export { DataUnitFetcher as D, InMemoryLoader as I, PesquisaFetcher as P, PreloadManager as a };
|
|
1163
|
+
export { DataUnitFetcher as D, InMemoryLoader as I, PesquisaFetcher as P, PreloadManager as a, applyFilter as b, applySorting as c, buildPaginationInfo as d };
|