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