@sankhyalabs/sankhyablocks 1.3.31-beta.5 → 1.3.31-beta.7

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 (59) hide show
  1. package/dist/cjs/{index-ebe8245e.js → index-532bcc28.js} +0 -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 +114 -14
  5. package/dist/cjs/snk-data-unit.cjs.entry.js +70 -36
  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 +6 -3
  9. package/dist/cjs/snk-taskbar.cjs.entry.js +15 -34
  10. package/dist/cjs/{taskbar-elements-589a3744.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 +122 -40
  13. package/dist/collection/components/snk-data-unit/snk-data-unit.js +103 -64
  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-pesquisa/snk-pesquisa.css +49 -10
  17. package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +5 -1
  18. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +3 -1
  19. package/dist/collection/components/snk-taskbar/snk-taskbar.js +17 -33
  20. package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +16 -0
  21. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +2 -0
  22. package/dist/components/snk-application2.js +114 -14
  23. package/dist/components/snk-data-unit.js +69 -35
  24. package/dist/components/snk-pesquisa2.js +5 -2
  25. package/dist/components/snk-taskbar2.js +14 -32
  26. package/dist/esm/{index-7565ae23.js → index-0b078db7.js} +0 -34
  27. package/dist/esm/loader.js +2 -2
  28. package/dist/esm/sankhyablocks.js +2 -2
  29. package/dist/esm/snk-application.entry.js +114 -14
  30. package/dist/esm/snk-data-unit.entry.js +70 -36
  31. package/dist/esm/snk-form.entry.js +1 -1
  32. package/dist/esm/snk-grid.entry.js +2 -2
  33. package/dist/esm/snk-pesquisa.entry.js +6 -3
  34. package/dist/esm/snk-taskbar.entry.js +13 -32
  35. package/dist/esm/{taskbar-elements-b6822601.js → taskbar-elements-3ba30bf4.js} +4 -2
  36. package/dist/esm/teste-pesquisa.entry.js +1 -1
  37. package/dist/sankhyablocks/p-1c19b89c.entry.js +1 -0
  38. package/dist/sankhyablocks/p-21c2457b.entry.js +1 -0
  39. package/dist/sankhyablocks/{p-bb8d8fe7.entry.js → p-560fdf54.entry.js} +1 -1
  40. package/dist/sankhyablocks/p-574764bf.js +1 -0
  41. package/dist/sankhyablocks/p-8f7b9a85.entry.js +1 -0
  42. package/dist/sankhyablocks/{p-e7ade160.entry.js → p-9c225717.entry.js} +1 -1
  43. package/dist/sankhyablocks/p-a45dba1a.js +2 -0
  44. package/dist/sankhyablocks/{p-bb31ea2a.entry.js → p-a8305c35.entry.js} +1 -1
  45. package/dist/sankhyablocks/{p-a4b2fa10.entry.js → p-bc14f01e.entry.js} +3 -3
  46. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  47. package/dist/types/components/snk-application/snk-application.d.ts +89 -12
  48. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +2 -1
  49. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +20 -3
  50. package/dist/types/components.d.ts +216 -2
  51. package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +2 -0
  52. package/package.json +1 -1
  53. package/dist/collection/components/snk-taskbar/component/snk-popup-button.js +0 -7
  54. package/dist/sankhyablocks/p-306224bf.entry.js +0 -1
  55. package/dist/sankhyablocks/p-4ee1e12b.js +0 -1
  56. package/dist/sankhyablocks/p-6d82d7fd.entry.js +0 -1
  57. package/dist/sankhyablocks/p-88278b85.entry.js +0 -1
  58. package/dist/sankhyablocks/p-90b832f7.js +0 -2
  59. package/dist/types/components/snk-taskbar/component/snk-popup-button.d.ts +0 -12
@@ -4,8 +4,19 @@ import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  export class SnkDataUnit {
5
5
  constructor() {
6
6
  this._onDataUnitResolve = [];
7
+ /**
8
+ * Determina quantas linhas são retornadas por página
9
+ */
10
+ this.pageSize = 150;
11
+ /**
12
+ * Quando ativada essa propriedade faz com que haja uma carga imediata no DataUnit
13
+ */
14
+ this.autoLoad = true;
7
15
  this._dataUnitObserver = (action) => {
8
- let msg = this.getActionInfo(action.type);
16
+ let msg;
17
+ if (!this.isTransitionAction(action.type)) {
18
+ msg = this.getActionInfo(action.type);
19
+ }
9
20
  if (msg) {
10
21
  ApplicationUtils.info(msg);
11
22
  }
@@ -29,6 +40,38 @@ export class SnkDataUnit {
29
40
  this.dataState = duState;
30
41
  };
31
42
  }
43
+ observePageSize() {
44
+ if (this.dataUnit) {
45
+ this.dataUnit.pageSize = this.pageSize;
46
+ }
47
+ }
48
+ observeDataUnitName(newValue, oldValue) {
49
+ if (oldValue != newValue) {
50
+ this.dataUnit = undefined;
51
+ this.dataUnitName = newValue;
52
+ this.loadDataUnit();
53
+ }
54
+ }
55
+ observeEntityName(newValue, oldValue) {
56
+ if (oldValue != newValue) {
57
+ this.dataUnit = undefined;
58
+ this.entityName = newValue;
59
+ this.loadDataUnit();
60
+ }
61
+ }
62
+ observeDataState(newValue, oldValue) {
63
+ if (oldValue != newValue) {
64
+ this.dataStateChange.emit(newValue);
65
+ }
66
+ }
67
+ observeDataUnit() {
68
+ this.dataUnitReady.emit(this.dataUnit);
69
+ }
70
+ /**
71
+ * Pode-se obter o dataUnit através desse método. Outra forma, é ouvir o evento de
72
+ *
73
+ * @returns dataUnit
74
+ */
32
75
  async getDataUnit() {
33
76
  return new Promise((resolve) => {
34
77
  if (this.dataUnit) {
@@ -69,7 +112,11 @@ export class SnkDataUnit {
69
112
  .then((result) => resolve(result ? action : undefined));
70
113
  break;
71
114
  case Action.REMOVING_RECORDS:
72
- ApplicationUtils.confirm(this.i18n("components.delete"), this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
115
+ let msg = undefined;
116
+ if (this.messageBuilder) {
117
+ msg = this.messageBuilder(action.type, this.dataState, this.dataUnit);
118
+ }
119
+ ApplicationUtils.confirm(this.i18n("components.delete"), msg || this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
73
120
  .then((result) => resolve(result ? action : undefined));
74
121
  break;
75
122
  default:
@@ -77,48 +124,32 @@ export class SnkDataUnit {
77
124
  }
78
125
  });
79
126
  }
127
+ isTransitionAction(action) {
128
+ switch (action) {
129
+ case Action.LOADING_METADATA:
130
+ case Action.LOADING_DATA:
131
+ case Action.SAVING_DATA:
132
+ case Action.REMOVING_RECORDS:
133
+ case Action.CHANGING_DATA:
134
+ return true;
135
+ default:
136
+ return false;
137
+ }
138
+ }
80
139
  getActionInfo(action) {
81
140
  if (this.messageBuilder) {
82
141
  return this.messageBuilder(action, this.dataState, this.dataUnit);
83
142
  }
84
- else {
85
- if (action === Action.EDITION_CANCELED) {
86
- return this.i18n("components.editionCanceled");
87
- }
88
- }
89
- }
90
- observePageSize() {
91
- if (this.dataUnit) {
92
- this.dataUnit.pageSize = this.pageSize;
93
- }
94
- }
95
- observeDataUnitName(newValue, oldValue) {
96
- if (oldValue != newValue) {
97
- this.dataUnit = undefined;
98
- this.dataUnitName = newValue;
99
- this.loadDataUnit();
143
+ if (action === Action.EDITION_CANCELED) {
144
+ return this.i18n("components.editionCanceled");
100
145
  }
101
146
  }
102
- observeEntityName(newValue, oldValue) {
103
- if (oldValue != newValue) {
104
- this.dataUnit = undefined;
105
- this.entityName = newValue;
106
- this.loadDataUnit();
107
- }
108
- }
109
- observeDataState(newValue, oldValue) {
110
- if (oldValue != newValue) {
111
- this.dataStateChange.emit(newValue);
112
- }
113
- }
114
- observeDataUnit() {
115
- this.dataUnitReady.emit(this.dataUnit);
116
- }
117
147
  async loadDataUnit() {
118
148
  if (!this.dataUnit) {
119
149
  const app = ApplicationContext.getContextValue("__SNK__APPLICATION__");
120
150
  if (app && this.entityName) {
121
- this.dataUnit = await app.getOrCreateDataUnit(this.entityName, this.dataUnitName);
151
+ const cacheName = this.dataUnitName ? this.dataUnitName : this.entityName;
152
+ this.dataUnit = await app.getDataUnit(this.entityName, cacheName);
122
153
  this.dataUnit.pageSize = this.pageSize;
123
154
  this.dataUnit.unsubscribe(this._dataUnitObserver);
124
155
  this.dataUnit.addInterceptor(this);
@@ -143,6 +174,9 @@ export class SnkDataUnit {
143
174
  };
144
175
  return pt_br[key];
145
176
  }
177
+ //---------------------------------------------
178
+ // Lifecycle web component
179
+ //---------------------------------------------
146
180
  componentDidRender() {
147
181
  this.loadDataUnit();
148
182
  }
@@ -174,7 +208,7 @@ export class SnkDataUnit {
174
208
  "optional": false,
175
209
  "docs": {
176
210
  "tags": [],
177
- "text": ""
211
+ "text": "O estato atual dos dados, isto \u00E9 se h\u00E1 altera\u00E7\u00E3o, insers\u00E3o, as linhas selecionadas, etc."
178
212
  }
179
213
  },
180
214
  "dataUnitName": {
@@ -189,7 +223,7 @@ export class SnkDataUnit {
189
223
  "optional": false,
190
224
  "docs": {
191
225
  "tags": [],
192
- "text": ""
226
+ "text": "Este atributo \u00E9 usado para criar o dataUnit uma \u00FAnica vez. Se omitido ser\u00E1 usado o pr\u00F3prio nome\nda entidade."
193
227
  },
194
228
  "attribute": "data-unit-name",
195
229
  "reflect": false
@@ -206,7 +240,7 @@ export class SnkDataUnit {
206
240
  "optional": false,
207
241
  "docs": {
208
242
  "tags": [],
209
- "text": ""
243
+ "text": "Determina qual a entidade representa os dados em quest\u00E3o."
210
244
  },
211
245
  "attribute": "entity-name",
212
246
  "reflect": false
@@ -223,10 +257,11 @@ export class SnkDataUnit {
223
257
  "optional": false,
224
258
  "docs": {
225
259
  "tags": [],
226
- "text": ""
260
+ "text": "Determina quantas linhas s\u00E3o retornadas por p\u00E1gina"
227
261
  },
228
262
  "attribute": "page-size",
229
- "reflect": false
263
+ "reflect": false,
264
+ "defaultValue": "150"
230
265
  },
231
266
  "dataUnit": {
232
267
  "type": "unknown",
@@ -245,7 +280,7 @@ export class SnkDataUnit {
245
280
  "optional": false,
246
281
  "docs": {
247
282
  "tags": [],
248
- "text": ""
283
+ "text": "Uma vez instanciado, pode-se obter o dataUnit por esta propriedade"
249
284
  }
250
285
  },
251
286
  "messageBuilder": {
@@ -268,7 +303,7 @@ export class SnkDataUnit {
268
303
  "optional": false,
269
304
  "docs": {
270
305
  "tags": [],
271
- "text": ""
306
+ "text": "Abstra\u00E7\u00E3o para obter-se mensagens de acordo com o estado dos dados."
272
307
  }
273
308
  },
274
309
  "beforeSave": {
@@ -291,7 +326,7 @@ export class SnkDataUnit {
291
326
  "optional": false,
292
327
  "docs": {
293
328
  "tags": [],
294
- "text": ""
329
+ "text": "Executado imediatamente antes da a\u00E7\u00E3o de salvar as altera\u00E7\u00F5es. \u00DAtil no caso de valida\u00E7\u00F5es por exemplo.\nCaso retorne \"false\" (ou a promessa se resolva como false), cancela a a\u00E7\u00E3o."
295
330
  }
296
331
  },
297
332
  "afterSave": {
@@ -311,7 +346,7 @@ export class SnkDataUnit {
311
346
  "optional": false,
312
347
  "docs": {
313
348
  "tags": [],
314
- "text": ""
349
+ "text": "Executado ap\u00F3s a a\u00E7\u00E3o de salvar"
315
350
  }
316
351
  },
317
352
  "autoLoad": {
@@ -326,28 +361,14 @@ export class SnkDataUnit {
326
361
  "optional": false,
327
362
  "docs": {
328
363
  "tags": [],
329
- "text": ""
364
+ "text": "Quando ativada essa propriedade faz com que haja uma carga imediata no DataUnit"
330
365
  },
331
366
  "attribute": "auto-load",
332
- "reflect": false
367
+ "reflect": false,
368
+ "defaultValue": "true"
333
369
  }
334
370
  }; }
335
371
  static get events() { return [{
336
- "method": "insertionMode",
337
- "name": "insertionMode",
338
- "bubbles": true,
339
- "cancelable": true,
340
- "composed": true,
341
- "docs": {
342
- "tags": [],
343
- "text": ""
344
- },
345
- "complexType": {
346
- "original": "void",
347
- "resolved": "void",
348
- "references": {}
349
- }
350
- }, {
351
372
  "method": "dataStateChange",
352
373
  "name": "dataStateChange",
353
374
  "bubbles": true,
@@ -355,7 +376,7 @@ export class SnkDataUnit {
355
376
  "composed": true,
356
377
  "docs": {
357
378
  "tags": [],
358
- "text": ""
379
+ "text": "Disparado quando o h\u00E1 qualquer mudan\u00E7a de estado no DataUnit"
359
380
  },
360
381
  "complexType": {
361
382
  "original": "DataState",
@@ -374,7 +395,7 @@ export class SnkDataUnit {
374
395
  "composed": true,
375
396
  "docs": {
376
397
  "tags": [],
377
- "text": ""
398
+ "text": "Disparado quando o DataUnit est\u00E1 pronto"
378
399
  },
379
400
  "complexType": {
380
401
  "original": "DataUnit",
@@ -386,6 +407,21 @@ export class SnkDataUnit {
386
407
  }
387
408
  }
388
409
  }
410
+ }, {
411
+ "method": "insertionMode",
412
+ "name": "insertionMode",
413
+ "bubbles": true,
414
+ "cancelable": true,
415
+ "composed": true,
416
+ "docs": {
417
+ "tags": [],
418
+ "text": "Disparado quando um registro \u00E9 adicionado ou copiado"
419
+ },
420
+ "complexType": {
421
+ "original": "void",
422
+ "resolved": "void",
423
+ "references": {}
424
+ }
389
425
  }]; }
390
426
  static get methods() { return {
391
427
  "getDataUnit": {
@@ -404,8 +440,11 @@ export class SnkDataUnit {
404
440
  "return": "Promise<DataUnit>"
405
441
  },
406
442
  "docs": {
407
- "text": "",
408
- "tags": []
443
+ "text": "Pode-se obter o dataUnit atrav\u00E9s desse m\u00E9todo. Outra forma, \u00E9 ouvir o evento de",
444
+ "tags": [{
445
+ "name": "returns",
446
+ "text": "dataUnit"
447
+ }]
409
448
  }
410
449
  }
411
450
  }; }
@@ -108,7 +108,7 @@ export class SnkForm {
108
108
  "optional": false,
109
109
  "docs": {
110
110
  "tags": [],
111
- "text": ""
111
+ "text": "Texto que aparece de forma descritiva no cabe\u00E7alho do form"
112
112
  },
113
113
  "attribute": "form-title",
114
114
  "reflect": false
@@ -125,7 +125,7 @@ export class SnkForm {
125
125
  "optional": false,
126
126
  "docs": {
127
127
  "tags": [],
128
- "text": ""
128
+ "text": "Nome usado para guardar/recuperar as configura\u00E7\u00F5es do formul\u00E1rio"
129
129
  },
130
130
  "attribute": "config-name",
131
131
  "reflect": false
@@ -150,7 +150,7 @@ export class SnkForm {
150
150
  "optional": false,
151
151
  "docs": {
152
152
  "tags": [],
153
- "text": ""
153
+ "text": "Lista de a\u00E7\u00F5es que devem ser usadas no bot\u00E3o \"Mais op\u00E7\u00F5es\""
154
154
  }
155
155
  }
156
156
  }; }
@@ -167,7 +167,7 @@ export class SnkForm {
167
167
  "composed": true,
168
168
  "docs": {
169
169
  "tags": [],
170
- "text": ""
170
+ "text": "Emitido quando o bot\u00E3o de voltar \u00E9 acionado"
171
171
  },
172
172
  "complexType": {
173
173
  "original": "void",
@@ -182,7 +182,7 @@ export class SnkForm {
182
182
  "composed": true,
183
183
  "docs": {
184
184
  "tags": [],
185
- "text": ""
185
+ "text": "Emitido sempre que houver click de bot\u00E3o ou a\u00E7\u00E3o"
186
186
  },
187
187
  "complexType": {
188
188
  "original": "string",
@@ -74,7 +74,7 @@ export class SnkGrid {
74
74
  "optional": false,
75
75
  "docs": {
76
76
  "tags": [],
77
- "text": ""
77
+ "text": "Nome usado para salvar/recuperar a configura\u00E7\u00E3o"
78
78
  },
79
79
  "attribute": "config-name",
80
80
  "reflect": false
@@ -99,7 +99,7 @@ export class SnkGrid {
99
99
  "optional": false,
100
100
  "docs": {
101
101
  "tags": [],
102
- "text": ""
102
+ "text": "Lista de a\u00E7\u00F5es que devem ser usadas no bot\u00E3o \"Mais op\u00E7\u00F5es\""
103
103
  }
104
104
  }
105
105
  }; }
@@ -116,7 +116,7 @@ export class SnkGrid {
116
116
  "composed": true,
117
117
  "docs": {
118
118
  "tags": [],
119
- "text": ""
119
+ "text": "Emitido sempre que houver click de bot\u00E3o ou a\u00E7\u00E3o"
120
120
  },
121
121
  "complexType": {
122
122
  "original": "string",
@@ -1,30 +1,37 @@
1
1
  :host {
2
+ /* general */
2
3
  /*@doc Define o tamanho da fonte do componente.*/
3
4
  --snk-pesquisa--font-size: var(--text--medium, 14px);
4
-
5
5
  /*@doc Define a família da fonte do componente.*/
6
6
  --snk-pesquisa--font-family: var(--font-pattern, Arial);
7
-
8
7
  /*@doc Define o peso da fonte do componente.*/
9
8
  --snk-pesquisa--font-weight: var(--text-weight--medium, 400);
10
9
 
10
+ /* records */
11
11
  /*@doc Define a cor da fonte do indicador de registros do componente.*/
12
12
  --snk-pesquisa__records--color: var(--text--primary, #626e82);
13
-
14
13
  /*@doc Define o espaçamento vertical do indicador de registros do componente.*/
15
14
  --snk-pesquisa__records--padding-vertical: var(--space--medium, 12px);
16
15
 
16
+ /* content */
17
17
  /*@doc Define o espaçamento da direita no conteúdo do componente.*/
18
18
  --snk-pesquisa__content--padding-right: var(--space--small, 6px);
19
19
 
20
+ /* scrollbar */
20
21
  /*@doc Define a cor da barra de rolagem do componente.*/
21
- --snk-pesquisa__content-scrollbar--background-color: var(--text--primary, #626e82);
22
-
22
+ --snk-pesquisa__content-scrollbar--background-color: var(--title--primary, #2B3A54);
23
23
  /*@doc Define o raio da borda da barra de rolagem do componente.*/
24
- --snk-pesquisa__content-scrollbar--border-radius: var(--border--radius-medium, 12px);
25
-
24
+ --snk-pesquisa__content-scrollbar--border-radius: var(--border--radius-small, 6px);
26
25
  /*@doc Define a largura da barra de rolagem do componente.*/
27
- --snk-pesquisa__content-scrollbar--width: var(--space--medium, 12px) display: block;
26
+ --snk-pesquisa__content-scrollbar--width: var(--space--medium, 12px);
27
+
28
+ /* buttons */
29
+ /*@doc Define a cor do botão de pesquisa do componente.*/
30
+ --snk-pesquisa__btn--color: var(--title--primary, #2B3A54);
31
+ /*@doc Define a cor do botão de pesquisa do componente quando desabilitado.*/
32
+ --snk-pesquisa__btn-disabled--color: var(--text--disable, #AFB6C0);
33
+ /*@doc Define a cor do botão de pesquisa do componente quando o mouse está sobre ele.*/
34
+ --snk-pesquisa__btn-hover--color: var(--color--primary, #4e4e4e);
28
35
 
29
36
  max-height: 100%;
30
37
  height: 100%;
@@ -47,8 +54,11 @@
47
54
  padding-right: 4px;
48
55
  }
49
56
 
50
- .snk-pesquisa__input-close {
51
- cursor: pointer;
57
+ .snk-pesquisa__input ez-icon {
58
+ --ez-icon--color: inherit;
59
+
60
+ /*public*/
61
+ font-weight: var(--text-weight--large, 600);
52
62
  }
53
63
 
54
64
  .snk-pesquisa__content {
@@ -91,4 +101,33 @@
91
101
  color: var(--snk-pesquisa__records--color);
92
102
  padding-bottom: var(--snk-pesquisa__records--padding-vertical);
93
103
  padding-top: var(--snk-pesquisa__records--padding-vertical);
104
+ }
105
+
106
+ .snk-pesquisa__btn {
107
+ outline: none;
108
+ border: none;
109
+ background: none;
110
+ cursor: pointer;
111
+
112
+ /*public*/
113
+ color: var(--snk-pesquisa__btn--color);
114
+ }
115
+
116
+ .snk-pesquisa__btn:disabled {
117
+ cursor: unset;
118
+
119
+ /*public*/
120
+ color: var(--snk-pesquisa__btn-disabled--color);
121
+ }
122
+
123
+ .snk-pesquisa__btn:disabled:hover {
124
+ cursor: unset;
125
+
126
+ /*public*/
127
+ color: var(--snk-pesquisa__btn-disabled--color);
128
+ }
129
+
130
+ .snk-pesquisa__btn:hover {
131
+ /*public*/
132
+ color: var(--snk-pesquisa__btn-hover--color);
94
133
  }
@@ -291,12 +291,16 @@ export class SnkPesquisa {
291
291
  : 'Os resultados de sua pesquisa aparecerão aqui...';
292
292
  }
293
293
  render() {
294
+ var _a;
294
295
  return (h(Host, null,
295
296
  h("div", { class: "snk-pesquisa" },
296
297
  h("div", { class: "snk-pesquisa__input" },
297
298
  h("ez-text-input", { label: "Buscar", class: "ez-margin-right--medium", canShowError: false, ref: (ref) => this._textInput = ref, onEzChange: (event) => this.onChangeValue(event), value: this.argument },
298
299
  h("ez-icon", { slot: "leftIcon", iconName: "search" }),
299
- h("ez-icon", { class: "snk-pesquisa__input-close", slot: "rightIcon", iconName: "close", onClick: () => { this.clearSearch(); } })),
300
+ this.argument && ((_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value)
301
+ ? h("button", { slot: "rightIcon", class: "snk-pesquisa__btn", onClick: () => this.clearSearch() },
302
+ h("ez-icon", { iconName: "close" }))
303
+ : undefined),
300
304
  h("ez-button", { class: "ez-button--primary", label: "Pesquisar", onClick: () => this.onClickSearch() })),
301
305
  h("label", { class: "snk-pesquisa__records" }, this.getMessageView()),
302
306
  h("div", { class: "snk-pesquisa__content" }, this._itemList && this._itemList.map((item) => {
@@ -24,7 +24,7 @@ export var AuthorizationElements;
24
24
  AuthorizationElements["INSERT"] = "INSERT";
25
25
  AuthorizationElements["CONFIG_GRID"] = "CONFIG_GRID";
26
26
  })(AuthorizationElements || (AuthorizationElements = {}));
27
- export const buildElem = (element, className, getTitle, action, isEnabled) => {
27
+ export const buildElem = (element, className, getTitle, action, isEnabled, actions) => {
28
28
  switch (element) {
29
29
  case TaskbarElement.PREVIOUS:
30
30
  return iconButton("chevron-left", element, className, getTitle, action, isEnabled);
@@ -50,6 +50,8 @@ export const buildElem = (element, className, getTitle, action, isEnabled) => {
50
50
  return iconButton("list", element, className, getTitle, action, isEnabled);
51
51
  case TaskbarElement.CONFIG_GRID:
52
52
  return iconButton("settings-inverted", element, className, getTitle, action, isEnabled);
53
+ case TaskbarElement.MORE_OPTIONS:
54
+ return h("ez-actions-button", { size: "small", class: className, enabled: isEnabled(element), onEzAction: (evt) => action(evt.detail.value), actions: actions });
53
55
  case TaskbarElement.DIVIDER:
54
56
  return h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-horizontal--medium" });
55
57
  }
@@ -1,11 +1,7 @@
1
1
  import { ApplicationContext } from '@sankhyalabs/core';
2
2
  import { Component, Event, h, Host, Prop, State, Watch } from '@stencil/core';
3
- import { SnkPopupButton } from './component/snk-popup-button';
4
3
  import { TaskbarElement, buildElem, AuthorizationElements } from './elements/taskbar-elements';
5
4
  export class SnkTaskbar {
6
- constructor() {
7
- this._moreOptionsOpened = false;
8
- }
9
5
  observeButtons() {
10
6
  this._definitions = undefined;
11
7
  }
@@ -77,10 +73,6 @@ export class SnkTaskbar {
77
73
  }
78
74
  this.actionClick.emit(elem);
79
75
  }
80
- actionClickHandler(act) {
81
- this._moreOptionsOpened = false;
82
- this.actionClick.emit(act.key);
83
- }
84
76
  isEnabled(elem) {
85
77
  return !(this.disabledButtons && this.disabledButtons.includes(elem));
86
78
  }
@@ -90,29 +82,22 @@ export class SnkTaskbar {
90
82
  if (index > 1) {
91
83
  className += "ez-padding-left--medium";
92
84
  }
93
- if (def === TaskbarElement.MORE_OPTIONS) {
94
- 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;
95
- }
96
- else {
97
- element = buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem));
98
- }
85
+ element = buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList);
99
86
  return element;
100
87
  }
101
88
  // Lifecycle
102
- componentWillRender() {
103
- if (this._permissions === undefined) {
104
- const snkApplication = ApplicationContext.getContextValue("__SNK__APPLICATION__");
105
- if (snkApplication) {
106
- snkApplication.getAllAccess().then(access => this._permissions = access);
107
- }
108
- else {
109
- this._permissions = {};
110
- }
89
+ componentWillLoad() {
90
+ const snkApplication = ApplicationContext.getContextValue("__SNK__APPLICATION__");
91
+ if (snkApplication) {
92
+ snkApplication.getAllAccess().then(access => this._permissions = access);
111
93
  }
112
94
  else {
113
- if (this._definitions == undefined) {
114
- this._definitions = this.elementsFromString(this.buttons);
115
- }
95
+ this._permissions = {};
96
+ }
97
+ }
98
+ componentWillRender() {
99
+ if (this._definitions == undefined && this._permissions) {
100
+ this._definitions = this.elementsFromString(this.buttons);
116
101
  }
117
102
  }
118
103
  render() {
@@ -157,7 +142,7 @@ export class SnkTaskbar {
157
142
  "optional": false,
158
143
  "docs": {
159
144
  "tags": [],
160
- "text": ""
145
+ "text": "Lista separada por virgula, contendo todos os elementos a serem criados"
161
146
  },
162
147
  "attribute": "buttons",
163
148
  "reflect": false
@@ -181,7 +166,7 @@ export class SnkTaskbar {
181
166
  "optional": false,
182
167
  "docs": {
183
168
  "tags": [],
184
- "text": ""
169
+ "text": "Lista de a\u00E7\u00F5es que devem ser usadas no bot\u00E3o \"Mais op\u00E7\u00F5es\""
185
170
  }
186
171
  },
187
172
  "primaryButton": {
@@ -196,7 +181,7 @@ export class SnkTaskbar {
196
181
  "optional": false,
197
182
  "docs": {
198
183
  "tags": [],
199
- "text": ""
184
+ "text": "Qual bot\u00E3o deve ter apar\u00EAncia prim\u00E1ria"
200
185
  },
201
186
  "attribute": "primary-button",
202
187
  "reflect": false
@@ -217,7 +202,7 @@ export class SnkTaskbar {
217
202
  "optional": false,
218
203
  "docs": {
219
204
  "tags": [],
220
- "text": ""
205
+ "text": "Array contendo todos os bot\u00F5es a serem desabilitados"
221
206
  }
222
207
  },
223
208
  "dataUnit": {
@@ -237,12 +222,11 @@ export class SnkTaskbar {
237
222
  "optional": false,
238
223
  "docs": {
239
224
  "tags": [],
240
- "text": ""
225
+ "text": "Inst\u00E2ncia do DataUnit"
241
226
  }
242
227
  }
243
228
  }; }
244
229
  static get states() { return {
245
- "_moreOptionsOpened": {},
246
230
  "_permissions": {}
247
231
  }; }
248
232
  static get events() { return [{
@@ -253,7 +237,7 @@ export class SnkTaskbar {
253
237
  "composed": true,
254
238
  "docs": {
255
239
  "tags": [],
256
- "text": ""
240
+ "text": "Emitido sempre que houver click de bot\u00E3o ou a\u00E7\u00E3o"
257
241
  },
258
242
  "complexType": {
259
243
  "original": "string",
@@ -4,6 +4,7 @@ import { DataFetcher } from "../DataFetcher";
4
4
  export default class DataUnitFetcher {
5
5
  constructor() {
6
6
  this.templateByQuery = new Map();
7
+ this._loadDataTimeout = {};
7
8
  this.buldTemplates();
8
9
  }
9
10
  buldTemplates() {
@@ -101,6 +102,21 @@ export default class DataUnitFetcher {
101
102
  });
102
103
  }
103
104
  loadData(dataUnit, request) {
105
+ const duName = dataUnit.name;
106
+ if (this._loadDataTimeout[duName]) {
107
+ clearTimeout(this._loadDataTimeout[duName]);
108
+ delete this._loadDataTimeout[duName];
109
+ }
110
+ return new Promise((resolve, reject) => {
111
+ this._loadDataTimeout[duName] = setTimeout(() => {
112
+ delete this._loadDataTimeout[duName];
113
+ this.doLoadData(dataUnit, request)
114
+ .then(result => resolve(result))
115
+ .catch(reason => reject(reason));
116
+ }, 200);
117
+ });
118
+ }
119
+ doLoadData(dataUnit, request) {
104
120
  return new Promise((resolve, reject) => {
105
121
  var _a;
106
122
  const { sort, filters, limit, offset, quickFilter } = request;
@@ -16,6 +16,8 @@ export class PesquisaFetcher {
16
16
  }`);
17
17
  }
18
18
  loadSearchOptions(entityName, argument, criteria, options) {
19
+ const cleanText = (argument === null || argument === void 0 ? void 0 : argument.trim()) || undefined;
20
+ argument = isNaN(Number(cleanText)) && cleanText ? `%${cleanText}` : cleanText;
19
21
  return new Promise((resolve, reject) => {
20
22
  DataFetcher.get()
21
23
  .callGraphQL({