@sankhyalabs/ezui 5.20.4 → 5.21.0-dev.10

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