@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
package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts
CHANGED
@@ -2,10 +2,16 @@ import { DataUnit, LoadDataRequest } from '@sankhyalabs/core';
|
|
2
2
|
import { ILoadDataResult } from "../interfaces/ILoadDataResult";
|
3
3
|
import { ILoadDataStrategy } from "../interfaces/ILoadDataStrategy";
|
4
4
|
import { ILoadingInfo } from "../interfaces/ILoadingInfo";
|
5
|
+
import { SnkDataUnit } from '../../../../../../components/snk-data-unit/snk-data-unit';
|
6
|
+
import { IRowMetadata } from '../interfaces/IRowMetadata';
|
5
7
|
export declare class DatasetStrategy implements ILoadDataStrategy {
|
6
8
|
canSlice(): boolean;
|
7
9
|
private processSortingSide;
|
8
10
|
load(dataUnit: DataUnit, request: LoadDataRequest, loadingInfo: ILoadingInfo): Promise<ILoadDataResult>;
|
11
|
+
loadRowMetadata(snkDataUnit: SnkDataUnit, fieldName: string, metadataName: string, updatedFields?: {
|
12
|
+
[key: string]: any;
|
13
|
+
}): Promise<IRowMetadata>;
|
14
|
+
private buildRequestBodyLoadRowMetadata;
|
9
15
|
private getFieldsList;
|
10
16
|
private getStandAloneFieldsList;
|
11
17
|
private getFieldNames;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
declare const metadataMock: {
|
2
|
+
label: string;
|
3
|
+
name: string;
|
4
|
+
fields: ({
|
5
|
+
name: string;
|
6
|
+
label: string;
|
7
|
+
dataType: string;
|
8
|
+
properties?: undefined;
|
9
|
+
} | {
|
10
|
+
name: string;
|
11
|
+
label: string;
|
12
|
+
dataType: string;
|
13
|
+
properties: {
|
14
|
+
rmp: {
|
15
|
+
value: string;
|
16
|
+
};
|
17
|
+
};
|
18
|
+
})[];
|
19
|
+
};
|
20
|
+
export default metadataMock;
|
@@ -1,9 +1,12 @@
|
|
1
1
|
import { DataType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
|
2
2
|
import { UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
3
|
+
import { ICustomFormatter } from '@sankhyalabs/ezui/dist/types/components/ez-grid/interfaces';
|
3
4
|
export default interface IExporterColumnMetadata {
|
4
5
|
label: string;
|
5
6
|
id: string;
|
6
7
|
width: number;
|
7
8
|
type: DataType;
|
8
9
|
userInterface: UserInterface;
|
10
|
+
descriptionFrom?: string;
|
11
|
+
customFormatter?: ICustomFormatter;
|
9
12
|
}
|
@@ -14,9 +14,10 @@ interface ISelectedID {
|
|
14
14
|
type: DataType;
|
15
15
|
value: string;
|
16
16
|
}
|
17
|
+
export type IExportType = 'all' | 'page' | 'selection';
|
17
18
|
export interface IResolveExporterParams {
|
18
19
|
methodName: string;
|
19
|
-
type?:
|
20
|
+
type?: IExportType;
|
20
21
|
offset?: number;
|
21
22
|
limit?: number;
|
22
23
|
to?: string;
|
package/package.json
CHANGED
@@ -1,462 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
const index = require('./index-f9e81701.js');
|
4
|
-
const core = require('@sankhyalabs/core');
|
5
|
-
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
6
|
-
const SnkMessageBuilder = require('./SnkMessageBuilder-66aa2557.js');
|
7
|
-
|
8
|
-
const SnkDataUnit = class {
|
9
|
-
constructor(hostRef) {
|
10
|
-
index.registerInstance(this, hostRef);
|
11
|
-
this.dataStateChange = index.createEvent(this, "dataStateChange", 3);
|
12
|
-
this.dataUnitReady = index.createEvent(this, "dataUnitReady", 3);
|
13
|
-
this.messagesBuilderUpdated = index.createEvent(this, "messagesBuilderUpdated", 3);
|
14
|
-
this.insertionMode = index.createEvent(this, "insertionMode", 3);
|
15
|
-
this.cancelEdition = index.createEvent(this, "cancelEdition", 3);
|
16
|
-
this._onDataUnitResolve = [];
|
17
|
-
this._openedAlert = false;
|
18
|
-
this._dataUnitObserver = (action) => {
|
19
|
-
var _a, _b;
|
20
|
-
const duState = this.buildDataState();
|
21
|
-
this.dataState = duState;
|
22
|
-
if (action.type === core.Action.DATA_SAVED) {
|
23
|
-
if (this.ignoreSaveMessage) {
|
24
|
-
return;
|
25
|
-
}
|
26
|
-
const msg = this.getMessage("snkDataUnit.saveInfo", action.payload.records[0]);
|
27
|
-
if (msg != undefined) {
|
28
|
-
this.showSuccessMessage(msg);
|
29
|
-
}
|
30
|
-
}
|
31
|
-
if (action.type === core.Action.RECORDS_ADDED || action.type === core.Action.RECORDS_COPIED) {
|
32
|
-
this.insertionMode.emit();
|
33
|
-
}
|
34
|
-
if (action.type === core.Action.EDITION_CANCELED) {
|
35
|
-
this.cancelEdition.emit();
|
36
|
-
}
|
37
|
-
if (action.type === core.Action.RECORDS_REMOVED) {
|
38
|
-
const cachedRecords = action.payload.cachedRecords;
|
39
|
-
let removeFinishMsg;
|
40
|
-
if ((cachedRecords === null || cachedRecords === void 0 ? void 0 : cachedRecords.length) > 1) {
|
41
|
-
removeFinishMsg = this.getMessage("snkDataUnit.removeAllInfo", { size: cachedRecords.length });
|
42
|
-
}
|
43
|
-
else {
|
44
|
-
removeFinishMsg = this.getMessage("snkDataUnit.removeInfo", action.payload.cachedRecords[0]);
|
45
|
-
}
|
46
|
-
if (removeFinishMsg != undefined) {
|
47
|
-
this.showSuccessMessage(removeFinishMsg);
|
48
|
-
}
|
49
|
-
const recordsCount = (_b = (_a = this.dataUnit.records) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
50
|
-
const paginationInfo = this.dataUnit.getPaginationInfo();
|
51
|
-
if (paginationInfo) {
|
52
|
-
if (recordsCount > 0 || paginationInfo.hasMore) {
|
53
|
-
this.dataUnit.gotoPage(paginationInfo.currentPage);
|
54
|
-
}
|
55
|
-
else {
|
56
|
-
this.dataUnit.gotoPage(0);
|
57
|
-
}
|
58
|
-
}
|
59
|
-
}
|
60
|
-
this.messagesBuilder.currentOperation = this.getMessageOperation();
|
61
|
-
};
|
62
|
-
this.dataState = undefined;
|
63
|
-
this.messagesBuilder = undefined;
|
64
|
-
this.dataUnitName = undefined;
|
65
|
-
this.entityName = undefined;
|
66
|
-
this.pageSize = 150;
|
67
|
-
this.dataUnit = undefined;
|
68
|
-
this.beforeSave = undefined;
|
69
|
-
this.afterSave = undefined;
|
70
|
-
this.useCancelConfirm = true;
|
71
|
-
this.ignoreSaveMessage = undefined;
|
72
|
-
this.configName = undefined;
|
73
|
-
this.resourceID = undefined;
|
74
|
-
}
|
75
|
-
observePageSize() {
|
76
|
-
if (this.dataUnit) {
|
77
|
-
this.dataUnit.pageSize = this.pageSize;
|
78
|
-
}
|
79
|
-
}
|
80
|
-
observeDataUnitName(newValue, oldValue) {
|
81
|
-
if (oldValue != newValue) {
|
82
|
-
if (this.dataUnit) {
|
83
|
-
this._application.updateDataunitCache(oldValue, this.dataUnitName, this.dataUnit);
|
84
|
-
}
|
85
|
-
else {
|
86
|
-
this.loadDataUnit();
|
87
|
-
}
|
88
|
-
}
|
89
|
-
}
|
90
|
-
observeEntityName(newValue, oldValue) {
|
91
|
-
if (oldValue != newValue) {
|
92
|
-
this.dataUnit = undefined;
|
93
|
-
this.entityName = newValue;
|
94
|
-
this.loadDataUnit();
|
95
|
-
}
|
96
|
-
}
|
97
|
-
observeDataState(newValue, oldValue) {
|
98
|
-
if (core.ObjectUtils.objectToString(oldValue) != core.ObjectUtils.objectToString(newValue)) {
|
99
|
-
this.dataStateChange.emit(newValue);
|
100
|
-
}
|
101
|
-
}
|
102
|
-
observeDataUnit() {
|
103
|
-
this.handlerLinkFields();
|
104
|
-
this.dataUnitReady.emit(this.dataUnit);
|
105
|
-
}
|
106
|
-
observeMessagesBuilder(newValue) {
|
107
|
-
if (newValue) {
|
108
|
-
this.messagesBuilderUpdated.emit(newValue);
|
109
|
-
}
|
110
|
-
}
|
111
|
-
/**
|
112
|
-
* Obtém o dataUnit.
|
113
|
-
*/
|
114
|
-
async getDataUnit() {
|
115
|
-
return new Promise((resolve) => {
|
116
|
-
if (this.dataUnit) {
|
117
|
-
resolve(this.dataUnit);
|
118
|
-
}
|
119
|
-
else {
|
120
|
-
this._onDataUnitResolve.push(resolve);
|
121
|
-
}
|
122
|
-
});
|
123
|
-
}
|
124
|
-
/**
|
125
|
-
* Método que retorna a lista de IDs dos registros selecionados.
|
126
|
-
* @returns Retorna a lista de IDs dos registros selecionados.
|
127
|
-
*/
|
128
|
-
async getSelectedRecordsIDsInfo() {
|
129
|
-
var _a;
|
130
|
-
const selectionInfo = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSelectionInfo();
|
131
|
-
if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
|
132
|
-
return [];
|
133
|
-
}
|
134
|
-
const selectedRecordsIDsInfo = [];
|
135
|
-
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.records;
|
136
|
-
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
137
|
-
selectedRecords.forEach(({ __record__id__ }) => {
|
138
|
-
if (!this.dataUnit.isNewRecord(__record__id__)) {
|
139
|
-
/*
|
140
|
-
Esse if foi necessário para tratar corretamente o ID
|
141
|
-
do record quando está sendo utilizado no modo standAlone
|
142
|
-
isso não faz a exportação da grid funcionar no modo standAlone
|
143
|
-
mas deixa de causar erro nas oprações de CRUD.
|
144
|
-
*/
|
145
|
-
if (!core.JSUtils.isBase64(__record__id__)) {
|
146
|
-
selectedRecordsIDsInfo.push({
|
147
|
-
name: "__record__id__",
|
148
|
-
type: core.DataType.TEXT,
|
149
|
-
value: __record__id__
|
150
|
-
});
|
151
|
-
return;
|
152
|
-
}
|
153
|
-
const revertBase64ToObject = JSON.parse(window.atob(__record__id__));
|
154
|
-
Object.entries(revertBase64ToObject).forEach(([name, value]) => {
|
155
|
-
var _a;
|
156
|
-
const metadataField = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
|
157
|
-
if (metadataField == undefined) {
|
158
|
-
return;
|
159
|
-
}
|
160
|
-
selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
|
161
|
-
});
|
162
|
-
}
|
163
|
-
});
|
164
|
-
}
|
165
|
-
return selectedRecordsIDsInfo;
|
166
|
-
}
|
167
|
-
getCleanOnCopyFields() {
|
168
|
-
var _a;
|
169
|
-
return (_a = this.dataUnit.metadata) === null || _a === void 0 ? void 0 : _a.fields.filter(field => { var _a; return (_a = field.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy; }).map(field => field.name);
|
170
|
-
}
|
171
|
-
async interceptAction(action) {
|
172
|
-
return new Promise(resolve => {
|
173
|
-
var _a, _b, _c, _d, _e;
|
174
|
-
switch (action.type) {
|
175
|
-
case core.Action.RECORDS_ADDED:
|
176
|
-
if (this.isAllowed("INSERT")) {
|
177
|
-
resolve(action);
|
178
|
-
}
|
179
|
-
else {
|
180
|
-
utils.ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenInsert"));
|
181
|
-
}
|
182
|
-
break;
|
183
|
-
case core.Action.RECORDS_COPIED:
|
184
|
-
if (this.isAllowed("CLONE")) {
|
185
|
-
const cleanFields = this.getCleanOnCopyFields();
|
186
|
-
if (cleanFields.length > 0) {
|
187
|
-
const records = action.payload;
|
188
|
-
action = new core.DataUnitAction(core.Action.RECORDS_COPIED, records.map(record => {
|
189
|
-
const newRecord = Object.assign({}, record);
|
190
|
-
cleanFields.forEach(fieldName => delete newRecord[fieldName]);
|
191
|
-
return newRecord;
|
192
|
-
}));
|
193
|
-
}
|
194
|
-
resolve(action);
|
195
|
-
}
|
196
|
-
else {
|
197
|
-
utils.ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenClone"));
|
198
|
-
}
|
199
|
-
break;
|
200
|
-
case core.Action.DATA_CHANGED:
|
201
|
-
case core.Action.CHANGING_DATA:
|
202
|
-
if (this.isAllowed("UPDATE"))
|
203
|
-
return resolve(action);
|
204
|
-
if (this._openedAlert)
|
205
|
-
return this.dataUnit.cancelEdition();
|
206
|
-
this._openedAlert = true;
|
207
|
-
this.dataUnit.cancelEdition();
|
208
|
-
utils.ApplicationUtils.alert(this.getMessage("snkDataUnit.forbidden"), this.getMessage("snkDataUnit.forbiddenUpdate")).then(() => {
|
209
|
-
this._openedAlert = false;
|
210
|
-
});
|
211
|
-
break;
|
212
|
-
case core.Action.SAVING_DATA:
|
213
|
-
if (this.beforeSave) {
|
214
|
-
const continueAction = this.beforeSave(this.dataUnit);
|
215
|
-
if (continueAction instanceof Promise) {
|
216
|
-
continueAction.then(result => resolve(result ? action : undefined));
|
217
|
-
}
|
218
|
-
else {
|
219
|
-
resolve(continueAction ? action : undefined);
|
220
|
-
}
|
221
|
-
}
|
222
|
-
else {
|
223
|
-
resolve(action);
|
224
|
-
}
|
225
|
-
break;
|
226
|
-
case core.Action.DATA_SAVED:
|
227
|
-
if (this.afterSave) {
|
228
|
-
this.afterSave(this.dataUnit);
|
229
|
-
}
|
230
|
-
else {
|
231
|
-
resolve(action);
|
232
|
-
}
|
233
|
-
break;
|
234
|
-
case core.Action.EDITION_CANCELED:
|
235
|
-
if (!this.useCancelConfirm)
|
236
|
-
return resolve(action);
|
237
|
-
if (this.dataState.hasDirtyRecords) {
|
238
|
-
const cancelConfirmation = this.getMessage("snkDataUnit.cancelConfirmation");
|
239
|
-
if (((_a = action.payload) === null || _a === void 0 ? void 0 : _a.fromParent) || ((_b = action.payload) === null || _b === void 0 ? void 0 : _b.silent)) {
|
240
|
-
resolve(action);
|
241
|
-
return;
|
242
|
-
}
|
243
|
-
if (cancelConfirmation == undefined) {
|
244
|
-
this.showSuccessMessage(this.getMessage("snkDataUnit.cancelInfo"));
|
245
|
-
resolve(action);
|
246
|
-
}
|
247
|
-
else {
|
248
|
-
const cancelConfirmationTitle = this.getMessage("snkDataUnit.cancelConfirmationTitle");
|
249
|
-
utils.ApplicationUtils.confirm(cancelConfirmationTitle, cancelConfirmation)
|
250
|
-
.then((result) => {
|
251
|
-
result && this.showSuccessMessage(this.getMessage("snkDataUnit.cancelInfo"));
|
252
|
-
resolve(result ? action : undefined);
|
253
|
-
});
|
254
|
-
}
|
255
|
-
}
|
256
|
-
else {
|
257
|
-
resolve(action);
|
258
|
-
}
|
259
|
-
break;
|
260
|
-
case core.Action.REMOVING_RECORDS:
|
261
|
-
if (this.isAllowed("REMOVE")) {
|
262
|
-
let multipleSelection = false;
|
263
|
-
let removeConfirmation = !((_c = action.payload) === null || _c === void 0 ? void 0 : _c.silent) && this.getMessage("snkDataUnit.removeConfirmation");
|
264
|
-
const selection = (_d = this.dataUnit) === null || _d === void 0 ? void 0 : _d.getSelectionInfo();
|
265
|
-
if (!((_e = action.payload) === null || _e === void 0 ? void 0 : _e.silent) && (selection === null || selection === void 0 ? void 0 : selection.length) > 1) {
|
266
|
-
removeConfirmation = this.getMessage("snkDataUnit.removeAllConfirmation", { size: selection.length });
|
267
|
-
multipleSelection = true;
|
268
|
-
}
|
269
|
-
if (!removeConfirmation) {
|
270
|
-
resolve(action);
|
271
|
-
}
|
272
|
-
else {
|
273
|
-
const options = {
|
274
|
-
canClose: false,
|
275
|
-
labelCancel: this.getMessage(`snkDataUnit.confirm.${multipleSelection ? "no" : "cancel"}`),
|
276
|
-
labelConfirm: this.getMessage(`snkDataUnit.confirm.${multipleSelection ? "yes" : "delete"}`),
|
277
|
-
btnConfirmDanger: false
|
278
|
-
};
|
279
|
-
const removeConfirmationTitle = this.getMessage("snkDataUnit.removeConfirmationTitle");
|
280
|
-
utils.ApplicationUtils.confirm(removeConfirmationTitle, removeConfirmation, null, utils.DialogType.WARN, options)
|
281
|
-
.then((result) => resolve(result ? action : undefined));
|
282
|
-
}
|
283
|
-
}
|
284
|
-
else {
|
285
|
-
utils.ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenRemove"));
|
286
|
-
}
|
287
|
-
break;
|
288
|
-
default:
|
289
|
-
resolve(action);
|
290
|
-
}
|
291
|
-
});
|
292
|
-
}
|
293
|
-
showSuccessMessage(message) {
|
294
|
-
utils.ApplicationUtils.info(message, { iconName: "check" });
|
295
|
-
}
|
296
|
-
isAllowed(flag) {
|
297
|
-
return this._permissions ? this._permissions.isSup || this._permissions[flag] : false;
|
298
|
-
}
|
299
|
-
buildDataState() {
|
300
|
-
const selectionInfo = this.dataUnit.getSelectionInfo();
|
301
|
-
const isStartingInsertionMode = (this.dataUnit.hasDirtyRecords() || this.dataUnit.hasWaitingChanges()) && (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isEmpty());
|
302
|
-
return new DataStateImpl({
|
303
|
-
insertionMode: this.dataUnit.hasNewRecord(),
|
304
|
-
isStartingInsertionMode,
|
305
|
-
hasNext: this.dataUnit.hasNext(),
|
306
|
-
hasPrevious: this.dataUnit.hasPrevious(),
|
307
|
-
copyMode: this.dataUnit.hasCopiedRecord(),
|
308
|
-
isDirty: this.dataUnit.isDirty(),
|
309
|
-
hasDirtyRecords: this.dataUnit.hasDirtyRecords(),
|
310
|
-
selectedRecords: undefined,
|
311
|
-
selectionInfo,
|
312
|
-
selectedRecord: this.dataUnit.getSelectedRecord(),
|
313
|
-
recordsIsEmpty: this.dataUnit.records.length === 0
|
314
|
-
});
|
315
|
-
}
|
316
|
-
/**
|
317
|
-
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
318
|
-
* através de um pequeno modulo na estrutura da aplicação:
|
319
|
-
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
320
|
-
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-data-unit.msg.ts"
|
321
|
-
*/
|
322
|
-
getMessage(key, params = undefined) {
|
323
|
-
if (!params) {
|
324
|
-
params = this.getMessageParams();
|
325
|
-
}
|
326
|
-
return this.messagesBuilder.getMessage(key, params);
|
327
|
-
}
|
328
|
-
getMessageParams() {
|
329
|
-
//FIXME: Devido ao recurso de multiseleção do dataunit, precisaremos criar um mecanismo para
|
330
|
-
//oferecer todos os registros selecionados para a mensagem, pois mensagens podem ficar incorretas.
|
331
|
-
return this.dataState.selectedRecord;
|
332
|
-
}
|
333
|
-
getMessageOperation() {
|
334
|
-
if (this.dataState.copyMode) {
|
335
|
-
return SnkMessageBuilder.OperationMap.CLONE;
|
336
|
-
}
|
337
|
-
if (this.dataState.insertionMode || this.dataState.isStartingInsertionMode) {
|
338
|
-
return SnkMessageBuilder.OperationMap.INSERT;
|
339
|
-
}
|
340
|
-
if (this.dataState.isDirty) {
|
341
|
-
return SnkMessageBuilder.OperationMap.UPDATE;
|
342
|
-
}
|
343
|
-
return SnkMessageBuilder.OperationMap.CLEAN;
|
344
|
-
}
|
345
|
-
async getDataUnitParentOrChild() {
|
346
|
-
var _a;
|
347
|
-
const cacheName = this.dataUnitName ? this.dataUnitName : this.entityName;
|
348
|
-
if (this._parentSnkDataUnit) {
|
349
|
-
this._parentDataUnit = await ((_a = this._parentSnkDataUnit) === null || _a === void 0 ? void 0 : _a.getDataUnit());
|
350
|
-
return await this._application.getDataUnit(this.entityName, cacheName, this._parentDataUnit, this.configName, this.resourceID);
|
351
|
-
}
|
352
|
-
else {
|
353
|
-
return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName, this.resourceID);
|
354
|
-
}
|
355
|
-
}
|
356
|
-
async loadDataUnit() {
|
357
|
-
if (this.dataUnit == null && this._application && this.entityName) {
|
358
|
-
this.dataUnit = await this.getDataUnitParentOrChild();
|
359
|
-
}
|
360
|
-
if (this.dataUnit) {
|
361
|
-
this.dataUnit.pageSize = this.pageSize;
|
362
|
-
this.dataUnit.unsubscribe(this._dataUnitObserver);
|
363
|
-
this.dataUnit.addInterceptor(this);
|
364
|
-
this.dataUnit.subscribe(this._dataUnitObserver);
|
365
|
-
this.dataState = this.buildDataState();
|
366
|
-
let resolver;
|
367
|
-
while (resolver = this._onDataUnitResolve.pop()) {
|
368
|
-
resolver(this.dataUnit);
|
369
|
-
}
|
370
|
-
}
|
371
|
-
}
|
372
|
-
getParentSnkDataUnit() {
|
373
|
-
let currentElement = this.element;
|
374
|
-
while (currentElement.parentNode) {
|
375
|
-
if (currentElement.parentNode.nodeName === 'SNK-DATA-UNIT') {
|
376
|
-
return currentElement.parentNode;
|
377
|
-
}
|
378
|
-
currentElement = currentElement.parentNode;
|
379
|
-
}
|
380
|
-
return;
|
381
|
-
}
|
382
|
-
handlerLinkFields() {
|
383
|
-
var _a, _b;
|
384
|
-
const metadata = Object.assign({}, this.dataUnit.metadata);
|
385
|
-
if (!this._parentDataUnit)
|
386
|
-
return;
|
387
|
-
const child = this._parentDataUnit.getChildInfo(this.entityName);
|
388
|
-
if (!child)
|
389
|
-
return;
|
390
|
-
const fieldsLink = (_a = child === null || child === void 0 ? void 0 : child.links) === null || _a === void 0 ? void 0 : _a.map(link => link.target);
|
391
|
-
(_b = metadata === null || metadata === void 0 ? void 0 : metadata.fields) === null || _b === void 0 ? void 0 : _b.forEach(field => {
|
392
|
-
if (fieldsLink === null || fieldsLink === void 0 ? void 0 : fieldsLink.includes(field.name)) {
|
393
|
-
field.visible = false;
|
394
|
-
}
|
395
|
-
});
|
396
|
-
this.dataUnit.metadata = metadata;
|
397
|
-
}
|
398
|
-
static getNearestInstance(element) {
|
399
|
-
let parent = element.parentElement;
|
400
|
-
while (parent) {
|
401
|
-
if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
|
402
|
-
return parent;
|
403
|
-
}
|
404
|
-
parent = parent.parentElement;
|
405
|
-
}
|
406
|
-
}
|
407
|
-
//---------------------------------------------
|
408
|
-
// Lifecycle web component
|
409
|
-
//---------------------------------------------
|
410
|
-
componentWillLoad() {
|
411
|
-
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
412
|
-
this._application.getAllAccess(this.resourceID).then(access => this._permissions = access);
|
413
|
-
this._parentSnkDataUnit = this.getParentSnkDataUnit();
|
414
|
-
if (this.messagesBuilder == undefined) {
|
415
|
-
this.messagesBuilder = new SnkMessageBuilder.SnkMessageBuilder(this.entityName);
|
416
|
-
}
|
417
|
-
}
|
418
|
-
disconnectedCallback() {
|
419
|
-
if (this.dataUnit) {
|
420
|
-
this.dataUnit.releaseCallbacks();
|
421
|
-
}
|
422
|
-
}
|
423
|
-
componentDidLoad() {
|
424
|
-
this.loadDataUnit();
|
425
|
-
}
|
426
|
-
render() {
|
427
|
-
return (index.h(index.Host, null));
|
428
|
-
}
|
429
|
-
get element() { return index.getElement(this); }
|
430
|
-
static get watchers() { return {
|
431
|
-
"pageSize": ["observePageSize"],
|
432
|
-
"dataUnitName": ["observeDataUnitName"],
|
433
|
-
"entityName": ["observeEntityName"],
|
434
|
-
"dataState": ["observeDataState"],
|
435
|
-
"dataUnit": ["observeDataUnit"],
|
436
|
-
"messagesBuilder": ["observeMessagesBuilder"]
|
437
|
-
}; }
|
438
|
-
};
|
439
|
-
class DataStateImpl {
|
440
|
-
constructor(datastate) {
|
441
|
-
this.copyMode = datastate.copyMode;
|
442
|
-
this.insertionMode = datastate.insertionMode;
|
443
|
-
this.isStartingInsertionMode = datastate.isStartingInsertionMode;
|
444
|
-
this.isDirty = datastate.isDirty;
|
445
|
-
this.hasDirtyRecords = datastate.hasDirtyRecords;
|
446
|
-
this.hasNext = datastate.hasNext;
|
447
|
-
this.hasPrevious = datastate.hasPrevious;
|
448
|
-
this.selectionInfo = datastate.selectionInfo;
|
449
|
-
this.selectedRecord = datastate.selectedRecord;
|
450
|
-
this.recordsIsEmpty = datastate.recordsIsEmpty;
|
451
|
-
}
|
452
|
-
get selectedRecords() {
|
453
|
-
var _a;
|
454
|
-
console.warn("SnkDataUnit: O método `selectedRecords` foi descontinuado. Use o método `selectionInfo`.");
|
455
|
-
if ((_a = this.selectionInfo) === null || _a === void 0 ? void 0 : _a.isAllRecords()) {
|
456
|
-
throw new Error("Erro interno: Impossível obter os registros selecionados. A seleção atual é virtual. Use o atributo `selectionInfo`.");
|
457
|
-
}
|
458
|
-
return this.selectionInfo.records;
|
459
|
-
}
|
460
|
-
}
|
461
|
-
|
462
|
-
exports.SnkDataUnit = SnkDataUnit;
|
@@ -1,34 +0,0 @@
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
2
|
-
var t = {};
|
3
|
-
for (var p in s)
|
4
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
5
|
-
t[p] = s[p];
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
9
|
-
t[p[i]] = s[p[i]];
|
10
|
-
}
|
11
|
-
return t;
|
12
|
-
};
|
13
|
-
import { ApplicationContext, ObjectUtils } from "@sankhyalabs/core";
|
14
|
-
import { DataFetcher } from '../../DataFetcher';
|
15
|
-
export default function fetchDataExporter(_a) {
|
16
|
-
var { methodName } = _a, requestBody = __rest(_a, ["methodName"]);
|
17
|
-
const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
18
|
-
const serviceName = `${application.getModuleName()}@DataExporterSPBean.${methodName}`;
|
19
|
-
const payload = { serviceName, requestBody };
|
20
|
-
return new Promise((resolve, reject) => {
|
21
|
-
DataFetcher.get()
|
22
|
-
.callServiceBroker(serviceName, ObjectUtils.objectToString(payload))
|
23
|
-
.then(result => resolve(getFormatResponse(result)))
|
24
|
-
.catch(error => reject(error));
|
25
|
-
});
|
26
|
-
}
|
27
|
-
function getFormatResponse(result) {
|
28
|
-
var _a;
|
29
|
-
const response = (_a = result === null || result === void 0 ? void 0 : result.json) === null || _a === void 0 ? void 0 : _a.$;
|
30
|
-
if (response == undefined) {
|
31
|
-
return;
|
32
|
-
}
|
33
|
-
return ObjectUtils.stringToObject(response);
|
34
|
-
}
|