@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
@@ -7,7 +7,7 @@ const core = require('@sankhyalabs/core');
7
7
  const ApplicationUtils = require('./ApplicationUtils-4a223c7a.js');
8
8
  const CSSVarsUtils = require('./CSSVarsUtils-1034b7b6.js');
9
9
 
10
- const ezComboBoxCss = ":host{--ez-combo-box--height:42px;--ez-combo-box--width:100%;--ez-combo-box__icon--width:48px;--ez-combo-box--border-radius:var(--border--radius-medium, 12px);--ez-combo-box--border-radius-small:var(--border--radius-small, 6px);--ez-combo-box--font-size:var(--text--medium, 14px);--ez-combo-box--font-family:var(--font-pattern, Arial);--ez-combo-box--font-weight--large:var(--text-weight--large, 500);--ez-combo-box--font-weight--medium:var(--text-weight--medium, 400);--ez-combo-box--background-color--xlight:var(--background--xlight, #fff);--ez-combo-box--background-medium:var(--background--medium, #f0f3f7);--ez-combo-box__input--background-color:var(--background--medium, #e0e0e0);--ez-combo-box__input--border:var(--border--medium, 2px solid);--ez-combo-box__input--border-color:var(--ez-combo-box__input--background-color);--ez-combo-box__input--focus--border-color:var(--color--primary, #008561);--ez-combo-box__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-combo-box__input--disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__input--error--border-color:#CC2936;--ez-combo-box__btn--color:var(--title--primary, #2B3A54);--ez-combo-box__btn-disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__btn-hover--color:var(--color--primary, #4e4e4e);--ez-combo-box__label--color:var(--title--primary, #2B3A54);--ez-combo-box__list-title--primary:var(--title--primary, #2B3A54);--ez-combo-box__list-text--primary:var(--text--primary, #626e82);--ez-combo-box__list-height:calc(var(--ez-combo-box--font-size) + var(--ez-combo-box--space--medium));--ez-combo-box--space--medium:var(--space--medium, 12px);--ez-combo-box--space--small:var(--space--small, 6px);--ez-combo-box__list-scrollbar--background-color:var(--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)}}";
10
+ const ezComboBoxCss = ":host{--ez-combo-box--height:42px;--ez-combo-box--width:100%;--ez-combo-box__icon--width:48px;--ez-combo-box--border-radius:var(--border--radius-medium, 12px);--ez-combo-box--border-radius-small:var(--border--radius-small, 6px);--ez-combo-box--font-size:var(--text--medium, 14px);--ez-combo-box--font-family:var(--font-pattern, Arial);--ez-combo-box--font-weight--large:var(--text-weight--large, 500);--ez-combo-box--font-weight--medium:var(--text-weight--medium, 400);--ez-combo-box--background-color--xlight:var(--background--xlight, #fff);--ez-combo-box--background-medium:var(--background--medium, #f0f3f7);--ez-combo-box__input--background-color:var(--background--medium, #e0e0e0);--ez-combo-box__input--border:var(--border--medium, 2px solid);--ez-combo-box__input--border-color:var(--ez-combo-box__input--background-color);--ez-combo-box__input--focus--border-color:var(--color--primary, #008561);--ez-combo-box__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-combo-box__input--disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__input--error--border-color:#CC2936;--ez-combo-box__btn--color:var(--title--primary, #2B3A54);--ez-combo-box__btn-disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__btn-hover--color:var(--color--primary, #4e4e4e);--ez-combo-box__label--color:var(--title--primary, #2B3A54);--ez-combo-box__list-title--primary:var(--title--primary, #2B3A54);--ez-combo-box__list-text--primary:var(--text--primary, #626e82);--ez-combo-box__list-height:calc(var(--ez-combo-box--font-size) + var(--ez-combo-box--space--medium));--ez-combo-box--space--medium:var(--space--medium, 12px);--ez-combo-box--space--small:var(--space--small, 6px);--ez-combo-box__list-scrollbar--background-color-primary:var(--scrollbar--primary, #2B3A54);--ez-combo-box__list-scrollbar--background-color-secondary:var(--scrollbar--secondary, #E5EAF0);--ez-combo-box__list-scrollbar--border-radius:var(--border--radius-small, 6px);--ez-combo-box__list-scrollbar--width:var(--space--medium, 12px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-combo-box--width)}ez-icon{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.suppressed-search-input{--ez-text-input__input--border-color:var(--color--strokes, #dce0e8);--ez-text-input__input--disabled--background-color:var(--background--xlight, #fff);--ez-text-input__input--disabled--color:var(--title--primary, #2B3A54)}.list-container{position:relative;width:100%}.list-wrapper{display:flex;flex-direction:column;box-sizing:border-box;width:100%;z-index:var(--more-visible, 2);max-height:calc(4*var(--ez-combo-box__list-height) + 2*var(--ez-combo-box--space--small));background-color:var(--ez-combo-box--background-color--xlight);border-radius:var(--ez-combo-box--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000);padding:var(--ez-combo-box--space--small)}.list-options{box-sizing:border-box;width:100%;height:100%;display:flex;flex-direction:column;scroll-behavior:smooth;overflow:auto;scrollbar-width:thin;scrollbar-color:var(--ez-combo-box__list-scrollbar--background-color-primary) var(--ez-combo-box__list-scrollbar--background-color-secondary)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-combo-box__list-scrollbar--background-color-secondary);border-radius:var(--ez-combo-box__list-scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-combo-box__list-scrollbar--background-color-primary);border-radius:var(--ez-combo-box__list-scrollbar--border-radius)}.list-options::-webkit-scrollbar{background-color:var(--ez-combo-box__list-scrollbar--background-color-secondary);width:var(--ez-combo-box__list-scrollbar--width);max-width:var(--ez-combo-box__list-scrollbar--width);min-width:var(--ez-combo-box__list-scrollbar--width)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-combo-box--border-radius-small);padding:0 var(--ez-combo-box--space--small);min-height:var(--ez-combo-box__list-height);gap:var(--space--small, 6px)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-combo-box__list-title--primary);font-weight:var(--ez-combo-box--font-weight--large);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size)}.item__value{text-align:center;color:var(--ez-combo-box__list-text--primary)}.item__value--hidden{visibility:hidden;position:absolute;z-index:-1;top:0;left:0}.item__label{text-align:left}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;min-height:calc(var(--ez-combo-box__list-height) * 1.5)}.message__no-result{color:var(--ez-combo-box__list-title--primary);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size)}.message__loading{border-radius:50%;width:16px;height:16px;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:3px solid var(--ez-combo-box__list-title--primary);border-top:3px solid transparent}li:hover{background-color:var(--ez-combo-box--background-medium)}.preselected{background-color:var(--background--medium)}.btn{outline:none;border:none;background:none;cursor:pointer;color:var(--ez-combo-box__btn--color)}.btn:disabled{cursor:unset;color:var(--ez-combo-box__btn-disabled--color)}.btn:disabled:hover{cursor:unset;color:var(--ez-combo-box__btn-disabled--color)}.btn:hover{color:var(--ez-combo-box__btn-hover--color)}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";
11
11
 
12
12
  let EzComboBox = class {
13
13
  constructor(hostRef) {
@@ -50,40 +50,66 @@ let EzComboBox = class {
50
50
  */
51
51
  this.mode = "regular";
52
52
  }
53
- observeValue() {
54
- if (this._inputElement) {
55
- this._inputElement.value = this.getText();
53
+ observeErrorMessage() {
54
+ var _a;
55
+ if (this._textInput) {
56
+ this._textInput.errorMessage = this.errorMessage;
57
+ if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
58
+ this.setInputValue();
59
+ }
60
+ }
61
+ }
62
+ observeValue(newValue, oldValue) {
63
+ var _a, _b, _c, _d;
64
+ if (this._textInput && newValue != oldValue) {
65
+ const newValueSelected = this.getSelectedOption(newValue);
66
+ const oldValueSelected = this.getSelectedOption(oldValue);
67
+ const currentValue = this.getSelectedOption(this.value);
68
+ if (((_a = currentValue === null || currentValue === void 0 ? void 0 : currentValue.value) === null || _a === void 0 ? void 0 : _a.toString()) != ((_b = newValueSelected === null || newValueSelected === void 0 ? void 0 : newValueSelected.value) === null || _b === void 0 ? void 0 : _b.toString())) {
69
+ this.value = newValueSelected;
70
+ }
71
+ if (((_c = newValueSelected === null || newValueSelected === void 0 ? void 0 : newValueSelected.value) === null || _c === void 0 ? void 0 : _c.toString()) !== ((_d = oldValueSelected === null || oldValueSelected === void 0 ? void 0 : oldValueSelected.value) === null || _d === void 0 ? void 0 : _d.toString())) {
72
+ this.setInputValue();
73
+ const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
74
+ this.ezChange.emit(valueEmitted);
75
+ }
76
+ this.hideOptions();
77
+ this._criteria = undefined;
78
+ this._preSelection = undefined;
79
+ this.updateVisibleOptions();
56
80
  }
57
- this.hideOptions();
58
- this._criteria = undefined;
59
- this._preSelection = undefined;
60
- this.updateVisibleOptions();
61
81
  }
62
82
  /**
63
83
  * Realiza o foco no componente de seleção
64
84
  */
65
85
  async setFocus() {
66
- this._inputElement.setFocus();
86
+ this._textInput.setFocus();
67
87
  }
68
88
  /**
69
89
  * Remove o foco no componente de seleção
70
90
  */
71
91
  async setBlur() {
72
- this._inputElement.setBlur();
92
+ this._textInput.setBlur();
93
+ }
94
+ /**
95
+ * Retorna informando se o campo está inválido (true | false)
96
+ */
97
+ async isInvalid() {
98
+ return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
73
99
  }
74
100
  getText() {
75
101
  let text = "";
76
- const selected = this.getSelectedOption();
77
- if (selected) {
78
- text = this.showSelectedValue ? `${selected.value} - ${selected.label}` : selected.label;
102
+ const currentValue = this.getSelectedOption(this.value);
103
+ if (currentValue) {
104
+ text = this.showSelectedValue ? `${currentValue.value} - ${currentValue.label}` : currentValue.label;
79
105
  }
80
106
  return text;
81
107
  }
82
- getSelectedOption() {
83
- if (typeof this.value === "string" || this.value instanceof String) {
84
- return this._visibleOptions.find(o => o.value === this.value);
108
+ getSelectedOption(value) {
109
+ if (typeof value === "string" || value instanceof String) {
110
+ return this._visibleOptions.find(o => o.value === value);
85
111
  }
86
- return this.value;
112
+ return value;
87
113
  }
88
114
  updateVisibleOptions() {
89
115
  let opts = this._source || [];
@@ -138,7 +164,7 @@ let EzComboBox = class {
138
164
  //FIXME: Provavelmente isso fará com que o popup abra em uma
139
165
  //posição errada no futuro. Preferi fazer simples no começo,
140
166
  //porque não quis onerar o text input com essa funcionalidade...
141
- const top = (this.errorMessage || !this.canShowError || this.mode == "slim") ? "0px" : "-19px";
167
+ const top = (this.errorMessage || !this.canShowError || this.mode === "slim") ? "0px" : "-19px";
142
168
  this._floatingID = core.FloatingManager.float(this._listWrapper, this._listContainer, { autoClose: true, top });
143
169
  window.requestAnimationFrame(() => {
144
170
  this._listWrapper.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
@@ -221,15 +247,13 @@ let EzComboBox = class {
221
247
  }
222
248
  selectOption(newOption) {
223
249
  var _a, _b;
224
- const currentOpt = this.getSelectedOption();
225
- 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())) {
250
+ const currentValue = this.getSelectedOption(this.value);
251
+ if (((_a = currentValue === null || currentValue === void 0 ? void 0 : currentValue.value) === null || _a === void 0 ? void 0 : _a.toString()) !== ((_b = newOption === null || newOption === void 0 ? void 0 : newOption.value) === null || _b === void 0 ? void 0 : _b.toString())) {
226
252
  const adjustedOpt = !(newOption === null || newOption === void 0 ? void 0 : newOption.value) ? undefined : newOption;
227
253
  this.value = adjustedOpt;
228
- this.errorMessage = "";
229
- this.ezChange.emit(this.value);
230
254
  }
231
255
  else {
232
- this.observeValue();
256
+ this.setInputValue();
233
257
  }
234
258
  if (this.searchMode) {
235
259
  this._visibleOptions = [];
@@ -246,11 +270,20 @@ let EzComboBox = class {
246
270
  }
247
271
  }
248
272
  cancelPreselection() {
249
- if (!this._inputElement.value && this.value) {
273
+ if (!this._textInput.value && this.value) {
250
274
  this.selectOption(undefined);
251
275
  }
252
276
  else {
253
- this.observeValue();
277
+ this.setInputValue();
278
+ }
279
+ }
280
+ setInputValue(clearError = true) {
281
+ const textValue = this.getText();
282
+ if ((this._textInput.value || '') !== textValue) {
283
+ this._textInput.value = textValue;
284
+ if (clearError) {
285
+ this.errorMessage = "";
286
+ }
254
287
  }
255
288
  }
256
289
  clearSearch() {
@@ -308,7 +341,8 @@ let EzComboBox = class {
308
341
  }
309
342
  }
310
343
  componentDidLoad() {
311
- CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this.el, this._inputElement);
344
+ CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this.el, this._textInput);
345
+ this.setInputValue(false);
312
346
  }
313
347
  //---------------------------------------------
314
348
  // Event handlers
@@ -328,7 +362,7 @@ let EzComboBox = class {
328
362
  const argument = (_a = event.target.value) === null || _a === void 0 ? void 0 : _a.trim();
329
363
  const argumentNumber = Number(argument || undefined);
330
364
  if (!this._criteria) {
331
- this._inputElement.value = event.data || argument;
365
+ this._textInput.value = event.data || argument;
332
366
  }
333
367
  this._criteria = argument;
334
368
  if (argument && (!isNaN(argumentNumber) || argument.length >= this._limitCharsToSearch)) {
@@ -386,7 +420,7 @@ let EzComboBox = class {
386
420
  }
387
421
  render() {
388
422
  var _a;
389
- return (index.h(index.Host, null, index.h("ez-text-input", { class: this.suppressSearch ? "suppressed-search-input" : "", ref: elem => this._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 }, index.h("button", { class: "btn", slot: this.searchMode ? "leftIcon" : "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.handlerIconClick() }, index.h("ez-icon", { iconName: this.searchMode ? "search" : "chevron-down" })), this.searchMode && ((_a = this._inputElement) === null || _a === void 0 ? void 0 : _a.value) && (this._criteria || this.value)
423
+ return (index.h(index.Host, null, index.h("ez-text-input", { class: this.suppressSearch ? "suppressed-search-input" : "", ref: elem => this._textInput = elem, "data-slave-mode": "true", enabled: this.enabled && !this.suppressSearch, onInput: event => this.onTextInputChangeHandler(event), onClick: () => this.onTextInputClickHandler(), onFocusout: () => this.onTextInputFocusOutHandler(), onKeyDown: event => this.keyDownHandler(event), label: this.label, canShowError: this.canShowError, errorMessage: this.errorMessage, mode: this.mode }, index.h("button", { class: "btn", slot: this.searchMode ? "leftIcon" : "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.handlerIconClick() }, index.h("ez-icon", { iconName: this.searchMode ? "search" : "chevron-down" })), this.searchMode && ((_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value) && (this._criteria || this.value)
390
424
  ? index.h("button", { class: "btn", slot: "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.clearSearch() }, index.h("ez-icon", { iconName: "close" }))
391
425
  : undefined), index.h("section", { class: "list-container", ref: elem => this._listContainer = elem }, index.h("div", { class: "list-wrapper", ref: elem => this._listWrapper = elem }, index.h("div", { class: "list-options", ref: elem => this._optionsList = elem }, this._visibleOptions.length === 0
392
426
  && index.h("div", { class: "message" }, !this._showLoading && index.h("span", { class: "message__no-result" }, this._textEmptyList), this._showLoading && index.h("div", { class: "message__loading" })), this.showOptionValue
@@ -395,6 +429,7 @@ let EzComboBox = class {
395
429
  }
396
430
  get el() { return index.getElement(this); }
397
431
  static get watchers() { return {
432
+ "errorMessage": ["observeErrorMessage"],
398
433
  "value": ["observeValue"]
399
434
  }; }
400
435
  };
@@ -14,6 +14,7 @@ let EzDateInput = class {
14
14
  this.ezChange = index.createEvent(this, "ezChange", 7);
15
15
  this.ezStartChange = index.createEvent(this, "ezStartChange", 7);
16
16
  this.ezCancelWaitingChange = index.createEvent(this, "ezCancelWaitingChange", 7);
17
+ this._focused = false;
17
18
  /**
18
19
  * Deixa o campo disponível ou não para uso.
19
20
  */
@@ -24,18 +25,33 @@ let EzDateInput = class {
24
25
  this.mode = "regular";
25
26
  }
26
27
  observeLabel() {
27
- this._textInput.label = this.label;
28
+ if (this._textInput) {
29
+ this._textInput.label = this.label;
30
+ }
28
31
  }
29
32
  observeErrorMessage() {
33
+ var _a;
30
34
  if (this._textInput) {
31
35
  this._textInput.errorMessage = this.errorMessage;
36
+ if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
37
+ this.setInputValue();
38
+ }
32
39
  }
33
40
  }
34
41
  observeValue(newValue, oldValue) {
35
- if (newValue != oldValue) {
36
- if (this._textInput) {
37
- this.errorMessage = "";
38
- this._textInput.value = this.getTextValue(this.value);
42
+ if (this._textInput && newValue != oldValue) {
43
+ const newValueValidated = this.validateValue(newValue);
44
+ const oldValueValidated = this.validateValue(oldValue);
45
+ if ((newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime()) !== (oldValueValidated === null || oldValueValidated === void 0 ? void 0 : oldValueValidated.getTime())) {
46
+ const textValue = this.getTextValue(newValueValidated) || '';
47
+ const parsedDate = core.DateUtils.strToDate(textValue);
48
+ if ((parsedDate || !this._focused) && (this._textInput.value || '') !== textValue) {
49
+ this._textInput.value = textValue;
50
+ this._focused = false;
51
+ this.errorMessage = "";
52
+ }
53
+ const valueEmitted = newValueValidated === null ? undefined : newValueValidated;
54
+ this.ezChange.emit(valueEmitted);
39
55
  }
40
56
  }
41
57
  }
@@ -51,59 +67,89 @@ let EzDateInput = class {
51
67
  async setBlur() {
52
68
  this._textInput.setBlur();
53
69
  }
70
+ /**
71
+ * Retorna informando se o campo está inválido (true | false)
72
+ */
73
+ async isInvalid() {
74
+ return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
75
+ }
54
76
  changeValue(newValue) {
55
- var _a;
56
- newValue = newValue instanceof Date ? core.DateUtils.clearTime(newValue) : undefined;
57
- this.value = this.value instanceof Date ? core.DateUtils.clearTime(this.value) : undefined;
58
- this._textInput.errorMessage = "";
59
- if ((newValue === null || newValue === void 0 ? void 0 : newValue.toString()) !== ((_a = this.value) === null || _a === void 0 ? void 0 : _a.toString())) {
60
- this.value = newValue;
61
- this.ezChange.emit(this.value);
77
+ const currentValue = this.validateValue(this.value);
78
+ const newValueValidated = this.validateValue(newValue);
79
+ if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
80
+ this.value = newValueValidated;
62
81
  }
63
82
  }
64
83
  showCalendar() {
65
- this.parseDate();
84
+ this.handleBlur();
66
85
  this._calendar.value = this.value;
67
86
  //FIXME: Provavelmente isso fará com que o popup abra em uma
68
87
  //posição errada no futuro. Preferi fazer simples no começo,
69
88
  //porque não quis onerar o text input com essa funcionalidade...
70
- const top = this._textInput.errorMessage || this.mode == "slim" ? 0 : -19;
89
+ const top = this.errorMessage || this.mode === "slim" ? 0 : -19;
71
90
  this._calendar.fitVertical(top, this._elem.clientHeight);
72
91
  }
73
92
  hideCalendar() {
74
93
  this.changeValue(this._calendar.value);
75
94
  this._calendar.hide();
76
95
  }
77
- parseDate() {
96
+ handleBlur() {
78
97
  const strValue = this._textInput.value;
79
- const parsedDate = core.DateUtils.strToDate(strValue);
80
- if (parsedDate || !strValue) {
81
- if (this.value === parsedDate) {
82
- this.changeValue(this.value);
98
+ const newValue = core.DateUtils.strToDate(strValue);
99
+ if (newValue || !strValue) {
100
+ this.errorMessage = "";
101
+ const currentValue = this.validateValue(this.value);
102
+ const newValueValidated = this.validateValue(newValue);
103
+ if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) === (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
104
+ if (newValueValidated) {
105
+ this._textInput.value = this.getTextValue(newValueValidated) || '';
106
+ this._focused = false;
107
+ }
108
+ this.ezCancelWaitingChange.emit();
83
109
  }
84
110
  else {
85
- this.changeValue(parsedDate);
111
+ this.changeValue(newValueValidated);
86
112
  }
87
113
  }
88
114
  else {
115
+ this.changeValue(undefined);
89
116
  this.ezCancelWaitingChange.emit();
90
- this._textInput.errorMessage = "O valor digitado não é uma data válida";
117
+ this.errorMessage = "O valor digitado não é uma data válida";
91
118
  }
92
119
  }
93
120
  getTextValue(d) {
94
121
  return d ? new Intl.DateTimeFormat("pt-BR").format(d) : undefined;
95
122
  }
96
- startChange() {
97
- this.ezStartChange.emit({ waitmessage: "", blocking: false });
123
+ handleInput() {
124
+ const strValue = this._textInput.value;
125
+ const newValue = core.DateUtils.strToDate(strValue);
126
+ const currentValue = this.validateValue(this.value);
127
+ const newValueValidated = this.validateValue(newValue);
128
+ if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
129
+ this._focused = true;
130
+ this.ezStartChange.emit({ waitmessage: "", blocking: false });
131
+ }
132
+ }
133
+ validateValue(value) {
134
+ return value instanceof Date && !isNaN(value.valueOf())
135
+ ? core.DateUtils.clearTime(value)
136
+ : undefined;
137
+ }
138
+ setInputValue() {
139
+ const textValue = this.getTextValue(this.value) || '';
140
+ if ((this._textInput.value || '') !== textValue) {
141
+ this._textInput.value = textValue;
142
+ }
98
143
  }
99
144
  componentDidLoad() {
100
145
  CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
146
+ this.setInputValue();
101
147
  }
102
148
  render() {
103
- return (index.h(index.Host, null, index.h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => {
149
+ return (index.h(index.Host, null, index.h("ez-text-input", { ref: elem => this._textInput = elem, "data-slave-mode": "true", onKeyDown: event => {
104
150
  if (event.key === "H" || event.key === "h")
105
151
  this.changeValue(new Date());
106
- }, label: this.label, value: this.getTextValue(this.value), onInput: () => this.startChange(), restrict: "0123456789/", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, slaveMode: true }, index.h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), index.h("ez-calendar", { onEzChange: (event) => { this.hideCalendar(); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem })));
152
+ }, label: this.label, onBlur: () => this.handleBlur(), onInput: () => this.handleInput(), restrict: "0123456789/", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode }, index.h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), index.h("ez-calendar", { onEzChange: (event) => { this.hideCalendar(); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem })));
107
153
  }
108
154
  get _elem() { return index.getElement(this); }
109
155
  static get watchers() { return {
@@ -14,6 +14,7 @@ let EzDateTimeInput = class {
14
14
  this.ezChange = index.createEvent(this, "ezChange", 7);
15
15
  this.ezStartChange = index.createEvent(this, "ezStartChange", 7);
16
16
  this.ezCancelWaitingChange = index.createEvent(this, "ezCancelWaitingChange", 7);
17
+ this._focused = false;
17
18
  /**
18
19
  * Deixa o campo disponível ou não para uso.
19
20
  */
@@ -28,14 +29,34 @@ let EzDateTimeInput = class {
28
29
  this.mode = "regular";
29
30
  }
30
31
  observeLabel() {
31
- this._textInput.label = this.label;
32
+ if (this._textInput) {
33
+ this._textInput.label = this.label;
34
+ }
32
35
  }
33
36
  observeErrorMessage() {
34
- this._textInput.errorMessage = this.errorMessage;
35
- }
36
- observeValue() {
37
+ var _a;
37
38
  if (this._textInput) {
38
- this._textInput.value = this.getTextValue(this.value);
39
+ this._textInput.errorMessage = this.errorMessage;
40
+ if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
41
+ this.setInputValue();
42
+ }
43
+ }
44
+ }
45
+ observeValue(newValue, oldValue) {
46
+ if (this._textInput && newValue != oldValue) {
47
+ const newValueValidated = this.validateValue(newValue);
48
+ const oldValueValidated = this.validateValue(oldValue);
49
+ if ((newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime()) !== (oldValueValidated === null || oldValueValidated === void 0 ? void 0 : oldValueValidated.getTime())) {
50
+ const textValue = this.getTextValue(newValueValidated) || '';
51
+ const parsedDate = this.getParsedDateTime(textValue);
52
+ if ((parsedDate || !this._focused) && (this._textInput.value || '') !== textValue) {
53
+ this._textInput.value = textValue;
54
+ this._focused = false;
55
+ this.errorMessage = "";
56
+ }
57
+ const valueEmitted = newValueValidated === null ? undefined : newValueValidated;
58
+ this.ezChange.emit(valueEmitted);
59
+ }
39
60
  }
40
61
  }
41
62
  /**
@@ -50,30 +71,36 @@ let EzDateTimeInput = class {
50
71
  async setBlur() {
51
72
  this._textInput.setBlur();
52
73
  }
53
- onChangeKeyDown(ev) {
74
+ /**
75
+ * Retorna informando se o campo está inválido (true | false)
76
+ */
77
+ async isInvalid() {
78
+ return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
79
+ }
80
+ handleKeyDown(event) {
54
81
  const input = this._textInput.shadowRoot.querySelector('input');
55
- if (ev.key === "H" || ev.key === "h") {
82
+ if (event.key === "H" || event.key === "h") {
56
83
  this.changeValue(new Date());
57
84
  }
58
- else if (ev.shiftKey && ev.key === "Tab") {
85
+ else if (event.shiftKey && event.key === "Tab") {
59
86
  if (input.selectionStart > 0) {
60
87
  let selectIni = input.value.lastIndexOf(" ", input.selectionStart);
61
88
  if (selectIni !== -1) {
62
89
  input.setSelectionRange(0, selectIni);
63
- ev.preventDefault();
90
+ event.preventDefault();
64
91
  }
65
92
  }
66
93
  }
67
- else if (ev.key === "Tab") {
94
+ else if (event.key === "Tab") {
68
95
  if (input.value.length !== input.selectionEnd) {
69
96
  let selectIni = input.value.indexOf(" ", input.selectionEnd);
70
97
  selectIni = selectIni === -1 ? input.selectionEnd : selectIni + 1;
71
98
  input.setSelectionRange(selectIni, input.value.length);
72
- ev.preventDefault();
99
+ event.preventDefault();
73
100
  }
74
101
  }
75
102
  }
76
- onFocused() {
103
+ handleFocus() {
77
104
  const input = this._textInput.shadowRoot.querySelector('input');
78
105
  if (input.selectionStart !== input.selectionEnd) {
79
106
  let selectIni = input.value.indexOf(" ", input.selectionStart);
@@ -81,7 +108,7 @@ let EzDateTimeInput = class {
81
108
  input.setSelectionRange(0, selectIni);
82
109
  }
83
110
  }
84
- onClicked() {
111
+ handleClick() {
85
112
  const input = this._textInput.shadowRoot.querySelector('input');
86
113
  let selectIni = input.value.lastIndexOf(" ", input.selectionEnd);
87
114
  selectIni = selectIni === -1 ? 0 : selectIni + 1;
@@ -90,37 +117,55 @@ let EzDateTimeInput = class {
90
117
  input.setSelectionRange(selectIni, selectFin);
91
118
  }
92
119
  changeValue(newValue) {
93
- var _a;
94
- this._textInput.errorMessage = "";
95
- if ((newValue === null || newValue === void 0 ? void 0 : newValue.toString()) !== ((_a = this.value) === null || _a === void 0 ? void 0 : _a.toString())) {
96
- this.value = newValue;
97
- this.ezChange.emit(this.value);
120
+ const currentValue = this.validateValue(this.value);
121
+ const newValueValidated = this.validateValue(newValue);
122
+ if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
123
+ this.value = newValueValidated;
98
124
  }
99
125
  }
100
126
  showCalendar() {
101
- const top = this._textInput.errorMessage || this.mode == "slim" ? 0 : -19;
127
+ const top = this.errorMessage || this.mode === "slim" ? 0 : -19;
102
128
  this._calendar.fitVertical(top, this._elem.clientHeight);
103
129
  this._calendar.style.visibility = 'inherit';
104
130
  }
105
- parseDate() {
106
- const strValue = this._textInput.value;
107
- const partsDateTime = (strValue && strValue.length > 0) ? strValue.split(" ") : [];
131
+ getParsedDateTime(strValue) {
132
+ var _a, _b;
133
+ if (strValue === void 0) {
134
+ strValue = (((_b = (_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.trim()) || "");
135
+ }
136
+ if (!strValue) {
137
+ return;
138
+ }
139
+ const partsDateTime = strValue.split(" ");
108
140
  const onlyDate = partsDateTime.length > 0 ? partsDateTime[0] : strValue;
109
141
  const onlyTime = partsDateTime[1] ? partsDateTime[1] : "";
110
142
  const parsedTime = core.TimeFormatter.prepareValue(onlyTime, this.showSeconds);
111
143
  const strDateTime = onlyDate + (parsedTime && " " + parsedTime);
112
- const parsedDate = core.DateUtils.strToDate(strDateTime);
113
- if (parsedDate || !strValue) {
114
- if (this.value === parsedDate) {
115
- this.changeValue(this.value);
144
+ return core.DateUtils.strToDate(strDateTime);
145
+ }
146
+ handleBlur() {
147
+ var _a, _b;
148
+ const strValue = ((_b = (_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.trim()) || "";
149
+ const newValue = this.getParsedDateTime();
150
+ if (newValue || !strValue) {
151
+ this.errorMessage = "";
152
+ const currentValue = this.validateValue(this.value);
153
+ const newValueValidated = this.validateValue(newValue);
154
+ if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) === (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
155
+ if (newValueValidated) {
156
+ this._textInput.value = this.getTextValue(newValueValidated) || '';
157
+ this._focused = false;
158
+ }
159
+ this.ezCancelWaitingChange.emit();
116
160
  }
117
161
  else {
118
- this.changeValue(parsedDate);
162
+ this.changeValue(newValueValidated);
119
163
  }
120
164
  }
121
165
  else {
166
+ this.changeValue(undefined);
122
167
  this.ezCancelWaitingChange.emit();
123
- this._textInput.errorMessage = "O valor digitado não é uma data válida";
168
+ this.errorMessage = "O valor digitado não é uma data válida";
124
169
  }
125
170
  }
126
171
  getTextValue(d) {
@@ -134,14 +179,32 @@ let EzDateTimeInput = class {
134
179
  };
135
180
  return d ? (new Intl.DateTimeFormat('pt-BR', this.showSeconds ? optionsSecond : options).format(d)) : undefined;
136
181
  }
137
- startChange() {
138
- this.ezStartChange.emit({ waitmessage: "", blocking: false });
182
+ validateValue(value) {
183
+ return value instanceof Date && !isNaN(value.valueOf())
184
+ ? value
185
+ : undefined;
186
+ }
187
+ handleInput() {
188
+ const newValue = this.getParsedDateTime();
189
+ const currentValue = this.validateValue(this.value);
190
+ const newValueValidated = this.validateValue(newValue);
191
+ if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
192
+ this._focused = true;
193
+ this.ezStartChange.emit({ waitmessage: "", blocking: false });
194
+ }
195
+ }
196
+ setInputValue() {
197
+ const textValue = this.getTextValue(this.value) || '';
198
+ if ((this._textInput.value || '') !== textValue) {
199
+ this._textInput.value = textValue;
200
+ }
139
201
  }
140
202
  componentDidLoad() {
141
203
  CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
204
+ this.setInputValue();
142
205
  }
143
206
  render() {
144
- return (index.h(index.Host, null, index.h("ez-text-input", { ref: elem => this._textInput = elem, 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 }, index.h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), index.h("ez-calendar", { onEzChange: (event) => { this.changeValue(this._calendar.value); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem, time: true, showSeconds: this.showSeconds })));
207
+ return (index.h(index.Host, null, index.h("ez-text-input", { ref: elem => this._textInput = elem, "data-slave-mode": "true", label: this.label, restrict: "0123456789/: ", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, onKeyDown: event => { this.handleKeyDown(event); }, onBlur: () => this.handleBlur(), onInput: () => this.handleInput(), onFocus: () => this.handleFocus(), onClick: () => this.handleClick() }, index.h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), index.h("ez-calendar", { onEzChange: (event) => { this.changeValue(this._calendar.value); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem, time: true, showSeconds: this.showSeconds })));
145
208
  }
146
209
  get _elem() { return index.getElement(this); }
147
210
  static get watchers() { return {
@@ -30,9 +30,10 @@ let EzFilterInput = class {
30
30
  this._textInput.errorMessage = this.errorMessage;
31
31
  }
32
32
  }
33
- observeValue() {
34
- if (this._textInput) {
35
- this._textInput.value = this.value;
33
+ observeValue(newValue, oldValue) {
34
+ if (this._textInput && newValue != oldValue) {
35
+ this._textInput.value = newValue;
36
+ this.ezChange.emit(newValue);
36
37
  }
37
38
  }
38
39
  /**
@@ -47,12 +48,17 @@ let EzFilterInput = class {
47
48
  async setBlur() {
48
49
  this._textInput.setBlur();
49
50
  }
51
+ /**
52
+ * Retorna informando se o campo está inválido (true | false)
53
+ */
54
+ async isInvalid() {
55
+ return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
56
+ }
50
57
  changeValue(evt) {
51
58
  const newValue = evt.detail;
52
59
  this.errorMessage = "";
53
60
  if (newValue !== this.value) {
54
61
  this.value = newValue;
55
- this.ezChange.emit(this.value);
56
62
  }
57
63
  }
58
64
  componentDidLoad() {