@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-65214.0 → 0.0.0-bugfix-dev-kb-67792.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{ConfigStorage-e49214c6.js → ConfigStorage-0a690675.js} +0 -1
- package/dist/cjs/{SnkFormConfigManager-beebf47a.js → SnkFormConfigManager-d6d5db6d.js} +7 -8
- package/dist/cjs/{SnkMessageBuilder-cceebbae.js → SnkMessageBuilder-96b0f549.js} +13 -9
- package/dist/cjs/{IExporterProvider-10b7fed5.js → SnkMultiSelectionListDataSource-f79d220c.js} +4 -94
- package/dist/cjs/{index-1dfc7a6e.js → index-0922807b.js} +0 -5
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{dataunit-fetcher-d4873076.js → pesquisa-fetcher-cba1b3d0.js} +180 -87
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +3 -5
- package/dist/cjs/snk-application.cjs.entry.js +12 -35
- package/dist/cjs/snk-attach.cjs.entry.js +46 -71
- package/dist/cjs/snk-crud.cjs.entry.js +10 -101
- package/dist/cjs/snk-data-exporter.cjs.entry.js +85 -315
- package/dist/cjs/snk-data-unit-559ac55c.js +462 -0
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -12
- package/dist/cjs/snk-detail-view.cjs.entry.js +10 -50
- package/dist/cjs/snk-filter-bar.cjs.entry.js +12 -7
- 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 +0 -67
- package/dist/cjs/snk-form.cjs.entry.js +7 -52
- package/dist/cjs/snk-grid.cjs.entry.js +110 -167
- package/dist/cjs/{snk-guides-viewer-aafc3073.js → snk-guides-viewer-bfcad2d6.js} +10 -43
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -9
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +40 -268
- package/dist/cjs/snk-taskbar.cjs.entry.js +3 -4
- package/dist/cjs/{taskbar-elements-9ad1f9c0.js → taskbar-elements-3ecd1278.js} +3 -3
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/snk-application/snk-application.js +11 -35
- package/dist/collection/components/snk-attach/snk-attach.js +44 -67
- package/dist/collection/components/snk-crud/snk-crud.js +7 -305
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +2 -136
- package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +0 -161
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +7 -134
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +1 -54
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +52 -59
- package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +0 -62
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +219 -540
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +11 -23
- package/dist/collection/components/snk-form/snk-form.js +5 -102
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +6 -7
- package/dist/collection/components/snk-form-config/snk-form-config.js +1 -1
- package/dist/collection/components/snk-grid/snk-grid.css +0 -2
- package/dist/collection/components/snk-grid/snk-grid.js +102 -241
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +20 -406
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +2 -2
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +1 -2
- package/dist/collection/lib/@types/index.js +0 -5
- package/dist/collection/lib/configs/ConfigStorage.js +0 -1
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +3 -7
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +0 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.js +0 -4
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +13 -11
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +0 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +4 -53
- package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/index.js +34 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +4 -4
- package/dist/collection/lib/message/SnkMessageBuilder.js +12 -5
- package/dist/collection/lib/message/resources/snk-data-exporter.msg.js +0 -2
- package/dist/collection/lib/message/resources/snk-data-unit.msg.js +1 -2
- package/dist/components/ConfigStorage.js +0 -1
- package/dist/components/SnkFormConfigManager.js +6 -7
- package/dist/components/SnkMessageBuilder.js +13 -9
- package/dist/components/dataunit-fetcher.js +182 -84
- package/dist/components/{IExporterProvider.js → field-search.js} +6 -93
- package/dist/components/index2.js +33 -198
- package/dist/components/index3.js +199 -0
- package/dist/components/snk-actions-button2.js +11 -4
- package/dist/components/snk-application2.js +9 -31
- package/dist/components/snk-attach2.js +41 -65
- package/dist/components/snk-crud.js +11 -110
- package/dist/components/snk-data-exporter2.js +85 -309
- package/dist/components/snk-data-unit2.js +217 -487
- package/dist/components/snk-detail-view2.js +14 -96
- package/dist/components/snk-expression-item2.js +1 -1
- package/dist/components/snk-filter-bar2.js +11 -7
- package/dist/components/snk-form-config2.js +1 -1
- package/dist/components/snk-form-view2.js +1 -72
- package/dist/components/snk-form.js +6 -53
- package/dist/components/snk-grid2.js +108 -170
- package/dist/components/snk-personalized-filter2.js +1 -1
- package/dist/components/snk-simple-crud2.js +25 -263
- package/dist/components/snk-taskbar2.js +5 -6
- package/dist/esm/{ConfigStorage-e476378d.js → ConfigStorage-8c2ddac8.js} +0 -1
- package/dist/esm/{SnkFormConfigManager-298cd647.js → SnkFormConfigManager-c01b9d9d.js} +7 -8
- package/dist/esm/{SnkMessageBuilder-ae87b754.js → SnkMessageBuilder-72423074.js} +13 -9
- package/dist/esm/{IExporterProvider-d597f27d.js → SnkMultiSelectionListDataSource-a4805051.js} +5 -93
- package/dist/esm/{index-3aa4977a.js → index-0ece87a6.js} +1 -6
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{dataunit-fetcher-3d2ec959.js → pesquisa-fetcher-34a8b8be.js} +181 -83
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +3 -5
- package/dist/esm/snk-application.entry.js +11 -34
- package/dist/esm/snk-attach.entry.js +41 -66
- package/dist/esm/snk-crud.entry.js +10 -101
- package/dist/esm/snk-data-exporter.entry.js +86 -316
- package/dist/esm/snk-data-unit-44215df7.js +460 -0
- package/dist/esm/snk-data-unit.entry.js +2 -12
- package/dist/esm/snk-detail-view.entry.js +10 -50
- package/dist/esm/snk-filter-bar.entry.js +12 -7
- 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 +0 -67
- package/dist/esm/snk-form.entry.js +7 -52
- package/dist/esm/snk-grid.entry.js +108 -165
- package/dist/esm/{snk-guides-viewer-62124f3d.js → snk-guides-viewer-edeac29f.js} +10 -43
- package/dist/esm/snk-guides-viewer.entry.js +7 -9
- package/dist/esm/snk-personalized-filter.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +28 -256
- package/dist/esm/snk-taskbar.entry.js +3 -4
- package/dist/esm/{taskbar-elements-d59867f1.js → taskbar-elements-2473c8ac.js} +3 -3
- package/dist/sankhyablocks/p-03dcc5ff.entry.js +1 -0
- package/dist/sankhyablocks/p-176c3491.entry.js +1 -0
- package/dist/sankhyablocks/p-37e5d563.js +65 -0
- package/dist/sankhyablocks/p-38289a55.js +1 -0
- package/dist/sankhyablocks/{p-9dfda04a.entry.js → p-41c2c191.entry.js} +1 -1
- package/dist/sankhyablocks/p-46e55a95.entry.js +1 -0
- package/dist/sankhyablocks/p-4e728357.entry.js +1 -0
- package/dist/sankhyablocks/p-5571bdfe.js +1 -0
- package/dist/sankhyablocks/p-5630574e.js +1 -0
- package/dist/sankhyablocks/p-5f8c0426.entry.js +1 -0
- package/dist/sankhyablocks/p-80c64add.entry.js +1 -0
- package/dist/sankhyablocks/p-86af4cc2.js +1 -0
- package/dist/sankhyablocks/p-8b690717.js +1 -0
- package/dist/sankhyablocks/{p-3287a6cc.js → p-96621231.js} +1 -1
- package/dist/sankhyablocks/p-a1832166.entry.js +1 -0
- package/dist/sankhyablocks/p-a809d944.entry.js +1 -0
- package/dist/sankhyablocks/p-a97226f6.entry.js +1 -0
- package/dist/sankhyablocks/p-add17f6a.entry.js +1 -0
- package/dist/sankhyablocks/{p-7e7a7473.js → p-ae4fc9a9.js} +1 -1
- package/dist/sankhyablocks/{p-bd008859.entry.js → p-c2ae0fab.entry.js} +1 -1
- package/dist/sankhyablocks/p-c5a9a5d9.entry.js +1 -0
- package/dist/sankhyablocks/p-c5aa7d70.entry.js +11 -0
- package/dist/sankhyablocks/p-cb0147ab.entry.js +1 -0
- package/dist/sankhyablocks/p-f0145e3b.js +1 -0
- package/dist/sankhyablocks/p-f03e4199.entry.js +1 -0
- package/dist/sankhyablocks/p-f607db63.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +3 -7
- package/dist/types/components/snk-attach/snk-attach.d.ts +9 -11
- package/dist/types/components/snk-crud/snk-crud.d.ts +1 -45
- package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +0 -23
- package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +3 -28
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +0 -24
- package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +4 -24
- package/dist/types/components/snk-data-exporter/snk-data-exporter.d.ts +1 -4
- package/dist/types/components/snk-data-exporter/structure/ItemBuilder.d.ts +0 -21
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +3 -67
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +1 -4
- package/dist/types/components/snk-form/snk-form.d.ts +0 -14
- package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +2 -2
- package/dist/types/components/snk-grid/snk-grid.d.ts +6 -46
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +4 -62
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +1 -1
- package/dist/types/components.d.ts +4 -261
- package/dist/types/lib/@types/index.d.ts +0 -5
- package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +1 -2
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.d.ts +1 -2
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.d.ts +0 -1
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +0 -1
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +0 -6
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/index.d.ts +3 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.d.ts +0 -3
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.d.ts +1 -2
- package/dist/types/lib/http/data-fetcher/fetchers/pesquisa-fetcher.d.ts +0 -1
- package/package.json +1 -1
- package/dist/cjs/RecordIDUtils-3735135c.js +0 -43
- package/dist/cjs/pesquisa-fetcher-a1d0353f.js +0 -166
- package/dist/cjs/snk-data-unit-f0221097.js +0 -690
- package/dist/collection/components/snk-crud/interfaces/PropsCustomEditor.js +0 -1
- package/dist/collection/components/snk-crud/interfaces/PropsCustomRender.js +0 -1
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +0 -97
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +0 -74
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterStrategy.js +0 -1
- package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +0 -58
- package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +0 -55
- package/dist/collection/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.js +0 -88
- package/dist/collection/components/snk-data-exporter/utils/ParserExport.js +0 -20
- package/dist/collection/components/snk-data-exporter/utils/RecordIDUtils.js +0 -38
- package/dist/collection/components/snk-data-unit/test/resources/metadataMock.js +0 -24
- package/dist/collection/components/snk-data-unit/test/resources/parentMetadataMock.js +0 -18
- package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +0 -35
- package/dist/collection/lib/dataUnit/ValueFormatter.js +0 -4
- package/dist/collection/lib/dataUnit/interfaces/InMemoryLoaderConfig.js +0 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.js +0 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.js +0 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.js +0 -22
- package/dist/components/ISave.js +0 -47
- package/dist/components/pesquisa-fetcher.js +0 -164
- package/dist/esm/RecordIDUtils-87d02110.js +0 -41
- package/dist/esm/pesquisa-fetcher-a87445a0.js +0 -164
- package/dist/esm/snk-data-unit-1ef94aef.js +0 -688
- package/dist/sankhyablocks/p-091ce761.js +0 -60
- package/dist/sankhyablocks/p-0c68f40f.entry.js +0 -1
- package/dist/sankhyablocks/p-162b9a59.entry.js +0 -11
- package/dist/sankhyablocks/p-1db45d26.entry.js +0 -1
- package/dist/sankhyablocks/p-25f1fc39.js +0 -6
- package/dist/sankhyablocks/p-2e9c764c.entry.js +0 -1
- package/dist/sankhyablocks/p-30cf616e.js +0 -1
- package/dist/sankhyablocks/p-421bec84.entry.js +0 -1
- package/dist/sankhyablocks/p-42f7b05d.entry.js +0 -1
- package/dist/sankhyablocks/p-51999ab5.entry.js +0 -1
- package/dist/sankhyablocks/p-52a6a293.entry.js +0 -1
- package/dist/sankhyablocks/p-5f016aed.js +0 -1
- package/dist/sankhyablocks/p-62f34e6f.entry.js +0 -1
- package/dist/sankhyablocks/p-684a2590.entry.js +0 -1
- package/dist/sankhyablocks/p-70001ac1.js +0 -1
- package/dist/sankhyablocks/p-74c665d5.entry.js +0 -1
- package/dist/sankhyablocks/p-76a65660.js +0 -1
- package/dist/sankhyablocks/p-7c4aabe2.js +0 -1
- package/dist/sankhyablocks/p-8c1ff936.entry.js +0 -1
- package/dist/sankhyablocks/p-939e15d3.entry.js +0 -1
- package/dist/sankhyablocks/p-9863d682.js +0 -1
- package/dist/sankhyablocks/p-c273d6ee.js +0 -1
- package/dist/sankhyablocks/p-d65d98ed.entry.js +0 -1
- package/dist/sankhyablocks/p-f2809746.entry.js +0 -1
- package/dist/types/components/snk-crud/interfaces/PropsCustomEditor.d.ts +0 -4
- package/dist/types/components/snk-crud/interfaces/PropsCustomRender.d.ts +0 -4
- package/dist/types/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.d.ts +0 -14
- package/dist/types/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.d.ts +0 -12
- package/dist/types/components/snk-data-exporter/interfaces/IExporterStrategy.d.ts +0 -5
- package/dist/types/components/snk-data-exporter/providers/ClientSideExporterProvider.d.ts +0 -17
- package/dist/types/components/snk-data-exporter/providers/ServerSideExporterProvider.d.ts +0 -17
- package/dist/types/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.d.ts +0 -77
- package/dist/types/components/snk-data-exporter/utils/ParserExport.d.ts +0 -4
- package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +0 -3
- package/dist/types/components/snk-data-unit/test/resources/metadataMock.d.ts +0 -3
- package/dist/types/components/snk-data-unit/test/resources/parentMetadataMock.d.ts +0 -3
- package/dist/types/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.d.ts +0 -11
- package/dist/types/lib/dataUnit/ValueFormatter.d.ts +0 -2
- package/dist/types/lib/dataUnit/interfaces/InMemoryLoaderConfig.d.ts +0 -3
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.d.ts +0 -10
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.d.ts +0 -7
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.d.ts +0 -20
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { DataType, ApplicationContext } from '@sankhyalabs/core';
|
|
2
|
-
import { d as dist, D as DataFetcher } from './DataFetcher.js';
|
|
3
|
-
|
|
4
|
-
class PesquisaFetcher {
|
|
5
|
-
constructor() {
|
|
6
|
-
this._defaultPageSize = 100;
|
|
7
|
-
this._templateByQuery = new Map();
|
|
8
|
-
this._searchListenersByDataUnit = new Map();
|
|
9
|
-
this.buldTemplates();
|
|
10
|
-
}
|
|
11
|
-
buldTemplates() {
|
|
12
|
-
this._templateByQuery.set("search", dist.gql `query($entityName: String! $argument: String $criteria: InputSearchCriteria $options: InputSearchOptions) {
|
|
13
|
-
$queryAlias$: search(entityName: $entityName argument: $argument criteria: $criteria options: $options){
|
|
14
|
-
value
|
|
15
|
-
label
|
|
16
|
-
}
|
|
17
|
-
}`);
|
|
18
|
-
}
|
|
19
|
-
loadSearchOptions(entityName, argument, criteria, options) {
|
|
20
|
-
var _a;
|
|
21
|
-
const cleanText = (argument === null || argument === void 0 ? void 0 : argument.toString().trim()) || undefined;
|
|
22
|
-
argument = isNaN(Number(cleanText)) && cleanText ? `%${cleanText}` : cleanText;
|
|
23
|
-
criteria === null || criteria === void 0 ? void 0 : criteria.params.forEach(param => {
|
|
24
|
-
if (param.dataType === DataType.OBJECT) {
|
|
25
|
-
param.value = JSON.stringify(param.value);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, options);
|
|
29
|
-
const values = {
|
|
30
|
-
argument: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.argument) || argument,
|
|
31
|
-
entityName,
|
|
32
|
-
criteria: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.criteria) || criteria,
|
|
33
|
-
options: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions) || options,
|
|
34
|
-
};
|
|
35
|
-
if (values.options) {
|
|
36
|
-
(_a = values.options) === null || _a === void 0 ? true : delete _a.dataUnitId;
|
|
37
|
-
}
|
|
38
|
-
return new Promise((resolve, reject) => {
|
|
39
|
-
DataFetcher.get()
|
|
40
|
-
.callGraphQL({
|
|
41
|
-
values,
|
|
42
|
-
query: this._templateByQuery.get("search"),
|
|
43
|
-
})
|
|
44
|
-
.then((result) => {
|
|
45
|
-
resolve(result);
|
|
46
|
-
})
|
|
47
|
-
.catch((error) => {
|
|
48
|
-
reject(error);
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
loadAdvancedSearch(entityName, argument, criteria, searchOptions) {
|
|
53
|
-
var _a, _b, _c, _d, _e;
|
|
54
|
-
const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, searchOptions);
|
|
55
|
-
const values = {
|
|
56
|
-
argument: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.argument) || argument,
|
|
57
|
-
criteria: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.criteria) || criteria,
|
|
58
|
-
searchOptions: Object.assign(Object.assign({}, searchOptions), listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions),
|
|
59
|
-
};
|
|
60
|
-
const serviceName = "PesquisaSP.getSuggestion";
|
|
61
|
-
const externalCriteria = {
|
|
62
|
-
query: {
|
|
63
|
-
$: (_a = values.criteria) === null || _a === void 0 ? void 0 : _a.expression
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
if (((_c = (_b = values.criteria) === null || _b === void 0 ? void 0 : _b.params) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
67
|
-
externalCriteria.params = {
|
|
68
|
-
param: values.criteria.params.map(param => {
|
|
69
|
-
let value = param.value;
|
|
70
|
-
if (typeof value === "string") {
|
|
71
|
-
const match = /CTX\{([^}]+)\}/.exec(value);
|
|
72
|
-
if (match) {
|
|
73
|
-
value = ApplicationContext.getContextValue(`__SNK__APPLICATION__FILTER__CONTEXT(${match[1]})__`);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
let type = param.dataType;
|
|
77
|
-
if (type === DataType.OBJECT) {
|
|
78
|
-
value = value.value;
|
|
79
|
-
type = "S";
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
type = convertParamType(param.dataType);
|
|
83
|
-
}
|
|
84
|
-
return { $: value, type };
|
|
85
|
-
})
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
const options = searchOptions != undefined
|
|
89
|
-
? Object.assign(Object.assign({}, values === null || values === void 0 ? void 0 : values.searchOptions), { "pkFieldName": searchOptions.codeFieldName, "label": searchOptions.descriptionFieldName, "fieldName": searchOptions.codeFieldName, "useDescriptionOptions": false, "enableRowsCounter": true }) : undefined;
|
|
90
|
-
const reqBody = {
|
|
91
|
-
"serviceName": serviceName,
|
|
92
|
-
"requestBody": {
|
|
93
|
-
"criteria": Object.assign({ "entityName": entityName, "compacted": false, "ignoreEntityCriteria": (_d = options === null || options === void 0 ? void 0 : options.ignoreEntityCriteria) !== null && _d !== void 0 ? _d : false, "limit": this._defaultPageSize, "query": { "$": values.argument }, "orderByDesc": false, "externalCriteria": externalCriteria, "localEntityName": (_e = values.searchOptions) === null || _e === void 0 ? void 0 : _e.rootEntity }, { options }),
|
|
94
|
-
"clientEventList": {
|
|
95
|
-
"clientEvent": []
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
return new Promise((resolve, reject) => {
|
|
100
|
-
DataFetcher.get()
|
|
101
|
-
.callServiceBroker("PesquisaSP.getSuggestion", JSON.stringify(reqBody))
|
|
102
|
-
.then(result => resolve(result))
|
|
103
|
-
.catch(error => reject(error));
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
addSearchListener(entityName, dataUnitID, listener) {
|
|
107
|
-
var _a;
|
|
108
|
-
const dataUnitSearchListeners = this._searchListenersByDataUnit.get(dataUnitID) || [];
|
|
109
|
-
const entityListener = dataUnitSearchListeners.find(currentListener => currentListener.entity === entityName);
|
|
110
|
-
if (!entityListener) {
|
|
111
|
-
this._searchListenersByDataUnit.set(dataUnitID, [...dataUnitSearchListeners, { entity: entityName, listener }]);
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
for (const type of Object.keys(listener)) {
|
|
115
|
-
if (type in entityListener.listener) {
|
|
116
|
-
const listenerFunctionIsEquals = ((_a = entityListener.listener[type]) === null || _a === void 0 ? void 0 : _a.toString()) === listener[type].toString();
|
|
117
|
-
if (listenerFunctionIsEquals)
|
|
118
|
-
continue;
|
|
119
|
-
entityListener.listener[type] = listener[type];
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return () => {
|
|
124
|
-
const newListeners = dataUnitSearchListeners.filter(currentListener => currentListener.entity !== entityName);
|
|
125
|
-
if (!newListeners.length) {
|
|
126
|
-
this._searchListenersByDataUnit.delete(dataUnitID);
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
this._searchListenersByDataUnit.set(dataUnitID, newListeners);
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
applySearchListener(listenerType, entityName, argument, criteria, searchOptions) {
|
|
133
|
-
var _a;
|
|
134
|
-
const dataUnitId = searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.dataUnitId;
|
|
135
|
-
if (!dataUnitId)
|
|
136
|
-
return;
|
|
137
|
-
const entityListener = (_a = this._searchListenersByDataUnit.get(dataUnitId)) === null || _a === void 0 ? void 0 : _a.find(({ entity }) => entity === entityName);
|
|
138
|
-
if (!entityListener)
|
|
139
|
-
return;
|
|
140
|
-
const { listener } = entityListener;
|
|
141
|
-
if (!(listenerType in listener))
|
|
142
|
-
return;
|
|
143
|
-
return listener[listenerType]({ argument, criteria, searchOptions });
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
function convertParamType(dataType) {
|
|
147
|
-
//Alerta: Cuidado pra não contaminar o DataType com a implementação
|
|
148
|
-
//atual da pesquisa... em geral, somente inteiros,
|
|
149
|
-
//data (com ou sem hora) e string são realmente relevantes
|
|
150
|
-
switch (dataType) {
|
|
151
|
-
case DataType.NUMBER:
|
|
152
|
-
return "I";
|
|
153
|
-
case DataType.DATE:
|
|
154
|
-
return "D";
|
|
155
|
-
default:
|
|
156
|
-
return "S";
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
var SearchListenerType;
|
|
160
|
-
(function (SearchListenerType) {
|
|
161
|
-
SearchListenerType["beforeSearch"] = "beforeSearch";
|
|
162
|
-
})(SearchListenerType || (SearchListenerType = {}));
|
|
163
|
-
|
|
164
|
-
export { PesquisaFetcher as P };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { JSUtils, DataType } from '@sankhyalabs/core';
|
|
2
|
-
|
|
3
|
-
const getSelectedIDs = (dataUnit) => {
|
|
4
|
-
const selectionInfo = dataUnit.getSelectionInfo();
|
|
5
|
-
if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
|
|
6
|
-
return [];
|
|
7
|
-
}
|
|
8
|
-
const selectedRecordsIDsInfo = [];
|
|
9
|
-
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.recordIds;
|
|
10
|
-
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
|
11
|
-
selectedRecords.forEach(recordId => {
|
|
12
|
-
if (!dataUnit.isNewRecord(recordId)) {
|
|
13
|
-
/*
|
|
14
|
-
Esse if foi necessário para tratar corretamente o ID
|
|
15
|
-
do record quando está sendo utilizado no modo standAlone
|
|
16
|
-
isso não faz a exportação da grid funcionar no modo standAlone
|
|
17
|
-
mas deixa de causar erro nas oprações de CRUD.
|
|
18
|
-
*/
|
|
19
|
-
if (!JSUtils.isBase64(recordId)) {
|
|
20
|
-
selectedRecordsIDsInfo.push({
|
|
21
|
-
name: "__record__id__",
|
|
22
|
-
type: DataType.TEXT,
|
|
23
|
-
value: recordId
|
|
24
|
-
});
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
const revertBase64ToObject = JSON.parse(window.atob(recordId));
|
|
28
|
-
Object.entries(revertBase64ToObject).forEach(([name, value]) => {
|
|
29
|
-
const metadataField = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(name);
|
|
30
|
-
if (metadataField == undefined) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
return selectedRecordsIDsInfo;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export { getSelectedIDs as g };
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { DataType, ApplicationContext } from '@sankhyalabs/core';
|
|
2
|
-
import { d as dist, D as DataFetcher } from './DataFetcher-773a3e4b.js';
|
|
3
|
-
|
|
4
|
-
class PesquisaFetcher {
|
|
5
|
-
constructor() {
|
|
6
|
-
this._defaultPageSize = 100;
|
|
7
|
-
this._templateByQuery = new Map();
|
|
8
|
-
this._searchListenersByDataUnit = new Map();
|
|
9
|
-
this.buldTemplates();
|
|
10
|
-
}
|
|
11
|
-
buldTemplates() {
|
|
12
|
-
this._templateByQuery.set("search", dist.gql `query($entityName: String! $argument: String $criteria: InputSearchCriteria $options: InputSearchOptions) {
|
|
13
|
-
$queryAlias$: search(entityName: $entityName argument: $argument criteria: $criteria options: $options){
|
|
14
|
-
value
|
|
15
|
-
label
|
|
16
|
-
}
|
|
17
|
-
}`);
|
|
18
|
-
}
|
|
19
|
-
loadSearchOptions(entityName, argument, criteria, options) {
|
|
20
|
-
var _a;
|
|
21
|
-
const cleanText = (argument === null || argument === void 0 ? void 0 : argument.toString().trim()) || undefined;
|
|
22
|
-
argument = isNaN(Number(cleanText)) && cleanText ? `%${cleanText}` : cleanText;
|
|
23
|
-
criteria === null || criteria === void 0 ? void 0 : criteria.params.forEach(param => {
|
|
24
|
-
if (param.dataType === DataType.OBJECT) {
|
|
25
|
-
param.value = JSON.stringify(param.value);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, options);
|
|
29
|
-
const values = {
|
|
30
|
-
argument: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.argument) || argument,
|
|
31
|
-
entityName,
|
|
32
|
-
criteria: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.criteria) || criteria,
|
|
33
|
-
options: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions) || options,
|
|
34
|
-
};
|
|
35
|
-
if (values.options) {
|
|
36
|
-
(_a = values.options) === null || _a === void 0 ? true : delete _a.dataUnitId;
|
|
37
|
-
}
|
|
38
|
-
return new Promise((resolve, reject) => {
|
|
39
|
-
DataFetcher.get()
|
|
40
|
-
.callGraphQL({
|
|
41
|
-
values,
|
|
42
|
-
query: this._templateByQuery.get("search"),
|
|
43
|
-
})
|
|
44
|
-
.then((result) => {
|
|
45
|
-
resolve(result);
|
|
46
|
-
})
|
|
47
|
-
.catch((error) => {
|
|
48
|
-
reject(error);
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
loadAdvancedSearch(entityName, argument, criteria, searchOptions) {
|
|
53
|
-
var _a, _b, _c, _d, _e;
|
|
54
|
-
const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, searchOptions);
|
|
55
|
-
const values = {
|
|
56
|
-
argument: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.argument) || argument,
|
|
57
|
-
criteria: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.criteria) || criteria,
|
|
58
|
-
searchOptions: Object.assign(Object.assign({}, searchOptions), listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions),
|
|
59
|
-
};
|
|
60
|
-
const serviceName = "PesquisaSP.getSuggestion";
|
|
61
|
-
const externalCriteria = {
|
|
62
|
-
query: {
|
|
63
|
-
$: (_a = values.criteria) === null || _a === void 0 ? void 0 : _a.expression
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
if (((_c = (_b = values.criteria) === null || _b === void 0 ? void 0 : _b.params) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
67
|
-
externalCriteria.params = {
|
|
68
|
-
param: values.criteria.params.map(param => {
|
|
69
|
-
let value = param.value;
|
|
70
|
-
if (typeof value === "string") {
|
|
71
|
-
const match = /CTX\{([^}]+)\}/.exec(value);
|
|
72
|
-
if (match) {
|
|
73
|
-
value = ApplicationContext.getContextValue(`__SNK__APPLICATION__FILTER__CONTEXT(${match[1]})__`);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
let type = param.dataType;
|
|
77
|
-
if (type === DataType.OBJECT) {
|
|
78
|
-
value = value.value;
|
|
79
|
-
type = "S";
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
type = convertParamType(param.dataType);
|
|
83
|
-
}
|
|
84
|
-
return { $: value, type };
|
|
85
|
-
})
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
const options = searchOptions != undefined
|
|
89
|
-
? Object.assign(Object.assign({}, values === null || values === void 0 ? void 0 : values.searchOptions), { "pkFieldName": searchOptions.codeFieldName, "label": searchOptions.descriptionFieldName, "fieldName": searchOptions.codeFieldName, "useDescriptionOptions": false, "enableRowsCounter": true }) : undefined;
|
|
90
|
-
const reqBody = {
|
|
91
|
-
"serviceName": serviceName,
|
|
92
|
-
"requestBody": {
|
|
93
|
-
"criteria": Object.assign({ "entityName": entityName, "compacted": false, "ignoreEntityCriteria": (_d = options === null || options === void 0 ? void 0 : options.ignoreEntityCriteria) !== null && _d !== void 0 ? _d : false, "limit": this._defaultPageSize, "query": { "$": values.argument }, "orderByDesc": false, "externalCriteria": externalCriteria, "localEntityName": (_e = values.searchOptions) === null || _e === void 0 ? void 0 : _e.rootEntity }, { options }),
|
|
94
|
-
"clientEventList": {
|
|
95
|
-
"clientEvent": []
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
return new Promise((resolve, reject) => {
|
|
100
|
-
DataFetcher.get()
|
|
101
|
-
.callServiceBroker("PesquisaSP.getSuggestion", JSON.stringify(reqBody))
|
|
102
|
-
.then(result => resolve(result))
|
|
103
|
-
.catch(error => reject(error));
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
addSearchListener(entityName, dataUnitID, listener) {
|
|
107
|
-
var _a;
|
|
108
|
-
const dataUnitSearchListeners = this._searchListenersByDataUnit.get(dataUnitID) || [];
|
|
109
|
-
const entityListener = dataUnitSearchListeners.find(currentListener => currentListener.entity === entityName);
|
|
110
|
-
if (!entityListener) {
|
|
111
|
-
this._searchListenersByDataUnit.set(dataUnitID, [...dataUnitSearchListeners, { entity: entityName, listener }]);
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
for (const type of Object.keys(listener)) {
|
|
115
|
-
if (type in entityListener.listener) {
|
|
116
|
-
const listenerFunctionIsEquals = ((_a = entityListener.listener[type]) === null || _a === void 0 ? void 0 : _a.toString()) === listener[type].toString();
|
|
117
|
-
if (listenerFunctionIsEquals)
|
|
118
|
-
continue;
|
|
119
|
-
entityListener.listener[type] = listener[type];
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return () => {
|
|
124
|
-
const newListeners = dataUnitSearchListeners.filter(currentListener => currentListener.entity !== entityName);
|
|
125
|
-
if (!newListeners.length) {
|
|
126
|
-
this._searchListenersByDataUnit.delete(dataUnitID);
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
this._searchListenersByDataUnit.set(dataUnitID, newListeners);
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
applySearchListener(listenerType, entityName, argument, criteria, searchOptions) {
|
|
133
|
-
var _a;
|
|
134
|
-
const dataUnitId = searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.dataUnitId;
|
|
135
|
-
if (!dataUnitId)
|
|
136
|
-
return;
|
|
137
|
-
const entityListener = (_a = this._searchListenersByDataUnit.get(dataUnitId)) === null || _a === void 0 ? void 0 : _a.find(({ entity }) => entity === entityName);
|
|
138
|
-
if (!entityListener)
|
|
139
|
-
return;
|
|
140
|
-
const { listener } = entityListener;
|
|
141
|
-
if (!(listenerType in listener))
|
|
142
|
-
return;
|
|
143
|
-
return listener[listenerType]({ argument, criteria, searchOptions });
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
function convertParamType(dataType) {
|
|
147
|
-
//Alerta: Cuidado pra não contaminar o DataType com a implementação
|
|
148
|
-
//atual da pesquisa... em geral, somente inteiros,
|
|
149
|
-
//data (com ou sem hora) e string são realmente relevantes
|
|
150
|
-
switch (dataType) {
|
|
151
|
-
case DataType.NUMBER:
|
|
152
|
-
return "I";
|
|
153
|
-
case DataType.DATE:
|
|
154
|
-
return "D";
|
|
155
|
-
default:
|
|
156
|
-
return "S";
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
var SearchListenerType;
|
|
160
|
-
(function (SearchListenerType) {
|
|
161
|
-
SearchListenerType["beforeSearch"] = "beforeSearch";
|
|
162
|
-
})(SearchListenerType || (SearchListenerType = {}));
|
|
163
|
-
|
|
164
|
-
export { PesquisaFetcher as P };
|