@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
|
@@ -574,6 +574,45 @@ let EzCollapsibleBox$1 = class extends HTMLElement$1 {
|
|
|
574
574
|
static get style() { return ezCollapsibleBoxCss; }
|
|
575
575
|
};
|
|
576
576
|
|
|
577
|
+
class ApplicationUtils {
|
|
578
|
+
static async showDialog(title, message, icon = null, confirm, critical = false, options) {
|
|
579
|
+
if (options) {
|
|
580
|
+
options = Object.assign(Object.assign({}, ApplicationUtils.defaultMessageOptions), options);
|
|
581
|
+
}
|
|
582
|
+
return new Promise(resolve => {
|
|
583
|
+
let dialog = document.querySelector("ez-dialog");
|
|
584
|
+
if (!dialog) {
|
|
585
|
+
dialog = document.createElement("ez-dialog");
|
|
586
|
+
window.document.body.appendChild(dialog);
|
|
587
|
+
}
|
|
588
|
+
dialog.show(title, message, critical, confirm, icon, options.labelCancel, options.labelConfirm, options.btnConfirmDanger).then(ok => resolve(ok));
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
static async alert(title, message, icon = null, options = ApplicationUtils.defaultMessageOptions) {
|
|
592
|
+
return ApplicationUtils.showDialog(title, message, icon, false, false, options);
|
|
593
|
+
}
|
|
594
|
+
static async error(title, message, icon = null, options = ApplicationUtils.defaultMessageOptions) {
|
|
595
|
+
return ApplicationUtils.showDialog(title, message, icon, false, true, options);
|
|
596
|
+
}
|
|
597
|
+
static async confirm(title, message, icon = null, critical = false, options = ApplicationUtils.defaultMessageOptions) {
|
|
598
|
+
return ApplicationUtils.showDialog(title, message, icon, true, critical, options);
|
|
599
|
+
}
|
|
600
|
+
static async info(message, options = ApplicationUtils.defaultMessageOptions) {
|
|
601
|
+
let toast = document.querySelector("ez-toast");
|
|
602
|
+
if (!toast) {
|
|
603
|
+
toast = document.createElement("ez-toast");
|
|
604
|
+
window.document.body.appendChild(toast);
|
|
605
|
+
}
|
|
606
|
+
toast.show(message, 4000, false, options.canClose);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
ApplicationUtils.defaultMessageOptions = {
|
|
610
|
+
canClose: true,
|
|
611
|
+
labelCancel: 'Não',
|
|
612
|
+
labelConfirm: 'Sim',
|
|
613
|
+
btnConfirmDanger: false
|
|
614
|
+
};
|
|
615
|
+
|
|
577
616
|
class CSSVarsUtils {
|
|
578
617
|
static applyVarsTextInput(host, child) {
|
|
579
618
|
if (child) {
|
|
@@ -592,7 +631,7 @@ class CSSVarsUtils {
|
|
|
592
631
|
}
|
|
593
632
|
}
|
|
594
633
|
|
|
595
|
-
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(--
|
|
634
|
+
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)}}";
|
|
596
635
|
|
|
597
636
|
let EzComboBox$1 = class extends HTMLElement$1 {
|
|
598
637
|
constructor() {
|
|
@@ -600,9 +639,12 @@ let EzComboBox$1 = class extends HTMLElement$1 {
|
|
|
600
639
|
this.__registerHost();
|
|
601
640
|
this.__attachShadow();
|
|
602
641
|
this.ezChange = createEvent(this, "ezChange", 7);
|
|
642
|
+
this._changeDeboucingTimeout = null;
|
|
603
643
|
this._limitCharsToSearch = 3;
|
|
604
644
|
this._deboucingTime = 300;
|
|
605
645
|
this._maxWidthValue = 0;
|
|
646
|
+
this._tabPressed = false;
|
|
647
|
+
this._textEmptyList = "Nenhum resultado encontrado";
|
|
606
648
|
this._startLoading = false;
|
|
607
649
|
this._showLoading = true;
|
|
608
650
|
/**
|
|
@@ -634,40 +676,66 @@ let EzComboBox$1 = class extends HTMLElement$1 {
|
|
|
634
676
|
*/
|
|
635
677
|
this.mode = "regular";
|
|
636
678
|
}
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
679
|
+
observeErrorMessage() {
|
|
680
|
+
var _a;
|
|
681
|
+
if (this._textInput) {
|
|
682
|
+
this._textInput.errorMessage = this.errorMessage;
|
|
683
|
+
if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
684
|
+
this.setInputValue();
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
observeValue(newValue, oldValue) {
|
|
689
|
+
var _a, _b, _c, _d;
|
|
690
|
+
if (this._textInput && newValue != oldValue) {
|
|
691
|
+
const newValueSelected = this.getSelectedOption(newValue);
|
|
692
|
+
const oldValueSelected = this.getSelectedOption(oldValue);
|
|
693
|
+
const currentValue = this.getSelectedOption(this.value);
|
|
694
|
+
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())) {
|
|
695
|
+
this.value = newValueSelected;
|
|
696
|
+
}
|
|
697
|
+
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())) {
|
|
698
|
+
this.setInputValue();
|
|
699
|
+
const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
|
|
700
|
+
this.ezChange.emit(valueEmitted);
|
|
701
|
+
}
|
|
702
|
+
this.hideOptions();
|
|
703
|
+
this._criteria = undefined;
|
|
704
|
+
this._preSelection = undefined;
|
|
705
|
+
this.updateVisibleOptions();
|
|
640
706
|
}
|
|
641
|
-
this.hideOptions();
|
|
642
|
-
this._criteria = undefined;
|
|
643
|
-
this._preSelection = undefined;
|
|
644
|
-
this.updateVisibleOptions();
|
|
645
707
|
}
|
|
646
708
|
/**
|
|
647
709
|
* Realiza o foco no componente de seleção
|
|
648
710
|
*/
|
|
649
711
|
async setFocus() {
|
|
650
|
-
this.
|
|
712
|
+
this._textInput.setFocus();
|
|
651
713
|
}
|
|
652
714
|
/**
|
|
653
715
|
* Remove o foco no componente de seleção
|
|
654
716
|
*/
|
|
655
717
|
async setBlur() {
|
|
656
|
-
this.
|
|
718
|
+
this._textInput.setBlur();
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Retorna informando se o campo está inválido (true | false)
|
|
722
|
+
*/
|
|
723
|
+
async isInvalid() {
|
|
724
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
657
725
|
}
|
|
658
726
|
getText() {
|
|
659
727
|
let text = "";
|
|
660
|
-
const
|
|
661
|
-
if (
|
|
662
|
-
text = this.showSelectedValue ? `${
|
|
728
|
+
const currentValue = this.getSelectedOption(this.value);
|
|
729
|
+
if (currentValue) {
|
|
730
|
+
text = this.showSelectedValue ? `${currentValue.value} - ${currentValue.label}` : currentValue.label;
|
|
663
731
|
}
|
|
664
732
|
return text;
|
|
665
733
|
}
|
|
666
|
-
getSelectedOption() {
|
|
667
|
-
if (typeof
|
|
668
|
-
return this._visibleOptions.find(o => o.value ===
|
|
734
|
+
getSelectedOption(value) {
|
|
735
|
+
if (typeof value === "string" || value instanceof String) {
|
|
736
|
+
return this._visibleOptions.find(o => o.value === value);
|
|
669
737
|
}
|
|
670
|
-
return
|
|
738
|
+
return value;
|
|
671
739
|
}
|
|
672
740
|
updateVisibleOptions() {
|
|
673
741
|
let opts = this._source || [];
|
|
@@ -722,7 +790,7 @@ let EzComboBox$1 = class extends HTMLElement$1 {
|
|
|
722
790
|
//FIXME: Provavelmente isso fará com que o popup abra em uma
|
|
723
791
|
//posição errada no futuro. Preferi fazer simples no começo,
|
|
724
792
|
//porque não quis onerar o text input com essa funcionalidade...
|
|
725
|
-
const top = (this.errorMessage || !this.canShowError || this.mode
|
|
793
|
+
const top = (this.errorMessage || !this.canShowError || this.mode === "slim") ? "0px" : "-19px";
|
|
726
794
|
this._floatingID = FloatingManager.float(this._listWrapper, this._listContainer, { autoClose: true, top });
|
|
727
795
|
window.requestAnimationFrame(() => {
|
|
728
796
|
this._listWrapper.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
|
|
@@ -770,6 +838,9 @@ let EzComboBox$1 = class extends HTMLElement$1 {
|
|
|
770
838
|
this.selectOption(this._visibleOptions[this._preSelection]);
|
|
771
839
|
this._preSelection = undefined;
|
|
772
840
|
}
|
|
841
|
+
else {
|
|
842
|
+
this.controlListWithOnlyOne();
|
|
843
|
+
}
|
|
773
844
|
}
|
|
774
845
|
updateSource(source) {
|
|
775
846
|
this._startLoading = false;
|
|
@@ -786,6 +857,10 @@ let EzComboBox$1 = class extends HTMLElement$1 {
|
|
|
786
857
|
if (Array.isArray(source)) {
|
|
787
858
|
this._source = source;
|
|
788
859
|
this.updateVisibleOptions();
|
|
860
|
+
if (this._tabPressed) {
|
|
861
|
+
this._tabPressed = false;
|
|
862
|
+
this.controlEmptySearch();
|
|
863
|
+
}
|
|
789
864
|
}
|
|
790
865
|
else {
|
|
791
866
|
this.selectOption(source);
|
|
@@ -798,15 +873,16 @@ let EzComboBox$1 = class extends HTMLElement$1 {
|
|
|
798
873
|
}
|
|
799
874
|
selectOption(newOption) {
|
|
800
875
|
var _a, _b;
|
|
801
|
-
const
|
|
802
|
-
if (((_a =
|
|
876
|
+
const currentValue = this.getSelectedOption(this.value);
|
|
877
|
+
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())) {
|
|
803
878
|
const adjustedOpt = !(newOption === null || newOption === void 0 ? void 0 : newOption.value) ? undefined : newOption;
|
|
804
879
|
this.value = adjustedOpt;
|
|
805
|
-
this.errorMessage = "";
|
|
806
|
-
this.ezChange.emit(this.value);
|
|
807
880
|
}
|
|
808
881
|
else {
|
|
809
|
-
this.
|
|
882
|
+
this.setInputValue();
|
|
883
|
+
}
|
|
884
|
+
if (this.searchMode) {
|
|
885
|
+
this._visibleOptions = [];
|
|
810
886
|
}
|
|
811
887
|
}
|
|
812
888
|
loadOptions(mode, argument = "") {
|
|
@@ -820,11 +896,43 @@ let EzComboBox$1 = class extends HTMLElement$1 {
|
|
|
820
896
|
}
|
|
821
897
|
}
|
|
822
898
|
cancelPreselection() {
|
|
823
|
-
if (!this.
|
|
899
|
+
if (!this._textInput.value && this.value) {
|
|
824
900
|
this.selectOption(undefined);
|
|
825
901
|
}
|
|
826
902
|
else {
|
|
827
|
-
this.
|
|
903
|
+
this.setInputValue();
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
setInputValue(clearError = true) {
|
|
907
|
+
const textValue = this.getText();
|
|
908
|
+
if ((this._textInput.value || '') !== textValue) {
|
|
909
|
+
this._textInput.value = textValue;
|
|
910
|
+
if (clearError) {
|
|
911
|
+
this.errorMessage = "";
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
clearSearch() {
|
|
916
|
+
this.value = null;
|
|
917
|
+
}
|
|
918
|
+
controlListWithOnlyOne() {
|
|
919
|
+
if (this.searchMode) {
|
|
920
|
+
const source = this._visibleOptions;
|
|
921
|
+
if ((source === null || source === void 0 ? void 0 : source.length) === 1) {
|
|
922
|
+
this.selectOption(source[0]);
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
controlEmptySearch() {
|
|
927
|
+
var _a;
|
|
928
|
+
if (this.searchMode) {
|
|
929
|
+
if (!((_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
930
|
+
this.clearSearch();
|
|
931
|
+
ApplicationUtils.info(this._textEmptyList);
|
|
932
|
+
}
|
|
933
|
+
else {
|
|
934
|
+
this.controlListWithOnlyOne();
|
|
935
|
+
}
|
|
828
936
|
}
|
|
829
937
|
}
|
|
830
938
|
//---------------------------------------------
|
|
@@ -859,7 +967,8 @@ let EzComboBox$1 = class extends HTMLElement$1 {
|
|
|
859
967
|
}
|
|
860
968
|
}
|
|
861
969
|
componentDidLoad() {
|
|
862
|
-
CSSVarsUtils.applyVarsTextInput(this.el, this.
|
|
970
|
+
CSSVarsUtils.applyVarsTextInput(this.el, this._textInput);
|
|
971
|
+
this.setInputValue(false);
|
|
863
972
|
}
|
|
864
973
|
//---------------------------------------------
|
|
865
974
|
// Event handlers
|
|
@@ -879,7 +988,7 @@ let EzComboBox$1 = class extends HTMLElement$1 {
|
|
|
879
988
|
const argument = (_a = event.target.value) === null || _a === void 0 ? void 0 : _a.trim();
|
|
880
989
|
const argumentNumber = Number(argument || undefined);
|
|
881
990
|
if (!this._criteria) {
|
|
882
|
-
this.
|
|
991
|
+
this._textInput.value = event.data || argument;
|
|
883
992
|
}
|
|
884
993
|
this._criteria = argument;
|
|
885
994
|
if (argument && (!isNaN(argumentNumber) || argument.length >= this._limitCharsToSearch)) {
|
|
@@ -911,6 +1020,7 @@ let EzComboBox$1 = class extends HTMLElement$1 {
|
|
|
911
1020
|
}
|
|
912
1021
|
}
|
|
913
1022
|
keyDownHandler(event) {
|
|
1023
|
+
this._tabPressed = false;
|
|
914
1024
|
switch (event.key) {
|
|
915
1025
|
case "ArrowDown":
|
|
916
1026
|
this.nextOption();
|
|
@@ -924,6 +1034,10 @@ let EzComboBox$1 = class extends HTMLElement$1 {
|
|
|
924
1034
|
case "Escape":
|
|
925
1035
|
this.cancelPreselection();
|
|
926
1036
|
break;
|
|
1037
|
+
case "Tab":
|
|
1038
|
+
this._tabPressed = true;
|
|
1039
|
+
this.controlListWithOnlyOne();
|
|
1040
|
+
break;
|
|
927
1041
|
}
|
|
928
1042
|
event.stopPropagation();
|
|
929
1043
|
}
|
|
@@ -931,13 +1045,17 @@ let EzComboBox$1 = class extends HTMLElement$1 {
|
|
|
931
1045
|
this.cancelPreselection();
|
|
932
1046
|
}
|
|
933
1047
|
render() {
|
|
934
|
-
|
|
935
|
-
|
|
1048
|
+
var _a;
|
|
1049
|
+
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)
|
|
1050
|
+
? h("button", { class: "btn", slot: "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.clearSearch() }, h("ez-icon", { iconName: "close" }))
|
|
1051
|
+
: 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
|
|
1052
|
+
&& h("div", { class: "message" }, !this._showLoading && h("span", { class: "message__no-result" }, this._textEmptyList), this._showLoading && h("div", { class: "message__loading" })), this.showOptionValue
|
|
936
1053
|
? h("span", { class: "item__value item__value--hidden", ref: elem => this._itemValueBasis = elem })
|
|
937
1054
|
: undefined, this._visibleOptions.length > 0 && this._visibleOptions.map((opt, index) => this.buildItem(opt, index)))))));
|
|
938
1055
|
}
|
|
939
1056
|
get el() { return this; }
|
|
940
1057
|
static get watchers() { return {
|
|
1058
|
+
"errorMessage": ["observeErrorMessage"],
|
|
941
1059
|
"value": ["observeValue"]
|
|
942
1060
|
}; }
|
|
943
1061
|
static get style() { return ezComboBoxCss; }
|
|
@@ -953,6 +1071,7 @@ let EzDateInput$1 = class extends HTMLElement$1 {
|
|
|
953
1071
|
this.ezChange = createEvent(this, "ezChange", 7);
|
|
954
1072
|
this.ezStartChange = createEvent(this, "ezStartChange", 7);
|
|
955
1073
|
this.ezCancelWaitingChange = createEvent(this, "ezCancelWaitingChange", 7);
|
|
1074
|
+
this._focused = false;
|
|
956
1075
|
/**
|
|
957
1076
|
* Deixa o campo disponível ou não para uso.
|
|
958
1077
|
*/
|
|
@@ -963,18 +1082,33 @@ let EzDateInput$1 = class extends HTMLElement$1 {
|
|
|
963
1082
|
this.mode = "regular";
|
|
964
1083
|
}
|
|
965
1084
|
observeLabel() {
|
|
966
|
-
this._textInput
|
|
1085
|
+
if (this._textInput) {
|
|
1086
|
+
this._textInput.label = this.label;
|
|
1087
|
+
}
|
|
967
1088
|
}
|
|
968
1089
|
observeErrorMessage() {
|
|
1090
|
+
var _a;
|
|
969
1091
|
if (this._textInput) {
|
|
970
1092
|
this._textInput.errorMessage = this.errorMessage;
|
|
1093
|
+
if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
1094
|
+
this.setInputValue();
|
|
1095
|
+
}
|
|
971
1096
|
}
|
|
972
1097
|
}
|
|
973
1098
|
observeValue(newValue, oldValue) {
|
|
974
|
-
if (newValue != oldValue) {
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
1099
|
+
if (this._textInput && newValue != oldValue) {
|
|
1100
|
+
const newValueValidated = this.validateValue(newValue);
|
|
1101
|
+
const oldValueValidated = this.validateValue(oldValue);
|
|
1102
|
+
if ((newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime()) !== (oldValueValidated === null || oldValueValidated === void 0 ? void 0 : oldValueValidated.getTime())) {
|
|
1103
|
+
const textValue = this.getTextValue(newValueValidated) || '';
|
|
1104
|
+
const parsedDate = DateUtils.strToDate(textValue);
|
|
1105
|
+
if ((parsedDate || !this._focused) && (this._textInput.value || '') !== textValue) {
|
|
1106
|
+
this._textInput.value = textValue;
|
|
1107
|
+
this._focused = false;
|
|
1108
|
+
this.errorMessage = "";
|
|
1109
|
+
}
|
|
1110
|
+
const valueEmitted = newValueValidated === null ? undefined : newValueValidated;
|
|
1111
|
+
this.ezChange.emit(valueEmitted);
|
|
978
1112
|
}
|
|
979
1113
|
}
|
|
980
1114
|
}
|
|
@@ -990,59 +1124,89 @@ let EzDateInput$1 = class extends HTMLElement$1 {
|
|
|
990
1124
|
async setBlur() {
|
|
991
1125
|
this._textInput.setBlur();
|
|
992
1126
|
}
|
|
1127
|
+
/**
|
|
1128
|
+
* Retorna informando se o campo está inválido (true | false)
|
|
1129
|
+
*/
|
|
1130
|
+
async isInvalid() {
|
|
1131
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
1132
|
+
}
|
|
993
1133
|
changeValue(newValue) {
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
if ((newValue === null || newValue === void 0 ? void 0 : newValue.toString()) !== ((_a = this.value) === null || _a === void 0 ? void 0 : _a.toString())) {
|
|
999
|
-
this.value = newValue;
|
|
1000
|
-
this.ezChange.emit(this.value);
|
|
1134
|
+
const currentValue = this.validateValue(this.value);
|
|
1135
|
+
const newValueValidated = this.validateValue(newValue);
|
|
1136
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
1137
|
+
this.value = newValueValidated;
|
|
1001
1138
|
}
|
|
1002
1139
|
}
|
|
1003
1140
|
showCalendar() {
|
|
1004
|
-
this.
|
|
1141
|
+
this.handleBlur();
|
|
1005
1142
|
this._calendar.value = this.value;
|
|
1006
1143
|
//FIXME: Provavelmente isso fará com que o popup abra em uma
|
|
1007
1144
|
//posição errada no futuro. Preferi fazer simples no começo,
|
|
1008
1145
|
//porque não quis onerar o text input com essa funcionalidade...
|
|
1009
|
-
const top = this.
|
|
1146
|
+
const top = this.errorMessage || this.mode === "slim" ? 0 : -19;
|
|
1010
1147
|
this._calendar.fitVertical(top, this._elem.clientHeight);
|
|
1011
1148
|
}
|
|
1012
1149
|
hideCalendar() {
|
|
1013
1150
|
this.changeValue(this._calendar.value);
|
|
1014
1151
|
this._calendar.hide();
|
|
1015
1152
|
}
|
|
1016
|
-
|
|
1153
|
+
handleBlur() {
|
|
1017
1154
|
const strValue = this._textInput.value;
|
|
1018
|
-
const
|
|
1019
|
-
if (
|
|
1020
|
-
|
|
1021
|
-
|
|
1155
|
+
const newValue = DateUtils.strToDate(strValue);
|
|
1156
|
+
if (newValue || !strValue) {
|
|
1157
|
+
this.errorMessage = "";
|
|
1158
|
+
const currentValue = this.validateValue(this.value);
|
|
1159
|
+
const newValueValidated = this.validateValue(newValue);
|
|
1160
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) === (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
1161
|
+
if (newValueValidated) {
|
|
1162
|
+
this._textInput.value = this.getTextValue(newValueValidated) || '';
|
|
1163
|
+
this._focused = false;
|
|
1164
|
+
}
|
|
1165
|
+
this.ezCancelWaitingChange.emit();
|
|
1022
1166
|
}
|
|
1023
1167
|
else {
|
|
1024
|
-
this.changeValue(
|
|
1168
|
+
this.changeValue(newValueValidated);
|
|
1025
1169
|
}
|
|
1026
1170
|
}
|
|
1027
1171
|
else {
|
|
1172
|
+
this.changeValue(undefined);
|
|
1028
1173
|
this.ezCancelWaitingChange.emit();
|
|
1029
|
-
this.
|
|
1174
|
+
this.errorMessage = "O valor digitado não é uma data válida";
|
|
1030
1175
|
}
|
|
1031
1176
|
}
|
|
1032
1177
|
getTextValue(d) {
|
|
1033
1178
|
return d ? new Intl.DateTimeFormat("pt-BR").format(d) : undefined;
|
|
1034
1179
|
}
|
|
1035
|
-
|
|
1036
|
-
this.
|
|
1180
|
+
handleInput() {
|
|
1181
|
+
const strValue = this._textInput.value;
|
|
1182
|
+
const newValue = DateUtils.strToDate(strValue);
|
|
1183
|
+
const currentValue = this.validateValue(this.value);
|
|
1184
|
+
const newValueValidated = this.validateValue(newValue);
|
|
1185
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
1186
|
+
this._focused = true;
|
|
1187
|
+
this.ezStartChange.emit({ waitmessage: "", blocking: false });
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
validateValue(value) {
|
|
1191
|
+
return value instanceof Date && !isNaN(value.valueOf())
|
|
1192
|
+
? DateUtils.clearTime(value)
|
|
1193
|
+
: undefined;
|
|
1194
|
+
}
|
|
1195
|
+
setInputValue() {
|
|
1196
|
+
const textValue = this.getTextValue(this.value) || '';
|
|
1197
|
+
if ((this._textInput.value || '') !== textValue) {
|
|
1198
|
+
this._textInput.value = textValue;
|
|
1199
|
+
}
|
|
1037
1200
|
}
|
|
1038
1201
|
componentDidLoad() {
|
|
1039
1202
|
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
1203
|
+
this.setInputValue();
|
|
1040
1204
|
}
|
|
1041
1205
|
render() {
|
|
1042
|
-
return (h(Host, null, h("ez-text-input", { ref: elem => this._textInput = elem,
|
|
1206
|
+
return (h(Host, null, h("ez-text-input", { ref: elem => this._textInput = elem, "data-slave-mode": "true", onKeyDown: event => {
|
|
1043
1207
|
if (event.key === "H" || event.key === "h")
|
|
1044
1208
|
this.changeValue(new Date());
|
|
1045
|
-
}, label: this.label,
|
|
1209
|
+
}, 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 })));
|
|
1046
1210
|
}
|
|
1047
1211
|
get _elem() { return this; }
|
|
1048
1212
|
static get watchers() { return {
|
|
@@ -1063,6 +1227,7 @@ let EzDateTimeInput$1 = class extends HTMLElement$1 {
|
|
|
1063
1227
|
this.ezChange = createEvent(this, "ezChange", 7);
|
|
1064
1228
|
this.ezStartChange = createEvent(this, "ezStartChange", 7);
|
|
1065
1229
|
this.ezCancelWaitingChange = createEvent(this, "ezCancelWaitingChange", 7);
|
|
1230
|
+
this._focused = false;
|
|
1066
1231
|
/**
|
|
1067
1232
|
* Deixa o campo disponível ou não para uso.
|
|
1068
1233
|
*/
|
|
@@ -1077,14 +1242,34 @@ let EzDateTimeInput$1 = class extends HTMLElement$1 {
|
|
|
1077
1242
|
this.mode = "regular";
|
|
1078
1243
|
}
|
|
1079
1244
|
observeLabel() {
|
|
1080
|
-
this._textInput
|
|
1245
|
+
if (this._textInput) {
|
|
1246
|
+
this._textInput.label = this.label;
|
|
1247
|
+
}
|
|
1081
1248
|
}
|
|
1082
1249
|
observeErrorMessage() {
|
|
1083
|
-
|
|
1084
|
-
}
|
|
1085
|
-
observeValue() {
|
|
1250
|
+
var _a;
|
|
1086
1251
|
if (this._textInput) {
|
|
1087
|
-
this._textInput.
|
|
1252
|
+
this._textInput.errorMessage = this.errorMessage;
|
|
1253
|
+
if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
1254
|
+
this.setInputValue();
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
observeValue(newValue, oldValue) {
|
|
1259
|
+
if (this._textInput && newValue != oldValue) {
|
|
1260
|
+
const newValueValidated = this.validateValue(newValue);
|
|
1261
|
+
const oldValueValidated = this.validateValue(oldValue);
|
|
1262
|
+
if ((newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime()) !== (oldValueValidated === null || oldValueValidated === void 0 ? void 0 : oldValueValidated.getTime())) {
|
|
1263
|
+
const textValue = this.getTextValue(newValueValidated) || '';
|
|
1264
|
+
const parsedDate = this.getParsedDateTime(textValue);
|
|
1265
|
+
if ((parsedDate || !this._focused) && (this._textInput.value || '') !== textValue) {
|
|
1266
|
+
this._textInput.value = textValue;
|
|
1267
|
+
this._focused = false;
|
|
1268
|
+
this.errorMessage = "";
|
|
1269
|
+
}
|
|
1270
|
+
const valueEmitted = newValueValidated === null ? undefined : newValueValidated;
|
|
1271
|
+
this.ezChange.emit(valueEmitted);
|
|
1272
|
+
}
|
|
1088
1273
|
}
|
|
1089
1274
|
}
|
|
1090
1275
|
/**
|
|
@@ -1099,30 +1284,36 @@ let EzDateTimeInput$1 = class extends HTMLElement$1 {
|
|
|
1099
1284
|
async setBlur() {
|
|
1100
1285
|
this._textInput.setBlur();
|
|
1101
1286
|
}
|
|
1102
|
-
|
|
1287
|
+
/**
|
|
1288
|
+
* Retorna informando se o campo está inválido (true | false)
|
|
1289
|
+
*/
|
|
1290
|
+
async isInvalid() {
|
|
1291
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
1292
|
+
}
|
|
1293
|
+
handleKeyDown(event) {
|
|
1103
1294
|
const input = this._textInput.shadowRoot.querySelector('input');
|
|
1104
|
-
if (
|
|
1295
|
+
if (event.key === "H" || event.key === "h") {
|
|
1105
1296
|
this.changeValue(new Date());
|
|
1106
1297
|
}
|
|
1107
|
-
else if (
|
|
1298
|
+
else if (event.shiftKey && event.key === "Tab") {
|
|
1108
1299
|
if (input.selectionStart > 0) {
|
|
1109
1300
|
let selectIni = input.value.lastIndexOf(" ", input.selectionStart);
|
|
1110
1301
|
if (selectIni !== -1) {
|
|
1111
1302
|
input.setSelectionRange(0, selectIni);
|
|
1112
|
-
|
|
1303
|
+
event.preventDefault();
|
|
1113
1304
|
}
|
|
1114
1305
|
}
|
|
1115
1306
|
}
|
|
1116
|
-
else if (
|
|
1307
|
+
else if (event.key === "Tab") {
|
|
1117
1308
|
if (input.value.length !== input.selectionEnd) {
|
|
1118
1309
|
let selectIni = input.value.indexOf(" ", input.selectionEnd);
|
|
1119
1310
|
selectIni = selectIni === -1 ? input.selectionEnd : selectIni + 1;
|
|
1120
1311
|
input.setSelectionRange(selectIni, input.value.length);
|
|
1121
|
-
|
|
1312
|
+
event.preventDefault();
|
|
1122
1313
|
}
|
|
1123
1314
|
}
|
|
1124
1315
|
}
|
|
1125
|
-
|
|
1316
|
+
handleFocus() {
|
|
1126
1317
|
const input = this._textInput.shadowRoot.querySelector('input');
|
|
1127
1318
|
if (input.selectionStart !== input.selectionEnd) {
|
|
1128
1319
|
let selectIni = input.value.indexOf(" ", input.selectionStart);
|
|
@@ -1130,7 +1321,7 @@ let EzDateTimeInput$1 = class extends HTMLElement$1 {
|
|
|
1130
1321
|
input.setSelectionRange(0, selectIni);
|
|
1131
1322
|
}
|
|
1132
1323
|
}
|
|
1133
|
-
|
|
1324
|
+
handleClick() {
|
|
1134
1325
|
const input = this._textInput.shadowRoot.querySelector('input');
|
|
1135
1326
|
let selectIni = input.value.lastIndexOf(" ", input.selectionEnd);
|
|
1136
1327
|
selectIni = selectIni === -1 ? 0 : selectIni + 1;
|
|
@@ -1139,37 +1330,55 @@ let EzDateTimeInput$1 = class extends HTMLElement$1 {
|
|
|
1139
1330
|
input.setSelectionRange(selectIni, selectFin);
|
|
1140
1331
|
}
|
|
1141
1332
|
changeValue(newValue) {
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
if ((
|
|
1145
|
-
this.value =
|
|
1146
|
-
this.ezChange.emit(this.value);
|
|
1333
|
+
const currentValue = this.validateValue(this.value);
|
|
1334
|
+
const newValueValidated = this.validateValue(newValue);
|
|
1335
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
1336
|
+
this.value = newValueValidated;
|
|
1147
1337
|
}
|
|
1148
1338
|
}
|
|
1149
1339
|
showCalendar() {
|
|
1150
|
-
const top = this.
|
|
1340
|
+
const top = this.errorMessage || this.mode === "slim" ? 0 : -19;
|
|
1151
1341
|
this._calendar.fitVertical(top, this._elem.clientHeight);
|
|
1152
1342
|
this._calendar.style.visibility = 'inherit';
|
|
1153
1343
|
}
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1344
|
+
getParsedDateTime(strValue) {
|
|
1345
|
+
var _a, _b;
|
|
1346
|
+
if (strValue === void 0) {
|
|
1347
|
+
strValue = (((_b = (_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.trim()) || "");
|
|
1348
|
+
}
|
|
1349
|
+
if (!strValue) {
|
|
1350
|
+
return;
|
|
1351
|
+
}
|
|
1352
|
+
const partsDateTime = strValue.split(" ");
|
|
1157
1353
|
const onlyDate = partsDateTime.length > 0 ? partsDateTime[0] : strValue;
|
|
1158
1354
|
const onlyTime = partsDateTime[1] ? partsDateTime[1] : "";
|
|
1159
1355
|
const parsedTime = TimeFormatter.prepareValue(onlyTime, this.showSeconds);
|
|
1160
1356
|
const strDateTime = onlyDate + (parsedTime && " " + parsedTime);
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1357
|
+
return DateUtils.strToDate(strDateTime);
|
|
1358
|
+
}
|
|
1359
|
+
handleBlur() {
|
|
1360
|
+
var _a, _b;
|
|
1361
|
+
const strValue = ((_b = (_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.trim()) || "";
|
|
1362
|
+
const newValue = this.getParsedDateTime();
|
|
1363
|
+
if (newValue || !strValue) {
|
|
1364
|
+
this.errorMessage = "";
|
|
1365
|
+
const currentValue = this.validateValue(this.value);
|
|
1366
|
+
const newValueValidated = this.validateValue(newValue);
|
|
1367
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) === (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
1368
|
+
if (newValueValidated) {
|
|
1369
|
+
this._textInput.value = this.getTextValue(newValueValidated) || '';
|
|
1370
|
+
this._focused = false;
|
|
1371
|
+
}
|
|
1372
|
+
this.ezCancelWaitingChange.emit();
|
|
1165
1373
|
}
|
|
1166
1374
|
else {
|
|
1167
|
-
this.changeValue(
|
|
1375
|
+
this.changeValue(newValueValidated);
|
|
1168
1376
|
}
|
|
1169
1377
|
}
|
|
1170
1378
|
else {
|
|
1379
|
+
this.changeValue(undefined);
|
|
1171
1380
|
this.ezCancelWaitingChange.emit();
|
|
1172
|
-
this.
|
|
1381
|
+
this.errorMessage = "O valor digitado não é uma data válida";
|
|
1173
1382
|
}
|
|
1174
1383
|
}
|
|
1175
1384
|
getTextValue(d) {
|
|
@@ -1183,14 +1392,32 @@ let EzDateTimeInput$1 = class extends HTMLElement$1 {
|
|
|
1183
1392
|
};
|
|
1184
1393
|
return d ? (new Intl.DateTimeFormat('pt-BR', this.showSeconds ? optionsSecond : options).format(d)) : undefined;
|
|
1185
1394
|
}
|
|
1186
|
-
|
|
1187
|
-
|
|
1395
|
+
validateValue(value) {
|
|
1396
|
+
return value instanceof Date && !isNaN(value.valueOf())
|
|
1397
|
+
? value
|
|
1398
|
+
: undefined;
|
|
1399
|
+
}
|
|
1400
|
+
handleInput() {
|
|
1401
|
+
const newValue = this.getParsedDateTime();
|
|
1402
|
+
const currentValue = this.validateValue(this.value);
|
|
1403
|
+
const newValueValidated = this.validateValue(newValue);
|
|
1404
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
1405
|
+
this._focused = true;
|
|
1406
|
+
this.ezStartChange.emit({ waitmessage: "", blocking: false });
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
setInputValue() {
|
|
1410
|
+
const textValue = this.getTextValue(this.value) || '';
|
|
1411
|
+
if ((this._textInput.value || '') !== textValue) {
|
|
1412
|
+
this._textInput.value = textValue;
|
|
1413
|
+
}
|
|
1188
1414
|
}
|
|
1189
1415
|
componentDidLoad() {
|
|
1190
1416
|
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
1417
|
+
this.setInputValue();
|
|
1191
1418
|
}
|
|
1192
1419
|
render() {
|
|
1193
|
-
return (h(Host, null, h("ez-text-input", { ref: elem => this._textInput = elem,
|
|
1420
|
+
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 })));
|
|
1194
1421
|
}
|
|
1195
1422
|
get _elem() { return this; }
|
|
1196
1423
|
static get watchers() { return {
|
|
@@ -1316,9 +1543,10 @@ let EzFilterInput$1 = class extends HTMLElement$1 {
|
|
|
1316
1543
|
this._textInput.errorMessage = this.errorMessage;
|
|
1317
1544
|
}
|
|
1318
1545
|
}
|
|
1319
|
-
observeValue() {
|
|
1320
|
-
if (this._textInput) {
|
|
1321
|
-
this._textInput.value =
|
|
1546
|
+
observeValue(newValue, oldValue) {
|
|
1547
|
+
if (this._textInput && newValue != oldValue) {
|
|
1548
|
+
this._textInput.value = newValue;
|
|
1549
|
+
this.ezChange.emit(newValue);
|
|
1322
1550
|
}
|
|
1323
1551
|
}
|
|
1324
1552
|
/**
|
|
@@ -1333,12 +1561,17 @@ let EzFilterInput$1 = class extends HTMLElement$1 {
|
|
|
1333
1561
|
async setBlur() {
|
|
1334
1562
|
this._textInput.setBlur();
|
|
1335
1563
|
}
|
|
1564
|
+
/**
|
|
1565
|
+
* Retorna informando se o campo está inválido (true | false)
|
|
1566
|
+
*/
|
|
1567
|
+
async isInvalid() {
|
|
1568
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
1569
|
+
}
|
|
1336
1570
|
changeValue(evt) {
|
|
1337
1571
|
const newValue = evt.detail;
|
|
1338
1572
|
this.errorMessage = "";
|
|
1339
1573
|
if (newValue !== this.value) {
|
|
1340
1574
|
this.value = newValue;
|
|
1341
|
-
this.ezChange.emit(this.value);
|
|
1342
1575
|
}
|
|
1343
1576
|
}
|
|
1344
1577
|
componentDidLoad() {
|
|
@@ -1985,7 +2218,7 @@ class DataBinder {
|
|
|
1985
2218
|
case Action.NEXT_SELECTED:
|
|
1986
2219
|
case Action.PREVIOUS_SELECTED:
|
|
1987
2220
|
(_a = this._fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
|
|
1988
|
-
this.updateValue(field.fieldName, field.field);
|
|
2221
|
+
this.updateValue(field.fieldName, field.field, action.type === Action.EDITION_CANCELED);
|
|
1989
2222
|
});
|
|
1990
2223
|
break;
|
|
1991
2224
|
}
|
|
@@ -2003,15 +2236,24 @@ class DataBinder {
|
|
|
2003
2236
|
onDisconnectedCallback() {
|
|
2004
2237
|
this._dataUnit.unsubscribe(this.onDataUnitEvent);
|
|
2005
2238
|
}
|
|
2006
|
-
updateValue(fieldName, field) {
|
|
2239
|
+
updateValue(fieldName, field, actionCanceled = false) {
|
|
2240
|
+
var _a;
|
|
2007
2241
|
field["value"] = this._dataUnit.getFieldValue(fieldName);
|
|
2242
|
+
/**
|
|
2243
|
+
* FIXME: Campo já salvo com undefined, ao inserir valor inválido e cancelar,
|
|
2244
|
+
* o campo não é limpo e atualizado automaticamente, pois o value não mudou,
|
|
2245
|
+
* assim, não dispara o Watch do value, que é o responsável por limpar o errorMessage.
|
|
2246
|
+
*/
|
|
2247
|
+
if (actionCanceled && ((_a = field["errorMessage"]) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
2248
|
+
field["errorMessage"] = "";
|
|
2249
|
+
}
|
|
2008
2250
|
}
|
|
2009
2251
|
updateBind(fieldName, field) {
|
|
2010
2252
|
const oldBind = this._fields.get(fieldName);
|
|
2011
2253
|
if (oldBind) {
|
|
2012
2254
|
oldBind.destroy();
|
|
2013
2255
|
}
|
|
2014
|
-
|
|
2256
|
+
this.updateValue(fieldName, field);
|
|
2015
2257
|
this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName) => this.cancelWaitingChange(fieldName), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
|
|
2016
2258
|
this.bindSearchOptionsLoader(fieldName, field);
|
|
2017
2259
|
this.applyEzUploadContext(fieldName, field);
|
|
@@ -2123,45 +2365,6 @@ class Bind {
|
|
|
2123
2365
|
}
|
|
2124
2366
|
}
|
|
2125
2367
|
|
|
2126
|
-
class ApplicationUtils {
|
|
2127
|
-
static async showDialog(title, message, icon = null, confirm, critical = false, options) {
|
|
2128
|
-
if (options) {
|
|
2129
|
-
options = Object.assign(Object.assign({}, ApplicationUtils.defaultMessageOptions), options);
|
|
2130
|
-
}
|
|
2131
|
-
return new Promise(resolve => {
|
|
2132
|
-
let dialog = document.querySelector("ez-dialog");
|
|
2133
|
-
if (!dialog) {
|
|
2134
|
-
dialog = document.createElement("ez-dialog");
|
|
2135
|
-
window.document.body.appendChild(dialog);
|
|
2136
|
-
}
|
|
2137
|
-
dialog.show(title, message, critical, confirm, icon, options.labelCancel, options.labelConfirm, options.btnConfirmDanger).then(ok => resolve(ok));
|
|
2138
|
-
});
|
|
2139
|
-
}
|
|
2140
|
-
static async alert(title, message, icon = null, options = ApplicationUtils.defaultMessageOptions) {
|
|
2141
|
-
return ApplicationUtils.showDialog(title, message, icon, false, false, options);
|
|
2142
|
-
}
|
|
2143
|
-
static async error(title, message, icon = null, options = ApplicationUtils.defaultMessageOptions) {
|
|
2144
|
-
return ApplicationUtils.showDialog(title, message, icon, false, true, options);
|
|
2145
|
-
}
|
|
2146
|
-
static async confirm(title, message, icon = null, critical = false, options = ApplicationUtils.defaultMessageOptions) {
|
|
2147
|
-
return ApplicationUtils.showDialog(title, message, icon, true, critical, options);
|
|
2148
|
-
}
|
|
2149
|
-
static async info(message, options = ApplicationUtils.defaultMessageOptions) {
|
|
2150
|
-
let toast = document.querySelector("ez-toast");
|
|
2151
|
-
if (!toast) {
|
|
2152
|
-
toast = document.createElement("ez-toast");
|
|
2153
|
-
window.document.body.appendChild(toast);
|
|
2154
|
-
}
|
|
2155
|
-
toast.show(message, 4000, false, options.canClose);
|
|
2156
|
-
}
|
|
2157
|
-
}
|
|
2158
|
-
ApplicationUtils.defaultMessageOptions = {
|
|
2159
|
-
canClose: true,
|
|
2160
|
-
labelCancel: 'Não',
|
|
2161
|
-
labelConfirm: 'Sim',
|
|
2162
|
-
btnConfirmDanger: false
|
|
2163
|
-
};
|
|
2164
|
-
|
|
2165
2368
|
const ezFormCss = "ez-form{display:flex;flex-direction:column;width:100%}.dynamic-content ez-collapsible-box{--ez-collapsible-box__header--padding-right:var(--space-small, 6px);--ez-collapsible-box__header--padding-left:var(--space-small, 6px)}";
|
|
2166
2369
|
|
|
2167
2370
|
let EzForm$1 = class extends HTMLElement$1 {
|
|
@@ -2182,25 +2385,58 @@ let EzForm$1 = class extends HTMLElement$1 {
|
|
|
2182
2385
|
return Promise.resolve();
|
|
2183
2386
|
}
|
|
2184
2387
|
validate() {
|
|
2185
|
-
return new Promise((accept, reject) => {
|
|
2388
|
+
return new Promise(async (accept, reject) => {
|
|
2186
2389
|
const metadata = selectFormMetadata(this._store.getState());
|
|
2187
2390
|
const requiredFields = this._staticFields
|
|
2188
2391
|
.filter(f => f.dataset.required)
|
|
2189
2392
|
.map(f => f.dataset.fieldName)
|
|
2190
2393
|
.concat(metadata.getRequiredFields());
|
|
2394
|
+
let isReject = false;
|
|
2191
2395
|
const records = this.dataUnit.getModifiedRecords();
|
|
2192
2396
|
for (let i = 0; i < records.length; i++) {
|
|
2193
2397
|
if (!this.validateRequired(requiredFields, records[i])) {
|
|
2194
|
-
|
|
2398
|
+
isReject = true;
|
|
2195
2399
|
break;
|
|
2196
2400
|
}
|
|
2197
2401
|
}
|
|
2198
|
-
|
|
2402
|
+
if (!isReject) {
|
|
2403
|
+
const validateError = await this.validateError();
|
|
2404
|
+
if (!validateError) {
|
|
2405
|
+
isReject = true;
|
|
2406
|
+
}
|
|
2407
|
+
}
|
|
2408
|
+
if (isReject) {
|
|
2409
|
+
reject();
|
|
2410
|
+
}
|
|
2411
|
+
else {
|
|
2412
|
+
accept();
|
|
2413
|
+
}
|
|
2199
2414
|
});
|
|
2200
2415
|
}
|
|
2201
2416
|
observeConfig() {
|
|
2202
2417
|
this.processMetadata();
|
|
2203
2418
|
}
|
|
2419
|
+
async validateError() {
|
|
2420
|
+
var _a;
|
|
2421
|
+
const invalidFields = [];
|
|
2422
|
+
const dataFields = (_a = this._element) === null || _a === void 0 ? void 0 : _a.querySelectorAll("[data-field-name]");
|
|
2423
|
+
if (dataFields && dataFields.length > 0) {
|
|
2424
|
+
for (let i = 0; i < dataFields.length; i++) {
|
|
2425
|
+
const fieldElem = dataFields[i];
|
|
2426
|
+
if (fieldElem && fieldElem['isInvalid']) {
|
|
2427
|
+
const hasError = await fieldElem['isInvalid']();
|
|
2428
|
+
if (hasError && fieldElem['dataset']) {
|
|
2429
|
+
invalidFields.push(fieldElem['dataset'].fieldName);
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
const isValid = invalidFields.length === 0;
|
|
2435
|
+
if (!isValid) {
|
|
2436
|
+
ApplicationUtils.info("Há pelo menos um campo com conteúdo inválido.");
|
|
2437
|
+
}
|
|
2438
|
+
return isValid;
|
|
2439
|
+
}
|
|
2204
2440
|
validateRequired(requiredFields, record) {
|
|
2205
2441
|
const invalidFields = [];
|
|
2206
2442
|
requiredFields.forEach(field => {
|
|
@@ -2213,13 +2449,16 @@ let EzForm$1 = class extends HTMLElement$1 {
|
|
|
2213
2449
|
* na aba, isso será tratado no card: https://sankhya.atlassian.net/browse/SKA-44182
|
|
2214
2450
|
*/
|
|
2215
2451
|
if (fieldElem) {
|
|
2452
|
+
/**
|
|
2453
|
+
* Devido o StencilJS não possuir Getter e Setter, para casos que o Watch não for chamado,
|
|
2454
|
+
* é necessário limpar a propriedade antes de setar o valor novamente, para que o Watch seja disparado novamente,
|
|
2455
|
+
* solução necessária para controlar componentes com herança (Exemplo: EzSearch -> EzComboBox -> EzTextInput).
|
|
2456
|
+
*/
|
|
2457
|
+
fieldElem["errorMessage"] = "";
|
|
2216
2458
|
if (value === null || value === undefined || value === "") {
|
|
2217
2459
|
invalidFields.push(field);
|
|
2218
2460
|
fieldElem["errorMessage"] = "Essa informação é obrigatória";
|
|
2219
2461
|
}
|
|
2220
|
-
else {
|
|
2221
|
-
fieldElem["errorMessage"] = "";
|
|
2222
|
-
}
|
|
2223
2462
|
}
|
|
2224
2463
|
});
|
|
2225
2464
|
const isValid = invalidFields.length === 0;
|
|
@@ -112594,7 +112833,7 @@ class AgGridController {
|
|
|
112594
112833
|
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
112595
112834
|
}
|
|
112596
112835
|
const colDef = this._gridOptions.columnApi.getAllColumns();
|
|
112597
|
-
return colDef.map(c => {
|
|
112836
|
+
return colDef.filter(c => c.getColId() !== "checkBoxColumn").map(c => {
|
|
112598
112837
|
const def = c.getColDef();
|
|
112599
112838
|
const colDef = { name: def.field, label: def.headerName };
|
|
112600
112839
|
this.conditionalSet(colDef, "sortable", def.sortable);
|
|
@@ -113091,6 +113330,14 @@ let EzGrid$1 = class extends HTMLElement$1 {
|
|
|
113091
113330
|
async hasPreviousRecord() {
|
|
113092
113331
|
return Promise.resolve(this._gridController.hasPreviousRecord());
|
|
113093
113332
|
}
|
|
113333
|
+
/**
|
|
113334
|
+
* Método para abrir a configuração da grid.
|
|
113335
|
+
*/
|
|
113336
|
+
async openGridConfig() {
|
|
113337
|
+
this._gridConfig.columns = this._gridController.getColumnsState().filter(c => c.name);
|
|
113338
|
+
this._gridConfig.selectedTab = "Colunas";
|
|
113339
|
+
this._popUpGridConfig = true;
|
|
113340
|
+
}
|
|
113094
113341
|
componentWillLoad() {
|
|
113095
113342
|
if (this.dataUnit) {
|
|
113096
113343
|
this._dataUnitBridge = new DataUnitBridge(this._gridController, this.dataUnit);
|
|
@@ -113208,11 +113455,6 @@ let EzGrid$1 = class extends HTMLElement$1 {
|
|
|
113208
113455
|
closeGridConfig() {
|
|
113209
113456
|
this._popUpGridConfig = false;
|
|
113210
113457
|
}
|
|
113211
|
-
openGridConfig() {
|
|
113212
|
-
this._gridConfig.columns = this._gridController.getColumnsState().filter(c => c.name);
|
|
113213
|
-
this._gridConfig.selectedTab = "Colunas";
|
|
113214
|
-
this._popUpGridConfig = true;
|
|
113215
|
-
}
|
|
113216
113458
|
render() {
|
|
113217
113459
|
return (h(Host, null, h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, h("div", { class: "grid-header__container" }, h("slot", { name: "leftButtons" })), h("div", { class: "grid-header__container" }, this.getPaginationControl())), h("div", { class: "grid__container ez-grid", ref: elem => this._container = elem }), h("div", { class: "grid__footer" }), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("grid-config", { ref: ref => this._gridConfig = ref, config: this.config, selectedTab: "Colunas", onConfigFinish: evt => { this.observeConfig(evt.detail); this.configChange.emit(evt.detail); }, onConfigCancel: _evt => this.closeGridConfig() }))));
|
|
113218
113460
|
}
|
|
@@ -113870,6 +114112,7 @@ let EzNumberInput$1 = class extends HTMLElement$1 {
|
|
|
113870
114112
|
this.ezChange = createEvent(this, "ezChange", 7);
|
|
113871
114113
|
this.ezStartChange = createEvent(this, "ezStartChange", 7);
|
|
113872
114114
|
this.ezCancelWaitingChange = createEvent(this, "ezCancelWaitingChange", 7);
|
|
114115
|
+
this._focused = false;
|
|
113873
114116
|
/**
|
|
113874
114117
|
* Deixa o campo disponível ou não para uso.
|
|
113875
114118
|
*/
|
|
@@ -113891,66 +114134,109 @@ let EzNumberInput$1 = class extends HTMLElement$1 {
|
|
|
113891
114134
|
async setBlur() {
|
|
113892
114135
|
this._textInput.setBlur();
|
|
113893
114136
|
}
|
|
114137
|
+
/**
|
|
114138
|
+
* Retorna informando se o campo está inválido (true | false)
|
|
114139
|
+
*/
|
|
114140
|
+
async isInvalid() {
|
|
114141
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
114142
|
+
}
|
|
113894
114143
|
observeLabel() {
|
|
113895
114144
|
if (this._textInput) {
|
|
113896
114145
|
this._textInput.label = this.label;
|
|
113897
114146
|
}
|
|
113898
114147
|
}
|
|
113899
114148
|
observeErrorMessage() {
|
|
114149
|
+
var _a;
|
|
113900
114150
|
if (this._textInput) {
|
|
113901
114151
|
this._textInput.errorMessage = this.errorMessage;
|
|
114152
|
+
if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
114153
|
+
this.setInputValue();
|
|
114154
|
+
}
|
|
113902
114155
|
}
|
|
113903
114156
|
}
|
|
113904
|
-
observeValue() {
|
|
113905
|
-
if (this._textInput) {
|
|
113906
|
-
|
|
114157
|
+
observeValue(newValue, oldValue) {
|
|
114158
|
+
if (this._textInput && newValue != oldValue) {
|
|
114159
|
+
const newValueValidated = this.validateValue(newValue);
|
|
114160
|
+
const oldValueValidated = this.validateValue(oldValue);
|
|
114161
|
+
if (newValueValidated != oldValueValidated) {
|
|
114162
|
+
const textValue = this.getTextValue(newValueValidated) || '';
|
|
114163
|
+
if ((this._textInput.value || '') !== textValue) {
|
|
114164
|
+
const parsedNumber = this.getParsedNumber(textValue);
|
|
114165
|
+
if (parsedNumber !== undefined || !this._focused) {
|
|
114166
|
+
this._textInput.value = textValue;
|
|
114167
|
+
this._focused = false;
|
|
114168
|
+
this.errorMessage = "";
|
|
114169
|
+
}
|
|
114170
|
+
}
|
|
114171
|
+
const valueEmitted = newValueValidated === null ? undefined : newValueValidated;
|
|
114172
|
+
this.ezChange.emit(valueEmitted);
|
|
114173
|
+
}
|
|
114174
|
+
}
|
|
114175
|
+
}
|
|
114176
|
+
validateValue(value) {
|
|
114177
|
+
return isNaN(value) || value === undefined ? null : value;
|
|
114178
|
+
}
|
|
114179
|
+
getTextValue(value) {
|
|
114180
|
+
if (value != undefined) {
|
|
114181
|
+
return this.precision > 0 ? NumberUtils.format(value.toString(), Number(this.precision), Number(this.prettyPrecision)) : value.toString();
|
|
113907
114182
|
}
|
|
114183
|
+
return undefined;
|
|
113908
114184
|
}
|
|
113909
114185
|
changeValue(newValue) {
|
|
113910
114186
|
this.errorMessage = "";
|
|
113911
|
-
if (
|
|
113912
|
-
this.value = newValue;
|
|
113913
|
-
this.ezChange.emit(this.value);
|
|
113914
|
-
return true;
|
|
114187
|
+
if (this.value != newValue) {
|
|
114188
|
+
this.value = newValue === undefined ? null : newValue;
|
|
113915
114189
|
}
|
|
113916
114190
|
else {
|
|
113917
|
-
this.
|
|
114191
|
+
this.ezCancelWaitingChange.emit();
|
|
113918
114192
|
}
|
|
113919
|
-
return false;
|
|
113920
114193
|
}
|
|
113921
|
-
|
|
113922
|
-
|
|
114194
|
+
setError(msg) {
|
|
114195
|
+
this.value = null;
|
|
114196
|
+
this.errorMessage = msg;
|
|
114197
|
+
this.ezCancelWaitingChange.emit();
|
|
114198
|
+
}
|
|
114199
|
+
handleBlur() {
|
|
114200
|
+
const parsedNumber = this.getParsedNumber();
|
|
113923
114201
|
if (parsedNumber !== undefined && isNaN(parsedNumber)) {
|
|
113924
|
-
this.
|
|
113925
|
-
this.errorMessage = "O valor digitado não é um número válido";
|
|
114202
|
+
this.setError("O valor digitado não é um número válido");
|
|
113926
114203
|
}
|
|
113927
114204
|
else {
|
|
113928
114205
|
try {
|
|
113929
|
-
|
|
113930
|
-
this.ezCancelWaitingChange.emit();
|
|
113931
|
-
}
|
|
114206
|
+
this.changeValue(parsedNumber);
|
|
113932
114207
|
}
|
|
113933
114208
|
catch (e) {
|
|
113934
|
-
this.
|
|
113935
|
-
this.errorMessage = e.message;
|
|
114209
|
+
this.setError(e.message);
|
|
113936
114210
|
return;
|
|
113937
114211
|
}
|
|
113938
114212
|
}
|
|
113939
114213
|
}
|
|
113940
|
-
|
|
113941
|
-
|
|
113942
|
-
|
|
114214
|
+
handleInput() {
|
|
114215
|
+
const parsedNumber = this.getParsedNumber();
|
|
114216
|
+
if (parsedNumber !== this.value) {
|
|
114217
|
+
this._focused = true;
|
|
114218
|
+
this.ezStartChange.emit({ waitmessage: "", blocking: false });
|
|
113943
114219
|
}
|
|
113944
|
-
return undefined;
|
|
113945
114220
|
}
|
|
113946
|
-
|
|
113947
|
-
|
|
114221
|
+
getParsedNumber(value) {
|
|
114222
|
+
var _a;
|
|
114223
|
+
if (value === void 0) {
|
|
114224
|
+
value = (_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value;
|
|
114225
|
+
}
|
|
114226
|
+
return (value === null || value === void 0 ? void 0 : value.trim()) ? NumberUtils.stringToNumber(value) : undefined;
|
|
114227
|
+
}
|
|
114228
|
+
setInputValue() {
|
|
114229
|
+
const textValue = this.getTextValue(this.value) || '';
|
|
114230
|
+
if ((this._textInput.value || '') !== textValue) {
|
|
114231
|
+
this._textInput.value = textValue;
|
|
114232
|
+
}
|
|
113948
114233
|
}
|
|
113949
114234
|
componentDidLoad() {
|
|
113950
114235
|
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
114236
|
+
this.setInputValue();
|
|
113951
114237
|
}
|
|
113952
114238
|
render() {
|
|
113953
|
-
return (h("ez-text-input", { ref: elem => this._textInput = elem,
|
|
114239
|
+
return (h("ez-text-input", { ref: elem => this._textInput = elem, "data-slave-mode": "true", label: this.label, onBlur: () => this.handleBlur(), onInput: () => this.handleInput(), restrict: this.precision > 0 ? "0123456789-,." : "0123456789-", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode }));
|
|
113954
114240
|
}
|
|
113955
114241
|
get _elem() { return this; }
|
|
113956
114242
|
static get watchers() { return {
|
|
@@ -114172,6 +114458,11 @@ let EzSearch$1 = class extends HTMLElement$1 {
|
|
|
114172
114458
|
*/
|
|
114173
114459
|
this.mode = "regular";
|
|
114174
114460
|
}
|
|
114461
|
+
observeErrorMessage() {
|
|
114462
|
+
if (this._comboElement) {
|
|
114463
|
+
this._comboElement.errorMessage = this.errorMessage;
|
|
114464
|
+
}
|
|
114465
|
+
}
|
|
114175
114466
|
observeValue() {
|
|
114176
114467
|
if (this._comboElement) {
|
|
114177
114468
|
this._comboElement.value = this.value;
|
|
@@ -114189,20 +114480,30 @@ let EzSearch$1 = class extends HTMLElement$1 {
|
|
|
114189
114480
|
async setBlur() {
|
|
114190
114481
|
this._comboElement.setBlur();
|
|
114191
114482
|
}
|
|
114192
|
-
|
|
114193
|
-
|
|
114194
|
-
|
|
114195
|
-
|
|
114483
|
+
/**
|
|
114484
|
+
* Retorna informando se o campo está inválido (true | false)
|
|
114485
|
+
*/
|
|
114486
|
+
async isInvalid() {
|
|
114487
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
114488
|
+
}
|
|
114489
|
+
onComboChange(event) {
|
|
114490
|
+
event.stopPropagation();
|
|
114491
|
+
this.value = event.detail;
|
|
114492
|
+
this.ezChange.emit(event.detail);
|
|
114493
|
+
if (this.errorMessage !== this._comboElement.errorMessage) {
|
|
114494
|
+
this.errorMessage = this._comboElement.errorMessage;
|
|
114495
|
+
}
|
|
114196
114496
|
}
|
|
114197
114497
|
componentDidLoad() {
|
|
114198
114498
|
CSSVarsUtils.applyVarsTextInput(this._elem, this._comboElement);
|
|
114199
114499
|
}
|
|
114200
114500
|
render() {
|
|
114201
|
-
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:
|
|
114501
|
+
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: event => this.onComboChange(event), showSelectedValue: this.showSelectedValue, showOptionValue: this.showOptionValue, suppressEmptyOption: this.suppressEmptyOption, mode: this.mode }));
|
|
114202
114502
|
}
|
|
114203
114503
|
;
|
|
114204
114504
|
get _elem() { return this; }
|
|
114205
114505
|
static get watchers() { return {
|
|
114506
|
+
"errorMessage": ["observeErrorMessage"],
|
|
114206
114507
|
"value": ["observeValue"]
|
|
114207
114508
|
}; }
|
|
114208
114509
|
static get style() { return ezSearchCss; }
|
|
@@ -114401,7 +114702,7 @@ let EzTabselector$1 = class extends HTMLElement$1 {
|
|
|
114401
114702
|
static get style() { return ezTabselectorCss; }
|
|
114402
114703
|
};
|
|
114403
114704
|
|
|
114404
|
-
const ezTextAreaCss = ":host{--text-area--width:100%;--text-area--border-radius:var(--border--radius-medium, 12px);--text-area--font-size:var(--text--medium, 14px);--text-area--font-family:var(--font-pattern, Arial);--text-area--font-weight:var(--text-weight--medium, 400);--text-area--color:var(--title--primary, #000);--text-area__input--background-color:var(--background--medium, #e0e0e0);--text-area__input--border:var(--border--medium, 2px solid);--text-area__input--border-color:var(--text-area__input--background-color);--text-area__input--focus--border-color:var(--color--primary, #008561);--text-area__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--text-area__input--disabled--color:var(--text--disable, #AFB6C0);--text-area__input--error--border-color:#CC2936;--text-area__message_box--font-size:var(--text--small, 12px);--text-area__message_box--info--color:var(--color--success, #22085d);--text-area__message_box--error--color:var(--color--error, #FF0000);--text-area__label--floating--top:6px;--text-area__label--padding-top:12px;--text-area__label--padding-left:14px;--text-area__label--padding-right:12px;display:flex;flex-wrap:wrap;position:relative;width:var(--text-area--width)}textarea{box-sizing:border-box;border:none;resize:none;margin-top:calc(var(--space--medium, 12px) + 4px);width:100%;font-weight:var(--text-weight
|
|
114705
|
+
const ezTextAreaCss = ":host{--text-area--width:100%;--text-area--border-radius:var(--border--radius-medium, 12px);--text-area--font-size:var(--text--medium, 14px);--text-area--font-family:var(--font-pattern, Arial);--text-area--font-weight:var(--text-weight--medium, 400);--text-area--color:var(--title--primary, #000);--text-area__input--background-color:var(--background--medium, #e0e0e0);--text-area__input--border:var(--border--medium, 2px solid);--text-area__input--border-color:var(--text-area__input--background-color);--text-area__input--focus--border-color:var(--color--primary, #008561);--text-area__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--text-area__input--disabled--color:var(--text--disable, #AFB6C0);--text-area__input--error--border-color:#CC2936;--text-area__message_box--font-size:var(--text--small, 12px);--text-area__message_box--info--color:var(--color--success, #22085d);--text-area__message_box--error--color:var(--color--error, #FF0000);--text-area__label--floating--top:6px;--text-area__label--padding-top:12px;--text-area__label--padding-left:14px;--text-area__label--padding-right:12px;display:flex;flex-wrap:wrap;position:relative;width:var(--text-area--width)}textarea{box-sizing:border-box;border:none;resize:none;margin-top:calc(var(--space--medium, 12px) + 4px);width:100%;font-weight:var(--text-area--font-weight);font-family:var(--text-area--font-family);font-size:var(--text-area--font-size);color:var(--text-area--color);padding:0;background:none}textarea:focus{outline:none}textarea:disabled{background-color:transparent;color:var(--text-area__input--disabled--color)}.textarea{width:100%;box-sizing:border-box;padding-left:var(--space--medium);padding-right:var(--space--extra-small);border-radius:var(--text-area--border-radius);border:var(--text-area__input--border);border-color:var(--text-area__input--border-color);background-color:var(--text-area__input--background-color)}.textarea--focus{border-color:var(--text-area__input--focus--border-color)}.textarea.hasError{color:var(--text-area--color);border-color:var(--text-area__input--error--border-color)}.message-box{min-height:16px;min-width:100%;margin-top:3px;line-height:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--text-area--font-family);font-size:var(--text-area__message_box--font-size);color:var(--text-area__message_box--info--color)}.hasError{color:var(--text-area__message_box--error--color)}.textarea__label{box-sizing:border-box;position:absolute;z-index:var(--visible);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-transition:font-size .05s, top .05s;transition:font-size .05s, top .05s;width:calc(100% - var(--text-area__label--padding-right));left:var(--text-area--space--medium);font-family:var(--text-area--font-family);font-size:var(--text-area--font-size);font-weight:var(--text-area--font-weight);color:var(--text-area--color);top:var(--text-area__label--padding-top);left:var(--text-area__label--padding-left);padding-right:var(--text-area__label--padding-right)}.textarea__label--floated{font-family:var(--text-area--font-family);font-size:var(--text--extra-small);color:var(--text--primary);top:var(--text-area__label--floating--top)}.textarea__label--disabled{color:var(--text-area__input--disabled--color)}.textarea--slim{margin-top:var(--space--small, 6px)}.textarea--slim::-webkit-input-placeholder{font-family:var(--text-area--font-family);font-size:var(--text-area--font-size);font-weight:var(--text-area--font-weight);color:var(--text-area--color)}.textarea--slim:-moz-placeholder{font-family:var(--text-area--font-family);font-size:var(--text-area--font-size);font-weight:var(--text-area--font-weight);color:var(--text-area--color)}.textarea--slim::-moz-placeholder{font-family:var(--text-area--font-family);font-size:var(--text-area--font-size);font-weight:var(--text-area--font-weight);color:var(--text-area--color)}.textarea--slim:-ms-input-placeholder{font-family:var(--text-area--font-family);font-size:var(--text-area--font-size);font-weight:var(--text-area--font-weight);color:var(--text-area--color)}.textarea--slim::placeholder{font-family:var(--text-area--font-family);font-size:var(--text-area--font-size);font-weight:var(--text-area--font-weight);color:var(--text-area--color)}.textarea--slim:disabled::-webkit-input-placeholder{color:var(--text-area__input--disabled--color)}.textarea--slim:disabled:-moz-placeholder{color:var(--text-area__input--disabled--color)}.textarea--slim:disabled::-moz-placeholder{color:var(--text-area__input--disabled--color)}.textarea--slim:disabled:-ms-input-placeholder{color:var(--text-area__input--disabled--color)}.textarea--slim:disabled::placeholder{color:var(--text-area__input--disabled--color)}";
|
|
114405
114706
|
|
|
114406
114707
|
let EzTextArea$1 = class extends HTMLElement$1 {
|
|
114407
114708
|
constructor() {
|
|
@@ -114481,6 +114782,12 @@ let EzTextArea$1 = class extends HTMLElement$1 {
|
|
|
114481
114782
|
async setBlur() {
|
|
114482
114783
|
this._inputElem.blur();
|
|
114483
114784
|
}
|
|
114785
|
+
/**
|
|
114786
|
+
* Retorna informando se o campo está inválido (true | false)
|
|
114787
|
+
*/
|
|
114788
|
+
async isInvalid() {
|
|
114789
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
114790
|
+
}
|
|
114484
114791
|
//---------------------------------------------
|
|
114485
114792
|
// Private methods
|
|
114486
114793
|
//---------------------------------------------
|
|
@@ -114539,7 +114846,7 @@ let EzTextArea$1 = class extends HTMLElement$1 {
|
|
|
114539
114846
|
render() {
|
|
114540
114847
|
return (h(Host, null, h("div", { class: "textarea", ref: (el) => this._container = el }, this.label && this.mode != "slim" ?
|
|
114541
114848
|
h("label", { ref: (el) => this._labelElem = el, class: this.enabled ? "textarea__label" : "textarea__label textarea__label--disabled", onClick: () => this._inputElem.focus(), title: this.label }, this.label)
|
|
114542
|
-
: null, h("textarea", { onFocus: () => this.handleFocus(), ref: (el) => this._inputElem = el, value: this.value, disabled: !this.enabled, class: this.mode
|
|
114849
|
+
: null, h("textarea", { onFocus: () => this.handleFocus(), ref: (el) => this._inputElem = el, value: this.value, disabled: !this.enabled, class: this.mode === "slim" ? "textarea--slim" : "", placeholder: this.mode === "slim" && this.label ? this.label : "", onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); }, onKeyDown: event => event.stopPropagation(), rows: this.rows })), this.canShowError && this.mode != "slim" &&
|
|
114543
114850
|
h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el, title: this.errorMessage }, this.errorMessage)));
|
|
114544
114851
|
}
|
|
114545
114852
|
get _hostElement() { return this; }
|
|
@@ -114552,7 +114859,7 @@ let EzTextArea$1 = class extends HTMLElement$1 {
|
|
|
114552
114859
|
static get style() { return ezTextAreaCss; }
|
|
114553
114860
|
};
|
|
114554
114861
|
|
|
114555
|
-
const ezTextInputCss = ":host{--ez-text-input--height:42px;--ez-text-input--width:100%;--ez-text-input__icon--width:48px;--ez-text-input--height--slim:32px;--ez-text-input--border-radius:var(--border--radius-medium, 12px);--ez-text-input--font-size:var(--text--medium, 14px);--ez-text-input--font-family:var(--font-pattern, Arial);--ez-text-input--font-weight:var(--text-weight--medium, 400);--ez-text-input--color:var(--title--primary, #
|
|
114862
|
+
const ezTextInputCss = ":host{--ez-text-input--height:42px;--ez-text-input--width:100%;--ez-text-input__icon--width:48px;--ez-text-input--height--slim:32px;--ez-text-input--border-radius:var(--border--radius-medium, 12px);--ez-text-input--font-size:var(--text--medium, 14px);--ez-text-input--font-family:var(--font-pattern, Arial);--ez-text-input--font-weight:var(--text-weight--medium, 400);--ez-text-input--color:var(--title--primary, #2B3A54);--ez-text-input__input--background-color:var(--background--medium, #e0e0e0);--ez-text-input__input--border:var(--border--medium, 2px solid);--ez-text-input__input--border-color:var(--ez-text-input__input--background-color);--ez-text-input__input--focus--border-color:var(--color--primary, #008561);--ez-text-input__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-text-input__input--disabled--color:var(--text--disable, #AFB6C0);--ez-text-input__input--error--border-color:#CC2936;--ez-text-input__message_box--font-size:var(--text--small, 12px);--ez-text-input__message_box--info--color:var(--color--success, #22085d);--ez-text-input__message_box--error--color:var(--color--error, #FF0000);--ez-text-input__label--floating--top:6px;--ez-text-input__label--padding-top:12px;--ez-text-input__label--padding-left:14px;--ez-text-input__label--padding-right:12px;display:flex;flex-wrap:wrap;position:relative;width:var(--ez-text-input--width)}input{width:100%;box-sizing:border-box;padding:var(--space--medium, 6px);height:var(--ez-text-input--height);border-radius:var(--ez-text-input--border-radius);font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);border:var(--ez-text-input__input--border);border-color:var(--ez-text-input__input--border-color);background-color:var(--ez-text-input__input--background-color);color:var(--ez-text-input--color);font-weight:var(--ez-text-input--font-weight)}input:disabled{background-color:var(--ez-text-input__input--disabled--background-color);color:var(--ez-text-input__input--disabled--color)}input:focus{outline:none;border-color:var(--ez-text-input__input--focus--border-color)}input.icon--left{padding-left:var(--ez-text-input__icon--width)}input.icon--right{padding-right:var(--ez-text-input__icon--width)}input.hasError{color:var(--ez-text-input--color);border-color:var(--ez-text-input__input--error--border-color)}input:disabled.hasError{color:var(--ez-text-input__input--disabled--color)}input.text--right{text-align:right}input:read-only{cursor:default}.message-box{min-height:16px;min-width:100%;margin-top:3px;line-height:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input__message_box--font-size);color:var(--ez-text-input__message_box--info--color)}.hasError{color:var(--ez-text-input__message_box--error--color)}.input__label{box-sizing:border-box;position:absolute;z-index:var(--visible);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-transition:font-size .05s, top .05s;transition:font-size .05s, top .05s;width:calc(100% - var(--ez-text-input__label--padding-right));left:var(--ez-text-input--space--medium);font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color);top:var(--ez-text-input__label--padding-top);left:var(--ez-text-input__label--padding-left);padding-right:var(--ez-text-input__label--padding-right)}.input__label--floated{font-family:var(--ez-text-input--font-family);font-size:var(--text--extra-small);color:var(--text--primary);top:var(--ez-text-input__label--floating--top)}.input__label--disabled{color:var(--ez-text-input__input--disabled--color)}.input__label--left{text-align:left;left:calc(var(--ez-text-input__icon--width) + 2px);width:calc(100% - var(--ez-text-input__icon--width))}.input__label--right{right:var(--ez-text-input__icon--width);width:calc(100% - var(--ez-text-input__icon--width))}.input__label--left.input__label--right{left:calc(var(--ez-text-input__icon--width) + 2px);width:calc(100% - var(--ez-text-input__icon--width) * 2)}.input--with--label{padding-bottom:0}.input--slim{padding-top:var(--space--small, 3px);padding-bottom:var(--space--small, 3px);height:var(--ez-text-input--height--slim)}.input--slim::-webkit-input-placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim:-moz-placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim::-moz-placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim:-ms-input-placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim::placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim:disabled::-webkit-input-placeholder{color:var(--ez-text-input__input--disabled--color)}.input--slim:disabled:-moz-placeholder{color:var(--ez-text-input__input--disabled--color)}.input--slim:disabled::-moz-placeholder{color:var(--ez-text-input__input--disabled--color)}.input--slim:disabled:-ms-input-placeholder{color:var(--ez-text-input__input--disabled--color)}.input--slim:disabled::placeholder{color:var(--ez-text-input__input--disabled--color)}";
|
|
114556
114863
|
|
|
114557
114864
|
let EzTextInput$1 = class extends HTMLElement$1 {
|
|
114558
114865
|
constructor() {
|
|
@@ -114572,23 +114879,20 @@ let EzTextInput$1 = class extends HTMLElement$1 {
|
|
|
114572
114879
|
* Define o modo do tamanho do campo; opções: slim e regular.
|
|
114573
114880
|
*/
|
|
114574
114881
|
this.mode = "regular";
|
|
114575
|
-
/**
|
|
114576
|
-
* Define se o controle de change do value será controlado por um componente pai.
|
|
114577
|
-
*/
|
|
114578
|
-
this.slaveMode = false;
|
|
114579
114882
|
}
|
|
114580
114883
|
observeErrorMessage() {
|
|
114581
|
-
var _a, _b;
|
|
114582
114884
|
if (this._inputElem) {
|
|
114583
|
-
|
|
114584
|
-
|
|
114585
|
-
|
|
114586
|
-
|
|
114587
|
-
|
|
114588
|
-
|
|
114589
|
-
|
|
114590
|
-
|
|
114591
|
-
|
|
114885
|
+
this.isInvalid().then((hasError) => {
|
|
114886
|
+
var _a, _b;
|
|
114887
|
+
if (hasError) {
|
|
114888
|
+
this._inputElem.classList.add("hasError");
|
|
114889
|
+
(_a = this._messageBoxElem) === null || _a === void 0 ? void 0 : _a.classList.add("hasError");
|
|
114890
|
+
}
|
|
114891
|
+
else {
|
|
114892
|
+
this._inputElem.classList.remove("hasError");
|
|
114893
|
+
(_b = this._messageBoxElem) === null || _b === void 0 ? void 0 : _b.classList.remove("hasError");
|
|
114894
|
+
}
|
|
114895
|
+
});
|
|
114592
114896
|
}
|
|
114593
114897
|
}
|
|
114594
114898
|
observeMask() {
|
|
@@ -114607,14 +114911,16 @@ let EzTextInput$1 = class extends HTMLElement$1 {
|
|
|
114607
114911
|
this._inputElem.value = this.value || "";
|
|
114608
114912
|
this.handleChange();
|
|
114609
114913
|
this.adjustFloatingLabel();
|
|
114610
|
-
if (this.
|
|
114611
|
-
|
|
114914
|
+
if (!this.isSlaveMode()) {
|
|
114915
|
+
this.errorMessage = "";
|
|
114916
|
+
this.ezChange.emit(this.value);
|
|
114612
114917
|
}
|
|
114613
|
-
this.errorMessage = "";
|
|
114614
|
-
this.ezChange.emit(this.value);
|
|
114615
114918
|
}
|
|
114616
114919
|
}
|
|
114617
114920
|
}
|
|
114921
|
+
//---------------------------------------------
|
|
114922
|
+
// Private methods
|
|
114923
|
+
//---------------------------------------------
|
|
114618
114924
|
adjustFloatingLabel() {
|
|
114619
114925
|
if (this.label && this._labelElem) {
|
|
114620
114926
|
if (this._inputElem && !this._inputElem.classList.contains("input--with--label")) {
|
|
@@ -114637,6 +114943,15 @@ let EzTextInput$1 = class extends HTMLElement$1 {
|
|
|
114637
114943
|
isFocused() {
|
|
114638
114944
|
return this._hostElement.shadowRoot.activeElement !== null;
|
|
114639
114945
|
}
|
|
114946
|
+
isSlaveMode() {
|
|
114947
|
+
var _a, _b;
|
|
114948
|
+
return ((_b = (_a = this._hostElement) === null || _a === void 0 ? void 0 : _a.dataset) === null || _b === void 0 ? void 0 : _b.slaveMode) === "true";
|
|
114949
|
+
}
|
|
114950
|
+
adjustColorContentSlot(color = "") {
|
|
114951
|
+
if (this._contentLeftSlot) {
|
|
114952
|
+
this._contentLeftSlot.style.color = color;
|
|
114953
|
+
}
|
|
114954
|
+
}
|
|
114640
114955
|
//---------------------------------------------
|
|
114641
114956
|
// Public methods
|
|
114642
114957
|
//---------------------------------------------
|
|
@@ -114652,6 +114967,12 @@ let EzTextInput$1 = class extends HTMLElement$1 {
|
|
|
114652
114967
|
async setBlur() {
|
|
114653
114968
|
this._inputElem.blur();
|
|
114654
114969
|
}
|
|
114970
|
+
/**
|
|
114971
|
+
* Retorna informando se o campo está inválido (true | false)
|
|
114972
|
+
*/
|
|
114973
|
+
async isInvalid() {
|
|
114974
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
114975
|
+
}
|
|
114655
114976
|
//---------------------------------------------
|
|
114656
114977
|
// Event handlers
|
|
114657
114978
|
//---------------------------------------------
|
|
@@ -114667,6 +114988,7 @@ let EzTextInput$1 = class extends HTMLElement$1 {
|
|
|
114667
114988
|
}
|
|
114668
114989
|
this.controlChangeValue();
|
|
114669
114990
|
this.adjustFloatingLabel();
|
|
114991
|
+
this.adjustColorContentSlot();
|
|
114670
114992
|
}
|
|
114671
114993
|
isValidValue(value) {
|
|
114672
114994
|
if (this.restrict) {
|
|
@@ -114675,7 +114997,7 @@ let EzTextInput$1 = class extends HTMLElement$1 {
|
|
|
114675
114997
|
return true;
|
|
114676
114998
|
}
|
|
114677
114999
|
controlChangeValue() {
|
|
114678
|
-
if ((this.value || '') !== this._inputElem.value) {
|
|
115000
|
+
if (this._inputElem && (this.value || '') !== this._inputElem.value) {
|
|
114679
115001
|
this.value = this._inputElem.value;
|
|
114680
115002
|
}
|
|
114681
115003
|
}
|
|
@@ -114711,6 +115033,7 @@ let EzTextInput$1 = class extends HTMLElement$1 {
|
|
|
114711
115033
|
if (this._labelElem) {
|
|
114712
115034
|
this._labelElem.classList.add("input__label--left");
|
|
114713
115035
|
}
|
|
115036
|
+
this._contentLeftSlot = content;
|
|
114714
115037
|
}
|
|
114715
115038
|
else if (slot.name == "rightIcon") {
|
|
114716
115039
|
content.style.right = "0px";
|
|
@@ -114727,6 +115050,7 @@ let EzTextInput$1 = class extends HTMLElement$1 {
|
|
|
114727
115050
|
if (this.label && this._labelElem && !this._labelElem.classList.contains("input__label--floated")) {
|
|
114728
115051
|
this._labelElem.classList.add("input__label--floated");
|
|
114729
115052
|
}
|
|
115053
|
+
this.adjustColorContentSlot("var(--ez-text-input__input--focus--border-color)");
|
|
114730
115054
|
}
|
|
114731
115055
|
//---------------------------------------------
|
|
114732
115056
|
// Lifecycle web component
|
|
@@ -114756,7 +115080,7 @@ let EzTextInput$1 = class extends HTMLElement$1 {
|
|
|
114756
115080
|
render() {
|
|
114757
115081
|
return (h(Host, null, h("slot", { name: "leftIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.label && this.mode != "slim" ?
|
|
114758
115082
|
h("label", { ref: (el) => this._labelElem = el, class: this.enabled ? "input__label" : "input__label input__label--disabled", onClick: () => this._inputElem.focus(), title: this.label }, this.label)
|
|
114759
|
-
: null, h("input", { onFocus: () => this.doFocus(), ref: (el) => this._inputElem = el, type: "text", class: this.mode
|
|
115083
|
+
: null, h("input", { onFocus: () => this.doFocus(), ref: (el) => this._inputElem = el, type: "text", class: this.mode === "slim" ? "input--slim" : "", placeholder: this.mode === "slim" && this.label ? this.label : "", value: this.value, disabled: !this.enabled, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); } }), h("slot", { name: "rightIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.canShowError && this.mode != "slim" &&
|
|
114760
115084
|
h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el, title: this.errorMessage }, this.errorMessage)));
|
|
114761
115085
|
}
|
|
114762
115086
|
get _hostElement() { return this; }
|
|
@@ -114783,7 +115107,7 @@ let EzTimeInput$1 = class extends HTMLElement$1 {
|
|
|
114783
115107
|
*/
|
|
114784
115108
|
this.enabled = true;
|
|
114785
115109
|
/**
|
|
114786
|
-
* Define se o componente irá ou não considerar os segundos
|
|
115110
|
+
* Define se o componente irá ou não considerar os segundos.
|
|
114787
115111
|
*/
|
|
114788
115112
|
this.showSeconds = false;
|
|
114789
115113
|
/**
|
|
@@ -114791,6 +115115,18 @@ let EzTimeInput$1 = class extends HTMLElement$1 {
|
|
|
114791
115115
|
*/
|
|
114792
115116
|
this.mode = "regular";
|
|
114793
115117
|
}
|
|
115118
|
+
observeErrorMessage() {
|
|
115119
|
+
var _a;
|
|
115120
|
+
if (this._textInput) {
|
|
115121
|
+
this._textInput.errorMessage = this.errorMessage;
|
|
115122
|
+
if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
115123
|
+
this.prepareValue(this._viewValue);
|
|
115124
|
+
if ((this._textInput.value || '') !== this._viewValue) {
|
|
115125
|
+
this._textInput.value = this._viewValue;
|
|
115126
|
+
}
|
|
115127
|
+
}
|
|
115128
|
+
}
|
|
115129
|
+
}
|
|
114794
115130
|
observeShowSeconds() {
|
|
114795
115131
|
if (this.showSeconds) {
|
|
114796
115132
|
this.prepareMask("##:##:##");
|
|
@@ -114799,9 +115135,23 @@ let EzTimeInput$1 = class extends HTMLElement$1 {
|
|
|
114799
115135
|
this.prepareMask("##:##");
|
|
114800
115136
|
}
|
|
114801
115137
|
}
|
|
114802
|
-
observeValue() {
|
|
114803
|
-
if (
|
|
114804
|
-
|
|
115138
|
+
observeValue(newValue, oldValue) {
|
|
115139
|
+
if (this._textInput && newValue != oldValue) {
|
|
115140
|
+
let newValueValidated = this.validateValue(newValue);
|
|
115141
|
+
const oldValueValidated = this.validateValue(oldValue);
|
|
115142
|
+
if (newValueValidated != oldValueValidated) {
|
|
115143
|
+
this._viewValue = newValueValidated == undefined ? "" : newValueValidated.toString();
|
|
115144
|
+
this.prepareValue(this._viewValue);
|
|
115145
|
+
if (this._viewValue && !TimeFormatter.validateTime(this._viewValue, this.showSeconds)) {
|
|
115146
|
+
this.setError("Favor inserir um horário válido.");
|
|
115147
|
+
newValueValidated = undefined;
|
|
115148
|
+
}
|
|
115149
|
+
else {
|
|
115150
|
+
this.setError("");
|
|
115151
|
+
}
|
|
115152
|
+
const valueEmitted = newValueValidated === null ? undefined : newValueValidated;
|
|
115153
|
+
this.ezChange.emit(valueEmitted);
|
|
115154
|
+
}
|
|
114805
115155
|
}
|
|
114806
115156
|
}
|
|
114807
115157
|
//---------------------------------------------
|
|
@@ -114815,79 +115165,88 @@ let EzTimeInput$1 = class extends HTMLElement$1 {
|
|
|
114815
115165
|
this._maskFormatter.mask = mask;
|
|
114816
115166
|
}
|
|
114817
115167
|
}
|
|
115168
|
+
validateValue(value) {
|
|
115169
|
+
return isNaN(value) || value === undefined ? null : value;
|
|
115170
|
+
}
|
|
115171
|
+
setError(msg) {
|
|
115172
|
+
this.errorMessage = msg;
|
|
115173
|
+
if (this._textInput && (msg === null || msg === void 0 ? void 0 : msg.trim())) {
|
|
115174
|
+
this.ezCancelWaitingChange.emit();
|
|
115175
|
+
}
|
|
115176
|
+
}
|
|
114818
115177
|
//---------------------------------------------
|
|
114819
115178
|
// Public methods
|
|
114820
115179
|
//---------------------------------------------
|
|
115180
|
+
getViewValue() {
|
|
115181
|
+
return this._viewValue;
|
|
115182
|
+
}
|
|
115183
|
+
prepareValue(value) {
|
|
115184
|
+
try {
|
|
115185
|
+
this._viewValue = TimeFormatter.prepareValue(value, this.showSeconds);
|
|
115186
|
+
if (this._textInput && this._textInput.value !== this._viewValue) {
|
|
115187
|
+
this._textInput.value = this._viewValue;
|
|
115188
|
+
}
|
|
115189
|
+
}
|
|
115190
|
+
catch (e) {
|
|
115191
|
+
this.setError(e.message);
|
|
115192
|
+
}
|
|
115193
|
+
}
|
|
114821
115194
|
/**
|
|
114822
115195
|
* Faz o foco no componente de input
|
|
114823
115196
|
*/
|
|
114824
115197
|
async setFocus() {
|
|
114825
|
-
this.
|
|
115198
|
+
this._textInput.setFocus();
|
|
114826
115199
|
}
|
|
114827
115200
|
/**
|
|
114828
115201
|
* Remove o foco no componente de input
|
|
114829
115202
|
*/
|
|
114830
115203
|
async setBlur() {
|
|
114831
|
-
this.
|
|
115204
|
+
this._textInput.setBlur();
|
|
115205
|
+
}
|
|
115206
|
+
/**
|
|
115207
|
+
* Retorna informando se o campo está inválido (true | false)
|
|
115208
|
+
*/
|
|
115209
|
+
async isInvalid() {
|
|
115210
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
114832
115211
|
}
|
|
114833
115212
|
//---------------------------------------------
|
|
114834
115213
|
// Event handlers
|
|
114835
115214
|
//---------------------------------------------
|
|
114836
|
-
|
|
114837
|
-
this.
|
|
114838
|
-
|
|
114839
|
-
|
|
114840
|
-
this.
|
|
114841
|
-
this.ezCancelWaitingChange.emit();
|
|
114842
|
-
this.errorMessage = "Favor inserir um horário válido.";
|
|
114843
|
-
}
|
|
114844
|
-
else {
|
|
114845
|
-
if (this.viewValue === this._oldViewValue) {
|
|
114846
|
-
this.ezCancelWaitingChange.emit();
|
|
114847
|
-
return;
|
|
114848
|
-
}
|
|
114849
|
-
this._oldViewValue = this.viewValue;
|
|
114850
|
-
if (this.viewValue === "00:00" && this.value == undefined) {
|
|
114851
|
-
this.value = 0;
|
|
114852
|
-
}
|
|
114853
|
-
this.ezChange.emit(this.value);
|
|
115215
|
+
handleBlur() {
|
|
115216
|
+
if (this._textInput) {
|
|
115217
|
+
this._viewValue = this._textInput.value;
|
|
115218
|
+
this.prepareValue(this._viewValue);
|
|
115219
|
+
this.value = NumberUtils.stringToNumber(this._viewValue.replace(/\D/g, ""));
|
|
114854
115220
|
}
|
|
114855
115221
|
}
|
|
114856
|
-
|
|
114857
|
-
|
|
114858
|
-
|
|
114859
|
-
|
|
114860
|
-
catch (e) {
|
|
114861
|
-
this.errorMessage = e.message;
|
|
115222
|
+
handleInput() {
|
|
115223
|
+
const parsedNumber = NumberUtils.stringToNumber(this._textInput.value.replace(/\D/g, ""));
|
|
115224
|
+
if (parsedNumber !== this.value) {
|
|
115225
|
+
this.ezStartChange.emit({ waitmessage: "", blocking: false });
|
|
114862
115226
|
}
|
|
114863
115227
|
}
|
|
114864
|
-
handleChange() {
|
|
114865
|
-
this.ezStartChange.emit({ waitmessage: "", blocking: false });
|
|
114866
|
-
this.viewValue = this._inputElem.value;
|
|
114867
|
-
this.value = NumberUtils.stringToNumber(this.viewValue.replace(/\D/g, ""));
|
|
114868
|
-
}
|
|
114869
115228
|
//---------------------------------------------
|
|
114870
115229
|
// Lifecycle web component
|
|
114871
115230
|
//---------------------------------------------
|
|
114872
115231
|
componentDidLoad() {
|
|
114873
|
-
this.
|
|
114874
|
-
CSSVarsUtils.applyVarsTextInput(this._elem, this._inputElem);
|
|
115232
|
+
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
114875
115233
|
}
|
|
114876
115234
|
componentWillLoad() {
|
|
114877
115235
|
this.observeShowSeconds();
|
|
114878
115236
|
if (this.value) {
|
|
114879
115237
|
this.prepareValue(this.value.toString());
|
|
114880
115238
|
}
|
|
114881
|
-
else if (this.
|
|
114882
|
-
this.prepareValue(this.
|
|
115239
|
+
else if (this._viewValue) {
|
|
115240
|
+
this.prepareValue(this._viewValue);
|
|
114883
115241
|
}
|
|
114884
115242
|
}
|
|
114885
115243
|
render() {
|
|
114886
|
-
return (h(Host, null, h("ez-text-input", { ref: (el) => this.
|
|
115244
|
+
return (h(Host, null, h("ez-text-input", { ref: (el) => this._textInput = el, "data-slave-mode": "true", value: this._viewValue, enabled: this.enabled, label: this.label, restrict: "0123456789:", onBlur: () => this.handleBlur(), onInput: () => this.handleInput(), errorMessage: this.errorMessage, mode: this.mode }, h("ez-icon", { slot: "leftIcon", iconName: "timer-outline" }))));
|
|
114887
115245
|
}
|
|
114888
115246
|
static get assetsDirs() { return ["../assets"]; }
|
|
114889
115247
|
get _elem() { return this; }
|
|
114890
115248
|
static get watchers() { return {
|
|
115249
|
+
"errorMessage": ["observeErrorMessage"],
|
|
114891
115250
|
"showSeconds": ["observeShowSeconds"],
|
|
114892
115251
|
"value": ["observeValue"]
|
|
114893
115252
|
}; }
|
|
@@ -115971,7 +116330,7 @@ const EzCardItem = /*@__PURE__*/proxyCustomElement(EzCardItem$1, [1,"ez-card-ite
|
|
|
115971
116330
|
const EzCheck = /*@__PURE__*/proxyCustomElement(EzCheck$1, [1,"ez-check",{"label":[513],"value":[1540],"enabled":[1540],"mode":[513]}]);
|
|
115972
116331
|
const EzChip = /*@__PURE__*/proxyCustomElement(EzChip$1, [1,"ez-chip",{"label":[513],"enabled":[516],"removePosition":[513,"remove-position"],"mode":[513],"value":[1540]}]);
|
|
115973
116332
|
const EzCollapsibleBox = /*@__PURE__*/proxyCustomElement(EzCollapsibleBox$1, [1,"ez-collapsible-box",{"value":[1540],"label":[513],"headerSize":[513,"header-size"],"iconPlacement":[513,"icon-placement"],"stretchTitle":[516,"stretch-title"]}]);
|
|
115974
|
-
const EzComboBox = /*@__PURE__*/proxyCustomElement(EzComboBox$1, [1,"ez-combo-box",{"value":[1537],"label":[513],"enabled":[516],"options":[1040],"errorMessage":[1537,"error-message"],"searchMode":[4,"search-mode"],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressSearch":[4,"suppress-search"],"optionLoader":[16],"suppressEmptyOption":[4,"suppress-empty-option"],"canShowError":[516,"can-show-error"],"mode":[513],"_preSelection":[32],"_visibleOptions":[32],"_startLoading":[32],"_showLoading":[32]}]);
|
|
116333
|
+
const EzComboBox = /*@__PURE__*/proxyCustomElement(EzComboBox$1, [1,"ez-combo-box",{"value":[1537],"label":[513],"enabled":[516],"options":[1040],"errorMessage":[1537,"error-message"],"searchMode":[4,"search-mode"],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressSearch":[4,"suppress-search"],"optionLoader":[16],"suppressEmptyOption":[4,"suppress-empty-option"],"canShowError":[516,"can-show-error"],"mode":[513],"_preSelection":[32],"_visibleOptions":[32],"_startLoading":[32],"_showLoading":[32],"_criteria":[32]}]);
|
|
115975
116334
|
const EzDateInput = /*@__PURE__*/proxyCustomElement(EzDateInput$1, [1,"ez-date-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"mode":[513]}]);
|
|
115976
116335
|
const EzDateTimeInput = /*@__PURE__*/proxyCustomElement(EzDateTimeInput$1, [1,"ez-date-time-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513]}]);
|
|
115977
116336
|
const EzDialog = /*@__PURE__*/proxyCustomElement(EzDialog$1, [1,"ez-dialog",{"confirm":[1028],"critical":[1028],"message":[1025],"opened":[1540],"personalizedIconPath":[1025,"personalized-icon-path"],"ezTitle":[1025,"ez-title"]}]);
|
|
@@ -115988,8 +116347,8 @@ const EzPopup = /*@__PURE__*/proxyCustomElement(EzPopup$1, [1,"ez-popup",{"size"
|
|
|
115988
116347
|
const EzSearch = /*@__PURE__*/proxyCustomElement(EzSearch$1, [1,"ez-search",{"value":[1537],"label":[1537],"enabled":[1540],"errorMessage":[1537,"error-message"],"optionLoader":[16],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressEmptyOption":[4,"suppress-empty-option"],"mode":[513]}]);
|
|
115989
116348
|
const EzTabselector = /*@__PURE__*/proxyCustomElement(EzTabselector$1, [1,"ez-tabselector",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1]}]);
|
|
115990
116349
|
const EzTextArea = /*@__PURE__*/proxyCustomElement(EzTextArea$1, [1,"ez-text-area",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"rows":[1538],"canShowError":[516,"can-show-error"],"mode":[513]}]);
|
|
115991
|
-
const EzTextInput = /*@__PURE__*/proxyCustomElement(EzTextInput$1, [1,"ez-text-input",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"mask":[1],"canShowError":[516,"can-show-error"],"restrict":[1],"mode":[513]
|
|
115992
|
-
const EzTimeInput = /*@__PURE__*/proxyCustomElement(EzTimeInput$1, [1,"ez-time-input",{"label":[513],"
|
|
116350
|
+
const EzTextInput = /*@__PURE__*/proxyCustomElement(EzTextInput$1, [1,"ez-text-input",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"mask":[1],"canShowError":[516,"can-show-error"],"restrict":[1],"mode":[513]}]);
|
|
116351
|
+
const EzTimeInput = /*@__PURE__*/proxyCustomElement(EzTimeInput$1, [1,"ez-time-input",{"label":[513],"value":[1026],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513]}]);
|
|
115993
116352
|
const EzToast = /*@__PURE__*/proxyCustomElement(EzToast$1, [1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"],"canClose":[1028,"can-close"]}]);
|
|
115994
116353
|
const EzUpload = /*@__PURE__*/proxyCustomElement(EzUpload$1, [1,"ez-upload",{"label":[1],"enabled":[4],"maxFileSize":[2,"max-file-size"],"maxFiles":[2,"max-files"],"requestHeaders":[8,"request-headers"],"urlUpload":[1,"url-upload"],"urlDelete":[1,"url-delete"],"value":[1040]}]);
|
|
115995
116354
|
const EzViewStack = /*@__PURE__*/proxyCustomElement(EzViewStack$1, [0,"ez-view-stack"]);
|