@sankhyalabs/sankhyablocks 1.1.14 → 1.1.17
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/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +78 -4
- package/dist/collection/components/snk-application/snk-application.js +40 -5
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +24 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/resource-fetcher.js +30 -0
- package/dist/components/snk-application.js +80 -5
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-application.entry.js +78 -4
- package/dist/sankhyablocks/p-5d41973e.entry.js +57 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +5 -0
- package/dist/types/components.d.ts +2 -0
- package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +4 -1
- package/dist/types/lib/http/data-fetcher/fetchers/resource-fetcher.d.ts +6 -0
- package/package.json +4 -5
- package/dist/sankhyablocks/p-ba60812c.entry.js +0 -53
- package/react/components.d.ts +0 -3
- package/react/components.js +0 -6
- package/react/components.js.map +0 -1
- package/react/react-component-lib/createComponent.d.ts +0 -10
- package/react/react-component-lib/createComponent.js +0 -75
- package/react/react-component-lib/createComponent.js.map +0 -1
- package/react/react-component-lib/createOverlayComponent.d.ts +0 -21
- package/react/react-component-lib/createOverlayComponent.js +0 -109
- package/react/react-component-lib/createOverlayComponent.js.map +0 -1
- package/react/react-component-lib/index.d.ts +0 -2
- package/react/react-component-lib/index.js +0 -3
- package/react/react-component-lib/index.js.map +0 -1
- package/react/react-component-lib/interfaces.d.ts +0 -29
- package/react/react-component-lib/interfaces.js +0 -1
- package/react/react-component-lib/interfaces.js.map +0 -1
- package/react/react-component-lib/utils/attachProps.d.ts +0 -12
- package/react/react-component-lib/utils/attachProps.js +0 -98
- package/react/react-component-lib/utils/attachProps.js.map +0 -1
- package/react/react-component-lib/utils/case.d.ts +0 -2
- package/react/react-component-lib/utils/case.js +0 -7
- package/react/react-component-lib/utils/case.js.map +0 -1
- package/react/react-component-lib/utils/dev.d.ts +0 -2
- package/react/react-component-lib/utils/dev.js +0 -13
- package/react/react-component-lib/utils/dev.js.map +0 -1
- package/react/react-component-lib/utils/index.d.ts +0 -10
- package/react/react-component-lib/utils/index.js +0 -34
- package/react/react-component-lib/utils/index.js.map +0 -1
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -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-application.cjs",[[2,"snk-application",{"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"temOpcional":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64]}]]]], options);
|
|
17
|
+
return index.bootstrapLazy([["snk-application.cjs",[[2,"snk-application",{"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"temOpcional":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["snk-application.cjs",[[2,"snk-application",{"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"temOpcional":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64]}]]]], options);
|
|
18
|
+
return index.bootstrapLazy([["snk-application.cjs",[[2,"snk-application",{"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"temOpcional":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64]}]]]], options);
|
|
19
19
|
});
|
|
@@ -1167,6 +1167,17 @@ var UserInterface;
|
|
|
1167
1167
|
UserInterface["HTML"] = "HTML";
|
|
1168
1168
|
})(UserInterface || (UserInterface = {}));
|
|
1169
1169
|
|
|
1170
|
+
var LoadStatus;
|
|
1171
|
+
(function (LoadStatus) {
|
|
1172
|
+
LoadStatus["DOM_LOADED"] = "DOM_LOADED";
|
|
1173
|
+
LoadStatus["PRE_INITIALIZE"] = "PRE_INITIALIZE";
|
|
1174
|
+
LoadStatus["LOADED"] = "LOADED";
|
|
1175
|
+
})(LoadStatus || (LoadStatus = {}));
|
|
1176
|
+
var LoadType;
|
|
1177
|
+
(function (LoadType) {
|
|
1178
|
+
LoadType["APP_LOAD"] = "APP_LOAD";
|
|
1179
|
+
})(LoadType || (LoadType = {}));
|
|
1180
|
+
|
|
1170
1181
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
1171
1182
|
|
|
1172
1183
|
function createCommonjsModule(fn, basedir, module) {
|
|
@@ -7745,6 +7756,60 @@ class ApplicationUtils {
|
|
|
7745
7756
|
}
|
|
7746
7757
|
}
|
|
7747
7758
|
|
|
7759
|
+
class ResourceFetcher {
|
|
7760
|
+
constructor() {
|
|
7761
|
+
this.templateByQuery = new Map();
|
|
7762
|
+
this.buldTemplates();
|
|
7763
|
+
}
|
|
7764
|
+
buldTemplates() {
|
|
7765
|
+
this.templateByQuery.set("fetchResource", dist.gql `query($name: String!) {
|
|
7766
|
+
$queryAlias$: fetchResource(name: $name){
|
|
7767
|
+
resource
|
|
7768
|
+
}
|
|
7769
|
+
}`);
|
|
7770
|
+
}
|
|
7771
|
+
loadResource(name) {
|
|
7772
|
+
return new Promise((resolve, reject) => {
|
|
7773
|
+
HttpFetcher.get()
|
|
7774
|
+
.callGraphQL({
|
|
7775
|
+
values: { name },
|
|
7776
|
+
query: this.templateByQuery.get("fetchResource"),
|
|
7777
|
+
})
|
|
7778
|
+
.then((result) => {
|
|
7779
|
+
resolve(result === null || result === void 0 ? void 0 : result.resource);
|
|
7780
|
+
})
|
|
7781
|
+
.catch((error) => {
|
|
7782
|
+
reject(error);
|
|
7783
|
+
});
|
|
7784
|
+
});
|
|
7785
|
+
}
|
|
7786
|
+
}
|
|
7787
|
+
|
|
7788
|
+
class FormConfigFetcher extends ResourceFetcher {
|
|
7789
|
+
loadFormConfig(formName, resourceID) {
|
|
7790
|
+
return new Promise((accept, reject) => {
|
|
7791
|
+
this.loadResource(`cfg://form/${resourceID}/${formName}`)
|
|
7792
|
+
.then((configAsString) => {
|
|
7793
|
+
if (configAsString) {
|
|
7794
|
+
const config = JSON.parse(configAsString);
|
|
7795
|
+
const { tabs, fields } = config;
|
|
7796
|
+
if (tabs) {
|
|
7797
|
+
const allTabs = new Map(tabs.map(t => [t.tabKey, t]));
|
|
7798
|
+
fields.forEach(f => f.tab = allTabs.get(f.tab));
|
|
7799
|
+
}
|
|
7800
|
+
accept(fields);
|
|
7801
|
+
}
|
|
7802
|
+
else {
|
|
7803
|
+
reject(`Sem configuração pro formulário "${formName}".`);
|
|
7804
|
+
}
|
|
7805
|
+
})
|
|
7806
|
+
.catch((error) => {
|
|
7807
|
+
reject(error);
|
|
7808
|
+
});
|
|
7809
|
+
});
|
|
7810
|
+
}
|
|
7811
|
+
}
|
|
7812
|
+
|
|
7748
7813
|
const snkApplicationCss = ".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";
|
|
7749
7814
|
|
|
7750
7815
|
const SnkApplication = class {
|
|
@@ -7822,18 +7887,21 @@ const SnkApplication = class {
|
|
|
7822
7887
|
async getResourceID() {
|
|
7823
7888
|
return Promise.resolve(this.resourceID);
|
|
7824
7889
|
}
|
|
7825
|
-
alert(title, message, icon) {
|
|
7890
|
+
async alert(title, message, icon) {
|
|
7826
7891
|
return ApplicationUtils.alert(title, message, icon);
|
|
7827
7892
|
}
|
|
7828
|
-
error(title, message, icon) {
|
|
7893
|
+
async error(title, message, icon) {
|
|
7829
7894
|
return ApplicationUtils.error(title, message, icon);
|
|
7830
7895
|
}
|
|
7831
|
-
confirm(title, message, icon, critical) {
|
|
7896
|
+
async confirm(title, message, icon, critical) {
|
|
7832
7897
|
return ApplicationUtils.confirm(title, message, icon, critical);
|
|
7833
7898
|
}
|
|
7834
|
-
info(message) {
|
|
7899
|
+
async info(message) {
|
|
7835
7900
|
return ApplicationUtils.info(message);
|
|
7836
7901
|
}
|
|
7902
|
+
async loadFormConfig(name) {
|
|
7903
|
+
return this.formConfigFetcher.loadFormConfig(name, this.resourceID);
|
|
7904
|
+
}
|
|
7837
7905
|
get urlParams() {
|
|
7838
7906
|
if (!this._urlParams) {
|
|
7839
7907
|
this._urlParams = UrlUtils.getQueryParams(location.search);
|
|
@@ -7846,6 +7914,12 @@ const SnkApplication = class {
|
|
|
7846
7914
|
}
|
|
7847
7915
|
return this._dataUnitFetcher;
|
|
7848
7916
|
}
|
|
7917
|
+
get formConfigFetcher() {
|
|
7918
|
+
if (!this._formConfigFetcher) {
|
|
7919
|
+
this._formConfigFetcher = new FormConfigFetcher();
|
|
7920
|
+
}
|
|
7921
|
+
return this._formConfigFetcher;
|
|
7922
|
+
}
|
|
7849
7923
|
componentDidLoad() {
|
|
7850
7924
|
this.applicationLoading.emit(true);
|
|
7851
7925
|
window.requestAnimationFrame(() => {
|
|
@@ -6,7 +6,7 @@ import ParametersFetcher from "../../lib/http/data-fetcher/fetchers/parameters-f
|
|
|
6
6
|
//FIXME: temporariamente estamos compiando essa classe do ezui pois não conseguimos
|
|
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
10
|
export class SnkApplication {
|
|
11
11
|
get parameters() {
|
|
12
12
|
if (!this._parameters) {
|
|
@@ -77,18 +77,21 @@ export class SnkApplication {
|
|
|
77
77
|
async getResourceID() {
|
|
78
78
|
return Promise.resolve(this.resourceID);
|
|
79
79
|
}
|
|
80
|
-
alert(title, message, icon) {
|
|
80
|
+
async alert(title, message, icon) {
|
|
81
81
|
return ApplicationUtils.alert(title, message, icon);
|
|
82
82
|
}
|
|
83
|
-
error(title, message, icon) {
|
|
83
|
+
async error(title, message, icon) {
|
|
84
84
|
return ApplicationUtils.error(title, message, icon);
|
|
85
85
|
}
|
|
86
|
-
confirm(title, message, icon, critical) {
|
|
86
|
+
async confirm(title, message, icon, critical) {
|
|
87
87
|
return ApplicationUtils.confirm(title, message, icon, critical);
|
|
88
88
|
}
|
|
89
|
-
info(message) {
|
|
89
|
+
async info(message) {
|
|
90
90
|
return ApplicationUtils.info(message);
|
|
91
91
|
}
|
|
92
|
+
async loadFormConfig(name) {
|
|
93
|
+
return this.formConfigFetcher.loadFormConfig(name, this.resourceID);
|
|
94
|
+
}
|
|
92
95
|
get urlParams() {
|
|
93
96
|
if (!this._urlParams) {
|
|
94
97
|
this._urlParams = UrlUtils.getQueryParams(location.search);
|
|
@@ -101,6 +104,12 @@ export class SnkApplication {
|
|
|
101
104
|
}
|
|
102
105
|
return this._dataUnitFetcher;
|
|
103
106
|
}
|
|
107
|
+
get formConfigFetcher() {
|
|
108
|
+
if (!this._formConfigFetcher) {
|
|
109
|
+
this._formConfigFetcher = new FormConfigFetcher();
|
|
110
|
+
}
|
|
111
|
+
return this._formConfigFetcher;
|
|
112
|
+
}
|
|
104
113
|
componentDidLoad() {
|
|
105
114
|
this.applicationLoading.emit(true);
|
|
106
115
|
window.requestAnimationFrame(() => {
|
|
@@ -446,6 +455,32 @@ export class SnkApplication {
|
|
|
446
455
|
"text": "",
|
|
447
456
|
"tags": []
|
|
448
457
|
}
|
|
458
|
+
},
|
|
459
|
+
"loadFormConfig": {
|
|
460
|
+
"complexType": {
|
|
461
|
+
"signature": "(name: string) => Promise<Array<FieldConfig>>",
|
|
462
|
+
"parameters": [{
|
|
463
|
+
"tags": [],
|
|
464
|
+
"text": ""
|
|
465
|
+
}],
|
|
466
|
+
"references": {
|
|
467
|
+
"Promise": {
|
|
468
|
+
"location": "global"
|
|
469
|
+
},
|
|
470
|
+
"FieldConfig": {
|
|
471
|
+
"location": "import",
|
|
472
|
+
"path": "@sankhyalabs/ezui/dist/types/components/ez-form/ez-form"
|
|
473
|
+
},
|
|
474
|
+
"Array": {
|
|
475
|
+
"location": "global"
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
"return": "Promise<FieldConfig[]>"
|
|
479
|
+
},
|
|
480
|
+
"docs": {
|
|
481
|
+
"text": "",
|
|
482
|
+
"tags": []
|
|
483
|
+
}
|
|
449
484
|
}
|
|
450
485
|
}; }
|
|
451
486
|
}
|
|
@@ -1,2 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
import { ResourceFetcher } from "./resource-fetcher";
|
|
2
|
+
export class FormConfigFetcher extends ResourceFetcher {
|
|
3
|
+
loadFormConfig(formName, resourceID) {
|
|
4
|
+
return new Promise((accept, reject) => {
|
|
5
|
+
this.loadResource(`cfg://form/${resourceID}/${formName}`)
|
|
6
|
+
.then((configAsString) => {
|
|
7
|
+
if (configAsString) {
|
|
8
|
+
const config = JSON.parse(configAsString);
|
|
9
|
+
const { tabs, fields } = config;
|
|
10
|
+
if (tabs) {
|
|
11
|
+
const allTabs = new Map(tabs.map(t => [t.tabKey, t]));
|
|
12
|
+
fields.forEach(f => f.tab = allTabs.get(f.tab));
|
|
13
|
+
}
|
|
14
|
+
accept(fields);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
reject(`Sem configuração pro formulário "${formName}".`);
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
.catch((error) => {
|
|
21
|
+
reject(error);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}
|
|
2
25
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { gql } from "graphql-request";
|
|
2
|
+
import { HttpFetcher } from "../DataFetcher";
|
|
3
|
+
export class ResourceFetcher {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.templateByQuery = new Map();
|
|
6
|
+
this.buldTemplates();
|
|
7
|
+
}
|
|
8
|
+
buldTemplates() {
|
|
9
|
+
this.templateByQuery.set("fetchResource", gql `query($name: String!) {
|
|
10
|
+
$queryAlias$: fetchResource(name: $name){
|
|
11
|
+
resource
|
|
12
|
+
}
|
|
13
|
+
}`);
|
|
14
|
+
}
|
|
15
|
+
loadResource(name) {
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
HttpFetcher.get()
|
|
18
|
+
.callGraphQL({
|
|
19
|
+
values: { name },
|
|
20
|
+
query: this.templateByQuery.get("fetchResource"),
|
|
21
|
+
})
|
|
22
|
+
.then((result) => {
|
|
23
|
+
resolve(result === null || result === void 0 ? void 0 : result.resource);
|
|
24
|
+
})
|
|
25
|
+
.catch((error) => {
|
|
26
|
+
reject(error);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -1163,6 +1163,17 @@ var UserInterface;
|
|
|
1163
1163
|
UserInterface["HTML"] = "HTML";
|
|
1164
1164
|
})(UserInterface || (UserInterface = {}));
|
|
1165
1165
|
|
|
1166
|
+
var LoadStatus;
|
|
1167
|
+
(function (LoadStatus) {
|
|
1168
|
+
LoadStatus["DOM_LOADED"] = "DOM_LOADED";
|
|
1169
|
+
LoadStatus["PRE_INITIALIZE"] = "PRE_INITIALIZE";
|
|
1170
|
+
LoadStatus["LOADED"] = "LOADED";
|
|
1171
|
+
})(LoadStatus || (LoadStatus = {}));
|
|
1172
|
+
var LoadType;
|
|
1173
|
+
(function (LoadType) {
|
|
1174
|
+
LoadType["APP_LOAD"] = "APP_LOAD";
|
|
1175
|
+
})(LoadType || (LoadType = {}));
|
|
1176
|
+
|
|
1166
1177
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
1167
1178
|
|
|
1168
1179
|
function createCommonjsModule(fn, basedir, module) {
|
|
@@ -7741,6 +7752,60 @@ class ApplicationUtils {
|
|
|
7741
7752
|
}
|
|
7742
7753
|
}
|
|
7743
7754
|
|
|
7755
|
+
class ResourceFetcher {
|
|
7756
|
+
constructor() {
|
|
7757
|
+
this.templateByQuery = new Map();
|
|
7758
|
+
this.buldTemplates();
|
|
7759
|
+
}
|
|
7760
|
+
buldTemplates() {
|
|
7761
|
+
this.templateByQuery.set("fetchResource", dist.gql `query($name: String!) {
|
|
7762
|
+
$queryAlias$: fetchResource(name: $name){
|
|
7763
|
+
resource
|
|
7764
|
+
}
|
|
7765
|
+
}`);
|
|
7766
|
+
}
|
|
7767
|
+
loadResource(name) {
|
|
7768
|
+
return new Promise((resolve, reject) => {
|
|
7769
|
+
HttpFetcher.get()
|
|
7770
|
+
.callGraphQL({
|
|
7771
|
+
values: { name },
|
|
7772
|
+
query: this.templateByQuery.get("fetchResource"),
|
|
7773
|
+
})
|
|
7774
|
+
.then((result) => {
|
|
7775
|
+
resolve(result === null || result === void 0 ? void 0 : result.resource);
|
|
7776
|
+
})
|
|
7777
|
+
.catch((error) => {
|
|
7778
|
+
reject(error);
|
|
7779
|
+
});
|
|
7780
|
+
});
|
|
7781
|
+
}
|
|
7782
|
+
}
|
|
7783
|
+
|
|
7784
|
+
class FormConfigFetcher extends ResourceFetcher {
|
|
7785
|
+
loadFormConfig(formName, resourceID) {
|
|
7786
|
+
return new Promise((accept, reject) => {
|
|
7787
|
+
this.loadResource(`cfg://form/${resourceID}/${formName}`)
|
|
7788
|
+
.then((configAsString) => {
|
|
7789
|
+
if (configAsString) {
|
|
7790
|
+
const config = JSON.parse(configAsString);
|
|
7791
|
+
const { tabs, fields } = config;
|
|
7792
|
+
if (tabs) {
|
|
7793
|
+
const allTabs = new Map(tabs.map(t => [t.tabKey, t]));
|
|
7794
|
+
fields.forEach(f => f.tab = allTabs.get(f.tab));
|
|
7795
|
+
}
|
|
7796
|
+
accept(fields);
|
|
7797
|
+
}
|
|
7798
|
+
else {
|
|
7799
|
+
reject(`Sem configuração pro formulário "${formName}".`);
|
|
7800
|
+
}
|
|
7801
|
+
})
|
|
7802
|
+
.catch((error) => {
|
|
7803
|
+
reject(error);
|
|
7804
|
+
});
|
|
7805
|
+
});
|
|
7806
|
+
}
|
|
7807
|
+
}
|
|
7808
|
+
|
|
7744
7809
|
const snkApplicationCss = ".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";
|
|
7745
7810
|
|
|
7746
7811
|
const SnkApplication$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
@@ -7819,18 +7884,21 @@ const SnkApplication$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
7819
7884
|
async getResourceID() {
|
|
7820
7885
|
return Promise.resolve(this.resourceID);
|
|
7821
7886
|
}
|
|
7822
|
-
alert(title, message, icon) {
|
|
7887
|
+
async alert(title, message, icon) {
|
|
7823
7888
|
return ApplicationUtils.alert(title, message, icon);
|
|
7824
7889
|
}
|
|
7825
|
-
error(title, message, icon) {
|
|
7890
|
+
async error(title, message, icon) {
|
|
7826
7891
|
return ApplicationUtils.error(title, message, icon);
|
|
7827
7892
|
}
|
|
7828
|
-
confirm(title, message, icon, critical) {
|
|
7893
|
+
async confirm(title, message, icon, critical) {
|
|
7829
7894
|
return ApplicationUtils.confirm(title, message, icon, critical);
|
|
7830
7895
|
}
|
|
7831
|
-
info(message) {
|
|
7896
|
+
async info(message) {
|
|
7832
7897
|
return ApplicationUtils.info(message);
|
|
7833
7898
|
}
|
|
7899
|
+
async loadFormConfig(name) {
|
|
7900
|
+
return this.formConfigFetcher.loadFormConfig(name, this.resourceID);
|
|
7901
|
+
}
|
|
7834
7902
|
get urlParams() {
|
|
7835
7903
|
if (!this._urlParams) {
|
|
7836
7904
|
this._urlParams = UrlUtils.getQueryParams(location.search);
|
|
@@ -7843,6 +7911,12 @@ const SnkApplication$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
7843
7911
|
}
|
|
7844
7912
|
return this._dataUnitFetcher;
|
|
7845
7913
|
}
|
|
7914
|
+
get formConfigFetcher() {
|
|
7915
|
+
if (!this._formConfigFetcher) {
|
|
7916
|
+
this._formConfigFetcher = new FormConfigFetcher();
|
|
7917
|
+
}
|
|
7918
|
+
return this._formConfigFetcher;
|
|
7919
|
+
}
|
|
7846
7920
|
componentDidLoad() {
|
|
7847
7921
|
this.applicationLoading.emit(true);
|
|
7848
7922
|
window.requestAnimationFrame(() => {
|
|
@@ -7867,7 +7941,8 @@ const SnkApplication$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
7867
7941
|
"alert": [64],
|
|
7868
7942
|
"error": [64],
|
|
7869
7943
|
"confirm": [64],
|
|
7870
|
-
"info": [64]
|
|
7944
|
+
"info": [64],
|
|
7945
|
+
"loadFormConfig": [64]
|
|
7871
7946
|
}]);
|
|
7872
7947
|
function defineCustomElement$1() {
|
|
7873
7948
|
if (typeof customElements === "undefined") {
|
package/dist/esm/loader.js
CHANGED
|
@@ -10,7 +10,7 @@ const patchEsm = () => {
|
|
|
10
10
|
const defineCustomElements = (win, options) => {
|
|
11
11
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
12
12
|
return patchEsm().then(() => {
|
|
13
|
-
return bootstrapLazy([["snk-application",[[2,"snk-application",{"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"temOpcional":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64]}]]]], options);
|
|
13
|
+
return bootstrapLazy([["snk-application",[[2,"snk-application",{"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"temOpcional":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64]}]]]], options);
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -13,5 +13,5 @@ const patchBrowser = () => {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
patchBrowser().then(options => {
|
|
16
|
-
return bootstrapLazy([["snk-application",[[2,"snk-application",{"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"temOpcional":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64]}]]]], options);
|
|
16
|
+
return bootstrapLazy([["snk-application",[[2,"snk-application",{"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"temOpcional":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64]}]]]], options);
|
|
17
17
|
});
|
|
@@ -1163,6 +1163,17 @@ var UserInterface;
|
|
|
1163
1163
|
UserInterface["HTML"] = "HTML";
|
|
1164
1164
|
})(UserInterface || (UserInterface = {}));
|
|
1165
1165
|
|
|
1166
|
+
var LoadStatus;
|
|
1167
|
+
(function (LoadStatus) {
|
|
1168
|
+
LoadStatus["DOM_LOADED"] = "DOM_LOADED";
|
|
1169
|
+
LoadStatus["PRE_INITIALIZE"] = "PRE_INITIALIZE";
|
|
1170
|
+
LoadStatus["LOADED"] = "LOADED";
|
|
1171
|
+
})(LoadStatus || (LoadStatus = {}));
|
|
1172
|
+
var LoadType;
|
|
1173
|
+
(function (LoadType) {
|
|
1174
|
+
LoadType["APP_LOAD"] = "APP_LOAD";
|
|
1175
|
+
})(LoadType || (LoadType = {}));
|
|
1176
|
+
|
|
1166
1177
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
1167
1178
|
|
|
1168
1179
|
function createCommonjsModule(fn, basedir, module) {
|
|
@@ -7741,6 +7752,60 @@ class ApplicationUtils {
|
|
|
7741
7752
|
}
|
|
7742
7753
|
}
|
|
7743
7754
|
|
|
7755
|
+
class ResourceFetcher {
|
|
7756
|
+
constructor() {
|
|
7757
|
+
this.templateByQuery = new Map();
|
|
7758
|
+
this.buldTemplates();
|
|
7759
|
+
}
|
|
7760
|
+
buldTemplates() {
|
|
7761
|
+
this.templateByQuery.set("fetchResource", dist.gql `query($name: String!) {
|
|
7762
|
+
$queryAlias$: fetchResource(name: $name){
|
|
7763
|
+
resource
|
|
7764
|
+
}
|
|
7765
|
+
}`);
|
|
7766
|
+
}
|
|
7767
|
+
loadResource(name) {
|
|
7768
|
+
return new Promise((resolve, reject) => {
|
|
7769
|
+
HttpFetcher.get()
|
|
7770
|
+
.callGraphQL({
|
|
7771
|
+
values: { name },
|
|
7772
|
+
query: this.templateByQuery.get("fetchResource"),
|
|
7773
|
+
})
|
|
7774
|
+
.then((result) => {
|
|
7775
|
+
resolve(result === null || result === void 0 ? void 0 : result.resource);
|
|
7776
|
+
})
|
|
7777
|
+
.catch((error) => {
|
|
7778
|
+
reject(error);
|
|
7779
|
+
});
|
|
7780
|
+
});
|
|
7781
|
+
}
|
|
7782
|
+
}
|
|
7783
|
+
|
|
7784
|
+
class FormConfigFetcher extends ResourceFetcher {
|
|
7785
|
+
loadFormConfig(formName, resourceID) {
|
|
7786
|
+
return new Promise((accept, reject) => {
|
|
7787
|
+
this.loadResource(`cfg://form/${resourceID}/${formName}`)
|
|
7788
|
+
.then((configAsString) => {
|
|
7789
|
+
if (configAsString) {
|
|
7790
|
+
const config = JSON.parse(configAsString);
|
|
7791
|
+
const { tabs, fields } = config;
|
|
7792
|
+
if (tabs) {
|
|
7793
|
+
const allTabs = new Map(tabs.map(t => [t.tabKey, t]));
|
|
7794
|
+
fields.forEach(f => f.tab = allTabs.get(f.tab));
|
|
7795
|
+
}
|
|
7796
|
+
accept(fields);
|
|
7797
|
+
}
|
|
7798
|
+
else {
|
|
7799
|
+
reject(`Sem configuração pro formulário "${formName}".`);
|
|
7800
|
+
}
|
|
7801
|
+
})
|
|
7802
|
+
.catch((error) => {
|
|
7803
|
+
reject(error);
|
|
7804
|
+
});
|
|
7805
|
+
});
|
|
7806
|
+
}
|
|
7807
|
+
}
|
|
7808
|
+
|
|
7744
7809
|
const snkApplicationCss = ".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";
|
|
7745
7810
|
|
|
7746
7811
|
const SnkApplication = class {
|
|
@@ -7818,18 +7883,21 @@ const SnkApplication = class {
|
|
|
7818
7883
|
async getResourceID() {
|
|
7819
7884
|
return Promise.resolve(this.resourceID);
|
|
7820
7885
|
}
|
|
7821
|
-
alert(title, message, icon) {
|
|
7886
|
+
async alert(title, message, icon) {
|
|
7822
7887
|
return ApplicationUtils.alert(title, message, icon);
|
|
7823
7888
|
}
|
|
7824
|
-
error(title, message, icon) {
|
|
7889
|
+
async error(title, message, icon) {
|
|
7825
7890
|
return ApplicationUtils.error(title, message, icon);
|
|
7826
7891
|
}
|
|
7827
|
-
confirm(title, message, icon, critical) {
|
|
7892
|
+
async confirm(title, message, icon, critical) {
|
|
7828
7893
|
return ApplicationUtils.confirm(title, message, icon, critical);
|
|
7829
7894
|
}
|
|
7830
|
-
info(message) {
|
|
7895
|
+
async info(message) {
|
|
7831
7896
|
return ApplicationUtils.info(message);
|
|
7832
7897
|
}
|
|
7898
|
+
async loadFormConfig(name) {
|
|
7899
|
+
return this.formConfigFetcher.loadFormConfig(name, this.resourceID);
|
|
7900
|
+
}
|
|
7833
7901
|
get urlParams() {
|
|
7834
7902
|
if (!this._urlParams) {
|
|
7835
7903
|
this._urlParams = UrlUtils.getQueryParams(location.search);
|
|
@@ -7842,6 +7910,12 @@ const SnkApplication = class {
|
|
|
7842
7910
|
}
|
|
7843
7911
|
return this._dataUnitFetcher;
|
|
7844
7912
|
}
|
|
7913
|
+
get formConfigFetcher() {
|
|
7914
|
+
if (!this._formConfigFetcher) {
|
|
7915
|
+
this._formConfigFetcher = new FormConfigFetcher();
|
|
7916
|
+
}
|
|
7917
|
+
return this._formConfigFetcher;
|
|
7918
|
+
}
|
|
7845
7919
|
componentDidLoad() {
|
|
7846
7920
|
this.applicationLoading.emit(true);
|
|
7847
7921
|
window.requestAnimationFrame(() => {
|