@sankhyalabs/sankhyablocks 8.15.0-dev.60 → 8.15.0-dev.62
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-1ed8e92a.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-cb768be1.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 +19 -17
- package/dist/cjs/snk-crud.cjs.entry.js +43 -9
- package/dist/cjs/snk-data-exporter.cjs.entry.js +9 -7
- 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-bec9c1a5.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-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-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/http/data-fetcher/fetchers/pesquisa-fetcher.js +2 -2
- 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 +4 -2
- package/dist/components/snk-crud.js +46 -9
- package/dist/components/snk-data-exporter2.js +4 -2
- 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-ceabfb7e.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-72125b13.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 +5 -3
- package/dist/esm/snk-crud.entry.js +43 -9
- package/dist/esm/snk-data-exporter.entry.js +6 -4
- 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-303aafb4.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-873d2e6a.entry.js +1 -0
- package/dist/sankhyablocks/p-931343a1.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-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/dist/types/lib/http/data-fetcher/fetchers/pesquisa-fetcher.d.ts +1 -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-1fa244c0.entry.js +0 -1
- package/dist/sankhyablocks/p-2d972c2e.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-3494a28e.entry.js +0 -1
- package/dist/sankhyablocks/p-35bd4df7.entry.js +0 -1
- package/dist/sankhyablocks/p-536eeb16.js +0 -26
- package/dist/sankhyablocks/p-563701f3.js +0 -1
- package/dist/sankhyablocks/p-61984566.entry.js +0 -1
- package/dist/sankhyablocks/p-64977b22.entry.js +0 -1
- package/dist/sankhyablocks/p-65b6dba3.entry.js +0 -1
- package/dist/sankhyablocks/p-6bc64fb0.entry.js +0 -1
- package/dist/sankhyablocks/p-aedf37fb.js +0 -65
- package/dist/sankhyablocks/p-b233f5aa.entry.js +0 -1
- package/dist/sankhyablocks/p-b86ea293.entry.js +0 -1
- package/dist/sankhyablocks/p-c73482cf.js +0 -1
- package/dist/sankhyablocks/p-cb3c7b4a.entry.js +0 -11
- package/dist/sankhyablocks/p-d911a023.entry.js +0 -1
- package/dist/sankhyablocks/p-fa84e72f.entry.js +0 -1
@@ -7021,253 +7021,4 @@ class WaitingRequest {
|
|
7021
7021
|
}
|
7022
7022
|
}
|
7023
7023
|
|
7024
|
-
|
7025
|
-
constructor() {
|
7026
|
-
this.templateByQuery = new Map();
|
7027
|
-
this.buldTemplates();
|
7028
|
-
}
|
7029
|
-
buldTemplates() {
|
7030
|
-
this.templateByQuery.set("fetchResource", dist.gql `query($name: String!) {
|
7031
|
-
$queryAlias$: fetchResource(name: $name){
|
7032
|
-
resource
|
7033
|
-
}
|
7034
|
-
}`);
|
7035
|
-
this.templateByQuery.set("saveResource", dist.gql `mutation($resource: InputResource!) {
|
7036
|
-
$queryAlias$: saveResource(resource: $resource){
|
7037
|
-
name
|
7038
|
-
resource
|
7039
|
-
}
|
7040
|
-
}`);
|
7041
|
-
}
|
7042
|
-
loadResource(name) {
|
7043
|
-
if (ResourceFetcher._loadingResource.has(name)) {
|
7044
|
-
return ResourceFetcher._loadingResource.get(name);
|
7045
|
-
}
|
7046
|
-
const promiseLoadResource = new Promise((resolve, reject) => {
|
7047
|
-
DataFetcher.get()
|
7048
|
-
.callGraphQL({
|
7049
|
-
values: { name },
|
7050
|
-
query: this.templateByQuery.get("fetchResource"),
|
7051
|
-
})
|
7052
|
-
.then((result) => {
|
7053
|
-
resolve(result === null || result === void 0 ? void 0 : result.resource);
|
7054
|
-
ResourceFetcher._loadingResource.delete(name);
|
7055
|
-
})
|
7056
|
-
.catch((error) => {
|
7057
|
-
reject(error);
|
7058
|
-
ResourceFetcher._loadingResource.delete(name);
|
7059
|
-
});
|
7060
|
-
});
|
7061
|
-
ResourceFetcher._loadingResource.set(name, promiseLoadResource);
|
7062
|
-
return promiseLoadResource;
|
7063
|
-
}
|
7064
|
-
saveResource(resource, name) {
|
7065
|
-
return new Promise((resolve, reject) => {
|
7066
|
-
DataFetcher.get()
|
7067
|
-
.callGraphQL({
|
7068
|
-
values: {
|
7069
|
-
resource: {
|
7070
|
-
name: name,
|
7071
|
-
resource: JSON.stringify(resource)
|
7072
|
-
}
|
7073
|
-
},
|
7074
|
-
query: this.templateByQuery.get("saveResource")
|
7075
|
-
})
|
7076
|
-
.then((resp) => {
|
7077
|
-
resolve(resp);
|
7078
|
-
})
|
7079
|
-
.catch((error) => {
|
7080
|
-
reject(error);
|
7081
|
-
});
|
7082
|
-
});
|
7083
|
-
}
|
7084
|
-
}
|
7085
|
-
ResourceFetcher._loadingResource = new Map();
|
7086
|
-
|
7087
|
-
class FormConfigFetcher extends ResourceFetcher {
|
7088
|
-
constructor() {
|
7089
|
-
super();
|
7090
|
-
this.queryConfig = new Map();
|
7091
|
-
this.buildTemplatesConfig();
|
7092
|
-
}
|
7093
|
-
buildTemplatesConfig() {
|
7094
|
-
this.queryConfig.set("fetchUserAvailableConfigs", dist.gql `query($name: String!) {
|
7095
|
-
$queryAlias$: fetchUserAvailableConfigs(name: $name){
|
7096
|
-
name
|
7097
|
-
origin
|
7098
|
-
key
|
7099
|
-
}
|
7100
|
-
}`);
|
7101
|
-
this.queryConfig.set("fetchLegacyConfig", dist.gql `query($name: String!) {
|
7102
|
-
$queryAlias$: fetchLegacyConfig(name: $name){
|
7103
|
-
name
|
7104
|
-
resource
|
7105
|
-
}
|
7106
|
-
}`);
|
7107
|
-
this.queryConfig.set("fetchDefaultConfig", dist.gql `query($name: String!) {
|
7108
|
-
$queryAlias$: fetchDefaultConfig(name: $name){
|
7109
|
-
name
|
7110
|
-
resource
|
7111
|
-
}
|
7112
|
-
}`);
|
7113
|
-
}
|
7114
|
-
loadFormConfig(formName, resourceID) {
|
7115
|
-
return new Promise((accept, reject) => {
|
7116
|
-
Promise.all([
|
7117
|
-
this.loadResource(this.getPath(resourceID, formName)),
|
7118
|
-
this.loadResource(this.getPath(`FormCardState:${resourceID}`, formName, "form-card")),
|
7119
|
-
this.loadResource(this.getPath(resourceID, formName, "summary")),
|
7120
|
-
this.loadResource(this.getPath(resourceID, formName, "defaultValues"))
|
7121
|
-
])
|
7122
|
-
.then(([configAsString, formCardState, summary, defaultValues]) => {
|
7123
|
-
let config;
|
7124
|
-
if (configAsString != undefined) {
|
7125
|
-
config = Object.assign(Object.assign({}, JSON.parse(configAsString)), { emptyConfig: false });
|
7126
|
-
const { tabs, fields } = config;
|
7127
|
-
if (tabs) {
|
7128
|
-
const allTabs = new Map(tabs.map(t => [t.label, t]));
|
7129
|
-
fields === null || fields === void 0 ? void 0 : fields.forEach(f => { var _a; return f.tab = ((_a = allTabs.get(this.getTabName(f.tab))) === null || _a === void 0 ? void 0 : _a.label) || allTabs.get(this.getTabName(f.tab)); });
|
7130
|
-
}
|
7131
|
-
config.fields = fields === null || fields === void 0 ? void 0 : fields.map((field) => {
|
7132
|
-
if ("readonly" in field) {
|
7133
|
-
const readOnly = field['readonly'] === true;
|
7134
|
-
delete field['readonly'];
|
7135
|
-
field.readOnly = readOnly;
|
7136
|
-
}
|
7137
|
-
return field;
|
7138
|
-
});
|
7139
|
-
}
|
7140
|
-
if (formCardState != undefined) {
|
7141
|
-
if (config == undefined) {
|
7142
|
-
config = { emptyConfig: true, fields: [] };
|
7143
|
-
}
|
7144
|
-
config.cardsState = new Map(JSON.parse(formCardState));
|
7145
|
-
}
|
7146
|
-
if (summary != undefined) {
|
7147
|
-
if (config == undefined) {
|
7148
|
-
config = { emptyConfig: true, fields: [] };
|
7149
|
-
}
|
7150
|
-
config.summary = new Map(Object.entries(JSON.parse(summary)));
|
7151
|
-
}
|
7152
|
-
if (defaultValues != undefined) {
|
7153
|
-
if (config == undefined) {
|
7154
|
-
config = { emptyConfig: true, fields: [] };
|
7155
|
-
}
|
7156
|
-
config.defaultVars = new Map(Object.entries(JSON.parse(defaultValues)));
|
7157
|
-
}
|
7158
|
-
accept(config);
|
7159
|
-
})
|
7160
|
-
.catch((error) => {
|
7161
|
-
reject(error);
|
7162
|
-
});
|
7163
|
-
});
|
7164
|
-
}
|
7165
|
-
getTabName(tab) {
|
7166
|
-
if (typeof tab === 'object') { // ITabConfig type
|
7167
|
-
return tab.label;
|
7168
|
-
}
|
7169
|
-
return tab; //string type
|
7170
|
-
}
|
7171
|
-
saveCardState(cardsState, formName, resourceID) {
|
7172
|
-
const completePath = this.getPath(`FormCardState:${resourceID}`, formName, "form-card");
|
7173
|
-
return new Promise((resolve, reject) => {
|
7174
|
-
this.saveResource(Array.from(cardsState.entries()), completePath)
|
7175
|
-
.then((resp) => {
|
7176
|
-
resolve(new Map(JSON.parse(resp.resource)));
|
7177
|
-
})
|
7178
|
-
.catch((error) => {
|
7179
|
-
reject(error);
|
7180
|
-
});
|
7181
|
-
});
|
7182
|
-
}
|
7183
|
-
saveConfig(config, formName, resourceID) {
|
7184
|
-
//Essas informações não devem ser salvas na configuração
|
7185
|
-
delete config.cardsState;
|
7186
|
-
delete config.defaultVars;
|
7187
|
-
delete config.summary;
|
7188
|
-
const completePath = this.getPath(resourceID, formName);
|
7189
|
-
return new Promise((resolve, reject) => {
|
7190
|
-
this.saveResource(config, completePath)
|
7191
|
-
.then((resp) => {
|
7192
|
-
resolve(JSON.parse(resp.resource));
|
7193
|
-
})
|
7194
|
-
.catch((error) => {
|
7195
|
-
reject(error);
|
7196
|
-
});
|
7197
|
-
});
|
7198
|
-
}
|
7199
|
-
fetchUserAvailableConfigs(formName, resourceID) {
|
7200
|
-
const name = this.getPath(resourceID, formName);
|
7201
|
-
return new Promise((resolve, reject) => {
|
7202
|
-
DataFetcher.get()
|
7203
|
-
.callGraphQL({
|
7204
|
-
values: { name },
|
7205
|
-
query: this.queryConfig.get("fetchUserAvailableConfigs"),
|
7206
|
-
})
|
7207
|
-
.then((result) => {
|
7208
|
-
resolve(result);
|
7209
|
-
})
|
7210
|
-
.catch((error) => {
|
7211
|
-
reject(error);
|
7212
|
-
});
|
7213
|
-
});
|
7214
|
-
}
|
7215
|
-
fetchLegacyConfig(formName, resourceID) {
|
7216
|
-
const name = this.getPath(resourceID, formName);
|
7217
|
-
return new Promise((resolve, reject) => {
|
7218
|
-
DataFetcher.get()
|
7219
|
-
.callGraphQL({
|
7220
|
-
values: { name },
|
7221
|
-
query: this.queryConfig.get("fetchLegacyConfig"),
|
7222
|
-
})
|
7223
|
-
.then((result) => {
|
7224
|
-
resolve(ObjectUtils.stringToObject((result === null || result === void 0 ? void 0 : result.resource) || ''));
|
7225
|
-
})
|
7226
|
-
.catch((error) => {
|
7227
|
-
reject(error);
|
7228
|
-
});
|
7229
|
-
});
|
7230
|
-
}
|
7231
|
-
fetchDefaultConfig(formName, resourceID) {
|
7232
|
-
const name = this.getPath(resourceID, formName);
|
7233
|
-
return new Promise((resolve, reject) => {
|
7234
|
-
DataFetcher.get()
|
7235
|
-
.callGraphQL({
|
7236
|
-
values: { name },
|
7237
|
-
query: this.queryConfig.get("fetchDefaultConfig"),
|
7238
|
-
})
|
7239
|
-
.then((result) => {
|
7240
|
-
resolve(ObjectUtils.stringToObject((result === null || result === void 0 ? void 0 : result.resource) || ''));
|
7241
|
-
})
|
7242
|
-
.catch((error) => {
|
7243
|
-
reject(error);
|
7244
|
-
});
|
7245
|
-
});
|
7246
|
-
}
|
7247
|
-
getPath(resourceID, name, authority = "form") {
|
7248
|
-
if (name) {
|
7249
|
-
return `cfg://${authority}/${resourceID}/${name}`;
|
7250
|
-
}
|
7251
|
-
return `cfg://${authority}/${resourceID}`;
|
7252
|
-
}
|
7253
|
-
async fetchLegacyConfigurableForm(configName) {
|
7254
|
-
const payload = { 'requestBody': { 'config': { 'chave': configName, 'tipo': 'T' } } };
|
7255
|
-
const response = await DataFetcher.get().callServiceBroker('SystemUtilsSP.getConf', JSON.stringify(payload));
|
7256
|
-
if (ObjectUtils.isEmpty(response))
|
7257
|
-
return undefined;
|
7258
|
-
return this.buildLegacyConfigurableForm(response);
|
7259
|
-
}
|
7260
|
-
buildLegacyConfigurableForm(config) {
|
7261
|
-
var _a, _b, _c;
|
7262
|
-
const rawFields = (_c = (_b = (_a = config === null || config === void 0 ? void 0 : config.formConfig) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : [];
|
7263
|
-
return { emptyConfig: false, fields: Array.isArray(rawFields) ? rawFields : [rawFields] };
|
7264
|
-
}
|
7265
|
-
}
|
7266
|
-
var UserConfigType;
|
7267
|
-
(function (UserConfigType) {
|
7268
|
-
UserConfigType["USER"] = "USER";
|
7269
|
-
UserConfigType["DEFAULT"] = "DEFAULT";
|
7270
|
-
UserConfigType["SHARED"] = "SHARED";
|
7271
|
-
})(UserConfigType || (UserConfigType = {}));
|
7272
|
-
|
7273
|
-
export { DataFetcher as D, FormConfigFetcher as F, ResourceFetcher as R, UrlUtils as U, UserConfigType as a, dist as d };
|
7024
|
+
export { DataFetcher as D, UrlUtils as U, dist as d };
|
@@ -1,11 +1,13 @@
|
|
1
|
-
import { D as DataFetcher } from './
|
2
|
-
import
|
3
|
-
import { SortMode, ApplicationContext, UserInterface, DateUtils, DataType } from '@sankhyalabs/core';
|
1
|
+
import { D as DataFetcher } from './DataFetcher-4b4b7beb.js';
|
2
|
+
import './pesquisa-fetcher-9cfab836.js';
|
3
|
+
import { SortMode, ApplicationContext, UserInterface, DateUtils, ObjectUtils, NumberUtils, DataType } from '@sankhyalabs/core';
|
4
4
|
import './index-0ece87a6.js';
|
5
5
|
import './ISave-d8c8bc59.js';
|
6
6
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
7
7
|
import { UserInterface as UserInterface$1 } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
8
|
+
import { P as PreloadManager } from './dataunit-fetcher-87ecba4a.js';
|
8
9
|
import './filter-item-type.enum-d45e026f.js';
|
10
|
+
import './form-config-fetcher-5d72aaf1.js';
|
9
11
|
import InMemoryFilterColumnDataSource from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
|
10
12
|
|
11
13
|
class CrudUtils {
|
@@ -129,6 +131,41 @@ class SnkMultiSelectionListDataSource {
|
|
129
131
|
}
|
130
132
|
}
|
131
133
|
|
134
|
+
class RmPrecisionCustomValueFormatter {
|
135
|
+
setGrid(grid) {
|
136
|
+
if (this._grid) {
|
137
|
+
return;
|
138
|
+
}
|
139
|
+
this._grid = grid;
|
140
|
+
this.refreshSelectedRows();
|
141
|
+
}
|
142
|
+
setDataState(dataState) {
|
143
|
+
if (ObjectUtils.objectToString(dataState) === ObjectUtils.objectToString(this._dataState)) {
|
144
|
+
return;
|
145
|
+
}
|
146
|
+
this._dataState = dataState;
|
147
|
+
this.refreshSelectedRows();
|
148
|
+
}
|
149
|
+
format(currentValue, column, recordId) {
|
150
|
+
var _a;
|
151
|
+
if (!currentValue) {
|
152
|
+
return currentValue;
|
153
|
+
}
|
154
|
+
const rowMetadata = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.metadataByRow.get(recordId);
|
155
|
+
const rmPrecision = rowMetadata === null || rowMetadata === void 0 ? void 0 : rowMetadata.getProp('rm_precision', column.name);
|
156
|
+
if (rmPrecision) {
|
157
|
+
return NumberUtils.format(currentValue, rmPrecision, rmPrecision);
|
158
|
+
}
|
159
|
+
else {
|
160
|
+
return currentValue;
|
161
|
+
}
|
162
|
+
}
|
163
|
+
refreshSelectedRows() {
|
164
|
+
var _a;
|
165
|
+
(_a = this._grid) === null || _a === void 0 ? void 0 : _a.refreshSelectedRows();
|
166
|
+
}
|
167
|
+
}
|
168
|
+
|
132
169
|
class CommonsExporter {
|
133
170
|
constructor(dataUnit, grid) {
|
134
171
|
this.dataUnit = dataUnit;
|
@@ -136,26 +173,31 @@ class CommonsExporter {
|
|
136
173
|
}
|
137
174
|
async getColumnsMetadata() {
|
138
175
|
var _a;
|
139
|
-
|
140
|
-
return this.buildColumnsMetadata(columnsState);
|
176
|
+
this.columnsState = await ((_a = this.grid) === null || _a === void 0 ? void 0 : _a.getColumnsState());
|
177
|
+
return await this.buildColumnsMetadata(this.columnsState);
|
178
|
+
}
|
179
|
+
getColumnsState() {
|
180
|
+
return this.columnsState;
|
141
181
|
}
|
142
|
-
buildColumnsMetadata(gridColumns) {
|
182
|
+
async buildColumnsMetadata(gridColumns) {
|
183
|
+
var _a, _b;
|
143
184
|
const columnsMetadata = [];
|
144
|
-
|
145
|
-
var _a, _b;
|
185
|
+
for (const column of gridColumns) {
|
146
186
|
/**
|
147
187
|
* TODO: Analisar e criar uma melhor forma de tratar essa validação do "RECDESP".
|
148
188
|
*/
|
149
189
|
if (column.hidden && column.name !== "RECDESP") {
|
150
|
-
|
190
|
+
continue;
|
151
191
|
}
|
152
192
|
const fieldData = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(column.name);
|
193
|
+
const customFormatter = await this.grid.getCustomValueFormatter(column.name);
|
153
194
|
const columnData = {
|
154
195
|
label: column.label,
|
155
196
|
id: column.name,
|
156
197
|
width: (fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface) === UserInterface$1.SEARCH ? 30 : column.width,
|
157
198
|
type: fieldData === null || fieldData === void 0 ? void 0 : fieldData.dataType,
|
158
|
-
userInterface: fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface
|
199
|
+
userInterface: fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface,
|
200
|
+
customFormatter
|
159
201
|
};
|
160
202
|
columnsMetadata.push(columnData);
|
161
203
|
if (((_b = fieldData === null || fieldData === void 0 ? void 0 : fieldData.properties) === null || _b === void 0 ? void 0 : _b.DESCRIPTIONFIELD) != undefined) {
|
@@ -171,9 +213,9 @@ class CommonsExporter {
|
|
171
213
|
};
|
172
214
|
columnsMetadata.push(descriptionColumn);
|
173
215
|
}
|
174
|
-
}
|
216
|
+
}
|
175
217
|
return columnsMetadata || [];
|
176
218
|
}
|
177
219
|
}
|
178
220
|
|
179
|
-
export { CommonsExporter as C, SnkMultiSelectionListDataSource as S, CrudUtils as a };
|
221
|
+
export { CommonsExporter as C, RmPrecisionCustomValueFormatter as R, SnkMultiSelectionListDataSource as S, CrudUtils as a };
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { C as ConfigStorage } from './ConfigStorage-
|
1
|
+
import { C as ConfigStorage } from './ConfigStorage-174101b9.js';
|
2
2
|
import { ObjectUtils, StringUtils } from '@sankhyalabs/core';
|
3
|
-
import { F as FormConfigFetcher } from './form-config-fetcher-
|
3
|
+
import { F as FormConfigFetcher } from './form-config-fetcher-5d72aaf1.js';
|
4
4
|
|
5
5
|
class SnkFormConfigManager {
|
6
6
|
constructor(configName, resourceID, onConfigChange) {
|
@@ -29,6 +29,7 @@ const snkDataUnitMessages = {
|
|
29
29
|
forbiddenRemove: "Não é possível remover. Verifique as permissões de acesso.",
|
30
30
|
removeAllConfirmation: "Os <strong>{{size}} registros selecionados</strong> serão excluídos.<br/><br/><strong>Você realmente gostaria de continuar?</strong>",
|
31
31
|
removeAllInfo: "Os {{size}} registros foram removidos com sucesso!",
|
32
|
+
fieldNameRequired: "É necessário informar o nome da coluna."
|
32
33
|
};
|
33
34
|
|
34
35
|
const snkFilterBarMessages = {
|
@@ -552,7 +553,7 @@ class SnkMessageBuilder {
|
|
552
553
|
this.loadAppMessages().then((msgs) => {
|
553
554
|
this._appMessages = msgs;
|
554
555
|
}, error => {
|
555
|
-
console.info('O arquivo de mensagens personalizadas não foi encontrado no caminho /messages/appmessages
|
556
|
+
console.info('O arquivo de mensagens personalizadas não foi encontrado no caminho /messages/appmessages', error);
|
556
557
|
});
|
557
558
|
}
|
558
559
|
/**
|
@@ -644,17 +645,10 @@ class SnkMessageBuilder {
|
|
644
645
|
return message;
|
645
646
|
}
|
646
647
|
}
|
647
|
-
loadAppMessages() {
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
.then(module => {
|
652
|
-
accept(module.default);
|
653
|
-
})
|
654
|
-
.catch(reason => {
|
655
|
-
reject(reason);
|
656
|
-
});
|
657
|
-
});
|
648
|
+
async loadAppMessages() {
|
649
|
+
const messagesUrl = await this._application.getApplicationPath();
|
650
|
+
const module = await import(/* webpackIgnore: true */ `${messagesUrl}/messages/appmessages.js`);
|
651
|
+
return module.default;
|
658
652
|
}
|
659
653
|
}
|
660
654
|
var OperationMap;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ObjectUtils } from '@sankhyalabs/core';
|
2
|
-
import { R as ResourceFetcher } from './form-config-fetcher-
|
2
|
+
import { R as ResourceFetcher } from './form-config-fetcher-5d72aaf1.js';
|
3
3
|
|
4
4
|
class AuthFetcher extends ResourceFetcher {
|
5
5
|
getData(resourceID) {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ObjectUtils, DataUnit, DataType, DateUtils, StringUtils, ChangeOperation, ApplicationContext, UserInterface, DataUnitStorage } from '@sankhyalabs/core';
|
2
|
-
import { D as DataFetcher, d as dist } from './
|
2
|
+
import { D as DataFetcher, d as dist } from './DataFetcher-4b4b7beb.js';
|
3
3
|
import { DISTINCT_FILTER_NAME_PREFIX } from '@sankhyalabs/ezui/dist/collection/utils/constants';
|
4
4
|
import { DataUnitTransient } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
5
5
|
import { ColumnFilterManager } from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
|
@@ -369,6 +369,11 @@ class InMemoryLoader {
|
|
369
369
|
}
|
370
370
|
InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME = "InMemoryDataUnit";
|
371
371
|
|
372
|
+
function getRecordValue(record, fieldName) {
|
373
|
+
var _a, _b;
|
374
|
+
return ((_a = record[fieldName]) === null || _a === void 0 ? void 0 : _a.value) !== undefined ? (_b = record[fieldName]) === null || _b === void 0 ? void 0 : _b.value : record[fieldName];
|
375
|
+
}
|
376
|
+
|
372
377
|
class DatasetStrategy {
|
373
378
|
canSlice() {
|
374
379
|
return false;
|
@@ -423,6 +428,53 @@ class DatasetStrategy {
|
|
423
428
|
return Promise.reject(error);
|
424
429
|
}
|
425
430
|
}
|
431
|
+
async loadRowMetadata(snkDataUnit, fieldName, metadataName, updatedFields = {}) {
|
432
|
+
try {
|
433
|
+
const serviceName = "DatasetSP.loadRowMetadata";
|
434
|
+
const parsedRequestBody = await this.buildRequestBodyLoadRowMetadata({ snkDataUnit, fieldName, metadataName, serviceName, updatedFields });
|
435
|
+
const response = await DataFetcher.get().callServiceBroker(serviceName, parsedRequestBody);
|
436
|
+
return response;
|
437
|
+
}
|
438
|
+
catch (error) {
|
439
|
+
console.error(error);
|
440
|
+
return Promise.reject(error);
|
441
|
+
}
|
442
|
+
}
|
443
|
+
async buildRequestBodyLoadRowMetadata({ snkDataUnit, serviceName, fieldName, metadataName, updatedFields, }) {
|
444
|
+
const dataUnit = snkDataUnit.dataUnit;
|
445
|
+
const entityName = DataUnitFetcher.parseDataUnitName(dataUnit.name).entityName;
|
446
|
+
const recordIdInfo = await snkDataUnit.getSelectedRecordsIDsInfo();
|
447
|
+
const pk = recordIdInfo.reduce((accumulator, currentValue) => {
|
448
|
+
accumulator[currentValue.name] = currentValue.value;
|
449
|
+
return accumulator;
|
450
|
+
}, {});
|
451
|
+
const record = dataUnit.getSelectedRecord();
|
452
|
+
const fields = dataUnit.metadata.fields.filter(({ standAlone, name }) => !standAlone && !name.includes(".")).map(({ name }) => name);
|
453
|
+
const values = fields.reduce((accumulator, currentValue, currentIndex) => {
|
454
|
+
const recordValue = getRecordValue(record, currentValue);
|
455
|
+
const updatedFieldValue = getRecordValue(updatedFields, currentValue);
|
456
|
+
accumulator[currentIndex] = updatedFieldValue !== undefined ? updatedFieldValue : recordValue;
|
457
|
+
return accumulator;
|
458
|
+
}, {});
|
459
|
+
const requestBody = {
|
460
|
+
serviceName,
|
461
|
+
requestBody: {
|
462
|
+
dataSetID: dataUnit.dataUnitId,
|
463
|
+
entityName,
|
464
|
+
standAlone: false,
|
465
|
+
metadataName,
|
466
|
+
fieldName,
|
467
|
+
fields,
|
468
|
+
record: {
|
469
|
+
pk,
|
470
|
+
oldPk: pk,
|
471
|
+
values,
|
472
|
+
},
|
473
|
+
}
|
474
|
+
};
|
475
|
+
const parsedRequestBody = JSON.stringify(requestBody);
|
476
|
+
return parsedRequestBody;
|
477
|
+
}
|
426
478
|
getFieldsList(dataUnit) {
|
427
479
|
let fields = ["__record__id__", "__record__label__"];
|
428
480
|
dataUnit.metadata.fields.forEach((descriptor) => {
|
@@ -502,9 +554,11 @@ class DatasetStrategy {
|
|
502
554
|
}
|
503
555
|
processRecords(dataUnit, fields, responseRecords) {
|
504
556
|
return responseRecords.map((dataFrame) => {
|
557
|
+
const lastElement = dataFrame[dataFrame.length - 1];
|
505
558
|
const duRecord = {
|
506
559
|
__record__id__: dataFrame[0],
|
507
|
-
__record__label__: dataFrame[1]
|
560
|
+
__record__label__: dataFrame[1],
|
561
|
+
__record__metadata__: lastElement['_rmd'],
|
508
562
|
};
|
509
563
|
dataUnit.metadata.fields.forEach(fieldDescriptor => {
|
510
564
|
duRecord[fieldDescriptor.name] = this.buildFieldValue(fieldDescriptor, fields, dataFrame);
|
@@ -989,164 +1043,4 @@ class DataUnitFetcher {
|
|
989
1043
|
}
|
990
1044
|
}
|
991
1045
|
|
992
|
-
|
993
|
-
constructor() {
|
994
|
-
this._defaultPageSize = 100;
|
995
|
-
this._templateByQuery = new Map();
|
996
|
-
this._searchListenersByDataUnit = new Map();
|
997
|
-
this.buldTemplates();
|
998
|
-
}
|
999
|
-
buldTemplates() {
|
1000
|
-
this._templateByQuery.set("search", dist.gql `query($entityName: String! $argument: String $criteria: InputSearchCriteria $options: InputSearchOptions) {
|
1001
|
-
$queryAlias$: search(entityName: $entityName argument: $argument criteria: $criteria options: $options){
|
1002
|
-
value
|
1003
|
-
label
|
1004
|
-
}
|
1005
|
-
}`);
|
1006
|
-
}
|
1007
|
-
loadSearchOptions(entityName, argument, criteria, options) {
|
1008
|
-
var _a;
|
1009
|
-
const cleanText = (argument === null || argument === void 0 ? void 0 : argument.toString().trim()) || undefined;
|
1010
|
-
argument = isNaN(Number(cleanText)) && cleanText ? `%${cleanText}` : cleanText;
|
1011
|
-
criteria === null || criteria === void 0 ? void 0 : criteria.params.forEach(param => {
|
1012
|
-
if (param.dataType === DataType.OBJECT) {
|
1013
|
-
param.value = JSON.stringify(param.value);
|
1014
|
-
}
|
1015
|
-
});
|
1016
|
-
const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, options);
|
1017
|
-
const values = {
|
1018
|
-
argument: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.argument) || argument,
|
1019
|
-
entityName,
|
1020
|
-
criteria: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.criteria) || criteria,
|
1021
|
-
options: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions) || options,
|
1022
|
-
};
|
1023
|
-
if (values.options) {
|
1024
|
-
(_a = values.options) === null || _a === void 0 ? true : delete _a.dataUnitId;
|
1025
|
-
}
|
1026
|
-
return new Promise((resolve, reject) => {
|
1027
|
-
DataFetcher.get()
|
1028
|
-
.callGraphQL({
|
1029
|
-
values,
|
1030
|
-
query: this._templateByQuery.get("search"),
|
1031
|
-
})
|
1032
|
-
.then((result) => {
|
1033
|
-
resolve(result);
|
1034
|
-
})
|
1035
|
-
.catch((error) => {
|
1036
|
-
reject(error);
|
1037
|
-
});
|
1038
|
-
});
|
1039
|
-
}
|
1040
|
-
loadAdvancedSearch(entityName, argument, criteria, searchOptions) {
|
1041
|
-
var _a, _b, _c, _d;
|
1042
|
-
const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, searchOptions);
|
1043
|
-
const values = {
|
1044
|
-
argument: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.argument) || argument,
|
1045
|
-
criteria: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.criteria) || criteria,
|
1046
|
-
searchOptions: Object.assign(Object.assign({}, searchOptions), listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions),
|
1047
|
-
};
|
1048
|
-
const serviceName = "PesquisaSP.getSuggestion";
|
1049
|
-
const externalCriteria = {
|
1050
|
-
query: {
|
1051
|
-
$: (_a = values.criteria) === null || _a === void 0 ? void 0 : _a.expression
|
1052
|
-
}
|
1053
|
-
};
|
1054
|
-
if (((_c = (_b = values.criteria) === null || _b === void 0 ? void 0 : _b.params) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
1055
|
-
externalCriteria.params = {
|
1056
|
-
param: values.criteria.params.map(param => {
|
1057
|
-
let value = param.value;
|
1058
|
-
if (typeof value === "string") {
|
1059
|
-
const match = /CTX\{([^}]+)\}/.exec(value);
|
1060
|
-
if (match) {
|
1061
|
-
value = ApplicationContext.getContextValue(`__SNK__APPLICATION__FILTER__CONTEXT(${match[1]})__`);
|
1062
|
-
}
|
1063
|
-
}
|
1064
|
-
let type = param.dataType;
|
1065
|
-
if (type === DataType.OBJECT) {
|
1066
|
-
value = value.value;
|
1067
|
-
type = "S";
|
1068
|
-
}
|
1069
|
-
else {
|
1070
|
-
type = convertParamType(param.dataType);
|
1071
|
-
}
|
1072
|
-
return { $: value, type };
|
1073
|
-
})
|
1074
|
-
};
|
1075
|
-
}
|
1076
|
-
const options = searchOptions != undefined
|
1077
|
-
? 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;
|
1078
|
-
const reqBody = {
|
1079
|
-
"serviceName": serviceName,
|
1080
|
-
"requestBody": {
|
1081
|
-
"criteria": Object.assign({ "entityName": entityName, "compacted": false, "ignoreEntityCriteria": false, "limit": this._defaultPageSize, "query": { "$": values.argument }, "orderByDesc": false, "externalCriteria": externalCriteria, "localEntityName": (_d = values.searchOptions) === null || _d === void 0 ? void 0 : _d.rootEntity }, { options }),
|
1082
|
-
"clientEventList": {
|
1083
|
-
"clientEvent": []
|
1084
|
-
}
|
1085
|
-
}
|
1086
|
-
};
|
1087
|
-
return new Promise((resolve, reject) => {
|
1088
|
-
DataFetcher.get()
|
1089
|
-
.callServiceBroker("PesquisaSP.getSuggestion", JSON.stringify(reqBody))
|
1090
|
-
.then(result => resolve(result))
|
1091
|
-
.catch(error => reject(error));
|
1092
|
-
});
|
1093
|
-
}
|
1094
|
-
addSearchListener(entityName, dataUnitID, listener) {
|
1095
|
-
var _a;
|
1096
|
-
const dataUnitSearchListeners = this._searchListenersByDataUnit.get(dataUnitID) || [];
|
1097
|
-
const entityListener = dataUnitSearchListeners.find(currentListener => currentListener.entity === entityName);
|
1098
|
-
if (!entityListener) {
|
1099
|
-
this._searchListenersByDataUnit.set(dataUnitID, [...dataUnitSearchListeners, { entity: entityName, listener }]);
|
1100
|
-
}
|
1101
|
-
else {
|
1102
|
-
for (const type of Object.keys(listener)) {
|
1103
|
-
if (type in entityListener.listener) {
|
1104
|
-
const listenerFunctionIsEquals = ((_a = entityListener.listener[type]) === null || _a === void 0 ? void 0 : _a.toString()) === listener[type].toString();
|
1105
|
-
if (listenerFunctionIsEquals)
|
1106
|
-
continue;
|
1107
|
-
entityListener.listener[type] = listener[type];
|
1108
|
-
}
|
1109
|
-
}
|
1110
|
-
}
|
1111
|
-
return () => {
|
1112
|
-
const newListeners = dataUnitSearchListeners.filter(currentListener => currentListener.entity !== entityName);
|
1113
|
-
if (!newListeners.length) {
|
1114
|
-
this._searchListenersByDataUnit.delete(dataUnitID);
|
1115
|
-
return;
|
1116
|
-
}
|
1117
|
-
this._searchListenersByDataUnit.set(dataUnitID, newListeners);
|
1118
|
-
};
|
1119
|
-
}
|
1120
|
-
applySearchListener(listenerType, entityName, argument, criteria, searchOptions) {
|
1121
|
-
var _a;
|
1122
|
-
const dataUnitId = searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.dataUnitId;
|
1123
|
-
if (!dataUnitId)
|
1124
|
-
return;
|
1125
|
-
const entityListener = (_a = this._searchListenersByDataUnit.get(dataUnitId)) === null || _a === void 0 ? void 0 : _a.find(({ entity }) => entity === entityName);
|
1126
|
-
if (!entityListener)
|
1127
|
-
return;
|
1128
|
-
const { listener } = entityListener;
|
1129
|
-
if (!(listenerType in listener))
|
1130
|
-
return;
|
1131
|
-
return listener[listenerType]({ argument, criteria, searchOptions });
|
1132
|
-
}
|
1133
|
-
}
|
1134
|
-
function convertParamType(dataType) {
|
1135
|
-
//Alerta: Cuidado pra não contaminar o DataType com a implementação
|
1136
|
-
//atual da pesquisa... em geral, somente inteiros,
|
1137
|
-
//data (com ou sem hora) e string são realmente relevantes
|
1138
|
-
switch (dataType) {
|
1139
|
-
case DataType.NUMBER:
|
1140
|
-
return "I";
|
1141
|
-
case DataType.DATE:
|
1142
|
-
return "D";
|
1143
|
-
default:
|
1144
|
-
return "S";
|
1145
|
-
}
|
1146
|
-
}
|
1147
|
-
var SearchListenerType;
|
1148
|
-
(function (SearchListenerType) {
|
1149
|
-
SearchListenerType["beforeSearch"] = "beforeSearch";
|
1150
|
-
})(SearchListenerType || (SearchListenerType = {}));
|
1151
|
-
|
1152
|
-
export { DataUnitFetcher as D, InMemoryLoader as I, PesquisaFetcher as P, PreloadManager as a, applyFilter as b, applySorting as c, buildPaginationInfo as d };
|
1046
|
+
export { DataUnitFetcher as D, InMemoryLoader as I, PreloadManager as P, DatasetStrategy as a, applyFilter as b, applySorting as c, buildPaginationInfo as d, getRecordValue as g };
|