@sankhyalabs/sankhyablocks 8.15.3 → 8.16.0-dev.10
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-942ce74b.js → ConfigStorage-a343e418.js} +1 -0
- package/dist/cjs/{SnkMultiSelectionListDataSource-3c08d25c.js → IExporterProvider-597949f9.js} +94 -4
- package/dist/cjs/RecordIDUtils-3735135c.js +43 -0
- package/dist/cjs/{SnkFormConfigManager-f9dc0d28.js → SnkFormConfigManager-166cbd1f.js} +8 -7
- package/dist/cjs/{SnkMessageBuilder-66aa2557.js → SnkMessageBuilder-897ffd08.js} +9 -13
- package/dist/cjs/{pesquisa-fetcher-562d281f.js → dataunit-fetcher-688d3f05.js} +87 -180
- package/dist/cjs/{index-0922807b.js → index-1dfc7a6e.js} +5 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pesquisa-fetcher-680e198f.js +166 -0
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +5 -3
- package/dist/cjs/snk-application.cjs.entry.js +35 -12
- package/dist/cjs/snk-attach.cjs.entry.js +71 -46
- package/dist/cjs/snk-crud.cjs.entry.js +101 -10
- package/dist/cjs/snk-data-exporter.cjs.entry.js +315 -85
- package/dist/cjs/snk-data-unit-8fa7917a.js +689 -0
- package/dist/cjs/snk-data-unit.cjs.entry.js +12 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +50 -10
- package/dist/cjs/snk-filter-bar.cjs.entry.js +6 -2
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +1 -1
- package/dist/cjs/snk-form-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-form-view.cjs.entry.js +67 -0
- package/dist/cjs/snk-form.cjs.entry.js +52 -7
- package/dist/cjs/snk-grid.cjs.entry.js +165 -108
- package/dist/cjs/{snk-guides-viewer-bb6087cd.js → snk-guides-viewer-9c682034.js} +43 -10
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +9 -7
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +268 -40
- package/dist/cjs/snk-taskbar.cjs.entry.js +4 -3
- package/dist/cjs/{taskbar-elements-3ecd1278.js → taskbar-elements-9ad1f9c0.js} +3 -3
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/snk-application/snk-application.js +35 -11
- package/dist/collection/components/snk-attach/snk-attach.js +67 -44
- package/dist/collection/components/snk-crud/interfaces/PropsCustomEditor.js +1 -0
- package/dist/collection/components/snk-crud/interfaces/PropsCustomRender.js +1 -0
- package/dist/collection/components/snk-crud/snk-crud.js +305 -7
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +136 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +161 -0
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +134 -7
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +97 -0
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +74 -0
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +54 -1
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterStrategy.js +1 -0
- package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +58 -0
- package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +55 -0
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +59 -52
- package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +62 -0
- package/dist/collection/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.js +88 -0
- package/dist/collection/components/snk-data-exporter/utils/ParserExport.js +20 -0
- package/dist/collection/components/snk-data-exporter/utils/RecordIDUtils.js +38 -0
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +538 -218
- package/dist/collection/components/snk-data-unit/test/resources/metadataMock.js +24 -0
- package/dist/collection/components/snk-data-unit/test/resources/parentMetadataMock.js +18 -0
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +22 -1
- package/dist/collection/components/snk-form/snk-form.js +102 -5
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +7 -6
- package/dist/collection/components/snk-form-config/snk-form-config.js +1 -1
- package/dist/collection/components/snk-grid/snk-grid.js +240 -101
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +406 -20
- 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/@types/index.js +5 -0
- package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +35 -0
- package/dist/collection/lib/configs/ConfigStorage.js +1 -0
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +7 -3
- package/dist/collection/lib/dataUnit/ValueFormatter.js +4 -0
- package/dist/collection/lib/dataUnit/interfaces/InMemoryLoaderConfig.js +1 -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 +11 -13
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +53 -4
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.js +22 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +4 -4
- package/dist/collection/lib/message/SnkMessageBuilder.js +5 -12
- package/dist/collection/lib/message/resources/snk-data-exporter.msg.js +2 -0
- package/dist/collection/lib/message/resources/snk-data-unit.msg.js +2 -1
- package/dist/components/ConfigStorage.js +1 -0
- package/dist/components/{field-search.js → IExporterProvider.js} +93 -6
- package/dist/components/ISave.js +47 -0
- package/dist/components/SnkFormConfigManager.js +7 -6
- package/dist/components/SnkMessageBuilder.js +9 -13
- package/dist/components/dataunit-fetcher.js +84 -182
- package/dist/components/index2.js +198 -33
- package/dist/components/pesquisa-fetcher.js +164 -0
- package/dist/components/snk-actions-button2.js +4 -11
- package/dist/components/snk-application2.js +31 -9
- package/dist/components/snk-attach2.js +65 -41
- package/dist/components/snk-crud.js +110 -11
- package/dist/components/snk-data-exporter2.js +309 -85
- package/dist/components/snk-data-unit2.js +485 -216
- package/dist/components/snk-detail-view2.js +96 -14
- package/dist/components/snk-expression-item2.js +1 -1
- package/dist/components/snk-filter-bar2.js +6 -1
- package/dist/components/snk-form-config2.js +1 -1
- package/dist/components/snk-form-view2.js +72 -1
- package/dist/components/snk-form.js +53 -6
- package/dist/components/snk-grid2.js +168 -106
- package/dist/components/snk-personalized-filter2.js +1 -1
- package/dist/components/snk-simple-crud2.js +263 -25
- package/dist/components/snk-taskbar2.js +6 -5
- package/dist/esm/{ConfigStorage-86187da3.js → ConfigStorage-3806514e.js} +1 -0
- package/dist/esm/{SnkMultiSelectionListDataSource-6a879955.js → IExporterProvider-63a188b6.js} +93 -5
- package/dist/esm/RecordIDUtils-87d02110.js +41 -0
- package/dist/esm/{SnkFormConfigManager-f53f9f87.js → SnkFormConfigManager-31b24066.js} +8 -7
- package/dist/esm/{SnkMessageBuilder-0a4becdd.js → SnkMessageBuilder-571462fb.js} +9 -13
- package/dist/esm/{pesquisa-fetcher-c7ce8ee7.js → dataunit-fetcher-264191b2.js} +83 -181
- package/dist/esm/{index-0ece87a6.js → index-3aa4977a.js} +6 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pesquisa-fetcher-03c8f919.js +164 -0
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +5 -3
- package/dist/esm/snk-application.entry.js +34 -11
- package/dist/esm/snk-attach.entry.js +66 -41
- package/dist/esm/snk-crud.entry.js +101 -10
- package/dist/esm/snk-data-exporter.entry.js +316 -86
- package/dist/esm/snk-data-unit-f5cbe64b.js +687 -0
- package/dist/esm/snk-data-unit.entry.js +12 -2
- package/dist/esm/snk-detail-view.entry.js +50 -10
- package/dist/esm/snk-filter-bar.entry.js +6 -2
- package/dist/esm/snk-filter-modal-item.entry.js +1 -1
- package/dist/esm/snk-form-config.entry.js +1 -1
- package/dist/esm/snk-form-view.entry.js +67 -0
- package/dist/esm/snk-form.entry.js +52 -7
- package/dist/esm/snk-grid.entry.js +163 -106
- package/dist/esm/{snk-guides-viewer-1d95ebf2.js → snk-guides-viewer-8f6960a2.js} +43 -10
- package/dist/esm/snk-guides-viewer.entry.js +9 -7
- package/dist/esm/snk-personalized-filter.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +256 -28
- package/dist/esm/snk-taskbar.entry.js +4 -3
- package/dist/esm/{taskbar-elements-2473c8ac.js → taskbar-elements-d59867f1.js} +3 -3
- package/dist/sankhyablocks/p-17def7cd.js +1 -0
- package/dist/sankhyablocks/p-1db45d26.entry.js +1 -0
- package/dist/sankhyablocks/p-28ee0972.js +1 -0
- package/dist/sankhyablocks/p-2a408684.js +1 -0
- package/dist/sankhyablocks/{p-eae7a817.entry.js → p-2c68b3ae.entry.js} +1 -1
- package/dist/sankhyablocks/p-30cf616e.js +1 -0
- package/dist/sankhyablocks/p-3a212712.js +1 -0
- package/dist/sankhyablocks/p-450c60e4.entry.js +1 -0
- package/dist/sankhyablocks/{p-a1d72395.entry.js → p-47db7e88.entry.js} +1 -1
- package/dist/sankhyablocks/p-4e5e1313.entry.js +1 -0
- package/dist/sankhyablocks/{p-aff76a53.js → p-52920496.js} +1 -1
- package/dist/sankhyablocks/p-62ba211a.entry.js +1 -0
- package/dist/sankhyablocks/p-6bb2f3e9.entry.js +1 -0
- package/dist/sankhyablocks/p-7505da04.entry.js +1 -0
- package/dist/sankhyablocks/p-7619bdb1.entry.js +11 -0
- package/dist/sankhyablocks/p-7a85fd49.entry.js +1 -0
- package/dist/sankhyablocks/{p-ae4fc9a9.js → p-7e7a7473.js} +1 -1
- package/dist/sankhyablocks/p-7ef9c55c.js +1 -0
- package/dist/sankhyablocks/p-80042dc6.entry.js +1 -0
- package/dist/sankhyablocks/p-8c59edd7.entry.js +1 -0
- package/dist/sankhyablocks/p-9606509c.entry.js +1 -0
- package/dist/sankhyablocks/p-9863d682.js +1 -0
- package/dist/sankhyablocks/p-ae93d46a.entry.js +1 -0
- package/dist/sankhyablocks/p-af8efd95.js +6 -0
- package/dist/sankhyablocks/p-d6e26ea8.entry.js +1 -0
- package/dist/sankhyablocks/p-f2809746.entry.js +1 -0
- package/dist/sankhyablocks/p-f4450320.entry.js +1 -0
- package/dist/sankhyablocks/p-fe79f83a.js +60 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +7 -3
- package/dist/types/components/snk-attach/snk-attach.d.ts +11 -9
- package/dist/types/components/snk-crud/interfaces/PropsCustomEditor.d.ts +4 -0
- package/dist/types/components/snk-crud/interfaces/PropsCustomRender.d.ts +4 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +45 -1
- package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +23 -0
- package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +28 -3
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +24 -0
- package/dist/types/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.d.ts +14 -0
- package/dist/types/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.d.ts +12 -0
- package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +24 -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 +4 -1
- package/dist/types/components/snk-data-exporter/structure/ItemBuilder.d.ts +21 -0
- package/dist/types/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.d.ts +77 -0
- package/dist/types/components/snk-data-exporter/utils/ParserExport.d.ts +4 -0
- package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +3 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +66 -2
- package/dist/types/components/snk-data-unit/test/resources/metadataMock.d.ts +3 -0
- package/dist/types/components/snk-data-unit/test/resources/parentMetadataMock.d.ts +3 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
- package/dist/types/components/snk-form/snk-form.d.ts +14 -0
- package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +2 -2
- package/dist/types/components/snk-grid/snk-grid.d.ts +46 -6
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +62 -4
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +1 -1
- package/dist/types/components.d.ts +261 -4
- package/dist/types/lib/@types/index.d.ts +5 -0
- package/dist/types/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.d.ts +11 -0
- package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +2 -1
- package/dist/types/lib/dataUnit/ValueFormatter.d.ts +2 -0
- package/dist/types/lib/dataUnit/interfaces/InMemoryLoaderConfig.d.ts +3 -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/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.d.ts +10 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.d.ts +7 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +6 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.d.ts +20 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.d.ts +3 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.d.ts +2 -1
- package/dist/types/lib/http/data-fetcher/fetchers/pesquisa-fetcher.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/snk-data-unit-41c29713.js +0 -462
- package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/index.js +0 -34
- package/dist/components/index3.js +0 -199
- package/dist/esm/snk-data-unit-de1d140d.js +0 -460
- package/dist/sankhyablocks/p-032fe52e.js +0 -1
- package/dist/sankhyablocks/p-03dcc5ff.entry.js +0 -1
- package/dist/sankhyablocks/p-0594db5a.entry.js +0 -1
- package/dist/sankhyablocks/p-06e13db2.js +0 -1
- package/dist/sankhyablocks/p-07a61550.entry.js +0 -1
- package/dist/sankhyablocks/p-1403a4b6.entry.js +0 -1
- package/dist/sankhyablocks/p-14a08904.entry.js +0 -1
- package/dist/sankhyablocks/p-15802c59.entry.js +0 -1
- package/dist/sankhyablocks/p-235dc7b1.js +0 -65
- package/dist/sankhyablocks/p-32556aa6.js +0 -1
- package/dist/sankhyablocks/p-38289a55.js +0 -1
- package/dist/sankhyablocks/p-3c632d48.js +0 -1
- package/dist/sankhyablocks/p-3f833983.entry.js +0 -1
- package/dist/sankhyablocks/p-52c8e589.js +0 -1
- package/dist/sankhyablocks/p-5e1502b6.entry.js +0 -11
- package/dist/sankhyablocks/p-74d349c3.entry.js +0 -1
- package/dist/sankhyablocks/p-93167e28.entry.js +0 -1
- package/dist/sankhyablocks/p-add17f6a.entry.js +0 -1
- package/dist/sankhyablocks/p-bd47dd16.entry.js +0 -1
- package/dist/sankhyablocks/p-c1f88236.entry.js +0 -1
- package/dist/sankhyablocks/p-ccdd5332.entry.js +0 -1
- package/dist/sankhyablocks/p-ee9536bc.entry.js +0 -1
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/index.d.ts +0 -3
@@ -2,51 +2,111 @@
|
|
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
7
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
8
8
|
const constants = require('./constants-35ddd366.js');
|
9
|
-
const taskbarElements = require('./taskbar-elements-
|
9
|
+
const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
|
10
10
|
require('./DataFetcher-313debd8.js');
|
11
|
-
|
12
|
-
const
|
13
|
-
const index
|
11
|
+
require('./pesquisa-fetcher-680e198f.js');
|
12
|
+
const IExporterProvider = require('./IExporterProvider-597949f9.js');
|
13
|
+
const index = require('./index-1dfc7a6e.js');
|
14
14
|
require('./ISave-e91b70a7.js');
|
15
15
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
16
16
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
17
|
+
const dataunitFetcher = require('./dataunit-fetcher-688d3f05.js');
|
17
18
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
18
19
|
const formConfigFetcher = require('./form-config-fetcher-2dd00e5b.js');
|
19
20
|
const fieldSearch = require('./field-search-f56aa7d6.js');
|
20
|
-
const ConfigStorage = require('./ConfigStorage-
|
21
|
-
const SnkFormConfigManager = require('./SnkFormConfigManager-
|
22
|
-
require('./
|
21
|
+
const ConfigStorage = require('./ConfigStorage-a343e418.js');
|
22
|
+
const SnkFormConfigManager = require('./SnkFormConfigManager-166cbd1f.js');
|
23
|
+
const RecordIDUtils = require('./RecordIDUtils-3735135c.js');
|
24
|
+
const index$2 = require('./index-102ba62d.js');
|
23
25
|
require('./PrintUtils-bcaeb82f.js');
|
26
|
+
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource');
|
24
27
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
28
|
+
require('@sankhyalabs/core/dist/utils/SortingUtils');
|
25
29
|
require('./ResourceIDUtils-5ff86aa7.js');
|
26
|
-
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource');
|
27
30
|
|
28
31
|
const REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "MORE_OPTIONS"];
|
29
32
|
const REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER", "MORE_OPTIONS"];
|
30
33
|
|
34
|
+
class ClientSideExporterProvider extends IExporterProvider.CommonsExporter {
|
35
|
+
getSelectedNumber() {
|
36
|
+
return this.dataUnit.getSelectionInfo().length;
|
37
|
+
}
|
38
|
+
getTotalRecords() {
|
39
|
+
var _a, _b, _c;
|
40
|
+
const { total } = ((_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo()) || {};
|
41
|
+
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;
|
42
|
+
}
|
43
|
+
getSelectedIDs() {
|
44
|
+
return RecordIDUtils.getSelectedIDs(this.dataUnit);
|
45
|
+
}
|
46
|
+
getRecordID() {
|
47
|
+
var _a, _b, _c;
|
48
|
+
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__;
|
49
|
+
}
|
50
|
+
async getRecords() {
|
51
|
+
if (this.dataUnit.records.length === 0) {
|
52
|
+
return Promise.resolve([]);
|
53
|
+
}
|
54
|
+
const selectionInfo = this.dataUnit.getSelectionInfo();
|
55
|
+
const records = selectionInfo.isEmpty() || selectionInfo.isAllRecords() ? await selectionInfo.getAllRecords() : selectionInfo.records;
|
56
|
+
return Promise.resolve(records == undefined ? [] : records);
|
57
|
+
}
|
58
|
+
getHiddenOptions() {
|
59
|
+
return [
|
60
|
+
index.DataExporterOption.EXPORT_BY_EMAIL,
|
61
|
+
index.DataExporterOption.EXPORT_PDF_TO_EMAIL,
|
62
|
+
index.DataExporterOption.EXPORT_XLS_TO_EMAIL,
|
63
|
+
index.DataExporterOption.EXPORT_PAGE_TO_PDF,
|
64
|
+
index.DataExporterOption.EXPORT_PAGE_TO_XLS
|
65
|
+
];
|
66
|
+
}
|
67
|
+
formatValue(record, column) {
|
68
|
+
const { id, descriptionFrom } = column;
|
69
|
+
const value = record[descriptionFrom || id];
|
70
|
+
if (value == undefined) {
|
71
|
+
return "";
|
72
|
+
}
|
73
|
+
if (descriptionFrom != undefined) {
|
74
|
+
return value.label;
|
75
|
+
}
|
76
|
+
const fieldDescriptor = this.dataUnit.getField(id);
|
77
|
+
if (fieldDescriptor.userInterface === core.UserInterface.SEARCH) {
|
78
|
+
return value.value;
|
79
|
+
}
|
80
|
+
if (column.customFormatter) {
|
81
|
+
const ezGridColumn = this.getColumnsState().find(columnState => column.id === columnState.name);
|
82
|
+
const formattedValue = column.customFormatter.format(value, ezGridColumn, record.__record__id__);
|
83
|
+
return formattedValue;
|
84
|
+
}
|
85
|
+
return this.dataUnit.getFormattedValue(id, value);
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
31
89
|
const snkSimpleCrudCss = ".sc-snk-simple-crud-h{display:flex;height:100%;width:100%;--snk-simple-crud-grid--min-height:300px}.simple-crud__container.sc-snk-simple-crud{display:grid;grid-template-rows:auto 1fr;row-gap:12px;height:100%;width:100%}.simple-crud__container-section.sc-snk-simple-crud{flex-wrap:unset;flex-direction:column}.simple-crud__form--hidden.sc-snk-simple-crud{display:none}ez-grid.sc-snk-simple-crud{--ez-grid__container--shadow:none;--ez-grid--min-height:var(--snk-simple-crud-grid--min-height)}ez-form.sc-snk-simple-crud{min-height:300px}";
|
32
90
|
|
33
91
|
const SnkSimpleCrud = class {
|
34
92
|
constructor(hostRef) {
|
35
|
-
index.registerInstance(this, hostRef);
|
36
|
-
this.dataStateChange = index.createEvent(this, "dataStateChange", 3);
|
37
|
-
this.dataUnitReady = index.createEvent(this, "dataUnitReady", 3);
|
38
|
-
this.actionClick = index.createEvent(this, "actionClick", 7);
|
39
|
-
this.formItemsReady = index.createEvent(this, "formItemsReady", 7);
|
40
|
-
this.configuratorSave = index.createEvent(this, "configuratorSave", 7);
|
41
|
-
this.configuratorCancel = index.createEvent(this, "configuratorCancel", 7);
|
42
|
-
this._multiSelectionListDataSource = new
|
93
|
+
index$1.registerInstance(this, hostRef);
|
94
|
+
this.dataStateChange = index$1.createEvent(this, "dataStateChange", 3);
|
95
|
+
this.dataUnitReady = index$1.createEvent(this, "dataUnitReady", 3);
|
96
|
+
this.actionClick = index$1.createEvent(this, "actionClick", 7);
|
97
|
+
this.formItemsReady = index$1.createEvent(this, "formItemsReady", 7);
|
98
|
+
this.configuratorSave = index$1.createEvent(this, "configuratorSave", 7);
|
99
|
+
this.configuratorCancel = index$1.createEvent(this, "configuratorCancel", 7);
|
100
|
+
this._multiSelectionListDataSource = new IExporterProvider.SnkMultiSelectionListDataSource();
|
43
101
|
this._keyDownHandler = (event) => this.keyDownListener(event);
|
44
102
|
this._formConfigFetcher = new formConfigFetcher.FormConfigFetcher();
|
103
|
+
this._customEditors = new Map();
|
104
|
+
this._customRenders = new Map();
|
45
105
|
this._taskbarProcessor = new fieldSearch.TaskbarProcessor({
|
46
|
-
"snkSimpleCrudTaskbar.form_regular": this.getButtons(false, taskbarElements.TaskbarElement.GRID_MODE),
|
47
|
-
"snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, taskbarElements.TaskbarElement.FORM_MODE),
|
48
|
-
"snkSimpleCrudTaskbar.form_selected": this.getButtons(true, taskbarElements.TaskbarElement.GRID_MODE),
|
49
|
-
"snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, taskbarElements.TaskbarElement.FORM_MODE),
|
106
|
+
"snkSimpleCrudTaskbar.form_regular": this.getButtons(false, [taskbarElements.TaskbarElement.GRID_MODE]),
|
107
|
+
"snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, [taskbarElements.TaskbarElement.DATA_EXPORTER, taskbarElements.TaskbarElement.FORM_MODE]),
|
108
|
+
"snkSimpleCrudTaskbar.form_selected": this.getButtons(true, [taskbarElements.TaskbarElement.GRID_MODE]),
|
109
|
+
"snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, [taskbarElements.TaskbarElement.DATA_EXPORTER, taskbarElements.TaskbarElement.FORM_MODE]),
|
50
110
|
"snkSimpleCrudTaskbar.finish_edition": ["CANCEL", "SAVE"]
|
51
111
|
});
|
52
112
|
this._showPopUpGridConfig = false;
|
@@ -57,12 +117,15 @@ const SnkSimpleCrud = class {
|
|
57
117
|
this._customContainerId = `SNK-SIMPLE-CRUD-CUSTOM-CONTAINER-${core.StringUtils.generateUUID()}`;
|
58
118
|
this.dataState = undefined;
|
59
119
|
this.dataUnit = undefined;
|
120
|
+
this.entityName = undefined;
|
60
121
|
this.mode = constants.SIMPLE_CRUD_MODE.SERVER;
|
61
122
|
this.gridConfig = undefined;
|
62
123
|
this.formConfig = undefined;
|
63
124
|
this._formFields = [];
|
125
|
+
this._fieldsProps = new Map();
|
64
126
|
this.multipleSelection = undefined;
|
65
127
|
this.useCancelConfirm = true;
|
128
|
+
this.pageSize = 150;
|
66
129
|
this.resourceID = undefined;
|
67
130
|
this.taskbarManager = undefined;
|
68
131
|
this.messagesBuilder = undefined;
|
@@ -73,6 +136,34 @@ const SnkSimpleCrud = class {
|
|
73
136
|
this.gridLegacyConfigName = undefined;
|
74
137
|
this.formLegacyConfigName = undefined;
|
75
138
|
this.ignoreReadOnlyFormFields = false;
|
139
|
+
this.autoFocus = true;
|
140
|
+
this.domainMessagesBuilder = undefined;
|
141
|
+
this.autoLoad = undefined;
|
142
|
+
}
|
143
|
+
/**
|
144
|
+
* Registra um editor customizado para campos da grade e formulário.
|
145
|
+
*/
|
146
|
+
async addCustomEditor(fieldName, customEditor) {
|
147
|
+
if (this._grid && this._form) {
|
148
|
+
this._grid.addCustomEditor(fieldName, customEditor);
|
149
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
150
|
+
return;
|
151
|
+
}
|
152
|
+
const newCustomEditors = new Map(this._customEditors);
|
153
|
+
newCustomEditors.set(fieldName, customEditor);
|
154
|
+
this._customEditors = newCustomEditors;
|
155
|
+
}
|
156
|
+
/**
|
157
|
+
* Registra um render customizado para colunas da grid.
|
158
|
+
*/
|
159
|
+
async addGridCustomRender(fieldName, customRender) {
|
160
|
+
if (this._grid) {
|
161
|
+
this._grid.addGridCustomRender(fieldName, customRender);
|
162
|
+
return;
|
163
|
+
}
|
164
|
+
const newCustomRenders = new Map(this._customRenders);
|
165
|
+
newCustomRenders.set(fieldName, customRender);
|
166
|
+
this._customRenders = newCustomRenders;
|
76
167
|
}
|
77
168
|
handleResourceIDChanged(newValue, oldValue) {
|
78
169
|
if (core.StringUtils.isEmpty(newValue)) {
|
@@ -84,9 +175,30 @@ const SnkSimpleCrud = class {
|
|
84
175
|
this.loadFormConfig(true);
|
85
176
|
this.loadGridConfig(true);
|
86
177
|
}
|
87
|
-
|
178
|
+
/**
|
179
|
+
* Registra um formatador de valores para uma coluna da grid.
|
180
|
+
*/
|
181
|
+
async addCustomValueFormatter(columnName, customFormatter) {
|
182
|
+
this._grid.addCustomValueFormatter(columnName, customFormatter);
|
183
|
+
}
|
184
|
+
/**
|
185
|
+
* Remove o formatador de valores de uma coluna da grid.
|
186
|
+
*/
|
187
|
+
async removeCustomValueFormatter(columnName) {
|
188
|
+
this._grid.removeCustomValueFormatter(columnName);
|
189
|
+
}
|
190
|
+
/**
|
191
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
192
|
+
*/
|
193
|
+
async setFieldProp(fieldName, propName, value) {
|
194
|
+
const newCustomFieldProps = new Map(this._fieldsProps);
|
195
|
+
const currentProps = this._fieldsProps.get(fieldName);
|
196
|
+
newCustomFieldProps.set(fieldName, Object.assign(Object.assign({}, currentProps), { [propName]: value }));
|
197
|
+
this._fieldsProps = newCustomFieldProps;
|
198
|
+
}
|
199
|
+
getButtons(selected, extraButtons) {
|
88
200
|
return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
|
89
|
-
.concat(
|
201
|
+
.concat(extraButtons));
|
90
202
|
}
|
91
203
|
addConfigButton(buttons) {
|
92
204
|
if (this.configName === undefined) {
|
@@ -126,15 +238,19 @@ const SnkSimpleCrud = class {
|
|
126
238
|
}
|
127
239
|
evt.stopPropagation();
|
128
240
|
}
|
241
|
+
async onChangeEntityName(newValue) {
|
242
|
+
if (this.dataUnit)
|
243
|
+
return;
|
244
|
+
const application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
245
|
+
this.dataUnit = await application.getDataUnit(newValue, null, null, this.configName);
|
246
|
+
}
|
129
247
|
onModeChange() {
|
130
248
|
if (this.mode == constants.SIMPLE_CRUD_MODE.IN_MEMORY) {
|
131
249
|
this.initInMemoryDataUnit();
|
132
250
|
}
|
133
251
|
}
|
134
252
|
observeDataState(newValue, oldValue) {
|
135
|
-
|
136
|
-
this.dataStateChange.emit(newValue);
|
137
|
-
}
|
253
|
+
this.handleDataStateChange(newValue, oldValue);
|
138
254
|
}
|
139
255
|
async observeFormLegacy(newValue, oldValue) {
|
140
256
|
await this.handleUpdateFormLegacyConfig(newValue, oldValue);
|
@@ -142,6 +258,28 @@ const SnkSimpleCrud = class {
|
|
142
258
|
async observeGridLegacy(newValue, oldValue) {
|
143
259
|
await this.handleUpdateGridLegacyConfig(newValue, oldValue);
|
144
260
|
}
|
261
|
+
async handleDataStateChange(newValue, oldValue) {
|
262
|
+
if (core.ObjectUtils.objectToString(oldValue) != core.ObjectUtils.objectToString(newValue)) {
|
263
|
+
this.dataStateChange.emit(newValue);
|
264
|
+
}
|
265
|
+
await this.processRmPrecision();
|
266
|
+
}
|
267
|
+
async processRmPrecision() {
|
268
|
+
var _a, _b;
|
269
|
+
const fieldsWithRmPrecision = await this._snkDataUnit.getFieldsWithRmPrecision();
|
270
|
+
for (const field of fieldsWithRmPrecision || []) {
|
271
|
+
if (!field) {
|
272
|
+
continue;
|
273
|
+
}
|
274
|
+
const rmPrecision = (_b = (_a = this.dataState) === null || _a === void 0 ? void 0 : _a.rowMetadata) === null || _b === void 0 ? void 0 : _b.getProp('rm_precision', field);
|
275
|
+
if (!rmPrecision && rmPrecision !== 0) {
|
276
|
+
continue;
|
277
|
+
}
|
278
|
+
await this.setFieldProp(field, 'precision', rmPrecision);
|
279
|
+
await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
|
280
|
+
}
|
281
|
+
this._rmPrecisionCustomValueFormatter.setDataState(this.dataState);
|
282
|
+
}
|
145
283
|
async handleUpdateGridLegacyConfig(newValue, oldValue) {
|
146
284
|
if (newValue == undefined || newValue == oldValue) {
|
147
285
|
return;
|
@@ -238,6 +376,7 @@ const SnkSimpleCrud = class {
|
|
238
376
|
}
|
239
377
|
async componentWillRender() {
|
240
378
|
this._resourceID = await this.application.getResourceID();
|
379
|
+
this.dataExporterProviderStore();
|
241
380
|
this._taskbarProcessor.process(this.getTaskBarId(), this.taskbarManager, this.dataState, this.getTaskBarDisabledButtons());
|
242
381
|
if (this.configName === undefined) {
|
243
382
|
return;
|
@@ -249,32 +388,70 @@ const SnkSimpleCrud = class {
|
|
249
388
|
this.loadGridConfig();
|
250
389
|
this.loadFormConfig();
|
251
390
|
}
|
391
|
+
componentDidRender() {
|
392
|
+
this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
|
393
|
+
this.addGridCustomValueFormattters();
|
394
|
+
this.setFieldsProps();
|
395
|
+
this.setCustomRenders();
|
396
|
+
this.setCustomEditors();
|
397
|
+
}
|
252
398
|
componentWillLoad() {
|
253
399
|
this.processMetadata();
|
254
400
|
this.onModeChange();
|
255
401
|
this.configDatasource();
|
402
|
+
this._rmPrecisionCustomValueFormatter = new IExporterProvider.RmPrecisionCustomValueFormatter();
|
256
403
|
}
|
257
404
|
componentDidLoad() {
|
258
405
|
utils.CSSVarsUtils.applyVarsGrid(this._element, this._grid);
|
259
406
|
}
|
407
|
+
setCustomRenders() {
|
408
|
+
if (!this._grid) {
|
409
|
+
return;
|
410
|
+
}
|
411
|
+
for (const [fieldName, customRender] of this._customRenders) {
|
412
|
+
this._grid.addGridCustomRender(fieldName, customRender);
|
413
|
+
this._customRenders.delete(fieldName);
|
414
|
+
}
|
415
|
+
}
|
416
|
+
setCustomEditors() {
|
417
|
+
if (!this._grid || !this._form) {
|
418
|
+
return;
|
419
|
+
}
|
420
|
+
for (const [fieldName, customEditor] of this._customEditors) {
|
421
|
+
this._grid.addCustomEditor(fieldName, customEditor);
|
422
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
423
|
+
this._customEditors.delete(fieldName);
|
424
|
+
}
|
425
|
+
}
|
260
426
|
configDatasource() {
|
261
427
|
this._multiSelectionListDataSource.setApplication(this.application);
|
262
428
|
this._multiSelectionListDataSource.setDataUnit(this.dataUnit);
|
263
429
|
}
|
430
|
+
setFieldsProps() {
|
431
|
+
if (!this._form) {
|
432
|
+
return;
|
433
|
+
}
|
434
|
+
for (const [fieldName, props] of this._fieldsProps) {
|
435
|
+
for (const prop in props) {
|
436
|
+
this._form.setFieldProp(fieldName, prop, props[prop]);
|
437
|
+
}
|
438
|
+
this._fieldsProps.delete(fieldName);
|
439
|
+
}
|
440
|
+
}
|
264
441
|
getTaskBarId() {
|
265
|
-
var _a, _b
|
442
|
+
var _a, _b;
|
266
443
|
if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
|
267
444
|
return "snkSimpleCrudTaskbar.finish_edition";
|
268
445
|
}
|
269
446
|
if (((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.selectionInfo) &&
|
270
447
|
!this.dataState.selectionInfo.isAllRecords() &&
|
271
|
-
|
448
|
+
this.dataState.selectionInfo.length > 0) {
|
272
449
|
return this._currentViewMode === constants.VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_selected" : "snkSimpleCrudTaskbar.form_selected";
|
273
450
|
}
|
274
451
|
return this._currentViewMode === constants.VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
|
275
452
|
}
|
276
453
|
initInMemoryDataUnit() {
|
277
|
-
this._inMemoryLoader = new
|
454
|
+
this._inMemoryLoader = new dataunitFetcher.InMemoryLoader(this._metadata, undefined, { autoLoad: this.autoLoad });
|
278
455
|
this.dataUnit = this._inMemoryLoader.dataUnit;
|
279
456
|
this.dataUnitReady.emit(this.dataUnit);
|
280
457
|
}
|
@@ -313,12 +490,11 @@ const SnkSimpleCrud = class {
|
|
313
490
|
var _a;
|
314
491
|
(_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.close();
|
315
492
|
}
|
316
|
-
updateConfig() {
|
493
|
+
async updateConfig() {
|
317
494
|
if (this._formConfigManager == undefined) {
|
318
495
|
this._formConfigManager = new SnkFormConfigManager.SnkFormConfigManager(this.configName, this.resolveResourceID());
|
319
496
|
}
|
320
497
|
this._formConfigManager.setConfig(this.formConfig);
|
321
|
-
return;
|
322
498
|
}
|
323
499
|
processMetadata() {
|
324
500
|
const fieldsMetadataElem = this._element.querySelectorAll("snk-field-metadata");
|
@@ -350,11 +526,28 @@ const SnkSimpleCrud = class {
|
|
350
526
|
};
|
351
527
|
}
|
352
528
|
}
|
529
|
+
addGridCustomValueFormattters() {
|
530
|
+
var _a, _b, _c;
|
531
|
+
const metadataFields = ((_a = this._metadata) === null || _a === void 0 ? void 0 : _a.fields) || ((_c = (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.metadata) === null || _c === void 0 ? void 0 : _c.fields);
|
532
|
+
if (!metadataFields) {
|
533
|
+
return;
|
534
|
+
}
|
535
|
+
const fieldsWithRmPrecision = [];
|
536
|
+
metadataFields.forEach((field) => {
|
537
|
+
var _a;
|
538
|
+
if (((_a = field.properties) === null || _a === void 0 ? void 0 : _a.rm_precision) && !fieldsWithRmPrecision.includes(field.name)) {
|
539
|
+
fieldsWithRmPrecision.push(field.name);
|
540
|
+
}
|
541
|
+
});
|
542
|
+
fieldsWithRmPrecision.forEach(field => {
|
543
|
+
this.addCustomValueFormatter(field, this._rmPrecisionCustomValueFormatter);
|
544
|
+
});
|
545
|
+
}
|
353
546
|
onDataStateChange(evt) {
|
354
547
|
this.dataState = Object.assign({}, evt.detail);
|
355
548
|
}
|
356
549
|
getTaskBarDisabledButtons() {
|
357
|
-
var _a, _b, _c, _d;
|
550
|
+
var _a, _b, _c, _d, _e, _f;
|
358
551
|
const disabledButtons = [];
|
359
552
|
if (!((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.hasNext)) {
|
360
553
|
disabledButtons.push(taskbarElements.TaskbarElement.NEXT);
|
@@ -365,6 +558,9 @@ const SnkSimpleCrud = class {
|
|
365
558
|
if ((_d = (_c = this.dataState) === null || _c === void 0 ? void 0 : _c.selectionInfo) === null || _d === void 0 ? void 0 : _d.isEmpty()) {
|
366
559
|
disabledButtons.push(taskbarElements.TaskbarElement.FORM_MODE);
|
367
560
|
}
|
561
|
+
if (((_f = (_e = this.dataState) === null || _e === void 0 ? void 0 : _e.selectionInfo) === null || _f === void 0 ? void 0 : _f.length) > 1) {
|
562
|
+
disabledButtons.push(taskbarElements.TaskbarElement.CLONE);
|
563
|
+
}
|
368
564
|
return disabledButtons;
|
369
565
|
}
|
370
566
|
handleCancelEdit() {
|
@@ -457,8 +653,8 @@ const SnkSimpleCrud = class {
|
|
457
653
|
}
|
458
654
|
getTopTaskBarId() {
|
459
655
|
var _a;
|
460
|
-
return ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? `snkGridTopTaskbar.finish_edition${index
|
461
|
-
`snkGridTopTaskbar.regular${index
|
656
|
+
return ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? `snkGridTopTaskbar.finish_edition${index.PresentationMode.PRIMARY}` :
|
657
|
+
`snkGridTopTaskbar.regular${index.PresentationMode.PRIMARY}`;
|
462
658
|
}
|
463
659
|
async keyDownListener(event) {
|
464
660
|
if (!event.ctrlKey || event.key == undefined || event.key.toUpperCase() !== "F") {
|
@@ -508,12 +704,26 @@ const SnkSimpleCrud = class {
|
|
508
704
|
.then(() => {
|
509
705
|
this.setGridConfig(config);
|
510
706
|
this.closeGridConfig();
|
707
|
+
this.dataExporterProviderStore();
|
511
708
|
});
|
512
709
|
evt.stopPropagation();
|
513
710
|
}
|
711
|
+
async dataExporterProviderStore() {
|
712
|
+
if (this.dataUnit == undefined) {
|
713
|
+
return;
|
714
|
+
}
|
715
|
+
if (this._grid == undefined) {
|
716
|
+
return;
|
717
|
+
}
|
718
|
+
const dataExporterProvider = new ClientSideExporterProvider(this.dataUnit, this._grid);
|
719
|
+
index$2.store.set("exporterProviders", Object.assign(Object.assign({}, index$2.store.get("exporterProviders")), { [this.getDataExporterStoreKey()]: dataExporterProvider }));
|
720
|
+
}
|
721
|
+
getDataExporterStoreKey() {
|
722
|
+
return `SnkSimpleCrudDataExporter:${this.configName == undefined ? this.dataUnit.name : this.configName}`;
|
723
|
+
}
|
514
724
|
setGridConfig(config) {
|
515
725
|
this.gridConfig = config;
|
516
|
-
|
726
|
+
IExporterProvider.CrudUtils.assertDefaultSorting(this.gridConfig, this.dataUnit);
|
517
727
|
}
|
518
728
|
setFormConfig(config, forceUpdate) {
|
519
729
|
if (this.formConfig && !forceUpdate)
|
@@ -526,6 +736,15 @@ const SnkSimpleCrud = class {
|
|
526
736
|
closeFormConfig() {
|
527
737
|
this._showFormConfig = false;
|
528
738
|
}
|
739
|
+
getPageSize() {
|
740
|
+
if (this.mode === constants.SIMPLE_CRUD_MODE.IN_MEMORY) {
|
741
|
+
return 0;
|
742
|
+
}
|
743
|
+
if (this.pageSize == undefined) {
|
744
|
+
return 150;
|
745
|
+
}
|
746
|
+
return this.pageSize;
|
747
|
+
}
|
529
748
|
//No momento não daremos suporte para configuração de formulário quando houver formLegacyConfigName
|
530
749
|
handleShowFormConfig() {
|
531
750
|
return this._showFormConfig && !this.formLegacyConfigName;
|
@@ -534,26 +753,35 @@ const SnkSimpleCrud = class {
|
|
534
753
|
return core.StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
|
535
754
|
}
|
536
755
|
getFormConfig() {
|
537
|
-
var _a
|
538
|
-
const configFromManager = (_a = this._formConfigManager) === null || _a === void 0 ? void 0 : _a.getConfig(
|
756
|
+
var _a;
|
757
|
+
const configFromManager = (_a = this._formConfigManager) === null || _a === void 0 ? void 0 : _a.getConfig(this.dataUnit, this.ignoreReadOnlyFormFields);
|
539
758
|
if (!this.configName && !configFromManager) {
|
540
759
|
return this.formConfig;
|
541
760
|
}
|
542
761
|
return configFromManager;
|
543
762
|
}
|
763
|
+
updateFormConfig() {
|
764
|
+
const newConfig = Object.assign(Object.assign({}, this.formConfig), { fields: this.dataUnit.metadata.fields });
|
765
|
+
this.setFormConfig(newConfig, true);
|
766
|
+
if (this._formConfigManager == undefined) {
|
767
|
+
this._formConfigManager = new SnkFormConfigManager.SnkFormConfigManager(this.configName, this.resolveResourceID());
|
768
|
+
}
|
769
|
+
this._formConfigManager.setConfig(this.formConfig);
|
770
|
+
}
|
544
771
|
/* istanbul ignore next */
|
545
772
|
render() {
|
546
773
|
var _a;
|
547
774
|
if (this.dataUnit == undefined) {
|
548
775
|
return;
|
549
776
|
}
|
550
|
-
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
|
777
|
+
return (index$1.h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, 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, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, 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(dataunitFetcher.InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
551
778
|
? undefined
|
552
|
-
: 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: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && index.h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && index.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.h("div", { id: `${this._customContainerId}` }, index.h("slot", { name: "SnkConfigContainerSlot" }))), index.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index.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() }))));
|
779
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus }, index$1.h("div", { slot: "footer" }, index$1.h("slot", { name: "snkSimpleCrudFooter" })))), index$1.h("stack-item", null, index$1.h("ez-form", { ref: (ref) => this._form = ref, 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() }))));
|
553
780
|
}
|
554
|
-
get _element() { return index.getElement(this); }
|
781
|
+
get _element() { return index$1.getElement(this); }
|
555
782
|
static get watchers() { return {
|
556
783
|
"resourceID": ["handleResourceIDChanged"],
|
784
|
+
"entityName": ["onChangeEntityName"],
|
557
785
|
"mode": ["onModeChange"],
|
558
786
|
"dataState": ["observeDataState"],
|
559
787
|
"formLegacyConfigName": ["observeFormLegacy"],
|
@@ -5,8 +5,8 @@ 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-
|
9
|
-
const index$1 = require('./index-
|
8
|
+
const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
|
9
|
+
const index$1 = require('./index-1dfc7a6e.js');
|
10
10
|
require('./index-102ba62d.js');
|
11
11
|
|
12
12
|
const snkTaskbarCss = ".sc-snk-taskbar-h{display:flex;flex-wrap:wrap}.no-wrap.sc-snk-taskbar-h{flex-wrap:nowrap}.full-width.sc-snk-taskbar-h{width:100%}.align-right.sc-snk-taskbar-h{justify-content:flex-end}.overflowed.sc-snk-taskbar{display:none}";
|
@@ -193,8 +193,9 @@ const SnkTaskbar = class {
|
|
193
193
|
className += "ez-padding-left--medium";
|
194
194
|
}
|
195
195
|
const taskbarElement = taskbarElements.TaskbarElement[def.toString()];
|
196
|
+
const dataExporterStoreKey = this._element.dataset.exporterStoreKey || this.configName;
|
196
197
|
if (taskbarElement) {
|
197
|
-
return taskbarElements.buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.buildDynamicActionsList(),
|
198
|
+
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);
|
198
199
|
}
|
199
200
|
else {
|
200
201
|
return taskbarElements.buildCustomButton(def, className, this.getIdElemBtnCustom(def), elem => this.elementClick(elem), elem => this.isEnabled(elem));
|
@@ -1,7 +1,7 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
3
|
const index = require('./index-f9e81701.js');
|
4
|
-
const index$2 = require('./index-
|
4
|
+
const index$2 = require('./index-1dfc7a6e.js');
|
5
5
|
const index$1 = require('./index-102ba62d.js');
|
6
6
|
|
7
7
|
exports.TaskbarElement = void 0;
|
@@ -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,8 @@
|
|
1
1
|
{
|
2
2
|
"entries": [
|
3
3
|
"./components/snk-filter-bar/filter-item/snk-filter-item.js",
|
4
|
-
"./components/snk-application/snk-application.js",
|
5
4
|
"./components/snk-data-unit/snk-data-unit.js",
|
5
|
+
"./components/snk-application/snk-application.js",
|
6
6
|
"./components/snk-taskbar/snk-taskbar.js",
|
7
7
|
"./components/snk-filter-bar/filter-list/snk-filter-list.js",
|
8
8
|
"./components/snk-print-selector/snk-print-selector.js",
|