@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-38445.1 → 0.0.0-bugfix-dev-kb-67792.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-942ce74b.js → ConfigStorage-0a690675.js} +2 -2
- package/dist/cjs/{DataFetcher-313debd8.js → DataFetcher-77729a93.js} +7 -2
- package/dist/cjs/{SnkFormConfigManager-1b13bacd.js → SnkFormConfigManager-d6d5db6d.js} +5 -8
- package/dist/cjs/{SnkMessageBuilder-722b104e.js → SnkMessageBuilder-96b0f549.js} +13 -9
- package/dist/cjs/{IExporterProvider-597949f9.js → SnkMultiSelectionListDataSource-f79d220c.js} +6 -96
- package/dist/cjs/{auth-fetcher-54f5ff9d.js → auth-fetcher-29bb791c.js} +1 -1
- package/dist/cjs/{form-config-fetcher-2dd00e5b.js → form-config-fetcher-feb08214.js} +1 -1
- package/dist/cjs/{index-1dfc7a6e.js → index-0922807b.js} +0 -5
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{dataunit-fetcher-688d3f05.js → pesquisa-fetcher-cba1b3d0.js} +181 -88
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +5 -7
- package/dist/cjs/snk-application.cjs.entry.js +15 -38
- package/dist/cjs/snk-attach.cjs.entry.js +49 -74
- package/dist/cjs/snk-crud.cjs.entry.js +13 -99
- package/dist/cjs/snk-data-exporter.cjs.entry.js +88 -318
- package/dist/cjs/snk-data-unit-559ac55c.js +462 -0
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -12
- package/dist/cjs/snk-detail-view.cjs.entry.js +10 -51
- package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-bar.cjs.entry.js +14 -9
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
- package/dist/cjs/snk-form-config.cjs.entry.js +2 -2
- package/dist/cjs/snk-form-view.cjs.entry.js +0 -67
- package/dist/cjs/snk-form.cjs.entry.js +9 -54
- package/dist/cjs/snk-grid.cjs.entry.js +112 -169
- package/dist/cjs/{snk-guides-viewer-67605336.js → snk-guides-viewer-bfcad2d6.js} +10 -38
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +9 -11
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
- package/dist/cjs/snk-simple-crud.cjs.entry.js +40 -267
- package/dist/cjs/snk-taskbar.cjs.entry.js +3 -4
- package/dist/cjs/{taskbar-elements-9ad1f9c0.js → taskbar-elements-3ecd1278.js} +3 -3
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/snk-application/snk-application.js +11 -35
- package/dist/collection/components/snk-attach/snk-attach.js +44 -67
- package/dist/collection/components/snk-crud/snk-crud.js +7 -249
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +0 -135
- package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +0 -161
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +5 -112
- package/dist/collection/components/snk-data-exporter/exporter-email-sender/options-step.js +1 -1
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +1 -54
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +52 -59
- package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +2 -64
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +214 -507
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +11 -23
- package/dist/collection/components/snk-form/snk-form.js +5 -102
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +3 -6
- package/dist/collection/components/snk-grid/snk-grid.css +0 -2
- package/dist/collection/components/snk-grid/snk-grid.js +102 -241
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +18 -386
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +2 -2
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +1 -2
- package/dist/collection/lib/@types/index.js +0 -5
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +3 -7
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +8 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +0 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.js +0 -4
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +13 -11
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +0 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +4 -53
- package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/index.js +34 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +4 -4
- package/dist/collection/lib/message/SnkMessageBuilder.js +12 -5
- package/dist/collection/lib/message/resources/snk-data-exporter.msg.js +0 -2
- package/dist/collection/lib/message/resources/snk-data-unit.msg.js +0 -1
- package/dist/collection/lib/message/resources/snk-exporter.msg.js +1 -1
- package/dist/components/DataFetcher.js +8 -3
- package/dist/components/SnkFormConfigManager.js +3 -6
- package/dist/components/SnkMessageBuilder.js +13 -9
- package/dist/components/dataunit-fetcher.js +182 -84
- package/dist/components/{IExporterProvider.js → field-search.js} +6 -93
- package/dist/components/index2.js +33 -198
- package/dist/components/index3.js +199 -0
- package/dist/components/snk-actions-button2.js +11 -4
- package/dist/components/snk-application2.js +9 -31
- package/dist/components/snk-attach2.js +41 -65
- package/dist/components/snk-crud.js +11 -103
- package/dist/components/snk-data-exporter2.js +87 -311
- package/dist/components/snk-data-unit2.js +212 -470
- package/dist/components/snk-detail-view2.js +10 -87
- package/dist/components/snk-exporter-email-sender2.js +1 -1
- package/dist/components/snk-expression-item2.js +1 -1
- package/dist/components/snk-filter-bar2.js +11 -7
- package/dist/components/snk-form-view2.js +1 -72
- package/dist/components/snk-form.js +6 -53
- package/dist/components/snk-grid2.js +108 -170
- package/dist/components/snk-personalized-filter2.js +1 -1
- package/dist/components/snk-simple-crud2.js +23 -259
- package/dist/components/snk-taskbar2.js +5 -6
- package/dist/esm/{ConfigStorage-86187da3.js → ConfigStorage-8c2ddac8.js} +2 -2
- package/dist/esm/{DataFetcher-c1baf61d.js → DataFetcher-773a3e4b.js} +8 -3
- package/dist/esm/{SnkFormConfigManager-d4554df9.js → SnkFormConfigManager-c01b9d9d.js} +5 -8
- package/dist/esm/{SnkMessageBuilder-89925609.js → SnkMessageBuilder-72423074.js} +13 -9
- package/dist/esm/{IExporterProvider-63a188b6.js → SnkMultiSelectionListDataSource-a4805051.js} +7 -95
- package/dist/esm/{auth-fetcher-039abba3.js → auth-fetcher-a411f73c.js} +1 -1
- package/dist/esm/{form-config-fetcher-30fb808f.js → form-config-fetcher-e0382e5a.js} +1 -1
- package/dist/esm/{index-3aa4977a.js → index-0ece87a6.js} +1 -6
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{dataunit-fetcher-264191b2.js → pesquisa-fetcher-34a8b8be.js} +182 -84
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +5 -7
- package/dist/esm/snk-application.entry.js +14 -37
- package/dist/esm/snk-attach.entry.js +44 -69
- package/dist/esm/snk-crud.entry.js +13 -99
- package/dist/esm/snk-data-exporter.entry.js +89 -319
- package/dist/esm/snk-data-unit-44215df7.js +460 -0
- package/dist/esm/snk-data-unit.entry.js +2 -12
- package/dist/esm/snk-detail-view.entry.js +10 -51
- package/dist/esm/snk-exporter-email-sender.entry.js +1 -1
- package/dist/esm/snk-filter-bar.entry.js +14 -9
- package/dist/esm/snk-filter-modal-item.entry.js +3 -3
- package/dist/esm/snk-form-config.entry.js +2 -2
- package/dist/esm/snk-form-view.entry.js +0 -67
- package/dist/esm/snk-form.entry.js +9 -54
- package/dist/esm/snk-grid.entry.js +110 -167
- package/dist/esm/{snk-guides-viewer-151f6091.js → snk-guides-viewer-edeac29f.js} +10 -38
- package/dist/esm/snk-guides-viewer.entry.js +9 -11
- package/dist/esm/snk-personalized-filter.entry.js +3 -3
- package/dist/esm/snk-simple-crud.entry.js +28 -255
- package/dist/esm/snk-taskbar.entry.js +3 -4
- package/dist/esm/{taskbar-elements-d59867f1.js → taskbar-elements-2473c8ac.js} +3 -3
- package/dist/sankhyablocks/p-03dcc5ff.entry.js +1 -0
- package/dist/sankhyablocks/{p-913a9979.js → p-0cd3c0a9.js} +1 -1
- package/dist/sankhyablocks/p-16a1dd18.entry.js +1 -0
- package/dist/sankhyablocks/p-176c3491.entry.js +1 -0
- package/dist/sankhyablocks/{p-df5451c7.js → p-181975f1.js} +1 -1
- package/dist/sankhyablocks/p-37e5d563.js +65 -0
- package/dist/sankhyablocks/p-38289a55.js +1 -0
- package/dist/sankhyablocks/{p-a1d72395.entry.js → p-41c2c191.entry.js} +1 -1
- package/dist/sankhyablocks/p-46e55a95.entry.js +1 -0
- package/dist/sankhyablocks/p-4e728357.entry.js +1 -0
- package/dist/sankhyablocks/p-5571bdfe.js +1 -0
- package/dist/sankhyablocks/p-5630574e.js +1 -0
- package/dist/sankhyablocks/p-594bc21d.js +1 -0
- package/dist/sankhyablocks/p-5f8c0426.entry.js +1 -0
- package/dist/sankhyablocks/p-80c64add.entry.js +1 -0
- package/dist/sankhyablocks/p-86af4cc2.js +1 -0
- package/dist/sankhyablocks/p-8b690717.js +1 -0
- package/dist/sankhyablocks/{p-aff76a53.js → p-96621231.js} +1 -1
- package/dist/sankhyablocks/p-a1832166.entry.js +1 -0
- package/dist/sankhyablocks/p-a809d944.entry.js +1 -0
- package/dist/sankhyablocks/p-a97226f6.entry.js +1 -0
- package/dist/sankhyablocks/p-add17f6a.entry.js +1 -0
- package/dist/sankhyablocks/{p-7e7a7473.js → p-ae4fc9a9.js} +1 -1
- package/dist/sankhyablocks/{p-eae7a817.entry.js → p-c2ae0fab.entry.js} +1 -1
- package/dist/sankhyablocks/p-c5a9a5d9.entry.js +1 -0
- package/dist/sankhyablocks/p-c5aa7d70.entry.js +11 -0
- package/dist/sankhyablocks/p-cb0147ab.entry.js +1 -0
- package/dist/sankhyablocks/p-f0145e3b.js +1 -0
- package/dist/sankhyablocks/{p-14a08904.entry.js → p-f03e4199.entry.js} +1 -1
- package/dist/sankhyablocks/p-f607db63.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +3 -7
- package/dist/types/components/snk-attach/snk-attach.d.ts +9 -11
- package/dist/types/components/snk-crud/snk-crud.d.ts +1 -36
- package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +0 -23
- package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +3 -28
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +0 -19
- package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +4 -24
- package/dist/types/components/snk-data-exporter/snk-data-exporter.d.ts +1 -4
- package/dist/types/components/snk-data-exporter/structure/ItemBuilder.d.ts +0 -21
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +2 -61
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +1 -4
- package/dist/types/components/snk-form/snk-form.d.ts +0 -14
- package/dist/types/components/snk-grid/snk-grid.d.ts +6 -46
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +4 -58
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +1 -1
- package/dist/types/components.d.ts +4 -220
- package/dist/types/lib/@types/index.d.ts +0 -5
- package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +1 -2
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.d.ts +1 -2
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.d.ts +0 -1
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +0 -1
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +0 -6
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/index.d.ts +3 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.d.ts +0 -3
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.d.ts +1 -2
- package/dist/types/lib/http/data-fetcher/fetchers/pesquisa-fetcher.d.ts +0 -1
- package/package.json +1 -1
- package/dist/cjs/RecordIDUtils-3735135c.js +0 -43
- package/dist/cjs/pesquisa-fetcher-680e198f.js +0 -166
- package/dist/cjs/snk-data-unit-685272e7.js +0 -679
- package/dist/collection/components/snk-crud/interfaces/PropsCustomEditor.js +0 -1
- package/dist/collection/components/snk-crud/interfaces/PropsCustomRender.js +0 -1
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +0 -97
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +0 -74
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterStrategy.js +0 -1
- package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +0 -58
- package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +0 -55
- package/dist/collection/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.js +0 -88
- package/dist/collection/components/snk-data-exporter/utils/ParserExport.js +0 -20
- package/dist/collection/components/snk-data-exporter/utils/RecordIDUtils.js +0 -38
- package/dist/collection/components/snk-data-unit/test/resources/metadataMock.js +0 -24
- package/dist/collection/components/snk-data-unit/test/resources/parentMetadataMock.js +0 -18
- package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +0 -35
- package/dist/collection/lib/dataUnit/ValueFormatter.js +0 -4
- package/dist/collection/lib/dataUnit/interfaces/InMemoryLoaderConfig.js +0 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.js +0 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.js +0 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.js +0 -22
- package/dist/components/ISave.js +0 -47
- package/dist/components/pesquisa-fetcher.js +0 -164
- package/dist/esm/RecordIDUtils-87d02110.js +0 -41
- package/dist/esm/pesquisa-fetcher-03c8f919.js +0 -164
- package/dist/esm/snk-data-unit-63f83504.js +0 -677
- package/dist/sankhyablocks/p-14b9f964.entry.js +0 -1
- package/dist/sankhyablocks/p-19c18d06.entry.js +0 -1
- package/dist/sankhyablocks/p-1db45d26.entry.js +0 -1
- package/dist/sankhyablocks/p-219f888d.entry.js +0 -1
- package/dist/sankhyablocks/p-30cf616e.js +0 -1
- package/dist/sankhyablocks/p-3a212712.js +0 -1
- package/dist/sankhyablocks/p-47b60deb.entry.js +0 -1
- package/dist/sankhyablocks/p-7505da04.entry.js +0 -1
- package/dist/sankhyablocks/p-75f83d1d.entry.js +0 -1
- package/dist/sankhyablocks/p-7a337364.js +0 -1
- package/dist/sankhyablocks/p-829d4045.js +0 -1
- package/dist/sankhyablocks/p-82a0bfb0.entry.js +0 -11
- package/dist/sankhyablocks/p-8fc470e5.entry.js +0 -1
- package/dist/sankhyablocks/p-941bf3ef.entry.js +0 -1
- package/dist/sankhyablocks/p-9863d682.js +0 -1
- package/dist/sankhyablocks/p-af8efd95.js +0 -6
- package/dist/sankhyablocks/p-b4b21558.entry.js +0 -1
- package/dist/sankhyablocks/p-bad55caa.entry.js +0 -1
- package/dist/sankhyablocks/p-c053256c.entry.js +0 -1
- package/dist/sankhyablocks/p-c5268346.entry.js +0 -1
- package/dist/sankhyablocks/p-cefba299.js +0 -1
- package/dist/sankhyablocks/p-dc7c9047.js +0 -1
- package/dist/sankhyablocks/p-f2809746.entry.js +0 -1
- package/dist/sankhyablocks/p-fcac4dfc.js +0 -1
- package/dist/sankhyablocks/p-fe79f83a.js +0 -60
- package/dist/types/components/snk-crud/interfaces/PropsCustomEditor.d.ts +0 -4
- package/dist/types/components/snk-crud/interfaces/PropsCustomRender.d.ts +0 -4
- package/dist/types/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.d.ts +0 -14
- package/dist/types/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.d.ts +0 -12
- package/dist/types/components/snk-data-exporter/interfaces/IExporterStrategy.d.ts +0 -5
- package/dist/types/components/snk-data-exporter/providers/ClientSideExporterProvider.d.ts +0 -17
- package/dist/types/components/snk-data-exporter/providers/ServerSideExporterProvider.d.ts +0 -17
- package/dist/types/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.d.ts +0 -77
- package/dist/types/components/snk-data-exporter/utils/ParserExport.d.ts +0 -4
- package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +0 -3
- package/dist/types/components/snk-data-unit/test/resources/metadataMock.d.ts +0 -3
- package/dist/types/components/snk-data-unit/test/resources/parentMetadataMock.d.ts +0 -3
- package/dist/types/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.d.ts +0 -11
- package/dist/types/lib/dataUnit/ValueFormatter.d.ts +0 -2
- package/dist/types/lib/dataUnit/interfaces/InMemoryLoaderConfig.d.ts +0 -3
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.d.ts +0 -10
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.d.ts +0 -7
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.d.ts +0 -20
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-f9e81701.js');
|
|
4
|
+
const core = require('@sankhyalabs/core');
|
|
5
|
+
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
6
|
+
const SnkMessageBuilder = require('./SnkMessageBuilder-96b0f549.js');
|
|
7
|
+
|
|
8
|
+
const SnkDataUnit = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
index.registerInstance(this, hostRef);
|
|
11
|
+
this.dataStateChange = index.createEvent(this, "dataStateChange", 3);
|
|
12
|
+
this.dataUnitReady = index.createEvent(this, "dataUnitReady", 3);
|
|
13
|
+
this.messagesBuilderUpdated = index.createEvent(this, "messagesBuilderUpdated", 3);
|
|
14
|
+
this.insertionMode = index.createEvent(this, "insertionMode", 3);
|
|
15
|
+
this.cancelEdition = index.createEvent(this, "cancelEdition", 3);
|
|
16
|
+
this._onDataUnitResolve = [];
|
|
17
|
+
this._openedAlert = false;
|
|
18
|
+
this._dataUnitObserver = (action) => {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
const duState = this.buildDataState();
|
|
21
|
+
this.dataState = duState;
|
|
22
|
+
if (action.type === core.Action.DATA_SAVED) {
|
|
23
|
+
if (this.ignoreSaveMessage) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const msg = this.getMessage("snkDataUnit.saveInfo", action.payload.records[0]);
|
|
27
|
+
if (msg != undefined) {
|
|
28
|
+
this.showSuccessMessage(msg);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (action.type === core.Action.RECORDS_ADDED || action.type === core.Action.RECORDS_COPIED) {
|
|
32
|
+
this.insertionMode.emit();
|
|
33
|
+
}
|
|
34
|
+
if (action.type === core.Action.EDITION_CANCELED) {
|
|
35
|
+
this.cancelEdition.emit();
|
|
36
|
+
}
|
|
37
|
+
if (action.type === core.Action.RECORDS_REMOVED) {
|
|
38
|
+
const cachedRecords = action.payload.cachedRecords;
|
|
39
|
+
let removeFinishMsg;
|
|
40
|
+
if ((cachedRecords === null || cachedRecords === void 0 ? void 0 : cachedRecords.length) > 1) {
|
|
41
|
+
removeFinishMsg = this.getMessage("snkDataUnit.removeAllInfo", { size: cachedRecords.length });
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
removeFinishMsg = this.getMessage("snkDataUnit.removeInfo", action.payload.cachedRecords[0]);
|
|
45
|
+
}
|
|
46
|
+
if (removeFinishMsg != undefined) {
|
|
47
|
+
this.showSuccessMessage(removeFinishMsg);
|
|
48
|
+
}
|
|
49
|
+
const recordsCount = (_b = (_a = this.dataUnit.records) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
50
|
+
const paginationInfo = this.dataUnit.getPaginationInfo();
|
|
51
|
+
if (paginationInfo) {
|
|
52
|
+
if (recordsCount > 0 || paginationInfo.hasMore) {
|
|
53
|
+
this.dataUnit.gotoPage(paginationInfo.currentPage);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
this.dataUnit.gotoPage(0);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
this.messagesBuilder.currentOperation = this.getMessageOperation();
|
|
61
|
+
};
|
|
62
|
+
this.dataState = undefined;
|
|
63
|
+
this.messagesBuilder = undefined;
|
|
64
|
+
this.dataUnitName = undefined;
|
|
65
|
+
this.entityName = undefined;
|
|
66
|
+
this.pageSize = 150;
|
|
67
|
+
this.dataUnit = undefined;
|
|
68
|
+
this.beforeSave = undefined;
|
|
69
|
+
this.afterSave = undefined;
|
|
70
|
+
this.useCancelConfirm = true;
|
|
71
|
+
this.ignoreSaveMessage = undefined;
|
|
72
|
+
this.configName = undefined;
|
|
73
|
+
this.resourceID = undefined;
|
|
74
|
+
}
|
|
75
|
+
observePageSize() {
|
|
76
|
+
if (this.dataUnit) {
|
|
77
|
+
this.dataUnit.pageSize = this.pageSize;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
observeDataUnitName(newValue, oldValue) {
|
|
81
|
+
if (oldValue != newValue) {
|
|
82
|
+
if (this.dataUnit) {
|
|
83
|
+
this._application.updateDataunitCache(oldValue, this.dataUnitName, this.dataUnit);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
this.loadDataUnit();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
observeEntityName(newValue, oldValue) {
|
|
91
|
+
if (oldValue != newValue) {
|
|
92
|
+
this.dataUnit = undefined;
|
|
93
|
+
this.entityName = newValue;
|
|
94
|
+
this.loadDataUnit();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
observeDataState(newValue, oldValue) {
|
|
98
|
+
if (core.ObjectUtils.objectToString(oldValue) != core.ObjectUtils.objectToString(newValue)) {
|
|
99
|
+
this.dataStateChange.emit(newValue);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
observeDataUnit() {
|
|
103
|
+
this.handlerLinkFields();
|
|
104
|
+
this.dataUnitReady.emit(this.dataUnit);
|
|
105
|
+
}
|
|
106
|
+
observeMessagesBuilder(newValue) {
|
|
107
|
+
if (newValue) {
|
|
108
|
+
this.messagesBuilderUpdated.emit(newValue);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Obtém o dataUnit.
|
|
113
|
+
*/
|
|
114
|
+
async getDataUnit() {
|
|
115
|
+
return new Promise((resolve) => {
|
|
116
|
+
if (this.dataUnit) {
|
|
117
|
+
resolve(this.dataUnit);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
this._onDataUnitResolve.push(resolve);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Método que retorna a lista de IDs dos registros selecionados.
|
|
126
|
+
* @returns Retorna a lista de IDs dos registros selecionados.
|
|
127
|
+
*/
|
|
128
|
+
async getSelectedRecordsIDsInfo() {
|
|
129
|
+
var _a;
|
|
130
|
+
const selectionInfo = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSelectionInfo();
|
|
131
|
+
if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
|
|
132
|
+
return [];
|
|
133
|
+
}
|
|
134
|
+
const selectedRecordsIDsInfo = [];
|
|
135
|
+
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.records;
|
|
136
|
+
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
|
137
|
+
selectedRecords.forEach(({ __record__id__ }) => {
|
|
138
|
+
if (!this.dataUnit.isNewRecord(__record__id__)) {
|
|
139
|
+
/*
|
|
140
|
+
Esse if foi necessário para tratar corretamente o ID
|
|
141
|
+
do record quando está sendo utilizado no modo standAlone
|
|
142
|
+
isso não faz a exportação da grid funcionar no modo standAlone
|
|
143
|
+
mas deixa de causar erro nas oprações de CRUD.
|
|
144
|
+
*/
|
|
145
|
+
if (!core.JSUtils.isBase64(__record__id__)) {
|
|
146
|
+
selectedRecordsIDsInfo.push({
|
|
147
|
+
name: "__record__id__",
|
|
148
|
+
type: core.DataType.TEXT,
|
|
149
|
+
value: __record__id__
|
|
150
|
+
});
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const revertBase64ToObject = JSON.parse(window.atob(__record__id__));
|
|
154
|
+
Object.entries(revertBase64ToObject).forEach(([name, value]) => {
|
|
155
|
+
var _a;
|
|
156
|
+
const metadataField = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
|
|
157
|
+
if (metadataField == undefined) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
return selectedRecordsIDsInfo;
|
|
166
|
+
}
|
|
167
|
+
getCleanOnCopyFields() {
|
|
168
|
+
var _a;
|
|
169
|
+
return (_a = this.dataUnit.metadata) === null || _a === void 0 ? void 0 : _a.fields.filter(field => { var _a; return (_a = field.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy; }).map(field => field.name);
|
|
170
|
+
}
|
|
171
|
+
async interceptAction(action) {
|
|
172
|
+
return new Promise(resolve => {
|
|
173
|
+
var _a, _b, _c, _d, _e;
|
|
174
|
+
switch (action.type) {
|
|
175
|
+
case core.Action.RECORDS_ADDED:
|
|
176
|
+
if (this.isAllowed("INSERT")) {
|
|
177
|
+
resolve(action);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
utils.ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenInsert"));
|
|
181
|
+
}
|
|
182
|
+
break;
|
|
183
|
+
case core.Action.RECORDS_COPIED:
|
|
184
|
+
if (this.isAllowed("CLONE")) {
|
|
185
|
+
const cleanFields = this.getCleanOnCopyFields();
|
|
186
|
+
if (cleanFields.length > 0) {
|
|
187
|
+
const records = action.payload;
|
|
188
|
+
action = new core.DataUnitAction(core.Action.RECORDS_COPIED, records.map(record => {
|
|
189
|
+
const newRecord = Object.assign({}, record);
|
|
190
|
+
cleanFields.forEach(fieldName => delete newRecord[fieldName]);
|
|
191
|
+
return newRecord;
|
|
192
|
+
}));
|
|
193
|
+
}
|
|
194
|
+
resolve(action);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
utils.ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenClone"));
|
|
198
|
+
}
|
|
199
|
+
break;
|
|
200
|
+
case core.Action.DATA_CHANGED:
|
|
201
|
+
case core.Action.CHANGING_DATA:
|
|
202
|
+
if (this.isAllowed("UPDATE"))
|
|
203
|
+
return resolve(action);
|
|
204
|
+
if (this._openedAlert)
|
|
205
|
+
return this.dataUnit.cancelEdition();
|
|
206
|
+
this._openedAlert = true;
|
|
207
|
+
this.dataUnit.cancelEdition();
|
|
208
|
+
utils.ApplicationUtils.alert(this.getMessage("snkDataUnit.forbidden"), this.getMessage("snkDataUnit.forbiddenUpdate")).then(() => {
|
|
209
|
+
this._openedAlert = false;
|
|
210
|
+
});
|
|
211
|
+
break;
|
|
212
|
+
case core.Action.SAVING_DATA:
|
|
213
|
+
if (this.beforeSave) {
|
|
214
|
+
const continueAction = this.beforeSave(this.dataUnit);
|
|
215
|
+
if (continueAction instanceof Promise) {
|
|
216
|
+
continueAction.then(result => resolve(result ? action : undefined));
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
resolve(continueAction ? action : undefined);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
resolve(action);
|
|
224
|
+
}
|
|
225
|
+
break;
|
|
226
|
+
case core.Action.DATA_SAVED:
|
|
227
|
+
if (this.afterSave) {
|
|
228
|
+
this.afterSave(this.dataUnit);
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
resolve(action);
|
|
232
|
+
}
|
|
233
|
+
break;
|
|
234
|
+
case core.Action.EDITION_CANCELED:
|
|
235
|
+
if (!this.useCancelConfirm)
|
|
236
|
+
return resolve(action);
|
|
237
|
+
if (this.dataState.hasDirtyRecords) {
|
|
238
|
+
const cancelConfirmation = this.getMessage("snkDataUnit.cancelConfirmation");
|
|
239
|
+
if (((_a = action.payload) === null || _a === void 0 ? void 0 : _a.fromParent) || ((_b = action.payload) === null || _b === void 0 ? void 0 : _b.silent)) {
|
|
240
|
+
resolve(action);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (cancelConfirmation == undefined) {
|
|
244
|
+
this.showSuccessMessage(this.getMessage("snkDataUnit.cancelInfo"));
|
|
245
|
+
resolve(action);
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
const cancelConfirmationTitle = this.getMessage("snkDataUnit.cancelConfirmationTitle");
|
|
249
|
+
utils.ApplicationUtils.confirm(cancelConfirmationTitle, cancelConfirmation)
|
|
250
|
+
.then((result) => {
|
|
251
|
+
result && this.showSuccessMessage(this.getMessage("snkDataUnit.cancelInfo"));
|
|
252
|
+
resolve(result ? action : undefined);
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
resolve(action);
|
|
258
|
+
}
|
|
259
|
+
break;
|
|
260
|
+
case core.Action.REMOVING_RECORDS:
|
|
261
|
+
if (this.isAllowed("REMOVE")) {
|
|
262
|
+
let multipleSelection = false;
|
|
263
|
+
let removeConfirmation = !((_c = action.payload) === null || _c === void 0 ? void 0 : _c.silent) && this.getMessage("snkDataUnit.removeConfirmation");
|
|
264
|
+
const selection = (_d = this.dataUnit) === null || _d === void 0 ? void 0 : _d.getSelectionInfo();
|
|
265
|
+
if (!((_e = action.payload) === null || _e === void 0 ? void 0 : _e.silent) && (selection === null || selection === void 0 ? void 0 : selection.length) > 1) {
|
|
266
|
+
removeConfirmation = this.getMessage("snkDataUnit.removeAllConfirmation", { size: selection.length });
|
|
267
|
+
multipleSelection = true;
|
|
268
|
+
}
|
|
269
|
+
if (!removeConfirmation) {
|
|
270
|
+
resolve(action);
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
const options = {
|
|
274
|
+
canClose: false,
|
|
275
|
+
labelCancel: this.getMessage(`snkDataUnit.confirm.${multipleSelection ? "no" : "cancel"}`),
|
|
276
|
+
labelConfirm: this.getMessage(`snkDataUnit.confirm.${multipleSelection ? "yes" : "delete"}`),
|
|
277
|
+
btnConfirmDanger: false
|
|
278
|
+
};
|
|
279
|
+
const removeConfirmationTitle = this.getMessage("snkDataUnit.removeConfirmationTitle");
|
|
280
|
+
utils.ApplicationUtils.confirm(removeConfirmationTitle, removeConfirmation, null, utils.DialogType.WARN, options)
|
|
281
|
+
.then((result) => resolve(result ? action : undefined));
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
utils.ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenRemove"));
|
|
286
|
+
}
|
|
287
|
+
break;
|
|
288
|
+
default:
|
|
289
|
+
resolve(action);
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
showSuccessMessage(message) {
|
|
294
|
+
utils.ApplicationUtils.info(message, { iconName: "check" });
|
|
295
|
+
}
|
|
296
|
+
isAllowed(flag) {
|
|
297
|
+
return this._permissions ? this._permissions.isSup || this._permissions[flag] : false;
|
|
298
|
+
}
|
|
299
|
+
buildDataState() {
|
|
300
|
+
const selectionInfo = this.dataUnit.getSelectionInfo();
|
|
301
|
+
const isStartingInsertionMode = (this.dataUnit.hasDirtyRecords() || this.dataUnit.hasWaitingChanges()) && (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isEmpty());
|
|
302
|
+
return new DataStateImpl({
|
|
303
|
+
insertionMode: this.dataUnit.hasNewRecord(),
|
|
304
|
+
isStartingInsertionMode,
|
|
305
|
+
hasNext: this.dataUnit.hasNext(),
|
|
306
|
+
hasPrevious: this.dataUnit.hasPrevious(),
|
|
307
|
+
copyMode: this.dataUnit.hasCopiedRecord(),
|
|
308
|
+
isDirty: this.dataUnit.isDirty(),
|
|
309
|
+
hasDirtyRecords: this.dataUnit.hasDirtyRecords(),
|
|
310
|
+
selectedRecords: undefined,
|
|
311
|
+
selectionInfo,
|
|
312
|
+
selectedRecord: this.dataUnit.getSelectedRecord(),
|
|
313
|
+
recordsIsEmpty: this.dataUnit.records.length === 0
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
318
|
+
* através de um pequeno modulo na estrutura da aplicação:
|
|
319
|
+
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
|
320
|
+
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-data-unit.msg.ts"
|
|
321
|
+
*/
|
|
322
|
+
getMessage(key, params = undefined) {
|
|
323
|
+
if (!params) {
|
|
324
|
+
params = this.getMessageParams();
|
|
325
|
+
}
|
|
326
|
+
return this.messagesBuilder.getMessage(key, params);
|
|
327
|
+
}
|
|
328
|
+
getMessageParams() {
|
|
329
|
+
//FIXME: Devido ao recurso de multiseleção do dataunit, precisaremos criar um mecanismo para
|
|
330
|
+
//oferecer todos os registros selecionados para a mensagem, pois mensagens podem ficar incorretas.
|
|
331
|
+
return this.dataState.selectedRecord;
|
|
332
|
+
}
|
|
333
|
+
getMessageOperation() {
|
|
334
|
+
if (this.dataState.copyMode) {
|
|
335
|
+
return SnkMessageBuilder.OperationMap.CLONE;
|
|
336
|
+
}
|
|
337
|
+
if (this.dataState.insertionMode || this.dataState.isStartingInsertionMode) {
|
|
338
|
+
return SnkMessageBuilder.OperationMap.INSERT;
|
|
339
|
+
}
|
|
340
|
+
if (this.dataState.isDirty) {
|
|
341
|
+
return SnkMessageBuilder.OperationMap.UPDATE;
|
|
342
|
+
}
|
|
343
|
+
return SnkMessageBuilder.OperationMap.CLEAN;
|
|
344
|
+
}
|
|
345
|
+
async getDataUnitParentOrChild() {
|
|
346
|
+
var _a;
|
|
347
|
+
const cacheName = this.dataUnitName ? this.dataUnitName : this.entityName;
|
|
348
|
+
if (this._parentSnkDataUnit) {
|
|
349
|
+
this._parentDataUnit = await ((_a = this._parentSnkDataUnit) === null || _a === void 0 ? void 0 : _a.getDataUnit());
|
|
350
|
+
return await this._application.getDataUnit(this.entityName, cacheName, this._parentDataUnit, this.configName, this.resourceID);
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName, this.resourceID);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
async loadDataUnit() {
|
|
357
|
+
if (this.dataUnit == null && this._application && this.entityName) {
|
|
358
|
+
this.dataUnit = await this.getDataUnitParentOrChild();
|
|
359
|
+
}
|
|
360
|
+
if (this.dataUnit) {
|
|
361
|
+
this.dataUnit.pageSize = this.pageSize;
|
|
362
|
+
this.dataUnit.unsubscribe(this._dataUnitObserver);
|
|
363
|
+
this.dataUnit.addInterceptor(this);
|
|
364
|
+
this.dataUnit.subscribe(this._dataUnitObserver);
|
|
365
|
+
this.dataState = this.buildDataState();
|
|
366
|
+
let resolver;
|
|
367
|
+
while (resolver = this._onDataUnitResolve.pop()) {
|
|
368
|
+
resolver(this.dataUnit);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
getParentSnkDataUnit() {
|
|
373
|
+
let currentElement = this.element;
|
|
374
|
+
while (currentElement.parentNode) {
|
|
375
|
+
if (currentElement.parentNode.nodeName === 'SNK-DATA-UNIT') {
|
|
376
|
+
return currentElement.parentNode;
|
|
377
|
+
}
|
|
378
|
+
currentElement = currentElement.parentNode;
|
|
379
|
+
}
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
handlerLinkFields() {
|
|
383
|
+
var _a, _b;
|
|
384
|
+
const metadata = Object.assign({}, this.dataUnit.metadata);
|
|
385
|
+
if (!this._parentDataUnit)
|
|
386
|
+
return;
|
|
387
|
+
const child = this._parentDataUnit.getChildInfo(this.entityName);
|
|
388
|
+
if (!child)
|
|
389
|
+
return;
|
|
390
|
+
const fieldsLink = (_a = child === null || child === void 0 ? void 0 : child.links) === null || _a === void 0 ? void 0 : _a.map(link => link.target);
|
|
391
|
+
(_b = metadata === null || metadata === void 0 ? void 0 : metadata.fields) === null || _b === void 0 ? void 0 : _b.forEach(field => {
|
|
392
|
+
if (fieldsLink === null || fieldsLink === void 0 ? void 0 : fieldsLink.includes(field.name)) {
|
|
393
|
+
field.visible = false;
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
this.dataUnit.metadata = metadata;
|
|
397
|
+
}
|
|
398
|
+
static getNearestInstance(element) {
|
|
399
|
+
let parent = element.parentElement;
|
|
400
|
+
while (parent) {
|
|
401
|
+
if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
|
|
402
|
+
return parent;
|
|
403
|
+
}
|
|
404
|
+
parent = parent.parentElement;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
//---------------------------------------------
|
|
408
|
+
// Lifecycle web component
|
|
409
|
+
//---------------------------------------------
|
|
410
|
+
componentWillLoad() {
|
|
411
|
+
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
412
|
+
this._application.getAllAccess(this.resourceID).then(access => this._permissions = access);
|
|
413
|
+
this._parentSnkDataUnit = this.getParentSnkDataUnit();
|
|
414
|
+
if (this.messagesBuilder == undefined) {
|
|
415
|
+
this.messagesBuilder = new SnkMessageBuilder.SnkMessageBuilder(this.entityName);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
disconnectedCallback() {
|
|
419
|
+
if (this.dataUnit) {
|
|
420
|
+
this.dataUnit.releaseCallbacks();
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
componentDidLoad() {
|
|
424
|
+
this.loadDataUnit();
|
|
425
|
+
}
|
|
426
|
+
render() {
|
|
427
|
+
return (index.h(index.Host, null));
|
|
428
|
+
}
|
|
429
|
+
get element() { return index.getElement(this); }
|
|
430
|
+
static get watchers() { return {
|
|
431
|
+
"pageSize": ["observePageSize"],
|
|
432
|
+
"dataUnitName": ["observeDataUnitName"],
|
|
433
|
+
"entityName": ["observeEntityName"],
|
|
434
|
+
"dataState": ["observeDataState"],
|
|
435
|
+
"dataUnit": ["observeDataUnit"],
|
|
436
|
+
"messagesBuilder": ["observeMessagesBuilder"]
|
|
437
|
+
}; }
|
|
438
|
+
};
|
|
439
|
+
class DataStateImpl {
|
|
440
|
+
constructor(datastate) {
|
|
441
|
+
this.copyMode = datastate.copyMode;
|
|
442
|
+
this.insertionMode = datastate.insertionMode;
|
|
443
|
+
this.isStartingInsertionMode = datastate.isStartingInsertionMode;
|
|
444
|
+
this.isDirty = datastate.isDirty;
|
|
445
|
+
this.hasDirtyRecords = datastate.hasDirtyRecords;
|
|
446
|
+
this.hasNext = datastate.hasNext;
|
|
447
|
+
this.hasPrevious = datastate.hasPrevious;
|
|
448
|
+
this.selectionInfo = datastate.selectionInfo;
|
|
449
|
+
this.selectedRecord = datastate.selectedRecord;
|
|
450
|
+
this.recordsIsEmpty = datastate.recordsIsEmpty;
|
|
451
|
+
}
|
|
452
|
+
get selectedRecords() {
|
|
453
|
+
var _a;
|
|
454
|
+
console.warn("SnkDataUnit: O método `selectedRecords` foi descontinuado. Use o método `selectionInfo`.");
|
|
455
|
+
if ((_a = this.selectionInfo) === null || _a === void 0 ? void 0 : _a.isAllRecords()) {
|
|
456
|
+
throw new Error("Erro interno: Impossível obter os registros selecionados. A seleção atual é virtual. Use o atributo `selectionInfo`.");
|
|
457
|
+
}
|
|
458
|
+
return this.selectionInfo.records;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
exports.SnkDataUnit = SnkDataUnit;
|
|
@@ -2,21 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const snkDataUnit = require('./snk-data-unit-
|
|
5
|
+
const snkDataUnit = require('./snk-data-unit-559ac55c.js');
|
|
6
6
|
require('./index-f9e81701.js');
|
|
7
7
|
require('@sankhyalabs/core');
|
|
8
8
|
require('@sankhyalabs/ezui/dist/collection/utils');
|
|
9
|
-
require('./SnkMessageBuilder-
|
|
10
|
-
require('./dataunit-fetcher-688d3f05.js');
|
|
11
|
-
require('./DataFetcher-313debd8.js');
|
|
12
|
-
require('./PrintUtils-bcaeb82f.js');
|
|
13
|
-
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
14
|
-
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
15
|
-
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
|
16
|
-
require('@sankhyalabs/core/dist/utils/SortingUtils');
|
|
17
|
-
require('./ResourceIDUtils-5ff86aa7.js');
|
|
18
|
-
require('./RecordIDUtils-3735135c.js');
|
|
19
|
-
require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
|
|
9
|
+
require('./SnkMessageBuilder-96b0f549.js');
|
|
20
10
|
|
|
21
11
|
|
|
22
12
|
|
|
@@ -4,25 +4,23 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-f9e81701.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
|
-
const SnkFormConfigManager = require('./SnkFormConfigManager-
|
|
7
|
+
const SnkFormConfigManager = require('./SnkFormConfigManager-d6d5db6d.js');
|
|
8
8
|
const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
|
|
9
|
-
require('./DataFetcher-
|
|
10
|
-
require('./pesquisa-fetcher-
|
|
11
|
-
const index$1 = require('./index-
|
|
9
|
+
require('./DataFetcher-77729a93.js');
|
|
10
|
+
require('./pesquisa-fetcher-cba1b3d0.js');
|
|
11
|
+
const index$1 = require('./index-0922807b.js');
|
|
12
12
|
require('./ISave-e91b70a7.js');
|
|
13
13
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
14
14
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
15
|
-
require('./dataunit-fetcher-688d3f05.js');
|
|
16
15
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
17
|
-
require('./form-config-fetcher-
|
|
18
|
-
const taskbarElements = require('./taskbar-elements-
|
|
16
|
+
require('./form-config-fetcher-feb08214.js');
|
|
17
|
+
const taskbarElements = require('./taskbar-elements-3ecd1278.js');
|
|
19
18
|
const constants = require('./constants-35ddd366.js');
|
|
20
|
-
const snkGuidesViewer = require('./snk-guides-viewer-
|
|
21
|
-
const SnkMessageBuilder = require('./SnkMessageBuilder-
|
|
22
|
-
require('./ConfigStorage-
|
|
19
|
+
const snkGuidesViewer = require('./snk-guides-viewer-bfcad2d6.js');
|
|
20
|
+
const SnkMessageBuilder = require('./SnkMessageBuilder-96b0f549.js');
|
|
21
|
+
require('./ConfigStorage-0a690675.js');
|
|
23
22
|
require('./PrintUtils-bcaeb82f.js');
|
|
24
23
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
|
25
|
-
require('@sankhyalabs/core/dist/utils/SortingUtils');
|
|
26
24
|
require('./ResourceIDUtils-5ff86aa7.js');
|
|
27
25
|
require('./index-102ba62d.js');
|
|
28
26
|
require('./field-search-f56aa7d6.js');
|
|
@@ -95,8 +93,6 @@ const SnkDetailView = class {
|
|
|
95
93
|
this.branchGuide = undefined;
|
|
96
94
|
this.canEdit = true;
|
|
97
95
|
this.taskbarCustomContainerId = undefined;
|
|
98
|
-
this.customEditors = undefined;
|
|
99
|
-
this.customRenders = undefined;
|
|
100
96
|
}
|
|
101
97
|
observeDataUnit(newDataUnit, oldDataUnit) {
|
|
102
98
|
newDataUnit === null || newDataUnit === void 0 ? void 0 : newDataUnit.subscribe(this.dataUnitActionHandler.bind(this));
|
|
@@ -164,38 +160,10 @@ const SnkDetailView = class {
|
|
|
164
160
|
this._snkGrid.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
165
161
|
}
|
|
166
162
|
}
|
|
167
|
-
/**
|
|
168
|
-
* Registra um editor customizado para campos da grade e formulário.
|
|
169
|
-
*/
|
|
170
|
-
async addCustomEditor(fieldName, customEditor) {
|
|
171
|
-
var _a;
|
|
172
|
-
const detailContext = this.normalizeBranchGuideId((_a = this.branchGuide) === null || _a === void 0 ? void 0 : _a.id);
|
|
173
|
-
this._snkGrid.addCustomEditor(fieldName, customEditor, detailContext);
|
|
174
|
-
this._snkFormView.addCustomEditor(fieldName, customEditor, detailContext);
|
|
175
|
-
}
|
|
176
|
-
async observerPropsCustomEditor(newValue) {
|
|
177
|
-
for (const fieldName in newValue) {
|
|
178
|
-
await this.addCustomEditor(fieldName, newValue[fieldName]);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Registra um render customizado para colunas da grid.
|
|
183
|
-
*/
|
|
184
|
-
async addGridCustomRender(fieldName, customRender) {
|
|
185
|
-
var _a;
|
|
186
|
-
const detailContext = this.normalizeBranchGuideId((_a = this.branchGuide) === null || _a === void 0 ? void 0 : _a.id);
|
|
187
|
-
await this._snkGrid.addGridCustomRender(fieldName, customRender, detailContext);
|
|
188
|
-
}
|
|
189
163
|
onContentCardChanged(evt) {
|
|
190
164
|
snkGuidesViewer.SnkGuidesViewer.updateContentCard(evt.detail.formName, evt.detail.cardConfig, evt.detail.propertyChanged, this.formConfigManager).then(() => index.forceUpdate(this));
|
|
191
165
|
evt.stopPropagation();
|
|
192
166
|
}
|
|
193
|
-
async observeCustomRenders(newValue) {
|
|
194
|
-
for (const field in newValue) {
|
|
195
|
-
const customRender = newValue[field];
|
|
196
|
-
await this.addGridCustomRender(field, customRender);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
167
|
updateLabel() {
|
|
200
168
|
const guideItemPathSize = this.guideItemPath ? this.guideItemPath.length : 0;
|
|
201
169
|
if (guideItemPathSize > 0) {
|
|
@@ -298,10 +266,6 @@ const SnkDetailView = class {
|
|
|
298
266
|
this.messagesBuilder = new SnkMessageBuilder.SnkMessageBuilder(this.entityName);
|
|
299
267
|
}
|
|
300
268
|
}
|
|
301
|
-
async componentDidLoad() {
|
|
302
|
-
await this.observerPropsCustomEditor(this.customEditors);
|
|
303
|
-
await this.observeCustomRenders(this.customRenders);
|
|
304
|
-
}
|
|
305
269
|
async dataUnitActionHandler(action) {
|
|
306
270
|
if (action.type === core.Action.FIELD_INVALIDATED) {
|
|
307
271
|
this.addErrorBadgeToBranchGuide();
|
|
@@ -311,9 +275,6 @@ const SnkDetailView = class {
|
|
|
311
275
|
this.branchGuide = Object.assign(Object.assign({}, this.branchGuide), { badge: 'error' });
|
|
312
276
|
this.snkDetailGuidesChange.emit(new GuideBuilder(this.branchGuide, this._formMetadata, this.dataUnit));
|
|
313
277
|
}
|
|
314
|
-
normalizeBranchGuideId(id) {
|
|
315
|
-
return id === null || id === void 0 ? void 0 : id.replace(/child\[(.*?)\]/g, '$1').replace(/::/g, '>');
|
|
316
|
-
}
|
|
317
278
|
render() {
|
|
318
279
|
this.updateLabel();
|
|
319
280
|
//const cardConfig: IFormCardConfig = this._cardsState?.get(this.selectedForm);
|
|
@@ -321,9 +282,7 @@ const SnkDetailView = class {
|
|
|
321
282
|
}
|
|
322
283
|
static get watchers() { return {
|
|
323
284
|
"dataUnit": ["observeDataUnit"],
|
|
324
|
-
"dataState": ["observerDataState"]
|
|
325
|
-
"customEditors": ["observerPropsCustomEditor"],
|
|
326
|
-
"customRenders": ["observeCustomRenders"]
|
|
285
|
+
"dataState": ["observerDataState"]
|
|
327
286
|
}; }
|
|
328
287
|
};
|
|
329
288
|
SnkDetailView.REGEX_FORM_ID = /__FORM:[^:]+/g;
|
|
@@ -20,7 +20,7 @@ const OptionsStep = ({ getMessage, changeInfo, data }) => {
|
|
|
20
20
|
const selectionCount = (data === null || data === void 0 ? void 0 : data.selectedRows) || 0;
|
|
21
21
|
const formatOptions = [
|
|
22
22
|
{ label: getMessage("snkExporter.emailSenderOptStep_formatPDF"), value: "pdf" },
|
|
23
|
-
{ label: getMessage("snkExporter.
|
|
23
|
+
{ label: getMessage("snkExporter.emailSenderOptStep_formatXLS"), value: "xls" }
|
|
24
24
|
];
|
|
25
25
|
const typeOptions = [
|
|
26
26
|
{ label: getMessage("snkExporter.emailSenderOptStep_allData"), value: "all" },
|
|
@@ -5,15 +5,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index$1 = require('./index-f9e81701.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
7
|
const EzScrollDirection = require('@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection');
|
|
8
|
-
const ConfigStorage = require('./ConfigStorage-
|
|
8
|
+
const ConfigStorage = require('./ConfigStorage-0a690675.js');
|
|
9
9
|
const DataType = require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
|
|
10
10
|
const filterItemType_enum = require('./filter-item-type.enum-a7ffdaa6.js');
|
|
11
11
|
const index = require('./index-c5771aba.js');
|
|
12
12
|
const filterNumberVariation = require('./filterNumberVariation-d65332da.js');
|
|
13
13
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
14
14
|
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-0184ffbb.js');
|
|
15
|
-
require('./form-config-fetcher-
|
|
16
|
-
require('./DataFetcher-
|
|
15
|
+
require('./form-config-fetcher-feb08214.js');
|
|
16
|
+
require('./DataFetcher-77729a93.js');
|
|
17
17
|
require('./PrintUtils-bcaeb82f.js');
|
|
18
18
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
19
19
|
|
|
@@ -269,7 +269,7 @@ const SnkFilterBar = class {
|
|
|
269
269
|
//campos Hard Fixed não variam a ordem
|
|
270
270
|
if (!item.hardFixed) {
|
|
271
271
|
index += item.fixed ? 100000 : 0;
|
|
272
|
-
index
|
|
272
|
+
index = this.handleValueSortIndex(item, index);
|
|
273
273
|
index += this._updateSequence.lastIndexOf(item.id) + 1;
|
|
274
274
|
}
|
|
275
275
|
return index;
|
|
@@ -286,12 +286,19 @@ const SnkFilterBar = class {
|
|
|
286
286
|
this.messagesBuilder = undefined;
|
|
287
287
|
this.disablePersonalizedFilter = undefined;
|
|
288
288
|
this.filterBarLegacyConfigName = undefined;
|
|
289
|
-
this.autoLoad = undefined;
|
|
290
289
|
this.allowDefault = undefined;
|
|
291
290
|
this.scrollerLocked = false;
|
|
292
291
|
this.showPersonalizedFilter = false;
|
|
293
292
|
this.personalizedFilterId = undefined;
|
|
294
293
|
}
|
|
294
|
+
handleValueSortIndex(item, index) {
|
|
295
|
+
if (item.value != undefined)
|
|
296
|
+
return (index + 10000);
|
|
297
|
+
if (item.type === filterItemType_enum.FilterItemType.PERSONALIZED && item.visible) {
|
|
298
|
+
index += 10000;
|
|
299
|
+
}
|
|
300
|
+
return index;
|
|
301
|
+
}
|
|
295
302
|
observeFilterConfig(newValue, oldValue) {
|
|
296
303
|
if (core.ObjectUtils.equals(newValue, oldValue))
|
|
297
304
|
return;
|
|
@@ -433,10 +440,7 @@ const SnkFilterBar = class {
|
|
|
433
440
|
}
|
|
434
441
|
async doLoadData(forceReload = false) {
|
|
435
442
|
try {
|
|
436
|
-
if (this._firstLoad &&
|
|
437
|
-
return;
|
|
438
|
-
}
|
|
439
|
-
if (this._firstLoad && !forceReload && this.autoLoad === undefined) {
|
|
443
|
+
if (this._firstLoad && !forceReload) {
|
|
440
444
|
let autoLoad = await this._application.getBooleanParam("global.carregar.registros.iniciar.tela");
|
|
441
445
|
if (!autoLoad) {
|
|
442
446
|
return;
|
|
@@ -587,6 +591,7 @@ const SnkFilterBar = class {
|
|
|
587
591
|
.then((filters) => {
|
|
588
592
|
accept();
|
|
589
593
|
this.filterConfig = filters.map(item => this.normalizeItem(item));
|
|
594
|
+
this.filterConfig.sort((a, b) => this._filtersComparator(a, b));
|
|
590
595
|
})
|
|
591
596
|
.catch(reason => {
|
|
592
597
|
throw new core.ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
|