@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-50122.0 → 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 +23 -7
- package/dist/cjs/snk-filter-detail.cjs.entry.js +4 -1
- package/dist/cjs/snk-filter-item.cjs.entry.js +10 -6
- 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 +3 -2
- 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/filter-item/snk-filter-detail.js +22 -1
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +28 -6
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +2 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +20 -3
- 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 +2 -1
- 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 +21 -4
- package/dist/components/snk-filter-detail2.js +5 -1
- package/dist/components/snk-filter-item2.js +11 -6
- 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 +6 -5
- 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 +23 -7
- package/dist/esm/snk-filter-detail.entry.js +4 -1
- package/dist/esm/snk-filter-item.entry.js +10 -6
- 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 +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-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-54a5d52a.entry.js +1 -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-e8763234.entry.js +1 -0
- 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/filter-item/snk-filter-detail.d.ts +4 -0
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +6 -2
- package/dist/types/components/snk-filter-bar/snk-filter-bar.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 +17 -2
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +1 -1
- package/dist/types/components.d.ts +33 -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-2d919e32.entry.js +0 -1
- package/dist/sankhyablocks/p-6c9adfca.js +0 -1
- package/dist/sankhyablocks/p-85ba3d6b.entry.js +0 -1
- package/dist/sankhyablocks/p-86801b08.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-b10b9934.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-d5cb4b5a.entry.js +0 -1
- package/dist/sankhyablocks/p-d6317851.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
|
@@ -2,50 +2,102 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-f9e81701.js');
|
|
5
|
+
const index$1 = require('./index-f9e81701.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
|
+
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
7
8
|
const constants = require('./constants-35ddd366.js');
|
|
8
|
-
const taskbarElements = require('./taskbar-elements-
|
|
9
|
-
require('./
|
|
10
|
-
const pesquisaFetcher = require('./pesquisa-fetcher-
|
|
11
|
-
const
|
|
12
|
-
const index
|
|
9
|
+
const taskbarElements = require('./taskbar-elements-d9392685.js');
|
|
10
|
+
const formConfigFetcher = require('./form-config-fetcher-cdd644a7.js');
|
|
11
|
+
const pesquisaFetcher = require('./pesquisa-fetcher-90b801fb.js');
|
|
12
|
+
const IExporterProvider = require('./IExporterProvider-f50b6846.js');
|
|
13
|
+
const index = require('./index-0922807b.js');
|
|
13
14
|
require('./ISave-e91b70a7.js');
|
|
14
15
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
15
16
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
16
17
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
17
|
-
const formConfigFetcher = require('./form-config-fetcher-d73f4449.js');
|
|
18
18
|
const fieldSearch = require('./field-search-f56aa7d6.js');
|
|
19
|
-
const ConfigStorage = require('./ConfigStorage-
|
|
20
|
-
const SnkFormConfigManager = require('./SnkFormConfigManager-
|
|
21
|
-
require('./
|
|
19
|
+
const ConfigStorage = require('./ConfigStorage-085c7117.js');
|
|
20
|
+
const SnkFormConfigManager = require('./SnkFormConfigManager-8986431f.js');
|
|
21
|
+
const RecordIDUtils = require('./RecordIDUtils-3735135c.js');
|
|
22
|
+
const index$2 = require('./index-102ba62d.js');
|
|
22
23
|
require('./PrintUtils-bcaeb82f.js');
|
|
23
24
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
|
25
|
+
require('@sankhyalabs/core/dist/utils/SortingUtils');
|
|
24
26
|
require('./ResourceIDUtils-5ff86aa7.js');
|
|
25
27
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource');
|
|
26
28
|
|
|
27
29
|
const REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "MORE_OPTIONS"];
|
|
28
30
|
const REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER", "MORE_OPTIONS"];
|
|
29
31
|
|
|
30
|
-
|
|
32
|
+
class ClientSideExporterProvider extends IExporterProvider.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 RecordIDUtils.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
|
+
index.DataExporterOption.EXPORT_BY_EMAIL,
|
|
59
|
+
index.DataExporterOption.EXPORT_PDF_TO_EMAIL,
|
|
60
|
+
index.DataExporterOption.EXPORT_XLS_TO_EMAIL,
|
|
61
|
+
index.DataExporterOption.EXPORT_PAGE_TO_PDF,
|
|
62
|
+
index.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 === core.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}";
|
|
31
83
|
|
|
32
84
|
const SnkSimpleCrud = class {
|
|
33
85
|
constructor(hostRef) {
|
|
34
|
-
index.registerInstance(this, hostRef);
|
|
35
|
-
this.dataStateChange = index.createEvent(this, "dataStateChange", 3);
|
|
36
|
-
this.dataUnitReady = index.createEvent(this, "dataUnitReady", 3);
|
|
37
|
-
this.actionClick = index.createEvent(this, "actionClick", 7);
|
|
38
|
-
this.formItemsReady = index.createEvent(this, "formItemsReady", 7);
|
|
39
|
-
this.configuratorSave = index.createEvent(this, "configuratorSave", 7);
|
|
40
|
-
this.configuratorCancel = index.createEvent(this, "configuratorCancel", 7);
|
|
41
|
-
this._multiSelectionListDataSource = new
|
|
86
|
+
index$1.registerInstance(this, hostRef);
|
|
87
|
+
this.dataStateChange = index$1.createEvent(this, "dataStateChange", 3);
|
|
88
|
+
this.dataUnitReady = index$1.createEvent(this, "dataUnitReady", 3);
|
|
89
|
+
this.actionClick = index$1.createEvent(this, "actionClick", 7);
|
|
90
|
+
this.formItemsReady = index$1.createEvent(this, "formItemsReady", 7);
|
|
91
|
+
this.configuratorSave = index$1.createEvent(this, "configuratorSave", 7);
|
|
92
|
+
this.configuratorCancel = index$1.createEvent(this, "configuratorCancel", 7);
|
|
93
|
+
this._multiSelectionListDataSource = new IExporterProvider.SnkMultiSelectionListDataSource();
|
|
42
94
|
this._keyDownHandler = (event) => this.keyDownListener(event);
|
|
43
95
|
this._formConfigFetcher = new formConfigFetcher.FormConfigFetcher();
|
|
44
96
|
this._taskbarProcessor = new fieldSearch.TaskbarProcessor({
|
|
45
|
-
"snkSimpleCrudTaskbar.form_regular": this.getButtons(false, taskbarElements.TaskbarElement.GRID_MODE),
|
|
46
|
-
"snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, taskbarElements.TaskbarElement.FORM_MODE),
|
|
47
|
-
"snkSimpleCrudTaskbar.form_selected": this.getButtons(true, taskbarElements.TaskbarElement.GRID_MODE),
|
|
48
|
-
"snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, taskbarElements.TaskbarElement.FORM_MODE),
|
|
97
|
+
"snkSimpleCrudTaskbar.form_regular": this.getButtons(false, [taskbarElements.TaskbarElement.GRID_MODE]),
|
|
98
|
+
"snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, [taskbarElements.TaskbarElement.DATA_EXPORTER, taskbarElements.TaskbarElement.FORM_MODE]),
|
|
99
|
+
"snkSimpleCrudTaskbar.form_selected": this.getButtons(true, [taskbarElements.TaskbarElement.GRID_MODE]),
|
|
100
|
+
"snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, [taskbarElements.TaskbarElement.DATA_EXPORTER, taskbarElements.TaskbarElement.FORM_MODE]),
|
|
49
101
|
"snkSimpleCrudTaskbar.finish_edition": ["CANCEL", "SAVE"]
|
|
50
102
|
});
|
|
51
103
|
this._showPopUpGridConfig = false;
|
|
@@ -56,12 +108,14 @@ const SnkSimpleCrud = class {
|
|
|
56
108
|
this._customContainerId = `SNK-SIMPLE-CRUD-CUSTOM-CONTAINER-${core.StringUtils.generateUUID()}`;
|
|
57
109
|
this.dataState = undefined;
|
|
58
110
|
this.dataUnit = undefined;
|
|
111
|
+
this.entityName = undefined;
|
|
59
112
|
this.mode = constants.SIMPLE_CRUD_MODE.SERVER;
|
|
60
113
|
this.gridConfig = undefined;
|
|
61
114
|
this.formConfig = undefined;
|
|
62
115
|
this._formFields = [];
|
|
63
116
|
this.multipleSelection = undefined;
|
|
64
117
|
this.useCancelConfirm = true;
|
|
118
|
+
this.pageSize = 150;
|
|
65
119
|
this.resourceID = undefined;
|
|
66
120
|
this.taskbarManager = undefined;
|
|
67
121
|
this.messagesBuilder = undefined;
|
|
@@ -83,9 +137,9 @@ const SnkSimpleCrud = class {
|
|
|
83
137
|
this.loadFormConfig(true);
|
|
84
138
|
this.loadGridConfig(true);
|
|
85
139
|
}
|
|
86
|
-
getButtons(selected,
|
|
140
|
+
getButtons(selected, extraButtons) {
|
|
87
141
|
return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
|
|
88
|
-
.concat(
|
|
142
|
+
.concat(extraButtons));
|
|
89
143
|
}
|
|
90
144
|
addConfigButton(buttons) {
|
|
91
145
|
if (this.configName === undefined) {
|
|
@@ -125,6 +179,12 @@ const SnkSimpleCrud = class {
|
|
|
125
179
|
}
|
|
126
180
|
evt.stopPropagation();
|
|
127
181
|
}
|
|
182
|
+
async onChangeEntityName(newValue) {
|
|
183
|
+
if (this.dataUnit)
|
|
184
|
+
return;
|
|
185
|
+
const application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
186
|
+
this.dataUnit = await application.getDataUnit(newValue, null, null, this.configName);
|
|
187
|
+
}
|
|
128
188
|
onModeChange() {
|
|
129
189
|
if (this.mode == constants.SIMPLE_CRUD_MODE.IN_MEMORY) {
|
|
130
190
|
this.initInMemoryDataUnit();
|
|
@@ -176,10 +236,15 @@ const SnkSimpleCrud = class {
|
|
|
176
236
|
this._showPopUpGridConfig = true;
|
|
177
237
|
});
|
|
178
238
|
}
|
|
179
|
-
openFormConfig() {
|
|
239
|
+
async openFormConfig() {
|
|
240
|
+
var _a, _b;
|
|
180
241
|
//No momento não daremos suporte para configuraçao de formulário quando houver legacy config
|
|
181
|
-
if (this.formLegacyConfigName)
|
|
242
|
+
if (this.formLegacyConfigName) {
|
|
243
|
+
const title = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.formConfigUnavaliable.title", undefined);
|
|
244
|
+
const message = (_b = this.messagesBuilder) === null || _b === void 0 ? void 0 : _b.getMessage("snkSimpleCrud.formConfigUnavaliable.message", undefined);
|
|
245
|
+
await this.application.alert(title, message);
|
|
182
246
|
return;
|
|
247
|
+
}
|
|
183
248
|
this._showFormConfig = true;
|
|
184
249
|
}
|
|
185
250
|
addGridLegacyConfigName() {
|
|
@@ -232,6 +297,7 @@ const SnkSimpleCrud = class {
|
|
|
232
297
|
}
|
|
233
298
|
async componentWillRender() {
|
|
234
299
|
this._resourceID = await this.application.getResourceID();
|
|
300
|
+
this.dataExporterProviderStore();
|
|
235
301
|
this._taskbarProcessor.process(this.getTaskBarId(), this.taskbarManager, this.dataState, this.getTaskBarDisabledButtons());
|
|
236
302
|
if (this.configName === undefined) {
|
|
237
303
|
return;
|
|
@@ -248,18 +314,21 @@ const SnkSimpleCrud = class {
|
|
|
248
314
|
this.onModeChange();
|
|
249
315
|
this.configDatasource();
|
|
250
316
|
}
|
|
317
|
+
componentDidLoad() {
|
|
318
|
+
utils.CSSVarsUtils.applyVarsGrid(this._element, this._grid);
|
|
319
|
+
}
|
|
251
320
|
configDatasource() {
|
|
252
321
|
this._multiSelectionListDataSource.setApplication(this.application);
|
|
253
322
|
this._multiSelectionListDataSource.setDataUnit(this.dataUnit);
|
|
254
323
|
}
|
|
255
324
|
getTaskBarId() {
|
|
256
|
-
var _a, _b
|
|
325
|
+
var _a, _b;
|
|
257
326
|
if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
|
|
258
327
|
return "snkSimpleCrudTaskbar.finish_edition";
|
|
259
328
|
}
|
|
260
329
|
if (((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.selectionInfo) &&
|
|
261
330
|
!this.dataState.selectionInfo.isAllRecords() &&
|
|
262
|
-
|
|
331
|
+
this.dataState.selectionInfo.length > 0) {
|
|
263
332
|
return this._currentViewMode === constants.VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_selected" : "snkSimpleCrudTaskbar.form_selected";
|
|
264
333
|
}
|
|
265
334
|
return this._currentViewMode === constants.VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
|
|
@@ -304,6 +373,13 @@ const SnkSimpleCrud = class {
|
|
|
304
373
|
var _a;
|
|
305
374
|
(_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.close();
|
|
306
375
|
}
|
|
376
|
+
updateConfig() {
|
|
377
|
+
if (this._formConfigManager == undefined) {
|
|
378
|
+
this._formConfigManager = new SnkFormConfigManager.SnkFormConfigManager(this.configName, this.resolveResourceID());
|
|
379
|
+
}
|
|
380
|
+
this._formConfigManager.setConfig(this.formConfig);
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
307
383
|
processMetadata() {
|
|
308
384
|
const fieldsMetadataElem = this._element.querySelectorAll("snk-field-metadata");
|
|
309
385
|
const fieldMetadata = [];
|
|
@@ -441,8 +517,8 @@ const SnkSimpleCrud = class {
|
|
|
441
517
|
}
|
|
442
518
|
getTopTaskBarId() {
|
|
443
519
|
var _a;
|
|
444
|
-
return ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? `snkGridTopTaskbar.finish_edition${index
|
|
445
|
-
`snkGridTopTaskbar.regular${index
|
|
520
|
+
return ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? `snkGridTopTaskbar.finish_edition${index.PresentationMode.PRIMARY}` :
|
|
521
|
+
`snkGridTopTaskbar.regular${index.PresentationMode.PRIMARY}`;
|
|
446
522
|
}
|
|
447
523
|
async keyDownListener(event) {
|
|
448
524
|
if (!event.ctrlKey || event.key == undefined || event.key.toUpperCase() !== "F") {
|
|
@@ -492,12 +568,26 @@ const SnkSimpleCrud = class {
|
|
|
492
568
|
.then(() => {
|
|
493
569
|
this.setGridConfig(config);
|
|
494
570
|
this.closeGridConfig();
|
|
571
|
+
this.dataExporterProviderStore();
|
|
495
572
|
});
|
|
496
573
|
evt.stopPropagation();
|
|
497
574
|
}
|
|
575
|
+
async dataExporterProviderStore() {
|
|
576
|
+
if (this.dataUnit == undefined) {
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
if (this._grid == undefined) {
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
const dataExporterProvider = new ClientSideExporterProvider(this.dataUnit, this._grid);
|
|
583
|
+
index$2.store.set("exporterProviders", Object.assign(Object.assign({}, index$2.store.get("exporterProviders")), { [this.getDataExporterStoreKey()]: dataExporterProvider }));
|
|
584
|
+
}
|
|
585
|
+
getDataExporterStoreKey() {
|
|
586
|
+
return `SnkSimpleCrudDataExporter:${this.configName == undefined ? this.dataUnit.name : this.configName}`;
|
|
587
|
+
}
|
|
498
588
|
setGridConfig(config) {
|
|
499
589
|
this.gridConfig = config;
|
|
500
|
-
|
|
590
|
+
IExporterProvider.CrudUtils.assertDefaultSorting(this.gridConfig, this.dataUnit);
|
|
501
591
|
}
|
|
502
592
|
setFormConfig(config, forceUpdate) {
|
|
503
593
|
if (this.formConfig && !forceUpdate)
|
|
@@ -510,6 +600,15 @@ const SnkSimpleCrud = class {
|
|
|
510
600
|
closeFormConfig() {
|
|
511
601
|
this._showFormConfig = false;
|
|
512
602
|
}
|
|
603
|
+
getPageSize() {
|
|
604
|
+
if (this.mode === constants.SIMPLE_CRUD_MODE.IN_MEMORY) {
|
|
605
|
+
return 0;
|
|
606
|
+
}
|
|
607
|
+
if (this.pageSize == undefined) {
|
|
608
|
+
return 150;
|
|
609
|
+
}
|
|
610
|
+
return this.pageSize;
|
|
611
|
+
}
|
|
513
612
|
//No momento não daremos suporte para configuração de formulário quando houver formLegacyConfigName
|
|
514
613
|
handleShowFormConfig() {
|
|
515
614
|
return this._showFormConfig && !this.formLegacyConfigName;
|
|
@@ -517,19 +616,28 @@ const SnkSimpleCrud = class {
|
|
|
517
616
|
resolveResourceID() {
|
|
518
617
|
return core.StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
|
|
519
618
|
}
|
|
619
|
+
getFormConfig() {
|
|
620
|
+
var _a, _b;
|
|
621
|
+
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);
|
|
622
|
+
if (!this.configName && !configFromManager) {
|
|
623
|
+
return this.formConfig;
|
|
624
|
+
}
|
|
625
|
+
return configFromManager;
|
|
626
|
+
}
|
|
520
627
|
/* istanbul ignore next */
|
|
521
628
|
render() {
|
|
522
|
-
var _a
|
|
629
|
+
var _a;
|
|
523
630
|
if (this.dataUnit == undefined) {
|
|
524
631
|
return;
|
|
525
632
|
}
|
|
526
|
-
return (index.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(constants.VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, index.h("header", null, index.h("slot", { name: "snkSimpleCrudHeader" })), index.h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, index.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: index
|
|
633
|
+
return (index$1.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(constants.VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, index$1.h("header", null, index$1.h("slot", { name: "snkSimpleCrudHeader" })), index$1.h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, index$1.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: index.PresentationMode.SECONDARY }, index$1.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), index$1.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index$1.h("stack-item", null, index$1.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(constants.VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(pesquisaFetcher.InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
|
527
634
|
? undefined
|
|
528
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, index.h("div", { slot: "footer" }, index.h("slot", { name: "snkSimpleCrudFooter" })))), index.h("stack-item", null, index.h("ez-form", { class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config:
|
|
635
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, index$1.h("div", { slot: "footer" }, index$1.h("slot", { name: "snkSimpleCrudFooter" })))), index$1.h("stack-item", null, index$1.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() && index$1.h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && index$1.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 })), index$1.h("div", { id: `${this._customContainerId}` }, index$1.h("slot", { name: "SnkConfigContainerSlot" }))), index$1.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index$1.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
|
529
636
|
}
|
|
530
|
-
get _element() { return index.getElement(this); }
|
|
637
|
+
get _element() { return index$1.getElement(this); }
|
|
531
638
|
static get watchers() { return {
|
|
532
639
|
"resourceID": ["handleResourceIDChanged"],
|
|
640
|
+
"entityName": ["onChangeEntityName"],
|
|
533
641
|
"mode": ["onModeChange"],
|
|
534
642
|
"dataState": ["observeDataState"],
|
|
535
643
|
"formLegacyConfigName": ["observeFormLegacy"],
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-f9e81701.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
7
|
const AuthorizationConfig = require('./AuthorizationConfig-79ffae4b.js');
|
|
8
|
-
const taskbarElements = require('./taskbar-elements-
|
|
8
|
+
const taskbarElements = require('./taskbar-elements-d9392685.js');
|
|
9
9
|
const index$1 = require('./index-0922807b.js');
|
|
10
10
|
require('./index-102ba62d.js');
|
|
11
11
|
|
|
@@ -166,8 +166,9 @@ const SnkTaskbar = class {
|
|
|
166
166
|
className += "ez-padding-left--medium";
|
|
167
167
|
}
|
|
168
168
|
const taskbarElement = taskbarElements.TaskbarElement[def.toString()];
|
|
169
|
+
const dataExporterStoreKey = this._element.dataset.exporterStoreKey || this.configName;
|
|
169
170
|
if (taskbarElement) {
|
|
170
|
-
return taskbarElements.buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.buildDynamicActionsList(),
|
|
171
|
+
return taskbarElements.buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.buildDynamicActionsList(), dataExporterStoreKey, this.presentationMode);
|
|
171
172
|
}
|
|
172
173
|
else {
|
|
173
174
|
return taskbarElements.buildCustomButton(def, className, this.getIdElemBtnCustom(def), elem => this.elementClick(elem), elem => this.isEnabled(elem));
|
|
@@ -50,7 +50,7 @@ const buildCustomButton = (def, className, dataElementId, action, isEnabled) =>
|
|
|
50
50
|
return textButton(def.name, className, dataElementId, text, hint, action, isEnabled);
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
-
const buildElem = (element, className, dataElementId, getTitle, action, isEnabled, actions,
|
|
53
|
+
const buildElem = (element, className, dataElementId, getTitle, action, isEnabled, actions, dataExporterStoreKey, presentationMode) => {
|
|
54
54
|
var _a;
|
|
55
55
|
const title = getTitle(element);
|
|
56
56
|
switch (element) {
|
|
@@ -93,7 +93,7 @@ const buildElem = (element, className, dataElementId, getTitle, action, isEnable
|
|
|
93
93
|
case exports.TaskbarElement.DIVIDER:
|
|
94
94
|
return index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin--none ez-margin-left--medium", "data-taskbar-divider": true });
|
|
95
95
|
case exports.TaskbarElement.DATA_EXPORTER:
|
|
96
|
-
const provider = (_a = index$1.store.get("exporterProviders")) === null || _a === void 0 ? void 0 : _a[
|
|
96
|
+
const provider = (_a = index$1.store.get("exporterProviders")) === null || _a === void 0 ? void 0 : _a[dataExporterStoreKey];
|
|
97
97
|
return index.h("snk-data-exporter", { class: className, provider: provider, "data-element-id": dataElementId, "data-taskbar-element": element });
|
|
98
98
|
case exports.TaskbarElement.ATTACH:
|
|
99
99
|
return iconButton("anexo", element, className, dataElementId, title, action, isEnabled);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
-
import { DataUnit, ApplicationContext } from "@sankhyalabs/core";
|
|
2
|
+
import { DataUnit, ApplicationContext, Action } from "@sankhyalabs/core";
|
|
3
3
|
import { AnexoSistemaFetcher, AttachFetcher, DataUnitFetcher } from "../../lib";
|
|
4
4
|
import { VIEW_MODE } from "../../lib/utils/constants";
|
|
5
5
|
import { AnexoSistemaDataUnitFactory, AttachFetcherDataUnitFactory, buildTaskBarManager, anexoSistemaCrudConfig, attachCrudConfig } from "./structure";
|
|
6
|
+
import InMemoryLoader from "../../lib/dataUnit/InMemoryLoader";
|
|
6
7
|
const RESOURCE_ID = 'AnexoSistema';
|
|
7
8
|
const DATA_UNIT_NAME = 'br.com.sankhya.core.v3.anexoSistema';
|
|
8
9
|
export class SnkAttach {
|
|
@@ -28,7 +29,7 @@ export class SnkAttach {
|
|
|
28
29
|
this.back.emit();
|
|
29
30
|
});
|
|
30
31
|
};
|
|
31
|
-
this.fetcherType =
|
|
32
|
+
this.fetcherType = undefined;
|
|
32
33
|
this.fetcher = undefined;
|
|
33
34
|
this.dataUnit = undefined;
|
|
34
35
|
this.dataUnitBuilder = undefined;
|
|
@@ -40,8 +41,8 @@ export class SnkAttach {
|
|
|
40
41
|
this.crudConfig = undefined;
|
|
41
42
|
}
|
|
42
43
|
registerKeyWatcher(newRegisterKey, oldRegisterKey) {
|
|
43
|
-
var _a, _b, _c, _d;
|
|
44
|
-
if (this._currentDataUnit
|
|
44
|
+
var _a, _b, _c, _d, _e, _f;
|
|
45
|
+
if (!this._currentDataUnit) {
|
|
45
46
|
this.loadAttachmentDataUnit();
|
|
46
47
|
}
|
|
47
48
|
if (oldRegisterKey !== newRegisterKey) {
|
|
@@ -56,11 +57,7 @@ export class SnkAttach {
|
|
|
56
57
|
if (hasMoreOneItem)
|
|
57
58
|
return;
|
|
58
59
|
}
|
|
59
|
-
return this._currentDataUnit
|
|
60
|
-
.loadMetadata()
|
|
61
|
-
.then(() => {
|
|
62
|
-
this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
|
|
63
|
-
});
|
|
60
|
+
return (_f = (_e = this._currentDataUnit) === null || _e === void 0 ? void 0 : _e.loadMetadata()) === null || _f === void 0 ? void 0 : _f.then(this._currentDataUnit.loadData.bind(undefined, undefined, true, this.registerKey));
|
|
64
61
|
}
|
|
65
62
|
}
|
|
66
63
|
/**
|
|
@@ -126,7 +123,7 @@ export class SnkAttach {
|
|
|
126
123
|
if (!this._currentDataUnit.metadata) {
|
|
127
124
|
this._currentDataUnit
|
|
128
125
|
.loadMetadata()
|
|
129
|
-
.then(() => this.crudConfig = anexoSistemaCrudConfig);
|
|
126
|
+
.then(() => this.crudConfig = Object.assign({}, anexoSistemaCrudConfig));
|
|
130
127
|
}
|
|
131
128
|
this._currentDataUnitBuilder = new AnexoSistemaDataUnitFactory(this.entityName, this.getMessage.bind(this));
|
|
132
129
|
this._currentDataUnit.addFilterProvider({
|
|
@@ -138,25 +135,29 @@ export class SnkAttach {
|
|
|
138
135
|
this._currentDataUnit.loadData().then(this.disableEditFieldsNotInForm.bind(this));
|
|
139
136
|
}
|
|
140
137
|
loadAttach() {
|
|
141
|
-
var _a;
|
|
138
|
+
var _a, _b, _c;
|
|
142
139
|
this._currentFetcher = new AttachFetcher();
|
|
143
|
-
this._currentDataUnit = new DataUnit();
|
|
140
|
+
this._currentDataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
|
|
144
141
|
this._currentDataUnit.addInterceptor({
|
|
145
|
-
interceptAction: (action) =>
|
|
142
|
+
interceptAction: (action) => {
|
|
143
|
+
var _a;
|
|
144
|
+
if (action.type === Action.METADATA_LOADED) {
|
|
145
|
+
this.crudConfig = Object.assign({}, attachCrudConfig);
|
|
146
|
+
(_a = this._crudElement) === null || _a === void 0 ? void 0 : _a.updateConfig();
|
|
147
|
+
}
|
|
148
|
+
return this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement);
|
|
149
|
+
}
|
|
146
150
|
});
|
|
147
151
|
this._currentDataUnitBuilder = new AttachFetcherDataUnitFactory(this.getMessage.bind(this));
|
|
148
152
|
(_a = this._currentDataUnitBuilder) === null || _a === void 0 ? void 0 : _a.initLoaders(this._currentDataUnit, this._currentFetcher, async () => {
|
|
149
|
-
await this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
|
|
150
153
|
this.returnToGridMode();
|
|
154
|
+
await this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
|
|
151
155
|
});
|
|
152
156
|
if (!this._currentDataUnit.metadata) {
|
|
153
|
-
this._currentDataUnit
|
|
154
|
-
|
|
155
|
-
.
|
|
156
|
-
this.
|
|
157
|
-
this._currentDataUnit
|
|
158
|
-
.loadData(undefined, undefined, true, this.registerKey)
|
|
159
|
-
.then(this.disableEditFieldsNotInForm.bind(this));
|
|
157
|
+
(_c = (_b = this._currentDataUnit) === null || _b === void 0 ? void 0 : _b.loadMetadata()) === null || _c === void 0 ? void 0 : _c.then(() => {
|
|
158
|
+
var _a, _b;
|
|
159
|
+
this.crudConfig = Object.assign({}, attachCrudConfig);
|
|
160
|
+
(_b = (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadData(undefined, undefined, true, this.registerKey)) === null || _b === void 0 ? void 0 : _b.then(this.disableEditFieldsNotInForm.bind(this));
|
|
160
161
|
});
|
|
161
162
|
}
|
|
162
163
|
}
|
|
@@ -174,15 +175,30 @@ export class SnkAttach {
|
|
|
174
175
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
175
176
|
}
|
|
176
177
|
componentWillRender() {
|
|
178
|
+
if (!this.fetcherType) {
|
|
179
|
+
this.fetcherType = "AnexoSistema";
|
|
180
|
+
}
|
|
177
181
|
if (this._currentDataUnit == null) {
|
|
178
182
|
this.loadAttachmentDataUnit();
|
|
179
183
|
}
|
|
180
184
|
}
|
|
185
|
+
async handleOnDataStateChange({ detail }) {
|
|
186
|
+
if (this.fetcherType !== 'Attach')
|
|
187
|
+
return;
|
|
188
|
+
if (!detail.insertionMode) {
|
|
189
|
+
this._currentDataUnit.disableField('DESCRICAO');
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
this._currentDataUnit.enableField('DESCRICAO');
|
|
193
|
+
}
|
|
194
|
+
await this._currentDataUnit.loadMetadata();
|
|
195
|
+
}
|
|
196
|
+
;
|
|
181
197
|
render() {
|
|
182
198
|
var _a, _b;
|
|
183
199
|
if (!this._currentDataUnit)
|
|
184
200
|
return null;
|
|
185
|
-
return (h("main", { class: "snk-attach__main" }, h("header", { class: "snk-attach__header" }, h("snk-simple-bar", { onExit: this.handleBack, messagesBuilder: this.messagesBuilder }, h("div", { slot: "rightSlot" }, h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })))), h("div", { class: "snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column" }, h("div", { class: "ez-box__container" }, h("snk-simple-crud", { ref: (el) => this._crudElement = el, dataUnit: this._currentDataUnit, taskbarManager: buildTaskBarManager(), gridConfig: (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid, formConfig: (_b = this.crudConfig) === null || _b === void 0 ? void 0 : _b.form, useCancelConfirm: false, onActionClick: this.handleTaskbarClick, messagesBuilder: this.messagesBuilder }, h("div", { slot: "snkSimpleCrudHeader" }, h("div", { class: "ez-flex ez-flex--column" }, h("span", { class: "ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium" }, this.getMessage("snkAttach.title")), h("span", { class: "ez-text ez-text--medium ez-text--secondary" }, this.getMessage("snkAttach.description")))))))));
|
|
201
|
+
return (h("main", { class: "snk-attach__main" }, h("header", { class: "snk-attach__header" }, h("snk-simple-bar", { onExit: this.handleBack, messagesBuilder: this.messagesBuilder }, h("div", { slot: "rightSlot" }, h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })))), h("div", { class: "snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column" }, h("div", { class: "ez-box__container" }, h("snk-simple-crud", { ref: (el) => this._crudElement = el, dataUnit: this._currentDataUnit, taskbarManager: buildTaskBarManager(), gridConfig: (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid, formConfig: (_b = this.crudConfig) === null || _b === void 0 ? void 0 : _b.form, useCancelConfirm: false, onActionClick: this.handleTaskbarClick, messagesBuilder: this.messagesBuilder, onDataStateChange: this.handleOnDataStateChange.bind(this) }, h("div", { slot: "snkSimpleCrudHeader" }, h("div", { class: "ez-flex ez-flex--column" }, h("span", { class: "ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium" }, this.getMessage("snkAttach.title")), h("span", { class: "ez-text ez-text--medium ez-text--secondary" }, this.getMessage("snkAttach.description")))))))));
|
|
186
202
|
}
|
|
187
203
|
static get is() { return "snk-attach"; }
|
|
188
204
|
static get encapsulation() { return "scoped"; }
|
|
@@ -218,8 +234,7 @@ export class SnkAttach {
|
|
|
218
234
|
"text": "FetcherType define o tipo de fetcher respons\u00E1vel por carregar os dados do DataUnit."
|
|
219
235
|
},
|
|
220
236
|
"attribute": "fetcher-type",
|
|
221
|
-
"reflect": false
|
|
222
|
-
"defaultValue": "\"AnexoSistema\""
|
|
237
|
+
"reflect": false
|
|
223
238
|
},
|
|
224
239
|
"fetcher": {
|
|
225
240
|
"type": "unknown",
|
package/dist/collection/components/snk-attach/structure/builder/attach-crud-config.builder.js
CHANGED
|
@@ -39,7 +39,7 @@ export const attachFetcherMetadataBuilder = {
|
|
|
39
39
|
label: "Attach List",
|
|
40
40
|
fields: [
|
|
41
41
|
{ name: "CODATA", label: getMessage("snkAttach.attachMetadata.lblCode"), dataType: DataType.TEXT },
|
|
42
|
-
{ name: "DESCRICAO", label: getMessage("snkAttach.attachMetadata.lblDescription"), dataType: DataType.TEXT },
|
|
42
|
+
{ name: "DESCRICAO", label: getMessage("snkAttach.attachMetadata.lblDescription"), dataType: DataType.TEXT, readOnly: false },
|
|
43
43
|
{ name: "ARQUIVO", label: getMessage("snkAttach.attachMetadata.lblFileOrLink"), dataType: DataType.TEXT },
|
|
44
44
|
{ name: "USUARIO", label: getMessage("snkAttach.attachMetadata.lblUser"), dataType: DataType.TEXT },
|
|
45
45
|
{ name: "DTALTER", label: getMessage("snkAttach.attachMetadata.lblDate"), dataType: DataType.TEXT },
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { Action, ApplicationContext, StringUtils } from
|
|
2
|
-
import { SaveErrorsEnum } from
|
|
3
|
-
import { AutorizationType } from
|
|
4
|
-
import { attachFetcherMetadataBuilder } from
|
|
5
|
-
import { VIEW_MODE } from
|
|
1
|
+
import { Action, ApplicationContext, StringUtils, } from '@sankhyalabs/core';
|
|
2
|
+
import { SaveErrorsEnum } from '../../../../../lib/http/data-fetcher/fetchers/AttachFetcher/interfaces';
|
|
3
|
+
import { AutorizationType } from '../../../../../lib/http/data-fetcher/fetchers/auth-fetcher';
|
|
4
|
+
import { attachFetcherMetadataBuilder } from '../../builder/attach-crud-config.builder';
|
|
5
|
+
import { VIEW_MODE } from '../../../../../lib/utils/constants';
|
|
6
|
+
import { applyFilter, applySorting, buildPaginationInfo } from '../../../../../lib/dataUnit/dataUnitInMemoryUtils';
|
|
6
7
|
const SERVICE_LOAD = "Attach.load";
|
|
7
8
|
export class AttachFetcherDataUnitFactory {
|
|
8
9
|
constructor(getMessage) {
|
|
9
10
|
this.getMessage = getMessage;
|
|
11
|
+
this._records = [];
|
|
10
12
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
11
13
|
}
|
|
12
14
|
initLoaders(dataUnit, fetcher, onSuccess) {
|
|
@@ -26,25 +28,30 @@ export class AttachFetcherDataUnitFactory {
|
|
|
26
28
|
metadataLoader(_) {
|
|
27
29
|
return Promise.resolve(attachFetcherMetadataBuilder);
|
|
28
30
|
}
|
|
29
|
-
async dataLoader(
|
|
31
|
+
async dataLoader(dataUnit, request) {
|
|
30
32
|
if (!request.source) {
|
|
31
|
-
return Promise.resolve({ records:
|
|
33
|
+
return Promise.resolve({ records: this._records });
|
|
32
34
|
}
|
|
33
|
-
|
|
34
|
-
criteria
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
35
|
+
if (!Number.isNaN(Number(request.source))) {
|
|
36
|
+
const criteria = {
|
|
37
|
+
criteria: {
|
|
38
|
+
codata: request.source,
|
|
39
|
+
tipoAnexo: "N"
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const applicationDataFetcher = await this._application.getDataFetcher();
|
|
43
|
+
const { anexos: { anexo = [] } } = await applicationDataFetcher.callServiceBroker(SERVICE_LOAD, JSON.stringify(criteria));
|
|
44
|
+
const records = [];
|
|
45
|
+
anexo.forEach((param) => {
|
|
46
|
+
records.push(Object.assign({ __record__id__: StringUtils.generateUUID(), CAMINHO_ARQUIVO: [{
|
|
47
|
+
name: param === null || param === void 0 ? void 0 : param.ARQUIVO,
|
|
48
|
+
}] }, param));
|
|
49
|
+
});
|
|
50
|
+
this._records = records;
|
|
51
|
+
}
|
|
52
|
+
let records = applyFilter(this._records, dataUnit, request.filters);
|
|
53
|
+
records = applySorting(records, dataUnit, request.sort);
|
|
54
|
+
return Promise.resolve({ records, paginationInfo: buildPaginationInfo(records, request.offset, request.limit) });
|
|
48
55
|
}
|
|
49
56
|
saveLoader(changes, fetcher) {
|
|
50
57
|
return new Promise((resolve) => {
|