@sankhyalabs/ezui 1.1.159 → 1.1.161

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/dist/cjs/ez-combo-box.cjs.entry.js +63 -28
  2. package/dist/cjs/ez-date-input.cjs.entry.js +71 -25
  3. package/dist/cjs/ez-date-time-input.cjs.entry.js +94 -31
  4. package/dist/cjs/ez-filter-input.cjs.entry.js +10 -4
  5. package/dist/cjs/ez-form.cjs.entry.js +54 -9
  6. package/dist/cjs/{grid-config.cjs.entry.js → ez-grid-config.cjs.entry.js} +6 -6
  7. package/dist/cjs/ez-grid.cjs.entry.js +16 -9
  8. package/dist/cjs/ez-list.cjs.entry.js +1 -1
  9. package/dist/cjs/ez-modal.cjs.entry.js +1 -1
  10. package/dist/cjs/ez-number-input.cjs.entry.js +69 -25
  11. package/dist/cjs/ez-search.cjs.entry.js +20 -5
  12. package/dist/cjs/{select-box.cjs.entry.js → ez-select-box.cjs.entry.js} +3 -3
  13. package/dist/cjs/ez-text-area.cjs.entry.js +8 -2
  14. package/dist/cjs/ez-text-input.cjs.entry.js +30 -21
  15. package/dist/cjs/ez-time-input.cjs.entry.js +75 -40
  16. package/dist/cjs/ezui.cjs.js +1 -1
  17. package/dist/cjs/loader.cjs.js +1 -1
  18. package/dist/collection/collection-manifest.json +2 -2
  19. package/dist/collection/components/ez-combo-box/ez-combo-box.css +10 -4
  20. package/dist/collection/components/ez-combo-box/ez-combo-box.js +81 -28
  21. package/dist/collection/components/ez-date-input/ez-date-input.js +87 -25
  22. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +108 -31
  23. package/dist/collection/components/ez-filter-input/ez-filter-input.js +26 -4
  24. package/dist/collection/components/ez-form/DataBinder.js +12 -3
  25. package/dist/collection/components/ez-form/ez-form.js +43 -6
  26. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +7 -3
  27. package/dist/collection/components/ez-grid/ez-grid.css +4 -0
  28. package/dist/collection/components/ez-grid/ez-grid.js +21 -14
  29. package/dist/collection/components/ez-grid/subcomponents/{gridconfig/grid-config.css → ez-grid-config/ez-grid-config.css} +46 -20
  30. package/dist/collection/components/ez-grid/subcomponents/{gridconfig/grid-config.js → ez-grid-config/ez-grid-config.js} +12 -12
  31. package/dist/collection/components/ez-grid/subcomponents/{select-box/select-box.css → ez-select-box/ez-select-box.css} +3 -4
  32. package/dist/collection/components/ez-grid/subcomponents/{select-box/select-box.js → ez-select-box/ez-select-box.js} +3 -3
  33. package/dist/collection/components/ez-list/ez-list.css +84 -46
  34. package/dist/collection/components/ez-modal/ez-modal.css +2 -2
  35. package/dist/collection/components/ez-number-input/ez-number-input.js +83 -25
  36. package/dist/collection/components/ez-search/ez-search.js +38 -5
  37. package/dist/collection/components/ez-text-area/ez-text-area.css +1 -1
  38. package/dist/collection/components/ez-text-area/ez-text-area.js +23 -1
  39. package/dist/collection/components/ez-text-input/ez-text-input.css +1 -1
  40. package/dist/collection/components/ez-text-input/ez-text-input.js +45 -38
  41. package/dist/collection/components/ez-time-input/ez-time-input.js +95 -59
  42. package/dist/custom-elements/index.d.ts +12 -12
  43. package/dist/custom-elements/index.js +1121 -810
  44. package/dist/esm/ez-combo-box.entry.js +63 -28
  45. package/dist/esm/ez-date-input.entry.js +71 -25
  46. package/dist/esm/ez-date-time-input.entry.js +94 -31
  47. package/dist/esm/ez-filter-input.entry.js +10 -4
  48. package/dist/esm/ez-form.entry.js +54 -9
  49. package/dist/esm/{grid-config.entry.js → ez-grid-config.entry.js} +6 -6
  50. package/dist/esm/ez-grid.entry.js +16 -9
  51. package/dist/esm/ez-list.entry.js +1 -1
  52. package/dist/esm/ez-modal.entry.js +1 -1
  53. package/dist/esm/ez-number-input.entry.js +69 -25
  54. package/dist/esm/ez-search.entry.js +20 -5
  55. package/dist/esm/{select-box.entry.js → ez-select-box.entry.js} +3 -3
  56. package/dist/esm/ez-text-area.entry.js +8 -2
  57. package/dist/esm/ez-text-input.entry.js +30 -21
  58. package/dist/esm/ez-time-input.entry.js +76 -41
  59. package/dist/esm/ezui.js +1 -1
  60. package/dist/esm/loader.js +1 -1
  61. package/dist/ezui/ezui.esm.js +1 -1
  62. package/dist/ezui/p-003d53b1.entry.js +1 -0
  63. package/dist/ezui/p-1fecaeb8.entry.js +1 -0
  64. package/dist/ezui/p-267fa515.entry.js +1 -0
  65. package/dist/ezui/p-2acf7d59.entry.js +1 -0
  66. package/dist/ezui/p-403de0a4.entry.js +1 -0
  67. package/dist/ezui/p-4c3d136c.entry.js +1 -0
  68. package/dist/ezui/p-53bbba8e.entry.js +1 -0
  69. package/dist/ezui/p-6668c3b0.entry.js +1 -0
  70. package/dist/ezui/p-7fd6deec.entry.js +1 -0
  71. package/dist/ezui/p-8c1b9fe0.entry.js +1 -0
  72. package/dist/ezui/{p-be87ac5e.entry.js → p-8d73594f.entry.js} +1 -1
  73. package/dist/ezui/p-988ff301.entry.js +1 -0
  74. package/dist/ezui/p-cf56d3e8.entry.js +1 -0
  75. package/dist/ezui/{p-727a39e5.entry.js → p-fd6f3bf9.entry.js} +1 -1
  76. package/dist/ezui/p-ff7b4b13.entry.js +1 -0
  77. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +13 -7
  78. package/dist/types/components/ez-date-input/ez-date-input.d.ts +10 -3
  79. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +15 -7
  80. package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +5 -1
  81. package/dist/types/components/ez-form/DataBinder.d.ts +1 -1
  82. package/dist/types/components/ez-form/ez-form.d.ts +1 -0
  83. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +1 -1
  84. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +1 -0
  85. package/dist/types/components/ez-grid/ez-grid.d.ts +9 -6
  86. package/dist/types/components/ez-grid/subcomponents/{gridconfig/grid-config.d.ts → ez-grid-config/ez-grid-config.d.ts} +4 -4
  87. package/dist/types/components/ez-grid/subcomponents/{select-box/select-box.d.ts → ez-select-box/ez-select-box.d.ts} +0 -0
  88. package/dist/types/components/ez-number-input/ez-number-input.d.ts +14 -5
  89. package/dist/types/components/ez-search/ez-search.d.ts +6 -1
  90. package/dist/types/components/ez-text-area/ez-text-area.d.ts +4 -0
  91. package/dist/types/components/ez-text-input/ez-text-input.d.ts +7 -6
  92. package/dist/types/components/ez-time-input/ez-time-input.d.ts +17 -13
  93. package/dist/types/components.d.ts +84 -61
  94. package/package.json +1 -1
  95. package/react/components.d.ts +2 -2
  96. package/react/components.js +2 -2
  97. package/react/components.js.map +1 -1
  98. package/dist/ezui/p-1859a3d8.entry.js +0 -1
  99. package/dist/ezui/p-49fdfa4b.entry.js +0 -1
  100. package/dist/ezui/p-4fdceb7d.entry.js +0 -1
  101. package/dist/ezui/p-6d4b1628.entry.js +0 -1
  102. package/dist/ezui/p-8f4fac31.entry.js +0 -1
  103. package/dist/ezui/p-91377c65.entry.js +0 -1
  104. package/dist/ezui/p-b524dfca.entry.js +0 -1
  105. package/dist/ezui/p-bc8aa27f.entry.js +0 -1
  106. package/dist/ezui/p-bea6f8a6.entry.js +0 -1
  107. package/dist/ezui/p-c2de757f.entry.js +0 -1
  108. package/dist/ezui/p-ec21ecce.entry.js +0 -1
  109. package/dist/ezui/p-ecee9d8d.entry.js +0 -1
  110. package/dist/ezui/p-fc9b9487.entry.js +0 -1
@@ -3,7 +3,7 @@ import { FloatingManager } from '@sankhyalabs/core';
3
3
  import { A as ApplicationUtils } from './ApplicationUtils-35350d20.js';
4
4
  import { C as CSSVarsUtils } from './CSSVarsUtils-eb4c5af6.js';
5
5
 
6
- const ezComboBoxCss = ":host{--ez-combo-box--height:42px;--ez-combo-box--width:100%;--ez-combo-box__icon--width:48px;--ez-combo-box--border-radius:var(--border--radius-medium, 12px);--ez-combo-box--border-radius-small:var(--border--radius-small, 6px);--ez-combo-box--font-size:var(--text--medium, 14px);--ez-combo-box--font-family:var(--font-pattern, Arial);--ez-combo-box--font-weight--large:var(--text-weight--large, 500);--ez-combo-box--font-weight--medium:var(--text-weight--medium, 400);--ez-combo-box--background-color--xlight:var(--background--xlight, #fff);--ez-combo-box--background-medium:var(--background--medium, #f0f3f7);--ez-combo-box__input--background-color:var(--background--medium, #e0e0e0);--ez-combo-box__input--border:var(--border--medium, 2px solid);--ez-combo-box__input--border-color:var(--ez-combo-box__input--background-color);--ez-combo-box__input--focus--border-color:var(--color--primary, #008561);--ez-combo-box__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-combo-box__input--disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__input--error--border-color:#CC2936;--ez-combo-box__btn--color:var(--title--primary, #2B3A54);--ez-combo-box__btn-disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__btn-hover--color:var(--color--primary, #4e4e4e);--ez-combo-box__label--color:var(--title--primary, #2B3A54);--ez-combo-box__list-title--primary:var(--title--primary, #2B3A54);--ez-combo-box__list-text--primary:var(--text--primary, #626e82);--ez-combo-box__list-height:calc(var(--ez-combo-box--font-size) + var(--ez-combo-box--space--medium));--ez-combo-box--space--medium:var(--space--medium, 12px);--ez-combo-box--space--small:var(--space--small, 6px);--ez-combo-box__list-scrollbar--background-color:var(--title--primary, #2B3A54);--ez-combo-box__list-scrollbar--border-radius:var(--border--radius-small, 6px);--ez-combo-box__list-scrollbar--width:var(--space--medium, 12px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-combo-box--width)}ez-icon{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.suppressed-search-input{--ez-text-input__input--border-color:var(--color--strokes, #dce0e8);--ez-text-input__input--disabled--background-color:var(--background--xlight, #fff);--ez-text-input__input--disabled--color:var(--title--primary, #2B3A54)}.list-container{position:relative;width:100%}.list-wrapper{display:flex;flex-direction:column;box-sizing:border-box;width:100%;z-index:var(--more-visible, 2);max-height:calc(4*var(--ez-combo-box__list-height) + 2*var(--ez-combo-box--space--small));background-color:var(--ez-combo-box--background-color--xlight);border-radius:var(--ez-combo-box--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000);padding:var(--ez-combo-box--space--small)}.list-options{box-sizing:border-box;width:100%;height:100%;display:flex;flex-direction:column;scroll-behavior:smooth;overflow:auto}.list-options::-webkit-scrollbar-track{background-color:#f0f2f5;border-radius:var(--ez-combo-box__list-scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-combo-box__list-scrollbar--background-color);border-radius:var(--ez-combo-box__list-scrollbar--border-radius)}.list-options::-webkit-scrollbar{background-color:#f0f2f5;width:var(--ez-combo-box__list-scrollbar--width);max-width:var(--ez-combo-box__list-scrollbar--width);min-width:var(--ez-combo-box__list-scrollbar--width)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-combo-box--border-radius-small);padding:0 var(--ez-combo-box--space--small);min-height:var(--ez-combo-box__list-height);gap:var(--space--small, 6px)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-combo-box__list-title--primary);font-weight:var(--ez-combo-box--font-weight--large);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size)}.item__value{text-align:center;color:var(--ez-combo-box__list-text--primary)}.item__value--hidden{visibility:hidden;position:absolute;z-index:-1;top:0;left:0}.item__label{text-align:left}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;min-height:calc(var(--ez-combo-box__list-height) * 1.5)}.message__no-result{color:var(--ez-combo-box__list-title--primary);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size)}.message__loading{border-radius:50%;width:16px;height:16px;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:3px solid var(--ez-combo-box__list-title--primary);border-top:3px solid transparent}li:hover{background-color:var(--ez-combo-box--background-medium)}.preselected{background-color:var(--background--medium)}.btn{outline:none;border:none;background:none;cursor:pointer;color:var(--ez-combo-box__btn--color)}.btn:disabled{cursor:unset;color:var(--ez-combo-box__btn-disabled--color)}.btn:disabled:hover{cursor:unset;color:var(--ez-combo-box__btn-disabled--color)}.btn:hover{color:var(--ez-combo-box__btn-hover--color)}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";
6
+ const ezComboBoxCss = ":host{--ez-combo-box--height:42px;--ez-combo-box--width:100%;--ez-combo-box__icon--width:48px;--ez-combo-box--border-radius:var(--border--radius-medium, 12px);--ez-combo-box--border-radius-small:var(--border--radius-small, 6px);--ez-combo-box--font-size:var(--text--medium, 14px);--ez-combo-box--font-family:var(--font-pattern, Arial);--ez-combo-box--font-weight--large:var(--text-weight--large, 500);--ez-combo-box--font-weight--medium:var(--text-weight--medium, 400);--ez-combo-box--background-color--xlight:var(--background--xlight, #fff);--ez-combo-box--background-medium:var(--background--medium, #f0f3f7);--ez-combo-box__input--background-color:var(--background--medium, #e0e0e0);--ez-combo-box__input--border:var(--border--medium, 2px solid);--ez-combo-box__input--border-color:var(--ez-combo-box__input--background-color);--ez-combo-box__input--focus--border-color:var(--color--primary, #008561);--ez-combo-box__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-combo-box__input--disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__input--error--border-color:#CC2936;--ez-combo-box__btn--color:var(--title--primary, #2B3A54);--ez-combo-box__btn-disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__btn-hover--color:var(--color--primary, #4e4e4e);--ez-combo-box__label--color:var(--title--primary, #2B3A54);--ez-combo-box__list-title--primary:var(--title--primary, #2B3A54);--ez-combo-box__list-text--primary:var(--text--primary, #626e82);--ez-combo-box__list-height:calc(var(--ez-combo-box--font-size) + var(--ez-combo-box--space--medium));--ez-combo-box--space--medium:var(--space--medium, 12px);--ez-combo-box--space--small:var(--space--small, 6px);--ez-combo-box__list-scrollbar--background-color-primary:var(--scrollbar--primary, #2B3A54);--ez-combo-box__list-scrollbar--background-color-secondary:var(--scrollbar--secondary, #E5EAF0);--ez-combo-box__list-scrollbar--border-radius:var(--border--radius-small, 6px);--ez-combo-box__list-scrollbar--width:var(--space--medium, 12px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-combo-box--width)}ez-icon{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.suppressed-search-input{--ez-text-input__input--border-color:var(--color--strokes, #dce0e8);--ez-text-input__input--disabled--background-color:var(--background--xlight, #fff);--ez-text-input__input--disabled--color:var(--title--primary, #2B3A54)}.list-container{position:relative;width:100%}.list-wrapper{display:flex;flex-direction:column;box-sizing:border-box;width:100%;z-index:var(--more-visible, 2);max-height:calc(4*var(--ez-combo-box__list-height) + 2*var(--ez-combo-box--space--small));background-color:var(--ez-combo-box--background-color--xlight);border-radius:var(--ez-combo-box--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000);padding:var(--ez-combo-box--space--small)}.list-options{box-sizing:border-box;width:100%;height:100%;display:flex;flex-direction:column;scroll-behavior:smooth;overflow:auto;scrollbar-width:thin;scrollbar-color:var(--ez-combo-box__list-scrollbar--background-color-primary) var(--ez-combo-box__list-scrollbar--background-color-secondary)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-combo-box__list-scrollbar--background-color-secondary);border-radius:var(--ez-combo-box__list-scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-combo-box__list-scrollbar--background-color-primary);border-radius:var(--ez-combo-box__list-scrollbar--border-radius)}.list-options::-webkit-scrollbar{background-color:var(--ez-combo-box__list-scrollbar--background-color-secondary);width:var(--ez-combo-box__list-scrollbar--width);max-width:var(--ez-combo-box__list-scrollbar--width);min-width:var(--ez-combo-box__list-scrollbar--width)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-combo-box--border-radius-small);padding:0 var(--ez-combo-box--space--small);min-height:var(--ez-combo-box__list-height);gap:var(--space--small, 6px)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-combo-box__list-title--primary);font-weight:var(--ez-combo-box--font-weight--large);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size)}.item__value{text-align:center;color:var(--ez-combo-box__list-text--primary)}.item__value--hidden{visibility:hidden;position:absolute;z-index:-1;top:0;left:0}.item__label{text-align:left}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;min-height:calc(var(--ez-combo-box__list-height) * 1.5)}.message__no-result{color:var(--ez-combo-box__list-title--primary);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size)}.message__loading{border-radius:50%;width:16px;height:16px;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:3px solid var(--ez-combo-box__list-title--primary);border-top:3px solid transparent}li:hover{background-color:var(--ez-combo-box--background-medium)}.preselected{background-color:var(--background--medium)}.btn{outline:none;border:none;background:none;cursor:pointer;color:var(--ez-combo-box__btn--color)}.btn:disabled{cursor:unset;color:var(--ez-combo-box__btn-disabled--color)}.btn:disabled:hover{cursor:unset;color:var(--ez-combo-box__btn-disabled--color)}.btn:hover{color:var(--ez-combo-box__btn-hover--color)}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";
7
7
 
8
8
  let EzComboBox = class {
9
9
  constructor(hostRef) {
@@ -46,40 +46,66 @@ let EzComboBox = class {
46
46
  */
47
47
  this.mode = "regular";
48
48
  }
49
- observeValue() {
50
- if (this._inputElement) {
51
- this._inputElement.value = this.getText();
49
+ observeErrorMessage() {
50
+ var _a;
51
+ if (this._textInput) {
52
+ this._textInput.errorMessage = this.errorMessage;
53
+ if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
54
+ this.setInputValue();
55
+ }
56
+ }
57
+ }
58
+ observeValue(newValue, oldValue) {
59
+ var _a, _b, _c, _d;
60
+ if (this._textInput && newValue != oldValue) {
61
+ const newValueSelected = this.getSelectedOption(newValue);
62
+ const oldValueSelected = this.getSelectedOption(oldValue);
63
+ const currentValue = this.getSelectedOption(this.value);
64
+ if (((_a = currentValue === null || currentValue === void 0 ? void 0 : currentValue.value) === null || _a === void 0 ? void 0 : _a.toString()) != ((_b = newValueSelected === null || newValueSelected === void 0 ? void 0 : newValueSelected.value) === null || _b === void 0 ? void 0 : _b.toString())) {
65
+ this.value = newValueSelected;
66
+ }
67
+ if (((_c = newValueSelected === null || newValueSelected === void 0 ? void 0 : newValueSelected.value) === null || _c === void 0 ? void 0 : _c.toString()) !== ((_d = oldValueSelected === null || oldValueSelected === void 0 ? void 0 : oldValueSelected.value) === null || _d === void 0 ? void 0 : _d.toString())) {
68
+ this.setInputValue();
69
+ const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
70
+ this.ezChange.emit(valueEmitted);
71
+ }
72
+ this.hideOptions();
73
+ this._criteria = undefined;
74
+ this._preSelection = undefined;
75
+ this.updateVisibleOptions();
52
76
  }
53
- this.hideOptions();
54
- this._criteria = undefined;
55
- this._preSelection = undefined;
56
- this.updateVisibleOptions();
57
77
  }
58
78
  /**
59
79
  * Realiza o foco no componente de seleção
60
80
  */
61
81
  async setFocus() {
62
- this._inputElement.setFocus();
82
+ this._textInput.setFocus();
63
83
  }
64
84
  /**
65
85
  * Remove o foco no componente de seleção
66
86
  */
67
87
  async setBlur() {
68
- this._inputElement.setBlur();
88
+ this._textInput.setBlur();
89
+ }
90
+ /**
91
+ * Retorna informando se o campo está inválido (true | false)
92
+ */
93
+ async isInvalid() {
94
+ return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
69
95
  }
70
96
  getText() {
71
97
  let text = "";
72
- const selected = this.getSelectedOption();
73
- if (selected) {
74
- text = this.showSelectedValue ? `${selected.value} - ${selected.label}` : selected.label;
98
+ const currentValue = this.getSelectedOption(this.value);
99
+ if (currentValue) {
100
+ text = this.showSelectedValue ? `${currentValue.value} - ${currentValue.label}` : currentValue.label;
75
101
  }
76
102
  return text;
77
103
  }
78
- getSelectedOption() {
79
- if (typeof this.value === "string" || this.value instanceof String) {
80
- return this._visibleOptions.find(o => o.value === this.value);
104
+ getSelectedOption(value) {
105
+ if (typeof value === "string" || value instanceof String) {
106
+ return this._visibleOptions.find(o => o.value === value);
81
107
  }
82
- return this.value;
108
+ return value;
83
109
  }
84
110
  updateVisibleOptions() {
85
111
  let opts = this._source || [];
@@ -134,7 +160,7 @@ let EzComboBox = class {
134
160
  //FIXME: Provavelmente isso fará com que o popup abra em uma
135
161
  //posição errada no futuro. Preferi fazer simples no começo,
136
162
  //porque não quis onerar o text input com essa funcionalidade...
137
- const top = (this.errorMessage || !this.canShowError || this.mode == "slim") ? "0px" : "-19px";
163
+ const top = (this.errorMessage || !this.canShowError || this.mode === "slim") ? "0px" : "-19px";
138
164
  this._floatingID = FloatingManager.float(this._listWrapper, this._listContainer, { autoClose: true, top });
139
165
  window.requestAnimationFrame(() => {
140
166
  this._listWrapper.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
@@ -217,15 +243,13 @@ let EzComboBox = class {
217
243
  }
218
244
  selectOption(newOption) {
219
245
  var _a, _b;
220
- const currentOpt = this.getSelectedOption();
221
- if (((_a = currentOpt === null || currentOpt === void 0 ? void 0 : currentOpt.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())) {
246
+ const currentValue = this.getSelectedOption(this.value);
247
+ if (((_a = currentValue === null || currentValue === void 0 ? void 0 : currentValue.value) === null || _a === void 0 ? void 0 : _a.toString()) !== ((_b = newOption === null || newOption === void 0 ? void 0 : newOption.value) === null || _b === void 0 ? void 0 : _b.toString())) {
222
248
  const adjustedOpt = !(newOption === null || newOption === void 0 ? void 0 : newOption.value) ? undefined : newOption;
223
249
  this.value = adjustedOpt;
224
- this.errorMessage = "";
225
- this.ezChange.emit(this.value);
226
250
  }
227
251
  else {
228
- this.observeValue();
252
+ this.setInputValue();
229
253
  }
230
254
  if (this.searchMode) {
231
255
  this._visibleOptions = [];
@@ -242,11 +266,20 @@ let EzComboBox = class {
242
266
  }
243
267
  }
244
268
  cancelPreselection() {
245
- if (!this._inputElement.value && this.value) {
269
+ if (!this._textInput.value && this.value) {
246
270
  this.selectOption(undefined);
247
271
  }
248
272
  else {
249
- this.observeValue();
273
+ this.setInputValue();
274
+ }
275
+ }
276
+ setInputValue(clearError = true) {
277
+ const textValue = this.getText();
278
+ if ((this._textInput.value || '') !== textValue) {
279
+ this._textInput.value = textValue;
280
+ if (clearError) {
281
+ this.errorMessage = "";
282
+ }
250
283
  }
251
284
  }
252
285
  clearSearch() {
@@ -304,7 +337,8 @@ let EzComboBox = class {
304
337
  }
305
338
  }
306
339
  componentDidLoad() {
307
- CSSVarsUtils.applyVarsTextInput(this.el, this._inputElement);
340
+ CSSVarsUtils.applyVarsTextInput(this.el, this._textInput);
341
+ this.setInputValue(false);
308
342
  }
309
343
  //---------------------------------------------
310
344
  // Event handlers
@@ -324,7 +358,7 @@ let EzComboBox = class {
324
358
  const argument = (_a = event.target.value) === null || _a === void 0 ? void 0 : _a.trim();
325
359
  const argumentNumber = Number(argument || undefined);
326
360
  if (!this._criteria) {
327
- this._inputElement.value = event.data || argument;
361
+ this._textInput.value = event.data || argument;
328
362
  }
329
363
  this._criteria = argument;
330
364
  if (argument && (!isNaN(argumentNumber) || argument.length >= this._limitCharsToSearch)) {
@@ -382,7 +416,7 @@ let EzComboBox = class {
382
416
  }
383
417
  render() {
384
418
  var _a;
385
- return (h(Host, null, h("ez-text-input", { class: this.suppressSearch ? "suppressed-search-input" : "", ref: elem => this._inputElement = elem, enabled: this.enabled && !this.suppressSearch, onInput: event => this.onTextInputChangeHandler(event), onClick: () => this.onTextInputClickHandler(), onFocusout: () => this.onTextInputFocusOutHandler(), onKeyDown: event => this.keyDownHandler(event), label: this.label, value: this.getText(), canShowError: this.canShowError, errorMessage: this.errorMessage, mode: this.mode, slaveMode: true }, 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._inputElement) === null || _a === void 0 ? void 0 : _a.value) && (this._criteria || this.value)
419
+ return (h(Host, null, h("ez-text-input", { class: this.suppressSearch ? "suppressed-search-input" : "", ref: elem => this._textInput = elem, "data-slave-mode": "true", enabled: this.enabled && !this.suppressSearch, onInput: event => this.onTextInputChangeHandler(event), onClick: () => this.onTextInputClickHandler(), onFocusout: () => this.onTextInputFocusOutHandler(), onKeyDown: event => this.keyDownHandler(event), label: this.label, canShowError: this.canShowError, errorMessage: this.errorMessage, mode: this.mode }, h("button", { class: "btn", slot: this.searchMode ? "leftIcon" : "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.handlerIconClick() }, h("ez-icon", { iconName: this.searchMode ? "search" : "chevron-down" })), this.searchMode && ((_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value) && (this._criteria || this.value)
386
420
  ? h("button", { class: "btn", slot: "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.clearSearch() }, h("ez-icon", { iconName: "close" }))
387
421
  : undefined), h("section", { class: "list-container", ref: elem => this._listContainer = elem }, h("div", { class: "list-wrapper", ref: elem => this._listWrapper = elem }, h("div", { class: "list-options", ref: elem => this._optionsList = elem }, this._visibleOptions.length === 0
388
422
  && h("div", { class: "message" }, !this._showLoading && h("span", { class: "message__no-result" }, this._textEmptyList), this._showLoading && h("div", { class: "message__loading" })), this.showOptionValue
@@ -391,6 +425,7 @@ let EzComboBox = class {
391
425
  }
392
426
  get el() { return getElement(this); }
393
427
  static get watchers() { return {
428
+ "errorMessage": ["observeErrorMessage"],
394
429
  "value": ["observeValue"]
395
430
  }; }
396
431
  };
@@ -10,6 +10,7 @@ let EzDateInput = class {
10
10
  this.ezChange = createEvent(this, "ezChange", 7);
11
11
  this.ezStartChange = createEvent(this, "ezStartChange", 7);
12
12
  this.ezCancelWaitingChange = createEvent(this, "ezCancelWaitingChange", 7);
13
+ this._focused = false;
13
14
  /**
14
15
  * Deixa o campo disponível ou não para uso.
15
16
  */
@@ -20,18 +21,33 @@ let EzDateInput = class {
20
21
  this.mode = "regular";
21
22
  }
22
23
  observeLabel() {
23
- this._textInput.label = this.label;
24
+ if (this._textInput) {
25
+ this._textInput.label = this.label;
26
+ }
24
27
  }
25
28
  observeErrorMessage() {
29
+ var _a;
26
30
  if (this._textInput) {
27
31
  this._textInput.errorMessage = this.errorMessage;
32
+ if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
33
+ this.setInputValue();
34
+ }
28
35
  }
29
36
  }
30
37
  observeValue(newValue, oldValue) {
31
- if (newValue != oldValue) {
32
- if (this._textInput) {
33
- this.errorMessage = "";
34
- this._textInput.value = this.getTextValue(this.value);
38
+ if (this._textInput && newValue != oldValue) {
39
+ const newValueValidated = this.validateValue(newValue);
40
+ const oldValueValidated = this.validateValue(oldValue);
41
+ if ((newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime()) !== (oldValueValidated === null || oldValueValidated === void 0 ? void 0 : oldValueValidated.getTime())) {
42
+ const textValue = this.getTextValue(newValueValidated) || '';
43
+ const parsedDate = DateUtils.strToDate(textValue);
44
+ if ((parsedDate || !this._focused) && (this._textInput.value || '') !== textValue) {
45
+ this._textInput.value = textValue;
46
+ this._focused = false;
47
+ this.errorMessage = "";
48
+ }
49
+ const valueEmitted = newValueValidated === null ? undefined : newValueValidated;
50
+ this.ezChange.emit(valueEmitted);
35
51
  }
36
52
  }
37
53
  }
@@ -47,59 +63,89 @@ let EzDateInput = class {
47
63
  async setBlur() {
48
64
  this._textInput.setBlur();
49
65
  }
66
+ /**
67
+ * Retorna informando se o campo está inválido (true | false)
68
+ */
69
+ async isInvalid() {
70
+ return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
71
+ }
50
72
  changeValue(newValue) {
51
- var _a;
52
- newValue = newValue instanceof Date ? DateUtils.clearTime(newValue) : undefined;
53
- this.value = this.value instanceof Date ? DateUtils.clearTime(this.value) : undefined;
54
- this._textInput.errorMessage = "";
55
- if ((newValue === null || newValue === void 0 ? void 0 : newValue.toString()) !== ((_a = this.value) === null || _a === void 0 ? void 0 : _a.toString())) {
56
- this.value = newValue;
57
- this.ezChange.emit(this.value);
73
+ const currentValue = this.validateValue(this.value);
74
+ const newValueValidated = this.validateValue(newValue);
75
+ if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
76
+ this.value = newValueValidated;
58
77
  }
59
78
  }
60
79
  showCalendar() {
61
- this.parseDate();
80
+ this.handleBlur();
62
81
  this._calendar.value = this.value;
63
82
  //FIXME: Provavelmente isso fará com que o popup abra em uma
64
83
  //posição errada no futuro. Preferi fazer simples no começo,
65
84
  //porque não quis onerar o text input com essa funcionalidade...
66
- const top = this._textInput.errorMessage || this.mode == "slim" ? 0 : -19;
85
+ const top = this.errorMessage || this.mode === "slim" ? 0 : -19;
67
86
  this._calendar.fitVertical(top, this._elem.clientHeight);
68
87
  }
69
88
  hideCalendar() {
70
89
  this.changeValue(this._calendar.value);
71
90
  this._calendar.hide();
72
91
  }
73
- parseDate() {
92
+ handleBlur() {
74
93
  const strValue = this._textInput.value;
75
- const parsedDate = DateUtils.strToDate(strValue);
76
- if (parsedDate || !strValue) {
77
- if (this.value === parsedDate) {
78
- this.changeValue(this.value);
94
+ const newValue = DateUtils.strToDate(strValue);
95
+ if (newValue || !strValue) {
96
+ this.errorMessage = "";
97
+ const currentValue = this.validateValue(this.value);
98
+ const newValueValidated = this.validateValue(newValue);
99
+ if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) === (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
100
+ if (newValueValidated) {
101
+ this._textInput.value = this.getTextValue(newValueValidated) || '';
102
+ this._focused = false;
103
+ }
104
+ this.ezCancelWaitingChange.emit();
79
105
  }
80
106
  else {
81
- this.changeValue(parsedDate);
107
+ this.changeValue(newValueValidated);
82
108
  }
83
109
  }
84
110
  else {
111
+ this.changeValue(undefined);
85
112
  this.ezCancelWaitingChange.emit();
86
- this._textInput.errorMessage = "O valor digitado não é uma data válida";
113
+ this.errorMessage = "O valor digitado não é uma data válida";
87
114
  }
88
115
  }
89
116
  getTextValue(d) {
90
117
  return d ? new Intl.DateTimeFormat("pt-BR").format(d) : undefined;
91
118
  }
92
- startChange() {
93
- this.ezStartChange.emit({ waitmessage: "", blocking: false });
119
+ handleInput() {
120
+ const strValue = this._textInput.value;
121
+ const newValue = DateUtils.strToDate(strValue);
122
+ const currentValue = this.validateValue(this.value);
123
+ const newValueValidated = this.validateValue(newValue);
124
+ if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
125
+ this._focused = true;
126
+ this.ezStartChange.emit({ waitmessage: "", blocking: false });
127
+ }
128
+ }
129
+ validateValue(value) {
130
+ return value instanceof Date && !isNaN(value.valueOf())
131
+ ? DateUtils.clearTime(value)
132
+ : undefined;
133
+ }
134
+ setInputValue() {
135
+ const textValue = this.getTextValue(this.value) || '';
136
+ if ((this._textInput.value || '') !== textValue) {
137
+ this._textInput.value = textValue;
138
+ }
94
139
  }
95
140
  componentDidLoad() {
96
141
  CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
142
+ this.setInputValue();
97
143
  }
98
144
  render() {
99
- return (h(Host, null, h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => {
145
+ return (h(Host, null, h("ez-text-input", { ref: elem => this._textInput = elem, "data-slave-mode": "true", onKeyDown: event => {
100
146
  if (event.key === "H" || event.key === "h")
101
147
  this.changeValue(new Date());
102
- }, label: this.label, value: this.getTextValue(this.value), onInput: () => this.startChange(), restrict: "0123456789/", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, slaveMode: true }, 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 })));
148
+ }, label: this.label, onBlur: () => this.handleBlur(), onInput: () => this.handleInput(), restrict: "0123456789/", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode }, h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), h("ez-calendar", { onEzChange: (event) => { this.hideCalendar(); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem })));
103
149
  }
104
150
  get _elem() { return getElement(this); }
105
151
  static get watchers() { return {
@@ -10,6 +10,7 @@ let EzDateTimeInput = class {
10
10
  this.ezChange = createEvent(this, "ezChange", 7);
11
11
  this.ezStartChange = createEvent(this, "ezStartChange", 7);
12
12
  this.ezCancelWaitingChange = createEvent(this, "ezCancelWaitingChange", 7);
13
+ this._focused = false;
13
14
  /**
14
15
  * Deixa o campo disponível ou não para uso.
15
16
  */
@@ -24,14 +25,34 @@ let EzDateTimeInput = class {
24
25
  this.mode = "regular";
25
26
  }
26
27
  observeLabel() {
27
- this._textInput.label = this.label;
28
+ if (this._textInput) {
29
+ this._textInput.label = this.label;
30
+ }
28
31
  }
29
32
  observeErrorMessage() {
30
- this._textInput.errorMessage = this.errorMessage;
31
- }
32
- observeValue() {
33
+ var _a;
33
34
  if (this._textInput) {
34
- this._textInput.value = this.getTextValue(this.value);
35
+ this._textInput.errorMessage = this.errorMessage;
36
+ if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
37
+ this.setInputValue();
38
+ }
39
+ }
40
+ }
41
+ observeValue(newValue, oldValue) {
42
+ if (this._textInput && newValue != oldValue) {
43
+ const newValueValidated = this.validateValue(newValue);
44
+ const oldValueValidated = this.validateValue(oldValue);
45
+ if ((newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime()) !== (oldValueValidated === null || oldValueValidated === void 0 ? void 0 : oldValueValidated.getTime())) {
46
+ const textValue = this.getTextValue(newValueValidated) || '';
47
+ const parsedDate = this.getParsedDateTime(textValue);
48
+ if ((parsedDate || !this._focused) && (this._textInput.value || '') !== textValue) {
49
+ this._textInput.value = textValue;
50
+ this._focused = false;
51
+ this.errorMessage = "";
52
+ }
53
+ const valueEmitted = newValueValidated === null ? undefined : newValueValidated;
54
+ this.ezChange.emit(valueEmitted);
55
+ }
35
56
  }
36
57
  }
37
58
  /**
@@ -46,30 +67,36 @@ let EzDateTimeInput = class {
46
67
  async setBlur() {
47
68
  this._textInput.setBlur();
48
69
  }
49
- onChangeKeyDown(ev) {
70
+ /**
71
+ * Retorna informando se o campo está inválido (true | false)
72
+ */
73
+ async isInvalid() {
74
+ return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
75
+ }
76
+ handleKeyDown(event) {
50
77
  const input = this._textInput.shadowRoot.querySelector('input');
51
- if (ev.key === "H" || ev.key === "h") {
78
+ if (event.key === "H" || event.key === "h") {
52
79
  this.changeValue(new Date());
53
80
  }
54
- else if (ev.shiftKey && ev.key === "Tab") {
81
+ else if (event.shiftKey && event.key === "Tab") {
55
82
  if (input.selectionStart > 0) {
56
83
  let selectIni = input.value.lastIndexOf(" ", input.selectionStart);
57
84
  if (selectIni !== -1) {
58
85
  input.setSelectionRange(0, selectIni);
59
- ev.preventDefault();
86
+ event.preventDefault();
60
87
  }
61
88
  }
62
89
  }
63
- else if (ev.key === "Tab") {
90
+ else if (event.key === "Tab") {
64
91
  if (input.value.length !== input.selectionEnd) {
65
92
  let selectIni = input.value.indexOf(" ", input.selectionEnd);
66
93
  selectIni = selectIni === -1 ? input.selectionEnd : selectIni + 1;
67
94
  input.setSelectionRange(selectIni, input.value.length);
68
- ev.preventDefault();
95
+ event.preventDefault();
69
96
  }
70
97
  }
71
98
  }
72
- onFocused() {
99
+ handleFocus() {
73
100
  const input = this._textInput.shadowRoot.querySelector('input');
74
101
  if (input.selectionStart !== input.selectionEnd) {
75
102
  let selectIni = input.value.indexOf(" ", input.selectionStart);
@@ -77,7 +104,7 @@ let EzDateTimeInput = class {
77
104
  input.setSelectionRange(0, selectIni);
78
105
  }
79
106
  }
80
- onClicked() {
107
+ handleClick() {
81
108
  const input = this._textInput.shadowRoot.querySelector('input');
82
109
  let selectIni = input.value.lastIndexOf(" ", input.selectionEnd);
83
110
  selectIni = selectIni === -1 ? 0 : selectIni + 1;
@@ -86,37 +113,55 @@ let EzDateTimeInput = class {
86
113
  input.setSelectionRange(selectIni, selectFin);
87
114
  }
88
115
  changeValue(newValue) {
89
- var _a;
90
- this._textInput.errorMessage = "";
91
- if ((newValue === null || newValue === void 0 ? void 0 : newValue.toString()) !== ((_a = this.value) === null || _a === void 0 ? void 0 : _a.toString())) {
92
- this.value = newValue;
93
- this.ezChange.emit(this.value);
116
+ const currentValue = this.validateValue(this.value);
117
+ const newValueValidated = this.validateValue(newValue);
118
+ if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
119
+ this.value = newValueValidated;
94
120
  }
95
121
  }
96
122
  showCalendar() {
97
- const top = this._textInput.errorMessage || this.mode == "slim" ? 0 : -19;
123
+ const top = this.errorMessage || this.mode === "slim" ? 0 : -19;
98
124
  this._calendar.fitVertical(top, this._elem.clientHeight);
99
125
  this._calendar.style.visibility = 'inherit';
100
126
  }
101
- parseDate() {
102
- const strValue = this._textInput.value;
103
- const partsDateTime = (strValue && strValue.length > 0) ? strValue.split(" ") : [];
127
+ getParsedDateTime(strValue) {
128
+ var _a, _b;
129
+ if (strValue === void 0) {
130
+ strValue = (((_b = (_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.trim()) || "");
131
+ }
132
+ if (!strValue) {
133
+ return;
134
+ }
135
+ const partsDateTime = strValue.split(" ");
104
136
  const onlyDate = partsDateTime.length > 0 ? partsDateTime[0] : strValue;
105
137
  const onlyTime = partsDateTime[1] ? partsDateTime[1] : "";
106
138
  const parsedTime = TimeFormatter.prepareValue(onlyTime, this.showSeconds);
107
139
  const strDateTime = onlyDate + (parsedTime && " " + parsedTime);
108
- const parsedDate = DateUtils.strToDate(strDateTime);
109
- if (parsedDate || !strValue) {
110
- if (this.value === parsedDate) {
111
- this.changeValue(this.value);
140
+ return DateUtils.strToDate(strDateTime);
141
+ }
142
+ handleBlur() {
143
+ var _a, _b;
144
+ const strValue = ((_b = (_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.trim()) || "";
145
+ const newValue = this.getParsedDateTime();
146
+ if (newValue || !strValue) {
147
+ this.errorMessage = "";
148
+ const currentValue = this.validateValue(this.value);
149
+ const newValueValidated = this.validateValue(newValue);
150
+ if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) === (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
151
+ if (newValueValidated) {
152
+ this._textInput.value = this.getTextValue(newValueValidated) || '';
153
+ this._focused = false;
154
+ }
155
+ this.ezCancelWaitingChange.emit();
112
156
  }
113
157
  else {
114
- this.changeValue(parsedDate);
158
+ this.changeValue(newValueValidated);
115
159
  }
116
160
  }
117
161
  else {
162
+ this.changeValue(undefined);
118
163
  this.ezCancelWaitingChange.emit();
119
- this._textInput.errorMessage = "O valor digitado não é uma data válida";
164
+ this.errorMessage = "O valor digitado não é uma data válida";
120
165
  }
121
166
  }
122
167
  getTextValue(d) {
@@ -130,14 +175,32 @@ let EzDateTimeInput = class {
130
175
  };
131
176
  return d ? (new Intl.DateTimeFormat('pt-BR', this.showSeconds ? optionsSecond : options).format(d)) : undefined;
132
177
  }
133
- startChange() {
134
- this.ezStartChange.emit({ waitmessage: "", blocking: false });
178
+ validateValue(value) {
179
+ return value instanceof Date && !isNaN(value.valueOf())
180
+ ? value
181
+ : undefined;
182
+ }
183
+ handleInput() {
184
+ const newValue = this.getParsedDateTime();
185
+ const currentValue = this.validateValue(this.value);
186
+ const newValueValidated = this.validateValue(newValue);
187
+ if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
188
+ this._focused = true;
189
+ this.ezStartChange.emit({ waitmessage: "", blocking: false });
190
+ }
191
+ }
192
+ setInputValue() {
193
+ const textValue = this.getTextValue(this.value) || '';
194
+ if ((this._textInput.value || '') !== textValue) {
195
+ this._textInput.value = textValue;
196
+ }
135
197
  }
136
198
  componentDidLoad() {
137
199
  CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
200
+ this.setInputValue();
138
201
  }
139
202
  render() {
140
- return (h(Host, null, h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => { this.onChangeKeyDown(event); }, label: this.label, value: this.getTextValue(this.value), restrict: "0123456789/: ", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, onInput: () => this.startChange(), onFocus: () => this.onFocused(), onClick: () => this.onClicked(), slaveMode: true }, 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 })));
203
+ return (h(Host, null, h("ez-text-input", { ref: elem => this._textInput = elem, "data-slave-mode": "true", label: this.label, restrict: "0123456789/: ", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, onKeyDown: event => { this.handleKeyDown(event); }, onBlur: () => this.handleBlur(), onInput: () => this.handleInput(), onFocus: () => this.handleFocus(), onClick: () => this.handleClick() }, h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), h("ez-calendar", { onEzChange: (event) => { this.changeValue(this._calendar.value); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem, time: true, showSeconds: this.showSeconds })));
141
204
  }
142
205
  get _elem() { return getElement(this); }
143
206
  static get watchers() { return {
@@ -26,9 +26,10 @@ let EzFilterInput = class {
26
26
  this._textInput.errorMessage = this.errorMessage;
27
27
  }
28
28
  }
29
- observeValue() {
30
- if (this._textInput) {
31
- this._textInput.value = this.value;
29
+ observeValue(newValue, oldValue) {
30
+ if (this._textInput && newValue != oldValue) {
31
+ this._textInput.value = newValue;
32
+ this.ezChange.emit(newValue);
32
33
  }
33
34
  }
34
35
  /**
@@ -43,12 +44,17 @@ let EzFilterInput = class {
43
44
  async setBlur() {
44
45
  this._textInput.setBlur();
45
46
  }
47
+ /**
48
+ * Retorna informando se o campo está inválido (true | false)
49
+ */
50
+ async isInvalid() {
51
+ return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
52
+ }
46
53
  changeValue(evt) {
47
54
  const newValue = evt.detail;
48
55
  this.errorMessage = "";
49
56
  if (newValue !== this.value) {
50
57
  this.value = newValue;
51
- this.ezChange.emit(this.value);
52
58
  }
53
59
  }
54
60
  componentDidLoad() {