@sankhyalabs/ezui 1.1.159 → 1.1.161
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 +63 -28
- 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/{grid-config.cjs.entry.js → ez-grid-config.cjs.entry.js} +6 -6
- package/dist/cjs/ez-grid.cjs.entry.js +16 -9
- package/dist/cjs/ez-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal.cjs.entry.js +1 -1
- package/dist/cjs/ez-number-input.cjs.entry.js +69 -25
- package/dist/cjs/ez-search.cjs.entry.js +20 -5
- package/dist/cjs/{select-box.cjs.entry.js → ez-select-box.cjs.entry.js} +3 -3
- package/dist/cjs/ez-text-area.cjs.entry.js +8 -2
- package/dist/cjs/ez-text-input.cjs.entry.js +30 -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/collection-manifest.json +2 -2
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +10 -4
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +81 -28
- 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 +7 -3
- package/dist/collection/components/ez-grid/ez-grid.css +4 -0
- package/dist/collection/components/ez-grid/ez-grid.js +21 -14
- package/dist/collection/components/ez-grid/subcomponents/{gridconfig/grid-config.css → ez-grid-config/ez-grid-config.css} +46 -20
- package/dist/collection/components/ez-grid/subcomponents/{gridconfig/grid-config.js → ez-grid-config/ez-grid-config.js} +12 -12
- package/dist/collection/components/ez-grid/subcomponents/{select-box/select-box.css → ez-select-box/ez-select-box.css} +3 -4
- package/dist/collection/components/ez-grid/subcomponents/{select-box/select-box.js → ez-select-box/ez-select-box.js} +3 -3
- package/dist/collection/components/ez-list/ez-list.css +84 -46
- package/dist/collection/components/ez-modal/ez-modal.css +2 -2
- 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 +1 -1
- package/dist/collection/components/ez-text-input/ez-text-input.js +45 -38
- package/dist/collection/components/ez-time-input/ez-time-input.js +95 -59
- package/dist/custom-elements/index.d.ts +12 -12
- package/dist/custom-elements/index.js +1121 -810
- package/dist/esm/ez-combo-box.entry.js +63 -28
- 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/{grid-config.entry.js → ez-grid-config.entry.js} +6 -6
- package/dist/esm/ez-grid.entry.js +16 -9
- package/dist/esm/ez-list.entry.js +1 -1
- package/dist/esm/ez-modal.entry.js +1 -1
- package/dist/esm/ez-number-input.entry.js +69 -25
- package/dist/esm/ez-search.entry.js +20 -5
- package/dist/esm/{select-box.entry.js → ez-select-box.entry.js} +3 -3
- package/dist/esm/ez-text-area.entry.js +8 -2
- package/dist/esm/ez-text-input.entry.js +30 -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-1fecaeb8.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-8c1b9fe0.entry.js +1 -0
- package/dist/ezui/{p-be87ac5e.entry.js → p-8d73594f.entry.js} +1 -1
- package/dist/ezui/p-988ff301.entry.js +1 -0
- package/dist/ezui/p-cf56d3e8.entry.js +1 -0
- package/dist/ezui/{p-727a39e5.entry.js → p-fd6f3bf9.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 +13 -7
- 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/controller/EzGridController.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +1 -0
- package/dist/types/components/ez-grid/ez-grid.d.ts +9 -6
- package/dist/types/components/ez-grid/subcomponents/{gridconfig/grid-config.d.ts → ez-grid-config/ez-grid-config.d.ts} +4 -4
- package/dist/types/components/ez-grid/subcomponents/{select-box/select-box.d.ts → ez-select-box/ez-select-box.d.ts} +0 -0
- 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 +7 -6
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +17 -13
- package/dist/types/components.d.ts +84 -61
- package/package.json +1 -1
- package/react/components.d.ts +2 -2
- package/react/components.js +2 -2
- package/react/components.js.map +1 -1
- package/dist/ezui/p-1859a3d8.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-b524dfca.entry.js +0 -1
- package/dist/ezui/p-bc8aa27f.entry.js +0 -1
- package/dist/ezui/p-bea6f8a6.entry.js +0 -1
- package/dist/ezui/p-c2de757f.entry.js +0 -1
- package/dist/ezui/p-ec21ecce.entry.js +0 -1
- package/dist/ezui/p-ecee9d8d.entry.js +0 -1
- package/dist/ezui/p-fc9b9487.entry.js +0 -1
|
@@ -7,7 +7,7 @@ const core = require('@sankhyalabs/core');
|
|
|
7
7
|
const ApplicationUtils = require('./ApplicationUtils-4a223c7a.js');
|
|
8
8
|
const CSSVarsUtils = require('./CSSVarsUtils-1034b7b6.js');
|
|
9
9
|
|
|
10
|
-
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(--
|
|
10
|
+
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-primary:var(--scrollbar--primary, #2B3A54);--ez-combo-box__list-scrollbar--background-color-secondary:var(--scrollbar--secondary, #E5EAF0);--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;scrollbar-width:thin;scrollbar-color:var(--ez-combo-box__list-scrollbar--background-color-primary) var(--ez-combo-box__list-scrollbar--background-color-secondary)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-combo-box__list-scrollbar--background-color-secondary);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-primary);border-radius:var(--ez-combo-box__list-scrollbar--border-radius)}.list-options::-webkit-scrollbar{background-color:var(--ez-combo-box__list-scrollbar--background-color-secondary);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)}}";
|
|
11
11
|
|
|
12
12
|
let EzComboBox = class {
|
|
13
13
|
constructor(hostRef) {
|
|
@@ -50,40 +50,66 @@ let EzComboBox = class {
|
|
|
50
50
|
*/
|
|
51
51
|
this.mode = "regular";
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
observeErrorMessage() {
|
|
54
|
+
var _a;
|
|
55
|
+
if (this._textInput) {
|
|
56
|
+
this._textInput.errorMessage = this.errorMessage;
|
|
57
|
+
if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
58
|
+
this.setInputValue();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
observeValue(newValue, oldValue) {
|
|
63
|
+
var _a, _b, _c, _d;
|
|
64
|
+
if (this._textInput && newValue != oldValue) {
|
|
65
|
+
const newValueSelected = this.getSelectedOption(newValue);
|
|
66
|
+
const oldValueSelected = this.getSelectedOption(oldValue);
|
|
67
|
+
const currentValue = this.getSelectedOption(this.value);
|
|
68
|
+
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())) {
|
|
69
|
+
this.value = newValueSelected;
|
|
70
|
+
}
|
|
71
|
+
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())) {
|
|
72
|
+
this.setInputValue();
|
|
73
|
+
const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
|
|
74
|
+
this.ezChange.emit(valueEmitted);
|
|
75
|
+
}
|
|
76
|
+
this.hideOptions();
|
|
77
|
+
this._criteria = undefined;
|
|
78
|
+
this._preSelection = undefined;
|
|
79
|
+
this.updateVisibleOptions();
|
|
56
80
|
}
|
|
57
|
-
this.hideOptions();
|
|
58
|
-
this._criteria = undefined;
|
|
59
|
-
this._preSelection = undefined;
|
|
60
|
-
this.updateVisibleOptions();
|
|
61
81
|
}
|
|
62
82
|
/**
|
|
63
83
|
* Realiza o foco no componente de seleção
|
|
64
84
|
*/
|
|
65
85
|
async setFocus() {
|
|
66
|
-
this.
|
|
86
|
+
this._textInput.setFocus();
|
|
67
87
|
}
|
|
68
88
|
/**
|
|
69
89
|
* Remove o foco no componente de seleção
|
|
70
90
|
*/
|
|
71
91
|
async setBlur() {
|
|
72
|
-
this.
|
|
92
|
+
this._textInput.setBlur();
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Retorna informando se o campo está inválido (true | false)
|
|
96
|
+
*/
|
|
97
|
+
async isInvalid() {
|
|
98
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
73
99
|
}
|
|
74
100
|
getText() {
|
|
75
101
|
let text = "";
|
|
76
|
-
const
|
|
77
|
-
if (
|
|
78
|
-
text = this.showSelectedValue ? `${
|
|
102
|
+
const currentValue = this.getSelectedOption(this.value);
|
|
103
|
+
if (currentValue) {
|
|
104
|
+
text = this.showSelectedValue ? `${currentValue.value} - ${currentValue.label}` : currentValue.label;
|
|
79
105
|
}
|
|
80
106
|
return text;
|
|
81
107
|
}
|
|
82
|
-
getSelectedOption() {
|
|
83
|
-
if (typeof
|
|
84
|
-
return this._visibleOptions.find(o => o.value ===
|
|
108
|
+
getSelectedOption(value) {
|
|
109
|
+
if (typeof value === "string" || value instanceof String) {
|
|
110
|
+
return this._visibleOptions.find(o => o.value === value);
|
|
85
111
|
}
|
|
86
|
-
return
|
|
112
|
+
return value;
|
|
87
113
|
}
|
|
88
114
|
updateVisibleOptions() {
|
|
89
115
|
let opts = this._source || [];
|
|
@@ -138,7 +164,7 @@ let EzComboBox = class {
|
|
|
138
164
|
//FIXME: Provavelmente isso fará com que o popup abra em uma
|
|
139
165
|
//posição errada no futuro. Preferi fazer simples no começo,
|
|
140
166
|
//porque não quis onerar o text input com essa funcionalidade...
|
|
141
|
-
const top = (this.errorMessage || !this.canShowError || this.mode
|
|
167
|
+
const top = (this.errorMessage || !this.canShowError || this.mode === "slim") ? "0px" : "-19px";
|
|
142
168
|
this._floatingID = core.FloatingManager.float(this._listWrapper, this._listContainer, { autoClose: true, top });
|
|
143
169
|
window.requestAnimationFrame(() => {
|
|
144
170
|
this._listWrapper.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
|
|
@@ -221,15 +247,13 @@ let EzComboBox = class {
|
|
|
221
247
|
}
|
|
222
248
|
selectOption(newOption) {
|
|
223
249
|
var _a, _b;
|
|
224
|
-
const
|
|
225
|
-
if (((_a =
|
|
250
|
+
const currentValue = this.getSelectedOption(this.value);
|
|
251
|
+
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())) {
|
|
226
252
|
const adjustedOpt = !(newOption === null || newOption === void 0 ? void 0 : newOption.value) ? undefined : newOption;
|
|
227
253
|
this.value = adjustedOpt;
|
|
228
|
-
this.errorMessage = "";
|
|
229
|
-
this.ezChange.emit(this.value);
|
|
230
254
|
}
|
|
231
255
|
else {
|
|
232
|
-
this.
|
|
256
|
+
this.setInputValue();
|
|
233
257
|
}
|
|
234
258
|
if (this.searchMode) {
|
|
235
259
|
this._visibleOptions = [];
|
|
@@ -246,11 +270,20 @@ let EzComboBox = class {
|
|
|
246
270
|
}
|
|
247
271
|
}
|
|
248
272
|
cancelPreselection() {
|
|
249
|
-
if (!this.
|
|
273
|
+
if (!this._textInput.value && this.value) {
|
|
250
274
|
this.selectOption(undefined);
|
|
251
275
|
}
|
|
252
276
|
else {
|
|
253
|
-
this.
|
|
277
|
+
this.setInputValue();
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
setInputValue(clearError = true) {
|
|
281
|
+
const textValue = this.getText();
|
|
282
|
+
if ((this._textInput.value || '') !== textValue) {
|
|
283
|
+
this._textInput.value = textValue;
|
|
284
|
+
if (clearError) {
|
|
285
|
+
this.errorMessage = "";
|
|
286
|
+
}
|
|
254
287
|
}
|
|
255
288
|
}
|
|
256
289
|
clearSearch() {
|
|
@@ -308,7 +341,8 @@ let EzComboBox = class {
|
|
|
308
341
|
}
|
|
309
342
|
}
|
|
310
343
|
componentDidLoad() {
|
|
311
|
-
CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this.el, this.
|
|
344
|
+
CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this.el, this._textInput);
|
|
345
|
+
this.setInputValue(false);
|
|
312
346
|
}
|
|
313
347
|
//---------------------------------------------
|
|
314
348
|
// Event handlers
|
|
@@ -328,7 +362,7 @@ let EzComboBox = class {
|
|
|
328
362
|
const argument = (_a = event.target.value) === null || _a === void 0 ? void 0 : _a.trim();
|
|
329
363
|
const argumentNumber = Number(argument || undefined);
|
|
330
364
|
if (!this._criteria) {
|
|
331
|
-
this.
|
|
365
|
+
this._textInput.value = event.data || argument;
|
|
332
366
|
}
|
|
333
367
|
this._criteria = argument;
|
|
334
368
|
if (argument && (!isNaN(argumentNumber) || argument.length >= this._limitCharsToSearch)) {
|
|
@@ -386,7 +420,7 @@ let EzComboBox = class {
|
|
|
386
420
|
}
|
|
387
421
|
render() {
|
|
388
422
|
var _a;
|
|
389
|
-
return (index.h(index.Host, null, index.h("ez-text-input", { class: this.suppressSearch ? "suppressed-search-input" : "", ref: elem => this.
|
|
423
|
+
return (index.h(index.Host, null, index.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 }, index.h("button", { class: "btn", slot: this.searchMode ? "leftIcon" : "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.handlerIconClick() }, index.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)
|
|
390
424
|
? index.h("button", { class: "btn", slot: "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.clearSearch() }, index.h("ez-icon", { iconName: "close" }))
|
|
391
425
|
: undefined), index.h("section", { class: "list-container", ref: elem => this._listContainer = elem }, index.h("div", { class: "list-wrapper", ref: elem => this._listWrapper = elem }, index.h("div", { class: "list-options", ref: elem => this._optionsList = elem }, this._visibleOptions.length === 0
|
|
392
426
|
&& index.h("div", { class: "message" }, !this._showLoading && index.h("span", { class: "message__no-result" }, this._textEmptyList), this._showLoading && index.h("div", { class: "message__loading" })), this.showOptionValue
|
|
@@ -395,6 +429,7 @@ let EzComboBox = class {
|
|
|
395
429
|
}
|
|
396
430
|
get el() { return index.getElement(this); }
|
|
397
431
|
static get watchers() { return {
|
|
432
|
+
"errorMessage": ["observeErrorMessage"],
|
|
398
433
|
"value": ["observeValue"]
|
|
399
434
|
}; }
|
|
400
435
|
};
|
|
@@ -14,6 +14,7 @@ let EzDateInput = class {
|
|
|
14
14
|
this.ezChange = index.createEvent(this, "ezChange", 7);
|
|
15
15
|
this.ezStartChange = index.createEvent(this, "ezStartChange", 7);
|
|
16
16
|
this.ezCancelWaitingChange = index.createEvent(this, "ezCancelWaitingChange", 7);
|
|
17
|
+
this._focused = false;
|
|
17
18
|
/**
|
|
18
19
|
* Deixa o campo disponível ou não para uso.
|
|
19
20
|
*/
|
|
@@ -24,18 +25,33 @@ let EzDateInput = 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() {
|
|
33
|
+
var _a;
|
|
30
34
|
if (this._textInput) {
|
|
31
35
|
this._textInput.errorMessage = this.errorMessage;
|
|
36
|
+
if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
37
|
+
this.setInputValue();
|
|
38
|
+
}
|
|
32
39
|
}
|
|
33
40
|
}
|
|
34
41
|
observeValue(newValue, oldValue) {
|
|
35
|
-
if (newValue != oldValue) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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 = core.DateUtils.strToDate(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);
|
|
39
55
|
}
|
|
40
56
|
}
|
|
41
57
|
}
|
|
@@ -51,59 +67,89 @@ let EzDateInput = class {
|
|
|
51
67
|
async setBlur() {
|
|
52
68
|
this._textInput.setBlur();
|
|
53
69
|
}
|
|
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
|
+
}
|
|
54
76
|
changeValue(newValue) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if ((newValue === null || newValue === void 0 ? void 0 : newValue.toString()) !== ((_a = this.value) === null || _a === void 0 ? void 0 : _a.toString())) {
|
|
60
|
-
this.value = newValue;
|
|
61
|
-
this.ezChange.emit(this.value);
|
|
77
|
+
const currentValue = this.validateValue(this.value);
|
|
78
|
+
const newValueValidated = this.validateValue(newValue);
|
|
79
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
80
|
+
this.value = newValueValidated;
|
|
62
81
|
}
|
|
63
82
|
}
|
|
64
83
|
showCalendar() {
|
|
65
|
-
this.
|
|
84
|
+
this.handleBlur();
|
|
66
85
|
this._calendar.value = this.value;
|
|
67
86
|
//FIXME: Provavelmente isso fará com que o popup abra em uma
|
|
68
87
|
//posição errada no futuro. Preferi fazer simples no começo,
|
|
69
88
|
//porque não quis onerar o text input com essa funcionalidade...
|
|
70
|
-
const top = this.
|
|
89
|
+
const top = this.errorMessage || this.mode === "slim" ? 0 : -19;
|
|
71
90
|
this._calendar.fitVertical(top, this._elem.clientHeight);
|
|
72
91
|
}
|
|
73
92
|
hideCalendar() {
|
|
74
93
|
this.changeValue(this._calendar.value);
|
|
75
94
|
this._calendar.hide();
|
|
76
95
|
}
|
|
77
|
-
|
|
96
|
+
handleBlur() {
|
|
78
97
|
const strValue = this._textInput.value;
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
81
|
-
|
|
82
|
-
|
|
98
|
+
const newValue = core.DateUtils.strToDate(strValue);
|
|
99
|
+
if (newValue || !strValue) {
|
|
100
|
+
this.errorMessage = "";
|
|
101
|
+
const currentValue = this.validateValue(this.value);
|
|
102
|
+
const newValueValidated = this.validateValue(newValue);
|
|
103
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) === (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
104
|
+
if (newValueValidated) {
|
|
105
|
+
this._textInput.value = this.getTextValue(newValueValidated) || '';
|
|
106
|
+
this._focused = false;
|
|
107
|
+
}
|
|
108
|
+
this.ezCancelWaitingChange.emit();
|
|
83
109
|
}
|
|
84
110
|
else {
|
|
85
|
-
this.changeValue(
|
|
111
|
+
this.changeValue(newValueValidated);
|
|
86
112
|
}
|
|
87
113
|
}
|
|
88
114
|
else {
|
|
115
|
+
this.changeValue(undefined);
|
|
89
116
|
this.ezCancelWaitingChange.emit();
|
|
90
|
-
this.
|
|
117
|
+
this.errorMessage = "O valor digitado não é uma data válida";
|
|
91
118
|
}
|
|
92
119
|
}
|
|
93
120
|
getTextValue(d) {
|
|
94
121
|
return d ? new Intl.DateTimeFormat("pt-BR").format(d) : undefined;
|
|
95
122
|
}
|
|
96
|
-
|
|
97
|
-
this.
|
|
123
|
+
handleInput() {
|
|
124
|
+
const strValue = this._textInput.value;
|
|
125
|
+
const newValue = core.DateUtils.strToDate(strValue);
|
|
126
|
+
const currentValue = this.validateValue(this.value);
|
|
127
|
+
const newValueValidated = this.validateValue(newValue);
|
|
128
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
129
|
+
this._focused = true;
|
|
130
|
+
this.ezStartChange.emit({ waitmessage: "", blocking: false });
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
validateValue(value) {
|
|
134
|
+
return value instanceof Date && !isNaN(value.valueOf())
|
|
135
|
+
? core.DateUtils.clearTime(value)
|
|
136
|
+
: undefined;
|
|
137
|
+
}
|
|
138
|
+
setInputValue() {
|
|
139
|
+
const textValue = this.getTextValue(this.value) || '';
|
|
140
|
+
if ((this._textInput.value || '') !== textValue) {
|
|
141
|
+
this._textInput.value = textValue;
|
|
142
|
+
}
|
|
98
143
|
}
|
|
99
144
|
componentDidLoad() {
|
|
100
145
|
CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
146
|
+
this.setInputValue();
|
|
101
147
|
}
|
|
102
148
|
render() {
|
|
103
|
-
return (index.h(index.Host, null, index.h("ez-text-input", { ref: elem => this._textInput = elem,
|
|
149
|
+
return (index.h(index.Host, null, index.h("ez-text-input", { ref: elem => this._textInput = elem, "data-slave-mode": "true", onKeyDown: event => {
|
|
104
150
|
if (event.key === "H" || event.key === "h")
|
|
105
151
|
this.changeValue(new Date());
|
|
106
|
-
}, label: this.label,
|
|
152
|
+
}, label: this.label, onBlur: () => this.handleBlur(), onInput: () => this.handleInput(), restrict: "0123456789/", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode }, index.h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), index.h("ez-calendar", { onEzChange: (event) => { this.hideCalendar(); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem })));
|
|
107
153
|
}
|
|
108
154
|
get _elem() { return index.getElement(this); }
|
|
109
155
|
static get watchers() { return {
|
|
@@ -14,6 +14,7 @@ let EzDateTimeInput = class {
|
|
|
14
14
|
this.ezChange = index.createEvent(this, "ezChange", 7);
|
|
15
15
|
this.ezStartChange = index.createEvent(this, "ezStartChange", 7);
|
|
16
16
|
this.ezCancelWaitingChange = index.createEvent(this, "ezCancelWaitingChange", 7);
|
|
17
|
+
this._focused = false;
|
|
17
18
|
/**
|
|
18
19
|
* Deixa o campo disponível ou não para uso.
|
|
19
20
|
*/
|
|
@@ -28,14 +29,34 @@ let EzDateTimeInput = class {
|
|
|
28
29
|
this.mode = "regular";
|
|
29
30
|
}
|
|
30
31
|
observeLabel() {
|
|
31
|
-
this._textInput
|
|
32
|
+
if (this._textInput) {
|
|
33
|
+
this._textInput.label = this.label;
|
|
34
|
+
}
|
|
32
35
|
}
|
|
33
36
|
observeErrorMessage() {
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
observeValue() {
|
|
37
|
+
var _a;
|
|
37
38
|
if (this._textInput) {
|
|
38
|
-
this._textInput.
|
|
39
|
+
this._textInput.errorMessage = this.errorMessage;
|
|
40
|
+
if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
41
|
+
this.setInputValue();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
observeValue(newValue, oldValue) {
|
|
46
|
+
if (this._textInput && newValue != oldValue) {
|
|
47
|
+
const newValueValidated = this.validateValue(newValue);
|
|
48
|
+
const oldValueValidated = this.validateValue(oldValue);
|
|
49
|
+
if ((newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime()) !== (oldValueValidated === null || oldValueValidated === void 0 ? void 0 : oldValueValidated.getTime())) {
|
|
50
|
+
const textValue = this.getTextValue(newValueValidated) || '';
|
|
51
|
+
const parsedDate = this.getParsedDateTime(textValue);
|
|
52
|
+
if ((parsedDate || !this._focused) && (this._textInput.value || '') !== textValue) {
|
|
53
|
+
this._textInput.value = textValue;
|
|
54
|
+
this._focused = false;
|
|
55
|
+
this.errorMessage = "";
|
|
56
|
+
}
|
|
57
|
+
const valueEmitted = newValueValidated === null ? undefined : newValueValidated;
|
|
58
|
+
this.ezChange.emit(valueEmitted);
|
|
59
|
+
}
|
|
39
60
|
}
|
|
40
61
|
}
|
|
41
62
|
/**
|
|
@@ -50,30 +71,36 @@ let EzDateTimeInput = class {
|
|
|
50
71
|
async setBlur() {
|
|
51
72
|
this._textInput.setBlur();
|
|
52
73
|
}
|
|
53
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Retorna informando se o campo está inválido (true | false)
|
|
76
|
+
*/
|
|
77
|
+
async isInvalid() {
|
|
78
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
79
|
+
}
|
|
80
|
+
handleKeyDown(event) {
|
|
54
81
|
const input = this._textInput.shadowRoot.querySelector('input');
|
|
55
|
-
if (
|
|
82
|
+
if (event.key === "H" || event.key === "h") {
|
|
56
83
|
this.changeValue(new Date());
|
|
57
84
|
}
|
|
58
|
-
else if (
|
|
85
|
+
else if (event.shiftKey && event.key === "Tab") {
|
|
59
86
|
if (input.selectionStart > 0) {
|
|
60
87
|
let selectIni = input.value.lastIndexOf(" ", input.selectionStart);
|
|
61
88
|
if (selectIni !== -1) {
|
|
62
89
|
input.setSelectionRange(0, selectIni);
|
|
63
|
-
|
|
90
|
+
event.preventDefault();
|
|
64
91
|
}
|
|
65
92
|
}
|
|
66
93
|
}
|
|
67
|
-
else if (
|
|
94
|
+
else if (event.key === "Tab") {
|
|
68
95
|
if (input.value.length !== input.selectionEnd) {
|
|
69
96
|
let selectIni = input.value.indexOf(" ", input.selectionEnd);
|
|
70
97
|
selectIni = selectIni === -1 ? input.selectionEnd : selectIni + 1;
|
|
71
98
|
input.setSelectionRange(selectIni, input.value.length);
|
|
72
|
-
|
|
99
|
+
event.preventDefault();
|
|
73
100
|
}
|
|
74
101
|
}
|
|
75
102
|
}
|
|
76
|
-
|
|
103
|
+
handleFocus() {
|
|
77
104
|
const input = this._textInput.shadowRoot.querySelector('input');
|
|
78
105
|
if (input.selectionStart !== input.selectionEnd) {
|
|
79
106
|
let selectIni = input.value.indexOf(" ", input.selectionStart);
|
|
@@ -81,7 +108,7 @@ let EzDateTimeInput = class {
|
|
|
81
108
|
input.setSelectionRange(0, selectIni);
|
|
82
109
|
}
|
|
83
110
|
}
|
|
84
|
-
|
|
111
|
+
handleClick() {
|
|
85
112
|
const input = this._textInput.shadowRoot.querySelector('input');
|
|
86
113
|
let selectIni = input.value.lastIndexOf(" ", input.selectionEnd);
|
|
87
114
|
selectIni = selectIni === -1 ? 0 : selectIni + 1;
|
|
@@ -90,37 +117,55 @@ let EzDateTimeInput = class {
|
|
|
90
117
|
input.setSelectionRange(selectIni, selectFin);
|
|
91
118
|
}
|
|
92
119
|
changeValue(newValue) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if ((
|
|
96
|
-
this.value =
|
|
97
|
-
this.ezChange.emit(this.value);
|
|
120
|
+
const currentValue = this.validateValue(this.value);
|
|
121
|
+
const newValueValidated = this.validateValue(newValue);
|
|
122
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
123
|
+
this.value = newValueValidated;
|
|
98
124
|
}
|
|
99
125
|
}
|
|
100
126
|
showCalendar() {
|
|
101
|
-
const top = this.
|
|
127
|
+
const top = this.errorMessage || this.mode === "slim" ? 0 : -19;
|
|
102
128
|
this._calendar.fitVertical(top, this._elem.clientHeight);
|
|
103
129
|
this._calendar.style.visibility = 'inherit';
|
|
104
130
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
131
|
+
getParsedDateTime(strValue) {
|
|
132
|
+
var _a, _b;
|
|
133
|
+
if (strValue === void 0) {
|
|
134
|
+
strValue = (((_b = (_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.trim()) || "");
|
|
135
|
+
}
|
|
136
|
+
if (!strValue) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const partsDateTime = strValue.split(" ");
|
|
108
140
|
const onlyDate = partsDateTime.length > 0 ? partsDateTime[0] : strValue;
|
|
109
141
|
const onlyTime = partsDateTime[1] ? partsDateTime[1] : "";
|
|
110
142
|
const parsedTime = core.TimeFormatter.prepareValue(onlyTime, this.showSeconds);
|
|
111
143
|
const strDateTime = onlyDate + (parsedTime && " " + parsedTime);
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
144
|
+
return core.DateUtils.strToDate(strDateTime);
|
|
145
|
+
}
|
|
146
|
+
handleBlur() {
|
|
147
|
+
var _a, _b;
|
|
148
|
+
const strValue = ((_b = (_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.trim()) || "";
|
|
149
|
+
const newValue = this.getParsedDateTime();
|
|
150
|
+
if (newValue || !strValue) {
|
|
151
|
+
this.errorMessage = "";
|
|
152
|
+
const currentValue = this.validateValue(this.value);
|
|
153
|
+
const newValueValidated = this.validateValue(newValue);
|
|
154
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) === (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
155
|
+
if (newValueValidated) {
|
|
156
|
+
this._textInput.value = this.getTextValue(newValueValidated) || '';
|
|
157
|
+
this._focused = false;
|
|
158
|
+
}
|
|
159
|
+
this.ezCancelWaitingChange.emit();
|
|
116
160
|
}
|
|
117
161
|
else {
|
|
118
|
-
this.changeValue(
|
|
162
|
+
this.changeValue(newValueValidated);
|
|
119
163
|
}
|
|
120
164
|
}
|
|
121
165
|
else {
|
|
166
|
+
this.changeValue(undefined);
|
|
122
167
|
this.ezCancelWaitingChange.emit();
|
|
123
|
-
this.
|
|
168
|
+
this.errorMessage = "O valor digitado não é uma data válida";
|
|
124
169
|
}
|
|
125
170
|
}
|
|
126
171
|
getTextValue(d) {
|
|
@@ -134,14 +179,32 @@ let EzDateTimeInput = class {
|
|
|
134
179
|
};
|
|
135
180
|
return d ? (new Intl.DateTimeFormat('pt-BR', this.showSeconds ? optionsSecond : options).format(d)) : undefined;
|
|
136
181
|
}
|
|
137
|
-
|
|
138
|
-
|
|
182
|
+
validateValue(value) {
|
|
183
|
+
return value instanceof Date && !isNaN(value.valueOf())
|
|
184
|
+
? value
|
|
185
|
+
: undefined;
|
|
186
|
+
}
|
|
187
|
+
handleInput() {
|
|
188
|
+
const newValue = this.getParsedDateTime();
|
|
189
|
+
const currentValue = this.validateValue(this.value);
|
|
190
|
+
const newValueValidated = this.validateValue(newValue);
|
|
191
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
192
|
+
this._focused = true;
|
|
193
|
+
this.ezStartChange.emit({ waitmessage: "", blocking: false });
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
setInputValue() {
|
|
197
|
+
const textValue = this.getTextValue(this.value) || '';
|
|
198
|
+
if ((this._textInput.value || '') !== textValue) {
|
|
199
|
+
this._textInput.value = textValue;
|
|
200
|
+
}
|
|
139
201
|
}
|
|
140
202
|
componentDidLoad() {
|
|
141
203
|
CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
204
|
+
this.setInputValue();
|
|
142
205
|
}
|
|
143
206
|
render() {
|
|
144
|
-
return (index.h(index.Host, null, index.h("ez-text-input", { ref: elem => this._textInput = elem,
|
|
207
|
+
return (index.h(index.Host, null, index.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() }, index.h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), index.h("ez-calendar", { onEzChange: (event) => { this.changeValue(this._calendar.value); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem, time: true, showSeconds: this.showSeconds })));
|
|
145
208
|
}
|
|
146
209
|
get _elem() { return index.getElement(this); }
|
|
147
210
|
static get watchers() { return {
|
|
@@ -30,9 +30,10 @@ let EzFilterInput = class {
|
|
|
30
30
|
this._textInput.errorMessage = this.errorMessage;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
observeValue() {
|
|
34
|
-
if (this._textInput) {
|
|
35
|
-
this._textInput.value =
|
|
33
|
+
observeValue(newValue, oldValue) {
|
|
34
|
+
if (this._textInput && newValue != oldValue) {
|
|
35
|
+
this._textInput.value = newValue;
|
|
36
|
+
this.ezChange.emit(newValue);
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
/**
|
|
@@ -47,12 +48,17 @@ let EzFilterInput = class {
|
|
|
47
48
|
async setBlur() {
|
|
48
49
|
this._textInput.setBlur();
|
|
49
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Retorna informando se o campo está inválido (true | false)
|
|
53
|
+
*/
|
|
54
|
+
async isInvalid() {
|
|
55
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
56
|
+
}
|
|
50
57
|
changeValue(evt) {
|
|
51
58
|
const newValue = evt.detail;
|
|
52
59
|
this.errorMessage = "";
|
|
53
60
|
if (newValue !== this.value) {
|
|
54
61
|
this.value = newValue;
|
|
55
|
-
this.ezChange.emit(this.value);
|
|
56
62
|
}
|
|
57
63
|
}
|
|
58
64
|
componentDidLoad() {
|