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