@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.
Files changed (54) hide show
  1. package/dist/cjs/{index-e42cb45d.js → index-532bcc28.js} +5 -34
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/sankhyablocks.cjs.js +2 -2
  4. package/dist/cjs/snk-application.cjs.entry.js +111 -15
  5. package/dist/cjs/snk-data-unit.cjs.entry.js +82 -37
  6. package/dist/cjs/snk-form.cjs.entry.js +1 -1
  7. package/dist/cjs/snk-grid.cjs.entry.js +2 -2
  8. package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
  9. package/dist/cjs/snk-taskbar.cjs.entry.js +15 -34
  10. package/dist/cjs/{taskbar-elements-bfa647c7.js → taskbar-elements-9d47b416.js} +4 -2
  11. package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
  12. package/dist/collection/components/snk-application/snk-application.js +107 -31
  13. package/dist/collection/components/snk-data-unit/snk-data-unit.js +171 -47
  14. package/dist/collection/components/snk-form/snk-form.js +5 -5
  15. package/dist/collection/components/snk-grid/snk-grid.js +3 -3
  16. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +3 -1
  17. package/dist/collection/components/snk-taskbar/snk-taskbar.js +17 -33
  18. package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +30 -10
  19. package/dist/components/snk-application2.js +111 -15
  20. package/dist/components/snk-data-unit.js +84 -36
  21. package/dist/components/snk-taskbar2.js +14 -32
  22. package/dist/esm/{index-02c04e0f.js → index-0b078db7.js} +5 -34
  23. package/dist/esm/loader.js +2 -2
  24. package/dist/esm/sankhyablocks.js +2 -2
  25. package/dist/esm/snk-application.entry.js +111 -15
  26. package/dist/esm/snk-data-unit.entry.js +82 -37
  27. package/dist/esm/snk-form.entry.js +1 -1
  28. package/dist/esm/snk-grid.entry.js +2 -2
  29. package/dist/esm/snk-pesquisa.entry.js +1 -1
  30. package/dist/esm/snk-taskbar.entry.js +13 -32
  31. package/dist/esm/{taskbar-elements-fe7cbf0e.js → taskbar-elements-3ba30bf4.js} +4 -2
  32. package/dist/esm/teste-pesquisa.entry.js +1 -1
  33. package/dist/sankhyablocks/{p-b80352ac.entry.js → p-3cb106f7.entry.js} +3 -3
  34. package/dist/sankhyablocks/p-3fce3190.entry.js +1 -0
  35. package/dist/sankhyablocks/{p-37b06977.entry.js → p-560fdf54.entry.js} +1 -1
  36. package/dist/sankhyablocks/p-574764bf.js +1 -0
  37. package/dist/sankhyablocks/p-8f7b9a85.entry.js +1 -0
  38. package/dist/sankhyablocks/{p-c156b1da.entry.js → p-9c225717.entry.js} +1 -1
  39. package/dist/sankhyablocks/p-a45dba1a.js +2 -0
  40. package/dist/sankhyablocks/{p-e38386b1.entry.js → p-a670853c.entry.js} +1 -1
  41. package/dist/sankhyablocks/{p-376004ef.entry.js → p-a8305c35.entry.js} +1 -1
  42. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  43. package/dist/types/components/snk-application/snk-application.d.ts +85 -9
  44. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +2 -1
  45. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +20 -3
  46. package/dist/types/components.d.ts +223 -2
  47. package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +2 -0
  48. package/package.json +1 -1
  49. package/dist/collection/components/snk-taskbar/component/snk-popup-button.js +0 -7
  50. package/dist/sankhyablocks/p-09e48ff8.entry.js +0 -1
  51. package/dist/sankhyablocks/p-64e2471c.js +0 -1
  52. package/dist/sankhyablocks/p-cc9c348a.entry.js +0 -1
  53. package/dist/sankhyablocks/p-db215c74.js +0 -2
  54. package/dist/types/components/snk-taskbar/component/snk-popup-button.d.ts +0 -12
@@ -209,10 +209,6 @@ const h = (nodeName, vnodeData, ...children) => {
209
209
  }
210
210
  }
211
211
  }
212
- if (typeof nodeName === 'function') {
213
- // nodeName is a functional component
214
- return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
215
- }
216
212
  const vnode = newVNode(nodeName, null);
217
213
  vnode.$attrs$ = vnodeData;
218
214
  if (vNodeChildren.length > 0) {
@@ -247,36 +243,6 @@ const newVNode = (tag, text) => {
247
243
  };
248
244
  const Host = {};
249
245
  const isHost = (node) => node && node.$tag$ === Host;
250
- const vdomFnUtils = {
251
- forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
252
- map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
253
- };
254
- const convertToPublic = (node) => ({
255
- vattrs: node.$attrs$,
256
- vchildren: node.$children$,
257
- vkey: node.$key$,
258
- vname: node.$name$,
259
- vtag: node.$tag$,
260
- vtext: node.$text$,
261
- });
262
- const convertToPrivate = (node) => {
263
- if (typeof node.vtag === 'function') {
264
- const vnodeData = Object.assign({}, node.vattrs);
265
- if (node.vkey) {
266
- vnodeData.key = node.vkey;
267
- }
268
- if (node.vname) {
269
- vnodeData.name = node.vname;
270
- }
271
- return h(node.vtag, vnodeData, ...(node.vchildren || []));
272
- }
273
- const vnode = newVNode(node.vtag, node.vtext);
274
- vnode.$attrs$ = node.vattrs;
275
- vnode.$children$ = node.vchildren;
276
- vnode.$key$ = node.vkey;
277
- vnode.$name$ = node.vname;
278
- return vnode;
279
- };
280
246
  /**
281
247
  * Production setAccessor() function based on Preact by
282
248
  * Jason Miller (@developit)
@@ -1166,6 +1132,11 @@ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1166
1132
  const parsePropertyValue = (propValue, propType) => {
1167
1133
  // ensure this value is of the correct prop type
1168
1134
  if (propValue != null && !isComplexType(propValue)) {
1135
+ if (propType & 4 /* Boolean */) {
1136
+ // per the HTML spec, any string value means it is a boolean true value
1137
+ // but we'll cheat here and say that the string "false" is the boolean false
1138
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
1139
+ }
1169
1140
  if (propType & 2 /* Number */) {
1170
1141
  // force it to be a number
1171
1142
  return parseFloat(propValue);
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-e42cb45d.js');
5
+ const index = require('./index-532bcc28.js');
6
6
 
7
7
  /*
8
8
  Stencil Client Patch Esm v2.16.1 | MIT Licensed | https://stenciljs.com
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["teste-pesquisa.cjs",[[1,"teste-pesquisa"]]],["snk-form.cjs",[[2,"snk-form",{"formTitle":[1,"form-title"],"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-grid.cjs",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["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],"messageBuilder":[16],"getDataUnit":[64]}]]],["snk-pesquisa.cjs",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-application.cjs",[[2,"snk-application",{"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getOrCreateDataUnit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"saveGridConfig":[64],"executeSearch":[64],"isDebugMode":[64]}]]],["snk-taskbar.cjs",[[6,"snk-taskbar",{"buttons":[1],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_moreOptionsOpened":[32],"_permissions":[32]}]]]], options);
17
+ return index.bootstrapLazy([["teste-pesquisa.cjs",[[1,"teste-pesquisa"]]],["snk-form.cjs",[[2,"snk-form",{"formTitle":[1,"form-title"],"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-grid.cjs",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["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],"messageBuilder":[16],"beforeSave":[16],"afterSave":[16],"autoLoad":[4,"auto-load"],"getDataUnit":[64]}]]],["snk-pesquisa.cjs",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-application.cjs",[[2,"snk-application",{"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getDataUnit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"saveGridConfig":[64],"executeSearch":[64],"isDebugMode":[64]}]]],["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
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-e42cb45d.js');
3
+ const index = require('./index-532bcc28.js');
4
4
 
5
5
  /*
6
6
  Stencil Client Patch Browser v2.16.1 | MIT Licensed | https://stenciljs.com
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["teste-pesquisa.cjs",[[1,"teste-pesquisa"]]],["snk-form.cjs",[[2,"snk-form",{"formTitle":[1,"form-title"],"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-grid.cjs",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["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],"messageBuilder":[16],"getDataUnit":[64]}]]],["snk-pesquisa.cjs",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-application.cjs",[[2,"snk-application",{"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getOrCreateDataUnit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"saveGridConfig":[64],"executeSearch":[64],"isDebugMode":[64]}]]],["snk-taskbar.cjs",[[6,"snk-taskbar",{"buttons":[1],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_moreOptionsOpened":[32],"_permissions":[32]}]]]], options);
18
+ return index.bootstrapLazy([["teste-pesquisa.cjs",[[1,"teste-pesquisa"]]],["snk-form.cjs",[[2,"snk-form",{"formTitle":[1,"form-title"],"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["snk-grid.cjs",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"_dataUnit":[32],"_configLoaded":[32],"_dataState":[32]}]]],["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],"messageBuilder":[16],"beforeSave":[16],"afterSave":[16],"autoLoad":[4,"auto-load"],"getDataUnit":[64]}]]],["snk-pesquisa.cjs",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-application.cjs",[[2,"snk-application",{"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getDataUnit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"saveGridConfig":[64],"executeSearch":[64],"isDebugMode":[64]}]]],["snk-taskbar.cjs",[[6,"snk-taskbar",{"buttons":[1],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_permissions":[32]}]]]], options);
19
19
  });
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-e42cb45d.js');
5
+ const index = require('./index-532bcc28.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
8
8
 
@@ -6691,6 +6691,7 @@ class WaitingRequest {
6691
6691
  class DataUnitFetcher {
6692
6692
  constructor() {
6693
6693
  this.templateByQuery = new Map();
6694
+ this._loadDataTimeout = {};
6694
6695
  this.buldTemplates();
6695
6696
  }
6696
6697
  buldTemplates() {
@@ -6788,6 +6789,21 @@ class DataUnitFetcher {
6788
6789
  });
6789
6790
  }
6790
6791
  loadData(dataUnit, request) {
6792
+ const duName = dataUnit.name;
6793
+ if (this._loadDataTimeout[duName]) {
6794
+ clearTimeout(this._loadDataTimeout[duName]);
6795
+ delete this._loadDataTimeout[duName];
6796
+ }
6797
+ return new Promise((resolve, reject) => {
6798
+ this._loadDataTimeout[duName] = setTimeout(() => {
6799
+ delete this._loadDataTimeout[duName];
6800
+ this.doLoadData(dataUnit, request)
6801
+ .then(result => resolve(result))
6802
+ .catch(reason => reject(reason));
6803
+ }, 200);
6804
+ });
6805
+ }
6806
+ doLoadData(dataUnit, request) {
6791
6807
  return new Promise((resolve, reject) => {
6792
6808
  var _a;
6793
6809
  const { sort, filters, limit, offset, quickFilter } = request;
@@ -6815,9 +6831,19 @@ class DataUnitFetcher {
6815
6831
  })
6816
6832
  .then((resp) => {
6817
6833
  const { limit, offset, total, hasMore, records } = resp.data;
6818
- const firstRecord = offset + 1;
6819
- const lastRecord = offset + Math.min(records.length, limit);
6820
- const currentPage = offset / limit;
6834
+ let paginationInfo;
6835
+ if (limit) {
6836
+ const firstRecord = offset + 1;
6837
+ const lastRecord = offset + Math.min(records.length, limit);
6838
+ const currentPage = offset / limit;
6839
+ paginationInfo = {
6840
+ firstRecord,
6841
+ lastRecord,
6842
+ total,
6843
+ currentPage,
6844
+ hasMore
6845
+ };
6846
+ }
6821
6847
  const processedRecords = [];
6822
6848
  records.forEach((responseRecord) => {
6823
6849
  const duRecord = { __record__id__: responseRecord.id };
@@ -6827,13 +6853,7 @@ class DataUnitFetcher {
6827
6853
  processedRecords.push(duRecord);
6828
6854
  });
6829
6855
  resolve({
6830
- paginationInfo: {
6831
- firstRecord,
6832
- lastRecord,
6833
- total,
6834
- currentPage,
6835
- hasMore
6836
- },
6856
+ paginationInfo,
6837
6857
  records: processedRecords
6838
6858
  });
6839
6859
  })
@@ -7294,6 +7314,9 @@ const SnkApplication = class {
7294
7314
  }
7295
7315
  });
7296
7316
  }
7317
+ /**
7318
+ * Caso o usuário logado seja o SUP.
7319
+ */
7297
7320
  async isUserSup() {
7298
7321
  return new Promise((resolve, reject) => {
7299
7322
  this.auth.then((authorization) => {
@@ -7303,6 +7326,9 @@ const SnkApplication = class {
7303
7326
  });
7304
7327
  });
7305
7328
  }
7329
+ /**
7330
+ * Se o usuário logado tem permissão pra determinada ação.
7331
+ */
7306
7332
  async hasAccess(access) {
7307
7333
  return new Promise((resolve, reject) => {
7308
7334
  this.auth.then((authorization) => {
@@ -7312,6 +7338,9 @@ const SnkApplication = class {
7312
7338
  });
7313
7339
  });
7314
7340
  }
7341
+ /**
7342
+ * Retorna todos os acessos do usuário logado.
7343
+ */
7315
7344
  async getAllAccess() {
7316
7345
  return new Promise((resolve, reject) => {
7317
7346
  this.auth.then((authorization) => {
@@ -7326,34 +7355,55 @@ const SnkApplication = class {
7326
7355
  });
7327
7356
  });
7328
7357
  }
7329
- async getAuthList(_auth) {
7330
- return await (new MGEAuthorization()).parseFromJSON(_auth);
7331
- }
7358
+ /**
7359
+ * Retorna o valor de um parâmetro do tipo string.
7360
+ */
7332
7361
  async getStringParam(name) {
7333
7362
  return this.parameters.asString(name, this.resourceID);
7334
7363
  }
7364
+ /**
7365
+ * Retorna o valor de um parâmetro do tipo Inteiro.
7366
+ */
7335
7367
  async getIntParam(name) {
7336
7368
  return this.parameters.asInteger(name, this.resourceID);
7337
7369
  }
7370
+ /**
7371
+ * Retorna o valor de um parâmetro do tipo Decimal.
7372
+ */
7338
7373
  async getFloatParam(name) {
7339
7374
  return this.parameters.asFloat(name, this.resourceID);
7340
7375
  }
7376
+ /**
7377
+ * Retorna o valor de um parâmetro do tipo booleano.
7378
+ */
7341
7379
  async getBooleanParam(name) {
7342
7380
  return this.parameters.asBoolean(name, this.resourceID);
7343
7381
  }
7382
+ /**
7383
+ * Retorna o valor de um parâmetro do tipo data.
7384
+ */
7344
7385
  async getDateParam(name) {
7345
7386
  return this.parameters.asDate(name, this.resourceID);
7346
7387
  }
7388
+ /**
7389
+ * Mostra o conteúdo passado em um Popup
7390
+ */
7347
7391
  async showPopUp(content) {
7348
7392
  this._popUp.appendChild(content);
7349
7393
  this._popUp["opened"] = true;
7350
7394
  }
7395
+ /**
7396
+ * Fecha o popup, liberando o conteúdo.
7397
+ */
7351
7398
  async closePopUp() {
7352
7399
  Array.from(this._popUp.children).forEach(c => {
7353
7400
  this._popUp.removeChild(c);
7354
7401
  });
7355
7402
  this._popUp["opened"] = false;
7356
7403
  }
7404
+ /**
7405
+ * Verifica se a licença do cliente tem determinado opcional (produto)
7406
+ */
7357
7407
  async temOpcional(opcional) {
7358
7408
  const opts = opcional.split(",");
7359
7409
  return new Promise((resolve, reject) => {
@@ -7377,6 +7427,10 @@ const SnkApplication = class {
7377
7427
  });
7378
7428
  });
7379
7429
  }
7430
+ /**
7431
+ * Retorna a configuração de um recurso por service broker
7432
+ * Veja também o método "loadConfig"
7433
+ */
7380
7434
  async getConfig(key) {
7381
7435
  let payload = {
7382
7436
  "serviceName": "SystemUtilsSP.getConf",
@@ -7394,6 +7448,9 @@ const SnkApplication = class {
7394
7448
  .catch(error => reject(error));
7395
7449
  });
7396
7450
  }
7451
+ /**
7452
+ * Salva a configuração de determinado recurso.
7453
+ */
7397
7454
  async saveConfig(key, data) {
7398
7455
  let payload = {
7399
7456
  "serviceName": "SystemUtilsSP.saveConf",
@@ -7412,19 +7469,31 @@ const SnkApplication = class {
7412
7469
  .catch(error => reject(error));
7413
7470
  });
7414
7471
  }
7472
+ /**
7473
+ * Acessa informações de contexto "empurrados" na abertura da tela
7474
+ */
7415
7475
  async getAttributeFromHTMLWrapper(attribName) {
7416
7476
  return Promise.resolve(window[attribName]);
7417
7477
  }
7478
+ /**
7479
+ * Abre determinada tela, repassando pkObject
7480
+ */
7418
7481
  async openApp(resourceId, pkObject) {
7419
7482
  Workspace.openAppActivity(resourceId, pkObject);
7420
7483
  }
7484
+ /**
7485
+ * Cria o DataUnit a partir do nome da entidade.
7486
+ */
7421
7487
  async createDataunit(entityName) {
7422
7488
  return new Promise(resolve => {
7423
7489
  const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, this.resourceID);
7424
7490
  dataUnit.loadMetadata().then(() => resolve(dataUnit));
7425
7491
  });
7426
7492
  }
7427
- async getOrCreateDataUnit(entityName, dataUnitName) {
7493
+ /**
7494
+ * Cria e armazena o DataUnit em um cache
7495
+ */
7496
+ async getDataUnit(entityName, dataUnitName) {
7428
7497
  return new Promise((resolve, reject) => {
7429
7498
  const dataUnit = this._duCache.get(dataUnitName);
7430
7499
  if (dataUnit) {
@@ -7440,30 +7509,57 @@ const SnkApplication = class {
7440
7509
  }
7441
7510
  });
7442
7511
  }
7512
+ /**
7513
+ * Retorna o resourceID da tela em questão.
7514
+ */
7443
7515
  async getResourceID() {
7444
7516
  return Promise.resolve(this.resourceID);
7445
7517
  }
7518
+ /**
7519
+ * Mostra o diálogo de alerta de acordo com os parâmetros passados.
7520
+ */
7446
7521
  async alert(title, message, icon, options) {
7447
7522
  return utils.ApplicationUtils.alert(title, message, icon, options);
7448
7523
  }
7524
+ /**
7525
+ * Mostra o diálogo de erro de acordo com os parâmetros passados.
7526
+ */
7449
7527
  async error(title, message, icon, options) {
7450
7528
  return utils.ApplicationUtils.error(title, message, icon, options);
7451
7529
  }
7530
+ /**
7531
+ * Exibe um diálogo de confirmação
7532
+ */
7452
7533
  async confirm(title, message, icon, critical, options) {
7453
7534
  return utils.ApplicationUtils.confirm(title, message, icon, critical, options);
7454
7535
  }
7536
+ /**
7537
+ * Mostra uma informação efêmera (de segundo plano).
7538
+ */
7455
7539
  async info(message, options) {
7456
7540
  return utils.ApplicationUtils.info(message, options);
7457
7541
  }
7542
+ /**
7543
+ * Busca a configuração de formulário.
7544
+ */
7458
7545
  async loadFormConfig(name) {
7459
7546
  return this.formConfigFetcher.loadFormConfig(name, this.resourceID);
7460
7547
  }
7548
+ /**
7549
+ * Busca a configuração de grade.
7550
+ */
7461
7551
  async loadGridConfig(name) {
7462
7552
  return this.gridConfigFetcher.getConfig(name, this.resourceID);
7463
7553
  }
7554
+ /**
7555
+ * Salva a configuração de grade.
7556
+ */
7464
7557
  async saveGridConfig(config) {
7465
7558
  return this.gridConfigFetcher.saveConfig(config, this.resourceID);
7466
7559
  }
7560
+ async getAuthList(_auth) {
7561
+ return await (new MGEAuthorization()).parseFromJSON(_auth);
7562
+ }
7467
7563
  get urlParams() {
7468
7564
  if (!this._urlParams) {
7469
7565
  this._urlParams = UrlUtils.getQueryParams(location.search);
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-e42cb45d.js');
5
+ const index = require('./index-532bcc28.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
8
8
 
@@ -13,12 +13,24 @@ const SnkDataUnit = class {
13
13
  index.registerInstance(this, hostRef);
14
14
  this.dataStateChange = index.createEvent(this, "dataStateChange", 7);
15
15
  this.dataUnitReady = index.createEvent(this, "dataUnitReady", 7);
16
+ this.insertionMode = index.createEvent(this, "insertionMode", 7);
16
17
  this._onDataUnitResolve = [];
18
+ /**
19
+ * Determina quantas linhas são retornadas por página
20
+ */
21
+ this.pageSize = 150;
22
+ /**
23
+ * Quando ativada essa propriedade faz com que haja uma carga imediata no DataUnit
24
+ */
25
+ this.autoLoad = true;
17
26
  this._dataUnitObserver = (action) => {
18
27
  let msg = this.getActionInfo(action.type);
19
28
  if (msg) {
20
29
  utils.ApplicationUtils.info(msg);
21
30
  }
31
+ if (action.type === core.Action.RECORDS_ADDED || action.type === core.Action.RECORDS_COPIED) {
32
+ this.insertionMode.emit();
33
+ }
22
34
  const duState = {
23
35
  insertionMode: false,
24
36
  hasNext: this.dataUnit.hasNext(),
@@ -36,41 +48,6 @@ const SnkDataUnit = class {
36
48
  this.dataState = duState;
37
49
  };
38
50
  }
39
- async getDataUnit() {
40
- return new Promise((resolve) => {
41
- if (this.dataUnit) {
42
- resolve(this.dataUnit);
43
- }
44
- else {
45
- this._onDataUnitResolve.push(resolve);
46
- }
47
- });
48
- }
49
- async interceptAction(action) {
50
- return new Promise(resolve => {
51
- if (action.type === core.Action.EDITION_CANCELED) {
52
- utils.ApplicationUtils.confirm(this.i18n("components.warning"), this.i18n("components.confirmCancelEdition"))
53
- .then((result) => resolve(result ? action : undefined));
54
- }
55
- else if (action.type === core.Action.REMOVING_RECORDS) {
56
- utils.ApplicationUtils.confirm(this.i18n("components.delete"), this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
57
- .then((result) => resolve(result ? action : undefined));
58
- }
59
- else {
60
- resolve(action);
61
- }
62
- });
63
- }
64
- getActionInfo(action) {
65
- if (this.messageBuilder) {
66
- return this.messageBuilder(action, this.dataState, this.dataUnit);
67
- }
68
- else {
69
- if (action === core.Action.EDITION_CANCELED) {
70
- return this.i18n("components.editionCanceled");
71
- }
72
- }
73
- }
74
51
  observePageSize() {
75
52
  if (this.dataUnit) {
76
53
  this.dataUnit.pageSize = this.pageSize;
@@ -98,11 +75,73 @@ const SnkDataUnit = class {
98
75
  observeDataUnit() {
99
76
  this.dataUnitReady.emit(this.dataUnit);
100
77
  }
78
+ /**
79
+ * Pode-se obter o dataUnit através desse método. Outra forma, é ouvir o evento de
80
+ *
81
+ * @returns dataUnit
82
+ */
83
+ async getDataUnit() {
84
+ return new Promise((resolve) => {
85
+ if (this.dataUnit) {
86
+ resolve(this.dataUnit);
87
+ }
88
+ else {
89
+ this._onDataUnitResolve.push(resolve);
90
+ }
91
+ });
92
+ }
93
+ async interceptAction(action) {
94
+ return new Promise(resolve => {
95
+ switch (action.type) {
96
+ case core.Action.SAVING_DATA:
97
+ if (this.beforeSave) {
98
+ const continueAction = this.beforeSave(this.dataUnit);
99
+ if (continueAction instanceof Promise) {
100
+ continueAction.then(result => resolve(result ? action : undefined));
101
+ }
102
+ else {
103
+ resolve(continueAction ? action : undefined);
104
+ }
105
+ }
106
+ else {
107
+ resolve(action);
108
+ }
109
+ break;
110
+ case core.Action.DATA_SAVED:
111
+ if (this.afterSave) {
112
+ this.afterSave(this.dataUnit);
113
+ }
114
+ else {
115
+ resolve(action);
116
+ }
117
+ break;
118
+ case core.Action.EDITION_CANCELED:
119
+ utils.ApplicationUtils.confirm(this.i18n("components.warning"), this.i18n("components.confirmCancelEdition"))
120
+ .then((result) => resolve(result ? action : undefined));
121
+ break;
122
+ case core.Action.REMOVING_RECORDS:
123
+ utils.ApplicationUtils.confirm(this.i18n("components.delete"), this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
124
+ .then((result) => resolve(result ? action : undefined));
125
+ break;
126
+ default:
127
+ resolve(action);
128
+ }
129
+ });
130
+ }
131
+ getActionInfo(action) {
132
+ if (this.messageBuilder) {
133
+ return this.messageBuilder(action, this.dataState, this.dataUnit);
134
+ }
135
+ if (action === core.Action.EDITION_CANCELED) {
136
+ return this.i18n("components.editionCanceled");
137
+ }
138
+ }
101
139
  async loadDataUnit() {
102
140
  if (!this.dataUnit) {
103
141
  const app = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
104
142
  if (app && this.entityName) {
105
- this.dataUnit = await app.getOrCreateDataUnit(this.entityName, this.dataUnitName);
143
+ const cacheName = this.dataUnitName ? this.dataUnitName : this.entityName;
144
+ this.dataUnit = await app.getDataUnit(this.entityName, cacheName);
106
145
  this.dataUnit.pageSize = this.pageSize;
107
146
  this.dataUnit.unsubscribe(this._dataUnitObserver);
108
147
  this.dataUnit.addInterceptor(this);
@@ -111,6 +150,9 @@ const SnkDataUnit = class {
111
150
  while (resolver = this._onDataUnitResolve.pop()) {
112
151
  resolver(this.dataUnit);
113
152
  }
153
+ if (this.autoLoad) {
154
+ this.dataUnit.loadData();
155
+ }
114
156
  }
115
157
  }
116
158
  }
@@ -124,6 +166,9 @@ const SnkDataUnit = class {
124
166
  };
125
167
  return pt_br[key];
126
168
  }
169
+ //---------------------------------------------
170
+ // Lifecycle web component
171
+ //---------------------------------------------
127
172
  componentDidRender() {
128
173
  this.loadDataUnit();
129
174
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-e42cb45d.js');
5
+ const index = require('./index-532bcc28.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
 
8
8
  const snkFormCss = ".sc-snk-form-h{display:block}";
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-e42cb45d.js');
5
+ const index = require('./index-532bcc28.js');
6
6
  const core = require('@sankhyalabs/core');
7
- const taskbarElements = require('./taskbar-elements-bfa647c7.js');
7
+ const taskbarElements = require('./taskbar-elements-9d47b416.js');
8
8
 
9
9
  const snkGridCss = ".sc-snk-grid-h{display:flex;height:100%;width:100%}";
10
10
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-e42cb45d.js');
5
+ const index = require('./index-532bcc28.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
 
8
8
  const snkPesquisaCss = ".sc-snk-pesquisa-h{--snk-pesquisa--font-size:var(--text--medium, 14px);--snk-pesquisa--font-family:var(--font-pattern, Arial);--snk-pesquisa--font-weight:var(--text-weight--medium, 400);--snk-pesquisa__records--color:var(--text--primary, #626e82);--snk-pesquisa__records--padding-vertical:var(--space--medium, 12px);--snk-pesquisa__content--padding-right:var(--space--small, 6px);--snk-pesquisa__content-scrollbar--background-color:var(--text--primary, #626e82);--snk-pesquisa__content-scrollbar--border-radius:var(--border--radius-medium, 12px);--snk-pesquisa__content-scrollbar--width:var(--space--medium, 12px) display: block;max-height:100%;height:100%;display:flex;flex-direction:column;overflow-y:auto}.snk-pesquisa.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%}.snk-pesquisa__input.sc-snk-pesquisa{display:flex;width:100%;box-sizing:border-box;padding-top:4px;padding-right:4px}.snk-pesquisa__input-close.sc-snk-pesquisa{cursor:pointer}.snk-pesquisa__content.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%;overflow-y:auto;padding-right:var(--snk-pesquisa__content--padding-right)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-track{background-color:#f0f2f5;border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb{background-color:var(--snk-pesquisa__content-scrollbar--background-color);border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar{background-color:#f0f2f5;width:var(--snk-pesquisa__content-scrollbar--width);max-width:var(--snk-pesquisa__content-scrollbar--width);min-width:var(--snk-pesquisa__content-scrollbar--width)}.snk-pesquisa__records.sc-snk-pesquisa{font-family:var(--snk-pesquisa--font-family);font-weight:var(--snk-pesquisa--font-weight);font-size:var(--snk-pesquisa--font-size);color:var(--snk-pesquisa__records--color);padding-bottom:var(--snk-pesquisa__records--padding-vertical);padding-top:var(--snk-pesquisa__records--padding-vertical)}";
@@ -2,16 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-e42cb45d.js');
5
+ const index = require('./index-532bcc28.js');
6
6
  const core = require('@sankhyalabs/core');
7
- const taskbarElements = require('./taskbar-elements-bfa647c7.js');
8
-
9
- const SnkPopupButton = ({ className, title, source, opened, setOpened, actionClick }) => {
10
- return (index.h("div", { class: "ez-flex " + className },
11
- index.h("ez-button", { id: "moreOptionsButton", title: title, mode: "icon", iconName: "dots-vertical", size: "small", onClick: () => setOpened(true) }),
12
- index.h("ez-popover", { opened: opened, autoClose: true, innerElement: ["moreOptionsButton", "moreOptionsDiv"], onEzVisibilityChange: (event) => setOpened(event.detail) },
13
- index.h("div", { id: "moreOptionsDiv", class: "ez-padding--small" }, source.map((option, index$1) => index.h("ez-button", { className: "btn-options", size: "small", label: option.label, key: index$1, onClick: () => actionClick(option) }))))));
14
- };
7
+ const taskbarElements = require('./taskbar-elements-9d47b416.js');
15
8
 
16
9
  const snkTaskbarCss = ".sc-snk-taskbar-h{display:flex}";
17
10
 
@@ -19,7 +12,6 @@ const SnkTaskbar = class {
19
12
  constructor(hostRef) {
20
13
  index.registerInstance(this, hostRef);
21
14
  this.actionClick = index.createEvent(this, "actionClick", 7);
22
- this._moreOptionsOpened = false;
23
15
  }
24
16
  observeButtons() {
25
17
  this._definitions = undefined;
@@ -92,42 +84,31 @@ const SnkTaskbar = class {
92
84
  }
93
85
  this.actionClick.emit(elem);
94
86
  }
95
- actionClickHandler(act) {
96
- this._moreOptionsOpened = false;
97
- this.actionClick.emit(act.key);
98
- }
99
87
  isEnabled(elem) {
100
88
  return !(this.disabledButtons && this.disabledButtons.includes(elem));
101
89
  }
102
- getElement(index$1, def) {
90
+ getElement(index, def) {
103
91
  let element;
104
92
  let className = def === this.primaryButton ? "ez-button--primary " : "";
105
- if (index$1 > 1) {
93
+ if (index > 1) {
106
94
  className += "ez-padding-left--medium";
107
95
  }
108
- if (def === taskbarElements.TaskbarElement.MORE_OPTIONS) {
109
- element = this.actionsList ? index.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;
110
- }
111
- else {
112
- element = taskbarElements.buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem));
113
- }
96
+ element = taskbarElements.buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList);
114
97
  return element;
115
98
  }
116
99
  // Lifecycle
117
- componentWillRender() {
118
- if (this._permissions === undefined) {
119
- const snkApplication = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
120
- if (snkApplication) {
121
- snkApplication.getAllAccess().then(access => this._permissions = access);
122
- }
123
- else {
124
- this._permissions = {};
125
- }
100
+ componentWillLoad() {
101
+ const snkApplication = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
102
+ if (snkApplication) {
103
+ snkApplication.getAllAccess().then(access => this._permissions = access);
126
104
  }
127
105
  else {
128
- if (this._definitions == undefined) {
129
- this._definitions = this.elementsFromString(this.buttons);
130
- }
106
+ this._permissions = {};
107
+ }
108
+ }
109
+ componentWillRender() {
110
+ if (this._definitions == undefined && this._permissions) {
111
+ this._definitions = this.elementsFromString(this.buttons);
131
112
  }
132
113
  }
133
114
  render() {