@sankhyalabs/sankhyablocks 1.3.31-beta.12 → 1.3.31-beta.14
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/{SnkMessageBuilder-13239761.js → SnkMessageBuilder-bb55d4c4.js} +2 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +60 -2
- package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
- package/dist/cjs/snk-form_2.cjs.entry.js +1 -1
- package/dist/cjs/snk-taskbar.cjs.entry.js +27 -30
- package/dist/cjs/{taskbar-elements-73d524e5.js → taskbar-elements-2888ceb6.js} +4 -0
- package/dist/collection/components/snk-application/snk-application.js +49 -1
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +4 -0
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +29 -30
- package/dist/collection/lib/http/data-fetcher/fetchers/totals-fetcher.js +47 -0
- package/dist/collection/lib/message/resources/snk-taskbar.msg.js +2 -1
- package/dist/components/SnkMessageBuilder.js +2 -1
- package/dist/components/snk-application2.js +60 -1
- package/dist/components/snk-taskbar2.js +30 -29
- package/dist/esm/{SnkMessageBuilder-3835f9d8.js → SnkMessageBuilder-17d91b88.js} +2 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-application.entry.js +60 -2
- package/dist/esm/snk-data-unit.entry.js +1 -1
- package/dist/esm/snk-form_2.entry.js +1 -1
- package/dist/esm/snk-taskbar.entry.js +27 -30
- package/dist/esm/{taskbar-elements-6d01a640.js → taskbar-elements-5ea74223.js} +5 -1
- package/dist/sankhyablocks/{p-962d9bdd.entry.js → p-825d2c38.entry.js} +7 -2
- package/dist/sankhyablocks/p-ab694dbc.js +1 -0
- package/dist/sankhyablocks/p-b559117b.js +1 -0
- package/dist/sankhyablocks/{p-2df33095.entry.js → p-ce2d1214.entry.js} +1 -1
- package/dist/sankhyablocks/p-d25803a1.entry.js +1 -0
- package/dist/sankhyablocks/{p-9b427c4c.entry.js → p-edf81d2c.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +8 -0
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +3 -0
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +15 -0
- package/dist/types/components.d.ts +5 -1
- package/dist/types/lib/http/data-fetcher/fetchers/totals-fetcher.d.ts +8 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-72bccbb6.js +0 -1
- package/dist/sankhyablocks/p-bab507ad.entry.js +0 -1
- package/dist/sankhyablocks/p-dd10a5e3.js +0 -1
|
@@ -64,8 +64,9 @@ const snkTaskbarMessages = {
|
|
|
64
64
|
titleCancel: "Cancelar",
|
|
65
65
|
titleSave: "Salvar",
|
|
66
66
|
titleGridMode: "Modo Grade",
|
|
67
|
+
titleFormMode: "Modo Formulário",
|
|
67
68
|
titleConfigGrid: "Configuração da grade",
|
|
68
|
-
|
|
69
|
+
forbidden: "Permissão não liberada"
|
|
69
70
|
};
|
|
70
71
|
|
|
71
72
|
class SnkMessageBuilder {
|
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-crud.cjs",[[6,"snk-crud",{"configName":[1,"config-name"],"actionsList":[16],"recordsValidator":[16],"_dataUnit":[32],"_dataState":[32]}]]],["teste-pesquisa.cjs",[[1,"teste-pesquisa"]]],["snk-data-unit.cjs",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"beforeSave":[16],"afterSave":[16],"autoLoad":[4,"auto-load"],"getDataUnit":[64]}]]],["snk-application.cjs",[[2,"snk-application",{"messagesBuilder":[1040],"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],"getDataUnit":[64],"getResourceID":[64],"alert":[64],"error":[64],"message":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"saveGridConfig":[64],"executeSearch":[64],"isDebugMode":[64]}]]],["snk-form_2.cjs",[[2,"snk-form",{"configName":[1,"config-name"],"recordsValidator":[16],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32],"_editionFormConfig":[32],"_insertionFormConfig":[32]}],[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32],"_gridConfig":[32]}]]],["snk-pesquisa.cjs",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-taskbar.cjs",[[6,"snk-taskbar",{"buttons":[1],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_permissions":[32]}]]]], options);
|
|
17
|
+
return index.bootstrapLazy([["snk-crud.cjs",[[6,"snk-crud",{"configName":[1,"config-name"],"actionsList":[16],"recordsValidator":[16],"_dataUnit":[32],"_dataState":[32]}]]],["teste-pesquisa.cjs",[[1,"teste-pesquisa"]]],["snk-data-unit.cjs",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"beforeSave":[16],"afterSave":[16],"autoLoad":[4,"auto-load"],"getDataUnit":[64]}]]],["snk-application.cjs",[[2,"snk-application",{"messagesBuilder":[1040],"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],"getDataUnit":[64],"getResourceID":[64],"alert":[64],"error":[64],"message":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"loadTotals":[64],"saveGridConfig":[64],"executeSearch":[64],"isDebugMode":[64]}]]],["snk-form_2.cjs",[[2,"snk-form",{"configName":[1,"config-name"],"recordsValidator":[16],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32],"_editionFormConfig":[32],"_insertionFormConfig":[32]}],[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32],"_gridConfig":[32]}]]],["snk-pesquisa.cjs",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-taskbar.cjs",[[6,"snk-taskbar",{"buttons":[1],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_permissions":[32]}]]]], 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-crud.cjs",[[6,"snk-crud",{"configName":[1,"config-name"],"actionsList":[16],"recordsValidator":[16],"_dataUnit":[32],"_dataState":[32]}]]],["teste-pesquisa.cjs",[[1,"teste-pesquisa"]]],["snk-data-unit.cjs",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"beforeSave":[16],"afterSave":[16],"autoLoad":[4,"auto-load"],"getDataUnit":[64]}]]],["snk-application.cjs",[[2,"snk-application",{"messagesBuilder":[1040],"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],"getDataUnit":[64],"getResourceID":[64],"alert":[64],"error":[64],"message":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"saveGridConfig":[64],"executeSearch":[64],"isDebugMode":[64]}]]],["snk-form_2.cjs",[[2,"snk-form",{"configName":[1,"config-name"],"recordsValidator":[16],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32],"_editionFormConfig":[32],"_insertionFormConfig":[32]}],[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32],"_gridConfig":[32]}]]],["snk-pesquisa.cjs",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-taskbar.cjs",[[6,"snk-taskbar",{"buttons":[1],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_permissions":[32]}]]]], options);
|
|
18
|
+
return index.bootstrapLazy([["snk-crud.cjs",[[6,"snk-crud",{"configName":[1,"config-name"],"actionsList":[16],"recordsValidator":[16],"_dataUnit":[32],"_dataState":[32]}]]],["teste-pesquisa.cjs",[[1,"teste-pesquisa"]]],["snk-data-unit.cjs",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"beforeSave":[16],"afterSave":[16],"autoLoad":[4,"auto-load"],"getDataUnit":[64]}]]],["snk-application.cjs",[[2,"snk-application",{"messagesBuilder":[1040],"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],"getDataUnit":[64],"getResourceID":[64],"alert":[64],"error":[64],"message":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"loadTotals":[64],"saveGridConfig":[64],"executeSearch":[64],"isDebugMode":[64]}]]],["snk-form_2.cjs",[[2,"snk-form",{"configName":[1,"config-name"],"recordsValidator":[16],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32],"_editionFormConfig":[32],"_insertionFormConfig":[32]}],[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32],"_gridConfig":[32]}]]],["snk-pesquisa.cjs",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-taskbar.cjs",[[6,"snk-taskbar",{"buttons":[1],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_permissions":[32]}]]]], options);
|
|
19
19
|
});
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-c6671817.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
7
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
8
|
-
const SnkMessageBuilder = require('./SnkMessageBuilder-
|
|
8
|
+
const SnkMessageBuilder = require('./SnkMessageBuilder-bb55d4c4.js');
|
|
9
9
|
|
|
10
10
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
11
11
|
|
|
@@ -7282,6 +7282,52 @@ class SnkErrorHandler {
|
|
|
7282
7282
|
|
|
7283
7283
|
function _0x53e1(){const _0x340df8=['2909523kXwted','CompanyName=Sankhya\x20Jiva\x20Tecnologia\x20e\x20Inovao\x20Ltda,LicensedApplication=Sankhya\x20Gestao,LicenseType=SingleApplication,LicensedConcurrentDeveloperCount=2,LicensedProductionInstancesCount=0,AssetReference=AG-019460,ExpiryDate=9_November_2022_[v2]_MTY2Nzk1MjAwMDAwMA==10487151e296ee4360f80961ca960869','1131048CARoeW','502909mLEPmu','447255iQEXuN','428UHbJwW','270AFTxAV','194369jhGqTI','1540nWuTrj','2044062GicUQI','30CkXPWg'];_0x53e1=function(){return _0x340df8;};return _0x53e1();}const _0xc7632f=_0x15c2;function _0x15c2(_0x353a9c,_0x3e4a5a){const _0x53e110=_0x53e1();return _0x15c2=function(_0x15c2aa,_0x219858){_0x15c2aa=_0x15c2aa-0x188;let _0x307231=_0x53e110[_0x15c2aa];return _0x307231;},_0x15c2(_0x353a9c,_0x3e4a5a);}(function(_0x42617e,_0x57debe){const _0x31061a=_0x15c2,_0x128d7d=_0x42617e();while(!![]){try{const _0x1c9bb1=-parseInt(_0x31061a(0x18e))/0x1+-parseInt(_0x31061a(0x189))/0x2+parseInt(_0x31061a(0x18b))/0x3+-parseInt(_0x31061a(0x190))/0x4*(parseInt(_0x31061a(0x188))/0x5)+-parseInt(_0x31061a(0x191))/0x6*(-parseInt(_0x31061a(0x192))/0x7)+parseInt(_0x31061a(0x18d))/0x8+-parseInt(_0x31061a(0x18f))/0x9*(-parseInt(_0x31061a(0x18a))/0xa);if(_0x1c9bb1===_0x57debe)break;else _0x128d7d['push'](_0x128d7d['shift']());}catch(_0x1bd816){_0x128d7d['push'](_0x128d7d['shift']());}}}(_0x53e1,0xe8676));const agGridLicense=_0xc7632f(0x18c);
|
|
7284
7284
|
|
|
7285
|
+
class TotalsFetcher {
|
|
7286
|
+
constructor() {
|
|
7287
|
+
this.templateByQuery = new Map();
|
|
7288
|
+
this.buldTemplates();
|
|
7289
|
+
}
|
|
7290
|
+
buldTemplates() {
|
|
7291
|
+
this.templateByQuery.set("fetchTotals", dist.gql `query($filters: [InputFilter!] $name: String!) {
|
|
7292
|
+
$queryAlias$: fetchTotals(name: $name, filters: $filters ){
|
|
7293
|
+
name
|
|
7294
|
+
value
|
|
7295
|
+
}
|
|
7296
|
+
}`);
|
|
7297
|
+
}
|
|
7298
|
+
async getTotals(name, resourceID, filters) {
|
|
7299
|
+
const path = `totals://${name}/${resourceID}`;
|
|
7300
|
+
let variables = {
|
|
7301
|
+
name: path,
|
|
7302
|
+
filters: filters
|
|
7303
|
+
};
|
|
7304
|
+
return DataFetcher.get().callGraphQL({
|
|
7305
|
+
values: variables,
|
|
7306
|
+
query: this.templateByQuery.get("fetchTotals"),
|
|
7307
|
+
});
|
|
7308
|
+
}
|
|
7309
|
+
fetchTotals(name, resourceID, filters = []) {
|
|
7310
|
+
return new Promise((accept, reject) => {
|
|
7311
|
+
this.getTotals(name, resourceID, filters)
|
|
7312
|
+
.then((result) => {
|
|
7313
|
+
if (result.length > 0) {
|
|
7314
|
+
const totalsData = new Map();
|
|
7315
|
+
result.forEach(total => {
|
|
7316
|
+
totalsData.set(total.name, parseFloat(total.value));
|
|
7317
|
+
});
|
|
7318
|
+
accept(totalsData);
|
|
7319
|
+
}
|
|
7320
|
+
else {
|
|
7321
|
+
reject(`Não foi possível recuperar os totalizadores`);
|
|
7322
|
+
}
|
|
7323
|
+
})
|
|
7324
|
+
.catch((error) => {
|
|
7325
|
+
reject(error);
|
|
7326
|
+
});
|
|
7327
|
+
});
|
|
7328
|
+
}
|
|
7329
|
+
}
|
|
7330
|
+
|
|
7285
7331
|
const snkApplicationCss = ".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";
|
|
7286
7332
|
|
|
7287
7333
|
const SnkApplication = class {
|
|
@@ -7318,7 +7364,7 @@ const SnkApplication = class {
|
|
|
7318
7364
|
const waitingAuth = this._authPromises.length > 0;
|
|
7319
7365
|
this._authPromises.push(new PendingPromise(resolve, reject));
|
|
7320
7366
|
if (!waitingAuth) {
|
|
7321
|
-
this.authFetcher.getData(this.
|
|
7367
|
+
this.authFetcher.getData(this.resourceID).then((authList) => {
|
|
7322
7368
|
this._auth = authList;
|
|
7323
7369
|
while (this._authPromises.length > 0) {
|
|
7324
7370
|
this._authPromises.pop().resolve(this._auth);
|
|
@@ -7599,6 +7645,12 @@ const SnkApplication = class {
|
|
|
7599
7645
|
async loadGridConfig(name) {
|
|
7600
7646
|
return this.gridConfigFetcher.getConfig(name, this.resourceID);
|
|
7601
7647
|
}
|
|
7648
|
+
/**
|
|
7649
|
+
* Busca os totalizadores da grade.
|
|
7650
|
+
*/
|
|
7651
|
+
async loadTotals(name, resourceID, filters) {
|
|
7652
|
+
return this.totalsFetcher.fetchTotals(name, resourceID, filters);
|
|
7653
|
+
}
|
|
7602
7654
|
/**
|
|
7603
7655
|
* Salva a configuração de grade.
|
|
7604
7656
|
*/
|
|
@@ -7632,6 +7684,12 @@ const SnkApplication = class {
|
|
|
7632
7684
|
}
|
|
7633
7685
|
return this._gridConfigFetcher;
|
|
7634
7686
|
}
|
|
7687
|
+
get totalsFetcher() {
|
|
7688
|
+
if (!this._totalsFetcher) {
|
|
7689
|
+
this._totalsFetcher = new TotalsFetcher();
|
|
7690
|
+
}
|
|
7691
|
+
return this._totalsFetcher;
|
|
7692
|
+
}
|
|
7635
7693
|
get pesquisaFetcher() {
|
|
7636
7694
|
if (!this._pesquisaFetcher) {
|
|
7637
7695
|
this._pesquisaFetcher = new PesquisaFetcher();
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-c6671817.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
7
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
8
|
-
const SnkMessageBuilder = require('./SnkMessageBuilder-
|
|
8
|
+
const SnkMessageBuilder = require('./SnkMessageBuilder-bb55d4c4.js');
|
|
9
9
|
|
|
10
10
|
const snkDataUnitCss = ".sc-snk-data-unit-h{display:flex;flex-direction:column;height:100%}";
|
|
11
11
|
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-c6671817.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
|
-
const taskbarElements = require('./taskbar-elements-
|
|
7
|
+
const taskbarElements = require('./taskbar-elements-2888ceb6.js');
|
|
8
8
|
|
|
9
9
|
const snkFormCss = ".sc-snk-form-h{display:block}.snk-form.sc-snk-form{position:relative;padding:var(--space--large);padding-top:var(--space--medium)}.snk-form__header.sc-snk-form{position:relative;padding-top:var(--space--medium);padding-bottom:var(--space--medium);margin-bottom:var(--space--medium)}.snk-form__header--fixed.sc-snk-form{position:sticky;top:0;background:var(--background--body);z-index:var(--more-visible, 2);padding-left:var(--space--large);padding-right:var(--space--large);margin-left:calc(var(--space--large) * -1);margin-right:calc(var(--space--large) * -1);width:calc(100% + (var(--space--large) * 2))}";
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-c6671817.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
|
-
const taskbarElements = require('./taskbar-elements-
|
|
7
|
+
const taskbarElements = require('./taskbar-elements-2888ceb6.js');
|
|
8
8
|
|
|
9
9
|
const snkTaskbarCss = ".sc-snk-taskbar-h{display:flex}";
|
|
10
10
|
|
|
@@ -12,6 +12,21 @@ const SnkTaskbar = class {
|
|
|
12
12
|
constructor(hostRef) {
|
|
13
13
|
index.registerInstance(this, hostRef);
|
|
14
14
|
this.actionClick = index.createEvent(this, "actionClick", 7);
|
|
15
|
+
this._titleKeyByElement = {
|
|
16
|
+
[taskbarElements.TaskbarElement.UPDATE]: "snkTaskbar.titleUpdate",
|
|
17
|
+
[taskbarElements.TaskbarElement.PREVIOUS]: "snkTaskbar.titlePrevious",
|
|
18
|
+
[taskbarElements.TaskbarElement.NEXT]: "snkTaskbar.titleNext",
|
|
19
|
+
[taskbarElements.TaskbarElement.REFRESH]: "snkTaskbar.titleRefresh",
|
|
20
|
+
[taskbarElements.TaskbarElement.CLONE]: "snkTaskbar.titleClone",
|
|
21
|
+
[taskbarElements.TaskbarElement.REMOVE]: "snkTaskbar.titleRemove",
|
|
22
|
+
[taskbarElements.TaskbarElement.MORE_OPTIONS]: "snkTaskbar.titleMoreOptions",
|
|
23
|
+
[taskbarElements.TaskbarElement.INSERT]: "snkTaskbar.titleInsert",
|
|
24
|
+
[taskbarElements.TaskbarElement.CANCEL]: "snkTaskbar.titleCancel",
|
|
25
|
+
[taskbarElements.TaskbarElement.SAVE]: "snkTaskbar.titleSave",
|
|
26
|
+
[taskbarElements.TaskbarElement.GRID_MODE]: "snkTaskbar.titleGridMode",
|
|
27
|
+
[taskbarElements.TaskbarElement.CONFIG_GRID]: "snkTaskbar.titleConfigGrid",
|
|
28
|
+
[taskbarElements.TaskbarElement.FORM_MODE]: "snkTaskbar.titleFormMode"
|
|
29
|
+
};
|
|
15
30
|
}
|
|
16
31
|
observeButtons() {
|
|
17
32
|
this._definitions = undefined;
|
|
@@ -22,7 +37,7 @@ const SnkTaskbar = class {
|
|
|
22
37
|
if (strButtons) {
|
|
23
38
|
strButtons.split(",").forEach(buttonName => {
|
|
24
39
|
buttonName = buttonName.trim();
|
|
25
|
-
if (this.isAllowed(buttonName)) {
|
|
40
|
+
if (taskbarElements.VisibleWhenForbidden[buttonName] || this.isAllowed(buttonName)) {
|
|
26
41
|
elements.push(buttonName.trim());
|
|
27
42
|
}
|
|
28
43
|
});
|
|
@@ -42,35 +57,14 @@ const SnkTaskbar = class {
|
|
|
42
57
|
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-taskbar.msg.ts"
|
|
43
58
|
*/
|
|
44
59
|
getTitle(element) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
case taskbarElements.TaskbarElement.PREVIOUS:
|
|
49
|
-
return this._application.messagesBuilder.getMessage("snkTaskbar.titlePrevious", {});
|
|
50
|
-
case taskbarElements.TaskbarElement.NEXT:
|
|
51
|
-
return this._application.messagesBuilder.getMessage("snkTaskbar.titleNext", {});
|
|
52
|
-
case taskbarElements.TaskbarElement.REFRESH:
|
|
53
|
-
return this._application.messagesBuilder.getMessage("snkTaskbar.titleRefresh", {});
|
|
54
|
-
case taskbarElements.TaskbarElement.CLONE:
|
|
55
|
-
return this._application.messagesBuilder.getMessage("snkTaskbar.titleClone", {});
|
|
56
|
-
case taskbarElements.TaskbarElement.REMOVE:
|
|
57
|
-
return this._application.messagesBuilder.getMessage("snkTaskbar.titleRemove", {});
|
|
58
|
-
case taskbarElements.TaskbarElement.MORE_OPTIONS:
|
|
59
|
-
return this._application.messagesBuilder.getMessage("snkTaskbar.titleMoreOptions", {});
|
|
60
|
-
case taskbarElements.TaskbarElement.INSERT:
|
|
61
|
-
return this._application.messagesBuilder.getMessage("snkTaskbar.titleInsert", {});
|
|
62
|
-
case taskbarElements.TaskbarElement.CANCEL:
|
|
63
|
-
return this._application.messagesBuilder.getMessage("snkTaskbar.titleCancel", {});
|
|
64
|
-
case taskbarElements.TaskbarElement.SAVE:
|
|
65
|
-
return this._application.messagesBuilder.getMessage("snkTaskbar.titleSave", {});
|
|
66
|
-
case taskbarElements.TaskbarElement.GRID_MODE:
|
|
67
|
-
return this._application.messagesBuilder.getMessage("snkTaskbar.titleGridMode", {});
|
|
68
|
-
case taskbarElements.TaskbarElement.CONFIG_GRID:
|
|
69
|
-
return this._application.messagesBuilder.getMessage("snkTaskbar.titleConfigGrid", {});
|
|
70
|
-
case taskbarElements.TaskbarElement.FORM_MODE:
|
|
71
|
-
return this._application.messagesBuilder.getMessage("snkTaskbar.titleFormMode", {});
|
|
60
|
+
let key;
|
|
61
|
+
if (this.isAllowed(element)) {
|
|
62
|
+
key = this._titleKeyByElement[element];
|
|
72
63
|
}
|
|
73
|
-
|
|
64
|
+
else {
|
|
65
|
+
key = "snkTaskbar.forbidden";
|
|
66
|
+
}
|
|
67
|
+
return key ? this._application.messagesBuilder.getMessage(key, {}) : "";
|
|
74
68
|
}
|
|
75
69
|
elementClick(elem) {
|
|
76
70
|
if (this.dataUnit) {
|
|
@@ -104,6 +98,9 @@ const SnkTaskbar = class {
|
|
|
104
98
|
this.actionClick.emit(elem);
|
|
105
99
|
}
|
|
106
100
|
isEnabled(elem) {
|
|
101
|
+
if (!this.isAllowed(elem)) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
107
104
|
return !(this.disabledButtons && this.disabledButtons.includes(elem));
|
|
108
105
|
}
|
|
109
106
|
getElement(index, def) {
|
|
@@ -27,6 +27,10 @@ exports.AuthorizationElements = void 0;
|
|
|
27
27
|
AuthorizationElements["INSERT"] = "INSERT";
|
|
28
28
|
AuthorizationElements["CONFIG_GRID"] = "CONFIG_GRID";
|
|
29
29
|
})(exports.AuthorizationElements || (exports.AuthorizationElements = {}));
|
|
30
|
+
exports.VisibleWhenForbidden = void 0;
|
|
31
|
+
(function (VisibleWhenForbidden) {
|
|
32
|
+
VisibleWhenForbidden["CONFIG_GRID"] = "CONFIG_GRID";
|
|
33
|
+
})(exports.VisibleWhenForbidden || (exports.VisibleWhenForbidden = {}));
|
|
30
34
|
const buildElem = (element, className, getTitle, action, isEnabled, actions) => {
|
|
31
35
|
switch (element) {
|
|
32
36
|
case exports.TaskbarElement.PREVIOUS:
|
|
@@ -15,6 +15,7 @@ import AuthFetcher, { AutorizationType } from "../../lib/http/data-fetcher/fetch
|
|
|
15
15
|
import MGEAuthorization from '../../lib/auth/mgeauthorization.module';
|
|
16
16
|
import { SnkErrorHandler } from "./errorhandler/snk-error-handler";
|
|
17
17
|
import { agGridLicense } from '../../lib/licenses/sankhyalicense.module';
|
|
18
|
+
import { TotalsFetcher } from "../../lib/http/data-fetcher/fetchers/totals-fetcher";
|
|
18
19
|
import { SnkMessageBuilder } from "../../lib/message/SnkMessageBuilder";
|
|
19
20
|
/**
|
|
20
21
|
* É possível customizar as mensagens dos blocos de construção através de um pequeno modulo na estrutura da aplicação:
|
|
@@ -52,7 +53,7 @@ export class SnkApplication {
|
|
|
52
53
|
const waitingAuth = this._authPromises.length > 0;
|
|
53
54
|
this._authPromises.push(new PendingPromise(resolve, reject));
|
|
54
55
|
if (!waitingAuth) {
|
|
55
|
-
this.authFetcher.getData(this.
|
|
56
|
+
this.authFetcher.getData(this.resourceID).then((authList) => {
|
|
56
57
|
this._auth = authList;
|
|
57
58
|
while (this._authPromises.length > 0) {
|
|
58
59
|
this._authPromises.pop().resolve(this._auth);
|
|
@@ -333,6 +334,12 @@ export class SnkApplication {
|
|
|
333
334
|
async loadGridConfig(name) {
|
|
334
335
|
return this.gridConfigFetcher.getConfig(name, this.resourceID);
|
|
335
336
|
}
|
|
337
|
+
/**
|
|
338
|
+
* Busca os totalizadores da grade.
|
|
339
|
+
*/
|
|
340
|
+
async loadTotals(name, resourceID, filters) {
|
|
341
|
+
return this.totalsFetcher.fetchTotals(name, resourceID, filters);
|
|
342
|
+
}
|
|
336
343
|
/**
|
|
337
344
|
* Salva a configuração de grade.
|
|
338
345
|
*/
|
|
@@ -366,6 +373,12 @@ export class SnkApplication {
|
|
|
366
373
|
}
|
|
367
374
|
return this._gridConfigFetcher;
|
|
368
375
|
}
|
|
376
|
+
get totalsFetcher() {
|
|
377
|
+
if (!this._totalsFetcher) {
|
|
378
|
+
this._totalsFetcher = new TotalsFetcher();
|
|
379
|
+
}
|
|
380
|
+
return this._totalsFetcher;
|
|
381
|
+
}
|
|
369
382
|
get pesquisaFetcher() {
|
|
370
383
|
if (!this._pesquisaFetcher) {
|
|
371
384
|
this._pesquisaFetcher = new PesquisaFetcher();
|
|
@@ -1117,6 +1130,41 @@ export class SnkApplication {
|
|
|
1117
1130
|
"tags": []
|
|
1118
1131
|
}
|
|
1119
1132
|
},
|
|
1133
|
+
"loadTotals": {
|
|
1134
|
+
"complexType": {
|
|
1135
|
+
"signature": "(name: string, resourceID: string, filters: Array<Filter>) => Promise<Map<string, number>>",
|
|
1136
|
+
"parameters": [{
|
|
1137
|
+
"tags": [],
|
|
1138
|
+
"text": ""
|
|
1139
|
+
}, {
|
|
1140
|
+
"tags": [],
|
|
1141
|
+
"text": ""
|
|
1142
|
+
}, {
|
|
1143
|
+
"tags": [],
|
|
1144
|
+
"text": ""
|
|
1145
|
+
}],
|
|
1146
|
+
"references": {
|
|
1147
|
+
"Promise": {
|
|
1148
|
+
"location": "global"
|
|
1149
|
+
},
|
|
1150
|
+
"Map": {
|
|
1151
|
+
"location": "global"
|
|
1152
|
+
},
|
|
1153
|
+
"Array": {
|
|
1154
|
+
"location": "global"
|
|
1155
|
+
},
|
|
1156
|
+
"Filter": {
|
|
1157
|
+
"location": "import",
|
|
1158
|
+
"path": "@sankhyalabs/core"
|
|
1159
|
+
}
|
|
1160
|
+
},
|
|
1161
|
+
"return": "Promise<Map<string, number>>"
|
|
1162
|
+
},
|
|
1163
|
+
"docs": {
|
|
1164
|
+
"text": "Busca os totalizadores da grade.",
|
|
1165
|
+
"tags": []
|
|
1166
|
+
}
|
|
1167
|
+
},
|
|
1120
1168
|
"saveGridConfig": {
|
|
1121
1169
|
"complexType": {
|
|
1122
1170
|
"signature": "(config: IGridConfig) => Promise<boolean>",
|
|
@@ -24,6 +24,10 @@ export var AuthorizationElements;
|
|
|
24
24
|
AuthorizationElements["INSERT"] = "INSERT";
|
|
25
25
|
AuthorizationElements["CONFIG_GRID"] = "CONFIG_GRID";
|
|
26
26
|
})(AuthorizationElements || (AuthorizationElements = {}));
|
|
27
|
+
export var VisibleWhenForbidden;
|
|
28
|
+
(function (VisibleWhenForbidden) {
|
|
29
|
+
VisibleWhenForbidden["CONFIG_GRID"] = "CONFIG_GRID";
|
|
30
|
+
})(VisibleWhenForbidden || (VisibleWhenForbidden = {}));
|
|
27
31
|
export const buildElem = (element, className, getTitle, action, isEnabled, actions) => {
|
|
28
32
|
switch (element) {
|
|
29
33
|
case TaskbarElement.PREVIOUS:
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import { ApplicationContext } from '@sankhyalabs/core';
|
|
2
2
|
import { Component, Event, h, Host, Prop, State, Watch } from '@stencil/core';
|
|
3
|
-
import { TaskbarElement, buildElem, AuthorizationElements } from './elements/taskbar-elements';
|
|
3
|
+
import { TaskbarElement, buildElem, AuthorizationElements, VisibleWhenForbidden } from './elements/taskbar-elements';
|
|
4
4
|
export class SnkTaskbar {
|
|
5
|
+
constructor() {
|
|
6
|
+
this._titleKeyByElement = {
|
|
7
|
+
[TaskbarElement.UPDATE]: "snkTaskbar.titleUpdate",
|
|
8
|
+
[TaskbarElement.PREVIOUS]: "snkTaskbar.titlePrevious",
|
|
9
|
+
[TaskbarElement.NEXT]: "snkTaskbar.titleNext",
|
|
10
|
+
[TaskbarElement.REFRESH]: "snkTaskbar.titleRefresh",
|
|
11
|
+
[TaskbarElement.CLONE]: "snkTaskbar.titleClone",
|
|
12
|
+
[TaskbarElement.REMOVE]: "snkTaskbar.titleRemove",
|
|
13
|
+
[TaskbarElement.MORE_OPTIONS]: "snkTaskbar.titleMoreOptions",
|
|
14
|
+
[TaskbarElement.INSERT]: "snkTaskbar.titleInsert",
|
|
15
|
+
[TaskbarElement.CANCEL]: "snkTaskbar.titleCancel",
|
|
16
|
+
[TaskbarElement.SAVE]: "snkTaskbar.titleSave",
|
|
17
|
+
[TaskbarElement.GRID_MODE]: "snkTaskbar.titleGridMode",
|
|
18
|
+
[TaskbarElement.CONFIG_GRID]: "snkTaskbar.titleConfigGrid",
|
|
19
|
+
[TaskbarElement.FORM_MODE]: "snkTaskbar.titleFormMode"
|
|
20
|
+
};
|
|
21
|
+
}
|
|
5
22
|
observeButtons() {
|
|
6
23
|
this._definitions = undefined;
|
|
7
24
|
}
|
|
@@ -11,7 +28,7 @@ export class SnkTaskbar {
|
|
|
11
28
|
if (strButtons) {
|
|
12
29
|
strButtons.split(",").forEach(buttonName => {
|
|
13
30
|
buttonName = buttonName.trim();
|
|
14
|
-
if (this.isAllowed(buttonName)) {
|
|
31
|
+
if (VisibleWhenForbidden[buttonName] || this.isAllowed(buttonName)) {
|
|
15
32
|
elements.push(buttonName.trim());
|
|
16
33
|
}
|
|
17
34
|
});
|
|
@@ -31,35 +48,14 @@ export class SnkTaskbar {
|
|
|
31
48
|
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-taskbar.msg.ts"
|
|
32
49
|
*/
|
|
33
50
|
getTitle(element) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return this._application.messagesBuilder.getMessage("snkTaskbar.titleNext", {});
|
|
41
|
-
case TaskbarElement.REFRESH:
|
|
42
|
-
return this._application.messagesBuilder.getMessage("snkTaskbar.titleRefresh", {});
|
|
43
|
-
case TaskbarElement.CLONE:
|
|
44
|
-
return this._application.messagesBuilder.getMessage("snkTaskbar.titleClone", {});
|
|
45
|
-
case TaskbarElement.REMOVE:
|
|
46
|
-
return this._application.messagesBuilder.getMessage("snkTaskbar.titleRemove", {});
|
|
47
|
-
case TaskbarElement.MORE_OPTIONS:
|
|
48
|
-
return this._application.messagesBuilder.getMessage("snkTaskbar.titleMoreOptions", {});
|
|
49
|
-
case TaskbarElement.INSERT:
|
|
50
|
-
return this._application.messagesBuilder.getMessage("snkTaskbar.titleInsert", {});
|
|
51
|
-
case TaskbarElement.CANCEL:
|
|
52
|
-
return this._application.messagesBuilder.getMessage("snkTaskbar.titleCancel", {});
|
|
53
|
-
case TaskbarElement.SAVE:
|
|
54
|
-
return this._application.messagesBuilder.getMessage("snkTaskbar.titleSave", {});
|
|
55
|
-
case TaskbarElement.GRID_MODE:
|
|
56
|
-
return this._application.messagesBuilder.getMessage("snkTaskbar.titleGridMode", {});
|
|
57
|
-
case TaskbarElement.CONFIG_GRID:
|
|
58
|
-
return this._application.messagesBuilder.getMessage("snkTaskbar.titleConfigGrid", {});
|
|
59
|
-
case TaskbarElement.FORM_MODE:
|
|
60
|
-
return this._application.messagesBuilder.getMessage("snkTaskbar.titleFormMode", {});
|
|
51
|
+
let key;
|
|
52
|
+
if (this.isAllowed(element)) {
|
|
53
|
+
key = this._titleKeyByElement[element];
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
key = "snkTaskbar.forbidden";
|
|
61
57
|
}
|
|
62
|
-
return "";
|
|
58
|
+
return key ? this._application.messagesBuilder.getMessage(key, {}) : "";
|
|
63
59
|
}
|
|
64
60
|
elementClick(elem) {
|
|
65
61
|
if (this.dataUnit) {
|
|
@@ -93,6 +89,9 @@ export class SnkTaskbar {
|
|
|
93
89
|
this.actionClick.emit(elem);
|
|
94
90
|
}
|
|
95
91
|
isEnabled(elem) {
|
|
92
|
+
if (!this.isAllowed(elem)) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
96
95
|
return !(this.disabledButtons && this.disabledButtons.includes(elem));
|
|
97
96
|
}
|
|
98
97
|
getElement(index, def) {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { gql } from "graphql-request";
|
|
2
|
+
import { DataFetcher } from "../DataFetcher";
|
|
3
|
+
export class TotalsFetcher {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.templateByQuery = new Map();
|
|
6
|
+
this.buldTemplates();
|
|
7
|
+
}
|
|
8
|
+
buldTemplates() {
|
|
9
|
+
this.templateByQuery.set("fetchTotals", gql `query($filters: [InputFilter!] $name: String!) {
|
|
10
|
+
$queryAlias$: fetchTotals(name: $name, filters: $filters ){
|
|
11
|
+
name
|
|
12
|
+
value
|
|
13
|
+
}
|
|
14
|
+
}`);
|
|
15
|
+
}
|
|
16
|
+
async getTotals(name, resourceID, filters) {
|
|
17
|
+
const path = `totals://${name}/${resourceID}`;
|
|
18
|
+
let variables = {
|
|
19
|
+
name: path,
|
|
20
|
+
filters: filters
|
|
21
|
+
};
|
|
22
|
+
return DataFetcher.get().callGraphQL({
|
|
23
|
+
values: variables,
|
|
24
|
+
query: this.templateByQuery.get("fetchTotals"),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
fetchTotals(name, resourceID, filters = []) {
|
|
28
|
+
return new Promise((accept, reject) => {
|
|
29
|
+
this.getTotals(name, resourceID, filters)
|
|
30
|
+
.then((result) => {
|
|
31
|
+
if (result.length > 0) {
|
|
32
|
+
const totalsData = new Map();
|
|
33
|
+
result.forEach(total => {
|
|
34
|
+
totalsData.set(total.name, parseFloat(total.value));
|
|
35
|
+
});
|
|
36
|
+
accept(totalsData);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
reject(`Não foi possível recuperar os totalizadores`);
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
.catch((error) => {
|
|
43
|
+
reject(error);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -10,7 +10,8 @@ const snkTaskbarMessages = {
|
|
|
10
10
|
titleCancel: "Cancelar",
|
|
11
11
|
titleSave: "Salvar",
|
|
12
12
|
titleGridMode: "Modo Grade",
|
|
13
|
+
titleFormMode: "Modo Formulário",
|
|
13
14
|
titleConfigGrid: "Configuração da grade",
|
|
14
|
-
|
|
15
|
+
forbidden: "Permissão não liberada"
|
|
15
16
|
};
|
|
16
17
|
export default snkTaskbarMessages;
|
|
@@ -42,8 +42,9 @@ const snkTaskbarMessages = {
|
|
|
42
42
|
titleCancel: "Cancelar",
|
|
43
43
|
titleSave: "Salvar",
|
|
44
44
|
titleGridMode: "Modo Grade",
|
|
45
|
+
titleFormMode: "Modo Formulário",
|
|
45
46
|
titleConfigGrid: "Configuração da grade",
|
|
46
|
-
|
|
47
|
+
forbidden: "Permissão não liberada"
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
class SnkMessageBuilder {
|
|
@@ -7279,6 +7279,52 @@ class SnkErrorHandler {
|
|
|
7279
7279
|
|
|
7280
7280
|
function _0x53e1(){const _0x340df8=['2909523kXwted','CompanyName=Sankhya\x20Jiva\x20Tecnologia\x20e\x20Inovao\x20Ltda,LicensedApplication=Sankhya\x20Gestao,LicenseType=SingleApplication,LicensedConcurrentDeveloperCount=2,LicensedProductionInstancesCount=0,AssetReference=AG-019460,ExpiryDate=9_November_2022_[v2]_MTY2Nzk1MjAwMDAwMA==10487151e296ee4360f80961ca960869','1131048CARoeW','502909mLEPmu','447255iQEXuN','428UHbJwW','270AFTxAV','194369jhGqTI','1540nWuTrj','2044062GicUQI','30CkXPWg'];_0x53e1=function(){return _0x340df8;};return _0x53e1();}const _0xc7632f=_0x15c2;function _0x15c2(_0x353a9c,_0x3e4a5a){const _0x53e110=_0x53e1();return _0x15c2=function(_0x15c2aa,_0x219858){_0x15c2aa=_0x15c2aa-0x188;let _0x307231=_0x53e110[_0x15c2aa];return _0x307231;},_0x15c2(_0x353a9c,_0x3e4a5a);}(function(_0x42617e,_0x57debe){const _0x31061a=_0x15c2,_0x128d7d=_0x42617e();while(!![]){try{const _0x1c9bb1=-parseInt(_0x31061a(0x18e))/0x1+-parseInt(_0x31061a(0x189))/0x2+parseInt(_0x31061a(0x18b))/0x3+-parseInt(_0x31061a(0x190))/0x4*(parseInt(_0x31061a(0x188))/0x5)+-parseInt(_0x31061a(0x191))/0x6*(-parseInt(_0x31061a(0x192))/0x7)+parseInt(_0x31061a(0x18d))/0x8+-parseInt(_0x31061a(0x18f))/0x9*(-parseInt(_0x31061a(0x18a))/0xa);if(_0x1c9bb1===_0x57debe)break;else _0x128d7d['push'](_0x128d7d['shift']());}catch(_0x1bd816){_0x128d7d['push'](_0x128d7d['shift']());}}}(_0x53e1,0xe8676));const agGridLicense=_0xc7632f(0x18c);
|
|
7281
7281
|
|
|
7282
|
+
class TotalsFetcher {
|
|
7283
|
+
constructor() {
|
|
7284
|
+
this.templateByQuery = new Map();
|
|
7285
|
+
this.buldTemplates();
|
|
7286
|
+
}
|
|
7287
|
+
buldTemplates() {
|
|
7288
|
+
this.templateByQuery.set("fetchTotals", dist.gql `query($filters: [InputFilter!] $name: String!) {
|
|
7289
|
+
$queryAlias$: fetchTotals(name: $name, filters: $filters ){
|
|
7290
|
+
name
|
|
7291
|
+
value
|
|
7292
|
+
}
|
|
7293
|
+
}`);
|
|
7294
|
+
}
|
|
7295
|
+
async getTotals(name, resourceID, filters) {
|
|
7296
|
+
const path = `totals://${name}/${resourceID}`;
|
|
7297
|
+
let variables = {
|
|
7298
|
+
name: path,
|
|
7299
|
+
filters: filters
|
|
7300
|
+
};
|
|
7301
|
+
return DataFetcher.get().callGraphQL({
|
|
7302
|
+
values: variables,
|
|
7303
|
+
query: this.templateByQuery.get("fetchTotals"),
|
|
7304
|
+
});
|
|
7305
|
+
}
|
|
7306
|
+
fetchTotals(name, resourceID, filters = []) {
|
|
7307
|
+
return new Promise((accept, reject) => {
|
|
7308
|
+
this.getTotals(name, resourceID, filters)
|
|
7309
|
+
.then((result) => {
|
|
7310
|
+
if (result.length > 0) {
|
|
7311
|
+
const totalsData = new Map();
|
|
7312
|
+
result.forEach(total => {
|
|
7313
|
+
totalsData.set(total.name, parseFloat(total.value));
|
|
7314
|
+
});
|
|
7315
|
+
accept(totalsData);
|
|
7316
|
+
}
|
|
7317
|
+
else {
|
|
7318
|
+
reject(`Não foi possível recuperar os totalizadores`);
|
|
7319
|
+
}
|
|
7320
|
+
})
|
|
7321
|
+
.catch((error) => {
|
|
7322
|
+
reject(error);
|
|
7323
|
+
});
|
|
7324
|
+
});
|
|
7325
|
+
}
|
|
7326
|
+
}
|
|
7327
|
+
|
|
7282
7328
|
const snkApplicationCss = ".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";
|
|
7283
7329
|
|
|
7284
7330
|
const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
@@ -7316,7 +7362,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
7316
7362
|
const waitingAuth = this._authPromises.length > 0;
|
|
7317
7363
|
this._authPromises.push(new PendingPromise(resolve, reject));
|
|
7318
7364
|
if (!waitingAuth) {
|
|
7319
|
-
this.authFetcher.getData(this.
|
|
7365
|
+
this.authFetcher.getData(this.resourceID).then((authList) => {
|
|
7320
7366
|
this._auth = authList;
|
|
7321
7367
|
while (this._authPromises.length > 0) {
|
|
7322
7368
|
this._authPromises.pop().resolve(this._auth);
|
|
@@ -7597,6 +7643,12 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
7597
7643
|
async loadGridConfig(name) {
|
|
7598
7644
|
return this.gridConfigFetcher.getConfig(name, this.resourceID);
|
|
7599
7645
|
}
|
|
7646
|
+
/**
|
|
7647
|
+
* Busca os totalizadores da grade.
|
|
7648
|
+
*/
|
|
7649
|
+
async loadTotals(name, resourceID, filters) {
|
|
7650
|
+
return this.totalsFetcher.fetchTotals(name, resourceID, filters);
|
|
7651
|
+
}
|
|
7600
7652
|
/**
|
|
7601
7653
|
* Salva a configuração de grade.
|
|
7602
7654
|
*/
|
|
@@ -7630,6 +7682,12 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
7630
7682
|
}
|
|
7631
7683
|
return this._gridConfigFetcher;
|
|
7632
7684
|
}
|
|
7685
|
+
get totalsFetcher() {
|
|
7686
|
+
if (!this._totalsFetcher) {
|
|
7687
|
+
this._totalsFetcher = new TotalsFetcher();
|
|
7688
|
+
}
|
|
7689
|
+
return this._totalsFetcher;
|
|
7690
|
+
}
|
|
7633
7691
|
get pesquisaFetcher() {
|
|
7634
7692
|
if (!this._pesquisaFetcher) {
|
|
7635
7693
|
this._pesquisaFetcher = new PesquisaFetcher();
|
|
@@ -7767,6 +7825,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
7767
7825
|
"info": [64],
|
|
7768
7826
|
"loadFormConfig": [64],
|
|
7769
7827
|
"loadGridConfig": [64],
|
|
7828
|
+
"loadTotals": [64],
|
|
7770
7829
|
"saveGridConfig": [64],
|
|
7771
7830
|
"executeSearch": [64],
|
|
7772
7831
|
"isDebugMode": [64]
|