@sankhyalabs/ezui 1.1.77 → 1.1.78
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/CSSVarsUtils-66e86394.js +18 -0
- package/dist/cjs/ez-application.cjs.entry.js +0 -2
- package/dist/cjs/ez-button_11.cjs.entry.js +1 -1
- package/dist/cjs/ez-calendar.cjs.entry.js +8 -3
- package/dist/cjs/ez-collapsible-box_6.cjs.entry.js +8 -4
- package/dist/cjs/ez-combo-box.cjs.entry.js +6 -2
- package/dist/cjs/ez-date-time-input.cjs.entry.js +25 -36
- package/dist/cjs/ez-form.cjs.entry.js +1 -1
- package/dist/cjs/ez-number-input.cjs.entry.js +11 -58
- package/dist/cjs/ez-popover.cjs.entry.js +1 -1
- package/dist/cjs/ez-time-input.cjs.entry.js +2 -2
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/{index-262d703b.js → index-40ebb2be.js} +0 -20
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ez-application/ez-application.js +0 -2
- package/dist/collection/components/ez-calendar/ez-calendar.js +7 -2
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +0 -5
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +4 -0
- package/dist/collection/components/ez-date-input/ez-date-input.css +2 -2
- package/dist/collection/components/ez-date-input/ez-date-input.js +1 -1
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.css +0 -5
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +23 -34
- package/dist/collection/components/ez-number-input/ez-number-input.css +0 -9
- package/dist/collection/components/ez-number-input/ez-number-input.js +20 -115
- package/dist/collection/components/ez-search/ez-search.js +6 -1
- package/dist/collection/utils/CSSVarsUtils.js +6 -6
- package/dist/custom-elements/index.js +147 -214
- package/dist/esm/CSSVarsUtils-aeee9825.js +16 -0
- package/dist/esm/ez-application.entry.js +0 -2
- package/dist/esm/ez-button_11.entry.js +1 -1
- package/dist/esm/ez-calendar.entry.js +8 -3
- package/dist/esm/ez-collapsible-box_6.entry.js +8 -4
- package/dist/esm/ez-combo-box.entry.js +6 -2
- package/dist/esm/ez-date-time-input.entry.js +25 -36
- package/dist/esm/ez-form.entry.js +1 -1
- package/dist/esm/ez-number-input.entry.js +12 -59
- package/dist/esm/ez-popover.entry.js +1 -1
- package/dist/esm/ez-time-input.entry.js +2 -2
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/{index-cfd5e193.js → index-ca8700cb.js} +1 -20
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-14bee38e.entry.js +1 -0
- package/dist/ezui/p-3a09c678.entry.js +1 -0
- package/dist/ezui/{p-e7ee2836.entry.js → p-43c15c94.entry.js} +1 -1
- package/dist/ezui/p-72ff3c95.entry.js +1 -0
- package/dist/ezui/{p-1ea8187e.entry.js → p-74f978db.entry.js} +1 -1
- package/dist/ezui/p-8b099482.js +1 -0
- package/dist/ezui/{p-7ef97c5f.entry.js → p-8d6cdd3e.entry.js} +1 -1
- package/dist/ezui/p-a0331955.entry.js +1 -0
- package/dist/ezui/p-a15093e3.entry.js +1 -0
- package/dist/ezui/p-a19f2af3.entry.js +1 -0
- package/dist/ezui/p-da929c01.js +1 -0
- package/dist/ezui/{p-8c51a6aa.entry.js → p-f3c5f27e.entry.js} +1 -1
- package/dist/types/components/ez-application/ez-application.d.ts +0 -2
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +1 -0
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +3 -20
- package/dist/types/components/ez-search/ez-search.d.ts +2 -0
- package/dist/types/components.d.ts +3 -19
- package/dist/types/utils/CSSVarsUtils.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cjs/CSSVarsUtils-f8827674.js +0 -18
- package/dist/esm/CSSVarsUtils-e0128b01.js +0 -16
- package/dist/ezui/p-45689464.entry.js +0 -1
- package/dist/ezui/p-57291f97.entry.js +0 -1
- package/dist/ezui/p-69416bec.entry.js +0 -1
- package/dist/ezui/p-a223eed8.entry.js +0 -1
- package/dist/ezui/p-b36308e7.js +0 -1
- package/dist/ezui/p-c0af195b.entry.js +0 -1
- package/dist/ezui/p-d1889704.js +0 -1
- package/dist/ezui/p-f7b835cf.entry.js +0 -1
|
@@ -83,10 +83,15 @@ export class EzCalendar {
|
|
|
83
83
|
}
|
|
84
84
|
selectDate(d) {
|
|
85
85
|
let newDate = d;
|
|
86
|
-
if (this.value) {
|
|
86
|
+
if (this.value && (this.time || this.showSeconds)) {
|
|
87
87
|
newDate.setHours(this.value.getHours());
|
|
88
88
|
newDate.setMinutes(this.value.getMinutes());
|
|
89
|
-
|
|
89
|
+
if (this.showSeconds) {
|
|
90
|
+
newDate.setSeconds(this.value.getSeconds());
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
newDate.setSeconds(0);
|
|
94
|
+
}
|
|
90
95
|
}
|
|
91
96
|
this.value = newDate;
|
|
92
97
|
this.ezChange.emit();
|
|
@@ -89,11 +89,6 @@
|
|
|
89
89
|
width: var(--ez-combo-box--width);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
ez-text-input {
|
|
93
|
-
--ez-text-input__input--background-color: var(--ez-combo-box__input--background-color, #FFFFFF);
|
|
94
|
-
--ez-text-input__input--border-color: var(--ez-combo-box__input--border-color, #DCE0E8);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
92
|
.list-container {
|
|
98
93
|
position: relative;
|
|
99
94
|
width: 100%;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FloatingManager } from "@sankhyalabs/core";
|
|
2
2
|
import { Component, h, Host, Prop, State, Event, Element, Watch } from "@stencil/core";
|
|
3
|
+
import CSSVarsUtils from "../../utils/CSSVarsUtils";
|
|
3
4
|
export class EzComboBox {
|
|
4
5
|
constructor() {
|
|
5
6
|
/**
|
|
@@ -177,6 +178,9 @@ export class EzComboBox {
|
|
|
177
178
|
this._optionsList.remove();
|
|
178
179
|
}
|
|
179
180
|
}
|
|
181
|
+
componentDidLoad() {
|
|
182
|
+
CSSVarsUtils.applyVarsTextInput(this.el, this._inputElement);
|
|
183
|
+
}
|
|
180
184
|
//---------------------------------------------
|
|
181
185
|
// Event handlers
|
|
182
186
|
//---------------------------------------------
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
--ez-date-input__calendar-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="15px"><path d="M 3.171875,5.25 C 2.6485088,5.25 2.21875,5.6797588 2.21875,6.203125 2.21875,6.7264912 2.6485088,7.15625 3.171875,7.15625 3.6952412,7.15625 4.125,6.7264912 4.125,6.203125 4.125,5.6797588 3.6952412,5.25 3.171875,5.25 Z m 2.875,0 C 5.5235088,5.25 5.09375,5.6797588 5.09375,6.203125 5.09375,6.7264912 5.5235088,7.15625 6.046875,7.15625 6.5702412,7.15625 7,6.7264912 7,6.203125 7,5.6797588 6.5702412,5.25 6.046875,5.25 Z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.9511719,-0.4297588 0.9511719,-0.953125 C 9.8730469,5.6797588 9.4452412,5.25 8.921875,5.25 Z m 2.873047,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.953125 0.953125,0.953125 0.523366,0 0.953125,-0.4297588 0.953125,-0.953125 C 12.748047,5.6797588 12.318288,5.25 11.794922,5.25 Z M 3.171875,8.1230469 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 0.5233662,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 C 6.5702412,10.029297 7,9.5995381 7,9.0761719 7,8.5528057 6.5702412,8.1230469 6.046875,8.1230469 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297587,0.9531251 0.953125,0.9531251 0.5233661,0 0.9531249,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.9531251 0.953125,0.9531251 0.523367,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.171875,10.998047 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 C 6.5702412,12.904297 7,12.474538 7,11.951172 7,11.427806 6.5702412,10.998047 6.046875,10.998047 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297587,0.953125 0.953125,0.953125 0.5233661,0 0.9531249,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.429759,0.953125 0.953125,0.953125 0.523367,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.5,0 c -0.554,0 -1,0.446 -1,1 v 0.050781 C 1.0853217,1.2909766 0,2.5186658 0,4 v 9 c 0,1.652487 1.3475134,3 3,3 h 9 c 1.652487,0 3,-1.347513 3,-3 V 4 C 15,2.5186658 13.914678,1.2909766 12.5,1.0507812 V 1 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 C 4.5,0.446 4.054,0 3.5,0 Z m 1,2.0996094 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 v -0.640625 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 2.1738281 C 13.311725,2.3905225 13.900391,3.11278 13.900391,4 v 9 c 0,1.062113 -0.838278,1.900391 -1.900391,1.900391 H 3 C 1.9378864,14.900391 1.0996094,14.062113 1.0996094,13 V 4 C 1.0996094,3.11278 1.6882747,2.3905225 2.5,2.1738281 v 0.5664063 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 z"/></svg>');
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/*.text-input {
|
|
13
13
|
--ez-text-input__input--background-color: inherit;
|
|
14
14
|
--ez-text-input__input--border-color: inherit;
|
|
15
|
-
}
|
|
15
|
+
}*/
|
|
16
16
|
|
|
17
17
|
.btn-open-cal {
|
|
18
18
|
outline: none;
|
|
@@ -22,7 +22,7 @@ export class EzDateInput {
|
|
|
22
22
|
changeValue(newValue) {
|
|
23
23
|
newValue = newValue == null ? null : DateUtils.clearTime(newValue);
|
|
24
24
|
this._textInput.errorMessage = "";
|
|
25
|
-
if (
|
|
25
|
+
if (newValue !== this.value) {
|
|
26
26
|
this.value = newValue;
|
|
27
27
|
this.ezChange.emit();
|
|
28
28
|
}
|
|
@@ -9,11 +9,6 @@
|
|
|
9
9
|
--ez-date-input__calendar-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="15px"><path d="M 3.171875,5.25 C 2.6485088,5.25 2.21875,5.6797588 2.21875,6.203125 2.21875,6.7264912 2.6485088,7.15625 3.171875,7.15625 3.6952412,7.15625 4.125,6.7264912 4.125,6.203125 4.125,5.6797588 3.6952412,5.25 3.171875,5.25 Z m 2.875,0 C 5.5235088,5.25 5.09375,5.6797588 5.09375,6.203125 5.09375,6.7264912 5.5235088,7.15625 6.046875,7.15625 6.5702412,7.15625 7,6.7264912 7,6.203125 7,5.6797588 6.5702412,5.25 6.046875,5.25 Z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.9511719,-0.4297588 0.9511719,-0.953125 C 9.8730469,5.6797588 9.4452412,5.25 8.921875,5.25 Z m 2.873047,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.953125 0.953125,0.953125 0.523366,0 0.953125,-0.4297588 0.953125,-0.953125 C 12.748047,5.6797588 12.318288,5.25 11.794922,5.25 Z M 3.171875,8.1230469 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 0.5233662,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 C 6.5702412,10.029297 7,9.5995381 7,9.0761719 7,8.5528057 6.5702412,8.1230469 6.046875,8.1230469 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297587,0.9531251 0.953125,0.9531251 0.5233661,0 0.9531249,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.9531251 0.953125,0.9531251 0.523367,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.171875,10.998047 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 C 6.5702412,12.904297 7,12.474538 7,11.951172 7,11.427806 6.5702412,10.998047 6.046875,10.998047 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297587,0.953125 0.953125,0.953125 0.5233661,0 0.9531249,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.429759,0.953125 0.953125,0.953125 0.523367,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.5,0 c -0.554,0 -1,0.446 -1,1 v 0.050781 C 1.0853217,1.2909766 0,2.5186658 0,4 v 9 c 0,1.652487 1.3475134,3 3,3 h 9 c 1.652487,0 3,-1.347513 3,-3 V 4 C 15,2.5186658 13.914678,1.2909766 12.5,1.0507812 V 1 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 C 4.5,0.446 4.054,0 3.5,0 Z m 1,2.0996094 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 v -0.640625 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 2.1738281 C 13.311725,2.3905225 13.900391,3.11278 13.900391,4 v 9 c 0,1.062113 -0.838278,1.900391 -1.900391,1.900391 H 3 C 1.9378864,14.900391 1.0996094,14.062113 1.0996094,13 V 4 C 1.0996094,3.11278 1.6882747,2.3905225 2.5,2.1738281 v 0.5664063 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 z"/></svg>');
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
.text-input {
|
|
13
|
-
--ez-text-input__input--background-color: inherit;
|
|
14
|
-
--ez-text-input__input--border-color: inherit;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
12
|
.btn-open-cal {
|
|
18
13
|
outline: none;
|
|
19
14
|
border: none;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component, Element, Host, h, Prop, Watch, Event } from '@stencil/core';
|
|
2
|
-
import { DateUtils } from '@sankhyalabs/core';
|
|
2
|
+
import { DateUtils, TimeFormatter } from '@sankhyalabs/core';
|
|
3
3
|
import CSSVarsUtils from '../../utils/CSSVarsUtils';
|
|
4
4
|
export class EzDateTimeInput {
|
|
5
5
|
constructor() {
|
|
@@ -30,29 +30,18 @@ export class EzDateTimeInput {
|
|
|
30
30
|
}
|
|
31
31
|
else if (ev.shiftKey && ev.key === "Tab") {
|
|
32
32
|
if (input.selectionStart > 0) {
|
|
33
|
-
let selectIni = input.value.lastIndexOf("
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
selectFin = selectFin === -1 ? input.value.lastIndexOf(" ", selectIni - 1) : selectFin;
|
|
39
|
-
selectFin = selectFin === -1 ? input.value.lastIndexOf("/", selectIni - 1) : selectFin;
|
|
40
|
-
selectFin = selectFin === -1 ? 0 : selectFin + 1;
|
|
41
|
-
input.setSelectionRange(selectFin, selectIni);
|
|
42
|
-
ev.preventDefault();
|
|
33
|
+
let selectIni = input.value.lastIndexOf(" ", input.selectionStart);
|
|
34
|
+
if (selectIni !== -1) {
|
|
35
|
+
input.setSelectionRange(0, selectIni);
|
|
36
|
+
ev.preventDefault();
|
|
37
|
+
}
|
|
43
38
|
}
|
|
44
39
|
}
|
|
45
40
|
else if (ev.key === "Tab") {
|
|
46
41
|
if (input.value.length !== input.selectionEnd) {
|
|
47
|
-
let selectIni = input.value.indexOf("
|
|
48
|
-
selectIni = selectIni === -1 ? input.value.indexOf(" ", input.selectionEnd) : selectIni;
|
|
49
|
-
selectIni = selectIni === -1 ? input.value.indexOf(":", input.selectionEnd) : selectIni;
|
|
42
|
+
let selectIni = input.value.indexOf(" ", input.selectionEnd);
|
|
50
43
|
selectIni = selectIni === -1 ? input.selectionEnd : selectIni + 1;
|
|
51
|
-
|
|
52
|
-
selectFin = selectFin === -1 ? input.value.indexOf(" ", selectIni) : selectFin;
|
|
53
|
-
selectFin = selectFin === -1 ? input.value.indexOf(":", selectIni) : selectFin;
|
|
54
|
-
selectFin = selectFin === -1 ? input.value.length : selectFin;
|
|
55
|
-
input.setSelectionRange(selectIni, selectFin);
|
|
44
|
+
input.setSelectionRange(selectIni, input.value.length);
|
|
56
45
|
ev.preventDefault();
|
|
57
46
|
}
|
|
58
47
|
}
|
|
@@ -60,27 +49,22 @@ export class EzDateTimeInput {
|
|
|
60
49
|
onFocused() {
|
|
61
50
|
const input = this._textInput.shadowRoot.querySelector('input');
|
|
62
51
|
if (input.selectionStart !== input.selectionEnd) {
|
|
63
|
-
let
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
selectFin = selectFin === -1 ? input.value.length : selectFin;
|
|
67
|
-
input.setSelectionRange(0, selectFin);
|
|
52
|
+
let selectIni = input.value.indexOf(" ", input.selectionStart);
|
|
53
|
+
selectIni = selectIni === -1 ? input.value.length : selectIni;
|
|
54
|
+
input.setSelectionRange(0, selectIni);
|
|
68
55
|
}
|
|
69
56
|
}
|
|
70
57
|
onClicked() {
|
|
71
58
|
const input = this._textInput.shadowRoot.querySelector('input');
|
|
72
|
-
let selectIni = input.value.
|
|
73
|
-
selectIni = selectIni === -1 ?
|
|
74
|
-
selectIni = selectIni
|
|
75
|
-
let selectFin = input.value.
|
|
76
|
-
|
|
77
|
-
selectFin = selectFin === -1 ? input.value.lastIndexOf("/", selectIni - 1) : selectFin;
|
|
78
|
-
selectFin = selectFin === -1 ? 0 : selectFin + 1;
|
|
79
|
-
input.setSelectionRange(selectFin, selectIni);
|
|
59
|
+
let selectIni = input.value.lastIndexOf(" ", input.selectionEnd);
|
|
60
|
+
selectIni = selectIni === -1 ? 0 : selectIni + 1;
|
|
61
|
+
selectIni = selectIni > input.selectionEnd ? 0 : selectIni;
|
|
62
|
+
let selectFin = selectIni === 0 ? input.value.indexOf(" ") : input.value.length;
|
|
63
|
+
input.setSelectionRange(selectIni, selectFin);
|
|
80
64
|
}
|
|
81
65
|
changeValue(newValue) {
|
|
82
66
|
this._textInput.errorMessage = "";
|
|
83
|
-
if (
|
|
67
|
+
if (newValue !== this.value) {
|
|
84
68
|
this.value = newValue;
|
|
85
69
|
this.ezChange.emit();
|
|
86
70
|
}
|
|
@@ -92,7 +76,12 @@ export class EzDateTimeInput {
|
|
|
92
76
|
}
|
|
93
77
|
parseDate() {
|
|
94
78
|
const strValue = this._textInput.value;
|
|
95
|
-
const
|
|
79
|
+
const partsDateTime = (strValue && strValue.length > 0) ? strValue.split(" ") : [];
|
|
80
|
+
const onlyDate = partsDateTime.length > 0 ? partsDateTime[0] : strValue;
|
|
81
|
+
const onlyTime = partsDateTime[1] ? partsDateTime[1] : "";
|
|
82
|
+
const parsedTime = TimeFormatter.prepareValue(onlyTime, this.showSeconds);
|
|
83
|
+
const strDateTime = onlyDate + (parsedTime && " " + parsedTime);
|
|
84
|
+
const parsedDate = DateUtils.strToDate(strDateTime);
|
|
96
85
|
if (parsedDate || !strValue) {
|
|
97
86
|
if (this.value === parsedDate) {
|
|
98
87
|
this.changeValue(this.value);
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
:host {
|
|
2
2
|
display: block;
|
|
3
3
|
width: 100%;
|
|
4
|
-
/*@doc Define a cor de fundo do input.*/
|
|
5
|
-
--ez-number-input__input--background-color: var(--background--medium, #e0e0e0);
|
|
6
|
-
/*@doc Define a cor da borda do input.*/
|
|
7
|
-
--ez-number-input__input--border-color: var(--ez-number-input__input--background-color);
|
|
8
4
|
}
|
|
9
|
-
|
|
10
|
-
.text-input {
|
|
11
|
-
--ez-number-input__input--background-color: inherit;
|
|
12
|
-
--ez-number-input__input--border-color: inherit;
|
|
13
|
-
}
|
|
@@ -1,22 +1,12 @@
|
|
|
1
1
|
import { NumberUtils } from "@sankhyalabs/core";
|
|
2
|
-
import { Component, h, Event, Prop, Watch,
|
|
2
|
+
import { Component, h, Event, Prop, Watch, Element } from "@stencil/core";
|
|
3
|
+
import CSSVarsUtils from "../../utils/CSSVarsUtils";
|
|
3
4
|
export class EzNumberInput {
|
|
4
5
|
constructor() {
|
|
5
6
|
/**
|
|
6
7
|
* Deixa o campo disponível ou não para uso.
|
|
7
8
|
*/
|
|
8
9
|
this.enabled = true;
|
|
9
|
-
/**
|
|
10
|
-
* Configura o alinhamento do texto.
|
|
11
|
-
*/
|
|
12
|
-
this.textleft = false;
|
|
13
|
-
/**
|
|
14
|
-
* Opção de configurar a transformação de string to number entre formatação pt-BR e en-US
|
|
15
|
-
* (formatação de ENTRADA e SAÍDA do componente: pt-BR="###.###,##" en-US="###,###.##"; Default: "pt-BR")
|
|
16
|
-
* Qualquer outro valor que não seja "en-US", adotará a formatação "pt-BR"
|
|
17
|
-
* Não é case sensitive
|
|
18
|
-
*/
|
|
19
|
-
this.formatNumber = "PT-BR";
|
|
20
10
|
}
|
|
21
11
|
setLabel() {
|
|
22
12
|
this._textInput.label = this.label;
|
|
@@ -29,22 +19,11 @@ export class EzNumberInput {
|
|
|
29
19
|
this._textInput.value = this.getTextValue(this.value);
|
|
30
20
|
}
|
|
31
21
|
}
|
|
32
|
-
onPrecisionChanged(newPrecision) {
|
|
33
|
-
if (isNaN(newPrecision)) {
|
|
34
|
-
this.precision = 0;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
onPrettyPrecisionChanged(newPrettyPrecision) {
|
|
38
|
-
if (isNaN(newPrettyPrecision)) {
|
|
39
|
-
this.prettyPrecision = 0;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
22
|
changeValue(newValue) {
|
|
43
23
|
this.errorMessage = "";
|
|
44
24
|
if (newValue && newValue !== this.value) {
|
|
45
25
|
this.value = newValue;
|
|
46
|
-
this.
|
|
47
|
-
this.ezChange.emit();
|
|
26
|
+
this.ezChange.emit(this.value);
|
|
48
27
|
}
|
|
49
28
|
}
|
|
50
29
|
parseNumber() {
|
|
@@ -63,45 +42,16 @@ export class EzNumberInput {
|
|
|
63
42
|
}
|
|
64
43
|
}
|
|
65
44
|
getTextValue(value) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
this.errorMessage = "O valor digitado não é um número válido";
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
return this.formatNumber.toUpperCase() !== "EN-US" ? NumberUtils.format(value.toString(), this.precision, this.prettyPrecision) : NumberUtils.changeFormat(NumberUtils.format(value.toString(), this.precision, this.prettyPrecision));
|
|
45
|
+
if (value) {
|
|
46
|
+
return this.precision > 0 ? NumberUtils.format(value.toString(), Number(this.precision), Number(this.prettyPrecision)) : value.toString();
|
|
72
47
|
}
|
|
73
|
-
return
|
|
48
|
+
return null;
|
|
74
49
|
}
|
|
75
50
|
componentDidLoad() {
|
|
76
|
-
|
|
77
|
-
this._textInput.shadowRoot.querySelector('input').classList.add('text--right');
|
|
78
|
-
}
|
|
79
|
-
let rightItem;
|
|
80
|
-
let letfItem;
|
|
81
|
-
for (const key in this._hostElement.children) {
|
|
82
|
-
if (Object.prototype.hasOwnProperty.call(this._hostElement.children, key)) {
|
|
83
|
-
const element = this._hostElement.children[key];
|
|
84
|
-
if (element.getAttribute('slot') === 'rightIcon') {
|
|
85
|
-
rightItem = element;
|
|
86
|
-
}
|
|
87
|
-
else if (element.getAttribute('slot') === 'leftIcon') {
|
|
88
|
-
letfItem = element;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
this._leftSlotItem = letfItem;
|
|
93
|
-
this._rightSlotItem = rightItem;
|
|
94
|
-
this.slotElement;
|
|
95
|
-
}
|
|
96
|
-
componentWillLoad() {
|
|
97
|
-
this.onPrecisionChanged(this.precision);
|
|
98
|
-
this.onPrettyPrecisionChanged(this.prettyPrecision);
|
|
51
|
+
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
99
52
|
}
|
|
100
53
|
render() {
|
|
101
|
-
return (h(
|
|
102
|
-
h("ez-text-input", { class: "text-input", ref: elem => this._textInput = elem, onBlur: () => this.parseNumber(), label: this.label, onEzChange: event => event.stopPropagation(), value: this.getTextValue(this.value), restrict: "0123456789-,.", enabled: this.enabled, errorMessage: this.errorMessage },
|
|
103
|
-
this._rightSlotItem ? h("slot", { name: "rightIcon", slot: "rightIcon" }) : undefined,
|
|
104
|
-
this._leftSlotItem ? h("slot", { name: "leftIcon", slot: "leftIcon" }) : undefined)));
|
|
54
|
+
return (h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseNumber(), label: this.label, onEzChange: event => event.stopPropagation(), value: this.getTextValue(this.value), restrict: this.precision > 0 ? "0123456789-,." : "0123456789-", enabled: this.enabled, errorMessage: this.errorMessage }));
|
|
105
55
|
}
|
|
106
56
|
static get is() { return "ez-number-input"; }
|
|
107
57
|
static get encapsulation() { return "shadow"; }
|
|
@@ -127,14 +77,14 @@ export class EzNumberInput {
|
|
|
127
77
|
"text": "T\u00EDtulo do campo"
|
|
128
78
|
},
|
|
129
79
|
"attribute": "label",
|
|
130
|
-
"reflect":
|
|
80
|
+
"reflect": false
|
|
131
81
|
},
|
|
132
82
|
"value": {
|
|
133
|
-
"type": "
|
|
83
|
+
"type": "number",
|
|
134
84
|
"mutable": true,
|
|
135
85
|
"complexType": {
|
|
136
|
-
"original": "
|
|
137
|
-
"resolved": "number
|
|
86
|
+
"original": "number",
|
|
87
|
+
"resolved": "number",
|
|
138
88
|
"references": {}
|
|
139
89
|
},
|
|
140
90
|
"required": false,
|
|
@@ -161,7 +111,7 @@ export class EzNumberInput {
|
|
|
161
111
|
"text": "Deixa o campo dispon\u00EDvel ou n\u00E3o para uso."
|
|
162
112
|
},
|
|
163
113
|
"attribute": "enabled",
|
|
164
|
-
"reflect":
|
|
114
|
+
"reflect": false,
|
|
165
115
|
"defaultValue": "true"
|
|
166
116
|
},
|
|
167
117
|
"errorMessage": {
|
|
@@ -183,7 +133,7 @@ export class EzNumberInput {
|
|
|
183
133
|
},
|
|
184
134
|
"precision": {
|
|
185
135
|
"type": "number",
|
|
186
|
-
"mutable":
|
|
136
|
+
"mutable": false,
|
|
187
137
|
"complexType": {
|
|
188
138
|
"original": "number",
|
|
189
139
|
"resolved": "number",
|
|
@@ -196,11 +146,11 @@ export class EzNumberInput {
|
|
|
196
146
|
"text": "Precis\u00E3o decimal, ou seja, quantas casas decimais podem ser exibidas. Caso a\nquantidade de casas decimais do valor seja maior que precision, haver\u00E1 arredondamento"
|
|
197
147
|
},
|
|
198
148
|
"attribute": "precision",
|
|
199
|
-
"reflect":
|
|
149
|
+
"reflect": false
|
|
200
150
|
},
|
|
201
151
|
"prettyPrecision": {
|
|
202
152
|
"type": "number",
|
|
203
|
-
"mutable":
|
|
153
|
+
"mutable": false,
|
|
204
154
|
"complexType": {
|
|
205
155
|
"original": "number",
|
|
206
156
|
"resolved": "number",
|
|
@@ -213,49 +163,9 @@ export class EzNumberInput {
|
|
|
213
163
|
"text": "Esse atributo determina qual \u00E9 o n\u00FAmero m\u00EDnimo de casas depois da v\u00EDrgula.\nExemplo: Digamos que a precision seja igual a 4, assim qualquer n\u00FAmero ser\u00E1 \nrepresentado com 4 casas decimais mesmo que iguais a zero: 1,0100.\nSe prettiprecision igual a 2, como n\u00E3o h\u00E1 necessidade de mais de duas casas decimais\no valor exibido ser\u00E1 1,01. Por outro lado, at\u00E9 a quarta casa n\u00E3o haver\u00E1 arredondamento\n(1,1234 = 1,1234) mas a partir da quinta casa sim (1,12345 = 1,1235)."
|
|
214
164
|
},
|
|
215
165
|
"attribute": "pretty-precision",
|
|
216
|
-
"reflect":
|
|
217
|
-
},
|
|
218
|
-
"textleft": {
|
|
219
|
-
"type": "boolean",
|
|
220
|
-
"mutable": false,
|
|
221
|
-
"complexType": {
|
|
222
|
-
"original": "boolean",
|
|
223
|
-
"resolved": "boolean",
|
|
224
|
-
"references": {}
|
|
225
|
-
},
|
|
226
|
-
"required": false,
|
|
227
|
-
"optional": false,
|
|
228
|
-
"docs": {
|
|
229
|
-
"tags": [],
|
|
230
|
-
"text": "Configura o alinhamento do texto."
|
|
231
|
-
},
|
|
232
|
-
"attribute": "textleft",
|
|
233
|
-
"reflect": true,
|
|
234
|
-
"defaultValue": "false"
|
|
235
|
-
},
|
|
236
|
-
"formatNumber": {
|
|
237
|
-
"type": "string",
|
|
238
|
-
"mutable": false,
|
|
239
|
-
"complexType": {
|
|
240
|
-
"original": "string",
|
|
241
|
-
"resolved": "string",
|
|
242
|
-
"references": {}
|
|
243
|
-
},
|
|
244
|
-
"required": false,
|
|
245
|
-
"optional": false,
|
|
246
|
-
"docs": {
|
|
247
|
-
"tags": [],
|
|
248
|
-
"text": "Op\u00E7\u00E3o de configurar a transforma\u00E7\u00E3o de string to number entre formata\u00E7\u00E3o pt-BR e en-US\n(formata\u00E7\u00E3o de ENTRADA e SA\u00CDDA do componente: pt-BR=\"###.###,##\" en-US=\"###,###.##\"; Default: \"pt-BR\")\nQualquer outro valor que n\u00E3o seja \"en-US\", adotar\u00E1 a formata\u00E7\u00E3o \"pt-BR\"\nN\u00E3o \u00E9 case sensitive"
|
|
249
|
-
},
|
|
250
|
-
"attribute": "format-number",
|
|
251
|
-
"reflect": true,
|
|
252
|
-
"defaultValue": "\"PT-BR\""
|
|
166
|
+
"reflect": false
|
|
253
167
|
}
|
|
254
168
|
}; }
|
|
255
|
-
static get states() { return {
|
|
256
|
-
"_leftSlotItem": {},
|
|
257
|
-
"_rightSlotItem": {}
|
|
258
|
-
}; }
|
|
259
169
|
static get events() { return [{
|
|
260
170
|
"method": "ezChange",
|
|
261
171
|
"name": "ezChange",
|
|
@@ -267,11 +177,12 @@ export class EzNumberInput {
|
|
|
267
177
|
"text": "Evento disparado quando o estado do componente \u00E9 alterado (onEzChange)."
|
|
268
178
|
},
|
|
269
179
|
"complexType": {
|
|
270
|
-
"original": "
|
|
271
|
-
"resolved": "
|
|
180
|
+
"original": "number",
|
|
181
|
+
"resolved": "number",
|
|
272
182
|
"references": {}
|
|
273
183
|
}
|
|
274
184
|
}]; }
|
|
185
|
+
static get elementRef() { return "_elem"; }
|
|
275
186
|
static get watchers() { return [{
|
|
276
187
|
"propName": "label",
|
|
277
188
|
"methodName": "setLabel"
|
|
@@ -281,11 +192,5 @@ export class EzNumberInput {
|
|
|
281
192
|
}, {
|
|
282
193
|
"propName": "value",
|
|
283
194
|
"methodName": "applyValueToInput"
|
|
284
|
-
}, {
|
|
285
|
-
"propName": "precision",
|
|
286
|
-
"methodName": "onPrecisionChanged"
|
|
287
|
-
}, {
|
|
288
|
-
"propName": "prettyPrecision",
|
|
289
|
-
"methodName": "onPrettyPrecisionChanged"
|
|
290
195
|
}]; }
|
|
291
196
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Component, Event, h, Prop, Watch } from "@stencil/core";
|
|
1
|
+
import { Component, Event, h, Prop, Watch, Element } from "@stencil/core";
|
|
2
|
+
import CSSVarsUtils from "../../utils/CSSVarsUtils";
|
|
2
3
|
export class EzSearch {
|
|
3
4
|
constructor() {
|
|
4
5
|
/**
|
|
@@ -24,6 +25,9 @@ export class EzSearch {
|
|
|
24
25
|
this.value = evt.detail;
|
|
25
26
|
this.ezChange.emit(evt.detail);
|
|
26
27
|
}
|
|
28
|
+
componentDidLoad() {
|
|
29
|
+
CSSVarsUtils.applyVarsTextInput(this._elem, this._comboElement);
|
|
30
|
+
}
|
|
27
31
|
render() {
|
|
28
32
|
return (h("ez-combo-box", { ref: elem => this._comboElement = elem, value: this.value, label: this.label, enabled: this.enabled, errorMessage: this.errorMessage, optionLoader: this.optionLoader, searchMode: true, onEzChange: evt => this.onComboChange(evt), showSelectedValue: this.showSelectedValue, showOptionValue: this.showOptionValue }));
|
|
29
33
|
}
|
|
@@ -203,6 +207,7 @@ export class EzSearch {
|
|
|
203
207
|
"references": {}
|
|
204
208
|
}
|
|
205
209
|
}]; }
|
|
210
|
+
static get elementRef() { return "_elem"; }
|
|
206
211
|
static get watchers() { return [{
|
|
207
212
|
"propName": "value",
|
|
208
213
|
"methodName": "updateValue"
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export default class CSSVarsUtils {
|
|
2
|
-
static applyVarsTextInput(host,
|
|
3
|
-
if (
|
|
4
|
-
CSSVarsUtils.applyIfExists(host,
|
|
5
|
-
CSSVarsUtils.applyIfExists(host,
|
|
2
|
+
static applyVarsTextInput(host, child) {
|
|
3
|
+
if (child) {
|
|
4
|
+
CSSVarsUtils.applyIfExists(host, child, '--ez-text-input__input--background-color');
|
|
5
|
+
CSSVarsUtils.applyIfExists(host, child, '--ez-text-input__input--border-color');
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
static applyIfExists(host,
|
|
8
|
+
static applyIfExists(host, element, varName) {
|
|
9
9
|
const prop = getComputedStyle(host).getPropertyValue(varName);
|
|
10
10
|
if (prop) {
|
|
11
|
-
|
|
11
|
+
element.style.setProperty(varName, prop);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
}
|