@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-57523.0 → 0.0.0-bugfix-dev-KB-47941.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-7df9d3bb.js → ConfigStorage-9a53a42c.js} +12 -11
- package/dist/cjs/{form-config-fetcher-3c4daeb5.js → DataFetcher-515bda03.js} +0 -251
- package/dist/cjs/{IExporterProvider-c307e2b1.js → IExporterProvider-d3a3ccd1.js} +55 -12
- package/dist/cjs/{SnkFormConfigManager-4259edbe.js → SnkFormConfigManager-dda10d75.js} +2 -2
- package/dist/cjs/{SnkMessageBuilder-66aa2557.js → SnkMessageBuilder-4a95fe86.js} +6 -12
- package/dist/cjs/{auth-fetcher-e6112be7.js → auth-fetcher-5acb0335.js} +1 -1
- package/dist/cjs/{pesquisa-fetcher-cbdaba63.js → dataunit-fetcher-e2109392.js} +68 -173
- package/dist/cjs/form-config-fetcher-3f430aee.js +256 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pesquisa-fetcher-916a935c.js +166 -0
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +10 -8
- package/dist/cjs/snk-application.cjs.entry.js +49 -39
- package/dist/cjs/snk-attach.cjs.entry.js +39 -32
- package/dist/cjs/snk-crud.cjs.entry.js +43 -9
- package/dist/cjs/snk-data-exporter.cjs.entry.js +11 -9
- package/dist/cjs/snk-data-unit-dee38ccd.js +614 -0
- package/dist/cjs/snk-data-unit.cjs.entry.js +10 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +8 -6
- package/dist/cjs/snk-filter-bar.cjs.entry.js +3 -2
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -2
- package/dist/cjs/snk-form-config.cjs.entry.js +2 -1
- package/dist/cjs/snk-form-view.cjs.entry.js +36 -0
- package/dist/cjs/snk-form.cjs.entry.js +28 -7
- package/dist/cjs/snk-grid.cjs.entry.js +55 -10
- package/dist/cjs/{snk-guides-viewer-b0c44e0c.js → snk-guides-viewer-af4a6ae5.js} +19 -6
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -6
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -2
- package/dist/cjs/snk-simple-crud.cjs.entry.js +96 -14
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/snk-application/snk-application.js +37 -17
- package/dist/collection/components/snk-attach/snk-attach.js +29 -21
- package/dist/collection/components/snk-crud/snk-crud.js +109 -6
- package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +79 -0
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +41 -4
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +14 -8
- package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +5 -0
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +2 -2
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +413 -165
- package/dist/collection/components/snk-data-unit/test/resources/metadataMock.js +24 -0
- package/dist/collection/components/snk-form/snk-form.js +50 -4
- package/dist/collection/components/snk-grid/snk-grid.js +96 -7
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +156 -8
- package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +35 -0
- package/dist/collection/lib/dataUnit/ValueFormatter.js +4 -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 +51 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.js +22 -0
- package/dist/collection/lib/message/SnkMessageBuilder.js +25 -32
- package/dist/collection/lib/message/resources/snk-data-unit.msg.js +1 -0
- package/dist/components/ConfigStorage.js +2 -1
- package/dist/components/DataFetcher.js +7024 -0
- package/dist/components/IExporterProvider.js +54 -12
- package/dist/components/SnkMessageBuilder.js +6 -12
- package/dist/components/dataunit-fetcher.js +58 -164
- package/dist/components/form-config-fetcher.js +3 -7023
- package/dist/components/pesquisa-fetcher.js +164 -0
- package/dist/components/snk-actions-button2.js +4 -2
- package/dist/components/snk-application2.js +26 -17
- package/dist/components/snk-attach2.js +24 -17
- package/dist/components/snk-crud.js +46 -9
- package/dist/components/snk-data-exporter2.js +6 -4
- package/dist/components/snk-data-unit2.js +356 -166
- package/dist/components/snk-detail-view2.js +21 -6
- package/dist/components/snk-form-config2.js +1 -1
- package/dist/components/snk-form-view2.js +39 -1
- package/dist/components/snk-form.js +26 -5
- package/dist/components/snk-grid2.js +58 -11
- package/dist/components/snk-simple-crud2.js +96 -10
- package/dist/esm/{ConfigStorage-928c3bf4.js → ConfigStorage-174101b9.js} +2 -1
- package/dist/esm/{form-config-fetcher-e3094014.js → DataFetcher-4b4b7beb.js} +1 -250
- package/dist/esm/{IExporterProvider-e2a1195d.js → IExporterProvider-640e1f6b.js} +54 -12
- package/dist/esm/{SnkFormConfigManager-a87ade7a.js → SnkFormConfigManager-87bd8082.js} +2 -2
- package/dist/esm/{SnkMessageBuilder-0a4becdd.js → SnkMessageBuilder-3a767111.js} +6 -12
- package/dist/esm/{auth-fetcher-e1cb288f.js → auth-fetcher-9f86c346.js} +1 -1
- package/dist/esm/{pesquisa-fetcher-6d8e50bb.js → dataunit-fetcher-87ecba4a.js} +57 -163
- package/dist/esm/form-config-fetcher-5d72aaf1.js +253 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pesquisa-fetcher-9cfab836.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 +30 -20
- package/dist/esm/snk-attach.entry.js +25 -18
- package/dist/esm/snk-crud.entry.js +43 -9
- package/dist/esm/snk-data-exporter.entry.js +8 -6
- package/dist/esm/snk-data-unit-1132e40b.js +612 -0
- package/dist/esm/snk-data-unit.entry.js +10 -2
- package/dist/esm/snk-detail-view.entry.js +8 -6
- package/dist/esm/snk-filter-bar.entry.js +3 -2
- package/dist/esm/snk-filter-modal-item.entry.js +3 -2
- package/dist/esm/snk-form-config.entry.js +2 -1
- package/dist/esm/snk-form-view.entry.js +36 -0
- package/dist/esm/snk-form.entry.js +28 -7
- package/dist/esm/snk-grid.entry.js +56 -11
- package/dist/esm/{snk-guides-viewer-1fd41a25.js → snk-guides-viewer-359e39a7.js} +19 -6
- package/dist/esm/snk-guides-viewer.entry.js +8 -6
- package/dist/esm/snk-personalized-filter.entry.js +3 -2
- package/dist/esm/snk-simple-crud.entry.js +95 -13
- package/dist/sankhyablocks/p-010d475f.js +1 -0
- package/dist/sankhyablocks/p-08fee6e8.js +60 -0
- package/dist/sankhyablocks/p-0bcc6e83.js +1 -0
- package/dist/sankhyablocks/p-2a84e45b.entry.js +1 -0
- package/dist/sankhyablocks/{p-0e8702f0.js → p-2eb90860.js} +1 -1
- package/dist/sankhyablocks/p-33f695d6.entry.js +1 -0
- package/dist/sankhyablocks/p-3519a984.entry.js +1 -0
- package/dist/sankhyablocks/p-4ce73e88.js +1 -0
- package/dist/sankhyablocks/{p-e27496ed.js → p-566f5f50.js} +6 -6
- package/dist/sankhyablocks/p-59dccb7a.entry.js +1 -0
- package/dist/sankhyablocks/p-5c8a9e27.entry.js +1 -0
- package/dist/sankhyablocks/p-66a31d30.entry.js +11 -0
- package/dist/sankhyablocks/p-6b2be902.js +6 -0
- package/dist/sankhyablocks/p-7ecaaea2.entry.js +1 -0
- package/dist/sankhyablocks/p-83950924.entry.js +1 -0
- package/dist/sankhyablocks/p-931343a1.entry.js +1 -0
- package/dist/sankhyablocks/p-9c70f37e.entry.js +1 -0
- package/dist/sankhyablocks/p-a6dfa396.js +1 -0
- package/dist/sankhyablocks/p-aa854fa8.entry.js +1 -0
- package/dist/sankhyablocks/p-b11921ca.entry.js +1 -0
- package/dist/sankhyablocks/p-cb91634d.js +1 -0
- package/dist/sankhyablocks/p-cf9d2d1e.entry.js +1 -0
- package/dist/sankhyablocks/p-d29a252c.js +1 -0
- package/dist/sankhyablocks/p-d799aa7f.entry.js +1 -0
- package/dist/sankhyablocks/p-da6e3dcf.entry.js +1 -0
- package/dist/sankhyablocks/p-e0c27486.js +26 -0
- package/dist/sankhyablocks/p-f72e8835.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +6 -2
- package/dist/types/components/snk-attach/snk-attach.d.ts +9 -9
- package/dist/types/components/snk-crud/snk-crud.d.ts +14 -1
- package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +13 -1
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +6 -0
- package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +3 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +45 -1
- package/dist/types/components/snk-data-unit/test/resources/metadataMock.d.ts +3 -0
- package/dist/types/components/snk-form/snk-form.d.ts +6 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +19 -3
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +22 -0
- package/dist/types/components.d.ts +68 -4
- package/dist/types/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.d.ts +11 -0
- package/dist/types/lib/dataUnit/ValueFormatter.d.ts +2 -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 +2 -0
- package/package.json +1 -1
- package/dist/cjs/snk-data-unit-abd2113f.js +0 -427
- package/dist/esm/snk-data-unit-29eba11a.js +0 -425
- package/dist/sankhyablocks/p-029bfc09.js +0 -1
- package/dist/sankhyablocks/p-03dcc5ff.entry.js +0 -1
- package/dist/sankhyablocks/p-07825198.js +0 -1
- package/dist/sankhyablocks/p-13ea113d.entry.js +0 -1
- package/dist/sankhyablocks/p-314e2d1a.entry.js +0 -1
- package/dist/sankhyablocks/p-32556aa6.js +0 -1
- package/dist/sankhyablocks/p-3357af48.js +0 -1
- package/dist/sankhyablocks/p-3c2a1f4d.js +0 -65
- package/dist/sankhyablocks/p-3e7167dd.js +0 -1
- package/dist/sankhyablocks/p-536eeb16.js +0 -26
- package/dist/sankhyablocks/p-587f9dcf.entry.js +0 -1
- package/dist/sankhyablocks/p-61984566.entry.js +0 -1
- package/dist/sankhyablocks/p-61b6126e.entry.js +0 -1
- package/dist/sankhyablocks/p-65b6dba3.entry.js +0 -1
- package/dist/sankhyablocks/p-6a7bc5c8.entry.js +0 -1
- package/dist/sankhyablocks/p-6c9edfd8.entry.js +0 -1
- package/dist/sankhyablocks/p-89bde7d3.entry.js +0 -1
- package/dist/sankhyablocks/p-91dceecf.entry.js +0 -1
- package/dist/sankhyablocks/p-a40cbad8.entry.js +0 -1
- package/dist/sankhyablocks/p-b86ea293.entry.js +0 -1
- package/dist/sankhyablocks/p-d8ddb2a4.entry.js +0 -11
- package/dist/sankhyablocks/p-f92f1f5f.entry.js +0 -1
- package/dist/sankhyablocks/p-fa84e72f.entry.js +0 -1
|
@@ -0,0 +1,164 @@
|
|
|
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,12 +1,14 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils, DateUtils, ArrayUtils, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
|
-
import { D as DataFetcher } from './
|
|
3
|
+
import { D as DataFetcher } from './DataFetcher.js';
|
|
4
4
|
import { P as ParamType } from './ParamType.js';
|
|
5
|
-
import './
|
|
5
|
+
import './pesquisa-fetcher.js';
|
|
6
6
|
import './ISave.js';
|
|
7
7
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
8
8
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
9
|
+
import './dataunit-fetcher.js';
|
|
9
10
|
import './filter-item-type.enum.js';
|
|
11
|
+
import './form-config-fetcher.js';
|
|
10
12
|
import { R as ResourceIDUtils } from './ResourceIDUtils.js';
|
|
11
13
|
|
|
12
14
|
const SERVICE_ACTION_EXECUTE_JAVA = 'ActionButtonsSP.executeJava';
|
|
@@ -2,9 +2,10 @@ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/i
|
|
|
2
2
|
import { DateUtils, StringUtils, ObjectUtils, WaitingChangeException, WarningException, ErrorException, KeyboardManager, OnboardingUtils, DependencyType, ArrayUtils, SearchUtils, ElementIDUtils, ApplicationContext, DataType, ErrorTracking } from '@sankhyalabs/core';
|
|
3
3
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
4
|
import { C as ConfigStorage } from './ConfigStorage.js';
|
|
5
|
-
import { d as dist, D as DataFetcher, U as UrlUtils } from './
|
|
5
|
+
import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher.js';
|
|
6
6
|
import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher.js';
|
|
7
|
-
import { D as DataUnitFetcher
|
|
7
|
+
import { D as DataUnitFetcher } from './dataunit-fetcher.js';
|
|
8
|
+
import { P as PesquisaFetcher } from './pesquisa-fetcher.js';
|
|
8
9
|
import { S as SnkMessageBuilder } from './SnkMessageBuilder.js';
|
|
9
10
|
import { d as defineCustomElement$1 } from './snk-pesquisa2.js';
|
|
10
11
|
|
|
@@ -606,7 +607,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
606
607
|
* Cria o DataUnit a partir do nome da entidade. É possível armazená-lo no cache
|
|
607
608
|
* passando o dataUnitName, assim, se mais de uma chamada for feita, o mesmo DataUnit será usado.
|
|
608
609
|
*/
|
|
609
|
-
async createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID) {
|
|
610
|
+
async createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID, options) {
|
|
610
611
|
if (resourceID == undefined) {
|
|
611
612
|
resourceID = this.applicationResourceID;
|
|
612
613
|
}
|
|
@@ -616,21 +617,29 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
616
617
|
duPromisses.push(new PendingPromise(resolve, reject));
|
|
617
618
|
if (!waitingDu) {
|
|
618
619
|
const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, resourceID, parentDataUnit, configName);
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
}
|
|
630
|
-
}
|
|
620
|
+
if (options === null || options === void 0 ? void 0 : options.skipLoadMetadata) {
|
|
621
|
+
this.processResolveDataUnit(dataUnit, dataUnitName, duPromisses);
|
|
622
|
+
}
|
|
623
|
+
else {
|
|
624
|
+
dataUnit.loadMetadata().then(() => {
|
|
625
|
+
this.processResolveDataUnit(dataUnit, dataUnitName, duPromisses);
|
|
626
|
+
}).catch(reason => {
|
|
627
|
+
while (duPromisses.length > 0) {
|
|
628
|
+
duPromisses.pop().reject(reason);
|
|
629
|
+
}
|
|
630
|
+
});
|
|
631
|
+
}
|
|
631
632
|
}
|
|
632
633
|
});
|
|
633
634
|
}
|
|
635
|
+
processResolveDataUnit(dataUnit, dataUnitName, duPromisses) {
|
|
636
|
+
if (dataUnitName) {
|
|
637
|
+
this.updateDataunitCache(undefined, dataUnitName, dataUnit);
|
|
638
|
+
}
|
|
639
|
+
while (duPromisses.length > 0) {
|
|
640
|
+
duPromisses.pop().resolve(dataUnit);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
634
643
|
/**
|
|
635
644
|
* Atualiza o cache de dataunits da aplicação.
|
|
636
645
|
* @param oldName - Nome do dataunit que está em cache.
|
|
@@ -646,14 +655,14 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
646
655
|
/**
|
|
647
656
|
* Obtem um DataUnit do cache ou cria um caso ainda não tenha sido criado.
|
|
648
657
|
*/
|
|
649
|
-
async getDataUnit(entityName, dataUnitName, parentDataUnit, configName, resourceID) {
|
|
658
|
+
async getDataUnit(entityName, dataUnitName, parentDataUnit, configName, resourceID, options) {
|
|
650
659
|
return new Promise((resolve, reject) => {
|
|
651
660
|
const dataUnit = this._duCache.get(dataUnitName);
|
|
652
661
|
if (dataUnit) {
|
|
653
662
|
resolve(dataUnit);
|
|
654
663
|
}
|
|
655
664
|
else {
|
|
656
|
-
this.createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID).then(dataUnit => {
|
|
665
|
+
this.createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID, options).then(dataUnit => {
|
|
657
666
|
resolve(dataUnit);
|
|
658
667
|
}).catch(reason => reject(reason));
|
|
659
668
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { ApplicationContext, DataType, Action, UserInterface, StringUtils, DataUnit } from '@sankhyalabs/core';
|
|
3
|
-
import { D as DataFetcher } from './
|
|
4
|
-
import
|
|
3
|
+
import { D as DataFetcher } from './DataFetcher.js';
|
|
4
|
+
import './pesquisa-fetcher.js';
|
|
5
5
|
import { S as SaveErrorsEnum } from './ISave.js';
|
|
6
|
+
import { P as PreloadManager, a as applyFilter, b as applySorting, c as buildPaginationInfo, D as DataUnitFetcher, I as InMemoryLoader } from './dataunit-fetcher.js';
|
|
6
7
|
import './filter-item-type.enum.js';
|
|
8
|
+
import './form-config-fetcher.js';
|
|
7
9
|
import { V as VIEW_MODE } from './constants.js';
|
|
8
10
|
import { A as AutorizationType } from './auth-fetcher.js';
|
|
9
11
|
import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
|
|
@@ -655,22 +657,25 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
655
657
|
this._currentDataUnit = undefined;
|
|
656
658
|
this.crudConfig = undefined;
|
|
657
659
|
}
|
|
658
|
-
|
|
660
|
+
registerKeyWatcher(newRegisterKey, oldRegisterKey) {
|
|
659
661
|
var _a, _b, _c, _d, _e, _f;
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
if (this.fetcherType === "AnexoSistema") {
|
|
663
|
-
this._currentFetcher = new AnexoSistemaFetcher(this.entityName, this.registerKey, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
|
|
664
|
-
(_b = this._currentDataUnitBuilder) === null || _b === void 0 ? void 0 : _b.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
|
|
665
|
-
await ((_c = this._currentDataUnit) === null || _c === void 0 ? void 0 : _c.loadData());
|
|
666
|
-
return;
|
|
662
|
+
if (!this._currentDataUnit) {
|
|
663
|
+
this.loadAttachmentDataUnit();
|
|
667
664
|
}
|
|
668
|
-
if (
|
|
669
|
-
|
|
670
|
-
if (
|
|
671
|
-
|
|
665
|
+
if (oldRegisterKey !== newRegisterKey) {
|
|
666
|
+
this.returnToGridMode();
|
|
667
|
+
if (this.fetcherType === "AnexoSistema") {
|
|
668
|
+
this._currentFetcher = new AnexoSistemaFetcher(this.entityName, this.registerKey, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
|
|
669
|
+
(_b = this._currentDataUnitBuilder) === null || _b === void 0 ? void 0 : _b.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
|
|
670
|
+
return (_c = this._currentDataUnit) === null || _c === void 0 ? void 0 : _c.loadData();
|
|
671
|
+
}
|
|
672
|
+
if (this.fetcherType === "Attach") {
|
|
673
|
+
const hasMoreOneItem = ((_d = this.registerKey) === null || _d === void 0 ? void 0 : _d.split("_").length) > 1;
|
|
674
|
+
if (hasMoreOneItem)
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
return (_f = (_e = this._currentDataUnit) === null || _e === void 0 ? void 0 : _e.loadMetadata()) === null || _f === void 0 ? void 0 : _f.then(this._currentDataUnit.loadData.bind(undefined, undefined, true, this.registerKey));
|
|
672
678
|
}
|
|
673
|
-
(_f = (_e = this._currentDataUnit) === null || _e === void 0 ? void 0 : _e.loadMetadata()) === null || _f === void 0 ? void 0 : _f.then(this._currentDataUnit.loadData.bind(undefined, undefined, true, this.registerKey));
|
|
674
679
|
}
|
|
675
680
|
/**
|
|
676
681
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
@@ -792,9 +797,8 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
792
797
|
}
|
|
793
798
|
});
|
|
794
799
|
}
|
|
795
|
-
|
|
800
|
+
componentWillLoad() {
|
|
796
801
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
797
|
-
await this.initAttach();
|
|
798
802
|
}
|
|
799
803
|
componentWillRender() {
|
|
800
804
|
if (!this.fetcherType) {
|
|
@@ -822,6 +826,9 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
822
826
|
return null;
|
|
823
827
|
return (h("main", { class: "snk-attach__main" }, h("header", { class: "snk-attach__header" }, h("snk-simple-bar", { onExit: this.handleBack, messagesBuilder: this.messagesBuilder }, h("div", { slot: "rightSlot" }, h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })))), h("div", { class: "snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column" }, h("div", { class: "ez-box__container" }, h("snk-simple-crud", { ref: (el) => this._crudElement = el, dataUnit: this._currentDataUnit, taskbarManager: buildTaskBarManager(), gridConfig: (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid, formConfig: (_b = this.crudConfig) === null || _b === void 0 ? void 0 : _b.form, useCancelConfirm: false, onActionClick: this.handleTaskbarClick, messagesBuilder: this.messagesBuilder, onDataStateChange: this.handleOnDataStateChange.bind(this) }, h("div", { slot: "snkSimpleCrudHeader" }, h("div", { class: "ez-flex ez-flex--column" }, h("span", { class: "ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium" }, this.getMessage("snkAttach.title")), h("span", { class: "ez-text ez-text--medium ez-text--secondary" }, this.getMessage("snkAttach.description")))))))));
|
|
824
828
|
}
|
|
829
|
+
static get watchers() { return {
|
|
830
|
+
"registerKey": ["registerKeyWatcher"]
|
|
831
|
+
}; }
|
|
825
832
|
static get style() { return snkAttachCss; }
|
|
826
833
|
}, [2, "snk-attach", {
|
|
827
834
|
"fetcherType": [1, "fetcher-type"],
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { StringUtils, ElementIDUtils, ApplicationContext, JSUtils, FloatingManager } from '@sankhyalabs/core';
|
|
3
3
|
import { T as TaskbarElement, d as defineCustomElement$3 } from './snk-taskbar2.js';
|
|
4
|
-
import './
|
|
5
|
-
import './
|
|
4
|
+
import './DataFetcher.js';
|
|
5
|
+
import './pesquisa-fetcher.js';
|
|
6
6
|
import { P as PresentationMode } from './ISave.js';
|
|
7
7
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
8
8
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
9
|
+
import './dataunit-fetcher.js';
|
|
9
10
|
import './filter-item-type.enum.js';
|
|
11
|
+
import './form-config-fetcher.js';
|
|
10
12
|
import { V as VIEW_MODE } from './constants.js';
|
|
11
13
|
import { A as AutorizationType } from './auth-fetcher.js';
|
|
12
14
|
import { d as defineCustomElement$w } from './snk-actions-button2.js';
|
|
@@ -108,6 +110,24 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
108
110
|
async getFilterBar() {
|
|
109
111
|
return await this._snkGrid.getFilterBar();
|
|
110
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Registra um formatador de valores para uma coluna da grid.
|
|
115
|
+
*/
|
|
116
|
+
async addCustomValueFormatter(columnName, customFormatter) {
|
|
117
|
+
this._snkGrid.addCustomValueFormatter(columnName, customFormatter);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Remove o formatador de valores de uma coluna da grid.
|
|
121
|
+
*/
|
|
122
|
+
async removeCustomValueFormatter(columnName) {
|
|
123
|
+
this._snkGrid.removeCustomValueFormatter(columnName);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
|
127
|
+
*/
|
|
128
|
+
async setFieldProp(fieldName, propName, value) {
|
|
129
|
+
await this._guidesViewer.setFieldProp(fieldName, propName, value);
|
|
130
|
+
}
|
|
111
131
|
currentViewModeWatcher(currentView) {
|
|
112
132
|
this._viewHistory = [...this._viewHistory.slice(-1), currentView];
|
|
113
133
|
}
|
|
@@ -183,12 +203,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
183
203
|
else {
|
|
184
204
|
this.initDataUnit();
|
|
185
205
|
}
|
|
186
|
-
this._snkDataUnit.addEventListener("dataStateChange",
|
|
187
|
-
this._dataState = dataState;
|
|
188
|
-
if (dataState.selectedRecord !== undefined) {
|
|
189
|
-
this.attachmentRegisterKey = await this.getAttachmentRegisterKey();
|
|
190
|
-
}
|
|
191
|
-
});
|
|
206
|
+
this._snkDataUnit.addEventListener("dataStateChange", this.handleDataStateChange.bind(this));
|
|
192
207
|
break;
|
|
193
208
|
}
|
|
194
209
|
parent = parent.parentElement;
|
|
@@ -204,6 +219,25 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
204
219
|
this.removeShortcuts();
|
|
205
220
|
window.removeEventListener("keydown", this._keyDownHandler);
|
|
206
221
|
}
|
|
222
|
+
async handleDataStateChange(evt) {
|
|
223
|
+
var _a;
|
|
224
|
+
this._dataState = evt.detail;
|
|
225
|
+
if (this._dataState.selectedRecord !== undefined) {
|
|
226
|
+
this.attachmentRegisterKey = await this.getAttachmentRegisterKey();
|
|
227
|
+
}
|
|
228
|
+
const fieldsWithRmPrecision = await this._snkDataUnit.getFieldsWithRmPrecision();
|
|
229
|
+
for (const field of fieldsWithRmPrecision || []) {
|
|
230
|
+
if (!field) {
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
const rmPrecision = (_a = this._dataState.rowMetadata) === null || _a === void 0 ? void 0 : _a.getProp('rm_precision', field);
|
|
234
|
+
if (!rmPrecision) {
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
await this.setFieldProp(field, 'precision', rmPrecision);
|
|
238
|
+
await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
207
241
|
async initKeyboardManager() {
|
|
208
242
|
var _a;
|
|
209
243
|
const keyboardManager = await ((_a = this._application) === null || _a === void 0 ? void 0 : _a.getKeyboardManager());
|
|
@@ -358,7 +392,10 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
358
392
|
"openConfigurator": [64],
|
|
359
393
|
"closeConfigurator": [64],
|
|
360
394
|
"reloadFilterBar": [64],
|
|
361
|
-
"getFilterBar": [64]
|
|
395
|
+
"getFilterBar": [64],
|
|
396
|
+
"addCustomValueFormatter": [64],
|
|
397
|
+
"removeCustomValueFormatter": [64],
|
|
398
|
+
"setFieldProp": [64]
|
|
362
399
|
}]);
|
|
363
400
|
function defineCustomElement$1() {
|
|
364
401
|
if (typeof customElements === "undefined") {
|
|
@@ -3,12 +3,14 @@ import { ApplicationContext, ObjectUtils, UserInterface, DataType, ElementIDUtil
|
|
|
3
3
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
4
|
import { D as DataExporterOption, a as DataExporterFormat, b as DataExporterType } from './ISave.js';
|
|
5
5
|
import { R as REPORT_LAUNCHER_RESOURCE_ID } from './constants.js';
|
|
6
|
-
import { D as DataFetcher } from './
|
|
6
|
+
import { D as DataFetcher } from './DataFetcher.js';
|
|
7
7
|
import { S as SnkDataUnit } from './snk-data-unit2.js';
|
|
8
|
-
import './
|
|
8
|
+
import './pesquisa-fetcher.js';
|
|
9
9
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
10
10
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
11
|
+
import './dataunit-fetcher.js';
|
|
11
12
|
import './filter-item-type.enum.js';
|
|
13
|
+
import './form-config-fetcher.js';
|
|
12
14
|
import { d as defineCustomElement$1 } from './snk-exporter-email-sender2.js';
|
|
13
15
|
|
|
14
16
|
class ItemBuilder {
|
|
@@ -577,8 +579,8 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
577
579
|
}
|
|
578
580
|
}
|
|
579
581
|
loadDropdown() {
|
|
580
|
-
var _a
|
|
581
|
-
this._selectedNumber = ((
|
|
582
|
+
var _a;
|
|
583
|
+
this._selectedNumber = ((_a = this.provider) === null || _a === void 0 ? void 0 : _a.getSelectedNumber()) || 0;
|
|
582
584
|
this._itemBuilder = new ItemBuilder(this.getMessage.bind(this), this._selectedNumber);
|
|
583
585
|
this.loadItems();
|
|
584
586
|
}
|