bromcom-ui 2.7.37-rc.3 → 2.7.37-rc.4-1
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.
- package/dist/collection/components/atoms/avatar/avatar.js +3 -3
- package/dist/collection/components/atoms/typography/typography.js +1 -1
- package/dist/collection/components/molecules/drawer/drawer.js +3 -3
- package/dist/collection/components/molecules/linked/linked.js +4 -4
- package/dist/collection/components/molecules/menu/menu.js +2 -2
- package/dist/collection/components/molecules/popover/popover.js +3 -3
- package/dist/collection/components/molecules/tooltip/tooltip.js +3 -3
- package/dist/collection/components/organism/list/list-tag-control.js +1 -1
- package/dist/collection/components/organism/list/list.js +5 -5
- package/dist/collection/components/other_deprecated/old-popover/old-popover-box.js +1 -1
- package/dist/collection/helper/popover-helper.js +2 -2
- package/dist/collection/helper/tooltip-helper.js +2 -2
- package/dist/collection/utils/floating-ui.js +1 -1
- package/dist/components/_commonjsHelpers.js +25 -0
- package/dist/components/avatar.js +124 -0
- package/dist/components/badge.js +95 -0
- package/dist/components/bcm-accordion.d.ts +11 -0
- package/dist/components/bcm-accordion.js +101 -0
- package/dist/components/bcm-alert.d.ts +11 -0
- package/dist/components/bcm-alert.js +140 -0
- package/dist/components/bcm-attendance.d.ts +11 -0
- package/dist/components/bcm-attendance.js +72 -0
- package/dist/components/bcm-autocomplete.d.ts +11 -0
- package/dist/components/bcm-autocomplete.js +293 -0
- package/dist/components/bcm-avatar.d.ts +11 -0
- package/dist/components/bcm-avatar.js +10 -0
- package/dist/components/bcm-badge.d.ts +11 -0
- package/dist/components/bcm-badge.js +10 -0
- package/dist/components/bcm-box.d.ts +11 -0
- package/dist/components/bcm-box.js +48 -0
- package/dist/components/bcm-breadcrumb.d.ts +11 -0
- package/dist/components/bcm-breadcrumb.js +96 -0
- package/dist/components/bcm-button-group.d.ts +11 -0
- package/dist/components/bcm-button-group.js +121 -0
- package/dist/components/bcm-button.d.ts +11 -0
- package/dist/components/bcm-button.js +10 -0
- package/dist/components/bcm-card.d.ts +11 -0
- package/dist/components/bcm-card.js +91 -0
- package/dist/components/bcm-checkbox-group.d.ts +11 -0
- package/dist/components/bcm-checkbox-group.js +474 -0
- package/dist/components/bcm-checkbox-lite.d.ts +11 -0
- package/dist/components/bcm-checkbox-lite.js +10 -0
- package/dist/components/bcm-checkbox.d.ts +11 -0
- package/dist/components/bcm-checkbox.js +10 -0
- package/dist/components/bcm-chip.d.ts +11 -0
- package/dist/components/bcm-chip.js +106 -0
- package/dist/components/bcm-collapse-group.d.ts +11 -0
- package/dist/components/bcm-collapse-group.js +75 -0
- package/dist/components/bcm-collapse.d.ts +11 -0
- package/dist/components/bcm-collapse.js +77 -0
- package/dist/components/bcm-colorpicker.d.ts +11 -0
- package/dist/components/bcm-colorpicker.js +491 -0
- package/dist/components/bcm-date-picker.d.ts +11 -0
- package/dist/components/bcm-date-picker.js +249 -0
- package/dist/components/bcm-datetime-picker.d.ts +11 -0
- package/dist/components/bcm-datetime-picker.js +10 -0
- package/dist/components/bcm-default.d.ts +11 -0
- package/dist/components/bcm-default.js +61 -0
- package/dist/components/bcm-divider.d.ts +11 -0
- package/dist/components/bcm-divider.js +10 -0
- package/dist/components/bcm-drawer.d.ts +11 -0
- package/dist/components/bcm-drawer.js +141 -0
- package/dist/components/bcm-dropdown.d.ts +11 -0
- package/dist/components/bcm-dropdown.js +306 -0
- package/dist/components/bcm-empty.d.ts +11 -0
- package/dist/components/bcm-empty.js +10 -0
- package/dist/components/bcm-error-layout.d.ts +11 -0
- package/dist/components/bcm-error-layout.js +98 -0
- package/dist/components/bcm-expansion-panel.d.ts +11 -0
- package/dist/components/bcm-expansion-panel.js +159 -0
- package/dist/components/bcm-form-2.d.ts +11 -0
- package/dist/components/bcm-form-2.js +226 -0
- package/dist/components/bcm-form-group.d.ts +11 -0
- package/dist/components/bcm-form-group.js +65 -0
- package/dist/components/bcm-form.d.ts +11 -0
- package/dist/components/bcm-form.js +510 -0
- package/dist/components/bcm-icon.d.ts +11 -0
- package/dist/components/bcm-icon.js +10 -0
- package/dist/components/bcm-input.d.ts +11 -0
- package/dist/components/bcm-input.js +404 -0
- package/dist/components/bcm-item.d.ts +11 -0
- package/dist/components/bcm-item.js +98 -0
- package/dist/components/bcm-items.d.ts +11 -0
- package/dist/components/bcm-items.js +74 -0
- package/dist/components/bcm-label.d.ts +11 -0
- package/dist/components/bcm-label.js +10 -0
- package/dist/components/bcm-link.d.ts +11 -0
- package/dist/components/bcm-link.js +10 -0
- package/dist/components/bcm-linked.d.ts +11 -0
- package/dist/components/bcm-linked.js +201 -0
- package/dist/components/bcm-list.d.ts +11 -0
- package/dist/components/bcm-list.js +1859 -0
- package/dist/components/bcm-listbox-group.d.ts +11 -0
- package/dist/components/bcm-listbox-group.js +10 -0
- package/dist/components/bcm-listbox-item.d.ts +11 -0
- package/dist/components/bcm-listbox-item.js +10 -0
- package/dist/components/bcm-listbox.d.ts +11 -0
- package/dist/components/bcm-listbox.js +10 -0
- package/dist/components/bcm-menu.d.ts +11 -0
- package/dist/components/bcm-menu.js +10 -0
- package/dist/components/bcm-message.d.ts +11 -0
- package/dist/components/bcm-message.js +126 -0
- package/dist/components/bcm-modal.d.ts +11 -0
- package/dist/components/bcm-modal.js +166 -0
- package/dist/components/bcm-notification.d.ts +11 -0
- package/dist/components/bcm-notification.js +136 -0
- package/dist/components/bcm-old-input.d.ts +11 -0
- package/dist/components/bcm-old-input.js +10 -0
- package/dist/components/bcm-old-search.d.ts +11 -0
- package/dist/components/bcm-old-search.js +10 -0
- package/dist/components/bcm-old-tag.d.ts +11 -0
- package/dist/components/bcm-old-tag.js +10 -0
- package/dist/components/bcm-popconfirm-box.d.ts +11 -0
- package/dist/components/bcm-popconfirm-box.js +10 -0
- package/dist/components/bcm-popconfirm.d.ts +11 -0
- package/dist/components/bcm-popconfirm.js +160 -0
- package/dist/components/bcm-popover.d.ts +11 -0
- package/dist/components/bcm-popover.js +203 -0
- package/dist/components/bcm-progress.d.ts +11 -0
- package/dist/components/bcm-progress.js +205 -0
- package/dist/components/bcm-radio-group.d.ts +11 -0
- package/dist/components/bcm-radio-group.js +334 -0
- package/dist/components/bcm-radio.d.ts +11 -0
- package/dist/components/bcm-radio.js +10 -0
- package/dist/components/bcm-range.d.ts +11 -0
- package/dist/components/bcm-range.js +220 -0
- package/dist/components/bcm-result.d.ts +11 -0
- package/dist/components/bcm-result.js +105 -0
- package/dist/components/bcm-search.d.ts +11 -0
- package/dist/components/bcm-search.js +10 -0
- package/dist/components/bcm-select-box.d.ts +11 -0
- package/dist/components/bcm-select-box.js +10 -0
- package/dist/components/bcm-select-group.d.ts +11 -0
- package/dist/components/bcm-select-group.js +48 -0
- package/dist/components/bcm-select-option.d.ts +11 -0
- package/dist/components/bcm-select-option.js +57 -0
- package/dist/components/bcm-select.d.ts +11 -0
- package/dist/components/bcm-select.js +1385 -0
- package/dist/components/bcm-skeleton.d.ts +11 -0
- package/dist/components/bcm-skeleton.js +10 -0
- package/dist/components/bcm-step.d.ts +11 -0
- package/dist/components/bcm-step.js +10 -0
- package/dist/components/bcm-stepper.d.ts +11 -0
- package/dist/components/bcm-stepper.js +249 -0
- package/dist/components/bcm-switch.d.ts +11 -0
- package/dist/components/bcm-switch.js +201 -0
- package/dist/components/bcm-tab-group.d.ts +11 -0
- package/dist/components/bcm-tab-group.js +190 -0
- package/dist/components/bcm-tab-pane.d.ts +11 -0
- package/dist/components/bcm-tab-pane.js +89 -0
- package/dist/components/bcm-tab.d.ts +11 -0
- package/dist/components/bcm-tab.js +125 -0
- package/dist/components/bcm-table.d.ts +11 -0
- package/dist/components/bcm-table.js +93 -0
- package/dist/components/bcm-tabs-content.d.ts +11 -0
- package/dist/components/bcm-tabs-content.js +80 -0
- package/dist/components/bcm-tabs.d.ts +11 -0
- package/dist/components/bcm-tabs.js +430 -0
- package/dist/components/bcm-tag.d.ts +11 -0
- package/dist/components/bcm-tag.js +132 -0
- package/dist/components/bcm-text.d.ts +11 -0
- package/dist/components/bcm-text.js +10 -0
- package/dist/components/bcm-textarea.d.ts +11 -0
- package/dist/components/bcm-textarea.js +212 -0
- package/dist/components/bcm-time-picker.d.ts +11 -0
- package/dist/components/bcm-time-picker.js +209 -0
- package/dist/components/bcm-timeline-item.d.ts +11 -0
- package/dist/components/bcm-timeline-item.js +81 -0
- package/dist/components/bcm-timeline.d.ts +11 -0
- package/dist/components/bcm-timeline.js +91 -0
- package/dist/components/bcm-tooltip.d.ts +11 -0
- package/dist/components/bcm-tooltip.js +10 -0
- package/dist/components/bcm-treeview-group.d.ts +11 -0
- package/dist/components/bcm-treeview-group.js +37 -0
- package/dist/components/bcm-treeview-item.d.ts +11 -0
- package/dist/components/bcm-treeview-item.js +10 -0
- package/dist/components/bcm-treeview.d.ts +11 -0
- package/dist/components/bcm-treeview.js +10 -0
- package/dist/components/bcm-typography.d.ts +11 -0
- package/dist/components/bcm-typography.js +10 -0
- package/dist/components/bcm.js +446 -0
- package/dist/components/button.js +403 -0
- package/dist/components/caption-template.js +32 -0
- package/dist/components/checkbox-lite.js +97 -0
- package/dist/components/checkbox.js +231 -0
- package/dist/components/color-helper.js +488 -0
- package/dist/components/colors.js +222 -0
- package/dist/components/datetime-picker.js +1509 -0
- package/dist/components/divider.js +59 -0
- package/dist/components/element-dragger.js +277 -0
- package/dist/components/empty.js +53 -0
- package/dist/components/floating-ui.js +1453 -0
- package/dist/components/generate.js +202 -0
- package/dist/components/icon.js +53 -0
- package/dist/components/index.d.ts +105 -0
- package/dist/components/index.js +99 -0
- package/dist/components/index2.js +62 -0
- package/dist/components/index3.js +191 -0
- package/dist/components/input-template.js +97 -0
- package/dist/components/is-load-decorator.js +54 -0
- package/dist/components/json-parse-decarator.js +38 -0
- package/dist/components/label-template.js +21 -0
- package/dist/components/label.js +83 -0
- package/dist/components/link.js +84 -0
- package/dist/components/listbox-group.js +55 -0
- package/dist/components/listbox-item.js +217 -0
- package/dist/components/listbox.js +1116 -0
- package/dist/components/menu.js +274 -0
- package/dist/components/number-helper.js +18 -0
- package/dist/components/old-bcm-popover-box.d.ts +11 -0
- package/dist/components/old-bcm-popover-box.js +10 -0
- package/dist/components/old-bcm-popover.d.ts +11 -0
- package/dist/components/old-bcm-popover.js +132 -0
- package/dist/components/old-input.js +470 -0
- package/dist/components/old-popover-box.js +184 -0
- package/dist/components/old-search.js +235 -0
- package/dist/components/old-tag.js +153 -0
- package/dist/components/popconfirm-box.js +160 -0
- package/dist/components/popover-placement.js +95 -0
- package/dist/components/property-decorators.js +31 -0
- package/dist/components/radio.js +119 -0
- package/dist/components/search.js +286 -0
- package/dist/components/select-box.js +165 -0
- package/dist/components/skeleton.js +69 -0
- package/dist/components/slot-template.js +13 -0
- package/dist/components/step.js +188 -0
- package/dist/components/string-helper.js +132 -0
- package/dist/components/text.js +72 -0
- package/dist/components/tooltip-helper.js +101 -0
- package/dist/components/tooltip.js +96 -0
- package/dist/components/treeview-item.js +419 -0
- package/dist/components/treeview.js +956 -0
- package/dist/components/types.js +32 -0
- package/dist/components/types2.js +32 -0
- package/dist/components/typography.js +45 -0
- package/dist/components/utils.js +123 -0
- package/dist/components/validators.js +35 -0
- package/package.json +4 -3
|
@@ -0,0 +1,956 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built with Stencil
|
|
3
|
+
* Copyright (c) Bromcom.
|
|
4
|
+
*/
|
|
5
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
6
|
+
import { b as getChilds } from './utils.js';
|
|
7
|
+
import { c as classnames } from './index2.js';
|
|
8
|
+
import { I as IsLoad } from './is-load-decorator.js';
|
|
9
|
+
import { d as defineCustomElement$b } from './checkbox.js';
|
|
10
|
+
import { d as defineCustomElement$a } from './divider.js';
|
|
11
|
+
import { d as defineCustomElement$9 } from './empty.js';
|
|
12
|
+
import { d as defineCustomElement$8 } from './icon.js';
|
|
13
|
+
import { d as defineCustomElement$7 } from './label.js';
|
|
14
|
+
import { d as defineCustomElement$6 } from './old-input.js';
|
|
15
|
+
import { d as defineCustomElement$5 } from './old-search.js';
|
|
16
|
+
import { d as defineCustomElement$4 } from './text.js';
|
|
17
|
+
import { d as defineCustomElement$3 } from './tooltip.js';
|
|
18
|
+
import { d as defineCustomElement$2 } from './treeview-item.js';
|
|
19
|
+
import { d as defineCustomElement$1 } from './typography.js';
|
|
20
|
+
|
|
21
|
+
const treeviewCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");.size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}.input-size-large{height:40px}.input-size-medium{height:32px}.input-size-small{height:24px}.resize-none textarea{resize:none}.resize-vertical textarea{resize:vertical}.resize-auto textarea{height:auto;resize:none}.textarea-size-large{padding:4px 0 0 4px;min-height:40px}.textarea-size-large .bcm-input-element{min-height:calc((40px - 8px) + 2px)}.textarea-size-large .input-clear-button{height:calc( 40px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-medium{padding:4px 0 0 4px;min-height:32px}.textarea-size-medium .bcm-input-element{min-height:calc((32px - 8px) + 2px)}.textarea-size-medium .input-clear-button{height:calc( 32px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-small{padding:0px 0 0 4px;min-height:24px}.textarea-size-small .bcm-input-element{min-height:calc((24px - 8px) + 2px)}.textarea-size-small .input-clear-button{height:calc( 24px - 16px );top:8px;padding:0;margin-right:8px}:host{display:flex;flex-direction:column;height:100%;max-height:100%;border:1px solid var(--bcm-color-grey-5);box-sizing:border-box;background-color:#ffffff}:host(.empty) .treeview{display:flex;align-items:center;justify-content:center}.search{padding:8px;padding-bottom:0;margin-bottom:4px}.treeview{height:100%;max-height:100%;overflow:auto;background-color:var(--bcm-color-grey-1);padding:0 8px 8px 0}.treeview.loading{min-height:150px;position:relative;margin:0 8px 8px 8px}.treeview .loading{display:none;align-items:center;justify-content:center;height:100%;width:100%;position:absolute;background-color:rgba(255, 255, 255, 0.03)}.treeview .loading.show{display:flex}.treeview .empty{display:none;align-items:center;justify-content:center;height:100%}.treeview .empty bcm-empty{width:fit-content;margin:auto}.treeview .empty.show{display:flex}footer{text-align:right;padding:4px 8px;background-color:var(--bcm-color-grey-3);user-select:none}";
|
|
22
|
+
|
|
23
|
+
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
24
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
25
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
26
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
27
|
+
else
|
|
28
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
29
|
+
if (d = decorators[i])
|
|
30
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
31
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* @desc
|
|
35
|
+
* @param str
|
|
36
|
+
*/
|
|
37
|
+
const lowercase = (str) => str.toLowerCase();
|
|
38
|
+
const Bcmtreeview = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
39
|
+
constructor() {
|
|
40
|
+
super();
|
|
41
|
+
this.__registerHost();
|
|
42
|
+
this.__attachShadow();
|
|
43
|
+
this.treeviewChange = createEvent(this, "bcm-treeview-change", 7);
|
|
44
|
+
this.treeviewSendCheck = createEvent(this, "bcm-treeview-send-check", 7);
|
|
45
|
+
this.treeviewSendUncheck = createEvent(this, "bcm-treeview-send-uncheck", 7);
|
|
46
|
+
this.treeviewChecklist = createEvent(this, "bcm-treeview-checklist", 7);
|
|
47
|
+
this.treeviewItemSelected = createEvent(this, "bcm-treeview-item-selected", 7);
|
|
48
|
+
this.treeviewClearSelecteds = createEvent(this, "bcm-treeview-clear-selecteds", 7);
|
|
49
|
+
this.treeviewShowContext = createEvent(this, "bcm-treeview-show-context", 7);
|
|
50
|
+
this.treeviewUnchecked = createEvent(this, "bcm-treeview-unchecked", 7);
|
|
51
|
+
this.treeviewChecked = createEvent(this, "bcm-treeview-checked", 7);
|
|
52
|
+
this.objectMapping = {
|
|
53
|
+
'text': 'text',
|
|
54
|
+
'icon': 'icon',
|
|
55
|
+
'id': 'id',
|
|
56
|
+
'items': 'items',
|
|
57
|
+
'open': 'open',
|
|
58
|
+
'selected': 'selected',
|
|
59
|
+
'checked': 'checked',
|
|
60
|
+
'tooltipText': 'tooltipText',
|
|
61
|
+
'disabled': "disabled",
|
|
62
|
+
'favorite': "favorite",
|
|
63
|
+
};
|
|
64
|
+
this.checkedObjectList = [];
|
|
65
|
+
this.allChilds = [];
|
|
66
|
+
this.onFocus = false;
|
|
67
|
+
this.minHeight = 200;
|
|
68
|
+
this.minWidth = 200;
|
|
69
|
+
this.allOpenCache = false;
|
|
70
|
+
this.allOpenOnSearch = false;
|
|
71
|
+
this.parentLength = [{}];
|
|
72
|
+
this.isSetData = false;
|
|
73
|
+
this.runClearAndSelect = false;
|
|
74
|
+
this.checkboxes = false;
|
|
75
|
+
this.showIcon = false;
|
|
76
|
+
this.size = 'medium';
|
|
77
|
+
this.checkedList = [];
|
|
78
|
+
this.updateCheckedList = [];
|
|
79
|
+
this.hidden = false;
|
|
80
|
+
this.search = false;
|
|
81
|
+
this.searchOnlyChild = false;
|
|
82
|
+
this.keydown = false;
|
|
83
|
+
this.allOpen = false;
|
|
84
|
+
this.fullWidth = false;
|
|
85
|
+
this.infoFooter = false;
|
|
86
|
+
this.searchFields = ['text', 'secondaryText', 'tooltipText'];
|
|
87
|
+
this.searchSub = "items";
|
|
88
|
+
this.returnField = "id";
|
|
89
|
+
this._items = [];
|
|
90
|
+
this.searchPlaceholder = "Search";
|
|
91
|
+
this.maxHeight = null;
|
|
92
|
+
this.highlight = false;
|
|
93
|
+
this.loading = true;
|
|
94
|
+
this.favIcon = false;
|
|
95
|
+
this.favIconOnlyChilds = false;
|
|
96
|
+
this._internal_id = (Math.random() * 4).toString(16).replace('.', '');
|
|
97
|
+
/**
|
|
98
|
+
* Component States
|
|
99
|
+
*/
|
|
100
|
+
this.empty = false;
|
|
101
|
+
this.showSearch = true;
|
|
102
|
+
this.items = [];
|
|
103
|
+
this.total = 0;
|
|
104
|
+
this.checkCount = 0;
|
|
105
|
+
this.keyMapForFocus = { 18: false, 87: false };
|
|
106
|
+
this.checklist = [];
|
|
107
|
+
this.favoriteList = [];
|
|
108
|
+
this.checklistSorted = [];
|
|
109
|
+
this.searchResults = [];
|
|
110
|
+
}
|
|
111
|
+
async setData(_data = []) {
|
|
112
|
+
this.clearAndSelectSearch(false);
|
|
113
|
+
this.isLoading(true);
|
|
114
|
+
this.isSetData = true;
|
|
115
|
+
this.checkedObjectList = [];
|
|
116
|
+
this.selectedId = null;
|
|
117
|
+
setTimeout(() => {
|
|
118
|
+
this._items = _data;
|
|
119
|
+
this.searchData = JSON.parse(_data);
|
|
120
|
+
this.calculateMinSizes();
|
|
121
|
+
this.handleChildProcess();
|
|
122
|
+
}, 100);
|
|
123
|
+
return Promise.resolve(true);
|
|
124
|
+
}
|
|
125
|
+
async getChecklist() {
|
|
126
|
+
return this.checkedObjectList;
|
|
127
|
+
}
|
|
128
|
+
async getFavorites() {
|
|
129
|
+
this.getChildItem(this.el).forEach(element => {
|
|
130
|
+
element[this.objectMapping['favorite']] == true && (this.favIconOnlyChilds && element[this.objectMapping['items']].length == 0 && (this.favoriteList.indexOf(element.itemObject) < 0 && (this.favoriteList.push(element.itemObject))),
|
|
131
|
+
!this.favIconOnlyChilds && (this.favoriteList.indexOf(element.itemObject) < 0 && (this.favoriteList.push(element.itemObject))));
|
|
132
|
+
});
|
|
133
|
+
return this.favoriteList;
|
|
134
|
+
}
|
|
135
|
+
async selected(id) {
|
|
136
|
+
this.selectedId = id;
|
|
137
|
+
}
|
|
138
|
+
async clearAndSelectSearch(select = true) {
|
|
139
|
+
this.runClearAndSelect = true;
|
|
140
|
+
if (this.search === true) {
|
|
141
|
+
setTimeout(() => {
|
|
142
|
+
var searchInput = null;
|
|
143
|
+
searchInput = this.el.shadowRoot.querySelector("bcm-old-search");
|
|
144
|
+
if (searchInput) {
|
|
145
|
+
searchInput.setClear();
|
|
146
|
+
if (select == true) {
|
|
147
|
+
searchInput.select();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}, 100);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
async addChecked(items = []) {
|
|
154
|
+
this.checkedList = items;
|
|
155
|
+
}
|
|
156
|
+
async updateChecked(items = []) {
|
|
157
|
+
this.updateCheckedList = items;
|
|
158
|
+
}
|
|
159
|
+
async config(_config) {
|
|
160
|
+
if (_config['maxHeight']) {
|
|
161
|
+
typeof _config['maxHeight'] == 'string'
|
|
162
|
+
? this.maxHeight = _config['maxHeight']
|
|
163
|
+
: this.maxHeight = "100%";
|
|
164
|
+
}
|
|
165
|
+
if (_config['searchFields']) {
|
|
166
|
+
if (Array.isArray(_config['searchFields'])) {
|
|
167
|
+
this.searchFields = _config['searchFields'];
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (_config['searchable']) {
|
|
171
|
+
typeof _config['searchable'] == 'boolean'
|
|
172
|
+
? this.search = _config['searchable']
|
|
173
|
+
: this.search = false;
|
|
174
|
+
}
|
|
175
|
+
if (_config['searchOnlyChild']) {
|
|
176
|
+
typeof _config['searchOnlyChild'] == 'boolean'
|
|
177
|
+
? this.searchOnlyChild = _config['searchOnlyChild']
|
|
178
|
+
: this.searchOnlyChild = false;
|
|
179
|
+
}
|
|
180
|
+
if (_config['searchPlaceholder']) {
|
|
181
|
+
typeof _config['searchPlaceholder'] == 'string'
|
|
182
|
+
? this.searchPlaceholder = _config['searchPlaceholder']
|
|
183
|
+
: this.searchPlaceholder = null;
|
|
184
|
+
}
|
|
185
|
+
if (_config['fullWidth']) {
|
|
186
|
+
typeof _config['fullWidth'] == 'boolean'
|
|
187
|
+
? this.fullWidth = _config['fullWidth']
|
|
188
|
+
: this.fullWidth = false;
|
|
189
|
+
}
|
|
190
|
+
if (_config['infoFooter']) {
|
|
191
|
+
typeof _config['infoFooter'] == 'boolean'
|
|
192
|
+
? this.infoFooter = _config['infoFooter']
|
|
193
|
+
: this.infoFooter = false;
|
|
194
|
+
}
|
|
195
|
+
if (_config['highlight']) {
|
|
196
|
+
typeof _config['highlight'] == 'boolean'
|
|
197
|
+
? this.highlight = _config['highlight']
|
|
198
|
+
: this.highlight = false;
|
|
199
|
+
}
|
|
200
|
+
if (_config['checkable']) {
|
|
201
|
+
typeof _config['checkable'] == 'boolean'
|
|
202
|
+
? this.checkboxes = _config['checkable']
|
|
203
|
+
: this.checkboxes = false;
|
|
204
|
+
}
|
|
205
|
+
if (_config['showIcon']) {
|
|
206
|
+
typeof _config['showIcon'] == 'boolean'
|
|
207
|
+
? this.showIcon = _config['showIcon']
|
|
208
|
+
: this.showIcon = false;
|
|
209
|
+
}
|
|
210
|
+
if (_config['favIcon']) {
|
|
211
|
+
typeof _config['favIcon'] == 'boolean'
|
|
212
|
+
? this.favIcon = _config['favIcon']
|
|
213
|
+
: this.favIcon = false;
|
|
214
|
+
}
|
|
215
|
+
if (_config['favIconOnlyChilds']) {
|
|
216
|
+
typeof _config['favIconOnlyChilds'] == 'boolean'
|
|
217
|
+
? this.favIconOnlyChilds = _config['favIconOnlyChilds']
|
|
218
|
+
: this.favIconOnlyChilds = false;
|
|
219
|
+
}
|
|
220
|
+
if (_config['allOpen']) {
|
|
221
|
+
typeof _config['allOpen'] == 'boolean'
|
|
222
|
+
? this.allOpen = _config['allOpen']
|
|
223
|
+
: this.allOpen = false;
|
|
224
|
+
}
|
|
225
|
+
this.allOpenCache = this.allOpen;
|
|
226
|
+
if (_config['size']) {
|
|
227
|
+
(["small", "medium", "large"].indexOf(_config['size']) >= 0)
|
|
228
|
+
? this.size = _config['size']
|
|
229
|
+
: this.size = 'medium';
|
|
230
|
+
}
|
|
231
|
+
if (_config['mapping']) {
|
|
232
|
+
if (_config['mapping']['text']) {
|
|
233
|
+
this.objectMapping['text'] = _config['mapping']['text'];
|
|
234
|
+
}
|
|
235
|
+
if (_config['mapping']['icon']) {
|
|
236
|
+
this.objectMapping['icon'] = _config['mapping']['icon'];
|
|
237
|
+
}
|
|
238
|
+
if (_config['mapping']['id']) {
|
|
239
|
+
this.objectMapping['id'] = _config['mapping']['id'];
|
|
240
|
+
this.returnField = this.objectMapping['id'];
|
|
241
|
+
}
|
|
242
|
+
if (_config['mapping']['items']) {
|
|
243
|
+
this.objectMapping['items'] = _config['mapping']['items'];
|
|
244
|
+
this.searchSub = this.objectMapping['items'];
|
|
245
|
+
}
|
|
246
|
+
if (_config['mapping']['open']) {
|
|
247
|
+
this.objectMapping['open'] = _config['mapping']['open'];
|
|
248
|
+
}
|
|
249
|
+
if (_config['mapping']['selected']) {
|
|
250
|
+
this.objectMapping['selected'] = _config['mapping']['selected'];
|
|
251
|
+
}
|
|
252
|
+
if (_config['mapping']['checked']) {
|
|
253
|
+
this.objectMapping['checked'] = _config['mapping']['checked'];
|
|
254
|
+
}
|
|
255
|
+
if (_config['mapping']['tooltipText']) {
|
|
256
|
+
this.objectMapping['tooltipText'] = _config['mapping']['tooltipText'];
|
|
257
|
+
}
|
|
258
|
+
if (_config['mapping']['disabled']) {
|
|
259
|
+
this.objectMapping['disabled'] = _config['mapping']['disabled'];
|
|
260
|
+
}
|
|
261
|
+
if (_config['mapping']['favorite']) {
|
|
262
|
+
this.objectMapping['favorite'] = _config['mapping']['favorite'];
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
// sessionStorage.setItem(this._internal_id + "-config", JSON.stringify(_config));
|
|
266
|
+
return Promise.resolve(true);
|
|
267
|
+
}
|
|
268
|
+
calculateMinSizes() {
|
|
269
|
+
if (this.minHeight < this.el.clientHeight) {
|
|
270
|
+
this.minHeight = this.el.clientHeight;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
connectedCallback() { }
|
|
274
|
+
componentWillLoad() { }
|
|
275
|
+
componentWillRender() {
|
|
276
|
+
if (sessionStorage.getItem(this._internal_id + "-config")) {
|
|
277
|
+
this.config(JSON.parse(sessionStorage.getItem(this._internal_id + "-config")));
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
componentDidRender() {
|
|
281
|
+
// this.isEmpty(true)
|
|
282
|
+
// if(this.total > 0) {
|
|
283
|
+
// this.isEmpty(false)
|
|
284
|
+
// }
|
|
285
|
+
}
|
|
286
|
+
// componentDidLoad(){
|
|
287
|
+
// this.handleChildProcess()
|
|
288
|
+
// setTimeout(() => {
|
|
289
|
+
// if(this.isSetData) {
|
|
290
|
+
// this.isLoading(true)
|
|
291
|
+
// this.isEmpty(false)
|
|
292
|
+
// }else{
|
|
293
|
+
// this.isLoading(false)
|
|
294
|
+
// this.isEmpty(true)
|
|
295
|
+
// }
|
|
296
|
+
// }, 1000);
|
|
297
|
+
// // this.isEmpty(true)
|
|
298
|
+
// }
|
|
299
|
+
componentWillUpdate() { }
|
|
300
|
+
// componentWillRender(){}
|
|
301
|
+
// componentDidRender(){}
|
|
302
|
+
componentDidUpdate() {
|
|
303
|
+
if (this.checkboxes === true) {
|
|
304
|
+
this.checkedObjectList = [];
|
|
305
|
+
if (this.checklistSorted.length > 0) {
|
|
306
|
+
this.getChildItem(this.el).forEach(element => {
|
|
307
|
+
element.checked == true && (this.checkedObjectList.indexOf(element.itemObject) < 0 && (this.checkedObjectList.push(element.itemObject)));
|
|
308
|
+
});
|
|
309
|
+
this.treeviewChecklist.emit(this.checkedObjectList);
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
this.treeviewChecklist.emit([]);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
parseItems(newValue) {
|
|
317
|
+
if (newValue) {
|
|
318
|
+
typeof newValue == 'string'
|
|
319
|
+
? this.items = JSON.parse(newValue)
|
|
320
|
+
: this.items = newValue;
|
|
321
|
+
}
|
|
322
|
+
this.handleChildProcess();
|
|
323
|
+
}
|
|
324
|
+
handleChildProcess() {
|
|
325
|
+
setTimeout(() => {
|
|
326
|
+
this.allChilds = this.getAllChilds();
|
|
327
|
+
this.total = this.allChilds.filter((v, i, a) => a.indexOf(v) === i).length;
|
|
328
|
+
if (this.total > 0) {
|
|
329
|
+
// setTimeout(() => {
|
|
330
|
+
this.isLoading(false);
|
|
331
|
+
// }, 100);
|
|
332
|
+
this.isEmpty(false);
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
// setTimeout(() => {
|
|
336
|
+
this.isLoading(false);
|
|
337
|
+
this.isEmpty(true);
|
|
338
|
+
// }, 100);
|
|
339
|
+
}
|
|
340
|
+
}, 100);
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* @desc
|
|
344
|
+
* @param group
|
|
345
|
+
*/
|
|
346
|
+
recursiveItemRenderer(group, parentGroup) {
|
|
347
|
+
const sId = String(this.selectedId);
|
|
348
|
+
const gId = String(group[this.objectMapping['id']]);
|
|
349
|
+
const isSelected = String(group[this.objectMapping['selected']]) === 'true' ? true : false;
|
|
350
|
+
if (sId === gId || isSelected) {
|
|
351
|
+
this.treeviewItemSelected.emit(group);
|
|
352
|
+
}
|
|
353
|
+
return (h("bcm-treeview-item", Object.assign({ _internal_id: this._internal_id, text: group[this.objectMapping['text']], icon: group[this.objectMapping['icon']], id: group[this.objectMapping['id']], size: this.size, "has-child": !!group[this.objectMapping['items']] }, (parentGroup && { 'parent-id': parentGroup[this.objectMapping['id']] }), (group[this.objectMapping['tooltipText']] && { tooltipText: group[this.objectMapping['tooltipText']] }), (String(group[this.objectMapping['checked']]) === "true" && { checkTrigger: true }), (String(group[this.objectMapping['open']]) === "true" && { open: true }), (String(group[this.objectMapping['selected']]) === "true" && { selected: true }), (String(group[this.objectMapping['disabled']]) === "true" && { disabled: true }), (group[this.objectMapping['items']] && { items: group[this.objectMapping['items']] }), (this.favIcon && !this.favIconOnlyChilds && { favicon: true }), (this.favIcon && this.favIconOnlyChilds && group[this.objectMapping['items']].length == 0 && { favicon: true }), (this.favIcon && group.rightSlot && { favorite: group.rightSlot[this.objectMapping['favorite']] }), (this.showIcon && { showIcon: true }), (String(this.checkboxes) === "true" && { checkboxes: true }), ((this.allOpen || this.allOpenOnSearch) && { open: true }), { itemObject: group }, ((this.checkedList && this.checkedList.find(e => e == group[this.objectMapping['id']]))) && { checkTrigger: true }, (this.updateCheckedList.length > 0 &&
|
|
354
|
+
((this.updateCheckedList.find(e => e == group[this.objectMapping['id']])) && { checkTrigger: true }))), group[this.objectMapping['items']] && group[this.objectMapping['items']].map((item) => (this.recursiveItemRenderer(item, group)))));
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* @desc
|
|
358
|
+
*/
|
|
359
|
+
handleCheckList(process = 'add', checkId) {
|
|
360
|
+
// console.log(checkId)
|
|
361
|
+
if (this.checkboxes === true) {
|
|
362
|
+
// const { checklist } = this
|
|
363
|
+
// checkId = Number(checkId)
|
|
364
|
+
switch (process) {
|
|
365
|
+
case 'add':
|
|
366
|
+
if (this.checklist.length > 0) {
|
|
367
|
+
this.checklist.indexOf(checkId) < 0 && (this.checklist = [...this.checklist, checkId]);
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
this.checklist = [checkId];
|
|
371
|
+
}
|
|
372
|
+
break;
|
|
373
|
+
case 'remove':
|
|
374
|
+
this.checklist = this.checklist.filter(item => item !== checkId);
|
|
375
|
+
break;
|
|
376
|
+
}
|
|
377
|
+
let sorted = this.checklist.sort(function (a, b) { return a - b; });
|
|
378
|
+
this.checklistSorted = sorted;
|
|
379
|
+
// console.log('sorted: ', sorted)
|
|
380
|
+
this.checkCount = this.checklistSorted.length;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
async showSearchMethod(val = true) {
|
|
384
|
+
this.showSearch = val;
|
|
385
|
+
// return val
|
|
386
|
+
}
|
|
387
|
+
async searchResultMethod(items = []) {
|
|
388
|
+
// this.listenSearchResult({ detail: items })
|
|
389
|
+
await customElements.whenDefined("bcm-old-search");
|
|
390
|
+
const search = this.el.shadowRoot.querySelector("bcm-old-search");
|
|
391
|
+
const detail = await search.searchArray(items, this.objectMapping['id']);
|
|
392
|
+
await this.listenSearchResult({ detail: detail });
|
|
393
|
+
// return true
|
|
394
|
+
}
|
|
395
|
+
isLoading(val) {
|
|
396
|
+
var treeview = this.el.shadowRoot.getElementById("treeview");
|
|
397
|
+
var loading = this.el.shadowRoot.getElementById("loading");
|
|
398
|
+
var searchInput = this.el.shadowRoot.querySelector("bcm-old-search");
|
|
399
|
+
// var listcontainer = this.el.shadowRoot.getElementById("list-container")
|
|
400
|
+
if (val === true) {
|
|
401
|
+
treeview && treeview.classList.add('loading');
|
|
402
|
+
loading && loading.classList.add('show');
|
|
403
|
+
if (searchInput) {
|
|
404
|
+
searchInput.disabled = true;
|
|
405
|
+
}
|
|
406
|
+
// listcontainer && listcontainer.classList.add('hidden')
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
treeview && treeview.classList.remove('loading');
|
|
410
|
+
loading && loading.classList.remove('show');
|
|
411
|
+
if (searchInput) {
|
|
412
|
+
searchInput.disabled = false;
|
|
413
|
+
}
|
|
414
|
+
// listcontainer && listcontainer.classList.remove('hidden')
|
|
415
|
+
}
|
|
416
|
+
return false;
|
|
417
|
+
}
|
|
418
|
+
isEmpty(val) {
|
|
419
|
+
var empty = this.el.shadowRoot.getElementById("empty");
|
|
420
|
+
// var listcontainer = this.el.shadowRoot.getElementById("list-container")
|
|
421
|
+
if (val === true) {
|
|
422
|
+
empty && empty.classList.add('show');
|
|
423
|
+
// listcontainer && listcontainer.classList.add('hidden')
|
|
424
|
+
}
|
|
425
|
+
else {
|
|
426
|
+
empty && empty.classList.remove('show');
|
|
427
|
+
// listcontainer && listcontainer.classList.remove('hidden')
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
isSearchCount(val = null) {
|
|
431
|
+
if (this.infoFooter === true) {
|
|
432
|
+
var inSearch = this.el.shadowRoot.getElementById("in-search");
|
|
433
|
+
var inTotal = this.el.shadowRoot.getElementById("in-total");
|
|
434
|
+
if (val >= 0 && val != null && inSearch && inTotal) {
|
|
435
|
+
inSearch.innerHTML = val;
|
|
436
|
+
inTotal.style.display = "none";
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
inTotal.style.display = "inline";
|
|
440
|
+
inSearch.innerHTML = "";
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
// if (val > 0){
|
|
444
|
+
// this.isEmpty(false)
|
|
445
|
+
// }
|
|
446
|
+
}
|
|
447
|
+
listenSearchResult(e) {
|
|
448
|
+
this.parentLength = [];
|
|
449
|
+
var searchValue = '';
|
|
450
|
+
// this.searchResults = e.detail
|
|
451
|
+
var totalSearch = e.detail.length;
|
|
452
|
+
this.empty = false;
|
|
453
|
+
var getAllChilds = this.getAllChilds();
|
|
454
|
+
this.isEmpty(false);
|
|
455
|
+
if (e.detail.length > 0) {
|
|
456
|
+
// this.allOpenOnSearch = true
|
|
457
|
+
if (e.detail[0] == -1) {
|
|
458
|
+
totalSearch = 0;
|
|
459
|
+
this.empty = true;
|
|
460
|
+
this.isEmpty(true);
|
|
461
|
+
}
|
|
462
|
+
if (getAllChilds.length > 0) {
|
|
463
|
+
getAllChilds.map((item) => {
|
|
464
|
+
var isParent = false;
|
|
465
|
+
if (this.searchOnlyChild && item.items && item.items.length > 0) {
|
|
466
|
+
isParent = true;
|
|
467
|
+
}
|
|
468
|
+
e.target.addEventListener('bcm-on-search-value', async (e) => {
|
|
469
|
+
searchValue = await e.detail;
|
|
470
|
+
var inputText = item.shadowRoot.getElementById("text");
|
|
471
|
+
inputText = inputText.textContent || inputText.innerText || "";
|
|
472
|
+
if (searchValue) {
|
|
473
|
+
var cacheInputText = lowercase(inputText);
|
|
474
|
+
var cacheSearchValue = lowercase(searchValue);
|
|
475
|
+
var index = cacheInputText.indexOf(cacheSearchValue);
|
|
476
|
+
if (index >= 0) {
|
|
477
|
+
if (isParent == false) {
|
|
478
|
+
if (this.parentLength.indexOf(item.id) === -1) {
|
|
479
|
+
this.parentLength.push(item.id);
|
|
480
|
+
}
|
|
481
|
+
if (this.highlight) {
|
|
482
|
+
inputText = inputText.substring(0, index)
|
|
483
|
+
+ "<span class='highlight'>"
|
|
484
|
+
+ inputText.substring(index, index + searchValue.length)
|
|
485
|
+
+ "</span>"
|
|
486
|
+
+ inputText.substring(index + searchValue.length);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
item.shadowRoot.getElementById("text").innerHTML = inputText;
|
|
492
|
+
});
|
|
493
|
+
item.hidden = true;
|
|
494
|
+
var _ids = item.id;
|
|
495
|
+
if (e.detail.indexOf(_ids) >= 0) {
|
|
496
|
+
item.hidden = false;
|
|
497
|
+
item.open = true;
|
|
498
|
+
setTimeout(() => {
|
|
499
|
+
if (this.parentLength.indexOf(item.id) !== -1 && item.items && item.items.length > 0 && this.searchOnlyChild == false) {
|
|
500
|
+
const getChilds = (item) => {
|
|
501
|
+
this.getAllChilds(item).map(element => {
|
|
502
|
+
element.hidden = false;
|
|
503
|
+
element.open = true;
|
|
504
|
+
getChilds(element);
|
|
505
|
+
});
|
|
506
|
+
};
|
|
507
|
+
getChilds(item);
|
|
508
|
+
}
|
|
509
|
+
}, 1);
|
|
510
|
+
}
|
|
511
|
+
else {
|
|
512
|
+
item.hidden = true;
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
else {
|
|
518
|
+
// this.allOpenOnSearch = this.allOpenCache
|
|
519
|
+
if (getAllChilds.length > 0) {
|
|
520
|
+
getAllChilds.map((item) => {
|
|
521
|
+
item.hidden = false;
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
// this.isEmpty(true)
|
|
525
|
+
}
|
|
526
|
+
// if ( this.searchOnlyChild ) {
|
|
527
|
+
// this.isSearchCount(highlightLength)
|
|
528
|
+
// }else{
|
|
529
|
+
setTimeout(() => {
|
|
530
|
+
if (totalSearch >= 0) {
|
|
531
|
+
var totals = totalSearch - Number(totalSearch - this.parentLength.length);
|
|
532
|
+
this.isSearchCount(totals > 0 ? totals : 0);
|
|
533
|
+
}
|
|
534
|
+
else {
|
|
535
|
+
this.isSearchCount();
|
|
536
|
+
}
|
|
537
|
+
if (e.detail[0] === -1) {
|
|
538
|
+
this.isSearchCount(0);
|
|
539
|
+
}
|
|
540
|
+
if (e.detail === true) {
|
|
541
|
+
this.isSearchCount();
|
|
542
|
+
}
|
|
543
|
+
}, 100);
|
|
544
|
+
// }
|
|
545
|
+
if (e.detail === true) {
|
|
546
|
+
this.isEmpty(false);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
getAllChilds(element = this.el) {
|
|
550
|
+
let returnAllItems = [];
|
|
551
|
+
getChilds(element, 'bcm-treeview-item').forEach(items => {
|
|
552
|
+
this.getAllChilds(items) && (returnAllItems.indexOf(items) < 0 && (returnAllItems.push(items))
|
|
553
|
+
// returnAllItems = [...returnAllItems, ...this.getAllChilds(items)]
|
|
554
|
+
);
|
|
555
|
+
returnAllItems.indexOf(items) < 0 && (returnAllItems.push(items));
|
|
556
|
+
// returnAllItems = [...returnAllItems,
|
|
557
|
+
// items
|
|
558
|
+
// ]
|
|
559
|
+
});
|
|
560
|
+
return returnAllItems;
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* @desc
|
|
564
|
+
*/
|
|
565
|
+
handletreeviewItemSelected(event) {
|
|
566
|
+
this.treeviewClearSelecteds.emit(event.detail);
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* @desc
|
|
570
|
+
*/
|
|
571
|
+
handletreeviewChecked(event) {
|
|
572
|
+
// this.treeviewSendCheck.emit(event.detail)
|
|
573
|
+
this.handleCheckList('add', event.detail);
|
|
574
|
+
// this.treeviewChange.emit(event.detail)
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* @desc
|
|
578
|
+
*/
|
|
579
|
+
// @Listen('bcm-treeview-check-group-check')
|
|
580
|
+
// bcmTreeviewCheckGroupChecked(event: any) {
|
|
581
|
+
// console.log(event)
|
|
582
|
+
// this.treeviewSendCheck.emit(event.detail)
|
|
583
|
+
// this.handleCheckList('add',event.detail)
|
|
584
|
+
// this.treeviewChange.emit(event.detail)
|
|
585
|
+
// }
|
|
586
|
+
/**
|
|
587
|
+
* @desc
|
|
588
|
+
*/
|
|
589
|
+
handletreeviewUnchecked(event) {
|
|
590
|
+
// this.treeviewSendUncheck.emit(event.detail)
|
|
591
|
+
this.handleCheckList('remove', event.detail);
|
|
592
|
+
// this.treeviewChange.emit(event.detail)
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* @desc
|
|
596
|
+
*/
|
|
597
|
+
handletreeviewIndeterminateChecked(event) {
|
|
598
|
+
this.handleCheckList('add', event.detail);
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* @desc
|
|
602
|
+
*/
|
|
603
|
+
handletreeviewIndeterminateUnchecked(event) {
|
|
604
|
+
this.handleCheckList('remove', event.detail);
|
|
605
|
+
}
|
|
606
|
+
treeviewUncheckedMethod(item) {
|
|
607
|
+
this.handletreeviewUnchecked({ "detail": item });
|
|
608
|
+
this.componentDidUpdate();
|
|
609
|
+
return Promise.resolve(true);
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* @desc
|
|
613
|
+
* Keyboard Navigation
|
|
614
|
+
*/
|
|
615
|
+
getIndex(item) {
|
|
616
|
+
return Array.from(item.parentNode.children).indexOf(item);
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* @desc
|
|
620
|
+
* Keyboard Navigation
|
|
621
|
+
*/
|
|
622
|
+
getNext(item) {
|
|
623
|
+
let returnItem = this.getChildItem(item.parentElement)[this.getIndex(item) + 1];
|
|
624
|
+
if (returnItem)
|
|
625
|
+
return returnItem;
|
|
626
|
+
return false;
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* @desc
|
|
630
|
+
* Keyboard Navigation
|
|
631
|
+
*/
|
|
632
|
+
getPrev(item) {
|
|
633
|
+
let returnItem = this.getChildItem(item.parentElement)[this.getIndex(item) - 1];
|
|
634
|
+
if (returnItem)
|
|
635
|
+
return returnItem;
|
|
636
|
+
return false;
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* @desc
|
|
640
|
+
* Keyboard Navigation
|
|
641
|
+
*/
|
|
642
|
+
getParent(item) {
|
|
643
|
+
if (lowercase(item.parentElement.tagName) == 'bcm-treeview') {
|
|
644
|
+
return false;
|
|
645
|
+
}
|
|
646
|
+
else {
|
|
647
|
+
return this.getChildItem(item.parentElement.parentElement)[this.getIndex(item.parentElement)];
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* @desc
|
|
652
|
+
* Keyboard Navigation
|
|
653
|
+
*/
|
|
654
|
+
getNextParent(item) {
|
|
655
|
+
let getParent = this.getParent(item);
|
|
656
|
+
let getNext;
|
|
657
|
+
if (getParent) {
|
|
658
|
+
getNext = this.getNext(getParent);
|
|
659
|
+
if (getNext) {
|
|
660
|
+
return getNext;
|
|
661
|
+
}
|
|
662
|
+
else {
|
|
663
|
+
return this.getNextParent(getParent);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* @desc
|
|
669
|
+
* Keyboard Navigation
|
|
670
|
+
*/
|
|
671
|
+
getFirstItem(el = this.el) {
|
|
672
|
+
return this.getChildItem(el)[0];
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* @desc
|
|
676
|
+
* Keyboard Navigation
|
|
677
|
+
*/
|
|
678
|
+
getLastItem(el = this.el) {
|
|
679
|
+
let childLength = this.getChildItem(el).length;
|
|
680
|
+
let lastChild = this.getChildItem(el)[childLength - 1];
|
|
681
|
+
if (this.getChildItem(lastChild).length > 0 && lastChild.open == true) {
|
|
682
|
+
return this.getLastItem(lastChild);
|
|
683
|
+
}
|
|
684
|
+
else {
|
|
685
|
+
return lastChild;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* @desc
|
|
690
|
+
* Keyboard Navigation
|
|
691
|
+
*/
|
|
692
|
+
getChildItem(element = this.el) {
|
|
693
|
+
let returnItems = getChilds(element, 'bcm-treeview-item');
|
|
694
|
+
if (returnItems)
|
|
695
|
+
return returnItems;
|
|
696
|
+
return 0;
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* @desc
|
|
700
|
+
*/
|
|
701
|
+
handleRightClick(e) {
|
|
702
|
+
this.treeviewShowContext.emit([e.target.id, e.clientY, e.clientX]);
|
|
703
|
+
e.preventDefault();
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* @desc
|
|
707
|
+
*/
|
|
708
|
+
keyboardNavigationUp(e) {
|
|
709
|
+
let { keyMapForFocus } = this;
|
|
710
|
+
if (e.keyCode in keyMapForFocus) {
|
|
711
|
+
keyMapForFocus[e.keyCode] = false;
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* @desc
|
|
716
|
+
*/
|
|
717
|
+
keyboardNavigation(e) {
|
|
718
|
+
if (this.keydown) {
|
|
719
|
+
const { keyMapForFocus, focusedElement, el } = this;
|
|
720
|
+
this.focusedElement = !focusedElement ? el : focusedElement;
|
|
721
|
+
const which = e.which || 0;
|
|
722
|
+
if (this.getChildItem(el).length > 0) {
|
|
723
|
+
if (e.keyCode in keyMapForFocus) {
|
|
724
|
+
keyMapForFocus[e.keyCode] = true;
|
|
725
|
+
if (keyMapForFocus[18] && keyMapForFocus[87]) {
|
|
726
|
+
e.preventDefault();
|
|
727
|
+
this.focusedElement = this.getFirstItem(this.focusedElement);
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
if (which == 9 || //tab
|
|
731
|
+
which == 13 || //enter
|
|
732
|
+
which == 18 || //alt
|
|
733
|
+
which == 32 || //space
|
|
734
|
+
which == 35 || // end
|
|
735
|
+
which == 36 || // home
|
|
736
|
+
(which >= 35 && which <= 40) //end, home, left arrow, up arrow, right arrow, down arrow
|
|
737
|
+
) {
|
|
738
|
+
e.preventDefault();
|
|
739
|
+
if (!focusedElement) {
|
|
740
|
+
this.focusedElement = this.getFirstItem(this.focusedElement);
|
|
741
|
+
}
|
|
742
|
+
else {
|
|
743
|
+
this.focusedElement.focused = false;
|
|
744
|
+
switch (which) {
|
|
745
|
+
case 13: // enter
|
|
746
|
+
this.focusedElement.selected = true;
|
|
747
|
+
break;
|
|
748
|
+
case 32: // space
|
|
749
|
+
this.focusedElement.checked && (this.treeviewUnchecked.emit(this.focusedElement.id)) || (this.treeviewChecked.emit(this.focusedElement.id));
|
|
750
|
+
break;
|
|
751
|
+
case 35: // end
|
|
752
|
+
this.focusedElement = this.getLastItem(this.focusedElement.parentElement);
|
|
753
|
+
break;
|
|
754
|
+
case 36: // home
|
|
755
|
+
this.focusedElement = this.getFirstItem(this.focusedElement.parentElement);
|
|
756
|
+
break;
|
|
757
|
+
case 37: // left arrow
|
|
758
|
+
if (this.getChildItem(this.focusedElement).length > 0 && this.focusedElement.open == true) {
|
|
759
|
+
this.focusedElement.open = false;
|
|
760
|
+
}
|
|
761
|
+
else {
|
|
762
|
+
if (this.getParent(this.focusedElement)) {
|
|
763
|
+
this.focusedElement = this.getParent(this.focusedElement);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
break;
|
|
767
|
+
case 38: // up arrow
|
|
768
|
+
if (this.getPrev(this.focusedElement)) {
|
|
769
|
+
this.focusedElement = this.getPrev(this.focusedElement);
|
|
770
|
+
if (this.getChildItem(this.focusedElement).length > 0 && this.focusedElement.open == true) {
|
|
771
|
+
this.focusedElement = this.getLastItem(this.focusedElement);
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
else if (this.getParent(this.focusedElement)) {
|
|
775
|
+
this.focusedElement = this.getParent(this.focusedElement);
|
|
776
|
+
}
|
|
777
|
+
break;
|
|
778
|
+
case 39: // right arrow
|
|
779
|
+
if (this.getChildItem(this.focusedElement).length > 0) {
|
|
780
|
+
if (this.focusedElement.open == true) {
|
|
781
|
+
this.focusedElement = this.getFirstItem(this.focusedElement);
|
|
782
|
+
}
|
|
783
|
+
else {
|
|
784
|
+
this.focusedElement.open = true;
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
break;
|
|
788
|
+
case 40: // down arrow
|
|
789
|
+
if (this.getChildItem(this.focusedElement).length > 0 && this.focusedElement.open == true) {
|
|
790
|
+
this.focusedElement = this.getFirstItem(this.focusedElement);
|
|
791
|
+
}
|
|
792
|
+
else if (this.getNext(this.focusedElement)) {
|
|
793
|
+
this.focusedElement = this.getNext(this.focusedElement);
|
|
794
|
+
}
|
|
795
|
+
else if (this.getNextParent(this.focusedElement)) {
|
|
796
|
+
this.focusedElement = this.getNextParent(this.focusedElement);
|
|
797
|
+
}
|
|
798
|
+
break;
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
if (this.focusedElement)
|
|
803
|
+
this.focusedElement.focused = true;
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
handleFocus(focusEvent = false) {
|
|
808
|
+
this.onFocus = focusEvent;
|
|
809
|
+
}
|
|
810
|
+
render() {
|
|
811
|
+
const { searchOnlyChild, searchPlaceholder, search, checkCount, searchData, searchFields, searchSub, returnField, total, fullWidth, infoFooter, showSearch } = this;
|
|
812
|
+
const hostClasses = classnames(this.hidden ? 'hidden' : null, {
|
|
813
|
+
'empty': this.empty,
|
|
814
|
+
'full-width': fullWidth
|
|
815
|
+
});
|
|
816
|
+
const customStyles = {
|
|
817
|
+
// 'min-height': this.minHeight + 'px',
|
|
818
|
+
'min-width': this.minWidth + 'px',
|
|
819
|
+
'max-height': this.maxHeight
|
|
820
|
+
};
|
|
821
|
+
return (h(Host, { class: hostClasses, style: customStyles }, search && (h("div", { class: "search", style: { 'display': String(showSearch) == 'false' ? 'none' : 'block' } }, h("bcm-old-search", { onlyChild: searchOnlyChild, searchPlaceholder: searchPlaceholder, "on-bcm-focus": () => this.handleFocus(true), "on-bcm-blur": () => this.handleFocus(false), data: searchData, returnField: returnField, searchFields: searchFields, searchSub: searchSub, clearable: true }), h("bcm-divider", null))), h("div", { id: "treeview", class: "treeview loading" },
|
|
822
|
+
// this.loading && (
|
|
823
|
+
h("div", { id: "loading", class: "loading show" }, h("bcm-icon", { class: "prefix", icon: "far fa-spinner-third fa-spin" }))
|
|
824
|
+
// )
|
|
825
|
+
,
|
|
826
|
+
// this.empty && (
|
|
827
|
+
h("div", { id: "empty", class: "empty" }, h("bcm-empty", null, "No Data"))
|
|
828
|
+
// )
|
|
829
|
+
, !this.empty && this.items.length !== 0 && this.items.map((item) => (this.recursiveItemRenderer(item, null)))), infoFooter == true && (h("footer", null, h("bcm-text", { scale: "size-1", color: "grey-8" }, checkCount > 0 && ('( ' + checkCount + ' items selected ) '), "Total ", h("span", { id: "in-search" }), " ", h("span", { id: "in-total" }, total), " items found.")))));
|
|
830
|
+
}
|
|
831
|
+
get el() { return this; }
|
|
832
|
+
static get watchers() { return {
|
|
833
|
+
"_items": ["parseItems"]
|
|
834
|
+
}; }
|
|
835
|
+
static get style() { return treeviewCss; }
|
|
836
|
+
}, [1, "bcm-treeview", {
|
|
837
|
+
"checkboxes": [1028],
|
|
838
|
+
"showIcon": [1028, "show-icon"],
|
|
839
|
+
"size": [1025],
|
|
840
|
+
"selectedId": [1025, "selected-id"],
|
|
841
|
+
"checkedList": [1040],
|
|
842
|
+
"updateCheckedList": [1040],
|
|
843
|
+
"hidden": [1028],
|
|
844
|
+
"search": [1028],
|
|
845
|
+
"searchOnlyChild": [1028, "search-only-child"],
|
|
846
|
+
"keydown": [1028],
|
|
847
|
+
"allOpen": [1028, "all-open"],
|
|
848
|
+
"fullWidth": [1028, "full-width"],
|
|
849
|
+
"infoFooter": [1028, "info-footer"],
|
|
850
|
+
"searchFields": [1040],
|
|
851
|
+
"searchSub": [1025, "search-sub"],
|
|
852
|
+
"returnField": [1025, "return-field"],
|
|
853
|
+
"_items": [1025, "data"],
|
|
854
|
+
"searchPlaceholder": [1025, "searchplaceholder"],
|
|
855
|
+
"maxHeight": [1025, "max-height"],
|
|
856
|
+
"highlight": [1028],
|
|
857
|
+
"loading": [1028],
|
|
858
|
+
"favIcon": [1028, "fav-icon"],
|
|
859
|
+
"favIconOnlyChilds": [1028, "fav-icon-only-childs"],
|
|
860
|
+
"_internal_id": [1537],
|
|
861
|
+
"showSearch": [32],
|
|
862
|
+
"items": [32],
|
|
863
|
+
"total": [32],
|
|
864
|
+
"checkCount": [32],
|
|
865
|
+
"focusedElement": [32],
|
|
866
|
+
"keyMapForFocus": [32],
|
|
867
|
+
"checklist": [32],
|
|
868
|
+
"favoriteList": [32],
|
|
869
|
+
"checklistSorted": [32],
|
|
870
|
+
"searchData": [32],
|
|
871
|
+
"searchResults": [32],
|
|
872
|
+
"setData": [64],
|
|
873
|
+
"getChecklist": [64],
|
|
874
|
+
"getFavorites": [64],
|
|
875
|
+
"selected": [64],
|
|
876
|
+
"clearAndSelectSearch": [64],
|
|
877
|
+
"addChecked": [64],
|
|
878
|
+
"updateChecked": [64],
|
|
879
|
+
"config": [64],
|
|
880
|
+
"showSearchMethod": [64],
|
|
881
|
+
"searchResultMethod": [64],
|
|
882
|
+
"treeviewUncheckedMethod": [64]
|
|
883
|
+
}, [[0, "bcm-on-search", "listenSearchResult"], [0, "bcm-treeview-item-selected", "handletreeviewItemSelected"], [0, "bcm-treeview-checked", "handletreeviewChecked"], [0, "bcm-treeview-unchecked", "handletreeviewUnchecked"], [0, "bcm-treeview-indeterminate-checked", "handletreeviewIndeterminateChecked"], [0, "bcm-treeview-indeterminate-unchecked", "handletreeviewIndeterminateUnchecked"], [0, "contextmenu", "handleRightClick"], [4, "keyup", "keyboardNavigationUp"], [4, "keydown", "keyboardNavigation"]]]);
|
|
884
|
+
__decorate([
|
|
885
|
+
IsLoad()
|
|
886
|
+
], Bcmtreeview.prototype, "el", void 0);
|
|
887
|
+
function defineCustomElement() {
|
|
888
|
+
if (typeof customElements === "undefined") {
|
|
889
|
+
return;
|
|
890
|
+
}
|
|
891
|
+
const components = ["bcm-treeview", "bcm-checkbox", "bcm-divider", "bcm-empty", "bcm-icon", "bcm-label", "bcm-old-input", "bcm-old-search", "bcm-text", "bcm-tooltip", "bcm-treeview-item", "bcm-typography"];
|
|
892
|
+
components.forEach(tagName => { switch (tagName) {
|
|
893
|
+
case "bcm-treeview":
|
|
894
|
+
if (!customElements.get(tagName)) {
|
|
895
|
+
customElements.define(tagName, Bcmtreeview);
|
|
896
|
+
}
|
|
897
|
+
break;
|
|
898
|
+
case "bcm-checkbox":
|
|
899
|
+
if (!customElements.get(tagName)) {
|
|
900
|
+
defineCustomElement$b();
|
|
901
|
+
}
|
|
902
|
+
break;
|
|
903
|
+
case "bcm-divider":
|
|
904
|
+
if (!customElements.get(tagName)) {
|
|
905
|
+
defineCustomElement$a();
|
|
906
|
+
}
|
|
907
|
+
break;
|
|
908
|
+
case "bcm-empty":
|
|
909
|
+
if (!customElements.get(tagName)) {
|
|
910
|
+
defineCustomElement$9();
|
|
911
|
+
}
|
|
912
|
+
break;
|
|
913
|
+
case "bcm-icon":
|
|
914
|
+
if (!customElements.get(tagName)) {
|
|
915
|
+
defineCustomElement$8();
|
|
916
|
+
}
|
|
917
|
+
break;
|
|
918
|
+
case "bcm-label":
|
|
919
|
+
if (!customElements.get(tagName)) {
|
|
920
|
+
defineCustomElement$7();
|
|
921
|
+
}
|
|
922
|
+
break;
|
|
923
|
+
case "bcm-old-input":
|
|
924
|
+
if (!customElements.get(tagName)) {
|
|
925
|
+
defineCustomElement$6();
|
|
926
|
+
}
|
|
927
|
+
break;
|
|
928
|
+
case "bcm-old-search":
|
|
929
|
+
if (!customElements.get(tagName)) {
|
|
930
|
+
defineCustomElement$5();
|
|
931
|
+
}
|
|
932
|
+
break;
|
|
933
|
+
case "bcm-text":
|
|
934
|
+
if (!customElements.get(tagName)) {
|
|
935
|
+
defineCustomElement$4();
|
|
936
|
+
}
|
|
937
|
+
break;
|
|
938
|
+
case "bcm-tooltip":
|
|
939
|
+
if (!customElements.get(tagName)) {
|
|
940
|
+
defineCustomElement$3();
|
|
941
|
+
}
|
|
942
|
+
break;
|
|
943
|
+
case "bcm-treeview-item":
|
|
944
|
+
if (!customElements.get(tagName)) {
|
|
945
|
+
defineCustomElement$2();
|
|
946
|
+
}
|
|
947
|
+
break;
|
|
948
|
+
case "bcm-typography":
|
|
949
|
+
if (!customElements.get(tagName)) {
|
|
950
|
+
defineCustomElement$1();
|
|
951
|
+
}
|
|
952
|
+
break;
|
|
953
|
+
} });
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
export { Bcmtreeview as B, defineCustomElement as d };
|