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