@sankhyalabs/ezui 1.1.158 → 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.
- package/dist/cjs/ez-combo-box.cjs.entry.js +109 -29
- package/dist/cjs/ez-date-input.cjs.entry.js +71 -25
- package/dist/cjs/ez-date-time-input.cjs.entry.js +94 -31
- package/dist/cjs/ez-filter-input.cjs.entry.js +10 -4
- package/dist/cjs/ez-form.cjs.entry.js +54 -9
- package/dist/cjs/ez-grid.cjs.entry.js +9 -6
- package/dist/cjs/ez-number-input.cjs.entry.js +69 -25
- package/dist/cjs/ez-search.cjs.entry.js +20 -5
- package/dist/cjs/ez-text-area.cjs.entry.js +8 -2
- package/dist/cjs/ez-text-input.cjs.entry.js +38 -21
- package/dist/cjs/ez-time-input.cjs.entry.js +75 -40
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +15 -17
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +132 -33
- package/dist/collection/components/ez-date-input/ez-date-input.js +87 -25
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +108 -31
- package/dist/collection/components/ez-filter-input/ez-filter-input.js +26 -4
- package/dist/collection/components/ez-form/DataBinder.js +12 -3
- package/dist/collection/components/ez-form/ez-form.js +43 -6
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +1 -1
- package/dist/collection/components/ez-grid/ez-grid.js +14 -7
- package/dist/collection/components/ez-number-input/ez-number-input.js +83 -25
- package/dist/collection/components/ez-search/ez-search.js +38 -5
- package/dist/collection/components/ez-text-area/ez-text-area.css +1 -1
- package/dist/collection/components/ez-text-area/ez-text-area.js +23 -1
- package/dist/collection/components/ez-text-input/ez-text-input.css +2 -2
- package/dist/collection/components/ez-text-input/ez-text-input.js +53 -38
- package/dist/collection/components/ez-time-input/ez-time-input.js +95 -59
- package/dist/custom-elements/index.js +598 -239
- package/dist/esm/ez-combo-box.entry.js +109 -29
- package/dist/esm/ez-date-input.entry.js +71 -25
- package/dist/esm/ez-date-time-input.entry.js +94 -31
- package/dist/esm/ez-filter-input.entry.js +10 -4
- package/dist/esm/ez-form.entry.js +54 -9
- package/dist/esm/ez-grid.entry.js +9 -6
- package/dist/esm/ez-number-input.entry.js +69 -25
- package/dist/esm/ez-search.entry.js +20 -5
- package/dist/esm/ez-text-area.entry.js +8 -2
- package/dist/esm/ez-text-input.entry.js +38 -21
- package/dist/esm/ez-time-input.entry.js +76 -41
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-003d53b1.entry.js +1 -0
- package/dist/ezui/p-267fa515.entry.js +1 -0
- package/dist/ezui/p-2acf7d59.entry.js +1 -0
- package/dist/ezui/p-403de0a4.entry.js +1 -0
- package/dist/ezui/p-4c3d136c.entry.js +1 -0
- package/dist/ezui/p-53bbba8e.entry.js +1 -0
- package/dist/ezui/p-6668c3b0.entry.js +1 -0
- package/dist/ezui/p-7fd6deec.entry.js +1 -0
- package/dist/ezui/p-ad6cc559.entry.js +1 -0
- package/dist/ezui/{p-be87ac5e.entry.js → p-ae2fea4c.entry.js} +1 -1
- package/dist/ezui/p-ff7b4b13.entry.js +1 -0
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +22 -8
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +10 -3
- package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +15 -7
- package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +5 -1
- package/dist/types/components/ez-form/DataBinder.d.ts +1 -1
- package/dist/types/components/ez-form/ez-form.d.ts +1 -0
- package/dist/types/components/ez-grid/ez-grid.d.ts +4 -1
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +14 -5
- package/dist/types/components/ez-search/ez-search.d.ts +6 -1
- package/dist/types/components/ez-text-area/ez-text-area.d.ts +4 -0
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +9 -6
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +17 -13
- package/dist/types/components.d.ts +49 -20
- package/package.json +1 -1
- package/dist/ezui/p-140f7085.entry.js +0 -1
- package/dist/ezui/p-49fdfa4b.entry.js +0 -1
- package/dist/ezui/p-4fdceb7d.entry.js +0 -1
- package/dist/ezui/p-6d4b1628.entry.js +0 -1
- package/dist/ezui/p-8f4fac31.entry.js +0 -1
- package/dist/ezui/p-91377c65.entry.js +0 -1
- package/dist/ezui/p-991ce464.entry.js +0 -1
- package/dist/ezui/p-b524dfca.entry.js +0 -1
- package/dist/ezui/p-ec21ecce.entry.js +0 -1
- package/dist/ezui/p-fc9b9487.entry.js +0 -1
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-b21f0a10.js';
|
|
2
2
|
import { FloatingManager } from '@sankhyalabs/core';
|
|
3
|
+
import { A as ApplicationUtils } from './ApplicationUtils-35350d20.js';
|
|
3
4
|
import { C as CSSVarsUtils } from './CSSVarsUtils-eb4c5af6.js';
|
|
4
5
|
|
|
5
|
-
const ezComboBoxCss = ":host{--ez-combo-box--height:42px;--ez-combo-box--width:100%;--ez-combo-box__icon--width:48px;--ez-combo-box--border-radius:var(--border--radius-medium, 12px);--ez-combo-box--border-radius-small:var(--border--radius-small, 6px);--ez-combo-box--font-size:var(--text--medium, 14px);--ez-combo-box--font-family:var(--font-pattern, Arial);--ez-combo-box--font-weight--large:var(--text-weight--large, 500);--ez-combo-box--font-weight--medium:var(--text-weight--medium, 400);--ez-combo-box--background-color--xlight:var(--background--xlight, #fff);--ez-combo-box--background-medium:var(--background--medium, #f0f3f7);--ez-combo-box__input--background-color:var(--background--medium, #e0e0e0);--ez-combo-box__input--border:var(--border--medium, 2px solid);--ez-combo-box__input--border-color:var(--ez-combo-box__input--background-color);--ez-combo-box__input--focus--border-color:var(--color--primary, #008561);--ez-combo-box__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-combo-box__input--disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__input--error--border-color:#CC2936;--ez-combo-box__btn--color:var(--
|
|
6
|
+
const ezComboBoxCss = ":host{--ez-combo-box--height:42px;--ez-combo-box--width:100%;--ez-combo-box__icon--width:48px;--ez-combo-box--border-radius:var(--border--radius-medium, 12px);--ez-combo-box--border-radius-small:var(--border--radius-small, 6px);--ez-combo-box--font-size:var(--text--medium, 14px);--ez-combo-box--font-family:var(--font-pattern, Arial);--ez-combo-box--font-weight--large:var(--text-weight--large, 500);--ez-combo-box--font-weight--medium:var(--text-weight--medium, 400);--ez-combo-box--background-color--xlight:var(--background--xlight, #fff);--ez-combo-box--background-medium:var(--background--medium, #f0f3f7);--ez-combo-box__input--background-color:var(--background--medium, #e0e0e0);--ez-combo-box__input--border:var(--border--medium, 2px solid);--ez-combo-box__input--border-color:var(--ez-combo-box__input--background-color);--ez-combo-box__input--focus--border-color:var(--color--primary, #008561);--ez-combo-box__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-combo-box__input--disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__input--error--border-color:#CC2936;--ez-combo-box__btn--color:var(--title--primary, #2B3A54);--ez-combo-box__btn-disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__btn-hover--color:var(--color--primary, #4e4e4e);--ez-combo-box__label--color:var(--title--primary, #2B3A54);--ez-combo-box__list-title--primary:var(--title--primary, #2B3A54);--ez-combo-box__list-text--primary:var(--text--primary, #626e82);--ez-combo-box__list-height:calc(var(--ez-combo-box--font-size) + var(--ez-combo-box--space--medium));--ez-combo-box--space--medium:var(--space--medium, 12px);--ez-combo-box--space--small:var(--space--small, 6px);--ez-combo-box__list-scrollbar--background-color:var(--title--primary, #2B3A54);--ez-combo-box__list-scrollbar--border-radius:var(--border--radius-small, 6px);--ez-combo-box__list-scrollbar--width:var(--space--medium, 12px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-combo-box--width)}ez-icon{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.suppressed-search-input{--ez-text-input__input--border-color:var(--color--strokes, #dce0e8);--ez-text-input__input--disabled--background-color:var(--background--xlight, #fff);--ez-text-input__input--disabled--color:var(--title--primary, #2B3A54)}.list-container{position:relative;width:100%}.list-wrapper{display:flex;flex-direction:column;box-sizing:border-box;width:100%;z-index:var(--more-visible, 2);max-height:calc(4*var(--ez-combo-box__list-height) + 2*var(--ez-combo-box--space--small));background-color:var(--ez-combo-box--background-color--xlight);border-radius:var(--ez-combo-box--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000);padding:var(--ez-combo-box--space--small)}.list-options{box-sizing:border-box;width:100%;height:100%;display:flex;flex-direction:column;scroll-behavior:smooth;overflow:auto}.list-options::-webkit-scrollbar-track{background-color:#f0f2f5;border-radius:var(--ez-combo-box__list-scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-combo-box__list-scrollbar--background-color);border-radius:var(--ez-combo-box__list-scrollbar--border-radius)}.list-options::-webkit-scrollbar{background-color:#f0f2f5;width:var(--ez-combo-box__list-scrollbar--width);max-width:var(--ez-combo-box__list-scrollbar--width);min-width:var(--ez-combo-box__list-scrollbar--width)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-combo-box--border-radius-small);padding:0 var(--ez-combo-box--space--small);min-height:var(--ez-combo-box__list-height);gap:var(--space--small, 6px)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-combo-box__list-title--primary);font-weight:var(--ez-combo-box--font-weight--large);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size)}.item__value{text-align:center;color:var(--ez-combo-box__list-text--primary)}.item__value--hidden{visibility:hidden;position:absolute;z-index:-1;top:0;left:0}.item__label{text-align:left}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;min-height:calc(var(--ez-combo-box__list-height) * 1.5)}.message__no-result{color:var(--ez-combo-box__list-title--primary);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size)}.message__loading{border-radius:50%;width:16px;height:16px;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:3px solid var(--ez-combo-box__list-title--primary);border-top:3px solid transparent}li:hover{background-color:var(--ez-combo-box--background-medium)}.preselected{background-color:var(--background--medium)}.btn{outline:none;border:none;background:none;cursor:pointer;color:var(--ez-combo-box__btn--color)}.btn:disabled{cursor:unset;color:var(--ez-combo-box__btn-disabled--color)}.btn:disabled:hover{cursor:unset;color:var(--ez-combo-box__btn-disabled--color)}.btn:hover{color:var(--ez-combo-box__btn-hover--color)}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";
|
|
6
7
|
|
|
7
8
|
let EzComboBox = class {
|
|
8
9
|
constructor(hostRef) {
|
|
9
10
|
registerInstance(this, hostRef);
|
|
10
11
|
this.ezChange = createEvent(this, "ezChange", 7);
|
|
12
|
+
this._changeDeboucingTimeout = null;
|
|
11
13
|
this._limitCharsToSearch = 3;
|
|
12
14
|
this._deboucingTime = 300;
|
|
13
15
|
this._maxWidthValue = 0;
|
|
16
|
+
this._tabPressed = false;
|
|
17
|
+
this._textEmptyList = "Nenhum resultado encontrado";
|
|
14
18
|
this._startLoading = false;
|
|
15
19
|
this._showLoading = true;
|
|
16
20
|
/**
|
|
@@ -42,40 +46,66 @@ let EzComboBox = class {
|
|
|
42
46
|
*/
|
|
43
47
|
this.mode = "regular";
|
|
44
48
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
observeErrorMessage() {
|
|
50
|
+
var _a;
|
|
51
|
+
if (this._textInput) {
|
|
52
|
+
this._textInput.errorMessage = this.errorMessage;
|
|
53
|
+
if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
54
|
+
this.setInputValue();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
observeValue(newValue, oldValue) {
|
|
59
|
+
var _a, _b, _c, _d;
|
|
60
|
+
if (this._textInput && newValue != oldValue) {
|
|
61
|
+
const newValueSelected = this.getSelectedOption(newValue);
|
|
62
|
+
const oldValueSelected = this.getSelectedOption(oldValue);
|
|
63
|
+
const currentValue = this.getSelectedOption(this.value);
|
|
64
|
+
if (((_a = currentValue === null || currentValue === void 0 ? void 0 : currentValue.value) === null || _a === void 0 ? void 0 : _a.toString()) != ((_b = newValueSelected === null || newValueSelected === void 0 ? void 0 : newValueSelected.value) === null || _b === void 0 ? void 0 : _b.toString())) {
|
|
65
|
+
this.value = newValueSelected;
|
|
66
|
+
}
|
|
67
|
+
if (((_c = newValueSelected === null || newValueSelected === void 0 ? void 0 : newValueSelected.value) === null || _c === void 0 ? void 0 : _c.toString()) !== ((_d = oldValueSelected === null || oldValueSelected === void 0 ? void 0 : oldValueSelected.value) === null || _d === void 0 ? void 0 : _d.toString())) {
|
|
68
|
+
this.setInputValue();
|
|
69
|
+
const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
|
|
70
|
+
this.ezChange.emit(valueEmitted);
|
|
71
|
+
}
|
|
72
|
+
this.hideOptions();
|
|
73
|
+
this._criteria = undefined;
|
|
74
|
+
this._preSelection = undefined;
|
|
75
|
+
this.updateVisibleOptions();
|
|
48
76
|
}
|
|
49
|
-
this.hideOptions();
|
|
50
|
-
this._criteria = undefined;
|
|
51
|
-
this._preSelection = undefined;
|
|
52
|
-
this.updateVisibleOptions();
|
|
53
77
|
}
|
|
54
78
|
/**
|
|
55
79
|
* Realiza o foco no componente de seleção
|
|
56
80
|
*/
|
|
57
81
|
async setFocus() {
|
|
58
|
-
this.
|
|
82
|
+
this._textInput.setFocus();
|
|
59
83
|
}
|
|
60
84
|
/**
|
|
61
85
|
* Remove o foco no componente de seleção
|
|
62
86
|
*/
|
|
63
87
|
async setBlur() {
|
|
64
|
-
this.
|
|
88
|
+
this._textInput.setBlur();
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Retorna informando se o campo está inválido (true | false)
|
|
92
|
+
*/
|
|
93
|
+
async isInvalid() {
|
|
94
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
65
95
|
}
|
|
66
96
|
getText() {
|
|
67
97
|
let text = "";
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
70
|
-
text = this.showSelectedValue ? `${
|
|
98
|
+
const currentValue = this.getSelectedOption(this.value);
|
|
99
|
+
if (currentValue) {
|
|
100
|
+
text = this.showSelectedValue ? `${currentValue.value} - ${currentValue.label}` : currentValue.label;
|
|
71
101
|
}
|
|
72
102
|
return text;
|
|
73
103
|
}
|
|
74
|
-
getSelectedOption() {
|
|
75
|
-
if (typeof
|
|
76
|
-
return this._visibleOptions.find(o => o.value ===
|
|
104
|
+
getSelectedOption(value) {
|
|
105
|
+
if (typeof value === "string" || value instanceof String) {
|
|
106
|
+
return this._visibleOptions.find(o => o.value === value);
|
|
77
107
|
}
|
|
78
|
-
return
|
|
108
|
+
return value;
|
|
79
109
|
}
|
|
80
110
|
updateVisibleOptions() {
|
|
81
111
|
let opts = this._source || [];
|
|
@@ -130,7 +160,7 @@ let EzComboBox = class {
|
|
|
130
160
|
//FIXME: Provavelmente isso fará com que o popup abra em uma
|
|
131
161
|
//posição errada no futuro. Preferi fazer simples no começo,
|
|
132
162
|
//porque não quis onerar o text input com essa funcionalidade...
|
|
133
|
-
const top = (this.errorMessage || !this.canShowError || this.mode
|
|
163
|
+
const top = (this.errorMessage || !this.canShowError || this.mode === "slim") ? "0px" : "-19px";
|
|
134
164
|
this._floatingID = FloatingManager.float(this._listWrapper, this._listContainer, { autoClose: true, top });
|
|
135
165
|
window.requestAnimationFrame(() => {
|
|
136
166
|
this._listWrapper.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
|
|
@@ -178,6 +208,9 @@ let EzComboBox = class {
|
|
|
178
208
|
this.selectOption(this._visibleOptions[this._preSelection]);
|
|
179
209
|
this._preSelection = undefined;
|
|
180
210
|
}
|
|
211
|
+
else {
|
|
212
|
+
this.controlListWithOnlyOne();
|
|
213
|
+
}
|
|
181
214
|
}
|
|
182
215
|
updateSource(source) {
|
|
183
216
|
this._startLoading = false;
|
|
@@ -194,6 +227,10 @@ let EzComboBox = class {
|
|
|
194
227
|
if (Array.isArray(source)) {
|
|
195
228
|
this._source = source;
|
|
196
229
|
this.updateVisibleOptions();
|
|
230
|
+
if (this._tabPressed) {
|
|
231
|
+
this._tabPressed = false;
|
|
232
|
+
this.controlEmptySearch();
|
|
233
|
+
}
|
|
197
234
|
}
|
|
198
235
|
else {
|
|
199
236
|
this.selectOption(source);
|
|
@@ -206,15 +243,16 @@ let EzComboBox = class {
|
|
|
206
243
|
}
|
|
207
244
|
selectOption(newOption) {
|
|
208
245
|
var _a, _b;
|
|
209
|
-
const
|
|
210
|
-
if (((_a =
|
|
246
|
+
const currentValue = this.getSelectedOption(this.value);
|
|
247
|
+
if (((_a = currentValue === null || currentValue === void 0 ? void 0 : currentValue.value) === null || _a === void 0 ? void 0 : _a.toString()) !== ((_b = newOption === null || newOption === void 0 ? void 0 : newOption.value) === null || _b === void 0 ? void 0 : _b.toString())) {
|
|
211
248
|
const adjustedOpt = !(newOption === null || newOption === void 0 ? void 0 : newOption.value) ? undefined : newOption;
|
|
212
249
|
this.value = adjustedOpt;
|
|
213
|
-
this.errorMessage = "";
|
|
214
|
-
this.ezChange.emit(this.value);
|
|
215
250
|
}
|
|
216
251
|
else {
|
|
217
|
-
this.
|
|
252
|
+
this.setInputValue();
|
|
253
|
+
}
|
|
254
|
+
if (this.searchMode) {
|
|
255
|
+
this._visibleOptions = [];
|
|
218
256
|
}
|
|
219
257
|
}
|
|
220
258
|
loadOptions(mode, argument = "") {
|
|
@@ -228,11 +266,43 @@ let EzComboBox = class {
|
|
|
228
266
|
}
|
|
229
267
|
}
|
|
230
268
|
cancelPreselection() {
|
|
231
|
-
if (!this.
|
|
269
|
+
if (!this._textInput.value && this.value) {
|
|
232
270
|
this.selectOption(undefined);
|
|
233
271
|
}
|
|
234
272
|
else {
|
|
235
|
-
this.
|
|
273
|
+
this.setInputValue();
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
setInputValue(clearError = true) {
|
|
277
|
+
const textValue = this.getText();
|
|
278
|
+
if ((this._textInput.value || '') !== textValue) {
|
|
279
|
+
this._textInput.value = textValue;
|
|
280
|
+
if (clearError) {
|
|
281
|
+
this.errorMessage = "";
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
clearSearch() {
|
|
286
|
+
this.value = null;
|
|
287
|
+
}
|
|
288
|
+
controlListWithOnlyOne() {
|
|
289
|
+
if (this.searchMode) {
|
|
290
|
+
const source = this._visibleOptions;
|
|
291
|
+
if ((source === null || source === void 0 ? void 0 : source.length) === 1) {
|
|
292
|
+
this.selectOption(source[0]);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
controlEmptySearch() {
|
|
297
|
+
var _a;
|
|
298
|
+
if (this.searchMode) {
|
|
299
|
+
if (!((_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
300
|
+
this.clearSearch();
|
|
301
|
+
ApplicationUtils.info(this._textEmptyList);
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
this.controlListWithOnlyOne();
|
|
305
|
+
}
|
|
236
306
|
}
|
|
237
307
|
}
|
|
238
308
|
//---------------------------------------------
|
|
@@ -267,7 +337,8 @@ let EzComboBox = class {
|
|
|
267
337
|
}
|
|
268
338
|
}
|
|
269
339
|
componentDidLoad() {
|
|
270
|
-
CSSVarsUtils.applyVarsTextInput(this.el, this.
|
|
340
|
+
CSSVarsUtils.applyVarsTextInput(this.el, this._textInput);
|
|
341
|
+
this.setInputValue(false);
|
|
271
342
|
}
|
|
272
343
|
//---------------------------------------------
|
|
273
344
|
// Event handlers
|
|
@@ -287,7 +358,7 @@ let EzComboBox = class {
|
|
|
287
358
|
const argument = (_a = event.target.value) === null || _a === void 0 ? void 0 : _a.trim();
|
|
288
359
|
const argumentNumber = Number(argument || undefined);
|
|
289
360
|
if (!this._criteria) {
|
|
290
|
-
this.
|
|
361
|
+
this._textInput.value = event.data || argument;
|
|
291
362
|
}
|
|
292
363
|
this._criteria = argument;
|
|
293
364
|
if (argument && (!isNaN(argumentNumber) || argument.length >= this._limitCharsToSearch)) {
|
|
@@ -319,6 +390,7 @@ let EzComboBox = class {
|
|
|
319
390
|
}
|
|
320
391
|
}
|
|
321
392
|
keyDownHandler(event) {
|
|
393
|
+
this._tabPressed = false;
|
|
322
394
|
switch (event.key) {
|
|
323
395
|
case "ArrowDown":
|
|
324
396
|
this.nextOption();
|
|
@@ -332,6 +404,10 @@ let EzComboBox = class {
|
|
|
332
404
|
case "Escape":
|
|
333
405
|
this.cancelPreselection();
|
|
334
406
|
break;
|
|
407
|
+
case "Tab":
|
|
408
|
+
this._tabPressed = true;
|
|
409
|
+
this.controlListWithOnlyOne();
|
|
410
|
+
break;
|
|
335
411
|
}
|
|
336
412
|
event.stopPropagation();
|
|
337
413
|
}
|
|
@@ -339,13 +415,17 @@ let EzComboBox = class {
|
|
|
339
415
|
this.cancelPreselection();
|
|
340
416
|
}
|
|
341
417
|
render() {
|
|
342
|
-
|
|
343
|
-
|
|
418
|
+
var _a;
|
|
419
|
+
return (h(Host, null, h("ez-text-input", { class: this.suppressSearch ? "suppressed-search-input" : "", ref: elem => this._textInput = elem, "data-slave-mode": "true", enabled: this.enabled && !this.suppressSearch, onInput: event => this.onTextInputChangeHandler(event), onClick: () => this.onTextInputClickHandler(), onFocusout: () => this.onTextInputFocusOutHandler(), onKeyDown: event => this.keyDownHandler(event), label: this.label, canShowError: this.canShowError, errorMessage: this.errorMessage, mode: this.mode }, h("button", { class: "btn", slot: this.searchMode ? "leftIcon" : "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.handlerIconClick() }, h("ez-icon", { iconName: this.searchMode ? "search" : "chevron-down" })), this.searchMode && ((_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value) && (this._criteria || this.value)
|
|
420
|
+
? h("button", { class: "btn", slot: "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.clearSearch() }, h("ez-icon", { iconName: "close" }))
|
|
421
|
+
: undefined), h("section", { class: "list-container", ref: elem => this._listContainer = elem }, h("div", { class: "list-wrapper", ref: elem => this._listWrapper = elem }, h("div", { class: "list-options", ref: elem => this._optionsList = elem }, this._visibleOptions.length === 0
|
|
422
|
+
&& h("div", { class: "message" }, !this._showLoading && h("span", { class: "message__no-result" }, this._textEmptyList), this._showLoading && h("div", { class: "message__loading" })), this.showOptionValue
|
|
344
423
|
? h("span", { class: "item__value item__value--hidden", ref: elem => this._itemValueBasis = elem })
|
|
345
424
|
: undefined, this._visibleOptions.length > 0 && this._visibleOptions.map((opt, index) => this.buildItem(opt, index)))))));
|
|
346
425
|
}
|
|
347
426
|
get el() { return getElement(this); }
|
|
348
427
|
static get watchers() { return {
|
|
428
|
+
"errorMessage": ["observeErrorMessage"],
|
|
349
429
|
"value": ["observeValue"]
|
|
350
430
|
}; }
|
|
351
431
|
};
|
|
@@ -10,6 +10,7 @@ let EzDateInput = class {
|
|
|
10
10
|
this.ezChange = createEvent(this, "ezChange", 7);
|
|
11
11
|
this.ezStartChange = createEvent(this, "ezStartChange", 7);
|
|
12
12
|
this.ezCancelWaitingChange = createEvent(this, "ezCancelWaitingChange", 7);
|
|
13
|
+
this._focused = false;
|
|
13
14
|
/**
|
|
14
15
|
* Deixa o campo disponível ou não para uso.
|
|
15
16
|
*/
|
|
@@ -20,18 +21,33 @@ let EzDateInput = class {
|
|
|
20
21
|
this.mode = "regular";
|
|
21
22
|
}
|
|
22
23
|
observeLabel() {
|
|
23
|
-
this._textInput
|
|
24
|
+
if (this._textInput) {
|
|
25
|
+
this._textInput.label = this.label;
|
|
26
|
+
}
|
|
24
27
|
}
|
|
25
28
|
observeErrorMessage() {
|
|
29
|
+
var _a;
|
|
26
30
|
if (this._textInput) {
|
|
27
31
|
this._textInput.errorMessage = this.errorMessage;
|
|
32
|
+
if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
33
|
+
this.setInputValue();
|
|
34
|
+
}
|
|
28
35
|
}
|
|
29
36
|
}
|
|
30
37
|
observeValue(newValue, oldValue) {
|
|
31
|
-
if (newValue != oldValue) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
38
|
+
if (this._textInput && newValue != oldValue) {
|
|
39
|
+
const newValueValidated = this.validateValue(newValue);
|
|
40
|
+
const oldValueValidated = this.validateValue(oldValue);
|
|
41
|
+
if ((newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime()) !== (oldValueValidated === null || oldValueValidated === void 0 ? void 0 : oldValueValidated.getTime())) {
|
|
42
|
+
const textValue = this.getTextValue(newValueValidated) || '';
|
|
43
|
+
const parsedDate = DateUtils.strToDate(textValue);
|
|
44
|
+
if ((parsedDate || !this._focused) && (this._textInput.value || '') !== textValue) {
|
|
45
|
+
this._textInput.value = textValue;
|
|
46
|
+
this._focused = false;
|
|
47
|
+
this.errorMessage = "";
|
|
48
|
+
}
|
|
49
|
+
const valueEmitted = newValueValidated === null ? undefined : newValueValidated;
|
|
50
|
+
this.ezChange.emit(valueEmitted);
|
|
35
51
|
}
|
|
36
52
|
}
|
|
37
53
|
}
|
|
@@ -47,59 +63,89 @@ let EzDateInput = class {
|
|
|
47
63
|
async setBlur() {
|
|
48
64
|
this._textInput.setBlur();
|
|
49
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Retorna informando se o campo está inválido (true | false)
|
|
68
|
+
*/
|
|
69
|
+
async isInvalid() {
|
|
70
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
71
|
+
}
|
|
50
72
|
changeValue(newValue) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if ((newValue === null || newValue === void 0 ? void 0 : newValue.toString()) !== ((_a = this.value) === null || _a === void 0 ? void 0 : _a.toString())) {
|
|
56
|
-
this.value = newValue;
|
|
57
|
-
this.ezChange.emit(this.value);
|
|
73
|
+
const currentValue = this.validateValue(this.value);
|
|
74
|
+
const newValueValidated = this.validateValue(newValue);
|
|
75
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
76
|
+
this.value = newValueValidated;
|
|
58
77
|
}
|
|
59
78
|
}
|
|
60
79
|
showCalendar() {
|
|
61
|
-
this.
|
|
80
|
+
this.handleBlur();
|
|
62
81
|
this._calendar.value = this.value;
|
|
63
82
|
//FIXME: Provavelmente isso fará com que o popup abra em uma
|
|
64
83
|
//posição errada no futuro. Preferi fazer simples no começo,
|
|
65
84
|
//porque não quis onerar o text input com essa funcionalidade...
|
|
66
|
-
const top = this.
|
|
85
|
+
const top = this.errorMessage || this.mode === "slim" ? 0 : -19;
|
|
67
86
|
this._calendar.fitVertical(top, this._elem.clientHeight);
|
|
68
87
|
}
|
|
69
88
|
hideCalendar() {
|
|
70
89
|
this.changeValue(this._calendar.value);
|
|
71
90
|
this._calendar.hide();
|
|
72
91
|
}
|
|
73
|
-
|
|
92
|
+
handleBlur() {
|
|
74
93
|
const strValue = this._textInput.value;
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
77
|
-
|
|
78
|
-
|
|
94
|
+
const newValue = DateUtils.strToDate(strValue);
|
|
95
|
+
if (newValue || !strValue) {
|
|
96
|
+
this.errorMessage = "";
|
|
97
|
+
const currentValue = this.validateValue(this.value);
|
|
98
|
+
const newValueValidated = this.validateValue(newValue);
|
|
99
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) === (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
100
|
+
if (newValueValidated) {
|
|
101
|
+
this._textInput.value = this.getTextValue(newValueValidated) || '';
|
|
102
|
+
this._focused = false;
|
|
103
|
+
}
|
|
104
|
+
this.ezCancelWaitingChange.emit();
|
|
79
105
|
}
|
|
80
106
|
else {
|
|
81
|
-
this.changeValue(
|
|
107
|
+
this.changeValue(newValueValidated);
|
|
82
108
|
}
|
|
83
109
|
}
|
|
84
110
|
else {
|
|
111
|
+
this.changeValue(undefined);
|
|
85
112
|
this.ezCancelWaitingChange.emit();
|
|
86
|
-
this.
|
|
113
|
+
this.errorMessage = "O valor digitado não é uma data válida";
|
|
87
114
|
}
|
|
88
115
|
}
|
|
89
116
|
getTextValue(d) {
|
|
90
117
|
return d ? new Intl.DateTimeFormat("pt-BR").format(d) : undefined;
|
|
91
118
|
}
|
|
92
|
-
|
|
93
|
-
this.
|
|
119
|
+
handleInput() {
|
|
120
|
+
const strValue = this._textInput.value;
|
|
121
|
+
const newValue = DateUtils.strToDate(strValue);
|
|
122
|
+
const currentValue = this.validateValue(this.value);
|
|
123
|
+
const newValueValidated = this.validateValue(newValue);
|
|
124
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
125
|
+
this._focused = true;
|
|
126
|
+
this.ezStartChange.emit({ waitmessage: "", blocking: false });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
validateValue(value) {
|
|
130
|
+
return value instanceof Date && !isNaN(value.valueOf())
|
|
131
|
+
? DateUtils.clearTime(value)
|
|
132
|
+
: undefined;
|
|
133
|
+
}
|
|
134
|
+
setInputValue() {
|
|
135
|
+
const textValue = this.getTextValue(this.value) || '';
|
|
136
|
+
if ((this._textInput.value || '') !== textValue) {
|
|
137
|
+
this._textInput.value = textValue;
|
|
138
|
+
}
|
|
94
139
|
}
|
|
95
140
|
componentDidLoad() {
|
|
96
141
|
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
142
|
+
this.setInputValue();
|
|
97
143
|
}
|
|
98
144
|
render() {
|
|
99
|
-
return (h(Host, null, h("ez-text-input", { ref: elem => this._textInput = elem,
|
|
145
|
+
return (h(Host, null, h("ez-text-input", { ref: elem => this._textInput = elem, "data-slave-mode": "true", onKeyDown: event => {
|
|
100
146
|
if (event.key === "H" || event.key === "h")
|
|
101
147
|
this.changeValue(new Date());
|
|
102
|
-
}, label: this.label,
|
|
148
|
+
}, label: this.label, onBlur: () => this.handleBlur(), onInput: () => this.handleInput(), restrict: "0123456789/", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode }, h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), h("ez-calendar", { onEzChange: (event) => { this.hideCalendar(); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem })));
|
|
103
149
|
}
|
|
104
150
|
get _elem() { return getElement(this); }
|
|
105
151
|
static get watchers() { return {
|
|
@@ -10,6 +10,7 @@ let EzDateTimeInput = class {
|
|
|
10
10
|
this.ezChange = createEvent(this, "ezChange", 7);
|
|
11
11
|
this.ezStartChange = createEvent(this, "ezStartChange", 7);
|
|
12
12
|
this.ezCancelWaitingChange = createEvent(this, "ezCancelWaitingChange", 7);
|
|
13
|
+
this._focused = false;
|
|
13
14
|
/**
|
|
14
15
|
* Deixa o campo disponível ou não para uso.
|
|
15
16
|
*/
|
|
@@ -24,14 +25,34 @@ let EzDateTimeInput = class {
|
|
|
24
25
|
this.mode = "regular";
|
|
25
26
|
}
|
|
26
27
|
observeLabel() {
|
|
27
|
-
this._textInput
|
|
28
|
+
if (this._textInput) {
|
|
29
|
+
this._textInput.label = this.label;
|
|
30
|
+
}
|
|
28
31
|
}
|
|
29
32
|
observeErrorMessage() {
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
observeValue() {
|
|
33
|
+
var _a;
|
|
33
34
|
if (this._textInput) {
|
|
34
|
-
this._textInput.
|
|
35
|
+
this._textInput.errorMessage = this.errorMessage;
|
|
36
|
+
if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
37
|
+
this.setInputValue();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
observeValue(newValue, oldValue) {
|
|
42
|
+
if (this._textInput && newValue != oldValue) {
|
|
43
|
+
const newValueValidated = this.validateValue(newValue);
|
|
44
|
+
const oldValueValidated = this.validateValue(oldValue);
|
|
45
|
+
if ((newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime()) !== (oldValueValidated === null || oldValueValidated === void 0 ? void 0 : oldValueValidated.getTime())) {
|
|
46
|
+
const textValue = this.getTextValue(newValueValidated) || '';
|
|
47
|
+
const parsedDate = this.getParsedDateTime(textValue);
|
|
48
|
+
if ((parsedDate || !this._focused) && (this._textInput.value || '') !== textValue) {
|
|
49
|
+
this._textInput.value = textValue;
|
|
50
|
+
this._focused = false;
|
|
51
|
+
this.errorMessage = "";
|
|
52
|
+
}
|
|
53
|
+
const valueEmitted = newValueValidated === null ? undefined : newValueValidated;
|
|
54
|
+
this.ezChange.emit(valueEmitted);
|
|
55
|
+
}
|
|
35
56
|
}
|
|
36
57
|
}
|
|
37
58
|
/**
|
|
@@ -46,30 +67,36 @@ let EzDateTimeInput = class {
|
|
|
46
67
|
async setBlur() {
|
|
47
68
|
this._textInput.setBlur();
|
|
48
69
|
}
|
|
49
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Retorna informando se o campo está inválido (true | false)
|
|
72
|
+
*/
|
|
73
|
+
async isInvalid() {
|
|
74
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
75
|
+
}
|
|
76
|
+
handleKeyDown(event) {
|
|
50
77
|
const input = this._textInput.shadowRoot.querySelector('input');
|
|
51
|
-
if (
|
|
78
|
+
if (event.key === "H" || event.key === "h") {
|
|
52
79
|
this.changeValue(new Date());
|
|
53
80
|
}
|
|
54
|
-
else if (
|
|
81
|
+
else if (event.shiftKey && event.key === "Tab") {
|
|
55
82
|
if (input.selectionStart > 0) {
|
|
56
83
|
let selectIni = input.value.lastIndexOf(" ", input.selectionStart);
|
|
57
84
|
if (selectIni !== -1) {
|
|
58
85
|
input.setSelectionRange(0, selectIni);
|
|
59
|
-
|
|
86
|
+
event.preventDefault();
|
|
60
87
|
}
|
|
61
88
|
}
|
|
62
89
|
}
|
|
63
|
-
else if (
|
|
90
|
+
else if (event.key === "Tab") {
|
|
64
91
|
if (input.value.length !== input.selectionEnd) {
|
|
65
92
|
let selectIni = input.value.indexOf(" ", input.selectionEnd);
|
|
66
93
|
selectIni = selectIni === -1 ? input.selectionEnd : selectIni + 1;
|
|
67
94
|
input.setSelectionRange(selectIni, input.value.length);
|
|
68
|
-
|
|
95
|
+
event.preventDefault();
|
|
69
96
|
}
|
|
70
97
|
}
|
|
71
98
|
}
|
|
72
|
-
|
|
99
|
+
handleFocus() {
|
|
73
100
|
const input = this._textInput.shadowRoot.querySelector('input');
|
|
74
101
|
if (input.selectionStart !== input.selectionEnd) {
|
|
75
102
|
let selectIni = input.value.indexOf(" ", input.selectionStart);
|
|
@@ -77,7 +104,7 @@ let EzDateTimeInput = class {
|
|
|
77
104
|
input.setSelectionRange(0, selectIni);
|
|
78
105
|
}
|
|
79
106
|
}
|
|
80
|
-
|
|
107
|
+
handleClick() {
|
|
81
108
|
const input = this._textInput.shadowRoot.querySelector('input');
|
|
82
109
|
let selectIni = input.value.lastIndexOf(" ", input.selectionEnd);
|
|
83
110
|
selectIni = selectIni === -1 ? 0 : selectIni + 1;
|
|
@@ -86,37 +113,55 @@ let EzDateTimeInput = class {
|
|
|
86
113
|
input.setSelectionRange(selectIni, selectFin);
|
|
87
114
|
}
|
|
88
115
|
changeValue(newValue) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if ((
|
|
92
|
-
this.value =
|
|
93
|
-
this.ezChange.emit(this.value);
|
|
116
|
+
const currentValue = this.validateValue(this.value);
|
|
117
|
+
const newValueValidated = this.validateValue(newValue);
|
|
118
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
119
|
+
this.value = newValueValidated;
|
|
94
120
|
}
|
|
95
121
|
}
|
|
96
122
|
showCalendar() {
|
|
97
|
-
const top = this.
|
|
123
|
+
const top = this.errorMessage || this.mode === "slim" ? 0 : -19;
|
|
98
124
|
this._calendar.fitVertical(top, this._elem.clientHeight);
|
|
99
125
|
this._calendar.style.visibility = 'inherit';
|
|
100
126
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
127
|
+
getParsedDateTime(strValue) {
|
|
128
|
+
var _a, _b;
|
|
129
|
+
if (strValue === void 0) {
|
|
130
|
+
strValue = (((_b = (_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.trim()) || "");
|
|
131
|
+
}
|
|
132
|
+
if (!strValue) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const partsDateTime = strValue.split(" ");
|
|
104
136
|
const onlyDate = partsDateTime.length > 0 ? partsDateTime[0] : strValue;
|
|
105
137
|
const onlyTime = partsDateTime[1] ? partsDateTime[1] : "";
|
|
106
138
|
const parsedTime = TimeFormatter.prepareValue(onlyTime, this.showSeconds);
|
|
107
139
|
const strDateTime = onlyDate + (parsedTime && " " + parsedTime);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
140
|
+
return DateUtils.strToDate(strDateTime);
|
|
141
|
+
}
|
|
142
|
+
handleBlur() {
|
|
143
|
+
var _a, _b;
|
|
144
|
+
const strValue = ((_b = (_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.trim()) || "";
|
|
145
|
+
const newValue = this.getParsedDateTime();
|
|
146
|
+
if (newValue || !strValue) {
|
|
147
|
+
this.errorMessage = "";
|
|
148
|
+
const currentValue = this.validateValue(this.value);
|
|
149
|
+
const newValueValidated = this.validateValue(newValue);
|
|
150
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) === (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
151
|
+
if (newValueValidated) {
|
|
152
|
+
this._textInput.value = this.getTextValue(newValueValidated) || '';
|
|
153
|
+
this._focused = false;
|
|
154
|
+
}
|
|
155
|
+
this.ezCancelWaitingChange.emit();
|
|
112
156
|
}
|
|
113
157
|
else {
|
|
114
|
-
this.changeValue(
|
|
158
|
+
this.changeValue(newValueValidated);
|
|
115
159
|
}
|
|
116
160
|
}
|
|
117
161
|
else {
|
|
162
|
+
this.changeValue(undefined);
|
|
118
163
|
this.ezCancelWaitingChange.emit();
|
|
119
|
-
this.
|
|
164
|
+
this.errorMessage = "O valor digitado não é uma data válida";
|
|
120
165
|
}
|
|
121
166
|
}
|
|
122
167
|
getTextValue(d) {
|
|
@@ -130,14 +175,32 @@ let EzDateTimeInput = class {
|
|
|
130
175
|
};
|
|
131
176
|
return d ? (new Intl.DateTimeFormat('pt-BR', this.showSeconds ? optionsSecond : options).format(d)) : undefined;
|
|
132
177
|
}
|
|
133
|
-
|
|
134
|
-
|
|
178
|
+
validateValue(value) {
|
|
179
|
+
return value instanceof Date && !isNaN(value.valueOf())
|
|
180
|
+
? value
|
|
181
|
+
: undefined;
|
|
182
|
+
}
|
|
183
|
+
handleInput() {
|
|
184
|
+
const newValue = this.getParsedDateTime();
|
|
185
|
+
const currentValue = this.validateValue(this.value);
|
|
186
|
+
const newValueValidated = this.validateValue(newValue);
|
|
187
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
188
|
+
this._focused = true;
|
|
189
|
+
this.ezStartChange.emit({ waitmessage: "", blocking: false });
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
setInputValue() {
|
|
193
|
+
const textValue = this.getTextValue(this.value) || '';
|
|
194
|
+
if ((this._textInput.value || '') !== textValue) {
|
|
195
|
+
this._textInput.value = textValue;
|
|
196
|
+
}
|
|
135
197
|
}
|
|
136
198
|
componentDidLoad() {
|
|
137
199
|
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
200
|
+
this.setInputValue();
|
|
138
201
|
}
|
|
139
202
|
render() {
|
|
140
|
-
return (h(Host, null, h("ez-text-input", { ref: elem => this._textInput = elem,
|
|
203
|
+
return (h(Host, null, h("ez-text-input", { ref: elem => this._textInput = elem, "data-slave-mode": "true", label: this.label, restrict: "0123456789/: ", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, onKeyDown: event => { this.handleKeyDown(event); }, onBlur: () => this.handleBlur(), onInput: () => this.handleInput(), onFocus: () => this.handleFocus(), onClick: () => this.handleClick() }, h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), h("ez-calendar", { onEzChange: (event) => { this.changeValue(this._calendar.value); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem, time: true, showSeconds: this.showSeconds })));
|
|
141
204
|
}
|
|
142
205
|
get _elem() { return getElement(this); }
|
|
143
206
|
static get watchers() { return {
|