@sankhyalabs/ezui 1.1.8 → 1.1.9

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 (141) hide show
  1. package/README.md +72 -72
  2. package/dist/cjs/{DataUnit-28b290cb.js → DataUnit-9a4a35ca.js} +415 -371
  3. package/dist/cjs/ez-action-chip.cjs.entry.js +41 -41
  4. package/dist/cjs/ez-button_14.cjs.entry.js +1911 -1911
  5. package/dist/cjs/ez-label-chip.cjs.entry.js +120 -120
  6. package/dist/cjs/ez-modal.cjs.entry.js +104 -104
  7. package/dist/cjs/ez-number-input.cjs.entry.js +236 -236
  8. package/dist/cjs/ez-time-input.cjs.entry.js +168 -168
  9. package/dist/cjs/form-metadata.cjs.entry.js +65 -65
  10. package/dist/collection/components/ez-action-chip/ez-action-chip.css +82 -82
  11. package/dist/collection/components/ez-action-chip/ez-action-chip.js +109 -109
  12. package/dist/collection/components/ez-button/ez-button.css +94 -94
  13. package/dist/collection/components/ez-button/ez-button.js +125 -125
  14. package/dist/collection/components/ez-calendar/ez-calendar.css +210 -210
  15. package/dist/collection/components/ez-calendar/ez-calendar.js +215 -215
  16. package/dist/collection/components/ez-check/ez-check.css +265 -265
  17. package/dist/collection/components/ez-check/ez-check.js +168 -168
  18. package/dist/collection/components/ez-collapsable-box/ez-collapsable-box.css +67 -67
  19. package/dist/collection/components/ez-collapsable-box/ez-collapsable-box.js +108 -108
  20. package/dist/collection/components/ez-combo-box/ez-combo-box-interfaces.js +2 -2
  21. package/dist/collection/components/ez-combo-box/ez-combo-box.css +167 -167
  22. package/dist/collection/components/ez-combo-box/ez-combo-box.js +363 -363
  23. package/dist/collection/components/ez-date-input/ez-date-input.css +38 -38
  24. package/dist/collection/components/ez-date-input/ez-date-input.js +172 -172
  25. package/dist/collection/components/ez-form/ez-form.css +19 -19
  26. package/dist/collection/components/ez-form/ez-form.js +368 -368
  27. package/dist/collection/components/ez-form/store/Form.actions.js +132 -132
  28. package/dist/collection/components/ez-form/store/Form.reducer.js +194 -194
  29. package/dist/collection/components/ez-form/store/Form.selectors.js +44 -44
  30. package/dist/collection/components/ez-form/subcomponents/DataUnit.js +251 -207
  31. package/dist/collection/components/ez-form/subcomponents/FormMetadata.js +16 -16
  32. package/dist/collection/components/ez-form/subcomponents/css/place-holder.css +23 -23
  33. package/dist/collection/components/ez-form/subcomponents/form-metadata.js +173 -173
  34. package/dist/collection/components/ez-form/subcomponents/place-holder.js +14 -14
  35. package/dist/collection/components/ez-form/subcomponents/structure/Field.js +71 -71
  36. package/dist/collection/components/ez-form/subcomponents/structure/FieldSet.js +27 -27
  37. package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +40 -40
  38. package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +27 -27
  39. package/dist/collection/components/ez-icon/ez-icon.css +36 -36
  40. package/dist/collection/components/ez-icon/ez-icon.js +56 -56
  41. package/dist/collection/components/ez-label-chip/ez-label-chip.css +117 -117
  42. package/dist/collection/components/ez-label-chip/ez-label-chip.js +276 -276
  43. package/dist/collection/components/ez-modal/ez-modal.css +86 -86
  44. package/dist/collection/components/ez-modal/ez-modal.js +224 -224
  45. package/dist/collection/components/ez-number-input/ez-number-input.css +144 -144
  46. package/dist/collection/components/ez-number-input/ez-number-input.js +465 -465
  47. package/dist/collection/components/ez-popover/ez-popover.css +38 -38
  48. package/dist/collection/components/ez-popover/ez-popover.js +323 -323
  49. package/dist/collection/components/ez-search/ez-search.css +295 -295
  50. package/dist/collection/components/ez-search/ez-search.js +527 -527
  51. package/dist/collection/components/ez-tabselector/ez-tabselector.css +125 -125
  52. package/dist/collection/components/ez-tabselector/ez-tabselector.js +283 -283
  53. package/dist/collection/components/ez-text-area/ez-text-area.css +139 -139
  54. package/dist/collection/components/ez-text-area/ez-text-area.js +267 -267
  55. package/dist/collection/components/ez-text-input/ez-text-input.css +169 -169
  56. package/dist/collection/components/ez-text-input/ez-text-input.js +395 -395
  57. package/dist/collection/components/ez-time-input/ez-time-input.css +155 -155
  58. package/dist/collection/components/ez-time-input/ez-time-input.js +326 -326
  59. package/dist/collection/index.js +1 -1
  60. package/dist/collection/servidor.js +100 -100
  61. package/dist/collection/utils/FloatingManager.js +15 -15
  62. package/dist/collection/utils/utils.js +6 -6
  63. package/dist/custom-elements/index.js +3125 -3081
  64. package/dist/esm/{DataUnit-69e518fa.js → DataUnit-d5d4c9a3.js} +415 -371
  65. package/dist/esm/ez-action-chip.entry.js +41 -41
  66. package/dist/esm/ez-button_14.entry.js +1911 -1911
  67. package/dist/esm/ez-label-chip.entry.js +120 -120
  68. package/dist/esm/ez-modal.entry.js +104 -104
  69. package/dist/esm/ez-number-input.entry.js +236 -236
  70. package/dist/esm/ez-time-input.entry.js +168 -168
  71. package/dist/esm/form-metadata.entry.js +65 -65
  72. package/dist/esm/polyfills/core-js.js +0 -0
  73. package/dist/esm/polyfills/dom.js +0 -0
  74. package/dist/esm/polyfills/es5-html-element.js +0 -0
  75. package/dist/esm/polyfills/index.js +0 -0
  76. package/dist/esm/polyfills/system.js +0 -0
  77. package/dist/ezui/ezui.esm.js +1 -1
  78. package/dist/ezui/{p-b0974f4f.entry.js → p-0fcdfb51.entry.js} +1 -1
  79. package/dist/ezui/p-dac7a6c2.js +1 -0
  80. package/dist/ezui/{p-db11c600.entry.js → p-dbef7060.entry.js} +1 -1
  81. package/dist/types/components/ez-action-chip/ez-action-chip.d.ts +16 -16
  82. package/dist/types/components/ez-button/ez-button.d.ts +20 -20
  83. package/dist/types/components/ez-calendar/ez-calendar.d.ts +42 -42
  84. package/dist/types/components/ez-check/ez-check.d.ts +32 -32
  85. package/dist/types/components/ez-collapsable-box/ez-collapsable-box.d.ts +18 -18
  86. package/dist/types/components/ez-combo-box/ez-combo-box-interfaces.d.ts +4 -4
  87. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +68 -68
  88. package/dist/types/components/ez-date-input/ez-date-input.d.ts +31 -31
  89. package/dist/types/components/ez-form/ez-form.d.ts +26 -31
  90. package/dist/types/components/ez-form/store/Form.actions.d.ts +111 -111
  91. package/dist/types/components/ez-form/store/Form.reducer.d.ts +20 -20
  92. package/dist/types/components/ez-form/store/Form.selectors.d.ts +14 -14
  93. package/dist/types/components/ez-form/subcomponents/DataUnit.d.ts +60 -55
  94. package/dist/types/components/ez-form/subcomponents/FormMetadata.d.ts +41 -41
  95. package/dist/types/components/ez-form/subcomponents/form-metadata.d.ts +15 -15
  96. package/dist/types/components/ez-form/subcomponents/place-holder.d.ts +3 -3
  97. package/dist/types/components/ez-form/subcomponents/structure/Field.d.ts +10 -10
  98. package/dist/types/components/ez-form/subcomponents/structure/FieldSet.d.ts +12 -12
  99. package/dist/types/components/ez-form/subcomponents/structure/FormSheet.d.ts +13 -13
  100. package/dist/types/components/ez-form/subcomponents/structure/NavigationBar.d.ts +17 -17
  101. package/dist/types/components/ez-icon/ez-icon.d.ts +5 -5
  102. package/dist/types/components/ez-label-chip/ez-label-chip.d.ts +40 -40
  103. package/dist/types/components/ez-modal/ez-modal.d.ts +32 -32
  104. package/dist/types/components/ez-number-input/ez-number-input.d.ts +73 -73
  105. package/dist/types/components/ez-popover/ez-popover.d.ts +52 -52
  106. package/dist/types/components/ez-search/ez-search.d.ts +95 -95
  107. package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +31 -31
  108. package/dist/types/components/ez-text-area/ez-text-area.d.ts +49 -49
  109. package/dist/types/components/ez-text-input/ez-text-input.d.ts +64 -64
  110. package/dist/types/components/ez-time-input/ez-time-input.d.ts +53 -53
  111. package/dist/types/index.d.ts +1 -1
  112. package/dist/types/utils/utils.d.ts +2 -2
  113. package/package.json +114 -114
  114. package/dist/ezui/p-10ef58b3.js +0 -1
  115. package/react/components.d.ts +0 -22
  116. package/react/components.js +0 -25
  117. package/react/components.js.map +0 -1
  118. package/react/react-component-lib/createComponent.d.ts +0 -10
  119. package/react/react-component-lib/createComponent.js +0 -59
  120. package/react/react-component-lib/createComponent.js.map +0 -1
  121. package/react/react-component-lib/createOverlayComponent.d.ts +0 -20
  122. package/react/react-component-lib/createOverlayComponent.js +0 -89
  123. package/react/react-component-lib/createOverlayComponent.js.map +0 -1
  124. package/react/react-component-lib/index.d.ts +0 -2
  125. package/react/react-component-lib/index.js +0 -3
  126. package/react/react-component-lib/index.js.map +0 -1
  127. package/react/react-component-lib/interfaces.d.ts +0 -29
  128. package/react/react-component-lib/interfaces.js +0 -1
  129. package/react/react-component-lib/interfaces.js.map +0 -1
  130. package/react/react-component-lib/utils/attachProps.d.ts +0 -12
  131. package/react/react-component-lib/utils/attachProps.js +0 -96
  132. package/react/react-component-lib/utils/attachProps.js.map +0 -1
  133. package/react/react-component-lib/utils/case.d.ts +0 -2
  134. package/react/react-component-lib/utils/case.js +0 -7
  135. package/react/react-component-lib/utils/case.js.map +0 -1
  136. package/react/react-component-lib/utils/dev.d.ts +0 -2
  137. package/react/react-component-lib/utils/dev.js +0 -13
  138. package/react/react-component-lib/utils/dev.js.map +0 -1
  139. package/react/react-component-lib/utils/index.d.ts +0 -7
  140. package/react/react-component-lib/utils/index.js +0 -21
  141. package/react/react-component-lib/utils/index.js.map +0 -1
@@ -1,326 +1,326 @@
1
- import { Component, Prop, h, Watch, Host, Method } from '@stencil/core';
2
- import { TimeFormatter, MaskFormatter, NumberUtils } from '@sankhyalabs/core';
3
- export class EzTimeInput {
4
- constructor() {
5
- /**
6
- * Deixa o campo disponível ou não para digitação.
7
- */
8
- this.enabled = true;
9
- /**
10
- * Define se o componente irá ou não considerar os segundos
11
- */
12
- this.showSeconds = false;
13
- }
14
- showError() {
15
- const hasError = typeof this.errormessage === 'string' && this.errormessage !== '';
16
- if (hasError) {
17
- this._inputElem.classList.add('hasError');
18
- this._messageBoxElem.classList.add('hasError');
19
- }
20
- else {
21
- this._inputElem.classList.remove('hasError');
22
- this._messageBoxElem.classList.remove('hasError');
23
- }
24
- }
25
- prepareMask() {
26
- if (this.showSeconds) {
27
- if (this._maskFormatter == undefined) {
28
- this._maskFormatter = new MaskFormatter("##:##:##");
29
- }
30
- else {
31
- this._maskFormatter.mask = "##:##:##";
32
- }
33
- }
34
- else {
35
- if (this._maskFormatter == undefined) {
36
- this._maskFormatter = new MaskFormatter("##:##");
37
- }
38
- else {
39
- this._maskFormatter.mask = "##:##";
40
- }
41
- }
42
- }
43
- adjustFloatingLabel() {
44
- if (this.label) {
45
- if (!this._inputElem.classList.contains("input--with--label")) {
46
- this._inputElem.classList.add("input--with--label");
47
- }
48
- if (this.viewValue && this.viewValue.toString().length > 0) {
49
- if (!this._labelElem.classList.contains("input__label--floated")) {
50
- this._labelElem.classList.add("input__label--floated");
51
- }
52
- }
53
- else {
54
- if (this._labelElem.classList.contains("input__label--floated")) {
55
- this._labelElem.classList.remove("input__label--floated");
56
- }
57
- }
58
- }
59
- }
60
- onValueChanged() {
61
- if (this.value === NaN) {
62
- this.value = undefined;
63
- this.handleFocusout();
64
- }
65
- }
66
- //---------------------------------------------
67
- // Public methods
68
- //---------------------------------------------
69
- /**
70
- * Faz o foco no componente de input
71
- */
72
- async setFocus() {
73
- this._inputElem.focus();
74
- }
75
- /**
76
- * Remove o foco no componente de input
77
- */
78
- async setBlur() {
79
- this._inputElem.blur();
80
- }
81
- //---------------------------------------------
82
- // Test Methods
83
- //---------------------------------------------
84
- setInputElemnt(input) {
85
- this._iconElement = input;
86
- }
87
- //---------------------------------------------
88
- // Event handlers
89
- //---------------------------------------------
90
- handleFocusout() {
91
- this.errormessage = "";
92
- this.prepareValue(this.viewValue);
93
- if (!TimeFormatter.validateTime(this.viewValue, this.showSeconds)) {
94
- this.clearField();
95
- this.errormessage = "Favor inserir um horário válido.";
96
- }
97
- this.adjustFloatingLabel();
98
- }
99
- prepareValue(value) {
100
- try {
101
- this.viewValue = TimeFormatter.prepareValue(value, this.showSeconds);
102
- }
103
- catch (e) {
104
- this.clearField();
105
- this.errormessage = e.message;
106
- }
107
- }
108
- clearField() {
109
- this.viewValue = this.value = undefined;
110
- }
111
- handleChange() {
112
- this.viewValue = this._inputElem.value;
113
- this.value = NumberUtils.stringToNumber(this.viewValue.replace(/\D/g, ""));
114
- }
115
- adjustIconStyle() {
116
- if (this._iconElement) {
117
- this._iconElement.style.position = "absolute";
118
- this._iconElement.style.display = "flex";
119
- this._iconElement.style.alignItems = "center";
120
- this._iconElement.style.justifyContent = "center";
121
- this._iconElement.style.overflow = "hidden";
122
- this._iconElement.style.top = "0px";
123
- this._iconElement.style.width = "var(--eztime__icon--width)";
124
- this._iconElement.style.height = "var(--eztime--height)";
125
- this._iconElement.style.left = "0px";
126
- this._iconElement.style.borderRadius = "var(--eztime--border-radius) 0 0 var(--eztime--border-radius)";
127
- this._inputElem.classList.add('icon--left');
128
- if (this._labelElem) {
129
- this._labelElem.classList.add("input__label--left");
130
- }
131
- }
132
- this.showError();
133
- }
134
- doFocus() {
135
- if (this.label && this._labelElem) {
136
- if (!this._labelElem.classList.contains("input__label--floated")) {
137
- this._labelElem.classList.add("input__label--floated");
138
- }
139
- }
140
- }
141
- //---------------------------------------------
142
- // Lifecycle web component
143
- //---------------------------------------------
144
- componentDidLoad() {
145
- this.onValueChanged();
146
- this.adjustIconStyle();
147
- this.adjustFloatingLabel();
148
- this.showError();
149
- }
150
- componentWillLoad() {
151
- this.prepareMask();
152
- if (this.value) {
153
- this.prepareValue(this.value.toString());
154
- }
155
- else if (this.viewValue) {
156
- this.prepareValue(this.viewValue);
157
- }
158
- }
159
- render() {
160
- return (h(Host, null,
161
- h("ez-icon", { ref: (el) => this._iconElement = el, href: "/themes/default/images/icons/actions-sprite.svg#timer-outline" }),
162
- this.label ?
163
- h("label", { onClick: () => this._inputElem.focus(), class: this.value ? "input__label input__label--floated" : "input__label", ref: (el) => this._labelElem = el, title: this.label }, this.label)
164
- : null,
165
- h("input", { onFocus: () => this.doFocus(), ref: (el) => this._inputElem = el, type: "text", value: this.viewValue, disabled: !this.enabled, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); } }),
166
- h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el }, this.errormessage)));
167
- }
168
- static get is() { return "ez-time-input"; }
169
- static get encapsulation() { return "shadow"; }
170
- static get originalStyleUrls() { return {
171
- "$": ["ez-time-input.css"]
172
- }; }
173
- static get styleUrls() { return {
174
- "$": ["ez-time-input.css"]
175
- }; }
176
- static get properties() { return {
177
- "label": {
178
- "type": "string",
179
- "mutable": false,
180
- "complexType": {
181
- "original": "string",
182
- "resolved": "string",
183
- "references": {}
184
- },
185
- "required": false,
186
- "optional": false,
187
- "docs": {
188
- "tags": [],
189
- "text": "Label \u00E9 o t\u00EDtulo do campo"
190
- },
191
- "attribute": "label",
192
- "reflect": true
193
- },
194
- "viewValue": {
195
- "type": "string",
196
- "mutable": true,
197
- "complexType": {
198
- "original": "string",
199
- "resolved": "string",
200
- "references": {}
201
- },
202
- "required": false,
203
- "optional": false,
204
- "docs": {
205
- "tags": [],
206
- "text": "Valor digitado pelo usu\u00E1rio. Este valor \u00E9 o que fica vis\u00EDvel no campo."
207
- },
208
- "attribute": "view-value",
209
- "reflect": true
210
- },
211
- "value": {
212
- "type": "number",
213
- "mutable": true,
214
- "complexType": {
215
- "original": "number",
216
- "resolved": "number",
217
- "references": {}
218
- },
219
- "required": false,
220
- "optional": false,
221
- "docs": {
222
- "tags": [],
223
- "text": "Valor que ser\u00E1 transmitido para o back-end."
224
- },
225
- "attribute": "value",
226
- "reflect": false
227
- },
228
- "enabled": {
229
- "type": "boolean",
230
- "mutable": false,
231
- "complexType": {
232
- "original": "boolean",
233
- "resolved": "boolean",
234
- "references": {}
235
- },
236
- "required": false,
237
- "optional": false,
238
- "docs": {
239
- "tags": [],
240
- "text": "Deixa o campo dispon\u00EDvel ou n\u00E3o para digita\u00E7\u00E3o."
241
- },
242
- "attribute": "enabled",
243
- "reflect": true,
244
- "defaultValue": "true"
245
- },
246
- "errormessage": {
247
- "type": "string",
248
- "mutable": true,
249
- "complexType": {
250
- "original": "string",
251
- "resolved": "string",
252
- "references": {}
253
- },
254
- "required": false,
255
- "optional": false,
256
- "docs": {
257
- "tags": [],
258
- "text": "Quando h\u00E1 um problema de valida\u00E7\u00E3o, serve como orienta\u00E7\u00E3o ao usu\u00E1rio"
259
- },
260
- "attribute": "errormessage",
261
- "reflect": true
262
- },
263
- "showSeconds": {
264
- "type": "boolean",
265
- "mutable": false,
266
- "complexType": {
267
- "original": "boolean",
268
- "resolved": "boolean",
269
- "references": {}
270
- },
271
- "required": false,
272
- "optional": false,
273
- "docs": {
274
- "tags": [],
275
- "text": "Define se o componente ir\u00E1 ou n\u00E3o considerar os segundos"
276
- },
277
- "attribute": "show-seconds",
278
- "reflect": true,
279
- "defaultValue": "false"
280
- }
281
- }; }
282
- static get methods() { return {
283
- "setFocus": {
284
- "complexType": {
285
- "signature": "() => Promise<void>",
286
- "parameters": [],
287
- "references": {
288
- "Promise": {
289
- "location": "global"
290
- }
291
- },
292
- "return": "Promise<void>"
293
- },
294
- "docs": {
295
- "text": "Faz o foco no componente de input",
296
- "tags": []
297
- }
298
- },
299
- "setBlur": {
300
- "complexType": {
301
- "signature": "() => Promise<void>",
302
- "parameters": [],
303
- "references": {
304
- "Promise": {
305
- "location": "global"
306
- }
307
- },
308
- "return": "Promise<void>"
309
- },
310
- "docs": {
311
- "text": "Remove o foco no componente de input",
312
- "tags": []
313
- }
314
- }
315
- }; }
316
- static get watchers() { return [{
317
- "propName": "errormessage",
318
- "methodName": "showError"
319
- }, {
320
- "propName": "showSeconds",
321
- "methodName": "prepareMask"
322
- }, {
323
- "propName": "value",
324
- "methodName": "onValueChanged"
325
- }]; }
326
- }
1
+ import { Component, Prop, h, Watch, Host, Method } from '@stencil/core';
2
+ import { TimeFormatter, MaskFormatter, NumberUtils } from '@sankhyalabs/core';
3
+ export class EzTimeInput {
4
+ constructor() {
5
+ /**
6
+ * Deixa o campo disponível ou não para digitação.
7
+ */
8
+ this.enabled = true;
9
+ /**
10
+ * Define se o componente irá ou não considerar os segundos
11
+ */
12
+ this.showSeconds = false;
13
+ }
14
+ showError() {
15
+ const hasError = typeof this.errormessage === 'string' && this.errormessage !== '';
16
+ if (hasError) {
17
+ this._inputElem.classList.add('hasError');
18
+ this._messageBoxElem.classList.add('hasError');
19
+ }
20
+ else {
21
+ this._inputElem.classList.remove('hasError');
22
+ this._messageBoxElem.classList.remove('hasError');
23
+ }
24
+ }
25
+ prepareMask() {
26
+ if (this.showSeconds) {
27
+ if (this._maskFormatter == undefined) {
28
+ this._maskFormatter = new MaskFormatter("##:##:##");
29
+ }
30
+ else {
31
+ this._maskFormatter.mask = "##:##:##";
32
+ }
33
+ }
34
+ else {
35
+ if (this._maskFormatter == undefined) {
36
+ this._maskFormatter = new MaskFormatter("##:##");
37
+ }
38
+ else {
39
+ this._maskFormatter.mask = "##:##";
40
+ }
41
+ }
42
+ }
43
+ adjustFloatingLabel() {
44
+ if (this.label) {
45
+ if (!this._inputElem.classList.contains("input--with--label")) {
46
+ this._inputElem.classList.add("input--with--label");
47
+ }
48
+ if (this.viewValue && this.viewValue.toString().length > 0) {
49
+ if (!this._labelElem.classList.contains("input__label--floated")) {
50
+ this._labelElem.classList.add("input__label--floated");
51
+ }
52
+ }
53
+ else {
54
+ if (this._labelElem.classList.contains("input__label--floated")) {
55
+ this._labelElem.classList.remove("input__label--floated");
56
+ }
57
+ }
58
+ }
59
+ }
60
+ onValueChanged() {
61
+ if (this.value === NaN) {
62
+ this.value = undefined;
63
+ this.handleFocusout();
64
+ }
65
+ }
66
+ //---------------------------------------------
67
+ // Public methods
68
+ //---------------------------------------------
69
+ /**
70
+ * Faz o foco no componente de input
71
+ */
72
+ async setFocus() {
73
+ this._inputElem.focus();
74
+ }
75
+ /**
76
+ * Remove o foco no componente de input
77
+ */
78
+ async setBlur() {
79
+ this._inputElem.blur();
80
+ }
81
+ //---------------------------------------------
82
+ // Test Methods
83
+ //---------------------------------------------
84
+ setInputElemnt(input) {
85
+ this._iconElement = input;
86
+ }
87
+ //---------------------------------------------
88
+ // Event handlers
89
+ //---------------------------------------------
90
+ handleFocusout() {
91
+ this.errormessage = "";
92
+ this.prepareValue(this.viewValue);
93
+ if (!TimeFormatter.validateTime(this.viewValue, this.showSeconds)) {
94
+ this.clearField();
95
+ this.errormessage = "Favor inserir um horário válido.";
96
+ }
97
+ this.adjustFloatingLabel();
98
+ }
99
+ prepareValue(value) {
100
+ try {
101
+ this.viewValue = TimeFormatter.prepareValue(value, this.showSeconds);
102
+ }
103
+ catch (e) {
104
+ this.clearField();
105
+ this.errormessage = e.message;
106
+ }
107
+ }
108
+ clearField() {
109
+ this.viewValue = this.value = undefined;
110
+ }
111
+ handleChange() {
112
+ this.viewValue = this._inputElem.value;
113
+ this.value = NumberUtils.stringToNumber(this.viewValue.replace(/\D/g, ""));
114
+ }
115
+ adjustIconStyle() {
116
+ if (this._iconElement) {
117
+ this._iconElement.style.position = "absolute";
118
+ this._iconElement.style.display = "flex";
119
+ this._iconElement.style.alignItems = "center";
120
+ this._iconElement.style.justifyContent = "center";
121
+ this._iconElement.style.overflow = "hidden";
122
+ this._iconElement.style.top = "0px";
123
+ this._iconElement.style.width = "var(--eztime__icon--width)";
124
+ this._iconElement.style.height = "var(--eztime--height)";
125
+ this._iconElement.style.left = "0px";
126
+ this._iconElement.style.borderRadius = "var(--eztime--border-radius) 0 0 var(--eztime--border-radius)";
127
+ this._inputElem.classList.add('icon--left');
128
+ if (this._labelElem) {
129
+ this._labelElem.classList.add("input__label--left");
130
+ }
131
+ }
132
+ this.showError();
133
+ }
134
+ doFocus() {
135
+ if (this.label && this._labelElem) {
136
+ if (!this._labelElem.classList.contains("input__label--floated")) {
137
+ this._labelElem.classList.add("input__label--floated");
138
+ }
139
+ }
140
+ }
141
+ //---------------------------------------------
142
+ // Lifecycle web component
143
+ //---------------------------------------------
144
+ componentDidLoad() {
145
+ this.onValueChanged();
146
+ this.adjustIconStyle();
147
+ this.adjustFloatingLabel();
148
+ this.showError();
149
+ }
150
+ componentWillLoad() {
151
+ this.prepareMask();
152
+ if (this.value) {
153
+ this.prepareValue(this.value.toString());
154
+ }
155
+ else if (this.viewValue) {
156
+ this.prepareValue(this.viewValue);
157
+ }
158
+ }
159
+ render() {
160
+ return (h(Host, null,
161
+ h("ez-icon", { ref: (el) => this._iconElement = el, href: "/themes/default/images/icons/actions-sprite.svg#timer-outline" }),
162
+ this.label ?
163
+ h("label", { onClick: () => this._inputElem.focus(), class: this.value ? "input__label input__label--floated" : "input__label", ref: (el) => this._labelElem = el, title: this.label }, this.label)
164
+ : null,
165
+ h("input", { onFocus: () => this.doFocus(), ref: (el) => this._inputElem = el, type: "text", value: this.viewValue, disabled: !this.enabled, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); } }),
166
+ h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el }, this.errormessage)));
167
+ }
168
+ static get is() { return "ez-time-input"; }
169
+ static get encapsulation() { return "shadow"; }
170
+ static get originalStyleUrls() { return {
171
+ "$": ["ez-time-input.css"]
172
+ }; }
173
+ static get styleUrls() { return {
174
+ "$": ["ez-time-input.css"]
175
+ }; }
176
+ static get properties() { return {
177
+ "label": {
178
+ "type": "string",
179
+ "mutable": false,
180
+ "complexType": {
181
+ "original": "string",
182
+ "resolved": "string",
183
+ "references": {}
184
+ },
185
+ "required": false,
186
+ "optional": false,
187
+ "docs": {
188
+ "tags": [],
189
+ "text": "Label \u00E9 o t\u00EDtulo do campo"
190
+ },
191
+ "attribute": "label",
192
+ "reflect": true
193
+ },
194
+ "viewValue": {
195
+ "type": "string",
196
+ "mutable": true,
197
+ "complexType": {
198
+ "original": "string",
199
+ "resolved": "string",
200
+ "references": {}
201
+ },
202
+ "required": false,
203
+ "optional": false,
204
+ "docs": {
205
+ "tags": [],
206
+ "text": "Valor digitado pelo usu\u00E1rio. Este valor \u00E9 o que fica vis\u00EDvel no campo."
207
+ },
208
+ "attribute": "view-value",
209
+ "reflect": true
210
+ },
211
+ "value": {
212
+ "type": "number",
213
+ "mutable": true,
214
+ "complexType": {
215
+ "original": "number",
216
+ "resolved": "number",
217
+ "references": {}
218
+ },
219
+ "required": false,
220
+ "optional": false,
221
+ "docs": {
222
+ "tags": [],
223
+ "text": "Valor que ser\u00E1 transmitido para o back-end."
224
+ },
225
+ "attribute": "value",
226
+ "reflect": false
227
+ },
228
+ "enabled": {
229
+ "type": "boolean",
230
+ "mutable": false,
231
+ "complexType": {
232
+ "original": "boolean",
233
+ "resolved": "boolean",
234
+ "references": {}
235
+ },
236
+ "required": false,
237
+ "optional": false,
238
+ "docs": {
239
+ "tags": [],
240
+ "text": "Deixa o campo dispon\u00EDvel ou n\u00E3o para digita\u00E7\u00E3o."
241
+ },
242
+ "attribute": "enabled",
243
+ "reflect": true,
244
+ "defaultValue": "true"
245
+ },
246
+ "errormessage": {
247
+ "type": "string",
248
+ "mutable": true,
249
+ "complexType": {
250
+ "original": "string",
251
+ "resolved": "string",
252
+ "references": {}
253
+ },
254
+ "required": false,
255
+ "optional": false,
256
+ "docs": {
257
+ "tags": [],
258
+ "text": "Quando h\u00E1 um problema de valida\u00E7\u00E3o, serve como orienta\u00E7\u00E3o ao usu\u00E1rio"
259
+ },
260
+ "attribute": "errormessage",
261
+ "reflect": true
262
+ },
263
+ "showSeconds": {
264
+ "type": "boolean",
265
+ "mutable": false,
266
+ "complexType": {
267
+ "original": "boolean",
268
+ "resolved": "boolean",
269
+ "references": {}
270
+ },
271
+ "required": false,
272
+ "optional": false,
273
+ "docs": {
274
+ "tags": [],
275
+ "text": "Define se o componente ir\u00E1 ou n\u00E3o considerar os segundos"
276
+ },
277
+ "attribute": "show-seconds",
278
+ "reflect": true,
279
+ "defaultValue": "false"
280
+ }
281
+ }; }
282
+ static get methods() { return {
283
+ "setFocus": {
284
+ "complexType": {
285
+ "signature": "() => Promise<void>",
286
+ "parameters": [],
287
+ "references": {
288
+ "Promise": {
289
+ "location": "global"
290
+ }
291
+ },
292
+ "return": "Promise<void>"
293
+ },
294
+ "docs": {
295
+ "text": "Faz o foco no componente de input",
296
+ "tags": []
297
+ }
298
+ },
299
+ "setBlur": {
300
+ "complexType": {
301
+ "signature": "() => Promise<void>",
302
+ "parameters": [],
303
+ "references": {
304
+ "Promise": {
305
+ "location": "global"
306
+ }
307
+ },
308
+ "return": "Promise<void>"
309
+ },
310
+ "docs": {
311
+ "text": "Remove o foco no componente de input",
312
+ "tags": []
313
+ }
314
+ }
315
+ }; }
316
+ static get watchers() { return [{
317
+ "propName": "errormessage",
318
+ "methodName": "showError"
319
+ }, {
320
+ "propName": "showSeconds",
321
+ "methodName": "prepareMask"
322
+ }, {
323
+ "propName": "value",
324
+ "methodName": "onValueChanged"
325
+ }]; }
326
+ }
@@ -1 +1 @@
1
- export {};
1
+ export {};