bromcom-ui 2.11.1-rc.9-5 → 2.11.1-rc.9-7

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 (203) hide show
  1. package/dist/bromcom-ui/bromcom-ui.esm.js +1 -1
  2. package/dist/bromcom-ui/p-053dc717.entry.js +5 -0
  3. package/dist/bromcom-ui/{p-51ba5764.entry.js → p-070c3309.entry.js} +1 -1
  4. package/dist/bromcom-ui/{p-62d2c650.entry.js → p-0b276355.entry.js} +1 -1
  5. package/dist/bromcom-ui/{p-beaec5b8.js → p-0bda558d.js} +1 -1
  6. package/dist/bromcom-ui/{p-77ef609e.entry.js → p-1c801d0c.entry.js} +1 -1
  7. package/dist/bromcom-ui/{p-a486613b.entry.js → p-1c9314bd.entry.js} +1 -1
  8. package/dist/bromcom-ui/p-228b5376.entry.js +16 -0
  9. package/dist/bromcom-ui/{p-9b2e26f6.entry.js → p-23c24cf7.entry.js} +1 -1
  10. package/dist/bromcom-ui/{p-d59d9687.entry.js → p-2aaeb247.entry.js} +1 -1
  11. package/dist/bromcom-ui/{p-788d1fb1.entry.js → p-30875843.entry.js} +1 -1
  12. package/dist/bromcom-ui/p-3238bf36.js +5 -0
  13. package/dist/bromcom-ui/p-33b063f9.entry.js +5 -0
  14. package/dist/bromcom-ui/{p-b0dc804a.entry.js → p-34d17092.entry.js} +1 -1
  15. package/dist/bromcom-ui/{p-a0d6d680.js → p-35f2e15a.js} +1 -1
  16. package/dist/bromcom-ui/{p-0745c696.js → p-39c6ede5.js} +1 -1
  17. package/dist/bromcom-ui/{p-0fa6d3a8.entry.js → p-3e7f3bd6.entry.js} +1 -1
  18. package/dist/bromcom-ui/{p-eca0acda.js → p-43c578cf.js} +1 -1
  19. package/dist/bromcom-ui/{p-6bea284a.js → p-499d8454.js} +1 -1
  20. package/dist/bromcom-ui/{p-c75b2352.entry.js → p-49c6a987.entry.js} +1 -1
  21. package/dist/bromcom-ui/{p-cb56a1d9.entry.js → p-4c57d895.entry.js} +1 -1
  22. package/dist/bromcom-ui/{p-dce99e4d.entry.js → p-4cc727ff.entry.js} +1 -1
  23. package/dist/bromcom-ui/{p-c77541f4.js → p-4d2bf0e7.js} +2 -2
  24. package/dist/bromcom-ui/{p-5d670fd7.entry.js → p-594a57c3.entry.js} +1 -1
  25. package/dist/bromcom-ui/{p-a0f44b56.entry.js → p-5dea2654.entry.js} +1 -1
  26. package/dist/bromcom-ui/{p-57678987.entry.js → p-6220fb40.entry.js} +1 -1
  27. package/dist/bromcom-ui/{p-a6aa173f.entry.js → p-626b805d.entry.js} +1 -1
  28. package/dist/bromcom-ui/p-64496819.entry.js +5 -0
  29. package/dist/bromcom-ui/{p-5dcc28c3.entry.js → p-64d9f96b.entry.js} +1 -1
  30. package/dist/bromcom-ui/p-64fad38b.js +11 -0
  31. package/dist/bromcom-ui/{p-c49b6287.entry.js → p-69260d36.entry.js} +1 -1
  32. package/dist/bromcom-ui/{p-b51e5b06.js → p-6d1bc914.js} +1 -1
  33. package/dist/bromcom-ui/{p-8c018ae0.js → p-6f2e4c9b.js} +1 -1
  34. package/dist/bromcom-ui/{p-7e44e6b5.js → p-6f861fed.js} +1 -1
  35. package/dist/bromcom-ui/{p-e8eaa3bb.entry.js → p-7d18ce0e.entry.js} +1 -1
  36. package/dist/bromcom-ui/{p-a2864264.js → p-7f776577.js} +1 -1
  37. package/dist/bromcom-ui/{p-201b04e8.entry.js → p-8153e18d.entry.js} +1 -1
  38. package/dist/bromcom-ui/{p-6657830f.js → p-85eedabc.js} +1 -1
  39. package/dist/bromcom-ui/{p-8e972c24.entry.js → p-87f4460b.entry.js} +1 -1
  40. package/dist/bromcom-ui/{p-2cd6cdee.js → p-8e683b32.js} +1 -1
  41. package/dist/bromcom-ui/{p-4b44c0ea.entry.js → p-90ce383c.entry.js} +1 -1
  42. package/dist/bromcom-ui/{p-d3b38aff.entry.js → p-91f04eca.entry.js} +1 -1
  43. package/dist/bromcom-ui/{p-4342cdf8.entry.js → p-9ddea72c.entry.js} +1 -1
  44. package/dist/bromcom-ui/p-9e16b47a.entry.js +5 -0
  45. package/dist/bromcom-ui/{p-aeb4be41.js → p-a2df6c19.js} +1 -1
  46. package/dist/bromcom-ui/{p-160fba10.entry.js → p-a3d0c1f4.entry.js} +1 -1
  47. package/dist/bromcom-ui/{p-8bb0fe5d.js → p-aa6ff189.js} +1 -1
  48. package/dist/bromcom-ui/{p-856dac72.entry.js → p-ab37f4bf.entry.js} +1 -1
  49. package/dist/bromcom-ui/{p-0e3e8cc2.entry.js → p-b0a85220.entry.js} +1 -1
  50. package/dist/bromcom-ui/{p-9586997f.js → p-b25f9130.js} +1 -1
  51. package/dist/bromcom-ui/{p-59f7fa84.entry.js → p-ba9eff2a.entry.js} +1 -1
  52. package/dist/bromcom-ui/{p-9b59c689.entry.js → p-bdc78a44.entry.js} +1 -1
  53. package/dist/bromcom-ui/{p-5bd4ba44.entry.js → p-cd0f94a1.entry.js} +1 -1
  54. package/dist/bromcom-ui/{p-32c55505.entry.js → p-d551a51d.entry.js} +1 -1
  55. package/dist/bromcom-ui/{p-33f3c5c5.entry.js → p-da1af01e.entry.js} +1 -1
  56. package/dist/bromcom-ui/{p-29263575.entry.js → p-e1894ee9.entry.js} +1 -1
  57. package/dist/bromcom-ui/{p-1b558b0f.entry.js → p-ece578ef.entry.js} +1 -1
  58. package/dist/bromcom-ui/{p-2b42d77e.entry.js → p-f0e30624.entry.js} +1 -1
  59. package/dist/bromcom-ui/{p-2e9c0070.entry.js → p-fb784bcd.entry.js} +1 -1
  60. package/dist/bromcom-ui/{p-2d9b633e.entry.js → p-ffbd4d1e.entry.js} +1 -1
  61. package/dist/cjs/{bcm-accordion_47.cjs.entry.js → bcm-accordion_63.cjs.entry.js} +41891 -20022
  62. package/dist/cjs/bcm-alert.cjs.entry.js +3 -3
  63. package/dist/cjs/bcm-attendance-actions-comment.cjs.entry.js +5 -5
  64. package/dist/cjs/bcm-attendance-actions-dropdown.cjs.entry.js +5 -5
  65. package/dist/cjs/bcm-breadcrumb.cjs.entry.js +2 -2
  66. package/dist/cjs/bcm-caption.cjs.entry.js +5 -5
  67. package/dist/cjs/bcm-card.cjs.entry.js +4 -4
  68. package/dist/cjs/bcm-chip-group.cjs.entry.js +5 -5
  69. package/dist/cjs/bcm-date-picker.cjs.entry.js +2 -2
  70. package/dist/cjs/bcm-datetime-picker.cjs.entry.js +4 -4
  71. package/dist/cjs/bcm-default.cjs.entry.js +2 -2
  72. package/dist/cjs/bcm-form-2.cjs.entry.js +3 -3
  73. package/dist/cjs/bcm-input-2.cjs.entry.js +2 -2
  74. package/dist/cjs/bcm-input-custom.cjs.entry.js +2 -2
  75. package/dist/cjs/bcm-input-dropdown.cjs.entry.js +5 -5
  76. package/dist/cjs/bcm-modal-2-footer.cjs.entry.js +5 -5
  77. package/dist/cjs/bcm-modal-2-header.cjs.entry.js +5 -5
  78. package/dist/cjs/bcm-modal-2.cjs.entry.js +5 -5
  79. package/dist/cjs/bcm-number-input.cjs.entry.js +5 -5
  80. package/dist/cjs/bcm-popover.cjs.entry.js +5 -5
  81. package/dist/cjs/bcm-range.cjs.entry.js +2 -2
  82. package/dist/cjs/bcm-skeleton.cjs.entry.js +5 -5
  83. package/dist/cjs/bcm-table.cjs.entry.js +5 -5
  84. package/dist/cjs/bcm-tag.cjs.entry.js +3 -3
  85. package/dist/cjs/bcm-time-picker.cjs.entry.js +2 -2
  86. package/dist/cjs/bcm-toast.cjs.entry.js +3 -3
  87. package/dist/cjs/bromcom-ui.cjs.js +3 -3
  88. package/dist/cjs/{generate-e4106db0.js → generate-0e132127.js} +1 -1
  89. package/dist/cjs/{global-c0174398.js → global-da1b03a6.js} +1 -1
  90. package/dist/cjs/loader.cjs.js +3 -3
  91. package/dist/cjs/{number-helper-0846aefe.js → number-helper-1de01e62.js} +1 -1
  92. package/dist/cjs/old-bcm-popover-box.cjs.entry.js +5 -5
  93. package/dist/cjs/old-bcm-popover.cjs.entry.js +2 -2
  94. package/dist/cjs/{package-822a0e3f.js → package-1aa89f41.js} +1 -1
  95. package/dist/cjs/{popover-placement-02e6101b.js → popover-placement-d1aa81f0.js} +1 -1
  96. package/dist/cjs/{slot-template-df7b5b59.js → slot-template-29229e8f.js} +1 -1
  97. package/dist/cjs/{string-helper-9cdfb273.js → string-helper-1ee6dc21.js} +4 -2
  98. package/dist/cjs/{validators-0fadce56.js → validators-b7892533.js} +1 -1
  99. package/dist/collection/components/organism/list/list.js +2 -2
  100. package/dist/collection/components/other_deprecated/select/select.js +1 -1
  101. package/dist/collection/components/other_deprecated/tabs/tab.css +15 -15
  102. package/dist/collection/helper/string-helper.js +4 -2
  103. package/dist/components/bcm-select.js +1 -1
  104. package/dist/components/bcm-tab.js +1 -1
  105. package/dist/components/generate.js +1 -1
  106. package/dist/components/list.js +2 -2
  107. package/dist/components/string-helper.js +4 -2
  108. package/dist/esm/{_commonjsHelpers-82aa9212.js → _commonjsHelpers-7002e5de.js} +1 -1
  109. package/dist/esm/{bcm-accordion_47.entry.js → bcm-accordion_63.entry.js} +41922 -20069
  110. package/dist/esm/bcm-alert.entry.js +6 -6
  111. package/dist/esm/bcm-attendance-actions-comment.entry.js +10 -10
  112. package/dist/esm/bcm-attendance-actions-dropdown.entry.js +11 -11
  113. package/dist/esm/bcm-autocomplete.entry.js +2 -2
  114. package/dist/esm/bcm-breadcrumb.entry.js +5 -5
  115. package/dist/esm/bcm-caption.entry.js +12 -12
  116. package/dist/esm/bcm-card.entry.js +9 -9
  117. package/dist/esm/bcm-chip-group.entry.js +13 -13
  118. package/dist/esm/bcm-colorpicker.entry.js +4 -4
  119. package/dist/esm/bcm-date-picker.entry.js +6 -6
  120. package/dist/esm/bcm-datetime-picker.entry.js +10 -10
  121. package/dist/esm/bcm-default.entry.js +4 -4
  122. package/dist/esm/bcm-error-layout.entry.js +2 -2
  123. package/dist/esm/bcm-form-2.entry.js +5 -5
  124. package/dist/esm/bcm-input-2.entry.js +6 -6
  125. package/dist/esm/bcm-input-custom.entry.js +5 -5
  126. package/dist/esm/bcm-input-dropdown.entry.js +12 -12
  127. package/dist/esm/bcm-message.entry.js +2 -2
  128. package/dist/esm/bcm-modal-2-footer.entry.js +11 -11
  129. package/dist/esm/bcm-modal-2-header.entry.js +10 -10
  130. package/dist/esm/bcm-modal-2.entry.js +11 -11
  131. package/dist/esm/bcm-notification.entry.js +2 -2
  132. package/dist/esm/bcm-number-input.entry.js +12 -12
  133. package/dist/esm/bcm-overlay_2.entry.js +3 -3
  134. package/dist/esm/bcm-popover.entry.js +10 -10
  135. package/dist/esm/bcm-range.entry.js +6 -6
  136. package/dist/esm/bcm-react-number.entry.js +2 -2
  137. package/dist/esm/bcm-result.entry.js +2 -2
  138. package/dist/esm/bcm-select-group.entry.js +2 -2
  139. package/dist/esm/bcm-select-option.entry.js +2 -2
  140. package/dist/esm/bcm-skeleton.entry.js +10 -10
  141. package/dist/esm/bcm-tab-pane.entry.js +2 -2
  142. package/dist/esm/bcm-table.entry.js +11 -11
  143. package/dist/esm/bcm-tabs-content.entry.js +3 -3
  144. package/dist/esm/bcm-tag.entry.js +7 -7
  145. package/dist/esm/bcm-time-picker.entry.js +6 -6
  146. package/dist/esm/bcm-timeline-item.entry.js +2 -2
  147. package/dist/esm/bcm-timeline.entry.js +2 -2
  148. package/dist/esm/bcm-toast.entry.js +7 -7
  149. package/dist/esm/bromcom-ui.js +3 -3
  150. package/dist/esm/{caption-template-d7953d13.js → caption-template-3cd42c3b.js} +1 -1
  151. package/dist/esm/{color-helper-74614f24.js → color-helper-ba15b0d8.js} +2 -2
  152. package/dist/esm/{colors-dd598eea.js → colors-ed4e7579.js} +1 -1
  153. package/dist/esm/{element-dragger-89bb52fd.js → element-dragger-b75266e6.js} +1 -1
  154. package/dist/esm/{generate-dbe68f53.js → generate-7657b903.js} +2 -2
  155. package/dist/esm/{global-0bea93f1.js → global-45ed375c.js} +1 -1
  156. package/dist/esm/{index-f549811f.js → index-00c8a8f7.js} +1 -1
  157. package/dist/esm/{index-036974d7.js → index-0d3a56ec.js} +1 -1
  158. package/dist/esm/{label-template-a26f76c0.js → label-template-ef97aadb.js} +1 -1
  159. package/dist/esm/loader.js +3 -3
  160. package/dist/esm/{number-helper-4a35e676.js → number-helper-6a1c621e.js} +1 -1
  161. package/dist/esm/old-bcm-popover-box.entry.js +10 -10
  162. package/dist/esm/old-bcm-popover.entry.js +5 -5
  163. package/dist/esm/{package-c9093920.js → package-b7d0ee8c.js} +1 -1
  164. package/dist/esm/{popover-placement-d12fec40.js → popover-placement-1b15cc99.js} +1 -1
  165. package/dist/esm/{slot-template-2a19b2db.js → slot-template-0d958dcc.js} +1 -1
  166. package/dist/esm/{string-helper-3592bdc2.js → string-helper-b4602002.js} +5 -3
  167. package/dist/esm/{utils-57652744.js → utils-7727d09e.js} +1 -1
  168. package/dist/esm/{validators-0d9bab98.js → validators-4ce708f9.js} +1 -1
  169. package/package.json +1 -1
  170. package/dist/bromcom-ui/p-1345d51b.entry.js +0 -5
  171. package/dist/bromcom-ui/p-270e1b24.entry.js +0 -5
  172. package/dist/bromcom-ui/p-376a20ed.js +0 -5
  173. package/dist/bromcom-ui/p-4393b33e.entry.js +0 -5
  174. package/dist/bromcom-ui/p-59327403.entry.js +0 -5
  175. package/dist/bromcom-ui/p-5f345ad2.entry.js +0 -5
  176. package/dist/bromcom-ui/p-6ddd9d7e.entry.js +0 -5
  177. package/dist/bromcom-ui/p-77b1dbdd.entry.js +0 -5
  178. package/dist/bromcom-ui/p-8b6d3a37.js +0 -5
  179. package/dist/bromcom-ui/p-93c016f1.entry.js +0 -5
  180. package/dist/bromcom-ui/p-9b8fcf49.entry.js +0 -16
  181. package/dist/bromcom-ui/p-a1d44a10.entry.js +0 -5
  182. package/dist/bromcom-ui/p-c1a992e7.entry.js +0 -5
  183. package/dist/bromcom-ui/p-d6cee6ba.entry.js +0 -5
  184. package/dist/bromcom-ui/p-e0ab7b38.js +0 -11
  185. package/dist/bromcom-ui/p-fc787048.entry.js +0 -5
  186. package/dist/cjs/bcm-checkbox-lite_8.cjs.entry.js +0 -2509
  187. package/dist/cjs/bcm-collapse-group.cjs.entry.js +0 -43
  188. package/dist/cjs/bcm-collapse.cjs.entry.js +0 -62
  189. package/dist/cjs/bcm-old-input.cjs.entry.js +0 -397
  190. package/dist/cjs/bcm-old-tag_2.cjs.entry.js +0 -145
  191. package/dist/cjs/bcm-select.cjs.entry.js +0 -1195
  192. package/dist/cjs/bcm-tab.cjs.entry.js +0 -72
  193. package/dist/cjs/bcm-tabs.cjs.entry.js +0 -370
  194. package/dist/cjs/lodash-917168d7.js +0 -17199
  195. package/dist/esm/bcm-checkbox-lite_8.entry.js +0 -2498
  196. package/dist/esm/bcm-collapse-group.entry.js +0 -39
  197. package/dist/esm/bcm-collapse.entry.js +0 -58
  198. package/dist/esm/bcm-old-input.entry.js +0 -393
  199. package/dist/esm/bcm-old-tag_2.entry.js +0 -140
  200. package/dist/esm/bcm-select.entry.js +0 -1191
  201. package/dist/esm/bcm-tab.entry.js +0 -68
  202. package/dist/esm/bcm-tabs.entry.js +0 -366
  203. package/dist/esm/lodash-4197be99.js +0 -17197
@@ -1,2498 +0,0 @@
1
- /*!
2
- * Built with Stencil
3
- * Copyright (c) Bromcom.
4
- */
5
- import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-0615c2b8.js';
6
- import { c as classnames } from './index-f549811f.js';
7
- import { G as Generate } from './generate-dbe68f53.js';
8
- import { a as Bcm } from './bcm-a50d55ba.js';
9
- import { c as getChilds, d as delay } from './utils-57652744.js';
10
- import './_commonjsHelpers-82aa9212.js';
11
- import './package-c9093920.js';
12
- import './colors-dd598eea.js';
13
-
14
- const checkboxCss = "@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\"); .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-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}";
15
-
16
- const BcmCheckboxLite = class {
17
- constructor(hostRef) {
18
- registerInstance(this, hostRef);
19
- this._id = Generate.UID();
20
- this.checked = true;
21
- this.indeterminate = null;
22
- this.disabled = false;
23
- this.hidden = false;
24
- this.required = false;
25
- this.readOnly = false;
26
- this.captionType = Bcm.Status.default;
27
- }
28
- render() {
29
- const { disabled, checked, readOnly, required, indeterminate, hidden, captionType, _id } = this;
30
- // const hostClasses = cs(
31
- // 'bcm-checkbox',
32
- // 'bcm-checkbox__type-default',
33
- // {
34
- // 'error': captionType == Bcm.Status.error,
35
- // hidden,
36
- // checked,
37
- // disabled,
38
- // required,
39
- // readOnly,
40
- // }
41
- // )
42
- // const bcmCheckboxIconClass = cs(
43
- // 'bcm-checkbox__icon',
44
- // 'bcm-checkbox__icon-lite',
45
- // 'bcm-checkbox__icon-' + indeterminate,
46
- // {
47
- // checked
48
- // }
49
- // )
50
- // const bcmCheckboxLabelClass = cs(
51
- // 'bcm-checkbox__label'
52
- // )
53
- const bcmCheckboxClass = classnames('bcm-checkbox', `bcm-checkbox-size-medium`, {
54
- 'error': captionType == Bcm.Status.error,
55
- hidden,
56
- checked,
57
- disabled,
58
- required
59
- });
60
- const bcmCheckboxIconClass = classnames('bcm-checkbox__label-icon', 'bcm-checkbox__label-icon-lite', 'bcm-checkbox__label-icon-' + indeterminate, {
61
- 'bcm-checkbox__label-icon-checked': checked,
62
- });
63
- const bcmCheckboxLabelClass = classnames('bcm-checkbox__label');
64
- const bcmCheckboxInputClass = classnames('bcm-checkbox__input');
65
- return (h(Host, { class: bcmCheckboxClass, style: { 'margin': '0' } }, h("div", { class: bcmCheckboxInputClass, style: {
66
- 'padding-top': '5px'
67
- } }, h("input", { id: _id, type: "checkbox", checked: checked, disabled: disabled, required: required, readOnly: readOnly }), h("label", { class: bcmCheckboxLabelClass, htmlFor: _id }, h("span", { class: bcmCheckboxIconClass }, h("div", { style: {
68
- 'height': '12px',
69
- 'min-height': '12px',
70
- 'width': '12px',
71
- 'min-width': '12px'
72
- } }, h("svg", { class: "bcm-icon-lite", width: "100%", height: "100%", viewBox: "0 0 11 9", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M1.91308 4.03516H1.91326C1.99256 4.03525 2.07081 4.05331 2.14213 4.08798C2.21341 4.12262 2.27591 4.17295 2.32497 4.2352L1.91308 4.03516ZM1.91308 4.03516H1.09394C0.890308 4.03516 0.776602 4.26975 0.902321 4.4292L0.902371 4.42927L4.11214 8.49567L4.11218 8.49573C4.32247 8.76188 4.72568 8.76114 4.93667 8.49617L4.93708 8.49566L10.6597 1.24398C10.6598 1.24378 10.66 1.24358 10.6602 1.24338C10.7884 1.08295 10.6699 0.85 10.4689 0.85H9.6498C9.48941 0.85 9.33668 0.9235 9.2376 1.05044C9.23751 1.05055 9.23742 1.05066 9.23734 1.05077L4.52403 7.02157M1.91308 4.03516L4.52403 7.02157M4.52403 7.02157L2.32506 4.23531L4.52403 7.02157Z", fill: "#ffffff" }))))))));
73
- }
74
- get el() { return getElement(this); }
75
- };
76
- BcmCheckboxLite.style = checkboxCss;
77
-
78
- const BcmEmpty = class {
79
- constructor(hostRef) {
80
- registerInstance(this, hostRef);
81
- this.icon = undefined;
82
- }
83
- render() {
84
- return (h(Host, { class: "tw-h-full tw-flex tw-flex-col tw-items-center tw-justify-center tw-w-full tw-flex-1 tw-bg-slate-50 tw-text-center tw-rounded tw-gap-3" }, this.icon && h("i", { class: `tw-text-8 tw-text-amber-500 ${this.icon}` }), h("bcm-typography", { class: "tw-text-slate-700 tw-text-2" }, h("slot", null))));
85
- }
86
- get el() { return getElement(this); }
87
- };
88
-
89
- const listboxCss = "@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}:host{display:block;width:fit-content;height:fit-content;background-color:#ffffff}:host(.hidden){display:none}:host(.flex){width:100%;height:100%}:host(.flex) .bcm-listbox{max-height:100%;max-width:100%;height:100%;min-width:100%}:host(.full-width){width:100%}:host(.full-width) .bcm-listbox{max-width:100%;min-width:100%}.bcm-listbox{flex:1;background-color:var(--bcm-color-grey-1);width:fit-content;display:flex;flex-direction:column;height:100%;width:100%;min-width:256px;max-width:256px;min-height:auto;max-height:300px;box-sizing:border-box;border:1px solid var(--bcm-color-grey-5)}.bcm-listbox-list{flex:1;display:flex;flex-direction:column;overflow-x:hidden;overflow-y:auto;border-bottom:none}.bcm-listbox-list.loading{min-height:150px;position:relative;margin:0 8px 8px 8px}.bcm-listbox-list .loading{display:none;align-items:center;justify-content:center;height:100%;width:100%;position:absolute;background-color:rgba(255, 255, 255, 0.03)}.bcm-listbox-list .loading.show{display:flex}.bcm-listbox-list .list-container.hidden{display:none}.bcm-listbox .search{padding:8px;padding-bottom:0}.bcm-listbox .search.hidden{display:none !important}.bcm-listbox .empty{display:none;align-items:center;justify-content:center;flex:1;height:100%}.bcm-listbox .empty.show{display:flex}.bcm-listbox-footer{text-align:right;padding:4px 8px;background-color:var(--bcm-color-grey-3)}.label{display:block;color:var(--bcm-color-grey-9);margin-bottom:4px}.listbox-item{display:flex;align-items:stretch;justify-content:flex-start;flex-direction:column;color:var(--bcm-color-grey-8);user-select:none;background-color:var(--bcm-color-grey-1)}.listbox-item.hidden{display:none}.listbox-item .divider{padding:0 8px}.listbox-item-container{display:flex;align-items:center;justify-content:flex-start;flex-direction:row;padding-left:8px;width:100%}.listbox-item-container .check-content{display:flex;align-items:center;justify-content:flex-start;width:16px;min-width:16px;margin-right:4px}.listbox-item-container .check-content .indeterminate{width:16px;height:16px;position:relative;display:block;padding-right:8px;cursor:pointer}.listbox-item-container .check-content .indeterminate:after{content:\"\";position:absolute;top:50%;left:9px;width:10px;height:10px;background-color:var(--bcm-color-prime-blue-6);transform:translate(-50%, -50%);opacity:1;z-index:1}.listbox-item-container .check-content .indeterminate:before{content:\"\";position:absolute;top:-1px;left:0px;width:16px;height:100%;border-radius:2px;background-color:transparent;border:1px solid var(--bcm-color-grey-5);opacity:1;z-index:2}.listbox-item-container .check-content .indeterminate:hover:before{border-color:var(--bcm-color-prime-blue-6);box-shadow:0px 2px 4px rgba(54, 121, 171, 0.5)}.listbox-item-container-text-content{display:flex;align-items:center;justify-content:flex-start;flex-direction:row;cursor:pointer;width:100%;padding:4px 8px 4px 4px}.listbox-item-container.disabled{color:var(--bcm-color-grey-6)}.listbox-item-container.selected{color:var(--bcm-color-prime-blue-6)}.listbox-item-container.selected:hover:not(.disabled){color:var(--bcm-color-prime-blue-6);background-color:var(--bcm-color-prime-blue-1)}.listbox-item-container:hover:not(.disabled),.listbox-item-container:active:not(.disabled){color:var(--bcm-color-prime-blue-6);background-color:var(--bcm-color-prime-blue-1)}.caption-area{margin-bottom:8px;min-height:20px}.input-caption{display:block}.error.label{color:var(--bcm-color-red-6) !important}.error.bcm-listbox{border:1px solid var(--bcm-color-red-6) !important}.caption-default{color:#8C8C8C}.caption-primary{color:#4293CF}.caption-success{color:#52C41A}.caption-warning{color:#FA8C16}.caption-error{color:#F5222D}.input-large{height:38px}.input-medium{height:30px}.input-small{height:20px}";
90
-
91
- /**
92
- * @desc
93
- * @param str
94
- */
95
- const lowercase$2 = (str) => str.toLowerCase();
96
- const BcmListbox = class {
97
- constructor(hostRef) {
98
- registerInstance(this, hostRef);
99
- this.listboxItemSelected = createEvent(this, "bcm-listbox-item-selected", 7);
100
- this.listboxClearSelected = createEvent(this, "bcm-listbox-clear-selecteds", 7);
101
- this.listboxSendCheck = createEvent(this, "bcm-listbox-send-check", 7);
102
- this.listboxSendUncheck = createEvent(this, "bcm-listbox-send-uncheck", 7);
103
- this.listboxChecklist = createEvent(this, "bcm-listbox-checklist", 7);
104
- this.listboxChange = createEvent(this, "bcm-listbox-change", 7);
105
- this.listboxChecked = createEvent(this, "bcm-listbox-checked", 7);
106
- this.change = createEvent(this, "bcm-change", 7);
107
- this.objectMapping = {
108
- 'id': "id",
109
- 'text': "text",
110
- 'icon': "icon",
111
- 'avatar': "avatar",
112
- 'avatarName': "avatarName",
113
- 'avatarImage': "avatarImage",
114
- 'secondaryText': "secondaryText",
115
- 'tooltipText': "tooltipText",
116
- 'selected': "selected",
117
- 'checked': "checked",
118
- 'disabled': "disabled",
119
- };
120
- this.checkedObjectList = [];
121
- this.cacheCheckedObjectList = [];
122
- this.allChilds = [];
123
- this.onlyChilds = [];
124
- this.firstRun = true;
125
- this.firstCheck = false;
126
- this.onFocus = false;
127
- this.isSetData = false;
128
- this.isGroupArray = [];
129
- this.intersection = [];
130
- /**
131
- * Component States
132
- */
133
- this.searchResults = [];
134
- this.totalSearch = 0;
135
- this.showSearch = true;
136
- this.empty = false;
137
- this.runClearAndSelect = false;
138
- this.innerComponent = false;
139
- this.checkboxes = false;
140
- this.label = undefined;
141
- this.required = false;
142
- this.value = null;
143
- this.search = false;
144
- this.infoFooter = false;
145
- this.showIcon = false;
146
- this.size = 'medium';
147
- this.selectedId = undefined;
148
- this.checkedList = [];
149
- this.updateCheckedList = [];
150
- this._items = [];
151
- this.fullWidth = false;
152
- this.searchFields = ['text', 'secondaryText', 'tooltipText'];
153
- this._flex = undefined;
154
- this.hidden = false;
155
- this.returnField = "id";
156
- this.searchSub = "items";
157
- this.searchText = "";
158
- this.treeview = false;
159
- this.searchPlaceholder = "Search";
160
- this.numberOfColumns = 1;
161
- this.height = null;
162
- this.maxHeight = null;
163
- this.template = null;
164
- this.highlight = false;
165
- this.loading = true;
166
- this.noCaption = false;
167
- this.caption = undefined;
168
- this.captionError = undefined;
169
- this.captionType = 'default';
170
- this._internal_id = (Math.random() * 4).toString(16).replace('.', '');
171
- this.tooltip = undefined;
172
- this.total = 0;
173
- this.items = [];
174
- this.checklist = [];
175
- this.sortedChecklist = [];
176
- this.indeterminateState = 'uncheck';
177
- this.checked = false;
178
- this.jsonItem = undefined;
179
- this.searchData = undefined;
180
- this.captionCache = undefined;
181
- this.captionTypeCache = undefined;
182
- this.checklistSorted = [];
183
- }
184
- async setClear() {
185
- this.listboxChecklist.emit([]);
186
- this.value = null;
187
- this.selectedId = null;
188
- this.listboxClearSelected.emit([]);
189
- // this.checkedObjectList.forEach(item => {
190
- // this.listboxUncheckedMethod(String(item[this.objectMapping['id']]), this._internal_id)
191
- // });
192
- let isItem = getChilds(this.el, 'bcm-listbox-item');
193
- let elementStatuses = [];
194
- if (isItem) {
195
- isItem.map(element => {
196
- elementStatuses.push(element.checked = false);
197
- });
198
- }
199
- // console.log("uncheck")
200
- await Promise.all(elementStatuses);
201
- // if ( allStatuses ){
202
- // console.log("bitti")
203
- // }
204
- this.checklist = [];
205
- this.sortedChecklist = [];
206
- this.checklistSorted = [];
207
- this.checkedObjectList = [];
208
- await delay(10);
209
- return Promise.resolve();
210
- }
211
- async resetCaption() {
212
- await delay(10);
213
- this.caption = this.captionCache;
214
- this.captionType = this.captionTypeCache;
215
- this.captionError = null;
216
- await delay(10);
217
- return Promise.resolve();
218
- }
219
- connectedCallback() {
220
- this.captionCache = this.caption;
221
- this.captionTypeCache = this.captionType;
222
- }
223
- async getValue() {
224
- if (this.checkboxes) {
225
- return this.checkedObjectList;
226
- }
227
- else {
228
- return this.value;
229
- }
230
- }
231
- async getChecklist() {
232
- return this.checkedObjectList;
233
- }
234
- async showSearchMethod(val = true) {
235
- if (this.treeview == false && this.search == true) {
236
- this.showSearch = val;
237
- var search = null;
238
- if (search = this.el.shadowRoot.getElementById("search")) {
239
- if (val) {
240
- search.classList.remove('hidden');
241
- }
242
- else {
243
- search.classList.add('hidden');
244
- }
245
- }
246
- }
247
- }
248
- async selected(id) {
249
- this.selectedId = String(id);
250
- if (this.treeview === true) {
251
- setTimeout(async () => {
252
- const bcmTreeview = this.el.shadowRoot.querySelector("bcm-treeview");
253
- if (bcmTreeview) {
254
- await bcmTreeview.selected(this.selectedId);
255
- }
256
- }, 100);
257
- }
258
- }
259
- async clearAndSelectSearch(select = true) {
260
- this.runClearAndSelect = true;
261
- if (this.search == true) {
262
- setTimeout(() => {
263
- var searchInput = null;
264
- searchInput = this.el.shadowRoot.querySelector("bcm-old-search");
265
- if (searchInput) {
266
- searchInput.setClear();
267
- if (select == true) {
268
- searchInput.select();
269
- }
270
- }
271
- }, 100);
272
- }
273
- }
274
- async addChecked(items) {
275
- await this.setClear();
276
- if (items) {
277
- if (typeof items != 'string') {
278
- await delay(50);
279
- if (sessionStorage.getItem(this._internal_id + "-config")) {
280
- this.config(JSON.parse(sessionStorage.getItem(this._internal_id + "-config")));
281
- }
282
- this.checkedList = items;
283
- this.checkedList.forEach((item) => {
284
- this.handleListboxChecked({ detail: String(item) }, this._internal_id);
285
- });
286
- this.updateCheckedList = [];
287
- if (this.treeview === true) {
288
- setTimeout(async () => {
289
- await customElements.whenDefined("bcm-treeview");
290
- const bcmTreeview = this.el.shadowRoot.querySelector("bcm-treeview");
291
- if (bcmTreeview) {
292
- await bcmTreeview.addChecked(items);
293
- }
294
- }, 50);
295
- }
296
- }
297
- }
298
- }
299
- async updateChecked(items) {
300
- this.setClear();
301
- this.checkedList = [];
302
- this.updateCheckedList = items;
303
- this.updateCheckedList.forEach((item) => {
304
- this.handleListboxChecked({ detail: item });
305
- });
306
- setTimeout(async () => {
307
- if (this.treeview === true) {
308
- await customElements.whenDefined("bcm-treeview");
309
- const bcmTreeview = this.el.shadowRoot.querySelector("bcm-treeview");
310
- if (bcmTreeview) {
311
- await bcmTreeview.updateChecked(items);
312
- }
313
- }
314
- }, 100);
315
- }
316
- async config(_config) {
317
- if (_config['treeview'] && _config['treeview'] === true) {
318
- typeof _config['treeview'] == 'boolean'
319
- ? this.treeview = _config['treeview']
320
- : this.treeview = false;
321
- }
322
- setTimeout(async () => {
323
- if (this.treeview === true) {
324
- await customElements.whenDefined("bcm-treeview");
325
- const bcmTreeview = this.el.shadowRoot.querySelector("bcm-treeview");
326
- if (bcmTreeview) {
327
- await bcmTreeview.config(_config);
328
- if (this.selectedId) {
329
- await bcmTreeview.selected(this.selectedId);
330
- }
331
- }
332
- }
333
- }, 300);
334
- if (_config['searchFields']) {
335
- if (Array.isArray(_config['searchFields'])) {
336
- this.searchFields = _config['searchFields'];
337
- }
338
- }
339
- if (_config['searchPlaceholder']) {
340
- typeof _config['searchPlaceholder'] == 'string'
341
- ? this.searchPlaceholder = _config['searchPlaceholder']
342
- : this.searchPlaceholder = null;
343
- }
344
- if (_config['maxHeight']) {
345
- typeof _config['maxHeight'] == 'string'
346
- ? this.maxHeight = _config['maxHeight']
347
- : this.maxHeight = "100%";
348
- }
349
- if (_config['height']) {
350
- typeof _config['height'] == 'string'
351
- ? this.height = _config['height']
352
- : this.height = "100%";
353
- }
354
- if (_config['template']) {
355
- typeof _config['template'] == 'string'
356
- ? this.template = _config['template']
357
- : this.template = null;
358
- }
359
- if (_config['searchable']) {
360
- typeof _config['searchable'] == 'boolean'
361
- ? this.search = _config['searchable']
362
- : this.search = false;
363
- }
364
- if (_config['highlight']) {
365
- typeof _config['highlight'] == 'boolean'
366
- ? this.highlight = _config['highlight']
367
- : this.highlight = false;
368
- }
369
- if (_config['fullWidth']) {
370
- typeof _config['fullWidth'] == 'boolean'
371
- ? this.fullWidth = _config['fullWidth']
372
- : this.fullWidth = false;
373
- }
374
- if (_config['numberOfColumns']) {
375
- typeof _config['numberOfColumns'] == 'number'
376
- ? this.numberOfColumns = _config['numberOfColumns']
377
- : this.numberOfColumns = 1;
378
- }
379
- if (_config['infoFooter']) {
380
- typeof _config['infoFooter'] == 'boolean'
381
- ? this.infoFooter = _config['infoFooter']
382
- : this.infoFooter = false;
383
- }
384
- if (_config['checkable']) {
385
- typeof _config['checkable'] == 'boolean'
386
- ? this.checkboxes = _config['checkable']
387
- : this.checkboxes = false;
388
- }
389
- if (_config['showIcon']) {
390
- typeof _config['showIcon'] == 'boolean'
391
- ? this.showIcon = _config['showIcon']
392
- : this.showIcon = false;
393
- }
394
- if (_config['size']) {
395
- (["small", "medium", "large"].indexOf(_config['size']) >= 0)
396
- ? this.size = _config['size']
397
- : this.size = 'medium';
398
- }
399
- this.searchSub = this.objectMapping['items'];
400
- if (_config['mapping']) {
401
- if (_config['mapping']['id']) {
402
- this.objectMapping['id'] = String(_config['mapping']['id']);
403
- this.returnField = this.objectMapping['id'];
404
- }
405
- if (_config['mapping']['text']) {
406
- this.objectMapping['text'] = _config['mapping']['text'];
407
- }
408
- if (_config['mapping']['icon']) {
409
- this.objectMapping['icon'] = _config['mapping']['icon'];
410
- }
411
- if (_config['mapping']['avatar']) {
412
- this.objectMapping['avatar'] = _config['mapping']['avatar'];
413
- }
414
- if (_config['mapping']['avatarName']) {
415
- this.objectMapping['avatarName'] = _config['mapping']['avatarName'];
416
- }
417
- if (_config['mapping']['avatarImage']) {
418
- this.objectMapping['avatarImage'] = _config['mapping']['avatarImage'];
419
- }
420
- if (_config['mapping']['secondaryText']) {
421
- this.objectMapping['secondaryText'] = _config['mapping']['secondaryText'];
422
- }
423
- if (_config['mapping']['tooltipText']) {
424
- this.objectMapping['tooltipText'] = _config['mapping']['tooltipText'];
425
- }
426
- if (_config['mapping']['disabled']) {
427
- this.objectMapping['disabled'] = _config['mapping']['disabled'];
428
- }
429
- if (_config['mapping']['checked']) {
430
- this.objectMapping['checked'] = _config['mapping']['checked'];
431
- }
432
- if (_config['mapping']['selected']) {
433
- this.objectMapping['selected'] = _config['mapping']['selected'];
434
- }
435
- if (_config['mapping']['items']) {
436
- this.objectMapping['items'] = _config['mapping']['items'];
437
- this.searchSub = this.objectMapping['items'];
438
- }
439
- // if ( this.treeview ) {
440
- // }else{
441
- // this.searchSub = this.objectMapping['items']
442
- // }
443
- }
444
- sessionStorage.setItem(this._internal_id + "-config", JSON.stringify(_config));
445
- // forceUpdate(this.el)
446
- return Promise.resolve(true);
447
- }
448
- async setData(_data = []) {
449
- this.clearAndSelectSearch(false);
450
- this.isLoading(true);
451
- this._items = _data;
452
- this.searchData = JSON.parse(_data);
453
- this.isSetData = true;
454
- // this.isEmpty(false)
455
- setTimeout(async () => {
456
- if (this.treeview === true) {
457
- const bcmTreeview = this.el.shadowRoot.querySelector("bcm-treeview");
458
- if (bcmTreeview) {
459
- await bcmTreeview.setData(_data);
460
- if (this.searchData.length > 0) {
461
- this.isEmpty(false);
462
- this.isLoading(false);
463
- }
464
- }
465
- }
466
- }, 100);
467
- }
468
- // componentDidLoad(){
469
- // console.log("kilitle")
470
- // setTimeout(() => {
471
- // if(this.isSetData) {
472
- // this.isLoading(true)
473
- // this.isEmpty(false)
474
- // }else{
475
- // this.isLoading(false)
476
- // this.isEmpty(true)
477
- // }
478
- // }, 100);
479
- // }
480
- componentWillRender() {
481
- if (this.isSetData) {
482
- this.onlyChilds = this.getAllGroup(this.el, true);
483
- this.allChilds = this.getAllGroup();
484
- if (this.onlyChilds.length != this.total) {
485
- this.total = this.onlyChilds.length;
486
- }
487
- if (this.checkboxes === true) {
488
- this.setIndeterminateState();
489
- if (this.checklistSorted.length > 0) {
490
- this.checkedObjectList = [];
491
- this.getAllGroup(this.el).forEach(element => {
492
- element.checked == true && (this.firstCheck = true,
493
- this.checkedObjectList.indexOf(element.itemObject) == -1 && (this.checkedObjectList.push(element.itemObject)));
494
- });
495
- if (JSON.stringify(this.cacheCheckedObjectList) !== JSON.stringify(this.checkedObjectList)) {
496
- this.listboxChecklist.emit(this.checkedObjectList);
497
- this.cacheCheckedObjectList = this.checkedObjectList;
498
- this.value = this.checkedObjectList;
499
- }
500
- }
501
- else {
502
- if (this.firstCheck) {
503
- this.listboxChecklist.emit([]);
504
- this.cacheCheckedObjectList = [];
505
- if (this.value != null) {
506
- this.value = null;
507
- }
508
- }
509
- }
510
- }
511
- }
512
- }
513
- componentDidRender() {
514
- // this.isEmpty(true)
515
- // this.isLoading(true)
516
- // if(this.total > 0) {
517
- // this.isLoading(false)
518
- // this.isEmpty(false)
519
- // }
520
- // this.isEmpty(true)
521
- if (this.isSetData) {
522
- if (this.total > 0) {
523
- this.isEmpty(false);
524
- this.isLoading(false);
525
- }
526
- else {
527
- this.isEmpty(true);
528
- }
529
- }
530
- }
531
- /**
532
- * @desc
533
- * @returns {void}
534
- */
535
- setIndeterminateState() {
536
- let state = 'uncheck';
537
- let allChecked = true;
538
- let allUnchecked = true;
539
- this.getAllGroup(this.el, true).map((item) => {
540
- item.checked && (allUnchecked = false);
541
- !item.checked && (allChecked = false);
542
- });
543
- !allChecked && !allUnchecked
544
- ? state = 'indeterminate'
545
- : allChecked
546
- ? state = 'determinate'
547
- : state = 'uncheck';
548
- this.indeterminateState = state;
549
- this.checked = state == 'determinate' ? true : false;
550
- // this.listboxChecklist.emit(this.sortedChecklist)
551
- }
552
- getAllGroup(element = this.el, onlyItem = false) {
553
- let returnAllItems = [];
554
- let isGroup = getChilds(element, 'bcm-listbox-group');
555
- let isItem = getChilds(element, 'bcm-listbox-item');
556
- if (isGroup.length > 0) {
557
- isGroup.forEach(group => {
558
- if (this.isGroupArray.indexOf(Number(group.id)) === -1) {
559
- this.isGroupArray.push(Number(group.id));
560
- }
561
- if (onlyItem == false) {
562
- returnAllItems = [...returnAllItems,
563
- group
564
- ];
565
- }
566
- getChilds(group, 'bcm-listbox-item').forEach(items => {
567
- if (!(returnAllItems.indexOf(items) >= 0)) {
568
- returnAllItems = [...returnAllItems,
569
- items
570
- ];
571
- }
572
- });
573
- });
574
- }
575
- if (isItem.length > 0) {
576
- isItem.forEach(items => {
577
- if (!(returnAllItems.indexOf(items) >= 0)) {
578
- returnAllItems = [...returnAllItems,
579
- items
580
- ];
581
- }
582
- });
583
- }
584
- return returnAllItems;
585
- }
586
- getAllChilds(element = this.el, type = null) {
587
- let returnAllItems = [];
588
- let oldItems = [];
589
- if (!this._items || type === "slot") {
590
- getChilds(element, 'bcm-listbox-item').forEach(items => {
591
- returnAllItems = [...returnAllItems,
592
- items
593
- ];
594
- });
595
- }
596
- else if (this._items && this._items.length > 0) {
597
- oldItems = JSON.parse(this._items);
598
- oldItems.map((item) => (((item.type === 'group') ? (item.items.map((item) => ((returnAllItems = [...returnAllItems, item])))) :
599
- (returnAllItems = [...returnAllItems, item]))));
600
- }
601
- return returnAllItems;
602
- }
603
- /**
604
- * @desc
605
- */
606
- handleCheckList(process = 'add', checkId) {
607
- checkId = String(checkId);
608
- if (this.checkboxes) {
609
- if (this.items && this.items.find(e => e[this.objectMapping['id']] == checkId)) {
610
- // checkId = Number(checkId)
611
- switch (process) {
612
- case 'add':
613
- if (this.checklist.length > 0) {
614
- if (!this.checklist.includes(checkId)) {
615
- this.checklist = [...this.checklist, checkId];
616
- }
617
- }
618
- else {
619
- this.checklist = [checkId];
620
- }
621
- break;
622
- case 'remove':
623
- this.checklist = this.checklist.filter(item => item !== checkId);
624
- break;
625
- }
626
- let sorted = this.checklist.sort(function (a, b) { return a - b; });
627
- this.sortedChecklist = this.checklist;
628
- this.checklistSorted = sorted;
629
- // forceUpdate(this.el)
630
- }
631
- }
632
- }
633
- handleIndeterminateClick() {
634
- let state = 'uncheck';
635
- let allChecked = true;
636
- let allUnchecked = true;
637
- let visibleItem = [];
638
- this.getAllGroup(this.el, true).map((item) => {
639
- if (item.hidden === false) {
640
- visibleItem.push(item);
641
- item.checked && (allUnchecked = false);
642
- !item.checked && (allChecked = false);
643
- }
644
- });
645
- !allChecked && !allUnchecked
646
- ? state = 'indeterminate'
647
- : allChecked
648
- ? state = 'determinate'
649
- : state = 'uncheck';
650
- visibleItem.map((item) => {
651
- if (state !== 'uncheck') {
652
- item.checked = false;
653
- this.handleCheckList('remove', String(item.id));
654
- }
655
- else {
656
- item.checked = true;
657
- this.handleCheckList('add', String(item.id));
658
- }
659
- });
660
- this.setIndeterminateState();
661
- }
662
- handleCheckboxClick(e) {
663
- e.preventDefault();
664
- }
665
- /**
666
- * @desc
667
- * @param item
668
- */
669
- itemRenderer(item) {
670
- if (item[this.objectMapping['id']] && String(this.selectedId) == String(item[this.objectMapping['id']])) {
671
- this.listboxItemSelected.emit(item);
672
- }
673
- // if(item[this.objectMapping['selected']] && item[this.objectMapping['selected']] === true){
674
- // this.listboxItemSelected.emit(item)
675
- // }
676
- // var checkedListCache = this.checkedList;
677
- // if(checkedListCache && checkedListCache.find(e => e == item[this.objectMapping['id']])){
678
- // this.handleListboxChecked({detail: item[this.objectMapping['id']]})
679
- // }
680
- // const index = checkedListCache.indexOf(item[this.objectMapping['id']]);
681
- // if (index > -1) {
682
- // checkedListCache.splice(index, 1);
683
- // }
684
- // if(this.updateCheckedList.length > 0 ){
685
- // if( this.updateCheckedList.find(e => e == item[this.objectMapping['id']]) ){
686
- // const index = this.updateCheckedList.indexOf(item[this.objectMapping['id']]);
687
- // if (index > -1) {
688
- // this.updateCheckedList.splice(index, 1);
689
- // }
690
- // this.listboxChecked.emit(item[this.objectMapping['id']])
691
- // }
692
- // }
693
- return (h("bcm-listbox-item", Object.assign({ _internal_id: this._internal_id, id: String(item[this.objectMapping['id']]), text: item[this.objectMapping['text']] }, (item[this.objectMapping['icon']] && { icon: item[this.objectMapping['icon']] }), (item[this.objectMapping['avatar']] && { avatar: item[this.objectMapping['avatar']] }), (item[this.objectMapping['avatarName']] && { avatarName: item[this.objectMapping['avatarName']] }), (item[this.objectMapping['avatarImage']] && { avatarImage: item[this.objectMapping['avatarImage']] }), (item[this.objectMapping['secondaryText']] && { secondaryText: item[this.objectMapping['secondaryText']] }), (item[this.objectMapping['tooltipText']] && { tooltipText: item[this.objectMapping['tooltipText']] }), (Boolean(item[this.objectMapping['checked']]) === Boolean(true) && { checked: Boolean(item[this.objectMapping['checked']]) }), (item[this.objectMapping['disabled']] === true && { disabled: true }), (Boolean(item[this.objectMapping['selected']]) === Boolean(true) && this.checkboxes == false && { selected: Boolean(item[this.objectMapping['selected']]) }), (this.template && { template: this.template }), (this.checkboxes && { checkboxes: true }), (this.size && { size: this.size }), { itemObject: item, objectMapping: this.objectMapping })));
694
- }
695
- /**
696
- * @desc
697
- * @param group
698
- */
699
- recursiveGroupRenderer(group) {
700
- return (h("bcm-listbox-group", { id: group[this.objectMapping['id']], text: group[this.objectMapping['text']] }, group.items.map((item) => ((item.type === 'group' ? this.recursiveGroupRenderer(item) : this.itemRenderer(item))))));
701
- }
702
- async searchResultMethod(items = []) {
703
- if (this.treeview == true) {
704
- const bcmtreeview = this.el.shadowRoot.querySelector("bcm-treeview");
705
- // await bcmListbox.config(this._config)
706
- if (bcmtreeview) {
707
- bcmtreeview.searchResultMethod({ detail: (items.length > 0 ? items : true) });
708
- }
709
- }
710
- else {
711
- this.listenSearchResult({ detail: (items.length > 0 ? items : true), isEvent: true });
712
- }
713
- // return true
714
- }
715
- handleListboxSelected(event) {
716
- this.listboxItemSelected.emit(event.detail);
717
- }
718
- /**
719
- * @desc
720
- */
721
- // @Listen('bcm-treeview-checklist')
722
- // handleListboxCheckedList(e) {
723
- // this.listboxChecklist.emit(e.detail)
724
- // }
725
- isLoading(val) {
726
- var listContainer = this.el.shadowRoot.getElementById("bcm-listbox-list");
727
- var loading = this.el.shadowRoot.getElementById("loading");
728
- var searchInput = this.el.shadowRoot.querySelector("bcm-old-search");
729
- // var listcontainer = this.el.shadowRoot.getElementById("list-container")
730
- if (val) {
731
- if (searchInput) {
732
- searchInput.disabled = true;
733
- }
734
- listContainer && listContainer.classList.add('loading');
735
- loading && loading.classList.add('show');
736
- // listcontainer && listcontainer.classList.add('hidden')
737
- }
738
- else {
739
- if (searchInput) {
740
- searchInput.disabled = false;
741
- }
742
- listContainer && listContainer.classList.remove('loading');
743
- loading && loading.classList.remove('show');
744
- // listcontainer && listcontainer.classList.remove('hidden')
745
- }
746
- }
747
- isEmpty(val) {
748
- var empty = this.el.shadowRoot.getElementById("empty");
749
- var listcontainer = this.el.shadowRoot.getElementById("list-container");
750
- var checkall = this.el.shadowRoot.getElementById("checkall");
751
- if (val) {
752
- empty && empty.classList.add('show');
753
- listcontainer && listcontainer.classList.add('hidden');
754
- checkall && checkall.classList.add('hidden');
755
- }
756
- else {
757
- empty && empty.classList.remove('show');
758
- listcontainer && listcontainer.classList.remove('hidden');
759
- checkall && checkall.classList.remove('hidden');
760
- }
761
- }
762
- isSearchCount(val = false) {
763
- if (this.infoFooter) {
764
- var inSearch = this.el.shadowRoot.getElementById("in-search");
765
- var inTotal = this.el.shadowRoot.getElementById("in-total");
766
- if (val !== false && val >= 0 && val != null && inSearch && inTotal) {
767
- inSearch.innerHTML = val;
768
- inTotal.style.display = "none";
769
- }
770
- else {
771
- inTotal.style.display = "inline";
772
- inSearch.innerHTML = "";
773
- }
774
- }
775
- }
776
- listenSearchResult(event) {
777
- var path = event.path || (event.composedPath && event.composedPath());
778
- if (event.isEvent == undefined) {
779
- if (path && path.filter((input) => input['_internal_id'] == this._internal_id)[0] != undefined) {
780
- var searchValue = '';
781
- if (this.treeview == false) {
782
- // var checkall = null
783
- // this.checkboxes && (checkall = this.el.shadowRoot.getElementById("checkall"))
784
- var totalSearch = event.detail.length;
785
- // this.empty = false
786
- this.isEmpty(false);
787
- this.intersection = [];
788
- if (event.detail.length > 0) {
789
- if (event.detail[0] == -1) {
790
- totalSearch = 0;
791
- this.empty = true;
792
- this.isEmpty(true);
793
- }
794
- if (this.allChilds.length > 0) {
795
- // this.checkboxes && ( checkall && checkall.classList.add('hidden') )
796
- this.allChilds.map((item) => {
797
- if (this.highlight) {
798
- event.target.addEventListener('bcm-on-search-value', async (e) => {
799
- var inputText = item.shadowRoot.getElementById("text");
800
- if (inputText) {
801
- searchValue = await e.detail;
802
- inputText = (inputText === null || inputText === void 0 ? void 0 : inputText.textContent) || (inputText === null || inputText === void 0 ? void 0 : inputText.innerText) || "";
803
- if (searchValue) {
804
- var cacheInputText = lowercase$2(inputText);
805
- var cacheSearchValue = lowercase$2(searchValue);
806
- var index = cacheInputText.indexOf(cacheSearchValue);
807
- if (index >= 0) {
808
- inputText = inputText.substring(0, index) + "<span class='highlight'>" + inputText.substring(index, index + searchValue.length) + "</span>" + inputText.substring(index + searchValue.length);
809
- }
810
- }
811
- item.shadowRoot.getElementById("text").innerHTML = inputText;
812
- }
813
- });
814
- }
815
- item.hidden = true;
816
- var _ids = String(item.id);
817
- if (event.detail.indexOf(_ids) >= 0) {
818
- item.hidden = false;
819
- }
820
- else {
821
- item.hidden = true;
822
- }
823
- });
824
- }
825
- this.intersection = event.detail[0] == -1 ? [0] : event.detail.filter(x => this.isGroupArray.includes(x));
826
- }
827
- else {
828
- if (this.allChilds.length > 0) {
829
- this.allChilds.map((item) => {
830
- item.hidden = false;
831
- });
832
- // this.checkboxes && ( checkall && checkall.classList.remove('hidden') )
833
- }
834
- // this.isEmpty(true)
835
- }
836
- if (this.search || this.checkboxes) {
837
- setTimeout(() => {
838
- if (totalSearch >= 0) {
839
- var totals = totalSearch;
840
- this.isSearchCount(totals);
841
- }
842
- else {
843
- this.isSearchCount(0);
844
- }
845
- if (event.detail[0] === -1) {
846
- this.isSearchCount(0);
847
- }
848
- if (event.detail === true) {
849
- this.isSearchCount();
850
- }
851
- }, 100);
852
- }
853
- if (event.detail === true) {
854
- this.isEmpty(false);
855
- }
856
- if (this.runClearAndSelect) {
857
- this.runClearAndSelect = false;
858
- this.isSearchCount(true);
859
- }
860
- }
861
- }
862
- }
863
- }
864
- /**
865
- * @desc
866
- * @param newValue
867
- * @returns {void}
868
- */
869
- parseItems(newValue) {
870
- if (newValue) {
871
- typeof newValue == 'string'
872
- ? this.items = JSON.parse(newValue)
873
- : this.items = newValue;
874
- }
875
- this.handleChildProcess();
876
- }
877
- handleChange(newValue) {
878
- this.change.emit(newValue);
879
- this.listboxChange.emit(newValue);
880
- }
881
- handleChildProcess() {
882
- setTimeout(() => {
883
- this.onlyChilds = this.getAllGroup(this.el, true);
884
- this.total = this.onlyChilds.length;
885
- // console.log(this.total)
886
- // this.allChilds = this.getAllChilds()
887
- // this.total = this.allChilds.filter((v, i, a) => a.indexOf(v) === i).length
888
- if (this.total > 0) {
889
- // setTimeout(() => {
890
- this.isLoading(false);
891
- // }, 100);
892
- this.isEmpty(false);
893
- }
894
- else {
895
- // setTimeout(() => {
896
- this.isLoading(false);
897
- this.isEmpty(true);
898
- // }, 100);
899
- }
900
- }, 100);
901
- }
902
- /**
903
- * @desc
904
- */
905
- handleListboxClearSelected(event) {
906
- var path = event.path || (event.composedPath && event.composedPath());
907
- if (this.checkboxes == false && path && path.filter((input) => input['_internal_id'] == this._internal_id)[0] != undefined) {
908
- this.value = event.detail;
909
- this.selectedId = String(event.detail[this.objectMapping['id']]);
910
- this.listboxClearSelected.emit(event.detail);
911
- }
912
- }
913
- /**
914
- * @desc
915
- */
916
- handleListboxChecked(event, _internal_id = this._internal_id) {
917
- var path = event.path || (event.composedPath && event.composedPath());
918
- if ((path && path.filter((input) => input['_internal_id'] == this._internal_id)[0] != undefined) || _internal_id == this._internal_id) {
919
- this.listboxSendCheck.emit(event.detail);
920
- this.handleCheckList('add', event.detail);
921
- this.setIndeterminateState();
922
- }
923
- }
924
- /**
925
- * @desc
926
- */
927
- handleListboxUnchecked(event, _internal_id = this._internal_id) {
928
- var path = event.path || (event.composedPath && event.composedPath());
929
- if ((path && path.filter((input) => input['_internal_id'] == this._internal_id)[0] != undefined) || _internal_id == this._internal_id) {
930
- this.listboxSendUncheck.emit(event.detail);
931
- this.handleCheckList('remove', event.detail);
932
- this.setIndeterminateState();
933
- }
934
- }
935
- async listboxUncheckedMethod(item, internal_id = this._internal_id) {
936
- if (this.treeview) {
937
- await customElements.whenDefined("bcm-treeview");
938
- const bcmTreeview = this.el.shadowRoot.querySelector("bcm-treeview");
939
- if (bcmTreeview) {
940
- await bcmTreeview.treeviewUncheckedMethod(item);
941
- }
942
- }
943
- else {
944
- this.handleListboxUnchecked({ "detail": item }, internal_id);
945
- }
946
- }
947
- handleFocus(focusEvent = false) {
948
- this.onFocus = focusEvent;
949
- }
950
- render() {
951
- const { innerComponent, label, required, treeview, searchText, checkboxes, search, size, fullWidth, total, indeterminateState, checked, checklist, searchData, searchFields, _flex, returnField, searchSub, infoFooter, showSearch, noCaption, caption, captionError, captionType } = this;
952
- const bcmListbox = classnames('bcm-listbox', {
953
- 'error': captionType == 'error' ? true : false,
954
- 'full-width': fullWidth,
955
- 'flex': _flex
956
- });
957
- const classes = classnames('listbox-item', {
958
- 'hidden': this.totalSearch > 0
959
- });
960
- const classesContainer = classnames('listbox-item-container');
961
- const textContent = classnames('listbox-item-container-text-content', size, {
962
- 'size-2': size === 'small' || size === 'medium',
963
- 'size-3': size === 'large',
964
- });
965
- const listContainer = classnames('list-container', {
966
- 'column-1': this.numberOfColumns <= 1,
967
- 'column-2': this.numberOfColumns == 2,
968
- 'column-3': this.numberOfColumns >= 3,
969
- });
970
- const listContainerStyle = {
971
- 'grid-template-columns': this.numberOfColumns <= 1 ? '1fr' : 'repeat(' + this.numberOfColumns + ', ' + (210 - (this.numberOfColumns * 10)) + 'px)'
972
- };
973
- const hostClasses = classnames(this.hidden ? 'hidden' : null,
974
- // this.totalSearch > 0 ? 'hidden' : null,
975
- {
976
- 'flex': _flex,
977
- 'full-width': fullWidth
978
- });
979
- var customStyles = {
980
- 'max-height': this.maxHeight
981
- };
982
- const customStylesList = {
983
- 'min-height': this.height ? "inherit" : this.maxHeight ? "auto" : "200px"
984
- };
985
- if (this.height) {
986
- customStyles = Object.assign(Object.assign({}, customStyles), { 'height': this.height });
987
- }
988
- const captionClasses = classnames('size-1', 'input-caption', 'caption-' + captionType);
989
- return (h(Host, { class: hostClasses, style: customStyles, "bcm-internal-id": this._internal_id }, !innerComponent && label && h("div", null, h("bcm-label", { tooltip: this.tooltip, type: captionType, value: label, required: required })), treeview === true && (h("bcm-treeview", { _internal_id: this._internal_id })), treeview == false && (h("div", { class: bcmListbox, style: customStyles }, search && (h("div", { class: "search", id: "search", style: { 'display': String(showSearch) == 'false' ? 'none' : 'block' } }, h("bcm-old-search", { _internal_id: this._internal_id, searchPlaceholder: this.searchPlaceholder, searchValue: searchText, "on-bcm-focus": () => this.handleFocus(true), "on-bcm-blur": () => this.handleFocus(false), data: searchData, returnField: returnField, searchFields: searchFields, searchSub: searchSub, clearable: true }), h("bcm-divider", null))), h("div", { id: "bcm-listbox-list", class: "bcm-listbox-list loading", style: customStylesList }, checkboxes && (h("div", { class: classes, id: "checkall" }, h("div", { class: classesContainer, onClick: () => this.handleIndeterminateClick() }, h("div", { class: "check-content" }, indeterminateState == 'indeterminate' && (h("span", { class: "indeterminate" })) || (h("bcm-checkbox-lite", { onClick: (e) => this.handleCheckboxClick(e), checked: checked, "no-caption": true }))), h("div", { class: textContent }, "Select All")), h("div", { class: "divider" }, h("bcm-divider", null)))),
990
- // this.empty == false && (
991
- h("div", { id: "list-container", class: listContainer, style: listContainerStyle }, this.items.length !== 0 && this.items.map((item) => ((item.type === 'group' ? this.recursiveGroupRenderer(item) : this.itemRenderer(item)))))
992
- // )
993
- ,
994
- // this.loading && (
995
- h("div", { id: "loading", class: "loading show" }, h("bcm-icon", { class: "prefix", icon: "far fa-spinner-third fa-spin" }))
996
- // )
997
- ,
998
- // ( this.empty || total == 0 ) && (
999
- h("div", { id: "empty", class: "empty" }, h("bcm-empty", null, "No Data"))
1000
- // )
1001
- ), infoFooter == true && (h("div", { class: "bcm-listbox-footer" }, h("bcm-text", { scale: "size-1", color: "grey-8" }, checklist.length > 0 && (' ( ' + checklist.length + ' selected ) '), "Total ", h("span", { id: "in-search" }), " ", h("span", { id: "in-total" }, total), " items found."))))), !noCaption && (h("div", { class: "caption-area" }, captionType == "error"
1002
- ? h("span", { class: captionClasses }, " ", captionError, " ")
1003
- : caption && h("span", { class: captionClasses }, " ", caption, " ")))));
1004
- }
1005
- get el() { return getElement(this); }
1006
- static get watchers() { return {
1007
- "_items": ["parseItems"],
1008
- "value": ["handleChange"]
1009
- }; }
1010
- };
1011
- BcmListbox.style = listboxCss;
1012
-
1013
- const listboxGroupCss = "@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}:host{display:block}:host(.hidden){display:none}.listbox-group-title{padding:4px 16px;background-color:var(--bcm-color-grey-7);position:sticky;top:0;z-index:1}";
1014
-
1015
- const uppercase = (str) => str.toUpperCase();
1016
- const BcmListboxGroup = class {
1017
- constructor(hostRef) {
1018
- registerInstance(this, hostRef);
1019
- this.text = undefined;
1020
- this._id = (Math.random() * 4).toString(16).replace('.', '');
1021
- this.hidden = false;
1022
- }
1023
- componentWillLoad() {
1024
- this.text = uppercase(this.text);
1025
- }
1026
- render() {
1027
- const { text } = this;
1028
- const classes = classnames('listbox-group');
1029
- const classesTitle = classnames('listbox-group-title');
1030
- const hostClasses = classnames(this.hidden ? 'hidden' : null);
1031
- return (h(Host, { class: hostClasses }, h("div", { class: classes }, h("div", { class: classesTitle }, h("bcm-text", { "font-size": "3", color: "slate-100" }, " ", text, " ")), h("slot", null))));
1032
- }
1033
- };
1034
- BcmListboxGroup.style = listboxGroupCss;
1035
-
1036
- const listboxItemCss = "@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}:host{display:flex;flex:1}:host(.hidden){display:none}.listbox-item{display:flex;flex:1;align-items:stretch;justify-content:flex-start;color:var(--bcm-color-grey-8);user-select:none;background-color:var(--bcm-color-grey-1);display:none}.listbox-item.display{display:flex}.listbox-item-container{display:flex;align-items:center;justify-content:flex-start;flex-direction:row;padding-left:8px;flex:1}.listbox-item-container .avatar{margin-right:4px}.listbox-item-container .check-content{display:flex;align-items:center;justify-content:flex-start;width:16px;min-width:16px;margin-right:4px}.listbox-item-container .check-content .indeterminate{width:16px;height:16px;position:relative;display:block;padding-right:8px;cursor:pointer}.listbox-item-container .check-content .indeterminate:after{content:\"\";position:absolute;top:50%;left:9px;width:10px;height:10px;background-color:var(--bcm-color-prime-blue-6);transform:translate(-50%, -50%);opacity:1;z-index:1}.listbox-item-container .check-content .indeterminate:before{content:\"\";position:absolute;top:-1px;left:0px;width:16px;height:100%;border-radius:2px;background-color:transparent;border:1px solid var(--bcm-color-grey-5);opacity:1;z-index:2}.listbox-item-container .check-content .indeterminate:hover:not(.disabled):before{border-color:var(--bcm-color-prime-blue-6);box-shadow:0px 2px 4px rgba(54, 121, 171, 0.5)}.listbox-item-container-html-content{display:flex;align-items:center;justify-content:flex-start;flex-direction:row;cursor:pointer;flex:1}.listbox-item-container-html-content #text .highlight{background-color:var(--bcm-color-yellow-5)}.listbox-item-container-html-content.small{padding:0 8px 0 4px;padding:4px 8px 4px 4px}.listbox-item-container-html-content.medium{padding:8px 8px 8px 4px}.listbox-item-container-html-content.large{padding:8px 8px 8px 4px}.listbox-item-container-text-content{display:flex;align-items:center;justify-content:space-between;flex-direction:row;cursor:pointer;width:100%}.listbox-item-container-text-content #text .highlight{background-color:var(--bcm-color-yellow-5)}.listbox-item-container-text-content.small{padding:0 8px 0 4px;padding:4px 8px 4px 4px}.listbox-item-container-text-content.medium{padding:8px 8px 8px 4px}.listbox-item-container-text-content.large{padding:8px 8px 8px 4px}.listbox-item-container-text-content .icon{text-align:center;margin-right:8px}.listbox-item-container-text-content>div{display:flex;align-items:center;flex-direction:row;word-wrap:break-word}.listbox-item-container.disabled{color:var(--bcm-color-grey-6)}.listbox-item-container.selected{color:var(--bcm-color-prime-blue-6);background-color:var(--bcm-color-prime-blue-1)}.listbox-item-container.selected:hover:not(.disabled){color:var(--bcm-color-prime-blue-6);background-color:var(--bcm-color-prime-blue-1)}.listbox-item-container:hover:not(.disabled),.listbox-item-container:active:not(.disabled){color:var(--bcm-color-prime-blue-6);background-color:var(--bcm-color-prime-blue-1)}";
1037
-
1038
- const BcmListboxItem = class {
1039
- constructor(hostRef) {
1040
- registerInstance(this, hostRef);
1041
- this.listboxItemSelected = createEvent(this, "bcm-listbox-item-selected", 7);
1042
- this.listboxUnchecked = createEvent(this, "bcm-listbox-unchecked", 7);
1043
- this.listboxChecked = createEvent(this, "bcm-listbox-checked", 7);
1044
- this.objectMapping = {
1045
- 'id': "id",
1046
- 'text': "text",
1047
- 'icon': "icon",
1048
- 'avatar': "avatar",
1049
- 'avatarName': "avatarName",
1050
- 'avatarImage': "avatarImage",
1051
- 'secondaryText': "secondaryText",
1052
- 'tooltipText': "tooltipText",
1053
- 'selected': "selected",
1054
- 'checked': "checked",
1055
- 'disabled': "disabled",
1056
- };
1057
- this.display = true;
1058
- this.avatar = false;
1059
- this.avatarImage = undefined;
1060
- this.avatarName = undefined;
1061
- this.secondaryText = undefined;
1062
- this.tooltipText = undefined;
1063
- this.text = undefined;
1064
- this._id = (Math.random() * 4).toString(16).replace('.', '');
1065
- this.size = 'medium';
1066
- this.icon = 'bug';
1067
- this.open = false;
1068
- this.selected = false;
1069
- this.checkboxes = false;
1070
- this.showIcon = false;
1071
- this.checked = false;
1072
- this.focused = false;
1073
- this.hidden = false;
1074
- this.itemObject = undefined;
1075
- this.disabled = false;
1076
- this.highlight = undefined;
1077
- this._internal_id = "";
1078
- this.template = null;
1079
- }
1080
- componentDidLoad() {
1081
- if (!this.disabled) {
1082
- if (this.selected === true) {
1083
- this.listboxItemSelected.emit(this.itemObject);
1084
- }
1085
- this.checkboxes === true && (this.checked === true && (this.listboxChecked.emit(this._id)));
1086
- }
1087
- }
1088
- /**
1089
- * @desc
1090
- */
1091
- handleClick() {
1092
- if (!this.disabled) {
1093
- this.checkboxes === true && (this.checked === true && (this.listboxUnchecked.emit(this._id)) || (this.listboxChecked.emit(this._id)));
1094
- this.checkboxes === false && (this.selected = true,
1095
- this.listboxItemSelected.emit(this.itemObject));
1096
- }
1097
- }
1098
- handleCheckboxClick(e) {
1099
- e.preventDefault();
1100
- }
1101
- isInternal(event) {
1102
- var path = event.path || (event.composedPath && event.composedPath());
1103
- const detect = path
1104
- && path[0]
1105
- && path[0].attributes
1106
- && path[0].attributes['bcm-internal-id']
1107
- && path[0].attributes['bcm-internal-id'].value;
1108
- return detect == this._internal_id;
1109
- }
1110
- /**
1111
- * @descc
1112
- * @param event
1113
- */
1114
- ListenListboxCheck(event) {
1115
- if (this.isInternal(event)) {
1116
- if (!this.disabled) {
1117
- if (event.detail && event.detail === this._id) {
1118
- this.checked = true;
1119
- }
1120
- }
1121
- }
1122
- }
1123
- /**
1124
- * @descc
1125
- * @param event
1126
- */
1127
- ListenListboxUncheck(event) {
1128
- if (this.isInternal(event)) {
1129
- if (!this.disabled) {
1130
- if (event.detail && event.detail === this._id) {
1131
- this.checked = false;
1132
- }
1133
- }
1134
- }
1135
- }
1136
- /**
1137
- * @descc
1138
- * @param event
1139
- */
1140
- handleListboxClearSelecteds(event) {
1141
- if (this.checkboxes == false && this.isInternal(event)) {
1142
- if (!this.disabled) {
1143
- if (event.detail) {
1144
- if (event.detail !== this.itemObject) {
1145
- this.selected = false;
1146
- }
1147
- else {
1148
- this.selected = true;
1149
- }
1150
- }
1151
- }
1152
- }
1153
- }
1154
- templateParser(template) {
1155
- var rxp = /{{([^}]+)}}/g, str = template, curMatch;
1156
- while (curMatch = rxp.exec(str)) {
1157
- template = template.replace("{{" + curMatch[1] + "}}", this.itemObject[curMatch[1]]);
1158
- }
1159
- return template;
1160
- }
1161
- render() {
1162
- const { display, focused, selected, size, showIcon, icon, checkboxes, _id, checked, text, avatarName, avatarImage, avatar, secondaryText, tooltipText } = this;
1163
- const classes = classnames('listbox-item', {
1164
- 'disabled': this.disabled,
1165
- 'display': display
1166
- });
1167
- const classesContainer = classnames('listbox-item-container', {
1168
- 'disabled': this.disabled,
1169
- 'focus': focused,
1170
- 'selected': selected
1171
- });
1172
- const textContent = classnames('listbox-item-container-text-content', size, {
1173
- 'disabled': this.disabled,
1174
- 'size-2': size === 'small' || size === 'medium',
1175
- 'size-3': size === 'large',
1176
- });
1177
- const hostClasses = classnames(this.hidden ? 'hidden' : null);
1178
- const htmlContent = classnames('listbox-item-container-html-content', size, {
1179
- 'disabled': this.disabled,
1180
- 'size-2': size === 'small' || size === 'medium',
1181
- 'size-3': size === 'large',
1182
- });
1183
- return (h(Host, { class: hostClasses }, h("div", { class: classes }, h("div", { class: classesContainer, onClick: () => this.handleClick() }, checkboxes && (h("div", { class: "check-content" }, h("bcm-checkbox-lite", { id: 'check-' + _id, onClick: (e) => this.handleCheckboxClick(e), checked: checked, disabled: this.disabled }))), this.template && (h("div", { class: htmlContent, title: tooltipText, innerHTML: this.templateParser(this.template) })), this.template == null && (h("div", { class: textContent, title: tooltipText }, h("div", null, (avatar || avatarName || avatarImage) && (h("div", { class: "avatar" }, h("bcm-avatar", Object.assign({ size: "small", name: text }, avatarName && { name: avatarName }, avatarImage && { image: avatarImage })))), showIcon && icon && (h("bcm-icon", { class: "icon", icon: icon })), text && (h("span", { id: "text" }, text)) || (h("slot", null))), h("div", null, (secondaryText) && (h("div", { class: "secondaryText size-1" }, secondaryText)))))))));
1184
- }
1185
- get el() { return getElement(this); }
1186
- };
1187
- BcmListboxItem.style = listboxItemCss;
1188
-
1189
- const oldSearchCss = "@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}:host{display:block}:host(.hidden){display:none}";
1190
-
1191
- const lowercase$1 = (str) => str.toLowerCase();
1192
- const BcmOldSearch = class {
1193
- constructor(hostRef) {
1194
- registerInstance(this, hostRef);
1195
- this.bcmOnSearch = createEvent(this, "bcm-on-search", 7);
1196
- this.bcmOnSearchValue = createEvent(this, "bcm-on-search-value", 7);
1197
- this.data = [];
1198
- this.searchFields = ['text', 'value' /*, ...*/];
1199
- this.returnField = 'idx';
1200
- this.searchSub = null;
1201
- this.hidden = false;
1202
- this.onlyChild = false;
1203
- this.clearable = false;
1204
- this.searchValue = '';
1205
- this.searchPlaceholder = 'Search';
1206
- this.disabled = false;
1207
- this._internal_id = (Math.random() * 4).toString(16).replace('.', '');
1208
- this.results = [];
1209
- }
1210
- getInput() {
1211
- return this.el.shadowRoot.querySelector('bcm-old-input');
1212
- }
1213
- componentDidLoad() {
1214
- this.getInput().clearable = this.clearable;
1215
- }
1216
- listenBcmChange(e) {
1217
- e.stopPropagation();
1218
- }
1219
- async setValue(value) {
1220
- await this.getInput().setValue(value);
1221
- return value;
1222
- }
1223
- async select() {
1224
- await this.getInput().select();
1225
- this.bcmOnSearch.emit(true);
1226
- return true;
1227
- }
1228
- async setClear() {
1229
- await this.getInput().setClear();
1230
- this.bcmOnSearch.emit(true);
1231
- return true;
1232
- }
1233
- async searchArray(value, idFields = null) {
1234
- // console.log(this.data)
1235
- let cacheSearchFields = this.searchFields;
1236
- let arrayResult = [];
1237
- if (idFields) {
1238
- this.searchFields = [idFields];
1239
- }
1240
- value.forEach(item => {
1241
- // item = {[idFields]:item}
1242
- this.results = [];
1243
- // console.log(this.data)
1244
- this.nestedSearch(this.data, item, true);
1245
- arrayResult.push(...this.results);
1246
- });
1247
- this.searchFields = cacheSearchFields;
1248
- return arrayResult;
1249
- // await this.getInput().setValue( value )
1250
- // return value
1251
- }
1252
- nestedSearch(items, value, equal = false) {
1253
- var result;
1254
- items && (items.map((item) => {
1255
- this.searchFields.map(searchField => {
1256
- if (searchField in item) {
1257
- // debugger;
1258
- item[searchField] = lowercase$1(String(item[searchField]));
1259
- if (this.onlyChild) {
1260
- if (item[this.searchSub]) {
1261
- var temp = this.nestedSearch(item[this.searchSub], value, equal);
1262
- if (temp) {
1263
- this.results.push((result = String(item[this.returnField])));
1264
- this.results.push(temp);
1265
- }
1266
- }
1267
- else {
1268
- if (equal) {
1269
- // console.log(value)
1270
- if (item[searchField] == lowercase$1(String(value))) {
1271
- // if (item == lowercase(value)) {
1272
- this.results.push((result = String(item[this.returnField])));
1273
- // this.results.push (result = String(item))
1274
- }
1275
- }
1276
- else {
1277
- if (item[searchField].indexOf(lowercase$1(value)) !== -1) {
1278
- this.results.push((result = String(item[this.returnField])));
1279
- }
1280
- }
1281
- }
1282
- }
1283
- else {
1284
- if (item[this.searchSub]) {
1285
- var temp = this.nestedSearch(item[this.searchSub], value, equal);
1286
- if (temp) {
1287
- this.results.push((result = String(item[this.returnField])));
1288
- this.results.push(temp);
1289
- }
1290
- }
1291
- if (equal) {
1292
- // console.log(value)
1293
- if (item[searchField] == lowercase$1(String(value))) {
1294
- // if (item == lowercase(value)) {
1295
- this.results.push((result = String(item[this.returnField])));
1296
- // this.results.push (result = String(item))
1297
- }
1298
- }
1299
- else {
1300
- if (item[searchField].indexOf(lowercase$1(value)) !== -1) {
1301
- this.results.push((result = String(item[this.returnField])));
1302
- }
1303
- }
1304
- }
1305
- }
1306
- });
1307
- }));
1308
- return result;
1309
- }
1310
- /**
1311
- * @desc
1312
- * @param value
1313
- */
1314
- inputChange(value) {
1315
- this.results = [];
1316
- // data prop'unda arama yapılacak (searchFields prop'u içerisindeki alanlar ile)
1317
- // arama sonucunda eşleyen itemların 'idx', index
1318
- // değerleri, array şeklinde root component'e
1319
- // event ile gönderilecek
1320
- // Örneğin value == 'to' olduğunda aşağıdaki
1321
- // sonuçlar filtrelenmeli
1322
- // -->
1323
- //{ text: 'Mateusz Eaton', idx: 2 },
1324
- //{ text: 'Tony Vickers', idx: 3 },
1325
- // result array'i eşleşen itemların
1326
- // index numaralarını tutacak
1327
- // results = [2, 3]
1328
- // Örnek arama
1329
- // #
1330
- this.nestedSearch(this.data, value);
1331
- this.results = Array.from(new Set(this.results));
1332
- (value && ((this.results.length > 0 && this.bcmOnSearch.emit(this.results)) || this.bcmOnSearch.emit([-1]))) || this.bcmOnSearch.emit(true);
1333
- this.bcmOnSearchValue.emit(value);
1334
- }
1335
- render() {
1336
- const hostClasses = classnames(this.hidden ? 'hidden' : null);
1337
- return (h(Host, { class: hostClasses }, h("bcm-old-input", { placeholder: this.searchPlaceholder, "no-caption": true, "no-margin": true, "full-width": true, disabled: this.disabled, type: "search", "on-bcm-change": e => this.inputChange(e.detail), value: this.searchValue })));
1338
- }
1339
- get el() { return getElement(this); }
1340
- static get watchers() { return {
1341
- "searchValue": ["inputChange"]
1342
- }; }
1343
- };
1344
- BcmOldSearch.style = oldSearchCss;
1345
-
1346
- const treeviewCss = "@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}:host{display:flex;flex-direction:column;height:100%;max-height:100%;border:1px solid var(--bcm-color-grey-5);box-sizing:border-box;background-color:#ffffff}:host(.empty) .treeview{display:flex;align-items:center;justify-content:center}.search{padding:8px;padding-bottom:0;margin-bottom:4px}.treeview{height:100%;max-height:100%;overflow:auto;background-color:var(--bcm-color-grey-1);padding:0 8px 8px 0}.treeview.loading{min-height:150px;position:relative;margin:0 8px 8px 8px}.treeview .loading{display:none;align-items:center;justify-content:center;height:100%;width:100%;position:absolute;background-color:rgba(255, 255, 255, 0.03)}.treeview .loading.show{display:flex}.treeview .empty{display:none;align-items:center;justify-content:center;height:100%}.treeview .empty bcm-empty{width:fit-content;margin:auto}.treeview .empty.show{display:flex}footer{text-align:right;padding:4px 8px;background-color:var(--bcm-color-grey-3);user-select:none}";
1347
-
1348
- /**
1349
- * @desc
1350
- * @param str
1351
- */
1352
- const lowercase = (str) => str.toLowerCase();
1353
- const Bcmtreeview = class {
1354
- constructor(hostRef) {
1355
- registerInstance(this, hostRef);
1356
- this.treeviewChange = createEvent(this, "bcm-treeview-change", 7);
1357
- this.treeviewSendCheck = createEvent(this, "bcm-treeview-send-check", 7);
1358
- this.treeviewSendUncheck = createEvent(this, "bcm-treeview-send-uncheck", 7);
1359
- this.treeviewChecklist = createEvent(this, "bcm-treeview-checklist", 7);
1360
- this.treeviewItemSelected = createEvent(this, "bcm-treeview-item-selected", 7);
1361
- this.treeviewClearSelecteds = createEvent(this, "bcm-treeview-clear-selecteds", 7);
1362
- this.treeviewShowContext = createEvent(this, "bcm-treeview-show-context", 7);
1363
- this.treeviewUnchecked = createEvent(this, "bcm-treeview-unchecked", 7);
1364
- this.treeviewChecked = createEvent(this, "bcm-treeview-checked", 7);
1365
- this.objectMapping = {
1366
- 'text': 'text',
1367
- 'icon': 'icon',
1368
- 'id': 'id',
1369
- 'items': 'items',
1370
- 'open': 'open',
1371
- 'selected': 'selected',
1372
- 'checked': 'checked',
1373
- 'tooltipText': 'tooltipText',
1374
- 'disabled': "disabled",
1375
- 'favorite': "favorite",
1376
- };
1377
- this.checkedObjectList = [];
1378
- this.allChilds = [];
1379
- this.onFocus = false;
1380
- this.minHeight = 200;
1381
- this.minWidth = 200;
1382
- this.allOpenCache = false;
1383
- this.allOpenOnSearch = false;
1384
- this.parentLength = [{}];
1385
- this.isSetData = false;
1386
- this.runClearAndSelect = false;
1387
- /**
1388
- * Component States
1389
- */
1390
- this.empty = false;
1391
- this.checkboxes = false;
1392
- this.showIcon = false;
1393
- this.size = 'medium';
1394
- this.selectedId = undefined;
1395
- this.checkedList = [];
1396
- this.updateCheckedList = [];
1397
- this.hidden = false;
1398
- this.search = false;
1399
- this.searchOnlyChild = false;
1400
- this.keydown = false;
1401
- this.allOpen = false;
1402
- this.fullWidth = false;
1403
- this.infoFooter = false;
1404
- this.searchFields = ['text', 'secondaryText', 'tooltipText'];
1405
- this.searchSub = "items";
1406
- this.returnField = "id";
1407
- this._items = [];
1408
- this.searchPlaceholder = "Search";
1409
- this.maxHeight = null;
1410
- this.highlight = false;
1411
- this.loading = true;
1412
- this.favIcon = false;
1413
- this.favIconOnlyChilds = false;
1414
- this._internal_id = (Math.random() * 4).toString(16).replace('.', '');
1415
- this.showSearch = true;
1416
- this.items = [];
1417
- this.total = 0;
1418
- this.checkCount = 0;
1419
- this.focusedElement = undefined;
1420
- this.keyMapForFocus = { 18: false, 87: false };
1421
- this.checklist = [];
1422
- this.favoriteList = [];
1423
- this.checklistSorted = [];
1424
- this.searchData = undefined;
1425
- this.searchResults = [];
1426
- }
1427
- async setData(_data = []) {
1428
- this.clearAndSelectSearch(false);
1429
- this.isLoading(true);
1430
- this.isSetData = true;
1431
- this.checkedObjectList = [];
1432
- this.selectedId = null;
1433
- setTimeout(() => {
1434
- this._items = _data;
1435
- this.searchData = JSON.parse(_data);
1436
- this.calculateMinSizes();
1437
- this.handleChildProcess();
1438
- }, 100);
1439
- return Promise.resolve(true);
1440
- }
1441
- async getChecklist() {
1442
- return this.checkedObjectList;
1443
- }
1444
- async getFavorites() {
1445
- this.getChildItem(this.el).forEach(element => {
1446
- element[this.objectMapping['favorite']] == true && (this.favIconOnlyChilds && element[this.objectMapping['items']].length == 0 && (this.favoriteList.indexOf(element.itemObject) < 0 && (this.favoriteList.push(element.itemObject))),
1447
- !this.favIconOnlyChilds && (this.favoriteList.indexOf(element.itemObject) < 0 && (this.favoriteList.push(element.itemObject))));
1448
- });
1449
- return this.favoriteList;
1450
- }
1451
- async selected(id) {
1452
- this.selectedId = id;
1453
- }
1454
- async clearAndSelectSearch(select = true) {
1455
- this.runClearAndSelect = true;
1456
- if (this.search === true) {
1457
- setTimeout(() => {
1458
- var searchInput = null;
1459
- searchInput = this.el.shadowRoot.querySelector("bcm-old-search");
1460
- if (searchInput) {
1461
- searchInput.setClear();
1462
- if (select == true) {
1463
- searchInput.select();
1464
- }
1465
- }
1466
- }, 100);
1467
- }
1468
- }
1469
- async addChecked(items = []) {
1470
- this.checkedList = items;
1471
- }
1472
- async updateChecked(items = []) {
1473
- this.updateCheckedList = items;
1474
- }
1475
- async config(_config) {
1476
- if (_config['maxHeight']) {
1477
- typeof _config['maxHeight'] == 'string'
1478
- ? this.maxHeight = _config['maxHeight']
1479
- : this.maxHeight = "100%";
1480
- }
1481
- if (_config['searchFields']) {
1482
- if (Array.isArray(_config['searchFields'])) {
1483
- this.searchFields = _config['searchFields'];
1484
- }
1485
- }
1486
- if (_config['searchable']) {
1487
- typeof _config['searchable'] == 'boolean'
1488
- ? this.search = _config['searchable']
1489
- : this.search = false;
1490
- }
1491
- if (_config['searchOnlyChild']) {
1492
- typeof _config['searchOnlyChild'] == 'boolean'
1493
- ? this.searchOnlyChild = _config['searchOnlyChild']
1494
- : this.searchOnlyChild = false;
1495
- }
1496
- if (_config['searchPlaceholder']) {
1497
- typeof _config['searchPlaceholder'] == 'string'
1498
- ? this.searchPlaceholder = _config['searchPlaceholder']
1499
- : this.searchPlaceholder = null;
1500
- }
1501
- if (_config['fullWidth']) {
1502
- typeof _config['fullWidth'] == 'boolean'
1503
- ? this.fullWidth = _config['fullWidth']
1504
- : this.fullWidth = false;
1505
- }
1506
- if (_config['infoFooter']) {
1507
- typeof _config['infoFooter'] == 'boolean'
1508
- ? this.infoFooter = _config['infoFooter']
1509
- : this.infoFooter = false;
1510
- }
1511
- if (_config['highlight']) {
1512
- typeof _config['highlight'] == 'boolean'
1513
- ? this.highlight = _config['highlight']
1514
- : this.highlight = false;
1515
- }
1516
- if (_config['checkable']) {
1517
- typeof _config['checkable'] == 'boolean'
1518
- ? this.checkboxes = _config['checkable']
1519
- : this.checkboxes = false;
1520
- }
1521
- if (_config['showIcon']) {
1522
- typeof _config['showIcon'] == 'boolean'
1523
- ? this.showIcon = _config['showIcon']
1524
- : this.showIcon = false;
1525
- }
1526
- if (_config['favIcon']) {
1527
- typeof _config['favIcon'] == 'boolean'
1528
- ? this.favIcon = _config['favIcon']
1529
- : this.favIcon = false;
1530
- }
1531
- if (_config['favIconOnlyChilds']) {
1532
- typeof _config['favIconOnlyChilds'] == 'boolean'
1533
- ? this.favIconOnlyChilds = _config['favIconOnlyChilds']
1534
- : this.favIconOnlyChilds = false;
1535
- }
1536
- if (_config['allOpen']) {
1537
- typeof _config['allOpen'] == 'boolean'
1538
- ? this.allOpen = _config['allOpen']
1539
- : this.allOpen = false;
1540
- }
1541
- this.allOpenCache = this.allOpen;
1542
- if (_config['size']) {
1543
- (["small", "medium", "large"].indexOf(_config['size']) >= 0)
1544
- ? this.size = _config['size']
1545
- : this.size = 'medium';
1546
- }
1547
- if (_config['mapping']) {
1548
- if (_config['mapping']['text']) {
1549
- this.objectMapping['text'] = _config['mapping']['text'];
1550
- }
1551
- if (_config['mapping']['icon']) {
1552
- this.objectMapping['icon'] = _config['mapping']['icon'];
1553
- }
1554
- if (_config['mapping']['id']) {
1555
- this.objectMapping['id'] = _config['mapping']['id'];
1556
- this.returnField = this.objectMapping['id'];
1557
- }
1558
- if (_config['mapping']['items']) {
1559
- this.objectMapping['items'] = _config['mapping']['items'];
1560
- this.searchSub = this.objectMapping['items'];
1561
- }
1562
- if (_config['mapping']['open']) {
1563
- this.objectMapping['open'] = _config['mapping']['open'];
1564
- }
1565
- if (_config['mapping']['selected']) {
1566
- this.objectMapping['selected'] = _config['mapping']['selected'];
1567
- }
1568
- if (_config['mapping']['checked']) {
1569
- this.objectMapping['checked'] = _config['mapping']['checked'];
1570
- }
1571
- if (_config['mapping']['tooltipText']) {
1572
- this.objectMapping['tooltipText'] = _config['mapping']['tooltipText'];
1573
- }
1574
- if (_config['mapping']['disabled']) {
1575
- this.objectMapping['disabled'] = _config['mapping']['disabled'];
1576
- }
1577
- if (_config['mapping']['favorite']) {
1578
- this.objectMapping['favorite'] = _config['mapping']['favorite'];
1579
- }
1580
- }
1581
- // sessionStorage.setItem(this._internal_id + "-config", JSON.stringify(_config));
1582
- return Promise.resolve(true);
1583
- }
1584
- calculateMinSizes() {
1585
- if (this.minHeight < this.el.clientHeight) {
1586
- this.minHeight = this.el.clientHeight;
1587
- }
1588
- }
1589
- connectedCallback() { }
1590
- componentWillLoad() { }
1591
- componentWillRender() {
1592
- if (sessionStorage.getItem(this._internal_id + "-config")) {
1593
- this.config(JSON.parse(sessionStorage.getItem(this._internal_id + "-config")));
1594
- }
1595
- }
1596
- componentDidRender() {
1597
- // this.isEmpty(true)
1598
- // if(this.total > 0) {
1599
- // this.isEmpty(false)
1600
- // }
1601
- }
1602
- // componentDidLoad(){
1603
- // this.handleChildProcess()
1604
- // setTimeout(() => {
1605
- // if(this.isSetData) {
1606
- // this.isLoading(true)
1607
- // this.isEmpty(false)
1608
- // }else{
1609
- // this.isLoading(false)
1610
- // this.isEmpty(true)
1611
- // }
1612
- // }, 1000);
1613
- // // this.isEmpty(true)
1614
- // }
1615
- componentWillUpdate() { }
1616
- // componentWillRender(){}
1617
- // componentDidRender(){}
1618
- componentDidUpdate() {
1619
- if (this.checkboxes === true) {
1620
- this.checkedObjectList = [];
1621
- if (this.checklistSorted.length > 0) {
1622
- this.getChildItem(this.el).forEach(element => {
1623
- element.checked == true && (this.checkedObjectList.indexOf(element.itemObject) < 0 && (this.checkedObjectList.push(element.itemObject)));
1624
- });
1625
- this.treeviewChecklist.emit(this.checkedObjectList);
1626
- }
1627
- else {
1628
- this.treeviewChecklist.emit([]);
1629
- }
1630
- }
1631
- }
1632
- parseItems(newValue) {
1633
- if (newValue) {
1634
- typeof newValue == 'string'
1635
- ? this.items = JSON.parse(newValue)
1636
- : this.items = newValue;
1637
- }
1638
- this.handleChildProcess();
1639
- }
1640
- handleChildProcess() {
1641
- setTimeout(() => {
1642
- this.allChilds = this.getAllChilds();
1643
- this.total = this.allChilds.filter((v, i, a) => a.indexOf(v) === i).length;
1644
- if (this.total > 0) {
1645
- // setTimeout(() => {
1646
- this.isLoading(false);
1647
- // }, 100);
1648
- this.isEmpty(false);
1649
- }
1650
- else {
1651
- // setTimeout(() => {
1652
- this.isLoading(false);
1653
- this.isEmpty(true);
1654
- // }, 100);
1655
- }
1656
- }, 100);
1657
- }
1658
- /**
1659
- * @desc
1660
- * @param group
1661
- */
1662
- recursiveItemRenderer(group, parentGroup) {
1663
- const sId = String(this.selectedId);
1664
- const gId = String(group[this.objectMapping['id']]);
1665
- const isSelected = String(group[this.objectMapping['selected']]) === 'true' ? true : false;
1666
- if (sId === gId || isSelected) {
1667
- this.treeviewItemSelected.emit(group);
1668
- }
1669
- return (h("bcm-treeview-item", Object.assign({ _internal_id: this._internal_id, text: group[this.objectMapping['text']], icon: group[this.objectMapping['icon']], id: group[this.objectMapping['id']], size: this.size, "has-child": !!group[this.objectMapping['items']] }, (parentGroup && { 'parent-id': parentGroup[this.objectMapping['id']] }), (group[this.objectMapping['tooltipText']] && { tooltipText: group[this.objectMapping['tooltipText']] }), (String(group[this.objectMapping['checked']]) === "true" && { checkTrigger: true }), (String(group[this.objectMapping['open']]) === "true" && { open: true }), (String(group[this.objectMapping['selected']]) === "true" && { selected: true }), (String(group[this.objectMapping['disabled']]) === "true" && { disabled: true }), (group[this.objectMapping['items']] && { items: group[this.objectMapping['items']] }), (this.favIcon && !this.favIconOnlyChilds && { favicon: true }), (this.favIcon && this.favIconOnlyChilds && group[this.objectMapping['items']].length == 0 && { favicon: true }), (this.favIcon && group.rightSlot && { favorite: group.rightSlot[this.objectMapping['favorite']] }), (this.showIcon && { showIcon: true }), (String(this.checkboxes) === "true" && { checkboxes: true }), ((this.allOpen || this.allOpenOnSearch) && { open: true }), { itemObject: group }, ((this.checkedList && this.checkedList.find(e => e == group[this.objectMapping['id']]))) && { checkTrigger: true }, (this.updateCheckedList.length > 0 &&
1670
- ((this.updateCheckedList.find(e => e == group[this.objectMapping['id']])) && { checkTrigger: true }))), group[this.objectMapping['items']] && group[this.objectMapping['items']].map((item) => (this.recursiveItemRenderer(item, group)))));
1671
- }
1672
- /**
1673
- * @desc
1674
- */
1675
- handleCheckList(process = 'add', checkId) {
1676
- // console.log(checkId)
1677
- if (this.checkboxes === true) {
1678
- // const { checklist } = this
1679
- // checkId = Number(checkId)
1680
- switch (process) {
1681
- case 'add':
1682
- if (this.checklist.length > 0) {
1683
- this.checklist.indexOf(checkId) < 0 && (this.checklist = [...this.checklist, checkId]);
1684
- }
1685
- else {
1686
- this.checklist = [checkId];
1687
- }
1688
- break;
1689
- case 'remove':
1690
- this.checklist = this.checklist.filter(item => item !== checkId);
1691
- break;
1692
- }
1693
- let sorted = this.checklist.sort(function (a, b) { return a - b; });
1694
- this.checklistSorted = sorted;
1695
- // console.log('sorted: ', sorted)
1696
- this.checkCount = this.checklistSorted.length;
1697
- }
1698
- }
1699
- async showSearchMethod(val = true) {
1700
- this.showSearch = val;
1701
- // return val
1702
- }
1703
- async searchResultMethod(items = []) {
1704
- // this.listenSearchResult({ detail: items })
1705
- await customElements.whenDefined("bcm-old-search");
1706
- const search = this.el.shadowRoot.querySelector("bcm-old-search");
1707
- const detail = await search.searchArray(items, this.objectMapping['id']);
1708
- await this.listenSearchResult({ detail: detail });
1709
- // return true
1710
- }
1711
- isLoading(val) {
1712
- var treeview = this.el.shadowRoot.getElementById("treeview");
1713
- var loading = this.el.shadowRoot.getElementById("loading");
1714
- var searchInput = this.el.shadowRoot.querySelector("bcm-old-search");
1715
- // var listcontainer = this.el.shadowRoot.getElementById("list-container")
1716
- if (val === true) {
1717
- treeview && treeview.classList.add('loading');
1718
- loading && loading.classList.add('show');
1719
- if (searchInput) {
1720
- searchInput.disabled = true;
1721
- }
1722
- // listcontainer && listcontainer.classList.add('hidden')
1723
- }
1724
- else {
1725
- treeview && treeview.classList.remove('loading');
1726
- loading && loading.classList.remove('show');
1727
- if (searchInput) {
1728
- searchInput.disabled = false;
1729
- }
1730
- // listcontainer && listcontainer.classList.remove('hidden')
1731
- }
1732
- return false;
1733
- }
1734
- isEmpty(val) {
1735
- var empty = this.el.shadowRoot.getElementById("empty");
1736
- // var listcontainer = this.el.shadowRoot.getElementById("list-container")
1737
- if (val === true) {
1738
- empty && empty.classList.add('show');
1739
- // listcontainer && listcontainer.classList.add('hidden')
1740
- }
1741
- else {
1742
- empty && empty.classList.remove('show');
1743
- // listcontainer && listcontainer.classList.remove('hidden')
1744
- }
1745
- }
1746
- isSearchCount(val = null) {
1747
- if (this.infoFooter === true) {
1748
- var inSearch = this.el.shadowRoot.getElementById("in-search");
1749
- var inTotal = this.el.shadowRoot.getElementById("in-total");
1750
- if (val >= 0 && val != null && inSearch && inTotal) {
1751
- inSearch.innerHTML = val;
1752
- inTotal.style.display = "none";
1753
- }
1754
- else {
1755
- inTotal.style.display = "inline";
1756
- inSearch.innerHTML = "";
1757
- }
1758
- }
1759
- // if (val > 0){
1760
- // this.isEmpty(false)
1761
- // }
1762
- }
1763
- listenSearchResult(e) {
1764
- this.parentLength = [];
1765
- var searchValue = '';
1766
- // this.searchResults = e.detail
1767
- var totalSearch = e.detail.length;
1768
- this.empty = false;
1769
- var getAllChilds = this.getAllChilds();
1770
- this.isEmpty(false);
1771
- if (e.detail.length > 0) {
1772
- // this.allOpenOnSearch = true
1773
- if (e.detail[0] == -1) {
1774
- totalSearch = 0;
1775
- this.empty = true;
1776
- this.isEmpty(true);
1777
- }
1778
- if (getAllChilds.length > 0) {
1779
- getAllChilds.map((item) => {
1780
- var isParent = false;
1781
- if (this.searchOnlyChild && item.items && item.items.length > 0) {
1782
- isParent = true;
1783
- }
1784
- e.target.addEventListener('bcm-on-search-value', async (e) => {
1785
- searchValue = await e.detail;
1786
- var inputText = item.shadowRoot.getElementById("text");
1787
- inputText = inputText.textContent || inputText.innerText || "";
1788
- if (searchValue) {
1789
- var cacheInputText = lowercase(inputText);
1790
- var cacheSearchValue = lowercase(searchValue);
1791
- var index = cacheInputText.indexOf(cacheSearchValue);
1792
- if (index >= 0) {
1793
- if (isParent == false) {
1794
- if (this.parentLength.indexOf(item.id) === -1) {
1795
- this.parentLength.push(item.id);
1796
- }
1797
- if (this.highlight) {
1798
- inputText = inputText.substring(0, index)
1799
- + "<span class='highlight'>"
1800
- + inputText.substring(index, index + searchValue.length)
1801
- + "</span>"
1802
- + inputText.substring(index + searchValue.length);
1803
- }
1804
- }
1805
- }
1806
- }
1807
- item.shadowRoot.getElementById("text").innerHTML = inputText;
1808
- });
1809
- item.hidden = true;
1810
- var _ids = item.id;
1811
- if (e.detail.indexOf(_ids) >= 0) {
1812
- item.hidden = false;
1813
- item.open = true;
1814
- setTimeout(() => {
1815
- if (this.parentLength.indexOf(item.id) !== -1 && item.items && item.items.length > 0 && this.searchOnlyChild == false) {
1816
- const getChilds = (item) => {
1817
- this.getAllChilds(item).map(element => {
1818
- element.hidden = false;
1819
- element.open = true;
1820
- getChilds(element);
1821
- });
1822
- };
1823
- getChilds(item);
1824
- }
1825
- }, 1);
1826
- }
1827
- else {
1828
- item.hidden = true;
1829
- }
1830
- });
1831
- }
1832
- }
1833
- else {
1834
- // this.allOpenOnSearch = this.allOpenCache
1835
- if (getAllChilds.length > 0) {
1836
- getAllChilds.map((item) => {
1837
- item.hidden = false;
1838
- });
1839
- }
1840
- // this.isEmpty(true)
1841
- }
1842
- // if ( this.searchOnlyChild ) {
1843
- // this.isSearchCount(highlightLength)
1844
- // }else{
1845
- setTimeout(() => {
1846
- if (totalSearch >= 0) {
1847
- var totals = totalSearch - Number(totalSearch - this.parentLength.length);
1848
- this.isSearchCount(totals > 0 ? totals : 0);
1849
- }
1850
- else {
1851
- this.isSearchCount();
1852
- }
1853
- if (e.detail[0] === -1) {
1854
- this.isSearchCount(0);
1855
- }
1856
- if (e.detail === true) {
1857
- this.isSearchCount();
1858
- }
1859
- }, 100);
1860
- // }
1861
- if (e.detail === true) {
1862
- this.isEmpty(false);
1863
- }
1864
- }
1865
- getAllChilds(element = this.el) {
1866
- let returnAllItems = [];
1867
- getChilds(element, 'bcm-treeview-item').forEach(items => {
1868
- this.getAllChilds(items) && (returnAllItems.indexOf(items) < 0 && (returnAllItems.push(items))
1869
- // returnAllItems = [...returnAllItems, ...this.getAllChilds(items)]
1870
- );
1871
- returnAllItems.indexOf(items) < 0 && (returnAllItems.push(items));
1872
- // returnAllItems = [...returnAllItems,
1873
- // items
1874
- // ]
1875
- });
1876
- return returnAllItems;
1877
- }
1878
- /**
1879
- * @desc
1880
- */
1881
- handletreeviewItemSelected(event) {
1882
- this.treeviewClearSelecteds.emit(event.detail);
1883
- }
1884
- /**
1885
- * @desc
1886
- */
1887
- handletreeviewChecked(event) {
1888
- // this.treeviewSendCheck.emit(event.detail)
1889
- this.handleCheckList('add', event.detail);
1890
- // this.treeviewChange.emit(event.detail)
1891
- }
1892
- /**
1893
- * @desc
1894
- */
1895
- // @Listen('bcm-treeview-check-group-check')
1896
- // bcmTreeviewCheckGroupChecked(event: any) {
1897
- // console.log(event)
1898
- // this.treeviewSendCheck.emit(event.detail)
1899
- // this.handleCheckList('add',event.detail)
1900
- // this.treeviewChange.emit(event.detail)
1901
- // }
1902
- /**
1903
- * @desc
1904
- */
1905
- handletreeviewUnchecked(event) {
1906
- // this.treeviewSendUncheck.emit(event.detail)
1907
- this.handleCheckList('remove', event.detail);
1908
- // this.treeviewChange.emit(event.detail)
1909
- }
1910
- /**
1911
- * @desc
1912
- */
1913
- handletreeviewIndeterminateChecked(event) {
1914
- this.handleCheckList('add', event.detail);
1915
- }
1916
- /**
1917
- * @desc
1918
- */
1919
- handletreeviewIndeterminateUnchecked(event) {
1920
- this.handleCheckList('remove', event.detail);
1921
- }
1922
- treeviewUncheckedMethod(item) {
1923
- this.handletreeviewUnchecked({ "detail": item });
1924
- this.componentDidUpdate();
1925
- return Promise.resolve(true);
1926
- }
1927
- /**
1928
- * @desc
1929
- * Keyboard Navigation
1930
- */
1931
- getIndex(item) {
1932
- return Array.from(item.parentNode.children).indexOf(item);
1933
- }
1934
- /**
1935
- * @desc
1936
- * Keyboard Navigation
1937
- */
1938
- getNext(item) {
1939
- let returnItem = this.getChildItem(item.parentElement)[this.getIndex(item) + 1];
1940
- if (returnItem)
1941
- return returnItem;
1942
- return false;
1943
- }
1944
- /**
1945
- * @desc
1946
- * Keyboard Navigation
1947
- */
1948
- getPrev(item) {
1949
- let returnItem = this.getChildItem(item.parentElement)[this.getIndex(item) - 1];
1950
- if (returnItem)
1951
- return returnItem;
1952
- return false;
1953
- }
1954
- /**
1955
- * @desc
1956
- * Keyboard Navigation
1957
- */
1958
- getParent(item) {
1959
- if (lowercase(item.parentElement.tagName) == 'bcm-treeview') {
1960
- return false;
1961
- }
1962
- else {
1963
- return this.getChildItem(item.parentElement.parentElement)[this.getIndex(item.parentElement)];
1964
- }
1965
- }
1966
- /**
1967
- * @desc
1968
- * Keyboard Navigation
1969
- */
1970
- getNextParent(item) {
1971
- let getParent = this.getParent(item);
1972
- let getNext;
1973
- if (getParent) {
1974
- getNext = this.getNext(getParent);
1975
- if (getNext) {
1976
- return getNext;
1977
- }
1978
- else {
1979
- return this.getNextParent(getParent);
1980
- }
1981
- }
1982
- }
1983
- /**
1984
- * @desc
1985
- * Keyboard Navigation
1986
- */
1987
- getFirstItem(el = this.el) {
1988
- return this.getChildItem(el)[0];
1989
- }
1990
- /**
1991
- * @desc
1992
- * Keyboard Navigation
1993
- */
1994
- getLastItem(el = this.el) {
1995
- let childLength = this.getChildItem(el).length;
1996
- let lastChild = this.getChildItem(el)[childLength - 1];
1997
- if (this.getChildItem(lastChild).length > 0 && lastChild.open == true) {
1998
- return this.getLastItem(lastChild);
1999
- }
2000
- else {
2001
- return lastChild;
2002
- }
2003
- }
2004
- /**
2005
- * @desc
2006
- * Keyboard Navigation
2007
- */
2008
- getChildItem(element = this.el) {
2009
- let returnItems = getChilds(element, 'bcm-treeview-item');
2010
- if (returnItems)
2011
- return returnItems;
2012
- return 0;
2013
- }
2014
- /**
2015
- * @desc
2016
- */
2017
- handleRightClick(e) {
2018
- this.treeviewShowContext.emit([e.target.id, e.clientY, e.clientX]);
2019
- e.preventDefault();
2020
- }
2021
- /**
2022
- * @desc
2023
- */
2024
- keyboardNavigationUp(e) {
2025
- let { keyMapForFocus } = this;
2026
- if (e.keyCode in keyMapForFocus) {
2027
- keyMapForFocus[e.keyCode] = false;
2028
- }
2029
- }
2030
- /**
2031
- * @desc
2032
- */
2033
- keyboardNavigation(e) {
2034
- if (this.keydown) {
2035
- const { keyMapForFocus, focusedElement, el } = this;
2036
- this.focusedElement = !focusedElement ? el : focusedElement;
2037
- const which = e.which || 0;
2038
- if (this.getChildItem(el).length > 0) {
2039
- if (e.keyCode in keyMapForFocus) {
2040
- keyMapForFocus[e.keyCode] = true;
2041
- if (keyMapForFocus[18] && keyMapForFocus[87]) {
2042
- e.preventDefault();
2043
- this.focusedElement = this.getFirstItem(this.focusedElement);
2044
- }
2045
- }
2046
- if (which == 9 || //tab
2047
- which == 13 || //enter
2048
- which == 18 || //alt
2049
- which == 32 || //space
2050
- which == 35 || // end
2051
- which == 36 || // home
2052
- (which >= 35 && which <= 40) //end, home, left arrow, up arrow, right arrow, down arrow
2053
- ) {
2054
- e.preventDefault();
2055
- if (!focusedElement) {
2056
- this.focusedElement = this.getFirstItem(this.focusedElement);
2057
- }
2058
- else {
2059
- this.focusedElement.focused = false;
2060
- switch (which) {
2061
- case 13: // enter
2062
- this.focusedElement.selected = true;
2063
- break;
2064
- case 32: // space
2065
- this.focusedElement.checked && (this.treeviewUnchecked.emit(this.focusedElement.id)) || (this.treeviewChecked.emit(this.focusedElement.id));
2066
- break;
2067
- case 35: // end
2068
- this.focusedElement = this.getLastItem(this.focusedElement.parentElement);
2069
- break;
2070
- case 36: // home
2071
- this.focusedElement = this.getFirstItem(this.focusedElement.parentElement);
2072
- break;
2073
- case 37: // left arrow
2074
- if (this.getChildItem(this.focusedElement).length > 0 && this.focusedElement.open == true) {
2075
- this.focusedElement.open = false;
2076
- }
2077
- else {
2078
- if (this.getParent(this.focusedElement)) {
2079
- this.focusedElement = this.getParent(this.focusedElement);
2080
- }
2081
- }
2082
- break;
2083
- case 38: // up arrow
2084
- if (this.getPrev(this.focusedElement)) {
2085
- this.focusedElement = this.getPrev(this.focusedElement);
2086
- if (this.getChildItem(this.focusedElement).length > 0 && this.focusedElement.open == true) {
2087
- this.focusedElement = this.getLastItem(this.focusedElement);
2088
- }
2089
- }
2090
- else if (this.getParent(this.focusedElement)) {
2091
- this.focusedElement = this.getParent(this.focusedElement);
2092
- }
2093
- break;
2094
- case 39: // right arrow
2095
- if (this.getChildItem(this.focusedElement).length > 0) {
2096
- if (this.focusedElement.open == true) {
2097
- this.focusedElement = this.getFirstItem(this.focusedElement);
2098
- }
2099
- else {
2100
- this.focusedElement.open = true;
2101
- }
2102
- }
2103
- break;
2104
- case 40: // down arrow
2105
- if (this.getChildItem(this.focusedElement).length > 0 && this.focusedElement.open == true) {
2106
- this.focusedElement = this.getFirstItem(this.focusedElement);
2107
- }
2108
- else if (this.getNext(this.focusedElement)) {
2109
- this.focusedElement = this.getNext(this.focusedElement);
2110
- }
2111
- else if (this.getNextParent(this.focusedElement)) {
2112
- this.focusedElement = this.getNextParent(this.focusedElement);
2113
- }
2114
- break;
2115
- }
2116
- }
2117
- }
2118
- if (this.focusedElement)
2119
- this.focusedElement.focused = true;
2120
- }
2121
- }
2122
- }
2123
- handleFocus(focusEvent = false) {
2124
- this.onFocus = focusEvent;
2125
- }
2126
- render() {
2127
- const { searchOnlyChild, searchPlaceholder, search, checkCount, searchData, searchFields, searchSub, returnField, total, fullWidth, infoFooter, showSearch } = this;
2128
- const hostClasses = classnames(this.hidden ? 'hidden' : null, {
2129
- 'empty': this.empty,
2130
- 'full-width': fullWidth
2131
- });
2132
- const customStyles = {
2133
- // 'min-height': this.minHeight + 'px',
2134
- 'min-width': this.minWidth + 'px',
2135
- 'max-height': this.maxHeight
2136
- };
2137
- return (h(Host, { class: hostClasses, style: customStyles }, search && (h("div", { class: "search", style: { 'display': String(showSearch) == 'false' ? 'none' : 'block' } }, h("bcm-old-search", { onlyChild: searchOnlyChild, searchPlaceholder: searchPlaceholder, "on-bcm-focus": () => this.handleFocus(true), "on-bcm-blur": () => this.handleFocus(false), data: searchData, returnField: returnField, searchFields: searchFields, searchSub: searchSub, clearable: true }), h("bcm-divider", null))), h("div", { id: "treeview", class: "treeview loading" },
2138
- // this.loading && (
2139
- h("div", { id: "loading", class: "loading show" }, h("bcm-icon", { class: "prefix", icon: "far fa-spinner-third fa-spin" }))
2140
- // )
2141
- ,
2142
- // this.empty && (
2143
- h("div", { id: "empty", class: "empty" }, h("bcm-empty", null, "No Data"))
2144
- // )
2145
- , !this.empty && this.items.length !== 0 && this.items.map((item) => (this.recursiveItemRenderer(item, null)))), infoFooter == true && (h("footer", null, h("bcm-text", { scale: "size-1", color: "grey-8" }, checkCount > 0 && ('( ' + checkCount + ' items selected ) '), "Total ", h("span", { id: "in-search" }), " ", h("span", { id: "in-total" }, total), " items found.")))));
2146
- }
2147
- get el() { return getElement(this); }
2148
- static get watchers() { return {
2149
- "_items": ["parseItems"]
2150
- }; }
2151
- };
2152
- Bcmtreeview.style = treeviewCss;
2153
-
2154
- const treeviewItemCss = "@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}:host(.hidden){display:none}.treeview-item{display:flex;align-items:stretch;justify-content:flex-start;color:var(--bcm-color-grey-8);padding-left:8px;user-select:none;background-color:var(--bcm-color-grey-1)}.treeview-item-context-menu{display:none;position:absolute;height:auto;background-color:#ffffff;align-items:center;justify-content:center;flex-direction:column;box-shadow:0px 4px 4px rgba(0, 0, 0, 0.25)}.treeview-item-context-menu.show{display:flex}.treeview-item-context-menu span{text-align:left;min-width:100px;padding:5px 8px;font-size:14px;line-height:22px;color:var(--bcm-color-grey-8)}.treeview-item-context-menu span:hover{cursor:pointer;color:var(--bcm-color-prime-blue-6);background-color:var(--bcm-color-prime-blue-1)}.treeview-item.focus .treeview-item-container{border:2px solid var(--bcm-color-prime-blue-2)}.treeview-item-container{width:100%;display:flex;flex-direction:row;align-items:center;justify-content:flex-start}.treeview-item-container.disabled{color:var(--bcm-color-grey-6)}.treeview-item-container.disabled .text-content{cursor:not-allowed}.treeview-item-container.selected:not(.disabled){color:var(--bcm-color-prime-blue-6)}.treeview-item-container.selected:not(.disabled):hover:not(.disabled){color:var(--bcm-color-prime-blue-6);background-color:var(--bcm-color-prime-blue-1)}.treeview-item-container:hover:not(.disabled),.treeview-item-container:active:not(.disabled){color:var(--bcm-color-prime-blue-6);background-color:var(--bcm-color-prime-blue-1)}.treeview-item-container>section:not(.favicon){display:flex;align-items:stretch;justify-content:flex-start;border:2px solid transparent;flex:1}.treeview-item-container>section.favicon{display:flex;align-items:center;justify-content:center;padding:0 5px;height:100%;cursor:pointer}.treeview-item-container>section.favicon:not(.favorite){display:none}.treeview-item-container:hover:not(.disabled) .favicon{display:flex}.treeview-inner{display:none}.treeview-inner.open{display:block}.collapse-content{display:flex;align-items:center;justify-content:center;width:16px;min-width:16px}.collapse-content.child{cursor:pointer}.check-content{display:flex;align-items:center;justify-content:flex-start;width:24px;min-width:24px;padding-left:8px}.check-content .indeterminate{width:16px;height:16px;position:relative;display:block;padding-right:8px;cursor:pointer}.check-content .indeterminate:after{content:\"\";position:absolute;top:50%;left:9px;width:10px;height:10px;background-color:var(--bcm-color-prime-blue-6);transform:translate(-50%, -50%);opacity:1;z-index:1}.check-content .indeterminate:before{content:\"\";position:absolute;top:-1px;left:0px;width:16px;height:100%;border-radius:2px;background-color:transparent;border:1px solid var(--bcm-color-grey-5);opacity:1;z-index:2}.check-content .indeterminate:hover:not(.disabled):before{border-color:var(--bcm-color-prime-blue-6);box-shadow:0px 2px 4px rgba(54, 121, 171, 0.5)}.check-content .indeterminate.disabled{cursor:not-allowed;background:linear-gradient(90deg, var(--bcm-color-grey-3) 18px, transparent 0px);border-color:var(--bcm-color-grey-3)}.check-content .indeterminate.disabled:after{background-color:var(--bcm-color-grey-6)}.check-content .indeterminate.disabled bcm-icon{filter:brightness(0);opacity:0.3}.text-content{display:flex;align-items:center;justify-content:space-between;cursor:pointer;width:100%;flex:1}.text-content .favicon{display:flex;flex-direction:row;align-items:center;grid-gap:4px}.text-content #text .highlight{background-color:var(--bcm-color-yellow-5)}.text-content.small{padding:0 8px 0 4px}.text-content.medium{padding:4px 8px 4px 4px}.text-content.large{padding:8px 8px 8px 4px}.text-content .icon{text-align:center;margin-right:8px}";
2155
-
2156
- const BcmtreeviewItem = class {
2157
- constructor(hostRef) {
2158
- registerInstance(this, hostRef);
2159
- this.treeviewItemSelected = createEvent(this, "bcm-treeview-item-selected", 7);
2160
- this.treeviewUnchecked = createEvent(this, "bcm-treeview-unchecked", 7);
2161
- this.treeviewChecked = createEvent(this, "bcm-treeview-checked", 7);
2162
- this.treeviewChange = createEvent(this, "bcm-treeview-change", 7);
2163
- this.treeviewIndeterminateUnchecked = createEvent(this, "bcm-treeview-indeterminate-unchecked", 7);
2164
- this.treeviewIndeterminateChecked = createEvent(this, "bcm-treeview-indeterminate-checked", 7);
2165
- this.itemChecked = createEvent(this, "bcm-treeview-check-item-checked", 7);
2166
- this.itemUnchecked = createEvent(this, "bcm-treeview-check-item-unchecked", 7);
2167
- this.groupCheck = createEvent(this, "bcm-treeview-check-group-check", 7);
2168
- this.favoriteStatus = createEvent(this, "bcm-favorite-status", 7);
2169
- this.firstRun = true;
2170
- this.items = undefined;
2171
- this.itemObject = undefined;
2172
- this.text = undefined;
2173
- this.tooltipText = undefined;
2174
- this._id = (Math.random() * 4).toString(16).replace('.', '');
2175
- this.parentId = undefined;
2176
- this.hasChild = false;
2177
- this.size = 'medium';
2178
- this.icon = 'bug';
2179
- this.open = false;
2180
- this.selected = false;
2181
- this.checkboxes = false;
2182
- this.showIcon = false;
2183
- this.favicon = false;
2184
- this.favorite = false;
2185
- this.checked = false;
2186
- this.checkTrigger = false;
2187
- this.focused = false;
2188
- this.disabled = false;
2189
- this.contextMenuShow = false;
2190
- this._contextMenu = [];
2191
- this.indeterminateState = 'uncheck';
2192
- this._internal_id = "";
2193
- this.menuPadding = 0;
2194
- this.childLength = 0;
2195
- this.indeterminate = false;
2196
- this.hidden = false;
2197
- this.contextMenu = [];
2198
- this.contextOffsetLeft = 0;
2199
- this.contextOffsetTop = 0;
2200
- }
2201
- /**
2202
- * @ComponentMethod
2203
- */
2204
- componentWillLoad() {
2205
- this.menuPadding = 24;
2206
- this.childLength = this.el.children.length;
2207
- this.parseItems(this._contextMenu);
2208
- }
2209
- /**
2210
- * @ComponentMethod
2211
- */
2212
- componentDidLoad() {
2213
- // if (!this.disabled){
2214
- // // if (this.selected) this.treeviewItemSelected.emit(this.itemObject)
2215
- // if (this.checked){
2216
- // // this.treeviewChecked.emit(this._id)
2217
- // this.handleCheckMouseUp()
2218
- // }
2219
- // }
2220
- if (!this.disabled && this.firstRun && this.checkTrigger) {
2221
- this.firstRun = false;
2222
- this.handleCheckMouseUp();
2223
- }
2224
- }
2225
- /**
2226
- * @desc
2227
- * @returns {void}
2228
- */
2229
- /* setIndeterminateState() {
2230
- if(this.getAllChilds().length > 0) {
2231
-
2232
- let state: string = 'uncheck'
2233
- let allChecked: boolean = true
2234
- let allUnchecked: boolean = true
2235
-
2236
- this.getAllChilds().map((item) => {
2237
- item.checked && (allUnchecked = false)
2238
- !item.checked && (allChecked = false)
2239
- });
2240
-
2241
- !allChecked && !allUnchecked
2242
- ? state = 'indeterminate'
2243
- : allChecked
2244
- ? state = 'determinate'
2245
- : state = 'uncheck'
2246
-
2247
- this.indeterminateState = state as any;
2248
-
2249
- }
2250
- } */
2251
- /* @Watch('indeterminateState')
2252
- onCheckedChange() {
2253
- if (this.indeterminateState == 'determinate') {
2254
- this.treeviewChecked.emit(this._id)
2255
- }else if (this.indeterminateState == 'uncheck') {
2256
- this.treeviewIndeterminateUnchecked.emit(this._id)
2257
- this.checked = false
2258
- }else{
2259
- this.treeviewIndeterminateUnchecked.emit(this._id)
2260
- this.checked = false
2261
- }
2262
- } */
2263
- /**
2264
- * @descc
2265
- * @param event
2266
- */
2267
- handletreeviewClearSelecteds(event) {
2268
- if (!this.disabled) {
2269
- if (event.detail && event.detail !== this.itemObject)
2270
- this.selected = false;
2271
- }
2272
- }
2273
- /**
2274
- * @descc
2275
- * @param event
2276
- */
2277
- ListentreeviewChange() {
2278
- //this.setIndeterminateState();
2279
- }
2280
- /**
2281
- * @descc
2282
- * @param event
2283
- */
2284
- ListentreeviewShowContext(event) {
2285
- this.contextOffsetTop = event.detail[1];
2286
- this.contextOffsetLeft = event.detail[2];
2287
- if (event.detail[0] && event.detail[0] === this._id) {
2288
- this.contextMenuShow = true;
2289
- }
2290
- else {
2291
- this.contextMenuShow = false;
2292
- }
2293
- }
2294
- /**
2295
- * @desc
2296
- * @param event
2297
- */
2298
- handleWindowClick(event) {
2299
- const target = event.target;
2300
- if (target === this.el)
2301
- return;
2302
- this.contextMenuShow = false;
2303
- }
2304
- /**
2305
- * @desc
2306
- */
2307
- handleClick() {
2308
- if (!this.disabled) {
2309
- this.selected = true;
2310
- this.treeviewItemSelected.emit(this.itemObject);
2311
- }
2312
- }
2313
- /**
2314
- * @desc
2315
- */
2316
- handleFavClick(e) {
2317
- if (!this.disabled) {
2318
- this.favorite = !this.favorite;
2319
- if (!this.itemObject["rightSlot"]) {
2320
- this.itemObject["rightSlot"] = {};
2321
- }
2322
- this.itemObject["rightSlot"]["favorite"] = this.favorite;
2323
- this.favoriteStatus.emit(this.itemObject);
2324
- e.stopPropagation();
2325
- e.preventDefault();
2326
- }
2327
- }
2328
- /**
2329
- * @desc
2330
- */
2331
- handleOpen() {
2332
- this.open = !this.open;
2333
- }
2334
- getRootChilds(element = this.el) {
2335
- return getChilds(element, 'bcm-treeview-item');
2336
- }
2337
- getAllChilds(element = this.el) {
2338
- let returnAllItems = [];
2339
- getChilds(element, 'bcm-treeview-item').forEach(items => {
2340
- this.getAllChilds(items) && (returnAllItems = [...returnAllItems, ...this.getAllChilds(items)]);
2341
- returnAllItems = [...returnAllItems,
2342
- items
2343
- ];
2344
- });
2345
- return returnAllItems;
2346
- }
2347
- /**
2348
- * @desc
2349
- * -
2350
- */
2351
- checkGroupState() {
2352
- // debugger;
2353
- const childsRoot = this.getRootChilds();
2354
- let [state, allChecked, allUnchecked] = ['uncheck', true, true];
2355
- if (childsRoot.length > 0) {
2356
- childsRoot.forEach(checkbox => {
2357
- (checkbox.checked || checkbox.indeterminateState === 'indeterminate') && (allUnchecked = false);
2358
- !checkbox.checked && (allChecked = false);
2359
- });
2360
- !allChecked && !allUnchecked
2361
- ? state = 'indeterminate'
2362
- : allChecked
2363
- ? state = 'determinate'
2364
- : state = 'uncheck';
2365
- this.indeterminateState = state;
2366
- if (state === 'determinate') {
2367
- this.checked = true;
2368
- // if(this.checked) {
2369
- this.treeviewChecked.emit(this._id);
2370
- // }
2371
- }
2372
- else {
2373
- this.checked = false;
2374
- this.treeviewUnchecked.emit(this._id);
2375
- }
2376
- }
2377
- else {
2378
- if (this.checked) {
2379
- this.checked = false;
2380
- this.treeviewUnchecked.emit(this._id);
2381
- }
2382
- else {
2383
- this.checked = true;
2384
- this.treeviewChecked.emit(this._id);
2385
- }
2386
- }
2387
- }
2388
- /**
2389
- * @Event
2390
- * @desc
2391
- * -
2392
- */
2393
- handleCheckMouseUp() {
2394
- const checked = this.checked;
2395
- const state = this.indeterminateState;
2396
- if (!this.hasChild) {
2397
- !checked
2398
- ? this.checked = true
2399
- : this.checked = false;
2400
- if (this.checked) {
2401
- this.treeviewChecked.emit(this._id);
2402
- }
2403
- else {
2404
- this.treeviewUnchecked.emit(this._id);
2405
- }
2406
- this.groupCheck.emit(this.parentId);
2407
- return;
2408
- }
2409
- const childs = this.getAllChilds();
2410
- if (state === 'indeterminate' || state === 'uncheck') {
2411
- childs.forEach(child => {
2412
- child.checked = true;
2413
- // if(this.checked) {
2414
- this.treeviewChecked.emit(child._id);
2415
- // }
2416
- child.indeterminateState = 'determined';
2417
- });
2418
- }
2419
- else {
2420
- childs.forEach(child => {
2421
- child.checked = false;
2422
- this.treeviewUnchecked.emit(child._id);
2423
- child.indeterminateState = 'uncheck';
2424
- });
2425
- }
2426
- this.checkGroupState();
2427
- this.groupCheck.emit(this.parentId);
2428
- }
2429
- checkGroup(e) {
2430
- const { detail: groupId } = e;
2431
- if (!groupId || this._id !== groupId)
2432
- return;
2433
- this.checkGroupState();
2434
- this.groupCheck.emit(this.parentId);
2435
- }
2436
- /**
2437
- * @desc
2438
- * @param item
2439
- */
2440
- contextItemRenderer(item) {
2441
- return (h("span", null, item.title));
2442
- }
2443
- /**
2444
- * @desc
2445
- * @param newValue
2446
- * @returns {void}
2447
- */
2448
- parseItems(newValue) {
2449
- if (newValue) {
2450
- typeof newValue == 'string'
2451
- ? this.contextMenu = JSON.parse(newValue)
2452
- : this.contextMenu = newValue;
2453
- }
2454
- }
2455
- render() {
2456
- const { _id, text, tooltipText, size, icon, open, childLength, checkboxes, showIcon, checked, indeterminateState, focused, contextMenuShow } = this;
2457
- const menuPadding = this.menuPadding + 'px';
2458
- const textContent = classnames('text-content', size, 'size-2'
2459
- // {
2460
- // 'size-2': size === 'small' || size === 'medium',
2461
- // 'size-3': size === 'large',
2462
- // }
2463
- );
2464
- const classes = classnames('treeview-item', {
2465
- 'focus': focused,
2466
- 'open': open,
2467
- 'selected': this.selected
2468
- });
2469
- const treeviewContextMenu = classnames('treeview-item-context-menu', {
2470
- 'show': contextMenuShow
2471
- });
2472
- const treeviewInner = classnames('treeview-inner', {
2473
- 'open': open,
2474
- });
2475
- const indeterminate = classnames('indeterminate', {
2476
- 'disabled': this.disabled,
2477
- });
2478
- const treeviewItemContainer = classnames('treeview-item-container', {
2479
- 'selected': this.selected,
2480
- 'disabled': this.disabled
2481
- });
2482
- const collapseContent = classnames('collapse-content', {
2483
- 'child': childLength > 0,
2484
- });
2485
- const hostClasses = classnames(this.hidden ? 'hidden' : null);
2486
- const faviconClass = classnames("favicon", {
2487
- "favorite": this.favorite
2488
- });
2489
- return (h(Host, { class: hostClasses }, h("div", { class: classes }, h("div", { class: collapseContent, id: "collapse-button", onClick: () => childLength > 0 && this.handleOpen() }, childLength > 0 && (h("bcm-icon", { class: "collapse-icon", icon: `far fa-${open ? 'caret-down' : 'caret-right'}` }))), h("div", { class: treeviewItemContainer }, h("section", { onMouseUp: () => this.handleCheckMouseUp() }, checkboxes && (h("div", { class: "check-content" }, indeterminateState == 'indeterminate' && (h("span", { class: indeterminate })) || (h("bcm-checkbox", { id: 'check-' + _id, name: 'check-' + _id, checked: checked, disabled: this.disabled, noCaption: true })))), h("div", { class: textContent, onClick: () => this.handleClick(), title: tooltipText }, showIcon && icon && (h("bcm-icon", { class: "icon", icon: icon })), h("span", { id: "text" }, text))), this.favicon && (h("section", { class: faviconClass, onClick: (e) => this.handleFavClick(e) }, h("bcm-icon", { title: this.favorite ? "Click to remove from favorite list" : "Click to add to your favourites list", icon: "far fa-star" })))), !checkboxes && (h("div", { class: treeviewContextMenu, style: { top: this.contextOffsetTop + 'px', left: this.contextOffsetLeft + 'px' } }, this.contextMenu.length !== 0 && this.contextMenu.map((item) => (this.contextItemRenderer(item)))))), h("div", { class: treeviewInner, style: { paddingLeft: menuPadding } }, h("slot", null))));
2490
- }
2491
- get el() { return getElement(this); }
2492
- static get watchers() { return {
2493
- "_contextMenu": ["parseItems"]
2494
- }; }
2495
- };
2496
- BcmtreeviewItem.style = treeviewItemCss;
2497
-
2498
- export { BcmCheckboxLite as bcm_checkbox_lite, BcmEmpty as bcm_empty, BcmListbox as bcm_listbox, BcmListboxGroup as bcm_listbox_group, BcmListboxItem as bcm_listbox_item, BcmOldSearch as bcm_old_search, Bcmtreeview as bcm_treeview, BcmtreeviewItem as bcm_treeview_item };