@sankhyalabs/sankhyablocks 1.3.31-beta.3 → 1.3.31-beta.6
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-e42cb45d.js → index-532bcc28.js} +5 -34
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/sankhyablocks.cjs.js +2 -2
- package/dist/cjs/snk-application.cjs.entry.js +111 -15
- package/dist/cjs/snk-data-unit.cjs.entry.js +82 -37
- package/dist/cjs/snk-form.cjs.entry.js +1 -1
- package/dist/cjs/snk-grid.cjs.entry.js +2 -2
- package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
- package/dist/cjs/snk-taskbar.cjs.entry.js +15 -34
- package/dist/cjs/{taskbar-elements-bfa647c7.js → taskbar-elements-9d47b416.js} +4 -2
- package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
- package/dist/collection/components/snk-application/snk-application.js +107 -31
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +171 -47
- package/dist/collection/components/snk-form/snk-form.js +5 -5
- package/dist/collection/components/snk-grid/snk-grid.js +3 -3
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +3 -1
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +17 -33
- package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +30 -10
- package/dist/components/snk-application2.js +111 -15
- package/dist/components/snk-data-unit.js +84 -36
- package/dist/components/snk-taskbar2.js +14 -32
- package/dist/esm/{index-02c04e0f.js → index-0b078db7.js} +5 -34
- package/dist/esm/loader.js +2 -2
- package/dist/esm/sankhyablocks.js +2 -2
- package/dist/esm/snk-application.entry.js +111 -15
- package/dist/esm/snk-data-unit.entry.js +82 -37
- package/dist/esm/snk-form.entry.js +1 -1
- package/dist/esm/snk-grid.entry.js +2 -2
- package/dist/esm/snk-pesquisa.entry.js +1 -1
- package/dist/esm/snk-taskbar.entry.js +13 -32
- package/dist/esm/{taskbar-elements-fe7cbf0e.js → taskbar-elements-3ba30bf4.js} +4 -2
- package/dist/esm/teste-pesquisa.entry.js +1 -1
- package/dist/sankhyablocks/{p-b80352ac.entry.js → p-3cb106f7.entry.js} +3 -3
- package/dist/sankhyablocks/p-3fce3190.entry.js +1 -0
- package/dist/sankhyablocks/{p-37b06977.entry.js → p-560fdf54.entry.js} +1 -1
- package/dist/sankhyablocks/p-574764bf.js +1 -0
- package/dist/sankhyablocks/p-8f7b9a85.entry.js +1 -0
- package/dist/sankhyablocks/{p-c156b1da.entry.js → p-9c225717.entry.js} +1 -1
- package/dist/sankhyablocks/p-a45dba1a.js +2 -0
- package/dist/sankhyablocks/{p-e38386b1.entry.js → p-a670853c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-376004ef.entry.js → p-a8305c35.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +85 -9
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +2 -1
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +20 -3
- package/dist/types/components.d.ts +223 -2
- package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +2 -0
- package/package.json +1 -1
- package/dist/collection/components/snk-taskbar/component/snk-popup-button.js +0 -7
- package/dist/sankhyablocks/p-09e48ff8.entry.js +0 -1
- package/dist/sankhyablocks/p-64e2471c.js +0 -1
- package/dist/sankhyablocks/p-cc9c348a.entry.js +0 -1
- package/dist/sankhyablocks/p-db215c74.js +0 -2
- package/dist/types/components/snk-taskbar/component/snk-popup-button.d.ts +0 -12
|
@@ -6688,6 +6688,7 @@ class WaitingRequest {
|
|
|
6688
6688
|
class DataUnitFetcher {
|
|
6689
6689
|
constructor() {
|
|
6690
6690
|
this.templateByQuery = new Map();
|
|
6691
|
+
this._loadDataTimeout = {};
|
|
6691
6692
|
this.buldTemplates();
|
|
6692
6693
|
}
|
|
6693
6694
|
buldTemplates() {
|
|
@@ -6785,6 +6786,21 @@ class DataUnitFetcher {
|
|
|
6785
6786
|
});
|
|
6786
6787
|
}
|
|
6787
6788
|
loadData(dataUnit, request) {
|
|
6789
|
+
const duName = dataUnit.name;
|
|
6790
|
+
if (this._loadDataTimeout[duName]) {
|
|
6791
|
+
clearTimeout(this._loadDataTimeout[duName]);
|
|
6792
|
+
delete this._loadDataTimeout[duName];
|
|
6793
|
+
}
|
|
6794
|
+
return new Promise((resolve, reject) => {
|
|
6795
|
+
this._loadDataTimeout[duName] = setTimeout(() => {
|
|
6796
|
+
delete this._loadDataTimeout[duName];
|
|
6797
|
+
this.doLoadData(dataUnit, request)
|
|
6798
|
+
.then(result => resolve(result))
|
|
6799
|
+
.catch(reason => reject(reason));
|
|
6800
|
+
}, 200);
|
|
6801
|
+
});
|
|
6802
|
+
}
|
|
6803
|
+
doLoadData(dataUnit, request) {
|
|
6788
6804
|
return new Promise((resolve, reject) => {
|
|
6789
6805
|
var _a;
|
|
6790
6806
|
const { sort, filters, limit, offset, quickFilter } = request;
|
|
@@ -6812,9 +6828,19 @@ class DataUnitFetcher {
|
|
|
6812
6828
|
})
|
|
6813
6829
|
.then((resp) => {
|
|
6814
6830
|
const { limit, offset, total, hasMore, records } = resp.data;
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
|
|
6831
|
+
let paginationInfo;
|
|
6832
|
+
if (limit) {
|
|
6833
|
+
const firstRecord = offset + 1;
|
|
6834
|
+
const lastRecord = offset + Math.min(records.length, limit);
|
|
6835
|
+
const currentPage = offset / limit;
|
|
6836
|
+
paginationInfo = {
|
|
6837
|
+
firstRecord,
|
|
6838
|
+
lastRecord,
|
|
6839
|
+
total,
|
|
6840
|
+
currentPage,
|
|
6841
|
+
hasMore
|
|
6842
|
+
};
|
|
6843
|
+
}
|
|
6818
6844
|
const processedRecords = [];
|
|
6819
6845
|
records.forEach((responseRecord) => {
|
|
6820
6846
|
const duRecord = { __record__id__: responseRecord.id };
|
|
@@ -6824,13 +6850,7 @@ class DataUnitFetcher {
|
|
|
6824
6850
|
processedRecords.push(duRecord);
|
|
6825
6851
|
});
|
|
6826
6852
|
resolve({
|
|
6827
|
-
paginationInfo
|
|
6828
|
-
firstRecord,
|
|
6829
|
-
lastRecord,
|
|
6830
|
-
total,
|
|
6831
|
-
currentPage,
|
|
6832
|
-
hasMore
|
|
6833
|
-
},
|
|
6853
|
+
paginationInfo,
|
|
6834
6854
|
records: processedRecords
|
|
6835
6855
|
});
|
|
6836
6856
|
})
|
|
@@ -7292,6 +7312,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
7292
7312
|
}
|
|
7293
7313
|
});
|
|
7294
7314
|
}
|
|
7315
|
+
/**
|
|
7316
|
+
* Caso o usuário logado seja o SUP.
|
|
7317
|
+
*/
|
|
7295
7318
|
async isUserSup() {
|
|
7296
7319
|
return new Promise((resolve, reject) => {
|
|
7297
7320
|
this.auth.then((authorization) => {
|
|
@@ -7301,6 +7324,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
7301
7324
|
});
|
|
7302
7325
|
});
|
|
7303
7326
|
}
|
|
7327
|
+
/**
|
|
7328
|
+
* Se o usuário logado tem permissão pra determinada ação.
|
|
7329
|
+
*/
|
|
7304
7330
|
async hasAccess(access) {
|
|
7305
7331
|
return new Promise((resolve, reject) => {
|
|
7306
7332
|
this.auth.then((authorization) => {
|
|
@@ -7310,6 +7336,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
7310
7336
|
});
|
|
7311
7337
|
});
|
|
7312
7338
|
}
|
|
7339
|
+
/**
|
|
7340
|
+
* Retorna todos os acessos do usuário logado.
|
|
7341
|
+
*/
|
|
7313
7342
|
async getAllAccess() {
|
|
7314
7343
|
return new Promise((resolve, reject) => {
|
|
7315
7344
|
this.auth.then((authorization) => {
|
|
@@ -7324,34 +7353,55 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
7324
7353
|
});
|
|
7325
7354
|
});
|
|
7326
7355
|
}
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7356
|
+
/**
|
|
7357
|
+
* Retorna o valor de um parâmetro do tipo string.
|
|
7358
|
+
*/
|
|
7330
7359
|
async getStringParam(name) {
|
|
7331
7360
|
return this.parameters.asString(name, this.resourceID);
|
|
7332
7361
|
}
|
|
7362
|
+
/**
|
|
7363
|
+
* Retorna o valor de um parâmetro do tipo Inteiro.
|
|
7364
|
+
*/
|
|
7333
7365
|
async getIntParam(name) {
|
|
7334
7366
|
return this.parameters.asInteger(name, this.resourceID);
|
|
7335
7367
|
}
|
|
7368
|
+
/**
|
|
7369
|
+
* Retorna o valor de um parâmetro do tipo Decimal.
|
|
7370
|
+
*/
|
|
7336
7371
|
async getFloatParam(name) {
|
|
7337
7372
|
return this.parameters.asFloat(name, this.resourceID);
|
|
7338
7373
|
}
|
|
7374
|
+
/**
|
|
7375
|
+
* Retorna o valor de um parâmetro do tipo booleano.
|
|
7376
|
+
*/
|
|
7339
7377
|
async getBooleanParam(name) {
|
|
7340
7378
|
return this.parameters.asBoolean(name, this.resourceID);
|
|
7341
7379
|
}
|
|
7380
|
+
/**
|
|
7381
|
+
* Retorna o valor de um parâmetro do tipo data.
|
|
7382
|
+
*/
|
|
7342
7383
|
async getDateParam(name) {
|
|
7343
7384
|
return this.parameters.asDate(name, this.resourceID);
|
|
7344
7385
|
}
|
|
7386
|
+
/**
|
|
7387
|
+
* Mostra o conteúdo passado em um Popup
|
|
7388
|
+
*/
|
|
7345
7389
|
async showPopUp(content) {
|
|
7346
7390
|
this._popUp.appendChild(content);
|
|
7347
7391
|
this._popUp["opened"] = true;
|
|
7348
7392
|
}
|
|
7393
|
+
/**
|
|
7394
|
+
* Fecha o popup, liberando o conteúdo.
|
|
7395
|
+
*/
|
|
7349
7396
|
async closePopUp() {
|
|
7350
7397
|
Array.from(this._popUp.children).forEach(c => {
|
|
7351
7398
|
this._popUp.removeChild(c);
|
|
7352
7399
|
});
|
|
7353
7400
|
this._popUp["opened"] = false;
|
|
7354
7401
|
}
|
|
7402
|
+
/**
|
|
7403
|
+
* Verifica se a licença do cliente tem determinado opcional (produto)
|
|
7404
|
+
*/
|
|
7355
7405
|
async temOpcional(opcional) {
|
|
7356
7406
|
const opts = opcional.split(",");
|
|
7357
7407
|
return new Promise((resolve, reject) => {
|
|
@@ -7375,6 +7425,10 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
7375
7425
|
});
|
|
7376
7426
|
});
|
|
7377
7427
|
}
|
|
7428
|
+
/**
|
|
7429
|
+
* Retorna a configuração de um recurso por service broker
|
|
7430
|
+
* Veja também o método "loadConfig"
|
|
7431
|
+
*/
|
|
7378
7432
|
async getConfig(key) {
|
|
7379
7433
|
let payload = {
|
|
7380
7434
|
"serviceName": "SystemUtilsSP.getConf",
|
|
@@ -7392,6 +7446,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
7392
7446
|
.catch(error => reject(error));
|
|
7393
7447
|
});
|
|
7394
7448
|
}
|
|
7449
|
+
/**
|
|
7450
|
+
* Salva a configuração de determinado recurso.
|
|
7451
|
+
*/
|
|
7395
7452
|
async saveConfig(key, data) {
|
|
7396
7453
|
let payload = {
|
|
7397
7454
|
"serviceName": "SystemUtilsSP.saveConf",
|
|
@@ -7410,19 +7467,31 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
7410
7467
|
.catch(error => reject(error));
|
|
7411
7468
|
});
|
|
7412
7469
|
}
|
|
7470
|
+
/**
|
|
7471
|
+
* Acessa informações de contexto "empurrados" na abertura da tela
|
|
7472
|
+
*/
|
|
7413
7473
|
async getAttributeFromHTMLWrapper(attribName) {
|
|
7414
7474
|
return Promise.resolve(window[attribName]);
|
|
7415
7475
|
}
|
|
7476
|
+
/**
|
|
7477
|
+
* Abre determinada tela, repassando pkObject
|
|
7478
|
+
*/
|
|
7416
7479
|
async openApp(resourceId, pkObject) {
|
|
7417
7480
|
Workspace.openAppActivity(resourceId, pkObject);
|
|
7418
7481
|
}
|
|
7482
|
+
/**
|
|
7483
|
+
* Cria o DataUnit a partir do nome da entidade.
|
|
7484
|
+
*/
|
|
7419
7485
|
async createDataunit(entityName) {
|
|
7420
7486
|
return new Promise(resolve => {
|
|
7421
7487
|
const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, this.resourceID);
|
|
7422
7488
|
dataUnit.loadMetadata().then(() => resolve(dataUnit));
|
|
7423
7489
|
});
|
|
7424
7490
|
}
|
|
7425
|
-
|
|
7491
|
+
/**
|
|
7492
|
+
* Cria e armazena o DataUnit em um cache
|
|
7493
|
+
*/
|
|
7494
|
+
async getDataUnit(entityName, dataUnitName) {
|
|
7426
7495
|
return new Promise((resolve, reject) => {
|
|
7427
7496
|
const dataUnit = this._duCache.get(dataUnitName);
|
|
7428
7497
|
if (dataUnit) {
|
|
@@ -7438,30 +7507,57 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
7438
7507
|
}
|
|
7439
7508
|
});
|
|
7440
7509
|
}
|
|
7510
|
+
/**
|
|
7511
|
+
* Retorna o resourceID da tela em questão.
|
|
7512
|
+
*/
|
|
7441
7513
|
async getResourceID() {
|
|
7442
7514
|
return Promise.resolve(this.resourceID);
|
|
7443
7515
|
}
|
|
7516
|
+
/**
|
|
7517
|
+
* Mostra o diálogo de alerta de acordo com os parâmetros passados.
|
|
7518
|
+
*/
|
|
7444
7519
|
async alert(title, message, icon, options) {
|
|
7445
7520
|
return ApplicationUtils.alert(title, message, icon, options);
|
|
7446
7521
|
}
|
|
7522
|
+
/**
|
|
7523
|
+
* Mostra o diálogo de erro de acordo com os parâmetros passados.
|
|
7524
|
+
*/
|
|
7447
7525
|
async error(title, message, icon, options) {
|
|
7448
7526
|
return ApplicationUtils.error(title, message, icon, options);
|
|
7449
7527
|
}
|
|
7528
|
+
/**
|
|
7529
|
+
* Exibe um diálogo de confirmação
|
|
7530
|
+
*/
|
|
7450
7531
|
async confirm(title, message, icon, critical, options) {
|
|
7451
7532
|
return ApplicationUtils.confirm(title, message, icon, critical, options);
|
|
7452
7533
|
}
|
|
7534
|
+
/**
|
|
7535
|
+
* Mostra uma informação efêmera (de segundo plano).
|
|
7536
|
+
*/
|
|
7453
7537
|
async info(message, options) {
|
|
7454
7538
|
return ApplicationUtils.info(message, options);
|
|
7455
7539
|
}
|
|
7540
|
+
/**
|
|
7541
|
+
* Busca a configuração de formulário.
|
|
7542
|
+
*/
|
|
7456
7543
|
async loadFormConfig(name) {
|
|
7457
7544
|
return this.formConfigFetcher.loadFormConfig(name, this.resourceID);
|
|
7458
7545
|
}
|
|
7546
|
+
/**
|
|
7547
|
+
* Busca a configuração de grade.
|
|
7548
|
+
*/
|
|
7459
7549
|
async loadGridConfig(name) {
|
|
7460
7550
|
return this.gridConfigFetcher.getConfig(name, this.resourceID);
|
|
7461
7551
|
}
|
|
7552
|
+
/**
|
|
7553
|
+
* Salva a configuração de grade.
|
|
7554
|
+
*/
|
|
7462
7555
|
async saveGridConfig(config) {
|
|
7463
7556
|
return this.gridConfigFetcher.saveConfig(config, this.resourceID);
|
|
7464
7557
|
}
|
|
7558
|
+
async getAuthList(_auth) {
|
|
7559
|
+
return await (new MGEAuthorization()).parseFromJSON(_auth);
|
|
7560
|
+
}
|
|
7465
7561
|
get urlParams() {
|
|
7466
7562
|
if (!this._urlParams) {
|
|
7467
7563
|
this._urlParams = UrlUtils.getQueryParams(location.search);
|
|
@@ -7605,7 +7701,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
7605
7701
|
"getAttributeFromHTMLWrapper": [64],
|
|
7606
7702
|
"openApp": [64],
|
|
7607
7703
|
"createDataunit": [64],
|
|
7608
|
-
"
|
|
7704
|
+
"getDataUnit": [64],
|
|
7609
7705
|
"getResourceID": [64],
|
|
7610
7706
|
"alert": [64],
|
|
7611
7707
|
"error": [64],
|
|
@@ -10,12 +10,24 @@ const SnkDataUnit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
10
10
|
this.__registerHost();
|
|
11
11
|
this.dataStateChange = createEvent(this, "dataStateChange", 7);
|
|
12
12
|
this.dataUnitReady = createEvent(this, "dataUnitReady", 7);
|
|
13
|
+
this.insertionMode = createEvent(this, "insertionMode", 7);
|
|
13
14
|
this._onDataUnitResolve = [];
|
|
15
|
+
/**
|
|
16
|
+
* Determina quantas linhas são retornadas por página
|
|
17
|
+
*/
|
|
18
|
+
this.pageSize = 150;
|
|
19
|
+
/**
|
|
20
|
+
* Quando ativada essa propriedade faz com que haja uma carga imediata no DataUnit
|
|
21
|
+
*/
|
|
22
|
+
this.autoLoad = true;
|
|
14
23
|
this._dataUnitObserver = (action) => {
|
|
15
24
|
let msg = this.getActionInfo(action.type);
|
|
16
25
|
if (msg) {
|
|
17
26
|
ApplicationUtils.info(msg);
|
|
18
27
|
}
|
|
28
|
+
if (action.type === Action.RECORDS_ADDED || action.type === Action.RECORDS_COPIED) {
|
|
29
|
+
this.insertionMode.emit();
|
|
30
|
+
}
|
|
19
31
|
const duState = {
|
|
20
32
|
insertionMode: false,
|
|
21
33
|
hasNext: this.dataUnit.hasNext(),
|
|
@@ -33,41 +45,6 @@ const SnkDataUnit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
33
45
|
this.dataState = duState;
|
|
34
46
|
};
|
|
35
47
|
}
|
|
36
|
-
async getDataUnit() {
|
|
37
|
-
return new Promise((resolve) => {
|
|
38
|
-
if (this.dataUnit) {
|
|
39
|
-
resolve(this.dataUnit);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
this._onDataUnitResolve.push(resolve);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
async interceptAction(action) {
|
|
47
|
-
return new Promise(resolve => {
|
|
48
|
-
if (action.type === Action.EDITION_CANCELED) {
|
|
49
|
-
ApplicationUtils.confirm(this.i18n("components.warning"), this.i18n("components.confirmCancelEdition"))
|
|
50
|
-
.then((result) => resolve(result ? action : undefined));
|
|
51
|
-
}
|
|
52
|
-
else if (action.type === Action.REMOVING_RECORDS) {
|
|
53
|
-
ApplicationUtils.confirm(this.i18n("components.delete"), this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
|
|
54
|
-
.then((result) => resolve(result ? action : undefined));
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
resolve(action);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
getActionInfo(action) {
|
|
62
|
-
if (this.messageBuilder) {
|
|
63
|
-
return this.messageBuilder(action, this.dataState, this.dataUnit);
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
if (action === Action.EDITION_CANCELED) {
|
|
67
|
-
return this.i18n("components.editionCanceled");
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
48
|
observePageSize() {
|
|
72
49
|
if (this.dataUnit) {
|
|
73
50
|
this.dataUnit.pageSize = this.pageSize;
|
|
@@ -95,11 +72,73 @@ const SnkDataUnit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
95
72
|
observeDataUnit() {
|
|
96
73
|
this.dataUnitReady.emit(this.dataUnit);
|
|
97
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Pode-se obter o dataUnit através desse método. Outra forma, é ouvir o evento de
|
|
77
|
+
*
|
|
78
|
+
* @returns dataUnit
|
|
79
|
+
*/
|
|
80
|
+
async getDataUnit() {
|
|
81
|
+
return new Promise((resolve) => {
|
|
82
|
+
if (this.dataUnit) {
|
|
83
|
+
resolve(this.dataUnit);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
this._onDataUnitResolve.push(resolve);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
async interceptAction(action) {
|
|
91
|
+
return new Promise(resolve => {
|
|
92
|
+
switch (action.type) {
|
|
93
|
+
case Action.SAVING_DATA:
|
|
94
|
+
if (this.beforeSave) {
|
|
95
|
+
const continueAction = this.beforeSave(this.dataUnit);
|
|
96
|
+
if (continueAction instanceof Promise) {
|
|
97
|
+
continueAction.then(result => resolve(result ? action : undefined));
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
resolve(continueAction ? action : undefined);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
resolve(action);
|
|
105
|
+
}
|
|
106
|
+
break;
|
|
107
|
+
case Action.DATA_SAVED:
|
|
108
|
+
if (this.afterSave) {
|
|
109
|
+
this.afterSave(this.dataUnit);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
resolve(action);
|
|
113
|
+
}
|
|
114
|
+
break;
|
|
115
|
+
case Action.EDITION_CANCELED:
|
|
116
|
+
ApplicationUtils.confirm(this.i18n("components.warning"), this.i18n("components.confirmCancelEdition"))
|
|
117
|
+
.then((result) => resolve(result ? action : undefined));
|
|
118
|
+
break;
|
|
119
|
+
case Action.REMOVING_RECORDS:
|
|
120
|
+
ApplicationUtils.confirm(this.i18n("components.delete"), this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
|
|
121
|
+
.then((result) => resolve(result ? action : undefined));
|
|
122
|
+
break;
|
|
123
|
+
default:
|
|
124
|
+
resolve(action);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
getActionInfo(action) {
|
|
129
|
+
if (this.messageBuilder) {
|
|
130
|
+
return this.messageBuilder(action, this.dataState, this.dataUnit);
|
|
131
|
+
}
|
|
132
|
+
if (action === Action.EDITION_CANCELED) {
|
|
133
|
+
return this.i18n("components.editionCanceled");
|
|
134
|
+
}
|
|
135
|
+
}
|
|
98
136
|
async loadDataUnit() {
|
|
99
137
|
if (!this.dataUnit) {
|
|
100
138
|
const app = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
101
139
|
if (app && this.entityName) {
|
|
102
|
-
this.
|
|
140
|
+
const cacheName = this.dataUnitName ? this.dataUnitName : this.entityName;
|
|
141
|
+
this.dataUnit = await app.getDataUnit(this.entityName, cacheName);
|
|
103
142
|
this.dataUnit.pageSize = this.pageSize;
|
|
104
143
|
this.dataUnit.unsubscribe(this._dataUnitObserver);
|
|
105
144
|
this.dataUnit.addInterceptor(this);
|
|
@@ -108,6 +147,9 @@ const SnkDataUnit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
108
147
|
while (resolver = this._onDataUnitResolve.pop()) {
|
|
109
148
|
resolver(this.dataUnit);
|
|
110
149
|
}
|
|
150
|
+
if (this.autoLoad) {
|
|
151
|
+
this.dataUnit.loadData();
|
|
152
|
+
}
|
|
111
153
|
}
|
|
112
154
|
}
|
|
113
155
|
}
|
|
@@ -121,6 +163,9 @@ const SnkDataUnit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
121
163
|
};
|
|
122
164
|
return pt_br[key];
|
|
123
165
|
}
|
|
166
|
+
//---------------------------------------------
|
|
167
|
+
// Lifecycle web component
|
|
168
|
+
//---------------------------------------------
|
|
124
169
|
componentDidRender() {
|
|
125
170
|
this.loadDataUnit();
|
|
126
171
|
}
|
|
@@ -143,6 +188,9 @@ const SnkDataUnit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
143
188
|
"pageSize": [2, "page-size"],
|
|
144
189
|
"dataUnit": [1040],
|
|
145
190
|
"messageBuilder": [16],
|
|
191
|
+
"beforeSave": [16],
|
|
192
|
+
"afterSave": [16],
|
|
193
|
+
"autoLoad": [4, "auto-load"],
|
|
146
194
|
"getDataUnit": [64]
|
|
147
195
|
}]);
|
|
148
196
|
function defineCustomElement$1() {
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { h, proxyCustomElement, HTMLElement, createEvent, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { ApplicationContext } from '@sankhyalabs/core';
|
|
3
3
|
|
|
4
|
-
const SnkPopupButton = ({ className, title, source, opened, setOpened, actionClick }) => {
|
|
5
|
-
return (h("div", { class: "ez-flex " + className },
|
|
6
|
-
h("ez-button", { id: "moreOptionsButton", title: title, mode: "icon", iconName: "dots-vertical", size: "small", onClick: () => setOpened(true) }),
|
|
7
|
-
h("ez-popover", { opened: opened, autoClose: true, innerElement: ["moreOptionsButton", "moreOptionsDiv"], onEzVisibilityChange: (event) => setOpened(event.detail) },
|
|
8
|
-
h("div", { id: "moreOptionsDiv", class: "ez-padding--small" }, source.map((option, index) => h("ez-button", { className: "btn-options", size: "small", label: option.label, key: index, onClick: () => actionClick(option) }))))));
|
|
9
|
-
};
|
|
10
|
-
|
|
11
4
|
var TaskbarElement;
|
|
12
5
|
(function (TaskbarElement) {
|
|
13
6
|
TaskbarElement["PREVIOUS"] = "PREVIOUS";
|
|
@@ -33,7 +26,7 @@ var AuthorizationElements;
|
|
|
33
26
|
AuthorizationElements["INSERT"] = "INSERT";
|
|
34
27
|
AuthorizationElements["CONFIG_GRID"] = "CONFIG_GRID";
|
|
35
28
|
})(AuthorizationElements || (AuthorizationElements = {}));
|
|
36
|
-
const buildElem = (element, className, getTitle, action, isEnabled) => {
|
|
29
|
+
const buildElem = (element, className, getTitle, action, isEnabled, actions) => {
|
|
37
30
|
switch (element) {
|
|
38
31
|
case TaskbarElement.PREVIOUS:
|
|
39
32
|
return iconButton("chevron-left", element, className, getTitle, action, isEnabled);
|
|
@@ -59,6 +52,8 @@ const buildElem = (element, className, getTitle, action, isEnabled) => {
|
|
|
59
52
|
return iconButton("list", element, className, getTitle, action, isEnabled);
|
|
60
53
|
case TaskbarElement.CONFIG_GRID:
|
|
61
54
|
return iconButton("settings-inverted", element, className, getTitle, action, isEnabled);
|
|
55
|
+
case TaskbarElement.MORE_OPTIONS:
|
|
56
|
+
return h("ez-actions-button", { size: "small", class: className, enabled: isEnabled(element), onEzAction: (evt) => action(evt.detail.value), actions: actions });
|
|
62
57
|
case TaskbarElement.DIVIDER:
|
|
63
58
|
return h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-horizontal--medium" });
|
|
64
59
|
}
|
|
@@ -78,7 +73,6 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
78
73
|
super();
|
|
79
74
|
this.__registerHost();
|
|
80
75
|
this.actionClick = createEvent(this, "actionClick", 7);
|
|
81
|
-
this._moreOptionsOpened = false;
|
|
82
76
|
}
|
|
83
77
|
observeButtons() {
|
|
84
78
|
this._definitions = undefined;
|
|
@@ -151,10 +145,6 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
151
145
|
}
|
|
152
146
|
this.actionClick.emit(elem);
|
|
153
147
|
}
|
|
154
|
-
actionClickHandler(act) {
|
|
155
|
-
this._moreOptionsOpened = false;
|
|
156
|
-
this.actionClick.emit(act.key);
|
|
157
|
-
}
|
|
158
148
|
isEnabled(elem) {
|
|
159
149
|
return !(this.disabledButtons && this.disabledButtons.includes(elem));
|
|
160
150
|
}
|
|
@@ -164,29 +154,22 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
164
154
|
if (index > 1) {
|
|
165
155
|
className += "ez-padding-left--medium";
|
|
166
156
|
}
|
|
167
|
-
|
|
168
|
-
element = this.actionsList ? h(SnkPopupButton, { className: className, title: this.getTitle(def), source: this.actionsList, opened: this._moreOptionsOpened, setOpened: opened => this._moreOptionsOpened = opened, actionClick: act => this.actionClickHandler(act) }) : undefined;
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
element = buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem));
|
|
172
|
-
}
|
|
157
|
+
element = buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList);
|
|
173
158
|
return element;
|
|
174
159
|
}
|
|
175
160
|
// Lifecycle
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
snkApplication.getAllAccess().then(access => this._permissions = access);
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
this._permissions = {};
|
|
184
|
-
}
|
|
161
|
+
componentWillLoad() {
|
|
162
|
+
const snkApplication = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
163
|
+
if (snkApplication) {
|
|
164
|
+
snkApplication.getAllAccess().then(access => this._permissions = access);
|
|
185
165
|
}
|
|
186
166
|
else {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
167
|
+
this._permissions = {};
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
componentWillRender() {
|
|
171
|
+
if (this._definitions == undefined && this._permissions) {
|
|
172
|
+
this._definitions = this.elementsFromString(this.buttons);
|
|
190
173
|
}
|
|
191
174
|
}
|
|
192
175
|
render() {
|
|
@@ -219,7 +202,6 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
219
202
|
"primaryButton": [1, "primary-button"],
|
|
220
203
|
"disabledButtons": [16],
|
|
221
204
|
"dataUnit": [16],
|
|
222
|
-
"_moreOptionsOpened": [32],
|
|
223
205
|
"_permissions": [32]
|
|
224
206
|
}]);
|
|
225
207
|
function defineCustomElement() {
|
|
@@ -187,10 +187,6 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
if (typeof nodeName === 'function') {
|
|
191
|
-
// nodeName is a functional component
|
|
192
|
-
return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
|
|
193
|
-
}
|
|
194
190
|
const vnode = newVNode(nodeName, null);
|
|
195
191
|
vnode.$attrs$ = vnodeData;
|
|
196
192
|
if (vNodeChildren.length > 0) {
|
|
@@ -225,36 +221,6 @@ const newVNode = (tag, text) => {
|
|
|
225
221
|
};
|
|
226
222
|
const Host = {};
|
|
227
223
|
const isHost = (node) => node && node.$tag$ === Host;
|
|
228
|
-
const vdomFnUtils = {
|
|
229
|
-
forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
|
|
230
|
-
map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
|
|
231
|
-
};
|
|
232
|
-
const convertToPublic = (node) => ({
|
|
233
|
-
vattrs: node.$attrs$,
|
|
234
|
-
vchildren: node.$children$,
|
|
235
|
-
vkey: node.$key$,
|
|
236
|
-
vname: node.$name$,
|
|
237
|
-
vtag: node.$tag$,
|
|
238
|
-
vtext: node.$text$,
|
|
239
|
-
});
|
|
240
|
-
const convertToPrivate = (node) => {
|
|
241
|
-
if (typeof node.vtag === 'function') {
|
|
242
|
-
const vnodeData = Object.assign({}, node.vattrs);
|
|
243
|
-
if (node.vkey) {
|
|
244
|
-
vnodeData.key = node.vkey;
|
|
245
|
-
}
|
|
246
|
-
if (node.vname) {
|
|
247
|
-
vnodeData.name = node.vname;
|
|
248
|
-
}
|
|
249
|
-
return h(node.vtag, vnodeData, ...(node.vchildren || []));
|
|
250
|
-
}
|
|
251
|
-
const vnode = newVNode(node.vtag, node.vtext);
|
|
252
|
-
vnode.$attrs$ = node.vattrs;
|
|
253
|
-
vnode.$children$ = node.vchildren;
|
|
254
|
-
vnode.$key$ = node.vkey;
|
|
255
|
-
vnode.$name$ = node.vname;
|
|
256
|
-
return vnode;
|
|
257
|
-
};
|
|
258
224
|
/**
|
|
259
225
|
* Production setAccessor() function based on Preact by
|
|
260
226
|
* Jason Miller (@developit)
|
|
@@ -1144,6 +1110,11 @@ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
|
1144
1110
|
const parsePropertyValue = (propValue, propType) => {
|
|
1145
1111
|
// ensure this value is of the correct prop type
|
|
1146
1112
|
if (propValue != null && !isComplexType(propValue)) {
|
|
1113
|
+
if (propType & 4 /* Boolean */) {
|
|
1114
|
+
// per the HTML spec, any string value means it is a boolean true value
|
|
1115
|
+
// but we'll cheat here and say that the string "false" is the boolean false
|
|
1116
|
+
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
1117
|
+
}
|
|
1147
1118
|
if (propType & 2 /* Number */) {
|
|
1148
1119
|
// force it to be a number
|
|
1149
1120
|
return parseFloat(propValue);
|
package/dist/esm/loader.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-0b078db7.js';
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
Stencil Client Patch Esm v2.16.1 | MIT Licensed | https://stenciljs.com
|
|
@@ -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([["teste-pesquisa",[[1,"teste-pesquisa"]]],["snk-form",[[2,"snk-form",{"formTitle":[1,"form-title"],"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-grid",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-data-unit",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"messageBuilder":[16],"getDataUnit":[64]}]]],["snk-pesquisa",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-application",[[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],"
|
|
13
|
+
return bootstrapLazy([["teste-pesquisa",[[1,"teste-pesquisa"]]],["snk-form",[[2,"snk-form",{"formTitle":[1,"form-title"],"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-grid",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-data-unit",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"messageBuilder":[16],"beforeSave":[16],"afterSave":[16],"autoLoad":[4,"auto-load"],"getDataUnit":[64]}]]],["snk-pesquisa",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-application",[[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],"getDataUnit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"saveGridConfig":[64],"executeSearch":[64],"isDebugMode":[64]}]]],["snk-taskbar",[[6,"snk-taskbar",{"buttons":[1],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_permissions":[32]}]]]], options);
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-0b078db7.js';
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
Stencil Client Patch Browser v2.16.1 | MIT Licensed | https://stenciljs.com
|
|
@@ -13,5 +13,5 @@ const patchBrowser = () => {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
patchBrowser().then(options => {
|
|
16
|
-
return bootstrapLazy([["teste-pesquisa",[[1,"teste-pesquisa"]]],["snk-form",[[2,"snk-form",{"formTitle":[1,"form-title"],"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-grid",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-data-unit",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"messageBuilder":[16],"getDataUnit":[64]}]]],["snk-pesquisa",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-application",[[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],"
|
|
16
|
+
return bootstrapLazy([["teste-pesquisa",[[1,"teste-pesquisa"]]],["snk-form",[[2,"snk-form",{"formTitle":[1,"form-title"],"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-grid",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-data-unit",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"messageBuilder":[16],"beforeSave":[16],"afterSave":[16],"autoLoad":[4,"auto-load"],"getDataUnit":[64]}]]],["snk-pesquisa",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-application",[[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],"getDataUnit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"saveGridConfig":[64],"executeSearch":[64],"isDebugMode":[64]}]]],["snk-taskbar",[[6,"snk-taskbar",{"buttons":[1],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_permissions":[32]}]]]], options);
|
|
17
17
|
});
|