bromcom-ui 2.9.0-rc.4 → 2.9.0-rc.6

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 (272) hide show
  1. package/dist/bromcom-ui/bromcom-ui.css +1 -1
  2. package/dist/bromcom-ui/bromcom-ui.esm.js +1 -1
  3. package/dist/bromcom-ui/{p-cb344455.entry.js → p-0641597e.entry.js} +1 -1
  4. package/dist/bromcom-ui/{p-8c9d109c.entry.js → p-15758356.entry.js} +1 -1
  5. package/dist/bromcom-ui/{p-fc07ca8a.entry.js → p-16dd7db9.entry.js} +1 -1
  6. package/dist/bromcom-ui/p-17264523.js +5 -0
  7. package/dist/bromcom-ui/p-17af6738.js +5 -0
  8. package/dist/bromcom-ui/{p-00d7bbed.js → p-184b7d3b.js} +1 -1
  9. package/dist/bromcom-ui/{p-5648b456.entry.js → p-1b1f4b44.entry.js} +1 -1
  10. package/dist/bromcom-ui/p-1eabd5dc.js +10 -0
  11. package/dist/bromcom-ui/{p-224d392c.entry.js → p-1fbd8af5.entry.js} +1 -1
  12. package/dist/bromcom-ui/{p-3adc157d.entry.js → p-24b8154c.entry.js} +1 -1
  13. package/dist/bromcom-ui/{p-6478455c.entry.js → p-24d8e9d6.entry.js} +1 -1
  14. package/dist/bromcom-ui/{p-8ae4bdb2.entry.js → p-2afdec61.entry.js} +1 -1
  15. package/dist/bromcom-ui/{p-50c3df61.js → p-2b13dd48.js} +1 -1
  16. package/dist/bromcom-ui/p-2b88c7bb.entry.js +5 -0
  17. package/dist/bromcom-ui/p-2fc584c4.js +5 -0
  18. package/dist/bromcom-ui/{p-f48e5337.entry.js → p-31eabaf3.entry.js} +1 -1
  19. package/dist/bromcom-ui/{p-6a087ad5.js → p-3215d598.js} +1 -1
  20. package/dist/bromcom-ui/{p-15347028.entry.js → p-3baf677c.entry.js} +1 -1
  21. package/dist/bromcom-ui/{p-8c018ae0.js → p-3c7a0345.js} +1 -1
  22. package/dist/bromcom-ui/p-459212eb.entry.js +5 -0
  23. package/dist/bromcom-ui/p-57f8802e.entry.js +5 -0
  24. package/dist/bromcom-ui/{p-7e44e6b5.js → p-5ae0a59b.js} +1 -1
  25. package/dist/bromcom-ui/{p-4cd8a7c8.entry.js → p-5c3e9ac9.entry.js} +1 -1
  26. package/dist/bromcom-ui/{p-6cb648f0.entry.js → p-5c468c5b.entry.js} +1 -1
  27. package/dist/bromcom-ui/{p-70aa6e00.entry.js → p-6272ecb4.entry.js} +1 -1
  28. package/dist/bromcom-ui/p-663766cf.entry.js +5 -0
  29. package/dist/bromcom-ui/p-6a5ac874.entry.js +13 -0
  30. package/dist/bromcom-ui/{p-6e9b23ed.entry.js → p-6b861832.entry.js} +1 -1
  31. package/dist/bromcom-ui/{p-30788121.entry.js → p-6c3e9e10.entry.js} +1 -1
  32. package/dist/bromcom-ui/{p-ba47106f.entry.js → p-7a394115.entry.js} +1 -1
  33. package/dist/bromcom-ui/{p-0d6623c0.entry.js → p-81b2dffb.entry.js} +1 -1
  34. package/dist/bromcom-ui/p-891de348.entry.js +5 -0
  35. package/dist/bromcom-ui/{p-1647559e.entry.js → p-8bcfe3b3.entry.js} +1 -1
  36. package/dist/bromcom-ui/{p-fd7243a7.entry.js → p-8d7bbe30.entry.js} +1 -1
  37. package/dist/bromcom-ui/{p-c8695c8b.entry.js → p-8de9d6b6.entry.js} +1 -1
  38. package/dist/bromcom-ui/p-8fc8b4ff.entry.js +5 -0
  39. package/dist/bromcom-ui/{p-20aa2ba8.entry.js → p-9099a1bf.entry.js} +1 -1
  40. package/dist/bromcom-ui/p-9773e744.entry.js +5 -0
  41. package/dist/bromcom-ui/{p-08d4cd65.entry.js → p-a512ca45.entry.js} +1 -1
  42. package/dist/bromcom-ui/{p-18696519.entry.js → p-b10265d7.entry.js} +1 -1
  43. package/dist/bromcom-ui/{p-30a3320f.entry.js → p-b1c83bb8.entry.js} +1 -1
  44. package/dist/bromcom-ui/{p-afb4a0e7.entry.js → p-b26ded9b.entry.js} +1 -1
  45. package/dist/bromcom-ui/{p-159b67a7.entry.js → p-b45b54b5.entry.js} +1 -1
  46. package/dist/bromcom-ui/{p-9fff4f7d.entry.js → p-b47e4417.entry.js} +1 -1
  47. package/dist/bromcom-ui/{p-e12e563a.entry.js → p-c2cbb810.entry.js} +1 -1
  48. package/dist/bromcom-ui/{p-ea23f0aa.entry.js → p-c387f0fb.entry.js} +1 -1
  49. package/dist/bromcom-ui/{p-4ea7331b.entry.js → p-c3a91954.entry.js} +1 -1
  50. package/dist/bromcom-ui/{p-3992dd70.entry.js → p-ca6cd989.entry.js} +1 -1
  51. package/dist/bromcom-ui/p-ccaabc2e.entry.js +5 -0
  52. package/dist/bromcom-ui/p-cf0ab7f0.entry.js +5 -0
  53. package/dist/bromcom-ui/{p-09c4a42a.entry.js → p-d37502f9.entry.js} +1 -1
  54. package/dist/bromcom-ui/p-dbdb10d5.js +5 -0
  55. package/dist/bromcom-ui/p-dd422dd1.js +5 -0
  56. package/dist/bromcom-ui/{p-8d14232d.entry.js → p-dd43bcd9.entry.js} +1 -1
  57. package/dist/bromcom-ui/{p-50066349.entry.js → p-de850d57.entry.js} +1 -1
  58. package/dist/bromcom-ui/{p-28649759.entry.js → p-e0c60c5d.entry.js} +1 -1
  59. package/dist/bromcom-ui/{p-21783e29.entry.js → p-e520d2a2.entry.js} +1 -1
  60. package/dist/bromcom-ui/{p-119fc842.entry.js → p-e86e4968.entry.js} +1 -1
  61. package/dist/bromcom-ui/{p-8ce0f5f8.entry.js → p-eaad2239.entry.js} +1 -1
  62. package/dist/bromcom-ui/{p-dc9466d6.entry.js → p-ebee9f45.entry.js} +1 -1
  63. package/dist/bromcom-ui/{p-b321e86d.entry.js → p-ee4b8753.entry.js} +1 -1
  64. package/dist/bromcom-ui/p-ee50f5e2.entry.js +5 -0
  65. package/dist/bromcom-ui/{p-4e6292fd.entry.js → p-ee5da693.entry.js} +1 -1
  66. package/dist/bromcom-ui/{p-2df6dc86.entry.js → p-f0fa1c29.entry.js} +1 -1
  67. package/dist/bromcom-ui/{p-68abefd2.entry.js → p-f331e009.entry.js} +1 -1
  68. package/dist/bromcom-ui/{p-cf307549.entry.js → p-fe37e88f.entry.js} +1 -1
  69. package/dist/cjs/bcm-accordion.cjs.entry.js +1 -1
  70. package/dist/cjs/bcm-alert.cjs.entry.js +1 -1
  71. package/dist/cjs/bcm-attendance.cjs.entry.js +1 -1
  72. package/dist/cjs/bcm-avatar.cjs.entry.js +126 -0
  73. package/dist/cjs/bcm-badge_15.cjs.entry.js +1738 -0
  74. package/dist/cjs/bcm-breadcrumb.cjs.entry.js +1 -1
  75. package/dist/cjs/bcm-button-group.cjs.entry.js +1 -1
  76. package/dist/cjs/bcm-card.cjs.entry.js +2 -2
  77. package/dist/cjs/bcm-checkbox-group.cjs.entry.js +17 -17
  78. package/dist/cjs/bcm-checkbox-lite_9.cjs.entry.js +1 -1
  79. package/dist/cjs/{bcm-checkbox_2.cjs.entry.js → bcm-checkbox.cjs.entry.js} +2 -13
  80. package/dist/cjs/bcm-chip-group.cjs.entry.js +128 -0
  81. package/dist/cjs/bcm-chip.cjs.entry.js +90 -0
  82. package/dist/cjs/bcm-collapse.cjs.entry.js +1 -1
  83. package/dist/cjs/bcm-color-input.cjs.entry.js +4 -4
  84. package/dist/cjs/{bcm-avatar_15.cjs.entry.js → bcm-colorful.cjs.entry.js} +3 -6332
  85. package/dist/cjs/bcm-date-picker.cjs.entry.js +1 -1
  86. package/dist/cjs/bcm-datetime-picker.cjs.entry.js +1 -1
  87. package/dist/cjs/bcm-default.cjs.entry.js +1 -1
  88. package/dist/cjs/bcm-drawer.cjs.entry.js +4 -4
  89. package/dist/cjs/bcm-expansion-panel.cjs.entry.js +2 -2
  90. package/dist/cjs/bcm-form-2.cjs.entry.js +1 -1
  91. package/dist/cjs/bcm-form.cjs.entry.js +488 -0
  92. package/dist/cjs/bcm-input-custom.cjs.entry.js +1 -1
  93. package/dist/cjs/bcm-input.cjs.entry.js +370 -0
  94. package/dist/cjs/bcm-label.cjs.entry.js +44 -0
  95. package/dist/cjs/bcm-list_3.cjs.entry.js +4025 -0
  96. package/dist/cjs/bcm-modal-2-footer.cjs.entry.js +4 -4
  97. package/dist/cjs/bcm-modal-2-header.cjs.entry.js +4 -4
  98. package/dist/cjs/bcm-modal-2.cjs.entry.js +4 -4
  99. package/dist/cjs/bcm-modal.cjs.entry.js +1 -1
  100. package/dist/cjs/bcm-popconfirm-box.cjs.entry.js +2 -2
  101. package/dist/cjs/bcm-popconfirm.cjs.entry.js +1 -1
  102. package/dist/cjs/bcm-progress.cjs.entry.js +2 -2
  103. package/dist/cjs/bcm-radio-group.cjs.entry.js +4 -4
  104. package/dist/cjs/bcm-radio.cjs.entry.js +4 -4
  105. package/dist/cjs/bcm-range.cjs.entry.js +1 -1
  106. package/dist/cjs/bcm-skeleton.cjs.entry.js +1 -1
  107. package/dist/cjs/bcm-step.cjs.entry.js +2 -2
  108. package/dist/cjs/bcm-stepper.cjs.entry.js +5 -5
  109. package/dist/cjs/bcm-switch.cjs.entry.js +1 -1
  110. package/dist/cjs/bcm-tag.cjs.entry.js +2 -2
  111. package/dist/cjs/bcm-textarea.cjs.entry.js +2 -2
  112. package/dist/cjs/bcm-time-picker.cjs.entry.js +1 -1
  113. package/dist/cjs/bcm-toast.cjs.entry.js +1 -1
  114. package/dist/cjs/bromcom-ui.cjs.js +1 -1
  115. package/dist/cjs/{color-helper-d6d2028b.js → color-helper-7ab15732.js} +27 -1
  116. package/dist/cjs/{generate-d246df02.js → generate-d3f8c970.js} +55 -5
  117. package/dist/cjs/index-906fb4e5.js +540 -0
  118. package/dist/cjs/index-b08b037a.js +52 -0
  119. package/dist/cjs/{input-template-22c31e2b.js → input-template-22725c68.js} +1 -1
  120. package/dist/cjs/{json-parse-decarator-bf157b28.js → json-parse-decarator-22c236ad.js} +1 -1
  121. package/dist/cjs/loader.cjs.js +1 -1
  122. package/dist/cjs/{number-helper-26df0c91.js → number-helper-66fe9479.js} +1 -1
  123. package/dist/cjs/old-bcm-popover-box.cjs.entry.js +2 -2
  124. package/dist/cjs/old-bcm-popover.cjs.entry.js +1 -1
  125. package/dist/cjs/{stepper-states-1a1a63cb.js → stepper-states-43daae37.js} +1 -1
  126. package/dist/cjs/{validators-095e7611.js → validators-aa39e3ec.js} +1 -1
  127. package/dist/collection/components/atoms/avatar/avatar.js +95 -80
  128. package/dist/collection/components/atoms/avatar/avatar.style.js +39 -0
  129. package/dist/collection/components/atoms/badge/badge.js +29 -90
  130. package/dist/collection/components/atoms/badge/badge.style.js +39 -0
  131. package/dist/collection/components/molecules/input/input.js +4 -4
  132. package/dist/collection/components/molecules/items/items.js +1 -1
  133. package/dist/collection/components/molecules/menu/menu.js +1 -0
  134. package/dist/collection/components/molecules/popover/popover.js +1 -1
  135. package/dist/collection/components/molecules/tab-group/tab-group.js +5 -1
  136. package/dist/collection/components/molecules/tab-group/tab-item-header.js +11 -26
  137. package/dist/collection/components/molecules/tooltip/tooltip.js +1 -1
  138. package/dist/collection/components/other/typography/typography.js +1 -1
  139. package/dist/collection/helper/color-helper.js +27 -1
  140. package/dist/collection/helper/generate.js +54 -4
  141. package/dist/collection/helper/popover-helper.js +13 -9
  142. package/dist/collection/helper/tooltip-helper.js +12 -4
  143. package/dist/components/avatar.js +91 -52
  144. package/dist/components/badge.js +109 -46
  145. package/dist/components/bcm-items.js +1 -1
  146. package/dist/components/bcm-popover.js +14 -10
  147. package/dist/components/bcm-tab-group.js +5 -1
  148. package/dist/components/bcm-tab-item-header.js +11 -26
  149. package/dist/components/color-helper.js +27 -1
  150. package/dist/components/generate.js +55 -5
  151. package/dist/components/input.js +4 -4
  152. package/dist/components/menu.js +1 -0
  153. package/dist/components/tooltip-helper.js +12 -4
  154. package/dist/components/tooltip.js +1 -1
  155. package/dist/components/typography.js +1 -1
  156. package/dist/esm/bcm-accordion.entry.js +1 -1
  157. package/dist/esm/bcm-alert.entry.js +1 -1
  158. package/dist/esm/bcm-attendance.entry.js +1 -1
  159. package/dist/esm/bcm-avatar.entry.js +122 -0
  160. package/dist/esm/bcm-badge_15.entry.js +1720 -0
  161. package/dist/esm/bcm-breadcrumb.entry.js +1 -1
  162. package/dist/esm/bcm-button-group.entry.js +1 -1
  163. package/dist/esm/bcm-card.entry.js +3 -3
  164. package/dist/esm/bcm-checkbox-group.entry.js +8 -8
  165. package/dist/esm/bcm-checkbox-lite_9.entry.js +2 -2
  166. package/dist/esm/{bcm-checkbox_2.entry.js → bcm-checkbox.entry.js} +4 -14
  167. package/dist/esm/bcm-chip-group.entry.js +124 -0
  168. package/dist/esm/bcm-chip.entry.js +86 -0
  169. package/dist/esm/bcm-collapse-group.entry.js +1 -1
  170. package/dist/esm/bcm-collapse.entry.js +1 -1
  171. package/dist/esm/bcm-color-input.entry.js +6 -6
  172. package/dist/esm/{bcm-avatar_15.entry.js → bcm-colorful.entry.js} +4 -6319
  173. package/dist/esm/bcm-colorpicker.entry.js +2 -2
  174. package/dist/esm/bcm-date-picker.entry.js +2 -2
  175. package/dist/esm/bcm-datetime-picker.entry.js +3 -3
  176. package/dist/esm/bcm-default.entry.js +1 -1
  177. package/dist/esm/bcm-drawer.entry.js +6 -6
  178. package/dist/esm/bcm-expansion-panel.entry.js +3 -3
  179. package/dist/esm/bcm-form-2.entry.js +1 -1
  180. package/dist/esm/bcm-form.entry.js +484 -0
  181. package/dist/esm/bcm-input-custom.entry.js +1 -1
  182. package/dist/esm/bcm-input.entry.js +366 -0
  183. package/dist/esm/bcm-label.entry.js +40 -0
  184. package/dist/esm/bcm-list_3.entry.js +4019 -0
  185. package/dist/esm/bcm-modal-2-footer.entry.js +6 -6
  186. package/dist/esm/bcm-modal-2-header.entry.js +6 -6
  187. package/dist/esm/bcm-modal-2.entry.js +6 -6
  188. package/dist/esm/bcm-modal.entry.js +1 -1
  189. package/dist/esm/bcm-old-input.entry.js +1 -1
  190. package/dist/esm/bcm-old-tag_2.entry.js +1 -1
  191. package/dist/esm/bcm-popconfirm-box.entry.js +3 -3
  192. package/dist/esm/bcm-popconfirm.entry.js +1 -1
  193. package/dist/esm/bcm-progress.entry.js +3 -3
  194. package/dist/esm/bcm-radio-group.entry.js +6 -6
  195. package/dist/esm/bcm-radio.entry.js +6 -6
  196. package/dist/esm/bcm-range.entry.js +2 -2
  197. package/dist/esm/bcm-select.entry.js +1 -1
  198. package/dist/esm/bcm-skeleton.entry.js +1 -1
  199. package/dist/esm/bcm-step.entry.js +2 -2
  200. package/dist/esm/bcm-stepper.entry.js +7 -7
  201. package/dist/esm/bcm-switch.entry.js +2 -2
  202. package/dist/esm/bcm-table.entry.js +1 -1
  203. package/dist/esm/bcm-tabs-content.entry.js +1 -1
  204. package/dist/esm/bcm-tabs.entry.js +1 -1
  205. package/dist/esm/bcm-tag.entry.js +3 -3
  206. package/dist/esm/bcm-textarea.entry.js +3 -3
  207. package/dist/esm/bcm-time-picker.entry.js +2 -2
  208. package/dist/esm/bcm-toast.entry.js +2 -2
  209. package/dist/esm/bromcom-ui.js +1 -1
  210. package/dist/esm/{color-helper-e8ce23d7.js → color-helper-116755ed.js} +28 -2
  211. package/dist/esm/{element-dragger-89bb52fd.js → element-dragger-7ea06c76.js} +1 -1
  212. package/dist/esm/{generate-e7435a13.js → generate-786bd626.js} +55 -5
  213. package/dist/esm/index-6310a048.js +537 -0
  214. package/dist/esm/index-962dec74.js +50 -0
  215. package/dist/esm/{input-template-e1e850b5.js → input-template-88fba8d7.js} +1 -1
  216. package/dist/esm/{json-parse-decarator-2bcd4584.js → json-parse-decarator-e85e0fea.js} +1 -1
  217. package/dist/esm/loader.js +1 -1
  218. package/dist/esm/{number-helper-cb2563aa.js → number-helper-d9b73e76.js} +1 -1
  219. package/dist/esm/old-bcm-popover-box.entry.js +4 -4
  220. package/dist/esm/old-bcm-popover.entry.js +1 -1
  221. package/dist/esm/{stepper-states-29463262.js → stepper-states-026cdd66.js} +1 -1
  222. package/dist/esm/{utils-57652744.js → utils-b3338faf.js} +1 -1
  223. package/dist/esm/{validators-0a4134a4.js → validators-0b019b63.js} +1 -1
  224. package/dist/types/components/atoms/avatar/avatar.d.ts +8 -10
  225. package/dist/types/components/atoms/avatar/avatar.style.d.ts +5 -0
  226. package/dist/types/components/atoms/badge/badge.d.ts +3 -7
  227. package/dist/types/components/atoms/badge/badge.style.d.ts +4 -0
  228. package/dist/types/components.d.ts +11 -13
  229. package/dist/types/helper/color-helper.d.ts +22 -2
  230. package/dist/types/helper/generate.d.ts +21 -1
  231. package/dist/types/helper/popover-helper.d.ts +0 -5
  232. package/dist/types/helper/tooltip-helper.d.ts +0 -1
  233. package/package.json +7 -4
  234. package/dist/bromcom-ui/p-0ab46a99.js +0 -5
  235. package/dist/bromcom-ui/p-0b0660a0.js +0 -5
  236. package/dist/bromcom-ui/p-1a3d281e.entry.js +0 -5
  237. package/dist/bromcom-ui/p-2b4677a8.entry.js +0 -5
  238. package/dist/bromcom-ui/p-3ae615ef.entry.js +0 -5
  239. package/dist/bromcom-ui/p-61c51804.entry.js +0 -5
  240. package/dist/bromcom-ui/p-632bbc11.entry.js +0 -5
  241. package/dist/bromcom-ui/p-6c34860e.entry.js +0 -5
  242. package/dist/bromcom-ui/p-843905c8.js +0 -5
  243. package/dist/bromcom-ui/p-92831a1d.js +0 -5
  244. package/dist/bromcom-ui/p-a9a9bf8f.js +0 -5
  245. package/dist/bromcom-ui/p-b17ba740.entry.js +0 -19
  246. package/dist/bromcom-ui/p-b8cfa9ab.entry.js +0 -5
  247. package/dist/bromcom-ui/p-c5de4c76.entry.js +0 -5
  248. package/dist/bromcom-ui/p-d832cf50.entry.js +0 -5
  249. package/dist/bromcom-ui/p-d888c814.entry.js +0 -5
  250. package/dist/bromcom-ui/p-fb96c1cd.entry.js +0 -5
  251. package/dist/cjs/bcm-dropdown.cjs.entry.js +0 -118
  252. package/dist/cjs/bcm-item.cjs.entry.js +0 -71
  253. package/dist/cjs/bcm-items.cjs.entry.js +0 -48
  254. package/dist/cjs/bcm-menu.cjs.entry.js +0 -149
  255. package/dist/cjs/bcm-popover.cjs.entry.js +0 -225
  256. package/dist/cjs/bcm-tab-group.cjs.entry.js +0 -205
  257. package/dist/cjs/bcm-tab-item-header.cjs.entry.js +0 -73
  258. package/dist/cjs/bcm-tab-item.cjs.entry.js +0 -90
  259. package/dist/cjs/bcm-text.cjs.entry.js +0 -49
  260. package/dist/cjs/tooltip-helper-c822010b.js +0 -150
  261. package/dist/collection/components/atoms/avatar/avatar.css +0 -198
  262. package/dist/collection/components/atoms/badge/badge.css +0 -231
  263. package/dist/esm/bcm-dropdown.entry.js +0 -114
  264. package/dist/esm/bcm-item.entry.js +0 -67
  265. package/dist/esm/bcm-items.entry.js +0 -44
  266. package/dist/esm/bcm-menu.entry.js +0 -145
  267. package/dist/esm/bcm-popover.entry.js +0 -221
  268. package/dist/esm/bcm-tab-group.entry.js +0 -201
  269. package/dist/esm/bcm-tab-item-header.entry.js +0 -69
  270. package/dist/esm/bcm-tab-item.entry.js +0 -86
  271. package/dist/esm/bcm-text.entry.js +0 -45
  272. package/dist/esm/tooltip-helper-f35d93d2.js +0 -148
@@ -0,0 +1,4019 @@
1
+ /*!
2
+ * Built with Stencil
3
+ * Copyright (c) Bromcom.
4
+ */
5
+ import { h as h$1, r as registerInstance, c as createEvent, H as Host, g as getElement } from './index-348b16ad.js';
6
+ import { I as IsLoad } from './is-load-decorator-07d3502a.js';
7
+ import { J as JsonParse } from './json-parse-decarator-e85e0fea.js';
8
+ import './color-helper-116755ed.js';
9
+ import './datetime-helper-df25808a.js';
10
+ import { s as snq, G as Generate } from './generate-786bd626.js';
11
+ import { N as NumberHelper } from './number-helper-d9b73e76.js';
12
+ import { S as StringHelper } from './string-helper-6bd24967.js';
13
+ import { V as Validators } from './validators-0b019b63.js';
14
+ import './element-dragger-7ea06c76.js';
15
+ import { g as getPlacement, s as setPosition } from './popover-placement-78f86f15.js';
16
+ import { p as pluralize, d as delay } from './utils-b3338faf.js';
17
+ import { a as Bcm, B as Bcm$1 } from './bcm-9f50af9c.js';
18
+ import { C as CaptionTemplate } from './caption-template-34a1cb44.js';
19
+ import { c as classnames } from './index-ed9652af.js';
20
+ import './types-6f06fa1a.js';
21
+ import { L as LabelTemplate } from './label-template-98dafeb3.js';
22
+ import './types-9493a7ed.js';
23
+ import { c as createStore } from './index-0052017c.js';
24
+ import { r as react, a as reactDom } from './index-6310a048.js';
25
+ import { c as createCommonjsModule } from './_commonjsHelpers-3016b722.js';
26
+ import { I as InputTemplate } from './input-template-88fba8d7.js';
27
+ import './colors-1d7854ea.js';
28
+ import './colors-44c95e7e.js';
29
+ import './slot-template-672e941d.js';
30
+
31
+ const CheckboxTemplate = ({ disabled, checked, readonly, required, indeterminate, hidden, captionType, _id }) => {
32
+ // if ( indeterminate ) {
33
+ // checked = indeterminate == 'determinate' ? true : false
34
+ // }
35
+ const hostClasses = classnames('bcm-checkbox', 'bcm-checkbox__type-default', `bcm-checkbox-size-medium`, {
36
+ // 'size-2': size === Bcm.Size.small || size === Bcm.Size.medium,
37
+ // 'size-3': optionType === 'button' && size === Bcm.Size.large,
38
+ 'error': captionType == Bcm.Status.error,
39
+ hidden,
40
+ checked,
41
+ disabled,
42
+ required,
43
+ readonly,
44
+ });
45
+ const bcmCheckboxIconClass = classnames('bcm-checkbox__label-icon', 'bcm-checkbox__label-icon-lite', 'bcm-checkbox__label-icon-' + indeterminate, {
46
+ 'bcm-checkbox__label-icon-checked': checked,
47
+ });
48
+ const bcmCheckboxLabelClass = classnames('bcm-checkbox__label');
49
+ return (h$1("div", { class: hostClasses },
50
+ h$1("input", { tabindex: "-1", id: _id, type: "checkbox", checked: checked, disabled: disabled, required: required, readonly: readonly }),
51
+ h$1("label", { class: bcmCheckboxLabelClass, htmlFor: _id },
52
+ h$1("span", { class: bcmCheckboxIconClass },
53
+ h$1("bcm-icon", { icon: "far fa-check" })))));
54
+ };
55
+
56
+ const InfoFooterTemplate = ({ selected, total, found, multiple, variableText }) => {
57
+ total = total || 0;
58
+ variableText = variableText ? pluralize(variableText, total) : 'items';
59
+ return (h$1("footer", { class: "bcm-info-footer" },
60
+ h$1("bcm-text", { scale: "size-1", color: "grey-8" },
61
+ (multiple && selected > 0) && ` ( ${selected} selected ) `,
62
+ ` Total ${total} `,
63
+ found != null && ` / ${found} `,
64
+ ` ${variableText} found. `)));
65
+ };
66
+
67
+ const ListItemTemplate = ({ item, treeview, highlight, checkboxes, size, selectedItem, openGroup, checkedItem, focusItem, searchIsOnlyChilds }) => {
68
+ const isHaveChildren = item.items && item.items.length > 0;
69
+ var text = StringHelper.htmlEntities(item.text);
70
+ let intersection = [];
71
+ if (highlight && StringHelper.slugify(text).includes(StringHelper.slugify(highlight))) {
72
+ if (!searchIsOnlyChilds || (searchIsOnlyChilds && (!isHaveChildren || (!treeview && item.type != "group")))) {
73
+ text = StringHelper.highlight(text, highlight);
74
+ }
75
+ }
76
+ if (item.type != 'group' && item.template) {
77
+ const match = item.template
78
+ .replace(/\s/g, '')
79
+ .match(/\{{[^}}]+\}/g)
80
+ .map(x => x.replace(/[{}]/g, ''));
81
+ const keys = Object.keys(item.itemObject);
82
+ intersection = match.filter(x => keys.includes(x));
83
+ }
84
+ text = item.isHtmlContent ? item.isHtmlContent : item.template && intersection.length > 0 ? StringHelper.templateParser(item.template, Object.assign(Object.assign({}, item.itemObject), { text })) : text;
85
+ const unClickable = !treeview && item.type == "group" && !item.clickable;
86
+ const disabled = item.disabled;
87
+ const readonly = item.readonly;
88
+ const itemClick = (event) => {
89
+ let path = event.path || event.composedPath();
90
+ if (path.filter(x => x.attributes && x.attributes.getNamedItem("unlinked"))[0]) {
91
+ return;
92
+ }
93
+ if (readonly) {
94
+ collapseClick();
95
+ }
96
+ !unClickable && !disabled && !readonly && (checkboxes ? checkedItem(item.id) : selectedItem(item.id));
97
+ };
98
+ const collapseClick = () => {
99
+ item.open = item.isSearching;
100
+ openGroup(item.id);
101
+ };
102
+ return (h$1("div", { id: item.id, hidden: item.hidden, "on-focus": e => !unClickable && !disabled && focusItem(e), class: classnames('bcm-list__item',
103
+ // size === 'large' ? 'size-3' : 'size-2',
104
+ 'bcm-list__item-' + size, {
105
+ 'bcm-list__item--group': !treeview && item.type == 'group',
106
+ 'bcm-list__item--readonly': readonly,
107
+ }) },
108
+ h$1("div", { class: classnames('bcm-list__item-content', !checkboxes && item.selected && 'selected', { disabled: disabled }) },
109
+ treeview && (h$1("div", { class: "bcm-list__item-content-collapse-icon", onClick: () => collapseClick() }, isHaveChildren && h$1("bcm-icon", { icon: classnames('fas fa-caret-' + (item.isSearching || item.open ? 'down' : 'right')) }))),
110
+ h$1("div", { class: classnames('bcm-list__item-content-text', { treeview }), onClick: (e) => itemClick(e) },
111
+ checkboxes && (treeview || (!treeview && item.type != 'group')) && (h$1("div", { class: "bcm-list__item-content-text-checkbox" },
112
+ h$1(CheckboxTemplate, { indeterminate: item.indeterminate, checked: item.checked, disabled: item.disabled }))),
113
+ h$1("span", Object.assign({ class: "bcm-list__item-content-text-inner" }, (item.title && { "title": item.title }), { innerHTML: text })))),
114
+ (treeview || !treeview && item.type == "group") && isHaveChildren && (h$1("div", { class: "bcm-list__item-childs" }, (item.isSearching || item.open || (!treeview && item.type == "group")) &&
115
+ item.items.map((item) => (h$1(ListItemTemplate, { highlight: highlight, item: item, searchIsOnlyChilds: searchIsOnlyChilds, treeview: treeview, checkboxes: checkboxes, size: size, selectedItem: selectedItem, checkedItem: checkedItem, openGroup: parentId => openGroup(parentId), focusItem: itemId => focusItem(itemId) })))))));
116
+ };
117
+
118
+ const ListTemplate = ({ highlight, selectAllItem, bcmListContainer, treeview, checkboxes, checkAll, infoFooter, value, totalData, searchFound, variableText, _id, data, width, height, size, searchPlaceholder, minSearchLength, selectedItem, openGroup, checkedItem, onScrollEvent, focusItem, items, searchable, searchIsOnlyChilds, emptyText, emptyIcon, }) => {
119
+ const showSelectAll = !(treeview && searchFound > 0) && !(searchFound > 0);
120
+ const setScrollHeight = () => {
121
+ const itemHeight = size === 'small' ? 28 : size === 'medium' ? 36 : 48;
122
+ const itemCount = searchFound == null ? (treeview ? items.length : totalData) : searchFound;
123
+ const scrollHeight = itemCount * itemHeight || 0;
124
+ return {
125
+ 'min-height': `${scrollHeight}px`,
126
+ 'overscroll-behavior': 'none',
127
+ 'height': '100%',
128
+ 'display': 'flex',
129
+ 'flex-direction': 'column',
130
+ };
131
+ };
132
+ return (h$1("div", { id: `bcm-list-${_id}`, class: bcmListContainer, style: { '--height': height, '--width': width } },
133
+ data && searchable && (h$1("section", { class: "bcm-list__container-search" },
134
+ h$1("bcm-search", { size: size, id: `bcm-list-${_id}-search`, data: data, clearable: true, placeholder: searchPlaceholder, "min-search-length": minSearchLength, searchIsOnlyChilds: searchIsOnlyChilds }))),
135
+ h$1("main", { onScroll: e => onScrollEvent(e), class: "scrolling", style: { 'overscroll-behavior': 'none' } },
136
+ h$1("div", { style: setScrollHeight() },
137
+ checkAll && searchFound != 0 && items && items.length > 0 && checkboxes && showSelectAll && (h$1("section", { class: "bcm-list__container-select-all" },
138
+ h$1(ListItemTemplate, { size: size, item: selectAllItem, treeview: false, checkboxes: true, selectedItem: itemId => selectedItem(itemId), checkedItem: itemId => checkedItem(itemId), openGroup: parentId => openGroup(parentId), focusItem: itemId => focusItem(itemId) }))),
139
+ items.map((item) => (h$1(ListItemTemplate, { highlight: highlight, size: size, item: item, searchIsOnlyChilds: searchIsOnlyChilds, treeview: treeview, checkboxes: checkboxes, selectedItem: itemId => selectedItem(itemId), checkedItem: itemId => checkedItem(itemId), openGroup: parentId => openGroup(parentId), focusItem: itemId => focusItem(itemId) }))),
140
+ (!items || items.length === 0) && searchFound != 0 && (h$1("section", { class: "bcm-list__container-no-data" },
141
+ h$1("bcm-empty", { style: { height: 'auto' }, icon: emptyIcon },
142
+ h$1("span", { innerHTML: emptyText || 'No data' })))),
143
+ searchFound == 0 && (h$1("section", { class: "bcm-list__container-no-data" },
144
+ h$1("bcm-empty", { style: { height: 'auto' }, icon: emptyIcon },
145
+ h$1("span", { innerHTML: emptyText || 'No Data Found' })))))),
146
+ infoFooter && data && data.length > 0 && (h$1(InfoFooterTemplate, { selected: value === null || value === void 0 ? void 0 : value.length, total: totalData, found: searchFound, multiple: checkboxes, variableText: variableText }))));
147
+ };
148
+
149
+ const { state: state$1 } = createStore({
150
+ value: new Map(),
151
+ });
152
+ const setValue$1 = val => {
153
+ const { id, dataSource, options } = val;
154
+ const { type, treeview, checkboxes, searchable, value, name, label, size, disabled, readonly, highlight, required, hidden, fullWidth, height, maxHeight, minHeight, width, infoFooter, variableText, template, allOpen, keyControl, checkAll, linkedComponent, placeholder, searchPlaceholder, searchIsOnlyChilds, clearable, caption, noCaption, captionType, captionError, placement, } = options;
155
+ const itemOptions = { size, checkboxes, template, allOpen, highlight, treeview };
156
+ const data = {
157
+ id: snq(() => id, Generate.UID),
158
+ dataSource: dataSource && dataSource.length > 0 && recursive$1(dataSource, itemOptions),
159
+ options: {
160
+ type,
161
+ treeview,
162
+ checkboxes,
163
+ searchable,
164
+ value,
165
+ name,
166
+ label,
167
+ size,
168
+ disabled,
169
+ readonly,
170
+ highlight,
171
+ required,
172
+ hidden,
173
+ fullWidth,
174
+ height,
175
+ maxHeight,
176
+ minHeight,
177
+ width,
178
+ infoFooter,
179
+ variableText,
180
+ template,
181
+ allOpen,
182
+ keyControl,
183
+ checkAll,
184
+ linkedComponent,
185
+ placeholder,
186
+ searchPlaceholder,
187
+ searchIsOnlyChilds,
188
+ clearable,
189
+ caption,
190
+ noCaption,
191
+ captionType,
192
+ captionError,
193
+ placement,
194
+ },
195
+ totalItems: (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) > 0 && calculateTotalItems(dataSource, options.treeview),
196
+ totalRoots: dataSource === null || dataSource === void 0 ? void 0 : dataSource.length,
197
+ };
198
+ state$1.value.set(data.id, data);
199
+ };
200
+ const recursive$1 = (data, options, parentId, parentIndex = "0.") => {
201
+ let recData = [];
202
+ if (data && data.length > 0) {
203
+ recData = data.map((item, index) => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ itemObject: item }, item), options), { parentId: snq(() => parentId, null), open: options.allOpen || item.open || false }), ((options.treeview || (!options.treeview && item.type == 'group')) && item.items && item.items.length > 0
204
+ ? { items: snq(() => recursive$1(item.items, options, item.id, `${parentIndex}${index}`), []) }
205
+ : { items: [] })), { ct: `${parentIndex}${index}` })));
206
+ }
207
+ return recData;
208
+ };
209
+ const removeValue$1 = _id => {
210
+ state$1.value.delete(_id);
211
+ };
212
+ const getValue$1 = id => snq(() => state$1.value.get(id), {});
213
+ const calculateTotalItems = (dataSource, treeview) => {
214
+ let total = 0;
215
+ dataSource.forEach(item => {
216
+ if (treeview || (!treeview && item.type != "group")) {
217
+ total += 1;
218
+ }
219
+ if ((treeview || (!treeview && item.type == "group")) && item.items) {
220
+ total += calculateTotalItems(item.items, treeview);
221
+ }
222
+ });
223
+ return total;
224
+ };
225
+ const getData = id => {
226
+ let data = [];
227
+ const value = getValue$1(id);
228
+ if (value) {
229
+ const { dataSource } = value;
230
+ data = dataSource;
231
+ }
232
+ return data;
233
+ };
234
+ const getDataPagination$1 = (id, limit = 3, ids) => {
235
+ let data = [];
236
+ const value = getValue$1(id);
237
+ if (value) {
238
+ const { dataSource } = value;
239
+ data = !ids ? dataSource.slice(0, limit) : dataSource.filter(item => ids.indexOf(item.id) > -1).slice(0, limit);
240
+ }
241
+ return data;
242
+ };
243
+ const openGroup = (id, groupId, items, status) => {
244
+ let dataSource;
245
+ if (items) {
246
+ dataSource = items;
247
+ }
248
+ else {
249
+ const value = getValue$1(id);
250
+ dataSource = value.dataSource;
251
+ }
252
+ if (dataSource) {
253
+ dataSource.forEach(item => {
254
+ if (status != undefined) {
255
+ item.open = status;
256
+ }
257
+ else if (item.id == groupId) {
258
+ item.open = !item.open;
259
+ item.isSearching = item.open;
260
+ if (!item.open && item.items) {
261
+ openGroup(id, groupId, item.items, false);
262
+ }
263
+ }
264
+ else if (item.items) {
265
+ openGroup(id, groupId, item.items);
266
+ }
267
+ });
268
+ }
269
+ };
270
+ const removeOtherTags = (id, ids, items) => {
271
+ ids = Array.isArray(ids) ? ids : [ids];
272
+ let dataSource;
273
+ if (items) {
274
+ dataSource = items;
275
+ }
276
+ else {
277
+ const value = getValue$1(id);
278
+ dataSource = value.dataSource;
279
+ }
280
+ if (dataSource) {
281
+ ids.forEach(otherTagIds => {
282
+ dataSource.forEach(child => {
283
+ if (child.id == otherTagIds) {
284
+ child.checked = false;
285
+ child.itemObject.checked = false;
286
+ }
287
+ else if (child.items) {
288
+ onRemoveItems(id, otherTagIds, child.items);
289
+ }
290
+ });
291
+ });
292
+ }
293
+ };
294
+ const onRemoveItems = (id, itemId, items) => {
295
+ if (items) {
296
+ items.forEach(item => {
297
+ if (item.id == itemId) {
298
+ item.checked = false;
299
+ item.itemObject.checked = false;
300
+ indeterminateStatus(id, item.parentId);
301
+ }
302
+ else if (item.items) {
303
+ onRemoveItems(id, itemId, item.items);
304
+ }
305
+ });
306
+ }
307
+ };
308
+ const addChecked = (id, ids) => {
309
+ const value = getValue$1(id);
310
+ if (value) {
311
+ ids.forEach(item => {
312
+ checkedItem(id, item);
313
+ });
314
+ }
315
+ };
316
+ const checkedItem = (id, itemId) => {
317
+ findItem(id, itemId);
318
+ };
319
+ const findItem = (id, itemId, items) => {
320
+ itemId = Array.isArray(itemId) ? itemId : [itemId];
321
+ let dataSource;
322
+ if (items) {
323
+ dataSource = items;
324
+ }
325
+ else {
326
+ const value = getValue$1(id);
327
+ dataSource = value.dataSource;
328
+ }
329
+ if (dataSource) {
330
+ dataSource.forEach(item => {
331
+ if (itemId.includes(item.id)) {
332
+ checkedProcess(id, item);
333
+ if (item.parentId) {
334
+ indeterminateStatus(id, item.parentId);
335
+ }
336
+ }
337
+ else if (item.items) {
338
+ findItem(id, itemId, item.items);
339
+ }
340
+ });
341
+ }
342
+ };
343
+ const checkedProcess = (id, item, status) => {
344
+ const value = getValue$1(id);
345
+ if (value) {
346
+ const treeview = value.options.treeview;
347
+ if (item) {
348
+ // && !item.hidden => select all bastığımızda hidden olanları seçmemesi içindi
349
+ if (treeview || (!treeview && item.type != "group")) {
350
+ if (!item.disabled) {
351
+ if (status != undefined) {
352
+ item.checked = status;
353
+ }
354
+ else {
355
+ item.checked = !item.checked;
356
+ }
357
+ item.itemObject.checked = item.checked;
358
+ item.indeterminate = item.checked ? "determinate" : "uncheck";
359
+ }
360
+ }
361
+ if (item.items) {
362
+ item.items.forEach(child => {
363
+ checkedProcess(id, child, status == undefined ? item.checked : status);
364
+ });
365
+ }
366
+ }
367
+ }
368
+ };
369
+ const indeterminateStatus = (id, itemId, items) => {
370
+ let dataSource;
371
+ if (items) {
372
+ dataSource = items;
373
+ }
374
+ else {
375
+ const value = getValue$1(id);
376
+ dataSource = value.dataSource;
377
+ }
378
+ if (dataSource) {
379
+ dataSource.forEach(item => {
380
+ if (item.id == itemId) {
381
+ let allChecked = true;
382
+ let allUnchecked = true;
383
+ if (item.items) {
384
+ item.items.map(child => {
385
+ (child.checked || child.indeterminate === "indeterminate") && (allUnchecked = false);
386
+ !child.checked && (allChecked = false);
387
+ });
388
+ }
389
+ const indeterminateState = !allChecked && !allUnchecked ? "indeterminate" : allChecked ? "determinate" : "uncheck";
390
+ item.indeterminate = indeterminateState;
391
+ item.checked = indeterminateState == "determinate" ? true : false;
392
+ item.itemObject.checked = item.checked;
393
+ if (item.parentId) {
394
+ indeterminateStatus(id, item.parentId);
395
+ }
396
+ }
397
+ else if (item.items) {
398
+ indeterminateStatus(id, itemId, item.items);
399
+ }
400
+ });
401
+ }
402
+ };
403
+ const filterData = (id, ids, items, searchOtherTag) => {
404
+ let checkeds = [];
405
+ let visibled = [];
406
+ getValue$1(id).isSearchOtherTag = searchOtherTag;
407
+ let dataSource;
408
+ if (items) {
409
+ dataSource = items;
410
+ }
411
+ else {
412
+ const value = getValue$1(id);
413
+ dataSource = value.dataSource;
414
+ }
415
+ if (dataSource) {
416
+ dataSource.forEach(item => {
417
+ if (ids) {
418
+ item.hidden = true;
419
+ // const filter = ids.find((find) => find.id === item.id)
420
+ var filter;
421
+ for (let index = 0; index < ids.length; index++) {
422
+ if (ids[index].id === item.id) {
423
+ filter = ids[index];
424
+ break;
425
+ }
426
+ }
427
+ if (filter) {
428
+ item.hidden = false;
429
+ if (!getValue$1(id).isSearchOtherTag) {
430
+ item.isSearching = true;
431
+ }
432
+ visibled.push(item);
433
+ if (item.checked) {
434
+ checkeds.push(item);
435
+ }
436
+ if (filter.items) {
437
+ const { checkedItems, visibledItems } = filterData(id, filter.items, item.items, searchOtherTag);
438
+ if (checkedItems) {
439
+ checkeds = [...new Set([...checkeds, ...checkedItems])];
440
+ }
441
+ if (visibledItems) {
442
+ visibled = [...new Set([...visibled, ...visibledItems])];
443
+ }
444
+ }
445
+ }
446
+ }
447
+ else {
448
+ item.hidden = false;
449
+ if (item.items) {
450
+ filterData(id, null, item.items);
451
+ }
452
+ visibled.push(item);
453
+ item.isSearching = false;
454
+ }
455
+ });
456
+ }
457
+ return { checkedItems: checkeds !== null && checkeds !== void 0 ? checkeds : [], visibledItems: visibled !== null && visibled !== void 0 ? visibled : [] };
458
+ };
459
+ const getSelected = (id, items) => {
460
+ let dataSource;
461
+ let selected = null;
462
+ if (items) {
463
+ dataSource = items;
464
+ }
465
+ else {
466
+ const value = getValue$1(id);
467
+ dataSource = value.dataSource;
468
+ }
469
+ if (dataSource) {
470
+ dataSource.forEach(item => {
471
+ if (item.selected) {
472
+ selected = item.itemObject;
473
+ }
474
+ else if (item.items) {
475
+ const found = getSelected(id, item.items);
476
+ if (found) {
477
+ selected = found;
478
+ }
479
+ }
480
+ });
481
+ }
482
+ return selected;
483
+ };
484
+ const getCheckedList = (id, items) => {
485
+ let dataSource;
486
+ let checkedList = [];
487
+ let nestedResult = [];
488
+ if (items) {
489
+ dataSource = items;
490
+ }
491
+ else {
492
+ const value = getValue$1(id);
493
+ dataSource = value.dataSource;
494
+ }
495
+ if (dataSource) {
496
+ dataSource.forEach(item => {
497
+ var _a;
498
+ const newItem = Object.assign(Object.assign({}, item.itemObject), { ct: item.ct });
499
+ let foundChild = [];
500
+ let foundItem = [];
501
+ if (item.checked) {
502
+ checkedList.push(newItem);
503
+ foundItem.push(Object.assign(Object.assign({}, newItem), { items: [] }));
504
+ }
505
+ if (item.items) {
506
+ const found = getCheckedList(id, item.items);
507
+ if (((_a = found === null || found === void 0 ? void 0 : found.checkedList) === null || _a === void 0 ? void 0 : _a.length) > 0) {
508
+ checkedList = [...checkedList, ...found.checkedList];
509
+ }
510
+ if (found.nestedResult.length > 0) {
511
+ foundChild = found.nestedResult;
512
+ }
513
+ }
514
+ if (foundChild.length > 0) {
515
+ if (foundItem.length == 0) {
516
+ foundItem.push(Object.assign(Object.assign({}, newItem), { items: [] }));
517
+ }
518
+ foundItem[0].items = foundChild;
519
+ nestedResult.push(foundItem[0]);
520
+ }
521
+ else {
522
+ if (foundItem.length > 0) {
523
+ foundItem[0].items = foundChild;
524
+ nestedResult.push(foundItem[0]);
525
+ }
526
+ }
527
+ });
528
+ }
529
+ return { checkedList: (checkedList === null || checkedList === void 0 ? void 0 : checkedList.length) > 0 ? checkedList : null, nestedResult: nestedResult };
530
+ };
531
+ const selectedItem = (id, itemId, items) => {
532
+ let dataSource;
533
+ let selected = [];
534
+ if (items) {
535
+ dataSource = items;
536
+ }
537
+ else {
538
+ const value = getValue$1(id);
539
+ dataSource = value.dataSource;
540
+ }
541
+ if (dataSource) {
542
+ dataSource.forEach(item => {
543
+ if (itemId) {
544
+ if (item.id == itemId) {
545
+ // if (!item.selected){
546
+ item.selected = true;
547
+ item.itemObject.selected = item.selected;
548
+ // }
549
+ }
550
+ else {
551
+ if (item.selected) {
552
+ item.selected = false;
553
+ item.itemObject.selected = item.selected;
554
+ }
555
+ }
556
+ }
557
+ if (item.items) {
558
+ const found = selectedItem(id, itemId, item.items);
559
+ if ((found === null || found === void 0 ? void 0 : found.length) > 0) {
560
+ selected = [...selected, ...found];
561
+ }
562
+ }
563
+ if (item.selected) {
564
+ selected.push(item.itemObject);
565
+ }
566
+ });
567
+ }
568
+ return selected && selected.length > 0 ? selected : null;
569
+ };
570
+ const setClear = (id, items) => {
571
+ let dataSource;
572
+ if (items) {
573
+ dataSource = items;
574
+ }
575
+ else {
576
+ const value = getValue$1(id);
577
+ dataSource = value.dataSource;
578
+ }
579
+ if (dataSource) {
580
+ dataSource.forEach(item => {
581
+ var _a, _b, _c;
582
+ item.checked && (item.checked = false);
583
+ item.selected && (item.selected = false);
584
+ item.indeterminate && (item.indeterminate = "uncheck");
585
+ ((_a = item.itemObject) === null || _a === void 0 ? void 0 : _a.checked) && (item.itemObject.checked = false);
586
+ ((_b = item.itemObject) === null || _b === void 0 ? void 0 : _b.selected) && (item.itemObject.selected = false);
587
+ ((_c = item.itemObject) === null || _c === void 0 ? void 0 : _c.indeterminate) && (item.itemObject.indeterminate = "uncheck");
588
+ if (item.items) {
589
+ setClear(id, item.items);
590
+ }
591
+ });
592
+ }
593
+ };
594
+ const selectAll = (id, status) => {
595
+ const dataSource = getValue$1(id).dataSource;
596
+ if (dataSource) {
597
+ dataSource.forEach(item => {
598
+ checkedProcess(id, item, status);
599
+ });
600
+ }
601
+ };
602
+ const updateOptions = (id, options) => {
603
+ Object.keys(getValue$1(id).options).forEach(key => {
604
+ getValue$1(id).options[key] = options[key];
605
+ });
606
+ };
607
+ const removeState = id => {
608
+ return Promise.resolve(state$1.value.delete(id));
609
+ };
610
+ const listState = {
611
+ setValue: setValue$1,
612
+ removeValue: removeValue$1,
613
+ getValue: getValue$1,
614
+ getData,
615
+ getDataPagination: getDataPagination$1,
616
+ openGroup,
617
+ checkedItem,
618
+ filterData,
619
+ getSelected,
620
+ getCheckedList,
621
+ selectedItem,
622
+ addChecked,
623
+ setClear,
624
+ selectAll,
625
+ removeOtherTags,
626
+ onRemoveItems,
627
+ updateOptions,
628
+ removeState,
629
+ };
630
+
631
+ class KeyControl {
632
+ constructor(keyCode, element, elementName, childElementName) {
633
+ this.elementName = '';
634
+ this.childElementName = '';
635
+ this.keyCode = keyCode;
636
+ this.element = element;
637
+ this.elementName = elementName;
638
+ this.childElementName = childElementName;
639
+ }
640
+ getKeyCode() {
641
+ return this.keyCode;
642
+ }
643
+ getElementName() {
644
+ return this.elementName;
645
+ }
646
+ getChildElementName() {
647
+ return this.childElementName;
648
+ }
649
+ getFocusedElementName() {
650
+ return this.getElementName() + '.focused';
651
+ }
652
+ getFocusedElement() {
653
+ return this.element.querySelectorAll(this.getFocusedElementName())[0] || null;
654
+ }
655
+ getFirstElement() {
656
+ return this.element.querySelectorAll(this.getElementName())[0] || null;
657
+ }
658
+ getNextElement() {
659
+ var _a;
660
+ return ((_a = this.getFocusedElement()) === null || _a === void 0 ? void 0 : _a.nextElementSibling) || this.getFirstElement();
661
+ }
662
+ getPreviousElement() {
663
+ var _a;
664
+ return ((_a = this.getFocusedElement()) === null || _a === void 0 ? void 0 : _a.previousElementSibling) || this.getFirstElement();
665
+ }
666
+ getChildElement() {
667
+ var _a;
668
+ return ((_a = this.getFocusedElement()) === null || _a === void 0 ? void 0 : _a.querySelectorAll(this.getChildElementName())[0]) || null;
669
+ }
670
+ getParentElement(element) {
671
+ if (element && element) {
672
+ const isRootElement = element && element.attributes['data-isroot'];
673
+ if (isRootElement) {
674
+ return element;
675
+ }
676
+ return this.getParentElement(element.parentNode);
677
+ }
678
+ }
679
+ focusElementIsOpen() {
680
+ var _a;
681
+ return ((_a = this.getFocusedElement()) === null || _a === void 0 ? void 0 : _a.classList.contains('bcm-list__item--open')) || false;
682
+ }
683
+ isRootElement() {
684
+ var _a;
685
+ return ((_a = this.getFocusedElement()) === null || _a === void 0 ? void 0 : _a.querySelectorAll(this.getChildElementName()).length) > 0;
686
+ }
687
+ isRootElementIsOpen() {
688
+ return this.getFocusedElement().classList.contains('bcm-list__item--open');
689
+ }
690
+ getFocusedChildElement() {
691
+ var _a;
692
+ return ((_a = this.getChildElement()) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.focused')[0]) || null;
693
+ }
694
+ isLastElement() {
695
+ var _a;
696
+ return ((_a = this.getFocusedElement()) === null || _a === void 0 ? void 0 : _a.nextElementSibling) === null;
697
+ }
698
+ focusParentElementFirstChild() {
699
+ var _a, _b;
700
+ return this.setFocus((_b = (_a = this.getFocusedElement()) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.firstChild);
701
+ }
702
+ isFirstElement() {
703
+ var _a;
704
+ return ((_a = this.getFocusedElement()) === null || _a === void 0 ? void 0 : _a.previousElementSibling) === null;
705
+ }
706
+ focusRootElement() {
707
+ var _a, _b, _c;
708
+ return this.setFocus((_c = (_b = (_a = this.getFocusedElement()) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.parentElement) === null || _c === void 0 ? void 0 : _c.firstChild);
709
+ }
710
+ nextRootElement() {
711
+ var _a, _b, _c;
712
+ return this.setFocus((_c = (_b = (_a = this.getFocusedElement()) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.parentElement) === null || _c === void 0 ? void 0 : _c.nextElementSibling);
713
+ }
714
+ findFocusElementParent() {
715
+ return this.getFocusedElement().parentNode.querySelectorAll('.bcm-list__item--open');
716
+ }
717
+ getLastElement() {
718
+ return this.element.querySelectorAll(this.getElementName())[this.element.querySelectorAll(this.getElementName()).length - 1] || null;
719
+ }
720
+ setFocus(element) {
721
+ element.focus();
722
+ }
723
+ }
724
+
725
+ class ListKeyControl extends KeyControl {
726
+ constructor(keyCode, element, treeview, checkBoxes) {
727
+ super(keyCode, element, '.bcm-list__item', '.bcm-list__item-childs');
728
+ this.isTreeview = false;
729
+ this.isCheckBoxes = false;
730
+ this.isTreeview = treeview;
731
+ this.isCheckBoxes = checkBoxes;
732
+ }
733
+ keyUpControl() {
734
+ if (this.isTreeview) {
735
+ this.keyUpTreeview();
736
+ }
737
+ else {
738
+ if (this.isFirstElement()) {
739
+ this.setFocus(this.getLastElement());
740
+ }
741
+ else {
742
+ this.setFocus(this.getPreviousElement());
743
+ }
744
+ }
745
+ }
746
+ keyDownTreeView() {
747
+ var _a;
748
+ if (this.isTreeview) {
749
+ if (this.isRootElement() && this.isRootElementIsOpen()) {
750
+ const childs = this.getChildElement();
751
+ if (childs) {
752
+ this.setFocus(childs.firstChild);
753
+ }
754
+ }
755
+ else {
756
+ if (this.isLastElement() && this.getParentElement(this.getFocusedElement())) {
757
+ this.setFocus((_a = this.getParentElement(this.getFocusedElement())) === null || _a === void 0 ? void 0 : _a.nextElementSibling);
758
+ }
759
+ else {
760
+ this.setFocus(this.getNextElement());
761
+ }
762
+ }
763
+ }
764
+ }
765
+ keyUpTreeview() {
766
+ if (this.isFirstElement()) {
767
+ const parent = this.getParentElement(this.getFocusedElement());
768
+ this.setFocus(parent);
769
+ }
770
+ else {
771
+ const previousElement = this.getPreviousElement();
772
+ if (previousElement) {
773
+ if (previousElement.classList.contains('bcm-list__item--open')) {
774
+ const getChildElement = previousElement.querySelectorAll(this.getChildElementName())[0];
775
+ console.log({ getChildElement });
776
+ this.setFocus(getChildElement.lastChild);
777
+ }
778
+ else {
779
+ this.setFocus(previousElement);
780
+ }
781
+ }
782
+ }
783
+ }
784
+ keyDownControl() {
785
+ if (this.isTreeview) {
786
+ this.keyDownTreeView();
787
+ }
788
+ else {
789
+ if (this.isLastElement()) {
790
+ this.setFocus(this.getFirstElement());
791
+ }
792
+ else {
793
+ this.setFocus(this.getNextElement());
794
+ }
795
+ }
796
+ }
797
+ keyRightControl() {
798
+ if (this.isTreeview) {
799
+ if (!this.isRootElementIsOpen() && this.isRootElement()) {
800
+ const { id } = this.getFocusedElement();
801
+ this.openGroup(id);
802
+ }
803
+ }
804
+ }
805
+ keyLeftControl() {
806
+ if (this.isTreeview) {
807
+ if (this.isRootElementIsOpen() && this.isRootElement()) {
808
+ const { id } = this.getFocusedElement();
809
+ this.openGroup(id);
810
+ }
811
+ }
812
+ }
813
+ keyEnterControl() { }
814
+ keySpaceControl() {
815
+ if (this.isCheckBoxes) {
816
+ const { id } = this.getFocusedElement();
817
+ this.checkedItem(id);
818
+ }
819
+ }
820
+ keyDown() {
821
+ switch (this.getKeyCode()) {
822
+ case Bcm.KeyCode.up:
823
+ this.keyUpControl();
824
+ break;
825
+ case Bcm.KeyCode.down:
826
+ this.keyDownControl();
827
+ break;
828
+ case Bcm.KeyCode.left:
829
+ this.keyLeftControl();
830
+ break;
831
+ case Bcm.KeyCode.right:
832
+ this.keyRightControl();
833
+ break;
834
+ case Bcm.KeyCode.enter:
835
+ this.keyEnterControl();
836
+ break;
837
+ case Bcm.KeyCode.space:
838
+ this.keySpaceControl();
839
+ break;
840
+ }
841
+ }
842
+ keyUp() { }
843
+ }
844
+
845
+ const listCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");@import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@200;400;500;600&display=swap\"); @import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@200;400;500;600&display=swap\"); @import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@200;400;500;600&display=swap\"); @import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@200;400;500;600&display=swap\"); .size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}.input-size-large{height:40px}.input-size-medium{height:32px}.input-size-small{height:24px}.resize-none textarea{resize:none}.resize-vertical textarea{resize:vertical}.resize-auto textarea{height:auto;resize:none}.textarea-size-large{padding:4px 0 0 4px;min-height:40px}.textarea-size-large .bcm-input-element{min-height:calc((40px - 8px) + 2px)}.textarea-size-large .input-clear-button{height:calc( 40px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-medium{padding:4px 0 0 4px;min-height:32px}.textarea-size-medium .bcm-input-element{min-height:calc((32px - 8px) + 2px)}.textarea-size-medium .input-clear-button{height:calc( 32px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-small{padding:0px 0 0 4px;min-height:24px}.textarea-size-small .bcm-input-element{min-height:calc((24px - 8px) + 2px)}.textarea-size-small .input-clear-button{height:calc( 24px - 16px );top:8px;padding:0;margin-right:8px}*{box-sizing:border-box}.bcm-caption-area{font-family:\"Inter\", sans-serif;font-size:14px;line-height:calc(14px + 8px);font-weight:400;font-size:12px;line-height:calc(12px + 8px);color:var(--bcm-new-ds-color-slate-400);display:flex;flex-direction:row;align-items:flex-start;justify-content:space-between;flex-wrap:nowrap;margin-top:2px}.bcm-caption-area__text{color:var(--bcm-new-ds-color-slate-400)}.bcm-caption-area__text.default{color:var(--bcm-new-ds-color-slate-400)}.bcm-caption-area__text.info{color:var(--bcm-new-ds-color-blue-500)}.bcm-caption-area__text.success{color:var(--bcm-new-ds-color-emerald-500)}.bcm-caption-area__text.warning{color:var(--bcm-new-ds-color-amber-500)}.bcm-caption-area__text.error{color:var(--bcm-new-ds-color-red-500)}.bcm-caption-area__size-small{font-size:10px;line-height:calc(10px + 8px);min-height:calc(10px + 8px)}.bcm-caption-area__size-medium{font-size:12px;line-height:calc(12px + 8px);min-height:calc(12px + 8px)}.bcm-caption-area__size-large{font-size:14px;line-height:calc(14px + 8px);min-height:calc(14px + 8px)}*{box-sizing:border-box}.bcm-label{display:inline-flex;align-items:flex-start;grid-gap:2px}.bcm-label__text{margin-bottom:2px;font-family:\"Inter\", sans-serif;font-size:14px;line-height:calc(14px + 8px);font-weight:400;display:inline-block;color:var(--bcm-new-ds-color-slate-600)}.bcm-label__size-small{font-size:10px;line-height:calc(10px + 8px);min-height:calc(10px + 8px)}.bcm-label__size-medium{font-size:12px;line-height:calc(12px + 8px);min-height:calc(12px + 8px)}.bcm-label__size-large{font-size:14px;line-height:calc(14px + 8px);min-height:calc(14px + 8px)}.bcm-input[no-margin]{margin:0}.bcm-textarea[no-margin]{margin:0}.bcm-switch[no-margin]{margin:0}.bcm-checkbox[no-margin]{margin:0}.bcm-radio-group[no-margin]{margin:0}.bcm-checkbox-group[no-margin]{margin:0}.bcm-range[no-margin]{margin:0}.bcm-form[no-margin]{margin:0}.bcm-form-group[no-margin]{margin:0}.bcm-list[no-margin]{margin:0}.bcm-colorpicker[no-margin]{margin:0}.bcm-date-picker[no-margin]{margin:0}.bcm-time-picker[no-margin]{margin:0}.bcm-datetime-picker[no-margin]{margin:0}.bcm-select[no-margin]{margin:0}.bcm-listbox[no-margin]{margin:0}*{box-sizing:border-box}*{box-sizing:border-box}.bcm-checkbox{outline:none;border:none;--bcm-checkbox-primary-color-default:var(--bcm-new-ds-color-blue-500);--bcm-checkbox-secondary-color-default:var(--bcm-new-ds-color-white);--bcm-checkbox-primary-color-hover:var(--bcm-new-ds-color-blue-600);--bcm-checkbox-secondary-color-hover:var(--bcm-new-ds-color-slate-50);--bcm-checkbox-primary-color-focus-visible:var(--bcm-new-ds-color-blue-800);--bcm-checkbox-secondary-color-focus-visible:var(--bcm-new-ds-color-slate-50);--bcm-checkbox-primary-color-active:var(--bcm-new-ds-color-blue-700);--bcm-checkbox-secondary-color-active:var(--bcm-new-ds-color-slate-50);--bcm-checkbox-primary-color-disabled:var(--bcm-new-ds-color-slate-300);--bcm-checkbox-secondary-color-disabled:var(--bcm-new-ds-color-slate-200);display:inline-flex;width:fit-content;flex-direction:column;margin-bottom:8px}.bcm-checkbox:focus,.bcm-checkbox:hover,.bcm-checkbox:active{outline:none;border:none}.bcm-checkbox *{box-sizing:border-box}.bcm-checkbox input[type=radio],.bcm-checkbox input[type=checkbox]{-webkit-appearance:none;appearance:none;background-color:#fff;margin:0;display:none}.bcm-checkbox__input{display:flex;flex-direction:row;align-items:flex-start;justify-content:flex-start;flex-wrap:nowrap;padding-top:4px}.bcm-checkbox.hidden{display:none}.bcm-checkbox :hover{cursor:pointer}.bcm-checkbox[disabled] :hover,.bcm-checkbox.disabled :hover{cursor:not-allowed}.bcm-checkbox .slot{font-family:\"Inter\", sans-serif;font-size:14px;line-height:calc(14px + 8px);font-weight:400;font-weight:500;color:var(--bcm-new-ds-color-slate-600)}.bcm-checkbox .slot:not(:empty){margin-left:8px;margin-right:8px}.bcm-checkbox-size-small .slot{font-size:12px;line-height:calc(12px + 8px);margin-top:-2.5px}.bcm-checkbox-size-small .bcm-checkbox__input{min-height:calc(24px - 4px)}.bcm-checkbox-size-small .bcm-checkbox__label-icon{width:14px;height:14px;min-width:14px;font-size:calc(10px - 2px)}.bcm-checkbox-size-medium .slot{font-size:calc(12px + 1px);line-height:calc(12px + 8px);margin-top:-1.5px}.bcm-checkbox-size-medium .bcm-checkbox__input{min-height:calc(32px - 4px)}.bcm-checkbox-size-medium .bcm-checkbox__label-icon{width:16px;height:16px;min-width:16px;font-size:10px}.bcm-checkbox-size-large .slot{font-size:16px;line-height:calc(16px + 8px);margin-top:-1.5px}.bcm-checkbox-size-large .bcm-checkbox__input{min-height:calc(32px - 4px)}.bcm-checkbox-size-large .bcm-checkbox__label-icon{width:18px;height:18px;min-width:18px;font-size:12px}.bcm-checkbox__label{display:flex;flex-direction:row;align-items:flex-start;justify-content:flex-start;flex-wrap:nowrap}.bcm-checkbox__label-icon{display:flex;flex-direction:column;align-items:center;justify-content:center;flex-wrap:nowrap;border-width:1px;border-style:solid;border-radius:2px}.bcm-checkbox__label-icon-indeterminate{position:relative}.bcm-checkbox__label-icon-indeterminate:after{content:\"\";display:block;position:absolute;width:70%;height:1.5px;background:var(--bcm-new-ds-color-white)}.bcm-checkbox__label-icon.bcm-radio__icon{width:16px;height:16px;box-sizing:border-box;border-radius:100px}.bcm-checkbox__label-icon.bcm-radio__icon .bcm-radio__icon-inner{width:10px;height:10px;border-radius:100px;background-color:var(--bcm-new-ds-color-white)}.bcm-checkbox .bcm-checkbox__label-icon{background:var(--bcm-checkbox-secondary-color-default);color:var(--bcm-checkbox-secondary-color-default);border-color:var(--bcm-new-ds-color-slate-300)}.bcm-checkbox .bcm-checkbox__label-icon-checked,.bcm-checkbox .bcm-checkbox__label-icon-indeterminate{color:var(--bcm-new-ds-color-white);background-color:var(--bcm-checkbox-primary-color-default);border-color:var(--bcm-checkbox-primary-color-default)}.bcm-checkbox .bcm-checkbox__label-icon-checked.bcm-radio__icon,.bcm-checkbox .bcm-checkbox__label-icon-indeterminate.bcm-radio__icon{border-color:var(--bcm-checkbox-primary-color-default);background-color:var(--bcm-checkbox-secondary-color-default)}.bcm-checkbox .bcm-checkbox__label-icon-checked.bcm-radio__icon .bcm-radio__icon-inner,.bcm-checkbox .bcm-checkbox__label-icon-indeterminate.bcm-radio__icon .bcm-radio__icon-inner{background-color:var(--bcm-checkbox-primary-color-default)}.bcm-checkbox .bcm-checkbox__label-icon-indeterminate{color:var(--bcm-checkbox-primary-color-default)}.bcm-checkbox:hover .bcm-checkbox__label-icon{background:var(--bcm-checkbox-secondary-color-hover);color:var(--bcm-checkbox-secondary-color-hover);border-color:var(--bcm-checkbox-primary-color-hover)}.bcm-checkbox:hover .bcm-checkbox__label-icon-checked,.bcm-checkbox:hover .bcm-checkbox__label-icon-indeterminate{color:var(--bcm-new-ds-color-white);background-color:var(--bcm-checkbox-primary-color-hover);border-color:var(--bcm-checkbox-primary-color-hover)}.bcm-checkbox:hover .bcm-checkbox__label-icon-checked.bcm-radio__icon,.bcm-checkbox:hover .bcm-checkbox__label-icon-indeterminate.bcm-radio__icon{border-color:var(--bcm-checkbox-primary-color-hover);background-color:var(--bcm-checkbox-secondary-color-hover)}.bcm-checkbox:hover .bcm-checkbox__label-icon-checked.bcm-radio__icon .bcm-radio__icon-inner,.bcm-checkbox:hover .bcm-checkbox__label-icon-indeterminate.bcm-radio__icon .bcm-radio__icon-inner{background-color:var(--bcm-checkbox-primary-color-hover)}.bcm-checkbox:hover .bcm-checkbox__label-icon-indeterminate{color:var(--bcm-checkbox-primary-color-hover)}.bcm-checkbox:focus-visible .bcm-checkbox__label-icon{background:var(--bcm-checkbox-secondary-color-focus-visible);color:var(--bcm-checkbox-secondary-color-focus-visible);border-color:var(--bcm-checkbox-primary-color-focus-visible)}.bcm-checkbox:focus-visible .bcm-checkbox__label-icon-checked,.bcm-checkbox:focus-visible .bcm-checkbox__label-icon-indeterminate{color:var(--bcm-new-ds-color-white);background-color:var(--bcm-checkbox-primary-color-focus-visible);border-color:var(--bcm-checkbox-primary-color-focus-visible)}.bcm-checkbox:focus-visible .bcm-checkbox__label-icon-checked.bcm-radio__icon,.bcm-checkbox:focus-visible .bcm-checkbox__label-icon-indeterminate.bcm-radio__icon{border-color:var(--bcm-checkbox-primary-color-focus-visible);background-color:var(--bcm-checkbox-secondary-color-focus-visible)}.bcm-checkbox:focus-visible .bcm-checkbox__label-icon-checked.bcm-radio__icon .bcm-radio__icon-inner,.bcm-checkbox:focus-visible .bcm-checkbox__label-icon-indeterminate.bcm-radio__icon .bcm-radio__icon-inner{background-color:var(--bcm-checkbox-primary-color-focus-visible)}.bcm-checkbox:focus-visible .bcm-checkbox__label-icon-indeterminate{color:var(--bcm-checkbox-primary-color-focus-visible)}.bcm-checkbox:active .bcm-checkbox__label-icon{background:var(--bcm-checkbox-secondary-color-active);color:var(--bcm-checkbox-secondary-color-active);border-color:var(--bcm-checkbox-primary-color-active)}.bcm-checkbox:active .bcm-checkbox__label-icon-checked,.bcm-checkbox:active .bcm-checkbox__label-icon-indeterminate{color:var(--bcm-new-ds-color-white);background-color:var(--bcm-checkbox-primary-color-active);border-color:var(--bcm-checkbox-primary-color-active)}.bcm-checkbox:active .bcm-checkbox__label-icon-checked.bcm-radio__icon,.bcm-checkbox:active .bcm-checkbox__label-icon-indeterminate.bcm-radio__icon{border-color:var(--bcm-checkbox-primary-color-active);background-color:var(--bcm-checkbox-secondary-color-active)}.bcm-checkbox:active .bcm-checkbox__label-icon-checked.bcm-radio__icon .bcm-radio__icon-inner,.bcm-checkbox:active .bcm-checkbox__label-icon-indeterminate.bcm-radio__icon .bcm-radio__icon-inner{background-color:var(--bcm-checkbox-primary-color-active)}.bcm-checkbox:active .bcm-checkbox__label-icon-indeterminate{color:var(--bcm-checkbox-primary-color-active)}.bcm-checkbox[disabled] .bcm-checkbox__label-icon,.bcm-checkbox.disabled .bcm-checkbox__label-icon{background:var(--bcm-checkbox-secondary-color-disabled);color:var(--bcm-checkbox-secondary-color-disabled);border-color:var(--bcm-checkbox-primary-color-disabled)}.bcm-checkbox[disabled] .bcm-checkbox__label-icon-checked,.bcm-checkbox[disabled] .bcm-checkbox__label-icon-indeterminate,.bcm-checkbox.disabled .bcm-checkbox__label-icon-checked,.bcm-checkbox.disabled .bcm-checkbox__label-icon-indeterminate{color:var(--bcm-new-ds-color-white);background-color:var(--bcm-checkbox-primary-color-disabled);border-color:var(--bcm-checkbox-primary-color-disabled)}.bcm-checkbox[disabled] .bcm-checkbox__label-icon-checked.bcm-radio__icon,.bcm-checkbox[disabled] .bcm-checkbox__label-icon-indeterminate.bcm-radio__icon,.bcm-checkbox.disabled .bcm-checkbox__label-icon-checked.bcm-radio__icon,.bcm-checkbox.disabled .bcm-checkbox__label-icon-indeterminate.bcm-radio__icon{border-color:var(--bcm-checkbox-primary-color-disabled);background-color:var(--bcm-checkbox-secondary-color-disabled)}.bcm-checkbox[disabled] .bcm-checkbox__label-icon-checked.bcm-radio__icon .bcm-radio__icon-inner,.bcm-checkbox[disabled] .bcm-checkbox__label-icon-indeterminate.bcm-radio__icon .bcm-radio__icon-inner,.bcm-checkbox.disabled .bcm-checkbox__label-icon-checked.bcm-radio__icon .bcm-radio__icon-inner,.bcm-checkbox.disabled .bcm-checkbox__label-icon-indeterminate.bcm-radio__icon .bcm-radio__icon-inner{background-color:var(--bcm-checkbox-primary-color-disabled)}.bcm-checkbox[disabled] .bcm-checkbox__label-icon-indeterminate,.bcm-checkbox.disabled .bcm-checkbox__label-icon-indeterminate{color:var(--bcm-checkbox-primary-color-disabled)}.bcm-checkbox[no-margin] .bcm-checkbox__input{margin:0;min-height:0;padding:0}.bcm-list{font-family:\"Inter\", sans-serif;font-size:14px;line-height:calc(14px + 8px);font-weight:400;--width:256px;--height:256px;--max-height:inherit;--min-height:inherit;min-width:90px;display:flex;flex-direction:column;margin:0 0 8px 0}.bcm-list__listbox .bcm-list__container{height:var(--height);max-height:var(--max-height);min-height:var(--min-height)}.bcm-list.full-width{width:100%}.bcm-list__size-small .bcm-list__input{height:24px;font-size:12px;line-height:calc(12px + 8px)}.bcm-list__size-small .bcm-list__input .bcm-tag__content.dismissable{font-size:10px;line-height:calc(10px + 8px)}.bcm-list__size-medium .bcm-list__input{height:32px;font-size:14px;line-height:calc(14px + 8px)}.bcm-list__size-medium .bcm-list__input .bcm-tag__content.dismissable{font-size:12px;line-height:calc(12px + 8px)}.bcm-list__size-large .bcm-list__input{height:40px;font-size:16px;line-height:calc(16px + 8px)}.bcm-list__size-large .bcm-list__input .bcm-tag__content.dismissable{font-size:14px;line-height:calc(14px + 8px)}.bcm-list:hover{outline:none}.bcm-list:hover .bcm-list__input{border-color:var(--bcm-new-ds-color-blue-500);background-color:var(--bcm-new-ds-color-slate-50)}.bcm-list:focus-visible{outline:none}.bcm-list:focus-visible .bcm-list__input{border-color:var(--bcm-new-ds-color-blue-600);background-color:var(--bcm-new-ds-color-white)}.bcm-list:active{outline:none}.bcm-list:active .bcm-list__input{border-color:var(--bcm-new-ds-color-blue-600);box-shadow:0 1px 3px 0 rgba(17, 24, 38, 0.1)}.bcm-list__container{--width:256px;--height:256px;width:var(--width);height:var(--height);background-color:var(--bcm-new-ds-color-white);border:1px solid var(--bcm-new-ds-color-slate-300);border-radius:4px;box-sizing:border-box;padding-top:8px;display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;flex-wrap:nowrap;gap:4px}.bcm-list__container main{scroll-behavior:smooth;padding:0 8px;flex:1;overflow:auto;display:flex;flex-direction:column}.bcm-list__container-search{margin:0 8px}.bcm-list__container-search:after{margin:4px 0}.bcm-list__container-no-data{flex:1;display:flex;justify-content:stretch;align-items:stretch;padding-bottom:4px}.bcm-list__container.error{border-color:var(--bcm-color-red-6)}.bcm-list__container.full-width{width:100%}.bcm-list__container.bcm-list__type-linked-component,.bcm-list__container.bcm-list__type-select,.bcm-list__container.bcm-list__type-autocomplete{opacity:0;visibility:hidden;position:absolute;top:0;left:0;height:0;width:0;transform:translateY(10%);z-index:10800;transition:visibility 0s linear 400ms, opacity 100ms, transform 200ms}.bcm-list__container.bcm-list__type-linked-component.bcm-list--top,.bcm-list__container.bcm-list__type-select.bcm-list--top,.bcm-list__container.bcm-list__type-autocomplete.bcm-list--top{transform:translateY(-10%)}.bcm-list__container.bcm-list__type-linked-component.is-open,.bcm-list__container.bcm-list__type-select.is-open,.bcm-list__container.bcm-list__type-autocomplete.is-open{opacity:1;transform:translateY(0);visibility:visible;transition:visibility 0s linear 0s, opacity 100ms, transform 100ms}.bcm-list__container.bcm-list__type-linked-component{margin-top:2px}.bcm-list__label{line-height:1}.bcm-list__input{display:flex;align-items:center;justify-content:space-between;box-sizing:border-box;border:1px solid var(--bcm-new-ds-color-slate-300);border-radius:4px;color:var(--bcm-new-ds-color-slate-600);background-color:var(--bcm-new-ds-color-white);user-select:none;cursor:pointer;padding:0 8px;height:32px;overflow:hidden;position:relative;transition:background-color 100ms, border-color 100ms}.bcm-list__input-spinner{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center;background-color:var(--bcm-color-grey-1);opacity:0;visibility:hidden;transition:opacity 0.2s ease-in-out;z-index:-1}.bcm-list__input-spinner.is-open{opacity:1;visibility:visible;z-index:1}.bcm-list__input-container{flex:1;display:block;overflow:hidden}.bcm-list__input-container.value-empty{color:var(--bcm-color-grey-6)}.bcm-list__input-container.type-single,.bcm-list__input-container.value-empty{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.bcm-list__input-placeholder{color:var(--bcm-color-grey-6)}.bcm-list__input-tag-container{height:100%;width:100%;display:flex;align-items:center;justify-content:flex-start;flex-wrap:nowrap;grid-gap:2px;line-height:1}.bcm-list__input-buttons{display:flex;align-items:center;justify-content:flex-end;grid-gap:4px}.bcm-list__input-buttons-button{display:flex;align-items:center;justify-content:center;box-sizing:border-box;padding:4px 4px 0 4px;font-size:16px;color:var(--bcm-new-ds-color-slate-500)}.bcm-list__input-buttons-button.caret-is{transform:rotate(360deg);transition:transform 0.2s ease-in-out}.bcm-list__input-buttons-button.caret-is-open{transform:rotate(180deg)}.bcm-list__input-buttons:not(.disabled) .bcm-list__input-buttons-button:hover{cursor:pointer;color:var(--bcm-new-ds-color-slate-600)}.bcm-list__input-autocomplete{position:relative;padding-right:0}.bcm-list__input-autocomplete .bcm-list-input-selected-text{background-color:#ffffff;display:flex;align-items:center;justify-content:flex-start;width:calc(100% - 24px);height:100%;padding:0 calc(8px + 4px);position:absolute;top:0;left:0}.bcm-list__input-autocomplete .bcm-list__input-container{height:100%;display:flex;flex-direction:row}.bcm-list__input-autocomplete .bcm-list__input-container .bcm-list__input-tag-container{width:auto}.bcm-list__input-autocomplete .bcm-input,.bcm-list__input-autocomplete .bcm-list__autocomplete{height:100%;min-width:70px;width:100%}.bcm-list__input-autocomplete .bcm-input__container,.bcm-list__input-autocomplete .bcm-list__autocomplete__container{height:100%;border:none;padding:0;width:100%}.bcm-list__input-autocomplete .bcm-input__container:not(.disabled).focused,.bcm-list__input-autocomplete .bcm-input__container:not(.disabled):hover,.bcm-list__input-autocomplete .bcm-list__autocomplete__container:not(.disabled).focused,.bcm-list__input-autocomplete .bcm-list__autocomplete__container:not(.disabled):hover{border:none;box-shadow:none}.bcm-list__autocomplete{width:100%;position:relative}.bcm-list.full-width .bcm-list__container,.bcm-list.full-width .bcm-list__input{width:100%}.bcm-list.error .bcm-list__input{border-color:var(--bcm-color-red-6)}.bcm-list.disabled .bcm-list__container,.bcm-list.disabled .bcm-list__input{color:var(--bcm-new-ds-color-slate-300);background-color:var(--bcm-new-ds-color-slate-50);cursor:not-allowed}.bcm-list.disabled .bcm-tag__content.dismissable .close-button{cursor:default}.bcm-list:not(.disabled) .bcm-list__input .bcm-tag__content.checked .close-button bcm-icon{color:var(--bcm-new-ds-color-slate-100)}.bcm-list:not(.disabled) .bcm-list__input .bcm-tag__content.checked .close-button:hover bcm-icon{color:var(--bcm-new-ds-color-slate-200)}.bcm-list:not(.disabled) .bcm-list__input:hover{border-color:var(--bcm-new-ds-color-blue-500)}.bcm-list:not(.disabled) .bcm-list__input:hover .bcm-tag__content.dismissable:not(.checked){background-color:var(--bcm-new-ds-color-slate-200);border-color:var(--bcm-new-ds-color-slate-200)}.bcm-list:not(.disabled) .bcm-list__input:focus-visible{border-color:var(--bcm-new-ds-color-blue-500);box-shadow:0 1px 3px 0 rgba(17, 24, 38, 0.1)}.bcm-list:not(.disabled) .bcm-list__input:active{border-color:var(--bcm-new-ds-color-blue-500)}.bcm-list__item{padding:2px 0}.bcm-list__item.disabled{user-select:none}.bcm-list__item:focus{outline:none}.bcm-list__item:focus-visible>.bcm-list__item-content{background-color:var(--bcm-new-ds-color-slate-300)}.bcm-list__item:focus-visible>.bcm-list__item-content:not(.disabled){color:var(--bcm-new-ds-color-slate-600)}.bcm-list__item-content{display:flex;flex-direction:row;align-items:stretch;justify-content:flex-start;flex-wrap:nowrap;cursor:pointer;border-radius:4px;padding:0;padding-left:4px;color:var(--bcm-new-ds-color-slate-600);background-color:var(--bcm-new-ds-color-slate-50);transition:background-color 0.2s ease}.bcm-list__item-content.disabled{color:var(--bcm-new-ds-color-slate-300);background-color:var(--bcm-new-ds-color-slate-50);user-select:none;cursor:not-allowed}.bcm-list__item-content.selected{color:var(--bcm-new-ds-color-white);background-color:var(--bcm-new-ds-color-blue-500)}.bcm-list__item-content.selected:hover:not(.disabled){color:var(--bcm-new-ds-color-white);background-color:var(--bcm-new-ds-color-blue-600)}.bcm-list__item-content:hover:not(.disabled){color:var(--bcm-new-ds-color-slate-600);background-color:var(--bcm-new-ds-color-slate-100)}.bcm-list__item-content:active:not(.disabled){color:var(--bcm-new-ds-color-slate-600);background-color:var(--bcm-new-ds-color-slate-200)}.bcm-list__item-content-collapse-icon{width:16px;padding:0 8px;display:flex;align-items:center;justify-content:center;font-size:16px}.bcm-list__item-content-collapse-icon.child{cursor:pointer}.bcm-list__item-content-text{user-select:none;padding:8px;width:100%;display:flex;flex-direction:row;align-items:center;justify-content:flex-start}.bcm-list__item-content-text.treeview{padding:8px 0}.bcm-list__item-content-text-checkbox{display:flex;flex-direction:row;align-items:center;justify-content:center;flex-wrap:nowrap;margin-right:8px}.bcm-list__item-content-text-checkbox .bcm-checkbox{margin:0}.bcm-list__item-content-text-inner{width:100%}.bcm-list__item-content-text mark{padding:0;margin:0;font-size:inherit;color:var(--bcm-color-grey-8);background-color:var(--bcm-color-yellow-4)}.bcm-list__item-childs{padding-left:16px}.bcm-list__item-small{padding:2px 0 2px 8px;font-size:10px;line-height:calc(10px + 8px)}.bcm-list__item-small .bcm-list__item-content-text{padding:3px 4px}.bcm-list__item-medium{font-size:12px;line-height:calc(12px + 8px)}.bcm-list__item-medium .bcm-list__item-content-text{padding:6px 4px}.bcm-list__item-large{font-size:14px;line-height:calc(14px + 8px)}.bcm-list__item-large .bcm-list__item-content-text{padding:9px 4px}.bcm-list__item--readonly:focus>.bcm-list__item-content:not(.disabled),.bcm-list__item--readonly.focused>.bcm-list__item-content:not(.disabled){color:var(--bcm-color-grey-7)}.bcm-list__item--readonly>.bcm-list__item-content{color:var(--bcm-color-grey-7)}.bcm-list__item--readonly>.bcm-list__item-content:hover,.bcm-list__item--readonly>.bcm-list__item-content:focus{color:var(--bcm-color-grey-7)}.bcm-list__item--group{border-radius:4px}.bcm-list__item--group:focus>.bcm-list__item-content:not(.disabled){background-color:var(--bcm-new-ds-color-slate-50);color:var(--bcm-new-ds-color-slate-600)}.bcm-list__item--group>.bcm-list__item-content{background-color:var(--bcm-new-ds-color-slate-50);color:var(--bcm-new-ds-color-slate-600);border-radius:4px 4px 0 0;cursor:default;font-size:14px;line-height:calc(14px + 8px);font-weight:500;position:sticky;top:0}.bcm-list__item--group>.bcm-list__item-content>.bcm-list__item-content-text{padding:4px 8px 4px 16px}.bcm-list__item--group>.bcm-list__item-content:hover,.bcm-list__item--group>.bcm-list__item-content:focus{color:var(--bcm-new-ds-color-slate-800);background-color:var(--bcm-new-ds-color-slate-50)}.bcm-list__item--group>.bcm-list__item-content-unclickable:hover{color:var(--bcm-new-ds-color-slate-700);background-color:var(--bcm-new-ds-color-slate-50)}.bcm-list__item--group>.bcm-list__item-childs{background-color:var(--bcm-new-ds-color-slate-50);color:var(--bcm-new-ds-color-slate-600);padding-bottom:8px;border-radius:0 0 4px 4px;padding-left:8px}.bcm-list__item--group>.bcm-list__item-childs .bcm-list__item-content{background-color:var(--bcm-new-ds-color-white);color:var(--bcm-new-ds-color-slate-600)}.bcm-list__item--group>.bcm-list__item-childs .bcm-list__item-content:hover{background-color:var(--bcm-new-ds-color-slate-100)}.bcm-list__item--group>.bcm-list__item-childs .bcm-list__item-content:active{background-color:var(--bcm-new-ds-color-slate-200)}.bcm-list__item--group>.bcm-list__item-childs .bcm-list__item-content:focus-visible{background-color:var(--bcm-new-ds-color-slate-300)}.bcm-list__item--group>.bcm-list__item-childs .bcm-list__item-content.selected{background-color:var(--bcm-new-ds-color-blue-500);color:var(--bcm-new-ds-color-white)}.bcm-list__item--group>.bcm-list__item-childs .bcm-list__item-content.selected:hover{background-color:var(--bcm-new-ds-color-blue-600)}.bcm-list__item--group>.bcm-list__item-childs .bcm-list__item-content.selected:active{background-color:var(--bcm-new-ds-color-blue-700)}.bcm-list__linked{display:none}.bcm-list .bcm-tag--other .value{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.bcm-info-footer{text-align:right;padding:4px 8px;background-color:var(--bcm-new-ds-color-slate-100);color:var(--bcm-new-ds-color-slate-600);border-radius:0 0 4px 4px}";
846
+
847
+ var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
848
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
849
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
850
+ r = Reflect.decorate(decorators, target, key, desc);
851
+ else
852
+ for (var i = decorators.length - 1; i >= 0; i--)
853
+ if (d = decorators[i])
854
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
855
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
856
+ };
857
+ const BcmList = class {
858
+ constructor(hostRef) {
859
+ registerInstance(this, hostRef);
860
+ this.bcmChecklist = createEvent(this, "bcm-checklist", 7);
861
+ this.bcmSelected = createEvent(this, "bcm-selected", 7);
862
+ this.change = createEvent(this, "bcm-change", 7);
863
+ this.open = createEvent(this, "bcm-open", 7);
864
+ this.close = createEvent(this, "bcm-close", 7);
865
+ this.debounce = null;
866
+ this.debounceHandler = Generate.debounceInput(() => this.listenResize(), 300, false);
867
+ this._id = Generate.UID();
868
+ this.type = Bcm$1.ListType.listbox;
869
+ this.treeview = false;
870
+ this.checkboxes = false;
871
+ this.searchable = false;
872
+ this.value = null;
873
+ this.inputText = undefined;
874
+ this.name = undefined;
875
+ this.label = undefined;
876
+ this.size = Bcm$1.Size.medium;
877
+ this.disabled = false;
878
+ this.readonly = false;
879
+ this.highlight = false;
880
+ this.highlightText = undefined;
881
+ this.required = false;
882
+ this.hidden = false;
883
+ this.fullWidth = false;
884
+ this.height = "256px";
885
+ this.maxHeight = "500px";
886
+ this.minHeight = "150px";
887
+ this.width = "256px";
888
+ this.infoFooter = false;
889
+ this.variableText = "item";
890
+ this.template = undefined;
891
+ this.allOpen = false;
892
+ this.keyControl = false;
893
+ this.checkAll = true;
894
+ this.stopDeepClean = false;
895
+ this.linkedComponent = undefined;
896
+ this.isOpen = false;
897
+ this.calculatedViewport = false;
898
+ this.isSelectedOther = false;
899
+ this.isHaveOtherTag = false;
900
+ this.placeholder = "Choose an option";
901
+ this.searchPlaceholder = "Search";
902
+ this.searchIsOnlyChilds = false;
903
+ this.minSearchLength = 2;
904
+ this.clearable = false;
905
+ this.caption = undefined;
906
+ this.noCaption = false;
907
+ this.captionType = Bcm$1.Status.default;
908
+ this.captionError = undefined;
909
+ this.emptyText = undefined;
910
+ this.emptyIcon = "fad fa-folder-open";
911
+ this.captionCache = undefined;
912
+ this.captionTypeCache = undefined;
913
+ this.tick = {};
914
+ this.totalData = 0;
915
+ this.totalRootData = 0;
916
+ this.limit = 20;
917
+ this.searchGetParents = undefined;
918
+ this.searchResultLimit = 20;
919
+ this.searchFound = null;
920
+ this.returnFilterData = {};
921
+ this.returnOtherData = {};
922
+ this.options = {
923
+ rootMargin: "30px",
924
+ };
925
+ this.tagContainerWidth = 0;
926
+ this.selectAllItem = {
927
+ id: "select-all",
928
+ text: "Select All",
929
+ value: "select-all",
930
+ checked: false,
931
+ disabled: false,
932
+ icon: "",
933
+ status: Bcm$1.Status.default,
934
+ indeterminate: "uncheck",
935
+ };
936
+ this.placement = Bcm$1.Placement["bottom-start"];
937
+ this.data = [];
938
+ }
939
+ connectedCallback() {
940
+ if (this.height != "256px") {
941
+ if (this.height.indexOf("px") > -1) {
942
+ this.limit = Math.floor(+this.height.replace("px", "") / 10);
943
+ }
944
+ else {
945
+ this.limit = Math.floor(+(window.innerHeight / 10));
946
+ }
947
+ this.searchResultLimit = this.limit;
948
+ this.markForCheck();
949
+ }
950
+ const checkElementWithDom = document.querySelectorAll(`#bcm-list-${this._id}`);
951
+ (checkElementWithDom === null || checkElementWithDom === void 0 ? void 0 : checkElementWithDom.length) > 1 && checkElementWithDom.forEach((item, index) => index > 0 && item.remove());
952
+ }
953
+ componentWillRender() {
954
+ this.calculateLocation();
955
+ }
956
+ componentShouldUpdate(newVal, oldVal, propName) {
957
+ if (Object.keys(this.getOptions()).indexOf(propName) > -1 && newVal !== oldVal) {
958
+ this.updateOptions();
959
+ }
960
+ }
961
+ get containerWidth() {
962
+ var _a, _b;
963
+ return (_b = (_a = this.el) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.width;
964
+ }
965
+ get tagCount() {
966
+ return this.containerWidth > 0 ? Math.floor(+(this.containerWidth - 100) / 85) : 0;
967
+ }
968
+ get tagData() {
969
+ return snq(() => {
970
+ var _a;
971
+ return (_a = this.value) === null || _a === void 0 ? void 0 : _a.map(item => ({
972
+ value: item.id,
973
+ label: StringHelper.textLimitter(item.text, 7),
974
+ text: item.tooltipMessage || item.tagTitle || item.text,
975
+ }));
976
+ }, []);
977
+ }
978
+ async componentDidLoad() {
979
+ await this.initState();
980
+ if (this.type == "select" || this.type == "autocomplete" || this.linkedComponent) {
981
+ const list = this.el.querySelector(`#bcm-list-${this._id}`);
982
+ if (list) {
983
+ document.body.appendChild(list);
984
+ }
985
+ }
986
+ }
987
+ disconnectedCallback() {
988
+ this.isOpen = false;
989
+ if (this.stopDeepClean)
990
+ return;
991
+ listState.removeState(this._id);
992
+ this.el.innerHTML = "";
993
+ if (this.type == "select" || this.type == "autocomplete" || this.linkedComponent) {
994
+ const list = document.querySelectorAll(`#bcm-list-${this._id}`);
995
+ if (list === null || list === void 0 ? void 0 : list.length) {
996
+ list.forEach(item => item.remove());
997
+ this.el.remove();
998
+ }
999
+ }
1000
+ }
1001
+ watchId(_, oldVal) {
1002
+ // console.info('Changed component id:', oldVal + ' -> ' + newVal);
1003
+ listState.removeState(oldVal);
1004
+ this.initState();
1005
+ }
1006
+ handleValueChange(newVal, oldVal) {
1007
+ var _a;
1008
+ if (Generate.objectIsEmpty(this.returnFilterData)) {
1009
+ this.handleIndeterminate(((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) || 0, this.totalData);
1010
+ }
1011
+ if (this.checkboxes) {
1012
+ if (!Validators.compareTwoArrayIsSame(newVal, oldVal)) {
1013
+ this.bcmChecklist.emit(this.value);
1014
+ this.change.emit(this.value);
1015
+ }
1016
+ }
1017
+ else {
1018
+ if ((newVal === null || newVal === void 0 ? void 0 : newVal.id) != (oldVal === null || oldVal === void 0 ? void 0 : oldVal.id)) {
1019
+ this.change.emit(this.value);
1020
+ }
1021
+ }
1022
+ }
1023
+ watchReturnFilterData(newVal) {
1024
+ var _a;
1025
+ const { checkedItems, visibledItems } = newVal;
1026
+ if (checkedItems && visibledItems) {
1027
+ this.handleIndeterminate(checkedItems.length, visibledItems.length);
1028
+ }
1029
+ else {
1030
+ this.handleIndeterminate(((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) || 0, this.totalData);
1031
+ }
1032
+ }
1033
+ async handleOpen() {
1034
+ if (this.isOpen) {
1035
+ this.open.emit();
1036
+ this.calculateLocation();
1037
+ this.onSelectSearch();
1038
+ }
1039
+ else {
1040
+ this.listScrollToTop();
1041
+ this.close.emit();
1042
+ await delay(100);
1043
+ this.unSelectOther();
1044
+ }
1045
+ }
1046
+ listScrollToTop() {
1047
+ const list = document.querySelector(`#bcm-list-${this._id}`);
1048
+ if (list) {
1049
+ list.querySelector(".scrolling").scrollTop = 0;
1050
+ }
1051
+ }
1052
+ async dataChanged(newValue, oldValue) {
1053
+ if (!Validators.compareTwoArrayIsSame(newValue, oldValue)) {
1054
+ await this.initState();
1055
+ }
1056
+ }
1057
+ isIntersecting(e) {
1058
+ const target = e === null || e === void 0 ? void 0 : e.target;
1059
+ if (target && target.id === this._id) {
1060
+ this.listenResize();
1061
+ }
1062
+ }
1063
+ handleSlotItems(e) {
1064
+ var _a;
1065
+ if (((_a = e === null || e === void 0 ? void 0 : e.detail) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1066
+ this.data = e.detail;
1067
+ }
1068
+ }
1069
+ handleChange(e) {
1070
+ if (e.target.id == `bcm-list-input-tag-container-${this._id}-autocomplete-input`) {
1071
+ e.stopImmediatePropagation();
1072
+ }
1073
+ }
1074
+ handleResize() {
1075
+ this.calculateLocation();
1076
+ this.debounceHandler();
1077
+ }
1078
+ handleWheel(event) {
1079
+ if (this.isOpen) {
1080
+ const list = document.querySelector(`#bcm-list-${this._id}`);
1081
+ const isClickInside = list && Generate.findEventPath(event, list);
1082
+ if (isClickInside) {
1083
+ if (this.type == "select" || this.type == "autocomplete" || this.linkedComponent) {
1084
+ this.calculateLocation();
1085
+ }
1086
+ }
1087
+ else {
1088
+ this.hide();
1089
+ }
1090
+ }
1091
+ }
1092
+ clearAutocomplete() {
1093
+ if (this.type == "autocomplete") {
1094
+ const autocompleteInput = this.getAutoCompleteInput();
1095
+ if (autocompleteInput) {
1096
+ autocompleteInput.handleClear(false);
1097
+ }
1098
+ }
1099
+ }
1100
+ async handleSelectOtherTag(e) {
1101
+ if (this.disabled)
1102
+ return;
1103
+ const { id, checked } = e.detail;
1104
+ this.isSelectedOther = checked;
1105
+ if (id) {
1106
+ checked ? this.filterOtherList(id) : this.unSelectOther();
1107
+ this.isOpen = true;
1108
+ }
1109
+ }
1110
+ async handleDeleteTag(e) {
1111
+ var _a;
1112
+ if (this.disabled)
1113
+ return;
1114
+ const { id } = e.detail;
1115
+ this.isSelectedOther && this.unSelectOther();
1116
+ Array.isArray(id) ? listState.removeOtherTags(this._id, id) : listState.checkedItem(this._id, id);
1117
+ this.value = (await this.getCheckedList()).checkedList;
1118
+ this.handleIndeterminate(((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) || 0, this.totalData);
1119
+ }
1120
+ async handleSelectTag(_) {
1121
+ if (this.disabled)
1122
+ return;
1123
+ this.clearAutocomplete();
1124
+ this.onSelectSearch();
1125
+ this.unSelectOther();
1126
+ }
1127
+ handleClick(event) {
1128
+ var _a;
1129
+ if (this.disabled)
1130
+ return;
1131
+ const list = document.querySelector(`#bcm-list-${this._id}`);
1132
+ const isClickInside = Generate.findEventPath(event, this.el) || (list && Generate.findEventPath(event, list));
1133
+ if (isClickInside) {
1134
+ if (this.debounce !== null) {
1135
+ event.preventDefault();
1136
+ event.stopPropagation();
1137
+ clearTimeout(this.debounce);
1138
+ this.debounce = null;
1139
+ }
1140
+ this.debounce = setTimeout(() => {
1141
+ this.debounce = null;
1142
+ }, 300);
1143
+ }
1144
+ if (!isClickInside) {
1145
+ if (this.type == "autocomplete") {
1146
+ const autocompleteInput = this.getAutoCompleteInput();
1147
+ if (autocompleteInput) {
1148
+ if (this.checkboxes) {
1149
+ autocompleteInput.setValue("");
1150
+ }
1151
+ else {
1152
+ autocompleteInput.setValue(((_a = this.value) === null || _a === void 0 ? void 0 : _a.text) || "");
1153
+ }
1154
+ }
1155
+ }
1156
+ }
1157
+ const clickToTag = Generate.findEventPathWithKey(event, "className", ["bcm-tag"]);
1158
+ const clickToOtherTag = Generate.findEventPathWithKey(event, "className", ["bcm-tag bcm-tag--other"]);
1159
+ const clickToSelect = Generate.findEventPathWithKey(event, "id", [`bcm-list-input-${this._id}`, `bcm-list-label-${this._id}`]);
1160
+ const clickToTagDismiss = Generate.findEventPathWithKey(event, "className", ["right close-button"]);
1161
+ if (clickToSelect && !clickToTagDismiss && this.type != "autocomplete") {
1162
+ this.isOpen = clickToTag || clickToOtherTag ? true : !this.isOpen;
1163
+ }
1164
+ if (list) {
1165
+ if (this.isOpen) {
1166
+ if (!list.contains(event.target) && !this.el.contains(event.target)) {
1167
+ this.isOpen = false;
1168
+ // this.unSelectOther()
1169
+ }
1170
+ }
1171
+ }
1172
+ }
1173
+ bcmOnSearchClear(event) {
1174
+ var _a, _b;
1175
+ if (this.type == "autocomplete") {
1176
+ if (((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.id) === `bcm-list-${this._id}-search` || ((_b = event === null || event === void 0 ? void 0 : event.target) === null || _b === void 0 ? void 0 : _b.id) === `bcm-list-input-tag-container-${this._id}-autocomplete-input`) {
1177
+ if (event.detail) {
1178
+ this.setClear();
1179
+ }
1180
+ }
1181
+ }
1182
+ }
1183
+ bcmOnSearch(event) {
1184
+ var _a, _b, _c, _d, _e, _f;
1185
+ if (((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.id) === `bcm-list-${this._id}-search` || ((_b = event === null || event === void 0 ? void 0 : event.target) === null || _b === void 0 ? void 0 : _b.id) === `bcm-list-input-tag-container-${this._id}-autocomplete-input`) {
1186
+ this.searchGetParents = snq(() => { var _a; return (_a = event.detail) === null || _a === void 0 ? void 0 : _a.parentIndex; }, null);
1187
+ this.searchResultLimit = 10;
1188
+ this.searchFound = ((_c = event.detail) === null || _c === void 0 ? void 0 : _c.matching) != null ? (_d = event.detail) === null || _d === void 0 ? void 0 : _d.matching.length : null;
1189
+ this.returnFilterData = listState.filterData(this._id, (_e = event.detail) === null || _e === void 0 ? void 0 : _e.nestedResult);
1190
+ if (this.searchFound > 0 && this.highlight) {
1191
+ this.highlightText = (_f = event.detail) === null || _f === void 0 ? void 0 : _f.value;
1192
+ }
1193
+ if (this.type == "autocomplete") {
1194
+ this.isOpen = true;
1195
+ }
1196
+ if (!event.detail.result) {
1197
+ if (this.type == "autocomplete") {
1198
+ this.isOpen = false;
1199
+ }
1200
+ else {
1201
+ this.returnFilterData = {};
1202
+ listState.filterData(this._id, null);
1203
+ }
1204
+ // this.isSelectedOther = false
1205
+ this.searchResultLimit = null;
1206
+ this.highlightText = null;
1207
+ }
1208
+ this.markForCheck();
1209
+ }
1210
+ }
1211
+ //keyboard navigation
1212
+ handleKeyDown(ev) {
1213
+ const keycode = ev.keyCode || ev.which;
1214
+ if (keycode === Bcm$1.KeyCode.escape) {
1215
+ if (this.isOpen) {
1216
+ this.isOpen = false;
1217
+ ev.preventDefault();
1218
+ ev.stopPropagation();
1219
+ ev.stopImmediatePropagation();
1220
+ }
1221
+ }
1222
+ if (this.keyControl) {
1223
+ const keyboard = new ListKeyControl(keycode, this.el, this.treeview, this.checkboxes);
1224
+ keyboard.openGroup = openGroupId => {
1225
+ this.openGroup(openGroupId);
1226
+ };
1227
+ keyboard.checkedItem = checkedItemId => {
1228
+ this.checkedItem(checkedItemId);
1229
+ };
1230
+ keyboard.keyDown();
1231
+ }
1232
+ }
1233
+ handleKeyUp(ev) {
1234
+ if (this.keyControl) {
1235
+ const focusedList = Generate.findEventPath(ev, this.el);
1236
+ if (focusedList) {
1237
+ const list = document.getElementById(`bcm-list-${this._id}`);
1238
+ if (list) {
1239
+ const items = list.querySelectorAll(".bcm-list__item.focused");
1240
+ if (items.length > 0) {
1241
+ const main = list.querySelector("main");
1242
+ const itemHeight = items[0].offsetHeight;
1243
+ const listHeight = main.offsetHeight;
1244
+ const itemTop = items[0].offsetTop;
1245
+ if (itemTop > listHeight) {
1246
+ main.scrollTop = itemTop - listHeight / 2 + itemHeight / 2;
1247
+ }
1248
+ if (itemTop < listHeight) {
1249
+ main.scrollTop = itemTop - listHeight / 2 - itemHeight / 2;
1250
+ }
1251
+ }
1252
+ }
1253
+ }
1254
+ }
1255
+ }
1256
+ async set(data) {
1257
+ if (data) {
1258
+ if (Array.isArray(data)) {
1259
+ this.addChecked(data);
1260
+ }
1261
+ if (typeof data === "string" || typeof data === "number") {
1262
+ this.selectedItem(data);
1263
+ }
1264
+ }
1265
+ else {
1266
+ this.setClear();
1267
+ }
1268
+ }
1269
+ async get() {
1270
+ var _a, _b;
1271
+ return this.value ? (this.checkboxes ? (_b = (_a = ((await this.getCheckedList()))) === null || _a === void 0 ? void 0 : _a.checkedList) === null || _b === void 0 ? void 0 : _b.map(item => item.id) : this.value.id) : null;
1272
+ }
1273
+ async getCheckedList() {
1274
+ return Promise.resolve(listState.getCheckedList(this._id));
1275
+ }
1276
+ async getSelected() {
1277
+ return Promise.resolve(listState.getSelected(this._id));
1278
+ }
1279
+ async getValue() {
1280
+ return Promise.resolve(this.value);
1281
+ }
1282
+ async addChecked(ids = [], save = false, emit = true) {
1283
+ if (ids && ids.length > 0) {
1284
+ if (!save) {
1285
+ listState.setClear(this._id);
1286
+ await delay(10);
1287
+ }
1288
+ await listState.addChecked(this._id, ids);
1289
+ await delay(10);
1290
+ emit && (this.value = (await this.getCheckedList()).checkedList);
1291
+ this.markForCheck();
1292
+ }
1293
+ return Promise.resolve(this.value);
1294
+ }
1295
+ async selected(id) {
1296
+ if (id) {
1297
+ return Promise.resolve(await this.selectedItem(id));
1298
+ }
1299
+ return false;
1300
+ }
1301
+ async setClear(e) {
1302
+ listState.setClear(this._id);
1303
+ this.value = null;
1304
+ this.inputText = "";
1305
+ this.isOpen = false;
1306
+ this.selectAllItem.indeterminate = "uncheck";
1307
+ this.markForCheck();
1308
+ if (e) {
1309
+ e.stopPropagation();
1310
+ e.preventDefault();
1311
+ }
1312
+ await delay(10);
1313
+ return Promise.resolve();
1314
+ }
1315
+ async resetCaption() {
1316
+ await delay(10);
1317
+ this.caption = this.captionCache;
1318
+ this.captionType = this.captionTypeCache;
1319
+ this.captionError = null;
1320
+ await delay(10);
1321
+ return Promise.resolve();
1322
+ }
1323
+ async show() {
1324
+ this.isOpen = true;
1325
+ return Promise.resolve();
1326
+ }
1327
+ async hide() {
1328
+ this.isOpen = false;
1329
+ return Promise.resolve();
1330
+ }
1331
+ updateOptions() {
1332
+ listState.updateOptions(this._id, this);
1333
+ }
1334
+ handleIndeterminate(checkeds, total) {
1335
+ this.selectAllItem = Object.assign(Object.assign({}, this.selectAllItem), { indeterminate: this.checkboxes && checkeds > 0 ? (checkeds === total ? "check" : "indeterminate") : "uncheck", checked: this.checkboxes && checkeds > 0 ? (checkeds === total ? true : false) : false });
1336
+ }
1337
+ listenResize() {
1338
+ this.calculateLocation();
1339
+ this.markForCheck();
1340
+ }
1341
+ async unSelectOther() {
1342
+ await this.onClearSearch();
1343
+ this.isSelectedOther = false;
1344
+ this.searchFound = null;
1345
+ this.returnFilterData = {};
1346
+ listState.filterData(this._id, null);
1347
+ await delay(10);
1348
+ return Promise.resolve();
1349
+ }
1350
+ async onClearSearch() {
1351
+ const searchInput = document.getElementById(`bcm-list-${this._id}-search`);
1352
+ if (searchInput) {
1353
+ await searchInput.handleClear();
1354
+ }
1355
+ return Promise.resolve();
1356
+ }
1357
+ async onSelectSearch() {
1358
+ const searchInput = document.getElementById(`bcm-list-${this._id}-search`);
1359
+ if (searchInput) {
1360
+ await delay(100);
1361
+ searchInput.onBcmFocus();
1362
+ searchInput.onBcmSelect();
1363
+ }
1364
+ }
1365
+ async filterOtherList(ids) {
1366
+ const checklist = (await this.getCheckedList()).nestedResult;
1367
+ const filter = Generate.convertIdsToNestedData(ids, checklist);
1368
+ this.returnFilterData = await listState.filterData(this._id, filter, null, true);
1369
+ this.searchFound = (ids === null || ids === void 0 ? void 0 : ids.length) || 0;
1370
+ this.limit = 500;
1371
+ this.searchGetParents = null;
1372
+ await delay(1000);
1373
+ this.markForCheck();
1374
+ }
1375
+ async initState() {
1376
+ var _a, _b, _c;
1377
+ this.onClearSearch();
1378
+ await listState.setValue({
1379
+ id: this._id,
1380
+ dataSource: this.data && snq(() => (typeof this.data == "string" ? JSON.parse(this.data) : this.data), []),
1381
+ options: this,
1382
+ });
1383
+ const { totalRoots, totalItems } = listState.getValue(this._id);
1384
+ this.totalData = totalItems;
1385
+ this.totalRootData = totalRoots;
1386
+ this.value = this.checkboxes ? (await this.getCheckedList()).checkedList : listState.selectedItem(this._id) ? listState.selectedItem(this._id)[0] : null;
1387
+ if (!this.checkboxes) {
1388
+ this.inputText = ((_a = this.value) === null || _a === void 0 ? void 0 : _a.text) || null;
1389
+ }
1390
+ // checkli olan subparentların indeterminate kontrolü için
1391
+ if (this.checkboxes && ((_b = this.value) === null || _b === void 0 ? void 0 : _b.length) > 0) {
1392
+ const checkedIDs = [];
1393
+ this.value.forEach(item => {
1394
+ if (!item.items || item.items.length === 0) {
1395
+ checkedIDs.push(item.id);
1396
+ }
1397
+ });
1398
+ await this.addChecked(checkedIDs, false, false);
1399
+ }
1400
+ await this.handleIndeterminate((_c = this.value) === null || _c === void 0 ? void 0 : _c.length, this.totalData);
1401
+ await this.markForCheck();
1402
+ }
1403
+ async markForCheck() {
1404
+ await delay(10);
1405
+ this.tick = Generate.UID();
1406
+ }
1407
+ getOptions() {
1408
+ return snq(() => listState.getValue(this._id).options, {});
1409
+ }
1410
+ getItems() {
1411
+ if (this.isSelectedOther) {
1412
+ return this.returnFilterData["checkedItems"];
1413
+ }
1414
+ return snq(() => listState.getData(this._id), []);
1415
+ }
1416
+ getLimitedItems(ids) {
1417
+ return snq(() => listState.getDataPagination(this._id, this.searchResultLimit || this.limit, ids), []);
1418
+ }
1419
+ openGroup(parentId) {
1420
+ listState.openGroup(this._id, parentId);
1421
+ this.markForCheck();
1422
+ }
1423
+ focusItem(e) {
1424
+ if (e.target.classList.contains("bcm-list__item")) {
1425
+ const item = e.target;
1426
+ const list = document.getElementById(`bcm-list-${this._id}`);
1427
+ if (list) {
1428
+ const items = list.querySelectorAll(".bcm-list__item");
1429
+ if (items.length > 0) {
1430
+ const selectedItem = list.querySelector(".bcm-list__item.focused");
1431
+ if (selectedItem) {
1432
+ selectedItem.classList.remove("focused");
1433
+ }
1434
+ item.classList.add("focused");
1435
+ }
1436
+ }
1437
+ }
1438
+ }
1439
+ async selectedItem(itemId) {
1440
+ var _a;
1441
+ if (!this.checkboxes) {
1442
+ this.value = listState.selectedItem(this._id, itemId) ? listState.selectedItem(this._id, itemId)[0] : null;
1443
+ this.inputText = ((_a = this.value) === null || _a === void 0 ? void 0 : _a.text) || null;
1444
+ this.isOpen = false;
1445
+ this.markForCheck();
1446
+ if (this.type == "autocomplete" && this.value) {
1447
+ // await delay(100)
1448
+ // this.resetCaption()
1449
+ const autocompleteInput = this.getAutoCompleteInput();
1450
+ if (autocompleteInput) {
1451
+ setTimeout(() => {
1452
+ var _a;
1453
+ autocompleteInput.setValue(((_a = this.value) === null || _a === void 0 ? void 0 : _a.text) || "");
1454
+ this.isOpen = false;
1455
+ }, 100);
1456
+ }
1457
+ }
1458
+ }
1459
+ return Promise.resolve(this.value);
1460
+ }
1461
+ async checkedItem(itemId) {
1462
+ const isCheckSelectAll = itemId === "select-all";
1463
+ if (!isCheckSelectAll) {
1464
+ listState.checkedItem(this._id, itemId);
1465
+ }
1466
+ else {
1467
+ listState.selectAll(this._id, !this.selectAllItem.checked);
1468
+ }
1469
+ this.value = (await this.getCheckedList()).checkedList;
1470
+ this.changeVisibleCheckeds();
1471
+ this.markForCheck();
1472
+ }
1473
+ changeVisibleCheckeds() {
1474
+ const { visibledItems } = this.returnFilterData;
1475
+ this.returnFilterData = {
1476
+ visibledItems,
1477
+ checkedItems: (visibledItems && visibledItems.filter(item => item.checked)) || [],
1478
+ };
1479
+ }
1480
+ getAutoCompleteInput() {
1481
+ return document.getElementById(`bcm-list-input-tag-container-${this._id}-autocomplete-input`);
1482
+ }
1483
+ dataScrollEvent(event) {
1484
+ let count = 0;
1485
+ let io = new IntersectionObserver((data) => {
1486
+ if (count === 0) {
1487
+ count++;
1488
+ if (data[0].isIntersecting) {
1489
+ this.limit += 15;
1490
+ this.searchResultLimit += 15;
1491
+ io.disconnect();
1492
+ io = null;
1493
+ }
1494
+ }
1495
+ }, this.options);
1496
+ io.observe(event.target.lastElementChild);
1497
+ }
1498
+ async calculateLocation() {
1499
+ var _a, _b;
1500
+ if (this.type == "select" || this.type == "autocomplete" || this.linkedComponent) {
1501
+ const list = document.getElementById(`bcm-list-${this._id}`);
1502
+ // list && (list.style.height = '256px') //sebebi neydi ki!
1503
+ var placement = this.placement;
1504
+ const targetElementId = this.linkedComponent ? this.linkedComponent : `bcm-list-input-${this._id}`;
1505
+ const targetElement = document.getElementById(targetElementId);
1506
+ if (list && targetElement) {
1507
+ getPlacement(list, targetElement, placement, (place) => (placement = place));
1508
+ await delay(10);
1509
+ let pos = setPosition(placement, targetElement);
1510
+ let captionAreaHeight = 0;
1511
+ let labelAreaHeight = 0;
1512
+ if (this.linkedComponent) {
1513
+ const linked = document.getElementById(this.linkedComponent);
1514
+ if (linked) {
1515
+ if (!linked["noCaption"]) {
1516
+ const captionArea = ((_a = linked.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(".bcm-caption-area")) || linked.querySelector(".bcm-caption-area");
1517
+ if (captionArea) {
1518
+ captionAreaHeight = captionArea.offsetHeight || captionArea.clientHeight;
1519
+ }
1520
+ }
1521
+ const labelArea = ((_b = linked.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector(".bcm-label")) || linked.querySelector(".bcm-label");
1522
+ if (labelArea) {
1523
+ labelAreaHeight = labelArea.offsetHeight || labelArea.clientHeight;
1524
+ }
1525
+ }
1526
+ }
1527
+ if (this.fullWidth) {
1528
+ list.style.width = targetElement.offsetWidth + "px";
1529
+ }
1530
+ else {
1531
+ list.style.width = this.width || "auto";
1532
+ }
1533
+ if (this.height.indexOf("%") > -1) {
1534
+ list.style.height = NumberHelper.toNumber(this.height) * 0.01 * window.innerHeight - pos[0] - 50 + "px";
1535
+ }
1536
+ else {
1537
+ list.style.height = this.height;
1538
+ }
1539
+ list.style.minHeight = this.minHeight;
1540
+ // const calculatedMaxHeight = window.innerHeight - pos[0] - 50;
1541
+ const calculatedMaxHeight = placement.split("-")[0] == "top" ? window.innerHeight - (window.innerHeight - pos[0]) - 50 : window.innerHeight - pos[0] - 50;
1542
+ if (this.maxHeight.indexOf("%") > -1) {
1543
+ list.style.maxHeight = NumberHelper.toNumber(this.maxHeight) * 0.01 * calculatedMaxHeight + "px";
1544
+ }
1545
+ else {
1546
+ list.style.maxHeight = NumberHelper.toNumber(this.maxHeight) < calculatedMaxHeight ? this.maxHeight : calculatedMaxHeight + "px";
1547
+ }
1548
+ getPlacement(list, targetElement, placement, (place) => (placement = place));
1549
+ await delay(10);
1550
+ pos = setPosition(placement, targetElement);
1551
+ list.style.top = (placement.split("-")[0] == "top" ? pos[0] - list.offsetHeight + labelAreaHeight : pos[0] - captionAreaHeight) + "px";
1552
+ // list.style.left = pos[1] + 'px';
1553
+ list.style.left = placement.split("-")[1] == "end" ? pos[1] - list.offsetWidth + "px" : pos[1] + "px";
1554
+ list.classList.toggle("bcm-list--top", placement.split("-")[0] == "top");
1555
+ this.calculatedViewport = true;
1556
+ }
1557
+ }
1558
+ }
1559
+ render() {
1560
+ const { checkboxes, treeview, label, size, disabled, readonly, required, hidden, fullWidth, searchable } = this.getOptions();
1561
+ const hostClasses = classnames("bcm-list", `bcm-list__size-${size}`, `bcm-list__${this.type}`, size === "large" ? "size-3" : "size-2", {
1562
+ "error": this.captionType == Bcm$1.Status.error,
1563
+ "full-width": fullWidth,
1564
+ "bcm-list__linked": this.linkedComponent,
1565
+ hidden,
1566
+ readonly,
1567
+ disabled,
1568
+ });
1569
+ const bcmListContainer = classnames("bcm-list__container", this.linkedComponent ? "bcm-list__type-linked-component" : `bcm-list__type-${this.type}`, {
1570
+ "is-open": this.isOpen && this.calculatedViewport,
1571
+ "error": this.captionType == Bcm$1.Status.error,
1572
+ "full-width": fullWidth,
1573
+ hidden,
1574
+ readonly,
1575
+ disabled,
1576
+ });
1577
+ const bcmListInput = classnames("bcm-list__input");
1578
+ const openedType = this.type == "select" || this.type == "autocomplete" || this.linkedComponent;
1579
+ return (h$1(Host, { class: hostClasses, tabindex: "0", style: {
1580
+ "--width": fullWidth ? "100%" : this.width,
1581
+ "--height": openedType ? "100%" : this.height,
1582
+ "--max-height": openedType ? "inherit" : this.maxHeight,
1583
+ "--min-height": openedType ? "inherit" : this.minHeight,
1584
+ } }, h$1("div", { id: `bcm-list-label-${this._id}`, class: "bcm-list__label" }, label && (h$1("div", null, h$1(LabelTemplate, { size: this.size, type: this.captionType, value: label, required: required, htmlFor: this._id })))), this.type == "select" && (h$1("div", { id: `bcm-list-input-${this._id}`, class: bcmListInput }, h$1("span", { class: classnames("bcm-list__input-container", { "type-single": !checkboxes, "value-empty": !this.value }) }, this.checkboxes ? (this.value && this.value.length > 0 ? (h$1("bcm-rc-overflow", { data: this.tagData, maxCount: this.tagCount })) : (h$1("span", { class: "bcm-list__input-placeholder" }, this.placeholder))) : this.value ? (this.inputText) : (h$1("span", { class: "bcm-list__input-placeholder" }, this.placeholder))), h$1("span", { class: classnames("bcm-list__input-buttons", {
1585
+ disabled: disabled,
1586
+ }) }, this.clearable && this.value && (h$1("div", { class: "bcm-list__input-buttons-button" }, h$1("bcm-icon", { icon: "fal fa-times", onClick: e => !disabled && this.setClear(e) }))), h$1("div", { class: `bcm-list__input-buttons-button caret-is ${this.isOpen && this.calculatedViewport && "caret-is-open"}` }, h$1("bcm-icon", { icon: `far fa-angle-down` }))))), this.type === "autocomplete" && (h$1("div", { id: `bcm-list-input-${this._id}`, class: classnames(bcmListInput, { "bcm-list__input-autocomplete": this.type == "autocomplete" }) }, h$1("span", { class: "bcm-list__input-container", id: `bcm-list-input-tag-container-${this._id}` }, this.checkboxes && h$1("span", { class: "bcm-list__input-tag-container", id: `bcm-list-input-tag-container-${this._id}-autocomplete` }), h$1("bcm-search", { id: `bcm-list-input-tag-container-${this._id}-autocomplete-input`, class: "bcm-list__autocomplete", data: this.data, clearable: true, "full-width": true, "no-caption": true, placeholder: this.placeholder })))), h$1(ListTemplate, { highlight: this.highlightText, searchable: this.type == "autocomplete" ? false : searchable, bcmListContainer: bcmListContainer, checkboxes: checkboxes, treeview: treeview, infoFooter: this.infoFooter, value: this.value, totalData: this.totalData, searchFound: this.searchFound, variableText: this.variableText, searchPlaceholder: this.searchPlaceholder, minSearchLength: this.minSearchLength, searchIsOnlyChilds: this.searchIsOnlyChilds, _id: this._id, checkAll: this.checkAll, data: this.getItems(), width: this.width, height: this.height, size: this.size, selectAllItem: this.selectAllItem, onScrollEvent: e => this.dataScrollEvent(e), items: this.getLimitedItems(this.searchGetParents), selectedItem: itemId => this.selectedItem(itemId), checkedItem: itemId => this.checkedItem(itemId), openGroup: parentId => this.openGroup(parentId), focusItem: itemId => this.focusItem(itemId), emptyText: this.emptyText, emptyIcon: this.emptyIcon }), h$1(CaptionTemplate, { noCaption: this.noCaption, captionType: this.captionType, captionError: this.captionError, caption: this.caption })));
1587
+ }
1588
+ get el() { return getElement(this); }
1589
+ static get watchers() { return {
1590
+ "_id": ["watchId"],
1591
+ "value": ["handleValueChange"],
1592
+ "returnFilterData": ["watchReturnFilterData"],
1593
+ "isOpen": ["handleOpen"],
1594
+ "data": ["dataChanged"]
1595
+ }; }
1596
+ };
1597
+ __decorate([
1598
+ IsLoad()
1599
+ ], BcmList.prototype, "el", void 0);
1600
+ __decorate([
1601
+ JsonParse("data", true)
1602
+ ], BcmList.prototype, "dataChanged", null);
1603
+ BcmList.style = listCss;
1604
+
1605
+ function _extends$1() {
1606
+ _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
1607
+ for (var i = 1; i < arguments.length; i++) {
1608
+ var source = arguments[i];
1609
+ for (var key in source) {
1610
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1611
+ target[key] = source[key];
1612
+ }
1613
+ }
1614
+ }
1615
+ return target;
1616
+ };
1617
+ return _extends$1.apply(this, arguments);
1618
+ }
1619
+
1620
+ function _typeof$2(obj) {
1621
+ "@babel/helpers - typeof";
1622
+
1623
+ return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
1624
+ return typeof obj;
1625
+ } : function (obj) {
1626
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1627
+ }, _typeof$2(obj);
1628
+ }
1629
+
1630
+ function _toPrimitive$1(input, hint) {
1631
+ if (_typeof$2(input) !== "object" || input === null) return input;
1632
+ var prim = input[Symbol.toPrimitive];
1633
+ if (prim !== undefined) {
1634
+ var res = prim.call(input, hint || "default");
1635
+ if (_typeof$2(res) !== "object") return res;
1636
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1637
+ }
1638
+ return (hint === "string" ? String : Number)(input);
1639
+ }
1640
+
1641
+ function _toPropertyKey$1(arg) {
1642
+ var key = _toPrimitive$1(arg, "string");
1643
+ return _typeof$2(key) === "symbol" ? key : String(key);
1644
+ }
1645
+
1646
+ function _defineProperty$1(obj, key, value) {
1647
+ key = _toPropertyKey$1(key);
1648
+ if (key in obj) {
1649
+ Object.defineProperty(obj, key, {
1650
+ value: value,
1651
+ enumerable: true,
1652
+ configurable: true,
1653
+ writable: true
1654
+ });
1655
+ } else {
1656
+ obj[key] = value;
1657
+ }
1658
+ return obj;
1659
+ }
1660
+
1661
+ function ownKeys$1(object, enumerableOnly) {
1662
+ var keys = Object.keys(object);
1663
+ if (Object.getOwnPropertySymbols) {
1664
+ var symbols = Object.getOwnPropertySymbols(object);
1665
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
1666
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1667
+ })), keys.push.apply(keys, symbols);
1668
+ }
1669
+ return keys;
1670
+ }
1671
+ function _objectSpread2$1(target) {
1672
+ for (var i = 1; i < arguments.length; i++) {
1673
+ var source = null != arguments[i] ? arguments[i] : {};
1674
+ i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) {
1675
+ _defineProperty$1(target, key, source[key]);
1676
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) {
1677
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1678
+ });
1679
+ }
1680
+ return target;
1681
+ }
1682
+
1683
+ function _arrayWithHoles(arr) {
1684
+ if (Array.isArray(arr)) return arr;
1685
+ }
1686
+
1687
+ function _iterableToArrayLimit(arr, i) {
1688
+ var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
1689
+ if (null != _i) {
1690
+ var _s,
1691
+ _e,
1692
+ _x,
1693
+ _r,
1694
+ _arr = [],
1695
+ _n = !0,
1696
+ _d = !1;
1697
+ try {
1698
+ if (_x = (_i = _i.call(arr)).next, 0 === i) {
1699
+ if (Object(_i) !== _i) return;
1700
+ _n = !1;
1701
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
1702
+ } catch (err) {
1703
+ _d = !0, _e = err;
1704
+ } finally {
1705
+ try {
1706
+ if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
1707
+ } finally {
1708
+ if (_d) throw _e;
1709
+ }
1710
+ }
1711
+ return _arr;
1712
+ }
1713
+ }
1714
+
1715
+ function _arrayLikeToArray(arr, len) {
1716
+ if (len == null || len > arr.length) len = arr.length;
1717
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
1718
+ return arr2;
1719
+ }
1720
+
1721
+ function _unsupportedIterableToArray(o, minLen) {
1722
+ if (!o) return;
1723
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
1724
+ var n = Object.prototype.toString.call(o).slice(8, -1);
1725
+ if (n === "Object" && o.constructor) n = o.constructor.name;
1726
+ if (n === "Map" || n === "Set") return Array.from(o);
1727
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
1728
+ }
1729
+
1730
+ function _nonIterableRest() {
1731
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1732
+ }
1733
+
1734
+ function _slicedToArray(arr, i) {
1735
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
1736
+ }
1737
+
1738
+ function _objectWithoutPropertiesLoose(source, excluded) {
1739
+ if (source == null) return {};
1740
+ var target = {};
1741
+ var sourceKeys = Object.keys(source);
1742
+ var key, i;
1743
+ for (i = 0; i < sourceKeys.length; i++) {
1744
+ key = sourceKeys[i];
1745
+ if (excluded.indexOf(key) >= 0) continue;
1746
+ target[key] = source[key];
1747
+ }
1748
+ return target;
1749
+ }
1750
+
1751
+ function _objectWithoutProperties(source, excluded) {
1752
+ if (source == null) return {};
1753
+ var target = _objectWithoutPropertiesLoose(source, excluded);
1754
+ var key, i;
1755
+ if (Object.getOwnPropertySymbols) {
1756
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
1757
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
1758
+ key = sourceSymbolKeys[i];
1759
+ if (excluded.indexOf(key) >= 0) continue;
1760
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
1761
+ target[key] = source[key];
1762
+ }
1763
+ }
1764
+ return target;
1765
+ }
1766
+
1767
+ function _extends() {
1768
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
1769
+ for (var i = 1; i < arguments.length; i++) {
1770
+ var source = arguments[i];
1771
+ for (var key in source) {
1772
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1773
+ target[key] = source[key];
1774
+ }
1775
+ }
1776
+ }
1777
+ return target;
1778
+ };
1779
+ return _extends.apply(this, arguments);
1780
+ }
1781
+
1782
+ /** @license React v16.13.1
1783
+ * react-is.production.min.js
1784
+ *
1785
+ * Copyright (c) Facebook, Inc. and its affiliates.
1786
+ *
1787
+ * This source code is licensed under the MIT license found in the
1788
+ * LICENSE file in the root directory of this source tree.
1789
+ */
1790
+ var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
1791
+ Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
1792
+ function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}var AsyncMode=l;var ConcurrentMode=m;var ContextConsumer=k;var ContextProvider=h;var Element$1=c;var ForwardRef=n;var Fragment=e;var Lazy=t;var Memo=r;var Portal=d;
1793
+ var Profiler=g;var StrictMode=f;var Suspense=p;var isAsyncMode=function(a){return A(a)||z(a)===l};var isConcurrentMode=A;var isContextConsumer=function(a){return z(a)===k};var isContextProvider=function(a){return z(a)===h};var isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};var isForwardRef=function(a){return z(a)===n};var isFragment=function(a){return z(a)===e};var isLazy=function(a){return z(a)===t};
1794
+ var isMemo=function(a){return z(a)===r};var isPortal=function(a){return z(a)===d};var isProfiler=function(a){return z(a)===g};var isStrictMode=function(a){return z(a)===f};var isSuspense=function(a){return z(a)===p};
1795
+ var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};var typeOf=z;
1796
+
1797
+ var reactIs_production_min = {
1798
+ AsyncMode: AsyncMode,
1799
+ ConcurrentMode: ConcurrentMode,
1800
+ ContextConsumer: ContextConsumer,
1801
+ ContextProvider: ContextProvider,
1802
+ Element: Element$1,
1803
+ ForwardRef: ForwardRef,
1804
+ Fragment: Fragment,
1805
+ Lazy: Lazy,
1806
+ Memo: Memo,
1807
+ Portal: Portal,
1808
+ Profiler: Profiler,
1809
+ StrictMode: StrictMode,
1810
+ Suspense: Suspense,
1811
+ isAsyncMode: isAsyncMode,
1812
+ isConcurrentMode: isConcurrentMode,
1813
+ isContextConsumer: isContextConsumer,
1814
+ isContextProvider: isContextProvider,
1815
+ isElement: isElement,
1816
+ isForwardRef: isForwardRef,
1817
+ isFragment: isFragment,
1818
+ isLazy: isLazy,
1819
+ isMemo: isMemo,
1820
+ isPortal: isPortal,
1821
+ isProfiler: isProfiler,
1822
+ isStrictMode: isStrictMode,
1823
+ isSuspense: isSuspense,
1824
+ isValidElementType: isValidElementType,
1825
+ typeOf: typeOf
1826
+ };
1827
+
1828
+ createCommonjsModule(function (module, exports) {
1829
+ });
1830
+
1831
+ var reactIs = createCommonjsModule(function (module) {
1832
+
1833
+ {
1834
+ module.exports = reactIs_production_min;
1835
+ }
1836
+ });
1837
+
1838
+ function toArray(children) {
1839
+ var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1840
+ var ret = [];
1841
+ react.Children.forEach(children, function (child) {
1842
+ if ((child === undefined || child === null) && !option.keepEmpty) {
1843
+ return;
1844
+ }
1845
+ if (Array.isArray(child)) {
1846
+ ret = ret.concat(toArray(child));
1847
+ } else if (reactIs.isFragment(child) && child.props) {
1848
+ ret = ret.concat(toArray(child.props.children, option));
1849
+ } else {
1850
+ ret.push(child);
1851
+ }
1852
+ });
1853
+ return ret;
1854
+ }
1855
+
1856
+ function _typeof$1(obj) {
1857
+ "@babel/helpers - typeof";
1858
+
1859
+ return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
1860
+ return typeof obj;
1861
+ } : function (obj) {
1862
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1863
+ }, _typeof$1(obj);
1864
+ }
1865
+
1866
+ function _toPrimitive(input, hint) {
1867
+ if (_typeof$1(input) !== "object" || input === null) return input;
1868
+ var prim = input[Symbol.toPrimitive];
1869
+ if (prim !== undefined) {
1870
+ var res = prim.call(input, hint || "default");
1871
+ if (_typeof$1(res) !== "object") return res;
1872
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1873
+ }
1874
+ return (hint === "string" ? String : Number)(input);
1875
+ }
1876
+
1877
+ function _toPropertyKey(arg) {
1878
+ var key = _toPrimitive(arg, "string");
1879
+ return _typeof$1(key) === "symbol" ? key : String(key);
1880
+ }
1881
+
1882
+ function _defineProperty(obj, key, value) {
1883
+ key = _toPropertyKey(key);
1884
+ if (key in obj) {
1885
+ Object.defineProperty(obj, key, {
1886
+ value: value,
1887
+ enumerable: true,
1888
+ configurable: true,
1889
+ writable: true
1890
+ });
1891
+ } else {
1892
+ obj[key] = value;
1893
+ }
1894
+ return obj;
1895
+ }
1896
+
1897
+ function ownKeys(object, enumerableOnly) {
1898
+ var keys = Object.keys(object);
1899
+ if (Object.getOwnPropertySymbols) {
1900
+ var symbols = Object.getOwnPropertySymbols(object);
1901
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
1902
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1903
+ })), keys.push.apply(keys, symbols);
1904
+ }
1905
+ return keys;
1906
+ }
1907
+ function _objectSpread2(target) {
1908
+ for (var i = 1; i < arguments.length; i++) {
1909
+ var source = null != arguments[i] ? arguments[i] : {};
1910
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
1911
+ _defineProperty(target, key, source[key]);
1912
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
1913
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1914
+ });
1915
+ }
1916
+ return target;
1917
+ }
1918
+
1919
+ function _typeof(obj) {
1920
+ "@babel/helpers - typeof";
1921
+
1922
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
1923
+ return typeof obj;
1924
+ } : function (obj) {
1925
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1926
+ }, _typeof(obj);
1927
+ }
1928
+
1929
+ function fillRef(ref, node) {
1930
+ if (typeof ref === 'function') {
1931
+ ref(node);
1932
+ } else if (_typeof(ref) === 'object' && ref && 'current' in ref) {
1933
+ ref.current = node;
1934
+ }
1935
+ }
1936
+
1937
+ /**
1938
+ * Merge refs into one ref function to support ref passing.
1939
+ */
1940
+ function composeRef() {
1941
+ for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
1942
+ refs[_key] = arguments[_key];
1943
+ }
1944
+ var refList = refs.filter(function (ref) {
1945
+ return ref;
1946
+ });
1947
+ if (refList.length <= 1) {
1948
+ return refList[0];
1949
+ }
1950
+ return function (node) {
1951
+ refs.forEach(function (ref) {
1952
+ fillRef(ref, node);
1953
+ });
1954
+ };
1955
+ }
1956
+ function supportRef(nodeOrComponent) {
1957
+ var _type$prototype, _nodeOrComponent$prot;
1958
+ var type = reactIs.isMemo(nodeOrComponent) ? nodeOrComponent.type.type : nodeOrComponent.type;
1959
+
1960
+ // Function component node
1961
+ if (typeof type === 'function' && !((_type$prototype = type.prototype) !== null && _type$prototype !== void 0 && _type$prototype.render)) {
1962
+ return false;
1963
+ }
1964
+
1965
+ // Class component
1966
+ if (typeof nodeOrComponent === 'function' && !((_nodeOrComponent$prot = nodeOrComponent.prototype) !== null && _nodeOrComponent$prot !== void 0 && _nodeOrComponent$prot.render)) {
1967
+ return false;
1968
+ }
1969
+ return true;
1970
+ }
1971
+ /* eslint-enable */
1972
+
1973
+ function isDOM(node) {
1974
+ // https://developer.mozilla.org/en-US/docs/Web/API/Element
1975
+ // Since XULElement is also subclass of Element, we only need HTMLElement and SVGElement
1976
+ return node instanceof HTMLElement || node instanceof SVGElement;
1977
+ }
1978
+
1979
+ /**
1980
+ * Return if a node is a DOM node. Else will return by `findDOMNode`
1981
+ */
1982
+ function findDOMNode(node) {
1983
+ if (isDOM(node)) {
1984
+ return node;
1985
+ }
1986
+ if (node instanceof react.Component) {
1987
+ return reactDom.findDOMNode(node);
1988
+ }
1989
+ return null;
1990
+ }
1991
+
1992
+ /**
1993
+ * A collection of shims that provide minimal functionality of the ES6 collections.
1994
+ *
1995
+ * These implementations are not meant to be used outside of the ResizeObserver
1996
+ * modules as they cover only a limited range of use cases.
1997
+ */
1998
+ /* eslint-disable require-jsdoc, valid-jsdoc */
1999
+ var MapShim = (function () {
2000
+ if (typeof Map !== 'undefined') {
2001
+ return Map;
2002
+ }
2003
+ /**
2004
+ * Returns index in provided array that matches the specified key.
2005
+ *
2006
+ * @param {Array<Array>} arr
2007
+ * @param {*} key
2008
+ * @returns {number}
2009
+ */
2010
+ function getIndex(arr, key) {
2011
+ var result = -1;
2012
+ arr.some(function (entry, index) {
2013
+ if (entry[0] === key) {
2014
+ result = index;
2015
+ return true;
2016
+ }
2017
+ return false;
2018
+ });
2019
+ return result;
2020
+ }
2021
+ return /** @class */ (function () {
2022
+ function class_1() {
2023
+ this.__entries__ = [];
2024
+ }
2025
+ Object.defineProperty(class_1.prototype, "size", {
2026
+ /**
2027
+ * @returns {boolean}
2028
+ */
2029
+ get: function () {
2030
+ return this.__entries__.length;
2031
+ },
2032
+ enumerable: true,
2033
+ configurable: true
2034
+ });
2035
+ /**
2036
+ * @param {*} key
2037
+ * @returns {*}
2038
+ */
2039
+ class_1.prototype.get = function (key) {
2040
+ var index = getIndex(this.__entries__, key);
2041
+ var entry = this.__entries__[index];
2042
+ return entry && entry[1];
2043
+ };
2044
+ /**
2045
+ * @param {*} key
2046
+ * @param {*} value
2047
+ * @returns {void}
2048
+ */
2049
+ class_1.prototype.set = function (key, value) {
2050
+ var index = getIndex(this.__entries__, key);
2051
+ if (~index) {
2052
+ this.__entries__[index][1] = value;
2053
+ }
2054
+ else {
2055
+ this.__entries__.push([key, value]);
2056
+ }
2057
+ };
2058
+ /**
2059
+ * @param {*} key
2060
+ * @returns {void}
2061
+ */
2062
+ class_1.prototype.delete = function (key) {
2063
+ var entries = this.__entries__;
2064
+ var index = getIndex(entries, key);
2065
+ if (~index) {
2066
+ entries.splice(index, 1);
2067
+ }
2068
+ };
2069
+ /**
2070
+ * @param {*} key
2071
+ * @returns {void}
2072
+ */
2073
+ class_1.prototype.has = function (key) {
2074
+ return !!~getIndex(this.__entries__, key);
2075
+ };
2076
+ /**
2077
+ * @returns {void}
2078
+ */
2079
+ class_1.prototype.clear = function () {
2080
+ this.__entries__.splice(0);
2081
+ };
2082
+ /**
2083
+ * @param {Function} callback
2084
+ * @param {*} [ctx=null]
2085
+ * @returns {void}
2086
+ */
2087
+ class_1.prototype.forEach = function (callback, ctx) {
2088
+ if (ctx === void 0) { ctx = null; }
2089
+ for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) {
2090
+ var entry = _a[_i];
2091
+ callback.call(ctx, entry[1], entry[0]);
2092
+ }
2093
+ };
2094
+ return class_1;
2095
+ }());
2096
+ })();
2097
+
2098
+ /**
2099
+ * Detects whether window and document objects are available in current environment.
2100
+ */
2101
+ var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && window.document === document;
2102
+
2103
+ // Returns global object of a current environment.
2104
+ var global$1 = (function () {
2105
+ if (typeof global !== 'undefined' && global.Math === Math) {
2106
+ return global;
2107
+ }
2108
+ if (typeof self !== 'undefined' && self.Math === Math) {
2109
+ return self;
2110
+ }
2111
+ if (typeof window !== 'undefined' && window.Math === Math) {
2112
+ return window;
2113
+ }
2114
+ // eslint-disable-next-line no-new-func
2115
+ return Function('return this')();
2116
+ })();
2117
+
2118
+ /**
2119
+ * A shim for the requestAnimationFrame which falls back to the setTimeout if
2120
+ * first one is not supported.
2121
+ *
2122
+ * @returns {number} Requests' identifier.
2123
+ */
2124
+ var requestAnimationFrame$1 = (function () {
2125
+ if (typeof requestAnimationFrame === 'function') {
2126
+ // It's required to use a bounded function because IE sometimes throws
2127
+ // an "Invalid calling object" error if rAF is invoked without the global
2128
+ // object on the left hand side.
2129
+ return requestAnimationFrame.bind(global$1);
2130
+ }
2131
+ return function (callback) { return setTimeout(function () { return callback(Date.now()); }, 1000 / 60); };
2132
+ })();
2133
+
2134
+ // Defines minimum timeout before adding a trailing call.
2135
+ var trailingTimeout = 2;
2136
+ /**
2137
+ * Creates a wrapper function which ensures that provided callback will be
2138
+ * invoked only once during the specified delay period.
2139
+ *
2140
+ * @param {Function} callback - Function to be invoked after the delay period.
2141
+ * @param {number} delay - Delay after which to invoke callback.
2142
+ * @returns {Function}
2143
+ */
2144
+ function throttle (callback, delay) {
2145
+ var leadingCall = false, trailingCall = false, lastCallTime = 0;
2146
+ /**
2147
+ * Invokes the original callback function and schedules new invocation if
2148
+ * the "proxy" was called during current request.
2149
+ *
2150
+ * @returns {void}
2151
+ */
2152
+ function resolvePending() {
2153
+ if (leadingCall) {
2154
+ leadingCall = false;
2155
+ callback();
2156
+ }
2157
+ if (trailingCall) {
2158
+ proxy();
2159
+ }
2160
+ }
2161
+ /**
2162
+ * Callback invoked after the specified delay. It will further postpone
2163
+ * invocation of the original function delegating it to the
2164
+ * requestAnimationFrame.
2165
+ *
2166
+ * @returns {void}
2167
+ */
2168
+ function timeoutCallback() {
2169
+ requestAnimationFrame$1(resolvePending);
2170
+ }
2171
+ /**
2172
+ * Schedules invocation of the original function.
2173
+ *
2174
+ * @returns {void}
2175
+ */
2176
+ function proxy() {
2177
+ var timeStamp = Date.now();
2178
+ if (leadingCall) {
2179
+ // Reject immediately following calls.
2180
+ if (timeStamp - lastCallTime < trailingTimeout) {
2181
+ return;
2182
+ }
2183
+ // Schedule new call to be in invoked when the pending one is resolved.
2184
+ // This is important for "transitions" which never actually start
2185
+ // immediately so there is a chance that we might miss one if change
2186
+ // happens amids the pending invocation.
2187
+ trailingCall = true;
2188
+ }
2189
+ else {
2190
+ leadingCall = true;
2191
+ trailingCall = false;
2192
+ setTimeout(timeoutCallback, delay);
2193
+ }
2194
+ lastCallTime = timeStamp;
2195
+ }
2196
+ return proxy;
2197
+ }
2198
+
2199
+ // Minimum delay before invoking the update of observers.
2200
+ var REFRESH_DELAY = 20;
2201
+ // A list of substrings of CSS properties used to find transition events that
2202
+ // might affect dimensions of observed elements.
2203
+ var transitionKeys = ['top', 'right', 'bottom', 'left', 'width', 'height', 'size', 'weight'];
2204
+ // Check if MutationObserver is available.
2205
+ var mutationObserverSupported = typeof MutationObserver !== 'undefined';
2206
+ /**
2207
+ * Singleton controller class which handles updates of ResizeObserver instances.
2208
+ */
2209
+ var ResizeObserverController = /** @class */ (function () {
2210
+ /**
2211
+ * Creates a new instance of ResizeObserverController.
2212
+ *
2213
+ * @private
2214
+ */
2215
+ function ResizeObserverController() {
2216
+ /**
2217
+ * Indicates whether DOM listeners have been added.
2218
+ *
2219
+ * @private {boolean}
2220
+ */
2221
+ this.connected_ = false;
2222
+ /**
2223
+ * Tells that controller has subscribed for Mutation Events.
2224
+ *
2225
+ * @private {boolean}
2226
+ */
2227
+ this.mutationEventsAdded_ = false;
2228
+ /**
2229
+ * Keeps reference to the instance of MutationObserver.
2230
+ *
2231
+ * @private {MutationObserver}
2232
+ */
2233
+ this.mutationsObserver_ = null;
2234
+ /**
2235
+ * A list of connected observers.
2236
+ *
2237
+ * @private {Array<ResizeObserverSPI>}
2238
+ */
2239
+ this.observers_ = [];
2240
+ this.onTransitionEnd_ = this.onTransitionEnd_.bind(this);
2241
+ this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY);
2242
+ }
2243
+ /**
2244
+ * Adds observer to observers list.
2245
+ *
2246
+ * @param {ResizeObserverSPI} observer - Observer to be added.
2247
+ * @returns {void}
2248
+ */
2249
+ ResizeObserverController.prototype.addObserver = function (observer) {
2250
+ if (!~this.observers_.indexOf(observer)) {
2251
+ this.observers_.push(observer);
2252
+ }
2253
+ // Add listeners if they haven't been added yet.
2254
+ if (!this.connected_) {
2255
+ this.connect_();
2256
+ }
2257
+ };
2258
+ /**
2259
+ * Removes observer from observers list.
2260
+ *
2261
+ * @param {ResizeObserverSPI} observer - Observer to be removed.
2262
+ * @returns {void}
2263
+ */
2264
+ ResizeObserverController.prototype.removeObserver = function (observer) {
2265
+ var observers = this.observers_;
2266
+ var index = observers.indexOf(observer);
2267
+ // Remove observer if it's present in registry.
2268
+ if (~index) {
2269
+ observers.splice(index, 1);
2270
+ }
2271
+ // Remove listeners if controller has no connected observers.
2272
+ if (!observers.length && this.connected_) {
2273
+ this.disconnect_();
2274
+ }
2275
+ };
2276
+ /**
2277
+ * Invokes the update of observers. It will continue running updates insofar
2278
+ * it detects changes.
2279
+ *
2280
+ * @returns {void}
2281
+ */
2282
+ ResizeObserverController.prototype.refresh = function () {
2283
+ var changesDetected = this.updateObservers_();
2284
+ // Continue running updates if changes have been detected as there might
2285
+ // be future ones caused by CSS transitions.
2286
+ if (changesDetected) {
2287
+ this.refresh();
2288
+ }
2289
+ };
2290
+ /**
2291
+ * Updates every observer from observers list and notifies them of queued
2292
+ * entries.
2293
+ *
2294
+ * @private
2295
+ * @returns {boolean} Returns "true" if any observer has detected changes in
2296
+ * dimensions of it's elements.
2297
+ */
2298
+ ResizeObserverController.prototype.updateObservers_ = function () {
2299
+ // Collect observers that have active observations.
2300
+ var activeObservers = this.observers_.filter(function (observer) {
2301
+ return observer.gatherActive(), observer.hasActive();
2302
+ });
2303
+ // Deliver notifications in a separate cycle in order to avoid any
2304
+ // collisions between observers, e.g. when multiple instances of
2305
+ // ResizeObserver are tracking the same element and the callback of one
2306
+ // of them changes content dimensions of the observed target. Sometimes
2307
+ // this may result in notifications being blocked for the rest of observers.
2308
+ activeObservers.forEach(function (observer) { return observer.broadcastActive(); });
2309
+ return activeObservers.length > 0;
2310
+ };
2311
+ /**
2312
+ * Initializes DOM listeners.
2313
+ *
2314
+ * @private
2315
+ * @returns {void}
2316
+ */
2317
+ ResizeObserverController.prototype.connect_ = function () {
2318
+ // Do nothing if running in a non-browser environment or if listeners
2319
+ // have been already added.
2320
+ if (!isBrowser || this.connected_) {
2321
+ return;
2322
+ }
2323
+ // Subscription to the "Transitionend" event is used as a workaround for
2324
+ // delayed transitions. This way it's possible to capture at least the
2325
+ // final state of an element.
2326
+ document.addEventListener('transitionend', this.onTransitionEnd_);
2327
+ window.addEventListener('resize', this.refresh);
2328
+ if (mutationObserverSupported) {
2329
+ this.mutationsObserver_ = new MutationObserver(this.refresh);
2330
+ this.mutationsObserver_.observe(document, {
2331
+ attributes: true,
2332
+ childList: true,
2333
+ characterData: true,
2334
+ subtree: true
2335
+ });
2336
+ }
2337
+ else {
2338
+ document.addEventListener('DOMSubtreeModified', this.refresh);
2339
+ this.mutationEventsAdded_ = true;
2340
+ }
2341
+ this.connected_ = true;
2342
+ };
2343
+ /**
2344
+ * Removes DOM listeners.
2345
+ *
2346
+ * @private
2347
+ * @returns {void}
2348
+ */
2349
+ ResizeObserverController.prototype.disconnect_ = function () {
2350
+ // Do nothing if running in a non-browser environment or if listeners
2351
+ // have been already removed.
2352
+ if (!isBrowser || !this.connected_) {
2353
+ return;
2354
+ }
2355
+ document.removeEventListener('transitionend', this.onTransitionEnd_);
2356
+ window.removeEventListener('resize', this.refresh);
2357
+ if (this.mutationsObserver_) {
2358
+ this.mutationsObserver_.disconnect();
2359
+ }
2360
+ if (this.mutationEventsAdded_) {
2361
+ document.removeEventListener('DOMSubtreeModified', this.refresh);
2362
+ }
2363
+ this.mutationsObserver_ = null;
2364
+ this.mutationEventsAdded_ = false;
2365
+ this.connected_ = false;
2366
+ };
2367
+ /**
2368
+ * "Transitionend" event handler.
2369
+ *
2370
+ * @private
2371
+ * @param {TransitionEvent} event
2372
+ * @returns {void}
2373
+ */
2374
+ ResizeObserverController.prototype.onTransitionEnd_ = function (_a) {
2375
+ var _b = _a.propertyName, propertyName = _b === void 0 ? '' : _b;
2376
+ // Detect whether transition may affect dimensions of an element.
2377
+ var isReflowProperty = transitionKeys.some(function (key) {
2378
+ return !!~propertyName.indexOf(key);
2379
+ });
2380
+ if (isReflowProperty) {
2381
+ this.refresh();
2382
+ }
2383
+ };
2384
+ /**
2385
+ * Returns instance of the ResizeObserverController.
2386
+ *
2387
+ * @returns {ResizeObserverController}
2388
+ */
2389
+ ResizeObserverController.getInstance = function () {
2390
+ if (!this.instance_) {
2391
+ this.instance_ = new ResizeObserverController();
2392
+ }
2393
+ return this.instance_;
2394
+ };
2395
+ /**
2396
+ * Holds reference to the controller's instance.
2397
+ *
2398
+ * @private {ResizeObserverController}
2399
+ */
2400
+ ResizeObserverController.instance_ = null;
2401
+ return ResizeObserverController;
2402
+ }());
2403
+
2404
+ /**
2405
+ * Defines non-writable/enumerable properties of the provided target object.
2406
+ *
2407
+ * @param {Object} target - Object for which to define properties.
2408
+ * @param {Object} props - Properties to be defined.
2409
+ * @returns {Object} Target object.
2410
+ */
2411
+ var defineConfigurable = (function (target, props) {
2412
+ for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) {
2413
+ var key = _a[_i];
2414
+ Object.defineProperty(target, key, {
2415
+ value: props[key],
2416
+ enumerable: false,
2417
+ writable: false,
2418
+ configurable: true
2419
+ });
2420
+ }
2421
+ return target;
2422
+ });
2423
+
2424
+ /**
2425
+ * Returns the global object associated with provided element.
2426
+ *
2427
+ * @param {Object} target
2428
+ * @returns {Object}
2429
+ */
2430
+ var getWindowOf = (function (target) {
2431
+ // Assume that the element is an instance of Node, which means that it
2432
+ // has the "ownerDocument" property from which we can retrieve a
2433
+ // corresponding global object.
2434
+ var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView;
2435
+ // Return the local global object if it's not possible extract one from
2436
+ // provided element.
2437
+ return ownerGlobal || global$1;
2438
+ });
2439
+
2440
+ // Placeholder of an empty content rectangle.
2441
+ var emptyRect = createRectInit(0, 0, 0, 0);
2442
+ /**
2443
+ * Converts provided string to a number.
2444
+ *
2445
+ * @param {number|string} value
2446
+ * @returns {number}
2447
+ */
2448
+ function toFloat(value) {
2449
+ return parseFloat(value) || 0;
2450
+ }
2451
+ /**
2452
+ * Extracts borders size from provided styles.
2453
+ *
2454
+ * @param {CSSStyleDeclaration} styles
2455
+ * @param {...string} positions - Borders positions (top, right, ...)
2456
+ * @returns {number}
2457
+ */
2458
+ function getBordersSize(styles) {
2459
+ var positions = [];
2460
+ for (var _i = 1; _i < arguments.length; _i++) {
2461
+ positions[_i - 1] = arguments[_i];
2462
+ }
2463
+ return positions.reduce(function (size, position) {
2464
+ var value = styles['border-' + position + '-width'];
2465
+ return size + toFloat(value);
2466
+ }, 0);
2467
+ }
2468
+ /**
2469
+ * Extracts paddings sizes from provided styles.
2470
+ *
2471
+ * @param {CSSStyleDeclaration} styles
2472
+ * @returns {Object} Paddings box.
2473
+ */
2474
+ function getPaddings(styles) {
2475
+ var positions = ['top', 'right', 'bottom', 'left'];
2476
+ var paddings = {};
2477
+ for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
2478
+ var position = positions_1[_i];
2479
+ var value = styles['padding-' + position];
2480
+ paddings[position] = toFloat(value);
2481
+ }
2482
+ return paddings;
2483
+ }
2484
+ /**
2485
+ * Calculates content rectangle of provided SVG element.
2486
+ *
2487
+ * @param {SVGGraphicsElement} target - Element content rectangle of which needs
2488
+ * to be calculated.
2489
+ * @returns {DOMRectInit}
2490
+ */
2491
+ function getSVGContentRect(target) {
2492
+ var bbox = target.getBBox();
2493
+ return createRectInit(0, 0, bbox.width, bbox.height);
2494
+ }
2495
+ /**
2496
+ * Calculates content rectangle of provided HTMLElement.
2497
+ *
2498
+ * @param {HTMLElement} target - Element for which to calculate the content rectangle.
2499
+ * @returns {DOMRectInit}
2500
+ */
2501
+ function getHTMLElementContentRect(target) {
2502
+ // Client width & height properties can't be
2503
+ // used exclusively as they provide rounded values.
2504
+ var clientWidth = target.clientWidth, clientHeight = target.clientHeight;
2505
+ // By this condition we can catch all non-replaced inline, hidden and
2506
+ // detached elements. Though elements with width & height properties less
2507
+ // than 0.5 will be discarded as well.
2508
+ //
2509
+ // Without it we would need to implement separate methods for each of
2510
+ // those cases and it's not possible to perform a precise and performance
2511
+ // effective test for hidden elements. E.g. even jQuery's ':visible' filter
2512
+ // gives wrong results for elements with width & height less than 0.5.
2513
+ if (!clientWidth && !clientHeight) {
2514
+ return emptyRect;
2515
+ }
2516
+ var styles = getWindowOf(target).getComputedStyle(target);
2517
+ var paddings = getPaddings(styles);
2518
+ var horizPad = paddings.left + paddings.right;
2519
+ var vertPad = paddings.top + paddings.bottom;
2520
+ // Computed styles of width & height are being used because they are the
2521
+ // only dimensions available to JS that contain non-rounded values. It could
2522
+ // be possible to utilize the getBoundingClientRect if only it's data wasn't
2523
+ // affected by CSS transformations let alone paddings, borders and scroll bars.
2524
+ var width = toFloat(styles.width), height = toFloat(styles.height);
2525
+ // Width & height include paddings and borders when the 'border-box' box
2526
+ // model is applied (except for IE).
2527
+ if (styles.boxSizing === 'border-box') {
2528
+ // Following conditions are required to handle Internet Explorer which
2529
+ // doesn't include paddings and borders to computed CSS dimensions.
2530
+ //
2531
+ // We can say that if CSS dimensions + paddings are equal to the "client"
2532
+ // properties then it's either IE, and thus we don't need to subtract
2533
+ // anything, or an element merely doesn't have paddings/borders styles.
2534
+ if (Math.round(width + horizPad) !== clientWidth) {
2535
+ width -= getBordersSize(styles, 'left', 'right') + horizPad;
2536
+ }
2537
+ if (Math.round(height + vertPad) !== clientHeight) {
2538
+ height -= getBordersSize(styles, 'top', 'bottom') + vertPad;
2539
+ }
2540
+ }
2541
+ // Following steps can't be applied to the document's root element as its
2542
+ // client[Width/Height] properties represent viewport area of the window.
2543
+ // Besides, it's as well not necessary as the <html> itself neither has
2544
+ // rendered scroll bars nor it can be clipped.
2545
+ if (!isDocumentElement(target)) {
2546
+ // In some browsers (only in Firefox, actually) CSS width & height
2547
+ // include scroll bars size which can be removed at this step as scroll
2548
+ // bars are the only difference between rounded dimensions + paddings
2549
+ // and "client" properties, though that is not always true in Chrome.
2550
+ var vertScrollbar = Math.round(width + horizPad) - clientWidth;
2551
+ var horizScrollbar = Math.round(height + vertPad) - clientHeight;
2552
+ // Chrome has a rather weird rounding of "client" properties.
2553
+ // E.g. for an element with content width of 314.2px it sometimes gives
2554
+ // the client width of 315px and for the width of 314.7px it may give
2555
+ // 314px. And it doesn't happen all the time. So just ignore this delta
2556
+ // as a non-relevant.
2557
+ if (Math.abs(vertScrollbar) !== 1) {
2558
+ width -= vertScrollbar;
2559
+ }
2560
+ if (Math.abs(horizScrollbar) !== 1) {
2561
+ height -= horizScrollbar;
2562
+ }
2563
+ }
2564
+ return createRectInit(paddings.left, paddings.top, width, height);
2565
+ }
2566
+ /**
2567
+ * Checks whether provided element is an instance of the SVGGraphicsElement.
2568
+ *
2569
+ * @param {Element} target - Element to be checked.
2570
+ * @returns {boolean}
2571
+ */
2572
+ var isSVGGraphicsElement = (function () {
2573
+ // Some browsers, namely IE and Edge, don't have the SVGGraphicsElement
2574
+ // interface.
2575
+ if (typeof SVGGraphicsElement !== 'undefined') {
2576
+ return function (target) { return target instanceof getWindowOf(target).SVGGraphicsElement; };
2577
+ }
2578
+ // If it's so, then check that element is at least an instance of the
2579
+ // SVGElement and that it has the "getBBox" method.
2580
+ // eslint-disable-next-line no-extra-parens
2581
+ return function (target) { return (target instanceof getWindowOf(target).SVGElement &&
2582
+ typeof target.getBBox === 'function'); };
2583
+ })();
2584
+ /**
2585
+ * Checks whether provided element is a document element (<html>).
2586
+ *
2587
+ * @param {Element} target - Element to be checked.
2588
+ * @returns {boolean}
2589
+ */
2590
+ function isDocumentElement(target) {
2591
+ return target === getWindowOf(target).document.documentElement;
2592
+ }
2593
+ /**
2594
+ * Calculates an appropriate content rectangle for provided html or svg element.
2595
+ *
2596
+ * @param {Element} target - Element content rectangle of which needs to be calculated.
2597
+ * @returns {DOMRectInit}
2598
+ */
2599
+ function getContentRect(target) {
2600
+ if (!isBrowser) {
2601
+ return emptyRect;
2602
+ }
2603
+ if (isSVGGraphicsElement(target)) {
2604
+ return getSVGContentRect(target);
2605
+ }
2606
+ return getHTMLElementContentRect(target);
2607
+ }
2608
+ /**
2609
+ * Creates rectangle with an interface of the DOMRectReadOnly.
2610
+ * Spec: https://drafts.fxtf.org/geometry/#domrectreadonly
2611
+ *
2612
+ * @param {DOMRectInit} rectInit - Object with rectangle's x/y coordinates and dimensions.
2613
+ * @returns {DOMRectReadOnly}
2614
+ */
2615
+ function createReadOnlyRect(_a) {
2616
+ var x = _a.x, y = _a.y, width = _a.width, height = _a.height;
2617
+ // If DOMRectReadOnly is available use it as a prototype for the rectangle.
2618
+ var Constr = typeof DOMRectReadOnly !== 'undefined' ? DOMRectReadOnly : Object;
2619
+ var rect = Object.create(Constr.prototype);
2620
+ // Rectangle's properties are not writable and non-enumerable.
2621
+ defineConfigurable(rect, {
2622
+ x: x, y: y, width: width, height: height,
2623
+ top: y,
2624
+ right: x + width,
2625
+ bottom: height + y,
2626
+ left: x
2627
+ });
2628
+ return rect;
2629
+ }
2630
+ /**
2631
+ * Creates DOMRectInit object based on the provided dimensions and the x/y coordinates.
2632
+ * Spec: https://drafts.fxtf.org/geometry/#dictdef-domrectinit
2633
+ *
2634
+ * @param {number} x - X coordinate.
2635
+ * @param {number} y - Y coordinate.
2636
+ * @param {number} width - Rectangle's width.
2637
+ * @param {number} height - Rectangle's height.
2638
+ * @returns {DOMRectInit}
2639
+ */
2640
+ function createRectInit(x, y, width, height) {
2641
+ return { x: x, y: y, width: width, height: height };
2642
+ }
2643
+
2644
+ /**
2645
+ * Class that is responsible for computations of the content rectangle of
2646
+ * provided DOM element and for keeping track of it's changes.
2647
+ */
2648
+ var ResizeObservation = /** @class */ (function () {
2649
+ /**
2650
+ * Creates an instance of ResizeObservation.
2651
+ *
2652
+ * @param {Element} target - Element to be observed.
2653
+ */
2654
+ function ResizeObservation(target) {
2655
+ /**
2656
+ * Broadcasted width of content rectangle.
2657
+ *
2658
+ * @type {number}
2659
+ */
2660
+ this.broadcastWidth = 0;
2661
+ /**
2662
+ * Broadcasted height of content rectangle.
2663
+ *
2664
+ * @type {number}
2665
+ */
2666
+ this.broadcastHeight = 0;
2667
+ /**
2668
+ * Reference to the last observed content rectangle.
2669
+ *
2670
+ * @private {DOMRectInit}
2671
+ */
2672
+ this.contentRect_ = createRectInit(0, 0, 0, 0);
2673
+ this.target = target;
2674
+ }
2675
+ /**
2676
+ * Updates content rectangle and tells whether it's width or height properties
2677
+ * have changed since the last broadcast.
2678
+ *
2679
+ * @returns {boolean}
2680
+ */
2681
+ ResizeObservation.prototype.isActive = function () {
2682
+ var rect = getContentRect(this.target);
2683
+ this.contentRect_ = rect;
2684
+ return (rect.width !== this.broadcastWidth ||
2685
+ rect.height !== this.broadcastHeight);
2686
+ };
2687
+ /**
2688
+ * Updates 'broadcastWidth' and 'broadcastHeight' properties with a data
2689
+ * from the corresponding properties of the last observed content rectangle.
2690
+ *
2691
+ * @returns {DOMRectInit} Last observed content rectangle.
2692
+ */
2693
+ ResizeObservation.prototype.broadcastRect = function () {
2694
+ var rect = this.contentRect_;
2695
+ this.broadcastWidth = rect.width;
2696
+ this.broadcastHeight = rect.height;
2697
+ return rect;
2698
+ };
2699
+ return ResizeObservation;
2700
+ }());
2701
+
2702
+ var ResizeObserverEntry = /** @class */ (function () {
2703
+ /**
2704
+ * Creates an instance of ResizeObserverEntry.
2705
+ *
2706
+ * @param {Element} target - Element that is being observed.
2707
+ * @param {DOMRectInit} rectInit - Data of the element's content rectangle.
2708
+ */
2709
+ function ResizeObserverEntry(target, rectInit) {
2710
+ var contentRect = createReadOnlyRect(rectInit);
2711
+ // According to the specification following properties are not writable
2712
+ // and are also not enumerable in the native implementation.
2713
+ //
2714
+ // Property accessors are not being used as they'd require to define a
2715
+ // private WeakMap storage which may cause memory leaks in browsers that
2716
+ // don't support this type of collections.
2717
+ defineConfigurable(this, { target: target, contentRect: contentRect });
2718
+ }
2719
+ return ResizeObserverEntry;
2720
+ }());
2721
+
2722
+ var ResizeObserverSPI = /** @class */ (function () {
2723
+ /**
2724
+ * Creates a new instance of ResizeObserver.
2725
+ *
2726
+ * @param {ResizeObserverCallback} callback - Callback function that is invoked
2727
+ * when one of the observed elements changes it's content dimensions.
2728
+ * @param {ResizeObserverController} controller - Controller instance which
2729
+ * is responsible for the updates of observer.
2730
+ * @param {ResizeObserver} callbackCtx - Reference to the public
2731
+ * ResizeObserver instance which will be passed to callback function.
2732
+ */
2733
+ function ResizeObserverSPI(callback, controller, callbackCtx) {
2734
+ /**
2735
+ * Collection of resize observations that have detected changes in dimensions
2736
+ * of elements.
2737
+ *
2738
+ * @private {Array<ResizeObservation>}
2739
+ */
2740
+ this.activeObservations_ = [];
2741
+ /**
2742
+ * Registry of the ResizeObservation instances.
2743
+ *
2744
+ * @private {Map<Element, ResizeObservation>}
2745
+ */
2746
+ this.observations_ = new MapShim();
2747
+ if (typeof callback !== 'function') {
2748
+ throw new TypeError('The callback provided as parameter 1 is not a function.');
2749
+ }
2750
+ this.callback_ = callback;
2751
+ this.controller_ = controller;
2752
+ this.callbackCtx_ = callbackCtx;
2753
+ }
2754
+ /**
2755
+ * Starts observing provided element.
2756
+ *
2757
+ * @param {Element} target - Element to be observed.
2758
+ * @returns {void}
2759
+ */
2760
+ ResizeObserverSPI.prototype.observe = function (target) {
2761
+ if (!arguments.length) {
2762
+ throw new TypeError('1 argument required, but only 0 present.');
2763
+ }
2764
+ // Do nothing if current environment doesn't have the Element interface.
2765
+ if (typeof Element === 'undefined' || !(Element instanceof Object)) {
2766
+ return;
2767
+ }
2768
+ if (!(target instanceof getWindowOf(target).Element)) {
2769
+ throw new TypeError('parameter 1 is not of type "Element".');
2770
+ }
2771
+ var observations = this.observations_;
2772
+ // Do nothing if element is already being observed.
2773
+ if (observations.has(target)) {
2774
+ return;
2775
+ }
2776
+ observations.set(target, new ResizeObservation(target));
2777
+ this.controller_.addObserver(this);
2778
+ // Force the update of observations.
2779
+ this.controller_.refresh();
2780
+ };
2781
+ /**
2782
+ * Stops observing provided element.
2783
+ *
2784
+ * @param {Element} target - Element to stop observing.
2785
+ * @returns {void}
2786
+ */
2787
+ ResizeObserverSPI.prototype.unobserve = function (target) {
2788
+ if (!arguments.length) {
2789
+ throw new TypeError('1 argument required, but only 0 present.');
2790
+ }
2791
+ // Do nothing if current environment doesn't have the Element interface.
2792
+ if (typeof Element === 'undefined' || !(Element instanceof Object)) {
2793
+ return;
2794
+ }
2795
+ if (!(target instanceof getWindowOf(target).Element)) {
2796
+ throw new TypeError('parameter 1 is not of type "Element".');
2797
+ }
2798
+ var observations = this.observations_;
2799
+ // Do nothing if element is not being observed.
2800
+ if (!observations.has(target)) {
2801
+ return;
2802
+ }
2803
+ observations.delete(target);
2804
+ if (!observations.size) {
2805
+ this.controller_.removeObserver(this);
2806
+ }
2807
+ };
2808
+ /**
2809
+ * Stops observing all elements.
2810
+ *
2811
+ * @returns {void}
2812
+ */
2813
+ ResizeObserverSPI.prototype.disconnect = function () {
2814
+ this.clearActive();
2815
+ this.observations_.clear();
2816
+ this.controller_.removeObserver(this);
2817
+ };
2818
+ /**
2819
+ * Collects observation instances the associated element of which has changed
2820
+ * it's content rectangle.
2821
+ *
2822
+ * @returns {void}
2823
+ */
2824
+ ResizeObserverSPI.prototype.gatherActive = function () {
2825
+ var _this = this;
2826
+ this.clearActive();
2827
+ this.observations_.forEach(function (observation) {
2828
+ if (observation.isActive()) {
2829
+ _this.activeObservations_.push(observation);
2830
+ }
2831
+ });
2832
+ };
2833
+ /**
2834
+ * Invokes initial callback function with a list of ResizeObserverEntry
2835
+ * instances collected from active resize observations.
2836
+ *
2837
+ * @returns {void}
2838
+ */
2839
+ ResizeObserverSPI.prototype.broadcastActive = function () {
2840
+ // Do nothing if observer doesn't have active observations.
2841
+ if (!this.hasActive()) {
2842
+ return;
2843
+ }
2844
+ var ctx = this.callbackCtx_;
2845
+ // Create ResizeObserverEntry instance for every active observation.
2846
+ var entries = this.activeObservations_.map(function (observation) {
2847
+ return new ResizeObserverEntry(observation.target, observation.broadcastRect());
2848
+ });
2849
+ this.callback_.call(ctx, entries, ctx);
2850
+ this.clearActive();
2851
+ };
2852
+ /**
2853
+ * Clears the collection of active observations.
2854
+ *
2855
+ * @returns {void}
2856
+ */
2857
+ ResizeObserverSPI.prototype.clearActive = function () {
2858
+ this.activeObservations_.splice(0);
2859
+ };
2860
+ /**
2861
+ * Tells whether observer has active observations.
2862
+ *
2863
+ * @returns {boolean}
2864
+ */
2865
+ ResizeObserverSPI.prototype.hasActive = function () {
2866
+ return this.activeObservations_.length > 0;
2867
+ };
2868
+ return ResizeObserverSPI;
2869
+ }());
2870
+
2871
+ // Registry of internal observers. If WeakMap is not available use current shim
2872
+ // for the Map collection as it has all required methods and because WeakMap
2873
+ // can't be fully polyfilled anyway.
2874
+ var observers = typeof WeakMap !== 'undefined' ? new WeakMap() : new MapShim();
2875
+ /**
2876
+ * ResizeObserver API. Encapsulates the ResizeObserver SPI implementation
2877
+ * exposing only those methods and properties that are defined in the spec.
2878
+ */
2879
+ var ResizeObserver$1 = /** @class */ (function () {
2880
+ /**
2881
+ * Creates a new instance of ResizeObserver.
2882
+ *
2883
+ * @param {ResizeObserverCallback} callback - Callback that is invoked when
2884
+ * dimensions of the observed elements change.
2885
+ */
2886
+ function ResizeObserver(callback) {
2887
+ if (!(this instanceof ResizeObserver)) {
2888
+ throw new TypeError('Cannot call a class as a function.');
2889
+ }
2890
+ if (!arguments.length) {
2891
+ throw new TypeError('1 argument required, but only 0 present.');
2892
+ }
2893
+ var controller = ResizeObserverController.getInstance();
2894
+ var observer = new ResizeObserverSPI(callback, controller, this);
2895
+ observers.set(this, observer);
2896
+ }
2897
+ return ResizeObserver;
2898
+ }());
2899
+ // Expose public methods of ResizeObserver.
2900
+ [
2901
+ 'observe',
2902
+ 'unobserve',
2903
+ 'disconnect'
2904
+ ].forEach(function (method) {
2905
+ ResizeObserver$1.prototype[method] = function () {
2906
+ var _a;
2907
+ return (_a = observers.get(this))[method].apply(_a, arguments);
2908
+ };
2909
+ });
2910
+
2911
+ var index = (function () {
2912
+ // Export existing implementation if available.
2913
+ if (typeof global$1.ResizeObserver !== 'undefined') {
2914
+ return global$1.ResizeObserver;
2915
+ }
2916
+ return ResizeObserver$1;
2917
+ })();
2918
+
2919
+ // =============================== Const ===============================
2920
+ var elementListeners = new Map();
2921
+ function onResize(entities) {
2922
+ entities.forEach(function (entity) {
2923
+ var _elementListeners$get;
2924
+ var target = entity.target;
2925
+ (_elementListeners$get = elementListeners.get(target)) === null || _elementListeners$get === void 0 ? void 0 : _elementListeners$get.forEach(function (listener) {
2926
+ return listener(target);
2927
+ });
2928
+ });
2929
+ }
2930
+ // Note: ResizeObserver polyfill not support option to measure border-box resize
2931
+ var resizeObserver = new index(onResize);
2932
+ // ============================== Observe ==============================
2933
+ function observe(element, callback) {
2934
+ if (!elementListeners.has(element)) {
2935
+ elementListeners.set(element, new Set());
2936
+ resizeObserver.observe(element);
2937
+ }
2938
+ elementListeners.get(element).add(callback);
2939
+ }
2940
+ function unobserve(element, callback) {
2941
+ if (elementListeners.has(element)) {
2942
+ elementListeners.get(element).delete(callback);
2943
+ if (!elementListeners.get(element).size) {
2944
+ resizeObserver.unobserve(element);
2945
+ elementListeners.delete(element);
2946
+ }
2947
+ }
2948
+ }
2949
+
2950
+ function _classCallCheck(instance, Constructor) {
2951
+ if (!(instance instanceof Constructor)) {
2952
+ throw new TypeError("Cannot call a class as a function");
2953
+ }
2954
+ }
2955
+
2956
+ function _defineProperties(target, props) {
2957
+ for (var i = 0; i < props.length; i++) {
2958
+ var descriptor = props[i];
2959
+ descriptor.enumerable = descriptor.enumerable || false;
2960
+ descriptor.configurable = true;
2961
+ if ("value" in descriptor) descriptor.writable = true;
2962
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
2963
+ }
2964
+ }
2965
+ function _createClass(Constructor, protoProps, staticProps) {
2966
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
2967
+ if (staticProps) _defineProperties(Constructor, staticProps);
2968
+ Object.defineProperty(Constructor, "prototype", {
2969
+ writable: false
2970
+ });
2971
+ return Constructor;
2972
+ }
2973
+
2974
+ function _setPrototypeOf(o, p) {
2975
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
2976
+ o.__proto__ = p;
2977
+ return o;
2978
+ };
2979
+ return _setPrototypeOf(o, p);
2980
+ }
2981
+
2982
+ function _inherits(subClass, superClass) {
2983
+ if (typeof superClass !== "function" && superClass !== null) {
2984
+ throw new TypeError("Super expression must either be null or a function");
2985
+ }
2986
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
2987
+ constructor: {
2988
+ value: subClass,
2989
+ writable: true,
2990
+ configurable: true
2991
+ }
2992
+ });
2993
+ Object.defineProperty(subClass, "prototype", {
2994
+ writable: false
2995
+ });
2996
+ if (superClass) _setPrototypeOf(subClass, superClass);
2997
+ }
2998
+
2999
+ function _getPrototypeOf(o) {
3000
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
3001
+ return o.__proto__ || Object.getPrototypeOf(o);
3002
+ };
3003
+ return _getPrototypeOf(o);
3004
+ }
3005
+
3006
+ function _isNativeReflectConstruct() {
3007
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
3008
+ if (Reflect.construct.sham) return false;
3009
+ if (typeof Proxy === "function") return true;
3010
+ try {
3011
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
3012
+ return true;
3013
+ } catch (e) {
3014
+ return false;
3015
+ }
3016
+ }
3017
+
3018
+ function _assertThisInitialized(self) {
3019
+ if (self === void 0) {
3020
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3021
+ }
3022
+ return self;
3023
+ }
3024
+
3025
+ function _possibleConstructorReturn(self, call) {
3026
+ if (call && (_typeof$1(call) === "object" || typeof call === "function")) {
3027
+ return call;
3028
+ } else if (call !== void 0) {
3029
+ throw new TypeError("Derived constructors may only return object or undefined");
3030
+ }
3031
+ return _assertThisInitialized(self);
3032
+ }
3033
+
3034
+ function _createSuper(Derived) {
3035
+ var hasNativeReflectConstruct = _isNativeReflectConstruct();
3036
+ return function _createSuperInternal() {
3037
+ var Super = _getPrototypeOf(Derived),
3038
+ result;
3039
+ if (hasNativeReflectConstruct) {
3040
+ var NewTarget = _getPrototypeOf(this).constructor;
3041
+ result = Reflect.construct(Super, arguments, NewTarget);
3042
+ } else {
3043
+ result = Super.apply(this, arguments);
3044
+ }
3045
+ return _possibleConstructorReturn(this, result);
3046
+ };
3047
+ }
3048
+
3049
+ /**
3050
+ * Fallback to findDOMNode if origin ref do not provide any dom element
3051
+ */
3052
+ var DomWrapper = /*#__PURE__*/function (_React$Component) {
3053
+ _inherits(DomWrapper, _React$Component);
3054
+ var _super = _createSuper(DomWrapper);
3055
+ function DomWrapper() {
3056
+ _classCallCheck(this, DomWrapper);
3057
+ return _super.apply(this, arguments);
3058
+ }
3059
+ _createClass(DomWrapper, [{
3060
+ key: "render",
3061
+ value: function render() {
3062
+ return this.props.children;
3063
+ }
3064
+ }]);
3065
+ return DomWrapper;
3066
+ }(react.Component);
3067
+
3068
+ var CollectionContext = /*#__PURE__*/react.createContext(null);
3069
+ /**
3070
+ * Collect all the resize event from children ResizeObserver
3071
+ */
3072
+ function Collection(_ref) {
3073
+ var children = _ref.children,
3074
+ onBatchResize = _ref.onBatchResize;
3075
+ var resizeIdRef = react.useRef(0);
3076
+ var resizeInfosRef = react.useRef([]);
3077
+ var onCollectionResize = react.useContext(CollectionContext);
3078
+ var onResize = react.useCallback(function (size, element, data) {
3079
+ resizeIdRef.current += 1;
3080
+ var currentId = resizeIdRef.current;
3081
+ resizeInfosRef.current.push({
3082
+ size: size,
3083
+ element: element,
3084
+ data: data
3085
+ });
3086
+ Promise.resolve().then(function () {
3087
+ if (currentId === resizeIdRef.current) {
3088
+ onBatchResize === null || onBatchResize === void 0 ? void 0 : onBatchResize(resizeInfosRef.current);
3089
+ resizeInfosRef.current = [];
3090
+ }
3091
+ });
3092
+ // Continue bubbling if parent exist
3093
+ onCollectionResize === null || onCollectionResize === void 0 ? void 0 : onCollectionResize(size, element, data);
3094
+ }, [onBatchResize, onCollectionResize]);
3095
+ return /*#__PURE__*/react.createElement(CollectionContext.Provider, {
3096
+ value: onResize
3097
+ }, children);
3098
+ }
3099
+
3100
+ function SingleObserver(props, ref) {
3101
+ var children = props.children,
3102
+ disabled = props.disabled;
3103
+ var elementRef = react.useRef(null);
3104
+ var wrapperRef = react.useRef(null);
3105
+ var onCollectionResize = react.useContext(CollectionContext);
3106
+ // =========================== Children ===========================
3107
+ var isRenderProps = typeof children === 'function';
3108
+ var mergedChildren = isRenderProps ? children(elementRef) : children;
3109
+ // ============================= Size =============================
3110
+ var sizeRef = react.useRef({
3111
+ width: -1,
3112
+ height: -1,
3113
+ offsetWidth: -1,
3114
+ offsetHeight: -1
3115
+ });
3116
+ // ============================= Ref ==============================
3117
+ var canRef = !isRenderProps && /*#__PURE__*/react.isValidElement(mergedChildren) && supportRef(mergedChildren);
3118
+ var originRef = canRef ? mergedChildren.ref : null;
3119
+ var mergedRef = react.useMemo(function () {
3120
+ return composeRef(originRef, elementRef);
3121
+ }, [originRef, elementRef]);
3122
+ var getDom = function getDom() {
3123
+ return findDOMNode(elementRef.current) || findDOMNode(wrapperRef.current);
3124
+ };
3125
+ react.useImperativeHandle(ref, function () {
3126
+ return getDom();
3127
+ });
3128
+ // =========================== Observe ============================
3129
+ var propsRef = react.useRef(props);
3130
+ propsRef.current = props;
3131
+ // Handler
3132
+ var onInternalResize = react.useCallback(function (target) {
3133
+ var _propsRef$current = propsRef.current,
3134
+ onResize = _propsRef$current.onResize,
3135
+ data = _propsRef$current.data;
3136
+ var _target$getBoundingCl = target.getBoundingClientRect(),
3137
+ width = _target$getBoundingCl.width,
3138
+ height = _target$getBoundingCl.height;
3139
+ var offsetWidth = target.offsetWidth,
3140
+ offsetHeight = target.offsetHeight;
3141
+ /**
3142
+ * Resize observer trigger when content size changed.
3143
+ * In most case we just care about element size,
3144
+ * let's use `boundary` instead of `contentRect` here to avoid shaking.
3145
+ */
3146
+ var fixedWidth = Math.floor(width);
3147
+ var fixedHeight = Math.floor(height);
3148
+ if (sizeRef.current.width !== fixedWidth || sizeRef.current.height !== fixedHeight || sizeRef.current.offsetWidth !== offsetWidth || sizeRef.current.offsetHeight !== offsetHeight) {
3149
+ var size = {
3150
+ width: fixedWidth,
3151
+ height: fixedHeight,
3152
+ offsetWidth: offsetWidth,
3153
+ offsetHeight: offsetHeight
3154
+ };
3155
+ sizeRef.current = size;
3156
+ // IE is strange, right?
3157
+ var mergedOffsetWidth = offsetWidth === Math.round(width) ? width : offsetWidth;
3158
+ var mergedOffsetHeight = offsetHeight === Math.round(height) ? height : offsetHeight;
3159
+ var sizeInfo = _objectSpread2(_objectSpread2({}, size), {}, {
3160
+ offsetWidth: mergedOffsetWidth,
3161
+ offsetHeight: mergedOffsetHeight
3162
+ });
3163
+ // Let collection know what happened
3164
+ onCollectionResize === null || onCollectionResize === void 0 ? void 0 : onCollectionResize(sizeInfo, target, data);
3165
+ if (onResize) {
3166
+ // defer the callback but not defer to next frame
3167
+ Promise.resolve().then(function () {
3168
+ onResize(sizeInfo, target);
3169
+ });
3170
+ }
3171
+ }
3172
+ }, []);
3173
+ // Dynamic observe
3174
+ react.useEffect(function () {
3175
+ var currentElement = getDom();
3176
+ if (currentElement && !disabled) {
3177
+ observe(currentElement, onInternalResize);
3178
+ }
3179
+ return function () {
3180
+ return unobserve(currentElement, onInternalResize);
3181
+ };
3182
+ }, [elementRef.current, disabled]);
3183
+ // ============================ Render ============================
3184
+ return /*#__PURE__*/react.createElement(DomWrapper, {
3185
+ ref: wrapperRef
3186
+ }, canRef ? /*#__PURE__*/react.cloneElement(mergedChildren, {
3187
+ ref: mergedRef
3188
+ }) : mergedChildren);
3189
+ }
3190
+ var RefSingleObserver = /*#__PURE__*/react.forwardRef(SingleObserver);
3191
+
3192
+ var INTERNAL_PREFIX_KEY = 'rc-observer-key';
3193
+ function ResizeObserver(props, ref) {
3194
+ var children = props.children;
3195
+ var childNodes = typeof children === 'function' ? [children] : toArray(children);
3196
+ return childNodes.map(function (child, index) {
3197
+ var key = (child === null || child === void 0 ? void 0 : child.key) || "".concat(INTERNAL_PREFIX_KEY, "-").concat(index);
3198
+ return /*#__PURE__*/react.createElement(RefSingleObserver, _extends({}, props, {
3199
+ key: key,
3200
+ ref: index === 0 ? ref : undefined
3201
+ }), child);
3202
+ });
3203
+ }
3204
+ var RefResizeObserver = /*#__PURE__*/react.forwardRef(ResizeObserver);
3205
+ RefResizeObserver.Collection = Collection;
3206
+
3207
+ function canUseDom() {
3208
+ return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
3209
+ }
3210
+
3211
+ /**
3212
+ * Wrap `React.useLayoutEffect` which will not throw warning message in test env
3213
+ */
3214
+ var useInternalLayoutEffect = canUseDom() ? react.useLayoutEffect : react.useEffect;
3215
+ var useLayoutEffect = function useLayoutEffect(callback, deps) {
3216
+ var firstMountRef = react.useRef(true);
3217
+ useInternalLayoutEffect(function () {
3218
+ return callback(firstMountRef.current);
3219
+ }, deps);
3220
+
3221
+ // We tell react that first mount has passed
3222
+ useInternalLayoutEffect(function () {
3223
+ firstMountRef.current = false;
3224
+ return function () {
3225
+ firstMountRef.current = true;
3226
+ };
3227
+ }, []);
3228
+ };
3229
+
3230
+ var _excluded$2 = ["prefixCls", "invalidate", "item", "renderItem", "responsive", "responsiveDisabled", "registerSize", "itemKey", "className", "style", "children", "display", "order", "component"];
3231
+ // Use shared variable to save bundle size
3232
+ var UNDEFINED = undefined;
3233
+ function InternalItem(props, ref) {
3234
+ var prefixCls = props.prefixCls,
3235
+ invalidate = props.invalidate,
3236
+ item = props.item,
3237
+ renderItem = props.renderItem,
3238
+ responsive = props.responsive,
3239
+ responsiveDisabled = props.responsiveDisabled,
3240
+ registerSize = props.registerSize,
3241
+ itemKey = props.itemKey,
3242
+ className = props.className,
3243
+ style = props.style,
3244
+ children = props.children,
3245
+ display = props.display,
3246
+ order = props.order,
3247
+ _props$component = props.component,
3248
+ Component = _props$component === void 0 ? 'div' : _props$component,
3249
+ restProps = _objectWithoutProperties(props, _excluded$2);
3250
+ var mergedHidden = responsive && !display;
3251
+ // ================================ Effect ================================
3252
+ function internalRegisterSize(width) {
3253
+ registerSize(itemKey, width);
3254
+ }
3255
+ react.useEffect(function () {
3256
+ return function () {
3257
+ internalRegisterSize(null);
3258
+ };
3259
+ }, []);
3260
+ // ================================ Render ================================
3261
+ var childNode = renderItem && item !== UNDEFINED ? renderItem(item) : children;
3262
+ var overflowStyle;
3263
+ if (!invalidate) {
3264
+ overflowStyle = {
3265
+ opacity: mergedHidden ? 0 : 1,
3266
+ height: mergedHidden ? 0 : UNDEFINED,
3267
+ overflowY: mergedHidden ? 'hidden' : UNDEFINED,
3268
+ order: responsive ? order : UNDEFINED,
3269
+ pointerEvents: mergedHidden ? 'none' : UNDEFINED,
3270
+ position: mergedHidden ? 'absolute' : UNDEFINED
3271
+ };
3272
+ }
3273
+ var overflowProps = {};
3274
+ if (mergedHidden) {
3275
+ overflowProps['aria-hidden'] = true;
3276
+ }
3277
+ var itemNode = /*#__PURE__*/react.createElement(Component, _extends$1({
3278
+ className: classnames(!invalidate && prefixCls, className),
3279
+ style: _objectSpread2$1(_objectSpread2$1({}, overflowStyle), style)
3280
+ }, overflowProps, restProps, {
3281
+ ref: ref
3282
+ }), childNode);
3283
+ if (responsive) {
3284
+ itemNode = /*#__PURE__*/react.createElement(RefResizeObserver, {
3285
+ onResize: function onResize(_ref) {
3286
+ var offsetWidth = _ref.offsetWidth;
3287
+ internalRegisterSize(offsetWidth);
3288
+ },
3289
+ disabled: responsiveDisabled
3290
+ }, itemNode);
3291
+ }
3292
+ return itemNode;
3293
+ }
3294
+ var Item = /*#__PURE__*/react.forwardRef(InternalItem);
3295
+ Item.displayName = 'Item';
3296
+
3297
+ function useEvent(callback) {
3298
+ var fnRef = react.useRef();
3299
+ fnRef.current = callback;
3300
+ var memoFn = react.useCallback(function () {
3301
+ var _fnRef$current;
3302
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3303
+ args[_key] = arguments[_key];
3304
+ }
3305
+ return (_fnRef$current = fnRef.current) === null || _fnRef$current === void 0 ? void 0 : _fnRef$current.call.apply(_fnRef$current, [fnRef].concat(args));
3306
+ }, []);
3307
+ return memoFn;
3308
+ }
3309
+
3310
+ var raf = function raf(callback) {
3311
+ return +setTimeout(callback, 16);
3312
+ };
3313
+ var caf = function caf(num) {
3314
+ return clearTimeout(num);
3315
+ };
3316
+ if (typeof window !== 'undefined' && 'requestAnimationFrame' in window) {
3317
+ raf = function raf(callback) {
3318
+ return window.requestAnimationFrame(callback);
3319
+ };
3320
+ caf = function caf(handle) {
3321
+ return window.cancelAnimationFrame(handle);
3322
+ };
3323
+ }
3324
+ var rafUUID = 0;
3325
+ var rafIds = new Map();
3326
+ function cleanup(id) {
3327
+ rafIds.delete(id);
3328
+ }
3329
+ var wrapperRaf = function wrapperRaf(callback) {
3330
+ var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
3331
+ rafUUID += 1;
3332
+ var id = rafUUID;
3333
+ function callRef(leftTimes) {
3334
+ if (leftTimes === 0) {
3335
+ // Clean up
3336
+ cleanup(id);
3337
+
3338
+ // Trigger
3339
+ callback();
3340
+ } else {
3341
+ // Next raf
3342
+ var realId = raf(function () {
3343
+ callRef(leftTimes - 1);
3344
+ });
3345
+
3346
+ // Bind real raf id
3347
+ rafIds.set(id, realId);
3348
+ }
3349
+ }
3350
+ callRef(times);
3351
+ return id;
3352
+ };
3353
+ wrapperRaf.cancel = function (id) {
3354
+ var realId = rafIds.get(id);
3355
+ cleanup(realId);
3356
+ return caf(realId);
3357
+ };
3358
+
3359
+ function channelUpdate(callback) {
3360
+ if (typeof MessageChannel === 'undefined') {
3361
+ wrapperRaf(callback);
3362
+ } else {
3363
+ var channel = new MessageChannel();
3364
+ channel.port1.onmessage = function () {
3365
+ return callback();
3366
+ };
3367
+ channel.port2.postMessage(undefined);
3368
+ }
3369
+ }
3370
+
3371
+ /**
3372
+ * Batcher for record any `useEffectState` need update.
3373
+ */
3374
+ function useBatcher() {
3375
+ // Updater Trigger
3376
+ var updateFuncRef = react.useRef(null);
3377
+ // Notify update
3378
+ var notifyEffectUpdate = function notifyEffectUpdate(callback) {
3379
+ if (!updateFuncRef.current) {
3380
+ updateFuncRef.current = [];
3381
+ channelUpdate(function () {
3382
+ reactDom.unstable_batchedUpdates(function () {
3383
+ updateFuncRef.current.forEach(function (fn) {
3384
+ fn();
3385
+ });
3386
+ updateFuncRef.current = null;
3387
+ });
3388
+ });
3389
+ }
3390
+ updateFuncRef.current.push(callback);
3391
+ };
3392
+ return notifyEffectUpdate;
3393
+ }
3394
+ /**
3395
+ * Trigger state update by `useLayoutEffect` to save perf.
3396
+ */
3397
+ function useEffectState(notifyEffectUpdate, defaultValue) {
3398
+ // Value
3399
+ var _React$useState = react.useState(defaultValue),
3400
+ _React$useState2 = _slicedToArray(_React$useState, 2),
3401
+ stateValue = _React$useState2[0],
3402
+ setStateValue = _React$useState2[1];
3403
+ // Set State
3404
+ var setEffectVal = useEvent(function (nextValue) {
3405
+ notifyEffectUpdate(function () {
3406
+ setStateValue(nextValue);
3407
+ });
3408
+ });
3409
+ return [stateValue, setEffectVal];
3410
+ }
3411
+
3412
+ var OverflowContext = /*#__PURE__*/react.createContext(null);
3413
+
3414
+ var _excluded$1 = ["component"],
3415
+ _excluded2 = ["className"],
3416
+ _excluded3 = ["className"];
3417
+ var InternalRawItem = function InternalRawItem(props, ref) {
3418
+ var context = react.useContext(OverflowContext);
3419
+ // Render directly when context not provided
3420
+ if (!context) {
3421
+ var _props$component = props.component,
3422
+ Component = _props$component === void 0 ? 'div' : _props$component,
3423
+ _restProps = _objectWithoutProperties(props, _excluded$1);
3424
+ return /*#__PURE__*/react.createElement(Component, _extends$1({}, _restProps, {
3425
+ ref: ref
3426
+ }));
3427
+ }
3428
+ var contextClassName = context.className,
3429
+ restContext = _objectWithoutProperties(context, _excluded2);
3430
+ var className = props.className,
3431
+ restProps = _objectWithoutProperties(props, _excluded3);
3432
+ // Do not pass context to sub item to avoid multiple measure
3433
+ return /*#__PURE__*/react.createElement(OverflowContext.Provider, {
3434
+ value: null
3435
+ }, /*#__PURE__*/react.createElement(Item, _extends$1({
3436
+ ref: ref,
3437
+ className: classnames(contextClassName, className)
3438
+ }, restContext, restProps)));
3439
+ };
3440
+ var RawItem = /*#__PURE__*/react.forwardRef(InternalRawItem);
3441
+ RawItem.displayName = 'RawItem';
3442
+
3443
+ var _excluded = ["prefixCls", "data", "renderItem", "renderRawItem", "itemKey", "itemWidth", "ssr", "style", "className", "maxCount", "renderRest", "renderRawRest", "suffix", "component", "itemComponent", "onVisibleChange"];
3444
+ var RESPONSIVE = 'responsive';
3445
+ var INVALIDATE = 'invalidate';
3446
+ function defaultRenderRest(omittedItems) {
3447
+ return "+ ".concat(omittedItems.length, " ...");
3448
+ }
3449
+ function Overflow(props, ref) {
3450
+ var _props$prefixCls = props.prefixCls,
3451
+ prefixCls = _props$prefixCls === void 0 ? 'rc-overflow' : _props$prefixCls,
3452
+ _props$data = props.data,
3453
+ data = _props$data === void 0 ? [] : _props$data,
3454
+ renderItem = props.renderItem,
3455
+ renderRawItem = props.renderRawItem,
3456
+ itemKey = props.itemKey,
3457
+ _props$itemWidth = props.itemWidth,
3458
+ itemWidth = _props$itemWidth === void 0 ? 10 : _props$itemWidth,
3459
+ ssr = props.ssr,
3460
+ style = props.style,
3461
+ className = props.className,
3462
+ maxCount = props.maxCount,
3463
+ renderRest = props.renderRest,
3464
+ renderRawRest = props.renderRawRest,
3465
+ suffix = props.suffix,
3466
+ _props$component = props.component,
3467
+ Component = _props$component === void 0 ? 'div' : _props$component,
3468
+ itemComponent = props.itemComponent,
3469
+ onVisibleChange = props.onVisibleChange,
3470
+ restProps = _objectWithoutProperties(props, _excluded);
3471
+ var fullySSR = ssr === 'full';
3472
+ var notifyEffectUpdate = useBatcher();
3473
+ var _useEffectState = useEffectState(notifyEffectUpdate, null),
3474
+ _useEffectState2 = _slicedToArray(_useEffectState, 2),
3475
+ containerWidth = _useEffectState2[0],
3476
+ setContainerWidth = _useEffectState2[1];
3477
+ var mergedContainerWidth = containerWidth || 0;
3478
+ var _useEffectState3 = useEffectState(notifyEffectUpdate, new Map()),
3479
+ _useEffectState4 = _slicedToArray(_useEffectState3, 2),
3480
+ itemWidths = _useEffectState4[0],
3481
+ setItemWidths = _useEffectState4[1];
3482
+ var _useEffectState5 = useEffectState(notifyEffectUpdate, 0),
3483
+ _useEffectState6 = _slicedToArray(_useEffectState5, 2),
3484
+ prevRestWidth = _useEffectState6[0],
3485
+ setPrevRestWidth = _useEffectState6[1];
3486
+ var _useEffectState7 = useEffectState(notifyEffectUpdate, 0),
3487
+ _useEffectState8 = _slicedToArray(_useEffectState7, 2),
3488
+ restWidth = _useEffectState8[0],
3489
+ setRestWidth = _useEffectState8[1];
3490
+ var _useEffectState9 = useEffectState(notifyEffectUpdate, 0),
3491
+ _useEffectState10 = _slicedToArray(_useEffectState9, 2),
3492
+ suffixWidth = _useEffectState10[0],
3493
+ setSuffixWidth = _useEffectState10[1];
3494
+ var _useState = react.useState(null),
3495
+ _useState2 = _slicedToArray(_useState, 2),
3496
+ suffixFixedStart = _useState2[0],
3497
+ setSuffixFixedStart = _useState2[1];
3498
+ var _useState3 = react.useState(null),
3499
+ _useState4 = _slicedToArray(_useState3, 2),
3500
+ displayCount = _useState4[0],
3501
+ setDisplayCount = _useState4[1];
3502
+ var mergedDisplayCount = react.useMemo(function () {
3503
+ if (displayCount === null && fullySSR) {
3504
+ return Number.MAX_SAFE_INTEGER;
3505
+ }
3506
+ return displayCount || 0;
3507
+ }, [displayCount, containerWidth]);
3508
+ var _useState5 = react.useState(false),
3509
+ _useState6 = _slicedToArray(_useState5, 2),
3510
+ restReady = _useState6[0],
3511
+ setRestReady = _useState6[1];
3512
+ var itemPrefixCls = "".concat(prefixCls, "-item");
3513
+ // Always use the max width to avoid blink
3514
+ var mergedRestWidth = Math.max(prevRestWidth, restWidth);
3515
+ // ================================= Data =================================
3516
+ var isResponsive = maxCount === RESPONSIVE;
3517
+ var shouldResponsive = data.length && isResponsive;
3518
+ var invalidate = maxCount === INVALIDATE;
3519
+ /**
3520
+ * When is `responsive`, we will always render rest node to get the real width of it for calculation
3521
+ */
3522
+ var showRest = shouldResponsive || typeof maxCount === 'number' && data.length > maxCount;
3523
+ var mergedData = react.useMemo(function () {
3524
+ var items = data;
3525
+ if (shouldResponsive) {
3526
+ if (containerWidth === null && fullySSR) {
3527
+ items = data;
3528
+ } else {
3529
+ items = data.slice(0, Math.min(data.length, mergedContainerWidth / itemWidth));
3530
+ }
3531
+ } else if (typeof maxCount === 'number') {
3532
+ items = data.slice(0, maxCount);
3533
+ }
3534
+ return items;
3535
+ }, [data, itemWidth, containerWidth, maxCount, shouldResponsive]);
3536
+ var omittedItems = react.useMemo(function () {
3537
+ if (shouldResponsive) {
3538
+ return data.slice(mergedDisplayCount + 1);
3539
+ }
3540
+ return data.slice(mergedData.length);
3541
+ }, [data, mergedData, shouldResponsive, mergedDisplayCount]);
3542
+ // ================================= Item =================================
3543
+ var getKey = react.useCallback(function (item, index) {
3544
+ var _ref;
3545
+ if (typeof itemKey === 'function') {
3546
+ return itemKey(item);
3547
+ }
3548
+ return (_ref = itemKey && (item === null || item === void 0 ? void 0 : item[itemKey])) !== null && _ref !== void 0 ? _ref : index;
3549
+ }, [itemKey]);
3550
+ var mergedRenderItem = react.useCallback(renderItem || function (item) {
3551
+ return item;
3552
+ }, [renderItem]);
3553
+ function updateDisplayCount(count, suffixFixedStartVal, notReady) {
3554
+ // React 18 will sync render even when the value is same in some case.
3555
+ // We take `mergedData` as deps which may cause dead loop if it's dynamic generate.
3556
+ // ref: https://github.com/ant-design/ant-design/issues/36559
3557
+ if (displayCount === count && (suffixFixedStartVal === undefined || suffixFixedStartVal === suffixFixedStart)) {
3558
+ return;
3559
+ }
3560
+ setDisplayCount(count);
3561
+ if (!notReady) {
3562
+ setRestReady(count < data.length - 1);
3563
+ onVisibleChange === null || onVisibleChange === void 0 ? void 0 : onVisibleChange(count);
3564
+ }
3565
+ if (suffixFixedStartVal !== undefined) {
3566
+ setSuffixFixedStart(suffixFixedStartVal);
3567
+ }
3568
+ }
3569
+ // ================================= Size =================================
3570
+ function onOverflowResize(_, element) {
3571
+ setContainerWidth(element.clientWidth);
3572
+ }
3573
+ function registerSize(key, width) {
3574
+ setItemWidths(function (origin) {
3575
+ var clone = new Map(origin);
3576
+ if (width === null) {
3577
+ clone.delete(key);
3578
+ } else {
3579
+ clone.set(key, width);
3580
+ }
3581
+ return clone;
3582
+ });
3583
+ }
3584
+ function registerOverflowSize(_, width) {
3585
+ setRestWidth(width);
3586
+ setPrevRestWidth(restWidth);
3587
+ }
3588
+ function registerSuffixSize(_, width) {
3589
+ setSuffixWidth(width);
3590
+ }
3591
+ // ================================ Effect ================================
3592
+ function getItemWidth(index) {
3593
+ return itemWidths.get(getKey(mergedData[index], index));
3594
+ }
3595
+ useLayoutEffect(function () {
3596
+ if (mergedContainerWidth && typeof mergedRestWidth === 'number' && mergedData) {
3597
+ var totalWidth = suffixWidth;
3598
+ var len = mergedData.length;
3599
+ var lastIndex = len - 1;
3600
+ // When data count change to 0, reset this since not loop will reach
3601
+ if (!len) {
3602
+ updateDisplayCount(0, null);
3603
+ return;
3604
+ }
3605
+ for (var i = 0; i < len; i += 1) {
3606
+ var currentItemWidth = getItemWidth(i);
3607
+ // Fully will always render
3608
+ if (fullySSR) {
3609
+ currentItemWidth = currentItemWidth || 0;
3610
+ }
3611
+ // Break since data not ready
3612
+ if (currentItemWidth === undefined) {
3613
+ updateDisplayCount(i - 1, undefined, true);
3614
+ break;
3615
+ }
3616
+ // Find best match
3617
+ totalWidth += currentItemWidth;
3618
+ if (
3619
+ // Only one means `totalWidth` is the final width
3620
+ lastIndex === 0 && totalWidth <= mergedContainerWidth ||
3621
+ // Last two width will be the final width
3622
+ i === lastIndex - 1 && totalWidth + getItemWidth(lastIndex) <= mergedContainerWidth) {
3623
+ // Additional check if match the end
3624
+ updateDisplayCount(lastIndex, null);
3625
+ break;
3626
+ } else if (totalWidth + mergedRestWidth > mergedContainerWidth) {
3627
+ // Can not hold all the content to show rest
3628
+ updateDisplayCount(i - 1, totalWidth - currentItemWidth - suffixWidth + restWidth);
3629
+ break;
3630
+ }
3631
+ }
3632
+ if (suffix && getItemWidth(0) + suffixWidth > mergedContainerWidth) {
3633
+ setSuffixFixedStart(null);
3634
+ }
3635
+ }
3636
+ }, [mergedContainerWidth, itemWidths, restWidth, suffixWidth, getKey, mergedData]);
3637
+ // ================================ Render ================================
3638
+ var displayRest = restReady && !!omittedItems.length;
3639
+ var suffixStyle = {};
3640
+ if (suffixFixedStart !== null && shouldResponsive) {
3641
+ suffixStyle = {
3642
+ position: 'absolute',
3643
+ left: suffixFixedStart,
3644
+ top: 0
3645
+ };
3646
+ }
3647
+ var itemSharedProps = {
3648
+ prefixCls: itemPrefixCls,
3649
+ responsive: shouldResponsive,
3650
+ component: itemComponent,
3651
+ invalidate: invalidate
3652
+ };
3653
+ // >>>>> Choice render fun by `renderRawItem`
3654
+ var internalRenderItemNode = renderRawItem ? function (item, index) {
3655
+ var key = getKey(item, index);
3656
+ return /*#__PURE__*/react.createElement(OverflowContext.Provider, {
3657
+ key: key,
3658
+ value: _objectSpread2$1(_objectSpread2$1({}, itemSharedProps), {}, {
3659
+ order: index,
3660
+ item: item,
3661
+ itemKey: key,
3662
+ registerSize: registerSize,
3663
+ display: index <= mergedDisplayCount
3664
+ })
3665
+ }, renderRawItem(item, index));
3666
+ } : function (item, index) {
3667
+ var key = getKey(item, index);
3668
+ return /*#__PURE__*/react.createElement(Item, _extends$1({}, itemSharedProps, {
3669
+ order: index,
3670
+ key: key,
3671
+ item: item,
3672
+ renderItem: mergedRenderItem,
3673
+ itemKey: key,
3674
+ registerSize: registerSize,
3675
+ display: index <= mergedDisplayCount
3676
+ }));
3677
+ };
3678
+ // >>>>> Rest node
3679
+ var restNode;
3680
+ var restContextProps = {
3681
+ order: displayRest ? mergedDisplayCount : Number.MAX_SAFE_INTEGER,
3682
+ className: "".concat(itemPrefixCls, "-rest"),
3683
+ registerSize: registerOverflowSize,
3684
+ display: displayRest
3685
+ };
3686
+ if (!renderRawRest) {
3687
+ var mergedRenderRest = renderRest || defaultRenderRest;
3688
+ restNode = /*#__PURE__*/react.createElement(Item, _extends$1({}, itemSharedProps, restContextProps), typeof mergedRenderRest === 'function' ? mergedRenderRest(omittedItems) : mergedRenderRest);
3689
+ } else if (renderRawRest) {
3690
+ restNode = /*#__PURE__*/react.createElement(OverflowContext.Provider, {
3691
+ value: _objectSpread2$1(_objectSpread2$1({}, itemSharedProps), restContextProps)
3692
+ }, renderRawRest(omittedItems));
3693
+ }
3694
+ var overflowNode = /*#__PURE__*/react.createElement(Component, _extends$1({
3695
+ className: classnames(!invalidate && prefixCls, className),
3696
+ style: style,
3697
+ ref: ref
3698
+ }, restProps), mergedData.map(internalRenderItemNode), showRest ? restNode : null, suffix && /*#__PURE__*/react.createElement(Item, _extends$1({}, itemSharedProps, {
3699
+ responsive: isResponsive,
3700
+ responsiveDisabled: !shouldResponsive,
3701
+ order: mergedDisplayCount,
3702
+ className: "".concat(itemPrefixCls, "-suffix"),
3703
+ registerSize: registerSuffixSize,
3704
+ display: true,
3705
+ style: suffixStyle
3706
+ }), suffix));
3707
+ if (isResponsive) {
3708
+ overflowNode = /*#__PURE__*/react.createElement(RefResizeObserver, {
3709
+ onResize: onOverflowResize,
3710
+ disabled: !shouldResponsive
3711
+ }, overflowNode);
3712
+ }
3713
+ return overflowNode;
3714
+ }
3715
+ var ForwardOverflow = /*#__PURE__*/react.forwardRef(Overflow);
3716
+ ForwardOverflow.displayName = 'Overflow';
3717
+ ForwardOverflow.Item = RawItem;
3718
+ ForwardOverflow.RESPONSIVE = RESPONSIVE;
3719
+ ForwardOverflow.INVALIDATE = INVALIDATE;
3720
+
3721
+ const rcOverflowCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");.size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}.input-size-large{height:40px}.input-size-medium{height:32px}.input-size-small{height:24px}.resize-none textarea{resize:none}.resize-vertical textarea{resize:vertical}.resize-auto textarea{height:auto;resize:none}.textarea-size-large{padding:4px 0 0 4px;min-height:40px}.textarea-size-large .bcm-input-element{min-height:calc((40px - 8px) + 2px)}.textarea-size-large .input-clear-button{height:calc( 40px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-medium{padding:4px 0 0 4px;min-height:32px}.textarea-size-medium .bcm-input-element{min-height:calc((32px - 8px) + 2px)}.textarea-size-medium .input-clear-button{height:calc( 32px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-small{padding:0px 0 0 4px;min-height:24px}.textarea-size-small .bcm-input-element{min-height:calc((24px - 8px) + 2px)}.textarea-size-small .input-clear-button{height:calc( 24px - 16px );top:8px;padding:0;margin-right:8px}.rc-overflow{display:flex;flex-direction:row;flex-wrap:nowrap;width:100%}.rc-overflow-item{transition:all 0.3s ease;padding:0 2px;display:flex;align-items:center;justify-content:center}";
3722
+
3723
+ const BcmRcOverflow = class {
3724
+ constructor(hostRef) {
3725
+ registerInstance(this, hostRef);
3726
+ this.selectOtherTag = createEvent(this, "bcm-select-other-tag", 7);
3727
+ this.selectTag = createEvent(this, "bcm-select-tag", 7);
3728
+ this.deleteTag = createEvent(this, "bcm-delete-tag", 7);
3729
+ this.renderItem = item => {
3730
+ return react.createElement("bcm-tooltip", {
3731
+ placement: "bottom",
3732
+ message: item.text,
3733
+ trigger: "hover",
3734
+ }, react.createElement("div", {
3735
+ id: item.value + "-tag",
3736
+ className: "bcm-tag",
3737
+ onClick: ({ target }) => this.onClickControl(target, item, false),
3738
+ }, react.createElement("span", { className: "bcm-tag__content dismissable" },
3739
+ // .bcm-tag__content span {
3740
+ // display: block;
3741
+ // max-width: 38px;
3742
+ // white-space: nowrap;
3743
+ // overflow: hidden;
3744
+ // text-overflow: ellipsis;
3745
+ react.createElement("div", { className: "value tw-block tw-max-w-[38px] tw-overflow-hidden tw-overflow-ellipsis tw-whitespace-nowrap" }, item.text), react.createElement("span", {
3746
+ className: "right close-button",
3747
+ }, react.createElement("bcm-icon", {
3748
+ icon: "fa fa-times",
3749
+ })))));
3750
+ };
3751
+ this.renderRest = items => {
3752
+ const titles = (items === null || items === void 0 ? void 0 : items.sort((a, b) => +a.ct - +b.ct).slice(0, 15).map(item => StringHelper.textLimitter(item.text, 40, true)).toString().split(",").join("\r\n")) + (items.length > 15 ? "\r\n..." : "");
3753
+ return react.createElement("bcm-tooltip", {
3754
+ placement: "bottom",
3755
+ message: titles,
3756
+ trigger: "hover",
3757
+ }, react.createElement("div", {
3758
+ className: "bcm-tag bcm-tag--other",
3759
+ onClick: ({ target }) => this.onClickControl(target, items, true),
3760
+ }, react.createElement("span", { className: `bcm-tag__content dismissable ${this.checked ? "checkable checked" : ""}` }, react.createElement("span", { className: "value" }, `+${items === null || items === void 0 ? void 0 : items.length}`), react.createElement("span", { className: "right close-button" }, react.createElement("bcm-icon", {
3761
+ icon: "fa fa-times",
3762
+ })))));
3763
+ };
3764
+ this._id = Generate.UID();
3765
+ this.maxCount = 1;
3766
+ this.data = [];
3767
+ this.checked = false;
3768
+ }
3769
+ isClickDismiss(e) {
3770
+ return e["s-hn"] === "BCM-ICON";
3771
+ }
3772
+ onClickControl(e, item, isOtherTag = false) {
3773
+ const isClickClose = this.isClickDismiss(e);
3774
+ isClickClose && this.deleteTag.emit({ id: Array.isArray(item) ? item.map(i => i.value) : item.value }) && this.checked && (this.checked = false);
3775
+ !isOtherTag && this.selectTag.emit({ id: item.value }) && this.checked && (this.checked = false);
3776
+ if (isOtherTag && !isClickClose) {
3777
+ this.checked = !this.checked;
3778
+ this.selectOtherTag.emit({ id: item === null || item === void 0 ? void 0 : item.map(i => i.value), checked: this.checked });
3779
+ }
3780
+ }
3781
+ componentWillRender() {
3782
+ const { data, renderItem, renderRest, maxCount } = this;
3783
+ this.overflowInstance = react.createElement(ForwardOverflow, {
3784
+ data,
3785
+ renderItem,
3786
+ renderRest,
3787
+ maxCount,
3788
+ });
3789
+ reactDom.render(this.overflowInstance, this.el);
3790
+ }
3791
+ get el() { return getElement(this); }
3792
+ };
3793
+ BcmRcOverflow.style = rcOverflowCss;
3794
+
3795
+ const { state } = createStore({
3796
+ value: new Map(),
3797
+ });
3798
+ const setValue = val => {
3799
+ const { id, dataSource } = val;
3800
+ const data = {
3801
+ id: snq(() => id, Generate.UID),
3802
+ dataSource: dataSource && dataSource.length > 0 && recursive(dataSource),
3803
+ searchIsOnlyChilds: val.searchIsOnlyChilds,
3804
+ };
3805
+ state.value.set(data.id, data);
3806
+ };
3807
+ const recursive = (data, parentId) => {
3808
+ let recData = [];
3809
+ if (data) {
3810
+ recData = data.map(item => (Object.assign(Object.assign(Object.assign({}, item), { parentId: snq(() => parentId, null) }), (item.items && item.items.length > 0 && { items: snq(() => recursive(item.items, item.id), []) }))));
3811
+ }
3812
+ return recData;
3813
+ };
3814
+ const removeValue = _id => {
3815
+ state.value.delete(_id);
3816
+ };
3817
+ const getValue = id => snq(() => state.value.get(id), {});
3818
+ const getDataPagination = (id, limit = 3) => {
3819
+ let data = [];
3820
+ const value = getValue(id);
3821
+ if (value) {
3822
+ const { dataSource } = value;
3823
+ data = dataSource.slice(0, limit);
3824
+ }
3825
+ return data;
3826
+ };
3827
+ // //search treeview data by text
3828
+ // const searchData = (id, search, items?) => {
3829
+ // let dataSource
3830
+ // if (items && items.length > 0) {
3831
+ // dataSource = items
3832
+ // } else {
3833
+ // const value = getValue(id);
3834
+ // dataSource = value.dataSource;
3835
+ // }
3836
+ // let result = []
3837
+ // if (dataSource) {
3838
+ // dataSource.forEach(child => {
3839
+ // if (child.text.toLowerCase().includes(search.toLowerCase())) {
3840
+ // result.push(child)
3841
+ // }
3842
+ // result = result.concat(searchData(id, search, child.items))
3843
+ // })
3844
+ // };
3845
+ // return result
3846
+ // };
3847
+ //nested search
3848
+ const searchData = (id, searchText, items) => {
3849
+ let dataSource;
3850
+ if (items && items.length > 0) {
3851
+ dataSource = items;
3852
+ }
3853
+ else {
3854
+ const value = getValue(id);
3855
+ dataSource = value.dataSource;
3856
+ }
3857
+ let results = [];
3858
+ if (dataSource) {
3859
+ results.push(nestedSearch(id, dataSource, searchText));
3860
+ //return with their parents
3861
+ // dataSource.forEach(child => {
3862
+ // if (child.text.toLowerCase().includes(searchText.toLowerCase())) {
3863
+ // results.push(child)
3864
+ // } else if (child.items && child.items.length > 0) {
3865
+ // child.items = nestedSearch(child.items, searchText)
3866
+ // if (child.items.length > 0) {
3867
+ // results.push(child)
3868
+ // }
3869
+ // }
3870
+ // })
3871
+ }
3872
+ return {
3873
+ result: snq(() => Generate.flatArray(results[0].result), []),
3874
+ matching: snq(() => results[0].matching, []),
3875
+ parentIndex: snq(() => results[0].parentIndex, []),
3876
+ nestedResult: snq(() => results[0].nestedResult, []),
3877
+ };
3878
+ };
3879
+ const nestedSearch = (id, items, searchText) => {
3880
+ let matching = [];
3881
+ let parentIndex = [];
3882
+ let result = [];
3883
+ let nestedResult = [];
3884
+ const { searchIsOnlyChilds } = getValue(id);
3885
+ if (items && items.length > 0) {
3886
+ items.forEach(child => {
3887
+ let isChild = searchIsOnlyChilds && child.parentId !== null;
3888
+ let isMatching = StringHelper.slugify(child.text).indexOf(StringHelper.slugify(searchText)) > -1 ||
3889
+ (child.keywords && StringHelper.slugify(child.keywords).indexOf(StringHelper.slugify(searchText)) > -1);
3890
+ if (isMatching && (!searchIsOnlyChilds || (searchIsOnlyChilds && isChild))) {
3891
+ result.push(child.id);
3892
+ matching.push(child.id);
3893
+ parentIndex.push(child.id);
3894
+ nestedResult.push({ id: child.id, text: child.text, parentId: child.parentId });
3895
+ if (child.items && child.items.length > 0) {
3896
+ const found = nestedSearch(id, child.items, searchText);
3897
+ if (found.matching.length > 0) {
3898
+ found.matching.forEach(chi => {
3899
+ matching.push(chi);
3900
+ });
3901
+ }
3902
+ }
3903
+ }
3904
+ else if (child.items && child.items.length > 0) {
3905
+ const found = nestedSearch(id, child.items, searchText);
3906
+ if (found.result.length > 0) {
3907
+ found.result.forEach(chi => {
3908
+ result.push(chi);
3909
+ });
3910
+ result.push(child.id);
3911
+ parentIndex.push(child.id);
3912
+ nestedResult.push({ id: child.id, text: child.text, parentId: child.parentId, items: found.nestedResult });
3913
+ }
3914
+ if (found.matching.length > 0) {
3915
+ matching.push(...found.matching);
3916
+ }
3917
+ }
3918
+ });
3919
+ }
3920
+ return { result, matching, parentIndex, nestedResult };
3921
+ };
3922
+ const searchState = {
3923
+ setValue,
3924
+ removeValue,
3925
+ getValue,
3926
+ getDataPagination,
3927
+ searchData,
3928
+ };
3929
+
3930
+ const searchCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");@import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@200;400;500;600&display=swap\"); @import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@200;400;500;600&display=swap\"); @import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@200;400;500;600&display=swap\"); .size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}.input-size-large{height:40px}.input-size-medium{height:32px}.input-size-small{height:24px}.resize-none textarea{resize:none}.resize-vertical textarea{resize:vertical}.resize-auto textarea{height:auto;resize:none}.textarea-size-large{padding:4px 0 0 4px;min-height:40px}.textarea-size-large .bcm-input-element{min-height:calc((40px - 8px) + 2px)}.textarea-size-large .input-clear-button{height:calc( 40px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-medium{padding:4px 0 0 4px;min-height:32px}.textarea-size-medium .bcm-input-element{min-height:calc((32px - 8px) + 2px)}.textarea-size-medium .input-clear-button{height:calc( 32px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-small{padding:0px 0 0 4px;min-height:24px}.textarea-size-small .bcm-input-element{min-height:calc((24px - 8px) + 2px)}.textarea-size-small .input-clear-button{height:calc( 24px - 16px );top:8px;padding:0;margin-right:8px}*{box-sizing:border-box}.bcm-caption-area{font-family:\"Inter\", sans-serif;font-size:14px;line-height:calc(14px + 8px);font-weight:400;font-size:12px;line-height:calc(12px + 8px);color:var(--bcm-new-ds-color-slate-400);display:flex;flex-direction:row;align-items:flex-start;justify-content:space-between;flex-wrap:nowrap;margin-top:2px}.bcm-caption-area__text{color:var(--bcm-new-ds-color-slate-400)}.bcm-caption-area__text.default{color:var(--bcm-new-ds-color-slate-400)}.bcm-caption-area__text.info{color:var(--bcm-new-ds-color-blue-500)}.bcm-caption-area__text.success{color:var(--bcm-new-ds-color-emerald-500)}.bcm-caption-area__text.warning{color:var(--bcm-new-ds-color-amber-500)}.bcm-caption-area__text.error{color:var(--bcm-new-ds-color-red-500)}.bcm-caption-area__size-small{font-size:10px;line-height:calc(10px + 8px);min-height:calc(10px + 8px)}.bcm-caption-area__size-medium{font-size:12px;line-height:calc(12px + 8px);min-height:calc(12px + 8px)}.bcm-caption-area__size-large{font-size:14px;line-height:calc(14px + 8px);min-height:calc(14px + 8px)}*{box-sizing:border-box}.bcm-label{display:inline-flex;align-items:flex-start;grid-gap:2px}.bcm-label__text{margin-bottom:2px;font-family:\"Inter\", sans-serif;font-size:14px;line-height:calc(14px + 8px);font-weight:400;display:inline-block;color:var(--bcm-new-ds-color-slate-600)}.bcm-label__size-small{font-size:10px;line-height:calc(10px + 8px);min-height:calc(10px + 8px)}.bcm-label__size-medium{font-size:12px;line-height:calc(12px + 8px);min-height:calc(12px + 8px)}.bcm-label__size-large{font-size:14px;line-height:calc(14px + 8px);min-height:calc(14px + 8px)}.bcm-input[no-margin]{margin:0}.bcm-textarea[no-margin]{margin:0}.bcm-switch[no-margin]{margin:0}.bcm-checkbox[no-margin]{margin:0}.bcm-radio-group[no-margin]{margin:0}.bcm-checkbox-group[no-margin]{margin:0}.bcm-range[no-margin]{margin:0}.bcm-form[no-margin]{margin:0}.bcm-form-group[no-margin]{margin:0}.bcm-list[no-margin]{margin:0}.bcm-colorpicker[no-margin]{margin:0}.bcm-date-picker[no-margin]{margin:0}.bcm-time-picker[no-margin]{margin:0}.bcm-datetime-picker[no-margin]{margin:0}.bcm-select[no-margin]{margin:0}.bcm-listbox[no-margin]{margin:0}*{box-sizing:border-box}.bcm-input{display:inline-flex;flex-direction:column;width:100%;max-width:256px;margin-bottom:8px}.bcm-input.full-width{max-width:100%}.bcm-input.hidden{display:none}.bcm-input__container{font-family:\"Inter\", sans-serif;font-size:14px;line-height:calc(14px + 8px);font-weight:400;display:flex;align-items:stretch;flex-direction:row;background-color:var(--bcm-new-ds-color-white);border:1px solid var(--bcm-new-ds-color-slate-300);border-radius:4px;box-sizing:border-box;cursor:text;padding:0 0 0 4px;position:relative;width:100%}.bcm-input__container.disabled{background-color:var(--bcm-new-ds-color-slate-50);cursor:not-allowed}.bcm-input__container.disabled .bcm-input-element{color:var(--bcm-new-ds-color-slate-500)}.bcm-input__container.readonly{background-color:var(--bcm-new-ds-color-slate-50);cursor:default}.bcm-input__container.readonly .bcm-input-element{color:var(--bcm-new-ds-color-slate-600)}.bcm-input__container:not(.disabled):hover .caret-container,.bcm-input__container:not(.disabled).focused .caret-container{opacity:1}.bcm-input__container:not(.disabled):hover .input-clear-button,.bcm-input__container:not(.disabled).focused .input-clear-button{opacity:1}.bcm-input__container:not(.disabled).focused{background-color:var(--bcm-new-ds-color-slate-50)}.bcm-input__container:not(.disabled):hover{border-color:var(--bcm-color-prime-blue-6)}.bcm-input__container.empty .input-clear-button{display:none}.bcm-input__container.invalid,.bcm-input__container.error{border-color:var(--bcm-new-ds-color-red-500)}.bcm-input__container .bcm-input-element{width:100%;color:var(--bcm-new-ds-color-slate-600);flex:1;border:none;background:transparent;box-shadow:unset;padding:0 4px;font-family:\"Inter\", sans-serif;cursor:inherit;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;overflow:hidden;text-overflow:ellipsis}.bcm-input__container .bcm-input-element::placeholder{font-family:\"Inter\", sans-serif;color:var(--bcm-new-ds-color-slate-300);user-select:none}.bcm-input__container .bcm-input-element::-webkit-search-decoration,.bcm-input__container .bcm-input-element::-webkit-search-cancel-button,.bcm-input__container .bcm-input-element::-webkit-search-results-button,.bcm-input__container .bcm-input-element::-webkit-search-results-decoration,.bcm-input__container .bcm-input-element::-webkit-calendar-picker-indicator,.bcm-input__container .bcm-input-element::-webkit-inner-spin-button,.bcm-input__container .bcm-input-element::-webkit-outer-spin-button{-webkit-appearance:none}.bcm-input__container .caret-container{width:30px;display:flex;flex-direction:column;justify-content:center;align-items:stretch;border-left:1px solid #D9D9D9;transition:0.2s opacity;user-select:none;box-sizing:border-box}.bcm-input__container .caret-container .bcm-input-caret{display:flex;align-items:center;justify-content:center;color:var(--bcm-color-grey-7);cursor:pointer;flex:1}.bcm-input__container .caret-container .bcm-input-caret bcm-icon{line-height:1}.bcm-input__container .caret-container .bcm-input-caret:hover{color:var(--bcm-color-prime-blue-6)}.bcm-input__container .caret-container .bcm-input-caret:active{background-color:var(--bcm-color-grey-3)}.bcm-input__container .caret-container .bcm-input-caret:last-child{border-top:1px solid #D9D9D9}.bcm-input__container .caret-container.disabled{background-color:var(--bcm-color-grey-3)}.bcm-input__container .caret-container.disabled .bcm-input-caret{cursor:not-allowed}.bcm-input__container .input-suffix-content{display:flex;align-items:center;justify-content:center}.bcm-input__container .input-prefix:not(:empty){padding-left:4px}.bcm-input__container .input-suffix:not(:empty){min-width:24px;padding-right:4px}.bcm-input__container .input-prefix:not(:empty),.bcm-input__container .input-suffix:not(:empty){display:flex;align-items:center;justify-content:center;cursor:default;color:#64748a}.bcm-input__container .input-prefix:not(:empty) .unit-prefix,.bcm-input__container .input-suffix:not(:empty) .unit-prefix{color:#64748a}.bcm-input__container .input-prefix-button:not(:empty),.bcm-input__container .input-suffix-button:not(:empty){cursor:pointer}.bcm-input__container .caret-container,.bcm-input__container .input-clear-button{opacity:0}.bcm-input__container--small{font-size:12px}.bcm-input__container--medium{font-size:14px}.bcm-input__container--large{font-size:16px}.bcm-input__textarea.clearable .bcm-input-element{padding-right:24px}.bcm-input__textarea .input-clear-button{position:absolute;top:4px;right:0}";
3931
+
3932
+ const BcmSearch = class {
3933
+ constructor(hostRef) {
3934
+ registerInstance(this, hostRef);
3935
+ this.bcmOnSearch = createEvent(this, "bcm-on-search", 7);
3936
+ this.bcmOnSearchClear = createEvent(this, "bcm-on-search-clear", 7);
3937
+ this.debounceHandler = Generate.debounceInput((event) => this.onSearchValue(event, this), 300, false, () => {
3938
+ var _a, _b;
3939
+ this.isActiveClearable = ((_b = (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.length) > 0 && this.clearable;
3940
+ });
3941
+ this._id = Generate.UID();
3942
+ this.placeholder = "Search";
3943
+ this.disabled = false;
3944
+ this.readonly = false;
3945
+ this.clearable = true;
3946
+ this.size = Bcm.Size.medium;
3947
+ this.limit = 10;
3948
+ this.searchIsOnlyChilds = false;
3949
+ this.minSearchLength = 2;
3950
+ this.data = [];
3951
+ this.tick = {};
3952
+ this.isActiveClearable = false;
3953
+ }
3954
+ async componentDidLoad() {
3955
+ await this.initState();
3956
+ }
3957
+ async dataChanged(newValue, oldValue) {
3958
+ // console.log('data changed', newValue, oldValue)
3959
+ if (newValue !== oldValue) {
3960
+ await this.initState();
3961
+ }
3962
+ }
3963
+ async initState() {
3964
+ await searchState.setValue({
3965
+ id: this._id + "-input",
3966
+ dataSource: this.data,
3967
+ searchIsOnlyChilds: this.searchIsOnlyChilds,
3968
+ });
3969
+ await this.markForCheck();
3970
+ }
3971
+ markForCheck() {
3972
+ this.tick = Generate.UID();
3973
+ }
3974
+ handleInput() {
3975
+ // console.log("aheyya")
3976
+ }
3977
+ async onBcmFocus() {
3978
+ this.inputElement.focus();
3979
+ }
3980
+ async onBcmBlur() {
3981
+ this.inputElement.blur();
3982
+ }
3983
+ async onBcmSelect() {
3984
+ this.inputElement.select();
3985
+ }
3986
+ async setValue(newValue) {
3987
+ this.inputElement.value = newValue;
3988
+ }
3989
+ handleFocus() { }
3990
+ handleBlur() { }
3991
+ handleChange() { }
3992
+ async handleClear(eventEmit = true) {
3993
+ this.inputElement.value = '';
3994
+ const { value, id } = this.inputElement;
3995
+ searchState.searchData(id, value);
3996
+ this.isActiveClearable = false;
3997
+ this.bcmOnSearch.emit({ result: null, value: null, matching: null, parentIndex: null });
3998
+ this.bcmOnSearchClear.emit(eventEmit);
3999
+ await delay(10);
4000
+ return Promise.resolve();
4001
+ }
4002
+ onSearchValue(event, instance) {
4003
+ const { value, id } = event.target;
4004
+ const searchResult = (value === null || value === void 0 ? void 0 : value.length) >= this.minSearchLength ? searchState.searchData(id, value, null) : null;
4005
+ const { bcmOnSearch, inputElement } = instance;
4006
+ bcmOnSearch.emit({ result: searchResult === null || searchResult === void 0 ? void 0 : searchResult.result, value: inputElement === null || inputElement === void 0 ? void 0 : inputElement.value, matching: searchResult === null || searchResult === void 0 ? void 0 : searchResult.matching, parentIndex: searchResult === null || searchResult === void 0 ? void 0 : searchResult.parentIndex, nestedResult: searchResult === null || searchResult === void 0 ? void 0 : searchResult.nestedResult });
4007
+ }
4008
+ render() {
4009
+ const { _id, placeholder, disabled, readonly } = this;
4010
+ return h$1(Host, { onClick: () => { this.onBcmFocus(); this.onBcmSelect(); } }, h$1(InputTemplate, { size: this.size, id: _id, type: "search", placeholder: placeholder, disabled: disabled, "full-width": true, readonly: readonly, clearable: this.isActiveClearable, handleFocus: () => this.handleFocus(), handleBlur: () => this.handleBlur(), handleChange: () => this.handleChange(), handleClear: () => this.handleClear(), handleInput: this.debounceHandler, ref: (el) => this.inputElement = el }));
4011
+ }
4012
+ get el() { return getElement(this); }
4013
+ static get watchers() { return {
4014
+ "data": ["dataChanged"]
4015
+ }; }
4016
+ };
4017
+ BcmSearch.style = searchCss;
4018
+
4019
+ export { BcmList as bcm_list, BcmRcOverflow as bcm_rc_overflow, BcmSearch as bcm_search };