@sankhyalabs/ezui 5.20.0-dev.4 → 5.20.0-dev.40

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 (173) hide show
  1. package/dist/cjs/{CSSVarsUtils-b136a156.js → CSSVarsUtils-10c9d5b4.js} +13 -0
  2. package/dist/cjs/ez-actions-button.cjs.entry.js +1 -1
  3. package/dist/cjs/ez-alert-list.cjs.entry.js +1 -1
  4. package/dist/cjs/ez-card-item_3.cjs.entry.js +183 -0
  5. package/dist/cjs/ez-check.cjs.entry.js +1 -1
  6. package/dist/cjs/ez-combo-box.cjs.entry.js +20 -163
  7. package/dist/cjs/ez-date-input.cjs.entry.js +4 -1
  8. package/dist/cjs/ez-date-time-input.cjs.entry.js +4 -1
  9. package/dist/cjs/ez-form-view.cjs.entry.js +30 -13
  10. package/dist/cjs/ez-grid.cjs.entry.js +149 -50
  11. package/dist/cjs/ez-icon.cjs.entry.js +1 -1
  12. package/dist/cjs/ez-modal-container.cjs.entry.js +6 -0
  13. package/dist/cjs/ez-multi-selection-list.cjs.entry.js +2 -10
  14. package/dist/cjs/ez-number-input.cjs.entry.js +4 -1
  15. package/dist/cjs/ez-popup.cjs.entry.js +8 -1
  16. package/dist/cjs/ez-scroller_3.cjs.entry.js +18 -4
  17. package/dist/cjs/ez-search.cjs.entry.js +611 -32
  18. package/dist/cjs/ez-split-button.cjs.entry.js +147 -0
  19. package/dist/cjs/ez-split-item.cjs.entry.js +20 -2
  20. package/dist/cjs/ez-split-panel.cjs.entry.js +52 -15
  21. package/dist/cjs/ez-time-input.cjs.entry.js +1 -1
  22. package/dist/cjs/ez-toast.cjs.entry.js +1 -1
  23. package/dist/cjs/ezui.cjs.js +1 -1
  24. package/dist/cjs/filter-column.cjs.entry.js +16 -5
  25. package/dist/cjs/index-a7b0c73d.js +10 -10
  26. package/dist/cjs/loader.cjs.js +1 -1
  27. package/dist/collection/collection-manifest.json +4 -3
  28. package/dist/collection/components/ez-alert-list/ez-alert-list.css +1 -1
  29. package/dist/collection/components/ez-card-item/ez-card-item.css +52 -3
  30. package/dist/collection/components/ez-card-item/ez-card-item.js +22 -3
  31. package/dist/collection/components/ez-check/ez-check.css +1 -0
  32. package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +1 -0
  33. package/dist/collection/components/ez-combo-box/ez-combo-box.js +20 -180
  34. package/dist/collection/components/ez-date-input/ez-date-input.js +3 -0
  35. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +3 -0
  36. package/dist/collection/components/ez-form-view/ez-form-view.css +17 -1
  37. package/dist/collection/components/ez-form-view/ez-form-view.js +22 -5
  38. package/dist/collection/components/ez-form-view/fieldbuilder/templates/CheckBox.tpl.js +1 -1
  39. package/dist/collection/components/ez-form-view/fieldbuilder/templates/ComboBox.tpl.js +1 -1
  40. package/dist/collection/components/ez-form-view/fieldbuilder/templates/DateInput.tpl.js +3 -3
  41. package/dist/collection/components/ez-form-view/fieldbuilder/templates/NumberInput.tpl.js +1 -1
  42. package/dist/collection/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.js +1 -1
  43. package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.js +1 -1
  44. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +34 -18
  45. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +15 -2
  46. package/dist/collection/components/ez-grid/controller/ag-grid/DataSourceInterceptor.js +21 -0
  47. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js +5 -7
  48. package/dist/collection/components/ez-grid/ez-grid.css +25 -2
  49. package/dist/collection/components/ez-grid/ez-grid.js +80 -18
  50. package/dist/collection/components/ez-grid/subcomponents/filter-column.js +16 -5
  51. package/dist/collection/components/ez-icon/ez-icon.css +118 -116
  52. package/dist/collection/components/ez-modal-container/ez-modal-container.js +15 -0
  53. package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +2 -10
  54. package/dist/collection/components/ez-number-input/ez-number-input.js +3 -0
  55. package/dist/collection/components/ez-popup/ez-popup.css +2 -5
  56. package/dist/collection/components/ez-popup/ez-popup.js +31 -1
  57. package/dist/collection/components/ez-search/ez-search.css +331 -0
  58. package/dist/collection/components/ez-search/ez-search.js +688 -55
  59. package/dist/collection/components/ez-split-button/ez-split-button.css +229 -0
  60. package/dist/collection/components/ez-split-button/ez-split-button.js +436 -0
  61. package/dist/collection/components/ez-split-button/test/dropdownItems.js +42 -0
  62. package/dist/collection/components/ez-split-panel/ez-split-panel.css +6 -14
  63. package/dist/collection/components/ez-split-panel/ez-split-panel.js +77 -23
  64. package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.css +66 -12
  65. package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.js +82 -2
  66. package/dist/collection/components/ez-toast/ez-toast.css +1 -1
  67. package/dist/collection/components/ez-tree/ez-tree.css +26 -0
  68. package/dist/collection/components/ez-tree/interfaces/ITreeItemBadge.js +1 -0
  69. package/dist/collection/components/ez-tree/subcomponents/TreeItem.js +15 -2
  70. package/dist/collection/utils/CSSVarsUtils.js +13 -0
  71. package/dist/collection/utils/form/test/DataBinder.test.js +9 -0
  72. package/dist/custom-elements/index.d.ts +6 -0
  73. package/dist/custom-elements/index.js +1109 -314
  74. package/dist/esm/{CSSVarsUtils-a97cfa29.js → CSSVarsUtils-71ce76be.js} +13 -0
  75. package/dist/esm/ez-actions-button.entry.js +1 -1
  76. package/dist/esm/ez-alert-list.entry.js +1 -1
  77. package/dist/esm/ez-card-item_3.entry.js +177 -0
  78. package/dist/esm/ez-check.entry.js +1 -1
  79. package/dist/esm/ez-combo-box.entry.js +21 -164
  80. package/dist/esm/ez-date-input.entry.js +4 -1
  81. package/dist/esm/ez-date-time-input.entry.js +4 -1
  82. package/dist/esm/ez-form-view.entry.js +31 -14
  83. package/dist/esm/ez-grid.entry.js +150 -51
  84. package/dist/esm/ez-icon.entry.js +1 -1
  85. package/dist/esm/ez-modal-container.entry.js +6 -0
  86. package/dist/esm/ez-multi-selection-list.entry.js +2 -10
  87. package/dist/esm/ez-number-input.entry.js +4 -1
  88. package/dist/esm/ez-popup.entry.js +8 -1
  89. package/dist/esm/ez-scroller_3.entry.js +18 -4
  90. package/dist/esm/ez-search.entry.js +613 -34
  91. package/dist/esm/ez-split-button.entry.js +143 -0
  92. package/dist/esm/ez-split-item.entry.js +20 -2
  93. package/dist/esm/ez-split-panel.entry.js +52 -15
  94. package/dist/esm/ez-time-input.entry.js +1 -1
  95. package/dist/esm/ez-toast.entry.js +1 -1
  96. package/dist/esm/ezui.js +1 -1
  97. package/dist/esm/filter-column.entry.js +16 -5
  98. package/dist/esm/index-baa5e267.js +10 -10
  99. package/dist/esm/loader.js +1 -1
  100. package/dist/ezui/ezui.esm.js +1 -1
  101. package/dist/ezui/{p-844ee673.entry.js → p-1dede1b2.entry.js} +2 -2
  102. package/dist/ezui/p-2eb8f73b.entry.js +1 -0
  103. package/dist/ezui/p-58fae29b.entry.js +1 -0
  104. package/dist/ezui/{p-40f72de4.entry.js → p-784fe207.entry.js} +1 -1
  105. package/dist/ezui/p-7a636dfc.entry.js +1 -0
  106. package/dist/ezui/p-7af81663.entry.js +1 -0
  107. package/dist/ezui/p-7bc07c31.entry.js +1 -0
  108. package/dist/ezui/p-8c82374d.entry.js +1 -0
  109. package/dist/ezui/{p-8becebf8.entry.js → p-8df1ca33.entry.js} +1 -1
  110. package/dist/ezui/{p-940ed30b.entry.js → p-8e7031a0.entry.js} +1 -1
  111. package/dist/ezui/p-91f626d3.entry.js +1 -0
  112. package/dist/ezui/{p-eb36f072.entry.js → p-99ead599.entry.js} +1 -1
  113. package/dist/ezui/{p-7eb3e1a5.js → p-9e11fc7b.js} +1 -1
  114. package/dist/ezui/p-9f1e89c9.entry.js +1 -0
  115. package/dist/ezui/p-af95cd16.entry.js +1 -0
  116. package/dist/ezui/{p-c0f1715f.entry.js → p-b567fa8c.entry.js} +1 -1
  117. package/dist/ezui/p-b9fbf4e7.entry.js +1 -0
  118. package/dist/ezui/p-bae3d0aa.entry.js +1 -0
  119. package/dist/ezui/p-baf80b13.entry.js +1 -0
  120. package/dist/ezui/p-bf79aaa1.entry.js +1 -0
  121. package/dist/ezui/{p-93c3df4f.entry.js → p-d7d7423a.entry.js} +1 -1
  122. package/dist/ezui/p-db77a984.entry.js +1 -0
  123. package/dist/ezui/{p-9cad9b6e.entry.js → p-e85c48d7.entry.js} +1 -1
  124. package/dist/types/components/ez-card-item/ez-card-item.d.ts +4 -0
  125. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +1 -15
  126. package/dist/types/components/ez-form-view/ez-form-view.d.ts +3 -0
  127. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +1 -0
  128. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +2 -0
  129. package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +2 -1
  130. package/dist/types/components/ez-grid/controller/ag-grid/DataSourceInterceptor.d.ts +8 -0
  131. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
  132. package/dist/types/components/ez-grid/ez-grid.d.ts +16 -2
  133. package/dist/types/components/ez-grid/subcomponents/filter-column.d.ts +4 -1
  134. package/dist/types/components/ez-guide-navigator/interfaces/IGuideItem.d.ts +0 -1
  135. package/dist/types/components/ez-modal-container/ez-modal-container.d.ts +1 -0
  136. package/dist/types/components/ez-multi-selection-list/ez-multi-selection-list.d.ts +0 -1
  137. package/dist/types/components/ez-popup/ez-popup.d.ts +6 -1
  138. package/dist/types/components/ez-search/ez-search.d.ts +100 -10
  139. package/dist/types/components/ez-split-button/ez-split-button.d.ts +89 -0
  140. package/dist/types/components/ez-split-button/test/dropdownItems.d.ts +2 -0
  141. package/dist/types/components/ez-split-panel/ez-split-panel.d.ts +28 -0
  142. package/dist/types/components/ez-split-panel/structure/item/ez-split-item.d.ts +27 -0
  143. package/dist/types/components/ez-tree/interfaces/ITreeItem.d.ts +3 -1
  144. package/dist/types/components/ez-tree/interfaces/ITreeItemBadge.d.ts +6 -0
  145. package/dist/types/components/ez-tree/subcomponents/TreeItem.d.ts +0 -1
  146. package/dist/types/components.d.ts +182 -21
  147. package/dist/types/utils/CSSVarsUtils.d.ts +1 -0
  148. package/dist/types/utils/form/test/DataBinder.test.d.ts +1 -0
  149. package/dist/types/utils/interfaces/AbstractFieldMetadata.d.ts +2 -1
  150. package/package.json +5 -5
  151. package/react/components.d.ts +1 -0
  152. package/react/components.js +1 -0
  153. package/react/components.js.map +1 -1
  154. package/dist/cjs/ez-card-item.cjs.entry.js +0 -52
  155. package/dist/cjs/ez-filter-input_2.cjs.entry.js +0 -137
  156. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridUtils.js +0 -8
  157. package/dist/esm/ez-card-item.entry.js +0 -48
  158. package/dist/esm/ez-filter-input_2.entry.js +0 -132
  159. package/dist/ezui/p-05f5a778.entry.js +0 -1
  160. package/dist/ezui/p-13dbad96.entry.js +0 -1
  161. package/dist/ezui/p-24d3fede.entry.js +0 -1
  162. package/dist/ezui/p-51c5e071.entry.js +0 -1
  163. package/dist/ezui/p-5613fe63.entry.js +0 -1
  164. package/dist/ezui/p-596634e9.entry.js +0 -1
  165. package/dist/ezui/p-5d692ed1.entry.js +0 -1
  166. package/dist/ezui/p-5d86cca9.entry.js +0 -1
  167. package/dist/ezui/p-60848ef6.entry.js +0 -1
  168. package/dist/ezui/p-a08b309b.entry.js +0 -1
  169. package/dist/ezui/p-a32aaac6.entry.js +0 -1
  170. package/dist/ezui/p-a5ac7151.entry.js +0 -1
  171. package/dist/ezui/p-af15c277.entry.js +0 -1
  172. package/dist/ezui/p-d6ffe679.entry.js +0 -1
  173. package/dist/types/components/ez-grid/controller/ag-grid/AgGridUtils.d.ts +0 -1
@@ -1,13 +1,32 @@
1
- import { r as registerInstance, c as createEvent, h, g as getElement } from './index-baa5e267.js';
2
- import { C as CSSVarsUtils } from './CSSVarsUtils-a97cfa29.js';
3
- import { ElementIDUtils } from '@sankhyalabs/core';
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-baa5e267.js';
2
+ import { C as CSSVarsUtils } from './CSSVarsUtils-71ce76be.js';
3
+ import { ObjectUtils, StringUtils, FloatingManager, ElementIDUtils } from '@sankhyalabs/core';
4
+ import { A as ApplicationUtils } from './ApplicationUtils-eaf91331.js';
5
+ import './DialogType-54a62731.js';
6
+ import './CheckMode-bdb2ec19.js';
7
+ import { R as REQUIRED_INFO } from './constants-4e0d35b7.js';
4
8
 
5
- const ezSearchCss = ":host{width:100%}";
9
+ const ezSearchCss = ":host{--ez-search--height:42px;--ez-search--width:100%;--ez-search__icon--width:48px;--ez-search--border-radius:var(--border--radius-medium, 12px);--ez-search--border-radius-small:var(--border--radius-small, 6px);--ez-search--font-size:var(--text--medium, 14px);--ez-search--font-family:var(--font-pattern, Arial);--ez-search--font-weight--large:var(--text-weight--large, 500);--ez-search--font-weight--medium:var(--text-weight--medium, 400);--ez-search--background-color--xlight:var(--background--xlight, #fff);--ez-search--background-medium:var(--background--medium, #f0f3f7);--ez-search--line-height:calc(var(--text--medium, 14px) + 4px);--ez-search__input--background-color:var(--background--medium, #e0e0e0);--ez-search__input--border:var(--border--medium, 2px solid);--ez-search__input--border-color:var(--ez-search__input--background-color);--ez-search__input--focus--border-color:var(--color--primary, #008561);--ez-search__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-search__input--disabled--color:var(--text--disable, #AFB6C0);--ez-search__input--error--border-color:#CC2936;--ez-search__btn--color:var(--title--primary, #2B3A54);--ez-search__btn-disabled--color:var(--text--disable, #AFB6C0);--ez-search__btn-hover--color:var(--color--primary, #4e4e4e);--ez-search__label--color:var(--title--primary, #2B3A54);--ez-search__list-title--primary:var(--title--primary, #2B3A54);--ez-search__list-text--primary:var(--text--primary, #626e82);--ez-search__list-height:calc(var(--ez-search--font-size) + var(--ez-search--space--medium) + 4px);--ez-search__list-min-width:64px;--ez-search--space--medium:var(--space--medium, 12px);--ez-search--space--small:var(--space--small, 6px);--ez-search__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-search__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-search__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-search__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-search__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-search__scrollbar--width:var(--space--medium, 12px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-search--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{min-width:var(--ez-search__list-min-width);overflow:auto;position:relative;width:100%}.list-wrapper{display:flex;flex-direction:column;box-sizing:border-box;width:0;z-index:var(--more-visible, 2);max-height:350px;min-width:150px;background-color:var(--ez-search--background-color--xlight);border-radius:var(--ez-search--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000);padding:var(--ez-search--space--small)}.list-options{box-sizing:border-box;width:100%;height:100%;padding:0;display:flex;flex-direction:column;scroll-behavior:smooth;overflow:auto;scrollbar-width:thin;gap:3px;scrollbar-color:var(--ez-search__scrollbar--color-clicked) var(--ez-search__scrollbar--color-background)}.list-options::-webkit-scrollbar{background-color:var(--ez-search__scrollbar--color-background);width:var(--ez-search__scrollbar--width);max-width:var(--ez-search__scrollbar--width);min-width:var(--ez-search__scrollbar--width)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-search__scrollbar--color-background);border-radius:var(--ez-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-search__scrollbar--color-default);border-radius:var(--ez-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb:vertical:hover,.list-options::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-search__scrollbar--color-hover)}.list-options::-webkit-scrollbar-thumb:vertical:active,.list-options::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-search__scrollbar--color-clicked)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-search--border-radius-small);padding:var(--ez-search--space--small);gap:var(--space--small, 6px)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-search__list-title--primary);font-family:var(--ez-search--font-family);font-size:var(--ez-search--font-size);line-height:var(--ez-search--line-height)}.item__label{font-weight:var(--ez-search--font-weight--medium)}.item__label--bold{font-weight:var(--ez-search--font-weight--large)}.item__value{text-align:center;color:var(--ez-search__list-text--primary);font-weight:var(--ez-search--font-weight--large)}.item__value--hidden{visibility:hidden;position:absolute;white-space:nowrap;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:var(--ez-search__list-height)}.message__no-result{color:var(--ez-search__list-title--primary);font-family:var(--ez-search--font-family);font-size:var(--ez-search--font-size)}.message__loading{border-radius:50%;width:14px;height:14px;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:3px solid var(--ez-search__list-title--primary);border-top:3px solid transparent}.item__list>li:hover{background-color:var(--ez-search--background-medium)}.preselected{background-color:var(--background--medium)}.btn{outline:none;border:none;background:none;cursor:pointer;color:var(--ez-search__btn--color)}.btn:disabled{cursor:unset;color:var(--ez-search__btn-disabled--color)}.btn:disabled:hover{cursor:unset;color:var(--ez-search__btn-disabled--color)}.btn:hover{color:var(--ez-search__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)}}";
6
10
 
7
11
  const EzSearch = class {
8
12
  constructor(hostRef) {
9
13
  registerInstance(this, hostRef);
10
14
  this.ezChange = createEvent(this, "ezChange", 7);
15
+ this._changeDeboucingTimeout = null;
16
+ this._limitCharsToSearch = 3;
17
+ this._deboucingTime = 300;
18
+ this._maxWidthValue = 0;
19
+ this._tabPressed = false;
20
+ this._textEmptyList = "Nenhum resultado encontrado";
21
+ this._textEmptySearch = "Nenhum resultado de {0} encontrado";
22
+ this._lookupMode = false;
23
+ this._startHighlightTag = "<span class='card-item__highlight'>";
24
+ this._endHighlightTag = "</span>";
25
+ this._preSelection = undefined;
26
+ this._visibleOptions = undefined;
27
+ this._startLoading = false;
28
+ this._showLoading = true;
29
+ this._criteria = undefined;
11
30
  this.value = undefined;
12
31
  this.label = undefined;
13
32
  this.enabled = true;
@@ -22,28 +41,82 @@ const EzSearch = class {
22
41
  this.listOptionsPosition = undefined;
23
42
  this.isTextSearch = false;
24
43
  this.ignoreLimitCharsToSearch = false;
44
+ this.options = undefined;
45
+ this.suppressSearch = false;
25
46
  }
26
47
  observeErrorMessage() {
27
- if (this._comboElement) {
28
- this._comboElement.errorMessage = this.errorMessage;
48
+ var _a;
49
+ if (this._textInput) {
50
+ this._textInput.errorMessage = this.errorMessage;
51
+ if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
52
+ this.setInputValue();
53
+ }
29
54
  }
30
55
  }
31
- observeValue() {
32
- if (this._comboElement) {
33
- this._comboElement.value = this.value;
56
+ observeValue(newValue, oldValue) {
57
+ if (this._textInput && newValue != oldValue) {
58
+ try {
59
+ if (newValue === "string") {
60
+ this.setInputValue();
61
+ return;
62
+ }
63
+ const newValueSelected = this.getSelectedOption(newValue);
64
+ const oldValueSelected = this.getSelectedOption(oldValue);
65
+ const currentValue = this.getSelectedOption(this.value);
66
+ if (this.isDifferentValues(currentValue, newValueSelected)) {
67
+ this.value = newValueSelected;
68
+ }
69
+ if (this.isDifferentValues(newValueSelected, oldValueSelected)) {
70
+ this.setInputValue();
71
+ const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
72
+ if (!this._lookupMode) {
73
+ this.ezChange.emit(valueEmitted);
74
+ }
75
+ }
76
+ this.resetOptions();
77
+ }
78
+ finally {
79
+ this._lookupMode = false;
80
+ }
34
81
  }
35
82
  }
83
+ observeOptions(newOptions, oldOptions) {
84
+ if ((newOptions === null || newOptions === void 0 ? void 0 : newOptions.join('')) === (oldOptions === null || oldOptions === void 0 ? void 0 : oldOptions.join('')))
85
+ return;
86
+ this.loadOptions(SearchMode.PRELOAD);
87
+ }
88
+ /*
89
+ * Retorna uma promise com o valor da opção selecionada,
90
+ * que será resolvida quando o backend devolver este dado.
91
+ */
92
+ async getValueAsync() {
93
+ if (!this._showLoading) {
94
+ return new Promise(resolve => resolve(this.value));
95
+ }
96
+ return new Promise(resolve => {
97
+ let id = setInterval(() => {
98
+ if (!this._showLoading) {
99
+ clearInterval(id);
100
+ resolve(this.value);
101
+ }
102
+ }, 100);
103
+ });
104
+ }
36
105
  /**
37
- * Aplica o foco no campo.
38
- */
106
+ * Aplica o foco no campo.
107
+ */
39
108
  async setFocus() {
40
- this._comboElement.setFocus();
109
+ if (this._textInput) {
110
+ this._textInput.setFocus();
111
+ }
41
112
  }
42
113
  /**
43
- * Remove o foco do campo.
44
- */
114
+ * Remove o foco do campo.
115
+ */
45
116
  async setBlur() {
46
- this._comboElement.setBlur();
117
+ if (this._textInput) {
118
+ this._textInput.setBlur();
119
+ }
47
120
  }
48
121
  /**
49
122
  * Retorna se o conteúdo é inválido.
@@ -55,39 +128,545 @@ const EzSearch = class {
55
128
  * Limpa o valor do campo de pesquisa
56
129
  */
57
130
  async clearValue() {
131
+ this.clearSearch();
132
+ }
133
+ scrollListener() {
134
+ var _a;
135
+ if (this._floatingID == undefined) {
136
+ return;
137
+ }
138
+ if ((_a = this.listOptionsPosition) === null || _a === void 0 ? void 0 : _a.hardPosition) {
139
+ this.hideOptions();
140
+ }
141
+ else {
142
+ window.requestAnimationFrame(() => {
143
+ this.updateListPosition();
144
+ });
145
+ }
146
+ }
147
+ updateListPosition() {
148
+ let { verticalPosition, horizontalPosition, fromBottom, fromRight, bottomLimit, hardPosition } = this.getListPosition();
149
+ const elementRect = this._listWrapper.getBoundingClientRect();
150
+ const containerRect = this._listContainer.getBoundingClientRect();
151
+ const textInputRect = this._textInput.getBoundingClientRect();
152
+ const limitHeight = bottomLimit || window.innerHeight;
153
+ const neededHeight = containerRect.bottom + elementRect.height;
154
+ if (!fromBottom && (elementRect.top < 0 || neededHeight > limitHeight)) {
155
+ fromBottom = true;
156
+ }
157
+ if (!hardPosition) {
158
+ verticalPosition = verticalPosition || 0;
159
+ horizontalPosition = horizontalPosition || 0;
160
+ if (fromBottom) {
161
+ verticalPosition = window.innerHeight - textInputRect.top + verticalPosition;
162
+ }
163
+ else {
164
+ verticalPosition += containerRect.top;
165
+ }
166
+ if (fromRight) {
167
+ horizontalPosition = window.innerWidth - textInputRect.right + horizontalPosition;
168
+ }
169
+ else {
170
+ horizontalPosition += containerRect.left;
171
+ }
172
+ }
173
+ if (verticalPosition != undefined) {
174
+ this._listWrapper.style[fromBottom ? "bottom" : "top"] = `${verticalPosition}px`;
175
+ this._listWrapper.style[fromBottom ? "top" : "bottom"] = "";
176
+ }
177
+ if (horizontalPosition != undefined) {
178
+ this._listWrapper.style[fromRight ? "right" : "left"] = `${horizontalPosition}px`;
179
+ this._listWrapper.style[fromRight ? "left" : "right"] = "";
180
+ }
181
+ }
182
+ getListPosition() {
183
+ if (this.listOptionsPosition) {
184
+ return this.listOptionsPosition;
185
+ }
186
+ return {
187
+ verticalPosition: (this.errorMessage || !this.canShowError || this.mode === "slim") ? 6 : -13
188
+ };
189
+ }
190
+ isDifferentValues(firstValue, secondValue) {
191
+ return ObjectUtils.objectToString(firstValue || {}) !== ObjectUtils.objectToString(secondValue || {});
192
+ }
193
+ getFormattedText(currentValue) {
194
+ if (currentValue == undefined) {
195
+ return;
196
+ }
197
+ let text = (!this.showSelectedValue || currentValue.value == undefined) ? currentValue.label : `${currentValue.value} - ${currentValue.label}`;
198
+ text = text.replace(new RegExp(this._startHighlightTag, 'g'), '').replace(new RegExp(this._endHighlightTag, 'g'), '');
199
+ return text;
200
+ }
201
+ getText() {
202
+ const currentValue = this.getSelectedOption(this.value);
203
+ const text = this.getFormattedText(currentValue);
204
+ if (text == undefined) {
205
+ return;
206
+ }
207
+ return String(text)
208
+ .replace(/&amp;/g, '&')
209
+ .replace(/&lt;/g, '<')
210
+ .replace(/&gt;/g, '>')
211
+ .replace(/&quot;/g, '"');
212
+ }
213
+ getSelectedOption(value) {
214
+ if (typeof value === "string" || value instanceof String) {
215
+ return this._visibleOptions.find(o => o.value === value);
216
+ }
217
+ return value;
218
+ }
219
+ updateVisibleOptions() {
220
+ let opts = this._source || [];
221
+ if (this.suppressEmptyOption) {
222
+ this._visibleOptions = opts;
223
+ }
224
+ else {
225
+ this._visibleOptions = [{ value: undefined, label: "" }].concat(opts);
226
+ }
227
+ this._maxWidthValue = this.getMaxWidthValue();
228
+ }
229
+ getMaxWidthValue() {
230
+ var _a;
231
+ const arrValues = [];
232
+ (_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.forEach(opt => {
233
+ const widthValue = this.getWidthValue(opt.value);
234
+ if (!arrValues.includes(widthValue)) {
235
+ arrValues.push(widthValue);
236
+ }
237
+ });
238
+ return arrValues.length > 1 ? Math.max(...arrValues) : 0;
239
+ }
240
+ getWidthValue(value) {
241
+ if (this._itemValueBasis != undefined) {
242
+ const span = this._itemValueBasis;
243
+ if (value != undefined) {
244
+ span.innerHTML = value;
245
+ return span.clientWidth > 0 ? (span.clientWidth + 2) : 0;
246
+ }
247
+ else {
248
+ span.innerHTML = "";
249
+ }
250
+ }
251
+ return 0;
252
+ }
253
+ createOption(detail) {
254
+ let { key, title } = detail;
255
+ const startHighlight = new RegExp(this._startHighlightTag, 'g');
256
+ const endHighlight = new RegExp(this._endHighlightTag, 'g');
257
+ title = StringUtils.decodeHtmlEntities(title);
258
+ const option = {
259
+ value: key === null || key === void 0 ? void 0 : key.replace(startHighlight, '').replace(endHighlight, ''),
260
+ label: title === null || title === void 0 ? void 0 : title.replace(startHighlight, '').replace(endHighlight, '')
261
+ };
262
+ this.selectOption(option);
263
+ }
264
+ buildItem(opt, index) {
265
+ opt.label = opt.label || opt.value;
266
+ const card = {
267
+ key: opt.value,
268
+ title: opt.label,
269
+ details: opt.details
270
+ };
271
+ return h("div", { style: { "height": "100%" }, class: index === this._preSelection ? "item preselected" : "item", id: `item_${opt.value}`, onMouseDown: () => this.createOption(card), onMouseOver: () => this._preSelection = index }, h("ez-card-item", { item: card }));
272
+ }
273
+ showOptions() {
274
+ if (!this.enabled)
275
+ return;
276
+ if (this.isOptionsVisible()) {
277
+ return;
278
+ }
279
+ if (!!this._resizeObserver)
280
+ this._resizeObserver.observe(this._textInput);
281
+ this._floatingID = FloatingManager.float(this._listWrapper, this._listContainer, { autoClose: false, isFixed: true, backClickListener: () => this.hideOptions() });
282
+ this.setFocus();
283
+ window.requestAnimationFrame(() => {
284
+ this.updateListPosition();
285
+ if (!this.listOptionsPosition) {
286
+ this._listWrapper.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
287
+ }
288
+ });
289
+ }
290
+ hideOptions() {
291
+ if (this._floatingID !== undefined) {
292
+ FloatingManager.close(this._floatingID);
293
+ }
294
+ this._floatingID = undefined;
295
+ if (!!this._resizeObserver)
296
+ this._resizeObserver.unobserve(this._textInput);
297
+ }
298
+ isOptionsVisible() {
299
+ return this._floatingID !== undefined && FloatingManager.isFloating(this._floatingID);
300
+ }
301
+ nextOption() {
302
+ if (!this.isOptionsVisible()) {
303
+ return;
304
+ }
305
+ this.showOptions();
306
+ this._preSelection = this._preSelection === undefined ? 0 : Math.min(this._preSelection + 1, this._visibleOptions.length - 1);
307
+ this.scrollToOption(this._visibleOptions[this._preSelection]);
308
+ }
309
+ previousOption() {
310
+ this._preSelection = this._preSelection === undefined ? 0 : Math.max(this._preSelection - 1, 0);
311
+ this.scrollToOption(this._visibleOptions[this._preSelection]);
312
+ }
313
+ scrollToOption(opt) {
314
+ window.requestAnimationFrame(() => {
315
+ const liElem = (opt === null || opt === void 0 ? void 0 : opt.value) ? this._optionsList.querySelector(`div#item_${opt.value.replace(/[<>\[\]#=]/g, '\\$&').replace(/:/g, '\\:')}`) : undefined;
316
+ if (liElem)
317
+ liElem.scrollIntoView({ behavior: "smooth", block: "nearest" });
318
+ });
319
+ }
320
+ selectCurrentOption() {
321
+ if (this._preSelection !== undefined) {
322
+ this.selectOption(this._visibleOptions[this._preSelection]);
323
+ this._preSelection = undefined;
324
+ }
325
+ else {
326
+ this.controlListWithOnlyOne();
327
+ }
328
+ }
329
+ updateSource(source) {
330
+ this._startLoading = false;
331
+ if (source instanceof Promise) {
332
+ this._showLoading = true;
333
+ source.then(result => {
334
+ this._showLoading = false;
335
+ this.updateSource(result);
336
+ }).catch(() => this._showLoading = false);
337
+ this.updateVisibleOptions();
338
+ }
339
+ else {
340
+ this._showLoading = false;
341
+ if (Array.isArray(source)) {
342
+ this._source = source;
343
+ this.updateVisibleOptions();
344
+ if (this._tabPressed) {
345
+ this._tabPressed = false;
346
+ this.controlEmptySearch();
347
+ }
348
+ }
349
+ else {
350
+ this.selectOption(source);
351
+ }
352
+ }
353
+ }
354
+ clearSource() {
355
+ this._source = [];
356
+ this.updateVisibleOptions();
357
+ }
358
+ selectOption(newOption) {
359
+ var _a, _b;
360
+ const currentValue = this.getSelectedOption(this.value);
361
+ 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()))
362
+ || (currentValue == undefined && newOption != undefined && "value" in newOption)) {
363
+ const adjustedOpt = !(newOption === null || newOption === void 0 ? void 0 : newOption.value) ? undefined : newOption;
364
+ this.value = adjustedOpt;
365
+ }
366
+ else {
367
+ this.resetOptions();
368
+ }
369
+ this._visibleOptions = [];
370
+ this.clearSource();
371
+ }
372
+ loadOptions(mode, argument = "") {
373
+ this._criteria = argument;
374
+ this._startLoading = true;
375
+ if (this.optionLoader) {
376
+ const searchArgument = { mode, argument };
377
+ this.updateSource(this.optionLoader(searchArgument));
378
+ }
379
+ else {
380
+ this.updateSource(this.options);
381
+ }
382
+ }
383
+ cancelPreselection() {
384
+ if (!this._textInput.value && this.value) {
385
+ this.selectOption(undefined);
386
+ }
387
+ else {
388
+ window.setTimeout(() => {
389
+ this.setInputValue();
390
+ }, this._deboucingTime);
391
+ }
392
+ this.resetOptions();
393
+ }
394
+ setInputValue(clearError = true) {
395
+ const textValue = this.getText();
396
+ if ((this._textInput.value || '') !== textValue) {
397
+ this._textInput.value = textValue;
398
+ if (clearError) {
399
+ this.errorMessage = null;
400
+ }
401
+ }
402
+ }
403
+ clearSearch() {
404
+ this.value = null;
405
+ }
406
+ controlListWithOnlyOne() {
58
407
  var _a, _b;
59
- (_b = (_a = this._comboElement) === null || _a === void 0 ? void 0 : _a['clearValue']) === null || _b === void 0 ? void 0 : _b.call(_a);
408
+ const source = (_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.filter((opt) => opt.label !== "" && opt.value != undefined);
409
+ if ((source === null || source === void 0 ? void 0 : source.length) > 0) {
410
+ const startHighlight = new RegExp(this._startHighlightTag, 'g');
411
+ const endHighlight = new RegExp(this._endHighlightTag, 'g');
412
+ let title = StringUtils.decodeHtmlEntities(source[0].label);
413
+ const option = {
414
+ value: (_b = source[0].value) === null || _b === void 0 ? void 0 : _b.replace(startHighlight, '').replace(endHighlight, ''),
415
+ label: title === null || title === void 0 ? void 0 : title.replace(startHighlight, '').replace(endHighlight, '')
416
+ };
417
+ this.selectOption(option);
418
+ }
60
419
  }
61
- /*
62
- * Retorna uma promise com o valor da opção selecionada,
63
- * que será resolvida quando o backend devolver este dado.
64
- */
65
- async getValueAsync() {
420
+ controlEmptySearch() {
421
+ var _a;
422
+ if (!((_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.length)) {
423
+ this.clearSearch();
424
+ ApplicationUtils.info(this._textEmptyList);
425
+ }
426
+ else {
427
+ this.controlListWithOnlyOne();
428
+ }
429
+ }
430
+ validateDescriptionValue() {
431
+ if (StringUtils.isEmpty(this.value)) {
432
+ return;
433
+ }
434
+ let value = this.value;
435
+ if (typeof value === "object") {
436
+ return;
437
+ }
438
+ if (StringUtils.isEmpty(value)) {
439
+ return;
440
+ }
441
+ this.loadDescriptionValue(value);
442
+ }
443
+ async loadDescriptionValue(argument) {
444
+ var _a, _b;
445
+ if (argument == undefined) {
446
+ return;
447
+ }
448
+ if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.length) > 0) {
449
+ this.loadOptionValue(argument);
450
+ return;
451
+ }
452
+ const searchArgument = {
453
+ mode: SearchMode.PREDICTIVE,
454
+ argument
455
+ };
456
+ const source = await ((_b = this.optionLoader) === null || _b === void 0 ? void 0 : _b.call(this, searchArgument));
457
+ if (source == undefined) {
458
+ return;
459
+ }
460
+ if (source instanceof Promise) {
461
+ source.then((result) => {
462
+ this.setDescriptionValue(result);
463
+ });
464
+ }
465
+ else {
466
+ this.setDescriptionValue(source);
467
+ }
468
+ }
469
+ setDescriptionValue(source) {
470
+ const value = (source === null || source === void 0 ? void 0 : source[0]) || source;
471
+ if (value == undefined || !Object.keys(value).length) {
472
+ this.showNoResultMessage();
473
+ return;
474
+ }
475
+ this._lookupMode = true;
476
+ this.value = value;
477
+ }
478
+ loadOptionValue(argument) {
66
479
  var _a;
67
- return (_a = this._comboElement) === null || _a === void 0 ? void 0 : _a.getValueAsync();
480
+ const source = (_a = this.options) === null || _a === void 0 ? void 0 : _a.find((opt) => opt.value === argument);
481
+ if (source != undefined) {
482
+ this.selectOption(source);
483
+ }
484
+ else {
485
+ this.showNoResultMessage();
486
+ }
68
487
  }
69
- onComboChange(event) {
70
- event.stopPropagation();
71
- this.value = event.detail;
72
- this.ezChange.emit(event.detail);
73
- if (this.errorMessage !== this._comboElement.errorMessage) {
74
- this.errorMessage = this._comboElement.errorMessage;
488
+ async showNoResultMessage() {
489
+ this.clearSearch();
490
+ ApplicationUtils.info(this._textEmptySearch.replace("{0}", this.getFieldLabel()));
491
+ }
492
+ getFieldLabel() {
493
+ var _a;
494
+ return (_a = this.label) === null || _a === void 0 ? void 0 : _a.replace(REQUIRED_INFO, "").toUpperCase();
495
+ }
496
+ resetOptions() {
497
+ this.hideOptions();
498
+ this._criteria = undefined;
499
+ this._preSelection = undefined;
500
+ this.updateVisibleOptions();
501
+ }
502
+ //---------------------------------------------
503
+ // Lifecycle web component
504
+ //---------------------------------------------
505
+ componentWillLoad() {
506
+ if (this.options === undefined) {
507
+ this.options = [];
508
+ const optionsTags = this.el.querySelectorAll("option");
509
+ if (optionsTags) {
510
+ optionsTags.forEach(e => {
511
+ let label = e.innerText;
512
+ let value = e.getAttribute("value");
513
+ let details = e.getAttribute("details");
514
+ if (!value) {
515
+ value = label;
516
+ }
517
+ this.options.push({ label, value, details });
518
+ e.hidden = true;
519
+ });
520
+ }
75
521
  }
522
+ this.updateSource([]);
523
+ }
524
+ componentDidRender() {
525
+ var _a;
526
+ if (this._floatingID === undefined) {
527
+ this._listWrapper.remove();
528
+ }
529
+ (_a = this._optionsList) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".item").forEach((elem) => {
530
+ ElementIDUtils.addIDInfoIfNotExists(elem, "itemSearch");
531
+ });
532
+ this.validateDescriptionValue();
76
533
  }
77
534
  componentDidLoad() {
78
- CSSVarsUtils.applyVarsTextInput(this._elem, this._comboElement);
535
+ CSSVarsUtils.applyVarsTextInput(this.el, this._textInput);
536
+ this.setInputValue(false);
537
+ this._resizeObserver = new ResizeObserver((entries) => {
538
+ window.requestAnimationFrame(() => {
539
+ if (!Array.isArray(entries) || !entries.length)
540
+ return;
541
+ const { clientWidth } = this._listContainer;
542
+ if (clientWidth > 0 && !!this._listWrapper) {
543
+ this._listWrapper.style.width = `${clientWidth}px`;
544
+ }
545
+ });
546
+ });
547
+ }
548
+ //---------------------------------------------
549
+ // Event handlers
550
+ //---------------------------------------------
551
+ handlerIconClick() {
552
+ this.loadOptions(SearchMode.ADVANCED);
553
+ }
554
+ buildNumberArgument(argument) {
555
+ if (this.isTextSearch) {
556
+ return NaN;
557
+ }
558
+ return Number(argument || undefined);
559
+ }
560
+ onTextInputChangeHandler(event) {
561
+ var _a;
562
+ this.clearDeboucingTimeout();
563
+ if (this._startLoading) {
564
+ this._changeDeboucingTimeout = window.setTimeout(() => {
565
+ this.onTextInputChangeHandler(event);
566
+ }, this._deboucingTime);
567
+ return;
568
+ }
569
+ const argument = (_a = event.target.value) === null || _a === void 0 ? void 0 : _a.trim();
570
+ const argumentNumber = this.buildNumberArgument(argument);
571
+ if (!this._criteria) {
572
+ this._textInput.value = event.data || argument;
573
+ }
574
+ this._criteria = argument;
575
+ if (argument) {
576
+ this._showLoading = false;
577
+ this.clearSource();
578
+ if (!isNaN(argumentNumber) || argument.length >= this._limitCharsToSearch) {
579
+ this._showLoading = true;
580
+ this._changeDeboucingTimeout = window.setTimeout(() => {
581
+ this.loadOptions(SearchMode.PREDICTIVE, isNaN(argumentNumber) ? argument : argumentNumber.toString());
582
+ }, this._deboucingTime);
583
+ this.showOptions();
584
+ }
585
+ else {
586
+ this.hideOptions();
587
+ }
588
+ }
589
+ else {
590
+ this.hideOptions();
591
+ this._showLoading = false;
592
+ this.clearSource();
593
+ }
594
+ }
595
+ clearDeboucingTimeout() {
596
+ if (this._changeDeboucingTimeout) {
597
+ window.clearTimeout(this._changeDeboucingTimeout);
598
+ this._changeDeboucingTimeout = null;
599
+ }
600
+ }
601
+ keyDownHandler(event) {
602
+ this._tabPressed = false;
603
+ if (event.ctrlKey) {
604
+ if (event.key === "f" || event.key === "F") {
605
+ this.loadOptions(SearchMode.ADVANCED);
606
+ //ATENÇÃO: Ctrl + F tem ação específica nos browsers
607
+ //nesse caso, como vamos abrir o popup de busca avançada,
608
+ //não é interessante deixar o evento propagar;
609
+ event.stopPropagation();
610
+ event.stopImmediatePropagation();
611
+ event.preventDefault();
612
+ }
613
+ }
614
+ switch (event.key) {
615
+ case "ArrowDown":
616
+ this.nextOption();
617
+ event.stopPropagation();
618
+ break;
619
+ case "ArrowUp":
620
+ this.previousOption();
621
+ event.stopPropagation();
622
+ break;
623
+ case "Enter":
624
+ this.selectCurrentOption();
625
+ break;
626
+ case "Escape":
627
+ this.cancelPreselection();
628
+ break;
629
+ case "Tab":
630
+ this._tabPressed = true;
631
+ this.controlListWithOnlyOne();
632
+ break;
633
+ }
634
+ //ATENÇÃO: Existe a necessidade de propagar o evento de teclado.
635
+ //Por exemplo, quando o usuário dá um Enter, além de selecionar
636
+ //um valor, também significa que a ateração finalizou,
637
+ //e o contexto pode reagir (fechar um popup por exemplo).
638
+ //event.stopPropagation();
639
+ }
640
+ onTextInputFocusOutHandler() {
641
+ if (this.hideErrorOnFocusOut)
642
+ this.cancelPreselection();
643
+ }
644
+ canShowListOptions() {
645
+ return !this._showLoading && this._visibleOptions.length > 0;
79
646
  }
80
647
  render() {
81
- ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
82
- return (h("ez-combo-box", { "data-element-id": ElementIDUtils.getInternalIDInfo("combo"), ref: elem => this._comboElement = elem, value: this.value, label: this.label, enabled: this.enabled, errorMessage: this.errorMessage, hideErrorOnFocusOut: this.hideErrorOnFocusOut, optionLoader: this.optionLoader, searchMode: true, onEzChange: event => this.onComboChange(event), showSelectedValue: this.showSelectedValue, showOptionValue: this.showOptionValue, suppressEmptyOption: this.suppressEmptyOption, mode: this.mode, canShowError: this.canShowError, listOptionsPosition: this.listOptionsPosition, isTextSearch: this.isTextSearch, limitCharsToSearch: this.ignoreLimitCharsToSearch ? 0 : 3 }));
648
+ var _a;
649
+ ElementIDUtils.addIDInfoIfNotExists(this.el, 'input');
650
+ return (h(Host, null, h("ez-text-input", { "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), 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), 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: "leftIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.handlerIconClick() }, h("ez-icon", { iconName: "search" })), ((_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value) && (this._criteria || this.value)
651
+ ? h("button", { class: "btn btn__close", slot: "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.clearSearch() }, h("ez-icon", { iconName: "close" }))
652
+ : undefined), h("section", { class: "list-container", ref: elem => this._listContainer = elem }, h("div", { class: "list-wrapper", ref: elem => this._listWrapper = elem }, h("ul", { class: "list-options", ref: elem => this._optionsList = elem }, !this._showLoading
653
+ && this._visibleOptions.length === 0
654
+ && h("div", { class: "message" }, h("span", { class: "message__no-result" }, this._textEmptyList)), this._showLoading
655
+ && h("div", { class: "message" }, h("div", { class: "message__loading" })), h("span", { class: "item__value item__value--hidden", ref: elem => this._itemValueBasis = elem }), this.canShowListOptions() && this._visibleOptions.map((opt, index) => this.buildItem(opt, index)))))));
83
656
  }
84
- ;
85
- get _elem() { return getElement(this); }
657
+ get el() { return getElement(this); }
86
658
  static get watchers() { return {
87
659
  "errorMessage": ["observeErrorMessage"],
88
- "value": ["observeValue"]
660
+ "value": ["observeValue"],
661
+ "options": ["observeOptions"]
89
662
  }; }
90
663
  };
664
+ var SearchMode;
665
+ (function (SearchMode) {
666
+ SearchMode["ADVANCED"] = "ADVANCED";
667
+ SearchMode["PRELOAD"] = "PRELOAD";
668
+ SearchMode["PREDICTIVE"] = "PREDICTIVE";
669
+ })(SearchMode || (SearchMode = {}));
91
670
  EzSearch.style = ezSearchCss;
92
671
 
93
672
  export { EzSearch as ez_search };