@sankhyalabs/sankhyablocks 8.15.1 → 8.16.0-dev.2
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/{SnkMultiSelectionListDataSource-303e85d1.js → IExporterProvider-9479f618.js} +94 -4
- package/dist/cjs/RecordIDUtils-3735135c.js +43 -0
- package/dist/cjs/{SnkFormConfigManager-f9dc0d28.js → SnkFormConfigManager-1b13bacd.js} +6 -3
- package/dist/cjs/{SnkMessageBuilder-66aa2557.js → SnkMessageBuilder-722b104e.js} +8 -12
- package/dist/cjs/{pesquisa-fetcher-213797ec.js → dataunit-fetcher-0c7106a0.js} +88 -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 +4 -2
- package/dist/cjs/snk-application.cjs.entry.js +34 -11
- package/dist/cjs/snk-attach.cjs.entry.js +71 -46
- package/dist/cjs/snk-crud.cjs.entry.js +96 -10
- package/dist/cjs/snk-data-exporter.cjs.entry.js +315 -85
- package/dist/cjs/snk-data-unit-16791a2f.js +679 -0
- package/dist/cjs/snk-data-unit.cjs.entry.js +12 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +48 -7
- package/dist/cjs/snk-filter-bar.cjs.entry.js +5 -1
- package/dist/cjs/snk-form-view.cjs.entry.js +67 -0
- package/dist/cjs/snk-form.cjs.entry.js +51 -6
- package/dist/cjs/snk-grid.cjs.entry.js +164 -107
- package/dist/cjs/{snk-guides-viewer-4b6ecda8.js → snk-guides-viewer-d82746e8.js} +36 -8
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -6
- package/dist/cjs/snk-simple-crud.cjs.entry.js +264 -37
- 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 +249 -7
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +135 -0
- package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +161 -0
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +112 -5
- 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 +507 -214
- 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 +6 -3
- package/dist/collection/components/snk-grid/snk-grid.js +240 -101
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +386 -18
- 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/dataUnit/InMemoryLoader.js +8 -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 +1 -0
- package/dist/components/{field-search.js → IExporterProvider.js} +93 -6
- package/dist/components/ISave.js +47 -0
- package/dist/components/SnkFormConfigManager.js +6 -3
- package/dist/components/SnkMessageBuilder.js +8 -12
- package/dist/components/dataunit-fetcher.js +85 -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 +103 -11
- package/dist/components/snk-data-exporter2.js +309 -85
- package/dist/components/snk-data-unit2.js +470 -212
- package/dist/components/snk-detail-view2.js +87 -10
- package/dist/components/snk-expression-item2.js +1 -1
- package/dist/components/snk-filter-bar2.js +6 -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 +259 -23
- package/dist/components/snk-taskbar2.js +6 -5
- package/dist/esm/{SnkMultiSelectionListDataSource-36918dbf.js → IExporterProvider-5a858363.js} +93 -5
- package/dist/esm/RecordIDUtils-87d02110.js +41 -0
- package/dist/esm/{SnkFormConfigManager-f53f9f87.js → SnkFormConfigManager-d4554df9.js} +6 -3
- package/dist/esm/{SnkMessageBuilder-0a4becdd.js → SnkMessageBuilder-89925609.js} +8 -12
- package/dist/esm/{pesquisa-fetcher-fe6f3826.js → dataunit-fetcher-f7e0ffc0.js} +84 -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 +4 -2
- package/dist/esm/snk-application.entry.js +33 -10
- package/dist/esm/snk-attach.entry.js +66 -41
- package/dist/esm/snk-crud.entry.js +96 -10
- package/dist/esm/snk-data-exporter.entry.js +316 -86
- package/dist/esm/snk-data-unit-a327d22c.js +677 -0
- package/dist/esm/snk-data-unit.entry.js +12 -2
- package/dist/esm/snk-detail-view.entry.js +48 -7
- package/dist/esm/snk-filter-bar.entry.js +5 -1
- package/dist/esm/snk-form-view.entry.js +67 -0
- package/dist/esm/snk-form.entry.js +51 -6
- package/dist/esm/snk-grid.entry.js +162 -105
- package/dist/esm/{snk-guides-viewer-113be3fd.js → snk-guides-viewer-874da66f.js} +36 -8
- package/dist/esm/snk-guides-viewer.entry.js +8 -6
- package/dist/esm/snk-simple-crud.entry.js +252 -25
- 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-0046959e.entry.js +1 -0
- package/dist/sankhyablocks/p-0e11ee18.entry.js +1 -0
- package/dist/sankhyablocks/p-1db45d26.entry.js +1 -0
- package/dist/sankhyablocks/p-30cf616e.js +1 -0
- package/dist/sankhyablocks/p-47b60deb.entry.js +1 -0
- package/dist/sankhyablocks/p-60e46675.entry.js +11 -0
- package/dist/sankhyablocks/p-6d4f4614.js +60 -0
- package/dist/sankhyablocks/p-6ded2076.entry.js +1 -0
- package/dist/sankhyablocks/p-7a337364.js +1 -0
- package/dist/sankhyablocks/p-7d9baaf4.entry.js +1 -0
- package/dist/sankhyablocks/{p-ae4fc9a9.js → p-7e7a7473.js} +1 -1
- package/dist/sankhyablocks/p-829d4045.js +1 -0
- package/dist/sankhyablocks/p-8c6b44ea.entry.js +1 -0
- package/dist/sankhyablocks/p-8fc470e5.entry.js +1 -0
- package/dist/sankhyablocks/p-9863d682.js +1 -0
- package/dist/sankhyablocks/p-a4b1f1eb.js +1 -0
- package/dist/sankhyablocks/p-af8efd95.js +6 -0
- package/dist/sankhyablocks/p-b7c4feeb.entry.js +1 -0
- package/dist/sankhyablocks/p-b8cde0d8.entry.js +1 -0
- package/dist/sankhyablocks/p-c7cbad38.js +1 -0
- package/dist/sankhyablocks/p-e0b9f59a.entry.js +1 -0
- package/dist/sankhyablocks/p-e6210aec.js +1 -0
- package/dist/sankhyablocks/p-e9bbc3d5.entry.js +1 -0
- package/dist/sankhyablocks/p-f2809746.entry.js +1 -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 +36 -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 +19 -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 +61 -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-grid/snk-grid.d.ts +46 -6
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +58 -4
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +1 -1
- package/dist/types/components.d.ts +220 -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-07a61550.entry.js +0 -1
- package/dist/sankhyablocks/p-0899e0b5.entry.js +0 -1
- package/dist/sankhyablocks/p-154a7f33.entry.js +0 -1
- package/dist/sankhyablocks/p-15802c59.entry.js +0 -1
- package/dist/sankhyablocks/p-164666b1.js +0 -65
- package/dist/sankhyablocks/p-32556aa6.js +0 -1
- package/dist/sankhyablocks/p-328585d0.entry.js +0 -1
- package/dist/sankhyablocks/p-38289a55.js +0 -1
- package/dist/sankhyablocks/p-52c8e589.js +0 -1
- package/dist/sankhyablocks/p-5cb07080.js +0 -1
- package/dist/sankhyablocks/p-74d349c3.entry.js +0 -1
- package/dist/sankhyablocks/p-7fe120b8.entry.js +0 -11
- package/dist/sankhyablocks/p-add17f6a.entry.js +0 -1
- package/dist/sankhyablocks/p-af1ac81f.entry.js +0 -1
- package/dist/sankhyablocks/p-b4525fc0.entry.js +0 -1
- package/dist/sankhyablocks/p-cce0865d.js +0 -1
- package/dist/sankhyablocks/p-dec65f6c.entry.js +0 -1
- package/dist/sankhyablocks/p-ee9536bc.entry.js +0 -1
- package/dist/sankhyablocks/p-f13f7616.entry.js +0 -1
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/index.d.ts +0 -3
package/dist/cjs/{SnkMultiSelectionListDataSource-303e85d1.js → IExporterProvider-9479f618.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-0c7106a0.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;
|
@@ -74,11 +74,14 @@ 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
|
-
return dataUnit.getField(name)
|
79
|
+
return Object.assign(Object.assign({}, dataUnit.getField(name)), { name,
|
80
|
+
readOnly,
|
81
|
+
visible,
|
82
|
+
required });
|
80
83
|
}
|
81
|
-
return { name, label, readOnly };
|
84
|
+
return { name, label, readOnly, visible, required };
|
82
85
|
})
|
83
86
|
.filter(field => this.isFieldVisible(field, descriptionFilter));
|
84
87
|
}
|
@@ -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();
|
@@ -258,15 +263,20 @@ function buildPaginationInfo(records, offset = 0, limit = 0) {
|
|
258
263
|
}
|
259
264
|
|
260
265
|
class InMemoryLoader {
|
261
|
-
constructor(metadata, records) {
|
266
|
+
constructor(metadata, records, config) {
|
262
267
|
this.metadata = metadata;
|
263
268
|
this.records = records;
|
264
269
|
this._dataUnit = new core.DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
|
270
|
+
this._dataUnit.pageSize = 150;
|
265
271
|
this._dataUnit.metadataLoader = () => this.metadaLoader();
|
266
272
|
this._dataUnit.dataLoader = (dataUnit, request) => this.inMemoryLoader(dataUnit, request, this.getRecordsToLoad());
|
267
273
|
this._dataUnit.saveLoader = (_dataUnit, changes) => this.saveLoader(_dataUnit, changes);
|
268
274
|
this._dataUnit.removeLoader = (_dataUnit, recordIds) => this.removeLoader(_dataUnit, recordIds);
|
269
|
-
this.dataUnit.loadMetadata().then(() =>
|
275
|
+
this.dataUnit.loadMetadata().then(() => {
|
276
|
+
if ((config === null || config === void 0 ? void 0 : config.autoLoad) !== false) {
|
277
|
+
this.dataUnit.loadData();
|
278
|
+
}
|
279
|
+
});
|
270
280
|
}
|
271
281
|
getRecordsToLoad() {
|
272
282
|
if (this._initialRecords == undefined && this.dataUnit.records.length > 0) {
|
@@ -318,7 +328,7 @@ class InMemoryLoader {
|
|
318
328
|
this._initialRecords = newRecords;
|
319
329
|
if (this._dataUnit) {
|
320
330
|
//Isso força o refresh internamente no datunit
|
321
|
-
this._dataUnit.
|
331
|
+
this._dataUnit.loadData();
|
322
332
|
}
|
323
333
|
}
|
324
334
|
get metadata() {
|
@@ -370,11 +380,17 @@ class InMemoryLoader {
|
|
370
380
|
}
|
371
381
|
InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME = "InMemoryDataUnit";
|
372
382
|
|
383
|
+
function getRecordValue(record, fieldName) {
|
384
|
+
var _a, _b;
|
385
|
+
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];
|
386
|
+
}
|
387
|
+
|
373
388
|
class DatasetStrategy {
|
374
389
|
canSlice() {
|
375
390
|
return false;
|
376
391
|
}
|
377
392
|
processSortingSide(request, dataUnit, serverSideFilters) {
|
393
|
+
var _a;
|
378
394
|
const localSorting = [];
|
379
395
|
const serverSorting = [];
|
380
396
|
if (request.sort != undefined) {
|
@@ -383,9 +399,7 @@ class DatasetStrategy {
|
|
383
399
|
}
|
384
400
|
for (const sort of request.sort) {
|
385
401
|
const descriptor = dataUnit.getField(sort.field);
|
386
|
-
const local = descriptor
|
387
|
-
&& descriptor.properties != undefined
|
388
|
-
&& descriptor.properties.calculated === "true";
|
402
|
+
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;
|
389
403
|
if (local) {
|
390
404
|
localSorting.push(sort);
|
391
405
|
}
|
@@ -425,6 +439,53 @@ class DatasetStrategy {
|
|
425
439
|
return Promise.reject(error);
|
426
440
|
}
|
427
441
|
}
|
442
|
+
async loadRowMetadata(snkDataUnit, fieldName, metadataName, updatedFields = {}) {
|
443
|
+
try {
|
444
|
+
const serviceName = "DatasetSP.loadRowMetadata";
|
445
|
+
const parsedRequestBody = await this.buildRequestBodyLoadRowMetadata({ snkDataUnit, fieldName, metadataName, serviceName, updatedFields });
|
446
|
+
const response = await DataFetcher.DataFetcher.get().callServiceBroker(serviceName, parsedRequestBody);
|
447
|
+
return response;
|
448
|
+
}
|
449
|
+
catch (error) {
|
450
|
+
console.error(error);
|
451
|
+
return Promise.reject(error);
|
452
|
+
}
|
453
|
+
}
|
454
|
+
async buildRequestBodyLoadRowMetadata({ snkDataUnit, serviceName, fieldName, metadataName, updatedFields, }) {
|
455
|
+
const dataUnit = snkDataUnit.dataUnit;
|
456
|
+
const entityName = DataUnitFetcher.parseDataUnitName(dataUnit.name).entityName;
|
457
|
+
const recordIdInfo = await snkDataUnit.getSelectedRecordsIDsInfo();
|
458
|
+
const pk = recordIdInfo.reduce((accumulator, currentValue) => {
|
459
|
+
accumulator[currentValue.name] = currentValue.value;
|
460
|
+
return accumulator;
|
461
|
+
}, {});
|
462
|
+
const record = dataUnit.getSelectedRecord();
|
463
|
+
const fields = dataUnit.metadata.fields.filter(({ standAlone, name }) => !standAlone && !name.includes(".")).map(({ name }) => name);
|
464
|
+
const values = fields.reduce((accumulator, currentValue, currentIndex) => {
|
465
|
+
const recordValue = getRecordValue(record, currentValue);
|
466
|
+
const updatedFieldValue = getRecordValue(updatedFields, currentValue);
|
467
|
+
accumulator[currentIndex] = updatedFieldValue !== undefined ? updatedFieldValue : recordValue;
|
468
|
+
return accumulator;
|
469
|
+
}, {});
|
470
|
+
const requestBody = {
|
471
|
+
serviceName,
|
472
|
+
requestBody: {
|
473
|
+
dataSetID: dataUnit.dataUnitId,
|
474
|
+
entityName,
|
475
|
+
standAlone: false,
|
476
|
+
metadataName,
|
477
|
+
fieldName,
|
478
|
+
fields,
|
479
|
+
record: {
|
480
|
+
pk,
|
481
|
+
oldPk: pk,
|
482
|
+
values,
|
483
|
+
},
|
484
|
+
}
|
485
|
+
};
|
486
|
+
const parsedRequestBody = JSON.stringify(requestBody);
|
487
|
+
return parsedRequestBody;
|
488
|
+
}
|
428
489
|
getFieldsList(dataUnit) {
|
429
490
|
let fields = ["__record__id__", "__record__label__"];
|
430
491
|
dataUnit.metadata.fields.forEach((descriptor) => {
|
@@ -504,9 +565,11 @@ class DatasetStrategy {
|
|
504
565
|
}
|
505
566
|
processRecords(dataUnit, fields, responseRecords) {
|
506
567
|
return responseRecords.map((dataFrame) => {
|
568
|
+
const lastElement = dataFrame[dataFrame.length - 1];
|
507
569
|
const duRecord = {
|
508
570
|
__record__id__: dataFrame[0],
|
509
|
-
__record__label__: dataFrame[1]
|
571
|
+
__record__label__: dataFrame[1],
|
572
|
+
__record__metadata__: lastElement['_rmd'],
|
510
573
|
};
|
511
574
|
dataUnit.metadata.fields.forEach(fieldDescriptor => {
|
512
575
|
duRecord[fieldDescriptor.name] = this.buildFieldValue(fieldDescriptor, fields, dataFrame);
|
@@ -569,6 +632,9 @@ class DataUnitDataLoader {
|
|
569
632
|
});
|
570
633
|
});
|
571
634
|
}
|
635
|
+
static getCachedRecords(dataUnit) {
|
636
|
+
return PreloadManager.getCachedRecords(dataUnit);
|
637
|
+
}
|
572
638
|
static async loadFromServer(dataUnit, request, loadingInfo) {
|
573
639
|
try {
|
574
640
|
//Registramos a request com as informações de carga para determinarmos a última.
|
@@ -769,6 +835,7 @@ class DataUnitFetcher {
|
|
769
835
|
dataUnit.saveLoader = (_dataUnit, changes) => this.saveData(dataUnit, changes);
|
770
836
|
dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
|
771
837
|
dataUnit.recordLoader = (dataUnit, recordIds) => this.loadRecord(dataUnit, recordIds);
|
838
|
+
dataUnit.allRecordsLoader = (dataUnit) => DataUnitDataLoader.getCachedRecords(dataUnit);
|
772
839
|
return dataUnit;
|
773
840
|
}
|
774
841
|
loadMetadata(dataUnit) {
|
@@ -987,170 +1054,11 @@ class DataUnitFetcher {
|
|
987
1054
|
}
|
988
1055
|
}
|
989
1056
|
|
990
|
-
class PesquisaFetcher {
|
991
|
-
constructor() {
|
992
|
-
this._defaultPageSize = 100;
|
993
|
-
this._templateByQuery = new Map();
|
994
|
-
this._searchListenersByDataUnit = new Map();
|
995
|
-
this.buldTemplates();
|
996
|
-
}
|
997
|
-
buldTemplates() {
|
998
|
-
this._templateByQuery.set("search", DataFetcher.dist.gql `query($entityName: String! $argument: String $criteria: InputSearchCriteria $options: InputSearchOptions) {
|
999
|
-
$queryAlias$: search(entityName: $entityName argument: $argument criteria: $criteria options: $options){
|
1000
|
-
value
|
1001
|
-
label
|
1002
|
-
}
|
1003
|
-
}`);
|
1004
|
-
}
|
1005
|
-
loadSearchOptions(entityName, argument, criteria, options) {
|
1006
|
-
var _a;
|
1007
|
-
const cleanText = (argument === null || argument === void 0 ? void 0 : argument.toString().trim()) || undefined;
|
1008
|
-
argument = isNaN(Number(cleanText)) && cleanText ? `%${cleanText}` : cleanText;
|
1009
|
-
criteria === null || criteria === void 0 ? void 0 : criteria.params.forEach(param => {
|
1010
|
-
if (param.dataType === core.DataType.OBJECT) {
|
1011
|
-
param.value = JSON.stringify(param.value);
|
1012
|
-
}
|
1013
|
-
});
|
1014
|
-
const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, options);
|
1015
|
-
const values = {
|
1016
|
-
argument: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.argument) || argument,
|
1017
|
-
entityName,
|
1018
|
-
criteria: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.criteria) || criteria,
|
1019
|
-
options: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions) || options,
|
1020
|
-
};
|
1021
|
-
if (values.options) {
|
1022
|
-
(_a = values.options) === null || _a === void 0 ? true : delete _a.dataUnitId;
|
1023
|
-
}
|
1024
|
-
return new Promise((resolve, reject) => {
|
1025
|
-
DataFetcher.DataFetcher.get()
|
1026
|
-
.callGraphQL({
|
1027
|
-
values,
|
1028
|
-
query: this._templateByQuery.get("search"),
|
1029
|
-
})
|
1030
|
-
.then((result) => {
|
1031
|
-
resolve(result);
|
1032
|
-
})
|
1033
|
-
.catch((error) => {
|
1034
|
-
reject(error);
|
1035
|
-
});
|
1036
|
-
});
|
1037
|
-
}
|
1038
|
-
loadAdvancedSearch(entityName, argument, criteria, searchOptions) {
|
1039
|
-
var _a, _b, _c, _d;
|
1040
|
-
const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, searchOptions);
|
1041
|
-
const values = {
|
1042
|
-
argument: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.argument) || argument,
|
1043
|
-
criteria: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.criteria) || criteria,
|
1044
|
-
searchOptions: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions) || searchOptions,
|
1045
|
-
};
|
1046
|
-
const serviceName = "PesquisaSP.getSuggestion";
|
1047
|
-
const externalCriteria = {
|
1048
|
-
query: {
|
1049
|
-
$: (_a = values.criteria) === null || _a === void 0 ? void 0 : _a.expression
|
1050
|
-
}
|
1051
|
-
};
|
1052
|
-
if (((_c = (_b = values.criteria) === null || _b === void 0 ? void 0 : _b.params) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
1053
|
-
externalCriteria.params = {
|
1054
|
-
param: values.criteria.params.map(param => {
|
1055
|
-
let value = param.value;
|
1056
|
-
if (typeof value === "string") {
|
1057
|
-
const match = /CTX\{([^}]+)\}/.exec(value);
|
1058
|
-
if (match) {
|
1059
|
-
value = core.ApplicationContext.getContextValue(`__SNK__APPLICATION__FILTER__CONTEXT(${match[1]})__`);
|
1060
|
-
}
|
1061
|
-
}
|
1062
|
-
let type = param.dataType;
|
1063
|
-
if (type === core.DataType.OBJECT) {
|
1064
|
-
value = value.value;
|
1065
|
-
type = "S";
|
1066
|
-
}
|
1067
|
-
else {
|
1068
|
-
type = convertParamType(param.dataType);
|
1069
|
-
}
|
1070
|
-
return { $: value, type };
|
1071
|
-
})
|
1072
|
-
};
|
1073
|
-
}
|
1074
|
-
const options = searchOptions != undefined
|
1075
|
-
? Object.assign(Object.assign({}, searchOptions), { "pkFieldName": searchOptions.codeFieldName, "label": searchOptions.descriptionFieldName, "fieldName": searchOptions.codeFieldName, "useDescriptionOptions": false, "enableRowsCounter": true }) : undefined;
|
1076
|
-
const reqBody = {
|
1077
|
-
"serviceName": serviceName,
|
1078
|
-
"requestBody": {
|
1079
|
-
"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 }),
|
1080
|
-
"clientEventList": {
|
1081
|
-
"clientEvent": []
|
1082
|
-
}
|
1083
|
-
}
|
1084
|
-
};
|
1085
|
-
return new Promise((resolve, reject) => {
|
1086
|
-
DataFetcher.DataFetcher.get()
|
1087
|
-
.callServiceBroker("PesquisaSP.getSuggestion", JSON.stringify(reqBody))
|
1088
|
-
.then(result => resolve(result))
|
1089
|
-
.catch(error => reject(error));
|
1090
|
-
});
|
1091
|
-
}
|
1092
|
-
addSearchListener(entityName, dataUnitID, listener) {
|
1093
|
-
var _a;
|
1094
|
-
const dataUnitSearchListeners = this._searchListenersByDataUnit.get(dataUnitID) || [];
|
1095
|
-
const entityListener = dataUnitSearchListeners.find(currentListener => currentListener.entity === entityName);
|
1096
|
-
if (!entityListener) {
|
1097
|
-
this._searchListenersByDataUnit.set(dataUnitID, [...dataUnitSearchListeners, { entity: entityName, listener }]);
|
1098
|
-
}
|
1099
|
-
else {
|
1100
|
-
for (const type of Object.keys(listener)) {
|
1101
|
-
if (type in entityListener.listener) {
|
1102
|
-
const listenerFunctionIsEquals = ((_a = entityListener.listener[type]) === null || _a === void 0 ? void 0 : _a.toString()) === listener[type].toString();
|
1103
|
-
if (listenerFunctionIsEquals)
|
1104
|
-
continue;
|
1105
|
-
entityListener.listener[type] = listener[type];
|
1106
|
-
}
|
1107
|
-
}
|
1108
|
-
}
|
1109
|
-
return () => {
|
1110
|
-
const newListeners = dataUnitSearchListeners.filter(currentListener => currentListener.entity !== entityName);
|
1111
|
-
if (!newListeners.length) {
|
1112
|
-
this._searchListenersByDataUnit.delete(dataUnitID);
|
1113
|
-
return;
|
1114
|
-
}
|
1115
|
-
this._searchListenersByDataUnit.set(dataUnitID, newListeners);
|
1116
|
-
};
|
1117
|
-
}
|
1118
|
-
applySearchListener(listenerType, entityName, argument, criteria, searchOptions) {
|
1119
|
-
var _a;
|
1120
|
-
const dataUnitId = searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.dataUnitId;
|
1121
|
-
if (!dataUnitId)
|
1122
|
-
return;
|
1123
|
-
const entityListener = (_a = this._searchListenersByDataUnit.get(dataUnitId)) === null || _a === void 0 ? void 0 : _a.find(({ entity }) => entity === entityName);
|
1124
|
-
if (!entityListener)
|
1125
|
-
return;
|
1126
|
-
const { listener } = entityListener;
|
1127
|
-
if (!(listenerType in listener))
|
1128
|
-
return;
|
1129
|
-
return listener[listenerType]({ argument, criteria, searchOptions });
|
1130
|
-
}
|
1131
|
-
}
|
1132
|
-
function convertParamType(dataType) {
|
1133
|
-
//Alerta: Cuidado pra não contaminar o DataType com a implementação
|
1134
|
-
//atual da pesquisa... em geral, somente inteiros,
|
1135
|
-
//data (com ou sem hora) e string são realmente relevantes
|
1136
|
-
switch (dataType) {
|
1137
|
-
case core.DataType.NUMBER:
|
1138
|
-
return "I";
|
1139
|
-
case core.DataType.DATE:
|
1140
|
-
return "D";
|
1141
|
-
default:
|
1142
|
-
return "S";
|
1143
|
-
}
|
1144
|
-
}
|
1145
|
-
var SearchListenerType;
|
1146
|
-
(function (SearchListenerType) {
|
1147
|
-
SearchListenerType["beforeSearch"] = "beforeSearch";
|
1148
|
-
})(SearchListenerType || (SearchListenerType = {}));
|
1149
|
-
|
1150
1057
|
exports.DataUnitFetcher = DataUnitFetcher;
|
1058
|
+
exports.DatasetStrategy = DatasetStrategy;
|
1151
1059
|
exports.InMemoryLoader = InMemoryLoader;
|
1152
|
-
exports.PesquisaFetcher = PesquisaFetcher;
|
1153
1060
|
exports.PreloadManager = PreloadManager;
|
1154
1061
|
exports.applyFilter = applyFilter;
|
1155
1062
|
exports.applySorting = applySorting;
|
1156
1063
|
exports.buildPaginationInfo = buildPaginationInfo;
|
1064
|
+
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 = {}));
|