@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-6165.0 → 0.0.0-bugfix-dev-KB-17130.0

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 (273) hide show
  1. package/README.md +8 -10
  2. package/dist/cjs/{ApplicationUtils-2e444734.js → ApplicationUtils-c9d1205c.js} +56 -6
  3. package/dist/cjs/{RecordValidationProcessor-edd23705.js → RecordValidationProcessor-4c893e04.js} +1 -1
  4. package/dist/cjs/{constants-3a1d64fb.js → constants-2714478b.js} +2 -0
  5. package/dist/cjs/ez-actions-button.cjs.entry.js +56 -28
  6. package/dist/cjs/ez-alert-list.cjs.entry.js +148 -0
  7. package/dist/cjs/ez-alert.cjs.entry.js +1 -1
  8. package/dist/cjs/ez-application.cjs.entry.js +1 -1
  9. package/dist/cjs/ez-badge.cjs.entry.js +1 -1
  10. package/dist/cjs/ez-breadcrumb.cjs.entry.js +1 -1
  11. package/dist/cjs/ez-button.cjs.entry.js +1 -1
  12. package/dist/cjs/ez-calendar.cjs.entry.js +1 -1
  13. package/dist/cjs/ez-card-item_3.cjs.entry.js +182 -0
  14. package/dist/cjs/ez-check.cjs.entry.js +1 -1
  15. package/dist/cjs/ez-chip.cjs.entry.js +1 -1
  16. package/dist/cjs/ez-collapsible-box.cjs.entry.js +3 -4
  17. package/dist/cjs/ez-combo-box.cjs.entry.js +17 -152
  18. package/dist/cjs/ez-date-input.cjs.entry.js +1 -1
  19. package/dist/cjs/ez-date-time-input.cjs.entry.js +1 -1
  20. package/dist/cjs/ez-dialog.cjs.entry.js +31 -5
  21. package/dist/cjs/ez-dropdown.cjs.entry.js +12 -6
  22. package/dist/cjs/ez-file-item.cjs.entry.js +1 -1
  23. package/dist/cjs/ez-form-view.cjs.entry.js +44 -3
  24. package/dist/cjs/ez-form.cjs.entry.js +36 -4
  25. package/dist/cjs/ez-grid.cjs.entry.js +246 -64
  26. package/dist/cjs/ez-guide-navigator.cjs.entry.js +7 -1
  27. package/dist/cjs/ez-icon.cjs.entry.js +2 -2
  28. package/dist/cjs/ez-list.cjs.entry.js +5 -3
  29. package/dist/cjs/ez-loading-bar.cjs.entry.js +1 -1
  30. package/dist/cjs/ez-modal-container.cjs.entry.js +1 -1
  31. package/dist/cjs/ez-modal.cjs.entry.js +2 -2
  32. package/dist/cjs/ez-multi-selection-list.cjs.entry.js +23 -10
  33. package/dist/cjs/ez-number-input.cjs.entry.js +1 -1
  34. package/dist/cjs/ez-popover.cjs.entry.js +1 -1
  35. package/dist/cjs/ez-popup.cjs.entry.js +2 -2
  36. package/dist/cjs/ez-radio-button.cjs.entry.js +1 -1
  37. package/dist/cjs/ez-scroller_3.cjs.entry.js +8 -6
  38. package/dist/cjs/ez-search.cjs.entry.js +615 -32
  39. package/dist/cjs/ez-skeleton.cjs.entry.js +1 -1
  40. package/dist/cjs/ez-split-item.cjs.entry.js +19 -0
  41. package/dist/cjs/ez-split-panel.cjs.entry.js +776 -0
  42. package/dist/cjs/ez-tabselector.cjs.entry.js +1 -1
  43. package/dist/cjs/ez-text-area.cjs.entry.js +1 -1
  44. package/dist/cjs/ez-text-edit.cjs.entry.js +2 -2
  45. package/dist/cjs/ez-text-input.cjs.entry.js +3 -2
  46. package/dist/cjs/ez-time-input.cjs.entry.js +1 -1
  47. package/dist/cjs/ez-toast.cjs.entry.js +1 -1
  48. package/dist/cjs/ez-upload.cjs.entry.js +2 -2
  49. package/dist/cjs/ez-view-stack.cjs.entry.js +1 -1
  50. package/dist/cjs/ezui.cjs.js +2 -2
  51. package/dist/cjs/filter-column.cjs.entry.js +47 -12
  52. package/dist/cjs/{index-1064511f.js → index-a7b0c73d.js} +16 -6
  53. package/dist/cjs/loader.cjs.js +2 -2
  54. package/dist/collection/collection-manifest.json +6 -3
  55. package/dist/collection/components/ez-actions-button/ez-actions-button.css +17 -3
  56. package/dist/collection/components/ez-actions-button/ez-actions-button.js +105 -27
  57. package/dist/collection/components/ez-alert-list/ez-alert-list.css +87 -0
  58. package/dist/collection/components/ez-alert-list/ez-alert-list.js +268 -0
  59. package/dist/collection/components/ez-card-item/ez-card-item.css +17 -0
  60. package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +1 -1
  61. package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.js +0 -1
  62. package/dist/collection/components/ez-combo-box/ez-combo-box.js +71 -169
  63. package/dist/collection/components/ez-dialog/ez-dialog.css +1 -1
  64. package/dist/collection/components/ez-dialog/ez-dialog.js +39 -4
  65. package/dist/collection/components/ez-dropdown/ez-dropdown.css +4 -3
  66. package/dist/collection/components/ez-dropdown/ez-dropdown.js +33 -4
  67. package/dist/collection/components/ez-form/ez-form.js +93 -0
  68. package/dist/collection/components/ez-form-view/ez-form-view.js +23 -0
  69. package/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder.js +4 -1
  70. package/dist/collection/components/ez-form-view/structure/index.js +34 -0
  71. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +21 -9
  72. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +23 -1
  73. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js +1 -1
  74. package/dist/collection/components/ez-grid/controller/ag-grid/components/cellRendererStatus.js +1 -1
  75. package/dist/collection/components/ez-grid/ez-grid.css +1 -4
  76. package/dist/collection/components/ez-grid/ez-grid.js +91 -51
  77. package/dist/collection/components/ez-grid/interfaces/IColumnFilter.js +1 -0
  78. package/dist/collection/components/ez-grid/interfaces/index.js +1 -0
  79. package/dist/collection/components/ez-grid/subcomponents/filter-column.js +66 -12
  80. package/dist/collection/components/ez-grid/utils/ColumnFilterManager.js +62 -0
  81. package/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource.js +94 -0
  82. package/dist/collection/components/ez-grid/utils/index.js +1 -0
  83. package/dist/collection/components/ez-guide-navigator/ez-guide-navigator.js +22 -0
  84. package/dist/collection/components/ez-icon/ez-icon.css +148 -139
  85. package/dist/collection/components/ez-list/ez-list.css +12 -7
  86. package/dist/collection/components/ez-list/ez-list.js +3 -1
  87. package/dist/collection/components/ez-modal/ez-modal.css +1 -1
  88. package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +41 -10
  89. package/dist/collection/components/ez-popup/ez-popup.css +2 -2
  90. package/dist/collection/components/ez-search/ez-search.css +330 -0
  91. package/dist/collection/components/ez-search/ez-search.js +746 -55
  92. package/dist/collection/components/ez-split-panel/ez-split-panel.css +8 -0
  93. package/dist/collection/components/ez-split-panel/ez-split-panel.js +122 -0
  94. package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.css +12 -0
  95. package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.js +17 -0
  96. package/dist/collection/components/ez-text-input/ez-text-input.js +20 -1
  97. package/dist/collection/components/ez-tree/ez-tree.css +33 -0
  98. package/dist/collection/components/ez-tree/subcomponents/TreeItem.js +3 -3
  99. package/dist/collection/utils/ApplicationUtils.js +56 -6
  100. package/dist/collection/utils/constants.js +1 -0
  101. package/dist/collection/utils/form/DataBinder.js +12 -1
  102. package/dist/collection/utils/interfaces/IAction.js +1 -0
  103. package/dist/custom-elements/index.d.ts +18 -0
  104. package/dist/custom-elements/index.js +2138 -339
  105. package/dist/esm/{ApplicationUtils-d9a34a16.js → ApplicationUtils-eaf91331.js} +56 -6
  106. package/dist/esm/{RecordValidationProcessor-abc814af.js → RecordValidationProcessor-b00b8b77.js} +1 -1
  107. package/dist/esm/constants-4e0d35b7.js +5 -0
  108. package/dist/esm/ez-actions-button.entry.js +56 -28
  109. package/dist/esm/ez-alert-list.entry.js +144 -0
  110. package/dist/esm/ez-alert.entry.js +1 -1
  111. package/dist/esm/ez-application.entry.js +1 -1
  112. package/dist/esm/ez-badge.entry.js +1 -1
  113. package/dist/esm/ez-breadcrumb.entry.js +1 -1
  114. package/dist/esm/ez-button.entry.js +1 -1
  115. package/dist/esm/ez-calendar.entry.js +1 -1
  116. package/dist/esm/ez-card-item_3.entry.js +176 -0
  117. package/dist/esm/ez-check.entry.js +1 -1
  118. package/dist/esm/ez-chip.entry.js +1 -1
  119. package/dist/esm/ez-collapsible-box.entry.js +3 -4
  120. package/dist/esm/ez-combo-box.entry.js +18 -153
  121. package/dist/esm/ez-date-input.entry.js +1 -1
  122. package/dist/esm/ez-date-time-input.entry.js +1 -1
  123. package/dist/esm/ez-dialog.entry.js +31 -5
  124. package/dist/esm/ez-dropdown.entry.js +12 -6
  125. package/dist/esm/ez-file-item.entry.js +1 -1
  126. package/dist/esm/ez-form-view.entry.js +44 -3
  127. package/dist/esm/ez-form.entry.js +36 -4
  128. package/dist/esm/ez-grid.entry.js +247 -65
  129. package/dist/esm/ez-guide-navigator.entry.js +7 -1
  130. package/dist/esm/ez-icon.entry.js +2 -2
  131. package/dist/esm/ez-list.entry.js +5 -3
  132. package/dist/esm/ez-loading-bar.entry.js +1 -1
  133. package/dist/esm/ez-modal-container.entry.js +1 -1
  134. package/dist/esm/ez-modal.entry.js +2 -2
  135. package/dist/esm/ez-multi-selection-list.entry.js +23 -10
  136. package/dist/esm/ez-number-input.entry.js +1 -1
  137. package/dist/esm/ez-popover.entry.js +1 -1
  138. package/dist/esm/ez-popup.entry.js +2 -2
  139. package/dist/esm/ez-radio-button.entry.js +1 -1
  140. package/dist/esm/ez-scroller_3.entry.js +8 -6
  141. package/dist/esm/ez-search.entry.js +616 -33
  142. package/dist/esm/ez-skeleton.entry.js +1 -1
  143. package/dist/esm/ez-split-item.entry.js +15 -0
  144. package/dist/esm/ez-split-panel.entry.js +772 -0
  145. package/dist/esm/ez-tabselector.entry.js +1 -1
  146. package/dist/esm/ez-text-area.entry.js +1 -1
  147. package/dist/esm/ez-text-edit.entry.js +2 -2
  148. package/dist/esm/ez-text-input.entry.js +3 -2
  149. package/dist/esm/ez-time-input.entry.js +1 -1
  150. package/dist/esm/ez-toast.entry.js +1 -1
  151. package/dist/esm/ez-upload.entry.js +2 -2
  152. package/dist/esm/ez-view-stack.entry.js +1 -1
  153. package/dist/esm/ezui.js +3 -3
  154. package/dist/esm/filter-column.entry.js +47 -12
  155. package/dist/esm/{index-296b8458.js → index-baa5e267.js} +16 -6
  156. package/dist/esm/loader.js +3 -3
  157. package/dist/ezui/ezui.esm.js +1 -1
  158. package/dist/ezui/{p-5cef0264.entry.js → p-0306dff7.entry.js} +1 -1
  159. package/dist/ezui/p-0447d17c.entry.js +1 -0
  160. package/dist/ezui/{p-86a2036d.js → p-04f24913.js} +1 -1
  161. package/dist/ezui/p-05e1f4e7.js +1 -0
  162. package/dist/ezui/p-072e6347.entry.js +1 -0
  163. package/dist/ezui/p-133fae4a.entry.js +1 -0
  164. package/dist/ezui/{p-f4208819.entry.js → p-17be134a.entry.js} +1 -1
  165. package/dist/ezui/{p-cd19a6f8.entry.js → p-1e7a8633.entry.js} +1 -1
  166. package/dist/ezui/{p-60ba28ea.entry.js → p-1f50fa05.entry.js} +1 -1
  167. package/dist/ezui/{p-a5e09759.entry.js → p-20ec22c0.entry.js} +1 -1
  168. package/dist/ezui/p-2187f86c.js +1 -0
  169. package/dist/ezui/{p-e318d280.js → p-23a36bb6.js} +1 -1
  170. package/dist/ezui/{p-ce035beb.entry.js → p-24d3fede.entry.js} +1 -1
  171. package/dist/ezui/p-2a1a0e04.entry.js +1 -0
  172. package/dist/ezui/p-40f72de4.entry.js +1 -0
  173. package/dist/ezui/p-43b03119.entry.js +1 -0
  174. package/dist/ezui/{p-9b347f04.entry.js → p-44caad9a.entry.js} +1 -1
  175. package/dist/ezui/p-49456b34.entry.js +1 -0
  176. package/dist/ezui/p-4a7f113d.entry.js +1 -0
  177. package/dist/ezui/p-51c5e071.entry.js +1 -0
  178. package/dist/ezui/{p-ccb4ccd9.entry.js → p-555c9018.entry.js} +1 -1
  179. package/dist/ezui/{p-d43b22f3.entry.js → p-596634e9.entry.js} +1 -1
  180. package/dist/ezui/p-5bd5e68f.entry.js +1 -0
  181. package/dist/ezui/{p-a01068e1.entry.js → p-5d692ed1.entry.js} +1 -1
  182. package/dist/ezui/{p-95426f93.entry.js → p-5d86cca9.entry.js} +1 -1
  183. package/dist/ezui/p-5e1d036e.entry.js +1 -0
  184. package/dist/ezui/{p-7525e604.entry.js → p-5ed81457.entry.js} +1 -1
  185. package/dist/ezui/{p-c49dbf23.entry.js → p-650e4b6d.entry.js} +1 -1
  186. package/dist/ezui/{p-fd54b5b4.entry.js → p-6e2f8e6b.entry.js} +2 -2
  187. package/dist/ezui/p-6e429cff.entry.js +1 -0
  188. package/dist/ezui/p-76ba9d67.entry.js +1 -0
  189. package/dist/ezui/{p-37673563.entry.js → p-77a4bd35.entry.js} +1 -1
  190. package/dist/ezui/p-796c1a88.entry.js +1 -0
  191. package/dist/ezui/{p-5d6f2550.entry.js → p-85c8baae.entry.js} +1 -1
  192. package/dist/ezui/{p-fa571a4e.entry.js → p-8becebf8.entry.js} +1 -1
  193. package/dist/ezui/p-8defa6d3.entry.js +1 -0
  194. package/dist/ezui/{p-391de0e4.entry.js → p-9050d2cd.entry.js} +1 -1
  195. package/dist/ezui/{p-028f264f.entry.js → p-9cad9b6e.entry.js} +1 -1
  196. package/dist/ezui/{p-b11f035c.entry.js → p-9f5fa3f9.entry.js} +1 -1
  197. package/dist/ezui/p-a08b309b.entry.js +1 -0
  198. package/dist/ezui/{p-2da09f70.entry.js → p-a80b1287.entry.js} +1 -1
  199. package/dist/ezui/p-af15c277.entry.js +1 -0
  200. package/dist/ezui/{p-32b4163f.entry.js → p-b041333c.entry.js} +1 -1
  201. package/dist/ezui/p-ba875f37.entry.js +1 -0
  202. package/dist/ezui/p-bc2f844e.entry.js +1 -0
  203. package/dist/ezui/{p-e2dfd935.entry.js → p-c0f1715f.entry.js} +1 -1
  204. package/dist/ezui/{p-83885b21.entry.js → p-cc2dc4f4.entry.js} +1 -1
  205. package/dist/ezui/p-d6ffe679.entry.js +1 -0
  206. package/dist/ezui/p-eb36f072.entry.js +1 -0
  207. package/dist/ezui/p-f56dd1da.entry.js +1 -0
  208. package/dist/types/components/ez-actions-button/ez-actions-button.d.ts +15 -7
  209. package/dist/types/components/ez-alert-list/ez-alert-list.d.ts +76 -0
  210. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +12 -15
  211. package/dist/types/components/ez-dialog/ez-dialog.d.ts +8 -2
  212. package/dist/types/components/ez-dropdown/ez-dropdown.d.ts +5 -0
  213. package/dist/types/components/ez-form/ez-form.d.ts +19 -1
  214. package/dist/types/components/ez-form-view/ez-form-view.d.ts +5 -0
  215. package/dist/types/components/ez-form-view/structure/index.d.ts +15 -0
  216. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +9 -6
  217. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +2 -3
  218. package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +1 -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 +13 -5
  221. package/dist/types/components/ez-grid/interfaces/IColumnFilter.d.ts +4 -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 +8 -0
  224. package/dist/types/components/ez-grid/utils/ColumnFilterManager.d.ts +9 -0
  225. package/dist/types/components/ez-grid/utils/InMemoryFilterColumnDataSource.d.ts +19 -0
  226. package/dist/types/components/ez-grid/utils/index.d.ts +1 -0
  227. package/dist/types/components/ez-guide-navigator/ez-guide-navigator.d.ts +4 -0
  228. package/dist/types/components/ez-guide-navigator/interfaces/IGuideItem.d.ts +1 -0
  229. package/dist/types/components/ez-multi-selection-list/ez-multi-selection-list.d.ts +4 -0
  230. package/dist/types/components/ez-multi-selection-list/interfaces/IMultiSelectionListDataSource.d.ts +2 -0
  231. package/dist/types/components/ez-search/ez-search.d.ts +112 -10
  232. package/dist/types/components/ez-split-panel/structure/item/ez-split-item.d.ts +3 -0
  233. package/dist/types/components/ez-text-input/ez-text-input.d.ts +4 -0
  234. package/dist/types/components/ez-tree/interfaces/ITreeItem.d.ts +1 -0
  235. package/dist/types/components/ez-tree/subcomponents/TreeItem.d.ts +1 -0
  236. package/dist/types/components.d.ts +236 -17
  237. package/dist/types/utils/ApplicationUtils.d.ts +24 -0
  238. package/dist/types/utils/constants.d.ts +1 -0
  239. package/dist/types/utils/form/DataBinder.d.ts +1 -0
  240. package/dist/types/utils/index.d.ts +1 -0
  241. package/dist/types/utils/interfaces/AbstractFieldMetadata.d.ts +2 -1
  242. package/dist/types/utils/interfaces/IAction.d.ts +7 -0
  243. package/package.json +4 -3
  244. package/react/components.d.ts +3 -0
  245. package/react/components.js +3 -0
  246. package/react/components.js.map +1 -1
  247. package/dist/cjs/ez-card-item.cjs.entry.js +0 -52
  248. package/dist/cjs/ez-filter-input_2.cjs.entry.js +0 -137
  249. package/dist/esm/constants-6dab64f7.js +0 -4
  250. package/dist/esm/ez-card-item.entry.js +0 -48
  251. package/dist/esm/ez-filter-input_2.entry.js +0 -132
  252. package/dist/ezui/p-050247dc.entry.js +0 -1
  253. package/dist/ezui/p-1e7c4986.entry.js +0 -1
  254. package/dist/ezui/p-244dfe8a.entry.js +0 -1
  255. package/dist/ezui/p-27a01a26.js +0 -1
  256. package/dist/ezui/p-2a0e1679.entry.js +0 -1
  257. package/dist/ezui/p-4535da17.entry.js +0 -1
  258. package/dist/ezui/p-4c8b029b.entry.js +0 -1
  259. package/dist/ezui/p-4e31b69b.entry.js +0 -1
  260. package/dist/ezui/p-5495fa45.entry.js +0 -1
  261. package/dist/ezui/p-5ce6548c.entry.js +0 -1
  262. package/dist/ezui/p-68352e41.entry.js +0 -1
  263. package/dist/ezui/p-87e85160.entry.js +0 -1
  264. package/dist/ezui/p-8bd3903b.entry.js +0 -1
  265. package/dist/ezui/p-90fa4cb3.entry.js +0 -1
  266. package/dist/ezui/p-9285b53e.entry.js +0 -1
  267. package/dist/ezui/p-a510a4c5.entry.js +0 -1
  268. package/dist/ezui/p-d51aa09b.entry.js +0 -1
  269. package/dist/ezui/p-db528b31.entry.js +0 -1
  270. package/dist/ezui/p-e67d0bd5.entry.js +0 -1
  271. package/dist/ezui/p-e7fa0ad6.entry.js +0 -1
  272. package/dist/ezui/p-f15ec3bb.js +0 -1
  273. package/dist/ezui/p-ff82b176.entry.js +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');
5
+ const index = require('./index-a7b0c73d.js');
6
6
  const CSSVarsUtils = require('./CSSVarsUtils-b136a156.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);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;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);min-height:var(--ez-search__list-height);gap:var(--space--small, 6px)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-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;
@@ -22,29 +41,86 @@ const EzSearch = class {
22
41
  this.suppressEmptyOption = false;
23
42
  this.mode = "regular";
24
43
  this.canShowError = true;
44
+ this.hideErrorOnFocusOut = true;
25
45
  this.listOptionsPosition = undefined;
46
+ this.isTextSearch = false;
47
+ this.ignoreLimitCharsToSearch = false;
48
+ this.options = undefined;
49
+ this.suppressSearch = false;
26
50
  }
27
51
  observeErrorMessage() {
28
- if (this._comboElement) {
29
- 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
+ }
30
85
  }
31
86
  }
32
- observeValue() {
33
- if (this._comboElement) {
34
- 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));
35
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
+ });
36
108
  }
37
109
  /**
38
- * Aplica o foco no campo.
39
- */
110
+ * Aplica o foco no campo.
111
+ */
40
112
  async setFocus() {
41
- this._comboElement.setFocus();
113
+ if (this._textInput) {
114
+ this._textInput.setFocus();
115
+ }
42
116
  }
43
117
  /**
44
- * Remove o foco do campo.
45
- */
118
+ * Remove o foco do campo.
119
+ */
46
120
  async setBlur() {
47
- this._comboElement.setBlur();
121
+ if (this._textInput) {
122
+ this._textInput.setBlur();
123
+ }
48
124
  }
49
125
  /**
50
126
  * Retorna se o conteúdo é inválido.
@@ -56,39 +132,546 @@ const EzSearch = class {
56
132
  * Limpa o valor do campo de pesquisa
57
133
  */
58
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
+ if (!this.showSelectedValue || currentValue.value == undefined) {
202
+ return currentValue.label;
203
+ }
204
+ return currentValue.label ? `${currentValue.value} - ${currentValue.label}` : currentValue.value;
205
+ }
206
+ getText() {
207
+ const currentValue = this.getSelectedOption(this.value);
208
+ const text = this.getFormattedText(currentValue);
209
+ if (text == undefined) {
210
+ return;
211
+ }
212
+ return String(text)
213
+ .replace(/&amp;/g, '&')
214
+ .replace(/&lt;/g, '<')
215
+ .replace(/&gt;/g, '>')
216
+ .replace(/&quot;/g, '"');
217
+ }
218
+ getSelectedOption(value) {
219
+ if (typeof value === "string" || value instanceof String) {
220
+ return this._visibleOptions.find(o => o.value === value);
221
+ }
222
+ return value;
223
+ }
224
+ updateVisibleOptions() {
225
+ let opts = this._source || [];
226
+ if (this.suppressEmptyOption) {
227
+ this._visibleOptions = opts;
228
+ }
229
+ else {
230
+ this._visibleOptions = [{ value: undefined, label: "" }].concat(opts);
231
+ }
232
+ this._maxWidthValue = this.getMaxWidthValue();
233
+ }
234
+ getMaxWidthValue() {
235
+ var _a;
236
+ const arrValues = [];
237
+ (_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.forEach(opt => {
238
+ const widthValue = this.getWidthValue(opt.value);
239
+ if (!arrValues.includes(widthValue)) {
240
+ arrValues.push(widthValue);
241
+ }
242
+ });
243
+ return arrValues.length > 1 ? Math.max(...arrValues) : 0;
244
+ }
245
+ getWidthValue(value) {
246
+ if (this._itemValueBasis != undefined) {
247
+ const span = this._itemValueBasis;
248
+ if (value != undefined) {
249
+ span.innerHTML = value;
250
+ return span.clientWidth > 0 ? (span.clientWidth + 2) : 0;
251
+ }
252
+ else {
253
+ span.innerHTML = "";
254
+ }
255
+ }
256
+ return 0;
257
+ }
258
+ createOption(detail) {
259
+ let { key, title } = detail;
260
+ const startHighlight = new RegExp(this._startHighlightTag, 'g');
261
+ const endHighlight = new RegExp(this._endHighlightTag, 'g');
262
+ title = core.StringUtils.decodeHtmlEntities(title);
263
+ const option = {
264
+ value: key === null || key === void 0 ? void 0 : key.replace(startHighlight, '').replace(endHighlight, ''),
265
+ label: title === null || title === void 0 ? void 0 : title.replace(startHighlight, '').replace(endHighlight, '')
266
+ };
267
+ this.selectOption(option);
268
+ }
269
+ buildItem(opt, index$1) {
270
+ opt.label = opt.label || opt.value;
271
+ const card = {
272
+ key: opt.value,
273
+ title: opt.label,
274
+ details: opt.details
275
+ };
276
+ return index.h("div", { style: { "height": "100%" }, onMouseDown: () => this.createOption(card), onMouseOver: () => this._preSelection = index$1 }, index.h("ez-card-item", { item: card }));
277
+ }
278
+ showOptions() {
279
+ if (!this.enabled)
280
+ return;
281
+ if (this.isOptionsVisible()) {
282
+ return;
283
+ }
284
+ if (!!this._resizeObserver)
285
+ this._resizeObserver.observe(this._textInput);
286
+ this._floatingID = core.FloatingManager.float(this._listWrapper, this._listContainer, { autoClose: false, isFixed: true, backClickListener: () => this.hideOptions() });
287
+ this.setFocus();
288
+ window.requestAnimationFrame(() => {
289
+ this.updateListPosition();
290
+ if (!this.listOptionsPosition) {
291
+ this._listWrapper.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
292
+ }
293
+ });
294
+ }
295
+ hideOptions() {
296
+ if (this._floatingID !== undefined) {
297
+ core.FloatingManager.close(this._floatingID);
298
+ }
299
+ this._floatingID = undefined;
300
+ if (!!this._resizeObserver)
301
+ this._resizeObserver.unobserve(this._textInput);
302
+ }
303
+ isOptionsVisible() {
304
+ return this._floatingID !== undefined && core.FloatingManager.isFloating(this._floatingID);
305
+ }
306
+ nextOption() {
307
+ if (!this.isOptionsVisible()) {
308
+ return;
309
+ }
310
+ this.showOptions();
311
+ this._preSelection = this._preSelection === undefined ? 0 : Math.min(this._preSelection + 1, this._visibleOptions.length - 1);
312
+ this.scrollToOption(this._visibleOptions[this._preSelection]);
313
+ }
314
+ previousOption() {
315
+ this._preSelection = this._preSelection === undefined ? 0 : Math.max(this._preSelection - 1, 0);
316
+ this.scrollToOption(this._visibleOptions[this._preSelection]);
317
+ }
318
+ scrollToOption(opt) {
319
+ window.requestAnimationFrame(() => {
320
+ const liElem = (opt === null || opt === void 0 ? void 0 : opt.value) ? this._optionsList.querySelector(`li#item_${opt.value.replace(/[<>\[\]#=]/g, '\\$&').replace(/:/g, '\\:')}`) : undefined;
321
+ if (liElem)
322
+ liElem.scrollIntoView({ behavior: "smooth", block: "nearest" });
323
+ });
324
+ }
325
+ selectCurrentOption() {
326
+ if (this._preSelection !== undefined) {
327
+ this.selectOption(this._visibleOptions[this._preSelection]);
328
+ this._preSelection = undefined;
329
+ }
330
+ else {
331
+ this.controlListWithOnlyOne();
332
+ }
333
+ }
334
+ updateSource(source) {
335
+ this._startLoading = false;
336
+ if (source instanceof Promise) {
337
+ this._showLoading = true;
338
+ source.then(result => {
339
+ this._showLoading = false;
340
+ this.updateSource(result);
341
+ }).catch(() => this._showLoading = false);
342
+ this.updateVisibleOptions();
343
+ }
344
+ else {
345
+ this._showLoading = false;
346
+ if (Array.isArray(source)) {
347
+ this._source = source;
348
+ this.updateVisibleOptions();
349
+ if (this._tabPressed) {
350
+ this._tabPressed = false;
351
+ this.controlEmptySearch();
352
+ }
353
+ }
354
+ else {
355
+ this.selectOption(source);
356
+ }
357
+ }
358
+ }
359
+ clearSource() {
360
+ this._source = [];
361
+ this.updateVisibleOptions();
362
+ }
363
+ selectOption(newOption) {
59
364
  var _a, _b;
60
- (_b = (_a = this._comboElement) === null || _a === void 0 ? void 0 : _a['clearValue']) === null || _b === void 0 ? void 0 : _b.call(_a);
365
+ const currentValue = this.getSelectedOption(this.value);
366
+ if ((((_a = currentValue === null || currentValue === void 0 ? void 0 : currentValue.value) === null || _a === void 0 ? void 0 : _a.toString()) !== ((_b = newOption === null || newOption === void 0 ? void 0 : newOption.value) === null || _b === void 0 ? void 0 : _b.toString()))
367
+ || (currentValue == undefined && newOption != undefined && "value" in newOption)) {
368
+ const adjustedOpt = !(newOption === null || newOption === void 0 ? void 0 : newOption.value) ? undefined : newOption;
369
+ this.value = adjustedOpt;
370
+ }
371
+ else {
372
+ this.resetOptions();
373
+ }
374
+ this._visibleOptions = [];
375
+ this.clearSource();
61
376
  }
62
- /*
63
- * Retorna uma promise com o valor da opção selecionada,
64
- * que será resolvida quando o backend devolver este dado.
65
- */
66
- async getValueAsync() {
377
+ loadOptions(mode, argument = "") {
378
+ this._criteria = argument;
379
+ this._startLoading = true;
380
+ if (this.optionLoader) {
381
+ const searchArgument = { mode, argument };
382
+ this.updateSource(this.optionLoader(searchArgument));
383
+ }
384
+ else {
385
+ this.updateSource(this.options);
386
+ }
387
+ }
388
+ cancelPreselection() {
389
+ if (!this._textInput.value && this.value) {
390
+ this.selectOption(undefined);
391
+ }
392
+ else {
393
+ window.setTimeout(() => {
394
+ this.setInputValue();
395
+ }, this._deboucingTime);
396
+ }
397
+ this.resetOptions();
398
+ }
399
+ setInputValue(clearError = true) {
400
+ const textValue = this.getText();
401
+ if ((this._textInput.value || '') !== textValue) {
402
+ this._textInput.value = textValue;
403
+ if (clearError) {
404
+ this.errorMessage = null;
405
+ }
406
+ }
407
+ }
408
+ clearSearch() {
409
+ this.value = null;
410
+ }
411
+ controlListWithOnlyOne() {
412
+ var _a, _b;
413
+ const source = (_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.filter((opt) => opt.label !== "" && opt.value != undefined);
414
+ if ((source === null || source === void 0 ? void 0 : source.length) > 0) {
415
+ const startHighlight = new RegExp(this._startHighlightTag, 'g');
416
+ const endHighlight = new RegExp(this._endHighlightTag, 'g');
417
+ let title = core.StringUtils.decodeHtmlEntities(source[0].label);
418
+ const option = {
419
+ value: (_b = source[0].value) === null || _b === void 0 ? void 0 : _b.replace(startHighlight, '').replace(endHighlight, ''),
420
+ label: title === null || title === void 0 ? void 0 : title.replace(startHighlight, '').replace(endHighlight, '')
421
+ };
422
+ this.selectOption(option);
423
+ }
424
+ }
425
+ controlEmptySearch() {
426
+ var _a;
427
+ if (!((_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.length)) {
428
+ this.clearSearch();
429
+ ApplicationUtils.ApplicationUtils.info(this._textEmptyList);
430
+ }
431
+ else {
432
+ this.controlListWithOnlyOne();
433
+ }
434
+ }
435
+ validateDescriptionValue() {
436
+ if (core.StringUtils.isEmpty(this.value)) {
437
+ return;
438
+ }
439
+ let value = this.value;
440
+ if (typeof value === "object") {
441
+ return;
442
+ }
443
+ if (core.StringUtils.isEmpty(value)) {
444
+ return;
445
+ }
446
+ this.loadDescriptionValue(value);
447
+ }
448
+ async loadDescriptionValue(argument) {
449
+ var _a, _b;
450
+ if (argument == undefined) {
451
+ return;
452
+ }
453
+ if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.length) > 0) {
454
+ this.loadOptionValue(argument);
455
+ return;
456
+ }
457
+ const searchArgument = {
458
+ mode: SearchMode.PREDICTIVE,
459
+ argument
460
+ };
461
+ const source = await ((_b = this.optionLoader) === null || _b === void 0 ? void 0 : _b.call(this, searchArgument));
462
+ if (source == undefined) {
463
+ return;
464
+ }
465
+ if (source instanceof Promise) {
466
+ source.then((result) => {
467
+ this.setDescriptionValue(result);
468
+ });
469
+ }
470
+ else {
471
+ this.setDescriptionValue(source);
472
+ }
473
+ }
474
+ setDescriptionValue(source) {
475
+ const value = (source === null || source === void 0 ? void 0 : source[0]) || source;
476
+ if (value == undefined || !Object.keys(value).length) {
477
+ this.showNoResultMessage();
478
+ return;
479
+ }
480
+ this._lookupMode = true;
481
+ this.value = value;
482
+ }
483
+ loadOptionValue(argument) {
67
484
  var _a;
68
- return (_a = this._comboElement) === null || _a === void 0 ? void 0 : _a.getValueAsync();
485
+ const source = (_a = this.options) === null || _a === void 0 ? void 0 : _a.find((opt) => opt.value === argument);
486
+ if (source != undefined) {
487
+ this.selectOption(source);
488
+ }
489
+ else {
490
+ this.showNoResultMessage();
491
+ }
69
492
  }
70
- onComboChange(event) {
71
- event.stopPropagation();
72
- this.value = event.detail;
73
- this.ezChange.emit(event.detail);
74
- if (this.errorMessage !== this._comboElement.errorMessage) {
75
- this.errorMessage = this._comboElement.errorMessage;
493
+ async showNoResultMessage() {
494
+ this.clearSearch();
495
+ ApplicationUtils.ApplicationUtils.info(this._textEmptySearch.replace("{0}", this.getFieldLabel()));
496
+ }
497
+ getFieldLabel() {
498
+ var _a;
499
+ return (_a = this.label) === null || _a === void 0 ? void 0 : _a.replace(constants.REQUIRED_INFO, "").toUpperCase();
500
+ }
501
+ resetOptions() {
502
+ this.hideOptions();
503
+ this._criteria = undefined;
504
+ this._preSelection = undefined;
505
+ this.updateVisibleOptions();
506
+ }
507
+ //---------------------------------------------
508
+ // Lifecycle web component
509
+ //---------------------------------------------
510
+ componentWillLoad() {
511
+ if (this.options === undefined) {
512
+ this.options = [];
513
+ const optionsTags = this.el.querySelectorAll("option");
514
+ if (optionsTags) {
515
+ optionsTags.forEach(e => {
516
+ let label = e.innerText;
517
+ let value = e.getAttribute("value");
518
+ let details = e.getAttribute("details");
519
+ if (!value) {
520
+ value = label;
521
+ }
522
+ this.options.push({ label, value, details });
523
+ e.hidden = true;
524
+ });
525
+ }
76
526
  }
527
+ this.updateSource([]);
528
+ }
529
+ componentDidRender() {
530
+ var _a;
531
+ if (this._floatingID === undefined) {
532
+ this._listWrapper.remove();
533
+ }
534
+ (_a = this._optionsList) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".item").forEach((elem) => {
535
+ core.ElementIDUtils.addIDInfoIfNotExists(elem, "itemSearch");
536
+ });
537
+ this.validateDescriptionValue();
77
538
  }
78
539
  componentDidLoad() {
79
- CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this._elem, this._comboElement);
540
+ CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this.el, this._textInput);
541
+ this.setInputValue(false);
542
+ this._resizeObserver = new ResizeObserver((entries) => {
543
+ window.requestAnimationFrame(() => {
544
+ if (!Array.isArray(entries) || !entries.length)
545
+ return;
546
+ const { clientWidth } = this._listContainer;
547
+ if (clientWidth > 0 && !!this._listWrapper) {
548
+ this._listWrapper.style.width = `${clientWidth}px`;
549
+ }
550
+ });
551
+ });
552
+ }
553
+ //---------------------------------------------
554
+ // Event handlers
555
+ //---------------------------------------------
556
+ handlerIconClick() {
557
+ this.loadOptions(SearchMode.ADVANCED);
558
+ }
559
+ buildNumberArgument(argument) {
560
+ if (this.isTextSearch) {
561
+ return NaN;
562
+ }
563
+ return Number(argument || undefined);
564
+ }
565
+ onTextInputChangeHandler(event) {
566
+ var _a;
567
+ this.clearDeboucingTimeout();
568
+ if (this._startLoading) {
569
+ this._changeDeboucingTimeout = window.setTimeout(() => {
570
+ this.onTextInputChangeHandler(event);
571
+ }, this._deboucingTime);
572
+ return;
573
+ }
574
+ const argument = (_a = event.target.value) === null || _a === void 0 ? void 0 : _a.trim();
575
+ const argumentNumber = this.buildNumberArgument(argument);
576
+ if (!this._criteria) {
577
+ this._textInput.value = event.data || argument;
578
+ }
579
+ this._criteria = argument;
580
+ if (argument) {
581
+ this._showLoading = false;
582
+ this.clearSource();
583
+ if (!isNaN(argumentNumber) || argument.length >= this._limitCharsToSearch) {
584
+ this._showLoading = true;
585
+ this._changeDeboucingTimeout = window.setTimeout(() => {
586
+ this.loadOptions(SearchMode.PREDICTIVE, isNaN(argumentNumber) ? argument : argumentNumber.toString());
587
+ }, this._deboucingTime);
588
+ this.showOptions();
589
+ }
590
+ else {
591
+ this.hideOptions();
592
+ }
593
+ }
594
+ else {
595
+ this.hideOptions();
596
+ this._showLoading = false;
597
+ this.clearSource();
598
+ }
599
+ }
600
+ clearDeboucingTimeout() {
601
+ if (this._changeDeboucingTimeout) {
602
+ window.clearTimeout(this._changeDeboucingTimeout);
603
+ this._changeDeboucingTimeout = null;
604
+ }
605
+ }
606
+ keyDownHandler(event) {
607
+ this._tabPressed = false;
608
+ if (event.ctrlKey) {
609
+ if (event.key === "f" || event.key === "F") {
610
+ this.loadOptions(SearchMode.ADVANCED);
611
+ //ATENÇÃO: Ctrl + F tem ação específica nos browsers
612
+ //nesse caso, como vamos abrir o popup de busca avançada,
613
+ //não é interessante deixar o evento propagar;
614
+ event.stopPropagation();
615
+ event.stopImmediatePropagation();
616
+ event.preventDefault();
617
+ }
618
+ }
619
+ switch (event.key) {
620
+ case "ArrowDown":
621
+ this.nextOption();
622
+ event.stopPropagation();
623
+ break;
624
+ case "ArrowUp":
625
+ this.previousOption();
626
+ event.stopPropagation();
627
+ break;
628
+ case "Enter":
629
+ this.selectCurrentOption();
630
+ break;
631
+ case "Escape":
632
+ this.cancelPreselection();
633
+ break;
634
+ case "Tab":
635
+ this._tabPressed = true;
636
+ this.controlListWithOnlyOne();
637
+ break;
638
+ }
639
+ //ATENÇÃO: Existe a necessidade de propagar o evento de teclado.
640
+ //Por exemplo, quando o usuário dá um Enter, além de selecionar
641
+ //um valor, também significa que a ateração finalizou,
642
+ //e o contexto pode reagir (fechar um popup por exemplo).
643
+ //event.stopPropagation();
644
+ }
645
+ onTextInputFocusOutHandler() {
646
+ if (this.hideErrorOnFocusOut)
647
+ this.cancelPreselection();
648
+ }
649
+ canShowListOptions() {
650
+ return !this._showLoading && this._visibleOptions.length > 0;
80
651
  }
81
652
  render() {
82
- core.ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
83
- 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, 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 }));
653
+ var _a;
654
+ core.ElementIDUtils.addIDInfoIfNotExists(this.el, 'input');
655
+ 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)
656
+ ? index.h("button", { class: "btn btn__close", slot: "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.clearSearch() }, index.h("ez-icon", { iconName: "close" }))
657
+ : 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
658
+ && this._visibleOptions.length === 0
659
+ && index.h("div", { class: "message" }, index.h("span", { class: "message__no-result" }, this._textEmptyList)), this._showLoading
660
+ && 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)))))));
84
661
  }
85
- ;
86
- get _elem() { return index.getElement(this); }
662
+ get el() { return index.getElement(this); }
87
663
  static get watchers() { return {
88
664
  "errorMessage": ["observeErrorMessage"],
89
- "value": ["observeValue"]
665
+ "value": ["observeValue"],
666
+ "options": ["observeOptions"]
90
667
  }; }
91
668
  };
669
+ var SearchMode;
670
+ (function (SearchMode) {
671
+ SearchMode["ADVANCED"] = "ADVANCED";
672
+ SearchMode["PRELOAD"] = "PRELOAD";
673
+ SearchMode["PREDICTIVE"] = "PREDICTIVE";
674
+ })(SearchMode || (SearchMode = {}));
92
675
  EzSearch.style = ezSearchCss;
93
676
 
94
677
  exports.ez_search = EzSearch;