@sankhyalabs/sankhyablocks 1.3.19 → 1.3.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-dcacd71c.js → index-1133bc2a.js} +55 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/sankhyablocks.cjs.js +2 -2
- package/dist/cjs/snk-application.cjs.entry.js +196 -36
- package/dist/cjs/snk-pesquisa.cjs.entry.js +296 -3
- package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
- package/dist/collection/components/snk-application/errorhandler/snk-error-handler.js +43 -0
- package/dist/collection/components/snk-application/snk-application.js +169 -5
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +92 -1
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +311 -6
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +47 -23
- package/dist/collection/lib/http/data-fetcher/fetchers/auth-fetcher.js +29 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +8 -7
- package/dist/components/snk-application2.js +201 -37
- package/dist/components/snk-pesquisa2.js +300 -6
- package/dist/esm/{index-b13a53d8.js → index-ffda6382.js} +55 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/sankhyablocks.js +2 -2
- package/dist/esm/snk-application.entry.js +197 -37
- package/dist/esm/snk-pesquisa.entry.js +296 -3
- package/dist/esm/teste-pesquisa.entry.js +1 -1
- package/dist/sankhyablocks/{p-28a5ef28.entry.js → p-2a7b4cb3.entry.js} +1 -1
- package/dist/sankhyablocks/p-a200791b.entry.js +68 -0
- package/dist/sankhyablocks/p-d62412bb.entry.js +1 -0
- package/dist/sankhyablocks/p-edcb9d8e.js +2 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/errorhandler/snk-error-handler.d.ts +8 -0
- package/dist/types/components/snk-application/snk-application.d.ts +87 -0
- package/dist/types/components/snk-pesquisa/snk-pesquisa.d.ts +44 -2
- package/dist/types/components.d.ts +9 -2
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +2 -0
- package/dist/types/lib/http/data-fetcher/fetchers/auth-fetcher.d.ts +17 -0
- package/dist/types/lib/http/data-fetcher/fetchers/pesquisa-fetcher.d.ts +3 -2
- package/package.json +7 -7
- package/dist/sankhyablocks/p-0b1577eb.entry.js +0 -1
- package/dist/sankhyablocks/p-4e116571.js +0 -2
- package/dist/sankhyablocks/p-7d9bb6a8.entry.js +0 -68
|
@@ -183,6 +183,19 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
183
183
|
}
|
|
184
184
|
};
|
|
185
185
|
walk(children);
|
|
186
|
+
if (vnodeData) {
|
|
187
|
+
{
|
|
188
|
+
const classData = vnodeData.className || vnodeData.class;
|
|
189
|
+
if (classData) {
|
|
190
|
+
vnodeData.class =
|
|
191
|
+
typeof classData !== 'object'
|
|
192
|
+
? classData
|
|
193
|
+
: Object.keys(classData)
|
|
194
|
+
.filter((k) => classData[k])
|
|
195
|
+
.join(' ');
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
186
199
|
const vnode = newVNode(nodeName, null);
|
|
187
200
|
vnode.$attrs$ = vnodeData;
|
|
188
201
|
if (vNodeChildren.length > 0) {
|
|
@@ -217,7 +230,14 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
217
230
|
if (oldValue !== newValue) {
|
|
218
231
|
let isProp = isMemberInElement(elm, memberName);
|
|
219
232
|
let ln = memberName.toLowerCase();
|
|
220
|
-
if (memberName === '
|
|
233
|
+
if (memberName === 'class') {
|
|
234
|
+
const classList = elm.classList;
|
|
235
|
+
const oldClasses = parseClassList(oldValue);
|
|
236
|
+
const newClasses = parseClassList(newValue);
|
|
237
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
238
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
239
|
+
}
|
|
240
|
+
else if (memberName === 'ref') {
|
|
221
241
|
// minifier will clean this up
|
|
222
242
|
if (newValue) {
|
|
223
243
|
newValue(elm);
|
|
@@ -299,6 +319,8 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
299
319
|
}
|
|
300
320
|
}
|
|
301
321
|
};
|
|
322
|
+
const parseClassListRegex = /\s/;
|
|
323
|
+
const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
|
|
302
324
|
const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
303
325
|
// if the element passed in is a shadow root, which is a document fragment
|
|
304
326
|
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
@@ -746,6 +768,7 @@ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propNam
|
|
|
746
768
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
747
769
|
// check our new property value against our internal value
|
|
748
770
|
const hostRef = getHostRef(ref);
|
|
771
|
+
const elm = hostRef.$hostElement$ ;
|
|
749
772
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
750
773
|
const flags = hostRef.$flags$;
|
|
751
774
|
const instance = hostRef.$lazyInstance$ ;
|
|
@@ -758,6 +781,22 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
758
781
|
// set our new value!
|
|
759
782
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
760
783
|
if (instance) {
|
|
784
|
+
// get an array of method names of watch functions to call
|
|
785
|
+
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
786
|
+
const watchMethods = cmpMeta.$watchers$[propName];
|
|
787
|
+
if (watchMethods) {
|
|
788
|
+
// this instance is watching for when this property changed
|
|
789
|
+
watchMethods.map((watchMethodName) => {
|
|
790
|
+
try {
|
|
791
|
+
// fire off each of the watch methods that are watching this property
|
|
792
|
+
instance[watchMethodName](newVal, oldVal, propName);
|
|
793
|
+
}
|
|
794
|
+
catch (e) {
|
|
795
|
+
consoleError(e, elm);
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
}
|
|
761
800
|
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
762
801
|
// looks like this value actually changed, so we've got work to do!
|
|
763
802
|
// but only if we've already rendered, otherwise just chill out
|
|
@@ -770,6 +809,9 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
770
809
|
};
|
|
771
810
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
772
811
|
if (cmpMeta.$members$) {
|
|
812
|
+
if (Cstr.watchers) {
|
|
813
|
+
cmpMeta.$watchers$ = Cstr.watchers;
|
|
814
|
+
}
|
|
773
815
|
// It's better to have a const than two Object.entries()
|
|
774
816
|
const members = Object.entries(cmpMeta.$members$);
|
|
775
817
|
const prototype = Cstr.prototype;
|
|
@@ -884,6 +926,12 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
884
926
|
endLoad();
|
|
885
927
|
}
|
|
886
928
|
if (!Cstr.isProxied) {
|
|
929
|
+
// we've never proxied this Constructor before
|
|
930
|
+
// let's add the getters/setters to its prototype before
|
|
931
|
+
// the first time we create an instance of the implementation
|
|
932
|
+
{
|
|
933
|
+
cmpMeta.$watchers$ = Cstr.watchers;
|
|
934
|
+
}
|
|
887
935
|
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
888
936
|
Cstr.isProxied = true;
|
|
889
937
|
}
|
|
@@ -907,6 +955,9 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
907
955
|
{
|
|
908
956
|
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
909
957
|
}
|
|
958
|
+
{
|
|
959
|
+
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
960
|
+
}
|
|
910
961
|
endNewInstance();
|
|
911
962
|
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
912
963
|
}
|
|
@@ -1020,6 +1071,9 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1020
1071
|
{
|
|
1021
1072
|
cmpMeta.$members$ = compactMeta[2];
|
|
1022
1073
|
}
|
|
1074
|
+
{
|
|
1075
|
+
cmpMeta.$watchers$ = {};
|
|
1076
|
+
}
|
|
1023
1077
|
const tagName = cmpMeta.$tagName$;
|
|
1024
1078
|
const HostElement = class extends HTMLElement {
|
|
1025
1079
|
// StencilLazyHost
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-1133bc2a.js');
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
8
|
Stencil Client Patch Esm v2.16.1 | MIT Licensed | https://stenciljs.com
|
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["snk-pesquisa.cjs",[[
|
|
17
|
+
return index.bootstrapLazy([["snk-pesquisa.cjs",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-application.cjs",[[2,"snk-application",{"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"saveGridConfig":[64],"executeSearch":[64]}]]],["teste-pesquisa.cjs",[[1,"teste-pesquisa"]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
3
|
+
const index = require('./index-1133bc2a.js');
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
Stencil Client Patch Browser v2.16.1 | MIT Licensed | https://stenciljs.com
|
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["snk-pesquisa.cjs",[[
|
|
18
|
+
return index.bootstrapLazy([["snk-pesquisa.cjs",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-application.cjs",[[2,"snk-application",{"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"saveGridConfig":[64],"executeSearch":[64]}]]],["teste-pesquisa.cjs",[[1,"teste-pesquisa"]]]], options);
|
|
19
19
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-1133bc2a.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
7
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
8
8
|
const UnitMetadata = require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
@@ -6501,13 +6501,9 @@ class DataFetcher {
|
|
|
6501
6501
|
let query = this.getQueryTemplate(req);
|
|
6502
6502
|
const res = await this.fecthGrapql([{ document: query, variables: req.values }]);
|
|
6503
6503
|
if (res.errors.length > 0) {
|
|
6504
|
-
reject(res);
|
|
6504
|
+
reject(new core.ErrorException("Falha detectada", res.errors[0][0].message));
|
|
6505
6505
|
}
|
|
6506
6506
|
else {
|
|
6507
|
-
//resolve(res);
|
|
6508
|
-
//FIXME: Precisamos trabalhar melhor a resposta, quem chamou
|
|
6509
|
-
//a API não pode ficar responsavel por desempacotar... fiz uma
|
|
6510
|
-
//gambiarra aqui...
|
|
6511
6507
|
resolve(res.data[0][reqKey]);
|
|
6512
6508
|
}
|
|
6513
6509
|
});
|
|
@@ -6596,7 +6592,7 @@ class DataFetcher {
|
|
|
6596
6592
|
errorsResponse.forEach((errorResponse) => {
|
|
6597
6593
|
Object.entries(errorResponse).forEach(([_key, val]) => {
|
|
6598
6594
|
var _a;
|
|
6599
|
-
(((_a = this.getWatingRequest(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(val);
|
|
6595
|
+
(((_a = this.getWatingRequest(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new core.ErrorException("Falha detectada", val.message));
|
|
6600
6596
|
});
|
|
6601
6597
|
});
|
|
6602
6598
|
//Resolve promises with data from query
|
|
@@ -6614,33 +6610,51 @@ class DataFetcher {
|
|
|
6614
6610
|
let dataResponse = [];
|
|
6615
6611
|
let errorsResponse = [];
|
|
6616
6612
|
let url = `${this.resolveURL() + this.GRAPHQL_PATH}`;
|
|
6613
|
+
if (window['skw_session']) {
|
|
6614
|
+
url += `?mgeSession=${window['skw_session']}`;
|
|
6615
|
+
}
|
|
6617
6616
|
DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url }));
|
|
6618
6617
|
try {
|
|
6619
6618
|
res = await dist.batchRequests(url, request, { 'Content-Type': `application/json; charset=${window['SERVER_ENCODING'] || 'UTF-8'}` });
|
|
6620
|
-
res.forEach((resItem) => {
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
catch (err) {
|
|
6625
|
-
//TODO: Tratar erro quando não existir err.response
|
|
6626
|
-
res = err.response;
|
|
6627
|
-
const req = err.request;
|
|
6628
|
-
Object.entries(res).forEach(([key, val]) => {
|
|
6629
|
-
if (val.errors) {
|
|
6630
|
-
errorsResponse.push(val.errors.map((item) => {
|
|
6631
|
-
item.request = req;
|
|
6632
|
-
item.index = Number(key);
|
|
6633
|
-
return item;
|
|
6634
|
-
}));
|
|
6619
|
+
res.forEach((resItem, index) => {
|
|
6620
|
+
var _a;
|
|
6621
|
+
if (((_a = resItem === null || resItem === void 0 ? void 0 : resItem.errors) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
6622
|
+
errorsResponse.push(resItem.errors.map((item) => this.normalizeErrorResponse(item, request, index)));
|
|
6635
6623
|
}
|
|
6636
|
-
else
|
|
6637
|
-
dataResponse.push(
|
|
6624
|
+
else {
|
|
6625
|
+
dataResponse.push(resItem.data);
|
|
6638
6626
|
}
|
|
6639
6627
|
});
|
|
6640
6628
|
}
|
|
6629
|
+
catch (err) {
|
|
6630
|
+
if (!this.isHttpError(err)) {
|
|
6631
|
+
res = err.response;
|
|
6632
|
+
const req = err.request;
|
|
6633
|
+
Object.entries(res).forEach(([key, val]) => {
|
|
6634
|
+
if (val.errors) {
|
|
6635
|
+
errorsResponse.push(val.errors.map((item) => {
|
|
6636
|
+
item.request = req;
|
|
6637
|
+
item.index = Number(key);
|
|
6638
|
+
return item;
|
|
6639
|
+
}));
|
|
6640
|
+
}
|
|
6641
|
+
else if (val.data) {
|
|
6642
|
+
dataResponse.push(val.data);
|
|
6643
|
+
}
|
|
6644
|
+
});
|
|
6645
|
+
}
|
|
6646
|
+
else {
|
|
6647
|
+
DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url }));
|
|
6648
|
+
throw new core.ErrorException("Falha de comunicação", err.message);
|
|
6649
|
+
}
|
|
6650
|
+
}
|
|
6641
6651
|
DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url }));
|
|
6642
6652
|
return { data: dataResponse, errors: errorsResponse };
|
|
6643
6653
|
}
|
|
6654
|
+
isHttpError(err) {
|
|
6655
|
+
var _a;
|
|
6656
|
+
return !err.response && !err.request || (((_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.status) >= 300);
|
|
6657
|
+
}
|
|
6644
6658
|
//TODO: Mover este metodo para o @sankhyalabs/core classe string utils.
|
|
6645
6659
|
hashCode(txt) {
|
|
6646
6660
|
var hash = 0, i, chr;
|
|
@@ -6654,6 +6668,15 @@ class DataFetcher {
|
|
|
6654
6668
|
return hash.toString();
|
|
6655
6669
|
}
|
|
6656
6670
|
;
|
|
6671
|
+
normalizeErrorResponse(error, requests, requestIndex) {
|
|
6672
|
+
const req = Object.assign({}, requests[requestIndex]);
|
|
6673
|
+
const { variables } = req;
|
|
6674
|
+
req.variables = [];
|
|
6675
|
+
req.variables[requestIndex] = variables;
|
|
6676
|
+
error.request = req;
|
|
6677
|
+
error.index = Number(requestIndex);
|
|
6678
|
+
return error;
|
|
6679
|
+
}
|
|
6657
6680
|
}
|
|
6658
6681
|
DataFetcher.appTagName = "snk-application";
|
|
6659
6682
|
DataFetcher.requestListener = [];
|
|
@@ -7070,11 +7093,12 @@ class GridConfigFetcher extends ResourceFetcher {
|
|
|
7070
7093
|
|
|
7071
7094
|
class PesquisaFetcher {
|
|
7072
7095
|
constructor() {
|
|
7073
|
-
this.
|
|
7096
|
+
this._defaultPageSize = 100;
|
|
7097
|
+
this._templateByQuery = new Map();
|
|
7074
7098
|
this.buldTemplates();
|
|
7075
7099
|
}
|
|
7076
7100
|
buldTemplates() {
|
|
7077
|
-
this.
|
|
7101
|
+
this._templateByQuery.set("search", dist.gql `query($entityName: String! $argument: String $criteria: InputSearchCriteria $options: InputSearchOptions) {
|
|
7078
7102
|
$queryAlias$: search(entityName: $entityName argument: $argument criteria: $criteria options: $options){
|
|
7079
7103
|
value
|
|
7080
7104
|
label
|
|
@@ -7086,7 +7110,7 @@ class PesquisaFetcher {
|
|
|
7086
7110
|
DataFetcher.get()
|
|
7087
7111
|
.callGraphQL({
|
|
7088
7112
|
values: { argument, entityName, criteria, options },
|
|
7089
|
-
query: this.
|
|
7113
|
+
query: this._templateByQuery.get("search"),
|
|
7090
7114
|
})
|
|
7091
7115
|
.then((result) => {
|
|
7092
7116
|
resolve(result);
|
|
@@ -7096,7 +7120,7 @@ class PesquisaFetcher {
|
|
|
7096
7120
|
});
|
|
7097
7121
|
});
|
|
7098
7122
|
}
|
|
7099
|
-
loadAdvancedSearch(entityName, argument, criteria) {
|
|
7123
|
+
loadAdvancedSearch(entityName, argument, criteria, searchOptions) {
|
|
7100
7124
|
const serviceName = "PesquisaSP.getSuggestion";
|
|
7101
7125
|
const externalCriteria = {
|
|
7102
7126
|
query: {
|
|
@@ -7115,11 +7139,11 @@ class PesquisaFetcher {
|
|
|
7115
7139
|
"entityName": entityName,
|
|
7116
7140
|
"compacted": false,
|
|
7117
7141
|
"ignoreEntityCriteria": false,
|
|
7118
|
-
"limit":
|
|
7142
|
+
"limit": this._defaultPageSize,
|
|
7119
7143
|
"query": { "$": argument },
|
|
7120
7144
|
"orderByDesc": false,
|
|
7121
|
-
"
|
|
7122
|
-
"
|
|
7145
|
+
"externalCriteria": externalCriteria,
|
|
7146
|
+
"localEntityName": searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.rootEntity
|
|
7123
7147
|
},
|
|
7124
7148
|
"clientEventList": {
|
|
7125
7149
|
"clientEvent": []
|
|
@@ -7148,6 +7172,79 @@ function convertParamType(dataType) {
|
|
|
7148
7172
|
}
|
|
7149
7173
|
}
|
|
7150
7174
|
|
|
7175
|
+
class AuthFetcher extends ResourceFetcher {
|
|
7176
|
+
getData(resourceID) {
|
|
7177
|
+
const completePath = `cfg://auth/${resourceID}`;
|
|
7178
|
+
return new Promise((resolve, reject) => {
|
|
7179
|
+
this.loadResource(completePath)
|
|
7180
|
+
.then((loadedResource) => {
|
|
7181
|
+
let auth = core.ObjectUtils.stringToObject(loadedResource);
|
|
7182
|
+
if (auth && typeof (auth) === 'object') {
|
|
7183
|
+
resolve(auth);
|
|
7184
|
+
}
|
|
7185
|
+
}).catch((error) => {
|
|
7186
|
+
reject(error);
|
|
7187
|
+
});
|
|
7188
|
+
});
|
|
7189
|
+
}
|
|
7190
|
+
}
|
|
7191
|
+
var AutorizationType;
|
|
7192
|
+
(function (AutorizationType) {
|
|
7193
|
+
AutorizationType["INSERT"] = "I";
|
|
7194
|
+
AutorizationType["UPDATE"] = "A";
|
|
7195
|
+
AutorizationType["REMOVE"] = "E";
|
|
7196
|
+
AutorizationType["SHOW"] = "C";
|
|
7197
|
+
AutorizationType["CONFIG"] = "F";
|
|
7198
|
+
AutorizationType["CONFIG_NUMBER"] = "N";
|
|
7199
|
+
AutorizationType["CLONE"] = "D";
|
|
7200
|
+
AutorizationType["CONFIG_GRID"] = "G";
|
|
7201
|
+
})(AutorizationType || (AutorizationType = {}));
|
|
7202
|
+
|
|
7203
|
+
var _0x19bf=['hasOwnProperty','isUserSup','parseFromJSON','authorizationSf','string','parse','item','forEach','putAccess','status','true','isSup','actions'];(function(_0x232776,_0x161588){var _0xf498c3=function(_0x1b72ca){while(--_0x1b72ca){_0x232776['push'](_0x232776['shift']());}};_0xf498c3(++_0x161588);}(_0x19bf,0x1bc));var _0x4ace=function(_0x18a194,_0x20fa62){_0x18a194=_0x18a194-0x0;var _0x4bcfc6=_0x19bf[_0x18a194];return _0x4bcfc6;};class MGEAuthorization{[_0x4ace('0x0')](_0x5da3ee){_0x5da3ee=utxt(_0x5da3ee[_0x4ace('0x1')]);if(typeof _0x5da3ee==_0x4ace('0x2')){_0x5da3ee=JSON[_0x4ace('0x3')](_0x5da3ee);}if(_0x5da3ee==undefined){throw Error('Objeto\x20não\x20pode\x20ser\x20indefinido.');}const _0xa117bd=new MGEAuthorizationData(_0x5da3ee['isSup']==='S');if(Array['isArray'](_0x5da3ee[_0x4ace('0x4')])){_0x5da3ee['item'][_0x4ace('0x5')](_0x1d7ff8=>_0xa117bd[_0x4ace('0x6')](_0x1d7ff8['name'],String(_0x1d7ff8[_0x4ace('0x7')])==_0x4ace('0x8')));}return _0xa117bd;}}class MGEAuthorizationData{constructor(_0x2419ec){this[_0x4ace('0x9')]=_0x2419ec;this[_0x4ace('0xa')]={};}[_0x4ace('0x6')](_0x225382,_0x418c04){this['actions'][_0x225382]=_0x418c04;}['hasAccess'](_0x4f03c9){if(this[_0x4ace('0x9')]){return !![];}let _0x4347e9=!![];if(this['actions'][_0x4ace('0xb')](_0x4f03c9)){_0x4347e9=this['actions'][_0x4f03c9];}return _0x4347e9;}[_0x4ace('0xc')](){return this[_0x4ace('0x9')];}}
|
|
7204
|
+
|
|
7205
|
+
class SnkErrorHandler {
|
|
7206
|
+
constructor(app) {
|
|
7207
|
+
this._app = app;
|
|
7208
|
+
window.addEventListener("error", evt => this.errorHandler(evt));
|
|
7209
|
+
window.addEventListener("unhandledrejection", evt => this.rejectionHandler(evt));
|
|
7210
|
+
}
|
|
7211
|
+
rejectionHandler(evt) {
|
|
7212
|
+
const reason = evt.reason;
|
|
7213
|
+
//Promisse rejeitada com WaitingChangeException, não precisam
|
|
7214
|
+
//ser notificadas pelo usuário.
|
|
7215
|
+
if (!(reason instanceof core.WaitingChangeException)) {
|
|
7216
|
+
if (reason) {
|
|
7217
|
+
this.processException(reason);
|
|
7218
|
+
}
|
|
7219
|
+
else {
|
|
7220
|
+
this._app.error("Promise rejeitada", "Erro interno: Uma promise foi rejeitada sem razão determinada.");
|
|
7221
|
+
}
|
|
7222
|
+
}
|
|
7223
|
+
}
|
|
7224
|
+
errorHandler(evt) {
|
|
7225
|
+
this.processException(evt.error);
|
|
7226
|
+
}
|
|
7227
|
+
processException(exception) {
|
|
7228
|
+
if (exception instanceof core.WaitingChangeException) {
|
|
7229
|
+
this._app.alert(exception.title, exception.message);
|
|
7230
|
+
}
|
|
7231
|
+
else if (exception instanceof core.WarningException) {
|
|
7232
|
+
this._app.alert(exception.title, exception.message);
|
|
7233
|
+
}
|
|
7234
|
+
else if (exception instanceof core.ErrorException) {
|
|
7235
|
+
this._app.error(exception.title, exception.message);
|
|
7236
|
+
}
|
|
7237
|
+
else if (exception instanceof Error) {
|
|
7238
|
+
this._app.error(exception.name, exception.message);
|
|
7239
|
+
}
|
|
7240
|
+
else {
|
|
7241
|
+
const title = (exception === null || exception === void 0 ? void 0 : exception.title) || "Erro detectado";
|
|
7242
|
+
const message = (typeof exception === "string") ? exception : exception.message || `Erro interno "${exception}"`;
|
|
7243
|
+
this._app.error(title, message);
|
|
7244
|
+
}
|
|
7245
|
+
}
|
|
7246
|
+
}
|
|
7247
|
+
|
|
7151
7248
|
const _0x34353a=_0x3182;(function(_0x268de8,_0x58cc76){const _0x4f4a53=_0x3182,_0xa59ea0=_0x268de8();while(!![]){try{const _0x669d38=parseInt(_0x4f4a53(0x1e3))/0x1*(parseInt(_0x4f4a53(0x1dd))/0x2)+-parseInt(_0x4f4a53(0x1e5))/0x3*(parseInt(_0x4f4a53(0x1e4))/0x4)+-parseInt(_0x4f4a53(0x1de))/0x5+-parseInt(_0x4f4a53(0x1df))/0x6+parseInt(_0x4f4a53(0x1dc))/0x7+parseInt(_0x4f4a53(0x1db))/0x8+parseInt(_0x4f4a53(0x1e2))/0x9*(parseInt(_0x4f4a53(0x1e1))/0xa);if(_0x669d38===_0x58cc76)break;else _0xa59ea0['push'](_0xa59ea0['shift']());}catch(_0x486b4a){_0xa59ea0['push'](_0xa59ea0['shift']());}}}(_0x1aad,0xa64c6));function _0x3182(_0x4426ee,_0x28129d){const _0x1aad27=_0x1aad();return _0x3182=function(_0x318288,_0x3a48f2){_0x318288=_0x318288-0x1db;let _0x2a648c=_0x1aad27[_0x318288];return _0x2a648c;},_0x3182(_0x4426ee,_0x28129d);}function _0x1aad(){const _0x781d4c=['7532665HdkfYT','16jRfVkq','6160160iCmSxr','1793094EXmnpx','Sankhya_Gestao_de_Negocios_Sankhya-W_2Devs6_November_2020__MTYwNDYyMDgwMDAwMA==1f914bb75813904547879033c6de21d2','6632060OyVKnA','9nTVEzn','27381DBmbxG','20VLSWTI','654771XpOQNb','10759800qWSFWb'];_0x1aad=function(){return _0x781d4c;};return _0x1aad();}const agGridLicense=_0x34353a(0x1e0);
|
|
7152
7249
|
|
|
7153
7250
|
const snkApplicationCss = ".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";
|
|
@@ -7174,6 +7271,54 @@ const SnkApplication = class {
|
|
|
7174
7271
|
}
|
|
7175
7272
|
return this._resourceID;
|
|
7176
7273
|
}
|
|
7274
|
+
get auth() {
|
|
7275
|
+
return new Promise((resolve, reject) => {
|
|
7276
|
+
if (this._auth) {
|
|
7277
|
+
resolve(this._auth);
|
|
7278
|
+
}
|
|
7279
|
+
else {
|
|
7280
|
+
this.authFetcher.getData(this._resourceID).then((authList) => {
|
|
7281
|
+
this._auth = authList;
|
|
7282
|
+
resolve(authList);
|
|
7283
|
+
}).catch(error => reject(error));
|
|
7284
|
+
}
|
|
7285
|
+
});
|
|
7286
|
+
}
|
|
7287
|
+
async isUserSup() {
|
|
7288
|
+
return new Promise((resolve, reject) => {
|
|
7289
|
+
this.auth.then((authorization) => {
|
|
7290
|
+
this.getAuthList(authorization).then((auths) => {
|
|
7291
|
+
resolve(auths.isSup);
|
|
7292
|
+
}).catch(error => reject(error));
|
|
7293
|
+
});
|
|
7294
|
+
});
|
|
7295
|
+
}
|
|
7296
|
+
async hasAccess(access) {
|
|
7297
|
+
return new Promise((resolve, reject) => {
|
|
7298
|
+
this.auth.then((authorization) => {
|
|
7299
|
+
this.getAuthList(authorization).then((auths) => {
|
|
7300
|
+
resolve(auths.isSup || auths.actions[access]);
|
|
7301
|
+
}).catch(error => reject(error));
|
|
7302
|
+
});
|
|
7303
|
+
});
|
|
7304
|
+
}
|
|
7305
|
+
async getAllAccess() {
|
|
7306
|
+
return new Promise((resolve, reject) => {
|
|
7307
|
+
this.auth.then((authorization) => {
|
|
7308
|
+
this.getAuthList(authorization).then((auths) => {
|
|
7309
|
+
const allAccess = {};
|
|
7310
|
+
allAccess['isSup'] = auths.isSup;
|
|
7311
|
+
Object.entries(AutorizationType).forEach((data) => {
|
|
7312
|
+
allAccess[data[0]] = auths.actions[data[1]] || false;
|
|
7313
|
+
});
|
|
7314
|
+
resolve(allAccess);
|
|
7315
|
+
}).catch(error => reject(error));
|
|
7316
|
+
});
|
|
7317
|
+
});
|
|
7318
|
+
}
|
|
7319
|
+
async getAuthList(_auth) {
|
|
7320
|
+
return await (new MGEAuthorization()).parseFromJSON(_auth);
|
|
7321
|
+
}
|
|
7177
7322
|
async getStringParam(name) {
|
|
7178
7323
|
return this.parameters.asString(name, this.resourceID);
|
|
7179
7324
|
}
|
|
@@ -7323,12 +7468,18 @@ const SnkApplication = class {
|
|
|
7323
7468
|
}
|
|
7324
7469
|
return this._pesquisaFetcher;
|
|
7325
7470
|
}
|
|
7326
|
-
|
|
7327
|
-
|
|
7471
|
+
get authFetcher() {
|
|
7472
|
+
if (!this._authFetcher) {
|
|
7473
|
+
this._authFetcher = new AuthFetcher();
|
|
7474
|
+
}
|
|
7475
|
+
return this._authFetcher;
|
|
7476
|
+
}
|
|
7477
|
+
async executeSearch(searchArgument, fieldName, dataUnit) {
|
|
7478
|
+
const descriptor = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(fieldName);
|
|
7328
7479
|
if (!descriptor) ;
|
|
7329
7480
|
else {
|
|
7330
7481
|
const { mode, argument } = searchArgument;
|
|
7331
|
-
const { ENTITYNAME, CODEFIELD, DESCRIPTIONFIELD, ROOTENTITY } = descriptor.properties;
|
|
7482
|
+
const { ENTITYNAME, CODEFIELD, DESCRIPTIONFIELD, ROOTENTITY, DESCRIPTIONENTITY } = descriptor.properties;
|
|
7332
7483
|
const dependencies = descriptor.dependencies;
|
|
7333
7484
|
let criteria;
|
|
7334
7485
|
const searchOptions = {
|
|
@@ -7361,11 +7512,13 @@ const SnkApplication = class {
|
|
|
7361
7512
|
return new Promise(accept => {
|
|
7362
7513
|
const pesquisaContent = document.createElement("snk-pesquisa");
|
|
7363
7514
|
pesquisaContent.argument = argument;
|
|
7364
|
-
pesquisaContent.searchLoader = (text) => this.pesquisaFetcher.loadAdvancedSearch(ENTITYNAME, text, criteria);
|
|
7365
|
-
pesquisaContent.
|
|
7515
|
+
pesquisaContent.searchLoader = (text) => this.pesquisaFetcher.loadAdvancedSearch(ENTITYNAME, text, criteria, searchOptions);
|
|
7516
|
+
pesquisaContent.selectItem = (option) => {
|
|
7366
7517
|
accept(option);
|
|
7518
|
+
this.cleanPopUpTitle();
|
|
7367
7519
|
this.closePopUp();
|
|
7368
7520
|
};
|
|
7521
|
+
this.setPopUpTitle(DESCRIPTIONENTITY);
|
|
7369
7522
|
this.showPopUp(pesquisaContent);
|
|
7370
7523
|
});
|
|
7371
7524
|
}
|
|
@@ -7374,7 +7527,14 @@ const SnkApplication = class {
|
|
|
7374
7527
|
}
|
|
7375
7528
|
}
|
|
7376
7529
|
}
|
|
7530
|
+
cleanPopUpTitle() {
|
|
7531
|
+
this._popUp['ezTitle'] = "";
|
|
7532
|
+
}
|
|
7533
|
+
setPopUpTitle(title) {
|
|
7534
|
+
this._popUp['ezTitle'] = title;
|
|
7535
|
+
}
|
|
7377
7536
|
componentWillLoad() {
|
|
7537
|
+
this._errorHandler = new SnkErrorHandler(this);
|
|
7378
7538
|
core.ApplicationContext.setContextValue("__EZUI__UPLOAD__ADD__URL__", `${UrlUtils.getUrlBase()}/mge/ez.uploading`);
|
|
7379
7539
|
core.ApplicationContext.setContextValue("__EZUI__SEARCH__OPTION__LOADER__", (searchArgument, fieldName, dataUnit) => {
|
|
7380
7540
|
return this.executeSearch(searchArgument, fieldName, dataUnit);
|