@sankhyalabs/sankhyablocks 1.1.19 → 1.1.22
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/{index-d3250310.js → index-20a7d705.js} +5 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +1231 -1134
- package/dist/collection/components/snk-application/snk-application.js +5 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +26 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +1 -1
- package/dist/collection/lib/utils/pesquisa.js +16 -0
- package/dist/components/snk-application.js +1230 -1133
- package/dist/esm/{index-781079ed.js → index-8d3572c4.js} +5 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-application.entry.js +1231 -1134
- package/dist/sankhyablocks/p-5fa264b9.js +1 -0
- package/dist/sankhyablocks/p-fe95f2c4.entry.js +57 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +1 -0
- package/dist/types/lib/utils/pesquisa.d.ts +2 -0
- package/package.json +3 -3
- package/dist/sankhyablocks/p-76332558.entry.js +0 -57
- package/dist/sankhyablocks/p-83177bdc.js +0 -1
|
@@ -7,6 +7,8 @@ import ParametersFetcher from "../../lib/http/data-fetcher/fetchers/parameters-f
|
|
|
7
7
|
//incluída no pacote. Isso deve ser resolvido nas proximas entregas e então ajustado aqui
|
|
8
8
|
import ApplicationUtils from "../../temp/ApplicationUtils";
|
|
9
9
|
import { FormConfigFetcher } from "../../lib/http/data-fetcher/fetchers/form-config-fetcher";
|
|
10
|
+
import { ApplicationContext } from "@sankhyalabs/core";
|
|
11
|
+
import { pesquisaLoadOptions } from "../../lib/utils/pesquisa";
|
|
10
12
|
export class SnkApplication {
|
|
11
13
|
get parameters() {
|
|
12
14
|
if (!this._parameters) {
|
|
@@ -110,6 +112,9 @@ export class SnkApplication {
|
|
|
110
112
|
}
|
|
111
113
|
return this._formConfigFetcher;
|
|
112
114
|
}
|
|
115
|
+
componentWillLoad() {
|
|
116
|
+
ApplicationContext.setContextValue("__EZUI__SEARCH__OPTION__LOADER__", pesquisaLoadOptions);
|
|
117
|
+
}
|
|
113
118
|
componentDidLoad() {
|
|
114
119
|
this.applicationLoading.emit(true);
|
|
115
120
|
window.requestAnimationFrame(() => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataUnit, } from "@sankhyalabs/core";
|
|
1
|
+
import { DataUnit, ChangeOperation, } from "@sankhyalabs/core";
|
|
2
2
|
import { HttpFetcher } from "../DataFetcher";
|
|
3
3
|
import { gql } from "graphql-request";
|
|
4
4
|
export default class DataUnitFetcher {
|
|
@@ -63,6 +63,7 @@ export default class DataUnitFetcher {
|
|
|
63
63
|
dataUnit.metadataLoader = (dataUnit) => this.loadMetadata(dataUnit);
|
|
64
64
|
dataUnit.dataLoader = (dataUnit, sort, filters) => this.loadData(dataUnit, sort, filters);
|
|
65
65
|
dataUnit.saveLoader = (dataUnit, changes) => this.saveData(dataUnit, changes);
|
|
66
|
+
dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
|
|
66
67
|
return dataUnit;
|
|
67
68
|
}
|
|
68
69
|
loadMetadata(dataUnit) {
|
|
@@ -123,7 +124,12 @@ export default class DataUnitFetcher {
|
|
|
123
124
|
const { dataUnit: changeDU, record, updatingFields, operation } = change;
|
|
124
125
|
const parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
|
|
125
126
|
if (value) {
|
|
126
|
-
|
|
127
|
+
try {
|
|
128
|
+
value = JSON.stringify(value);
|
|
129
|
+
}
|
|
130
|
+
catch (_a) {
|
|
131
|
+
value = value.toString();
|
|
132
|
+
}
|
|
127
133
|
}
|
|
128
134
|
return { fieldName, value };
|
|
129
135
|
});
|
|
@@ -154,4 +160,22 @@ export default class DataUnitFetcher {
|
|
|
154
160
|
});
|
|
155
161
|
});
|
|
156
162
|
}
|
|
163
|
+
removeRecords(dataUnit, recordIds) {
|
|
164
|
+
const changes = recordIds.map((recordId) => {
|
|
165
|
+
return { dataUnit: dataUnit.name, operation: ChangeOperation.DELETE, recordId };
|
|
166
|
+
});
|
|
167
|
+
return new Promise((resolve, reject) => {
|
|
168
|
+
HttpFetcher.get()
|
|
169
|
+
.callGraphQL({
|
|
170
|
+
values: { changes: changes },
|
|
171
|
+
query: this.templateByQuery.get("saveData"),
|
|
172
|
+
})
|
|
173
|
+
.then((_resp) => {
|
|
174
|
+
resolve(recordIds);
|
|
175
|
+
})
|
|
176
|
+
.catch((error) => {
|
|
177
|
+
reject(error);
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
}
|
|
157
181
|
}
|
|
@@ -8,7 +8,7 @@ export class FormConfigFetcher extends ResourceFetcher {
|
|
|
8
8
|
const config = JSON.parse(configAsString);
|
|
9
9
|
const { tabs, fields } = config;
|
|
10
10
|
if (tabs) {
|
|
11
|
-
const allTabs = new Map(tabs.map(t => [t.
|
|
11
|
+
const allTabs = new Map(tabs.map(t => [t.label, t]));
|
|
12
12
|
fields.forEach(f => f.tab = allTabs.get(f.tab));
|
|
13
13
|
}
|
|
14
14
|
accept(fields);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const mockByEntity = {
|
|
2
|
+
"ImplantacaoSaldoConta": [{ "value": 6, "label": "Conta Financeiro" }, { "value": 7, "label": "Conta Banco do Brasil" }],
|
|
3
|
+
"HistoricoBancario": [{ "value": 9, "label": "Lanç. Origem" }, { "value": 8, "label": "Lanç. Origem 2" }],
|
|
4
|
+
"ContaDestino": [{ "value": 10, "label": "Conta BB" }, { "value": 7, "label": "Conta Santander" }],
|
|
5
|
+
"HistoricoBancarioDestino": [{ "value": 11, "label": "Contra Bradesco" }, { "value": 13, "label": "Contra Destino" }],
|
|
6
|
+
"Usuario": [{ "value": 0, "label": "SUP" }],
|
|
7
|
+
"ContaBancaria": [{ "value": 10, "label": "Conta 10" }, { "value": 17, "label": "Conta 17" }],
|
|
8
|
+
"TipoOperacao": [{ "value": 4, "label": "Entrada NFse" }, { "value": 5, "label": "Outra top" }, { "value": 6, "label": "Top 6" }]
|
|
9
|
+
};
|
|
10
|
+
export const pesquisaLoadOptions = (searchArgument, fieldName, dataUnit) => {
|
|
11
|
+
var _a;
|
|
12
|
+
console.log(searchArgument);
|
|
13
|
+
const field = dataUnit.getField(fieldName);
|
|
14
|
+
const entityName = (_a = field.properties) === null || _a === void 0 ? void 0 : _a.ENTITYNAME;
|
|
15
|
+
return (mockByEntity[entityName] || []);
|
|
16
|
+
};
|