@sankhyalabs/ezui 5.20.4 → 5.21.0-dev.2

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 (248) hide show
  1. package/README.md +4 -5
  2. package/dist/cjs/{CSSVarsUtils-b136a156.js → CSSVarsUtils-10c9d5b4.js} +13 -0
  3. package/dist/cjs/ez-actions-button.cjs.entry.js +2 -2
  4. package/dist/cjs/ez-alert-list.cjs.entry.js +121 -49
  5. package/dist/cjs/ez-alert.cjs.entry.js +1 -1
  6. package/dist/cjs/ez-application.cjs.entry.js +1 -1
  7. package/dist/cjs/ez-badge.cjs.entry.js +1 -1
  8. package/dist/cjs/ez-breadcrumb.cjs.entry.js +1 -1
  9. package/dist/cjs/ez-button.cjs.entry.js +1 -1
  10. package/dist/cjs/ez-calendar.cjs.entry.js +1 -1
  11. package/dist/cjs/ez-card-item_3.cjs.entry.js +183 -0
  12. package/dist/cjs/ez-check.cjs.entry.js +2 -2
  13. package/dist/cjs/ez-chip.cjs.entry.js +1 -1
  14. package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -1
  15. package/dist/cjs/ez-combo-box.cjs.entry.js +20 -163
  16. package/dist/cjs/ez-date-input.cjs.entry.js +2 -2
  17. package/dist/cjs/ez-date-time-input.cjs.entry.js +2 -2
  18. package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
  19. package/dist/cjs/ez-dropdown.cjs.entry.js +10 -4
  20. package/dist/cjs/ez-file-item.cjs.entry.js +1 -1
  21. package/dist/cjs/ez-form-view.cjs.entry.js +35 -16
  22. package/dist/cjs/ez-form.cjs.entry.js +1 -1
  23. package/dist/cjs/ez-grid.cjs.entry.js +132 -58
  24. package/dist/cjs/ez-guide-navigator.cjs.entry.js +1 -1
  25. package/dist/cjs/ez-icon.cjs.entry.js +2 -2
  26. package/dist/cjs/ez-list.cjs.entry.js +1 -1
  27. package/dist/cjs/ez-loading-bar.cjs.entry.js +1 -1
  28. package/dist/cjs/ez-modal-container.cjs.entry.js +6 -1
  29. package/dist/cjs/ez-modal.cjs.entry.js +1 -1
  30. package/dist/cjs/ez-multi-selection-list.cjs.entry.js +1 -1
  31. package/dist/cjs/ez-number-input.cjs.entry.js +2 -2
  32. package/dist/cjs/ez-popover.cjs.entry.js +1 -1
  33. package/dist/cjs/ez-popup.cjs.entry.js +9 -2
  34. package/dist/cjs/ez-radio-button.cjs.entry.js +1 -1
  35. package/dist/cjs/ez-scroller_3.cjs.entry.js +19 -5
  36. package/dist/cjs/ez-search.cjs.entry.js +622 -33
  37. package/dist/cjs/ez-skeleton.cjs.entry.js +1 -1
  38. package/dist/cjs/ez-split-button.cjs.entry.js +166 -0
  39. package/dist/cjs/ez-split-item.cjs.entry.js +21 -3
  40. package/dist/cjs/ez-split-panel.cjs.entry.js +68 -14
  41. package/dist/cjs/ez-tabselector.cjs.entry.js +1 -1
  42. package/dist/cjs/ez-text-area.cjs.entry.js +1 -1
  43. package/dist/cjs/ez-text-edit.cjs.entry.js +1 -1
  44. package/dist/cjs/ez-text-input.cjs.entry.js +1 -1
  45. package/dist/cjs/ez-time-input.cjs.entry.js +2 -2
  46. package/dist/cjs/ez-toast.cjs.entry.js +1 -1
  47. package/dist/cjs/ez-upload.cjs.entry.js +1 -1
  48. package/dist/cjs/ez-view-stack.cjs.entry.js +1 -1
  49. package/dist/cjs/ezui.cjs.js +2 -2
  50. package/dist/cjs/filter-column.cjs.entry.js +17 -6
  51. package/dist/cjs/{index-1064511f.js → index-a7b0c73d.js} +12 -10
  52. package/dist/cjs/loader.cjs.js +2 -2
  53. package/dist/collection/collection-manifest.json +4 -3
  54. package/dist/collection/components/ez-alert-list/ez-alert-list.css +16 -2
  55. package/dist/collection/components/ez-alert-list/ez-alert-list.js +127 -48
  56. package/dist/collection/components/ez-card-item/ez-card-item.css +52 -3
  57. package/dist/collection/components/ez-card-item/ez-card-item.js +22 -3
  58. package/dist/collection/components/ez-check/ez-check.css +1 -0
  59. package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +1 -0
  60. package/dist/collection/components/ez-combo-box/ez-combo-box.js +19 -179
  61. package/dist/collection/components/ez-dropdown/ez-dropdown.js +32 -3
  62. package/dist/collection/components/ez-form-view/ez-form-view.css +17 -1
  63. package/dist/collection/components/ez-form-view/ez-form-view.js +22 -5
  64. package/dist/collection/components/ez-form-view/fieldbuilder/templates/CheckBox.tpl.js +1 -1
  65. package/dist/collection/components/ez-form-view/fieldbuilder/templates/ComboBox.tpl.js +1 -1
  66. package/dist/collection/components/ez-form-view/fieldbuilder/templates/DateInput.tpl.js +3 -3
  67. package/dist/collection/components/ez-form-view/fieldbuilder/templates/FileInput.tpl.js +4 -2
  68. package/dist/collection/components/ez-form-view/fieldbuilder/templates/NumberInput.tpl.js +1 -1
  69. package/dist/collection/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.js +1 -1
  70. package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.js +1 -1
  71. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +8 -11
  72. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +3 -4
  73. package/dist/collection/components/ez-grid/controller/ag-grid/DataSourceInterceptor.js +21 -0
  74. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js +1 -3
  75. package/dist/collection/components/ez-grid/ez-grid.css +25 -1
  76. package/dist/collection/components/ez-grid/ez-grid.js +103 -33
  77. package/dist/collection/components/ez-grid/subcomponents/filter-column.js +16 -5
  78. package/dist/collection/components/ez-icon/ez-icon.css +119 -117
  79. package/dist/collection/components/ez-modal-container/ez-modal-container.js +5 -0
  80. package/dist/collection/components/ez-popup/ez-popup.css +2 -5
  81. package/dist/collection/components/ez-popup/ez-popup.js +23 -2
  82. package/dist/collection/components/ez-search/ez-search.css +331 -0
  83. package/dist/collection/components/ez-search/ez-search.js +698 -55
  84. package/dist/collection/components/ez-split-button/ez-split-button.css +229 -0
  85. package/dist/collection/components/ez-split-button/ez-split-button.js +455 -0
  86. package/dist/collection/components/ez-split-button/test/dropdownItems.js +42 -0
  87. package/dist/collection/components/ez-split-panel/ez-split-panel.css +6 -7
  88. package/dist/collection/components/ez-split-panel/ez-split-panel.js +103 -15
  89. package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.css +59 -12
  90. package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.js +82 -2
  91. package/dist/collection/components/ez-tree/ez-tree.css +26 -0
  92. package/dist/collection/components/ez-tree/interfaces/ITreeItemBadge.js +1 -0
  93. package/dist/collection/components/ez-tree/subcomponents/TreeItem.js +15 -2
  94. package/dist/collection/utils/CSSVarsUtils.js +13 -0
  95. package/dist/collection/utils/form/test/DataBinder.test.js +9 -0
  96. package/dist/custom-elements/index.d.ts +6 -0
  97. package/dist/custom-elements/index.js +1252 -359
  98. package/dist/esm/{CSSVarsUtils-a97cfa29.js → CSSVarsUtils-71ce76be.js} +13 -0
  99. package/dist/esm/ez-actions-button.entry.js +2 -2
  100. package/dist/esm/ez-alert-list.entry.js +121 -49
  101. package/dist/esm/ez-alert.entry.js +1 -1
  102. package/dist/esm/ez-application.entry.js +1 -1
  103. package/dist/esm/ez-badge.entry.js +1 -1
  104. package/dist/esm/ez-breadcrumb.entry.js +1 -1
  105. package/dist/esm/ez-button.entry.js +1 -1
  106. package/dist/esm/ez-calendar.entry.js +1 -1
  107. package/dist/esm/ez-card-item_3.entry.js +177 -0
  108. package/dist/esm/ez-check.entry.js +2 -2
  109. package/dist/esm/ez-chip.entry.js +1 -1
  110. package/dist/esm/ez-collapsible-box.entry.js +1 -1
  111. package/dist/esm/ez-combo-box.entry.js +21 -164
  112. package/dist/esm/ez-date-input.entry.js +2 -2
  113. package/dist/esm/ez-date-time-input.entry.js +2 -2
  114. package/dist/esm/ez-dialog.entry.js +1 -1
  115. package/dist/esm/ez-dropdown.entry.js +10 -4
  116. package/dist/esm/ez-file-item.entry.js +1 -1
  117. package/dist/esm/ez-form-view.entry.js +35 -16
  118. package/dist/esm/ez-form.entry.js +1 -1
  119. package/dist/esm/ez-grid.entry.js +133 -59
  120. package/dist/esm/ez-guide-navigator.entry.js +1 -1
  121. package/dist/esm/ez-icon.entry.js +2 -2
  122. package/dist/esm/ez-list.entry.js +1 -1
  123. package/dist/esm/ez-loading-bar.entry.js +1 -1
  124. package/dist/esm/ez-modal-container.entry.js +6 -1
  125. package/dist/esm/ez-modal.entry.js +1 -1
  126. package/dist/esm/ez-multi-selection-list.entry.js +1 -1
  127. package/dist/esm/ez-number-input.entry.js +2 -2
  128. package/dist/esm/ez-popover.entry.js +1 -1
  129. package/dist/esm/ez-popup.entry.js +10 -3
  130. package/dist/esm/ez-radio-button.entry.js +1 -1
  131. package/dist/esm/ez-scroller_3.entry.js +19 -5
  132. package/dist/esm/ez-search.entry.js +623 -34
  133. package/dist/esm/ez-skeleton.entry.js +1 -1
  134. package/dist/esm/ez-split-button.entry.js +162 -0
  135. package/dist/esm/ez-split-item.entry.js +21 -3
  136. package/dist/esm/ez-split-panel.entry.js +68 -14
  137. package/dist/esm/ez-tabselector.entry.js +1 -1
  138. package/dist/esm/ez-text-area.entry.js +1 -1
  139. package/dist/esm/ez-text-edit.entry.js +1 -1
  140. package/dist/esm/ez-text-input.entry.js +1 -1
  141. package/dist/esm/ez-time-input.entry.js +2 -2
  142. package/dist/esm/ez-toast.entry.js +1 -1
  143. package/dist/esm/ez-upload.entry.js +1 -1
  144. package/dist/esm/ez-view-stack.entry.js +1 -1
  145. package/dist/esm/ezui.js +3 -3
  146. package/dist/esm/filter-column.entry.js +17 -6
  147. package/dist/esm/{index-296b8458.js → index-baa5e267.js} +12 -10
  148. package/dist/esm/loader.js +3 -3
  149. package/dist/ezui/ezui.esm.js +1 -1
  150. package/dist/ezui/{p-5cef0264.entry.js → p-0306dff7.entry.js} +1 -1
  151. package/dist/ezui/{p-871c1a07.entry.js → p-0447d17c.entry.js} +1 -1
  152. package/dist/ezui/p-072e6347.entry.js +1 -0
  153. package/dist/ezui/{p-f4208819.entry.js → p-17be134a.entry.js} +1 -1
  154. package/dist/ezui/{p-cd19a6f8.entry.js → p-1e7a8633.entry.js} +1 -1
  155. package/dist/ezui/{p-60ba28ea.entry.js → p-1f50fa05.entry.js} +1 -1
  156. package/dist/ezui/{p-245a44ed.entry.js → p-20ec22c0.entry.js} +1 -1
  157. package/dist/ezui/{p-e318d280.js → p-23a36bb6.js} +1 -1
  158. package/dist/ezui/{p-8252d9b5.entry.js → p-2a1a0e04.entry.js} +1 -1
  159. package/dist/ezui/p-3faa2b46.entry.js +1 -0
  160. package/dist/ezui/{p-9b347f04.entry.js → p-44caad9a.entry.js} +1 -1
  161. package/dist/ezui/{p-7319c253.entry.js → p-49456b34.entry.js} +1 -1
  162. package/dist/ezui/{p-ccb4ccd9.entry.js → p-555c9018.entry.js} +1 -1
  163. package/dist/ezui/{p-52dd8b4c.entry.js → p-5bd5e68f.entry.js} +1 -1
  164. package/dist/ezui/{p-62304715.entry.js → p-5e1d036e.entry.js} +1 -1
  165. package/dist/ezui/{p-7525e604.entry.js → p-5ed81457.entry.js} +1 -1
  166. package/dist/ezui/p-5ef056ce.entry.js +1 -0
  167. package/dist/ezui/p-637f69f2.entry.js +1 -0
  168. package/dist/ezui/{p-c49dbf23.entry.js → p-650e4b6d.entry.js} +1 -1
  169. package/dist/ezui/{p-f55d75e7.entry.js → p-6e429cff.entry.js} +1 -1
  170. package/dist/ezui/p-701231f0.entry.js +1 -0
  171. package/dist/ezui/{p-0b902469.entry.js → p-77a4bd35.entry.js} +1 -1
  172. package/dist/ezui/{p-81cd05c8.entry.js → p-784fe207.entry.js} +1 -1
  173. package/dist/ezui/p-7af81663.entry.js +1 -0
  174. package/dist/ezui/p-7bc07c31.entry.js +1 -0
  175. package/dist/ezui/{p-5d6f2550.entry.js → p-85c8baae.entry.js} +1 -1
  176. package/dist/ezui/{p-d3b5228e.entry.js → p-8defa6d3.entry.js} +1 -1
  177. package/dist/ezui/{p-fbca293f.entry.js → p-8df1ca33.entry.js} +1 -1
  178. package/dist/ezui/{p-391de0e4.entry.js → p-9050d2cd.entry.js} +1 -1
  179. package/dist/ezui/p-91f626d3.entry.js +1 -0
  180. package/dist/ezui/{p-3e7cc8a4.entry.js → p-99ead599.entry.js} +1 -1
  181. package/dist/ezui/p-9aefaa52.entry.js +1 -0
  182. package/dist/ezui/{p-7eb3e1a5.js → p-9e11fc7b.js} +1 -1
  183. package/dist/ezui/{p-b11f035c.entry.js → p-9f5fa3f9.entry.js} +1 -1
  184. package/dist/ezui/p-a1ec32ef.entry.js +1 -0
  185. package/dist/ezui/{p-2da09f70.entry.js → p-a80b1287.entry.js} +1 -1
  186. package/dist/ezui/{p-d20ed286.entry.js → p-af2ecb1b.entry.js} +1 -1
  187. package/dist/ezui/{p-e8f88361.entry.js → p-af95cd16.entry.js} +1 -1
  188. package/dist/ezui/{p-32b4163f.entry.js → p-b041333c.entry.js} +1 -1
  189. package/dist/ezui/{p-545b5b2f.entry.js → p-b44741b0.entry.js} +2 -2
  190. package/dist/ezui/{p-12526044.entry.js → p-b567fa8c.entry.js} +1 -1
  191. package/dist/ezui/p-bae3d0aa.entry.js +1 -0
  192. package/dist/ezui/{p-fb21d72f.entry.js → p-bae4e180.entry.js} +1 -1
  193. package/dist/ezui/p-baf80b13.entry.js +1 -0
  194. package/dist/ezui/p-bc2f844e.entry.js +1 -0
  195. package/dist/ezui/p-bf79aaa1.entry.js +1 -0
  196. package/dist/ezui/{p-83885b21.entry.js → p-cc2dc4f4.entry.js} +1 -1
  197. package/dist/ezui/p-db77a984.entry.js +1 -0
  198. package/dist/ezui/{p-028f264f.entry.js → p-e85c48d7.entry.js} +1 -1
  199. package/dist/types/components/ez-alert-list/ez-alert-list.d.ts +38 -4
  200. package/dist/types/components/ez-card-item/ez-card-item.d.ts +4 -0
  201. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +1 -15
  202. package/dist/types/components/ez-dropdown/ez-dropdown.d.ts +5 -0
  203. package/dist/types/components/ez-form-view/ez-form-view.d.ts +3 -0
  204. package/dist/types/components/ez-grid/controller/ag-grid/DataSourceInterceptor.d.ts +8 -0
  205. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
  206. package/dist/types/components/ez-grid/ez-grid.d.ts +17 -2
  207. package/dist/types/components/ez-grid/subcomponents/filter-column.d.ts +4 -1
  208. package/dist/types/components/ez-guide-navigator/interfaces/IGuideItem.d.ts +0 -1
  209. package/dist/types/components/ez-modal-container/ez-modal-container.d.ts +1 -0
  210. package/dist/types/components/ez-popup/ez-popup.d.ts +7 -1
  211. package/dist/types/components/ez-search/ez-search.d.ts +101 -10
  212. package/dist/types/components/ez-split-button/ez-split-button.d.ts +92 -0
  213. package/dist/types/components/ez-split-button/test/dropdownItems.d.ts +2 -0
  214. package/dist/types/components/ez-split-panel/ez-split-panel.d.ts +29 -0
  215. package/dist/types/components/ez-split-panel/structure/item/ez-split-item.d.ts +27 -0
  216. package/dist/types/components/ez-tree/interfaces/ITreeItem.d.ts +3 -1
  217. package/dist/types/components/ez-tree/interfaces/ITreeItemBadge.d.ts +6 -0
  218. package/dist/types/components/ez-tree/subcomponents/TreeItem.d.ts +0 -1
  219. package/dist/types/components.d.ts +188 -15
  220. package/dist/types/utils/CSSVarsUtils.d.ts +1 -0
  221. package/dist/types/utils/form/test/DataBinder.test.d.ts +1 -0
  222. package/dist/types/utils/interfaces/AbstractFieldMetadata.d.ts +2 -1
  223. package/dist/types/utils/interfaces/IAction.d.ts +1 -1
  224. package/package.json +13 -5
  225. package/react/components.d.ts +1 -0
  226. package/react/components.js +1 -0
  227. package/react/components.js.map +1 -1
  228. package/dist/cjs/ez-card-item.cjs.entry.js +0 -52
  229. package/dist/cjs/ez-filter-input_2.cjs.entry.js +0 -137
  230. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridUtils.js +0 -8
  231. package/dist/esm/ez-card-item.entry.js +0 -48
  232. package/dist/esm/ez-filter-input_2.entry.js +0 -132
  233. package/dist/ezui/p-47afb974.entry.js +0 -1
  234. package/dist/ezui/p-59bcb27c.entry.js +0 -1
  235. package/dist/ezui/p-74049254.entry.js +0 -1
  236. package/dist/ezui/p-76d16a24.entry.js +0 -1
  237. package/dist/ezui/p-7fd54841.entry.js +0 -1
  238. package/dist/ezui/p-87e85160.entry.js +0 -1
  239. package/dist/ezui/p-95426f93.entry.js +0 -1
  240. package/dist/ezui/p-99692afa.entry.js +0 -1
  241. package/dist/ezui/p-a01068e1.entry.js +0 -1
  242. package/dist/ezui/p-a42fe2ce.entry.js +0 -1
  243. package/dist/ezui/p-af285e68.entry.js +0 -1
  244. package/dist/ezui/p-b6867f19.entry.js +0 -1
  245. package/dist/ezui/p-d51aa09b.entry.js +0 -1
  246. package/dist/ezui/p-d81917fd.entry.js +0 -1
  247. package/dist/ezui/p-f8653522.entry.js +0 -1
  248. package/dist/types/components/ez-grid/controller/ag-grid/AgGridUtils.d.ts +0 -1
@@ -1,8 +1,25 @@
1
- import { h } from "@stencil/core";
1
+ import { h, Host } from "@stencil/core";
2
2
  import CSSVarsUtils from "../../utils/CSSVarsUtils";
3
- import { ElementIDUtils } from "@sankhyalabs/core";
3
+ import { ElementIDUtils, FloatingManager, ObjectUtils, StringUtils } from "@sankhyalabs/core";
4
+ import { ApplicationUtils } from "../../utils";
5
+ import { REQUIRED_INFO } from "../../utils/constants";
4
6
  export class EzSearch {
5
7
  constructor() {
8
+ this._changeDeboucingTimeout = null;
9
+ this._limitCharsToSearch = 3;
10
+ this._deboucingTime = 300;
11
+ this._maxWidthValue = 0;
12
+ this._tabPressed = false;
13
+ this._textEmptyList = "Nenhum resultado encontrado";
14
+ this._textEmptySearch = "Nenhum resultado de {0} encontrado";
15
+ this._lookupMode = false;
16
+ this._startHighlightTag = "<span class='card-item__highlight'>";
17
+ this._endHighlightTag = "</span>";
18
+ this._preSelection = undefined;
19
+ this._visibleOptions = undefined;
20
+ this._startLoading = false;
21
+ this._showLoading = true;
22
+ this._criteria = undefined;
6
23
  this.value = undefined;
7
24
  this.label = undefined;
8
25
  this.enabled = true;
@@ -17,28 +34,82 @@ export class EzSearch {
17
34
  this.listOptionsPosition = undefined;
18
35
  this.isTextSearch = false;
19
36
  this.ignoreLimitCharsToSearch = false;
37
+ this.options = undefined;
38
+ this.suppressSearch = false;
20
39
  }
21
40
  observeErrorMessage() {
22
- if (this._comboElement) {
23
- this._comboElement.errorMessage = this.errorMessage;
41
+ var _a;
42
+ if (this._textInput) {
43
+ this._textInput.errorMessage = this.errorMessage;
44
+ if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
45
+ this.setInputValue();
46
+ }
24
47
  }
25
48
  }
26
- observeValue() {
27
- if (this._comboElement) {
28
- this._comboElement.value = this.value;
49
+ observeValue(newValue, oldValue) {
50
+ if (this._textInput && newValue != oldValue) {
51
+ try {
52
+ if (newValue === "string") {
53
+ this.setInputValue();
54
+ return;
55
+ }
56
+ const newValueSelected = this.getSelectedOption(newValue);
57
+ const oldValueSelected = this.getSelectedOption(oldValue);
58
+ const currentValue = this.getSelectedOption(this.value);
59
+ if (this.isDifferentValues(currentValue, newValueSelected)) {
60
+ this.value = newValueSelected;
61
+ }
62
+ if (this.isDifferentValues(newValueSelected, oldValueSelected)) {
63
+ this.setInputValue();
64
+ const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
65
+ if (!this._lookupMode) {
66
+ this.ezChange.emit(valueEmitted);
67
+ }
68
+ }
69
+ this.resetOptions();
70
+ }
71
+ finally {
72
+ this._lookupMode = false;
73
+ }
29
74
  }
30
75
  }
76
+ observeOptions(newOptions, oldOptions) {
77
+ if ((newOptions === null || newOptions === void 0 ? void 0 : newOptions.join('')) === (oldOptions === null || oldOptions === void 0 ? void 0 : oldOptions.join('')))
78
+ return;
79
+ this.loadOptions(SearchMode.PRELOAD);
80
+ }
81
+ /*
82
+ * Retorna uma promise com o valor da opção selecionada,
83
+ * que será resolvida quando o backend devolver este dado.
84
+ */
85
+ async getValueAsync() {
86
+ if (!this._showLoading) {
87
+ return new Promise(resolve => resolve(this.value));
88
+ }
89
+ return new Promise(resolve => {
90
+ let id = setInterval(() => {
91
+ if (!this._showLoading) {
92
+ clearInterval(id);
93
+ resolve(this.value);
94
+ }
95
+ }, 100);
96
+ });
97
+ }
31
98
  /**
32
- * Aplica o foco no campo.
33
- */
99
+ * Aplica o foco no campo.
100
+ */
34
101
  async setFocus() {
35
- this._comboElement.setFocus();
102
+ if (this._textInput) {
103
+ this._textInput.setFocus();
104
+ }
36
105
  }
37
106
  /**
38
- * Remove o foco do campo.
39
- */
107
+ * Remove o foco do campo.
108
+ */
40
109
  async setBlur() {
41
- this._comboElement.setBlur();
110
+ if (this._textInput) {
111
+ this._textInput.setBlur();
112
+ }
42
113
  }
43
114
  /**
44
115
  * Retorna se o conteúdo é inválido.
@@ -50,33 +121,542 @@ export class EzSearch {
50
121
  * Limpa o valor do campo de pesquisa
51
122
  */
52
123
  async clearValue() {
124
+ this.clearSearch();
125
+ }
126
+ scrollListener() {
127
+ var _a;
128
+ if (this._floatingID == undefined) {
129
+ return;
130
+ }
131
+ if ((_a = this.listOptionsPosition) === null || _a === void 0 ? void 0 : _a.hardPosition) {
132
+ this.hideOptions();
133
+ }
134
+ else {
135
+ window.requestAnimationFrame(() => {
136
+ this.updateListPosition();
137
+ });
138
+ }
139
+ }
140
+ updateListPosition() {
141
+ let { verticalPosition, horizontalPosition, fromBottom, fromRight, bottomLimit, hardPosition } = this.getListPosition();
142
+ const elementRect = this._listWrapper.getBoundingClientRect();
143
+ const containerRect = this._listContainer.getBoundingClientRect();
144
+ const textInputRect = this._textInput.getBoundingClientRect();
145
+ const limitHeight = bottomLimit || window.innerHeight;
146
+ const neededHeight = containerRect.bottom + elementRect.height;
147
+ if (!fromBottom && (elementRect.top < 0 || neededHeight > limitHeight)) {
148
+ fromBottom = true;
149
+ }
150
+ if (!hardPosition) {
151
+ verticalPosition = verticalPosition || 0;
152
+ horizontalPosition = horizontalPosition || 0;
153
+ if (fromBottom) {
154
+ verticalPosition = window.innerHeight - textInputRect.top + verticalPosition;
155
+ }
156
+ else {
157
+ verticalPosition += containerRect.top;
158
+ }
159
+ if (fromRight) {
160
+ horizontalPosition = window.innerWidth - textInputRect.right + horizontalPosition;
161
+ }
162
+ else {
163
+ horizontalPosition += containerRect.left;
164
+ }
165
+ }
166
+ if (verticalPosition != undefined) {
167
+ this._listWrapper.style[fromBottom ? "bottom" : "top"] = `${verticalPosition}px`;
168
+ this._listWrapper.style[fromBottom ? "top" : "bottom"] = "";
169
+ }
170
+ if (horizontalPosition != undefined) {
171
+ this._listWrapper.style[fromRight ? "right" : "left"] = `${horizontalPosition}px`;
172
+ this._listWrapper.style[fromRight ? "left" : "right"] = "";
173
+ }
174
+ }
175
+ getListPosition() {
176
+ if (this.listOptionsPosition) {
177
+ return this.listOptionsPosition;
178
+ }
179
+ return {
180
+ verticalPosition: (this.errorMessage || !this.canShowError || this.mode === "slim") ? 6 : -13
181
+ };
182
+ }
183
+ isDifferentValues(firstValue, secondValue) {
184
+ return ObjectUtils.objectToString(firstValue || {}) !== ObjectUtils.objectToString(secondValue || {});
185
+ }
186
+ getFormattedText(currentValue) {
187
+ if (currentValue == undefined) {
188
+ return;
189
+ }
190
+ let text = (!this.showSelectedValue || currentValue.value == undefined) ? currentValue.label : `${currentValue.value} - ${currentValue.label}`;
191
+ text = text.replace(new RegExp(this._startHighlightTag, 'g'), '').replace(new RegExp(this._endHighlightTag, 'g'), '');
192
+ return text;
193
+ }
194
+ getText() {
195
+ const currentValue = this.getSelectedOption(this.value);
196
+ const text = this.getFormattedText(currentValue);
197
+ if (text == undefined) {
198
+ return;
199
+ }
200
+ return String(text)
201
+ .replace(/&amp;/g, '&')
202
+ .replace(/&lt;/g, '<')
203
+ .replace(/&gt;/g, '>')
204
+ .replace(/&quot;/g, '"');
205
+ }
206
+ getSelectedOption(value) {
207
+ if (typeof value === "string" || value instanceof String) {
208
+ return this._visibleOptions.find(o => o.value === value);
209
+ }
210
+ if (value) {
211
+ return Object.assign(Object.assign({}, value), { value: this.replaceHighlight(value === null || value === void 0 ? void 0 : value.value), label: this.replaceHighlight(value === null || value === void 0 ? void 0 : value.label) });
212
+ }
213
+ return value;
214
+ }
215
+ updateVisibleOptions() {
216
+ let opts = this._source || [];
217
+ if (this.suppressEmptyOption) {
218
+ this._visibleOptions = opts;
219
+ }
220
+ else {
221
+ this._visibleOptions = [{ value: undefined, label: "" }].concat(opts);
222
+ }
223
+ this._maxWidthValue = this.getMaxWidthValue();
224
+ }
225
+ getMaxWidthValue() {
226
+ var _a;
227
+ const arrValues = [];
228
+ (_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.forEach(opt => {
229
+ const widthValue = this.getWidthValue(opt.value);
230
+ if (!arrValues.includes(widthValue)) {
231
+ arrValues.push(widthValue);
232
+ }
233
+ });
234
+ return arrValues.length > 1 ? Math.max(...arrValues) : 0;
235
+ }
236
+ getWidthValue(value) {
237
+ if (this._itemValueBasis != undefined) {
238
+ const span = this._itemValueBasis;
239
+ if (value != undefined) {
240
+ span.innerHTML = value;
241
+ return span.clientWidth > 0 ? (span.clientWidth + 2) : 0;
242
+ }
243
+ else {
244
+ span.innerHTML = "";
245
+ }
246
+ }
247
+ return 0;
248
+ }
249
+ createOption(detail) {
250
+ let { key, title } = detail;
251
+ const startHighlight = new RegExp(this._startHighlightTag, 'g');
252
+ const endHighlight = new RegExp(this._endHighlightTag, 'g');
253
+ title = StringUtils.decodeHtmlEntities(title);
254
+ const option = {
255
+ value: key === null || key === void 0 ? void 0 : key.replace(startHighlight, '').replace(endHighlight, ''),
256
+ label: title === null || title === void 0 ? void 0 : title.replace(startHighlight, '').replace(endHighlight, '')
257
+ };
258
+ this.selectOption(option);
259
+ }
260
+ buildItem(opt, index) {
261
+ opt.label = opt.label || opt.value;
262
+ const card = {
263
+ key: opt.value,
264
+ title: opt.label,
265
+ details: opt.details
266
+ };
267
+ 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 }));
268
+ }
269
+ showOptions() {
270
+ if (!this.enabled)
271
+ return;
272
+ if (this.isOptionsVisible()) {
273
+ return;
274
+ }
275
+ if (!!this._resizeObserver)
276
+ this._resizeObserver.observe(this._textInput);
277
+ this._floatingID = FloatingManager.float(this._listWrapper, this._listContainer, { autoClose: false, isFixed: true, backClickListener: () => this.hideOptions() });
278
+ this.setFocus();
279
+ window.requestAnimationFrame(() => {
280
+ this.updateListPosition();
281
+ if (!this.listOptionsPosition) {
282
+ this._listWrapper.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
283
+ }
284
+ });
285
+ }
286
+ hideOptions() {
287
+ if (this._floatingID !== undefined) {
288
+ FloatingManager.close(this._floatingID);
289
+ }
290
+ this._floatingID = undefined;
291
+ if (!!this._resizeObserver)
292
+ this._resizeObserver.unobserve(this._textInput);
293
+ }
294
+ isOptionsVisible() {
295
+ return this._floatingID !== undefined && FloatingManager.isFloating(this._floatingID);
296
+ }
297
+ nextOption() {
298
+ if (!this.isOptionsVisible()) {
299
+ return;
300
+ }
301
+ this.showOptions();
302
+ this._preSelection = this._preSelection === undefined ? 0 : Math.min(this._preSelection + 1, this._visibleOptions.length - 1);
303
+ this.scrollToOption(this._visibleOptions[this._preSelection]);
304
+ }
305
+ previousOption() {
306
+ this._preSelection = this._preSelection === undefined ? 0 : Math.max(this._preSelection - 1, 0);
307
+ this.scrollToOption(this._visibleOptions[this._preSelection]);
308
+ }
309
+ scrollToOption(opt) {
310
+ window.requestAnimationFrame(() => {
311
+ const liElem = (opt === null || opt === void 0 ? void 0 : opt.value) ? this._optionsList.querySelector(`div#item_${this.replaceHighlight(opt.value).replace(/[<>\[\]#=]/g, '\\$&').replace(/:/g, '\\:')}`) : undefined;
312
+ if (liElem)
313
+ liElem.scrollIntoView({ behavior: "smooth", block: "nearest" });
314
+ });
315
+ }
316
+ selectCurrentOption() {
317
+ if (this._preSelection !== undefined) {
318
+ this.selectOption(this._visibleOptions[this._preSelection]);
319
+ this._preSelection = undefined;
320
+ }
321
+ else {
322
+ this.controlListWithOnlyOne();
323
+ }
324
+ }
325
+ updateSource(source) {
326
+ this._startLoading = false;
327
+ if (source instanceof Promise) {
328
+ this._showLoading = true;
329
+ source.then(result => {
330
+ this._showLoading = false;
331
+ this.updateSource(result);
332
+ }).catch(() => this._showLoading = false);
333
+ this.updateVisibleOptions();
334
+ }
335
+ else {
336
+ this._showLoading = false;
337
+ if (Array.isArray(source)) {
338
+ this._source = source;
339
+ this.updateVisibleOptions();
340
+ if (this._tabPressed) {
341
+ this._tabPressed = false;
342
+ this.controlEmptySearch();
343
+ }
344
+ }
345
+ else {
346
+ this.selectOption(source);
347
+ }
348
+ }
349
+ }
350
+ clearSource() {
351
+ this._source = [];
352
+ this.updateVisibleOptions();
353
+ }
354
+ replaceHighlight(value) {
355
+ const startHighlight = new RegExp(this._startHighlightTag, 'g');
356
+ const endHighlight = new RegExp(this._endHighlightTag, 'g');
357
+ return (value !== null && value !== void 0 ? value : "").replace(startHighlight, '').replace(endHighlight, '');
358
+ }
359
+ selectOption(newOption) {
53
360
  var _a, _b;
54
- (_b = (_a = this._comboElement) === null || _a === void 0 ? void 0 : _a['clearValue']) === null || _b === void 0 ? void 0 : _b.call(_a);
361
+ const currentValue = this.getSelectedOption(this.value);
362
+ const newOptionsReplaced = Object.assign(Object.assign({}, newOption), { value: this.replaceHighlight(newOption === null || newOption === void 0 ? void 0 : newOption.value), label: this.replaceHighlight(newOption === null || newOption === void 0 ? void 0 : newOption.label) });
363
+ if ((((_a = currentValue === null || currentValue === void 0 ? void 0 : currentValue.value) === null || _a === void 0 ? void 0 : _a.toString()) !== ((_b = newOptionsReplaced === null || newOptionsReplaced === void 0 ? void 0 : newOptionsReplaced.value) === null || _b === void 0 ? void 0 : _b.toString()))
364
+ || (currentValue == undefined && newOptionsReplaced != undefined && "value" in newOptionsReplaced)) {
365
+ const adjustedOpt = !(newOptionsReplaced === null || newOptionsReplaced === void 0 ? void 0 : newOptionsReplaced.value) ? undefined : newOptionsReplaced;
366
+ this.value = adjustedOpt;
367
+ }
368
+ else {
369
+ this.setInputValue();
370
+ this.resetOptions();
371
+ }
372
+ this._visibleOptions = [];
373
+ this.clearSource();
55
374
  }
56
- /*
57
- * Retorna uma promise com o valor da opção selecionada,
58
- * que será resolvida quando o backend devolver este dado.
59
- */
60
- async getValueAsync() {
375
+ loadOptions(mode, argument = "") {
376
+ this._criteria = argument;
377
+ this._startLoading = true;
378
+ if (this.optionLoader) {
379
+ const searchArgument = { mode, argument };
380
+ this.updateSource(this.optionLoader(searchArgument));
381
+ }
382
+ else {
383
+ this.updateSource(this.options);
384
+ }
385
+ }
386
+ cancelPreselection() {
387
+ if (!this._textInput.value && this.value) {
388
+ this.selectOption(undefined);
389
+ }
390
+ else {
391
+ window.setTimeout(() => {
392
+ this.setInputValue();
393
+ }, this._deboucingTime);
394
+ }
395
+ this.resetOptions();
396
+ }
397
+ setInputValue(clearError = true) {
398
+ const textValue = this.getText();
399
+ if ((this._textInput.value || '') !== textValue) {
400
+ this._textInput.value = textValue;
401
+ if (clearError) {
402
+ this.errorMessage = null;
403
+ }
404
+ }
405
+ }
406
+ clearSearch() {
407
+ this.value = null;
408
+ }
409
+ controlListWithOnlyOne() {
410
+ var _a, _b;
411
+ const source = (_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.filter((opt) => opt.label !== "" && opt.value != undefined);
412
+ if ((source === null || source === void 0 ? void 0 : source.length) > 0) {
413
+ const startHighlight = new RegExp(this._startHighlightTag, 'g');
414
+ const endHighlight = new RegExp(this._endHighlightTag, 'g');
415
+ let title = StringUtils.decodeHtmlEntities(source[0].label);
416
+ const option = {
417
+ value: (_b = source[0].value) === null || _b === void 0 ? void 0 : _b.replace(startHighlight, '').replace(endHighlight, ''),
418
+ label: title === null || title === void 0 ? void 0 : title.replace(startHighlight, '').replace(endHighlight, '')
419
+ };
420
+ this.selectOption(option);
421
+ }
422
+ }
423
+ controlEmptySearch() {
424
+ var _a;
425
+ if (!((_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.length)) {
426
+ this.clearSearch();
427
+ ApplicationUtils.info(this._textEmptyList);
428
+ }
429
+ else {
430
+ this.controlListWithOnlyOne();
431
+ }
432
+ }
433
+ validateDescriptionValue() {
434
+ if (StringUtils.isEmpty(this.value)) {
435
+ return;
436
+ }
437
+ let value = this.value;
438
+ if (typeof value === "object") {
439
+ return;
440
+ }
441
+ if (StringUtils.isEmpty(value)) {
442
+ return;
443
+ }
444
+ this.loadDescriptionValue(value);
445
+ }
446
+ async loadDescriptionValue(argument) {
447
+ var _a, _b;
448
+ if (argument == undefined) {
449
+ return;
450
+ }
451
+ if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.length) > 0) {
452
+ this.loadOptionValue(argument);
453
+ return;
454
+ }
455
+ const searchArgument = {
456
+ mode: SearchMode.PREDICTIVE,
457
+ argument
458
+ };
459
+ const source = await ((_b = this.optionLoader) === null || _b === void 0 ? void 0 : _b.call(this, searchArgument));
460
+ if (source == undefined) {
461
+ return;
462
+ }
463
+ if (source instanceof Promise) {
464
+ source.then((result) => {
465
+ this.setDescriptionValue(result);
466
+ });
467
+ }
468
+ else {
469
+ this.setDescriptionValue(source);
470
+ }
471
+ }
472
+ setDescriptionValue(source) {
473
+ const value = (source === null || source === void 0 ? void 0 : source[0]) || source;
474
+ if (value == undefined || !Object.keys(value).length) {
475
+ this.showNoResultMessage();
476
+ return;
477
+ }
478
+ this._lookupMode = true;
479
+ this.value = value ? Object.assign(Object.assign({}, value), { value: this.replaceHighlight(value.value), label: this.replaceHighlight(value.label) }) : value;
480
+ }
481
+ loadOptionValue(argument) {
61
482
  var _a;
62
- return (_a = this._comboElement) === null || _a === void 0 ? void 0 : _a.getValueAsync();
483
+ const source = (_a = this.options) === null || _a === void 0 ? void 0 : _a.find((opt) => opt.value === argument);
484
+ if (source != undefined) {
485
+ this.selectOption(source);
486
+ }
487
+ else {
488
+ this.showNoResultMessage();
489
+ }
490
+ }
491
+ async showNoResultMessage() {
492
+ this.clearSearch();
493
+ ApplicationUtils.info(this._textEmptySearch.replace("{0}", this.getFieldLabel()));
63
494
  }
64
- onComboChange(event) {
65
- event.stopPropagation();
66
- this.value = event.detail;
67
- this.ezChange.emit(event.detail);
68
- if (this.errorMessage !== this._comboElement.errorMessage) {
69
- this.errorMessage = this._comboElement.errorMessage;
495
+ getFieldLabel() {
496
+ var _a;
497
+ return (_a = this.label) === null || _a === void 0 ? void 0 : _a.replace(REQUIRED_INFO, "").toUpperCase();
498
+ }
499
+ resetOptions() {
500
+ this.hideOptions();
501
+ this._criteria = undefined;
502
+ this._preSelection = undefined;
503
+ this.updateVisibleOptions();
504
+ }
505
+ //---------------------------------------------
506
+ // Lifecycle web component
507
+ //---------------------------------------------
508
+ componentWillLoad() {
509
+ if (this.options === undefined) {
510
+ this.options = [];
511
+ const optionsTags = this.el.querySelectorAll("option");
512
+ if (optionsTags) {
513
+ optionsTags.forEach(e => {
514
+ let label = e.innerText;
515
+ let value = e.getAttribute("value");
516
+ let details = e.getAttribute("details");
517
+ if (!value) {
518
+ value = label;
519
+ }
520
+ this.options.push({ label, value, details });
521
+ e.hidden = true;
522
+ });
523
+ }
70
524
  }
525
+ this.updateSource([]);
526
+ }
527
+ componentDidRender() {
528
+ var _a;
529
+ if (this._floatingID === undefined) {
530
+ this._listWrapper.remove();
531
+ }
532
+ (_a = this._optionsList) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".item").forEach((elem) => {
533
+ ElementIDUtils.addIDInfoIfNotExists(elem, "itemSearch");
534
+ });
535
+ this.validateDescriptionValue();
71
536
  }
72
537
  componentDidLoad() {
73
- CSSVarsUtils.applyVarsTextInput(this._elem, this._comboElement);
538
+ CSSVarsUtils.applyVarsTextInput(this.el, this._textInput);
539
+ this.setInputValue(false);
540
+ this._resizeObserver = new ResizeObserver((entries) => {
541
+ window.requestAnimationFrame(() => {
542
+ if (!Array.isArray(entries) || !entries.length)
543
+ return;
544
+ const { clientWidth } = this._listContainer;
545
+ if (clientWidth > 0 && !!this._listWrapper) {
546
+ this._listWrapper.style.width = `${clientWidth}px`;
547
+ }
548
+ });
549
+ });
550
+ }
551
+ //---------------------------------------------
552
+ // Event handlers
553
+ //---------------------------------------------
554
+ handlerIconClick() {
555
+ this.loadOptions(SearchMode.ADVANCED);
556
+ }
557
+ buildNumberArgument(argument) {
558
+ if (this.isTextSearch) {
559
+ return NaN;
560
+ }
561
+ return Number(argument || undefined);
562
+ }
563
+ onTextInputChangeHandler(event) {
564
+ var _a;
565
+ this.clearDeboucingTimeout();
566
+ if (this._startLoading) {
567
+ this._changeDeboucingTimeout = window.setTimeout(() => {
568
+ this.onTextInputChangeHandler(event);
569
+ }, this._deboucingTime);
570
+ return;
571
+ }
572
+ const argument = (_a = event.target.value) === null || _a === void 0 ? void 0 : _a.trim();
573
+ const argumentNumber = this.buildNumberArgument(argument);
574
+ if (!this._criteria) {
575
+ this._textInput.value = event.data || argument;
576
+ }
577
+ this._criteria = argument;
578
+ if (argument) {
579
+ this._showLoading = false;
580
+ this.clearSource();
581
+ if (!isNaN(argumentNumber) || argument.length >= this._limitCharsToSearch) {
582
+ this._showLoading = true;
583
+ this._changeDeboucingTimeout = window.setTimeout(() => {
584
+ this.loadOptions(SearchMode.PREDICTIVE, isNaN(argumentNumber) ? argument : argumentNumber.toString());
585
+ }, this._deboucingTime);
586
+ this.showOptions();
587
+ }
588
+ else {
589
+ this.hideOptions();
590
+ }
591
+ }
592
+ else {
593
+ this.hideOptions();
594
+ this._showLoading = false;
595
+ this.clearSource();
596
+ }
597
+ }
598
+ clearDeboucingTimeout() {
599
+ if (this._changeDeboucingTimeout) {
600
+ window.clearTimeout(this._changeDeboucingTimeout);
601
+ this._changeDeboucingTimeout = null;
602
+ }
603
+ }
604
+ keyDownHandler(event) {
605
+ this._tabPressed = false;
606
+ if (event.ctrlKey) {
607
+ if (event.key === "f" || event.key === "F") {
608
+ this.loadOptions(SearchMode.ADVANCED);
609
+ //ATENÇÃO: Ctrl + F tem ação específica nos browsers
610
+ //nesse caso, como vamos abrir o popup de busca avançada,
611
+ //não é interessante deixar o evento propagar;
612
+ event.stopPropagation();
613
+ event.stopImmediatePropagation();
614
+ event.preventDefault();
615
+ }
616
+ }
617
+ switch (event.key) {
618
+ case "ArrowDown":
619
+ this.nextOption();
620
+ event.stopPropagation();
621
+ break;
622
+ case "ArrowUp":
623
+ this.previousOption();
624
+ event.stopPropagation();
625
+ break;
626
+ case "Enter":
627
+ this.selectCurrentOption();
628
+ break;
629
+ case "Escape":
630
+ this.cancelPreselection();
631
+ break;
632
+ case "Tab":
633
+ this._tabPressed = true;
634
+ this.controlListWithOnlyOne();
635
+ break;
636
+ }
637
+ //ATENÇÃO: Existe a necessidade de propagar o evento de teclado.
638
+ //Por exemplo, quando o usuário dá um Enter, além de selecionar
639
+ //um valor, também significa que a ateração finalizou,
640
+ //e o contexto pode reagir (fechar um popup por exemplo).
641
+ //event.stopPropagation();
642
+ }
643
+ onTextInputFocusOutHandler() {
644
+ if (this.hideErrorOnFocusOut)
645
+ this.cancelPreselection();
646
+ }
647
+ canShowListOptions() {
648
+ return !this._showLoading && this._visibleOptions.length > 0;
74
649
  }
75
650
  render() {
76
- ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
77
- 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 }));
651
+ var _a;
652
+ ElementIDUtils.addIDInfoIfNotExists(this.el, 'input');
653
+ 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)
654
+ ? h("button", { class: "btn btn__close", slot: "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.clearSearch() }, h("ez-icon", { iconName: "close" }))
655
+ : 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
656
+ && this._visibleOptions.length === 0
657
+ && h("div", { class: "message" }, h("span", { class: "message__no-result" }, this._textEmptyList)), this._showLoading
658
+ && 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)))))));
78
659
  }
79
- ;
80
660
  static get is() { return "ez-search"; }
81
661
  static get encapsulation() { return "shadow"; }
82
662
  static get originalStyleUrls() {
@@ -99,8 +679,7 @@ export class EzSearch {
99
679
  "resolved": "IOption | string",
100
680
  "references": {
101
681
  "IOption": {
102
- "location": "import",
103
- "path": "../ez-combo-box/ez-combo-box"
682
+ "location": "local"
104
683
  }
105
684
  }
106
685
  },
@@ -173,8 +752,7 @@ export class EzSearch {
173
752
  "resolved": "(argument: ISearchArgument) => IOption | IOption[] | Promise<IOption[]>",
174
753
  "references": {
175
754
  "ISearchArgument": {
176
- "location": "import",
177
- "path": "../ez-combo-box/ez-combo-box"
755
+ "location": "local"
178
756
  },
179
757
  "Promise": {
180
758
  "location": "global"
@@ -183,8 +761,7 @@ export class EzSearch {
183
761
  "location": "global"
184
762
  },
185
763
  "IOption": {
186
- "location": "import",
187
- "path": "../ez-combo-box/ez-combo-box"
764
+ "location": "local"
188
765
  }
189
766
  }
190
767
  },
@@ -358,9 +935,58 @@ export class EzSearch {
358
935
  "attribute": "ignore-limit-chars-to-search",
359
936
  "reflect": false,
360
937
  "defaultValue": "false"
938
+ },
939
+ "options": {
940
+ "type": "unknown",
941
+ "mutable": true,
942
+ "complexType": {
943
+ "original": "Array<IOption>",
944
+ "resolved": "IOption[]",
945
+ "references": {
946
+ "Array": {
947
+ "location": "global"
948
+ },
949
+ "IOption": {
950
+ "location": "local"
951
+ }
952
+ }
953
+ },
954
+ "required": false,
955
+ "optional": false,
956
+ "docs": {
957
+ "tags": [],
958
+ "text": "Array com as op\u00E7\u00F5es do ez-combo-box. Os elementos devem obedecer\no formato: `{value: string, label: string}`."
959
+ }
960
+ },
961
+ "suppressSearch": {
962
+ "type": "boolean",
963
+ "mutable": false,
964
+ "complexType": {
965
+ "original": "boolean",
966
+ "resolved": "boolean",
967
+ "references": {}
968
+ },
969
+ "required": false,
970
+ "optional": false,
971
+ "docs": {
972
+ "tags": [],
973
+ "text": "Se true desabilita a digita\u00E7\u00E3o dentro do componente."
974
+ },
975
+ "attribute": "suppress-search",
976
+ "reflect": false,
977
+ "defaultValue": "false"
361
978
  }
362
979
  };
363
980
  }
981
+ static get states() {
982
+ return {
983
+ "_preSelection": {},
984
+ "_visibleOptions": {},
985
+ "_startLoading": {},
986
+ "_showLoading": {},
987
+ "_criteria": {}
988
+ };
989
+ }
364
990
  static get events() {
365
991
  return [{
366
992
  "method": "ezChange",
@@ -377,8 +1003,7 @@ export class EzSearch {
377
1003
  "resolved": "IOption",
378
1004
  "references": {
379
1005
  "IOption": {
380
- "location": "import",
381
- "path": "../ez-combo-box/ez-combo-box"
1006
+ "location": "local"
382
1007
  }
383
1008
  }
384
1009
  }
@@ -386,6 +1011,22 @@ export class EzSearch {
386
1011
  }
387
1012
  static get methods() {
388
1013
  return {
1014
+ "getValueAsync": {
1015
+ "complexType": {
1016
+ "signature": "() => Promise<unknown>",
1017
+ "parameters": [],
1018
+ "references": {
1019
+ "Promise": {
1020
+ "location": "global"
1021
+ }
1022
+ },
1023
+ "return": "Promise<unknown>"
1024
+ },
1025
+ "docs": {
1026
+ "text": "",
1027
+ "tags": []
1028
+ }
1029
+ },
389
1030
  "setFocus": {
390
1031
  "complexType": {
391
1032
  "signature": "() => Promise<void>",
@@ -449,26 +1090,10 @@ export class EzSearch {
449
1090
  "text": "Limpa o valor do campo de pesquisa",
450
1091
  "tags": []
451
1092
  }
452
- },
453
- "getValueAsync": {
454
- "complexType": {
455
- "signature": "() => Promise<unknown>",
456
- "parameters": [],
457
- "references": {
458
- "Promise": {
459
- "location": "global"
460
- }
461
- },
462
- "return": "Promise<unknown>"
463
- },
464
- "docs": {
465
- "text": "",
466
- "tags": []
467
- }
468
1093
  }
469
1094
  };
470
1095
  }
471
- static get elementRef() { return "_elem"; }
1096
+ static get elementRef() { return "el"; }
472
1097
  static get watchers() {
473
1098
  return [{
474
1099
  "propName": "errorMessage",
@@ -476,6 +1101,24 @@ export class EzSearch {
476
1101
  }, {
477
1102
  "propName": "value",
478
1103
  "methodName": "observeValue"
1104
+ }, {
1105
+ "propName": "options",
1106
+ "methodName": "observeOptions"
1107
+ }];
1108
+ }
1109
+ static get listeners() {
1110
+ return [{
1111
+ "name": "scroll",
1112
+ "method": "scrollListener",
1113
+ "target": "window",
1114
+ "capture": true,
1115
+ "passive": true
479
1116
  }];
480
1117
  }
481
1118
  }
1119
+ var SearchMode;
1120
+ (function (SearchMode) {
1121
+ SearchMode["ADVANCED"] = "ADVANCED";
1122
+ SearchMode["PRELOAD"] = "PRELOAD";
1123
+ SearchMode["PREDICTIVE"] = "PREDICTIVE";
1124
+ })(SearchMode || (SearchMode = {}));