@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
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, c as createEvent, h } from './index-02c04e0f.js';
1
+ import { r as registerInstance, c as createEvent, h } from './index-0b078db7.js';
2
2
  import { ErrorException, StringUtils, DataUnit, DataType, ChangeOperation, DateUtils, ObjectUtils, WaitingChangeException, WarningException, DependencyType, ApplicationContext, ErrorTracking } from '@sankhyalabs/core';
3
3
  import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
 
@@ -6687,6 +6687,7 @@ class WaitingRequest {
6687
6687
  class DataUnitFetcher {
6688
6688
  constructor() {
6689
6689
  this.templateByQuery = new Map();
6690
+ this._loadDataTimeout = {};
6690
6691
  this.buldTemplates();
6691
6692
  }
6692
6693
  buldTemplates() {
@@ -6784,6 +6785,21 @@ class DataUnitFetcher {
6784
6785
  });
6785
6786
  }
6786
6787
  loadData(dataUnit, request) {
6788
+ const duName = dataUnit.name;
6789
+ if (this._loadDataTimeout[duName]) {
6790
+ clearTimeout(this._loadDataTimeout[duName]);
6791
+ delete this._loadDataTimeout[duName];
6792
+ }
6793
+ return new Promise((resolve, reject) => {
6794
+ this._loadDataTimeout[duName] = setTimeout(() => {
6795
+ delete this._loadDataTimeout[duName];
6796
+ this.doLoadData(dataUnit, request)
6797
+ .then(result => resolve(result))
6798
+ .catch(reason => reject(reason));
6799
+ }, 200);
6800
+ });
6801
+ }
6802
+ doLoadData(dataUnit, request) {
6787
6803
  return new Promise((resolve, reject) => {
6788
6804
  var _a;
6789
6805
  const { sort, filters, limit, offset, quickFilter } = request;
@@ -6811,9 +6827,19 @@ class DataUnitFetcher {
6811
6827
  })
6812
6828
  .then((resp) => {
6813
6829
  const { limit, offset, total, hasMore, records } = resp.data;
6814
- const firstRecord = offset + 1;
6815
- const lastRecord = offset + Math.min(records.length, limit);
6816
- const currentPage = offset / limit;
6830
+ let paginationInfo;
6831
+ if (limit) {
6832
+ const firstRecord = offset + 1;
6833
+ const lastRecord = offset + Math.min(records.length, limit);
6834
+ const currentPage = offset / limit;
6835
+ paginationInfo = {
6836
+ firstRecord,
6837
+ lastRecord,
6838
+ total,
6839
+ currentPage,
6840
+ hasMore
6841
+ };
6842
+ }
6817
6843
  const processedRecords = [];
6818
6844
  records.forEach((responseRecord) => {
6819
6845
  const duRecord = { __record__id__: responseRecord.id };
@@ -6823,13 +6849,7 @@ class DataUnitFetcher {
6823
6849
  processedRecords.push(duRecord);
6824
6850
  });
6825
6851
  resolve({
6826
- paginationInfo: {
6827
- firstRecord,
6828
- lastRecord,
6829
- total,
6830
- currentPage,
6831
- hasMore
6832
- },
6852
+ paginationInfo,
6833
6853
  records: processedRecords
6834
6854
  });
6835
6855
  })
@@ -7290,6 +7310,9 @@ const SnkApplication = class {
7290
7310
  }
7291
7311
  });
7292
7312
  }
7313
+ /**
7314
+ * Caso o usuário logado seja o SUP.
7315
+ */
7293
7316
  async isUserSup() {
7294
7317
  return new Promise((resolve, reject) => {
7295
7318
  this.auth.then((authorization) => {
@@ -7299,6 +7322,9 @@ const SnkApplication = class {
7299
7322
  });
7300
7323
  });
7301
7324
  }
7325
+ /**
7326
+ * Se o usuário logado tem permissão pra determinada ação.
7327
+ */
7302
7328
  async hasAccess(access) {
7303
7329
  return new Promise((resolve, reject) => {
7304
7330
  this.auth.then((authorization) => {
@@ -7308,6 +7334,9 @@ const SnkApplication = class {
7308
7334
  });
7309
7335
  });
7310
7336
  }
7337
+ /**
7338
+ * Retorna todos os acessos do usuário logado.
7339
+ */
7311
7340
  async getAllAccess() {
7312
7341
  return new Promise((resolve, reject) => {
7313
7342
  this.auth.then((authorization) => {
@@ -7322,34 +7351,55 @@ const SnkApplication = class {
7322
7351
  });
7323
7352
  });
7324
7353
  }
7325
- async getAuthList(_auth) {
7326
- return await (new MGEAuthorization()).parseFromJSON(_auth);
7327
- }
7354
+ /**
7355
+ * Retorna o valor de um parâmetro do tipo string.
7356
+ */
7328
7357
  async getStringParam(name) {
7329
7358
  return this.parameters.asString(name, this.resourceID);
7330
7359
  }
7360
+ /**
7361
+ * Retorna o valor de um parâmetro do tipo Inteiro.
7362
+ */
7331
7363
  async getIntParam(name) {
7332
7364
  return this.parameters.asInteger(name, this.resourceID);
7333
7365
  }
7366
+ /**
7367
+ * Retorna o valor de um parâmetro do tipo Decimal.
7368
+ */
7334
7369
  async getFloatParam(name) {
7335
7370
  return this.parameters.asFloat(name, this.resourceID);
7336
7371
  }
7372
+ /**
7373
+ * Retorna o valor de um parâmetro do tipo booleano.
7374
+ */
7337
7375
  async getBooleanParam(name) {
7338
7376
  return this.parameters.asBoolean(name, this.resourceID);
7339
7377
  }
7378
+ /**
7379
+ * Retorna o valor de um parâmetro do tipo data.
7380
+ */
7340
7381
  async getDateParam(name) {
7341
7382
  return this.parameters.asDate(name, this.resourceID);
7342
7383
  }
7384
+ /**
7385
+ * Mostra o conteúdo passado em um Popup
7386
+ */
7343
7387
  async showPopUp(content) {
7344
7388
  this._popUp.appendChild(content);
7345
7389
  this._popUp["opened"] = true;
7346
7390
  }
7391
+ /**
7392
+ * Fecha o popup, liberando o conteúdo.
7393
+ */
7347
7394
  async closePopUp() {
7348
7395
  Array.from(this._popUp.children).forEach(c => {
7349
7396
  this._popUp.removeChild(c);
7350
7397
  });
7351
7398
  this._popUp["opened"] = false;
7352
7399
  }
7400
+ /**
7401
+ * Verifica se a licença do cliente tem determinado opcional (produto)
7402
+ */
7353
7403
  async temOpcional(opcional) {
7354
7404
  const opts = opcional.split(",");
7355
7405
  return new Promise((resolve, reject) => {
@@ -7373,6 +7423,10 @@ const SnkApplication = class {
7373
7423
  });
7374
7424
  });
7375
7425
  }
7426
+ /**
7427
+ * Retorna a configuração de um recurso por service broker
7428
+ * Veja também o método "loadConfig"
7429
+ */
7376
7430
  async getConfig(key) {
7377
7431
  let payload = {
7378
7432
  "serviceName": "SystemUtilsSP.getConf",
@@ -7390,6 +7444,9 @@ const SnkApplication = class {
7390
7444
  .catch(error => reject(error));
7391
7445
  });
7392
7446
  }
7447
+ /**
7448
+ * Salva a configuração de determinado recurso.
7449
+ */
7393
7450
  async saveConfig(key, data) {
7394
7451
  let payload = {
7395
7452
  "serviceName": "SystemUtilsSP.saveConf",
@@ -7408,19 +7465,31 @@ const SnkApplication = class {
7408
7465
  .catch(error => reject(error));
7409
7466
  });
7410
7467
  }
7468
+ /**
7469
+ * Acessa informações de contexto "empurrados" na abertura da tela
7470
+ */
7411
7471
  async getAttributeFromHTMLWrapper(attribName) {
7412
7472
  return Promise.resolve(window[attribName]);
7413
7473
  }
7474
+ /**
7475
+ * Abre determinada tela, repassando pkObject
7476
+ */
7414
7477
  async openApp(resourceId, pkObject) {
7415
7478
  Workspace.openAppActivity(resourceId, pkObject);
7416
7479
  }
7480
+ /**
7481
+ * Cria o DataUnit a partir do nome da entidade.
7482
+ */
7417
7483
  async createDataunit(entityName) {
7418
7484
  return new Promise(resolve => {
7419
7485
  const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, this.resourceID);
7420
7486
  dataUnit.loadMetadata().then(() => resolve(dataUnit));
7421
7487
  });
7422
7488
  }
7423
- async getOrCreateDataUnit(entityName, dataUnitName) {
7489
+ /**
7490
+ * Cria e armazena o DataUnit em um cache
7491
+ */
7492
+ async getDataUnit(entityName, dataUnitName) {
7424
7493
  return new Promise((resolve, reject) => {
7425
7494
  const dataUnit = this._duCache.get(dataUnitName);
7426
7495
  if (dataUnit) {
@@ -7436,30 +7505,57 @@ const SnkApplication = class {
7436
7505
  }
7437
7506
  });
7438
7507
  }
7508
+ /**
7509
+ * Retorna o resourceID da tela em questão.
7510
+ */
7439
7511
  async getResourceID() {
7440
7512
  return Promise.resolve(this.resourceID);
7441
7513
  }
7514
+ /**
7515
+ * Mostra o diálogo de alerta de acordo com os parâmetros passados.
7516
+ */
7442
7517
  async alert(title, message, icon, options) {
7443
7518
  return ApplicationUtils.alert(title, message, icon, options);
7444
7519
  }
7520
+ /**
7521
+ * Mostra o diálogo de erro de acordo com os parâmetros passados.
7522
+ */
7445
7523
  async error(title, message, icon, options) {
7446
7524
  return ApplicationUtils.error(title, message, icon, options);
7447
7525
  }
7526
+ /**
7527
+ * Exibe um diálogo de confirmação
7528
+ */
7448
7529
  async confirm(title, message, icon, critical, options) {
7449
7530
  return ApplicationUtils.confirm(title, message, icon, critical, options);
7450
7531
  }
7532
+ /**
7533
+ * Mostra uma informação efêmera (de segundo plano).
7534
+ */
7451
7535
  async info(message, options) {
7452
7536
  return ApplicationUtils.info(message, options);
7453
7537
  }
7538
+ /**
7539
+ * Busca a configuração de formulário.
7540
+ */
7454
7541
  async loadFormConfig(name) {
7455
7542
  return this.formConfigFetcher.loadFormConfig(name, this.resourceID);
7456
7543
  }
7544
+ /**
7545
+ * Busca a configuração de grade.
7546
+ */
7457
7547
  async loadGridConfig(name) {
7458
7548
  return this.gridConfigFetcher.getConfig(name, this.resourceID);
7459
7549
  }
7550
+ /**
7551
+ * Salva a configuração de grade.
7552
+ */
7460
7553
  async saveGridConfig(config) {
7461
7554
  return this.gridConfigFetcher.saveConfig(config, this.resourceID);
7462
7555
  }
7556
+ async getAuthList(_auth) {
7557
+ return await (new MGEAuthorization()).parseFromJSON(_auth);
7558
+ }
7463
7559
  get urlParams() {
7464
7560
  if (!this._urlParams) {
7465
7561
  this._urlParams = UrlUtils.getQueryParams(location.search);
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, c as createEvent, h, g as getElement, H as Host } from './index-02c04e0f.js';
1
+ import { r as registerInstance, c as createEvent, h, g as getElement, H as Host } from './index-0b078db7.js';
2
2
  import { Action, ApplicationContext } from '@sankhyalabs/core';
3
3
  import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
 
@@ -9,12 +9,24 @@ const SnkDataUnit = class {
9
9
  registerInstance(this, hostRef);
10
10
  this.dataStateChange = createEvent(this, "dataStateChange", 7);
11
11
  this.dataUnitReady = createEvent(this, "dataUnitReady", 7);
12
+ this.insertionMode = createEvent(this, "insertionMode", 7);
12
13
  this._onDataUnitResolve = [];
14
+ /**
15
+ * Determina quantas linhas são retornadas por página
16
+ */
17
+ this.pageSize = 150;
18
+ /**
19
+ * Quando ativada essa propriedade faz com que haja uma carga imediata no DataUnit
20
+ */
21
+ this.autoLoad = true;
13
22
  this._dataUnitObserver = (action) => {
14
23
  let msg = this.getActionInfo(action.type);
15
24
  if (msg) {
16
25
  ApplicationUtils.info(msg);
17
26
  }
27
+ if (action.type === Action.RECORDS_ADDED || action.type === Action.RECORDS_COPIED) {
28
+ this.insertionMode.emit();
29
+ }
18
30
  const duState = {
19
31
  insertionMode: false,
20
32
  hasNext: this.dataUnit.hasNext(),
@@ -32,41 +44,6 @@ const SnkDataUnit = class {
32
44
  this.dataState = duState;
33
45
  };
34
46
  }
35
- async getDataUnit() {
36
- return new Promise((resolve) => {
37
- if (this.dataUnit) {
38
- resolve(this.dataUnit);
39
- }
40
- else {
41
- this._onDataUnitResolve.push(resolve);
42
- }
43
- });
44
- }
45
- async interceptAction(action) {
46
- return new Promise(resolve => {
47
- if (action.type === Action.EDITION_CANCELED) {
48
- ApplicationUtils.confirm(this.i18n("components.warning"), this.i18n("components.confirmCancelEdition"))
49
- .then((result) => resolve(result ? action : undefined));
50
- }
51
- else if (action.type === Action.REMOVING_RECORDS) {
52
- ApplicationUtils.confirm(this.i18n("components.delete"), this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
53
- .then((result) => resolve(result ? action : undefined));
54
- }
55
- else {
56
- resolve(action);
57
- }
58
- });
59
- }
60
- getActionInfo(action) {
61
- if (this.messageBuilder) {
62
- return this.messageBuilder(action, this.dataState, this.dataUnit);
63
- }
64
- else {
65
- if (action === Action.EDITION_CANCELED) {
66
- return this.i18n("components.editionCanceled");
67
- }
68
- }
69
- }
70
47
  observePageSize() {
71
48
  if (this.dataUnit) {
72
49
  this.dataUnit.pageSize = this.pageSize;
@@ -94,11 +71,73 @@ const SnkDataUnit = class {
94
71
  observeDataUnit() {
95
72
  this.dataUnitReady.emit(this.dataUnit);
96
73
  }
74
+ /**
75
+ * Pode-se obter o dataUnit através desse método. Outra forma, é ouvir o evento de
76
+ *
77
+ * @returns dataUnit
78
+ */
79
+ async getDataUnit() {
80
+ return new Promise((resolve) => {
81
+ if (this.dataUnit) {
82
+ resolve(this.dataUnit);
83
+ }
84
+ else {
85
+ this._onDataUnitResolve.push(resolve);
86
+ }
87
+ });
88
+ }
89
+ async interceptAction(action) {
90
+ return new Promise(resolve => {
91
+ switch (action.type) {
92
+ case Action.SAVING_DATA:
93
+ if (this.beforeSave) {
94
+ const continueAction = this.beforeSave(this.dataUnit);
95
+ if (continueAction instanceof Promise) {
96
+ continueAction.then(result => resolve(result ? action : undefined));
97
+ }
98
+ else {
99
+ resolve(continueAction ? action : undefined);
100
+ }
101
+ }
102
+ else {
103
+ resolve(action);
104
+ }
105
+ break;
106
+ case Action.DATA_SAVED:
107
+ if (this.afterSave) {
108
+ this.afterSave(this.dataUnit);
109
+ }
110
+ else {
111
+ resolve(action);
112
+ }
113
+ break;
114
+ case Action.EDITION_CANCELED:
115
+ ApplicationUtils.confirm(this.i18n("components.warning"), this.i18n("components.confirmCancelEdition"))
116
+ .then((result) => resolve(result ? action : undefined));
117
+ break;
118
+ case Action.REMOVING_RECORDS:
119
+ ApplicationUtils.confirm(this.i18n("components.delete"), this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
120
+ .then((result) => resolve(result ? action : undefined));
121
+ break;
122
+ default:
123
+ resolve(action);
124
+ }
125
+ });
126
+ }
127
+ getActionInfo(action) {
128
+ if (this.messageBuilder) {
129
+ return this.messageBuilder(action, this.dataState, this.dataUnit);
130
+ }
131
+ if (action === Action.EDITION_CANCELED) {
132
+ return this.i18n("components.editionCanceled");
133
+ }
134
+ }
97
135
  async loadDataUnit() {
98
136
  if (!this.dataUnit) {
99
137
  const app = ApplicationContext.getContextValue("__SNK__APPLICATION__");
100
138
  if (app && this.entityName) {
101
- this.dataUnit = await app.getOrCreateDataUnit(this.entityName, this.dataUnitName);
139
+ const cacheName = this.dataUnitName ? this.dataUnitName : this.entityName;
140
+ this.dataUnit = await app.getDataUnit(this.entityName, cacheName);
102
141
  this.dataUnit.pageSize = this.pageSize;
103
142
  this.dataUnit.unsubscribe(this._dataUnitObserver);
104
143
  this.dataUnit.addInterceptor(this);
@@ -107,6 +146,9 @@ const SnkDataUnit = class {
107
146
  while (resolver = this._onDataUnitResolve.pop()) {
108
147
  resolver(this.dataUnit);
109
148
  }
149
+ if (this.autoLoad) {
150
+ this.dataUnit.loadData();
151
+ }
110
152
  }
111
153
  }
112
154
  }
@@ -120,6 +162,9 @@ const SnkDataUnit = class {
120
162
  };
121
163
  return pt_br[key];
122
164
  }
165
+ //---------------------------------------------
166
+ // Lifecycle web component
167
+ //---------------------------------------------
123
168
  componentDidRender() {
124
169
  this.loadDataUnit();
125
170
  }
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, c as createEvent, h, g as getElement } from './index-02c04e0f.js';
1
+ import { r as registerInstance, c as createEvent, h, g as getElement } from './index-0b078db7.js';
2
2
  import { ApplicationContext } from '@sankhyalabs/core';
3
3
 
4
4
  const snkFormCss = ".sc-snk-form-h{display:block}";
@@ -1,6 +1,6 @@
1
- import { r as registerInstance, c as createEvent, h, g as getElement } from './index-02c04e0f.js';
1
+ import { r as registerInstance, c as createEvent, h, g as getElement } from './index-0b078db7.js';
2
2
  import { ApplicationContext } from '@sankhyalabs/core';
3
- import { T as TaskbarElement } from './taskbar-elements-fe7cbf0e.js';
3
+ import { T as TaskbarElement } from './taskbar-elements-3ba30bf4.js';
4
4
 
5
5
  const snkGridCss = ".sc-snk-grid-h{display:flex;height:100%;width:100%}";
6
6
 
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h, H as Host } from './index-02c04e0f.js';
1
+ import { r as registerInstance, h, H as Host } from './index-0b078db7.js';
2
2
  import { ObjectUtils, StringUtils } from '@sankhyalabs/core';
3
3
 
4
4
  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)}";
@@ -1,13 +1,6 @@
1
- import { h, r as registerInstance, c as createEvent, H as Host } from './index-02c04e0f.js';
1
+ import { r as registerInstance, c as createEvent, h, H as Host } from './index-0b078db7.js';
2
2
  import { ApplicationContext } from '@sankhyalabs/core';
3
- import { A as AuthorizationElements, T as TaskbarElement, b as buildElem } from './taskbar-elements-fe7cbf0e.js';
4
-
5
- const SnkPopupButton = ({ className, title, source, opened, setOpened, actionClick }) => {
6
- return (h("div", { class: "ez-flex " + className },
7
- h("ez-button", { id: "moreOptionsButton", title: title, mode: "icon", iconName: "dots-vertical", size: "small", onClick: () => setOpened(true) }),
8
- h("ez-popover", { opened: opened, autoClose: true, innerElement: ["moreOptionsButton", "moreOptionsDiv"], onEzVisibilityChange: (event) => setOpened(event.detail) },
9
- 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) }))))));
10
- };
3
+ import { A as AuthorizationElements, T as TaskbarElement, b as buildElem } from './taskbar-elements-3ba30bf4.js';
11
4
 
12
5
  const snkTaskbarCss = ".sc-snk-taskbar-h{display:flex}";
13
6
 
@@ -15,7 +8,6 @@ const SnkTaskbar = class {
15
8
  constructor(hostRef) {
16
9
  registerInstance(this, hostRef);
17
10
  this.actionClick = createEvent(this, "actionClick", 7);
18
- this._moreOptionsOpened = false;
19
11
  }
20
12
  observeButtons() {
21
13
  this._definitions = undefined;
@@ -88,10 +80,6 @@ const SnkTaskbar = class {
88
80
  }
89
81
  this.actionClick.emit(elem);
90
82
  }
91
- actionClickHandler(act) {
92
- this._moreOptionsOpened = false;
93
- this.actionClick.emit(act.key);
94
- }
95
83
  isEnabled(elem) {
96
84
  return !(this.disabledButtons && this.disabledButtons.includes(elem));
97
85
  }
@@ -101,29 +89,22 @@ const SnkTaskbar = class {
101
89
  if (index > 1) {
102
90
  className += "ez-padding-left--medium";
103
91
  }
104
- if (def === TaskbarElement.MORE_OPTIONS) {
105
- 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;
106
- }
107
- else {
108
- element = buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem));
109
- }
92
+ element = buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList);
110
93
  return element;
111
94
  }
112
95
  // Lifecycle
113
- componentWillRender() {
114
- if (this._permissions === undefined) {
115
- const snkApplication = ApplicationContext.getContextValue("__SNK__APPLICATION__");
116
- if (snkApplication) {
117
- snkApplication.getAllAccess().then(access => this._permissions = access);
118
- }
119
- else {
120
- this._permissions = {};
121
- }
96
+ componentWillLoad() {
97
+ const snkApplication = ApplicationContext.getContextValue("__SNK__APPLICATION__");
98
+ if (snkApplication) {
99
+ snkApplication.getAllAccess().then(access => this._permissions = access);
122
100
  }
123
101
  else {
124
- if (this._definitions == undefined) {
125
- this._definitions = this.elementsFromString(this.buttons);
126
- }
102
+ this._permissions = {};
103
+ }
104
+ }
105
+ componentWillRender() {
106
+ if (this._definitions == undefined && this._permissions) {
107
+ this._definitions = this.elementsFromString(this.buttons);
127
108
  }
128
109
  }
129
110
  render() {
@@ -1,4 +1,4 @@
1
- import { h } from './index-02c04e0f.js';
1
+ import { h } from './index-0b078db7.js';
2
2
 
3
3
  var TaskbarElement;
4
4
  (function (TaskbarElement) {
@@ -25,7 +25,7 @@ var AuthorizationElements;
25
25
  AuthorizationElements["INSERT"] = "INSERT";
26
26
  AuthorizationElements["CONFIG_GRID"] = "CONFIG_GRID";
27
27
  })(AuthorizationElements || (AuthorizationElements = {}));
28
- const buildElem = (element, className, getTitle, action, isEnabled) => {
28
+ const buildElem = (element, className, getTitle, action, isEnabled, actions) => {
29
29
  switch (element) {
30
30
  case TaskbarElement.PREVIOUS:
31
31
  return iconButton("chevron-left", element, className, getTitle, action, isEnabled);
@@ -51,6 +51,8 @@ const buildElem = (element, className, getTitle, action, isEnabled) => {
51
51
  return iconButton("list", element, className, getTitle, action, isEnabled);
52
52
  case TaskbarElement.CONFIG_GRID:
53
53
  return iconButton("settings-inverted", element, className, getTitle, action, isEnabled);
54
+ case TaskbarElement.MORE_OPTIONS:
55
+ return h("ez-actions-button", { size: "small", class: className, enabled: isEnabled(element), onEzAction: (evt) => action(evt.detail.value), actions: actions });
54
56
  case TaskbarElement.DIVIDER:
55
57
  return h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-horizontal--medium" });
56
58
  }
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h } from './index-02c04e0f.js';
1
+ import { r as registerInstance, h } from './index-0b078db7.js';
2
2
  import { DataUnit, DataType, UserInterface } from '@sankhyalabs/core';
3
3
 
4
4
  const testePesquisaCss = ":host{display:block}";