@sankhyalabs/ezui 1.1.159 → 1.1.160

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 (78) hide show
  1. package/dist/cjs/ez-combo-box.cjs.entry.js +62 -27
  2. package/dist/cjs/ez-date-input.cjs.entry.js +71 -25
  3. package/dist/cjs/ez-date-time-input.cjs.entry.js +94 -31
  4. package/dist/cjs/ez-filter-input.cjs.entry.js +10 -4
  5. package/dist/cjs/ez-form.cjs.entry.js +54 -9
  6. package/dist/cjs/ez-grid.cjs.entry.js +9 -6
  7. package/dist/cjs/ez-number-input.cjs.entry.js +69 -25
  8. package/dist/cjs/ez-search.cjs.entry.js +20 -5
  9. package/dist/cjs/ez-text-area.cjs.entry.js +8 -2
  10. package/dist/cjs/ez-text-input.cjs.entry.js +30 -21
  11. package/dist/cjs/ez-time-input.cjs.entry.js +75 -40
  12. package/dist/cjs/ezui.cjs.js +1 -1
  13. package/dist/cjs/loader.cjs.js +1 -1
  14. package/dist/collection/components/ez-combo-box/ez-combo-box.js +81 -28
  15. package/dist/collection/components/ez-date-input/ez-date-input.js +87 -25
  16. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +108 -31
  17. package/dist/collection/components/ez-filter-input/ez-filter-input.js +26 -4
  18. package/dist/collection/components/ez-form/DataBinder.js +12 -3
  19. package/dist/collection/components/ez-form/ez-form.js +43 -6
  20. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +1 -1
  21. package/dist/collection/components/ez-grid/ez-grid.js +14 -7
  22. package/dist/collection/components/ez-number-input/ez-number-input.js +83 -25
  23. package/dist/collection/components/ez-search/ez-search.js +38 -5
  24. package/dist/collection/components/ez-text-area/ez-text-area.css +1 -1
  25. package/dist/collection/components/ez-text-area/ez-text-area.js +23 -1
  26. package/dist/collection/components/ez-text-input/ez-text-input.css +1 -1
  27. package/dist/collection/components/ez-text-input/ez-text-input.js +45 -38
  28. package/dist/collection/components/ez-time-input/ez-time-input.js +95 -59
  29. package/dist/custom-elements/index.js +504 -197
  30. package/dist/esm/ez-combo-box.entry.js +62 -27
  31. package/dist/esm/ez-date-input.entry.js +71 -25
  32. package/dist/esm/ez-date-time-input.entry.js +94 -31
  33. package/dist/esm/ez-filter-input.entry.js +10 -4
  34. package/dist/esm/ez-form.entry.js +54 -9
  35. package/dist/esm/ez-grid.entry.js +9 -6
  36. package/dist/esm/ez-number-input.entry.js +69 -25
  37. package/dist/esm/ez-search.entry.js +20 -5
  38. package/dist/esm/ez-text-area.entry.js +8 -2
  39. package/dist/esm/ez-text-input.entry.js +30 -21
  40. package/dist/esm/ez-time-input.entry.js +76 -41
  41. package/dist/esm/ezui.js +1 -1
  42. package/dist/esm/loader.js +1 -1
  43. package/dist/ezui/ezui.esm.js +1 -1
  44. package/dist/ezui/p-003d53b1.entry.js +1 -0
  45. package/dist/ezui/p-267fa515.entry.js +1 -0
  46. package/dist/ezui/p-2acf7d59.entry.js +1 -0
  47. package/dist/ezui/p-403de0a4.entry.js +1 -0
  48. package/dist/ezui/p-4c3d136c.entry.js +1 -0
  49. package/dist/ezui/p-53bbba8e.entry.js +1 -0
  50. package/dist/ezui/p-6668c3b0.entry.js +1 -0
  51. package/dist/ezui/p-7fd6deec.entry.js +1 -0
  52. package/dist/ezui/p-ad6cc559.entry.js +1 -0
  53. package/dist/ezui/{p-be87ac5e.entry.js → p-ae2fea4c.entry.js} +1 -1
  54. package/dist/ezui/p-ff7b4b13.entry.js +1 -0
  55. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +13 -7
  56. package/dist/types/components/ez-date-input/ez-date-input.d.ts +10 -3
  57. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +15 -7
  58. package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +5 -1
  59. package/dist/types/components/ez-form/DataBinder.d.ts +1 -1
  60. package/dist/types/components/ez-form/ez-form.d.ts +1 -0
  61. package/dist/types/components/ez-grid/ez-grid.d.ts +4 -1
  62. package/dist/types/components/ez-number-input/ez-number-input.d.ts +14 -5
  63. package/dist/types/components/ez-search/ez-search.d.ts +6 -1
  64. package/dist/types/components/ez-text-area/ez-text-area.d.ts +4 -0
  65. package/dist/types/components/ez-text-input/ez-text-input.d.ts +7 -6
  66. package/dist/types/components/ez-time-input/ez-time-input.d.ts +17 -13
  67. package/dist/types/components.d.ts +43 -20
  68. package/package.json +1 -1
  69. package/dist/ezui/p-1859a3d8.entry.js +0 -1
  70. package/dist/ezui/p-49fdfa4b.entry.js +0 -1
  71. package/dist/ezui/p-4fdceb7d.entry.js +0 -1
  72. package/dist/ezui/p-6d4b1628.entry.js +0 -1
  73. package/dist/ezui/p-8f4fac31.entry.js +0 -1
  74. package/dist/ezui/p-91377c65.entry.js +0 -1
  75. package/dist/ezui/p-b524dfca.entry.js +0 -1
  76. package/dist/ezui/p-bc8aa27f.entry.js +0 -1
  77. package/dist/ezui/p-ec21ecce.entry.js +0 -1
  78. package/dist/ezui/p-fc9b9487.entry.js +0 -1
@@ -8,7 +8,7 @@ export class EzTimeInput {
8
8
  */
9
9
  this.enabled = true;
10
10
  /**
11
- * Define se o componente irá ou não considerar os segundos
11
+ * Define se o componente irá ou não considerar os segundos.
12
12
  */
13
13
  this.showSeconds = false;
14
14
  /**
@@ -16,6 +16,18 @@ export class EzTimeInput {
16
16
  */
17
17
  this.mode = "regular";
18
18
  }
19
+ observeErrorMessage() {
20
+ var _a;
21
+ if (this._textInput) {
22
+ this._textInput.errorMessage = this.errorMessage;
23
+ if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
24
+ this.prepareValue(this._viewValue);
25
+ if ((this._textInput.value || '') !== this._viewValue) {
26
+ this._textInput.value = this._viewValue;
27
+ }
28
+ }
29
+ }
30
+ }
19
31
  observeShowSeconds() {
20
32
  if (this.showSeconds) {
21
33
  this.prepareMask("##:##:##");
@@ -24,9 +36,23 @@ export class EzTimeInput {
24
36
  this.prepareMask("##:##");
25
37
  }
26
38
  }
27
- observeValue() {
28
- if (isNaN(this.value)) {
29
- this.value = undefined;
39
+ observeValue(newValue, oldValue) {
40
+ if (this._textInput && newValue != oldValue) {
41
+ let newValueValidated = this.validateValue(newValue);
42
+ const oldValueValidated = this.validateValue(oldValue);
43
+ if (newValueValidated != oldValueValidated) {
44
+ this._viewValue = newValueValidated == undefined ? "" : newValueValidated.toString();
45
+ this.prepareValue(this._viewValue);
46
+ if (this._viewValue && !TimeFormatter.validateTime(this._viewValue, this.showSeconds)) {
47
+ this.setError("Favor inserir um horário válido.");
48
+ newValueValidated = undefined;
49
+ }
50
+ else {
51
+ this.setError("");
52
+ }
53
+ const valueEmitted = newValueValidated === null ? undefined : newValueValidated;
54
+ this.ezChange.emit(valueEmitted);
55
+ }
30
56
  }
31
57
  }
32
58
  //---------------------------------------------
@@ -40,76 +66,84 @@ export class EzTimeInput {
40
66
  this._maskFormatter.mask = mask;
41
67
  }
42
68
  }
69
+ validateValue(value) {
70
+ return isNaN(value) || value === undefined ? null : value;
71
+ }
72
+ setError(msg) {
73
+ this.errorMessage = msg;
74
+ if (this._textInput && (msg === null || msg === void 0 ? void 0 : msg.trim())) {
75
+ this.ezCancelWaitingChange.emit();
76
+ }
77
+ }
43
78
  //---------------------------------------------
44
79
  // Public methods
45
80
  //---------------------------------------------
81
+ getViewValue() {
82
+ return this._viewValue;
83
+ }
84
+ prepareValue(value) {
85
+ try {
86
+ this._viewValue = TimeFormatter.prepareValue(value, this.showSeconds);
87
+ if (this._textInput && this._textInput.value !== this._viewValue) {
88
+ this._textInput.value = this._viewValue;
89
+ }
90
+ }
91
+ catch (e) {
92
+ this.setError(e.message);
93
+ }
94
+ }
46
95
  /**
47
96
  * Faz o foco no componente de input
48
97
  */
49
98
  async setFocus() {
50
- this._inputElem.setFocus();
99
+ this._textInput.setFocus();
51
100
  }
52
101
  /**
53
102
  * Remove o foco no componente de input
54
103
  */
55
104
  async setBlur() {
56
- this._inputElem.setBlur();
105
+ this._textInput.setBlur();
106
+ }
107
+ /**
108
+ * Retorna informando se o campo está inválido (true | false)
109
+ */
110
+ async isInvalid() {
111
+ return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
57
112
  }
58
113
  //---------------------------------------------
59
114
  // Event handlers
60
115
  //---------------------------------------------
61
- handleFocusout() {
62
- this.errorMessage = "";
63
- this.prepareValue(this.viewValue);
64
- if (this.viewValue && !TimeFormatter.validateTime(this.viewValue, this.showSeconds)) {
65
- this._oldViewValue = this.viewValue;
66
- this.ezCancelWaitingChange.emit();
67
- this.errorMessage = "Favor inserir um horário válido.";
68
- }
69
- else {
70
- if (this.viewValue === this._oldViewValue) {
71
- this.ezCancelWaitingChange.emit();
72
- return;
73
- }
74
- this._oldViewValue = this.viewValue;
75
- if (this.viewValue === "00:00" && this.value == undefined) {
76
- this.value = 0;
77
- }
78
- this.ezChange.emit(this.value);
116
+ handleBlur() {
117
+ if (this._textInput) {
118
+ this._viewValue = this._textInput.value;
119
+ this.prepareValue(this._viewValue);
120
+ this.value = NumberUtils.stringToNumber(this._viewValue.replace(/\D/g, ""));
79
121
  }
80
122
  }
81
- prepareValue(value) {
82
- try {
83
- this.viewValue = TimeFormatter.prepareValue(value, this.showSeconds);
123
+ handleInput() {
124
+ const parsedNumber = NumberUtils.stringToNumber(this._textInput.value.replace(/\D/g, ""));
125
+ if (parsedNumber !== this.value) {
126
+ this.ezStartChange.emit({ waitmessage: "", blocking: false });
84
127
  }
85
- catch (e) {
86
- this.errorMessage = e.message;
87
- }
88
- }
89
- handleChange() {
90
- this.ezStartChange.emit({ waitmessage: "", blocking: false });
91
- this.viewValue = this._inputElem.value;
92
- this.value = NumberUtils.stringToNumber(this.viewValue.replace(/\D/g, ""));
93
128
  }
94
129
  //---------------------------------------------
95
130
  // Lifecycle web component
96
131
  //---------------------------------------------
97
132
  componentDidLoad() {
98
- this.observeValue();
99
- CSSVarsUtils.applyVarsTextInput(this._elem, this._inputElem);
133
+ CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
100
134
  }
101
135
  componentWillLoad() {
102
136
  this.observeShowSeconds();
103
137
  if (this.value) {
104
138
  this.prepareValue(this.value.toString());
105
139
  }
106
- else if (this.viewValue) {
107
- this.prepareValue(this.viewValue);
140
+ else if (this._viewValue) {
141
+ this.prepareValue(this._viewValue);
108
142
  }
109
143
  }
110
144
  render() {
111
145
  return (h(Host, null,
112
- h("ez-text-input", { ref: (el) => this._inputElem = el, value: this.viewValue, enabled: this.enabled, label: this.label, restrict: "0123456789:", onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); }, errorMessage: this.errorMessage, mode: this.mode, slaveMode: true },
146
+ h("ez-text-input", { ref: (el) => this._textInput = el, "data-slave-mode": "true", value: this._viewValue, enabled: this.enabled, label: this.label, restrict: "0123456789:", onBlur: () => this.handleBlur(), onInput: () => this.handleInput(), errorMessage: this.errorMessage, mode: this.mode },
113
147
  h("ez-icon", { slot: "leftIcon", iconName: "timer-outline" }))));
114
148
  }
115
149
  static get is() { return "ez-time-input"; }
@@ -139,23 +173,6 @@ export class EzTimeInput {
139
173
  "attribute": "label",
140
174
  "reflect": true
141
175
  },
142
- "viewValue": {
143
- "type": "string",
144
- "mutable": true,
145
- "complexType": {
146
- "original": "string",
147
- "resolved": "string",
148
- "references": {}
149
- },
150
- "required": false,
151
- "optional": false,
152
- "docs": {
153
- "tags": [],
154
- "text": "Valor digitado pelo usu\u00E1rio. Este valor \u00E9 o que fica vis\u00EDvel no campo."
155
- },
156
- "attribute": "view-value",
157
- "reflect": true
158
- },
159
176
  "value": {
160
177
  "type": "number",
161
178
  "mutable": true,
@@ -203,7 +220,7 @@ export class EzTimeInput {
203
220
  "optional": false,
204
221
  "docs": {
205
222
  "tags": [],
206
- "text": "Quando h\u00E1 um problema de valida\u00E7\u00E3o, serve como orienta\u00E7\u00E3o ao usu\u00E1rio"
223
+ "text": "Quando h\u00E1 um problema de valida\u00E7\u00E3o, serve como orienta\u00E7\u00E3o ao usu\u00E1rio."
207
224
  },
208
225
  "attribute": "error-message",
209
226
  "reflect": true
@@ -220,7 +237,7 @@ export class EzTimeInput {
220
237
  "optional": false,
221
238
  "docs": {
222
239
  "tags": [],
223
- "text": "Define se o componente ir\u00E1 ou n\u00E3o considerar os segundos"
240
+ "text": "Define se o componente ir\u00E1 ou n\u00E3o considerar os segundos."
224
241
  },
225
242
  "attribute": "show-seconds",
226
243
  "reflect": true,
@@ -328,10 +345,29 @@ export class EzTimeInput {
328
345
  "text": "Remove o foco no componente de input",
329
346
  "tags": []
330
347
  }
348
+ },
349
+ "isInvalid": {
350
+ "complexType": {
351
+ "signature": "() => Promise<boolean>",
352
+ "parameters": [],
353
+ "references": {
354
+ "Promise": {
355
+ "location": "global"
356
+ }
357
+ },
358
+ "return": "Promise<boolean>"
359
+ },
360
+ "docs": {
361
+ "text": "Retorna informando se o campo est\u00E1 inv\u00E1lido (true | false)",
362
+ "tags": []
363
+ }
331
364
  }
332
365
  }; }
333
366
  static get elementRef() { return "_elem"; }
334
367
  static get watchers() { return [{
368
+ "propName": "errorMessage",
369
+ "methodName": "observeErrorMessage"
370
+ }, {
335
371
  "propName": "showSeconds",
336
372
  "methodName": "observeShowSeconds"
337
373
  }, {