bromcom-ui 2.3.46 → 2.3.50
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/bromcom-ui/bromcom-ui.esm.js +1 -1
- package/dist/bromcom-ui/{p-21acf1de.js → p-09753e05.js} +1 -1
- package/dist/bromcom-ui/{p-b6c0d182.entry.js → p-1a2724a0.entry.js} +1 -1
- package/dist/bromcom-ui/{p-09b8803d.entry.js → p-26b3d5d0.entry.js} +1 -1
- package/dist/bromcom-ui/{p-61cde6d6.entry.js → p-2c1ee381.entry.js} +1 -1
- package/dist/bromcom-ui/p-31e2a0d5.entry.js +1 -0
- package/dist/bromcom-ui/{p-192301be.entry.js → p-3704fffd.entry.js} +1 -1
- package/dist/bromcom-ui/{p-180a8dbf.entry.js → p-4396ee3b.entry.js} +1 -1
- package/dist/bromcom-ui/{p-c16d4f4f.entry.js → p-4a296c0a.entry.js} +1 -1
- package/dist/bromcom-ui/{p-47c82122.entry.js → p-4b7f14ed.entry.js} +1 -1
- package/dist/bromcom-ui/{p-16735e3f.entry.js → p-774ff4d9.entry.js} +1 -1
- package/dist/bromcom-ui/{p-a51fa846.entry.js → p-a18a0cc4.entry.js} +1 -1
- package/dist/bromcom-ui/{p-ce19d569.js → p-b92324e7.js} +1 -1
- package/dist/bromcom-ui/p-dafc1ec6.entry.js +1 -0
- package/dist/bromcom-ui/p-f27776a4.entry.js +1 -0
- package/dist/cjs/{bcm-badge_18.cjs.entry.js → bcm-badge_20.cjs.entry.js} +875 -199
- package/dist/cjs/bcm-empty_6.cjs.entry.js +3 -2
- package/dist/cjs/bcm-select.cjs.entry.js +11 -8
- package/dist/cjs/bromcom-ui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/bromcom.js +8 -1
- package/dist/collection/components/atoms/button/buttons.css +1 -0
- package/dist/collection/components/molecules/list/list-item.css +188 -0
- package/dist/collection/components/molecules/list/list-item.js +12 -1
- package/dist/collection/components/molecules/list/list-select.css +82 -0
- package/dist/collection/components/molecules/list/list-select.js +399 -79
- package/dist/collection/components/molecules/list/list.css +57 -4
- package/dist/collection/components/molecules/list/list.js +700 -247
- package/dist/collection/components/molecules/modal/modal.css +7 -3
- package/dist/collection/components/molecules/radio/radio.css +2 -0
- package/dist/collection/components/molecules/select/select.js +17 -8
- package/dist/collection/components/organism/form/form.js +1 -0
- package/dist/collection/components/organism/listbox/listbox.js +2 -1
- package/dist/collection/components/organism/treeview/treeview-item.js +1 -1
- package/dist/esm/{bcm-badge_18.entry.js → bcm-badge_20.entry.js} +875 -201
- package/dist/esm/bcm-checkbox.entry.js +1 -1
- package/dist/esm/bcm-colorpicker.entry.js +2 -2
- package/dist/esm/bcm-datetime-picker_2.entry.js +2 -2
- package/dist/esm/bcm-dropdown.entry.js +1 -1
- package/dist/esm/bcm-empty_6.entry.js +4 -3
- package/dist/esm/bcm-popconfirm.entry.js +1 -1
- package/dist/esm/bcm-popover.entry.js +1 -1
- package/dist/esm/bcm-pulldown-group_2.entry.js +1 -1
- package/dist/esm/bcm-pulldown.entry.js +1 -1
- package/dist/esm/bcm-select.entry.js +12 -9
- package/dist/esm/bcm-upload.entry.js +1 -1
- package/dist/esm/bromcom-ui.js +1 -1
- package/dist/esm/{element-dragger-838e9223.js → element-dragger-03ac2a5e.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{utils-3040bca4.js → utils-b7fba7c4.js} +1 -1
- package/dist/types/components/molecules/list/list-select.d.ts +35 -4
- package/dist/types/components/molecules/list/list.d.ts +53 -11
- package/dist/types/components/molecules/list/types.d.ts +8 -0
- package/dist/types/components/molecules/select/select.d.ts +1 -0
- package/dist/types/components.d.ts +59 -19
- package/dist/types/types/index.d.ts +4 -0
- package/package.json +1 -1
- package/dist/bromcom-ui/p-6103be4a.entry.js +0 -1
- package/dist/bromcom-ui/p-865ccb94.entry.js +0 -1
- package/dist/bromcom-ui/p-d71b1744.entry.js +0 -1
- package/dist/bromcom-ui/p-ec3b5c87.entry.js +0 -1
- package/dist/bromcom-ui/p-fe565105.entry.js +0 -1
- package/dist/cjs/bcm-radio-group.cjs.entry.js +0 -124
- package/dist/cjs/bcm-radio.cjs.entry.js +0 -104
- package/dist/esm/bcm-radio-group.entry.js +0 -120
- package/dist/esm/bcm-radio.entry.js +0 -100
|
@@ -12,13 +12,21 @@ export class BcmListSelect {
|
|
|
12
12
|
this._id = (Math.random() * 4).toString(16).replace('.', '');
|
|
13
13
|
this._list_id = null;
|
|
14
14
|
this.value = null;
|
|
15
|
+
this._internal_id = (Math.random() * 4).toString(16).replace('.', '');
|
|
16
|
+
this.type = 'default';
|
|
15
17
|
this.size = 'medium';
|
|
16
18
|
this.placeholder = "Choose an option";
|
|
17
19
|
this.noCaption = false;
|
|
18
20
|
this.captionType = 'default';
|
|
19
21
|
this.fullWidth = false;
|
|
20
22
|
this.required = false;
|
|
21
|
-
this.
|
|
23
|
+
this.multiSelect = false;
|
|
24
|
+
this.searchData = null;
|
|
25
|
+
this.searchPlaceholder = "Search";
|
|
26
|
+
this.searchFields = ['text'];
|
|
27
|
+
this.returnField = "id";
|
|
28
|
+
this.searchSub = "items";
|
|
29
|
+
this.searchText = "";
|
|
22
30
|
this.captionCache = null;
|
|
23
31
|
this.captionTypeCache = null;
|
|
24
32
|
this.isOpen = false;
|
|
@@ -46,8 +54,8 @@ export class BcmListSelect {
|
|
|
46
54
|
this.selectArea = this.el.shadowRoot.querySelector(".selected-text");
|
|
47
55
|
this.selectAreaWidth = this.selectArea.clientWidth;
|
|
48
56
|
}
|
|
57
|
+
this.selectArea.style.width = "100%";
|
|
49
58
|
this.handleTagControl();
|
|
50
|
-
this.selectArea.style.width = this.selectAreaWidth - 16 + "px";
|
|
51
59
|
if (sessionStorage.getItem(this._internal_id + "-config")) {
|
|
52
60
|
this.config(JSON.parse(sessionStorage.getItem(this._internal_id + "-config")));
|
|
53
61
|
}
|
|
@@ -66,20 +74,85 @@ export class BcmListSelect {
|
|
|
66
74
|
handleBlur() {
|
|
67
75
|
this.blur.emit();
|
|
68
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* @desc
|
|
79
|
+
*/
|
|
80
|
+
async resetCaption() {
|
|
81
|
+
this.caption = this.captionCache;
|
|
82
|
+
this.captionType = this.captionTypeCache;
|
|
83
|
+
this.captionError = null;
|
|
84
|
+
}
|
|
69
85
|
/**
|
|
70
86
|
* @descc
|
|
71
87
|
*/
|
|
72
|
-
async handleOpen() {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
88
|
+
async handleOpen(list = "default") {
|
|
89
|
+
var element = null;
|
|
90
|
+
var list_id = null;
|
|
91
|
+
switch (list) {
|
|
92
|
+
case "default":
|
|
93
|
+
list_id = this._list_id;
|
|
94
|
+
break;
|
|
95
|
+
case "other":
|
|
96
|
+
list_id = "bcm-clone-list-" + this._internal_id;
|
|
97
|
+
break;
|
|
98
|
+
default: break;
|
|
99
|
+
}
|
|
100
|
+
element = document.getElementById(list_id);
|
|
101
|
+
if (element != null) {
|
|
102
|
+
if (element.classList.contains("show") === true) {
|
|
103
|
+
element.hide();
|
|
77
104
|
}
|
|
78
105
|
else {
|
|
79
|
-
|
|
106
|
+
element.show();
|
|
80
107
|
}
|
|
81
108
|
}
|
|
82
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* @desc
|
|
112
|
+
*/
|
|
113
|
+
async hide(list = "default") {
|
|
114
|
+
var element = null;
|
|
115
|
+
var list_id = null;
|
|
116
|
+
switch (list) {
|
|
117
|
+
case "default":
|
|
118
|
+
list_id = this._list_id;
|
|
119
|
+
break;
|
|
120
|
+
case "other":
|
|
121
|
+
list_id = "bcm-clone-list-" + this._internal_id;
|
|
122
|
+
break;
|
|
123
|
+
default: break;
|
|
124
|
+
}
|
|
125
|
+
element = document.getElementById(list_id);
|
|
126
|
+
if (element != null) {
|
|
127
|
+
element.hide();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* @desc
|
|
132
|
+
*/
|
|
133
|
+
async show(list = "default") {
|
|
134
|
+
var element = null;
|
|
135
|
+
var list_id = null;
|
|
136
|
+
switch (list) {
|
|
137
|
+
case "default":
|
|
138
|
+
list_id = this._list_id;
|
|
139
|
+
break;
|
|
140
|
+
case "other":
|
|
141
|
+
list_id = "bcm-clone-list-" + this._internal_id;
|
|
142
|
+
break;
|
|
143
|
+
default: break;
|
|
144
|
+
}
|
|
145
|
+
element = document.getElementById(list_id);
|
|
146
|
+
if (element != null) {
|
|
147
|
+
element.show();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* @desc
|
|
152
|
+
*/
|
|
153
|
+
async toggle(list = "default") {
|
|
154
|
+
this.handleOpen(list);
|
|
155
|
+
}
|
|
83
156
|
/**
|
|
84
157
|
* @descc
|
|
85
158
|
*/
|
|
@@ -90,6 +163,26 @@ export class BcmListSelect {
|
|
|
90
163
|
* @desc
|
|
91
164
|
*/
|
|
92
165
|
async config(_config) {
|
|
166
|
+
this.selectArea = this.el.shadowRoot.querySelector(".selected-text");
|
|
167
|
+
this.selectArea.style.width = "100%";
|
|
168
|
+
this.selectAreaWidth = this.selectArea.clientWidth;
|
|
169
|
+
this.handleTagControl();
|
|
170
|
+
this.selectArea.style.width = this.selectAreaWidth - 16 + "px";
|
|
171
|
+
if (_config['searchPlaceholder']) {
|
|
172
|
+
this.searchPlaceholder = _config['searchPlaceholder'];
|
|
173
|
+
}
|
|
174
|
+
if (_config['searchFields']) {
|
|
175
|
+
this.searchFields = _config['searchFields'];
|
|
176
|
+
}
|
|
177
|
+
if (_config['returnField']) {
|
|
178
|
+
this.returnField = _config['returnField'];
|
|
179
|
+
}
|
|
180
|
+
if (_config['searchSub']) {
|
|
181
|
+
this.searchSub = _config['searchSub'];
|
|
182
|
+
}
|
|
183
|
+
if (_config['searchText']) {
|
|
184
|
+
this.searchText = _config['searchText'];
|
|
185
|
+
}
|
|
93
186
|
if (_config['mapping']) {
|
|
94
187
|
if (_config['mapping']['id']) {
|
|
95
188
|
this.objectMapping['id'] = _config['mapping']['id'];
|
|
@@ -108,55 +201,68 @@ export class BcmListSelect {
|
|
|
108
201
|
*/
|
|
109
202
|
async setValue(value, _id = "id", _text = "text") {
|
|
110
203
|
var newValue = value;
|
|
111
|
-
//
|
|
204
|
+
// this.searchData = JSON.parse(value as string)
|
|
112
205
|
this.handleLoading(true);
|
|
113
206
|
this.selectData = [];
|
|
114
207
|
this.otherList = [];
|
|
115
208
|
if (typeof value == 'string') {
|
|
116
|
-
this.
|
|
117
|
-
|
|
209
|
+
if (this.value !== value) {
|
|
210
|
+
this.selectText = String(value);
|
|
211
|
+
this.value = this.selectText;
|
|
212
|
+
}
|
|
118
213
|
this.handleLoading(false);
|
|
119
214
|
}
|
|
120
215
|
else {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
216
|
+
if (value) {
|
|
217
|
+
value.forEach(item => {
|
|
218
|
+
// console.log(item[id] + " " + item[text])
|
|
219
|
+
this.selectData.push({ id: item[_id], text: item[_text], selected: true });
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
if (this.value !== this.selectData) {
|
|
223
|
+
this.value = this.selectData;
|
|
224
|
+
if (value) {
|
|
225
|
+
newValue.forEach(element => {
|
|
226
|
+
// element[this.objectMapping['id']] = element[this.objectMapping['id']]
|
|
227
|
+
element[this.objectMapping['selected']] = true;
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
this.otherList = newValue;
|
|
231
|
+
var visibleTags = this.el.shadowRoot.getElementById("visible-tags");
|
|
232
|
+
if (visibleTags) {
|
|
233
|
+
visibleTags.innerHTML = " ";
|
|
234
|
+
const maxTags = Math.ceil((this.selectAreaWidth - 16) / 40);
|
|
235
|
+
const visibleSelectData = this.selectData.slice(0, maxTags);
|
|
236
|
+
visibleSelectData.map((item) => {
|
|
237
|
+
const newTag = document.createElement("span");
|
|
238
|
+
newTag.setAttribute("id", String(item["id"]));
|
|
239
|
+
newTag.setAttribute("value", item["text"]);
|
|
240
|
+
newTag.setAttribute("title", item["text"]);
|
|
241
|
+
newTag.setAttribute("_internal_id", this._internal_id);
|
|
242
|
+
// newTag.customStyle = customStyleTag
|
|
243
|
+
newTag.style.opacity = "0";
|
|
244
|
+
newTag.style.position = "absolute";
|
|
245
|
+
newTag.classList.add("tag");
|
|
246
|
+
newTag.classList.add("dissmisable");
|
|
247
|
+
newTag.classList.add("size-1");
|
|
248
|
+
newTag.setAttribute("_internal_id", this._internal_id);
|
|
249
|
+
newTag.innerHTML = '<span class="value"> ' + item["text"] + ' </span>'
|
|
250
|
+
+ '<span id="close-button" ' + '_internal_id="' + this._internal_id + '" class="right close-button"> '
|
|
251
|
+
+ '<svg class="icon" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> '
|
|
252
|
+
+ '<g id="icon/outlined/suggested/close">'
|
|
253
|
+
+ '<path id="Vector" d="M18.9275 4.07814L19.9219 5.07251C20.0103 5.1609 20.0103 5.24928 19.9219 5.33767L5.3378 19.9218C5.24941 20.0101 5.16102 20.0101 5.07263 19.9218L4.07826 18.9274C3.98987 18.839 3.98987 18.7506 4.07826 18.6622L18.6623 4.07814C18.7507 3.98975 18.8391 3.98975 18.9275 4.07814Z" fill="black"/>'
|
|
254
|
+
+ '<path id="Vector_2" d="M5.33766 4.07814L19.9217 18.6622C20.0101 18.7506 20.0101 18.839 19.9217 18.9274L18.9274 19.9218C18.839 20.0101 18.7506 20.0101 18.6622 19.9218L4.07813 5.33767C3.98974 5.24928 3.98974 5.1609 4.07813 5.07251L5.0725 4.07814C5.16088 3.98975 5.24927 3.98975 5.33766 4.07814Z" fill="black"/>'
|
|
255
|
+
+ '</g>'
|
|
256
|
+
+ '</svg>'
|
|
257
|
+
+ '</span>';
|
|
258
|
+
visibleTags.appendChild(newTag);
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
130
262
|
// this.selectHiddenData = this.value
|
|
131
263
|
}
|
|
132
264
|
// console.log('this.otherList: ', this.otherList)
|
|
133
|
-
|
|
134
|
-
if (visibleTags) {
|
|
135
|
-
const customStyleTag = {
|
|
136
|
-
"cursor": "pointer",
|
|
137
|
-
"max-width": "164px",
|
|
138
|
-
"text-overflow": "ellipsis",
|
|
139
|
-
"white-space": "nowrap",
|
|
140
|
-
"overflow": "hidden",
|
|
141
|
-
"display": "block"
|
|
142
|
-
};
|
|
143
|
-
visibleTags.innerHTML = " ";
|
|
144
|
-
const maxTags = Math.ceil((this.selectAreaWidth - 16) / 40);
|
|
145
|
-
const visibleSelectData = this.selectData.slice(0, maxTags);
|
|
146
|
-
visibleSelectData.map((item) => {
|
|
147
|
-
const newTag = document.createElement("bcm-tag");
|
|
148
|
-
newTag.setAttribute("id", String(item["id"]));
|
|
149
|
-
newTag.setAttribute("value", item["text"]);
|
|
150
|
-
newTag.setAttribute("title", item["text"]);
|
|
151
|
-
newTag.setAttribute("type", "dissmisable");
|
|
152
|
-
newTag.setAttribute("_internal_id", this._internal_id);
|
|
153
|
-
newTag.customStyle = customStyleTag;
|
|
154
|
-
newTag.style.opacity = "0";
|
|
155
|
-
newTag.style.position = "absolute";
|
|
156
|
-
newTag.classList.add("tag");
|
|
157
|
-
visibleTags.appendChild(newTag);
|
|
158
|
-
});
|
|
159
|
-
}
|
|
265
|
+
// this.resetCaption()
|
|
160
266
|
return this.value;
|
|
161
267
|
}
|
|
162
268
|
/**
|
|
@@ -189,10 +295,10 @@ export class BcmListSelect {
|
|
|
189
295
|
this.selectHiddenData = [];
|
|
190
296
|
const tagcontainer = this.el.shadowRoot.getElementById("tagcontainer");
|
|
191
297
|
if (tagcontainer) {
|
|
192
|
-
var tags = tagcontainer.querySelectorAll("
|
|
298
|
+
var tags = tagcontainer.querySelectorAll(".tag");
|
|
193
299
|
var tagsWidth = 0;
|
|
194
300
|
// var otherStatus = false
|
|
195
|
-
var otherTagWidth =
|
|
301
|
+
var otherTagWidth = 135 + 2;
|
|
196
302
|
var padding = 16;
|
|
197
303
|
var visibleTags = [];
|
|
198
304
|
tags.forEach(element => {
|
|
@@ -200,10 +306,10 @@ export class BcmListSelect {
|
|
|
200
306
|
element["style"]["opacity"] = "0";
|
|
201
307
|
element["style"]["position"] = "absolute";
|
|
202
308
|
});
|
|
203
|
-
await delay(100);
|
|
204
309
|
tags.forEach(element => {
|
|
205
|
-
|
|
206
|
-
|
|
310
|
+
var clientWidth = element.clientWidth <= 200 ? element.clientWidth : 200;
|
|
311
|
+
if ((this.selectAreaWidth - padding) > (clientWidth + 2 + tagsWidth)) {
|
|
312
|
+
tagsWidth += clientWidth + 2;
|
|
207
313
|
element["style"]["opacity"] = "1";
|
|
208
314
|
element["style"]["position"] = "relative";
|
|
209
315
|
}
|
|
@@ -216,14 +322,16 @@ export class BcmListSelect {
|
|
|
216
322
|
if ((this.selectAreaWidth - padding) < (calcOther === true ? tagsWidth + otherTagWidth : tagsWidth)) {
|
|
217
323
|
visibleTags = Array.from(tags).filter(e => e["hidden"] === false);
|
|
218
324
|
if (visibleTags[visibleTags.length - 1]) {
|
|
219
|
-
|
|
325
|
+
var clientWidth = visibleTags[visibleTags.length - 1].clientWidth <= 200 ? visibleTags[visibleTags.length - 1].clientWidth : 200;
|
|
326
|
+
tagsWidth -= clientWidth + 2;
|
|
220
327
|
visibleTags[visibleTags.length - 1]["hidden"] = true;
|
|
221
328
|
removeTag(calcOther);
|
|
222
329
|
}
|
|
223
330
|
}
|
|
224
331
|
};
|
|
225
332
|
removeTag();
|
|
226
|
-
|
|
333
|
+
await delay(100);
|
|
334
|
+
tags = tagcontainer.querySelectorAll(".tag");
|
|
227
335
|
var hiddenData = Array.from(tags).filter(e => e["hidden"] === true);
|
|
228
336
|
const otherTagcontainer = this.el.shadowRoot.getElementById("other-container");
|
|
229
337
|
if (Number(hiddenData.length) > 0) {
|
|
@@ -256,9 +364,10 @@ export class BcmListSelect {
|
|
|
256
364
|
cloneList.config(JSON.parse(sessionStorage.getItem(this._internal_id + "-config")));
|
|
257
365
|
}
|
|
258
366
|
// console.log('selectHiddenData: ', this.selectHiddenData )
|
|
259
|
-
cloneList.
|
|
260
|
-
cloneList.show()
|
|
367
|
+
cloneList.setDataOther(this.selectHiddenData);
|
|
368
|
+
// cloneList.show()
|
|
261
369
|
}
|
|
370
|
+
// await delay(100)
|
|
262
371
|
this.handleLoading(false);
|
|
263
372
|
}
|
|
264
373
|
/**
|
|
@@ -273,18 +382,18 @@ export class BcmListSelect {
|
|
|
273
382
|
element = document.createElement("bcm-list");
|
|
274
383
|
var el = document.getElementById(this._list_id);
|
|
275
384
|
for (var i = 0, atts = el.attributes, n = atts.length; i < n; i++) {
|
|
276
|
-
// arr.push(atts[i].nodeName);
|
|
277
|
-
// console.log(atts[i].nodeName)
|
|
278
|
-
// console.log(atts[i].nodeValue)
|
|
279
385
|
element.setAttribute(atts[i].nodeName, atts[i].nodeValue);
|
|
280
386
|
}
|
|
281
387
|
element.setAttribute("id", elementId);
|
|
282
388
|
element.setAttribute("_list_id", this._list_id);
|
|
283
|
-
|
|
389
|
+
element.setAttribute("_list_select_id", this._id);
|
|
284
390
|
element.setAttribute("_internal_id", otherListInternalId);
|
|
285
391
|
element.searchable = true;
|
|
392
|
+
element.infoFooter = false;
|
|
286
393
|
element.type = "default";
|
|
394
|
+
element.processType = "deselect";
|
|
287
395
|
element.setAttribute("linked-component", this._id);
|
|
396
|
+
element.linkedComponent = this._id;
|
|
288
397
|
element.multiSelect = true;
|
|
289
398
|
const parentNode = this.el.parentNode;
|
|
290
399
|
parentNode.insertBefore(element, this.el);
|
|
@@ -298,15 +407,70 @@ export class BcmListSelect {
|
|
|
298
407
|
/**
|
|
299
408
|
* @descc
|
|
300
409
|
*/
|
|
301
|
-
|
|
302
|
-
|
|
410
|
+
inputChange(e) {
|
|
411
|
+
this.search(e);
|
|
412
|
+
}
|
|
413
|
+
search(value) {
|
|
414
|
+
const element = document.getElementById(this._list_id);
|
|
415
|
+
if (element != null) {
|
|
416
|
+
element.setSearch(value);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* @desc
|
|
421
|
+
*/
|
|
422
|
+
async handleClick(event) {
|
|
423
|
+
var path = event.path || (event.composedPath && event.composedPath());
|
|
424
|
+
if (path && path.filter((input) => input['_internal_id'] == this._internal_id)[0]) {
|
|
425
|
+
const cloneElementId = "bcm-clone-list-" + this._internal_id;
|
|
426
|
+
const cloneElement = document.querySelector("#" + cloneElementId);
|
|
427
|
+
const element = document.querySelector("#" + this._list_id);
|
|
428
|
+
if (path.filter((input) => input['id'] == "close-button")[0]
|
|
429
|
+
&& path.filter((input) => input['className'] == "tag dissmisable size-1")[0]
|
|
430
|
+
&& path.filter((input) => input['className'] == "tag dissmisable size-1")[0]["id"]) {
|
|
431
|
+
event.preventDefault();
|
|
432
|
+
event.stopPropagation();
|
|
433
|
+
const selectedID = path.filter((input) => input['className'] == "tag dissmisable size-1")[0]["id"];
|
|
434
|
+
if (element) {
|
|
435
|
+
element.unChecked(selectedID);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
if (path.filter((input) => input['id'] == "other-tag")[0]) {
|
|
439
|
+
event.preventDefault();
|
|
440
|
+
event.stopPropagation();
|
|
441
|
+
if (path.filter((input) => input['id'] == "close")[0]) {
|
|
442
|
+
if (cloneElement) {
|
|
443
|
+
if (await cloneElement.openStatus() === true) {
|
|
444
|
+
if (element) {
|
|
445
|
+
element.show();
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
var selectedIDs = [];
|
|
450
|
+
this.selectHiddenData.forEach(item => {
|
|
451
|
+
selectedIDs.push(item[this.objectMapping['id']]);
|
|
452
|
+
});
|
|
453
|
+
if (element) {
|
|
454
|
+
element.unChecked(selectedIDs);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
else {
|
|
458
|
+
if (cloneElement) {
|
|
459
|
+
setTimeout(() => {
|
|
460
|
+
cloneElement.show();
|
|
461
|
+
}, 100);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
303
467
|
render() {
|
|
304
468
|
const { label, fullWidth, required, selectText, selectData, placeholder, clearable, value, isOpen, noCaption, captionType, captionError, caption, size, disabled } = this;
|
|
305
469
|
// const classes = cs(
|
|
306
470
|
// 'card',
|
|
307
471
|
// this.size
|
|
308
472
|
// )
|
|
309
|
-
const hostClasses = cs(this.hidden ? 'hidden' : null, {
|
|
473
|
+
const hostClasses = cs(this.hidden ? 'hidden' : null, 'type-' + this.type, {
|
|
310
474
|
'full-width': fullWidth
|
|
311
475
|
});
|
|
312
476
|
const captionClasses = cs('size-1', 'input-caption', 'caption-' + captionType);
|
|
@@ -344,24 +508,25 @@ export class BcmListSelect {
|
|
|
344
508
|
" ",
|
|
345
509
|
label,
|
|
346
510
|
" ",
|
|
347
|
-
required && ('*'),
|
|
511
|
+
required === true && ('*'),
|
|
348
512
|
" "),
|
|
349
513
|
h("div", { id: "selected-container", class: selected, onClick: () => this.handleOpen(), tabIndex: -1 },
|
|
350
514
|
h("span", { class: selectedText, title: selectText !== null && (selectText) },
|
|
351
515
|
h("div", { class: "spinner first-run" }),
|
|
352
|
-
(selectText !== null && (h("div", { class: "text-content" }, selectText))),
|
|
353
|
-
(selectText === null && (h("span", { id: "tagcontainer", class: "tag-container" },
|
|
516
|
+
this.type === 'select' && (selectText !== null && (h("div", { class: "text-content" }, selectText))),
|
|
517
|
+
(this.type === 'select' || this.type === 'autocomplete' && this.multiSelect === true) && (selectText === null && (h("span", { id: "tagcontainer", class: "tag-container" },
|
|
354
518
|
h("span", { id: "visible-tags" }),
|
|
355
519
|
h("span", { id: "other-container" }, h("bcm-tag", { _internal_id: this._internal_id, customStyle: customStyleOtherTag, type: "dissmisable", id: "other-tag" }))))),
|
|
356
|
-
(selectText === null && selectData.length === 0 && placeholder !== null && (h("span", { class: "placeholder" },
|
|
520
|
+
this.type === 'select' && (selectText === null && selectData.length === 0 && placeholder !== null && (h("span", { class: "placeholder" },
|
|
357
521
|
" ",
|
|
358
522
|
placeholder,
|
|
359
|
-
" ")))
|
|
360
|
-
|
|
523
|
+
" "))),
|
|
524
|
+
this.type === 'autocomplete' && (h("bcm-input", { "on-bcm-change": e => this.inputChange(e.detail), "full-width": true, placeholder: this.searchPlaceholder, id: "autocomplete", value: this.searchText, "no-caption": true, "no-margin": true, type: "search", clearable: true }))),
|
|
525
|
+
this.type === 'select' && (h("div", { class: "buttons" },
|
|
361
526
|
clearable && value && (h("button", { class: "select-clear-button", onClick: (e) => this.clickClear(e) },
|
|
362
527
|
h("bcm-icon", { icon: "close-circle", type: "fill", size: 18, color: "grey-7" }))),
|
|
363
528
|
h("span", { class: isOpen ? 'open' : 'close' },
|
|
364
|
-
h("bcm-icon", { icon: "caret-up", type: "outlined", size: 18, color: "grey-6" })))),
|
|
529
|
+
h("bcm-icon", { icon: "caret-up", type: "outlined", size: 18, color: "grey-6" }))))),
|
|
365
530
|
noCaption === false && (h("div", { class: "caption-area" }, captionType == "error"
|
|
366
531
|
? h("span", { class: captionClasses },
|
|
367
532
|
" ",
|
|
@@ -453,6 +618,47 @@ export class BcmListSelect {
|
|
|
453
618
|
"reflect": false,
|
|
454
619
|
"defaultValue": "null"
|
|
455
620
|
},
|
|
621
|
+
"_internal_id": {
|
|
622
|
+
"type": "string",
|
|
623
|
+
"mutable": false,
|
|
624
|
+
"complexType": {
|
|
625
|
+
"original": "string",
|
|
626
|
+
"resolved": "string",
|
|
627
|
+
"references": {}
|
|
628
|
+
},
|
|
629
|
+
"required": false,
|
|
630
|
+
"optional": false,
|
|
631
|
+
"docs": {
|
|
632
|
+
"tags": [],
|
|
633
|
+
"text": ""
|
|
634
|
+
},
|
|
635
|
+
"attribute": "_internal_id",
|
|
636
|
+
"reflect": true,
|
|
637
|
+
"defaultValue": "(Math.random() * 4).toString(16).replace('.', '')"
|
|
638
|
+
},
|
|
639
|
+
"type": {
|
|
640
|
+
"type": "string",
|
|
641
|
+
"mutable": false,
|
|
642
|
+
"complexType": {
|
|
643
|
+
"original": "TypeProp",
|
|
644
|
+
"resolved": "\"autocomplete\" | \"default\" | \"multiselect\" | \"select\"",
|
|
645
|
+
"references": {
|
|
646
|
+
"TypeProp": {
|
|
647
|
+
"location": "import",
|
|
648
|
+
"path": "./types"
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
},
|
|
652
|
+
"required": false,
|
|
653
|
+
"optional": false,
|
|
654
|
+
"docs": {
|
|
655
|
+
"tags": [],
|
|
656
|
+
"text": ""
|
|
657
|
+
},
|
|
658
|
+
"attribute": "type",
|
|
659
|
+
"reflect": false,
|
|
660
|
+
"defaultValue": "'default'"
|
|
661
|
+
},
|
|
456
662
|
"size": {
|
|
457
663
|
"type": "string",
|
|
458
664
|
"mutable": false,
|
|
@@ -584,9 +790,14 @@ export class BcmListSelect {
|
|
|
584
790
|
"type": "string",
|
|
585
791
|
"mutable": false,
|
|
586
792
|
"complexType": {
|
|
587
|
-
"original": "
|
|
793
|
+
"original": "captionTypeProp",
|
|
588
794
|
"resolved": "\"default\" | \"error\" | \"primary\" | \"success\" | \"warning\"",
|
|
589
|
-
"references": {
|
|
795
|
+
"references": {
|
|
796
|
+
"captionTypeProp": {
|
|
797
|
+
"location": "import",
|
|
798
|
+
"path": "../../../types"
|
|
799
|
+
}
|
|
800
|
+
}
|
|
590
801
|
},
|
|
591
802
|
"required": false,
|
|
592
803
|
"optional": false,
|
|
@@ -668,12 +879,12 @@ export class BcmListSelect {
|
|
|
668
879
|
"reflect": false,
|
|
669
880
|
"defaultValue": "false"
|
|
670
881
|
},
|
|
671
|
-
"
|
|
672
|
-
"type": "
|
|
882
|
+
"multiSelect": {
|
|
883
|
+
"type": "boolean",
|
|
673
884
|
"mutable": false,
|
|
674
885
|
"complexType": {
|
|
675
|
-
"original": "
|
|
676
|
-
"resolved": "
|
|
886
|
+
"original": "boolean",
|
|
887
|
+
"resolved": "boolean",
|
|
677
888
|
"references": {}
|
|
678
889
|
},
|
|
679
890
|
"required": false,
|
|
@@ -682,9 +893,27 @@ export class BcmListSelect {
|
|
|
682
893
|
"tags": [],
|
|
683
894
|
"text": ""
|
|
684
895
|
},
|
|
685
|
-
"attribute": "
|
|
686
|
-
"reflect":
|
|
687
|
-
"defaultValue": "
|
|
896
|
+
"attribute": "multiselect",
|
|
897
|
+
"reflect": false,
|
|
898
|
+
"defaultValue": "false"
|
|
899
|
+
},
|
|
900
|
+
"searchData": {
|
|
901
|
+
"type": "any",
|
|
902
|
+
"mutable": false,
|
|
903
|
+
"complexType": {
|
|
904
|
+
"original": "any",
|
|
905
|
+
"resolved": "any",
|
|
906
|
+
"references": {}
|
|
907
|
+
},
|
|
908
|
+
"required": false,
|
|
909
|
+
"optional": false,
|
|
910
|
+
"docs": {
|
|
911
|
+
"tags": [],
|
|
912
|
+
"text": ""
|
|
913
|
+
},
|
|
914
|
+
"attribute": "search-data",
|
|
915
|
+
"reflect": false,
|
|
916
|
+
"defaultValue": "null"
|
|
688
917
|
}
|
|
689
918
|
}; }
|
|
690
919
|
static get states() { return {
|
|
@@ -753,6 +982,91 @@ export class BcmListSelect {
|
|
|
753
982
|
}
|
|
754
983
|
}]; }
|
|
755
984
|
static get methods() { return {
|
|
985
|
+
"resetCaption": {
|
|
986
|
+
"complexType": {
|
|
987
|
+
"signature": "() => Promise<void>",
|
|
988
|
+
"parameters": [],
|
|
989
|
+
"references": {
|
|
990
|
+
"Promise": {
|
|
991
|
+
"location": "global"
|
|
992
|
+
}
|
|
993
|
+
},
|
|
994
|
+
"return": "Promise<void>"
|
|
995
|
+
},
|
|
996
|
+
"docs": {
|
|
997
|
+
"text": "",
|
|
998
|
+
"tags": [{
|
|
999
|
+
"name": "desc",
|
|
1000
|
+
"text": undefined
|
|
1001
|
+
}]
|
|
1002
|
+
}
|
|
1003
|
+
},
|
|
1004
|
+
"hide": {
|
|
1005
|
+
"complexType": {
|
|
1006
|
+
"signature": "(list?: \"default\" | \"other\") => Promise<void>",
|
|
1007
|
+
"parameters": [{
|
|
1008
|
+
"tags": [],
|
|
1009
|
+
"text": ""
|
|
1010
|
+
}],
|
|
1011
|
+
"references": {
|
|
1012
|
+
"Promise": {
|
|
1013
|
+
"location": "global"
|
|
1014
|
+
}
|
|
1015
|
+
},
|
|
1016
|
+
"return": "Promise<void>"
|
|
1017
|
+
},
|
|
1018
|
+
"docs": {
|
|
1019
|
+
"text": "",
|
|
1020
|
+
"tags": [{
|
|
1021
|
+
"name": "desc",
|
|
1022
|
+
"text": undefined
|
|
1023
|
+
}]
|
|
1024
|
+
}
|
|
1025
|
+
},
|
|
1026
|
+
"show": {
|
|
1027
|
+
"complexType": {
|
|
1028
|
+
"signature": "(list?: \"default\" | \"other\") => Promise<void>",
|
|
1029
|
+
"parameters": [{
|
|
1030
|
+
"tags": [],
|
|
1031
|
+
"text": ""
|
|
1032
|
+
}],
|
|
1033
|
+
"references": {
|
|
1034
|
+
"Promise": {
|
|
1035
|
+
"location": "global"
|
|
1036
|
+
}
|
|
1037
|
+
},
|
|
1038
|
+
"return": "Promise<void>"
|
|
1039
|
+
},
|
|
1040
|
+
"docs": {
|
|
1041
|
+
"text": "",
|
|
1042
|
+
"tags": [{
|
|
1043
|
+
"name": "desc",
|
|
1044
|
+
"text": undefined
|
|
1045
|
+
}]
|
|
1046
|
+
}
|
|
1047
|
+
},
|
|
1048
|
+
"toggle": {
|
|
1049
|
+
"complexType": {
|
|
1050
|
+
"signature": "(list?: \"default\" | \"other\") => Promise<void>",
|
|
1051
|
+
"parameters": [{
|
|
1052
|
+
"tags": [],
|
|
1053
|
+
"text": ""
|
|
1054
|
+
}],
|
|
1055
|
+
"references": {
|
|
1056
|
+
"Promise": {
|
|
1057
|
+
"location": "global"
|
|
1058
|
+
}
|
|
1059
|
+
},
|
|
1060
|
+
"return": "Promise<void>"
|
|
1061
|
+
},
|
|
1062
|
+
"docs": {
|
|
1063
|
+
"text": "",
|
|
1064
|
+
"tags": [{
|
|
1065
|
+
"name": "desc",
|
|
1066
|
+
"text": undefined
|
|
1067
|
+
}]
|
|
1068
|
+
}
|
|
1069
|
+
},
|
|
756
1070
|
"config": {
|
|
757
1071
|
"complexType": {
|
|
758
1072
|
"signature": "(_config: Array<object>) => Promise<object[]>",
|
|
@@ -817,5 +1131,11 @@ export class BcmListSelect {
|
|
|
817
1131
|
"target": "window",
|
|
818
1132
|
"capture": false,
|
|
819
1133
|
"passive": true
|
|
1134
|
+
}, {
|
|
1135
|
+
"name": "click",
|
|
1136
|
+
"method": "handleClick",
|
|
1137
|
+
"target": "window",
|
|
1138
|
+
"capture": true,
|
|
1139
|
+
"passive": false
|
|
820
1140
|
}]; }
|
|
821
1141
|
}
|