@sankhyalabs/ezui 1.2.0-beta.6 → 1.2.0-beta.8

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 (165) hide show
  1. package/dist/cjs/{ApplicationUtils-483c0a9e.js → ApplicationUtils-2ac1b73e.js} +2 -1
  2. package/dist/cjs/ApplicationUtils-475b50d9.js +63 -0
  3. package/dist/cjs/{CSSVarsUtils-09b431cc.js → CSSVarsUtils-af809e73.js} +17 -0
  4. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  5. package/dist/cjs/css-shim-3bfdba4f.js +6 -0
  6. package/dist/cjs/dom-8ac1ad03.js +75 -0
  7. package/dist/cjs/ez-actions-button.cjs.entry.js +8 -7
  8. package/dist/cjs/ez-application.cjs.entry.js +1 -1
  9. package/dist/cjs/ez-button.cjs.entry.js +2 -2
  10. package/dist/cjs/ez-calendar.cjs.entry.js +4 -4
  11. package/dist/cjs/ez-card-item.cjs.entry.js +1 -1
  12. package/dist/cjs/ez-check.cjs.entry.js +1 -1
  13. package/dist/cjs/ez-chip.cjs.entry.js +2 -2
  14. package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -1
  15. package/dist/cjs/ez-combo-box.cjs.entry.js +8 -7
  16. package/dist/cjs/ez-date-input.cjs.entry.js +7 -7
  17. package/dist/cjs/ez-date-time-input.cjs.entry.js +5 -5
  18. package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
  19. package/dist/cjs/ez-filter-input.cjs.entry.js +2 -2
  20. package/dist/cjs/ez-form.cjs.entry.js +460 -49
  21. package/dist/cjs/ez-grid-config.cjs.entry.js +5 -5
  22. package/dist/cjs/ez-grid.cjs.entry.js +1153 -989
  23. package/dist/cjs/ez-icon.cjs.entry.js +3 -3
  24. package/dist/cjs/ez-list.cjs.entry.js +3 -1
  25. package/dist/cjs/ez-loading-bar.cjs.entry.js +1 -1
  26. package/dist/cjs/ez-modal.cjs.entry.js +1 -1
  27. package/dist/cjs/ez-number-input.cjs.entry.js +5 -5
  28. package/dist/cjs/ez-popover.cjs.entry.js +5 -5
  29. package/dist/cjs/ez-popup.cjs.entry.js +1 -1
  30. package/dist/cjs/ez-radio-button.cjs.entry.js +1 -1
  31. package/dist/cjs/ez-scroller.cjs.entry.js +2 -2
  32. package/dist/cjs/ez-search.cjs.entry.js +2 -2
  33. package/dist/cjs/ez-select-box.cjs.entry.js +1 -1
  34. package/dist/cjs/ez-tabselector.cjs.entry.js +2 -1
  35. package/dist/cjs/ez-text-area.cjs.entry.js +1 -1
  36. package/dist/cjs/ez-text-input.cjs.entry.js +3 -3
  37. package/dist/cjs/ez-time-input.cjs.entry.js +8 -8
  38. package/dist/cjs/ez-toast.cjs.entry.js +1 -1
  39. package/dist/cjs/ez-upload.cjs.entry.js +2 -2
  40. package/dist/cjs/ez-view-stack.cjs.entry.js +2 -1
  41. package/dist/cjs/ezui.cjs.js +112 -4
  42. package/dist/cjs/index-2ec1da82.js +2307 -0
  43. package/dist/cjs/index-55178184.js +6 -0
  44. package/dist/cjs/index-d9c5cb88.js +3068 -0
  45. package/dist/cjs/loader.cjs.js +18 -2
  46. package/dist/cjs/shadow-css-41d9783d.js +390 -0
  47. package/dist/collection/collection-manifest.json +2 -2
  48. package/dist/collection/components/ez-button/ez-button.css +1 -0
  49. package/dist/collection/components/ez-chip/ez-chip.css +2 -1
  50. package/dist/collection/components/ez-scroller/ez-scroller.css +1 -0
  51. package/dist/collection/utils/ApplicationUtils.js +2 -1
  52. package/dist/collection/utils/CSSVarsUtils.js +17 -0
  53. package/dist/custom-elements/index.js +3864 -970
  54. package/dist/esm/ApplicationUtils-30a69eb0.js +61 -0
  55. package/dist/esm/{ApplicationUtils-5f87ae60.js → ApplicationUtils-a4a76132.js} +2 -1
  56. package/dist/esm/{CSSVarsUtils-499b75c2.js → CSSVarsUtils-00f67f32.js} +17 -0
  57. package/dist/esm/app-globals-0f993ce5.js +3 -0
  58. package/dist/esm/css-shim-20dbffa5.js +4 -0
  59. package/dist/esm/dom-c5ed0ba5.js +73 -0
  60. package/dist/esm/ez-actions-button.entry.js +5 -4
  61. package/dist/esm/ez-application.entry.js +1 -1
  62. package/dist/esm/ez-button.entry.js +2 -2
  63. package/dist/esm/ez-calendar.entry.js +2 -2
  64. package/dist/esm/ez-card-item.entry.js +1 -1
  65. package/dist/esm/ez-check.entry.js +1 -1
  66. package/dist/esm/ez-chip.entry.js +2 -2
  67. package/dist/esm/ez-collapsible-box.entry.js +1 -1
  68. package/dist/esm/ez-combo-box.entry.js +5 -4
  69. package/dist/esm/ez-date-input.entry.js +3 -3
  70. package/dist/esm/ez-date-time-input.entry.js +3 -3
  71. package/dist/esm/ez-dialog.entry.js +1 -1
  72. package/dist/esm/ez-filter-input.entry.js +2 -2
  73. package/dist/esm/ez-form.entry.js +426 -15
  74. package/dist/esm/ez-grid-config.entry.js +3 -3
  75. package/dist/esm/ez-grid.entry.js +1119 -955
  76. package/dist/esm/ez-icon.entry.js +2 -2
  77. package/dist/esm/ez-list.entry.js +3 -1
  78. package/dist/esm/ez-loading-bar.entry.js +1 -1
  79. package/dist/esm/ez-modal.entry.js +1 -1
  80. package/dist/esm/ez-number-input.entry.js +3 -3
  81. package/dist/esm/ez-popover.entry.js +2 -2
  82. package/dist/esm/ez-popup.entry.js +1 -1
  83. package/dist/esm/ez-radio-button.entry.js +1 -1
  84. package/dist/esm/ez-scroller.entry.js +2 -2
  85. package/dist/esm/ez-search.entry.js +2 -2
  86. package/dist/esm/ez-select-box.entry.js +1 -1
  87. package/dist/esm/ez-tabselector.entry.js +2 -1
  88. package/dist/esm/ez-text-area.entry.js +1 -1
  89. package/dist/esm/ez-text-input.entry.js +2 -2
  90. package/dist/esm/ez-time-input.entry.js +3 -3
  91. package/dist/esm/ez-toast.entry.js +1 -1
  92. package/dist/esm/ez-upload.entry.js +2 -2
  93. package/dist/esm/ez-view-stack.entry.js +2 -1
  94. package/dist/esm/ezui.js +112 -4
  95. package/dist/esm/index-1e9d524f.js +3031 -0
  96. package/dist/esm/index-b96183c8.js +2295 -0
  97. package/dist/esm/index-f32470b5.js +3 -0
  98. package/dist/esm/loader.js +18 -2
  99. package/dist/esm/shadow-css-8c625855.js +388 -0
  100. package/dist/ezui/ApplicationUtils-30a69eb0.js +61 -0
  101. package/dist/ezui/CSSVarsUtils-00f67f32.js +70 -0
  102. package/dist/ezui/DialogType-72afa679.js +8 -0
  103. package/dist/ezui/app-globals-0f993ce5.js +3 -0
  104. package/dist/ezui/css-shim-20dbffa5.js +4 -0
  105. package/dist/ezui/dom-c5ed0ba5.js +73 -0
  106. package/dist/ezui/ez-actions-button.entry.js +98 -0
  107. package/dist/ezui/ez-application.entry.js +22 -0
  108. package/dist/ezui/ez-button.entry.js +73 -0
  109. package/dist/ezui/ez-calendar.entry.js +219 -0
  110. package/dist/ezui/ez-card-item.entry.js +40 -0
  111. package/dist/ezui/ez-check.entry.js +72 -0
  112. package/dist/ezui/ez-chip.entry.js +97 -0
  113. package/dist/ezui/ez-collapsible-box.entry.js +57 -0
  114. package/dist/ezui/ez-combo-box.entry.js +439 -0
  115. package/dist/ezui/ez-date-input.entry.js +159 -0
  116. package/dist/ezui/ez-date-time-input.entry.js +214 -0
  117. package/dist/ezui/ez-dialog.entry.js +108 -0
  118. package/dist/ezui/ez-filter-input.entry.js +75 -0
  119. package/dist/ezui/ez-form.entry.js +1395 -0
  120. package/dist/ezui/ez-grid-config.entry.js +433 -0
  121. package/dist/ezui/ez-grid.entry.js +115419 -0
  122. package/dist/ezui/ez-icon.entry.js +37 -0
  123. package/dist/ezui/ez-list.entry.js +516 -0
  124. package/dist/ezui/ez-loading-bar.entry.js +24 -0
  125. package/dist/ezui/ez-modal.entry.js +67 -0
  126. package/dist/ezui/ez-number-input.entry.js +148 -0
  127. package/dist/ezui/ez-popover.entry.js +141 -0
  128. package/dist/ezui/ez-popup.entry.js +49 -0
  129. package/dist/ezui/ez-radio-button.entry.js +45 -0
  130. package/dist/ezui/ez-scroller.entry.js +101 -0
  131. package/dist/ezui/ez-search.entry.js +83 -0
  132. package/dist/ezui/ez-select-box.entry.js +18 -0
  133. package/dist/ezui/ez-tabselector.entry.js +195 -0
  134. package/dist/ezui/ez-text-area.entry.js +158 -0
  135. package/dist/ezui/ez-text-input.entry.js +235 -0
  136. package/dist/ezui/ez-time-input.entry.js +164 -0
  137. package/dist/ezui/ez-toast.entry.js +84 -0
  138. package/dist/ezui/ez-upload.entry.js +379 -0
  139. package/dist/ezui/ez-view-stack.entry.js +74 -0
  140. package/dist/ezui/ezui.esm.js +125 -1
  141. package/dist/ezui/index-1e9d524f.js +3031 -0
  142. package/dist/ezui/index-b96183c8.js +2295 -0
  143. package/dist/ezui/index-f32470b5.js +3 -0
  144. package/dist/ezui/index.esm.js +1 -0
  145. package/dist/ezui/{p-3ffdde40.entry.js → p-2f02347d.entry.js} +1 -1
  146. package/dist/ezui/{p-768053d0.entry.js → p-43bb6a59.entry.js} +1 -1
  147. package/dist/ezui/p-4a5e37a7.js +1 -0
  148. package/dist/ezui/{p-72ab066f.entry.js → p-4eb273f8.entry.js} +1 -1
  149. package/dist/ezui/{p-a3ff4f0e.entry.js → p-544f0c63.entry.js} +1 -1
  150. package/dist/ezui/{p-03742d3e.entry.js → p-56688470.entry.js} +1 -1
  151. package/dist/ezui/{p-b901ba02.entry.js → p-5a1927a2.entry.js} +1 -1
  152. package/dist/ezui/{p-cf283c4a.entry.js → p-62110996.entry.js} +1 -1
  153. package/dist/ezui/{p-15d18ece.entry.js → p-744eb735.entry.js} +1 -1
  154. package/dist/ezui/{p-5c721278.entry.js → p-867aac16.entry.js} +1 -1
  155. package/dist/ezui/{p-3ae441ec.entry.js → p-9d5be6a7.entry.js} +1 -1
  156. package/dist/ezui/p-adbe4188.js +1 -0
  157. package/dist/ezui/{p-6cfe20a0.entry.js → p-af43be42.entry.js} +1 -1
  158. package/dist/ezui/{p-7fe1ac9a.entry.js → p-b7467ad6.entry.js} +1 -1
  159. package/dist/ezui/{p-b3e978aa.entry.js → p-c019e137.entry.js} +1 -1
  160. package/dist/ezui/{p-47e06040.entry.js → p-c9d2060e.entry.js} +1 -1
  161. package/dist/ezui/shadow-css-8c625855.js +388 -0
  162. package/dist/types/utils/CSSVarsUtils.d.ts +1 -0
  163. package/package.json +1 -1
  164. package/dist/ezui/p-3263a002.js +0 -1
  165. package/dist/ezui/p-898b9906.js +0 -1
@@ -0,0 +1,439 @@
1
+ import { r as registerInstance, e as createEvent, h, f as Host, g as getElement } from './index-1e9d524f.js';
2
+ import { F as FloatingManager } from './index-b96183c8.js';
3
+ import './index-f32470b5.js';
4
+ import { A as ApplicationUtils } from './ApplicationUtils-30a69eb0.js';
5
+ import { C as CSSVarsUtils } from './CSSVarsUtils-00f67f32.js';
6
+ import './DialogType-72afa679.js';
7
+
8
+ 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)}.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)}.btn__close{visibility:hidden}ez-text-input:hover .btn__close,ez-text-input:focus .btn__close{visibility:visible}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";
9
+
10
+ let EzComboBox = class {
11
+ constructor(hostRef) {
12
+ registerInstance(this, hostRef);
13
+ this.ezChange = createEvent(this, "ezChange", 7);
14
+ this._changeDeboucingTimeout = null;
15
+ this._limitCharsToSearch = 3;
16
+ this._deboucingTime = 300;
17
+ this._maxWidthValue = 0;
18
+ this._tabPressed = false;
19
+ this._textEmptyList = "Nenhum resultado encontrado";
20
+ this._startLoading = false;
21
+ this._showLoading = true;
22
+ /**
23
+ * Deixa o campo disponível ou não para interação com usuário.
24
+ */
25
+ this.enabled = true;
26
+ /**
27
+ * Ajusta a opção de mostrar o "value" ao selecionar uma opção. Por padrão não mostra.
28
+ */
29
+ this.showSelectedValue = false;
30
+ /**
31
+ * Ajusta a opção de mostrar o "value" para cada opção. Por padrão não mostra
32
+ */
33
+ this.showOptionValue = false;
34
+ /**
35
+ * Desabilita a digitação dentro do componente.
36
+ */
37
+ this.suppressSearch = false;
38
+ /**
39
+ * Remove a opção vazia da lista de opções
40
+ */
41
+ this.suppressEmptyOption = false;
42
+ /**
43
+ * Permite exibir a mensagem de erro.
44
+ */
45
+ this.canShowError = true;
46
+ /**
47
+ * Define o modo do tamanho do campo; opções: slim e regular.
48
+ */
49
+ this.mode = "regular";
50
+ }
51
+ observeErrorMessage() {
52
+ var _a;
53
+ if (this._textInput) {
54
+ this._textInput.errorMessage = this.errorMessage;
55
+ if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
56
+ this.setInputValue();
57
+ }
58
+ }
59
+ }
60
+ observeValue(newValue, oldValue) {
61
+ var _a, _b, _c, _d;
62
+ if (this._textInput && newValue != oldValue) {
63
+ const newValueSelected = this.getSelectedOption(newValue);
64
+ const oldValueSelected = this.getSelectedOption(oldValue);
65
+ const currentValue = this.getSelectedOption(this.value);
66
+ 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())) {
67
+ this.value = newValueSelected;
68
+ }
69
+ 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())) {
70
+ this.setInputValue();
71
+ const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
72
+ this.ezChange.emit(valueEmitted);
73
+ }
74
+ this.hideOptions();
75
+ this._criteria = undefined;
76
+ this._preSelection = undefined;
77
+ this.updateVisibleOptions();
78
+ }
79
+ }
80
+ /**
81
+ * Realiza o foco no componente de seleção
82
+ */
83
+ async setFocus() {
84
+ this._textInput.setFocus();
85
+ }
86
+ /**
87
+ * Remove o foco no componente de seleção
88
+ */
89
+ async setBlur() {
90
+ this._textInput.setBlur();
91
+ }
92
+ /**
93
+ * Retorna informando se o campo está inválido (true | false)
94
+ */
95
+ async isInvalid() {
96
+ return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
97
+ }
98
+ getText() {
99
+ let text = "";
100
+ const currentValue = this.getSelectedOption(this.value);
101
+ if (currentValue) {
102
+ text = this.showSelectedValue ? `${currentValue.value} - ${currentValue.label}` : currentValue.label;
103
+ }
104
+ return text;
105
+ }
106
+ getSelectedOption(value) {
107
+ if (typeof value === "string" || value instanceof String) {
108
+ return this._visibleOptions.find(o => o.value === value);
109
+ }
110
+ return value;
111
+ }
112
+ updateVisibleOptions() {
113
+ let opts = this._source || [];
114
+ if (!this.searchMode && this._criteria) {
115
+ const upperCriteria = this._criteria.toUpperCase();
116
+ opts = opts.filter(opt => opt.label.toLocaleUpperCase().indexOf(upperCriteria) > -1);
117
+ }
118
+ if (this.suppressEmptyOption) {
119
+ this._visibleOptions = opts;
120
+ }
121
+ else {
122
+ this._visibleOptions = [{ value: undefined, label: "" }].concat(opts);
123
+ }
124
+ this._maxWidthValue = this.getMaxWidthValue();
125
+ }
126
+ getMaxWidthValue() {
127
+ var _a;
128
+ if (this.showOptionValue) {
129
+ const arrValues = [];
130
+ (_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.forEach(opt => {
131
+ const widthValue = this.getWidthValue(opt.value);
132
+ if (!arrValues.includes(widthValue)) {
133
+ arrValues.push(widthValue);
134
+ }
135
+ });
136
+ return arrValues.length > 1 ? Math.max(...arrValues) : 0;
137
+ }
138
+ return 0;
139
+ }
140
+ getWidthValue(value) {
141
+ if (this._itemValueBasis) {
142
+ const span = this._itemValueBasis;
143
+ if (value) {
144
+ span.innerHTML = value;
145
+ return span.clientWidth > 0 ? (span.clientWidth + 1) : 0;
146
+ }
147
+ else {
148
+ span.innerHTML = "";
149
+ }
150
+ }
151
+ return 0;
152
+ }
153
+ buildItem(opt, index) {
154
+ return h("li", { class: index === this._preSelection ? "item preselected" : "item", id: `item_${opt.value}`, onMouseDown: () => this.selectOption(opt), onMouseOver: () => this._preSelection = undefined }, this.showOptionValue
155
+ ? h("span", { class: "item__value", title: opt.value, style: { width: this.showOptionValue && this._maxWidthValue > 0 ? `${this._maxWidthValue}px` : '' } }, opt.value)
156
+ : undefined, h("span", { class: "item__label", title: opt.label }, opt.label));
157
+ }
158
+ showOptions() {
159
+ if (!this.enabled) {
160
+ return;
161
+ }
162
+ //FIXME: Provavelmente isso fará com que o popup abra em uma
163
+ //posição errada no futuro. Preferi fazer simples no começo,
164
+ //porque não quis onerar o text input com essa funcionalidade...
165
+ const top = (this.errorMessage || !this.canShowError || this.mode === "slim") ? "0px" : "-19px";
166
+ this._floatingID = FloatingManager.float(this._listWrapper, this._listContainer, { autoClose: true, top });
167
+ window.requestAnimationFrame(() => {
168
+ this._listWrapper.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
169
+ });
170
+ }
171
+ hideOptions() {
172
+ if (this._floatingID !== undefined) {
173
+ FloatingManager.close(this._floatingID);
174
+ }
175
+ this._floatingID = undefined;
176
+ }
177
+ isOptionsVisible() {
178
+ return this._floatingID !== undefined && FloatingManager.isFloating(this._floatingID);
179
+ }
180
+ nextOption() {
181
+ if (this.searchMode && !this.isOptionsVisible()) {
182
+ return;
183
+ }
184
+ this.showOptions();
185
+ this._preSelection = this._preSelection === undefined ? 0 : Math.min(this._preSelection + 1, this._visibleOptions.length - 1);
186
+ this.scrollToOption(this._visibleOptions[this._preSelection], true);
187
+ }
188
+ previousOption() {
189
+ this._preSelection = this._preSelection === undefined ? 0 : Math.max(this._preSelection - 1, 0);
190
+ this.scrollToOption(this._visibleOptions[this._preSelection], false);
191
+ }
192
+ scrollToOption(opt, down) {
193
+ window.requestAnimationFrame(() => {
194
+ const liElem = this._optionsList.querySelector(`li#item_${opt.value}`);
195
+ if (liElem) {
196
+ const parent = liElem.parentElement;
197
+ const parentRect = parent.getBoundingClientRect();
198
+ const itemRect = liElem.getBoundingClientRect();
199
+ if (down && itemRect.bottom > parentRect.bottom) {
200
+ parent.scrollTop = itemRect.top;
201
+ }
202
+ else if (!down && itemRect.top < parentRect.top) {
203
+ parent.scrollTop = 0;
204
+ }
205
+ }
206
+ });
207
+ }
208
+ selectCurrentOption() {
209
+ if (this._preSelection !== undefined) {
210
+ this.selectOption(this._visibleOptions[this._preSelection]);
211
+ this._preSelection = undefined;
212
+ }
213
+ else {
214
+ this.controlListWithOnlyOne();
215
+ }
216
+ }
217
+ updateSource(source) {
218
+ this._startLoading = false;
219
+ if (source instanceof Promise) {
220
+ this._showLoading = true;
221
+ source.then(result => {
222
+ this._showLoading = false;
223
+ this.updateSource(result);
224
+ }).catch(() => this._showLoading = false);
225
+ this.updateVisibleOptions();
226
+ }
227
+ else {
228
+ this._showLoading = false;
229
+ if (Array.isArray(source)) {
230
+ this._source = source;
231
+ this.updateVisibleOptions();
232
+ if (this._tabPressed) {
233
+ this._tabPressed = false;
234
+ this.controlEmptySearch();
235
+ }
236
+ }
237
+ else {
238
+ this.selectOption(source);
239
+ }
240
+ }
241
+ }
242
+ clearSource() {
243
+ this._source = [];
244
+ this.updateVisibleOptions();
245
+ }
246
+ selectOption(newOption) {
247
+ var _a, _b;
248
+ const currentValue = this.getSelectedOption(this.value);
249
+ 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())) {
250
+ const adjustedOpt = !(newOption === null || newOption === void 0 ? void 0 : newOption.value) ? undefined : newOption;
251
+ this.value = adjustedOpt;
252
+ }
253
+ else {
254
+ this.setInputValue();
255
+ }
256
+ if (this.searchMode) {
257
+ this._visibleOptions = [];
258
+ }
259
+ if (this.searchMode) {
260
+ this._visibleOptions = [];
261
+ }
262
+ }
263
+ loadOptions(mode, argument = "") {
264
+ this._criteria = argument;
265
+ this._startLoading = true;
266
+ if (this.optionLoader) {
267
+ this.updateSource(this.optionLoader({ mode, argument }));
268
+ }
269
+ else {
270
+ this.updateSource(this.options);
271
+ }
272
+ }
273
+ cancelPreselection() {
274
+ if (!this._textInput.value && this.value) {
275
+ this.selectOption(undefined);
276
+ }
277
+ else {
278
+ this.setInputValue();
279
+ }
280
+ }
281
+ setInputValue(clearError = true) {
282
+ const textValue = this.getText();
283
+ if ((this._textInput.value || '') !== textValue) {
284
+ this._textInput.value = textValue;
285
+ if (clearError) {
286
+ this.errorMessage = "";
287
+ }
288
+ }
289
+ }
290
+ clearSearch() {
291
+ this.value = null;
292
+ }
293
+ controlListWithOnlyOne() {
294
+ if (this.searchMode) {
295
+ const source = this._visibleOptions;
296
+ if ((source === null || source === void 0 ? void 0 : source.length) === 1) {
297
+ this.selectOption(source[0]);
298
+ }
299
+ }
300
+ }
301
+ controlEmptySearch() {
302
+ var _a;
303
+ if (this.searchMode) {
304
+ if (!((_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.length)) {
305
+ this.clearSearch();
306
+ ApplicationUtils.info(this._textEmptyList);
307
+ }
308
+ else {
309
+ this.controlListWithOnlyOne();
310
+ }
311
+ }
312
+ }
313
+ //---------------------------------------------
314
+ // Lifecycle web component
315
+ //---------------------------------------------
316
+ componentWillLoad() {
317
+ if (this.options === undefined) {
318
+ this.options = [];
319
+ const optionsTags = this.el.querySelectorAll("option");
320
+ if (optionsTags) {
321
+ optionsTags.forEach(e => {
322
+ let label = e.innerText;
323
+ let value = e.getAttribute("value");
324
+ if (!value) {
325
+ value = label;
326
+ }
327
+ this.options.push({ label, value });
328
+ e.hidden = true;
329
+ });
330
+ }
331
+ }
332
+ if (this.searchMode) {
333
+ this.updateSource([]);
334
+ }
335
+ else {
336
+ this.loadOptions("PRELOAD");
337
+ }
338
+ }
339
+ componentDidRender() {
340
+ if (this._floatingID === undefined) {
341
+ this._listWrapper.remove();
342
+ }
343
+ }
344
+ componentDidLoad() {
345
+ CSSVarsUtils.applyVarsTextInput(this.el, this._textInput);
346
+ this.setInputValue(false);
347
+ }
348
+ //---------------------------------------------
349
+ // Event handlers
350
+ //---------------------------------------------
351
+ handlerIconClick() {
352
+ this.searchMode ? this.loadOptions("ADVANCED") : this.showOptions();
353
+ }
354
+ onTextInputChangeHandler(event) {
355
+ var _a;
356
+ this.clearDeboucingTimeout();
357
+ if (this._startLoading) {
358
+ this._changeDeboucingTimeout = window.setTimeout(() => {
359
+ this.onTextInputChangeHandler(event);
360
+ }, this._deboucingTime);
361
+ return;
362
+ }
363
+ const argument = (_a = event.target.value) === null || _a === void 0 ? void 0 : _a.trim();
364
+ const argumentNumber = Number(argument || undefined);
365
+ if (!this._criteria) {
366
+ this._textInput.value = event.data || argument;
367
+ }
368
+ this._criteria = argument;
369
+ if (argument && (!isNaN(argumentNumber) || argument.length >= this._limitCharsToSearch)) {
370
+ if (this.searchMode) {
371
+ this._showLoading = true;
372
+ this.clearSource();
373
+ this._changeDeboucingTimeout = window.setTimeout(() => {
374
+ this.loadOptions("PREDICTIVE", isNaN(argumentNumber) ? argument : argumentNumber.toString());
375
+ }, this._deboucingTime);
376
+ }
377
+ else {
378
+ this.updateVisibleOptions();
379
+ }
380
+ this.showOptions();
381
+ }
382
+ else {
383
+ this.hideOptions();
384
+ }
385
+ }
386
+ clearDeboucingTimeout() {
387
+ if (this._changeDeboucingTimeout) {
388
+ window.clearTimeout(this._changeDeboucingTimeout);
389
+ this._changeDeboucingTimeout = undefined;
390
+ }
391
+ }
392
+ onTextInputClickHandler() {
393
+ if (!this.searchMode) {
394
+ this.showOptions();
395
+ }
396
+ }
397
+ keyDownHandler(event) {
398
+ this._tabPressed = false;
399
+ switch (event.key) {
400
+ case "ArrowDown":
401
+ this.nextOption();
402
+ break;
403
+ case "ArrowUp":
404
+ this.previousOption();
405
+ break;
406
+ case "Enter":
407
+ this.selectCurrentOption();
408
+ break;
409
+ case "Escape":
410
+ this.cancelPreselection();
411
+ break;
412
+ case "Tab":
413
+ this._tabPressed = true;
414
+ this.controlListWithOnlyOne();
415
+ break;
416
+ }
417
+ event.stopPropagation();
418
+ }
419
+ onTextInputFocusOutHandler() {
420
+ this.cancelPreselection();
421
+ }
422
+ render() {
423
+ var _a;
424
+ 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)
425
+ ? h("button", { class: "btn btn__close", slot: "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.clearSearch() }, h("ez-icon", { iconName: "close" }))
426
+ : 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
427
+ && h("div", { class: "message" }, !this._showLoading && h("span", { class: "message__no-result" }, this._textEmptyList), this._showLoading && h("div", { class: "message__loading" })), this.showOptionValue
428
+ ? h("span", { class: "item__value item__value--hidden", ref: elem => this._itemValueBasis = elem })
429
+ : undefined, this._visibleOptions.length > 0 && this._visibleOptions.map((opt, index) => this.buildItem(opt, index)))))));
430
+ }
431
+ get el() { return getElement(this); }
432
+ static get watchers() { return {
433
+ "errorMessage": ["observeErrorMessage"],
434
+ "value": ["observeValue"]
435
+ }; }
436
+ };
437
+ EzComboBox.style = ezComboBoxCss;
438
+
439
+ export { EzComboBox as ez_combo_box };
@@ -0,0 +1,159 @@
1
+ import { r as registerInstance, e as createEvent, h, f as Host, g as getElement } from './index-1e9d524f.js';
2
+ import { e as DateUtils } from './index-b96183c8.js';
3
+ import { C as CSSVarsUtils } from './CSSVarsUtils-00f67f32.js';
4
+
5
+ const ezDateInputCss = ":host{display:block;width:100%;--ez-date-input__input--background-color:var(--background--medium, #e0e0e0);--ez-date-input__input--border-color:var(--ez-date-input__input--background-color);--ez-date-input__calendar-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"15px\"><path d=\"M 3.171875,5.25 C 2.6485088,5.25 2.21875,5.6797588 2.21875,6.203125 2.21875,6.7264912 2.6485088,7.15625 3.171875,7.15625 3.6952412,7.15625 4.125,6.7264912 4.125,6.203125 4.125,5.6797588 3.6952412,5.25 3.171875,5.25 Z m 2.875,0 C 5.5235088,5.25 5.09375,5.6797588 5.09375,6.203125 5.09375,6.7264912 5.5235088,7.15625 6.046875,7.15625 6.5702412,7.15625 7,6.7264912 7,6.203125 7,5.6797588 6.5702412,5.25 6.046875,5.25 Z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.9511719,-0.4297588 0.9511719,-0.953125 C 9.8730469,5.6797588 9.4452412,5.25 8.921875,5.25 Z m 2.873047,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.953125 0.953125,0.953125 0.523366,0 0.953125,-0.4297588 0.953125,-0.953125 C 12.748047,5.6797588 12.318288,5.25 11.794922,5.25 Z M 3.171875,8.1230469 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 0.5233662,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 C 6.5702412,10.029297 7,9.5995381 7,9.0761719 7,8.5528057 6.5702412,8.1230469 6.046875,8.1230469 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297587,0.9531251 0.953125,0.9531251 0.5233661,0 0.9531249,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.9531251 0.953125,0.9531251 0.523367,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.171875,10.998047 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 C 6.5702412,12.904297 7,12.474538 7,11.951172 7,11.427806 6.5702412,10.998047 6.046875,10.998047 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297587,0.953125 0.953125,0.953125 0.5233661,0 0.9531249,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.429759,0.953125 0.953125,0.953125 0.523367,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.5,0 c -0.554,0 -1,0.446 -1,1 v 0.050781 C 1.0853217,1.2909766 0,2.5186658 0,4 v 9 c 0,1.652487 1.3475134,3 3,3 h 9 c 1.652487,0 3,-1.347513 3,-3 V 4 C 15,2.5186658 13.914678,1.2909766 12.5,1.0507812 V 1 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 C 4.5,0.446 4.054,0 3.5,0 Z m 1,2.0996094 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 v -0.640625 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 2.1738281 C 13.311725,2.3905225 13.900391,3.11278 13.900391,4 v 9 c 0,1.062113 -0.838278,1.900391 -1.900391,1.900391 H 3 C 1.9378864,14.900391 1.0996094,14.062113 1.0996094,13 V 4 C 1.0996094,3.11278 1.6882747,2.3905225 2.5,2.1738281 v 0.5664063 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 z\"/></svg>')}.btn-open-cal{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-cal:disabled{cursor:unset}.btn-open-cal::after{content:'';display:flex;background-color:var(--text--primary, #008561);width:15px;height:16px;-webkit-mask-image:var(--ez-date-input__calendar-image);mask-image:var(--ez-date-input__calendar-image)}.btn-open-cal:disabled:after{background-color:var(--text--disable, #AFB6C0)}.btn-open-cal:enabled:hover::after{background-color:var(--color--primary, #4e4e4e)}ez-text-input{--text-input__input--background-color:var(--ez-date-input__input--background-color, #FFFFFF);--text-input__input--border-color:var(--ez-date-input__input--border-color, #DCE0E8)}";
6
+
7
+ let EzDateInput = class {
8
+ constructor(hostRef) {
9
+ registerInstance(this, hostRef);
10
+ this.ezChange = createEvent(this, "ezChange", 7);
11
+ this.ezStartChange = createEvent(this, "ezStartChange", 7);
12
+ this.ezCancelWaitingChange = createEvent(this, "ezCancelWaitingChange", 7);
13
+ this._focused = false;
14
+ /**
15
+ * Deixa o campo disponível ou não para uso.
16
+ */
17
+ this.enabled = true;
18
+ /**
19
+ * Define o modo do tamanho do campo; opções: slim e regular.
20
+ */
21
+ this.mode = "regular";
22
+ }
23
+ observeLabel() {
24
+ if (this._textInput) {
25
+ this._textInput.label = this.label;
26
+ }
27
+ }
28
+ observeErrorMessage() {
29
+ var _a;
30
+ if (this._textInput) {
31
+ this._textInput.errorMessage = this.errorMessage;
32
+ if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
33
+ this.setInputValue();
34
+ }
35
+ }
36
+ }
37
+ observeValue(newValue, oldValue) {
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);
51
+ }
52
+ }
53
+ }
54
+ /**
55
+ * Realiza o foco no componente de data
56
+ */
57
+ async setFocus() {
58
+ this._textInput.setFocus();
59
+ }
60
+ /**
61
+ * Remove o foco no componente de data
62
+ */
63
+ async setBlur() {
64
+ this._textInput.setBlur();
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
+ }
72
+ changeValue(newValue) {
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;
77
+ }
78
+ }
79
+ showCalendar() {
80
+ this.handleBlur();
81
+ this._calendar.value = this.value;
82
+ //FIXME: Provavelmente isso fará com que o popup abra em uma
83
+ //posição errada no futuro. Preferi fazer simples no começo,
84
+ //porque não quis onerar o text input com essa funcionalidade...
85
+ const top = this.errorMessage || this.mode === "slim" ? 0 : -19;
86
+ this._calendar.fitVertical(top, this._elem.clientHeight);
87
+ }
88
+ hideCalendar() {
89
+ this.changeValue(this._calendar.value);
90
+ this._calendar.hide();
91
+ }
92
+ handleBlur() {
93
+ const strValue = this._textInput.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();
105
+ }
106
+ else {
107
+ this.changeValue(newValueValidated);
108
+ }
109
+ }
110
+ else {
111
+ this.changeValue(undefined);
112
+ this.ezCancelWaitingChange.emit();
113
+ this.errorMessage = "O valor digitado não é uma data válida";
114
+ }
115
+ }
116
+ getTextValue(d) {
117
+ return d ? new Intl.DateTimeFormat("pt-BR").format(d) : undefined;
118
+ }
119
+ handleInput(event) {
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
+ if (event['data'] === "H" || event['data'] === "h") {
129
+ this.changeValue(new Date());
130
+ }
131
+ }
132
+ validateValue(value) {
133
+ return value instanceof Date && !isNaN(value.valueOf())
134
+ ? DateUtils.clearTime(value)
135
+ : undefined;
136
+ }
137
+ setInputValue() {
138
+ const textValue = this.getTextValue(this.value) || '';
139
+ if ((this._textInput.value || '') !== textValue) {
140
+ this._textInput.value = textValue;
141
+ }
142
+ }
143
+ componentDidLoad() {
144
+ CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
145
+ this.setInputValue();
146
+ }
147
+ render() {
148
+ return (h(Host, null, h("ez-text-input", { ref: elem => this._textInput = elem, "data-slave-mode": "true", label: this.label, onBlur: () => this.handleBlur(), onInput: (evt) => this.handleInput(evt), 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 })));
149
+ }
150
+ get _elem() { return getElement(this); }
151
+ static get watchers() { return {
152
+ "label": ["observeLabel"],
153
+ "errorMessage": ["observeErrorMessage"],
154
+ "value": ["observeValue"]
155
+ }; }
156
+ };
157
+ EzDateInput.style = ezDateInputCss;
158
+
159
+ export { EzDateInput as ez_date_input };