@sankhyalabs/ezui 5.20.2 → 5.21.0-dev.1

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