bromcom-ui 2.3.54 → 2.3.58

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 (212) hide show
  1. package/dist/bromcom-ui/bromcom-ui.css +0 -0
  2. package/dist/bromcom-ui/bromcom-ui.esm.js +1 -1
  3. package/dist/bromcom-ui/index.esm.js +0 -0
  4. package/dist/bromcom-ui/p-12493dbc.entry.js +1 -0
  5. package/dist/bromcom-ui/{p-a18a0cc4.entry.js → p-13d038f5.entry.js} +1 -1
  6. package/dist/bromcom-ui/p-1429a2b4.js +1 -0
  7. package/dist/bromcom-ui/{p-4b7f14ed.entry.js → p-20d03fa1.entry.js} +1 -1
  8. package/dist/bromcom-ui/{p-774ff4d9.entry.js → p-30c1cd7f.entry.js} +1 -1
  9. package/dist/bromcom-ui/p-37750343.entry.js +1 -0
  10. package/dist/bromcom-ui/p-3f797656.entry.js +1 -0
  11. package/dist/bromcom-ui/{p-4396ee3b.entry.js → p-4092f5f1.entry.js} +1 -1
  12. package/dist/bromcom-ui/p-4a41ef80.entry.js +1 -0
  13. package/dist/bromcom-ui/p-4cb268d2.js +1 -0
  14. package/dist/bromcom-ui/p-53e9b679.entry.js +1 -0
  15. package/dist/bromcom-ui/{p-09753e05.js → p-554d326a.js} +1 -1
  16. package/dist/bromcom-ui/p-68ff64de.js +1 -0
  17. package/dist/bromcom-ui/p-7238d22f.entry.js +1 -0
  18. package/dist/bromcom-ui/p-7f1cd976.entry.js +1 -0
  19. package/dist/bromcom-ui/p-811c24d7.entry.js +1 -0
  20. package/dist/bromcom-ui/p-8851e01e.entry.js +1 -0
  21. package/dist/bromcom-ui/{p-1a2724a0.entry.js → p-92e3e240.entry.js} +1 -1
  22. package/dist/bromcom-ui/p-9ffff762.entry.js +1 -0
  23. package/dist/bromcom-ui/p-a6ef098a.entry.js +1 -0
  24. package/dist/bromcom-ui/p-af7e4741.entry.js +1 -0
  25. package/dist/bromcom-ui/{p-0d336381.entry.js → p-afb68492.entry.js} +1 -1
  26. package/dist/bromcom-ui/p-bbf99620.entry.js +1 -0
  27. package/dist/bromcom-ui/p-bc50aa86.entry.js +1 -0
  28. package/dist/bromcom-ui/p-e21a8f2d.entry.js +1 -0
  29. package/dist/bromcom-ui/p-e450ebda.entry.js +1 -0
  30. package/dist/bromcom-ui/p-e8307da9.entry.js +1 -0
  31. package/dist/bromcom-ui/{p-26b3d5d0.entry.js → p-e8771d32.entry.js} +1 -1
  32. package/dist/bromcom-ui/p-f067821e.entry.js +1 -0
  33. package/dist/bromcom-ui/p-f12743d8.entry.js +1 -0
  34. package/dist/bromcom-ui/p-ff5e57d3.entry.js +1 -0
  35. package/dist/cjs/bcm-alert.cjs.entry.js +7 -26
  36. package/dist/cjs/bcm-badge.cjs.entry.js +50 -0
  37. package/dist/cjs/{bcm-badge_20.cjs.entry.js → bcm-button_11.cjs.entry.js} +1209 -2835
  38. package/dist/cjs/bcm-checkbox-lite_4.cjs.entry.js +291 -0
  39. package/dist/cjs/bcm-colorpicker.cjs.entry.js +3 -3
  40. package/dist/cjs/{bcm-datetime-picker_2.cjs.entry.js → bcm-datetime-picker.cjs.entry.js} +3 -137
  41. package/dist/cjs/bcm-dropdown.cjs.entry.js +1 -1
  42. package/dist/cjs/bcm-list-item_2.cjs.entry.js +197 -0
  43. package/dist/cjs/bcm-list-select.cjs.entry.js +658 -0
  44. package/dist/cjs/bcm-list.cjs.entry.js +1204 -0
  45. package/dist/cjs/{bcm-empty_6.cjs.entry.js → bcm-listbox_5.cjs.entry.js} +10 -77
  46. package/dist/cjs/bcm-modal.cjs.entry.js +197 -0
  47. package/dist/cjs/bcm-popconfirm-box.cjs.entry.js +1 -1
  48. package/dist/cjs/bcm-popconfirm.cjs.entry.js +2 -2
  49. package/dist/cjs/bcm-popover-box.cjs.entry.js +1 -1
  50. package/dist/cjs/bcm-popover.cjs.entry.js +2 -2
  51. package/dist/cjs/bcm-pulldown-group_2.cjs.entry.js +1 -1
  52. package/dist/cjs/bcm-pulldown.cjs.entry.js +1 -1
  53. package/dist/cjs/bcm-radio-group.cjs.entry.js +124 -0
  54. package/dist/cjs/bcm-radio.cjs.entry.js +104 -0
  55. package/dist/cjs/bcm-select.cjs.entry.js +68 -8
  56. package/dist/cjs/bcm-tab-pane.cjs.entry.js +51 -0
  57. package/dist/cjs/bcm-tab.cjs.entry.js +72 -0
  58. package/dist/cjs/bcm-tabs-content.cjs.entry.js +43 -0
  59. package/dist/cjs/bcm-tabs.cjs.entry.js +361 -0
  60. package/dist/cjs/bcm-text.cjs.entry.js +28 -0
  61. package/dist/cjs/bcm-upload.cjs.entry.js +1 -1
  62. package/dist/cjs/bromcom-ui.cjs.js +1 -1
  63. package/dist/cjs/{element-dragger-36fcb296.js → element-dragger-4a91c708.js} +1 -1
  64. package/dist/cjs/loader.cjs.js +1 -1
  65. package/dist/cjs/types-37c8ced6.js +16 -0
  66. package/dist/cjs/types-f53bc841.js +19 -0
  67. package/dist/cjs/{utils-43fda566.js → utils-60414768.js} +25 -0
  68. package/dist/collection/collection-manifest.json +1 -0
  69. package/dist/collection/components/atoms/label/label.css +70 -0
  70. package/dist/collection/components/atoms/label/label.js +203 -0
  71. package/dist/collection/components/molecules/checkbox/group.js +19 -6
  72. package/dist/collection/components/molecules/input/input.js +39 -7
  73. package/dist/collection/components/molecules/list/list-item.css +1 -0
  74. package/dist/collection/components/molecules/list/list-select.css +10 -5
  75. package/dist/collection/components/molecules/list/list-select.js +232 -34
  76. package/dist/collection/components/molecules/list/list.css +24 -2
  77. package/dist/collection/components/molecules/list/list.js +391 -119
  78. package/dist/collection/components/molecules/popconfirm/popconfirm-box.css +1 -0
  79. package/dist/collection/components/molecules/popconfirm/popconfirm.css +1 -0
  80. package/dist/collection/components/molecules/popover/popover-box.css +1 -0
  81. package/dist/collection/components/molecules/popover/popover.css +1 -0
  82. package/dist/collection/components/molecules/radio/group.js +19 -6
  83. package/dist/collection/components/molecules/search/search.js +2 -2
  84. package/dist/collection/components/molecules/select/select.js +85 -12
  85. package/dist/collection/components/molecules/switch/switch.css +0 -1
  86. package/dist/collection/components/molecules/switch/switch.js +20 -7
  87. package/dist/collection/components/molecules/textarea/textarea.css +4 -1
  88. package/dist/collection/components/molecules/textarea/textarea.js +33 -17
  89. package/dist/collection/components/molecules/tooltip/tooltip-box.css +1 -0
  90. package/dist/collection/components/molecules/tooltip/tooltip.css +1 -0
  91. package/dist/collection/components/organism/colorpicker/colorpicker.js +19 -6
  92. package/dist/collection/components/organism/datetime-picker/datetime-picker.js +1 -1
  93. package/dist/collection/components/organism/form/form.js +5 -4
  94. package/dist/collection/components/organism/listbox/listbox.js +27 -17
  95. package/dist/collection/helper/color-helper.js +33 -0
  96. package/dist/collection/helper/generate.js +47 -0
  97. package/dist/collection/helper/number-helper.js +10 -0
  98. package/dist/collection/helper/string-helper.js +21 -0
  99. package/dist/collection/helper/validators.js +21 -0
  100. package/dist/collection/models/bcm-types.js +1 -0
  101. package/dist/collection/models/bcm.js +451 -0
  102. package/dist/collection/templates/caption-template.js +22 -0
  103. package/dist/collection/templates/label-template.js +16 -0
  104. package/dist/collection/templates/slot-template.js +6 -0
  105. package/dist/collection/utils/utils.js +24 -0
  106. package/dist/esm/bcm-alert.entry.js +1 -20
  107. package/dist/esm/bcm-badge.entry.js +46 -0
  108. package/dist/esm/{bcm-badge_20.entry.js → bcm-button_11.entry.js} +1204 -2821
  109. package/dist/esm/bcm-checkbox-lite_4.entry.js +284 -0
  110. package/dist/esm/bcm-colorpicker.entry.js +3 -3
  111. package/dist/esm/{bcm-datetime-picker_2.entry.js → bcm-datetime-picker.entry.js} +4 -137
  112. package/dist/esm/bcm-dropdown.entry.js +1 -1
  113. package/dist/esm/bcm-list-item_2.entry.js +192 -0
  114. package/dist/esm/bcm-list-select.entry.js +654 -0
  115. package/dist/esm/bcm-list.entry.js +1200 -0
  116. package/dist/esm/{bcm-empty_6.entry.js → bcm-listbox_5.entry.js} +12 -78
  117. package/dist/esm/bcm-modal.entry.js +193 -0
  118. package/dist/esm/bcm-popconfirm-box.entry.js +1 -1
  119. package/dist/esm/bcm-popconfirm.entry.js +2 -2
  120. package/dist/esm/bcm-popover-box.entry.js +1 -1
  121. package/dist/esm/bcm-popover.entry.js +2 -2
  122. package/dist/esm/bcm-pulldown-group_2.entry.js +1 -1
  123. package/dist/esm/bcm-pulldown.entry.js +1 -1
  124. package/dist/esm/bcm-radio-group.entry.js +120 -0
  125. package/dist/esm/bcm-radio.entry.js +100 -0
  126. package/dist/esm/bcm-select.entry.js +68 -8
  127. package/dist/esm/bcm-tab-pane.entry.js +47 -0
  128. package/dist/esm/bcm-tab.entry.js +68 -0
  129. package/dist/esm/bcm-tabs-content.entry.js +39 -0
  130. package/dist/esm/bcm-tabs.entry.js +357 -0
  131. package/dist/esm/bcm-text.entry.js +24 -0
  132. package/dist/esm/bcm-upload.entry.js +1 -1
  133. package/dist/esm/bromcom-ui.js +1 -1
  134. package/dist/esm/{element-dragger-03ac2a5e.js → element-dragger-97a8f373.js} +1 -1
  135. package/dist/esm/loader.js +1 -1
  136. package/dist/esm/polyfills/css-shim.js +0 -0
  137. package/dist/esm/types-4b11eac9.js +28 -0
  138. package/dist/esm/types-911a8837.js +21 -0
  139. package/dist/esm/{utils-b7fba7c4.js → utils-de9aee67.js} +25 -1
  140. package/dist/types/assets/icons/index.d.ts +0 -0
  141. package/dist/types/assets/icons/index.example.d.ts +0 -0
  142. package/dist/types/components/atoms/avatar/avatar.d.ts +0 -0
  143. package/dist/types/components/atoms/badge/badge.d.ts +0 -0
  144. package/dist/types/components/atoms/button/button.d.ts +0 -0
  145. package/dist/types/components/atoms/divider/divider.d.ts +0 -0
  146. package/dist/types/components/atoms/icon/icon.d.ts +0 -0
  147. package/dist/types/components/atoms/icon/types.d.ts +0 -0
  148. package/dist/types/components/atoms/label/label.d.ts +16 -0
  149. package/dist/types/components/atoms/tag/tag.d.ts +0 -0
  150. package/dist/types/components/atoms/text/text.d.ts +0 -0
  151. package/dist/types/components/molecules/card/card-footer.d.ts +0 -0
  152. package/dist/types/components/molecules/card/card-header.d.ts +0 -0
  153. package/dist/types/components/molecules/card/card.d.ts +0 -0
  154. package/dist/types/components/molecules/checkbox/checkbox.d.ts +0 -0
  155. package/dist/types/components/molecules/checkbox/group.d.ts +1 -0
  156. package/dist/types/components/molecules/input/input.d.ts +2 -0
  157. package/dist/types/components/molecules/list/list-select.d.ts +24 -4
  158. package/dist/types/components/molecules/list/list.d.ts +13 -3
  159. package/dist/types/components/molecules/radio/group.d.ts +1 -0
  160. package/dist/types/components/molecules/radio/radio.d.ts +0 -0
  161. package/dist/types/components/molecules/select/group.d.ts +0 -0
  162. package/dist/types/components/molecules/select/option.d.ts +0 -0
  163. package/dist/types/components/molecules/select/select.d.ts +1 -0
  164. package/dist/types/components/molecules/switch/switch.d.ts +1 -0
  165. package/dist/types/components/molecules/textarea/textarea.d.ts +3 -2
  166. package/dist/types/components/organism/colorpicker/colorpicker.d.ts +1 -0
  167. package/dist/types/components/organism/listbox/listbox.d.ts +1 -0
  168. package/dist/types/components.d.ts +95 -12
  169. package/dist/types/global/variables/colors.d.ts +0 -0
  170. package/dist/types/helper/color-helper.d.ts +9 -0
  171. package/dist/types/helper/generate.d.ts +10 -0
  172. package/dist/types/helper/number-helper.d.ts +9 -0
  173. package/dist/types/helper/string-helper.d.ts +20 -0
  174. package/dist/types/helper/validators.d.ts +8 -0
  175. package/dist/types/index.d.ts +0 -0
  176. package/dist/types/models/bcm-types.d.ts +19 -0
  177. package/dist/types/models/bcm.d.ts +447 -0
  178. package/dist/types/stencil-public-runtime.d.ts +0 -0
  179. package/dist/types/templates/caption-template.d.ts +12 -0
  180. package/dist/types/templates/label-template.d.ts +12 -0
  181. package/dist/types/templates/slot-template.d.ts +8 -0
  182. package/dist/types/utils/utils.d.ts +1 -0
  183. package/loader/cdn.js +0 -0
  184. package/loader/index.cjs.js +0 -0
  185. package/loader/index.d.ts +0 -0
  186. package/loader/index.es2017.js +0 -0
  187. package/loader/index.js +0 -0
  188. package/loader/package.json +0 -0
  189. package/package.json +1 -1
  190. package/dist/bromcom-ui/p-013b6f5d.entry.js +0 -1
  191. package/dist/bromcom-ui/p-0532e299.entry.js +0 -1
  192. package/dist/bromcom-ui/p-0aa53bdb.entry.js +0 -1
  193. package/dist/bromcom-ui/p-2c1ee381.entry.js +0 -1
  194. package/dist/bromcom-ui/p-607bc9b3.entry.js +0 -1
  195. package/dist/bromcom-ui/p-6355c903.entry.js +0 -1
  196. package/dist/bromcom-ui/p-6bd805f1.entry.js +0 -1
  197. package/dist/bromcom-ui/p-77a480ff.entry.js +0 -1
  198. package/dist/bromcom-ui/p-a88256f2.entry.js +0 -1
  199. package/dist/bromcom-ui/p-b92324e7.js +0 -1
  200. package/dist/bromcom-ui/p-ba219861.entry.js +0 -1
  201. package/dist/bromcom-ui/p-cdfd9ba0.entry.js +0 -1
  202. package/dist/bromcom-ui/p-cf6b0656.entry.js +0 -1
  203. package/dist/cjs/bcm-checkbox-group.cjs.entry.js +0 -273
  204. package/dist/cjs/bcm-checkbox.cjs.entry.js +0 -143
  205. package/dist/cjs/bcm-switch.cjs.entry.js +0 -86
  206. package/dist/cjs/bcm-textarea.cjs.entry.js +0 -136
  207. package/dist/cjs/bcm-tooltip-box.cjs.entry.js +0 -36
  208. package/dist/esm/bcm-checkbox-group.entry.js +0 -269
  209. package/dist/esm/bcm-checkbox.entry.js +0 -139
  210. package/dist/esm/bcm-switch.entry.js +0 -82
  211. package/dist/esm/bcm-textarea.entry.js +0 -132
  212. package/dist/esm/bcm-tooltip-box.entry.js +0 -32
@@ -0,0 +1,1200 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-8fe7aea4.js';
2
+ import { c as classnames } from './index-e58a2d48.js';
3
+ import { d as delay, b as dropInComponent, g as getChilds, p as pluralize } from './utils-de9aee67.js';
4
+
5
+ const listCss = "@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}:host{display:block;position:relative;user-select:none;width:fit-content;height:fit-content}:host main{width:256px;height:256px;background-color:#ffffff;border:1px solid #d9d9d9;box-sizing:border-box;transition:height 1s ease 1s;display:flex;flex-direction:column;position:relative;padding-top:8px}:host(.full-width){width:100%}:host(.full-width) main{width:100%}:host(.linked){z-index:-999;position:absolute;opacity:0;top:-10000;left:-10000;visibility:hidden !important;box-shadow:0px 2px 8px rgba(0, 0, 0, 0.15)}:host(.linked.show){opacity:1;visibility:visible !important;z-index:100000}:host(.flex){width:100%;height:100%}:host(.flex) main{width:100%}:host(.type-autocomplete) .search-container{height:0;margin:0;padding:0;overflow:hidden}.label{display:block;color:var(--bcm-color-grey-9);margin-bottom:4px}.caption-area{min-height:20px}.caption-default{color:#8C8C8C}.caption-primary{color:#4293CF}.caption-success{color:#52C41A}.caption-warning{color:#FA8C16}.caption-error{color:#F5222D}:host(.error) .label{color:var(--bcm-color-red-6) !important}:host(.error) main{border:1px solid var(--bcm-color-red-6) !important}.search-container{margin:0 8px;padding-top:8px;background-color:#ffffff}.search-container+.list-container{padding-top:0}.footer{text-align:right;padding:4px 8px;background-color:var(--bcm-color-grey-3)}.list-container{flex:1;overflow-y:auto;display:flex;flex-direction:column;grid-gap:4px;position:relative}.list-container .list{display:flex;flex-direction:column;grid-gap:4px}.check-container{display:block}.check-container.hidden{display:none}.empty{display:none;align-items:center;justify-content:center;flex:1;height:100%}.empty.show{display:flex}.spinner{position:absolute;z-index:1;top:0;opacity:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;background-color:#ffffff;visibility:hidden;transition:opacity 0.3s, visibility 0.5s}.spinner.show{visibility:visible;opacity:0.8}.spinner.first-run{visibility:visible;opacity:0.9}.list-item{padding:8px;color:var(--bcm-color-grey-8);background-color:var(--bcm-color-grey-1);cursor:pointer;display:flex;justify-content:flex-start;align-items:center;flex-direction:row;margin:0 8px}.list-item:hover:not(.disabled),.list-item:active:not(.disabled){color:var(--bcm-color-prime-blue-6);background-color:var(--bcm-color-prime-blue-1)}.divider{margin:0 8px}";
6
+
7
+ const lowercase = (str) => str.toLowerCase();
8
+ const BcmList = class {
9
+ constructor(hostRef) {
10
+ registerInstance(this, hostRef);
11
+ this.listSelected = createEvent(this, "bcm-list-selected", 7);
12
+ this.listChecked = createEvent(this, "bcm-list-checklist", 7);
13
+ this.change = createEvent(this, "bcm-change", 7);
14
+ this.configObject = [];
15
+ this.isRendered = false;
16
+ this.firstRender = true;
17
+ this.linkedElementWidth = "100%";
18
+ this.bodyStyleOverflow = '';
19
+ this.dataLength = 0;
20
+ this.checklist = [];
21
+ this.otherList = [];
22
+ this.configured = false;
23
+ this.checkStatus = false;
24
+ this.resetSelected = false;
25
+ this.indeterminateStatus = false;
26
+ this.total = 0;
27
+ this.totalSearch = 0;
28
+ this.empty = false;
29
+ this.objectMapping = {
30
+ 'id': "id",
31
+ 'text': "text",
32
+ 'selected': "selected",
33
+ };
34
+ this._id = (Math.random() * 4).toString(16).replace('.', '');
35
+ this._internal_id = (Math.random() * 4).toString(16).replace('.', '');
36
+ this._list_select_id = null;
37
+ this._list_id = null;
38
+ this.type = 'default';
39
+ this.processType = 'default';
40
+ this.hidden = false;
41
+ this.items = [];
42
+ this.isShow = true;
43
+ this.linkedComponent = null;
44
+ this.selectedId = null;
45
+ this.flex = false;
46
+ this.height = "256px";
47
+ this.minHeight = null;
48
+ this.maxHeight = null;
49
+ this.width = "100%";
50
+ this.minWidth = null;
51
+ this.maxWidth = null;
52
+ this.fullWidth = false;
53
+ this.size = 'medium';
54
+ this.infoFooter = false;
55
+ this.searchable = false;
56
+ this.highlight = true;
57
+ this.searchPlaceholder = "Search";
58
+ this.searchFields = ['text'];
59
+ this.returnField = "id";
60
+ this.searchData = null;
61
+ this.searchSub = "items";
62
+ this.searchText = "";
63
+ this.value = null;
64
+ this.multiSelect = false;
65
+ /******/
66
+ this.variableText = 'item';
67
+ this.clearable = false;
68
+ this.label = null;
69
+ this.placeholder = "Choose an option";
70
+ this.noCaption = false;
71
+ this.caption = null;
72
+ this.captionError = null;
73
+ this.captionType = 'default';
74
+ this.disabled = false;
75
+ this.name = null;
76
+ this.required = false;
77
+ }
78
+ connectedCallback() {
79
+ this.captionCache = this.caption;
80
+ this.captionTypeCache = this.captionType;
81
+ this.bodyStyleOverflow = document.querySelector("body").style.overflow;
82
+ const elementId = "bcm-list-select-" + this._id;
83
+ if (this.type === 'select' || this.type === 'autocomplete') {
84
+ this.selectIsInitialize();
85
+ this.linkedComponent = elementId;
86
+ }
87
+ if (this.type !== 'default' || this.linkedComponent !== null) {
88
+ this.isShow = false;
89
+ this.el.classList.add("linked");
90
+ this.el.classList.remove("show");
91
+ this.handleLinkedComponent();
92
+ }
93
+ const slot = this.el.shadowRoot.querySelectorAll('bcm-list-item');
94
+ if (slot) {
95
+ slot.forEach(el => {
96
+ if (lowercase(el.tagName) === 'bcm-list-item') {
97
+ el.setAttribute("_internal_id", this._internal_id);
98
+ }
99
+ });
100
+ }
101
+ }
102
+ disconnectedCallback() { }
103
+ componentWillLoad() { }
104
+ componentDidLoad() { }
105
+ componentWillRender() { }
106
+ componentDidRender() {
107
+ const elementId = "bcm-list-select-" + this._id;
108
+ if (this.type === 'select' || this.type === 'autocomplete') {
109
+ this.selectIsInitialize();
110
+ this.linkedComponent = elementId;
111
+ }
112
+ if (sessionStorage.getItem(this._internal_id + "-config")) {
113
+ this.config(JSON.parse(sessionStorage.getItem(this._internal_id + "-config")));
114
+ }
115
+ setTimeout(() => {
116
+ const spinner = this.el.shadowRoot.querySelector('.spinner');
117
+ if (spinner) {
118
+ spinner.classList.remove("first-run");
119
+ }
120
+ }, 500);
121
+ }
122
+ componentWillUpdate() { }
123
+ componentDidUpdate() { }
124
+ /**
125
+ * @desc
126
+ */
127
+ async hide() {
128
+ this.isShow = false;
129
+ document.querySelector("body").style.overflow = this.bodyStyleOverflow;
130
+ }
131
+ async setSearch(text) {
132
+ const searchInput = this.el.shadowRoot.querySelector("bcm-search");
133
+ if (searchInput) {
134
+ searchInput.setValue(text);
135
+ // searchInput.select()
136
+ }
137
+ }
138
+ async clearAndSelectSearch(select = true) {
139
+ if (this.searchable == true) {
140
+ // var searchInput = null
141
+ const searchInput = this.el.shadowRoot.querySelector("bcm-search");
142
+ // console.log(searchInput)
143
+ if (searchInput) {
144
+ searchInput.setClear();
145
+ if (select == true) {
146
+ searchInput.select();
147
+ }
148
+ }
149
+ }
150
+ }
151
+ /**
152
+ * @desc
153
+ */
154
+ async show() {
155
+ if (this.processType == 'deselect') {
156
+ this.firstRender = true;
157
+ if (this.items != this.otherList) {
158
+ this.isRendered = false;
159
+ this.setData(this.otherList);
160
+ }
161
+ }
162
+ this.isShow = true;
163
+ this.renderList();
164
+ this.clearAndSelectSearch(true);
165
+ }
166
+ /**
167
+ * @desc
168
+ */
169
+ async renderList() {
170
+ if (this.items && this.isRendered === false) {
171
+ this.isRendered = true;
172
+ this.processData(this.items);
173
+ }
174
+ if (this.linkedComponent !== null) {
175
+ this.handleLinkedComponent();
176
+ }
177
+ }
178
+ /**
179
+ * @desc
180
+ */
181
+ async toggle() {
182
+ this.isShow = !this.isShow;
183
+ }
184
+ /**
185
+ * @desc
186
+ */
187
+ async openStatus() {
188
+ return this.isShow;
189
+ }
190
+ /**
191
+ * @desc
192
+ */
193
+ handleOpen(value) {
194
+ if (this.processType === "deselect") {
195
+ const listSelect = document.getElementById(this._list_select_id);
196
+ if (listSelect) {
197
+ const otherTag = listSelect.shadowRoot.querySelector("#other-tag");
198
+ if (otherTag) {
199
+ if (value === true) {
200
+ otherTag.setAttribute("color", "prime-blue");
201
+ }
202
+ else {
203
+ otherTag.removeAttribute("color");
204
+ }
205
+ }
206
+ }
207
+ }
208
+ }
209
+ /**
210
+ * @desc
211
+ */
212
+ handleChange(newValue) {
213
+ this.change.emit(newValue);
214
+ }
215
+ /**
216
+ * @desc
217
+ */
218
+ handleCaptionType() {
219
+ if (this.type === 'select' || this.type === 'autocomplete') {
220
+ const element = document.getElementById("bcm-list-select-" + this._id);
221
+ if (element) {
222
+ element.caption = this.caption;
223
+ element.captionError = this.captionError;
224
+ element.captionType = this.captionType;
225
+ }
226
+ }
227
+ }
228
+ /**
229
+ * @desc
230
+ */
231
+ async config(_config) {
232
+ if (_config['type']) {
233
+ this.type = _config['type'];
234
+ }
235
+ if (_config['searchPlaceholder']) {
236
+ this.searchPlaceholder = _config['searchPlaceholder'];
237
+ }
238
+ if (_config['searchFields']) {
239
+ this.searchFields = _config['searchFields'];
240
+ }
241
+ if (_config['returnField']) {
242
+ this.returnField = _config['returnField'];
243
+ }
244
+ if (_config['highlight']) {
245
+ this.highlight = _config['highlight'];
246
+ }
247
+ if (_config['linkedComponent'] && typeof _config['linkedComponent'] == 'string') {
248
+ this.linkedComponent = _config['linkedComponent'];
249
+ }
250
+ if (_config['searchable'] && typeof _config['searchable'] == 'boolean') {
251
+ this.searchable = _config['searchable'];
252
+ }
253
+ if (_config['infoFooter'] && typeof _config['infoFooter'] == 'boolean') {
254
+ this.infoFooter = _config['infoFooter'];
255
+ }
256
+ if (_config['mapping']) {
257
+ if (_config['mapping']['id']) {
258
+ this.objectMapping['id'] = _config['mapping']['id'];
259
+ }
260
+ if (_config['mapping']['text']) {
261
+ this.objectMapping['text'] = _config['mapping']['text'];
262
+ }
263
+ if (_config['mapping']['selected']) {
264
+ this.objectMapping['selected'] = _config['mapping']['selected'];
265
+ }
266
+ }
267
+ sessionStorage.setItem(this._internal_id + "-config", JSON.stringify(_config));
268
+ this.configured = true;
269
+ this.configObject = _config;
270
+ return _config;
271
+ }
272
+ /**
273
+ * @desc
274
+ */
275
+ async setDataOther(_data = []) {
276
+ this.otherList = _data;
277
+ }
278
+ /**
279
+ * @desc
280
+ */
281
+ async setData(_data = []) {
282
+ if (this.type === 'select' || this.type === 'autocomplete') {
283
+ this.selectIsInitialize();
284
+ }
285
+ if (this.value !== null) {
286
+ this.setClear();
287
+ }
288
+ if (_data) {
289
+ typeof _data == 'string'
290
+ ? this.items = JSON.parse(_data)
291
+ : this.items = _data;
292
+ if (this.items) {
293
+ switch (this.processType) {
294
+ case 'default':
295
+ if (this.items.find(e => e[this.objectMapping['selected']])) {
296
+ var selectedIDs = [];
297
+ this.items.filter(e => String(e[this.objectMapping['selected']]) === "true").forEach(element => {
298
+ selectedIDs.push(element[this.objectMapping['id']]);
299
+ });
300
+ // if ( selectedIDs.length > 0 ) {
301
+ this.checked(selectedIDs);
302
+ // }
303
+ }
304
+ break;
305
+ case 'deselect':
306
+ var selectedIDs = [];
307
+ this.items.forEach(element => {
308
+ // element[ this.objectMapping['selected'] ] = true;
309
+ selectedIDs.push(element[this.objectMapping['id']]);
310
+ });
311
+ // if ( selectedIDs.length > 0 ) {
312
+ this.checked(selectedIDs);
313
+ // }
314
+ break;
315
+ }
316
+ }
317
+ this.calculatedTotals({ "total": this.items.length });
318
+ if (this.multiSelect === true) {
319
+ this.calculatedTotals({ "selected": selectedIDs ? selectedIDs.length : 0 });
320
+ }
321
+ this.isRendered = false;
322
+ if (this.linkedComponent === null) {
323
+ this.show();
324
+ }
325
+ }
326
+ if (this.type === 'autocomplete') {
327
+ this.renderList();
328
+ }
329
+ return _data;
330
+ }
331
+ /**
332
+ * @desc
333
+ */
334
+ async getValue() {
335
+ return this.value;
336
+ }
337
+ /**
338
+ * @desc
339
+ */
340
+ async getChecklist() {
341
+ return this.checklist;
342
+ }
343
+ /**
344
+ * @desc
345
+ */
346
+ async resetCaption() {
347
+ this.caption = this.captionCache;
348
+ this.captionType = this.captionTypeCache;
349
+ this.captionError = null;
350
+ if (this.type === 'autocomplete' || this.type === 'select') {
351
+ const elementId = "bcm-list-select-" + this._id;
352
+ const element = document.getElementById(elementId);
353
+ if (element) {
354
+ element.resetCaption();
355
+ }
356
+ }
357
+ }
358
+ /**
359
+ * @desc
360
+ */
361
+ async toggleChecked(checkedItems = null) {
362
+ if (checkedItems !== null && checkedItems !== []) {
363
+ if (typeof checkedItems !== 'string') {
364
+ if (checkedItems.length == 1) {
365
+ checkedItems = String(checkedItems[0]);
366
+ }
367
+ }
368
+ var checkStatus = false;
369
+ if (typeof checkedItems == 'string') {
370
+ checkStatus = this.items.find(e => e[this.objectMapping['id']] == checkedItems)[this.objectMapping['selected']];
371
+ }
372
+ else {
373
+ let state = 'uncheck';
374
+ let allChecked = true;
375
+ let allUnchecked = true;
376
+ checkedItems.forEach((item) => {
377
+ if (String(this.items.find(e => e[this.objectMapping['id']] == item)[this.objectMapping['selected']]) === 'true') {
378
+ allUnchecked = false;
379
+ }
380
+ else {
381
+ allChecked = false;
382
+ }
383
+ });
384
+ !allChecked && !allUnchecked
385
+ ? state = 'determinate'
386
+ : allChecked
387
+ ? state = 'determinate'
388
+ : state = 'uncheck';
389
+ checkStatus = state == 'determinate' ? false : true;
390
+ }
391
+ // let state: string = 'uncheck'
392
+ // let allChecked: boolean = true
393
+ // let allUnchecked: boolean = true
394
+ // checkedItems.map((item) => {
395
+ // item[ this.objectMapping['selected'] ] === true && (allUnchecked = false)
396
+ // !item[ this.objectMapping['selected'] ] === true && (allChecked = false)
397
+ // });
398
+ // !allChecked && !allUnchecked
399
+ // ? state = 'determinate'
400
+ // : allChecked
401
+ // ? state = 'determinate'
402
+ // : state = 'uncheck'
403
+ // const checkStatus = state == 'determinate' ? true : false
404
+ // const checkStatus = this.items.find( e => e[ this.objectMapping['id'] ] == checkedItems )[ this.objectMapping['selected'] ]
405
+ if (checkStatus === true) {
406
+ this.unChecked(checkedItems);
407
+ }
408
+ else {
409
+ // this.checked(checkedItems, false)
410
+ var selectedIDs = [];
411
+ // var checkItem = null
412
+ if (typeof checkedItems == 'string') {
413
+ // checkItem = this.sendSelectId( String(checkedItems), true)
414
+ selectedIDs.push(checkedItems);
415
+ }
416
+ else {
417
+ checkedItems.forEach((item) => {
418
+ selectedIDs.push(item);
419
+ // String(item[ this.objectMapping['selected'] ]) === 'true' && (allUnchecked = false),
420
+ // String(item[ this.objectMapping['selected'] ]) !== 'true' && (allChecked = false)
421
+ });
422
+ // this.sendSelectId( String(checkedItems), true)
423
+ // var selectedIDs = []
424
+ // if( this.items && this.items.find( e => e[ this.objectMapping['selected'] ] ) ){
425
+ // this.items.filter( e => String( e[ this.objectMapping['selected'] ] ) === "true" ).forEach(element => {
426
+ // selectedIDs.push( element )
427
+ // });
428
+ // }
429
+ // this.value = selectedIDs
430
+ // this.listChecked.emit( this.value )
431
+ // this.handleIndeterminateStatus()
432
+ // this.sendSelectValue()
433
+ }
434
+ this.checked(selectedIDs, false);
435
+ }
436
+ }
437
+ }
438
+ /**
439
+ * @desc
440
+ */
441
+ async unChecked(checkedItems = null) {
442
+ if (checkedItems !== null && checkedItems !== []) {
443
+ if (typeof checkedItems !== 'string') {
444
+ if (checkedItems.length == 1) {
445
+ checkedItems = String(checkedItems[0]);
446
+ }
447
+ }
448
+ var selectedIDs = [];
449
+ this.selectedId = null;
450
+ if (typeof checkedItems == 'string') {
451
+ this.sendSelectId(String(checkedItems), false);
452
+ }
453
+ else {
454
+ checkedItems.forEach(item => {
455
+ this.sendSelectId(String(item), false);
456
+ });
457
+ }
458
+ if (this.items && this.items.find(e => e[this.objectMapping['selected']])) {
459
+ this.items.filter(e => String(e[this.objectMapping['selected']]) === "true").forEach(element => {
460
+ selectedIDs.push(element);
461
+ });
462
+ }
463
+ this.value = selectedIDs;
464
+ this.listChecked.emit(this.value);
465
+ this.handleIndeterminateStatus();
466
+ this.sendSelectValue();
467
+ }
468
+ }
469
+ /**
470
+ * @desc
471
+ */
472
+ async checked(checkedItems = null, reset = true) {
473
+ if (checkedItems !== null && checkedItems !== []) {
474
+ if (typeof checkedItems !== 'string') {
475
+ if (checkedItems.length == 1) {
476
+ checkedItems = String(checkedItems[0]);
477
+ }
478
+ }
479
+ var selectedIDs = [];
480
+ if (reset === true) {
481
+ if (this.items && this.items.find(e => String(e[this.objectMapping['selected']]) === "true")) {
482
+ this.items.filter(e => String(e[this.objectMapping['selected']]) === "true").forEach(element => {
483
+ this.jsonDataProcess(element[this.objectMapping['id']], false);
484
+ this.sendSelectId(String(element[this.objectMapping['id']]), false);
485
+ });
486
+ }
487
+ this.setClear(false);
488
+ }
489
+ if (typeof checkedItems == 'string') {
490
+ this.sendSelectId(String(checkedItems));
491
+ if (this.multiSelect === false) {
492
+ this.selectedId = this.items.find(e => String(e[this.objectMapping['id']]) === String(checkedItems))[this.objectMapping['id']];
493
+ }
494
+ }
495
+ else {
496
+ if (this.multiSelect === true) {
497
+ checkedItems.forEach(item => {
498
+ this.sendSelectId(String(item));
499
+ });
500
+ }
501
+ }
502
+ // if ( this.multiSelect === false ){
503
+ // this.selectedId = this.items.find( e => String(e[ this.objectMapping['id'] ]) === String(checkedItems) )[ this.objectMapping['id'] ]
504
+ // }
505
+ if (this.items && this.items.find(e => String(e[this.objectMapping['selected']]) === "true")) {
506
+ this.items.filter(e => String(e[this.objectMapping['selected']]) === "true").forEach(item => {
507
+ selectedIDs.push(item);
508
+ });
509
+ }
510
+ this.value = selectedIDs;
511
+ this.listChecked.emit(this.value);
512
+ this.handleIndeterminateStatus();
513
+ this.sendSelectValue();
514
+ }
515
+ }
516
+ /**
517
+ * @desc
518
+ */
519
+ async setClear(eventEmit = true) {
520
+ if (this.items != undefined && this.items.length > 0 && this.items.find(e => e[this.objectMapping['selected']])) {
521
+ var selectedIDs = [];
522
+ this.items.filter(e => String(e[this.objectMapping['selected']]) === "true").forEach(element => {
523
+ selectedIDs.push(element[this.objectMapping['id']]);
524
+ });
525
+ this.unChecked(selectedIDs);
526
+ }
527
+ this.selectedId = null;
528
+ this.checklist = [];
529
+ if (eventEmit === true) {
530
+ this.listChecked.emit(this.checklist);
531
+ this.value = null;
532
+ }
533
+ this.handleIndeterminateStatus();
534
+ this.calculatedTotals({ "selected": this.checklist.length });
535
+ }
536
+ /**
537
+ * @desc
538
+ */
539
+ async processData(_data) {
540
+ this.handleLoading(true);
541
+ await delay(100);
542
+ const list = this.el.shadowRoot.querySelector('.list');
543
+ list.innerHTML = "";
544
+ // this.selectedId = null
545
+ // this.value = null
546
+ const elementStatuses = [];
547
+ var checkedItems = [];
548
+ if (_data.length > 0) {
549
+ this.dataLength = _data.length;
550
+ this.searchData = _data;
551
+ await delay(100);
552
+ _data.map(item => {
553
+ const element = document.createElement("bcm-list-item");
554
+ element.setAttribute("_internal_id", this._internal_id);
555
+ element.setAttribute("text", item[this.objectMapping['text']]);
556
+ element.setAttribute("id", String(item[this.objectMapping['id']]));
557
+ if (String(item[this.objectMapping['selected']]) === "true") {
558
+ // element.select()
559
+ checkedItems.push(String(item[this.objectMapping['id']]));
560
+ }
561
+ // element.setAttribute("item-object", JSON.stringify(item))
562
+ var object = item;
563
+ element.itemObject = object;
564
+ element.multiSelect = this.multiSelect === true ? true : false;
565
+ list.appendChild(element);
566
+ elementStatuses.push(element.componentOnReady());
567
+ });
568
+ const allStatuses = await Promise.all(elementStatuses);
569
+ if (allStatuses) {
570
+ if (checkedItems != []) {
571
+ checkedItems.forEach(item => {
572
+ // if ( this.sendSelectId( String(item) ) !== false ){
573
+ this.sendSelectId(String(item));
574
+ // }
575
+ });
576
+ }
577
+ this.handleLoading(false);
578
+ this.handleIndeterminateStatus();
579
+ this.firstRender = false;
580
+ return true;
581
+ }
582
+ }
583
+ else {
584
+ this.handleLoading(false);
585
+ }
586
+ }
587
+ /**
588
+ * @desc
589
+ */
590
+ handleLoading(show = false) {
591
+ const spinner = this.el.shadowRoot.querySelector('.spinner');
592
+ // const searchInput = this.el.shadowRoot.querySelector('#search');
593
+ if (show == true) {
594
+ spinner.classList.add("show");
595
+ // searchInput.setAttribute('readonly', 'true')
596
+ }
597
+ else {
598
+ spinner.classList.remove("show");
599
+ // searchInput.setAttribute('readonly', 'false')
600
+ }
601
+ if (this.linkedComponent !== null) {
602
+ this.handleLinkedComponent();
603
+ }
604
+ }
605
+ /**
606
+ * @desc
607
+ */
608
+ handleClick(event) {
609
+ var path = event.path || (event.composedPath && event.composedPath());
610
+ // const elementId = "bcm-list-select-" + this._id
611
+ // console.log (
612
+ // !!(
613
+ // path
614
+ // && path.filter((input: HTMLElement) => input['_internal_id'] == this._internal_id)[0]
615
+ // && (
616
+ // path.filter((input: HTMLElement) => input['id'] == "clear-button")[0] !== undefined
617
+ // || path.filter((input: HTMLElement) => input['id'] == "close-button")[0] !== undefined
618
+ // || path.filter((input: HTMLElement) => input['id'] == "close")[0] !== undefined
619
+ // )
620
+ // )
621
+ // )
622
+ if (!this.el.contains(event.target)
623
+ || (path
624
+ && path.filter((input) => input['_internal_id'] == this._internal_id)[0]
625
+ && path.filter((input) => input['nodeName'] == "BCM-LIST-ITEM")[0]
626
+ && this.multiSelect === false)) {
627
+ if (this.isShow === true) {
628
+ this.hide();
629
+ }
630
+ }
631
+ }
632
+ /**
633
+ * @desc
634
+ */
635
+ wheelEvent(event) {
636
+ if (!this.el.contains(event.target)) {
637
+ if (this.isShow === true) {
638
+ this.hide();
639
+ }
640
+ }
641
+ }
642
+ /**
643
+ * @desc
644
+ */
645
+ scrollEvent(event) {
646
+ if (!this.el.contains(event.target)) {
647
+ if (this.isShow === true) {
648
+ this.hide();
649
+ }
650
+ }
651
+ }
652
+ /**
653
+ * @desc
654
+ */
655
+ resizeEvent() {
656
+ dropInComponent(this.el, "#" + this.linkedComponent);
657
+ }
658
+ /**
659
+ * @descc
660
+ */
661
+ onmousemove(e) {
662
+ if (this.el.contains(e.target)) {
663
+ if (document.querySelector("body").style.overflow != "hidden") {
664
+ document.querySelector("body").style.overflow = "hidden";
665
+ }
666
+ }
667
+ else {
668
+ if (document.querySelector("body").style.overflow != this.bodyStyleOverflow) {
669
+ document.querySelector("body").style.overflow = this.bodyStyleOverflow;
670
+ }
671
+ }
672
+ }
673
+ /**
674
+ * @descc
675
+ */
676
+ listenSearchResult(event) {
677
+ var path = event.path || (event.composedPath && event.composedPath());
678
+ if (event.isEvent == undefined) {
679
+ if (path && path.filter((input) => input['_internal_id'] == this._internal_id)[0] != undefined) {
680
+ // var childs: any[] = getChilds(this.el, 'bcm-list-item')
681
+ var childs = this.el.shadowRoot.querySelectorAll("bcm-list-item");
682
+ childs.forEach(element => {
683
+ element.classList.add("hidden");
684
+ });
685
+ if (event.detail.length > 0) {
686
+ if (event.detail[0] == -1) {
687
+ this.totalSearch = 0;
688
+ this.empty = true;
689
+ }
690
+ else {
691
+ this.totalSearch = event.detail.length;
692
+ this.empty = false;
693
+ if (this.dataLength > 0) {
694
+ childs.forEach(element => {
695
+ // if ( this.highlight ){
696
+ // event.target.addEventListener('bcm-on-search-value', async(event: CustomEvent) => {
697
+ // var searchValue = await event.detail
698
+ // var inputText = element.shadowRoot.getElementById("text")
699
+ // inputText = inputText.textContent || inputText.innerText || ""
700
+ // if (searchValue) {
701
+ // var cacheInputText = lowercase(inputText)
702
+ // var cacheSearchValue = lowercase(searchValue)
703
+ // var index = cacheInputText.indexOf(cacheSearchValue);
704
+ // if (index >= 0) {
705
+ // inputText = inputText.substring(0,index) + "<span class='highlight'>" + inputText.substring(index,index+searchValue.length) + "</span>" + inputText.substring(index + searchValue.length);
706
+ // }
707
+ // }
708
+ // element.shadowRoot.getElementById("text").innerHTML = inputText;
709
+ // })
710
+ // }
711
+ if (event.detail.indexOf(element._id) >= 0) {
712
+ element.classList.remove("hidden");
713
+ }
714
+ });
715
+ }
716
+ }
717
+ }
718
+ else if (event.detail === true) {
719
+ this.totalSearch = this.dataLength;
720
+ this.empty = false;
721
+ childs.forEach(element => {
722
+ element.classList.remove("hidden");
723
+ });
724
+ }
725
+ this.handleIndeterminateStatus();
726
+ this.calculatedTotals({ "searchResult": this.totalSearch });
727
+ }
728
+ }
729
+ }
730
+ /**
731
+ * @descc
732
+
733
+ */
734
+ sendSelectId(id, status = true) {
735
+ id = String(id);
736
+ if (this.items && this.items.find(e => String(e[this.objectMapping['id']]) == id)) {
737
+ this.selectedId = id;
738
+ if (this.isRendered === false) {
739
+ const findItem = this.items.find(e => String(e[this.objectMapping['id']]) == String(id));
740
+ findItem[this.objectMapping['selected']] = status;
741
+ this.handleChecklist(findItem, status);
742
+ return findItem;
743
+ }
744
+ else {
745
+ var selectedItem = null;
746
+ if (selectedItem = this.el.shadowRoot.getElementById(id)) {
747
+ if (status === true) {
748
+ selectedItem.classList.add("selected");
749
+ }
750
+ else {
751
+ selectedItem.classList.remove("selected");
752
+ }
753
+ if (this.multiSelect === true) {
754
+ this.handleChecklist(selectedItem["itemObject"], status);
755
+ // selectedItem.classList.toggle("selected")
756
+ if (selectedItem.shadowRoot.querySelector(".checkbox")) {
757
+ selectedItem.shadowRoot.querySelector(".checkbox").querySelector("input").checked = status;
758
+ }
759
+ }
760
+ this.items.find(e => e[this.objectMapping['id']] == id)[this.objectMapping['selected']] = status;
761
+ return this.items.find(e => e[this.objectMapping['id']] == id);
762
+ }
763
+ }
764
+ }
765
+ return false;
766
+ }
767
+ /**
768
+ * @descc
769
+ */
770
+ jsonDataProcess(id, status) {
771
+ var item = this.items.find(e => String(e[this.objectMapping['id']]) == String(id));
772
+ if (item) {
773
+ item[this.objectMapping['selected']] = status;
774
+ }
775
+ }
776
+ /**
777
+ * @descc
778
+ */
779
+ handleListSelected(event) {
780
+ var path = event.path || (event.composedPath && event.composedPath());
781
+ if (this.isInternal(event) || (!this.isInternal(event) && this.isInternalSlot(event))) {
782
+ var status = false;
783
+ var selectedItem = null;
784
+ const itemId = this.getItemId(event);
785
+ if (this.multiSelect === false) {
786
+ if (selectedItem = getChilds(this.el, "bcm-list-item").find(x => x._id === this.selectedId)) {
787
+ selectedItem.classList.remove("selected");
788
+ status = false;
789
+ // selectedItem.selected = false
790
+ }
791
+ }
792
+ selectedItem = this.el.shadowRoot.getElementById(itemId);
793
+ if (selectedItem) {
794
+ this.selectedId = selectedItem["id"];
795
+ // selectedItem.selected = true
796
+ if (this.multiSelect === true) {
797
+ selectedItem.classList.toggle("selected");
798
+ if (selectedItem.classList.contains("selected") === true) {
799
+ status = false;
800
+ }
801
+ else {
802
+ status = true;
803
+ }
804
+ }
805
+ else {
806
+ selectedItem.classList.add("selected");
807
+ status = true;
808
+ }
809
+ }
810
+ if (this.isInternalSlot(event)) {
811
+ if (selectedItem = path[0]) {
812
+ this.selectedId = path[0].id;
813
+ this.value = [event.detail];
814
+ return true;
815
+ }
816
+ }
817
+ if (this.multiSelect === true) {
818
+ this.handleChecklist(selectedItem["itemObject"], selectedItem.classList.contains("selected"));
819
+ this.listChecked.emit(this.checklist);
820
+ if (selectedItem.shadowRoot.querySelector(".checkbox")) {
821
+ selectedItem.shadowRoot.querySelector(".checkbox").querySelector("input").checked = selectedItem.classList.contains("selected");
822
+ }
823
+ this.value = this.checklist;
824
+ }
825
+ else {
826
+ this.value = [event.detail];
827
+ }
828
+ if (this.processType === 'default') {
829
+ this.jsonDataProcess(this.selectedId, status);
830
+ }
831
+ this.handleIndeterminateStatus();
832
+ this.sendSelectValue();
833
+ if (this.processType === 'deselect') {
834
+ var element = document.querySelector("#" + this._list_id);
835
+ if (element) {
836
+ if (this.firstRender === false) {
837
+ element.toggleChecked(this.selectedId);
838
+ }
839
+ // element.unChecked(this.selectedId)
840
+ }
841
+ }
842
+ }
843
+ }
844
+ /**
845
+ * @desc
846
+ */
847
+ handleChecklist(checkItem, process = true) {
848
+ if (this.items && this.items.find(e => e[this.objectMapping['id']] == checkItem[this.objectMapping['id']])) {
849
+ switch (process) {
850
+ case true:
851
+ if (this.checklist.length > 0) {
852
+ if (!this.checklist.includes(checkItem)) {
853
+ this.checklist = [...this.checklist, checkItem];
854
+ }
855
+ }
856
+ else {
857
+ this.checklist = [checkItem];
858
+ }
859
+ break;
860
+ case false:
861
+ this.checklist = this.checklist.filter(item => item[this.objectMapping['id']] !== checkItem[this.objectMapping['id']]);
862
+ break;
863
+ }
864
+ let sorted = this.checklist.sort(function (a, b) { return a - b; });
865
+ this.checklist = sorted;
866
+ // if ( this.firstRender === false ){
867
+ this.calculatedTotals({ "selected": this.checklist.length });
868
+ // }
869
+ }
870
+ }
871
+ /**
872
+ * @desc
873
+ */
874
+ handleIndeterminateStatus() {
875
+ if (this.multiSelect === true) {
876
+ this.checkStatus = false;
877
+ this.indeterminateStatus = false;
878
+ if (this.items != undefined && this.checklist != undefined) {
879
+ let state = 'uncheck';
880
+ let allChecked = true;
881
+ let allUnchecked = true;
882
+ getChilds(this.el, "bcm-list-item").map((item) => {
883
+ if (item.classList.contains("hidden") === false) {
884
+ item.classList.contains("selected") === true && (allUnchecked = false);
885
+ !item.classList.contains("selected") === true && (allChecked = false);
886
+ }
887
+ });
888
+ !allChecked && !allUnchecked
889
+ ? state = 'indeterminate'
890
+ : allChecked
891
+ ? state = 'determinate'
892
+ : state = 'uncheck';
893
+ switch (state) {
894
+ case 'indeterminate':
895
+ this.checkStatus = false;
896
+ this.indeterminateStatus = true;
897
+ break;
898
+ case 'determinate':
899
+ this.checkStatus = true;
900
+ this.indeterminateStatus = false;
901
+ break;
902
+ case 'uncheck':
903
+ this.checkStatus = false;
904
+ this.indeterminateStatus = false;
905
+ break;
906
+ }
907
+ var indeterminateCheckbox;
908
+ if (indeterminateCheckbox = this.el.shadowRoot.querySelector('#check-lite-' + this._id)) {
909
+ indeterminateCheckbox["checked"] = this.checkStatus;
910
+ indeterminateCheckbox["indeterminate"] = this.indeterminateStatus;
911
+ }
912
+ // if ( this.checklist.length == 0 ) {
913
+ // this.checkStatus = false
914
+ // this.indeterminateStatus = false
915
+ // } else if ( this.checklist.length == this.items.length ){
916
+ // this.checkStatus = true
917
+ // this.indeterminateStatus = false
918
+ // } else if ( this.checklist.length < this.items.length ){
919
+ // this.checkStatus = false
920
+ // this.indeterminateStatus = true
921
+ // } else {
922
+ // this.checkStatus = false
923
+ // this.indeterminateStatus = false
924
+ // }
925
+ // if ( this.multiSelect === true ){
926
+ var indeterminateCheckbox;
927
+ if (indeterminateCheckbox = this.el.shadowRoot.querySelector('#check-lite-' + this._id)) {
928
+ indeterminateCheckbox["checked"] = this.checkStatus;
929
+ indeterminateCheckbox["indeterminate"] = this.indeterminateStatus;
930
+ }
931
+ // }
932
+ }
933
+ }
934
+ }
935
+ /**
936
+ * @desc
937
+ */
938
+ calculatedTotals(calcObject) {
939
+ var searchResult = -1;
940
+ if (calcObject["selected"] != undefined) {
941
+ if (this.infoFooter == true && this.el.shadowRoot.querySelector("#selected-item")) {
942
+ if (calcObject["selected"] > 0) {
943
+ this.el.shadowRoot.querySelector("#selected-item").innerHTML = "( " + calcObject["selected"] + " selected ) ";
944
+ }
945
+ else {
946
+ this.el.shadowRoot.querySelector("#selected-item").innerHTML = " ";
947
+ }
948
+ }
949
+ }
950
+ if (calcObject["searchResult"] != undefined) {
951
+ if (this.infoFooter == true && this.el.shadowRoot.querySelector("#search-result")) {
952
+ if (calcObject["searchResult"] == this.total) {
953
+ this.el.shadowRoot.querySelector("#search-result").innerHTML = "";
954
+ }
955
+ else {
956
+ this.el.shadowRoot.querySelector("#search-result").innerHTML = calcObject["searchResult"] + " / ";
957
+ }
958
+ searchResult = calcObject["searchResult"];
959
+ }
960
+ }
961
+ if (calcObject["total"] != undefined) {
962
+ if (this.infoFooter == true && this.el.shadowRoot.querySelector("#in-total")) {
963
+ this.el.shadowRoot.querySelector("#in-total").innerHTML = calcObject["total"];
964
+ this.total = calcObject["total"];
965
+ this.el.shadowRoot.querySelector("#variable-text").innerHTML = pluralize(this.variableText, calcObject["total"]);
966
+ }
967
+ }
968
+ const empty = this.el.shadowRoot.querySelector("#empty");
969
+ const selectAll = this.el.shadowRoot.querySelector("#check-container");
970
+ if (searchResult == 0 || this.total == 0) {
971
+ if (empty) {
972
+ empty.classList.add("show");
973
+ }
974
+ if (selectAll) {
975
+ selectAll.classList.add("hidden");
976
+ }
977
+ }
978
+ else {
979
+ if (empty) {
980
+ empty.classList.remove("show");
981
+ }
982
+ if (selectAll) {
983
+ selectAll.classList.remove("hidden");
984
+ }
985
+ }
986
+ }
987
+ /**
988
+ * @desc
989
+ */
990
+ getItemId(event) {
991
+ var path = event.path || (event.composedPath && event.composedPath());
992
+ const detect = path
993
+ && path[0]
994
+ && path[0].attributes
995
+ && path[0].attributes['id']
996
+ && path[0].attributes['id'].value;
997
+ return detect;
998
+ }
999
+ /**
1000
+ * @desc
1001
+ */
1002
+ isInternalSlot(event) {
1003
+ var path = event.path || (event.composedPath && event.composedPath());
1004
+ const detect = path
1005
+ && path[0]
1006
+ && lowercase(path[0].tagName) === 'bcm-list-item'
1007
+ && this.el.contains(path[0]);
1008
+ return detect;
1009
+ }
1010
+ /**
1011
+ * @desc
1012
+ */
1013
+ isInternal(event) {
1014
+ var path = event.path || (event.composedPath && event.composedPath());
1015
+ const detect = path
1016
+ && path[0]
1017
+ && path[0].attributes
1018
+ && path[0].attributes['_internal_id']
1019
+ && path[0].attributes['_internal_id'].value;
1020
+ return detect == this._internal_id;
1021
+ }
1022
+ /**
1023
+ * @desc
1024
+ */
1025
+ handleLinkedComponent() {
1026
+ dropInComponent(this.el, "#" + this.linkedComponent);
1027
+ var element = null;
1028
+ if (this.width == "100%" && (element = document.querySelector("#" + this.linkedComponent))) {
1029
+ this.linkedElementWidth = element.clientWidth + "px";
1030
+ }
1031
+ }
1032
+ /**
1033
+ * @desc
1034
+ */
1035
+ async selectIsInitialize() {
1036
+ const elementId = "bcm-list-select-" + this._id;
1037
+ var element;
1038
+ if (!document.getElementById(elementId)) {
1039
+ element = document.createElement("bcm-list-select");
1040
+ }
1041
+ else {
1042
+ element = document.getElementById(elementId);
1043
+ }
1044
+ element.setAttribute("id", elementId);
1045
+ element.setAttribute("_list_id", this._id);
1046
+ element.setAttribute("_internal_id", this._internal_id);
1047
+ if (this.type) {
1048
+ element.setAttribute("type", this.type);
1049
+ }
1050
+ if (this.clearable) {
1051
+ element.setAttribute("clearable", this.clearable);
1052
+ }
1053
+ if (this.label) {
1054
+ element.setAttribute("label", this.label);
1055
+ }
1056
+ if (this.variableText) {
1057
+ element.setAttribute("variable-text", this.variableText);
1058
+ }
1059
+ if (this.placeholder) {
1060
+ element.setAttribute("placeholder", this.placeholder);
1061
+ }
1062
+ if (this.noCaption) {
1063
+ element.setAttribute("no-naption", this.noCaption);
1064
+ }
1065
+ if (this.caption) {
1066
+ element.setAttribute("caption", this.caption);
1067
+ }
1068
+ if (this.captionError) {
1069
+ element.setAttribute("caption-error", this.captionError);
1070
+ }
1071
+ if (this.captionType) {
1072
+ element.setAttribute("caption-type", this.captionType);
1073
+ }
1074
+ if (this.disabled) {
1075
+ element.setAttribute("disabled", this.disabled);
1076
+ }
1077
+ if (this.name) {
1078
+ element.setAttribute("name", this.name);
1079
+ }
1080
+ if (this.required) {
1081
+ element.setAttribute("required", this.required);
1082
+ }
1083
+ if (this.fullWidth) {
1084
+ element.setAttribute("full-width", this.fullWidth);
1085
+ }
1086
+ if (this.multiSelect) {
1087
+ element.setAttribute("multiselect", this.multiSelect);
1088
+ }
1089
+ const parentNode = this.el.parentNode;
1090
+ parentNode.insertBefore(element, this.el);
1091
+ return elementId;
1092
+ }
1093
+ /**
1094
+ * @desc
1095
+ */
1096
+ handleCheckboxClick(e) {
1097
+ e.preventDefault();
1098
+ }
1099
+ /**
1100
+ * @desc
1101
+ */
1102
+ async handleIndeterminateClick(e) {
1103
+ e.preventDefault();
1104
+ let state = 'uncheck';
1105
+ let allChecked = true;
1106
+ let allUnchecked = true;
1107
+ let visibleItem = [];
1108
+ getChilds(this.el, "bcm-list-item").map((item) => {
1109
+ if (item.classList.contains("hidden") === false) {
1110
+ visibleItem.push(item.id);
1111
+ item.classList.contains("selected") === true && (allUnchecked = false);
1112
+ !item.classList.contains("selected") === true && (allChecked = false);
1113
+ }
1114
+ });
1115
+ !allChecked && !allUnchecked
1116
+ ? state = 'indeterminate'
1117
+ : allChecked
1118
+ ? state = 'determinate'
1119
+ : state = 'uncheck';
1120
+ if (state === 'determinate') {
1121
+ this.unChecked(visibleItem);
1122
+ }
1123
+ else {
1124
+ this.checked(visibleItem, false);
1125
+ }
1126
+ this.handleIndeterminateStatus();
1127
+ }
1128
+ /**
1129
+ * @desc
1130
+ */
1131
+ sendSelectValue() {
1132
+ if (this.type === 'select' || this.type === 'autocomplete') {
1133
+ const select = document.getElementById("bcm-list-select-" + this._id);
1134
+ if (select) {
1135
+ // if ( this.multiSelect === true ){
1136
+ select.setValue(this.value, this.objectMapping["id"], this.objectMapping["text"]);
1137
+ // } else {
1138
+ // var val = null;
1139
+ // if ( this.value ){
1140
+ // debugger;
1141
+ // if ( typeof this.value === 'object'){
1142
+ // val = this.value
1143
+ // }else{
1144
+ // if ( this.value.length > 0 ){
1145
+ // val = this.value[0]
1146
+ // }
1147
+ // }
1148
+ // }
1149
+ // // val = this.value[this.objectMapping["text"]]
1150
+ // select.setValue(val, this.objectMapping["id"], this.objectMapping["text"])
1151
+ // }
1152
+ }
1153
+ }
1154
+ }
1155
+ render() {
1156
+ const classes = classnames('list-container', this.size);
1157
+ const listItem = classnames('list-item', this.size, {
1158
+ 'size-2': this.size === 'small' || this.size === 'medium',
1159
+ 'size-3': this.size === 'large',
1160
+ });
1161
+ const hostClasses = classnames(this.hidden ? 'hidden' : null, 'type-' + this.type, {
1162
+ 'error': this.type == "default" && this.captionType == 'error' ? true : false,
1163
+ 'show': this.isShow,
1164
+ 'flex': this.minHeight != null || this.maxHeight != null,
1165
+ 'full-width': this.fullWidth
1166
+ });
1167
+ const searchContainer = classnames('search-container', {
1168
+ 'show': this.searchable,
1169
+ });
1170
+ const footer = classnames('footer');
1171
+ const captionClasses = classnames('size-1', 'input-caption', 'caption-' + this.captionType);
1172
+ var labelAreaHeight = 0;
1173
+ if (this.el.shadowRoot && this.el.shadowRoot.querySelector(".label") && this.el.shadowRoot.querySelector(".label").clientHeight) {
1174
+ labelAreaHeight = this.el.shadowRoot.querySelector(".label").clientHeight + 2;
1175
+ }
1176
+ var styleHeight = this.minHeight != null || this.maxHeight != null ? 'auto' : this.height;
1177
+ var customStyle = {
1178
+ 'min-height': this.minHeight != null ? this.minHeight : null,
1179
+ 'max-height': this.maxHeight != null ? this.maxHeight : null,
1180
+ 'width': this.minWidth != null || this.maxWidth != null ? 'max-content' :
1181
+ this.width != "100%" ? this.width : this.linkedElementWidth,
1182
+ 'min-width': this.minWidth != null ? this.minWidth == "100%" || this.minWidth == "auto" ? this.linkedElementWidth : this.minWidth : null,
1183
+ 'max-width': this.maxWidth != null ? this.maxWidth == "100%" || this.maxWidth == "auto" ? this.linkedElementWidth : this.maxWidth : null,
1184
+ };
1185
+ var mainStyle = Object.assign({ 'height': styleHeight }, customStyle);
1186
+ var hostStyle = Object.assign({ 'height': styleHeight + labelAreaHeight }, customStyle);
1187
+ return (h(Host, { class: hostClasses, style: hostStyle }, (this.type === 'default' && this.processType === 'default' && this.label) && (h("div", null, h("bcm-label", { tooltip: this.tooltip, type: this.captionType, value: this.label, required: this.required }))), h("main", { style: mainStyle }, this.searchable === true && (h("div", { class: searchContainer }, h("bcm-search", { id: "search", _internal_id: this._internal_id, searchPlaceholder: this.searchPlaceholder, data: this.searchData, returnField: this.returnField, searchFields: this.searchFields, searchValue: this.searchText, clearable: true }), h("bcm-divider", null))), h("div", { class: classes }, this.multiSelect === true && (h("div", { id: "check-container", class: "check-container" }, h("div", { class: listItem, id: "text", onClick: (e) => this.handleIndeterminateClick(e) }, h("div", { class: "check-content" }, h("bcm-checkbox-lite", { id: 'check-lite-' + this._id, name: 'check-lite-' + this._id, checked: false, indeterminate: false, onClick: (e) => this.handleCheckboxClick(e) })), "Select All"), h("div", { class: "divider" }, h("bcm-divider", null)))), h("slot", null), h("div", { class: "list" }), h("div", { class: "spinner first-run" }, h("bcm-icon", { type: "animated", color: "prime-blue", class: "prefix", icon: "loading" })), h("div", { id: "empty", class: "empty" }, h("bcm-empty", { size: "small", text: "No Data" }))), this.infoFooter == true && (h("div", { class: footer }, h("bcm-text", { scale: "size-1", color: "grey-8" }, this.multiSelect === true && (h("span", { id: "selected-item" })), "Total ", h("span", { id: "search-result" }), " ", h("span", { id: "in-total" }, "0"), " ", h("span", { id: "variable-text" }, " ", pluralize(this.variableText)), " found.")))), (this.type === 'default' && this.processType === 'default' && !this.noCaption) && (h("div", { class: "caption-area" }, this.captionType == "error"
1188
+ ? h("span", { class: captionClasses }, " ", this.captionError, " ")
1189
+ : this.caption && h("span", { class: captionClasses }, " ", this.caption, " ")))));
1190
+ }
1191
+ get el() { return getElement(this); }
1192
+ static get watchers() { return {
1193
+ "isShow": ["handleOpen"],
1194
+ "value": ["handleChange"],
1195
+ "captionType": ["handleCaptionType"]
1196
+ }; }
1197
+ };
1198
+ BcmList.style = listCss;
1199
+
1200
+ export { BcmList as bcm_list };