@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
@@ -425,6 +425,7 @@ class ConfigStorage {
|
|
425
425
|
if (config == undefined) {
|
426
426
|
return;
|
427
427
|
}
|
428
|
+
name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.grid);
|
428
429
|
await this.deleteGridConfigCache(name, resourceID);
|
429
430
|
return this.gridConfigFetcher.saveConfig(config, name, resourceID);
|
430
431
|
}
|
package/dist/cjs/{SnkMultiSelectionListDataSource-3c08d25c.js → IExporterProvider-597949f9.js}
RENAMED
@@ -1,12 +1,13 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
3
|
const DataFetcher = require('./DataFetcher-313debd8.js');
|
4
|
-
|
4
|
+
require('./pesquisa-fetcher-680e198f.js');
|
5
5
|
const core = require('@sankhyalabs/core');
|
6
|
-
require('./index-
|
6
|
+
require('./index-1dfc7a6e.js');
|
7
7
|
require('./ISave-e91b70a7.js');
|
8
8
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
9
|
-
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
9
|
+
const UnitMetadata = require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
10
|
+
const dataunitFetcher = require('./dataunit-fetcher-688d3f05.js');
|
10
11
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
11
12
|
require('./form-config-fetcher-2dd00e5b.js');
|
12
13
|
const InMemoryFilterColumnDataSource = require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource');
|
@@ -116,7 +117,7 @@ class SnkMultiSelectionListDataSource {
|
|
116
117
|
if (fieldName == undefined) {
|
117
118
|
return Promise.resolve(undefined);
|
118
119
|
}
|
119
|
-
return Promise.resolve(await
|
120
|
+
return Promise.resolve(await dataunitFetcher.PreloadManager.getDistinct(this._dataUnit, fieldName));
|
120
121
|
}
|
121
122
|
fetchData(filterTerm, fieldName) {
|
122
123
|
return new Promise(resolve => {
|
@@ -136,5 +137,94 @@ class SnkMultiSelectionListDataSource {
|
|
136
137
|
}
|
137
138
|
}
|
138
139
|
|
140
|
+
class RmPrecisionCustomValueFormatter {
|
141
|
+
setGrid(grid) {
|
142
|
+
if (this._grid) {
|
143
|
+
return;
|
144
|
+
}
|
145
|
+
this._grid = grid;
|
146
|
+
this.refreshSelectedRows();
|
147
|
+
}
|
148
|
+
setDataState(dataState) {
|
149
|
+
if (core.ObjectUtils.objectToString(dataState) === core.ObjectUtils.objectToString(this._dataState)) {
|
150
|
+
return;
|
151
|
+
}
|
152
|
+
this._dataState = dataState;
|
153
|
+
this.refreshSelectedRows();
|
154
|
+
}
|
155
|
+
format(currentValue, column, recordId) {
|
156
|
+
var _a;
|
157
|
+
if (!currentValue) {
|
158
|
+
return currentValue;
|
159
|
+
}
|
160
|
+
const rowMetadata = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.metadataByRow.get(recordId);
|
161
|
+
const rmPrecision = rowMetadata === null || rowMetadata === void 0 ? void 0 : rowMetadata.getProp('rm_precision', column.name);
|
162
|
+
if (rmPrecision || rmPrecision === 0) {
|
163
|
+
return core.NumberUtils.format(currentValue, rmPrecision, rmPrecision);
|
164
|
+
}
|
165
|
+
else {
|
166
|
+
return currentValue;
|
167
|
+
}
|
168
|
+
}
|
169
|
+
refreshSelectedRows() {
|
170
|
+
var _a;
|
171
|
+
(_a = this._grid) === null || _a === void 0 ? void 0 : _a.refreshSelectedRows();
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
class CommonsExporter {
|
176
|
+
constructor(dataUnit, grid) {
|
177
|
+
this.dataUnit = dataUnit;
|
178
|
+
this.grid = grid;
|
179
|
+
}
|
180
|
+
async getColumnsMetadata() {
|
181
|
+
var _a;
|
182
|
+
this.columnsState = await ((_a = this.grid) === null || _a === void 0 ? void 0 : _a.getColumnsState()) || [];
|
183
|
+
return await this.buildColumnsMetadata(this.columnsState);
|
184
|
+
}
|
185
|
+
getColumnsState() {
|
186
|
+
return this.columnsState;
|
187
|
+
}
|
188
|
+
async buildColumnsMetadata(gridColumns) {
|
189
|
+
var _a, _b;
|
190
|
+
const columnsMetadata = [];
|
191
|
+
for (const column of gridColumns) {
|
192
|
+
/**
|
193
|
+
* TODO: Analisar e criar uma melhor forma de tratar essa validação do "RECDESP".
|
194
|
+
*/
|
195
|
+
if (column.hidden && column.name !== "RECDESP") {
|
196
|
+
continue;
|
197
|
+
}
|
198
|
+
const fieldData = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(column.name);
|
199
|
+
const customFormatter = await this.grid.getCustomValueFormatter(column.name);
|
200
|
+
const columnData = {
|
201
|
+
label: column.label,
|
202
|
+
id: column.name,
|
203
|
+
width: column.width,
|
204
|
+
type: fieldData === null || fieldData === void 0 ? void 0 : fieldData.dataType,
|
205
|
+
userInterface: fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface,
|
206
|
+
customFormatter
|
207
|
+
};
|
208
|
+
columnsMetadata.push(columnData);
|
209
|
+
if (((_b = fieldData === null || fieldData === void 0 ? void 0 : fieldData.properties) === null || _b === void 0 ? void 0 : _b.DESCRIPTIONFIELD) != undefined) {
|
210
|
+
const mergedFrom = fieldData.properties.mergedFrom;
|
211
|
+
const descriptionField = `${fieldData.properties.ENTITYNAME}.${fieldData.properties.DESCRIPTIONFIELD}`;
|
212
|
+
const descriptionColumn = {
|
213
|
+
label: fieldData.properties.DESCRIPTIONENTITY,
|
214
|
+
id: `${mergedFrom ? (mergedFrom + ".") : ""}${descriptionField}`,
|
215
|
+
width: column.width,
|
216
|
+
type: core.DataType.TEXT,
|
217
|
+
userInterface: UnitMetadata.UserInterface.LONGTEXT,
|
218
|
+
descriptionFrom: fieldData.name
|
219
|
+
};
|
220
|
+
columnsMetadata.push(descriptionColumn);
|
221
|
+
}
|
222
|
+
}
|
223
|
+
return columnsMetadata || [];
|
224
|
+
}
|
225
|
+
}
|
226
|
+
|
227
|
+
exports.CommonsExporter = CommonsExporter;
|
139
228
|
exports.CrudUtils = CrudUtils;
|
229
|
+
exports.RmPrecisionCustomValueFormatter = RmPrecisionCustomValueFormatter;
|
140
230
|
exports.SnkMultiSelectionListDataSource = SnkMultiSelectionListDataSource;
|
@@ -0,0 +1,43 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
const core = require('@sankhyalabs/core');
|
4
|
+
|
5
|
+
const getSelectedIDs = (dataUnit) => {
|
6
|
+
const selectionInfo = dataUnit.getSelectionInfo();
|
7
|
+
if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
|
8
|
+
return [];
|
9
|
+
}
|
10
|
+
const selectedRecordsIDsInfo = [];
|
11
|
+
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.recordIds;
|
12
|
+
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
13
|
+
selectedRecords.forEach(recordId => {
|
14
|
+
if (!dataUnit.isNewRecord(recordId)) {
|
15
|
+
/*
|
16
|
+
Esse if foi necessário para tratar corretamente o ID
|
17
|
+
do record quando está sendo utilizado no modo standAlone
|
18
|
+
isso não faz a exportação da grid funcionar no modo standAlone
|
19
|
+
mas deixa de causar erro nas oprações de CRUD.
|
20
|
+
*/
|
21
|
+
if (!core.JSUtils.isBase64(recordId)) {
|
22
|
+
selectedRecordsIDsInfo.push({
|
23
|
+
name: "__record__id__",
|
24
|
+
type: core.DataType.TEXT,
|
25
|
+
value: recordId
|
26
|
+
});
|
27
|
+
return;
|
28
|
+
}
|
29
|
+
const revertBase64ToObject = JSON.parse(window.atob(recordId));
|
30
|
+
Object.entries(revertBase64ToObject).forEach(([name, value]) => {
|
31
|
+
const metadataField = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(name);
|
32
|
+
if (metadataField == undefined) {
|
33
|
+
return;
|
34
|
+
}
|
35
|
+
selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
|
36
|
+
});
|
37
|
+
}
|
38
|
+
});
|
39
|
+
}
|
40
|
+
return selectedRecordsIDsInfo;
|
41
|
+
};
|
42
|
+
|
43
|
+
exports.getSelectedIDs = getSelectedIDs;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
const ConfigStorage = require('./ConfigStorage-
|
3
|
+
const ConfigStorage = require('./ConfigStorage-a343e418.js');
|
4
4
|
const core = require('@sankhyalabs/core');
|
5
5
|
const formConfigFetcher = require('./form-config-fetcher-2dd00e5b.js');
|
6
6
|
|
@@ -74,11 +74,12 @@ class SnkFormConfigManager {
|
|
74
74
|
var _a;
|
75
75
|
const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
|
76
76
|
if (fields != undefined && fields.length > 0) {
|
77
|
-
return fields.map(({ label, name, readOnly }) => {
|
77
|
+
return fields.map(({ label, name, readOnly, visible, required }) => {
|
78
78
|
if (label == undefined) {
|
79
|
-
|
79
|
+
const currentField = dataUnit.getField(name);
|
80
|
+
return Object.assign(Object.assign({}, currentField), { name: name !== null && name !== void 0 ? name : currentField.name, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : currentField.readOnly, visible: visible !== null && visible !== void 0 ? visible : currentField.visible, required: required !== null && required !== void 0 ? required : currentField.required });
|
80
81
|
}
|
81
|
-
return { name, label, readOnly };
|
82
|
+
return { name, label, readOnly, visible, required };
|
82
83
|
})
|
83
84
|
.filter(field => this.isFieldVisible(field, descriptionFilter));
|
84
85
|
}
|
@@ -100,7 +101,7 @@ class SnkFormConfigManager {
|
|
100
101
|
const normalizedFilter = core.StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
|
101
102
|
return normalizedText.includes(normalizedFilter);
|
102
103
|
}
|
103
|
-
|
104
|
+
getFormConfig(dataUnit, ignoreReadOnlyFormFields) {
|
104
105
|
let fields = this.getFieldsList(dataUnit);
|
105
106
|
if (ignoreReadOnlyFormFields) {
|
106
107
|
fields = fields.filter(field => {
|
@@ -132,8 +133,8 @@ class SnkFormConfigManager {
|
|
132
133
|
this._onConfigChange(Object.assign({}, this._config));
|
133
134
|
}
|
134
135
|
}
|
135
|
-
getConfig(
|
136
|
-
return
|
136
|
+
getConfig(dataUnit, ignoreReadOnlyFormFields) {
|
137
|
+
return this.getFormConfig(dataUnit, ignoreReadOnlyFormFields !== null && ignoreReadOnlyFormFields !== void 0 ? ignoreReadOnlyFormFields : true);
|
137
138
|
}
|
138
139
|
getFormConfigFetcher() {
|
139
140
|
if (this._formConfigFetcher == undefined) {
|
@@ -30,7 +30,7 @@ const snkDataUnitMessages = {
|
|
30
30
|
},
|
31
31
|
cancelInfo: {
|
32
32
|
clone: "Duplicação descartada!",
|
33
|
-
insert: "A inclusão descartada!",
|
33
|
+
insert: "A inclusão foi descartada!",
|
34
34
|
update: "A edição foi descartada!"
|
35
35
|
},
|
36
36
|
confirm: {
|
@@ -51,6 +51,7 @@ const snkDataUnitMessages = {
|
|
51
51
|
forbiddenRemove: "Não é possível remover. Verifique as permissões de acesso.",
|
52
52
|
removeAllConfirmation: "Os <strong>{{size}} registros selecionados</strong> serão excluídos.<br/><br/><strong>Você realmente gostaria de continuar?</strong>",
|
53
53
|
removeAllInfo: "Os {{size}} registros foram removidos com sucesso!",
|
54
|
+
fieldNameRequired: "É necessário informar o nome da coluna."
|
54
55
|
};
|
55
56
|
|
56
57
|
const snkFilterBarMessages = {
|
@@ -306,6 +307,7 @@ const snkDataExporterMessages = {
|
|
306
307
|
},
|
307
308
|
label: {
|
308
309
|
currentPage: "Somente a página atual",
|
310
|
+
allRecords: "Todos os registros",
|
309
311
|
spreadsheet: "Planilha",
|
310
312
|
cube: "Cubo",
|
311
313
|
sendByEmail: "Enviar por email",
|
@@ -318,6 +320,7 @@ const snkDataExporterMessages = {
|
|
318
320
|
},
|
319
321
|
title: {
|
320
322
|
error: "Erro",
|
323
|
+
permission: "Falha detectada",
|
321
324
|
},
|
322
325
|
limitExceeded: {
|
323
326
|
title: "Atenção",
|
@@ -574,7 +577,7 @@ class SnkMessageBuilder {
|
|
574
577
|
this.loadAppMessages().then((msgs) => {
|
575
578
|
this._appMessages = msgs;
|
576
579
|
}, error => {
|
577
|
-
console.info('O arquivo de mensagens personalizadas não foi encontrado no caminho /messages/appmessages
|
580
|
+
console.info('O arquivo de mensagens personalizadas não foi encontrado no caminho /messages/appmessages', error);
|
578
581
|
});
|
579
582
|
}
|
580
583
|
/**
|
@@ -666,17 +669,10 @@ class SnkMessageBuilder {
|
|
666
669
|
return message;
|
667
670
|
}
|
668
671
|
}
|
669
|
-
loadAppMessages() {
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
.then(module => {
|
674
|
-
accept(module.default);
|
675
|
-
})
|
676
|
-
.catch(reason => {
|
677
|
-
reject(reason);
|
678
|
-
});
|
679
|
-
});
|
672
|
+
async loadAppMessages() {
|
673
|
+
const messagesUrl = await this._application.getApplicationPath();
|
674
|
+
const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(/* webpackIgnore: true */ `${messagesUrl}/messages/appmessages.js`)); });
|
675
|
+
return module.default;
|
680
676
|
}
|
681
677
|
}
|
682
678
|
exports.OperationMap = void 0;
|
@@ -5,8 +5,13 @@ const DataFetcher = require('./DataFetcher-313debd8.js');
|
|
5
5
|
const constants = require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
6
6
|
const UnitMetadata = require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
7
7
|
const utils = require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
8
|
+
const SortingUtils = require('@sankhyalabs/core/dist/utils/SortingUtils');
|
8
9
|
const ResourceIDUtils = require('./ResourceIDUtils-5ff86aa7.js');
|
9
10
|
|
11
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
12
|
+
|
13
|
+
const SortingUtils__default = /*#__PURE__*/_interopDefaultLegacy(SortingUtils);
|
14
|
+
|
10
15
|
class ArrayRepository {
|
11
16
|
constructor(equalsFunction) {
|
12
17
|
this._list = [];
|
@@ -86,6 +91,9 @@ class ArrayRepository {
|
|
86
91
|
async count() {
|
87
92
|
return Promise.resolve(this._list.length);
|
88
93
|
}
|
94
|
+
getFromCache() {
|
95
|
+
return core.ObjectUtils.copy(this._list);
|
96
|
+
}
|
89
97
|
}
|
90
98
|
|
91
99
|
class PreloadManager {
|
@@ -107,17 +115,7 @@ class PreloadManager {
|
|
107
115
|
}
|
108
116
|
}
|
109
117
|
static getSortingFunction(dataUnit, sorting) {
|
110
|
-
|
111
|
-
return undefined;
|
112
|
-
}
|
113
|
-
return (recordA, recordB) => {
|
114
|
-
for (const sort of sorting) {
|
115
|
-
const result = core.FieldComparator.compare(dataUnit.getField(sort.field), recordA, recordB, sort.mode === core.SortMode.ASC);
|
116
|
-
if (result != 0) {
|
117
|
-
return result;
|
118
|
-
}
|
119
|
-
}
|
120
|
-
};
|
118
|
+
return SortingUtils__default['default'].getSortingFunction(dataUnit, sorting);
|
121
119
|
}
|
122
120
|
static async getDistinct(dataUnit, fieldName) {
|
123
121
|
if (!PreloadManager.isCacheEnabled(dataUnit)) {
|
@@ -154,7 +152,11 @@ class PreloadManager {
|
|
154
152
|
static async loadData(dataUnit, request, loadFromServer) {
|
155
153
|
try {
|
156
154
|
if (PreloadManager.isCacheEnabled(dataUnit)) {
|
157
|
-
|
155
|
+
const useCache = [
|
156
|
+
"EZ_GRID_LOADING_SOURCE",
|
157
|
+
core.DataUnit.CHANGING_PAGE_LOADING_SOURCE,
|
158
|
+
core.DataUnit.ALL_RECORDS_SELECTION_SOURCE
|
159
|
+
].includes(request.source);
|
158
160
|
if (useCache) {
|
159
161
|
const isCacheEmpty = await PreloadManager.getRepository(dataUnit).isEmpty();
|
160
162
|
if (!isCacheEmpty) {
|
@@ -221,6 +223,9 @@ class PreloadManager {
|
|
221
223
|
.catch(reason => reject(reason));
|
222
224
|
});
|
223
225
|
}
|
226
|
+
static getCachedRecords(dataUnit) {
|
227
|
+
return PreloadManager.getRepository(dataUnit).getFromCache();
|
228
|
+
}
|
224
229
|
}
|
225
230
|
PreloadManager._repositories = new Map();
|
226
231
|
PreloadManager._loadingStatus = new Map();
|
@@ -262,7 +267,7 @@ function buildPaginationInfo(records, offset = 0, limit = 0) {
|
|
262
267
|
}
|
263
268
|
|
264
269
|
class InMemoryLoader {
|
265
|
-
constructor(metadata, records) {
|
270
|
+
constructor(metadata, records, config) {
|
266
271
|
this.metadata = metadata;
|
267
272
|
this.records = records;
|
268
273
|
this._dataUnit = new core.DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
|
@@ -271,7 +276,11 @@ class InMemoryLoader {
|
|
271
276
|
this._dataUnit.dataLoader = (dataUnit, request) => this.inMemoryLoader(dataUnit, request, this.getRecordsToLoad());
|
272
277
|
this._dataUnit.saveLoader = (_dataUnit, changes) => this.saveLoader(_dataUnit, changes);
|
273
278
|
this._dataUnit.removeLoader = (_dataUnit, recordIds) => this.removeLoader(_dataUnit, recordIds);
|
274
|
-
this.dataUnit.loadMetadata().then(() =>
|
279
|
+
this.dataUnit.loadMetadata().then(() => {
|
280
|
+
if ((config === null || config === void 0 ? void 0 : config.autoLoad) !== false) {
|
281
|
+
this.dataUnit.loadData();
|
282
|
+
}
|
283
|
+
});
|
275
284
|
}
|
276
285
|
getRecordsToLoad() {
|
277
286
|
if (this._initialRecords == undefined && this.dataUnit.records.length > 0) {
|
@@ -323,7 +332,7 @@ class InMemoryLoader {
|
|
323
332
|
this._initialRecords = newRecords;
|
324
333
|
if (this._dataUnit) {
|
325
334
|
//Isso força o refresh internamente no datunit
|
326
|
-
this._dataUnit.
|
335
|
+
this._dataUnit.loadData();
|
327
336
|
}
|
328
337
|
}
|
329
338
|
get metadata() {
|
@@ -375,11 +384,17 @@ class InMemoryLoader {
|
|
375
384
|
}
|
376
385
|
InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME = "InMemoryDataUnit";
|
377
386
|
|
387
|
+
function getRecordValue(record, fieldName) {
|
388
|
+
var _a, _b;
|
389
|
+
return ((_a = record[fieldName]) === null || _a === void 0 ? void 0 : _a.value) !== undefined ? (_b = record[fieldName]) === null || _b === void 0 ? void 0 : _b.value : record[fieldName];
|
390
|
+
}
|
391
|
+
|
378
392
|
class DatasetStrategy {
|
379
393
|
canSlice() {
|
380
394
|
return false;
|
381
395
|
}
|
382
396
|
processSortingSide(request, dataUnit, serverSideFilters) {
|
397
|
+
var _a;
|
383
398
|
const localSorting = [];
|
384
399
|
const serverSorting = [];
|
385
400
|
if (request.sort != undefined) {
|
@@ -388,9 +403,7 @@ class DatasetStrategy {
|
|
388
403
|
}
|
389
404
|
for (const sort of request.sort) {
|
390
405
|
const descriptor = dataUnit.getField(sort.field);
|
391
|
-
const local = descriptor
|
392
|
-
&& descriptor.properties != undefined
|
393
|
-
&& descriptor.properties.calculated === "true";
|
406
|
+
const local = ((_a = descriptor === null || descriptor === void 0 ? void 0 : descriptor.properties) === null || _a === void 0 ? void 0 : _a.calculated) === "true" || (descriptor === null || descriptor === void 0 ? void 0 : descriptor.userInterface) === core.UserInterface.LONGTEXT;
|
394
407
|
if (local) {
|
395
408
|
localSorting.push(sort);
|
396
409
|
}
|
@@ -430,6 +443,53 @@ class DatasetStrategy {
|
|
430
443
|
return Promise.reject(error);
|
431
444
|
}
|
432
445
|
}
|
446
|
+
async loadRowMetadata(snkDataUnit, fieldName, metadataName, updatedFields = {}) {
|
447
|
+
try {
|
448
|
+
const serviceName = "DatasetSP.loadRowMetadata";
|
449
|
+
const parsedRequestBody = await this.buildRequestBodyLoadRowMetadata({ snkDataUnit, fieldName, metadataName, serviceName, updatedFields });
|
450
|
+
const response = await DataFetcher.DataFetcher.get().callServiceBroker(serviceName, parsedRequestBody);
|
451
|
+
return response;
|
452
|
+
}
|
453
|
+
catch (error) {
|
454
|
+
console.error(error);
|
455
|
+
return Promise.reject(error);
|
456
|
+
}
|
457
|
+
}
|
458
|
+
async buildRequestBodyLoadRowMetadata({ snkDataUnit, serviceName, fieldName, metadataName, updatedFields, }) {
|
459
|
+
const dataUnit = snkDataUnit.dataUnit;
|
460
|
+
const entityName = DataUnitFetcher.parseDataUnitName(dataUnit.name).entityName;
|
461
|
+
const recordIdInfo = await snkDataUnit.getSelectedRecordsIDsInfo();
|
462
|
+
const pk = recordIdInfo.reduce((accumulator, currentValue) => {
|
463
|
+
accumulator[currentValue.name] = currentValue.value;
|
464
|
+
return accumulator;
|
465
|
+
}, {});
|
466
|
+
const record = dataUnit.getSelectedRecord();
|
467
|
+
const fields = dataUnit.metadata.fields.filter(({ standAlone, name }) => !standAlone && !name.includes(".")).map(({ name }) => name);
|
468
|
+
const values = fields.reduce((accumulator, currentValue, currentIndex) => {
|
469
|
+
const recordValue = getRecordValue(record, currentValue);
|
470
|
+
const updatedFieldValue = getRecordValue(updatedFields, currentValue);
|
471
|
+
accumulator[currentIndex] = updatedFieldValue !== undefined ? updatedFieldValue : recordValue;
|
472
|
+
return accumulator;
|
473
|
+
}, {});
|
474
|
+
const requestBody = {
|
475
|
+
serviceName,
|
476
|
+
requestBody: {
|
477
|
+
dataSetID: dataUnit.dataUnitId,
|
478
|
+
entityName,
|
479
|
+
standAlone: false,
|
480
|
+
metadataName,
|
481
|
+
fieldName,
|
482
|
+
fields,
|
483
|
+
record: {
|
484
|
+
pk,
|
485
|
+
oldPk: pk,
|
486
|
+
values,
|
487
|
+
},
|
488
|
+
}
|
489
|
+
};
|
490
|
+
const parsedRequestBody = JSON.stringify(requestBody);
|
491
|
+
return parsedRequestBody;
|
492
|
+
}
|
433
493
|
getFieldsList(dataUnit) {
|
434
494
|
let fields = ["__record__id__", "__record__label__"];
|
435
495
|
dataUnit.metadata.fields.forEach((descriptor) => {
|
@@ -509,9 +569,11 @@ class DatasetStrategy {
|
|
509
569
|
}
|
510
570
|
processRecords(dataUnit, fields, responseRecords) {
|
511
571
|
return responseRecords.map((dataFrame) => {
|
572
|
+
const lastElement = dataFrame[dataFrame.length - 1];
|
512
573
|
const duRecord = {
|
513
574
|
__record__id__: dataFrame[0],
|
514
|
-
__record__label__: dataFrame[1]
|
575
|
+
__record__label__: dataFrame[1],
|
576
|
+
__record__metadata__: lastElement['_rmd'],
|
515
577
|
};
|
516
578
|
dataUnit.metadata.fields.forEach(fieldDescriptor => {
|
517
579
|
duRecord[fieldDescriptor.name] = this.buildFieldValue(fieldDescriptor, fields, dataFrame);
|
@@ -574,6 +636,9 @@ class DataUnitDataLoader {
|
|
574
636
|
});
|
575
637
|
});
|
576
638
|
}
|
639
|
+
static getCachedRecords(dataUnit) {
|
640
|
+
return PreloadManager.getCachedRecords(dataUnit);
|
641
|
+
}
|
577
642
|
static async loadFromServer(dataUnit, request, loadingInfo) {
|
578
643
|
try {
|
579
644
|
//Registramos a request com as informações de carga para determinarmos a última.
|
@@ -774,6 +839,7 @@ class DataUnitFetcher {
|
|
774
839
|
dataUnit.saveLoader = (_dataUnit, changes) => this.saveData(dataUnit, changes);
|
775
840
|
dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
|
776
841
|
dataUnit.recordLoader = (dataUnit, recordIds) => this.loadRecord(dataUnit, recordIds);
|
842
|
+
dataUnit.allRecordsLoader = (dataUnit) => DataUnitDataLoader.getCachedRecords(dataUnit);
|
777
843
|
return dataUnit;
|
778
844
|
}
|
779
845
|
loadMetadata(dataUnit) {
|
@@ -992,170 +1058,11 @@ class DataUnitFetcher {
|
|
992
1058
|
}
|
993
1059
|
}
|
994
1060
|
|
995
|
-
class PesquisaFetcher {
|
996
|
-
constructor() {
|
997
|
-
this._defaultPageSize = 100;
|
998
|
-
this._templateByQuery = new Map();
|
999
|
-
this._searchListenersByDataUnit = new Map();
|
1000
|
-
this.buldTemplates();
|
1001
|
-
}
|
1002
|
-
buldTemplates() {
|
1003
|
-
this._templateByQuery.set("search", DataFetcher.dist.gql `query($entityName: String! $argument: String $criteria: InputSearchCriteria $options: InputSearchOptions) {
|
1004
|
-
$queryAlias$: search(entityName: $entityName argument: $argument criteria: $criteria options: $options){
|
1005
|
-
value
|
1006
|
-
label
|
1007
|
-
}
|
1008
|
-
}`);
|
1009
|
-
}
|
1010
|
-
loadSearchOptions(entityName, argument, criteria, options) {
|
1011
|
-
var _a;
|
1012
|
-
const cleanText = (argument === null || argument === void 0 ? void 0 : argument.toString().trim()) || undefined;
|
1013
|
-
argument = isNaN(Number(cleanText)) && cleanText ? `%${cleanText}` : cleanText;
|
1014
|
-
criteria === null || criteria === void 0 ? void 0 : criteria.params.forEach(param => {
|
1015
|
-
if (param.dataType === core.DataType.OBJECT) {
|
1016
|
-
param.value = JSON.stringify(param.value);
|
1017
|
-
}
|
1018
|
-
});
|
1019
|
-
const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, options);
|
1020
|
-
const values = {
|
1021
|
-
argument: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.argument) || argument,
|
1022
|
-
entityName,
|
1023
|
-
criteria: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.criteria) || criteria,
|
1024
|
-
options: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions) || options,
|
1025
|
-
};
|
1026
|
-
if (values.options) {
|
1027
|
-
(_a = values.options) === null || _a === void 0 ? true : delete _a.dataUnitId;
|
1028
|
-
}
|
1029
|
-
return new Promise((resolve, reject) => {
|
1030
|
-
DataFetcher.DataFetcher.get()
|
1031
|
-
.callGraphQL({
|
1032
|
-
values,
|
1033
|
-
query: this._templateByQuery.get("search"),
|
1034
|
-
})
|
1035
|
-
.then((result) => {
|
1036
|
-
resolve(result);
|
1037
|
-
})
|
1038
|
-
.catch((error) => {
|
1039
|
-
reject(error);
|
1040
|
-
});
|
1041
|
-
});
|
1042
|
-
}
|
1043
|
-
loadAdvancedSearch(entityName, argument, criteria, searchOptions) {
|
1044
|
-
var _a, _b, _c, _d;
|
1045
|
-
const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, searchOptions);
|
1046
|
-
const values = {
|
1047
|
-
argument: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.argument) || argument,
|
1048
|
-
criteria: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.criteria) || criteria,
|
1049
|
-
searchOptions: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions) || searchOptions,
|
1050
|
-
};
|
1051
|
-
const serviceName = "PesquisaSP.getSuggestion";
|
1052
|
-
const externalCriteria = {
|
1053
|
-
query: {
|
1054
|
-
$: (_a = values.criteria) === null || _a === void 0 ? void 0 : _a.expression
|
1055
|
-
}
|
1056
|
-
};
|
1057
|
-
if (((_c = (_b = values.criteria) === null || _b === void 0 ? void 0 : _b.params) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
1058
|
-
externalCriteria.params = {
|
1059
|
-
param: values.criteria.params.map(param => {
|
1060
|
-
let value = param.value;
|
1061
|
-
if (typeof value === "string") {
|
1062
|
-
const match = /CTX\{([^}]+)\}/.exec(value);
|
1063
|
-
if (match) {
|
1064
|
-
value = core.ApplicationContext.getContextValue(`__SNK__APPLICATION__FILTER__CONTEXT(${match[1]})__`);
|
1065
|
-
}
|
1066
|
-
}
|
1067
|
-
let type = param.dataType;
|
1068
|
-
if (type === core.DataType.OBJECT) {
|
1069
|
-
value = value.value;
|
1070
|
-
type = "S";
|
1071
|
-
}
|
1072
|
-
else {
|
1073
|
-
type = convertParamType(param.dataType);
|
1074
|
-
}
|
1075
|
-
return { $: value, type };
|
1076
|
-
})
|
1077
|
-
};
|
1078
|
-
}
|
1079
|
-
const options = searchOptions != undefined
|
1080
|
-
? Object.assign(Object.assign({}, searchOptions), { "pkFieldName": searchOptions.codeFieldName, "label": searchOptions.descriptionFieldName, "fieldName": searchOptions.codeFieldName, "useDescriptionOptions": false, "enableRowsCounter": true }) : undefined;
|
1081
|
-
const reqBody = {
|
1082
|
-
"serviceName": serviceName,
|
1083
|
-
"requestBody": {
|
1084
|
-
"criteria": Object.assign({ "entityName": entityName, "compacted": false, "ignoreEntityCriteria": false, "limit": this._defaultPageSize, "query": { "$": values.argument }, "orderByDesc": false, "externalCriteria": externalCriteria, "localEntityName": (_d = values.searchOptions) === null || _d === void 0 ? void 0 : _d.rootEntity }, { options }),
|
1085
|
-
"clientEventList": {
|
1086
|
-
"clientEvent": []
|
1087
|
-
}
|
1088
|
-
}
|
1089
|
-
};
|
1090
|
-
return new Promise((resolve, reject) => {
|
1091
|
-
DataFetcher.DataFetcher.get()
|
1092
|
-
.callServiceBroker("PesquisaSP.getSuggestion", JSON.stringify(reqBody))
|
1093
|
-
.then(result => resolve(result))
|
1094
|
-
.catch(error => reject(error));
|
1095
|
-
});
|
1096
|
-
}
|
1097
|
-
addSearchListener(entityName, dataUnitID, listener) {
|
1098
|
-
var _a;
|
1099
|
-
const dataUnitSearchListeners = this._searchListenersByDataUnit.get(dataUnitID) || [];
|
1100
|
-
const entityListener = dataUnitSearchListeners.find(currentListener => currentListener.entity === entityName);
|
1101
|
-
if (!entityListener) {
|
1102
|
-
this._searchListenersByDataUnit.set(dataUnitID, [...dataUnitSearchListeners, { entity: entityName, listener }]);
|
1103
|
-
}
|
1104
|
-
else {
|
1105
|
-
for (const type of Object.keys(listener)) {
|
1106
|
-
if (type in entityListener.listener) {
|
1107
|
-
const listenerFunctionIsEquals = ((_a = entityListener.listener[type]) === null || _a === void 0 ? void 0 : _a.toString()) === listener[type].toString();
|
1108
|
-
if (listenerFunctionIsEquals)
|
1109
|
-
continue;
|
1110
|
-
entityListener.listener[type] = listener[type];
|
1111
|
-
}
|
1112
|
-
}
|
1113
|
-
}
|
1114
|
-
return () => {
|
1115
|
-
const newListeners = dataUnitSearchListeners.filter(currentListener => currentListener.entity !== entityName);
|
1116
|
-
if (!newListeners.length) {
|
1117
|
-
this._searchListenersByDataUnit.delete(dataUnitID);
|
1118
|
-
return;
|
1119
|
-
}
|
1120
|
-
this._searchListenersByDataUnit.set(dataUnitID, newListeners);
|
1121
|
-
};
|
1122
|
-
}
|
1123
|
-
applySearchListener(listenerType, entityName, argument, criteria, searchOptions) {
|
1124
|
-
var _a;
|
1125
|
-
const dataUnitId = searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.dataUnitId;
|
1126
|
-
if (!dataUnitId)
|
1127
|
-
return;
|
1128
|
-
const entityListener = (_a = this._searchListenersByDataUnit.get(dataUnitId)) === null || _a === void 0 ? void 0 : _a.find(({ entity }) => entity === entityName);
|
1129
|
-
if (!entityListener)
|
1130
|
-
return;
|
1131
|
-
const { listener } = entityListener;
|
1132
|
-
if (!(listenerType in listener))
|
1133
|
-
return;
|
1134
|
-
return listener[listenerType]({ argument, criteria, searchOptions });
|
1135
|
-
}
|
1136
|
-
}
|
1137
|
-
function convertParamType(dataType) {
|
1138
|
-
//Alerta: Cuidado pra não contaminar o DataType com a implementação
|
1139
|
-
//atual da pesquisa... em geral, somente inteiros,
|
1140
|
-
//data (com ou sem hora) e string são realmente relevantes
|
1141
|
-
switch (dataType) {
|
1142
|
-
case core.DataType.NUMBER:
|
1143
|
-
return "I";
|
1144
|
-
case core.DataType.DATE:
|
1145
|
-
return "D";
|
1146
|
-
default:
|
1147
|
-
return "S";
|
1148
|
-
}
|
1149
|
-
}
|
1150
|
-
var SearchListenerType;
|
1151
|
-
(function (SearchListenerType) {
|
1152
|
-
SearchListenerType["beforeSearch"] = "beforeSearch";
|
1153
|
-
})(SearchListenerType || (SearchListenerType = {}));
|
1154
|
-
|
1155
1061
|
exports.DataUnitFetcher = DataUnitFetcher;
|
1062
|
+
exports.DatasetStrategy = DatasetStrategy;
|
1156
1063
|
exports.InMemoryLoader = InMemoryLoader;
|
1157
|
-
exports.PesquisaFetcher = PesquisaFetcher;
|
1158
1064
|
exports.PreloadManager = PreloadManager;
|
1159
1065
|
exports.applyFilter = applyFilter;
|
1160
1066
|
exports.applySorting = applySorting;
|
1161
1067
|
exports.buildPaginationInfo = buildPaginationInfo;
|
1068
|
+
exports.getRecordValue = getRecordValue;
|
@@ -11,8 +11,11 @@ exports.DataExporterOption = void 0;
|
|
11
11
|
DataExporterOption["EXPORT_TO_PDF"] = "exportToPDF";
|
12
12
|
DataExporterOption["EXPORT_TO_XLS"] = "exportToXLS";
|
13
13
|
DataExporterOption["EXPORT_CURRENT_PAGE"] = "exportCurrentPage";
|
14
|
+
DataExporterOption["EXPORT_ALL_RECORDS"] = "exportAllRecords";
|
14
15
|
DataExporterOption["EXPORT_PAGE_TO_PDF"] = "exportPageToPDF";
|
15
16
|
DataExporterOption["EXPORT_PAGE_TO_XLS"] = "exportPageToXLS";
|
17
|
+
DataExporterOption["EXPORT_ALL_RECORDS_TO_PDF"] = "exportAllRecordsToPDF";
|
18
|
+
DataExporterOption["EXPORT_ALL_RECORDS_TO_XLS"] = "exportAllRecordsToXLS";
|
16
19
|
DataExporterOption["EXPORT_BY_EMAIL"] = "exportToEmail";
|
17
20
|
DataExporterOption["EXPORT_PDF_TO_EMAIL"] = "exportPDFToEmail";
|
18
21
|
DataExporterOption["EXPORT_XLS_TO_EMAIL"] = "exportXLSToEmail";
|
@@ -29,6 +32,8 @@ exports.DataExporterType = void 0;
|
|
29
32
|
DataExporterType["EXPORT_TO_XLS"] = "XLS";
|
30
33
|
DataExporterType["EXPORT_PAGE_TO_PDF"] = "PDF";
|
31
34
|
DataExporterType["EXPORT_PAGE_TO_XLS"] = "XLS";
|
35
|
+
DataExporterType["EXPORT_ALL_RECORDS_TO_PDF"] = "PDF";
|
36
|
+
DataExporterType["EXPORT_ALL_RECORDS_TO_XLS"] = "XLS";
|
32
37
|
DataExporterType["EXPORT_PDF_TO_EMAIL"] = "PDF";
|
33
38
|
DataExporterType["EXPORT_XLS_TO_EMAIL"] = "XLS";
|
34
39
|
})(exports.DataExporterType || (exports.DataExporterType = {}));
|