@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.
- package/README.md +72 -72
- package/dist/cjs/{DataUnit-28b290cb.js → DataUnit-9a4a35ca.js} +415 -371
- package/dist/cjs/ez-action-chip.cjs.entry.js +41 -41
- package/dist/cjs/ez-button_14.cjs.entry.js +1911 -1911
- package/dist/cjs/ez-label-chip.cjs.entry.js +120 -120
- package/dist/cjs/ez-modal.cjs.entry.js +104 -104
- package/dist/cjs/ez-number-input.cjs.entry.js +236 -236
- package/dist/cjs/ez-time-input.cjs.entry.js +168 -168
- package/dist/cjs/form-metadata.cjs.entry.js +65 -65
- package/dist/collection/components/ez-action-chip/ez-action-chip.css +82 -82
- package/dist/collection/components/ez-action-chip/ez-action-chip.js +109 -109
- package/dist/collection/components/ez-button/ez-button.css +94 -94
- package/dist/collection/components/ez-button/ez-button.js +125 -125
- package/dist/collection/components/ez-calendar/ez-calendar.css +210 -210
- package/dist/collection/components/ez-calendar/ez-calendar.js +215 -215
- package/dist/collection/components/ez-check/ez-check.css +265 -265
- package/dist/collection/components/ez-check/ez-check.js +168 -168
- package/dist/collection/components/ez-collapsable-box/ez-collapsable-box.css +67 -67
- package/dist/collection/components/ez-collapsable-box/ez-collapsable-box.js +108 -108
- package/dist/collection/components/ez-combo-box/ez-combo-box-interfaces.js +2 -2
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +167 -167
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +363 -363
- package/dist/collection/components/ez-date-input/ez-date-input.css +38 -38
- package/dist/collection/components/ez-date-input/ez-date-input.js +172 -172
- package/dist/collection/components/ez-form/ez-form.css +19 -19
- package/dist/collection/components/ez-form/ez-form.js +368 -368
- package/dist/collection/components/ez-form/store/Form.actions.js +132 -132
- package/dist/collection/components/ez-form/store/Form.reducer.js +194 -194
- package/dist/collection/components/ez-form/store/Form.selectors.js +44 -44
- package/dist/collection/components/ez-form/subcomponents/DataUnit.js +251 -207
- package/dist/collection/components/ez-form/subcomponents/FormMetadata.js +16 -16
- package/dist/collection/components/ez-form/subcomponents/css/place-holder.css +23 -23
- package/dist/collection/components/ez-form/subcomponents/form-metadata.js +173 -173
- package/dist/collection/components/ez-form/subcomponents/place-holder.js +14 -14
- package/dist/collection/components/ez-form/subcomponents/structure/Field.js +71 -71
- package/dist/collection/components/ez-form/subcomponents/structure/FieldSet.js +27 -27
- package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +40 -40
- package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +27 -27
- package/dist/collection/components/ez-icon/ez-icon.css +36 -36
- package/dist/collection/components/ez-icon/ez-icon.js +56 -56
- package/dist/collection/components/ez-label-chip/ez-label-chip.css +117 -117
- package/dist/collection/components/ez-label-chip/ez-label-chip.js +276 -276
- package/dist/collection/components/ez-modal/ez-modal.css +86 -86
- package/dist/collection/components/ez-modal/ez-modal.js +224 -224
- package/dist/collection/components/ez-number-input/ez-number-input.css +144 -144
- package/dist/collection/components/ez-number-input/ez-number-input.js +465 -465
- package/dist/collection/components/ez-popover/ez-popover.css +38 -38
- package/dist/collection/components/ez-popover/ez-popover.js +323 -323
- package/dist/collection/components/ez-search/ez-search.css +295 -295
- package/dist/collection/components/ez-search/ez-search.js +527 -527
- package/dist/collection/components/ez-tabselector/ez-tabselector.css +125 -125
- package/dist/collection/components/ez-tabselector/ez-tabselector.js +283 -283
- package/dist/collection/components/ez-text-area/ez-text-area.css +139 -139
- package/dist/collection/components/ez-text-area/ez-text-area.js +267 -267
- package/dist/collection/components/ez-text-input/ez-text-input.css +169 -169
- package/dist/collection/components/ez-text-input/ez-text-input.js +395 -395
- package/dist/collection/components/ez-time-input/ez-time-input.css +155 -155
- package/dist/collection/components/ez-time-input/ez-time-input.js +326 -326
- package/dist/collection/index.js +1 -1
- package/dist/collection/servidor.js +100 -100
- package/dist/collection/utils/FloatingManager.js +15 -15
- package/dist/collection/utils/utils.js +6 -6
- package/dist/custom-elements/index.js +3125 -3081
- package/dist/esm/{DataUnit-69e518fa.js → DataUnit-d5d4c9a3.js} +415 -371
- package/dist/esm/ez-action-chip.entry.js +41 -41
- package/dist/esm/ez-button_14.entry.js +1911 -1911
- package/dist/esm/ez-label-chip.entry.js +120 -120
- package/dist/esm/ez-modal.entry.js +104 -104
- package/dist/esm/ez-number-input.entry.js +236 -236
- package/dist/esm/ez-time-input.entry.js +168 -168
- package/dist/esm/form-metadata.entry.js +65 -65
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-b0974f4f.entry.js → p-0fcdfb51.entry.js} +1 -1
- package/dist/ezui/p-dac7a6c2.js +1 -0
- package/dist/ezui/{p-db11c600.entry.js → p-dbef7060.entry.js} +1 -1
- package/dist/types/components/ez-action-chip/ez-action-chip.d.ts +16 -16
- package/dist/types/components/ez-button/ez-button.d.ts +20 -20
- package/dist/types/components/ez-calendar/ez-calendar.d.ts +42 -42
- package/dist/types/components/ez-check/ez-check.d.ts +32 -32
- package/dist/types/components/ez-collapsable-box/ez-collapsable-box.d.ts +18 -18
- package/dist/types/components/ez-combo-box/ez-combo-box-interfaces.d.ts +4 -4
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +68 -68
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +31 -31
- package/dist/types/components/ez-form/ez-form.d.ts +26 -31
- package/dist/types/components/ez-form/store/Form.actions.d.ts +111 -111
- package/dist/types/components/ez-form/store/Form.reducer.d.ts +20 -20
- package/dist/types/components/ez-form/store/Form.selectors.d.ts +14 -14
- package/dist/types/components/ez-form/subcomponents/DataUnit.d.ts +60 -55
- package/dist/types/components/ez-form/subcomponents/FormMetadata.d.ts +41 -41
- package/dist/types/components/ez-form/subcomponents/form-metadata.d.ts +15 -15
- package/dist/types/components/ez-form/subcomponents/place-holder.d.ts +3 -3
- package/dist/types/components/ez-form/subcomponents/structure/Field.d.ts +10 -10
- package/dist/types/components/ez-form/subcomponents/structure/FieldSet.d.ts +12 -12
- package/dist/types/components/ez-form/subcomponents/structure/FormSheet.d.ts +13 -13
- package/dist/types/components/ez-form/subcomponents/structure/NavigationBar.d.ts +17 -17
- package/dist/types/components/ez-icon/ez-icon.d.ts +5 -5
- package/dist/types/components/ez-label-chip/ez-label-chip.d.ts +40 -40
- package/dist/types/components/ez-modal/ez-modal.d.ts +32 -32
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +73 -73
- package/dist/types/components/ez-popover/ez-popover.d.ts +52 -52
- package/dist/types/components/ez-search/ez-search.d.ts +95 -95
- package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +31 -31
- package/dist/types/components/ez-text-area/ez-text-area.d.ts +49 -49
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +64 -64
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +53 -53
- package/dist/types/index.d.ts +1 -1
- package/dist/types/utils/utils.d.ts +2 -2
- package/package.json +114 -114
- package/dist/ezui/p-10ef58b3.js +0 -1
- package/react/components.d.ts +0 -22
- package/react/components.js +0 -25
- package/react/components.js.map +0 -1
- package/react/react-component-lib/createComponent.d.ts +0 -10
- package/react/react-component-lib/createComponent.js +0 -59
- package/react/react-component-lib/createComponent.js.map +0 -1
- package/react/react-component-lib/createOverlayComponent.d.ts +0 -20
- package/react/react-component-lib/createOverlayComponent.js +0 -89
- package/react/react-component-lib/createOverlayComponent.js.map +0 -1
- package/react/react-component-lib/index.d.ts +0 -2
- package/react/react-component-lib/index.js +0 -3
- package/react/react-component-lib/index.js.map +0 -1
- package/react/react-component-lib/interfaces.d.ts +0 -29
- package/react/react-component-lib/interfaces.js +0 -1
- package/react/react-component-lib/interfaces.js.map +0 -1
- package/react/react-component-lib/utils/attachProps.d.ts +0 -12
- package/react/react-component-lib/utils/attachProps.js +0 -96
- package/react/react-component-lib/utils/attachProps.js.map +0 -1
- package/react/react-component-lib/utils/case.d.ts +0 -2
- package/react/react-component-lib/utils/case.js +0 -7
- package/react/react-component-lib/utils/case.js.map +0 -1
- package/react/react-component-lib/utils/dev.d.ts +0 -2
- package/react/react-component-lib/utils/dev.js +0 -13
- package/react/react-component-lib/utils/dev.js.map +0 -1
- package/react/react-component-lib/utils/index.d.ts +0 -7
- package/react/react-component-lib/utils/index.js +0 -21
- package/react/react-component-lib/utils/index.js.map +0 -1
|
@@ -1,267 +1,267 @@
|
|
|
1
|
-
import { Component, Prop, h, Watch, Host, Method, Event, Element } from '@stencil/core';
|
|
2
|
-
export class EzTextArea {
|
|
3
|
-
constructor() {
|
|
4
|
-
/**
|
|
5
|
-
* Deixa o campo disponível ou não para digitação.
|
|
6
|
-
*/
|
|
7
|
-
this.enabled = true;
|
|
8
|
-
/**
|
|
9
|
-
* Ajusta o numero de linhas e consequentemente o height do textarea. Valor default: 4
|
|
10
|
-
*/
|
|
11
|
-
this.rows = 4;
|
|
12
|
-
}
|
|
13
|
-
showError() {
|
|
14
|
-
const hasError = typeof this.errormessage === 'string' && this.errormessage !== '';
|
|
15
|
-
if (hasError) {
|
|
16
|
-
this._inputElem.classList.add('hasError');
|
|
17
|
-
this._messageBoxElem.classList.add('hasError');
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
this._inputElem.classList.remove('hasError');
|
|
21
|
-
this._messageBoxElem.classList.remove('hasError');
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
updateInputValue() {
|
|
25
|
-
this._inputElem.value = this.value;
|
|
26
|
-
this.handleChange();
|
|
27
|
-
this.adjustFloatingLabel();
|
|
28
|
-
}
|
|
29
|
-
adjustFloatingLabel() {
|
|
30
|
-
if (this.label) {
|
|
31
|
-
if (!this._inputElem.classList.contains("input--with--label")) {
|
|
32
|
-
this._inputElem.classList.add("input--with--label");
|
|
33
|
-
}
|
|
34
|
-
const hasValue = this.value && this.value.toString().length > 0;
|
|
35
|
-
const containsFloatedClass = this._labelElem.classList.contains("textarea__label--floated");
|
|
36
|
-
if (hasValue || this.isFocused()) {
|
|
37
|
-
if (!containsFloatedClass) {
|
|
38
|
-
this._labelElem.classList.add("textarea__label--floated");
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
if (containsFloatedClass) {
|
|
43
|
-
this._labelElem.classList.remove("textarea__label--floated");
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
isFocused() {
|
|
49
|
-
return this._hostElement.shadowRoot.activeElement !== null;
|
|
50
|
-
}
|
|
51
|
-
//---------------------------------------------
|
|
52
|
-
// Public methods
|
|
53
|
-
//---------------------------------------------
|
|
54
|
-
/**
|
|
55
|
-
* Faz o foco no componente de input
|
|
56
|
-
*/
|
|
57
|
-
async setFocus() {
|
|
58
|
-
this._inputElem.focus();
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Remove o foco no componente de input
|
|
62
|
-
*/
|
|
63
|
-
async setBlur() {
|
|
64
|
-
this._inputElem.blur();
|
|
65
|
-
}
|
|
66
|
-
//---------------------------------------------
|
|
67
|
-
// Event handlers
|
|
68
|
-
//---------------------------------------------
|
|
69
|
-
handleFocusout() {
|
|
70
|
-
this.adjustFloatingLabel();
|
|
71
|
-
}
|
|
72
|
-
handleChange() {
|
|
73
|
-
this.value = this._inputElem.value;
|
|
74
|
-
}
|
|
75
|
-
handleFocus() {
|
|
76
|
-
if (this.label && this._labelElem && !this._labelElem.classList.contains("textarea__label--floated")) {
|
|
77
|
-
this._labelElem.classList.add("textarea__label--floated");
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
//---------------------------------------------
|
|
81
|
-
// Lifecycle web component
|
|
82
|
-
//---------------------------------------------
|
|
83
|
-
componentDidLoad() {
|
|
84
|
-
this.showError();
|
|
85
|
-
this.adjustFloatingLabel();
|
|
86
|
-
}
|
|
87
|
-
render() {
|
|
88
|
-
return (h(Host, null,
|
|
89
|
-
this.label ?
|
|
90
|
-
h("label", { ref: (el) => this._labelElem = el, class: this.enabled ? "textarea__label" : "textarea__label textarea__label--disabled", onClick: () => this._inputElem.focus(), title: this.label }, this.label)
|
|
91
|
-
: null,
|
|
92
|
-
h("textarea", { onFocus: () => this.handleFocus(), ref: (el) => this._inputElem = el, value: this.value, disabled: !this.enabled, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); }, onKeyDown: event => event.stopPropagation(), rows: this.rows }),
|
|
93
|
-
h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el, title: this.errormessage }, this.errormessage)));
|
|
94
|
-
}
|
|
95
|
-
static get is() { return "ez-text-area"; }
|
|
96
|
-
static get encapsulation() { return "shadow"; }
|
|
97
|
-
static get originalStyleUrls() { return {
|
|
98
|
-
"$": ["ez-text-area.css"]
|
|
99
|
-
}; }
|
|
100
|
-
static get styleUrls() { return {
|
|
101
|
-
"$": ["ez-text-area.css"]
|
|
102
|
-
}; }
|
|
103
|
-
static get properties() { return {
|
|
104
|
-
"label": {
|
|
105
|
-
"type": "string",
|
|
106
|
-
"mutable": false,
|
|
107
|
-
"complexType": {
|
|
108
|
-
"original": "string",
|
|
109
|
-
"resolved": "string",
|
|
110
|
-
"references": {}
|
|
111
|
-
},
|
|
112
|
-
"required": false,
|
|
113
|
-
"optional": false,
|
|
114
|
-
"docs": {
|
|
115
|
-
"tags": [],
|
|
116
|
-
"text": "Label \u00E9 o t\u00EDtulo do campo"
|
|
117
|
-
},
|
|
118
|
-
"attribute": "label",
|
|
119
|
-
"reflect": true
|
|
120
|
-
},
|
|
121
|
-
"value": {
|
|
122
|
-
"type": "string",
|
|
123
|
-
"mutable": true,
|
|
124
|
-
"complexType": {
|
|
125
|
-
"original": "string",
|
|
126
|
-
"resolved": "string",
|
|
127
|
-
"references": {}
|
|
128
|
-
},
|
|
129
|
-
"required": false,
|
|
130
|
-
"optional": false,
|
|
131
|
-
"docs": {
|
|
132
|
-
"tags": [],
|
|
133
|
-
"text": "Valor digitado pelo usu\u00E1rio. Este valor \u00E9 o que fica vis\u00EDvel no campo."
|
|
134
|
-
},
|
|
135
|
-
"attribute": "value",
|
|
136
|
-
"reflect": true
|
|
137
|
-
},
|
|
138
|
-
"enabled": {
|
|
139
|
-
"type": "boolean",
|
|
140
|
-
"mutable": false,
|
|
141
|
-
"complexType": {
|
|
142
|
-
"original": "boolean",
|
|
143
|
-
"resolved": "boolean",
|
|
144
|
-
"references": {}
|
|
145
|
-
},
|
|
146
|
-
"required": false,
|
|
147
|
-
"optional": false,
|
|
148
|
-
"docs": {
|
|
149
|
-
"tags": [],
|
|
150
|
-
"text": "Deixa o campo dispon\u00EDvel ou n\u00E3o para digita\u00E7\u00E3o."
|
|
151
|
-
},
|
|
152
|
-
"attribute": "enabled",
|
|
153
|
-
"reflect": true,
|
|
154
|
-
"defaultValue": "true"
|
|
155
|
-
},
|
|
156
|
-
"loading": {
|
|
157
|
-
"type": "boolean",
|
|
158
|
-
"mutable": false,
|
|
159
|
-
"complexType": {
|
|
160
|
-
"original": "boolean",
|
|
161
|
-
"resolved": "boolean",
|
|
162
|
-
"references": {}
|
|
163
|
-
},
|
|
164
|
-
"required": false,
|
|
165
|
-
"optional": false,
|
|
166
|
-
"docs": {
|
|
167
|
-
"tags": [],
|
|
168
|
-
"text": "Deixa o componente em modo \"carregando\"."
|
|
169
|
-
},
|
|
170
|
-
"attribute": "loading",
|
|
171
|
-
"reflect": true
|
|
172
|
-
},
|
|
173
|
-
"errormessage": {
|
|
174
|
-
"type": "string",
|
|
175
|
-
"mutable": true,
|
|
176
|
-
"complexType": {
|
|
177
|
-
"original": "string",
|
|
178
|
-
"resolved": "string",
|
|
179
|
-
"references": {}
|
|
180
|
-
},
|
|
181
|
-
"required": false,
|
|
182
|
-
"optional": false,
|
|
183
|
-
"docs": {
|
|
184
|
-
"tags": [],
|
|
185
|
-
"text": "Quando h\u00E1 um problema de valida\u00E7\u00E3o, serve como orienta\u00E7\u00E3o ao usu\u00E1rio"
|
|
186
|
-
},
|
|
187
|
-
"attribute": "errormessage",
|
|
188
|
-
"reflect": true
|
|
189
|
-
},
|
|
190
|
-
"rows": {
|
|
191
|
-
"type": "number",
|
|
192
|
-
"mutable": true,
|
|
193
|
-
"complexType": {
|
|
194
|
-
"original": "number",
|
|
195
|
-
"resolved": "number",
|
|
196
|
-
"references": {}
|
|
197
|
-
},
|
|
198
|
-
"required": false,
|
|
199
|
-
"optional": false,
|
|
200
|
-
"docs": {
|
|
201
|
-
"tags": [],
|
|
202
|
-
"text": "Ajusta o numero de linhas e consequentemente o height do textarea. Valor default: 4"
|
|
203
|
-
},
|
|
204
|
-
"attribute": "rows",
|
|
205
|
-
"reflect": true,
|
|
206
|
-
"defaultValue": "4"
|
|
207
|
-
}
|
|
208
|
-
}; }
|
|
209
|
-
static get events() { return [{
|
|
210
|
-
"method": "ezChange",
|
|
211
|
-
"name": "ezChange",
|
|
212
|
-
"bubbles": true,
|
|
213
|
-
"cancelable": true,
|
|
214
|
-
"composed": true,
|
|
215
|
-
"docs": {
|
|
216
|
-
"tags": [],
|
|
217
|
-
"text": ""
|
|
218
|
-
},
|
|
219
|
-
"complexType": {
|
|
220
|
-
"original": "string",
|
|
221
|
-
"resolved": "string",
|
|
222
|
-
"references": {}
|
|
223
|
-
}
|
|
224
|
-
}]; }
|
|
225
|
-
static get methods() { return {
|
|
226
|
-
"setFocus": {
|
|
227
|
-
"complexType": {
|
|
228
|
-
"signature": "() => Promise<void>",
|
|
229
|
-
"parameters": [],
|
|
230
|
-
"references": {
|
|
231
|
-
"Promise": {
|
|
232
|
-
"location": "global"
|
|
233
|
-
}
|
|
234
|
-
},
|
|
235
|
-
"return": "Promise<void>"
|
|
236
|
-
},
|
|
237
|
-
"docs": {
|
|
238
|
-
"text": "Faz o foco no componente de input",
|
|
239
|
-
"tags": []
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
"setBlur": {
|
|
243
|
-
"complexType": {
|
|
244
|
-
"signature": "() => Promise<void>",
|
|
245
|
-
"parameters": [],
|
|
246
|
-
"references": {
|
|
247
|
-
"Promise": {
|
|
248
|
-
"location": "global"
|
|
249
|
-
}
|
|
250
|
-
},
|
|
251
|
-
"return": "Promise<void>"
|
|
252
|
-
},
|
|
253
|
-
"docs": {
|
|
254
|
-
"text": "Remove o foco no componente de input",
|
|
255
|
-
"tags": []
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}; }
|
|
259
|
-
static get elementRef() { return "_hostElement"; }
|
|
260
|
-
static get watchers() { return [{
|
|
261
|
-
"propName": "errormessage",
|
|
262
|
-
"methodName": "showError"
|
|
263
|
-
}, {
|
|
264
|
-
"propName": "value",
|
|
265
|
-
"methodName": "updateInputValue"
|
|
266
|
-
}]; }
|
|
267
|
-
}
|
|
1
|
+
import { Component, Prop, h, Watch, Host, Method, Event, Element } from '@stencil/core';
|
|
2
|
+
export class EzTextArea {
|
|
3
|
+
constructor() {
|
|
4
|
+
/**
|
|
5
|
+
* Deixa o campo disponível ou não para digitação.
|
|
6
|
+
*/
|
|
7
|
+
this.enabled = true;
|
|
8
|
+
/**
|
|
9
|
+
* Ajusta o numero de linhas e consequentemente o height do textarea. Valor default: 4
|
|
10
|
+
*/
|
|
11
|
+
this.rows = 4;
|
|
12
|
+
}
|
|
13
|
+
showError() {
|
|
14
|
+
const hasError = typeof this.errormessage === 'string' && this.errormessage !== '';
|
|
15
|
+
if (hasError) {
|
|
16
|
+
this._inputElem.classList.add('hasError');
|
|
17
|
+
this._messageBoxElem.classList.add('hasError');
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
this._inputElem.classList.remove('hasError');
|
|
21
|
+
this._messageBoxElem.classList.remove('hasError');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
updateInputValue() {
|
|
25
|
+
this._inputElem.value = this.value;
|
|
26
|
+
this.handleChange();
|
|
27
|
+
this.adjustFloatingLabel();
|
|
28
|
+
}
|
|
29
|
+
adjustFloatingLabel() {
|
|
30
|
+
if (this.label) {
|
|
31
|
+
if (!this._inputElem.classList.contains("input--with--label")) {
|
|
32
|
+
this._inputElem.classList.add("input--with--label");
|
|
33
|
+
}
|
|
34
|
+
const hasValue = this.value && this.value.toString().length > 0;
|
|
35
|
+
const containsFloatedClass = this._labelElem.classList.contains("textarea__label--floated");
|
|
36
|
+
if (hasValue || this.isFocused()) {
|
|
37
|
+
if (!containsFloatedClass) {
|
|
38
|
+
this._labelElem.classList.add("textarea__label--floated");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
if (containsFloatedClass) {
|
|
43
|
+
this._labelElem.classList.remove("textarea__label--floated");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
isFocused() {
|
|
49
|
+
return this._hostElement.shadowRoot.activeElement !== null;
|
|
50
|
+
}
|
|
51
|
+
//---------------------------------------------
|
|
52
|
+
// Public methods
|
|
53
|
+
//---------------------------------------------
|
|
54
|
+
/**
|
|
55
|
+
* Faz o foco no componente de input
|
|
56
|
+
*/
|
|
57
|
+
async setFocus() {
|
|
58
|
+
this._inputElem.focus();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Remove o foco no componente de input
|
|
62
|
+
*/
|
|
63
|
+
async setBlur() {
|
|
64
|
+
this._inputElem.blur();
|
|
65
|
+
}
|
|
66
|
+
//---------------------------------------------
|
|
67
|
+
// Event handlers
|
|
68
|
+
//---------------------------------------------
|
|
69
|
+
handleFocusout() {
|
|
70
|
+
this.adjustFloatingLabel();
|
|
71
|
+
}
|
|
72
|
+
handleChange() {
|
|
73
|
+
this.value = this._inputElem.value;
|
|
74
|
+
}
|
|
75
|
+
handleFocus() {
|
|
76
|
+
if (this.label && this._labelElem && !this._labelElem.classList.contains("textarea__label--floated")) {
|
|
77
|
+
this._labelElem.classList.add("textarea__label--floated");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//---------------------------------------------
|
|
81
|
+
// Lifecycle web component
|
|
82
|
+
//---------------------------------------------
|
|
83
|
+
componentDidLoad() {
|
|
84
|
+
this.showError();
|
|
85
|
+
this.adjustFloatingLabel();
|
|
86
|
+
}
|
|
87
|
+
render() {
|
|
88
|
+
return (h(Host, null,
|
|
89
|
+
this.label ?
|
|
90
|
+
h("label", { ref: (el) => this._labelElem = el, class: this.enabled ? "textarea__label" : "textarea__label textarea__label--disabled", onClick: () => this._inputElem.focus(), title: this.label }, this.label)
|
|
91
|
+
: null,
|
|
92
|
+
h("textarea", { onFocus: () => this.handleFocus(), ref: (el) => this._inputElem = el, value: this.value, disabled: !this.enabled, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); }, onKeyDown: event => event.stopPropagation(), rows: this.rows }),
|
|
93
|
+
h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el, title: this.errormessage }, this.errormessage)));
|
|
94
|
+
}
|
|
95
|
+
static get is() { return "ez-text-area"; }
|
|
96
|
+
static get encapsulation() { return "shadow"; }
|
|
97
|
+
static get originalStyleUrls() { return {
|
|
98
|
+
"$": ["ez-text-area.css"]
|
|
99
|
+
}; }
|
|
100
|
+
static get styleUrls() { return {
|
|
101
|
+
"$": ["ez-text-area.css"]
|
|
102
|
+
}; }
|
|
103
|
+
static get properties() { return {
|
|
104
|
+
"label": {
|
|
105
|
+
"type": "string",
|
|
106
|
+
"mutable": false,
|
|
107
|
+
"complexType": {
|
|
108
|
+
"original": "string",
|
|
109
|
+
"resolved": "string",
|
|
110
|
+
"references": {}
|
|
111
|
+
},
|
|
112
|
+
"required": false,
|
|
113
|
+
"optional": false,
|
|
114
|
+
"docs": {
|
|
115
|
+
"tags": [],
|
|
116
|
+
"text": "Label \u00E9 o t\u00EDtulo do campo"
|
|
117
|
+
},
|
|
118
|
+
"attribute": "label",
|
|
119
|
+
"reflect": true
|
|
120
|
+
},
|
|
121
|
+
"value": {
|
|
122
|
+
"type": "string",
|
|
123
|
+
"mutable": true,
|
|
124
|
+
"complexType": {
|
|
125
|
+
"original": "string",
|
|
126
|
+
"resolved": "string",
|
|
127
|
+
"references": {}
|
|
128
|
+
},
|
|
129
|
+
"required": false,
|
|
130
|
+
"optional": false,
|
|
131
|
+
"docs": {
|
|
132
|
+
"tags": [],
|
|
133
|
+
"text": "Valor digitado pelo usu\u00E1rio. Este valor \u00E9 o que fica vis\u00EDvel no campo."
|
|
134
|
+
},
|
|
135
|
+
"attribute": "value",
|
|
136
|
+
"reflect": true
|
|
137
|
+
},
|
|
138
|
+
"enabled": {
|
|
139
|
+
"type": "boolean",
|
|
140
|
+
"mutable": false,
|
|
141
|
+
"complexType": {
|
|
142
|
+
"original": "boolean",
|
|
143
|
+
"resolved": "boolean",
|
|
144
|
+
"references": {}
|
|
145
|
+
},
|
|
146
|
+
"required": false,
|
|
147
|
+
"optional": false,
|
|
148
|
+
"docs": {
|
|
149
|
+
"tags": [],
|
|
150
|
+
"text": "Deixa o campo dispon\u00EDvel ou n\u00E3o para digita\u00E7\u00E3o."
|
|
151
|
+
},
|
|
152
|
+
"attribute": "enabled",
|
|
153
|
+
"reflect": true,
|
|
154
|
+
"defaultValue": "true"
|
|
155
|
+
},
|
|
156
|
+
"loading": {
|
|
157
|
+
"type": "boolean",
|
|
158
|
+
"mutable": false,
|
|
159
|
+
"complexType": {
|
|
160
|
+
"original": "boolean",
|
|
161
|
+
"resolved": "boolean",
|
|
162
|
+
"references": {}
|
|
163
|
+
},
|
|
164
|
+
"required": false,
|
|
165
|
+
"optional": false,
|
|
166
|
+
"docs": {
|
|
167
|
+
"tags": [],
|
|
168
|
+
"text": "Deixa o componente em modo \"carregando\"."
|
|
169
|
+
},
|
|
170
|
+
"attribute": "loading",
|
|
171
|
+
"reflect": true
|
|
172
|
+
},
|
|
173
|
+
"errormessage": {
|
|
174
|
+
"type": "string",
|
|
175
|
+
"mutable": true,
|
|
176
|
+
"complexType": {
|
|
177
|
+
"original": "string",
|
|
178
|
+
"resolved": "string",
|
|
179
|
+
"references": {}
|
|
180
|
+
},
|
|
181
|
+
"required": false,
|
|
182
|
+
"optional": false,
|
|
183
|
+
"docs": {
|
|
184
|
+
"tags": [],
|
|
185
|
+
"text": "Quando h\u00E1 um problema de valida\u00E7\u00E3o, serve como orienta\u00E7\u00E3o ao usu\u00E1rio"
|
|
186
|
+
},
|
|
187
|
+
"attribute": "errormessage",
|
|
188
|
+
"reflect": true
|
|
189
|
+
},
|
|
190
|
+
"rows": {
|
|
191
|
+
"type": "number",
|
|
192
|
+
"mutable": true,
|
|
193
|
+
"complexType": {
|
|
194
|
+
"original": "number",
|
|
195
|
+
"resolved": "number",
|
|
196
|
+
"references": {}
|
|
197
|
+
},
|
|
198
|
+
"required": false,
|
|
199
|
+
"optional": false,
|
|
200
|
+
"docs": {
|
|
201
|
+
"tags": [],
|
|
202
|
+
"text": "Ajusta o numero de linhas e consequentemente o height do textarea. Valor default: 4"
|
|
203
|
+
},
|
|
204
|
+
"attribute": "rows",
|
|
205
|
+
"reflect": true,
|
|
206
|
+
"defaultValue": "4"
|
|
207
|
+
}
|
|
208
|
+
}; }
|
|
209
|
+
static get events() { return [{
|
|
210
|
+
"method": "ezChange",
|
|
211
|
+
"name": "ezChange",
|
|
212
|
+
"bubbles": true,
|
|
213
|
+
"cancelable": true,
|
|
214
|
+
"composed": true,
|
|
215
|
+
"docs": {
|
|
216
|
+
"tags": [],
|
|
217
|
+
"text": ""
|
|
218
|
+
},
|
|
219
|
+
"complexType": {
|
|
220
|
+
"original": "string",
|
|
221
|
+
"resolved": "string",
|
|
222
|
+
"references": {}
|
|
223
|
+
}
|
|
224
|
+
}]; }
|
|
225
|
+
static get methods() { return {
|
|
226
|
+
"setFocus": {
|
|
227
|
+
"complexType": {
|
|
228
|
+
"signature": "() => Promise<void>",
|
|
229
|
+
"parameters": [],
|
|
230
|
+
"references": {
|
|
231
|
+
"Promise": {
|
|
232
|
+
"location": "global"
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
"return": "Promise<void>"
|
|
236
|
+
},
|
|
237
|
+
"docs": {
|
|
238
|
+
"text": "Faz o foco no componente de input",
|
|
239
|
+
"tags": []
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
"setBlur": {
|
|
243
|
+
"complexType": {
|
|
244
|
+
"signature": "() => Promise<void>",
|
|
245
|
+
"parameters": [],
|
|
246
|
+
"references": {
|
|
247
|
+
"Promise": {
|
|
248
|
+
"location": "global"
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
"return": "Promise<void>"
|
|
252
|
+
},
|
|
253
|
+
"docs": {
|
|
254
|
+
"text": "Remove o foco no componente de input",
|
|
255
|
+
"tags": []
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}; }
|
|
259
|
+
static get elementRef() { return "_hostElement"; }
|
|
260
|
+
static get watchers() { return [{
|
|
261
|
+
"propName": "errormessage",
|
|
262
|
+
"methodName": "showError"
|
|
263
|
+
}, {
|
|
264
|
+
"propName": "value",
|
|
265
|
+
"methodName": "updateInputValue"
|
|
266
|
+
}]; }
|
|
267
|
+
}
|