@sankhyalabs/sankhyablocks 1.1.18 → 1.1.21
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 +1225 -1133
- package/dist/collection/components/snk-application/snk-application.js +5 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +20 -1
- 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 +1225 -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 +1225 -1133
- package/dist/sankhyablocks/p-1f8989f1.entry.js +57 -0
- package/dist/sankhyablocks/p-5fa264b9.js +1 -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 +5 -4
- package/react/components.d.ts +3 -0
- package/react/components.js +6 -0
- package/react/components.js.map +1 -0
- package/react/react-component-lib/createComponent.d.ts +10 -0
- package/react/react-component-lib/createComponent.js +75 -0
- package/react/react-component-lib/createComponent.js.map +1 -0
- package/react/react-component-lib/createOverlayComponent.d.ts +21 -0
- package/react/react-component-lib/createOverlayComponent.js +109 -0
- package/react/react-component-lib/createOverlayComponent.js.map +1 -0
- package/react/react-component-lib/index.d.ts +2 -0
- package/react/react-component-lib/index.js +3 -0
- package/react/react-component-lib/index.js.map +1 -0
- package/react/react-component-lib/interfaces.d.ts +29 -0
- package/react/react-component-lib/interfaces.js +1 -0
- package/react/react-component-lib/interfaces.js.map +1 -0
- package/react/react-component-lib/utils/attachProps.d.ts +12 -0
- package/react/react-component-lib/utils/attachProps.js +98 -0
- package/react/react-component-lib/utils/attachProps.js.map +1 -0
- package/react/react-component-lib/utils/case.d.ts +2 -0
- package/react/react-component-lib/utils/case.js +7 -0
- package/react/react-component-lib/utils/case.js.map +1 -0
- package/react/react-component-lib/utils/dev.d.ts +2 -0
- package/react/react-component-lib/utils/dev.js +13 -0
- package/react/react-component-lib/utils/dev.js.map +1 -0
- package/react/react-component-lib/utils/index.d.ts +10 -0
- package/react/react-component-lib/utils/index.js +34 -0
- package/react/react-component-lib/utils/index.js.map +1 -0
- 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) {
|
|
@@ -154,4 +155,22 @@ export default class DataUnitFetcher {
|
|
|
154
155
|
});
|
|
155
156
|
});
|
|
156
157
|
}
|
|
158
|
+
removeRecords(dataUnit, recordIds) {
|
|
159
|
+
const changes = recordIds.map((recordId) => {
|
|
160
|
+
return { dataUnit: dataUnit.name, operation: ChangeOperation.DELETE, recordId };
|
|
161
|
+
});
|
|
162
|
+
return new Promise((resolve, reject) => {
|
|
163
|
+
HttpFetcher.get()
|
|
164
|
+
.callGraphQL({
|
|
165
|
+
values: { changes: changes },
|
|
166
|
+
query: this.templateByQuery.get("saveData"),
|
|
167
|
+
})
|
|
168
|
+
.then((_resp) => {
|
|
169
|
+
resolve(recordIds);
|
|
170
|
+
})
|
|
171
|
+
.catch((error) => {
|
|
172
|
+
reject(error);
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
}
|
|
157
176
|
}
|
|
@@ -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
|
+
};
|