@sankhyalabs/ezui 1.2.0-beta.19 → 1.2.0-beta.20

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 (132) hide show
  1. package/dist/cjs/FieldBuilder-cd3e45ed.js +119 -0
  2. package/dist/cjs/ez-actions-button.cjs.entry.js +64 -12
  3. package/dist/cjs/ez-button.cjs.entry.js +12 -10
  4. package/dist/cjs/ez-calendar.cjs.entry.js +1 -1
  5. package/dist/cjs/ez-chip.cjs.entry.js +1 -1
  6. package/dist/cjs/ez-collapsible-box.cjs.entry.js +85 -6
  7. package/dist/cjs/ez-combo-box.cjs.entry.js +10 -6
  8. package/dist/cjs/ez-date-input.cjs.entry.js +8 -13
  9. package/dist/cjs/ez-date-time-input.cjs.entry.js +8 -13
  10. package/dist/cjs/ez-form.cjs.entry.js +41 -131
  11. package/dist/cjs/ez-grid-config.cjs.entry.js +2 -3
  12. package/dist/cjs/ez-grid.cjs.entry.js +1 -1
  13. package/dist/cjs/ez-list.cjs.entry.js +1 -1
  14. package/dist/cjs/ez-popover.cjs.entry.js +1 -1
  15. package/dist/cjs/ez-radio-button.cjs.entry.js +2 -2
  16. package/dist/cjs/ez-tabselector.cjs.entry.js +7 -5
  17. package/dist/cjs/ez-text-area.cjs.entry.js +6 -6
  18. package/dist/cjs/ez-text-edit.cjs.entry.js +103 -0
  19. package/dist/cjs/ez-text-input.cjs.entry.js +11 -1
  20. package/dist/cjs/ezui.cjs.js +1 -1
  21. package/dist/cjs/loader.cjs.js +1 -1
  22. package/dist/collection/collection-manifest.json +4 -3
  23. package/dist/collection/components/ez-actions-button/ez-actions-button.css +49 -20
  24. package/dist/collection/components/ez-actions-button/ez-actions-button.js +219 -23
  25. package/dist/collection/components/ez-button/ez-button.css +0 -6
  26. package/dist/collection/components/ez-button/ez-button.js +11 -9
  27. package/dist/collection/components/ez-calendar/ez-calendar.css +17 -20
  28. package/dist/collection/components/ez-chip/ez-chip.css +3 -2
  29. package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +16 -0
  30. package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.js +226 -7
  31. package/dist/collection/components/ez-combo-box/ez-combo-box.css +1 -22
  32. package/dist/collection/components/ez-combo-box/ez-combo-box.js +17 -14
  33. package/dist/collection/components/ez-date-input/ez-date-input.js +8 -13
  34. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +8 -13
  35. package/dist/collection/components/ez-form/ez-form.js +22 -13
  36. package/dist/collection/components/ez-form/fieldbuilder/FieldBuilder.js +1 -1
  37. package/dist/collection/components/ez-form/structure/FormSheetMetadata.js +24 -14
  38. package/dist/collection/components/ez-grid/ez-grid.js +17 -1
  39. package/dist/collection/components/ez-grid/subcomponents/ez-grid-config/ez-grid-config.css +36 -25
  40. package/dist/collection/components/ez-grid/subcomponents/ez-grid-config/ez-grid-config.js +1 -2
  41. package/dist/collection/components/ez-grid/subcomponents/ez-select-box/ez-select-box.js +5 -4
  42. package/dist/collection/components/ez-list/ez-list.css +9 -1
  43. package/dist/collection/components/ez-popover/ez-popover.css +1 -1
  44. package/dist/collection/components/ez-radio-button/ez-radio-button.css +16 -5
  45. package/dist/collection/components/ez-radio-button/ez-radio-button.js +1 -1
  46. package/dist/collection/components/ez-search/ez-search.js +6 -6
  47. package/dist/collection/components/ez-tabselector/ez-tabselector.css +9 -0
  48. package/dist/collection/components/ez-tabselector/ez-tabselector.js +7 -3
  49. package/dist/collection/components/ez-text-area/ez-text-area.css +6 -3
  50. package/dist/collection/components/ez-text-area/ez-text-area.js +5 -5
  51. package/dist/collection/components/ez-text-edit/ez-text-edit.css +19 -0
  52. package/dist/collection/components/ez-text-edit/ez-text-edit.js +188 -0
  53. package/dist/collection/components/ez-text-input/ez-text-input.css +18 -2
  54. package/dist/collection/components/ez-text-input/ez-text-input.js +28 -0
  55. package/dist/collection/utils/index.js +1 -0
  56. package/dist/custom-elements/index.d.ts +6 -0
  57. package/dist/custom-elements/index.js +467 -217
  58. package/dist/esm/FieldBuilder-9e9545fc.js +117 -0
  59. package/dist/esm/ez-actions-button.entry.js +64 -12
  60. package/dist/esm/ez-button.entry.js +12 -10
  61. package/dist/esm/ez-calendar.entry.js +1 -1
  62. package/dist/esm/ez-chip.entry.js +1 -1
  63. package/dist/esm/ez-collapsible-box.entry.js +86 -7
  64. package/dist/esm/ez-combo-box.entry.js +10 -6
  65. package/dist/esm/ez-date-input.entry.js +8 -13
  66. package/dist/esm/ez-date-time-input.entry.js +9 -14
  67. package/dist/esm/ez-form.entry.js +40 -130
  68. package/dist/esm/ez-grid-config.entry.js +2 -3
  69. package/dist/esm/ez-grid.entry.js +1 -1
  70. package/dist/esm/ez-list.entry.js +1 -1
  71. package/dist/esm/ez-popover.entry.js +1 -1
  72. package/dist/esm/ez-radio-button.entry.js +2 -2
  73. package/dist/esm/ez-tabselector.entry.js +7 -5
  74. package/dist/esm/ez-text-area.entry.js +6 -6
  75. package/dist/esm/ez-text-edit.entry.js +99 -0
  76. package/dist/esm/ez-text-input.entry.js +11 -1
  77. package/dist/esm/ezui.js +1 -1
  78. package/dist/esm/loader.js +1 -1
  79. package/dist/ezui/ezui.esm.js +1 -1
  80. package/dist/ezui/p-2cc6dd66.entry.js +1 -0
  81. package/dist/ezui/p-2ccad880.entry.js +1 -0
  82. package/dist/ezui/p-333d79c4.entry.js +1 -0
  83. package/dist/ezui/{p-1d47487a.entry.js → p-3c87845d.entry.js} +1 -1
  84. package/dist/ezui/p-4ad647fc.entry.js +1 -0
  85. package/dist/ezui/p-54ecd19a.js +1 -0
  86. package/dist/ezui/{p-b2cf7db2.entry.js → p-63d567cc.entry.js} +1 -1
  87. package/dist/ezui/p-6befd7e4.entry.js +1 -0
  88. package/dist/ezui/p-712bd293.entry.js +1 -0
  89. package/dist/ezui/{p-ce824077.entry.js → p-72c75a43.entry.js} +1 -1
  90. package/dist/ezui/{p-81eb2738.entry.js → p-802d23d9.entry.js} +1 -1
  91. package/dist/ezui/p-bca406db.entry.js +1 -0
  92. package/dist/ezui/p-be06251d.entry.js +1 -0
  93. package/dist/ezui/{p-e7d03a0d.entry.js → p-bffae598.entry.js} +1 -1
  94. package/dist/ezui/p-d91527dc.entry.js +1 -0
  95. package/dist/ezui/p-dd257f17.entry.js +1 -0
  96. package/dist/ezui/p-e1f2b5da.entry.js +1 -0
  97. package/dist/ezui/p-e230bfd2.entry.js +1 -0
  98. package/dist/ezui/p-e697ffd5.entry.js +1 -0
  99. package/dist/types/components/ez-actions-button/ez-actions-button.d.ts +42 -9
  100. package/dist/types/components/ez-collapsible-box/ez-collapsible-box.d.ts +46 -1
  101. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +15 -5
  102. package/dist/types/components/ez-date-input/ez-date-input.d.ts +0 -1
  103. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +0 -1
  104. package/dist/types/components/ez-form/DataBinder.d.ts +2 -2
  105. package/dist/types/components/ez-form/ez-form.d.ts +21 -11
  106. package/dist/types/components/ez-form/fieldbuilder/tpl/CheckBox.tpl.d.ts +3 -3
  107. package/dist/types/components/ez-form/fieldbuilder/tpl/NumberInput.tpl.d.ts +2 -5
  108. package/dist/types/components/ez-form/structure/FormSheetMetadata.d.ts +3 -3
  109. package/dist/types/components/ez-grid/ez-grid.d.ts +1 -1
  110. package/dist/types/components/ez-grid/subcomponents/ez-select-box/ez-select-box.d.ts +2 -6
  111. package/dist/types/components/ez-search/ez-search.d.ts +3 -3
  112. package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +2 -0
  113. package/dist/types/components/ez-text-edit/ez-text-edit.d.ts +39 -0
  114. package/dist/types/components/ez-text-input/ez-text-input.d.ts +5 -0
  115. package/dist/types/components.d.ts +177 -26
  116. package/dist/types/utils/index.d.ts +1 -0
  117. package/package.json +5 -3
  118. package/react/components.d.ts +1 -0
  119. package/react/components.js +1 -0
  120. package/react/components.js.map +1 -1
  121. package/dist/ezui/p-21c0531b.entry.js +0 -1
  122. package/dist/ezui/p-2f02347d.entry.js +0 -1
  123. package/dist/ezui/p-416bedbe.entry.js +0 -1
  124. package/dist/ezui/p-52085ae4.entry.js +0 -1
  125. package/dist/ezui/p-5fe7e960.entry.js +0 -1
  126. package/dist/ezui/p-62110996.entry.js +0 -1
  127. package/dist/ezui/p-a27dafa4.entry.js +0 -1
  128. package/dist/ezui/p-aba3fa6c.entry.js +0 -1
  129. package/dist/ezui/p-abc21959.entry.js +0 -1
  130. package/dist/ezui/p-c019e137.entry.js +0 -1
  131. package/dist/ezui/p-d0671e14.entry.js +0 -1
  132. package/dist/ezui/p-e0f06d73.entry.js +0 -1
@@ -1,6 +1,8 @@
1
- import { Component, h, Prop, Event, Watch, Method } from "@stencil/core";
1
+ import { Component, h, Prop, Event, Watch, Method, Element, State } from "@stencil/core";
2
+ import { ApplicationUtils } from "../../utils";
2
3
  export class EzCollapsibleBox {
3
4
  constructor() {
5
+ this._activeEditText = false;
4
6
  /**
5
7
  * Valor externalizado que garante a exibição ou não do componente.
6
8
  */
@@ -17,9 +19,14 @@ export class EzCollapsibleBox {
17
19
  * Define se o titulo irá ocupar toda a largura do componente.
18
20
  */
19
21
  this.stretchTitle = false;
20
- }
21
- observeCollapsedValue() {
22
- this.ezChange.emit(this.value);
22
+ /**
23
+ * Ativa o ícone para remoção do componente.
24
+ */
25
+ this.removable = false;
26
+ /**
27
+ * Ativa o ícone para edição do componente.
28
+ */
29
+ this.editable = false;
23
30
  }
24
31
  /**
25
32
  * Esconde ou revela o conteúdo do componente.
@@ -27,6 +34,23 @@ export class EzCollapsibleBox {
27
34
  async showHide() {
28
35
  this.value = !this.value;
29
36
  }
37
+ /**
38
+ * Aplica focus no campo de edição de título.
39
+ */
40
+ async applyFocusTextEdit() {
41
+ var _a;
42
+ (_a = this._refTextEdit) === null || _a === void 0 ? void 0 : _a.applyFocusSelect();
43
+ }
44
+ /**
45
+ * Fecha a edição de título.
46
+ */
47
+ async cancelEdition() {
48
+ this._activeEditText = false;
49
+ this.ezEditLabelMode.emit(this._activeEditText);
50
+ }
51
+ observeCollapsedValue() {
52
+ this.ezChange.emit(this.value);
53
+ }
30
54
  /**
31
55
  * Retorna o tamanho configurado do texto e do ícone.
32
56
  */
@@ -37,15 +61,66 @@ export class EzCollapsibleBox {
37
61
  const sizeCustom = sizeAlias.includes(sizeLowerCase) ? sizeLowerCase.replace('x', 'x-') : sizeLowerCase;
38
62
  return sizeList.includes(sizeCustom) ? sizeCustom : "small";
39
63
  }
64
+ removeElement() {
65
+ this._hostElement && this._hostElement.remove();
66
+ this.ezRemove.emit(this);
67
+ }
68
+ editLabel(evt) {
69
+ evt.preventDefault();
70
+ evt.stopPropagation();
71
+ this._activeEditText = true;
72
+ this.ezEditLabelMode.emit(this._activeEditText);
73
+ }
74
+ confirmRemove(evt) {
75
+ evt.preventDefault();
76
+ evt.stopPropagation();
77
+ ApplicationUtils.confirm("Aviso", `Deseja realmente remover o grupo <b>${this.label}</b>?`)
78
+ .then((canRemove) => {
79
+ if (canRemove) {
80
+ this.removeElement();
81
+ }
82
+ });
83
+ }
84
+ saveEditionText(editDetails) {
85
+ const { newValue } = editDetails.detail;
86
+ let canSave = true;
87
+ if (this.conditionalSave) {
88
+ canSave = this.conditionalSave(newValue);
89
+ }
90
+ if (this.label !== newValue && canSave) {
91
+ this.label = newValue;
92
+ this._activeEditText = false;
93
+ this.ezSaveEditLabel.emit(editDetails.detail);
94
+ this.ezEditLabelMode.emit(this._activeEditText);
95
+ }
96
+ }
97
+ getStyledLabel() {
98
+ if (this._refLabel == undefined) {
99
+ return;
100
+ }
101
+ let styledLabel = {
102
+ fontSize: window.getComputedStyle(this._refLabel).getPropertyValue('font-size'),
103
+ fontWeight: window.getComputedStyle(this._refLabel).getPropertyValue('font-weight'),
104
+ fontFamily: window.getComputedStyle(this._refLabel).getPropertyValue('font-family')
105
+ };
106
+ return styledLabel;
107
+ }
40
108
  render() {
41
109
  return (h("div", { class: "collapsible-box" },
42
110
  h("div", { class: "collapsible-box__header" },
43
- h("button", { onClick: () => this.showHide(), class: "collapsible-box__title" +
111
+ h("button", Object.assign({}, (!this._activeEditText ? { onClick: () => { this.showHide(); } } : null), { class: "collapsible-box__title" +
44
112
  (this.iconPlacement === "right" ? " collapsible-box__title--icon-right" : "") +
45
113
  (this.stretchTitle ? " collapsible-box__title--stretched" : "") +
46
- (this.value ? " collapsible-box__title--no-margin" : "") },
114
+ (this.value ? " collapsible-box__title--no-margin" : "") }),
47
115
  h("ez-icon", { slot: "icon", "icon-name": "chevron-right", size: this.getHeaderSize(), class: "collapsible-box__icon collapsible-box__icon--" + this.getHeaderSize() + (this.value ? " collapsible-box__icon--collapsed" : "") }),
48
- h("label", { class: "collapsible-box__label font--" + this.getHeaderSize(), title: this.label }, this.label))),
116
+ !this._activeEditText ?
117
+ h("label", { class: "collapsible-box__label font--" + this.getHeaderSize(), title: this.label, ref: elem => this._refLabel = elem },
118
+ h("span", null, this.label),
119
+ this.editable &&
120
+ h("ez-icon", { slot: "icon", "icon-name": "edit", onClick: (evt) => this.editLabel(evt), title: "Editar" }),
121
+ this.removable &&
122
+ h("ez-icon", { slot: "icon", "icon-name": "delete", onClick: (evt) => this.confirmRemove(evt), title: "Remover" })) :
123
+ h("ez-text-edit", { class: "collapsible-box__text-edit", ref: ref => this._refTextEdit = ref, value: this.label, styled: this.getStyledLabel(), onSaveEdition: (ev) => this.saveEditionText(ev), onCancelEdition: () => this.cancelEdition() }))),
49
124
  h("div", { class: "collapsible-box__content" + (this.value ? "" : " collapsible-box__content--show") },
50
125
  h("slot", null))));
51
126
  }
@@ -146,8 +221,66 @@ export class EzCollapsibleBox {
146
221
  "attribute": "stretch-title",
147
222
  "reflect": true,
148
223
  "defaultValue": "false"
224
+ },
225
+ "removable": {
226
+ "type": "boolean",
227
+ "mutable": false,
228
+ "complexType": {
229
+ "original": "boolean",
230
+ "resolved": "boolean",
231
+ "references": {}
232
+ },
233
+ "required": false,
234
+ "optional": false,
235
+ "docs": {
236
+ "tags": [],
237
+ "text": "Ativa o \u00EDcone para remo\u00E7\u00E3o do componente."
238
+ },
239
+ "attribute": "removable",
240
+ "reflect": true,
241
+ "defaultValue": "false"
242
+ },
243
+ "editable": {
244
+ "type": "boolean",
245
+ "mutable": false,
246
+ "complexType": {
247
+ "original": "boolean",
248
+ "resolved": "boolean",
249
+ "references": {}
250
+ },
251
+ "required": false,
252
+ "optional": false,
253
+ "docs": {
254
+ "tags": [],
255
+ "text": "Ativa o \u00EDcone para edi\u00E7\u00E3o do componente."
256
+ },
257
+ "attribute": "editable",
258
+ "reflect": true,
259
+ "defaultValue": "false"
260
+ },
261
+ "conditionalSave": {
262
+ "type": "unknown",
263
+ "mutable": false,
264
+ "complexType": {
265
+ "original": "Function",
266
+ "resolved": "Function",
267
+ "references": {
268
+ "Function": {
269
+ "location": "global"
270
+ }
271
+ }
272
+ },
273
+ "required": false,
274
+ "optional": false,
275
+ "docs": {
276
+ "tags": [],
277
+ "text": "Define uma condi\u00E7\u00E3o para salvar ou n\u00E3o uma altera\u00E7\u00E3o."
278
+ }
149
279
  }
150
280
  }; }
281
+ static get states() { return {
282
+ "_activeEditText": {}
283
+ }; }
151
284
  static get events() { return [{
152
285
  "method": "ezChange",
153
286
  "name": "ezChange",
@@ -163,6 +296,59 @@ export class EzCollapsibleBox {
163
296
  "resolved": "boolean",
164
297
  "references": {}
165
298
  }
299
+ }, {
300
+ "method": "ezRemove",
301
+ "name": "ezRemove",
302
+ "bubbles": true,
303
+ "cancelable": true,
304
+ "composed": true,
305
+ "docs": {
306
+ "tags": [],
307
+ "text": "Evento disparado ao remover o componente (onEzRemove)."
308
+ },
309
+ "complexType": {
310
+ "original": "EzCollapsibleBox",
311
+ "resolved": "EzCollapsibleBox",
312
+ "references": {
313
+ "EzCollapsibleBox": {
314
+ "location": "global"
315
+ }
316
+ }
317
+ }
318
+ }, {
319
+ "method": "ezSaveEditLabel",
320
+ "name": "ezSaveEditLabel",
321
+ "bubbles": true,
322
+ "cancelable": true,
323
+ "composed": true,
324
+ "docs": {
325
+ "tags": [],
326
+ "text": "Evento disparado ao concluir edi\u00E7\u00E3o da label (onEzSaveEditLabel)."
327
+ },
328
+ "complexType": {
329
+ "original": "CustomEvent",
330
+ "resolved": "CustomEvent<any>",
331
+ "references": {
332
+ "CustomEvent": {
333
+ "location": "global"
334
+ }
335
+ }
336
+ }
337
+ }, {
338
+ "method": "ezEditLabelMode",
339
+ "name": "ezEditLabelMode",
340
+ "bubbles": true,
341
+ "cancelable": true,
342
+ "composed": true,
343
+ "docs": {
344
+ "tags": [],
345
+ "text": "Evento disparado quando o modo de edi\u00E7\u00E3o da label for aberto e fechado (onEzEditLabelMode)."
346
+ },
347
+ "complexType": {
348
+ "original": "boolean",
349
+ "resolved": "boolean",
350
+ "references": {}
351
+ }
166
352
  }]; }
167
353
  static get methods() { return {
168
354
  "showHide": {
@@ -180,8 +366,41 @@ export class EzCollapsibleBox {
180
366
  "text": "Esconde ou revela o conte\u00FAdo do componente.",
181
367
  "tags": []
182
368
  }
369
+ },
370
+ "applyFocusTextEdit": {
371
+ "complexType": {
372
+ "signature": "() => Promise<void>",
373
+ "parameters": [],
374
+ "references": {
375
+ "Promise": {
376
+ "location": "global"
377
+ }
378
+ },
379
+ "return": "Promise<void>"
380
+ },
381
+ "docs": {
382
+ "text": "Aplica focus no campo de edi\u00E7\u00E3o de t\u00EDtulo.",
383
+ "tags": []
384
+ }
385
+ },
386
+ "cancelEdition": {
387
+ "complexType": {
388
+ "signature": "() => Promise<void>",
389
+ "parameters": [],
390
+ "references": {
391
+ "Promise": {
392
+ "location": "global"
393
+ }
394
+ },
395
+ "return": "Promise<void>"
396
+ },
397
+ "docs": {
398
+ "text": "Fecha a edi\u00E7\u00E3o de t\u00EDtulo.",
399
+ "tags": []
400
+ }
183
401
  }
184
402
  }; }
403
+ static get elementRef() { return "_hostElement"; }
185
404
  static get watchers() { return [{
186
405
  "propName": "value",
187
406
  "methodName": "observeCollapsedValue"
@@ -161,28 +161,6 @@ ez-icon {
161
161
  min-width: var(--ez-combo-box__list-scrollbar--width);
162
162
  }
163
163
 
164
- .list-options::-webkit-scrollbar-track {
165
- background-color: #f0f2f5;
166
-
167
- /*public*/
168
- border-radius: var(--ez-combo-box__list-scrollbar--border-radius);
169
- }
170
-
171
- .list-options::-webkit-scrollbar-thumb {
172
- /*public*/
173
- background-color: var(--ez-combo-box__list-scrollbar--background-color);
174
- border-radius: var(--ez-combo-box__list-scrollbar--border-radius);
175
- }
176
-
177
- .list-options::-webkit-scrollbar {
178
- background-color: #f0f2f5;
179
-
180
- /*public*/
181
- width: var(--ez-combo-box__list-scrollbar--width);
182
- max-width: var(--ez-combo-box__list-scrollbar--width);
183
- min-width: var(--ez-combo-box__list-scrollbar--width);
184
- }
185
-
186
164
  .item {
187
165
  display: flex;
188
166
  align-items: center;
@@ -222,6 +200,7 @@ ez-icon {
222
200
  .item__value--hidden {
223
201
  visibility: hidden;
224
202
  position: absolute;
203
+ white-space: nowrap;
225
204
  z-index: -1;
226
205
  top: 0;
227
206
  left: 0;
@@ -130,11 +130,11 @@ export class EzComboBox {
130
130
  return 0;
131
131
  }
132
132
  getWidthValue(value) {
133
- if (this._itemValueBasis) {
133
+ if (this._itemValueBasis != undefined) {
134
134
  const span = this._itemValueBasis;
135
- if (value) {
135
+ if (value != undefined) {
136
136
  span.innerHTML = value;
137
- return span.clientWidth > 0 ? (span.clientWidth + 1) : 0;
137
+ return span.clientWidth > 0 ? (span.clientWidth + 2) : 0;
138
138
  }
139
139
  else {
140
140
  span.innerHTML = "";
@@ -143,9 +143,10 @@ export class EzComboBox {
143
143
  return 0;
144
144
  }
145
145
  buildItem(opt, index) {
146
+ const widthValue = this.showOptionValue && this._maxWidthValue > 0 ? `${this._maxWidthValue}px` : '';
146
147
  return h("li", { class: index === this._preSelection ? "item preselected" : "item", id: `item_${opt.value}`, onMouseDown: () => this.selectOption(opt), onMouseOver: () => this._preSelection = undefined },
147
148
  this.showOptionValue
148
- ? h("span", { class: "item__value", title: opt.value, style: { width: this.showOptionValue && this._maxWidthValue > 0 ? `${this._maxWidthValue}px` : '' } }, opt.value)
149
+ ? h("span", { class: "item__value", title: opt.value, style: { width: widthValue, minWidth: widthValue, maxWidth: widthValue } }, opt.value)
149
150
  : undefined,
150
151
  h("span", { class: "item__label", title: opt.label }, opt.label));
151
152
  }
@@ -246,6 +247,7 @@ export class EzComboBox {
246
247
  }
247
248
  else {
248
249
  this.setInputValue();
250
+ this.hideOptions();
249
251
  }
250
252
  if (this.searchMode) {
251
253
  this._visibleOptions = [];
@@ -258,7 +260,8 @@ export class EzComboBox {
258
260
  this._criteria = argument;
259
261
  this._startLoading = true;
260
262
  if (this.optionLoader) {
261
- this.updateSource(this.optionLoader({ mode, argument }));
263
+ const searchArgument = { mode, argument };
264
+ this.updateSource(this.optionLoader(searchArgument));
262
265
  }
263
266
  else {
264
267
  this.updateSource(this.options);
@@ -463,10 +466,10 @@ export class EzComboBox {
463
466
  "type": "string",
464
467
  "mutable": true,
465
468
  "complexType": {
466
- "original": "Option | string",
467
- "resolved": "Option | string",
469
+ "original": "IOption | string",
470
+ "resolved": "IOption | string",
468
471
  "references": {
469
- "Option": {
472
+ "IOption": {
470
473
  "location": "local"
471
474
  }
472
475
  }
@@ -519,13 +522,13 @@ export class EzComboBox {
519
522
  "type": "unknown",
520
523
  "mutable": true,
521
524
  "complexType": {
522
- "original": "Array<Option>",
523
- "resolved": "Option[]",
525
+ "original": "Array<IOption>",
526
+ "resolved": "IOption[]",
524
527
  "references": {
525
528
  "Array": {
526
529
  "location": "global"
527
530
  },
528
- "Option": {
531
+ "IOption": {
529
532
  "location": "local"
530
533
  }
531
534
  }
@@ -717,10 +720,10 @@ export class EzComboBox {
717
720
  "text": "Evento que \u00E9 disparado ao alterar o valor do componente"
718
721
  },
719
722
  "complexType": {
720
- "original": "Option",
721
- "resolved": "Option",
723
+ "original": "IOption",
724
+ "resolved": "IOption",
722
725
  "references": {
723
- "Option": {
726
+ "IOption": {
724
727
  "location": "local"
725
728
  }
726
729
  }
@@ -29,8 +29,8 @@ export class EzDateInput {
29
29
  }
30
30
  observeValue(newValue, oldValue) {
31
31
  if (this._textInput && newValue != oldValue) {
32
- const newValueValidated = this.validateValue(newValue);
33
- const oldValueValidated = this.validateValue(oldValue);
32
+ const newValueValidated = DateUtils.validateDate(newValue);
33
+ const oldValueValidated = DateUtils.validateDate(oldValue);
34
34
  if ((newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime()) !== (oldValueValidated === null || oldValueValidated === void 0 ? void 0 : oldValueValidated.getTime())) {
35
35
  const textValue = this.getTextValue(newValueValidated) || '';
36
36
  const parsedDate = DateUtils.strToDate(textValue);
@@ -63,8 +63,8 @@ export class EzDateInput {
63
63
  return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
64
64
  }
65
65
  changeValue(newValue) {
66
- const currentValue = this.validateValue(this.value);
67
- const newValueValidated = this.validateValue(newValue);
66
+ const currentValue = DateUtils.validateDate(this.value);
67
+ const newValueValidated = DateUtils.validateDate(newValue);
68
68
  if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
69
69
  this.value = newValueValidated;
70
70
  }
@@ -87,8 +87,8 @@ export class EzDateInput {
87
87
  const newValue = DateUtils.strToDate(strValue);
88
88
  if (newValue || !strValue) {
89
89
  this.errorMessage = "";
90
- const currentValue = this.validateValue(this.value);
91
- const newValueValidated = this.validateValue(newValue);
90
+ const currentValue = DateUtils.validateDate(this.value);
91
+ const newValueValidated = DateUtils.validateDate(newValue);
92
92
  if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) === (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
93
93
  if (newValueValidated) {
94
94
  this._textInput.value = this.getTextValue(newValueValidated) || '';
@@ -112,8 +112,8 @@ export class EzDateInput {
112
112
  handleInput(event) {
113
113
  const strValue = this._textInput.value;
114
114
  const newValue = DateUtils.strToDate(strValue);
115
- const currentValue = this.validateValue(this.value);
116
- const newValueValidated = this.validateValue(newValue);
115
+ const currentValue = DateUtils.validateDate(this.value);
116
+ const newValueValidated = DateUtils.validateDate(newValue);
117
117
  if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
118
118
  this._focused = true;
119
119
  this.ezStartChange.emit({ waitmessage: "", blocking: false });
@@ -122,11 +122,6 @@ export class EzDateInput {
122
122
  this.changeValue(new Date());
123
123
  }
124
124
  }
125
- validateValue(value) {
126
- return value instanceof Date && !isNaN(value.valueOf())
127
- ? DateUtils.clearTime(value)
128
- : undefined;
129
- }
130
125
  setInputValue() {
131
126
  const textValue = this.getTextValue(this.value) || '';
132
127
  if ((this._textInput.value || '') !== textValue) {
@@ -33,8 +33,8 @@ export class EzDateTimeInput {
33
33
  }
34
34
  observeValue(newValue, oldValue) {
35
35
  if (this._textInput && newValue != oldValue) {
36
- const newValueValidated = this.validateValue(newValue);
37
- const oldValueValidated = this.validateValue(oldValue);
36
+ const newValueValidated = DateUtils.validateDate(newValue, true);
37
+ const oldValueValidated = DateUtils.validateDate(oldValue, true);
38
38
  if ((newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime()) !== (oldValueValidated === null || oldValueValidated === void 0 ? void 0 : oldValueValidated.getTime())) {
39
39
  const textValue = this.getTextValue(newValueValidated) || '';
40
40
  const parsedDate = this.getParsedDateTime(textValue);
@@ -103,8 +103,8 @@ export class EzDateTimeInput {
103
103
  input.setSelectionRange(selectIni, selectFin);
104
104
  }
105
105
  changeValue(newValue) {
106
- const currentValue = this.validateValue(this.value);
107
- const newValueValidated = this.validateValue(newValue);
106
+ const currentValue = DateUtils.validateDate(this.value, true);
107
+ const newValueValidated = DateUtils.validateDate(newValue, true);
108
108
  if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
109
109
  this.value = newValueValidated;
110
110
  }
@@ -133,8 +133,8 @@ export class EzDateTimeInput {
133
133
  const newValue = this.getParsedDateTime();
134
134
  if (newValue || !strValue) {
135
135
  this.errorMessage = "";
136
- const currentValue = this.validateValue(this.value);
137
- const newValueValidated = this.validateValue(newValue);
136
+ const currentValue = DateUtils.validateDate(this.value, true);
137
+ const newValueValidated = DateUtils.validateDate(newValue, true);
138
138
  if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) === (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
139
139
  if (newValueValidated) {
140
140
  this._textInput.value = this.getTextValue(newValueValidated) || '';
@@ -163,15 +163,10 @@ export class EzDateTimeInput {
163
163
  };
164
164
  return d ? (new Intl.DateTimeFormat('pt-BR', this.showSeconds ? optionsSecond : options).format(d)) : undefined;
165
165
  }
166
- validateValue(value) {
167
- return value instanceof Date && !isNaN(value.valueOf())
168
- ? value
169
- : undefined;
170
- }
171
166
  handleInput(event) {
172
167
  const newValue = this.getParsedDateTime();
173
- const currentValue = this.validateValue(this.value);
174
- const newValueValidated = this.validateValue(newValue);
168
+ const currentValue = DateUtils.validateDate(this.value, true);
169
+ const newValueValidated = DateUtils.validateDate(newValue, true);
175
170
  if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
176
171
  this._focused = true;
177
172
  this.ezStartChange.emit({ waitmessage: "", blocking: false });
@@ -1,5 +1,5 @@
1
1
  import { Component, h, Host, Prop, Element, forceUpdate, Method, Watch, Event } from "@stencil/core";
2
- import { DataUnit, Action, DataUnitAction } from "@sankhyalabs/core";
2
+ import { DataUnit, Action, DataUnitAction, DateUtils } from "@sankhyalabs/core";
3
3
  import { FormSheet } from "./structure/FormSheet";
4
4
  import { buildFromConfig, buildFromDataUnit } from "./structure/FormSheetMetadata";
5
5
  import { createStore } from "redux";
@@ -101,7 +101,7 @@ export class EzForm {
101
101
  }
102
102
  processMetadata() {
103
103
  if (!this.isStatic() && this.dataUnit) {
104
- const metadata = this.config && this.config.length > 0 ? buildFromConfig(this.config, this.dataUnit) : buildFromDataUnit(this.dataUnit);
104
+ const metadata = this.config != undefined ? buildFromConfig(this.config, this.dataUnit) : buildFromDataUnit(this.dataUnit);
105
105
  this._store.dispatch(loadMetadata(metadata));
106
106
  }
107
107
  }
@@ -109,6 +109,16 @@ export class EzForm {
109
109
  var _a;
110
110
  return ((_a = this._staticFields) === null || _a === void 0 ? void 0 : _a.length) > 0;
111
111
  }
112
+ getValidatedValue(value) {
113
+ switch (value) {
114
+ case "${data}":
115
+ return DateUtils.getToday();
116
+ case "${datahora}":
117
+ return DateUtils.getToday(true);
118
+ default:
119
+ return value;
120
+ }
121
+ }
112
122
  interceptAction(action) {
113
123
  if (action.type === Action.RECORDS_COPIED) {
114
124
  const metadata = selectFormMetadata(this._store.getState());
@@ -137,7 +147,9 @@ export class EzForm {
137
147
  return new DataUnitAction(Action.RECORDS_ADDED, records.map(record => {
138
148
  const newRecord = Object.assign({}, record);
139
149
  for (const field in defaultValues) {
140
- newRecord[field] = this.dataUnit.valueFromString(field, defaultValues[field]);
150
+ const defaultValue = defaultValues[field].value;
151
+ const fieldValue = defaultValue != undefined ? defaultValue : defaultValues[field];
152
+ newRecord[field] = this.dataUnit.valueFromString(field, this.getValidatedValue(fieldValue));
141
153
  }
142
154
  return newRecord;
143
155
  }));
@@ -201,13 +213,10 @@ export class EzForm {
201
213
  "type": "unknown",
202
214
  "mutable": false,
203
215
  "complexType": {
204
- "original": "Array<FieldConfig>",
205
- "resolved": "FieldConfig[]",
216
+ "original": "IFormConfig",
217
+ "resolved": "IFormConfig",
206
218
  "references": {
207
- "Array": {
208
- "location": "global"
209
- },
210
- "FieldConfig": {
219
+ "IFormConfig": {
211
220
  "location": "local"
212
221
  }
213
222
  }
@@ -223,10 +232,10 @@ export class EzForm {
223
232
  "type": "unknown",
224
233
  "mutable": false,
225
234
  "complexType": {
226
- "original": "RecordValidator",
227
- "resolved": "RecordValidator",
235
+ "original": "IRecordValidator",
236
+ "resolved": "IRecordValidator",
228
237
  "references": {
229
- "RecordValidator": {
238
+ "IRecordValidator": {
230
239
  "location": "local"
231
240
  }
232
241
  }
@@ -303,7 +312,7 @@ export class EzForm {
303
312
  "location": "import",
304
313
  "path": "@sankhyalabs/core"
305
314
  },
306
- "ValidationResult": {
315
+ "IValidationResult": {
307
316
  "location": "local"
308
317
  }
309
318
  },
@@ -41,7 +41,7 @@ export const buildField = (field) => {
41
41
  builder = uiBuilders.get(descriptor.userInterface);
42
42
  }
43
43
  if (config.required) {
44
- config.label = `* ${config.label} (obrigatório)`;
44
+ config.label = `${config.label} (obrigatório) *`;
45
45
  }
46
46
  if (!builder) {
47
47
  builder = buildTextInput;