bromcom-ui 2.4.32 → 2.4.33
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.css +1 -1
- package/dist/bromcom-ui/bromcom-ui.esm.js +1 -1
- package/dist/bromcom-ui/p-052ac20b.entry.js +1 -0
- package/dist/bromcom-ui/p-072c24b5.js +1 -0
- package/dist/bromcom-ui/p-3ed8c65b.entry.js +1 -0
- package/dist/bromcom-ui/p-40b3e4b9.js +1 -0
- package/dist/bromcom-ui/p-43a2dc90.js +1 -0
- package/dist/bromcom-ui/{p-13e143a5.entry.js → p-61385f1e.entry.js} +1 -1
- package/dist/bromcom-ui/p-68d9dd67.js +1 -0
- package/dist/bromcom-ui/p-9330c810.entry.js +1 -0
- package/dist/bromcom-ui/p-a6b11a46.entry.js +1 -0
- package/dist/bromcom-ui/{p-8ad580f2.entry.js → p-a8800df8.entry.js} +1 -1
- package/dist/bromcom-ui/p-d1dc11c5.entry.js +1 -0
- package/dist/bromcom-ui/p-d3c5255a.entry.js +1 -0
- package/dist/bromcom-ui/p-d665b89d.entry.js +1 -0
- package/dist/bromcom-ui/{p-073fe976.entry.js → p-e62a5e66.entry.js} +1 -1
- package/dist/cjs/{bcm-button_14.cjs.entry.js → bcm-button_12.cjs.entry.js} +477 -369
- package/dist/cjs/bcm-icon-2_2.cjs.entry.js +7 -6
- package/dist/cjs/bcm-popconfirm-box.cjs.entry.js +1 -1
- package/dist/cjs/bcm-popconfirm.cjs.entry.js +98 -0
- package/dist/cjs/bcm-popover-box.cjs.entry.js +78 -0
- package/dist/cjs/bcm-popover.cjs.entry.js +95 -0
- package/dist/cjs/bcm-select-box_2.cjs.entry.js +138 -0
- package/dist/cjs/bcm-select.cjs.entry.js +23 -20
- package/dist/cjs/bcm-stepper.cjs.entry.js +4 -4
- package/dist/cjs/bcm-tag-2.cjs.entry.js +48 -45
- package/dist/cjs/bromcom-ui.cjs.js +1 -1
- package/dist/cjs/{property-decorators-c405d518.js → color-helper-04636625.js} +0 -35
- package/dist/cjs/{generate-df748d90.js → generate-84dce6ea.js} +5 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/property-decorators-476df1c5.js +38 -0
- package/dist/cjs/{stepper-states-991b5b89.js → stepper-states-c11f78f7.js} +1 -1
- package/dist/collection/components/atoms/tag-2/tag-2.css +0 -18629
- package/dist/collection/components/atoms/tag-2/tag-2.js +1 -28
- package/dist/collection/components/molecules/select/select.js +23 -20
- package/dist/collection/components/organism/list/list.css +23 -0
- package/dist/collection/components/organism/list/list.js +39 -10
- package/dist/collection/components/organism/states/bcm-list2.states.js +2 -2
- package/dist/collection/helper/generate.js +4 -0
- package/dist/collection/templates/tag-template.js +39 -10
- package/dist/esm/{bcm-button_14.entry.js → bcm-button_12.entry.js} +471 -361
- package/dist/esm/bcm-icon-2_2.entry.js +5 -4
- package/dist/esm/bcm-popconfirm-box.entry.js +1 -1
- package/dist/esm/bcm-popconfirm.entry.js +94 -0
- package/dist/esm/bcm-popover-box.entry.js +74 -0
- package/dist/esm/bcm-popover.entry.js +91 -0
- package/dist/esm/bcm-select-box_2.entry.js +133 -0
- package/dist/esm/bcm-select.entry.js +23 -20
- package/dist/esm/bcm-stepper.entry.js +4 -4
- package/dist/esm/bcm-tag-2.entry.js +41 -38
- package/dist/esm/bromcom-ui.js +1 -1
- package/dist/esm/{property-decorators-d09918fe.js → color-helper-ff728802.js} +1 -35
- package/dist/esm/{generate-a97a04fc.js → generate-5aa9d89a.js} +5 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/property-decorators-681ae42e.js +36 -0
- package/dist/esm/{stepper-states-638eb20f.js → stepper-states-525936b7.js} +1 -1
- package/dist/types/components/atoms/tag-2/tag-2.d.ts +0 -6
- package/dist/types/components/organism/list/list.d.ts +3 -1
- package/dist/types/helper/generate.d.ts +1 -0
- package/dist/types/templates/tag-template.d.ts +6 -1
- package/package.json +1 -1
- package/dist/bromcom-ui/p-3bca790c.entry.js +0 -1
- package/dist/bromcom-ui/p-4054d5e3.js +0 -1
- package/dist/bromcom-ui/p-573ec2ec.js +0 -1
- package/dist/bromcom-ui/p-73720a30.entry.js +0 -1
- package/dist/bromcom-ui/p-7b9c963c.js +0 -1
- package/dist/bromcom-ui/p-7f6b81ef.entry.js +0 -1
- package/dist/bromcom-ui/p-920b5044.entry.js +0 -1
- package/dist/bromcom-ui/p-aa697b33.entry.js +0 -1
- package/dist/bromcom-ui/p-d16cf22d.entry.js +0 -1
- package/dist/bromcom-ui/p-e1aca7d8.js +0 -1
- package/dist/cjs/bcm-input.cjs.entry.js +0 -382
- package/dist/cjs/bcm-label.cjs.entry.js +0 -35
- package/dist/cjs/bcm-select-box.cjs.entry.js +0 -38
- package/dist/cjs/label-template-39ce726c.js +0 -26
- package/dist/esm/bcm-input.entry.js +0 -378
- package/dist/esm/bcm-label.entry.js +0 -31
- package/dist/esm/bcm-select-box.entry.js +0 -34
- package/dist/esm/label-template-6989c6ba.js +0 -24
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import { Component, Prop, h, Event, Element, Listen } from '@stencil/core';
|
|
2
|
-
import cs from 'classnames';
|
|
3
|
-
import { ColorPalette } from '../../../global/variables/colors';
|
|
4
2
|
import { Generate } from '../../../helper/generate';
|
|
5
|
-
import { NumberHelper } from '../../../helper/number-helper';
|
|
6
3
|
import Bcm from '../../../models/bcm';
|
|
7
4
|
import { TagTemplate } from '../../../templates/tag-template';
|
|
8
|
-
import { extractColor } from '../../../utils/utils';
|
|
9
|
-
import { ColorProps } from './types';
|
|
10
5
|
export class BcmTag2 {
|
|
11
6
|
constructor() {
|
|
12
7
|
this._id = Generate.UID();
|
|
@@ -22,23 +17,6 @@ export class BcmTag2 {
|
|
|
22
17
|
handleClick() {
|
|
23
18
|
this.type === Bcm.TagType.checkable && this.handleChecked();
|
|
24
19
|
}
|
|
25
|
-
getColor(color) {
|
|
26
|
-
if ((this.type === Bcm.TagType.basic || this.type == Bcm.TagType.dismissable) && ColorProps[color])
|
|
27
|
-
return {
|
|
28
|
-
color: extractColor(ColorPalette, ColorProps[color] + '-6'),
|
|
29
|
-
borderColor: extractColor(ColorPalette, ColorProps[color] + '-3'),
|
|
30
|
-
backgroundColor: extractColor(ColorPalette, ColorProps[color] + '-1')
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
getSize(size, returnNumber = false) {
|
|
34
|
-
if (NumberHelper.isNumber(size)) {
|
|
35
|
-
size = Bcm.FontSize["size-" + size] || Bcm.FontSize["size-4"];
|
|
36
|
-
}
|
|
37
|
-
if (returnNumber) {
|
|
38
|
-
return +(Bcm.FontSizeValue[size] || Bcm.FontSizeValue['size-4']) + 2;
|
|
39
|
-
}
|
|
40
|
-
return size;
|
|
41
|
-
}
|
|
42
20
|
handleClose() {
|
|
43
21
|
this.tagDismissable.emit(this.el);
|
|
44
22
|
}
|
|
@@ -48,12 +26,7 @@ export class BcmTag2 {
|
|
|
48
26
|
}
|
|
49
27
|
render() {
|
|
50
28
|
const { type, color, value, customStyle, size, hidden, checked } = this;
|
|
51
|
-
|
|
52
|
-
const hostClasses = cs('bcm-tag-2', {
|
|
53
|
-
hidden
|
|
54
|
-
});
|
|
55
|
-
const calculatedSize = this.getSize(size, true);
|
|
56
|
-
return (h(TagTemplate, { hostClasses: hostClasses, classes: classes, colorStyle: this.getColor(color), customStyle: customStyle, checked: checked, value: value, type: Bcm.TagType[type], calculatedSize: calculatedSize, onSelect: (e) => { this.bcmTagSelect.emit(e); this.selectFunc({ event: e, id: this._id }); }, onDismiss: (e) => { this.handleClose(); this.closeFunc(e); } }));
|
|
29
|
+
return (h(TagTemplate, { size: size, hidden: hidden, color: color, customStyle: customStyle, checked: checked, value: value, type: Bcm.TagType[type], onSelect: (e) => { this.bcmTagSelect.emit(e); this.selectFunc({ event: e, id: this._id }); }, onDismiss: (e) => { this.handleClose(); this.closeFunc(e); } }));
|
|
57
30
|
}
|
|
58
31
|
static get is() { return "bcm-tag-2"; }
|
|
59
32
|
static get originalStyleUrls() { return {
|
|
@@ -440,13 +440,15 @@ export class BcmSelect {
|
|
|
440
440
|
this.captionTypeCache = this.captionType;
|
|
441
441
|
}
|
|
442
442
|
handleChange(newValue, oldValue) {
|
|
443
|
-
|
|
443
|
+
const oldVal = oldValue ? oldValue : null;
|
|
444
|
+
const newVal = newValue ? newValue : null;
|
|
445
|
+
if (oldVal != newVal) {
|
|
444
446
|
if (this.checkboxes == true) {
|
|
445
|
-
this.change.emit(
|
|
447
|
+
this.change.emit(newVal);
|
|
446
448
|
}
|
|
447
449
|
else {
|
|
448
|
-
if (
|
|
449
|
-
this.change.emit(
|
|
450
|
+
if (newVal[this.objectMapping['id']] != (oldVal && oldVal[this.objectMapping['id']])) {
|
|
451
|
+
this.change.emit(newVal);
|
|
450
452
|
}
|
|
451
453
|
}
|
|
452
454
|
}
|
|
@@ -480,21 +482,21 @@ export class BcmSelect {
|
|
|
480
482
|
}
|
|
481
483
|
if (this.isOpen && this.searchable && !otherTag) {
|
|
482
484
|
// await this.createElement()
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
485
|
+
setTimeout(() => {
|
|
486
|
+
var searchInput = null;
|
|
487
|
+
if (document.getElementById("select-box" + this._internal_id)
|
|
488
|
+
&& document.getElementById("select-box" + this._internal_id).shadowRoot.querySelector("bcm-listbox")) {
|
|
489
|
+
if (this.treeview) {
|
|
490
|
+
searchInput = document.getElementById("select-box" + this._internal_id).shadowRoot.querySelector("bcm-listbox").shadowRoot.querySelector("bcm-treeview");
|
|
491
|
+
}
|
|
492
|
+
else {
|
|
493
|
+
searchInput = document.getElementById("select-box" + this._internal_id).shadowRoot.querySelector("bcm-listbox");
|
|
494
|
+
}
|
|
495
|
+
if (searchInput) {
|
|
496
|
+
searchInput.clearAndSelectSearch();
|
|
497
|
+
}
|
|
495
498
|
}
|
|
496
|
-
}
|
|
497
|
-
// }, 50);
|
|
499
|
+
}, 100);
|
|
498
500
|
}
|
|
499
501
|
if (this.isOpen == true && this.isRendered == false) {
|
|
500
502
|
this.renderListbox();
|
|
@@ -650,6 +652,7 @@ export class BcmSelect {
|
|
|
650
652
|
}
|
|
651
653
|
}
|
|
652
654
|
handleClickOutside(event) {
|
|
655
|
+
var _a;
|
|
653
656
|
var path = event.path || (event.composedPath && event.composedPath());
|
|
654
657
|
if (path && path.filter((input) => input['id'] == "other-tag")[0] == undefined
|
|
655
658
|
&& path && path.filter((input) => input['id'] == "listbox")[0] == undefined) {
|
|
@@ -660,8 +663,8 @@ export class BcmSelect {
|
|
|
660
663
|
}
|
|
661
664
|
}, 50);
|
|
662
665
|
}
|
|
663
|
-
if (this.el.contains(event.target)
|
|
664
|
-
|| path && path.filter((input) => input['id'] == "select-box" + this._internal_id)[0] != undefined) {
|
|
666
|
+
if (((event === null || event === void 0 ? void 0 : event.target) && ((_a = this.el) === null || _a === void 0 ? void 0 : _a.contains(event.target)))
|
|
667
|
+
|| (path && path.filter((input) => input['id'] == "select-box" + this._internal_id)[0] != undefined)) {
|
|
665
668
|
// this.searchResults = []
|
|
666
669
|
// this.watchSearchResults()
|
|
667
670
|
this.optionViewportStyleAlignment = {};
|
|
@@ -18608,6 +18608,27 @@
|
|
|
18608
18608
|
padding: 0 8px;
|
|
18609
18609
|
height: 32px;
|
|
18610
18610
|
overflow: hidden;
|
|
18611
|
+
position: relative;
|
|
18612
|
+
}
|
|
18613
|
+
.bcm-list__input-spinner {
|
|
18614
|
+
position: absolute;
|
|
18615
|
+
top: 0;
|
|
18616
|
+
left: 0;
|
|
18617
|
+
width: 100%;
|
|
18618
|
+
height: 100%;
|
|
18619
|
+
display: flex;
|
|
18620
|
+
justify-content: center;
|
|
18621
|
+
align-items: center;
|
|
18622
|
+
background-color: var(--bcm-color-grey-1);
|
|
18623
|
+
opacity: 0;
|
|
18624
|
+
visibility: hidden;
|
|
18625
|
+
transition: opacity 0.2s ease-in-out;
|
|
18626
|
+
z-index: -1;
|
|
18627
|
+
}
|
|
18628
|
+
.bcm-list__input-spinner.is-open {
|
|
18629
|
+
opacity: 1;
|
|
18630
|
+
visibility: visible;
|
|
18631
|
+
z-index: 1;
|
|
18611
18632
|
}
|
|
18612
18633
|
.bcm-list__input-container {
|
|
18613
18634
|
width: 100%;
|
|
@@ -18752,6 +18773,7 @@
|
|
|
18752
18773
|
background-color: var(--bcm-color-prime-blue-1);
|
|
18753
18774
|
}
|
|
18754
18775
|
.bcm-list__item-content-collapse-icon {
|
|
18776
|
+
color: var(--bcm-color-grey-8);
|
|
18755
18777
|
width: 16px;
|
|
18756
18778
|
padding: 0 8px;
|
|
18757
18779
|
display: flex;
|
|
@@ -18763,6 +18785,7 @@
|
|
|
18763
18785
|
cursor: pointer;
|
|
18764
18786
|
}
|
|
18765
18787
|
.bcm-list__item-content-text {
|
|
18788
|
+
user-select: none;
|
|
18766
18789
|
padding: 8px;
|
|
18767
18790
|
width: 100%;
|
|
18768
18791
|
display: flex;
|
|
@@ -67,7 +67,8 @@ export class BcmList {
|
|
|
67
67
|
this.searchFound = null;
|
|
68
68
|
this.returnFilterData = {};
|
|
69
69
|
this.returnOtherData = {};
|
|
70
|
-
this.
|
|
70
|
+
this.isLoadingInput = true;
|
|
71
|
+
this.isLoadingList = true;
|
|
71
72
|
this.options = {
|
|
72
73
|
rootMargin: '30px'
|
|
73
74
|
};
|
|
@@ -101,6 +102,7 @@ export class BcmList {
|
|
|
101
102
|
componentWillRender() {
|
|
102
103
|
this.calculateLocation();
|
|
103
104
|
this.updateOptions();
|
|
105
|
+
this.tagControl();
|
|
104
106
|
}
|
|
105
107
|
componentShouldUpdate(newVal, oldVal, propName) {
|
|
106
108
|
var _a;
|
|
@@ -171,6 +173,7 @@ export class BcmList {
|
|
|
171
173
|
}
|
|
172
174
|
async handleOpen() {
|
|
173
175
|
if (this.isOpen) {
|
|
176
|
+
this.calculateLocation();
|
|
174
177
|
this.onSelectSearch();
|
|
175
178
|
}
|
|
176
179
|
else {
|
|
@@ -188,6 +191,7 @@ export class BcmList {
|
|
|
188
191
|
}
|
|
189
192
|
}
|
|
190
193
|
handleResize() {
|
|
194
|
+
this.isLoadingInput = true;
|
|
191
195
|
this.calculateLocation();
|
|
192
196
|
this.debounceHandler();
|
|
193
197
|
}
|
|
@@ -392,12 +396,14 @@ export class BcmList {
|
|
|
392
396
|
return false;
|
|
393
397
|
}
|
|
394
398
|
async setClear(e) {
|
|
399
|
+
// this.isLoadingInput = true
|
|
395
400
|
listState.setClear(this._id);
|
|
396
401
|
this.value = null;
|
|
397
402
|
this.inputText = '';
|
|
398
403
|
this.isOpen = false;
|
|
399
404
|
this.selectAllItem.indeterminate = 'uncheck';
|
|
400
|
-
await this.tagControl()
|
|
405
|
+
// await this.tagControl()
|
|
406
|
+
this.removeTags();
|
|
401
407
|
this.markForCheck();
|
|
402
408
|
if (e) {
|
|
403
409
|
e.stopPropagation();
|
|
@@ -428,6 +434,7 @@ export class BcmList {
|
|
|
428
434
|
this.selectAllItem = Object.assign(Object.assign({}, this.selectAllItem), { indeterminate: this.checkboxes && checkeds > 0 ? checkeds === total ? 'check' : 'indeterminate' : 'uncheck', checked: this.checkboxes && checkeds > 0 ? checkeds === total ? true : false : false });
|
|
429
435
|
}
|
|
430
436
|
listenResize() {
|
|
437
|
+
this.isLoadingInput = true;
|
|
431
438
|
this.tagControl();
|
|
432
439
|
this.calculateLocation();
|
|
433
440
|
}
|
|
@@ -471,6 +478,7 @@ export class BcmList {
|
|
|
471
478
|
}
|
|
472
479
|
async initState() {
|
|
473
480
|
var _a, _b, _c;
|
|
481
|
+
this.isLoadingInput = true;
|
|
474
482
|
await listState.setValue({
|
|
475
483
|
id: this._id,
|
|
476
484
|
dataSource: this.data && snq(() => typeof this.data == 'string' ? JSON.parse(this.data) : this.data, []),
|
|
@@ -487,6 +495,7 @@ export class BcmList {
|
|
|
487
495
|
}
|
|
488
496
|
else {
|
|
489
497
|
this.inputText = ((_a = this.value) === null || _a === void 0 ? void 0 : _a.text) || null;
|
|
498
|
+
this.isLoadingInput = false;
|
|
490
499
|
}
|
|
491
500
|
const checkedIDs = [];
|
|
492
501
|
((_b = this.value) === null || _b === void 0 ? void 0 : _b.length) > 0 && this.value.forEach(item => {
|
|
@@ -593,23 +602,30 @@ export class BcmList {
|
|
|
593
602
|
io.observe(event.target.lastElementChild);
|
|
594
603
|
}
|
|
595
604
|
calculateLocation() {
|
|
605
|
+
var _a;
|
|
596
606
|
const list = document.getElementById(`bcm-list-${this._id}`);
|
|
597
607
|
list && (list.style.height = '256px');
|
|
598
608
|
if (this.isOpen) {
|
|
599
609
|
var placement = this.placement;
|
|
600
610
|
const list = document.getElementById(`bcm-list-${this._id}`);
|
|
601
|
-
// if (this.linkedComponent) {
|
|
602
|
-
// const linked = document.getElementById(this.linkedComponent)
|
|
603
|
-
// if (linked) {
|
|
604
|
-
// console.dir(linked)
|
|
605
|
-
// }
|
|
606
|
-
// }
|
|
607
611
|
const targetElementId = this.linkedComponent ? this.linkedComponent : `bcm-list-input-${this._id}`;
|
|
608
612
|
const targetElement = document.getElementById(targetElementId);
|
|
609
613
|
if (list && targetElement) {
|
|
610
614
|
getPlacement(list, targetElement, placement, (place) => placement = place);
|
|
611
615
|
const pos = setPosition(placement, targetElement);
|
|
612
|
-
|
|
616
|
+
let captionAreaHeight = 0;
|
|
617
|
+
if (this.linkedComponent) {
|
|
618
|
+
const linked = document.getElementById(this.linkedComponent);
|
|
619
|
+
if (linked) {
|
|
620
|
+
if (!linked["noCaption"]) {
|
|
621
|
+
const captionArea = ((_a = linked.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.caption-area')) || linked.querySelector('.caption-area');
|
|
622
|
+
if (captionArea) {
|
|
623
|
+
captionAreaHeight = captionArea.offsetHeight || captionArea.clientHeight;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
list.style.top = (placement.split('-')[0] == 'top' ? pos[0] - list.offsetHeight : pos[0] - captionAreaHeight) + "px";
|
|
613
629
|
list.style.left = pos[1] + "px";
|
|
614
630
|
if (this.fullWidth) {
|
|
615
631
|
list.style.width = targetElement.offsetWidth + "px";
|
|
@@ -632,6 +648,7 @@ export class BcmList {
|
|
|
632
648
|
type: 'dismissable',
|
|
633
649
|
itemObject: tag.itemObject || null,
|
|
634
650
|
});
|
|
651
|
+
await delay(10);
|
|
635
652
|
return Promise.resolve(element.componentOnReady());
|
|
636
653
|
}
|
|
637
654
|
async tagControl() {
|
|
@@ -742,6 +759,17 @@ export class BcmList {
|
|
|
742
759
|
}
|
|
743
760
|
}
|
|
744
761
|
}
|
|
762
|
+
removeTags() {
|
|
763
|
+
let tagContainer = this.el.querySelector(`#bcm-list-input-tag-container-${this._id}`);
|
|
764
|
+
if (tagContainer) {
|
|
765
|
+
if (this.type === 'autocomplete') {
|
|
766
|
+
tagContainer = this.el.querySelector(`#bcm-list-input-tag-container-${this._id}-autocomplete`);
|
|
767
|
+
}
|
|
768
|
+
tagContainer.querySelectorAll('bcm-tag-2').forEach(element => {
|
|
769
|
+
element.remove();
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
}
|
|
745
773
|
render() {
|
|
746
774
|
const { checkboxes, treeview, label, size, disabled, readonly, required, hidden, fullWidth, searchable } = this.getOptions();
|
|
747
775
|
const hostClasses = cs('bcm-list', `bcm-list__size-${size}`, size === 'large' ? 'size-3' : 'size-2', {
|
|
@@ -1541,7 +1569,8 @@ export class BcmList {
|
|
|
1541
1569
|
"searchFound": {},
|
|
1542
1570
|
"returnFilterData": {},
|
|
1543
1571
|
"returnOtherData": {},
|
|
1544
|
-
"
|
|
1572
|
+
"isLoadingInput": {},
|
|
1573
|
+
"isLoadingList": {},
|
|
1545
1574
|
"options": {},
|
|
1546
1575
|
"tagContainerWidth": {},
|
|
1547
1576
|
"selectAllItem": {}
|
|
@@ -154,7 +154,7 @@ const addChecked = (id, ids) => {
|
|
|
154
154
|
const value = getValue(id);
|
|
155
155
|
if (value) {
|
|
156
156
|
ids.forEach((item) => {
|
|
157
|
-
checkedItem(id, item
|
|
157
|
+
checkedItem(id, item);
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
160
|
};
|
|
@@ -173,7 +173,7 @@ const findItem = (id, itemId, items) => {
|
|
|
173
173
|
}
|
|
174
174
|
if (dataSource) {
|
|
175
175
|
dataSource.forEach((item) => {
|
|
176
|
-
if (itemId.includes(item.id
|
|
176
|
+
if (itemId.includes(item.id)) {
|
|
177
177
|
checkedProcess(id, item);
|
|
178
178
|
if (item.parentId) {
|
|
179
179
|
indeterminateStatus(id, item.parentId);
|
|
@@ -1,13 +1,42 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
2
|
import Bcm from '../models/bcm';
|
|
3
3
|
import cs from 'classnames';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
import { NumberHelper } from '../helper/number-helper';
|
|
5
|
+
import { extractColor } from '../utils/utils';
|
|
6
|
+
import { ColorPalette } from '../global/variables/colors';
|
|
7
|
+
import { ColorProps } from '../components/atoms/tag-2/types';
|
|
8
|
+
export const TagTemplate = ({ _id, color, customStyle, size, checked, hidden, value, type, onDismiss, onSelect }) => {
|
|
9
|
+
!size && (size = Bcm.FontSize['size-1']);
|
|
10
|
+
const getColor = (color) => {
|
|
11
|
+
if ((type === Bcm.TagType.basic || type == Bcm.TagType.dismissable) && ColorProps[color])
|
|
12
|
+
return {
|
|
13
|
+
color: extractColor(ColorPalette, ColorProps[color] + '-6'),
|
|
14
|
+
borderColor: extractColor(ColorPalette, ColorProps[color] + '-3'),
|
|
15
|
+
backgroundColor: extractColor(ColorPalette, ColorProps[color] + '-1')
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
const getSize = (size, returnNumber = false) => {
|
|
19
|
+
if (NumberHelper.isNumber(size)) {
|
|
20
|
+
size = Bcm.FontSize["size-" + size] || Bcm.FontSize["size-4"];
|
|
21
|
+
}
|
|
22
|
+
if (returnNumber) {
|
|
23
|
+
return +(Bcm.FontSizeValue[size] || Bcm.FontSizeValue['size-4']) + 2;
|
|
24
|
+
}
|
|
25
|
+
return size;
|
|
26
|
+
};
|
|
27
|
+
const classes = cs('bcm-tag-2__content', type, getSize(size));
|
|
28
|
+
const hostClasses = cs('bcm-tag-2', {
|
|
29
|
+
hidden
|
|
30
|
+
});
|
|
31
|
+
const calculatedSize = getSize(size, true);
|
|
32
|
+
return (h("div", { id: _id, class: cs(hostClasses, { checked }) },
|
|
33
|
+
h("span", { hidden: true },
|
|
34
|
+
h("slot", null)),
|
|
35
|
+
h("span", { class: classes, style: getColor(color), onClick: (e) => onSelect(e) },
|
|
36
|
+
type === Bcm.TagType.add && (h("span", { class: "left" },
|
|
37
|
+
h("bcm-icon", { icon: "plus", type: "outlined", color: "grey-8", size: calculatedSize }))),
|
|
38
|
+
type === Bcm.TagType.checkable && h("input", { type: "checkbox", checked: checked }),
|
|
39
|
+
h("span", { class: "value", style: customStyle }, value),
|
|
40
|
+
type === Bcm.TagType.dismissable && (h("span", { class: "right close-button", onClick: (e) => onDismiss(e) },
|
|
41
|
+
h("i", { class: "bcm-fal bcm-fa-times" }))))));
|
|
42
|
+
};
|