bromcom-ui 2.3.54 → 2.3.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bromcom-ui/bromcom-ui.css +0 -0
- package/dist/bromcom-ui/bromcom-ui.esm.js +1 -1
- package/dist/bromcom-ui/index.esm.js +0 -0
- package/dist/bromcom-ui/p-12493dbc.entry.js +1 -0
- package/dist/bromcom-ui/{p-a18a0cc4.entry.js → p-13d038f5.entry.js} +1 -1
- package/dist/bromcom-ui/p-1429a2b4.js +1 -0
- package/dist/bromcom-ui/{p-4b7f14ed.entry.js → p-20d03fa1.entry.js} +1 -1
- package/dist/bromcom-ui/{p-774ff4d9.entry.js → p-30c1cd7f.entry.js} +1 -1
- package/dist/bromcom-ui/p-37750343.entry.js +1 -0
- package/dist/bromcom-ui/p-3f797656.entry.js +1 -0
- package/dist/bromcom-ui/{p-4396ee3b.entry.js → p-4092f5f1.entry.js} +1 -1
- package/dist/bromcom-ui/p-4a41ef80.entry.js +1 -0
- package/dist/bromcom-ui/p-4cb268d2.js +1 -0
- package/dist/bromcom-ui/p-53e9b679.entry.js +1 -0
- package/dist/bromcom-ui/{p-09753e05.js → p-554d326a.js} +1 -1
- package/dist/bromcom-ui/p-68ff64de.js +1 -0
- package/dist/bromcom-ui/p-7238d22f.entry.js +1 -0
- package/dist/bromcom-ui/p-7f1cd976.entry.js +1 -0
- package/dist/bromcom-ui/p-811c24d7.entry.js +1 -0
- package/dist/bromcom-ui/p-8851e01e.entry.js +1 -0
- package/dist/bromcom-ui/{p-1a2724a0.entry.js → p-92e3e240.entry.js} +1 -1
- package/dist/bromcom-ui/p-9ffff762.entry.js +1 -0
- package/dist/bromcom-ui/p-a6ef098a.entry.js +1 -0
- package/dist/bromcom-ui/p-af7e4741.entry.js +1 -0
- package/dist/bromcom-ui/{p-0d336381.entry.js → p-afb68492.entry.js} +1 -1
- package/dist/bromcom-ui/p-bbf99620.entry.js +1 -0
- package/dist/bromcom-ui/p-bc50aa86.entry.js +1 -0
- package/dist/bromcom-ui/p-e21a8f2d.entry.js +1 -0
- package/dist/bromcom-ui/p-e450ebda.entry.js +1 -0
- package/dist/bromcom-ui/p-e8307da9.entry.js +1 -0
- package/dist/bromcom-ui/{p-26b3d5d0.entry.js → p-e8771d32.entry.js} +1 -1
- package/dist/bromcom-ui/p-f067821e.entry.js +1 -0
- package/dist/bromcom-ui/p-f12743d8.entry.js +1 -0
- package/dist/bromcom-ui/p-ff5e57d3.entry.js +1 -0
- package/dist/cjs/bcm-alert.cjs.entry.js +7 -26
- package/dist/cjs/bcm-badge.cjs.entry.js +50 -0
- package/dist/cjs/{bcm-badge_20.cjs.entry.js → bcm-button_11.cjs.entry.js} +1209 -2835
- package/dist/cjs/bcm-checkbox-lite_4.cjs.entry.js +291 -0
- package/dist/cjs/bcm-colorpicker.cjs.entry.js +3 -3
- package/dist/cjs/{bcm-datetime-picker_2.cjs.entry.js → bcm-datetime-picker.cjs.entry.js} +3 -137
- package/dist/cjs/bcm-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/bcm-list-item_2.cjs.entry.js +197 -0
- package/dist/cjs/bcm-list-select.cjs.entry.js +658 -0
- package/dist/cjs/bcm-list.cjs.entry.js +1204 -0
- package/dist/cjs/{bcm-empty_6.cjs.entry.js → bcm-listbox_5.cjs.entry.js} +10 -77
- package/dist/cjs/bcm-modal.cjs.entry.js +197 -0
- package/dist/cjs/bcm-popconfirm-box.cjs.entry.js +1 -1
- package/dist/cjs/bcm-popconfirm.cjs.entry.js +2 -2
- package/dist/cjs/bcm-popover-box.cjs.entry.js +1 -1
- package/dist/cjs/bcm-popover.cjs.entry.js +2 -2
- package/dist/cjs/bcm-pulldown-group_2.cjs.entry.js +1 -1
- package/dist/cjs/bcm-pulldown.cjs.entry.js +1 -1
- package/dist/cjs/bcm-radio-group.cjs.entry.js +124 -0
- package/dist/cjs/bcm-radio.cjs.entry.js +104 -0
- package/dist/cjs/bcm-select.cjs.entry.js +68 -8
- package/dist/cjs/bcm-tab-pane.cjs.entry.js +51 -0
- package/dist/cjs/bcm-tab.cjs.entry.js +72 -0
- package/dist/cjs/bcm-tabs-content.cjs.entry.js +43 -0
- package/dist/cjs/bcm-tabs.cjs.entry.js +361 -0
- package/dist/cjs/bcm-text.cjs.entry.js +28 -0
- package/dist/cjs/bcm-upload.cjs.entry.js +1 -1
- package/dist/cjs/bromcom-ui.cjs.js +1 -1
- package/dist/cjs/{element-dragger-36fcb296.js → element-dragger-4a91c708.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/types-37c8ced6.js +16 -0
- package/dist/cjs/types-f53bc841.js +19 -0
- package/dist/cjs/{utils-43fda566.js → utils-60414768.js} +25 -0
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/atoms/label/label.css +70 -0
- package/dist/collection/components/atoms/label/label.js +203 -0
- package/dist/collection/components/molecules/checkbox/group.js +19 -6
- package/dist/collection/components/molecules/input/input.js +39 -7
- package/dist/collection/components/molecules/list/list-item.css +1 -0
- package/dist/collection/components/molecules/list/list-select.css +10 -5
- package/dist/collection/components/molecules/list/list-select.js +232 -34
- package/dist/collection/components/molecules/list/list.css +24 -2
- package/dist/collection/components/molecules/list/list.js +391 -119
- package/dist/collection/components/molecules/popconfirm/popconfirm-box.css +1 -0
- package/dist/collection/components/molecules/popconfirm/popconfirm.css +1 -0
- package/dist/collection/components/molecules/popover/popover-box.css +1 -0
- package/dist/collection/components/molecules/popover/popover.css +1 -0
- package/dist/collection/components/molecules/radio/group.js +19 -6
- package/dist/collection/components/molecules/search/search.js +2 -2
- package/dist/collection/components/molecules/select/select.js +85 -12
- package/dist/collection/components/molecules/switch/switch.css +0 -1
- package/dist/collection/components/molecules/switch/switch.js +20 -7
- package/dist/collection/components/molecules/textarea/textarea.css +4 -1
- package/dist/collection/components/molecules/textarea/textarea.js +33 -17
- package/dist/collection/components/molecules/tooltip/tooltip-box.css +1 -0
- package/dist/collection/components/molecules/tooltip/tooltip.css +1 -0
- package/dist/collection/components/organism/colorpicker/colorpicker.js +19 -6
- package/dist/collection/components/organism/datetime-picker/datetime-picker.js +1 -1
- package/dist/collection/components/organism/form/form.js +5 -4
- package/dist/collection/components/organism/listbox/listbox.js +27 -17
- package/dist/collection/helper/color-helper.js +33 -0
- package/dist/collection/helper/generate.js +47 -0
- package/dist/collection/helper/number-helper.js +10 -0
- package/dist/collection/helper/string-helper.js +21 -0
- package/dist/collection/helper/validators.js +21 -0
- package/dist/collection/models/bcm-types.js +1 -0
- package/dist/collection/models/bcm.js +451 -0
- package/dist/collection/templates/caption-template.js +22 -0
- package/dist/collection/templates/label-template.js +16 -0
- package/dist/collection/templates/slot-template.js +6 -0
- package/dist/collection/utils/utils.js +24 -0
- package/dist/esm/bcm-alert.entry.js +1 -20
- package/dist/esm/bcm-badge.entry.js +46 -0
- package/dist/esm/{bcm-badge_20.entry.js → bcm-button_11.entry.js} +1204 -2821
- package/dist/esm/bcm-checkbox-lite_4.entry.js +284 -0
- package/dist/esm/bcm-colorpicker.entry.js +3 -3
- package/dist/esm/{bcm-datetime-picker_2.entry.js → bcm-datetime-picker.entry.js} +4 -137
- package/dist/esm/bcm-dropdown.entry.js +1 -1
- package/dist/esm/bcm-list-item_2.entry.js +192 -0
- package/dist/esm/bcm-list-select.entry.js +654 -0
- package/dist/esm/bcm-list.entry.js +1200 -0
- package/dist/esm/{bcm-empty_6.entry.js → bcm-listbox_5.entry.js} +12 -78
- package/dist/esm/bcm-modal.entry.js +193 -0
- package/dist/esm/bcm-popconfirm-box.entry.js +1 -1
- package/dist/esm/bcm-popconfirm.entry.js +2 -2
- package/dist/esm/bcm-popover-box.entry.js +1 -1
- package/dist/esm/bcm-popover.entry.js +2 -2
- package/dist/esm/bcm-pulldown-group_2.entry.js +1 -1
- package/dist/esm/bcm-pulldown.entry.js +1 -1
- package/dist/esm/bcm-radio-group.entry.js +120 -0
- package/dist/esm/bcm-radio.entry.js +100 -0
- package/dist/esm/bcm-select.entry.js +68 -8
- package/dist/esm/bcm-tab-pane.entry.js +47 -0
- package/dist/esm/bcm-tab.entry.js +68 -0
- package/dist/esm/bcm-tabs-content.entry.js +39 -0
- package/dist/esm/bcm-tabs.entry.js +357 -0
- package/dist/esm/bcm-text.entry.js +24 -0
- package/dist/esm/bcm-upload.entry.js +1 -1
- package/dist/esm/bromcom-ui.js +1 -1
- package/dist/esm/{element-dragger-03ac2a5e.js → element-dragger-97a8f373.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/polyfills/css-shim.js +0 -0
- package/dist/esm/types-4b11eac9.js +28 -0
- package/dist/esm/types-911a8837.js +21 -0
- package/dist/esm/{utils-b7fba7c4.js → utils-de9aee67.js} +25 -1
- package/dist/types/assets/icons/index.d.ts +0 -0
- package/dist/types/assets/icons/index.example.d.ts +0 -0
- package/dist/types/components/atoms/avatar/avatar.d.ts +0 -0
- package/dist/types/components/atoms/badge/badge.d.ts +0 -0
- package/dist/types/components/atoms/button/button.d.ts +0 -0
- package/dist/types/components/atoms/divider/divider.d.ts +0 -0
- package/dist/types/components/atoms/icon/icon.d.ts +0 -0
- package/dist/types/components/atoms/icon/types.d.ts +0 -0
- package/dist/types/components/atoms/label/label.d.ts +16 -0
- package/dist/types/components/atoms/tag/tag.d.ts +0 -0
- package/dist/types/components/atoms/text/text.d.ts +0 -0
- package/dist/types/components/molecules/card/card-footer.d.ts +0 -0
- package/dist/types/components/molecules/card/card-header.d.ts +0 -0
- package/dist/types/components/molecules/card/card.d.ts +0 -0
- package/dist/types/components/molecules/checkbox/checkbox.d.ts +0 -0
- package/dist/types/components/molecules/checkbox/group.d.ts +1 -0
- package/dist/types/components/molecules/input/input.d.ts +2 -0
- package/dist/types/components/molecules/list/list-select.d.ts +24 -4
- package/dist/types/components/molecules/list/list.d.ts +13 -3
- package/dist/types/components/molecules/radio/group.d.ts +1 -0
- package/dist/types/components/molecules/radio/radio.d.ts +0 -0
- package/dist/types/components/molecules/select/group.d.ts +0 -0
- package/dist/types/components/molecules/select/option.d.ts +0 -0
- package/dist/types/components/molecules/select/select.d.ts +1 -0
- package/dist/types/components/molecules/switch/switch.d.ts +1 -0
- package/dist/types/components/molecules/textarea/textarea.d.ts +3 -2
- package/dist/types/components/organism/colorpicker/colorpicker.d.ts +1 -0
- package/dist/types/components/organism/listbox/listbox.d.ts +1 -0
- package/dist/types/components.d.ts +95 -12
- package/dist/types/global/variables/colors.d.ts +0 -0
- package/dist/types/helper/color-helper.d.ts +9 -0
- package/dist/types/helper/generate.d.ts +10 -0
- package/dist/types/helper/number-helper.d.ts +9 -0
- package/dist/types/helper/string-helper.d.ts +20 -0
- package/dist/types/helper/validators.d.ts +8 -0
- package/dist/types/index.d.ts +0 -0
- package/dist/types/models/bcm-types.d.ts +19 -0
- package/dist/types/models/bcm.d.ts +447 -0
- package/dist/types/stencil-public-runtime.d.ts +0 -0
- package/dist/types/templates/caption-template.d.ts +12 -0
- package/dist/types/templates/label-template.d.ts +12 -0
- package/dist/types/templates/slot-template.d.ts +8 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/loader/cdn.js +0 -0
- package/loader/index.cjs.js +0 -0
- package/loader/index.d.ts +0 -0
- package/loader/index.es2017.js +0 -0
- package/loader/index.js +0 -0
- package/loader/package.json +0 -0
- package/package.json +1 -1
- package/dist/bromcom-ui/p-013b6f5d.entry.js +0 -1
- package/dist/bromcom-ui/p-0532e299.entry.js +0 -1
- package/dist/bromcom-ui/p-0aa53bdb.entry.js +0 -1
- package/dist/bromcom-ui/p-2c1ee381.entry.js +0 -1
- package/dist/bromcom-ui/p-607bc9b3.entry.js +0 -1
- package/dist/bromcom-ui/p-6355c903.entry.js +0 -1
- package/dist/bromcom-ui/p-6bd805f1.entry.js +0 -1
- package/dist/bromcom-ui/p-77a480ff.entry.js +0 -1
- package/dist/bromcom-ui/p-a88256f2.entry.js +0 -1
- package/dist/bromcom-ui/p-b92324e7.js +0 -1
- package/dist/bromcom-ui/p-ba219861.entry.js +0 -1
- package/dist/bromcom-ui/p-cdfd9ba0.entry.js +0 -1
- package/dist/bromcom-ui/p-cf6b0656.entry.js +0 -1
- package/dist/cjs/bcm-checkbox-group.cjs.entry.js +0 -273
- package/dist/cjs/bcm-checkbox.cjs.entry.js +0 -143
- package/dist/cjs/bcm-switch.cjs.entry.js +0 -86
- package/dist/cjs/bcm-textarea.cjs.entry.js +0 -136
- package/dist/cjs/bcm-tooltip-box.cjs.entry.js +0 -36
- package/dist/esm/bcm-checkbox-group.entry.js +0 -269
- package/dist/esm/bcm-checkbox.entry.js +0 -139
- package/dist/esm/bcm-switch.entry.js +0 -82
- package/dist/esm/bcm-textarea.entry.js +0 -132
- package/dist/esm/bcm-tooltip-box.entry.js +0 -32
|
@@ -1,47 +1,9 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent
|
|
1
|
+
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-8fe7aea4.js';
|
|
2
2
|
import { c as classnames } from './index-e58a2d48.js';
|
|
3
3
|
import { C as ColorPalette } from './colors-7c7b35e9.js';
|
|
4
|
-
import { e as extractColor, g as getChilds, d as delay
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @desc
|
|
10
|
-
* @param str
|
|
11
|
-
*/
|
|
12
|
-
const lowercase = (str) => str.toLowerCase();
|
|
13
|
-
const BcmBadge = class {
|
|
14
|
-
constructor(hostRef) {
|
|
15
|
-
registerInstance(this, hostRef);
|
|
16
|
-
this.type = 'basic';
|
|
17
|
-
this.status = this.type === 'basic' ? 'error' : 'default';
|
|
18
|
-
this.hidden = false;
|
|
19
|
-
this.color = null;
|
|
20
|
-
this.size = 'small';
|
|
21
|
-
}
|
|
22
|
-
handleColor(color) {
|
|
23
|
-
var returnColor;
|
|
24
|
-
if (color) {
|
|
25
|
-
if (color.match(/^#[a-f0-9]{6}$/i) !== null || lowercase(color.substring(0, 3)) === "rgb") {
|
|
26
|
-
returnColor = color;
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
returnColor = extractColor(ColorPalette, color);
|
|
30
|
-
}
|
|
31
|
-
return { backgroundColor: returnColor };
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
render() {
|
|
35
|
-
const dotClass = classnames('badge-dot', this.status, this.type, this.size);
|
|
36
|
-
if (this.type === 'info') {
|
|
37
|
-
return (h("div", { class: "badge-info" }, h("span", { class: dotClass, style: this.handleColor(this.color) }), h("span", { class: "badge-text" }, h("slot", null))));
|
|
38
|
-
}
|
|
39
|
-
const hostClasses = classnames(this.hidden ? 'hidden' : null);
|
|
40
|
-
return (h(Host, { class: hostClasses }, !this.value ? h("span", { class: dotClass, style: this.handleColor(this.color) })
|
|
41
|
-
: (h("span", { class: `badge-basic ${this.status}` }, " ", this.value, " "))));
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
BcmBadge.style = badgeCss;
|
|
4
|
+
import { e as extractColor, g as getChilds, d as delay } from './utils-de9aee67.js';
|
|
5
|
+
import { S as StatusProps } from './types-911a8837.js';
|
|
6
|
+
import { p as popoverPlacement, a as popoverBoxPlacement } from './popover-placement-a4ab1587.js';
|
|
45
7
|
|
|
46
8
|
/**
|
|
47
9
|
* 'type' prop variantOption
|
|
@@ -281,64 +243,403 @@ const BcmButton = class {
|
|
|
281
243
|
};
|
|
282
244
|
BcmButton.style = buttonsCss;
|
|
283
245
|
|
|
246
|
+
/**
|
|
247
|
+
* 'color' prop predefined values
|
|
248
|
+
*/
|
|
249
|
+
var ColorProps;
|
|
250
|
+
(function (ColorProps) {
|
|
251
|
+
ColorProps["black"] = "black";
|
|
252
|
+
ColorProps["white"] = "white";
|
|
253
|
+
ColorProps["prime-blue"] = "prime-blue";
|
|
254
|
+
ColorProps["grey"] = "grey";
|
|
255
|
+
ColorProps["blue"] = "blue";
|
|
256
|
+
ColorProps["warmyellow"] = "warmyellow";
|
|
257
|
+
ColorProps["yellow"] = "yellow";
|
|
258
|
+
ColorProps["limegreen"] = "limegreen";
|
|
259
|
+
ColorProps["red"] = "red";
|
|
260
|
+
ColorProps["darkorange"] = "darkorange";
|
|
261
|
+
ColorProps["orange"] = "orange";
|
|
262
|
+
ColorProps["green"] = "green";
|
|
263
|
+
ColorProps["turquosie"] = "turquosie";
|
|
264
|
+
ColorProps["cobaltblue"] = "cobaltblue";
|
|
265
|
+
ColorProps["magenta"] = "magenta";
|
|
266
|
+
ColorProps["purple"] = "purple";
|
|
267
|
+
ColorProps["bc-red"] = "bc-red";
|
|
268
|
+
ColorProps["bc-blue"] = "bc-blue";
|
|
269
|
+
ColorProps["bc-green"] = "bc-green";
|
|
270
|
+
ColorProps["bc-orange"] = "bc-orange";
|
|
271
|
+
})(ColorProps || (ColorProps = {}));
|
|
272
|
+
|
|
284
273
|
const checkboxCss = "@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}.size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}:host{display:inline-block}:host(.hidden){display:none}input{display:none}.svg-icon{filter:brightness(0) invert(1);width:12px;height:12px}label{display:flex;align-items:flex-start;font-size:14px;color:var(--bcm-color-grey-8);cursor:pointer}label span.icon{display:flex;align-items:center;justify-content:center;min-width:16px;min-height:16px;border:1px solid #D9D9D9;margin-right:8px;border-radius:2px;margin-top:2px;background-color:var(--bcm-color-grey-1)}:host(.indeterminate) label span.icon{position:relative}:host(.indeterminate) label span.icon::after{content:\"\";position:absolute;top:50%;left:8px;width:10px;height:10px;background-color:var(--bcm-color-prime-blue-6);transform:translate(-50%, -50%);opacity:1;z-index:1}:host(.indeterminate) label span.icon::before{content:\"\";position:absolute;top:-1px;left:-1px;width:16px;height:100%;border-radius:2px;background-color:var(--bcm-color-grey-1);border:1px solid var(--bcm-color-grey-5);opacity:1;z-index:1}:host(.indeterminate) label span.icon:hover:not(.disabled):before{border-color:var(--bcm-color-prime-blue-6);box-shadow:0px 2px 4px rgba(54, 121, 171, 0.5)}input:checked+label span.icon{background-color:var(--bcm-color-prime-blue-6);border-color:transparent}input:checked+label .icon-checked{display:block}bcm-icon{filter:brightness(0) invert(1)}input[disabled]+label{cursor:not-allowed}input[disabled]+label span.icon{background-color:var(--bcm-color-grey-3);border-color:var(--bcm-color-grey-5)}input[disabled]+label bcm-icon{filter:brightness(0);opacity:0.3}input:not([disabled])+label:hover span.icon{border-color:var(--bcm-color-prime-blue-6);box-shadow:0px 2px 4px rgba(54, 121, 171, 0.5)}:host(.error) input:not([disabled])+label span.icon{border-color:var(--bcm-color-red-6)}.caption-area{margin-bottom:8px;min-height:20px;display:block}.input-caption{display:block}.caption-default{color:#8C8C8C}.caption-primary{color:#4293CF}.caption-success{color:#52C41A}.caption-warning{color:#FA8C16}.caption-error{color:#F5222D}.radio-button{background-color:var(--bcm-color-grey-1);color:var(--bcm-color-grey-8);border:1px solid var(--bcm-color-grey-5);padding:0 16px;box-sizing:border-box;display:flex;align-items:center;justify-content:center}.radio-button>span.icon{display:none}.radio-button>span.slot{display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden;user-select:none}.radio-button:hover:not(.disabled){color:var(--bcm-color-prime-blue-5)}.radio-button:active:not(.disabled){color:var(--bcm-color-prime-blue-7)}.radio-button.disabled{background-color:var(--bcm-color-grey-3);color:var(--bcm-color-grey-6);cursor:not-allowed}.radio-button.checked.disabled{background-color:var(--bcm-color-grey-4);color:var(--bcm-color-grey-1);border-color:var(--bcm-color-grey-5)}.radio-button.checked.solid{color:var(--bcm-color-grey-1);background-color:var(--bcm-color-prime-blue-6);border-color:var(--bcm-color-prime-blue-6)}.radio-button.checked.solid:hover{background-color:var(--bcm-color-prime-blue-5);border-color:var(--bcm-color-prime-blue-5)}.radio-button.checked.solid:active{background-color:var(--bcm-color-prime-blue-7);border-color:var(--bcm-color-prime-blue-7)}.radio-button.checked.outline{background-color:var(--bcm-color-grey-1);color:var(--bcm-color-prime-blue-6);border-color:var(--bcm-color-prime-blue-6)}.radio-button.checked.outline:hover{color:var(--bcm-color-prime-blue-5);border-color:var(--bcm-color-prime-blue-5)}.radio-button.checked.outline:active{color:var(--bcm-color-prime-blue-7);border-color:var(--bcm-color-prime-blue-7)}.radio-button.large{height:40px}.radio-button.medium{height:32px}.radio-button.small{height:24px}";
|
|
285
274
|
|
|
286
|
-
const
|
|
275
|
+
const BcmCheckbox = class {
|
|
287
276
|
constructor(hostRef) {
|
|
288
277
|
registerInstance(this, hostRef);
|
|
278
|
+
this.blur = createEvent(this, "bcm-blur", 7);
|
|
279
|
+
this.focus = createEvent(this, "bcm-focus", 7);
|
|
280
|
+
this.change = createEvent(this, "bcm-change", 7);
|
|
289
281
|
/**
|
|
290
282
|
* Component Properties
|
|
291
283
|
*/
|
|
292
284
|
this.value = '';
|
|
293
285
|
this.name = 'checkbox';
|
|
294
286
|
this.checked = false;
|
|
295
|
-
this.indeterminate = false;
|
|
296
287
|
this.disabled = false;
|
|
297
288
|
this.readOnly = false;
|
|
298
289
|
this.hidden = false;
|
|
299
290
|
this.required = false;
|
|
291
|
+
this.optionType = 'default';
|
|
292
|
+
this.buttonStyle = 'solid';
|
|
293
|
+
this.size = 'medium';
|
|
300
294
|
this.noCaption = false;
|
|
301
295
|
this.captionType = 'default';
|
|
302
296
|
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
297
|
+
/**
|
|
298
|
+
* @ComponentMethod
|
|
299
|
+
*/
|
|
300
|
+
connectedCallback() {
|
|
301
|
+
this.handleChange = this.handleChange.bind(this);
|
|
302
|
+
this.captionCache = this.caption;
|
|
303
|
+
this.captionTypeCache = this.captionType;
|
|
304
|
+
}
|
|
305
|
+
async setClear() {
|
|
306
|
+
if (this.inputElement.checked == true) {
|
|
307
|
+
this.inputElement.checked = false;
|
|
308
|
+
this.handleChange();
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
async resetCaption() {
|
|
312
|
+
this.caption = this.captionCache;
|
|
313
|
+
this.captionType = this.captionTypeCache;
|
|
314
|
+
this.captionError = null;
|
|
315
|
+
}
|
|
316
|
+
componentDidLoad() {
|
|
317
|
+
this.value = this.inputElement.checked;
|
|
318
|
+
this.checked = this.value;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* @desc
|
|
322
|
+
* @param event
|
|
323
|
+
* @returns
|
|
324
|
+
*/
|
|
325
|
+
handleChange() {
|
|
326
|
+
this.value = this.inputElement.checked;
|
|
327
|
+
this.checked = this.value;
|
|
328
|
+
this.change.emit({
|
|
329
|
+
name: this.name,
|
|
330
|
+
value: this.value
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
handleFocus() {
|
|
334
|
+
this.focus.emit();
|
|
335
|
+
}
|
|
336
|
+
handleBlur() {
|
|
337
|
+
this.blur.emit();
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* @desc
|
|
341
|
+
* @param name -
|
|
342
|
+
* @returns {void}
|
|
343
|
+
*/
|
|
344
|
+
async check(uncheck) {
|
|
345
|
+
this.inputElement.checked = uncheck;
|
|
346
|
+
this.handleChange();
|
|
347
|
+
}
|
|
348
|
+
getColor(color) {
|
|
349
|
+
if (this.color !== 'default' && this.optionType == 'button' && this.checked)
|
|
350
|
+
return {
|
|
351
|
+
// color: extractColor(ColorPalette, ColorProps[color] + '-6'),
|
|
352
|
+
borderColor: extractColor(ColorPalette, ColorProps[color] + '-5'),
|
|
353
|
+
backgroundColor: extractColor(ColorPalette, ColorProps[color] + '-5')
|
|
354
|
+
};
|
|
355
|
+
}
|
|
311
356
|
render() {
|
|
312
|
-
const { disabled, checked, readOnly, name, required } = this;
|
|
357
|
+
const { disabled, checked, readOnly, name, handleChange, required, caption, captionError, captionType, noCaption, buttonStyle, size, optionType } = this;
|
|
313
358
|
const hostClasses = classnames(this.hidden ? 'hidden' : null, {
|
|
314
|
-
'
|
|
359
|
+
'error': captionType == 'error' ? true : false
|
|
360
|
+
});
|
|
361
|
+
const captionClasses = classnames('size-1', 'input-caption', 'caption-' + captionType);
|
|
362
|
+
const defaultClasses = classnames();
|
|
363
|
+
const buttonClasses = classnames('radio-button', buttonStyle, size, {
|
|
364
|
+
'size-2': size === 'small' || size === 'medium',
|
|
365
|
+
'size-3': size === 'large',
|
|
366
|
+
'checked': checked,
|
|
367
|
+
'disabled': disabled,
|
|
315
368
|
});
|
|
316
|
-
|
|
317
|
-
|
|
369
|
+
var fontColor = extractColor(ColorPalette, ColorProps[this.color] + '-6');
|
|
370
|
+
var style = "<style>.radio-button:not(.checked):hover{color: " + fontColor + "} </style>";
|
|
371
|
+
return (h(Host, { class: hostClasses, onFocus: () => this.handleFocus(), onBlur: () => this.handleBlur() }, h("input", { id: name, type: "checkbox", checked: checked, disabled: disabled, required: required, readOnly: readOnly, onChange: handleChange, ref: el => (this.inputElement = el) }), optionType == 'button' && (h("span", { innerHTML: style })), h("label", { title: optionType == 'button' ? this.el.innerHTML : null, htmlFor: name, class: optionType == 'default' ? defaultClasses : buttonClasses, style: this.getColor(this.color) }, h("span", { class: "icon" }, h("bcm-icon", { class: "icon-checked", icon: "component-check", size: "small", type: "default" })), h("span", { class: "slot" }, h("slot", null))), !noCaption && (h("div", { class: "caption-area" }, captionType == "error"
|
|
372
|
+
? h("span", { class: captionClasses }, " ", captionError, " ")
|
|
373
|
+
: caption && h("span", { class: captionClasses }, " ", caption, " ")))));
|
|
318
374
|
}
|
|
319
375
|
get el() { return getElement(this); }
|
|
320
376
|
};
|
|
321
|
-
|
|
377
|
+
BcmCheckbox.style = checkboxCss;
|
|
322
378
|
|
|
323
|
-
const
|
|
379
|
+
const groupCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");.size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}:host{display:block;width:100%}:host(.hidden){display:none}:host(.error) .label{color:var(--bcm-color-red-6) !important}.group-container{display:flex;gap:24px}.group-container.vertical{gap:unset;flex-direction:column}.group-container.button{gap:unset}.group-container.full-width{max-width:100%}.indeterminate{padding:0 0 16px 0;margin-bottom:16px;border-bottom:1px solid #efefef;}.indeterminate input{display:none}.indeterminate label{display:flex;align-items:center;font-size:14px;color:var(--bcm-color-grey-8);cursor:pointer}.indeterminate label .icon-checked{display:none}.indeterminate span{position:relative;display:flex;align-items:center;justify-content:center;width:16px;height:16px;border:1px solid #D9D9D9;margin-right:8px;border-radius:2px}.indeterminate span:after{content:\"\";position:absolute;top:50%;left:50%;width:10px;height:10px;background-color:var(--bcm-color-prime-blue-6);transform:translate(-50%, -50%);opacity:0}.indeterminate bcm-icon{filter:brightness(0) invert(1)}.indeterminate input[disabled]+label{cursor:not-allowed}.indeterminate input[disabled]+label span{background-color:var(--bcm-color-grey-3);border-color:var(--bcm-color-grey-5)}.indeterminate input[disabled]+label span:after{background-color:var(--bcm-color-grey-6)}.indeterminate input[disabled]+label bcm-icon{filter:brightness(0);opacity:0.3}.indeterminate input:not([disabled])+label:hover span{border-color:var(--bcm-color-prime-blue-6);box-shadow:0px 2px 4px rgba(54, 121, 171, 0.5)}.indeterminate.bcm-uncheck label span{background-color:#ffffff}.indeterminate.bcm-determinate bcm-icon{display:block}.indeterminate.bcm-determinate label span{background-color:var(--bcm-color-prime-blue-6);border-color:transparent}.indeterminate.bcm-determinate label span:after{opacity:0}.indeterminate.bcm-indeterminate bcm-icon{display:none !important}.indeterminate.bcm-indeterminate label span{background-color:#ffffff}.indeterminate.bcm-indeterminate label span:after{opacity:1}.label{display:flex;flex-direction:column;color:var(--bcm-color-grey-9);margin-bottom:8px}";
|
|
324
380
|
|
|
325
|
-
const
|
|
381
|
+
const BcmCheckboxGroup = class {
|
|
326
382
|
constructor(hostRef) {
|
|
327
383
|
registerInstance(this, hostRef);
|
|
384
|
+
this.groupChange = createEvent(this, "bcm-group-change", 7);
|
|
385
|
+
this.groupCheckedList = createEvent(this, "bcm-group-checked-list", 7);
|
|
386
|
+
/**
|
|
387
|
+
* Private variables
|
|
388
|
+
*/
|
|
389
|
+
this.checkboxes = [];
|
|
390
|
+
/**
|
|
391
|
+
* Component Properties
|
|
392
|
+
*/
|
|
328
393
|
this.direction = 'horizontal';
|
|
329
|
-
this.
|
|
394
|
+
this.items = [];
|
|
395
|
+
this.indeterminate = false;
|
|
396
|
+
this.disabled = false;
|
|
330
397
|
this.hidden = false;
|
|
398
|
+
this.required = false;
|
|
399
|
+
this.label = null;
|
|
400
|
+
this.gap = null;
|
|
401
|
+
this.fullWidth = "false";
|
|
402
|
+
this.optionType = 'default';
|
|
403
|
+
this.buttonStyle = 'solid';
|
|
404
|
+
this.size = 'medium';
|
|
405
|
+
this.noCaption = false;
|
|
406
|
+
this.captionType = 'default';
|
|
407
|
+
/**
|
|
408
|
+
* Component State Variables
|
|
409
|
+
*/
|
|
410
|
+
this.indeterminateState = 'uncheck';
|
|
411
|
+
this.checkboxesProp = [];
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* @ComponentMethod
|
|
415
|
+
*/
|
|
416
|
+
componentWillLoad() {
|
|
417
|
+
this.parseItems(this.items);
|
|
418
|
+
this.parseOptions();
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* @ComponentMethod
|
|
422
|
+
*/
|
|
423
|
+
connectedCallback() { }
|
|
424
|
+
componentDidLoad() {
|
|
425
|
+
let checkboxesInit = [];
|
|
426
|
+
checkboxesInit = this.getAllInputs();
|
|
427
|
+
checkboxesInit.map(checkbox => {
|
|
428
|
+
if (this.fullWidth != "false") {
|
|
429
|
+
if (this.fullWidth === "flex") {
|
|
430
|
+
checkbox.style.flex = "auto";
|
|
431
|
+
}
|
|
432
|
+
else {
|
|
433
|
+
checkbox.style.width = "100%";
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
this.optionType && (checkbox.optionType = this.optionType);
|
|
437
|
+
this.buttonStyle && (checkbox.buttonStyle = this.buttonStyle);
|
|
438
|
+
this.size && (checkbox.size = this.size);
|
|
439
|
+
// this.required == true && checkbox.required == true && (
|
|
440
|
+
// checkbox.required = true
|
|
441
|
+
// )
|
|
442
|
+
this.disabled == true && (checkbox.disabled = true);
|
|
443
|
+
});
|
|
444
|
+
this.groupChecked().then(values => this.value = values);
|
|
445
|
+
}
|
|
446
|
+
async setClear() {
|
|
447
|
+
const checkboxesInit = this.getAllInputs();
|
|
448
|
+
checkboxesInit.map(checkbox => {
|
|
449
|
+
checkbox.setClear();
|
|
450
|
+
checkbox.noCaption = this.noCaption;
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
async resetCaption() {
|
|
454
|
+
const checkboxesInit = this.getAllInputs();
|
|
455
|
+
checkboxesInit.map(checkbox => {
|
|
456
|
+
checkbox.resetCaption();
|
|
457
|
+
checkbox.noCaption = this.noCaption;
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* @ComponentMethod
|
|
462
|
+
*/
|
|
463
|
+
componentDidRender() {
|
|
464
|
+
let slotElements;
|
|
465
|
+
slotElements = this.el.shadowRoot.querySelector('slot').assignedElements();
|
|
466
|
+
this.checkboxes = [];
|
|
467
|
+
// Get only bcm-checkbox elements from
|
|
468
|
+
// slot childs
|
|
469
|
+
slotElements.map(element => {
|
|
470
|
+
String(element.tagName).toLowerCase() == 'bcm-checkbox'
|
|
471
|
+
&& this.checkboxes.push(element);
|
|
472
|
+
});
|
|
473
|
+
this.setIndeterminateState();
|
|
474
|
+
if (this.items.length > 0) {
|
|
475
|
+
let checkboxesInit = [];
|
|
476
|
+
checkboxesInit = this.getAllInputs();
|
|
477
|
+
checkboxesInit.map(checkbox => {
|
|
478
|
+
this.defaultValueState && (this.defaultValueState.find(e => e === checkbox.name) && checkbox.check(checkbox.name));
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
componentDidUpdate() {
|
|
483
|
+
this.handleChange();
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* @desc
|
|
487
|
+
*/
|
|
488
|
+
inputChange() {
|
|
489
|
+
this.groupChecked().then(values => this.value = values);
|
|
490
|
+
this.setIndeterminateState();
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* @desc Returns merged slot and prop
|
|
494
|
+
* checkbox items
|
|
495
|
+
* @returns {Array<BcmCheckbox>}
|
|
496
|
+
*/
|
|
497
|
+
getAllInputs() {
|
|
498
|
+
return [
|
|
499
|
+
...this.checkboxes,
|
|
500
|
+
...this.el.shadowRoot.querySelectorAll('bcm-checkbox')
|
|
501
|
+
];
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* @desc
|
|
505
|
+
* @returns {void}
|
|
506
|
+
*/
|
|
507
|
+
setIndeterminateState() {
|
|
508
|
+
let state = 'uncheck';
|
|
509
|
+
let allChecked = true;
|
|
510
|
+
let allUnchecked = true;
|
|
511
|
+
this.getAllInputs().map((checkbox) => {
|
|
512
|
+
checkbox.checked && (allUnchecked = false);
|
|
513
|
+
!checkbox.checked && (allChecked = false);
|
|
514
|
+
});
|
|
515
|
+
!allChecked && !allUnchecked
|
|
516
|
+
? state = 'indeterminate'
|
|
517
|
+
: allChecked
|
|
518
|
+
? state = 'determinate'
|
|
519
|
+
: state = 'uncheck';
|
|
520
|
+
this.indeterminateState = state;
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* @desc
|
|
524
|
+
* @param event
|
|
525
|
+
*/
|
|
526
|
+
indeterminateClick() {
|
|
527
|
+
if (this.disabled == false) {
|
|
528
|
+
let checkAll = true;
|
|
529
|
+
if (this.indeterminateState == 'determinate') {
|
|
530
|
+
checkAll = false;
|
|
531
|
+
}
|
|
532
|
+
this.getAllInputs().map((checkbox) => {
|
|
533
|
+
checkbox.check(checkAll);
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
parseOptions() {
|
|
538
|
+
if (this.defaultValue) {
|
|
539
|
+
this.defaultValueState = JSON.parse(this.defaultValue);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* @desc
|
|
544
|
+
* @param newValue
|
|
545
|
+
* @returns {void}
|
|
546
|
+
*/
|
|
547
|
+
parseItems(newValue) {
|
|
548
|
+
if (newValue) {
|
|
549
|
+
typeof newValue == 'string'
|
|
550
|
+
? this.checkboxesProp = JSON.parse(newValue)
|
|
551
|
+
: this.checkboxesProp = newValue;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* @desc
|
|
556
|
+
* @param name -
|
|
557
|
+
* @returns {boolean | Array<any>}
|
|
558
|
+
*/
|
|
559
|
+
async check(options) {
|
|
560
|
+
if (options) {
|
|
561
|
+
typeof options == 'string'
|
|
562
|
+
? options = JSON.parse(options)
|
|
563
|
+
: options = options;
|
|
564
|
+
}
|
|
565
|
+
let checkboxes = [];
|
|
566
|
+
checkboxes = this.getAllInputs();
|
|
567
|
+
const inBoth = (list1, list2) => list1.filter(a => true === list2.some(b => a.name === b.name));
|
|
568
|
+
let optionsArray = options;
|
|
569
|
+
inBoth(checkboxes, options).map(item => {
|
|
570
|
+
item.check(optionsArray.find(x => x.name === item.name).checked);
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* @desc
|
|
575
|
+
* @param name -
|
|
576
|
+
* @returns {boolean | Array<any>}
|
|
577
|
+
*/
|
|
578
|
+
async groupChecked(name) {
|
|
579
|
+
let retVal = null;
|
|
580
|
+
let checkeds = {};
|
|
581
|
+
let checkboxes = [];
|
|
582
|
+
if (typeof retVal != 'boolean' && !retVal) {
|
|
583
|
+
retVal = checkeds;
|
|
584
|
+
}
|
|
585
|
+
// Merge slotted items with prop items
|
|
586
|
+
// #
|
|
587
|
+
checkboxes = this.getAllInputs();
|
|
588
|
+
checkboxes.map(checkbox => {
|
|
589
|
+
checkbox.checked && (checkeds[checkbox.name] = {
|
|
590
|
+
value: true,
|
|
591
|
+
name: checkbox.name
|
|
592
|
+
});
|
|
593
|
+
!checkbox.checked && (checkeds[checkbox.name] = {
|
|
594
|
+
value: false,
|
|
595
|
+
name: checkbox.name
|
|
596
|
+
});
|
|
597
|
+
if (checkbox.name === name) {
|
|
598
|
+
retVal = checkbox.checked;
|
|
599
|
+
}
|
|
600
|
+
});
|
|
601
|
+
return retVal;
|
|
602
|
+
}
|
|
603
|
+
handleChange() {
|
|
604
|
+
let checkeds = {};
|
|
605
|
+
let changes = {};
|
|
606
|
+
let checkboxes = [];
|
|
607
|
+
checkboxes = this.getAllInputs();
|
|
608
|
+
checkboxes.map(checkbox => {
|
|
609
|
+
checkbox.checked && (checkeds[checkbox.name] = {
|
|
610
|
+
value: true,
|
|
611
|
+
name: checkbox.name
|
|
612
|
+
});
|
|
613
|
+
changes[checkbox.name] = {
|
|
614
|
+
value: checkbox.checked ? true : false,
|
|
615
|
+
name: checkbox.name
|
|
616
|
+
};
|
|
617
|
+
});
|
|
618
|
+
this.groupChange.emit(changes);
|
|
619
|
+
this.groupCheckedList.emit(checkeds);
|
|
331
620
|
}
|
|
332
621
|
render() {
|
|
333
|
-
const
|
|
334
|
-
const
|
|
335
|
-
width: this.
|
|
336
|
-
};
|
|
337
|
-
const
|
|
338
|
-
|
|
622
|
+
const { checkboxesProp, indeterminate, disabled, label, required, captionType } = this;
|
|
623
|
+
const groupContainerClasses = classnames('group-container', this.direction, this.optionType, this.fullWidth, {
|
|
624
|
+
'full-width': this.fullWidth
|
|
625
|
+
});
|
|
626
|
+
const indeterminateClasses = classnames('indeterminate', 'bcm-' + this.indeterminateState, {
|
|
627
|
+
'disabled': disabled
|
|
628
|
+
});
|
|
629
|
+
const hostClasses = classnames(this.hidden ? 'hidden' : null, {
|
|
630
|
+
'error': captionType == 'error' ? true : false
|
|
631
|
+
});
|
|
632
|
+
var customStyle = {};
|
|
633
|
+
this.gap && (customStyle = { 'gap': this.gap });
|
|
634
|
+
return (h(Host, { class: hostClasses, "on-bcm-change": () => this.inputChange() }, label && h("div", null, h("bcm-label", { tooltip: this.tooltip, type: captionType, value: label, required: required })), indeterminate && (h("div", { class: indeterminateClasses }, h("input", { id: "bcm-indeterminate-element", type: "checkbox", disabled: disabled }), h("label", { htmlFor: "bcm-indeterminate-element", "on-click": () => this.indeterminateClick() }, h("span", null, h("bcm-icon", { class: "icon-checked", icon: "component-check", size: "small", type: "default" })), "Check All"))), h("div", { class: groupContainerClasses, style: customStyle }, checkboxesProp && this.checkboxesProp.map((checkbox) => h("bcm-checkbox", { name: checkbox.name, checked: checkbox.checked, disabled: checkbox.disabled, required: this.required === true && checkbox.required === true && (true), noCaption: this.noCaption, optionType: this.optionType, buttonStyle: this.buttonStyle, size: this.size, "full-width": this.fullWidth }, checkbox.label)), h("slot", null))));
|
|
339
635
|
}
|
|
636
|
+
get el() { return getElement(this); }
|
|
637
|
+
static get watchers() { return {
|
|
638
|
+
"defaultValue": ["parseOptions"],
|
|
639
|
+
"items": ["parseItems"]
|
|
640
|
+
}; }
|
|
340
641
|
};
|
|
341
|
-
|
|
642
|
+
BcmCheckboxGroup.style = groupCss;
|
|
342
643
|
|
|
343
644
|
// /**
|
|
344
645
|
// *
|
|
@@ -383,7 +684,7 @@ const formCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:40
|
|
|
383
684
|
* @desc
|
|
384
685
|
* @param str
|
|
385
686
|
*/
|
|
386
|
-
const lowercase
|
|
687
|
+
const lowercase = (str) => str.toLowerCase();
|
|
387
688
|
const BcmForm = class {
|
|
388
689
|
constructor(hostRef) {
|
|
389
690
|
registerInstance(this, hostRef);
|
|
@@ -426,7 +727,7 @@ const BcmForm = class {
|
|
|
426
727
|
this.name = "";
|
|
427
728
|
}
|
|
428
729
|
handleSubmit(e) {
|
|
429
|
-
if (lowercase
|
|
730
|
+
if (lowercase(e.target.nodeName) === 'bcm-button') {
|
|
430
731
|
if (e.target.type === 'submit') {
|
|
431
732
|
this.submitFunction();
|
|
432
733
|
}
|
|
@@ -507,12 +808,12 @@ const BcmForm = class {
|
|
|
507
808
|
const rootInputs = inputs.filter((input) => !input['s-hn']);
|
|
508
809
|
rootInputs.forEach(element => {
|
|
509
810
|
var item = element;
|
|
510
|
-
if (lowercase
|
|
811
|
+
if (lowercase(item.nodeName) == "bcm-checkbox-group") {
|
|
511
812
|
item.querySelectorAll("bcm-checkbox").forEach(element => {
|
|
512
813
|
this.duplicateInput.push(element.name);
|
|
513
814
|
});
|
|
514
815
|
}
|
|
515
|
-
if (lowercase
|
|
816
|
+
if (lowercase(item.nodeName) == "bcm-form") {
|
|
516
817
|
// console.log(item)
|
|
517
818
|
const groupInputs = Array.from(item.querySelectorAll('bcm-' + Object.values(this.Bromcom.inputComponents).join(',bcm-')));
|
|
518
819
|
var itemObject;
|
|
@@ -546,7 +847,7 @@ const BcmForm = class {
|
|
|
546
847
|
return ['bcm-datetime-picker', 'bcm-date-picker', 'bcm-time-picker'].includes(item.toLowerCase());
|
|
547
848
|
}
|
|
548
849
|
isGroupComponent(item) {
|
|
549
|
-
return ['bcm-checkbox-group'
|
|
850
|
+
return ['bcm-checkbox-group'].includes(item.toLowerCase());
|
|
550
851
|
}
|
|
551
852
|
async userFormData() {
|
|
552
853
|
this.formData = {};
|
|
@@ -578,8 +879,9 @@ const BcmForm = class {
|
|
|
578
879
|
}
|
|
579
880
|
}
|
|
580
881
|
else if (isGroupComponent) {
|
|
581
|
-
getChilds(input, "bcm-checkbox")
|
|
582
|
-
|
|
882
|
+
const childsCheckbox = getChilds(input, "bcm-checkbox");
|
|
883
|
+
childsCheckbox.length > 0 && (childsCheckbox.forEach((element) => {
|
|
884
|
+
if (element && element.required === true) {
|
|
583
885
|
valid = validate.required(element.value);
|
|
584
886
|
if (!valid['valid']) {
|
|
585
887
|
element.noCaption = false;
|
|
@@ -592,7 +894,7 @@ const BcmForm = class {
|
|
|
592
894
|
element.captionType = "default";
|
|
593
895
|
}
|
|
594
896
|
}
|
|
595
|
-
});
|
|
897
|
+
}));
|
|
596
898
|
}
|
|
597
899
|
else {
|
|
598
900
|
valid = validate.required(input.value);
|
|
@@ -6099,6 +6401,7 @@ const BcmInput = class {
|
|
|
6099
6401
|
this.disabled = false;
|
|
6100
6402
|
this.readonly = false;
|
|
6101
6403
|
this.clearable = false;
|
|
6404
|
+
this._internal_id = (Math.random() * 4).toString(16).replace('.', '');
|
|
6102
6405
|
this.unit = null;
|
|
6103
6406
|
this.unitPrefix = null;
|
|
6104
6407
|
this.min = null;
|
|
@@ -6177,7 +6480,7 @@ const BcmInput = class {
|
|
|
6177
6480
|
this.value = '';
|
|
6178
6481
|
this.inputElement.focus();
|
|
6179
6482
|
this.change.emit(this.value);
|
|
6180
|
-
this.clear.emit();
|
|
6483
|
+
this.clear.emit(e);
|
|
6181
6484
|
e.stopPropagation();
|
|
6182
6485
|
}
|
|
6183
6486
|
changePasswordVisibility() {
|
|
@@ -6422,7 +6725,7 @@ const BcmInput = class {
|
|
|
6422
6725
|
const inputClass = size === 'large' ? 'size-3' : 'size-2';
|
|
6423
6726
|
const captionClasses = classnames('size-1', 'input-caption', 'caption-' + captionType);
|
|
6424
6727
|
const hostClasses = classnames(this.hidden ? 'hidden' : null, this.noMargin ? 'no-margin' : null);
|
|
6425
|
-
return (h(Host, { class: hostClasses }, h("div", { class: containerClasses }, label && h("label", {
|
|
6728
|
+
return (h(Host, { class: hostClasses }, h("div", { class: containerClasses }, label && h("div", null, h("bcm-label", { tooltip: this.tooltip, type: captionType, value: label, required: required, htmlFor: this.inputId })), h("div", { class: baseClasses }, h("span", { class: "input-prefix" }, h("slot", { name: "prefix" }), unitPrefix && h("span", { class: classnames(inputClass, 'unit-prefix') }, unitPrefix)), h("input", { "bcm-internal-id": this._id, id: this.inputId, class: inputClass, ref: el => (this.inputElement = el), onFocus: this.handleFocus, onBlur: this.handleBlur, onChange: this.handleChange, onInput: this.handleInput, maxLength: this.maxLength, type: type === 'password' && isPasswordVisible ? 'text' :
|
|
6426
6729
|
type === 'number' ? 'text' : type, placeholder: placeholder, value: type === 'number' && !this.hasFocus
|
|
6427
6730
|
? value + (value && (unit === null || unit === void 0 ? void 0 : unit.length) > 0 ? ' ' + unit : '')
|
|
6428
6731
|
: value, disabled: this.disabled, readonly: this.readonly }), clearable && !this.disabled && (h("button", { class: "input-clear-button", onClick: this.handleClear }, h("bcm-icon", { icon: "close-circle", type: "fill", size: iconSizes$1[size], color: "grey-7" }))), type === 'password' && passwordToggle && (h("button", { class: "input-password-toggle", onClick: this.changePasswordVisibility }, h("bcm-icon", { icon: isPasswordVisible ? "eye-invisible" : "eye", type: "outlined", size: iconSizes$1[size], color: "grey-7" }))), Object.keys(defaultIcons).includes(type) && !noDefaultIcon && (h("span", { class: "input-suffix default-icon" }, h("bcm-icon", { icon: defaultIcons[type], type: "outlined", size: iconSizes$1[size], color: "grey-7" }))), type === 'number' && (h("div", { class: classnames('caret-container', { 'unit': (unit === null || unit === void 0 ? void 0 : unit.length) > 0 }, { 'disabled': inValid }, { 'disabled': readonly }) }, h("span", { class: "caret", onClick: inValid == false && this.incrementNumber }, h("bcm-icon", { icon: "caret-up", type: "outlined", color: "grey-7", size: 8 })), h("span", { class: "caret", onClick: inValid == false && this.decrementNumber }, h("bcm-icon", { icon: "caret-down", type: "outlined", color: "grey-7", size: 8 })))), type !== 'number' && (h("span", { class: "input-suffix" }, h("slot", { name: "suffix" })))), !noCaption && (h("div", { class: "caption-area" }, captionType == "error"
|
|
@@ -6436,2852 +6739,932 @@ const BcmInput = class {
|
|
|
6436
6739
|
};
|
|
6437
6740
|
BcmInput.style = inputCss;
|
|
6438
6741
|
|
|
6439
|
-
|
|
6742
|
+
class Generate {
|
|
6743
|
+
}
|
|
6744
|
+
Generate.UID = () => Math.random().toString(36).substr(2, 9);
|
|
6745
|
+
Generate.getIconAttrWithStatusType = (status, loading = false) => {
|
|
6746
|
+
if (loading)
|
|
6747
|
+
return { icon: 'loading', color: 'blue-6' };
|
|
6748
|
+
switch (status) {
|
|
6749
|
+
case StatusProps.info:
|
|
6750
|
+
return { color: 'blue-6', icon: 'info-circle' };
|
|
6751
|
+
case StatusProps.error:
|
|
6752
|
+
return { color: 'red-6', icon: 'close-circle' };
|
|
6753
|
+
case StatusProps.warning:
|
|
6754
|
+
return { color: 'warmyellow-6', icon: 'exclamation-circle' };
|
|
6755
|
+
case StatusProps.success:
|
|
6756
|
+
return { color: 'green-6', icon: 'check-circle' };
|
|
6757
|
+
}
|
|
6758
|
+
};
|
|
6759
|
+
Generate.createComponent = (element, props) => {
|
|
6760
|
+
let box = document.createElement(element);
|
|
6761
|
+
Object.keys(props).forEach(key => {
|
|
6762
|
+
box[key] = props[key];
|
|
6763
|
+
});
|
|
6764
|
+
document.body.appendChild(box);
|
|
6765
|
+
return box;
|
|
6766
|
+
};
|
|
6767
|
+
Generate.debounceInput = (func, wait, immediate) => {
|
|
6768
|
+
let timeout;
|
|
6769
|
+
return function () {
|
|
6770
|
+
let context = this, args = arguments;
|
|
6771
|
+
let later = function () {
|
|
6772
|
+
timeout = null;
|
|
6773
|
+
if (!immediate)
|
|
6774
|
+
func.apply(context, args);
|
|
6775
|
+
};
|
|
6776
|
+
let callNow = immediate && !timeout;
|
|
6777
|
+
clearTimeout(timeout);
|
|
6778
|
+
timeout = setTimeout(later, wait);
|
|
6779
|
+
if (callNow)
|
|
6780
|
+
func.apply(context, args);
|
|
6781
|
+
};
|
|
6782
|
+
};
|
|
6783
|
+
Generate.flatArray = (arr) => {
|
|
6784
|
+
return arr.reduce((acc, val) => {
|
|
6785
|
+
return acc.concat(Array.isArray(val) ? Generate.flatArray(val) : val);
|
|
6786
|
+
}, []);
|
|
6787
|
+
};
|
|
6788
|
+
|
|
6789
|
+
var Bcm;
|
|
6790
|
+
(function (Bcm) {
|
|
6791
|
+
let HtmlElementType;
|
|
6792
|
+
(function (HtmlElementType) {
|
|
6793
|
+
HtmlElementType["div"] = "div";
|
|
6794
|
+
HtmlElementType["span"] = "span";
|
|
6795
|
+
HtmlElementType["button"] = "button";
|
|
6796
|
+
HtmlElementType["a"] = "a";
|
|
6797
|
+
HtmlElementType["input"] = "input";
|
|
6798
|
+
HtmlElementType["textarea"] = "textarea";
|
|
6799
|
+
HtmlElementType["select"] = "select";
|
|
6800
|
+
HtmlElementType["option"] = "option";
|
|
6801
|
+
HtmlElementType["img"] = "img";
|
|
6802
|
+
HtmlElementType["table"] = "table";
|
|
6803
|
+
HtmlElementType["tr"] = "tr";
|
|
6804
|
+
HtmlElementType["td"] = "td";
|
|
6805
|
+
HtmlElementType["th"] = "th";
|
|
6806
|
+
HtmlElementType["tbody"] = "tbody";
|
|
6807
|
+
HtmlElementType["thead"] = "thead";
|
|
6808
|
+
HtmlElementType["tfoot"] = "tfoot";
|
|
6809
|
+
HtmlElementType["ul"] = "ul";
|
|
6810
|
+
HtmlElementType["li"] = "li";
|
|
6811
|
+
HtmlElementType["form"] = "form";
|
|
6812
|
+
HtmlElementType["label"] = "label";
|
|
6813
|
+
HtmlElementType["main"] = "main";
|
|
6814
|
+
HtmlElementType["header"] = "header";
|
|
6815
|
+
HtmlElementType["footer"] = "footer";
|
|
6816
|
+
HtmlElementType["section"] = "section";
|
|
6817
|
+
HtmlElementType["article"] = "article";
|
|
6818
|
+
HtmlElementType["nav"] = "nav";
|
|
6819
|
+
HtmlElementType["aside"] = "aside";
|
|
6820
|
+
})(HtmlElementType = Bcm.HtmlElementType || (Bcm.HtmlElementType = {}));
|
|
6821
|
+
let Status;
|
|
6822
|
+
(function (Status) {
|
|
6823
|
+
Status["info"] = "info";
|
|
6824
|
+
Status["error"] = "error";
|
|
6825
|
+
Status["warning"] = "warning";
|
|
6826
|
+
Status["success"] = "success";
|
|
6827
|
+
Status["default"] = "default";
|
|
6828
|
+
})(Status = Bcm.Status || (Bcm.Status = {}));
|
|
6829
|
+
let Shape;
|
|
6830
|
+
(function (Shape) {
|
|
6831
|
+
Shape["ellipse"] = "ellipse";
|
|
6832
|
+
Shape["square"] = "square";
|
|
6833
|
+
})(Shape = Bcm.Shape || (Bcm.Shape = {}));
|
|
6834
|
+
let Direction;
|
|
6835
|
+
(function (Direction) {
|
|
6836
|
+
Direction["horizontal"] = "horizontal";
|
|
6837
|
+
Direction["vertical"] = "vertical";
|
|
6838
|
+
})(Direction = Bcm.Direction || (Bcm.Direction = {}));
|
|
6839
|
+
let PreDefinedIconSize;
|
|
6840
|
+
(function (PreDefinedIconSize) {
|
|
6841
|
+
PreDefinedIconSize[PreDefinedIconSize["large"] = 48] = "large";
|
|
6842
|
+
PreDefinedIconSize[PreDefinedIconSize["medium"] = 24] = "medium";
|
|
6843
|
+
PreDefinedIconSize[PreDefinedIconSize["default"] = 16] = "default";
|
|
6844
|
+
PreDefinedIconSize[PreDefinedIconSize["small"] = 12] = "small";
|
|
6845
|
+
PreDefinedIconSize[PreDefinedIconSize["xsmall"] = 8] = "xsmall";
|
|
6846
|
+
})(PreDefinedIconSize = Bcm.PreDefinedIconSize || (Bcm.PreDefinedIconSize = {}));
|
|
6847
|
+
let IconSize;
|
|
6848
|
+
(function (IconSize) {
|
|
6849
|
+
IconSize["small"] = "16";
|
|
6850
|
+
IconSize["medium"] = "20";
|
|
6851
|
+
IconSize["large"] = "24";
|
|
6852
|
+
})(IconSize = Bcm.IconSize || (Bcm.IconSize = {}));
|
|
6853
|
+
let Size;
|
|
6854
|
+
(function (Size) {
|
|
6855
|
+
Size["small"] = "small";
|
|
6856
|
+
Size["medium"] = "medium";
|
|
6857
|
+
Size["large"] = "large";
|
|
6858
|
+
Size["xsmall"] = "xsmall";
|
|
6859
|
+
Size["xlarge"] = "xlarge";
|
|
6860
|
+
Size["xxlarge"] = "xxlarge";
|
|
6861
|
+
Size["xxxlarge"] = "xxxlarge";
|
|
6862
|
+
})(Size = Bcm.Size || (Bcm.Size = {}));
|
|
6863
|
+
let Kind;
|
|
6864
|
+
(function (Kind) {
|
|
6865
|
+
Kind["solid"] = "solid";
|
|
6866
|
+
Kind["ghost"] = "ghost";
|
|
6867
|
+
Kind["link"] = "link";
|
|
6868
|
+
Kind["solid-link"] = "solid-link";
|
|
6869
|
+
Kind["ghost-link"] = "ghost-link";
|
|
6870
|
+
})(Kind = Bcm.Kind || (Bcm.Kind = {}));
|
|
6871
|
+
let ButtonType;
|
|
6872
|
+
(function (ButtonType) {
|
|
6873
|
+
ButtonType["button"] = "button";
|
|
6874
|
+
ButtonType["reset"] = "reset";
|
|
6875
|
+
ButtonType["submit"] = "submit";
|
|
6876
|
+
})(ButtonType = Bcm.ButtonType || (Bcm.ButtonType = {}));
|
|
6877
|
+
let IconPosition;
|
|
6878
|
+
(function (IconPosition) {
|
|
6879
|
+
IconPosition["prefix"] = "prefix";
|
|
6880
|
+
IconPosition["suffix"] = "suffix";
|
|
6881
|
+
})(IconPosition = Bcm.IconPosition || (Bcm.IconPosition = {}));
|
|
6882
|
+
let TagType;
|
|
6883
|
+
(function (TagType) {
|
|
6884
|
+
TagType["basic"] = "basic";
|
|
6885
|
+
TagType["add"] = "add";
|
|
6886
|
+
TagType["checkable"] = "checkable";
|
|
6887
|
+
TagType["dissmisable"] = "dissmisable";
|
|
6888
|
+
})(TagType = Bcm.TagType || (Bcm.TagType = {}));
|
|
6889
|
+
let FontSize;
|
|
6890
|
+
(function (FontSize) {
|
|
6891
|
+
FontSize["size-1"] = "size-1";
|
|
6892
|
+
FontSize["size-2"] = "size-2";
|
|
6893
|
+
FontSize["size-3"] = "size-3";
|
|
6894
|
+
FontSize["size-4"] = "size-4";
|
|
6895
|
+
FontSize["size-5"] = "size-5";
|
|
6896
|
+
FontSize["size-6"] = "size-6";
|
|
6897
|
+
FontSize["size-7"] = "size-7";
|
|
6898
|
+
FontSize["size-8"] = "size-8";
|
|
6899
|
+
FontSize["size-9"] = "size-9";
|
|
6900
|
+
})(FontSize = Bcm.FontSize || (Bcm.FontSize = {}));
|
|
6901
|
+
let FontSizeValue;
|
|
6902
|
+
(function (FontSizeValue) {
|
|
6903
|
+
FontSizeValue[FontSizeValue["size-1"] = 12] = "size-1";
|
|
6904
|
+
FontSizeValue[FontSizeValue["size-2"] = 14] = "size-2";
|
|
6905
|
+
FontSizeValue[FontSizeValue["size-3"] = 16] = "size-3";
|
|
6906
|
+
FontSizeValue[FontSizeValue["size-4"] = 20] = "size-4";
|
|
6907
|
+
FontSizeValue[FontSizeValue["size-5"] = 24] = "size-5";
|
|
6908
|
+
FontSizeValue[FontSizeValue["size-6"] = 30] = "size-6";
|
|
6909
|
+
FontSizeValue[FontSizeValue["size-7"] = 38] = "size-7";
|
|
6910
|
+
FontSizeValue[FontSizeValue["size-8"] = 46] = "size-8";
|
|
6911
|
+
FontSizeValue[FontSizeValue["size-9"] = 56] = "size-9";
|
|
6912
|
+
})(FontSizeValue = Bcm.FontSizeValue || (Bcm.FontSizeValue = {}));
|
|
6913
|
+
let FontWeight;
|
|
6914
|
+
(function (FontWeight) {
|
|
6915
|
+
FontWeight["thin"] = "thin";
|
|
6916
|
+
FontWeight["light"] = "light";
|
|
6917
|
+
FontWeight["regular"] = "regular";
|
|
6918
|
+
FontWeight["medium"] = "medium";
|
|
6919
|
+
FontWeight["bold"] = "bold";
|
|
6920
|
+
FontWeight["black"] = "black";
|
|
6921
|
+
})(FontWeight = Bcm.FontWeight || (Bcm.FontWeight = {}));
|
|
6922
|
+
let ColorPalette;
|
|
6923
|
+
(function (ColorPalette) {
|
|
6924
|
+
ColorPalette["default"] = "default";
|
|
6925
|
+
ColorPalette["black"] = "black";
|
|
6926
|
+
ColorPalette["white"] = "white";
|
|
6927
|
+
ColorPalette["prime-blue"] = "prime-blue";
|
|
6928
|
+
ColorPalette["prime-blue-1"] = "prime-blue-1";
|
|
6929
|
+
ColorPalette["prime-blue-2"] = "prime-blue-2";
|
|
6930
|
+
ColorPalette["prime-blue-3"] = "prime-blue-3";
|
|
6931
|
+
ColorPalette["prime-blue-4"] = "prime-blue-4";
|
|
6932
|
+
ColorPalette["prime-blue-5"] = "prime-blue-5";
|
|
6933
|
+
ColorPalette["prime-blue-6"] = "prime-blue-6";
|
|
6934
|
+
ColorPalette["prime-blue-7"] = "prime-blue-7";
|
|
6935
|
+
ColorPalette["prime-blue-8"] = "prime-blue-8";
|
|
6936
|
+
ColorPalette["prime-blue-9"] = "prime-blue-9";
|
|
6937
|
+
ColorPalette["prime-blue-10"] = "prime-blue-10";
|
|
6938
|
+
ColorPalette["grey"] = "grey";
|
|
6939
|
+
ColorPalette["grey-1"] = "grey-1";
|
|
6940
|
+
ColorPalette["grey-2"] = "grey-2";
|
|
6941
|
+
ColorPalette["grey-3"] = "grey-3";
|
|
6942
|
+
ColorPalette["grey-4"] = "grey-4";
|
|
6943
|
+
ColorPalette["grey-5"] = "grey-5";
|
|
6944
|
+
ColorPalette["grey-6"] = "grey-6";
|
|
6945
|
+
ColorPalette["grey-7"] = "grey-7";
|
|
6946
|
+
ColorPalette["grey-8"] = "grey-8";
|
|
6947
|
+
ColorPalette["grey-9"] = "grey-9";
|
|
6948
|
+
ColorPalette["grey-10"] = "grey-10";
|
|
6949
|
+
ColorPalette["blue"] = "blue";
|
|
6950
|
+
ColorPalette["blue-1"] = "blue-1";
|
|
6951
|
+
ColorPalette["blue-2"] = "blue-2";
|
|
6952
|
+
ColorPalette["blue-3"] = "blue-3";
|
|
6953
|
+
ColorPalette["blue-4"] = "blue-4";
|
|
6954
|
+
ColorPalette["blue-5"] = "blue-5";
|
|
6955
|
+
ColorPalette["blue-6"] = "blue-6";
|
|
6956
|
+
ColorPalette["blue-7"] = "blue-7";
|
|
6957
|
+
ColorPalette["blue-8"] = "blue-8";
|
|
6958
|
+
ColorPalette["blue-9"] = "blue-9";
|
|
6959
|
+
ColorPalette["blue-10"] = "blue-10";
|
|
6960
|
+
ColorPalette["warmyellow"] = "warmyellow";
|
|
6961
|
+
ColorPalette["warmyellow-1"] = "warmyellow-1";
|
|
6962
|
+
ColorPalette["warmyellow-2"] = "warmyellow-2";
|
|
6963
|
+
ColorPalette["warmyellow-3"] = "warmyellow-3";
|
|
6964
|
+
ColorPalette["warmyellow-4"] = "warmyellow-4";
|
|
6965
|
+
ColorPalette["warmyellow-5"] = "warmyellow-5";
|
|
6966
|
+
ColorPalette["warmyellow-6"] = "warmyellow-6";
|
|
6967
|
+
ColorPalette["warmyellow-7"] = "warmyellow-7";
|
|
6968
|
+
ColorPalette["warmyellow-8"] = "warmyellow-8";
|
|
6969
|
+
ColorPalette["warmyellow-9"] = "warmyellow-9";
|
|
6970
|
+
ColorPalette["warmyellow-10"] = "warmyellow-10";
|
|
6971
|
+
ColorPalette["yellow"] = "yellow";
|
|
6972
|
+
ColorPalette["yellow-1"] = "yellow-1";
|
|
6973
|
+
ColorPalette["yellow-2"] = "yellow-2";
|
|
6974
|
+
ColorPalette["yellow-3"] = "yellow-3";
|
|
6975
|
+
ColorPalette["yellow-4"] = "yellow-4";
|
|
6976
|
+
ColorPalette["yellow-5"] = "yellow-5";
|
|
6977
|
+
ColorPalette["yellow-6"] = "yellow-6";
|
|
6978
|
+
ColorPalette["yellow-7"] = "yellow-7";
|
|
6979
|
+
ColorPalette["yellow-8"] = "yellow-8";
|
|
6980
|
+
ColorPalette["yellow-9"] = "yellow-9";
|
|
6981
|
+
ColorPalette["yellow-10"] = "yellow-10";
|
|
6982
|
+
ColorPalette["limegreen"] = "limegreen";
|
|
6983
|
+
ColorPalette["limegreen-1"] = "limegreen-1";
|
|
6984
|
+
ColorPalette["limegreen-2"] = "limegreen-2";
|
|
6985
|
+
ColorPalette["limegreen-3"] = "limegreen-3";
|
|
6986
|
+
ColorPalette["limegreen-4"] = "limegreen-4";
|
|
6987
|
+
ColorPalette["limegreen-5"] = "limegreen-5";
|
|
6988
|
+
ColorPalette["limegreen-6"] = "limegreen-6";
|
|
6989
|
+
ColorPalette["limegreen-7"] = "limegreen-7";
|
|
6990
|
+
ColorPalette["limegreen-8"] = "limegreen-8";
|
|
6991
|
+
ColorPalette["limegreen-9"] = "limegreen-9";
|
|
6992
|
+
ColorPalette["limegreen-10"] = "limegreen-10";
|
|
6993
|
+
ColorPalette["red"] = "red";
|
|
6994
|
+
ColorPalette["red-1"] = "red-1";
|
|
6995
|
+
ColorPalette["red-2"] = "red-2";
|
|
6996
|
+
ColorPalette["red-3"] = "red-3";
|
|
6997
|
+
ColorPalette["red-4"] = "red-4";
|
|
6998
|
+
ColorPalette["red-5"] = "red-5";
|
|
6999
|
+
ColorPalette["red-6"] = "red-6";
|
|
7000
|
+
ColorPalette["red-7"] = "red-7";
|
|
7001
|
+
ColorPalette["red-8"] = "red-8";
|
|
7002
|
+
ColorPalette["red-9"] = "red-9";
|
|
7003
|
+
ColorPalette["red-10"] = "red-10";
|
|
7004
|
+
ColorPalette["darkorange"] = "darkorange";
|
|
7005
|
+
ColorPalette["darkorange-1"] = "darkorange-1";
|
|
7006
|
+
ColorPalette["darkorange-2"] = "darkorange-2";
|
|
7007
|
+
ColorPalette["darkorange-3"] = "darkorange-3";
|
|
7008
|
+
ColorPalette["darkorange-4"] = "darkorange-4";
|
|
7009
|
+
ColorPalette["darkorange-5"] = "darkorange-5";
|
|
7010
|
+
ColorPalette["darkorange-6"] = "darkorange-6";
|
|
7011
|
+
ColorPalette["darkorange-7"] = "darkorange-7";
|
|
7012
|
+
ColorPalette["darkorange-8"] = "darkorange-8";
|
|
7013
|
+
ColorPalette["darkorange-9"] = "darkorange-9";
|
|
7014
|
+
ColorPalette["darkorange-10"] = "darkorange-10";
|
|
7015
|
+
ColorPalette["orange"] = "orange";
|
|
7016
|
+
ColorPalette["orange-1"] = "orange-1";
|
|
7017
|
+
ColorPalette["orange-2"] = "orange-2";
|
|
7018
|
+
ColorPalette["orange-3"] = "orange-3";
|
|
7019
|
+
ColorPalette["orange-4"] = "orange-4";
|
|
7020
|
+
ColorPalette["orange-5"] = "orange-5";
|
|
7021
|
+
ColorPalette["orange-6"] = "orange-6";
|
|
7022
|
+
ColorPalette["orange-7"] = "orange-7";
|
|
7023
|
+
ColorPalette["orange-8"] = "orange-8";
|
|
7024
|
+
ColorPalette["orange-9"] = "orange-9";
|
|
7025
|
+
ColorPalette["orange-10"] = "orange-10";
|
|
7026
|
+
ColorPalette["green"] = "green";
|
|
7027
|
+
ColorPalette["green-1"] = "green-1";
|
|
7028
|
+
ColorPalette["green-2"] = "green-2";
|
|
7029
|
+
ColorPalette["green-3"] = "green-3";
|
|
7030
|
+
ColorPalette["green-4"] = "green-4";
|
|
7031
|
+
ColorPalette["green-5"] = "green-5";
|
|
7032
|
+
ColorPalette["green-6"] = "green-6";
|
|
7033
|
+
ColorPalette["green-7"] = "green-7";
|
|
7034
|
+
ColorPalette["green-8"] = "green-8";
|
|
7035
|
+
ColorPalette["green-9"] = "green-9";
|
|
7036
|
+
ColorPalette["green-10"] = "green-10";
|
|
7037
|
+
ColorPalette["turquosie"] = "turquosie";
|
|
7038
|
+
ColorPalette["turquosie-1"] = "turquosie-1";
|
|
7039
|
+
ColorPalette["turquosie-2"] = "turquosie-2";
|
|
7040
|
+
ColorPalette["turquosie-3"] = "turquosie-3";
|
|
7041
|
+
ColorPalette["turquosie-4"] = "turquosie-4";
|
|
7042
|
+
ColorPalette["turquosie-5"] = "turquosie-5";
|
|
7043
|
+
ColorPalette["turquosie-6"] = "turquosie-6";
|
|
7044
|
+
ColorPalette["turquosie-7"] = "turquosie-7";
|
|
7045
|
+
ColorPalette["turquosie-8"] = "turquosie-8";
|
|
7046
|
+
ColorPalette["turquosie-9"] = "turquosie-9";
|
|
7047
|
+
ColorPalette["turquosie-10"] = "turquosie-10";
|
|
7048
|
+
ColorPalette["cobaltblue"] = "cobaltblue";
|
|
7049
|
+
ColorPalette["cobaltblue-1"] = "cobaltblue-1";
|
|
7050
|
+
ColorPalette["cobaltblue-2"] = "cobaltblue-2";
|
|
7051
|
+
ColorPalette["cobaltblue-3"] = "cobaltblue-3";
|
|
7052
|
+
ColorPalette["cobaltblue-4"] = "cobaltblue-4";
|
|
7053
|
+
ColorPalette["cobaltblue-5"] = "cobaltblue-5";
|
|
7054
|
+
ColorPalette["cobaltblue-6"] = "cobaltblue-6";
|
|
7055
|
+
ColorPalette["cobaltblue-7"] = "cobaltblue-7";
|
|
7056
|
+
ColorPalette["cobaltblue-8"] = "cobaltblue-8";
|
|
7057
|
+
ColorPalette["cobaltblue-9"] = "cobaltblue-9";
|
|
7058
|
+
ColorPalette["cobaltblue-10"] = "cobaltblue-10";
|
|
7059
|
+
ColorPalette["magenta"] = "magenta";
|
|
7060
|
+
ColorPalette["magenta-1"] = "magenta-1";
|
|
7061
|
+
ColorPalette["magenta-2"] = "magenta-2";
|
|
7062
|
+
ColorPalette["magenta-3"] = "magenta-3";
|
|
7063
|
+
ColorPalette["magenta-4"] = "magenta-4";
|
|
7064
|
+
ColorPalette["magenta-5"] = "magenta-5";
|
|
7065
|
+
ColorPalette["magenta-6"] = "magenta-6";
|
|
7066
|
+
ColorPalette["magenta-7"] = "magenta-7";
|
|
7067
|
+
ColorPalette["magenta-8"] = "magenta-8";
|
|
7068
|
+
ColorPalette["magenta-9"] = "magenta-9";
|
|
7069
|
+
ColorPalette["magenta-10"] = "magenta-10";
|
|
7070
|
+
ColorPalette["purple"] = "purple";
|
|
7071
|
+
ColorPalette["purple-1"] = "purple-1";
|
|
7072
|
+
ColorPalette["purple-2"] = "purple-2";
|
|
7073
|
+
ColorPalette["purple-3"] = "purple-3";
|
|
7074
|
+
ColorPalette["purple-4"] = "purple-4";
|
|
7075
|
+
ColorPalette["purple-5"] = "purple-5";
|
|
7076
|
+
ColorPalette["purple-6"] = "purple-6";
|
|
7077
|
+
ColorPalette["purple-7"] = "purple-7";
|
|
7078
|
+
ColorPalette["purple-8"] = "purple-8";
|
|
7079
|
+
ColorPalette["purple-9"] = "purple-9";
|
|
7080
|
+
ColorPalette["purple-10"] = "purple-10";
|
|
7081
|
+
ColorPalette["bc-red"] = "bc-red";
|
|
7082
|
+
ColorPalette["bc-red-1"] = "bc-red-1";
|
|
7083
|
+
ColorPalette["bc-red-2"] = "bc-red-2";
|
|
7084
|
+
ColorPalette["bc-red-3"] = "bc-red-3";
|
|
7085
|
+
ColorPalette["bc-red-4"] = "bc-red-4";
|
|
7086
|
+
ColorPalette["bc-red-5"] = "bc-red-5";
|
|
7087
|
+
ColorPalette["bc-red-6"] = "bc-red-6";
|
|
7088
|
+
ColorPalette["bc-red-7"] = "bc-red-7";
|
|
7089
|
+
ColorPalette["bc-red-8"] = "bc-red-8";
|
|
7090
|
+
ColorPalette["bc-red-9"] = "bc-red-9";
|
|
7091
|
+
ColorPalette["bc-blue"] = "bc-blue";
|
|
7092
|
+
ColorPalette["bc-blue-1"] = "bc-blue-1";
|
|
7093
|
+
ColorPalette["bc-blue-2"] = "bc-blue-2";
|
|
7094
|
+
ColorPalette["bc-blue-3"] = "bc-blue-3";
|
|
7095
|
+
ColorPalette["bc-blue-4"] = "bc-blue-4";
|
|
7096
|
+
ColorPalette["bc-blue-5"] = "bc-blue-5";
|
|
7097
|
+
ColorPalette["bc-blue-6"] = "bc-blue-6";
|
|
7098
|
+
ColorPalette["bc-blue-7"] = "bc-blue-7";
|
|
7099
|
+
ColorPalette["bc-blue-8"] = "bc-blue-8";
|
|
7100
|
+
ColorPalette["bc-blue-9"] = "bc-blue-9";
|
|
7101
|
+
ColorPalette["bc-green"] = "bc-green";
|
|
7102
|
+
ColorPalette["bc-green-1"] = "bc-green-1";
|
|
7103
|
+
ColorPalette["bc-green-2"] = "bc-green-2";
|
|
7104
|
+
ColorPalette["bc-green-3"] = "bc-green-3";
|
|
7105
|
+
ColorPalette["bc-green-4"] = "bc-green-4";
|
|
7106
|
+
ColorPalette["bc-green-5"] = "bc-green-5";
|
|
7107
|
+
ColorPalette["bc-green-6"] = "bc-green-6";
|
|
7108
|
+
ColorPalette["bc-green-7"] = "bc-green-7";
|
|
7109
|
+
ColorPalette["bc-green-8"] = "bc-green-8";
|
|
7110
|
+
ColorPalette["bc-green-9"] = "bc-green-9";
|
|
7111
|
+
ColorPalette["bc-orange"] = "bc-orange";
|
|
7112
|
+
ColorPalette["bc-orange-1"] = "bc-orange-1";
|
|
7113
|
+
ColorPalette["bc-orange-2"] = "bc-orange-2";
|
|
7114
|
+
ColorPalette["bc-orange-3"] = "bc-orange-3";
|
|
7115
|
+
ColorPalette["bc-orange-4"] = "bc-orange-4";
|
|
7116
|
+
ColorPalette["bc-orange-5"] = "bc-orange-5";
|
|
7117
|
+
ColorPalette["bc-orange-6"] = "bc-orange-6";
|
|
7118
|
+
ColorPalette["bc-orange-7"] = "bc-orange-7";
|
|
7119
|
+
ColorPalette["bc-orange-8"] = "bc-orange-8";
|
|
7120
|
+
ColorPalette["bc-orange-9"] = "bc-orange-9";
|
|
7121
|
+
})(ColorPalette = Bcm.ColorPalette || (Bcm.ColorPalette = {}));
|
|
7122
|
+
let InputType;
|
|
7123
|
+
(function (InputType) {
|
|
7124
|
+
InputType["text"] = "text";
|
|
7125
|
+
InputType["number"] = "number";
|
|
7126
|
+
InputType["email"] = "email";
|
|
7127
|
+
InputType["password"] = "password";
|
|
7128
|
+
InputType["url"] = "url";
|
|
7129
|
+
InputType["search"] = "search";
|
|
7130
|
+
InputType["tel"] = "tel";
|
|
7131
|
+
InputType["hidden"] = "hidden";
|
|
7132
|
+
})(InputType = Bcm.InputType || (Bcm.InputType = {}));
|
|
7133
|
+
let KeyCode;
|
|
7134
|
+
(function (KeyCode) {
|
|
7135
|
+
KeyCode[KeyCode["backspace"] = 8] = "backspace";
|
|
7136
|
+
KeyCode[KeyCode["tab"] = 9] = "tab";
|
|
7137
|
+
KeyCode[KeyCode["enter"] = 13] = "enter";
|
|
7138
|
+
KeyCode[KeyCode["shift"] = 16] = "shift";
|
|
7139
|
+
KeyCode[KeyCode["ctrl"] = 17] = "ctrl";
|
|
7140
|
+
KeyCode[KeyCode["alt"] = 18] = "alt";
|
|
7141
|
+
KeyCode[KeyCode["pause"] = 19] = "pause";
|
|
7142
|
+
KeyCode[KeyCode["capslock"] = 20] = "capslock";
|
|
7143
|
+
KeyCode[KeyCode["escape"] = 27] = "escape";
|
|
7144
|
+
KeyCode[KeyCode["space"] = 32] = "space";
|
|
7145
|
+
KeyCode[KeyCode["pageup"] = 33] = "pageup";
|
|
7146
|
+
KeyCode[KeyCode["pagedown"] = 34] = "pagedown";
|
|
7147
|
+
KeyCode[KeyCode["end"] = 35] = "end";
|
|
7148
|
+
KeyCode[KeyCode["home"] = 36] = "home";
|
|
7149
|
+
KeyCode[KeyCode["left"] = 37] = "left";
|
|
7150
|
+
KeyCode[KeyCode["up"] = 38] = "up";
|
|
7151
|
+
KeyCode[KeyCode["right"] = 39] = "right";
|
|
7152
|
+
KeyCode[KeyCode["down"] = 40] = "down";
|
|
7153
|
+
KeyCode[KeyCode["insert"] = 45] = "insert";
|
|
7154
|
+
KeyCode[KeyCode["delete"] = 46] = "delete";
|
|
7155
|
+
KeyCode[KeyCode["f1"] = 112] = "f1";
|
|
7156
|
+
KeyCode[KeyCode["f2"] = 113] = "f2";
|
|
7157
|
+
KeyCode[KeyCode["f3"] = 114] = "f3";
|
|
7158
|
+
KeyCode[KeyCode["f4"] = 115] = "f4";
|
|
7159
|
+
KeyCode[KeyCode["f5"] = 116] = "f5";
|
|
7160
|
+
KeyCode[KeyCode["f6"] = 117] = "f6";
|
|
7161
|
+
KeyCode[KeyCode["f7"] = 118] = "f7";
|
|
7162
|
+
KeyCode[KeyCode["f8"] = 119] = "f8";
|
|
7163
|
+
KeyCode[KeyCode["f9"] = 120] = "f9";
|
|
7164
|
+
KeyCode[KeyCode["f10"] = 121] = "f10";
|
|
7165
|
+
KeyCode[KeyCode["f11"] = 122] = "f11";
|
|
7166
|
+
KeyCode[KeyCode["f12"] = 123] = "f12";
|
|
7167
|
+
KeyCode[KeyCode["numlock"] = 144] = "numlock";
|
|
7168
|
+
KeyCode[KeyCode["scrolllock"] = 145] = "scrolllock";
|
|
7169
|
+
KeyCode[KeyCode["semicolon"] = 186] = "semicolon";
|
|
7170
|
+
KeyCode[KeyCode["equal"] = 187] = "equal";
|
|
7171
|
+
KeyCode[KeyCode["comma"] = 188] = "comma";
|
|
7172
|
+
KeyCode[KeyCode["dash"] = 189] = "dash";
|
|
7173
|
+
KeyCode[KeyCode["period"] = 190] = "period";
|
|
7174
|
+
KeyCode[KeyCode["slash"] = 191] = "slash";
|
|
7175
|
+
KeyCode[KeyCode["backslash"] = 220] = "backslash";
|
|
7176
|
+
KeyCode[KeyCode["bracketleft"] = 219] = "bracketleft";
|
|
7177
|
+
KeyCode[KeyCode["bracketright"] = 221] = "bracketright";
|
|
7178
|
+
KeyCode[KeyCode["quote"] = 222] = "quote";
|
|
7179
|
+
KeyCode[KeyCode["backtick"] = 192] = "backtick";
|
|
7180
|
+
KeyCode[KeyCode["a"] = 65] = "a";
|
|
7181
|
+
})(KeyCode = Bcm.KeyCode || (Bcm.KeyCode = {}));
|
|
7182
|
+
Bcm.FormErrorMessages = {
|
|
7183
|
+
'email': 'Please enter a valid email address',
|
|
7184
|
+
'password': 'Please enter a valid password',
|
|
7185
|
+
'url': 'Please enter a valid URL',
|
|
7186
|
+
'phone': 'Please enter a valid phone number',
|
|
7187
|
+
'search': 'Please enter a valid search term',
|
|
7188
|
+
'number': 'Please enter a valid number',
|
|
7189
|
+
'text': 'Please enter a valid text',
|
|
7190
|
+
'required': 'This field is required',
|
|
7191
|
+
'minlength': 'This field must be at least {0} characters long',
|
|
7192
|
+
'maxlength': 'This field must be at most {0} characters long',
|
|
7193
|
+
'min': 'This field must be at least {0}',
|
|
7194
|
+
'max': 'This field must be at most {0}',
|
|
7195
|
+
'between': 'This field must be between {0} and {1}',
|
|
7196
|
+
'pattern': 'This field is invalid',
|
|
7197
|
+
'date': 'Please enter a valid date',
|
|
7198
|
+
'time': 'Please enter a valid time',
|
|
7199
|
+
'datetime': 'Please enter a valid date and time',
|
|
7200
|
+
'datetime-local': 'Please enter a valid date and time',
|
|
7201
|
+
'month': 'Please enter a valid month',
|
|
7202
|
+
'week': 'Please enter a valid week',
|
|
7203
|
+
'color': 'Please enter a valid color',
|
|
7204
|
+
'file': 'Please enter a valid file',
|
|
7205
|
+
'range': 'Please enter a valid range',
|
|
7206
|
+
'radio': 'Please select a valid option',
|
|
7207
|
+
'checkbox': 'Please select a valid option',
|
|
7208
|
+
'select': 'Please select a valid option',
|
|
7209
|
+
'multiple': 'Please select a valid option',
|
|
7210
|
+
};
|
|
7211
|
+
let IndeterminateType;
|
|
7212
|
+
(function (IndeterminateType) {
|
|
7213
|
+
IndeterminateType["uncheck"] = "uncheck";
|
|
7214
|
+
IndeterminateType["indeterminate"] = "indeterminate";
|
|
7215
|
+
IndeterminateType["determinate"] = "determinate"; // true
|
|
7216
|
+
})(IndeterminateType = Bcm.IndeterminateType || (Bcm.IndeterminateType = {}));
|
|
7217
|
+
let Placement;
|
|
7218
|
+
(function (Placement) {
|
|
7219
|
+
Placement["top"] = "top";
|
|
7220
|
+
Placement["top-start"] = "top-start";
|
|
7221
|
+
Placement["top-end"] = "top-end";
|
|
7222
|
+
Placement["bottom"] = "bottom";
|
|
7223
|
+
Placement["bottom-start"] = "bottom-start";
|
|
7224
|
+
Placement["bottom-end"] = "bottom-end";
|
|
7225
|
+
Placement["left"] = "left";
|
|
7226
|
+
Placement["left-start"] = "left-start";
|
|
7227
|
+
Placement["left-end"] = "left-end";
|
|
7228
|
+
Placement["right"] = "right";
|
|
7229
|
+
Placement["right-start"] = "right-start";
|
|
7230
|
+
Placement["right-end"] = "right-end";
|
|
7231
|
+
})(Placement = Bcm.Placement || (Bcm.Placement = {}));
|
|
7232
|
+
let TriggerType;
|
|
7233
|
+
(function (TriggerType) {
|
|
7234
|
+
TriggerType["hover"] = "hover";
|
|
7235
|
+
TriggerType["click"] = "click";
|
|
7236
|
+
TriggerType["focus"] = "focus";
|
|
7237
|
+
})(TriggerType = Bcm.TriggerType || (Bcm.TriggerType = {}));
|
|
7238
|
+
})(Bcm || (Bcm = {}));
|
|
7239
|
+
const Bcm$1 = Bcm;
|
|
7240
|
+
|
|
7241
|
+
class StringHelper {
|
|
7242
|
+
}
|
|
7243
|
+
StringHelper.lowercase = (str) => str.toLowerCase();
|
|
7244
|
+
StringHelper.uppercase = (str) => str.toUpperCase();
|
|
7245
|
+
StringHelper.capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
7246
|
+
StringHelper.camelCase = (str) => str.replace(/\s(.)/g, function ($1) { return $1.toUpperCase(); }).replace(/\s/g, '');
|
|
7247
|
+
StringHelper.kebabCase = (str) => str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
|
7248
|
+
StringHelper.snakeCase = (str) => str.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase();
|
|
7249
|
+
StringHelper.titleCase = (str) => str.replace(/\w\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); });
|
|
7250
|
+
StringHelper.trim = (str) => str.trim();
|
|
7251
|
+
StringHelper.trimLeft = (str) => str.trimLeft();
|
|
7252
|
+
StringHelper.trimRight = (str) => str.trimRight();
|
|
7253
|
+
StringHelper.trimAll = (str) => str.trim().replace(/\s+/g, ' ');
|
|
7254
|
+
StringHelper.replace = (str, search, replace) => str.replace(search, replace);
|
|
7255
|
+
StringHelper.remove = (str, search) => str.replace(search, '');
|
|
7256
|
+
StringHelper.isNullOrEmpty = (str) => str === null || str === undefined || str === '';
|
|
7257
|
+
StringHelper.localizationMessage = (str, args) => str.replace(/{(\d+)}/g, (match, number) => typeof args[number] != 'undefined' ? args[number] : match);
|
|
7258
|
+
StringHelper.getMessage = (type, args) => StringHelper.localizationMessage(Bcm$1.FormErrorMessages[type], args);
|
|
7259
|
+
StringHelper.split = (str, separator) => str.split(separator);
|
|
7260
|
+
StringHelper.textContains = (str, search) => str.indexOf(search) !== -1;
|
|
7261
|
+
|
|
7262
|
+
const SlotTemplate = ({ value, className, name }) => {
|
|
7263
|
+
return StringHelper.isNullOrEmpty(value) ? h("span", { class: className },
|
|
7264
|
+
h("slot", Object.assign({}, (name && { name: name })))) : h("span", { class: className }, value);
|
|
7265
|
+
};
|
|
7266
|
+
|
|
7267
|
+
const LabelTemplate = ({ required, value, size, form, htmlFor, type }) => {
|
|
7268
|
+
size = size || Bcm$1.FontSize['size-1'];
|
|
7269
|
+
type = type || Bcm$1.Status.default;
|
|
7270
|
+
const labelClasses = classnames('bcm-label__text', size, {
|
|
7271
|
+
'bcm-label__text-error': type === Bcm$1.Status.error,
|
|
7272
|
+
});
|
|
7273
|
+
return (h("label", { form: form, htmlFor: htmlFor, class: labelClasses },
|
|
7274
|
+
" ",
|
|
7275
|
+
h(SlotTemplate, { value: value }),
|
|
7276
|
+
" ",
|
|
7277
|
+
required && ('*')));
|
|
7278
|
+
};
|
|
7279
|
+
|
|
7280
|
+
const labelCss = "@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}.bcm-label{display:flex;align-items:center;grid-gap:2px}.bcm-label__text{display:inline-block;color:var(--bcm-color-grey-9);margin-bottom:4px}.bcm-label__text-error{color:var(--bcm-color-red-6)}";
|
|
6440
7281
|
|
|
6441
|
-
const
|
|
6442
|
-
const BcmList = class {
|
|
7282
|
+
const BcmLabel = class {
|
|
6443
7283
|
constructor(hostRef) {
|
|
6444
7284
|
registerInstance(this, hostRef);
|
|
6445
|
-
|
|
6446
|
-
this.
|
|
6447
|
-
this.
|
|
6448
|
-
this.
|
|
6449
|
-
this.isRendered = false;
|
|
6450
|
-
this.firstRender = true;
|
|
6451
|
-
this.linkedElementWidth = "100%";
|
|
6452
|
-
this.bodyStyleOverflow = '';
|
|
6453
|
-
this.dataLength = 0;
|
|
6454
|
-
this.checklist = [];
|
|
6455
|
-
this.otherList = [];
|
|
6456
|
-
this.configured = false;
|
|
6457
|
-
this.checkStatus = false;
|
|
6458
|
-
this.resetSelected = false;
|
|
6459
|
-
this.indeterminateStatus = false;
|
|
6460
|
-
this.totalSearch = 0;
|
|
6461
|
-
this.empty = false;
|
|
6462
|
-
this.objectMapping = {
|
|
6463
|
-
'id': "id",
|
|
6464
|
-
'text': "text",
|
|
6465
|
-
'selected': "selected",
|
|
6466
|
-
};
|
|
6467
|
-
this._id = (Math.random() * 4).toString(16).replace('.', '');
|
|
6468
|
-
this._internal_id = (Math.random() * 4).toString(16).replace('.', '');
|
|
6469
|
-
this._list_select_id = null;
|
|
6470
|
-
this._list_id = null;
|
|
6471
|
-
this.type = 'default';
|
|
6472
|
-
this.processType = 'default';
|
|
7285
|
+
/** Props **/
|
|
7286
|
+
this._id = Generate.UID();
|
|
7287
|
+
this.required = false;
|
|
7288
|
+
this.size = Bcm$1.FontSize['size-1'];
|
|
6473
7289
|
this.hidden = false;
|
|
6474
|
-
this.
|
|
6475
|
-
this.isShow = true;
|
|
6476
|
-
this.linkedComponent = null;
|
|
6477
|
-
this.selectedId = null;
|
|
6478
|
-
this.flex = false;
|
|
6479
|
-
this.height = "256px";
|
|
6480
|
-
this.minHeight = null;
|
|
6481
|
-
this.maxHeight = null;
|
|
6482
|
-
this.width = "100%";
|
|
6483
|
-
this.minWidth = null;
|
|
6484
|
-
this.maxWidth = null;
|
|
6485
|
-
this.fullWidth = false;
|
|
6486
|
-
this.size = 'medium';
|
|
6487
|
-
this.infoFooter = false;
|
|
6488
|
-
this.searchable = false;
|
|
6489
|
-
this.highlight = false;
|
|
6490
|
-
this.searchPlaceholder = "Search";
|
|
6491
|
-
this.searchFields = ['text'];
|
|
6492
|
-
this.returnField = "id";
|
|
6493
|
-
this.searchData = null;
|
|
6494
|
-
this.searchSub = "items";
|
|
6495
|
-
this.searchText = "";
|
|
6496
|
-
this.value = null;
|
|
6497
|
-
this.multiSelect = false;
|
|
6498
|
-
/******/
|
|
6499
|
-
this.clearable = false;
|
|
6500
|
-
this.label = null;
|
|
6501
|
-
this.placeholder = "Choose an option";
|
|
6502
|
-
this.noCaption = false;
|
|
6503
|
-
this.caption = null;
|
|
6504
|
-
this.captionError = null;
|
|
6505
|
-
this.captionType = 'default';
|
|
6506
|
-
this.disabled = false;
|
|
6507
|
-
this.name = null;
|
|
6508
|
-
this.required = false;
|
|
6509
|
-
}
|
|
6510
|
-
connectedCallback() {
|
|
6511
|
-
this.captionCache = this.caption;
|
|
6512
|
-
this.captionTypeCache = this.captionType;
|
|
6513
|
-
this.bodyStyleOverflow = document.querySelector("body").style.overflow;
|
|
6514
|
-
const elementId = "bcm-list-select-" + this._id;
|
|
6515
|
-
if (this.type === 'select' || this.type === 'autocomplete') {
|
|
6516
|
-
this.selectIsInitialize();
|
|
6517
|
-
this.linkedComponent = elementId;
|
|
6518
|
-
}
|
|
6519
|
-
if (this.type !== 'default' || this.linkedComponent !== null) {
|
|
6520
|
-
this.isShow = false;
|
|
6521
|
-
this.el.classList.add("linked");
|
|
6522
|
-
this.handleLinkedComponent();
|
|
6523
|
-
}
|
|
6524
|
-
const slot = this.el.shadowRoot.querySelectorAll('bcm-list-item');
|
|
6525
|
-
if (slot) {
|
|
6526
|
-
slot.forEach(el => {
|
|
6527
|
-
if (lowercase$2(el.tagName) === 'bcm-list-item') {
|
|
6528
|
-
el.setAttribute("_internal_id", this._internal_id);
|
|
6529
|
-
}
|
|
6530
|
-
});
|
|
6531
|
-
}
|
|
6532
|
-
}
|
|
6533
|
-
disconnectedCallback() { }
|
|
6534
|
-
componentWillLoad() { }
|
|
6535
|
-
componentDidLoad() { }
|
|
6536
|
-
componentWillRender() { }
|
|
6537
|
-
componentDidRender() {
|
|
6538
|
-
const elementId = "bcm-list-select-" + this._id;
|
|
6539
|
-
if (this.type === 'select' || this.type === 'autocomplete') {
|
|
6540
|
-
this.selectIsInitialize();
|
|
6541
|
-
this.linkedComponent = elementId;
|
|
6542
|
-
}
|
|
6543
|
-
if (sessionStorage.getItem(this._internal_id + "-config")) {
|
|
6544
|
-
this.config(JSON.parse(sessionStorage.getItem(this._internal_id + "-config")));
|
|
6545
|
-
}
|
|
6546
|
-
setTimeout(() => {
|
|
6547
|
-
const spinner = this.el.shadowRoot.querySelector('.spinner');
|
|
6548
|
-
if (spinner) {
|
|
6549
|
-
spinner.classList.remove("first-run");
|
|
6550
|
-
}
|
|
6551
|
-
}, 500);
|
|
6552
|
-
}
|
|
6553
|
-
componentWillUpdate() { }
|
|
6554
|
-
componentDidUpdate() { }
|
|
6555
|
-
/**
|
|
6556
|
-
* @desc
|
|
6557
|
-
*/
|
|
6558
|
-
async hide() {
|
|
6559
|
-
this.isShow = false;
|
|
6560
|
-
document.querySelector("body").style.overflow = this.bodyStyleOverflow;
|
|
6561
|
-
}
|
|
6562
|
-
async setSearch(text) {
|
|
6563
|
-
const searchInput = this.el.shadowRoot.querySelector("bcm-search");
|
|
6564
|
-
if (searchInput) {
|
|
6565
|
-
searchInput.setValue(text);
|
|
6566
|
-
// searchInput.select()
|
|
6567
|
-
}
|
|
6568
|
-
}
|
|
6569
|
-
async clearAndSelectSearch(select = true) {
|
|
6570
|
-
if (this.searchable == true) {
|
|
6571
|
-
// var searchInput = null
|
|
6572
|
-
const searchInput = this.el.shadowRoot.querySelector("bcm-search");
|
|
6573
|
-
if (searchInput) {
|
|
6574
|
-
searchInput.setClear();
|
|
6575
|
-
if (select == true) {
|
|
6576
|
-
searchInput.select();
|
|
6577
|
-
}
|
|
6578
|
-
}
|
|
6579
|
-
}
|
|
6580
|
-
}
|
|
6581
|
-
/**
|
|
6582
|
-
* @desc
|
|
6583
|
-
*/
|
|
6584
|
-
async show() {
|
|
6585
|
-
if (this.processType == 'deselect') {
|
|
6586
|
-
this.firstRender = true;
|
|
6587
|
-
this.isRendered = false;
|
|
6588
|
-
this.setData(this.otherList);
|
|
6589
|
-
}
|
|
6590
|
-
this.isShow = true;
|
|
6591
|
-
if (this.items && this.isRendered === false) {
|
|
6592
|
-
this.isRendered = true;
|
|
6593
|
-
this.processData(this.items);
|
|
6594
|
-
}
|
|
6595
|
-
if (this.linkedComponent !== null) {
|
|
6596
|
-
this.handleLinkedComponent();
|
|
6597
|
-
}
|
|
6598
|
-
}
|
|
6599
|
-
/**
|
|
6600
|
-
* @desc
|
|
6601
|
-
*/
|
|
6602
|
-
async toggle() {
|
|
6603
|
-
this.isShow = !this.isShow;
|
|
6604
|
-
}
|
|
6605
|
-
/**
|
|
6606
|
-
* @desc
|
|
6607
|
-
*/
|
|
6608
|
-
async openStatus() {
|
|
6609
|
-
return this.isShow;
|
|
6610
|
-
}
|
|
6611
|
-
/**
|
|
6612
|
-
* @desc
|
|
6613
|
-
*/
|
|
6614
|
-
handleOpen(value) {
|
|
6615
|
-
if (this.processType === "deselect") {
|
|
6616
|
-
const listSelect = document.getElementById(this._list_select_id);
|
|
6617
|
-
if (listSelect) {
|
|
6618
|
-
const otherTag = listSelect.shadowRoot.querySelector("#other-tag");
|
|
6619
|
-
if (otherTag) {
|
|
6620
|
-
if (value === true) {
|
|
6621
|
-
otherTag.setAttribute("color", "prime-blue");
|
|
6622
|
-
}
|
|
6623
|
-
else {
|
|
6624
|
-
otherTag.removeAttribute("color");
|
|
6625
|
-
}
|
|
6626
|
-
}
|
|
6627
|
-
}
|
|
6628
|
-
}
|
|
6629
|
-
}
|
|
6630
|
-
/**
|
|
6631
|
-
* @desc
|
|
6632
|
-
*/
|
|
6633
|
-
handleChange(newValue) {
|
|
6634
|
-
this.change.emit(newValue);
|
|
6635
|
-
}
|
|
6636
|
-
/**
|
|
6637
|
-
* @desc
|
|
6638
|
-
*/
|
|
6639
|
-
async config(_config) {
|
|
6640
|
-
if (_config['type']) {
|
|
6641
|
-
this.type = _config['type'];
|
|
6642
|
-
}
|
|
6643
|
-
if (_config['searchPlaceholder']) {
|
|
6644
|
-
this.searchPlaceholder = _config['searchPlaceholder'];
|
|
6645
|
-
}
|
|
6646
|
-
if (_config['searchFields']) {
|
|
6647
|
-
this.searchFields = _config['searchFields'];
|
|
6648
|
-
}
|
|
6649
|
-
if (_config['returnField']) {
|
|
6650
|
-
this.returnField = _config['returnField'];
|
|
6651
|
-
}
|
|
6652
|
-
if (_config['highlight']) {
|
|
6653
|
-
this.highlight = _config['highlight'];
|
|
6654
|
-
}
|
|
6655
|
-
if (_config['linkedComponent'] && typeof _config['linkedComponent'] == 'string') {
|
|
6656
|
-
this.linkedComponent = _config['linkedComponent'];
|
|
6657
|
-
}
|
|
6658
|
-
if (_config['searchable'] && typeof _config['searchable'] == 'boolean') {
|
|
6659
|
-
this.searchable = _config['searchable'];
|
|
6660
|
-
}
|
|
6661
|
-
if (_config['infoFooter'] && typeof _config['infoFooter'] == 'boolean') {
|
|
6662
|
-
this.infoFooter = _config['infoFooter'];
|
|
6663
|
-
}
|
|
6664
|
-
if (_config['mapping']) {
|
|
6665
|
-
if (_config['mapping']['id']) {
|
|
6666
|
-
this.objectMapping['id'] = _config['mapping']['id'];
|
|
6667
|
-
}
|
|
6668
|
-
if (_config['mapping']['text']) {
|
|
6669
|
-
this.objectMapping['text'] = _config['mapping']['text'];
|
|
6670
|
-
}
|
|
6671
|
-
if (_config['mapping']['selected']) {
|
|
6672
|
-
this.objectMapping['selected'] = _config['mapping']['selected'];
|
|
6673
|
-
}
|
|
6674
|
-
}
|
|
6675
|
-
sessionStorage.setItem(this._internal_id + "-config", JSON.stringify(_config));
|
|
6676
|
-
this.configured = true;
|
|
6677
|
-
this.configObject = _config;
|
|
6678
|
-
return _config;
|
|
6679
|
-
}
|
|
6680
|
-
/**
|
|
6681
|
-
* @desc
|
|
6682
|
-
*/
|
|
6683
|
-
async setDataOther(_data = []) {
|
|
6684
|
-
this.otherList = _data;
|
|
6685
|
-
}
|
|
6686
|
-
/**
|
|
6687
|
-
* @desc
|
|
6688
|
-
*/
|
|
6689
|
-
async setData(_data = []) {
|
|
6690
|
-
if (this.value) {
|
|
6691
|
-
this.setClear();
|
|
6692
|
-
}
|
|
6693
|
-
if (_data) {
|
|
6694
|
-
typeof _data == 'string'
|
|
6695
|
-
? this.items = JSON.parse(_data)
|
|
6696
|
-
: this.items = _data;
|
|
6697
|
-
if (this.items) {
|
|
6698
|
-
switch (this.processType) {
|
|
6699
|
-
case 'default':
|
|
6700
|
-
if (this.items.find(e => e[this.objectMapping['selected']])) {
|
|
6701
|
-
var selectedIDs = [];
|
|
6702
|
-
this.items.filter(e => String(e[this.objectMapping['selected']]) === "true").forEach(element => {
|
|
6703
|
-
selectedIDs.push(element[this.objectMapping['id']]);
|
|
6704
|
-
});
|
|
6705
|
-
this.checked(selectedIDs);
|
|
6706
|
-
}
|
|
6707
|
-
break;
|
|
6708
|
-
case 'deselect':
|
|
6709
|
-
var selectedIDs = [];
|
|
6710
|
-
this.items.forEach(element => {
|
|
6711
|
-
// element[ this.objectMapping['selected'] ] = true;
|
|
6712
|
-
selectedIDs.push(element[this.objectMapping['id']]);
|
|
6713
|
-
});
|
|
6714
|
-
this.checked(selectedIDs);
|
|
6715
|
-
break;
|
|
6716
|
-
}
|
|
6717
|
-
}
|
|
6718
|
-
this.calculatedTotals({ "total": this.items.length });
|
|
6719
|
-
if (this.multiSelect === true) {
|
|
6720
|
-
this.calculatedTotals({ "selected": selectedIDs ? selectedIDs.length : 0 });
|
|
6721
|
-
}
|
|
6722
|
-
this.isRendered = false;
|
|
6723
|
-
if (this.linkedComponent === null) {
|
|
6724
|
-
this.show();
|
|
6725
|
-
}
|
|
6726
|
-
}
|
|
6727
|
-
return _data;
|
|
6728
|
-
}
|
|
6729
|
-
/**
|
|
6730
|
-
* @desc
|
|
6731
|
-
*/
|
|
6732
|
-
async getValue() {
|
|
6733
|
-
return this.value;
|
|
6734
|
-
}
|
|
6735
|
-
/**
|
|
6736
|
-
* @desc
|
|
6737
|
-
*/
|
|
6738
|
-
async getChecklist() {
|
|
6739
|
-
return this.checklist;
|
|
6740
|
-
}
|
|
6741
|
-
/**
|
|
6742
|
-
* @desc
|
|
6743
|
-
*/
|
|
6744
|
-
async resetCaption() {
|
|
6745
|
-
this.caption = this.captionCache;
|
|
6746
|
-
this.captionType = this.captionTypeCache;
|
|
6747
|
-
this.captionError = null;
|
|
6748
|
-
}
|
|
6749
|
-
/**
|
|
6750
|
-
* @desc
|
|
6751
|
-
*/
|
|
6752
|
-
async toggleChecked(checkedItems = null) {
|
|
6753
|
-
if (checkedItems !== null) {
|
|
6754
|
-
var checkStatus = false;
|
|
6755
|
-
if (typeof checkedItems == 'string') {
|
|
6756
|
-
checkStatus = this.items.find(e => e[this.objectMapping['id']] == checkedItems)[this.objectMapping['selected']];
|
|
6757
|
-
}
|
|
6758
|
-
else {
|
|
6759
|
-
let state = 'uncheck';
|
|
6760
|
-
let allChecked = true;
|
|
6761
|
-
let allUnchecked = true;
|
|
6762
|
-
checkedItems.forEach((item) => {
|
|
6763
|
-
if (String(this.items.find(e => e[this.objectMapping['id']] == item)[this.objectMapping['selected']]) === 'true') {
|
|
6764
|
-
allUnchecked = false;
|
|
6765
|
-
}
|
|
6766
|
-
else {
|
|
6767
|
-
allChecked = false;
|
|
6768
|
-
}
|
|
6769
|
-
});
|
|
6770
|
-
!allChecked && !allUnchecked
|
|
6771
|
-
? state = 'determinate'
|
|
6772
|
-
: allChecked
|
|
6773
|
-
? state = 'determinate'
|
|
6774
|
-
: state = 'uncheck';
|
|
6775
|
-
checkStatus = state == 'determinate' ? false : true;
|
|
6776
|
-
}
|
|
6777
|
-
// let state: string = 'uncheck'
|
|
6778
|
-
// let allChecked: boolean = true
|
|
6779
|
-
// let allUnchecked: boolean = true
|
|
6780
|
-
// checkedItems.map((item) => {
|
|
6781
|
-
// item[ this.objectMapping['selected'] ] === true && (allUnchecked = false)
|
|
6782
|
-
// !item[ this.objectMapping['selected'] ] === true && (allChecked = false)
|
|
6783
|
-
// });
|
|
6784
|
-
// !allChecked && !allUnchecked
|
|
6785
|
-
// ? state = 'determinate'
|
|
6786
|
-
// : allChecked
|
|
6787
|
-
// ? state = 'determinate'
|
|
6788
|
-
// : state = 'uncheck'
|
|
6789
|
-
// const checkStatus = state == 'determinate' ? true : false
|
|
6790
|
-
// const checkStatus = this.items.find( e => e[ this.objectMapping['id'] ] == checkedItems )[ this.objectMapping['selected'] ]
|
|
6791
|
-
if (checkStatus === true) {
|
|
6792
|
-
this.unChecked(checkedItems);
|
|
6793
|
-
}
|
|
6794
|
-
else {
|
|
6795
|
-
// this.checked(checkedItems, false)
|
|
6796
|
-
var selectedIDs = [];
|
|
6797
|
-
// var checkItem = null
|
|
6798
|
-
if (typeof checkedItems == 'string') {
|
|
6799
|
-
// checkItem = this.sendSelectId( String(checkedItems), true)
|
|
6800
|
-
selectedIDs.push(checkedItems);
|
|
6801
|
-
}
|
|
6802
|
-
else {
|
|
6803
|
-
checkedItems.forEach((item) => {
|
|
6804
|
-
selectedIDs.push(item);
|
|
6805
|
-
// String(item[ this.objectMapping['selected'] ]) === 'true' && (allUnchecked = false),
|
|
6806
|
-
// String(item[ this.objectMapping['selected'] ]) !== 'true' && (allChecked = false)
|
|
6807
|
-
});
|
|
6808
|
-
// this.sendSelectId( String(checkedItems), true)
|
|
6809
|
-
// var selectedIDs = []
|
|
6810
|
-
// if( this.items && this.items.find( e => e[ this.objectMapping['selected'] ] ) ){
|
|
6811
|
-
// this.items.filter( e => String( e[ this.objectMapping['selected'] ] ) === "true" ).forEach(element => {
|
|
6812
|
-
// selectedIDs.push( element )
|
|
6813
|
-
// });
|
|
6814
|
-
// }
|
|
6815
|
-
// this.value = selectedIDs
|
|
6816
|
-
// this.listChecked.emit( this.value )
|
|
6817
|
-
// this.handleIndeterminateStatus()
|
|
6818
|
-
// this.sendSelectValue()
|
|
6819
|
-
}
|
|
6820
|
-
this.checked(selectedIDs, false);
|
|
6821
|
-
}
|
|
6822
|
-
}
|
|
6823
|
-
}
|
|
6824
|
-
/**
|
|
6825
|
-
* @desc
|
|
6826
|
-
*/
|
|
6827
|
-
async unChecked(checkedItems = null) {
|
|
6828
|
-
if (checkedItems !== null) {
|
|
6829
|
-
var selectedIDs = [];
|
|
6830
|
-
this.selectedId = null;
|
|
6831
|
-
if (typeof checkedItems == 'string') {
|
|
6832
|
-
this.sendSelectId(String(checkedItems), false);
|
|
6833
|
-
}
|
|
6834
|
-
else {
|
|
6835
|
-
checkedItems.forEach(item => {
|
|
6836
|
-
this.sendSelectId(String(item), false);
|
|
6837
|
-
});
|
|
6838
|
-
}
|
|
6839
|
-
if (this.items && this.items.find(e => e[this.objectMapping['selected']])) {
|
|
6840
|
-
this.items.filter(e => String(e[this.objectMapping['selected']]) === "true").forEach(element => {
|
|
6841
|
-
selectedIDs.push(element);
|
|
6842
|
-
});
|
|
6843
|
-
}
|
|
6844
|
-
this.value = selectedIDs;
|
|
6845
|
-
this.listChecked.emit(this.value);
|
|
6846
|
-
this.handleIndeterminateStatus();
|
|
6847
|
-
this.sendSelectValue();
|
|
6848
|
-
}
|
|
6849
|
-
}
|
|
6850
|
-
/**
|
|
6851
|
-
* @desc
|
|
6852
|
-
*/
|
|
6853
|
-
async checked(checkedItems = null, reset = true) {
|
|
6854
|
-
if (checkedItems !== null) {
|
|
6855
|
-
var selectedIDs = [];
|
|
6856
|
-
if (reset === true) {
|
|
6857
|
-
if (this.items && this.items.find(e => e[this.objectMapping['selected']])) {
|
|
6858
|
-
this.items.filter(e => String(e[this.objectMapping['selected']]) === "true").forEach(element => {
|
|
6859
|
-
element[this.objectMapping['selected']] = false;
|
|
6860
|
-
});
|
|
6861
|
-
}
|
|
6862
|
-
this.setClear(false);
|
|
6863
|
-
}
|
|
6864
|
-
if (typeof checkedItems == 'string') {
|
|
6865
|
-
this.sendSelectId(String(checkedItems));
|
|
6866
|
-
if (this.multiSelect === false) {
|
|
6867
|
-
this.selectedId = this.items.find(e => String(e[this.objectMapping['id']]) === String(checkedItems));
|
|
6868
|
-
}
|
|
6869
|
-
}
|
|
6870
|
-
else {
|
|
6871
|
-
if (this.multiSelect === true) {
|
|
6872
|
-
checkedItems.forEach(item => {
|
|
6873
|
-
this.sendSelectId(String(item));
|
|
6874
|
-
});
|
|
6875
|
-
}
|
|
6876
|
-
}
|
|
6877
|
-
// if ( this.multiSelect === false ){
|
|
6878
|
-
// this.selectedId = this.items.find( e => String(e[ this.objectMapping['id'] ]) === String(checkedItems) )
|
|
6879
|
-
// }
|
|
6880
|
-
if (this.items && this.items.find(e => e[this.objectMapping['selected']])) {
|
|
6881
|
-
this.items.filter(e => String(e[this.objectMapping['selected']]) === "true").forEach(element => {
|
|
6882
|
-
selectedIDs.push(element);
|
|
6883
|
-
});
|
|
6884
|
-
}
|
|
6885
|
-
this.value = selectedIDs;
|
|
6886
|
-
this.listChecked.emit(this.value);
|
|
6887
|
-
this.handleIndeterminateStatus();
|
|
6888
|
-
this.sendSelectValue();
|
|
6889
|
-
}
|
|
6890
|
-
}
|
|
6891
|
-
/**
|
|
6892
|
-
* @desc
|
|
6893
|
-
*/
|
|
6894
|
-
async setClear(eventEmit = true) {
|
|
6895
|
-
if (this.items != undefined && this.items.length > 0) {
|
|
6896
|
-
this.unChecked(this.items.map(item => { return item[this.objectMapping["id"]]; }));
|
|
6897
|
-
}
|
|
6898
|
-
this.selectedId = null;
|
|
6899
|
-
this.checklist = [];
|
|
6900
|
-
if (eventEmit === true) {
|
|
6901
|
-
this.listChecked.emit(this.checklist);
|
|
6902
|
-
}
|
|
6903
|
-
this.value = null;
|
|
6904
|
-
this.handleIndeterminateStatus();
|
|
6905
|
-
this.calculatedTotals({ "selected": this.checklist.length });
|
|
6906
|
-
}
|
|
6907
|
-
/**
|
|
6908
|
-
* @desc
|
|
6909
|
-
*/
|
|
6910
|
-
async processData(_data) {
|
|
6911
|
-
this.handleLoading(true);
|
|
6912
|
-
await delay(100);
|
|
6913
|
-
const list = this.el.shadowRoot.querySelector('.list');
|
|
6914
|
-
list.innerHTML = "";
|
|
6915
|
-
this.selectedId = null;
|
|
6916
|
-
this.value = null;
|
|
6917
|
-
const elementStatuses = [];
|
|
6918
|
-
var checkedItems = [];
|
|
6919
|
-
if (_data.length > 0) {
|
|
6920
|
-
this.dataLength = _data.length;
|
|
6921
|
-
this.searchData = _data;
|
|
6922
|
-
await delay(100);
|
|
6923
|
-
_data.map(item => {
|
|
6924
|
-
const element = document.createElement("bcm-list-item");
|
|
6925
|
-
element.setAttribute("_internal_id", this._internal_id);
|
|
6926
|
-
element.setAttribute("text", item[this.objectMapping['text']]);
|
|
6927
|
-
element.setAttribute("id", String(item[this.objectMapping['id']]));
|
|
6928
|
-
if (item[this.objectMapping['selected']]) {
|
|
6929
|
-
// element.select()
|
|
6930
|
-
checkedItems.push(String(item[this.objectMapping['id']]));
|
|
6931
|
-
}
|
|
6932
|
-
// element.setAttribute("item-object", JSON.stringify(item))
|
|
6933
|
-
var object = item;
|
|
6934
|
-
element.itemObject = object;
|
|
6935
|
-
element.multiSelect = this.multiSelect;
|
|
6936
|
-
list.appendChild(element);
|
|
6937
|
-
elementStatuses.push(element.componentOnReady());
|
|
6938
|
-
});
|
|
6939
|
-
const allStatuses = await Promise.all(elementStatuses);
|
|
6940
|
-
if (allStatuses) {
|
|
6941
|
-
if (checkedItems != []) {
|
|
6942
|
-
checkedItems.forEach(item => {
|
|
6943
|
-
// if ( this.sendSelectId( String(item) ) !== false ){
|
|
6944
|
-
this.sendSelectId(String(item));
|
|
6945
|
-
// }
|
|
6946
|
-
});
|
|
6947
|
-
}
|
|
6948
|
-
this.handleLoading(false);
|
|
6949
|
-
this.firstRender = false;
|
|
6950
|
-
}
|
|
6951
|
-
}
|
|
6952
|
-
else {
|
|
6953
|
-
this.handleLoading(false);
|
|
6954
|
-
// console.log("no data")
|
|
6955
|
-
}
|
|
6956
|
-
}
|
|
6957
|
-
/**
|
|
6958
|
-
* @desc
|
|
6959
|
-
*/
|
|
6960
|
-
handleLoading(show = false) {
|
|
6961
|
-
const spinner = this.el.shadowRoot.querySelector('.spinner');
|
|
6962
|
-
// const searchInput = this.el.shadowRoot.querySelector('#search');
|
|
6963
|
-
if (show == true) {
|
|
6964
|
-
spinner.classList.add("show");
|
|
6965
|
-
// searchInput.setAttribute('readonly', 'true')
|
|
6966
|
-
}
|
|
6967
|
-
else {
|
|
6968
|
-
spinner.classList.remove("show");
|
|
6969
|
-
// searchInput.setAttribute('readonly', 'false')
|
|
6970
|
-
}
|
|
6971
|
-
if (this.linkedComponent !== null) {
|
|
6972
|
-
this.handleLinkedComponent();
|
|
6973
|
-
}
|
|
6974
|
-
}
|
|
6975
|
-
/**
|
|
6976
|
-
* @desc
|
|
6977
|
-
*/
|
|
6978
|
-
handleClick(event) {
|
|
6979
|
-
var path = event.path || (event.composedPath && event.composedPath());
|
|
6980
|
-
if (!this.el.contains(event.target)
|
|
6981
|
-
|| (path
|
|
6982
|
-
&& path.filter((input) => input['_internal_id'] == this._internal_id)[0]
|
|
6983
|
-
&& path.filter((input) => input['nodeName'] == "BCM-LIST-ITEM")[0]
|
|
6984
|
-
&& this.multiSelect === false)) {
|
|
6985
|
-
if (this.isShow === true) {
|
|
6986
|
-
this.hide();
|
|
6987
|
-
}
|
|
6988
|
-
}
|
|
6989
|
-
}
|
|
6990
|
-
/**
|
|
6991
|
-
* @desc
|
|
6992
|
-
*/
|
|
6993
|
-
wheelEvent(event) {
|
|
6994
|
-
if (!this.el.contains(event.target)) {
|
|
6995
|
-
if (this.isShow === true) {
|
|
6996
|
-
this.hide();
|
|
6997
|
-
}
|
|
6998
|
-
}
|
|
6999
|
-
}
|
|
7000
|
-
/**
|
|
7001
|
-
* @desc
|
|
7002
|
-
*/
|
|
7003
|
-
scrollEvent(event) {
|
|
7004
|
-
if (!this.el.contains(event.target)) {
|
|
7005
|
-
if (this.isShow === true) {
|
|
7006
|
-
this.hide();
|
|
7007
|
-
}
|
|
7008
|
-
}
|
|
7009
|
-
}
|
|
7010
|
-
/**
|
|
7011
|
-
* @desc
|
|
7012
|
-
*/
|
|
7013
|
-
resizeEvent() {
|
|
7014
|
-
dropInComponent(this.el, "#" + this.linkedComponent);
|
|
7015
|
-
}
|
|
7016
|
-
/**
|
|
7017
|
-
* @descc
|
|
7018
|
-
*/
|
|
7019
|
-
onmousemove(e) {
|
|
7020
|
-
if (this.el.contains(e.target)) {
|
|
7021
|
-
if (document.querySelector("body").style.overflow != "hidden") {
|
|
7022
|
-
document.querySelector("body").style.overflow = "hidden";
|
|
7023
|
-
}
|
|
7024
|
-
}
|
|
7025
|
-
else {
|
|
7026
|
-
if (document.querySelector("body").style.overflow != this.bodyStyleOverflow) {
|
|
7027
|
-
document.querySelector("body").style.overflow = this.bodyStyleOverflow;
|
|
7028
|
-
}
|
|
7029
|
-
}
|
|
7030
|
-
}
|
|
7031
|
-
/**
|
|
7032
|
-
* @descc
|
|
7033
|
-
|
|
7034
|
-
*/
|
|
7035
|
-
listenSearchResult(event) {
|
|
7036
|
-
var path = event.path || (event.composedPath && event.composedPath());
|
|
7037
|
-
if (event.isEvent == undefined) {
|
|
7038
|
-
if (path && path.filter((input) => input['_internal_id'] == this._internal_id)[0] != undefined) {
|
|
7039
|
-
// var childs: any[] = getChilds(this.el, 'bcm-list-item')
|
|
7040
|
-
var childs = this.el.shadowRoot.querySelectorAll("bcm-list-item");
|
|
7041
|
-
childs.forEach(element => {
|
|
7042
|
-
element.classList.add("hidden");
|
|
7043
|
-
});
|
|
7044
|
-
if (event.detail.length > 0) {
|
|
7045
|
-
if (event.detail[0] == -1) {
|
|
7046
|
-
this.totalSearch = 0;
|
|
7047
|
-
this.empty = true;
|
|
7048
|
-
}
|
|
7049
|
-
else {
|
|
7050
|
-
this.totalSearch = event.detail.length;
|
|
7051
|
-
this.empty = false;
|
|
7052
|
-
if (this.dataLength > 0) {
|
|
7053
|
-
childs.forEach(element => {
|
|
7054
|
-
// if ( this.highlight ){
|
|
7055
|
-
// event.target.addEventListener('bcm-on-search-value', async(event: CustomEvent) => {
|
|
7056
|
-
// var searchValue = await event.detail
|
|
7057
|
-
// var inputText = element.shadowRoot.getElementById("text")
|
|
7058
|
-
// inputText = inputText.textContent || inputText.innerText || ""
|
|
7059
|
-
// if (searchValue) {
|
|
7060
|
-
// var cacheInputText = lowercase(inputText)
|
|
7061
|
-
// var cacheSearchValue = lowercase(searchValue)
|
|
7062
|
-
// var index = cacheInputText.indexOf(cacheSearchValue);
|
|
7063
|
-
// if (index >= 0) {
|
|
7064
|
-
// inputText = inputText.substring(0,index) + "<span class='highlight'>" + inputText.substring(index,index+searchValue.length) + "</span>" + inputText.substring(index + searchValue.length);
|
|
7065
|
-
// }
|
|
7066
|
-
// }
|
|
7067
|
-
// element.shadowRoot.getElementById("text").innerHTML = inputText;
|
|
7068
|
-
// })
|
|
7069
|
-
// }
|
|
7070
|
-
if (event.detail.indexOf(element._id) >= 0) {
|
|
7071
|
-
element.classList.remove("hidden");
|
|
7072
|
-
}
|
|
7073
|
-
});
|
|
7074
|
-
}
|
|
7075
|
-
}
|
|
7076
|
-
}
|
|
7077
|
-
else if (event.detail === true) {
|
|
7078
|
-
this.totalSearch = this.dataLength;
|
|
7079
|
-
this.empty = false;
|
|
7080
|
-
childs.forEach(element => {
|
|
7081
|
-
element.classList.remove("hidden");
|
|
7082
|
-
});
|
|
7083
|
-
}
|
|
7084
|
-
this.calculatedTotals({ "total": this.totalSearch });
|
|
7085
|
-
}
|
|
7086
|
-
}
|
|
7087
|
-
}
|
|
7088
|
-
/**
|
|
7089
|
-
* @descc
|
|
7090
|
-
|
|
7091
|
-
*/
|
|
7092
|
-
sendSelectId(id, status = true) {
|
|
7093
|
-
if (this.items && this.items.find(e => e[this.objectMapping['id']] == id)) {
|
|
7094
|
-
if (this.isRendered === false) {
|
|
7095
|
-
this.items.find(e => e[this.objectMapping['id']] == id)[this.objectMapping['selected']] = status;
|
|
7096
|
-
this.handleChecklist(this.items.find(e => e[this.objectMapping['id']] == id), status);
|
|
7097
|
-
return this.items.find(e => e[this.objectMapping['id']] == id);
|
|
7098
|
-
}
|
|
7099
|
-
else {
|
|
7100
|
-
var selectedItem = null;
|
|
7101
|
-
if (selectedItem = this.el.shadowRoot.getElementById(id)) {
|
|
7102
|
-
if (status === true) {
|
|
7103
|
-
selectedItem.classList.add("selected");
|
|
7104
|
-
}
|
|
7105
|
-
else {
|
|
7106
|
-
selectedItem.classList.remove("selected");
|
|
7107
|
-
}
|
|
7108
|
-
if (this.multiSelect === true) {
|
|
7109
|
-
this.handleChecklist(selectedItem["itemObject"], status);
|
|
7110
|
-
// selectedItem.classList.toggle("selected")
|
|
7111
|
-
if (selectedItem.shadowRoot.querySelector(".checkbox")) {
|
|
7112
|
-
selectedItem.shadowRoot.querySelector(".checkbox").querySelector("input").checked = status;
|
|
7113
|
-
}
|
|
7114
|
-
}
|
|
7115
|
-
this.items.find(e => e[this.objectMapping['id']] == id)[this.objectMapping['selected']] = status;
|
|
7116
|
-
return this.items.find(e => e[this.objectMapping['id']] == id);
|
|
7117
|
-
}
|
|
7118
|
-
}
|
|
7119
|
-
}
|
|
7120
|
-
return false;
|
|
7121
|
-
}
|
|
7122
|
-
/**
|
|
7123
|
-
* @descc
|
|
7124
|
-
*/
|
|
7125
|
-
jsonDataProcess(id, status) {
|
|
7126
|
-
// console.log(id)
|
|
7127
|
-
var item = this.items.find(e => String(e[this.objectMapping['id']]) == String(id));
|
|
7128
|
-
if (item) {
|
|
7129
|
-
item[this.objectMapping['selected']] = status;
|
|
7130
|
-
}
|
|
7131
|
-
}
|
|
7132
|
-
/**
|
|
7133
|
-
* @descc
|
|
7134
|
-
*/
|
|
7135
|
-
handleListSelected(event) {
|
|
7136
|
-
var path = event.path || (event.composedPath && event.composedPath());
|
|
7137
|
-
// console.log(path);
|
|
7138
|
-
if (this.isInternal(event) || (!this.isInternal(event) && this.isInternalSlot(event))) {
|
|
7139
|
-
var status = false;
|
|
7140
|
-
var selectedItem = null;
|
|
7141
|
-
const itemId = this.getItemId(event);
|
|
7142
|
-
if (this.multiSelect === false) {
|
|
7143
|
-
if (selectedItem = getChilds(this.el, "bcm-list-item").find(x => x._id === this.selectedId)) {
|
|
7144
|
-
selectedItem.classList.remove("selected");
|
|
7145
|
-
status = false;
|
|
7146
|
-
// selectedItem.selected = false
|
|
7147
|
-
}
|
|
7148
|
-
}
|
|
7149
|
-
selectedItem = this.el.shadowRoot.getElementById(itemId);
|
|
7150
|
-
if (selectedItem) {
|
|
7151
|
-
this.selectedId = selectedItem["id"];
|
|
7152
|
-
// selectedItem.selected = true
|
|
7153
|
-
if (this.multiSelect === true) {
|
|
7154
|
-
selectedItem.classList.toggle("selected");
|
|
7155
|
-
if (selectedItem.classList.contains("selected") === true) {
|
|
7156
|
-
status = false;
|
|
7157
|
-
}
|
|
7158
|
-
else {
|
|
7159
|
-
status = true;
|
|
7160
|
-
}
|
|
7161
|
-
}
|
|
7162
|
-
else {
|
|
7163
|
-
selectedItem.classList.add("selected");
|
|
7164
|
-
status = true;
|
|
7165
|
-
}
|
|
7166
|
-
}
|
|
7167
|
-
if (this.isInternalSlot(event)) {
|
|
7168
|
-
if (selectedItem = path[0]) {
|
|
7169
|
-
this.selectedId = path[0].id;
|
|
7170
|
-
this.value = event.detail;
|
|
7171
|
-
return true;
|
|
7172
|
-
}
|
|
7173
|
-
}
|
|
7174
|
-
if (this.multiSelect === true) {
|
|
7175
|
-
this.handleChecklist(selectedItem["itemObject"], selectedItem.classList.contains("selected"));
|
|
7176
|
-
this.listChecked.emit(this.checklist);
|
|
7177
|
-
if (selectedItem.shadowRoot.querySelector(".checkbox")) {
|
|
7178
|
-
selectedItem.shadowRoot.querySelector(".checkbox").querySelector("input").checked = selectedItem.classList.contains("selected");
|
|
7179
|
-
}
|
|
7180
|
-
this.value = this.checklist;
|
|
7181
|
-
}
|
|
7182
|
-
else {
|
|
7183
|
-
this.value = event.detail;
|
|
7184
|
-
}
|
|
7185
|
-
if (this.processType === 'default') {
|
|
7186
|
-
this.jsonDataProcess(this.selectedId, status);
|
|
7187
|
-
}
|
|
7188
|
-
this.handleIndeterminateStatus();
|
|
7189
|
-
this.sendSelectValue();
|
|
7190
|
-
if (this.processType === 'deselect') {
|
|
7191
|
-
var element = document.querySelector("#" + this._list_id);
|
|
7192
|
-
if (element) {
|
|
7193
|
-
if (this.firstRender === false) {
|
|
7194
|
-
element.toggleChecked(this.selectedId);
|
|
7195
|
-
}
|
|
7196
|
-
// element.unChecked(this.selectedId)
|
|
7197
|
-
}
|
|
7198
|
-
}
|
|
7199
|
-
}
|
|
7200
|
-
}
|
|
7201
|
-
/**
|
|
7202
|
-
* @desc
|
|
7203
|
-
*/
|
|
7204
|
-
handleChecklist(checkItem, process = true) {
|
|
7205
|
-
if (this.items && this.items.find(e => e[this.objectMapping['id']] == checkItem[this.objectMapping['id']])) {
|
|
7206
|
-
switch (process) {
|
|
7207
|
-
case true:
|
|
7208
|
-
if (this.checklist.length > 0) {
|
|
7209
|
-
if (!this.checklist.includes(checkItem)) {
|
|
7210
|
-
this.checklist = [...this.checklist, checkItem];
|
|
7211
|
-
}
|
|
7212
|
-
}
|
|
7213
|
-
else {
|
|
7214
|
-
this.checklist = [checkItem];
|
|
7215
|
-
}
|
|
7216
|
-
break;
|
|
7217
|
-
case false:
|
|
7218
|
-
this.checklist = this.checklist.filter(item => item[this.objectMapping['id']] !== checkItem[this.objectMapping['id']]);
|
|
7219
|
-
break;
|
|
7220
|
-
}
|
|
7221
|
-
let sorted = this.checklist.sort(function (a, b) { return a - b; });
|
|
7222
|
-
this.checklist = sorted;
|
|
7223
|
-
// if ( this.firstRender === false ){
|
|
7224
|
-
this.calculatedTotals({ "selected": this.checklist.length });
|
|
7225
|
-
// }
|
|
7226
|
-
}
|
|
7227
|
-
}
|
|
7228
|
-
/**
|
|
7229
|
-
* @desc
|
|
7230
|
-
*/
|
|
7231
|
-
handleIndeterminateStatus() {
|
|
7232
|
-
if (this.multiSelect === true) {
|
|
7233
|
-
this.checkStatus = false;
|
|
7234
|
-
this.indeterminateStatus = false;
|
|
7235
|
-
if (this.items != undefined && this.checklist != undefined) {
|
|
7236
|
-
if (this.checklist.length == 0) {
|
|
7237
|
-
this.checkStatus = false;
|
|
7238
|
-
this.indeterminateStatus = false;
|
|
7239
|
-
}
|
|
7240
|
-
else if (this.checklist.length == this.items.length) {
|
|
7241
|
-
this.checkStatus = true;
|
|
7242
|
-
this.indeterminateStatus = false;
|
|
7243
|
-
}
|
|
7244
|
-
else if (this.checklist.length < this.items.length) {
|
|
7245
|
-
this.checkStatus = false;
|
|
7246
|
-
this.indeterminateStatus = true;
|
|
7247
|
-
}
|
|
7248
|
-
else {
|
|
7249
|
-
this.checkStatus = false;
|
|
7250
|
-
this.indeterminateStatus = false;
|
|
7251
|
-
}
|
|
7252
|
-
if (this.multiSelect === true) {
|
|
7253
|
-
var indeterminateCheckbox;
|
|
7254
|
-
if (indeterminateCheckbox = this.el.shadowRoot.querySelector('#check-lite-' + this._id)) {
|
|
7255
|
-
indeterminateCheckbox["checked"] = this.checkStatus;
|
|
7256
|
-
indeterminateCheckbox["indeterminate"] = this.indeterminateStatus;
|
|
7257
|
-
}
|
|
7258
|
-
}
|
|
7259
|
-
}
|
|
7260
|
-
}
|
|
7261
|
-
}
|
|
7262
|
-
/**
|
|
7263
|
-
* @desc
|
|
7264
|
-
*/
|
|
7265
|
-
calculatedTotals(calcObject) {
|
|
7266
|
-
if (calcObject["selected"] != undefined) {
|
|
7267
|
-
if (this.infoFooter == true && this.el.shadowRoot.querySelector("#selected-item")) {
|
|
7268
|
-
if (calcObject["selected"] > 0) {
|
|
7269
|
-
this.el.shadowRoot.querySelector("#selected-item").innerHTML = "( " + calcObject["selected"] + " selected )";
|
|
7270
|
-
}
|
|
7271
|
-
else {
|
|
7272
|
-
this.el.shadowRoot.querySelector("#selected-item").innerHTML = " ";
|
|
7273
|
-
}
|
|
7274
|
-
}
|
|
7275
|
-
}
|
|
7276
|
-
if (calcObject["total"] != undefined) {
|
|
7277
|
-
if (this.infoFooter == true && this.el.shadowRoot.querySelector("#in-total")) {
|
|
7278
|
-
this.el.shadowRoot.querySelector("#in-total").innerHTML = calcObject["total"];
|
|
7279
|
-
}
|
|
7280
|
-
}
|
|
7281
|
-
}
|
|
7282
|
-
/**
|
|
7283
|
-
* @desc
|
|
7284
|
-
*/
|
|
7285
|
-
getItemId(event) {
|
|
7286
|
-
var path = event.path || (event.composedPath && event.composedPath());
|
|
7287
|
-
const detect = path
|
|
7288
|
-
&& path[0]
|
|
7289
|
-
&& path[0].attributes
|
|
7290
|
-
&& path[0].attributes['id']
|
|
7291
|
-
&& path[0].attributes['id'].value;
|
|
7292
|
-
return detect;
|
|
7293
|
-
}
|
|
7294
|
-
/**
|
|
7295
|
-
* @desc
|
|
7296
|
-
*/
|
|
7297
|
-
isInternalSlot(event) {
|
|
7298
|
-
var path = event.path || (event.composedPath && event.composedPath());
|
|
7299
|
-
const detect = path
|
|
7300
|
-
&& path[0]
|
|
7301
|
-
&& lowercase$2(path[0].tagName) === 'bcm-list-item'
|
|
7302
|
-
&& this.el.contains(path[0]);
|
|
7303
|
-
return detect;
|
|
7304
|
-
}
|
|
7305
|
-
/**
|
|
7306
|
-
* @desc
|
|
7307
|
-
*/
|
|
7308
|
-
isInternal(event) {
|
|
7309
|
-
var path = event.path || (event.composedPath && event.composedPath());
|
|
7310
|
-
const detect = path
|
|
7311
|
-
&& path[0]
|
|
7312
|
-
&& path[0].attributes
|
|
7313
|
-
&& path[0].attributes['_internal_id']
|
|
7314
|
-
&& path[0].attributes['_internal_id'].value;
|
|
7315
|
-
return detect == this._internal_id;
|
|
7316
|
-
}
|
|
7317
|
-
/**
|
|
7318
|
-
* @desc
|
|
7319
|
-
*/
|
|
7320
|
-
handleLinkedComponent() {
|
|
7321
|
-
dropInComponent(this.el, "#" + this.linkedComponent);
|
|
7322
|
-
var element = null;
|
|
7323
|
-
if (this.width == "100%" && (element = document.querySelector("#" + this.linkedComponent))) {
|
|
7324
|
-
this.linkedElementWidth = element.clientWidth + "px";
|
|
7325
|
-
}
|
|
7326
|
-
}
|
|
7327
|
-
/**
|
|
7328
|
-
* @desc
|
|
7329
|
-
*/
|
|
7330
|
-
async selectIsInitialize() {
|
|
7331
|
-
const elementId = "bcm-list-select-" + this._id;
|
|
7332
|
-
var element;
|
|
7333
|
-
if (!document.getElementById(elementId)) {
|
|
7334
|
-
element = document.createElement("bcm-list-select");
|
|
7335
|
-
}
|
|
7336
|
-
else {
|
|
7337
|
-
element = document.getElementById(elementId);
|
|
7338
|
-
}
|
|
7339
|
-
element.setAttribute("id", elementId);
|
|
7340
|
-
element.setAttribute("_list_id", this._id);
|
|
7341
|
-
element.setAttribute("_internal_id", this._internal_id);
|
|
7342
|
-
if (this.type) {
|
|
7343
|
-
element.setAttribute("type", this.type);
|
|
7344
|
-
}
|
|
7345
|
-
if (this.clearable) {
|
|
7346
|
-
element.setAttribute("clearable", this.clearable);
|
|
7347
|
-
}
|
|
7348
|
-
if (this.label) {
|
|
7349
|
-
element.setAttribute("label", this.label);
|
|
7350
|
-
}
|
|
7351
|
-
if (this.placeholder) {
|
|
7352
|
-
element.setAttribute("placeholder", this.placeholder);
|
|
7353
|
-
}
|
|
7354
|
-
if (this.noCaption) {
|
|
7355
|
-
element.setAttribute("no-naption", this.noCaption);
|
|
7356
|
-
}
|
|
7357
|
-
if (this.caption) {
|
|
7358
|
-
element.setAttribute("caption", this.caption);
|
|
7359
|
-
}
|
|
7360
|
-
if (this.captionError) {
|
|
7361
|
-
element.setAttribute("caption-error", this.captionError);
|
|
7362
|
-
}
|
|
7363
|
-
if (this.captionType) {
|
|
7364
|
-
element.setAttribute("caption-type", this.captionType);
|
|
7365
|
-
}
|
|
7366
|
-
if (this.disabled) {
|
|
7367
|
-
element.setAttribute("disabled", this.disabled);
|
|
7368
|
-
}
|
|
7369
|
-
if (this.name) {
|
|
7370
|
-
element.setAttribute("name", this.name);
|
|
7371
|
-
}
|
|
7372
|
-
if (this.required) {
|
|
7373
|
-
element.setAttribute("required", this.required);
|
|
7374
|
-
}
|
|
7375
|
-
if (this.fullWidth) {
|
|
7376
|
-
element.setAttribute("full-width", this.fullWidth);
|
|
7377
|
-
}
|
|
7378
|
-
if (this.multiSelect) {
|
|
7379
|
-
element.setAttribute("multiselect", this.multiSelect);
|
|
7380
|
-
}
|
|
7381
|
-
const parentNode = this.el.parentNode;
|
|
7382
|
-
parentNode.insertBefore(element, this.el);
|
|
7383
|
-
return elementId;
|
|
7384
|
-
}
|
|
7385
|
-
/**
|
|
7386
|
-
* @desc
|
|
7387
|
-
*/
|
|
7388
|
-
handleCheckboxClick(e) {
|
|
7389
|
-
e.preventDefault();
|
|
7390
|
-
}
|
|
7391
|
-
/**
|
|
7392
|
-
* @desc
|
|
7393
|
-
*/
|
|
7394
|
-
async handleIndeterminateClick(e) {
|
|
7395
|
-
e.preventDefault();
|
|
7396
|
-
this.indeterminateStatus = false;
|
|
7397
|
-
if (this.checkStatus === false) {
|
|
7398
|
-
this.checkStatus = true;
|
|
7399
|
-
}
|
|
7400
|
-
else {
|
|
7401
|
-
this.checkStatus = false;
|
|
7402
|
-
}
|
|
7403
|
-
if (this.items != undefined && this.items.length > 0) {
|
|
7404
|
-
// const subItems = this.el.shadowRoot.querySelectorAll("bcm-list-item")
|
|
7405
|
-
var selectedIDs = [];
|
|
7406
|
-
this.items.forEach(item => {
|
|
7407
|
-
selectedIDs.push(item[this.objectMapping['id']]);
|
|
7408
|
-
// this.jsonDataProcess( item[ this.objectMapping['id'] ], this.checkStatus === true ? true : false)
|
|
7409
|
-
// this.handleChecklist( item, this.checkStatus === true ? true : false)
|
|
7410
|
-
// var element:any = this.el.shadowRoot.getElementById( item[ this.objectMapping['id'] ] )
|
|
7411
|
-
// if ( element ) {
|
|
7412
|
-
// if ( element.shadowRoot.querySelector(".checkbox") ){
|
|
7413
|
-
// element.shadowRoot.querySelector(".checkbox").querySelector("input").checked = this.checkStatus
|
|
7414
|
-
// }
|
|
7415
|
-
// if ( this.checkStatus === true ){
|
|
7416
|
-
// element.classList.add("selected")
|
|
7417
|
-
// } else {
|
|
7418
|
-
// element.classList.remove("selected")
|
|
7419
|
-
// }
|
|
7420
|
-
// }
|
|
7421
|
-
});
|
|
7422
|
-
if (this.checkStatus === true) {
|
|
7423
|
-
this.checked(selectedIDs, false);
|
|
7424
|
-
}
|
|
7425
|
-
else {
|
|
7426
|
-
this.unChecked(selectedIDs);
|
|
7427
|
-
}
|
|
7428
|
-
if (this.processType === 'deselect') {
|
|
7429
|
-
var element = document.querySelector("#" + this._list_id);
|
|
7430
|
-
if (element) {
|
|
7431
|
-
// if ( this.firstRender === false ){
|
|
7432
|
-
element.toggleChecked(selectedIDs);
|
|
7433
|
-
// }
|
|
7434
|
-
// element.unChecked(this.selectedId)
|
|
7435
|
-
}
|
|
7436
|
-
}
|
|
7437
|
-
// this.listChecked.emit( this.checklist )
|
|
7438
|
-
// this.value = this.checklist
|
|
7439
|
-
// this.sendSelectValue()
|
|
7440
|
-
}
|
|
7441
|
-
this.handleIndeterminateStatus();
|
|
7442
|
-
}
|
|
7443
|
-
/**
|
|
7444
|
-
* @desc
|
|
7445
|
-
*/
|
|
7446
|
-
sendSelectValue() {
|
|
7447
|
-
if (this.type === 'select' || this.type === 'autocomplete') {
|
|
7448
|
-
const select = document.getElementById("bcm-list-select-" + this._id);
|
|
7449
|
-
if (select) {
|
|
7450
|
-
if (this.multiSelect === true) {
|
|
7451
|
-
select.setValue(this.value, this.objectMapping["id"], this.objectMapping["text"]);
|
|
7452
|
-
}
|
|
7453
|
-
else {
|
|
7454
|
-
select.setValue(this.value[this.objectMapping["text"]]);
|
|
7455
|
-
}
|
|
7456
|
-
}
|
|
7457
|
-
}
|
|
7458
|
-
}
|
|
7459
|
-
render() {
|
|
7460
|
-
const classes = classnames('list-container', this.size);
|
|
7461
|
-
const listItem = classnames('list-item', this.size, {
|
|
7462
|
-
'size-2': this.size === 'small' || this.size === 'medium',
|
|
7463
|
-
'size-3': this.size === 'large',
|
|
7464
|
-
});
|
|
7465
|
-
const hostClasses = classnames(this.hidden ? 'hidden' : null, 'type-' + this.type, {
|
|
7466
|
-
'error': this.captionType == 'error' ? true : false,
|
|
7467
|
-
'show': this.isShow,
|
|
7468
|
-
'flex': this.minHeight != null || this.maxHeight != null,
|
|
7469
|
-
'full-width': this.fullWidth
|
|
7470
|
-
});
|
|
7471
|
-
const searchContainer = classnames('search-container', {
|
|
7472
|
-
'show': this.searchable,
|
|
7473
|
-
});
|
|
7474
|
-
const footer = classnames('footer');
|
|
7475
|
-
const captionClasses = classnames('size-1', 'input-caption', 'caption-' + this.captionType);
|
|
7476
|
-
var customStyle = {
|
|
7477
|
-
'height': this.minHeight != null || this.maxHeight != null ? 'auto' : this.height,
|
|
7478
|
-
'min-height': this.minHeight != null ? this.minHeight : null,
|
|
7479
|
-
'max-height': this.maxHeight != null ? this.maxHeight : null,
|
|
7480
|
-
'width': this.minWidth != null || this.maxWidth != null ? 'max-content' :
|
|
7481
|
-
this.width != "100%" ? this.width : this.linkedElementWidth,
|
|
7482
|
-
'min-width': this.minWidth != null ? this.minWidth == "100%" || this.minWidth == "auto" ? this.linkedElementWidth : this.minWidth : null,
|
|
7483
|
-
'max-width': this.maxWidth != null ? this.maxWidth == "100%" || this.maxWidth == "auto" ? this.linkedElementWidth : this.maxWidth : null,
|
|
7484
|
-
};
|
|
7485
|
-
return (h(Host, { class: hostClasses, style: customStyle }, (this.type === 'default' && this.processType === 'default' && this.label) && (h("label", { class: "label size-1" }, " ", this.label, " ", this.required && ('*'), " ")), h("main", { style: customStyle }, this.searchable === true && (h("div", { class: searchContainer }, h("bcm-search", { id: "search", _internal_id: this._internal_id, searchPlaceholder: this.searchPlaceholder, data: this.searchData, returnField: this.returnField, searchFields: this.searchFields, searchValue: this.searchText, clearable: true }), h("bcm-divider", null))), h("div", { class: classes }, this.multiSelect === true && (h("div", { class: "check-container" }, h("div", { class: listItem, id: "text", onClick: (e) => this.handleIndeterminateClick(e) }, h("div", { class: "check-content" }, h("bcm-checkbox-lite", { id: 'check-lite-' + this._id, name: 'check-lite-' + this._id, checked: false, indeterminate: false, onClick: (e) => this.handleCheckboxClick(e) })), "Select All"), h("div", { class: "divider" }, h("bcm-divider", null)))), h("slot", null), h("div", { class: "list" }), h("div", { class: "spinner first-run" }, h("bcm-icon", { type: "animated", color: "prime-blue", class: "prefix", icon: "loading" }))), this.infoFooter == true && (h("div", { class: footer }, h("bcm-text", { scale: "size-1", color: "grey-8" }, h("span", { id: "selected-item" }), " Total ", h("span", { id: "in-total" }, "0"), " items found.")))), (this.type === 'default' && this.processType === 'default' && !this.noCaption) && (h("div", { class: "caption-area" }, this.captionType == "error"
|
|
7486
|
-
? h("span", { class: captionClasses }, " ", this.captionError, " ")
|
|
7487
|
-
: this.caption && h("span", { class: captionClasses }, " ", this.caption, " ")))));
|
|
7488
|
-
}
|
|
7489
|
-
get el() { return getElement(this); }
|
|
7490
|
-
static get watchers() { return {
|
|
7491
|
-
"isShow": ["handleOpen"],
|
|
7492
|
-
"value": ["handleChange"]
|
|
7493
|
-
}; }
|
|
7494
|
-
};
|
|
7495
|
-
BcmList.style = listCss;
|
|
7496
|
-
|
|
7497
|
-
const listItemCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");.size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}:host(.hidden){display:none}:host(.selected) .list-item{color:var(--bcm-color-prime-blue-6);background-color:var(--bcm-color-prime-blue-1)}:host(.selected) .list-item:hover:not(.disabled){color:var(--bcm-color-prime-blue-7);background-color:var(--bcm-color-prime-blue-1)}:host(.selected) .list-item.disabled{color:var(--bcm-color-grey-6);cursor:not-allowed}:host(.selected) .list-item .check{background-color:#333333}:host(.checkable) .list-item .check{display:inline-block}.list-item{padding:8px;color:var(--bcm-color-grey-8);background-color:var(--bcm-color-grey-1);cursor:pointer;display:flex;justify-content:flex-start;align-items:center;flex-direction:row;white-space:break-spaces}.list-item .check{display:none;background-color:#ededed;width:15px;height:15px}.list-item .highlight{background-color:var(--bcm-color-yellow-5)}.list-item:hover:not(.disabled),.list-item:active:not(.disabled){color:var(--bcm-color-grey-8);background-color:var(--bcm-color-prime-blue-1)}.list-item .check-content{display:flex;align-items:center;justify-content:flex-start;width:16px;min-width:16px;margin-right:8px;margin-bottom:2px}.checkbox{}.checkbox input{display:none}.checkbox .svg-icon{filter:brightness(0) invert(1);width:12px;height:12px}.checkbox label{display:flex;align-items:flex-start;font-size:14px;color:var(--bcm-color-grey-8);cursor:pointer}.checkbox label span.icon{display:flex;align-items:center;justify-content:center;min-width:16px;min-height:16px;border:1px solid #D9D9D9;margin-right:8px;border-radius:2px;margin-top:2px;background-color:var(--bcm-color-grey-1)}.checkbox.indeterminate label span.icon{position:relative}.checkbox.indeterminate label span.icon::after{content:\"\";position:absolute;top:50%;left:8px;width:10px;height:10px;background-color:var(--bcm-color-prime-blue-6);transform:translate(-50%, -50%);opacity:1;z-index:1}.checkbox.indeterminate label span.icon::before{content:\"\";position:absolute;top:-1px;left:-1px;width:16px;height:100%;border-radius:2px;background-color:var(--bcm-color-grey-1);border:1px solid var(--bcm-color-grey-5);opacity:1;z-index:1}.checkbox.indeterminate label span.icon:hover:not(.disabled):before{border-color:var(--bcm-color-prime-blue-6);box-shadow:0px 2px 4px rgba(54, 121, 171, 0.5)}.checkbox input:checked+label span.icon{background-color:var(--bcm-color-prime-blue-6);border-color:transparent}.checkbox input:checked+label .icon-checked{display:block}.checkbox bcm-icon{filter:brightness(0) invert(1)}.checkbox input[disabled]+label{cursor:not-allowed}.checkbox input[disabled]+label span.icon{background-color:var(--bcm-color-grey-3);border-color:var(--bcm-color-grey-5)}.checkbox input[disabled]+label bcm-icon{filter:brightness(0);opacity:0.3}.checkbox input:not([disabled])+label:hover span.icon{border-color:var(--bcm-color-prime-blue-6);box-shadow:0px 2px 4px rgba(54, 121, 171, 0.5)}.checkbox .caption-area{margin-bottom:8px;min-height:20px;display:block}.checkbox .input-caption{display:block}.checkbox .caption-default{color:#8C8C8C}.checkbox .caption-primary{color:#4293CF}.checkbox .caption-success{color:#52C41A}.checkbox .caption-warning{color:#FA8C16}.checkbox .caption-error{color:#F5222D}.checkbox .radio-button{background-color:var(--bcm-color-grey-1);color:var(--bcm-color-grey-8);border:1px solid var(--bcm-color-grey-5);padding:0 16px;box-sizing:border-box;display:flex;align-items:center;justify-content:center}.checkbox .radio-button>span.icon{display:none}.checkbox .radio-button>span.slot{display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden;user-select:none}.checkbox .radio-button:hover:not(.disabled){color:var(--bcm-color-prime-blue-5)}.checkbox .radio-button:active:not(.disabled){color:var(--bcm-color-prime-blue-7)}.checkbox .radio-button.disabled{background-color:var(--bcm-color-grey-3);color:var(--bcm-color-grey-6);cursor:not-allowed}.checkbox .radio-button.checked.disabled{background-color:var(--bcm-color-grey-4);color:var(--bcm-color-grey-1);border-color:var(--bcm-color-grey-5)}.checkbox .radio-button.checked.solid{color:var(--bcm-color-grey-1);background-color:var(--bcm-color-prime-blue-6);border-color:var(--bcm-color-prime-blue-6)}.checkbox .radio-button.checked.solid:hover{background-color:var(--bcm-color-prime-blue-5);border-color:var(--bcm-color-prime-blue-5)}.checkbox .radio-button.checked.solid:active{background-color:var(--bcm-color-prime-blue-7);border-color:var(--bcm-color-prime-blue-7)}.checkbox .radio-button.checked.outline{background-color:var(--bcm-color-grey-1);color:var(--bcm-color-prime-blue-6);border-color:var(--bcm-color-prime-blue-6)}.checkbox .radio-button.checked.outline:hover{color:var(--bcm-color-prime-blue-5);border-color:var(--bcm-color-prime-blue-5)}.checkbox .radio-button.checked.outline:active{color:var(--bcm-color-prime-blue-7);border-color:var(--bcm-color-prime-blue-7)}.checkbox .radio-button.large{height:40px}.checkbox .radio-button.medium{height:32px}.checkbox .radio-button.small{height:24px}";
|
|
7498
|
-
|
|
7499
|
-
const BcmListItem = class {
|
|
7500
|
-
constructor(hostRef) {
|
|
7501
|
-
registerInstance(this, hostRef);
|
|
7502
|
-
this.listSelected = createEvent(this, "bcm-list-selected", 7);
|
|
7503
|
-
this.listChecked = createEvent(this, "bcm-list-checked", 7);
|
|
7504
|
-
this.size = 'medium';
|
|
7505
|
-
this.hidden = false;
|
|
7506
|
-
this.disabled = false;
|
|
7507
|
-
this._internal_id = (Math.random() * 4).toString(16).replace('.', '');
|
|
7508
|
-
this.template = null;
|
|
7509
|
-
this._uniq_id = (Math.random() * 4).toString(16).replace('.', '');
|
|
7510
|
-
// @Prop({ attribute: 'id', reflect: true }) id: string = (Math.random() * 4).toString(16).replace('.', '')
|
|
7511
|
-
this._id = (Math.random() * 4).toString(16).replace('.', '');
|
|
7512
|
-
this.itemObject = null;
|
|
7513
|
-
this.selected = false;
|
|
7514
|
-
this.multiSelect = false;
|
|
7515
|
-
}
|
|
7516
|
-
// @Event({ bubbles: true, composed: true }) loaded: EventEmitter<boolean>;
|
|
7517
|
-
connectedCallback() { }
|
|
7518
|
-
disconnectedCallback() { }
|
|
7519
|
-
componentWillLoad() { }
|
|
7520
|
-
componentDidLoad() {
|
|
7521
|
-
this.itemObject = this.itemObject;
|
|
7522
|
-
// setTimeout(() => {
|
|
7523
|
-
// this.loaded.emit(true);
|
|
7524
|
-
// }, 1000);
|
|
7525
|
-
}
|
|
7526
|
-
componentWillRender() { }
|
|
7527
|
-
componentDidRender() { }
|
|
7528
|
-
componentWillUpdate() { }
|
|
7529
|
-
componentDidUpdate() { }
|
|
7530
|
-
/**
|
|
7531
|
-
* @desc
|
|
7532
|
-
*/
|
|
7533
|
-
async select() {
|
|
7534
|
-
this.sendSelect();
|
|
7535
|
-
}
|
|
7536
|
-
/**
|
|
7537
|
-
* @desc
|
|
7538
|
-
*/
|
|
7539
|
-
handleClick() {
|
|
7540
|
-
this.sendSelect();
|
|
7541
|
-
}
|
|
7542
|
-
/**
|
|
7543
|
-
* @desc
|
|
7544
|
-
*/
|
|
7545
|
-
sendSelect() {
|
|
7546
|
-
if (!this.disabled) {
|
|
7547
|
-
var returnValue = null;
|
|
7548
|
-
if (this.itemObject) {
|
|
7549
|
-
typeof this.itemObject == 'string'
|
|
7550
|
-
? returnValue = JSON.parse(this.itemObject)
|
|
7551
|
-
: returnValue = this.itemObject;
|
|
7552
|
-
// returnValue = this.itemObject
|
|
7553
|
-
}
|
|
7554
|
-
else {
|
|
7555
|
-
returnValue = this._id;
|
|
7556
|
-
}
|
|
7557
|
-
this.listSelected.emit(returnValue);
|
|
7558
|
-
}
|
|
7559
|
-
}
|
|
7560
|
-
handleCheckboxClick(e) {
|
|
7561
|
-
e.preventDefault();
|
|
7562
|
-
}
|
|
7563
|
-
render() {
|
|
7564
|
-
const { size, disabled, selected, hidden, multiSelect } = this;
|
|
7565
|
-
const classes = classnames('list-item', size, {
|
|
7566
|
-
'disabled': disabled,
|
|
7567
|
-
'selected': selected,
|
|
7568
|
-
'size-2': size === 'small' || size === 'medium',
|
|
7569
|
-
'size-3': size === 'large',
|
|
7570
|
-
});
|
|
7571
|
-
const hostClasses = classnames(hidden ? 'hidden' : null, {
|
|
7572
|
-
'disabled': disabled,
|
|
7573
|
-
'selected': selected,
|
|
7574
|
-
'checkable': multiSelect,
|
|
7575
|
-
});
|
|
7576
|
-
const checkboxClasses = classnames('checkbox', this.hidden ? 'hidden' : null, {
|
|
7577
|
-
'indeterminate': false
|
|
7578
|
-
});
|
|
7579
|
-
const checkboxIconClasses = classnames('icon');
|
|
7580
|
-
return (h(Host, { class: hostClasses, onClick: () => this.handleClick() }, h("div", { class: classes }, multiSelect && (h("div", { class: "check-content" }, h("div", { class: checkboxClasses, onClick: (e) => this.handleCheckboxClick(e) }, h("input", { id: 'check-' + this._id, type: "checkbox", name: 'check-' + this._id, checked: this.selected, disabled: this.disabled }), h("label", { htmlFor: 'check-' + this._id }, h("span", { class: checkboxIconClasses }, h("svg", { class: "svg-icon icon-checked", width: "11", height: "9", viewBox: "0 0 11 9", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M1.91308 4.03516H1.91326C1.99256 4.03525 2.07081 4.05331 2.14213 4.08798C2.21341 4.12262 2.27591 4.17295 2.32497 4.2352L1.91308 4.03516ZM1.91308 4.03516H1.09394C0.890308 4.03516 0.776602 4.26975 0.902321 4.4292L0.902371 4.42927L4.11214 8.49567L4.11218 8.49573C4.32247 8.76188 4.72568 8.76114 4.93667 8.49617L4.93708 8.49566L10.6597 1.24398C10.6598 1.24378 10.66 1.24358 10.6602 1.24338C10.7884 1.08295 10.6699 0.85 10.4689 0.85H9.6498C9.48941 0.85 9.33668 0.9235 9.2376 1.05044C9.23751 1.05055 9.23742 1.05066 9.23734 1.05077L4.52403 7.02157M1.91308 4.03516L4.52403 7.02157M4.52403 7.02157L2.32506 4.23531L4.52403 7.02157Z", fill: "#BFBFBF", stroke: "#BFBFBF", "stroke-width": "0.3" }))))))), h("span", { id: "text" }, this.text ? this.text : h("slot", null)))));
|
|
7581
|
-
}
|
|
7582
|
-
get el() { return getElement(this); }
|
|
7583
|
-
};
|
|
7584
|
-
BcmListItem.style = listItemCss;
|
|
7585
|
-
|
|
7586
|
-
const listSelectCss = "@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}.size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}:host{display:inline-block;width:256px;margin:0 0 8px 0;overflow:hidden;max-width:100%}:host(.hidden){display:none}:host(.full-width){width:100%}:host(.type-autocomplete) #selected-container{border:none}:host(.type-autocomplete) #selected-container .selected-text{padding:0;border:none}:host(.type-autocomplete) #selected-container .selected-text bcm-input{display:contents}.container{display:block;max-width:256px;position:relative}.container.full-width{width:100%;max-width:100%}.selected{width:100%;box-sizing:border-box;color:var(--bcm-color-grey-8);background-color:var(--bcm-color-grey-1);display:flex;justify-content:space-between;align-items:center;border:1px solid var(--bcm-color-grey-5);user-select:none;cursor:pointer;border-radius:2px;position:relative}.selected:hover:not(.disabled){border-color:var(--bcm-color-prime-blue-5)}.selected:hover:not(.disabled) .select-clear-button{opacity:1}.selected:focus:not(.disabled){border-color:var(--bcm-color-prime-blue-5);box-shadow:0px 0px 4px var(--bcm-color-prime-blue-6)}.selected:focus:not(.disabled) .select-clear-button{opacity:1}.selected:focus{outline:none}.selected.disabled{background-color:var(--bcm-color-grey-3);color:var(--bcm-color-grey-8);cursor:not-allowed}.selected .buttons{padding:8px;height:100%;display:flex;align-items:center;justify-content:center}.selected .selected-text{padding:0 8px;width:100%;height:100%;flex:1;display:flex;align-items:center;overflow:hidden}.selected .selected-text .text-content{display:-webkit-box;overflow:hidden;-webkit-line-clamp:1;-webkit-box-orient:vertical}.selected .selected-tags{padding:0 4px;height:100%}.selected .tag-container{height:100%;display:flex;align-items:center;justify-content:flex-start;grid-gap:2px}.selected .tag-container>span{height:100%;align-items:center;justify-content:flex-start;display:flex;grid-gap:2px}.selected .tag-container .tag{max-width:200px}.selected .tag-container #other-tag{cursor:pointer}.selected .open,.selected .close{display:inline-flex}.selected .close{transform:rotate(180deg)}.selected .placeholder{color:var(--bcm-color-grey-6);user-select:none;font-size:14px;display:flex;align-items:center;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}.options-viewport{display:inline-block}.option-container{display:block;position:absolute;background-color:var(--bcm-color-grey-1);box-shadow:0px 2px 8px rgba(0, 0, 0, 0.15);box-sizing:border-box;width:100%;z-index:10000}.option-container.alignment-left{left:0}.option-container.alignment-right{right:0}.option-container.hidden{display:none}.option-container .search{position:sticky;padding:8px;margin-bottom:4px}.option-container .search:after{content:\"\";position:absolute;bottom:0;height:1px;width:calc(100% - 16px);background-color:var(--bcm-color-grey-5)}.items{display:flex;flex-direction:column}.buttons{display:flex}.select-clear-button{display:inline-flex;align-items:center;outline:none;border:none;background:none;padding:0;cursor:pointer;margin-right:4px;opacity:0}.label{display:block;color:var(--bcm-color-grey-9);margin-bottom:4px}.caption-area{min-height:20px}.input-caption{display:block}.selected-large{height:40px}.selected-medium{height:32px}.selected-small{height:24px}.caption-default{color:#8C8C8C}.caption-primary{color:#4293CF}.caption-success{color:#52C41A}.caption-warning{color:#FA8C16}.caption-error{color:#F5222D}.error .label{color:var(--bcm-color-red-6) !important}.error .selected{border:1px solid var(--bcm-color-red-6) !important}.spinner{position:absolute;z-index:1;top:0;opacity:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;background-color:#ffffff;visibility:hidden;transition:opacity 0.3s, visibility 0.5s}.spinner.show{visibility:visible;opacity:0.9}.spinner.first-run{visibility:visible;opacity:1}.tag{display:flex;align-items:center;justify-content:center;padding:0 8px;cursor:default;border-radius:48px;border:1px solid var(--bcm-color-grey-5);user-select:none;min-width:10px;min-height:20px;height:20px}.tag[hidden]{opacity:0 !important;position:absolute !important;z-index:-1}.tag .value{cursor:pointer;max-width:164px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block}.tag.size-large{padding:calc(40px - 8px) 40px}.tag.size-medium{padding:calc(32px - 8px) 32px}.tag.size-small{padding:calc(24px - 8px) 24px}.tag.dissmisable{background-color:var(--bcm-color-grey-3);color:var(--bcm-color-grey-8)}.tag.dissmisable:hover{opacity:0.85}.tag.dissmisable{color:var(--bcm-color-grey-10)}.tag.dissmisable .close-button{width:14px;cursor:pointer}.tag.dissmisable .close-button bcm-icon,.tag.dissmisable .close-button .icon *{color:var(--bcm-color-grey-7)}.tag.dissmisable .close-button:hover bcm-icon,.tag.dissmisable .close-button:hover .icon *{color:var(--bcm-color-grey-10)}.tag span{display:inline-flex}.tag span.left{margin-right:4px}.tag span.right{margin-left:4px}.tag:before,.tag:after{content:\"\"}";
|
|
7587
|
-
|
|
7588
|
-
const BcmListSelect = class {
|
|
7589
|
-
constructor(hostRef) {
|
|
7590
|
-
registerInstance(this, hostRef);
|
|
7591
|
-
this.change = createEvent(this, "bcm-change", 7);
|
|
7592
|
-
this.clear = createEvent(this, "bcm-clear", 7);
|
|
7593
|
-
this.focus = createEvent(this, "bcm-focus", 7);
|
|
7594
|
-
this.blur = createEvent(this, "bcm-blur", 7);
|
|
7595
|
-
this.objectMapping = {
|
|
7596
|
-
'id': "id",
|
|
7597
|
-
'text': "text",
|
|
7598
|
-
'selected': "selected",
|
|
7599
|
-
};
|
|
7600
|
-
this.hidden = false;
|
|
7601
|
-
this._id = (Math.random() * 4).toString(16).replace('.', '');
|
|
7602
|
-
this._list_id = null;
|
|
7603
|
-
this.value = null;
|
|
7604
|
-
this._internal_id = (Math.random() * 4).toString(16).replace('.', '');
|
|
7605
|
-
this.type = 'default';
|
|
7606
|
-
this.size = 'medium';
|
|
7607
|
-
this.placeholder = "Choose an option";
|
|
7608
|
-
this.noCaption = false;
|
|
7609
|
-
this.captionType = 'default';
|
|
7610
|
-
this.fullWidth = false;
|
|
7611
|
-
this.required = false;
|
|
7612
|
-
this.multiSelect = false;
|
|
7613
|
-
this.searchData = null;
|
|
7614
|
-
this.searchPlaceholder = "Search";
|
|
7615
|
-
this.searchFields = ['text'];
|
|
7616
|
-
this.returnField = "id";
|
|
7617
|
-
this.searchSub = "items";
|
|
7618
|
-
this.searchText = "";
|
|
7619
|
-
this.captionCache = null;
|
|
7620
|
-
this.captionTypeCache = null;
|
|
7621
|
-
this.isOpen = false;
|
|
7622
|
-
this.selectArea = null;
|
|
7623
|
-
this.selectAreaWidth = 0;
|
|
7624
|
-
this.selectHiddenData = [];
|
|
7625
|
-
this.otherList = [];
|
|
7626
|
-
this.selectText = null;
|
|
7627
|
-
this.selectData = [];
|
|
7628
|
-
}
|
|
7629
|
-
connectedCallback() { }
|
|
7630
|
-
disconnectedCallback() { }
|
|
7631
|
-
componentWillLoad() { }
|
|
7632
|
-
componentDidLoad() {
|
|
7633
|
-
this.selectArea = this.el.shadowRoot.querySelector(".selected-text");
|
|
7634
|
-
this.selectAreaWidth = this.selectArea.clientWidth;
|
|
7635
|
-
setTimeout(() => {
|
|
7636
|
-
const spinner = this.el.shadowRoot.querySelector('.spinner');
|
|
7637
|
-
spinner.classList.remove("first-run");
|
|
7638
|
-
}, 100);
|
|
7639
|
-
}
|
|
7640
|
-
componentWillRender() { }
|
|
7641
|
-
componentDidRender() {
|
|
7642
|
-
if (this.selectAreaWidth === 0) {
|
|
7643
|
-
this.selectArea = this.el.shadowRoot.querySelector(".selected-text");
|
|
7644
|
-
this.selectAreaWidth = this.selectArea.clientWidth;
|
|
7645
|
-
}
|
|
7646
|
-
this.selectArea.style.width = "100%";
|
|
7647
|
-
this.handleTagControl();
|
|
7648
|
-
if (sessionStorage.getItem(this._internal_id + "-config")) {
|
|
7649
|
-
this.config(JSON.parse(sessionStorage.getItem(this._internal_id + "-config")));
|
|
7650
|
-
}
|
|
7651
|
-
}
|
|
7652
|
-
componentWillUpdate() { }
|
|
7653
|
-
componentDidUpdate() { }
|
|
7654
|
-
/**
|
|
7655
|
-
* @descc
|
|
7656
|
-
*/
|
|
7657
|
-
handleFocus() {
|
|
7658
|
-
this.focus.emit();
|
|
7659
|
-
}
|
|
7660
|
-
/**
|
|
7661
|
-
* @descc
|
|
7662
|
-
*/
|
|
7663
|
-
handleBlur() {
|
|
7664
|
-
this.blur.emit();
|
|
7665
|
-
}
|
|
7666
|
-
/**
|
|
7667
|
-
* @desc
|
|
7668
|
-
*/
|
|
7669
|
-
async resetCaption() {
|
|
7670
|
-
this.caption = this.captionCache;
|
|
7671
|
-
this.captionType = this.captionTypeCache;
|
|
7672
|
-
this.captionError = null;
|
|
7673
|
-
}
|
|
7674
|
-
/**
|
|
7675
|
-
* @descc
|
|
7676
|
-
*/
|
|
7677
|
-
async handleOpen(list = "default") {
|
|
7678
|
-
var element = null;
|
|
7679
|
-
var list_id = null;
|
|
7680
|
-
switch (list) {
|
|
7681
|
-
case "default":
|
|
7682
|
-
list_id = this._list_id;
|
|
7683
|
-
break;
|
|
7684
|
-
case "other":
|
|
7685
|
-
list_id = "bcm-clone-list-" + this._internal_id;
|
|
7686
|
-
break;
|
|
7687
|
-
}
|
|
7688
|
-
element = document.getElementById(list_id);
|
|
7689
|
-
if (element != null) {
|
|
7690
|
-
if (element.classList.contains("show") === true) {
|
|
7691
|
-
element.hide();
|
|
7692
|
-
}
|
|
7693
|
-
else {
|
|
7694
|
-
element.show();
|
|
7695
|
-
}
|
|
7696
|
-
}
|
|
7697
|
-
}
|
|
7698
|
-
/**
|
|
7699
|
-
* @desc
|
|
7700
|
-
*/
|
|
7701
|
-
async hide(list = "default") {
|
|
7702
|
-
var element = null;
|
|
7703
|
-
var list_id = null;
|
|
7704
|
-
switch (list) {
|
|
7705
|
-
case "default":
|
|
7706
|
-
list_id = this._list_id;
|
|
7707
|
-
break;
|
|
7708
|
-
case "other":
|
|
7709
|
-
list_id = "bcm-clone-list-" + this._internal_id;
|
|
7710
|
-
break;
|
|
7711
|
-
}
|
|
7712
|
-
element = document.getElementById(list_id);
|
|
7713
|
-
if (element != null) {
|
|
7714
|
-
element.hide();
|
|
7715
|
-
}
|
|
7716
|
-
}
|
|
7717
|
-
/**
|
|
7718
|
-
* @desc
|
|
7719
|
-
*/
|
|
7720
|
-
async show(list = "default") {
|
|
7721
|
-
var element = null;
|
|
7722
|
-
var list_id = null;
|
|
7723
|
-
switch (list) {
|
|
7724
|
-
case "default":
|
|
7725
|
-
list_id = this._list_id;
|
|
7726
|
-
break;
|
|
7727
|
-
case "other":
|
|
7728
|
-
list_id = "bcm-clone-list-" + this._internal_id;
|
|
7729
|
-
break;
|
|
7730
|
-
}
|
|
7731
|
-
element = document.getElementById(list_id);
|
|
7732
|
-
if (element != null) {
|
|
7733
|
-
element.show();
|
|
7734
|
-
}
|
|
7735
|
-
}
|
|
7736
|
-
/**
|
|
7737
|
-
* @desc
|
|
7738
|
-
*/
|
|
7739
|
-
async toggle(list = "default") {
|
|
7740
|
-
this.handleOpen(list);
|
|
7741
|
-
}
|
|
7742
|
-
/**
|
|
7743
|
-
* @descc
|
|
7744
|
-
*/
|
|
7745
|
-
clickClear(e) {
|
|
7746
|
-
e.stopPropagation();
|
|
7747
|
-
}
|
|
7748
|
-
/**
|
|
7749
|
-
* @desc
|
|
7750
|
-
*/
|
|
7751
|
-
async config(_config) {
|
|
7752
|
-
this.selectArea = this.el.shadowRoot.querySelector(".selected-text");
|
|
7753
|
-
this.selectArea.style.width = "100%";
|
|
7754
|
-
this.selectAreaWidth = this.selectArea.clientWidth;
|
|
7755
|
-
this.handleTagControl();
|
|
7756
|
-
this.selectArea.style.width = this.selectAreaWidth - 16 + "px";
|
|
7757
|
-
if (_config['searchPlaceholder']) {
|
|
7758
|
-
this.searchPlaceholder = _config['searchPlaceholder'];
|
|
7759
|
-
}
|
|
7760
|
-
if (_config['searchFields']) {
|
|
7761
|
-
this.searchFields = _config['searchFields'];
|
|
7762
|
-
}
|
|
7763
|
-
if (_config['returnField']) {
|
|
7764
|
-
this.returnField = _config['returnField'];
|
|
7765
|
-
}
|
|
7766
|
-
if (_config['searchSub']) {
|
|
7767
|
-
this.searchSub = _config['searchSub'];
|
|
7768
|
-
}
|
|
7769
|
-
if (_config['searchText']) {
|
|
7770
|
-
this.searchText = _config['searchText'];
|
|
7771
|
-
}
|
|
7772
|
-
if (_config['mapping']) {
|
|
7773
|
-
if (_config['mapping']['id']) {
|
|
7774
|
-
this.objectMapping['id'] = _config['mapping']['id'];
|
|
7775
|
-
}
|
|
7776
|
-
if (_config['mapping']['text']) {
|
|
7777
|
-
this.objectMapping['text'] = _config['mapping']['text'];
|
|
7778
|
-
}
|
|
7779
|
-
if (_config['mapping']['selected']) {
|
|
7780
|
-
this.objectMapping['selected'] = _config['mapping']['selected'];
|
|
7781
|
-
}
|
|
7782
|
-
}
|
|
7783
|
-
return _config;
|
|
7784
|
-
}
|
|
7785
|
-
/**
|
|
7786
|
-
* @descc
|
|
7787
|
-
*/
|
|
7788
|
-
async setValue(value, _id = "id", _text = "text") {
|
|
7789
|
-
var newValue = value;
|
|
7790
|
-
// this.searchData = JSON.parse(value as string)
|
|
7791
|
-
this.handleLoading(true);
|
|
7792
|
-
this.selectData = [];
|
|
7793
|
-
this.otherList = [];
|
|
7794
|
-
if (typeof value == 'string') {
|
|
7795
|
-
if (this.value !== value) {
|
|
7796
|
-
this.selectText = String(value);
|
|
7797
|
-
this.value = this.selectText;
|
|
7798
|
-
}
|
|
7799
|
-
this.handleLoading(false);
|
|
7800
|
-
}
|
|
7801
|
-
else {
|
|
7802
|
-
if (value) {
|
|
7803
|
-
value.forEach(item => {
|
|
7804
|
-
// console.log(item[id] + " " + item[text])
|
|
7805
|
-
this.selectData.push({ id: item[_id], text: item[_text], selected: true });
|
|
7806
|
-
});
|
|
7807
|
-
}
|
|
7808
|
-
if (this.value !== this.selectData) {
|
|
7809
|
-
this.value = this.selectData;
|
|
7810
|
-
if (value) {
|
|
7811
|
-
newValue.forEach(element => {
|
|
7812
|
-
// element[this.objectMapping['id']] = element[this.objectMapping['id']]
|
|
7813
|
-
element[this.objectMapping['selected']] = true;
|
|
7814
|
-
});
|
|
7815
|
-
}
|
|
7816
|
-
this.otherList = newValue;
|
|
7817
|
-
var visibleTags = this.el.shadowRoot.getElementById("visible-tags");
|
|
7818
|
-
if (visibleTags) {
|
|
7819
|
-
visibleTags.innerHTML = " ";
|
|
7820
|
-
const maxTags = Math.ceil((this.selectAreaWidth - 16) / 40);
|
|
7821
|
-
const visibleSelectData = this.selectData.slice(0, maxTags);
|
|
7822
|
-
visibleSelectData.map((item) => {
|
|
7823
|
-
const newTag = document.createElement("span");
|
|
7824
|
-
newTag.setAttribute("id", String(item["id"]));
|
|
7825
|
-
newTag.setAttribute("value", item["text"]);
|
|
7826
|
-
newTag.setAttribute("title", item["text"]);
|
|
7827
|
-
newTag.setAttribute("_internal_id", this._internal_id);
|
|
7828
|
-
// newTag.customStyle = customStyleTag
|
|
7829
|
-
newTag.style.opacity = "0";
|
|
7830
|
-
newTag.style.position = "absolute";
|
|
7831
|
-
newTag.classList.add("tag");
|
|
7832
|
-
newTag.classList.add("dissmisable");
|
|
7833
|
-
newTag.classList.add("size-1");
|
|
7834
|
-
newTag.setAttribute("_internal_id", this._internal_id);
|
|
7835
|
-
newTag.innerHTML = '<span class="value"> ' + item["text"] + ' </span>'
|
|
7836
|
-
+ '<span id="close-button" ' + '_internal_id="' + this._internal_id + '" class="right close-button"> '
|
|
7837
|
-
+ '<svg class="icon" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> '
|
|
7838
|
-
+ '<g id="icon/outlined/suggested/close">'
|
|
7839
|
-
+ '<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"/>'
|
|
7840
|
-
+ '<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"/>'
|
|
7841
|
-
+ '</g>'
|
|
7842
|
-
+ '</svg>'
|
|
7843
|
-
+ '</span>';
|
|
7844
|
-
visibleTags.appendChild(newTag);
|
|
7845
|
-
});
|
|
7846
|
-
}
|
|
7847
|
-
}
|
|
7848
|
-
// this.selectHiddenData = this.value
|
|
7849
|
-
}
|
|
7850
|
-
// console.log('this.otherList: ', this.otherList)
|
|
7851
|
-
// this.resetCaption()
|
|
7852
|
-
return this.value;
|
|
7853
|
-
}
|
|
7854
|
-
/**
|
|
7855
|
-
* @descc
|
|
7856
|
-
* @param event
|
|
7857
|
-
*/
|
|
7858
|
-
handleLoading(show = false) {
|
|
7859
|
-
const spinner = this.el.shadowRoot.querySelector('.spinner');
|
|
7860
|
-
if (show == true) {
|
|
7861
|
-
spinner.classList.add("show");
|
|
7862
|
-
}
|
|
7863
|
-
else {
|
|
7864
|
-
spinner.classList.remove("show");
|
|
7865
|
-
}
|
|
7866
|
-
}
|
|
7867
|
-
/**
|
|
7868
|
-
* @descc
|
|
7869
|
-
*/
|
|
7870
|
-
resizeEvent() {
|
|
7871
|
-
this.selectArea = this.el.shadowRoot.querySelector(".selected-text");
|
|
7872
|
-
this.selectArea.style.width = "100%";
|
|
7873
|
-
this.selectAreaWidth = this.selectArea.clientWidth;
|
|
7874
|
-
this.handleTagControl();
|
|
7875
|
-
this.selectArea.style.width = this.selectAreaWidth - 16 + "px";
|
|
7876
|
-
}
|
|
7877
|
-
/**
|
|
7878
|
-
* @descc
|
|
7879
|
-
*/
|
|
7880
|
-
async handleTagControl() {
|
|
7881
|
-
this.selectHiddenData = [];
|
|
7882
|
-
const tagcontainer = this.el.shadowRoot.getElementById("tagcontainer");
|
|
7883
|
-
if (tagcontainer) {
|
|
7884
|
-
var tags = tagcontainer.querySelectorAll(".tag");
|
|
7885
|
-
var tagsWidth = 0;
|
|
7886
|
-
// var otherStatus = false
|
|
7887
|
-
var otherTagWidth = 135 + 2;
|
|
7888
|
-
var padding = 16;
|
|
7889
|
-
var visibleTags = [];
|
|
7890
|
-
tags.forEach(element => {
|
|
7891
|
-
element["hidden"] = false;
|
|
7892
|
-
element["style"]["opacity"] = "0";
|
|
7893
|
-
element["style"]["position"] = "absolute";
|
|
7894
|
-
});
|
|
7895
|
-
tags.forEach(element => {
|
|
7896
|
-
var clientWidth = element.clientWidth <= 200 ? element.clientWidth : 200;
|
|
7897
|
-
if ((this.selectAreaWidth - padding) > (clientWidth + 2 + tagsWidth)) {
|
|
7898
|
-
tagsWidth += clientWidth + 2;
|
|
7899
|
-
element["style"]["opacity"] = "1";
|
|
7900
|
-
element["style"]["position"] = "relative";
|
|
7901
|
-
}
|
|
7902
|
-
else {
|
|
7903
|
-
element["hidden"] = true;
|
|
7904
|
-
// otherStatus = true
|
|
7905
|
-
}
|
|
7906
|
-
});
|
|
7907
|
-
const removeTag = (calcOther = false) => {
|
|
7908
|
-
if ((this.selectAreaWidth - padding) < (calcOther === true ? tagsWidth + otherTagWidth : tagsWidth)) {
|
|
7909
|
-
visibleTags = Array.from(tags).filter(e => e["hidden"] === false);
|
|
7910
|
-
if (visibleTags[visibleTags.length - 1]) {
|
|
7911
|
-
var clientWidth = visibleTags[visibleTags.length - 1].clientWidth <= 200 ? visibleTags[visibleTags.length - 1].clientWidth : 200;
|
|
7912
|
-
tagsWidth -= clientWidth + 2;
|
|
7913
|
-
visibleTags[visibleTags.length - 1]["hidden"] = true;
|
|
7914
|
-
removeTag(calcOther);
|
|
7915
|
-
}
|
|
7916
|
-
}
|
|
7917
|
-
};
|
|
7918
|
-
removeTag();
|
|
7919
|
-
await delay(100);
|
|
7920
|
-
tags = tagcontainer.querySelectorAll(".tag");
|
|
7921
|
-
var hiddenData = Array.from(tags).filter(e => e["hidden"] === true);
|
|
7922
|
-
const otherTagcontainer = this.el.shadowRoot.getElementById("other-container");
|
|
7923
|
-
if (Number(hiddenData.length) > 0) {
|
|
7924
|
-
removeTag(true);
|
|
7925
|
-
if (otherTagcontainer) {
|
|
7926
|
-
otherTagcontainer.style.display = "flex";
|
|
7927
|
-
const otherTag = otherTagcontainer.querySelector("bcm-tag");
|
|
7928
|
-
if (otherTag) {
|
|
7929
|
-
this.selectHiddenData = this.otherList;
|
|
7930
|
-
Array.from(tags).filter(e => e["hidden"] === false).forEach(element => {
|
|
7931
|
-
this.selectHiddenData = this.selectHiddenData.filter(e => String(e[this.objectMapping['id']]) !== String(element.id));
|
|
7932
|
-
});
|
|
7933
|
-
otherTag.setAttribute("value", this.selectHiddenData.length + " item" + (this.selectHiddenData.length > 1 ? 's' : '') + " selected");
|
|
7934
|
-
var result = Object.keys(this.selectHiddenData).map((key) => (this.selectHiddenData[key][this.objectMapping['text']]).substring(0, 15) + "...").slice(0, 10) + "\r\n...";
|
|
7935
|
-
const hiddenTagsString = result.toString().split(',').join("\r\n");
|
|
7936
|
-
otherTag.setAttribute("title", hiddenTagsString);
|
|
7937
|
-
}
|
|
7938
|
-
}
|
|
7939
|
-
}
|
|
7940
|
-
else {
|
|
7941
|
-
if (otherTagcontainer) {
|
|
7942
|
-
otherTagcontainer.style.display = "none";
|
|
7943
|
-
}
|
|
7944
|
-
}
|
|
7945
|
-
}
|
|
7946
|
-
const cloneList = this.listIsInitialize();
|
|
7947
|
-
if (cloneList) {
|
|
7948
|
-
if (sessionStorage.getItem(this._internal_id + "-config")) {
|
|
7949
|
-
cloneList.config(JSON.parse(sessionStorage.getItem(this._internal_id + "-config")));
|
|
7950
|
-
}
|
|
7951
|
-
// console.log('selectHiddenData: ', this.selectHiddenData )
|
|
7952
|
-
cloneList.setDataOther(this.selectHiddenData);
|
|
7953
|
-
// cloneList.show()
|
|
7954
|
-
}
|
|
7955
|
-
// await delay(100)
|
|
7956
|
-
this.handleLoading(false);
|
|
7957
|
-
}
|
|
7958
|
-
/**
|
|
7959
|
-
* @desc
|
|
7960
|
-
*/
|
|
7961
|
-
listIsInitialize() {
|
|
7962
|
-
// console.log("olusturuldu")
|
|
7963
|
-
var element;
|
|
7964
|
-
const elementId = "bcm-clone-list-" + this._internal_id;
|
|
7965
|
-
const otherListInternalId = (Math.random() * 4).toString(16).replace('.', '');
|
|
7966
|
-
if (!document.getElementById(elementId)) {
|
|
7967
|
-
element = document.createElement("bcm-list");
|
|
7968
|
-
var el = document.getElementById(this._list_id);
|
|
7969
|
-
for (var i = 0, atts = el.attributes, n = atts.length; i < n; i++) {
|
|
7970
|
-
element.setAttribute(atts[i].nodeName, atts[i].nodeValue);
|
|
7971
|
-
}
|
|
7972
|
-
element.setAttribute("id", elementId);
|
|
7973
|
-
element.setAttribute("_list_id", this._list_id);
|
|
7974
|
-
element.setAttribute("_list_select_id", this._id);
|
|
7975
|
-
element.setAttribute("_internal_id", otherListInternalId);
|
|
7976
|
-
element.searchable = true;
|
|
7977
|
-
element.infoFooter = false;
|
|
7978
|
-
element.type = "default";
|
|
7979
|
-
element.processType = "deselect";
|
|
7980
|
-
element.setAttribute("linked-component", this._id);
|
|
7981
|
-
element.linkedComponent = this._id;
|
|
7982
|
-
element.multiSelect = true;
|
|
7983
|
-
const parentNode = this.el.parentNode;
|
|
7984
|
-
parentNode.insertBefore(element, this.el);
|
|
7985
|
-
}
|
|
7986
|
-
else {
|
|
7987
|
-
element = document.getElementById(elementId);
|
|
7988
|
-
}
|
|
7989
|
-
//
|
|
7990
|
-
return element;
|
|
7991
|
-
}
|
|
7992
|
-
/**
|
|
7993
|
-
* @descc
|
|
7994
|
-
*/
|
|
7995
|
-
inputChange(e) {
|
|
7996
|
-
this.search(e);
|
|
7997
|
-
}
|
|
7998
|
-
search(value) {
|
|
7999
|
-
const element = document.getElementById(this._list_id);
|
|
8000
|
-
if (element != null) {
|
|
8001
|
-
element.setSearch(value);
|
|
8002
|
-
}
|
|
8003
|
-
}
|
|
8004
|
-
/**
|
|
8005
|
-
* @desc
|
|
8006
|
-
*/
|
|
8007
|
-
async handleClick(event) {
|
|
8008
|
-
var path = event.path || (event.composedPath && event.composedPath());
|
|
8009
|
-
if (path && path.filter((input) => input['_internal_id'] == this._internal_id)[0]) {
|
|
8010
|
-
const cloneElementId = "bcm-clone-list-" + this._internal_id;
|
|
8011
|
-
const cloneElement = document.querySelector("#" + cloneElementId);
|
|
8012
|
-
const element = document.querySelector("#" + this._list_id);
|
|
8013
|
-
if (path.filter((input) => input['id'] == "close-button")[0]
|
|
8014
|
-
&& path.filter((input) => input['className'] == "tag dissmisable size-1")[0]
|
|
8015
|
-
&& path.filter((input) => input['className'] == "tag dissmisable size-1")[0]["id"]) {
|
|
8016
|
-
event.preventDefault();
|
|
8017
|
-
event.stopPropagation();
|
|
8018
|
-
const selectedID = path.filter((input) => input['className'] == "tag dissmisable size-1")[0]["id"];
|
|
8019
|
-
if (element) {
|
|
8020
|
-
element.unChecked(selectedID);
|
|
8021
|
-
}
|
|
8022
|
-
}
|
|
8023
|
-
if (path.filter((input) => input['id'] == "other-tag")[0]) {
|
|
8024
|
-
event.preventDefault();
|
|
8025
|
-
event.stopPropagation();
|
|
8026
|
-
if (path.filter((input) => input['id'] == "close")[0]) {
|
|
8027
|
-
if (cloneElement) {
|
|
8028
|
-
if (await cloneElement.openStatus() === true) {
|
|
8029
|
-
if (element) {
|
|
8030
|
-
element.show();
|
|
8031
|
-
}
|
|
8032
|
-
}
|
|
8033
|
-
}
|
|
8034
|
-
var selectedIDs = [];
|
|
8035
|
-
this.selectHiddenData.forEach(item => {
|
|
8036
|
-
selectedIDs.push(item[this.objectMapping['id']]);
|
|
8037
|
-
});
|
|
8038
|
-
if (element) {
|
|
8039
|
-
element.unChecked(selectedIDs);
|
|
8040
|
-
}
|
|
8041
|
-
}
|
|
8042
|
-
else {
|
|
8043
|
-
if (cloneElement) {
|
|
8044
|
-
setTimeout(() => {
|
|
8045
|
-
cloneElement.show();
|
|
8046
|
-
}, 100);
|
|
8047
|
-
}
|
|
8048
|
-
}
|
|
8049
|
-
}
|
|
8050
|
-
}
|
|
8051
|
-
}
|
|
8052
|
-
render() {
|
|
8053
|
-
const { label, fullWidth, required, selectText, selectData, placeholder, clearable, value, isOpen, noCaption, captionType, captionError, caption, size, disabled } = this;
|
|
8054
|
-
// const classes = cs(
|
|
8055
|
-
// 'card',
|
|
8056
|
-
// this.size
|
|
8057
|
-
// )
|
|
8058
|
-
const hostClasses = classnames(this.hidden ? 'hidden' : null, 'type-' + this.type, {
|
|
8059
|
-
'full-width': fullWidth
|
|
8060
|
-
});
|
|
8061
|
-
const captionClasses = classnames('size-1', 'input-caption', 'caption-' + captionType);
|
|
8062
|
-
const container = classnames('container', {
|
|
8063
|
-
'error': captionType == 'error' ? true : false,
|
|
8064
|
-
'full-width': fullWidth
|
|
8065
|
-
});
|
|
8066
|
-
const selectedText = classnames('selected-text');
|
|
8067
|
-
const selected = classnames('selected', 'selected-' + size, {
|
|
8068
|
-
'size-3': size === 'large',
|
|
8069
|
-
'size-2': size === 'small' || size === 'medium',
|
|
8070
|
-
'disabled': disabled
|
|
8071
|
-
});
|
|
8072
|
-
// const customStyleTag = {
|
|
8073
|
-
// 'cursor': 'pointer',
|
|
8074
|
-
// 'max-width': '164px',
|
|
8075
|
-
// 'text-overflow': 'ellipsis',
|
|
8076
|
-
// 'white-space': 'nowrap',
|
|
8077
|
-
// 'overflow': 'hidden',
|
|
8078
|
-
// 'display': 'block'
|
|
8079
|
-
// }
|
|
8080
|
-
const customStyleOtherTag = {
|
|
8081
|
-
'cursor': 'pointer',
|
|
8082
|
-
'white-space': 'nowrap'
|
|
8083
|
-
};
|
|
8084
|
-
return (
|
|
8085
|
-
// <Host class={hostClasses}>
|
|
8086
|
-
// <div class={classes}>
|
|
8087
|
-
// <slot />
|
|
8088
|
-
// </div>
|
|
8089
|
-
// </Host>
|
|
8090
|
-
h(Host, { class: hostClasses, onFocus: () => this.handleFocus(), onBlur: () => this.handleBlur() }, h("div", { class: container }, label && h("label", { class: "label size-1", onClick: () => this.handleOpen() }, " ", label, " ", required === true && ('*'), " "), h("div", { id: "selected-container", class: selected, onClick: () => this.handleOpen(), tabIndex: -1 }, h("span", { class: selectedText, title: selectText !== null && (selectText) }, h("div", { class: "spinner first-run" }), this.type === 'select' && (selectText !== null && (h("div", { class: "text-content" }, selectText))), (this.type === 'select' || this.type === 'autocomplete' && this.multiSelect === true) && (selectText === null && (h("span", { id: "tagcontainer", class: "tag-container" }, h("span", { id: "visible-tags" }), h("span", { id: "other-container" }, h("bcm-tag", { _internal_id: this._internal_id, customStyle: customStyleOtherTag, type: "dissmisable", id: "other-tag" }))))), this.type === 'select' && (selectText === null && selectData.length === 0 && placeholder !== null && (h("span", { class: "placeholder" }, " ", placeholder, " "))), 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 }))), this.type === 'select' && (h("div", { class: "buttons" }, clearable && value && (h("button", { class: "select-clear-button", onClick: (e) => this.clickClear(e) }, h("bcm-icon", { icon: "close-circle", type: "fill", size: 18, color: "grey-7" }))), h("span", { class: isOpen ? 'open' : 'close' }, h("bcm-icon", { icon: "caret-up", type: "outlined", size: 18, color: "grey-6" }))))), noCaption === false && (h("div", { class: "caption-area" }, captionType == "error"
|
|
8091
|
-
? h("span", { class: captionClasses }, " ", captionError, " ")
|
|
8092
|
-
: caption && h("span", { class: captionClasses }, " ", caption, " "))))));
|
|
8093
|
-
}
|
|
8094
|
-
get el() { return getElement(this); }
|
|
8095
|
-
};
|
|
8096
|
-
BcmListSelect.style = listSelectCss;
|
|
8097
|
-
|
|
8098
|
-
/**
|
|
8099
|
-
* 'status' prop predefined values
|
|
8100
|
-
*/
|
|
8101
|
-
var StatusProps;
|
|
8102
|
-
(function (StatusProps) {
|
|
8103
|
-
StatusProps["info"] = "info";
|
|
8104
|
-
StatusProps["error"] = "error";
|
|
8105
|
-
StatusProps["warning"] = "warning";
|
|
8106
|
-
StatusProps["success"] = "success";
|
|
8107
|
-
StatusProps["none"] = "none";
|
|
8108
|
-
})(StatusProps || (StatusProps = {}));
|
|
8109
|
-
/**
|
|
8110
|
-
* 'type' prop predefined values
|
|
8111
|
-
*/
|
|
8112
|
-
var TypeProps;
|
|
8113
|
-
(function (TypeProps) {
|
|
8114
|
-
TypeProps["modal"] = "modal";
|
|
8115
|
-
TypeProps["information"] = "information";
|
|
8116
|
-
TypeProps["confirmation"] = "confirmation";
|
|
8117
|
-
})(TypeProps || (TypeProps = {}));
|
|
8118
|
-
/**
|
|
8119
|
-
* 'type' prop predefined values
|
|
8120
|
-
*/
|
|
8121
|
-
var OrientationProps;
|
|
8122
|
-
(function (OrientationProps) {
|
|
8123
|
-
OrientationProps["portrait"] = "portrait";
|
|
8124
|
-
OrientationProps["landscape"] = "landscape";
|
|
8125
|
-
})(OrientationProps || (OrientationProps = {}));
|
|
8126
|
-
|
|
8127
|
-
const modalCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");.size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}:host{display:block}:host(.hidden){display:none}.modal{display:flex;position:fixed;justify-content:center;align-items:flex-start;top:0;left:0;opacity:0;margin:0;padding:80px 40px 40px;overflow:hidden;overflow-y:auto;background-color:rgba(0, 0, 0, 0.5);box-sizing:border-box;z-index:-1000;width:100vw;height:100vh;visibility:hidden}.modal.show{visibility:visible;top:0;opacity:1;z-index:10500}.overlay{position:fixed;width:100vw;height:100vh;z-index:1;top:0;left:0}.card{display:flex;flex-direction:column;width:100%;box-shadow:0px 4px 12px rgba(0, 0, 0, 0.15);border-radius:2px;background-color:#fff;z-index:2}.card.portrait{max-width:312px}.card.landscape{max-width:475px}.card.small{width:576px}.card.medium{width:768px}.card.large{width:992px}.card.x-large{width:1024px}.card.xx-large{width:1200px}.card.xxx-large{width:1700px}.card.full-width{width:100%}.text-content{font-size:14px;line-height:22px;color:var(--bcm-color-grey-8);padding:0}.title{position:relative;display:flex;align-items:center;justify-content:flex-start;padding-right:24px;font-size:16px;line-height:24px;font-weight:500;color:var(--bcm-color-grey-9)}.title bcm-icon{margin-right:8px}p:not(.with-status){margin:0}p.with-status{padding-left:32px}header{position:relative;display:flex;align-items:center;justify-content:space-between;padding:16px 24px;font-size:16px;line-height:24px;font-weight:500;color:var(--bcm-color-grey-9);background-color:var(--bcm-color-grey-2);border-bottom:1px solid var(--bcm-color-grey-5)}header bcm-icon{cursor:pointer}footer{position:relative;display:flex;align-items:flex-start;justify-content:flex-end;padding:10px 16px;border-top:1px solid var(--bcm-color-grey-5);background-color:var(--bcm-color-grey-2)}footer bcm-button+bcm-button{margin-left:8px}.footer{display:flex;align-items:flex-start;justify-content:flex-end}.footer bcm-button+bcm-button{margin-left:8px}";
|
|
8128
|
-
|
|
8129
|
-
/**
|
|
8130
|
-
* @desc
|
|
8131
|
-
* @param str
|
|
8132
|
-
*/
|
|
8133
|
-
const lowercase$3 = (str) => str.toLowerCase();
|
|
8134
|
-
const BcmModal = class {
|
|
8135
|
-
constructor(hostRef) {
|
|
8136
|
-
registerInstance(this, hostRef);
|
|
8137
|
-
this.ok = createEvent(this, "bcm-ok", 7);
|
|
8138
|
-
this.cancel = createEvent(this, "bcm-cancel", 7);
|
|
8139
|
-
this.slotHeader = false;
|
|
8140
|
-
this.slotContent = false;
|
|
8141
|
-
this.slotFooter = false;
|
|
8142
|
-
this.slotHeaderHtml = '';
|
|
8143
|
-
this.slotContentHtml = '';
|
|
8144
|
-
this.slotFooterHtml = '';
|
|
8145
|
-
this.bodyStyleOverflow = '';
|
|
8146
|
-
this.type = TypeProps.modal;
|
|
8147
|
-
this.status = StatusProps.none;
|
|
8148
|
-
this.okText = 'OK';
|
|
8149
|
-
this.cancelText = 'Cancel';
|
|
8150
|
-
this.isShow = false;
|
|
8151
|
-
this.hidden = false;
|
|
8152
|
-
this.size = 'medium';
|
|
8153
|
-
this.fullWidth = false;
|
|
8154
|
-
this.backdrop = true;
|
|
8155
|
-
}
|
|
8156
|
-
/**
|
|
8157
|
-
* @StencilMethod
|
|
8158
|
-
*/
|
|
8159
|
-
componentWillLoad() {
|
|
8160
|
-
if (this.type !== TypeProps.modal && this.status === StatusProps.none)
|
|
8161
|
-
this.status = StatusProps.info;
|
|
8162
|
-
// if ( this.el.querySelector('bcm-modal-header') ) {
|
|
8163
|
-
// this.slotHeaderHtml = this.el.querySelector('bcm-modal-header').innerHTML
|
|
8164
|
-
// this.slotHeader = true
|
|
8165
|
-
// }
|
|
8166
|
-
// if ( this.el.querySelector('bcm-modal-content') ) {
|
|
8167
|
-
// this.slotContentHtml = this.el.querySelector('bcm-modal-content').outerHTML
|
|
8168
|
-
// this.slotContent = true
|
|
8169
|
-
// }
|
|
8170
|
-
// if ( this.el.querySelector('bcm-modal-footer') ) {
|
|
8171
|
-
// this.slotFooter = true
|
|
8172
|
-
// }
|
|
8173
|
-
}
|
|
8174
|
-
componentDidRender() {
|
|
8175
|
-
const slot = this.el.shadowRoot.querySelector('slot').assignedElements();
|
|
8176
|
-
slot.map(el => {
|
|
8177
|
-
if (String(el.tagName).toLowerCase() === 'bcm-modal-header') {
|
|
8178
|
-
el.slot = 'header';
|
|
8179
|
-
this.headerArea = true;
|
|
8180
|
-
}
|
|
8181
|
-
if (String(el.tagName).toLowerCase() === 'bcm-modal-footer') {
|
|
8182
|
-
el.slot = 'footer';
|
|
8183
|
-
this.footerArea = true;
|
|
8184
|
-
}
|
|
8185
|
-
});
|
|
8186
|
-
}
|
|
8187
|
-
/**
|
|
8188
|
-
* @desc
|
|
8189
|
-
* @returns {BcmIcon}
|
|
8190
|
-
*/
|
|
8191
|
-
getIcon() {
|
|
8192
|
-
switch (this.status) {
|
|
8193
|
-
case StatusProps.info:
|
|
8194
|
-
return h("bcm-icon", { type: "outlined", icon: "info-circle", size: "medium", color: "prime-blue-6" });
|
|
8195
|
-
case StatusProps.error:
|
|
8196
|
-
return h("bcm-icon", { type: "outlined", icon: "close-circle", size: "medium", color: "red-6" });
|
|
8197
|
-
case StatusProps.warning:
|
|
8198
|
-
return h("bcm-icon", { type: "outlined", icon: "exclamation-circle", size: "medium", color: "warmyellow-6" });
|
|
8199
|
-
case StatusProps.success:
|
|
8200
|
-
return h("bcm-icon", { type: "outlined", icon: "check-circle", size: "medium", color: "green-6" });
|
|
8201
|
-
}
|
|
8202
|
-
}
|
|
8203
|
-
/**
|
|
8204
|
-
* @desc
|
|
8205
|
-
*/
|
|
8206
|
-
handleOk() {
|
|
8207
|
-
this.ok.emit();
|
|
8208
|
-
this.isShow = false;
|
|
8209
|
-
}
|
|
8210
|
-
/**
|
|
8211
|
-
* @desc
|
|
8212
|
-
*/
|
|
8213
|
-
handleCancel() {
|
|
8214
|
-
this.cancel.emit();
|
|
8215
|
-
this.isShow = false;
|
|
8216
|
-
}
|
|
8217
|
-
/**
|
|
8218
|
-
* @desc
|
|
8219
|
-
* @returns {BcmIcon}
|
|
8220
|
-
*/
|
|
8221
|
-
getFooterActions() {
|
|
8222
|
-
return ((this.footerArea && (h("footer", null, " ", h("slot", { name: "footer" }), " "))));
|
|
8223
|
-
}
|
|
8224
|
-
handleSubmit(e) {
|
|
8225
|
-
if (lowercase$3(e.target.nodeName) === 'bcm-button') {
|
|
8226
|
-
if (e.target.dataDismiss) {
|
|
8227
|
-
this.dismiss();
|
|
8228
|
-
}
|
|
8229
|
-
}
|
|
8230
|
-
}
|
|
8231
|
-
/**
|
|
8232
|
-
* @desc Removes component itself
|
|
8233
|
-
*/
|
|
8234
|
-
dismiss() {
|
|
8235
|
-
this.isShow = false;
|
|
8236
|
-
document.querySelector("body").style.overflow = this.bodyStyleOverflow;
|
|
8237
|
-
// this.el.remove()
|
|
8238
|
-
}
|
|
8239
|
-
handleBackdrop() {
|
|
8240
|
-
if (this.backdrop == true) {
|
|
8241
|
-
this.dismiss();
|
|
8242
|
-
}
|
|
8243
|
-
}
|
|
8244
|
-
/**
|
|
8245
|
-
* @desc
|
|
8246
|
-
*/
|
|
8247
|
-
async hide() {
|
|
8248
|
-
this.dismiss();
|
|
8249
|
-
}
|
|
8250
|
-
/**
|
|
8251
|
-
* @desc
|
|
8252
|
-
*/
|
|
8253
|
-
async show() {
|
|
8254
|
-
this.isShow = true;
|
|
8255
|
-
if (document.querySelector("body").style.overflow != "hidden") {
|
|
8256
|
-
this.bodyStyleOverflow = document.querySelector("body").style.overflow;
|
|
8257
|
-
}
|
|
8258
|
-
document.querySelector("body").style.overflow = "hidden";
|
|
8259
|
-
// const bcmTabs = this.el.querySelector('bcm-tabs')
|
|
8260
|
-
// if ( bcmTabs ) {
|
|
8261
|
-
// var getActiveTab = await bcmTabs.getActiveTab()
|
|
8262
|
-
// bcmTabs.active( getActiveTab )
|
|
8263
|
-
// }
|
|
8264
|
-
}
|
|
8265
|
-
keyboardNavigation(e) {
|
|
8266
|
-
if (this.backdrop == true) {
|
|
8267
|
-
const which = e.which || 0;
|
|
8268
|
-
if (which == 27) {
|
|
8269
|
-
e.preventDefault();
|
|
8270
|
-
this.dismiss();
|
|
8271
|
-
}
|
|
8272
|
-
}
|
|
7290
|
+
this.type = Bcm$1.Status.default;
|
|
8273
7291
|
}
|
|
8274
7292
|
render() {
|
|
8275
|
-
const {
|
|
8276
|
-
const
|
|
8277
|
-
const
|
|
8278
|
-
|
|
8279
|
-
});
|
|
8280
|
-
const hostClasses = classnames(this.hidden ? 'hidden' : null);
|
|
8281
|
-
return (h(Host, { class: hostClasses }, h("div", { class: modal }, h("div", { class: "overlay", onClick: () => this.handleBackdrop() }), h("div", { class: cardClasses }, type === TypeProps.modal && (headerArea && (h("header", null, h("slot", { name: "header" }), " ", h("bcm-icon", { icon: "close", color: "grey-10", onClick: () => this.dismiss() })))), h("div", { class: "text-content" }, type !== TypeProps.modal && (h("span", { class: "title" }, this.getIcon(), headerArea && (h("slot", { name: "header" })), !headerArea && (headerTitle))), h("p", { class: type !== TypeProps.modal ? 'with-status' : '' }, h("slot", null)), type !== TypeProps.modal && this.getFooterActions()), type === TypeProps.modal && (this.getFooterActions())))));
|
|
7293
|
+
const { required, value, size, form, htmlFor, hidden, type, tooltip } = this;
|
|
7294
|
+
const hostClasses = classnames('bcm-label', { hidden });
|
|
7295
|
+
const Label = (h(LabelTemplate, { form: form, htmlFor: htmlFor, value: value, size: size, type: type, required: required }));
|
|
7296
|
+
return (h(Host, null, h("div", { class: hostClasses }, Label, tooltip && (h("bcm-tooltip", { message: tooltip, placement: 'top', trigger: 'hover' }, h("bcm-icon", { color: "grey-8", icon: "question-circle", type: "fill" }))))));
|
|
8282
7297
|
}
|
|
8283
7298
|
get el() { return getElement(this); }
|
|
8284
7299
|
};
|
|
8285
|
-
|
|
8286
|
-
|
|
8287
|
-
/**
|
|
8288
|
-
* 'color' prop predefined values
|
|
8289
|
-
*/
|
|
8290
|
-
var ColorProps;
|
|
8291
|
-
(function (ColorProps) {
|
|
8292
|
-
ColorProps["black"] = "black";
|
|
8293
|
-
ColorProps["white"] = "white";
|
|
8294
|
-
ColorProps["prime-blue"] = "prime-blue";
|
|
8295
|
-
ColorProps["grey"] = "grey";
|
|
8296
|
-
ColorProps["blue"] = "blue";
|
|
8297
|
-
ColorProps["warmyellow"] = "warmyellow";
|
|
8298
|
-
ColorProps["yellow"] = "yellow";
|
|
8299
|
-
ColorProps["limegreen"] = "limegreen";
|
|
8300
|
-
ColorProps["red"] = "red";
|
|
8301
|
-
ColorProps["darkorange"] = "darkorange";
|
|
8302
|
-
ColorProps["orange"] = "orange";
|
|
8303
|
-
ColorProps["green"] = "green";
|
|
8304
|
-
ColorProps["turquosie"] = "turquosie";
|
|
8305
|
-
ColorProps["cobaltblue"] = "cobaltblue";
|
|
8306
|
-
ColorProps["magenta"] = "magenta";
|
|
8307
|
-
ColorProps["purple"] = "purple";
|
|
8308
|
-
ColorProps["bc-red"] = "bc-red";
|
|
8309
|
-
ColorProps["bc-blue"] = "bc-blue";
|
|
8310
|
-
ColorProps["bc-green"] = "bc-green";
|
|
8311
|
-
ColorProps["bc-orange"] = "bc-orange";
|
|
8312
|
-
})(ColorProps || (ColorProps = {}));
|
|
8313
|
-
|
|
8314
|
-
const radioCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");.size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}:host{display:inline-block}:host(.hidden){display:none}input[type=radio]{position:absolute;width:0;height:0;opacity:0}label{user-select:none;display:inline-flex;align-items:center;color:var(--bcm-color-grey-8);cursor:pointer}.radio-container .radio{width:16px;height:16px;min-width:16px;min-height:16px;border:1px solid var(--bcm-color-grey-5);border-radius:100%;background-color:var(--bcm-color-grey-1);box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;transition-duration:0.3s;margin-right:8px}.radio-container .radio .inner{width:8px;height:8px;border-radius:100%;background-color:var(--bcm-color-grey-1)}.radio-container:hover:not(.disabled) .radio{border-color:var(--bcm-color-prime-blue-6);filter:drop-shadow(0px 2px 4px rgba(54, 121, 171, 0.5))}.radio-container.disabled{color:var(--bcm-color-grey-6);cursor:not-allowed}.radio-container.disabled .radio{border-color:var(--bcm-color-grey-5)}.radio-container.checked .radio{border-color:var(--bcm-color-prime-blue-6)}.radio-container.checked .inner{background-color:var(--bcm-color-prime-blue-6)}.radio-container.checked.disabled .radio{background-color:var(--bcm-color-grey-3);border-color:var(--bcm-color-grey-5)}.radio-container.checked.disabled .inner{background-color:var(--bcm-color-grey-6)}.radio-button{background-color:var(--bcm-color-grey-1);color:var(--bcm-color-grey-8);border:1px solid var(--bcm-color-grey-5);padding:0 16px;box-sizing:border-box}.radio-button:hover:not(.disabled){color:var(--bcm-color-prime-blue-5)}.radio-button:active:not(.disabled){color:var(--bcm-color-prime-blue-7)}.radio-button.disabled{background-color:var(--bcm-color-grey-3);color:var(--bcm-color-grey-6);cursor:not-allowed}.radio-button.checked.disabled{background-color:var(--bcm-color-grey-4);color:var(--bcm-color-grey-1);border-color:var(--bcm-color-grey-5)}.radio-button.checked.solid{color:var(--bcm-color-grey-1);background-color:var(--bcm-color-prime-blue-6);border-color:var(--bcm-color-prime-blue-6)}.radio-button.checked.solid:hover{background-color:var(--bcm-color-prime-blue-5);border-color:var(--bcm-color-prime-blue-5)}.radio-button.checked.solid:active{background-color:var(--bcm-color-prime-blue-7);border-color:var(--bcm-color-prime-blue-7)}.radio-button.checked.outline{background-color:var(--bcm-color-grey-1);color:var(--bcm-color-prime-blue-6);border-color:var(--bcm-color-prime-blue-6)}.radio-button.checked.outline:hover{color:var(--bcm-color-prime-blue-5);border-color:var(--bcm-color-prime-blue-5)}.radio-button.checked.outline:active{color:var(--bcm-color-prime-blue-7);border-color:var(--bcm-color-prime-blue-7)}.radio-button.large{height:40px}.radio-button.medium{height:32px}.radio-button.small{height:24px}";
|
|
8315
|
-
|
|
8316
|
-
const BcmRadio = class {
|
|
8317
|
-
constructor(hostRef) {
|
|
8318
|
-
registerInstance(this, hostRef);
|
|
8319
|
-
this.change = createEvent(this, "bcm-change", 3);
|
|
8320
|
-
this.focus = createEvent(this, "bcm-focus", 3);
|
|
8321
|
-
this.blur = createEvent(this, "bcm-blur", 3);
|
|
8322
|
-
this.optionType = 'default';
|
|
8323
|
-
this.buttonStyle = 'solid';
|
|
8324
|
-
this.size = 'medium';
|
|
8325
|
-
this.hidden = false;
|
|
8326
|
-
this.required = false;
|
|
8327
|
-
}
|
|
8328
|
-
handleFocus() {
|
|
8329
|
-
this.focus.emit();
|
|
8330
|
-
}
|
|
8331
|
-
handleBlur() {
|
|
8332
|
-
this.blur.emit();
|
|
8333
|
-
}
|
|
8334
|
-
/**
|
|
8335
|
-
* @desc
|
|
8336
|
-
* @param name -
|
|
8337
|
-
* @returns {void}
|
|
8338
|
-
*/
|
|
8339
|
-
async check(uncheck) {
|
|
8340
|
-
this.radio.checked = uncheck;
|
|
8341
|
-
this.handleChange();
|
|
8342
|
-
}
|
|
8343
|
-
handleChange() {
|
|
8344
|
-
this.checked = this.radio.checked;
|
|
8345
|
-
this.change.emit({
|
|
8346
|
-
value: this.radio.value,
|
|
8347
|
-
checked: this.radio.checked
|
|
8348
|
-
});
|
|
8349
|
-
}
|
|
8350
|
-
connectedCallback() {
|
|
8351
|
-
this.handleChange = this.handleChange.bind(this);
|
|
8352
|
-
this.handleFocus = this.handleFocus.bind(this);
|
|
8353
|
-
this.handleBlur = this.handleBlur.bind(this);
|
|
8354
|
-
}
|
|
8355
|
-
getColor(color) {
|
|
8356
|
-
if (this.color !== 'default' && this.optionType == 'button' && this.checked)
|
|
8357
|
-
return {
|
|
8358
|
-
// color: extractColor(ColorPalette, ColorProps[color] + '-6'),
|
|
8359
|
-
borderColor: extractColor(ColorPalette, ColorProps[color] + '-5'),
|
|
8360
|
-
backgroundColor: extractColor(ColorPalette, ColorProps[color] + '-5')
|
|
8361
|
-
};
|
|
8362
|
-
}
|
|
8363
|
-
render() {
|
|
8364
|
-
const { checked, value, disabled, optionType, buttonStyle, size } = this;
|
|
8365
|
-
const defaultClasses = classnames('radio-container', 'size-2', {
|
|
8366
|
-
'checked': checked,
|
|
8367
|
-
'disabled': disabled
|
|
8368
|
-
});
|
|
8369
|
-
const buttonClasses = classnames('radio-button', buttonStyle, size, {
|
|
8370
|
-
'size-2': size === 'small' || size === 'medium',
|
|
8371
|
-
'size-3': size === 'large',
|
|
8372
|
-
'checked': checked,
|
|
8373
|
-
'disabled': disabled,
|
|
8374
|
-
});
|
|
8375
|
-
const hostClasses = classnames(this.hidden ? 'hidden' : null);
|
|
8376
|
-
return (h(Host, { class: hostClasses, onFocus: this.handleFocus, onBlur: this.handleBlur }, h("label", { class: optionType == 'default' ? defaultClasses : buttonClasses, style: this.getColor(this.color) }, h("input", { type: "radio", value: value, checked: checked, ref: el => (this.radio = el), onChange: this.handleChange, disabled: disabled }), optionType === 'default' && (h("span", { class: "radio" }, h("span", { class: "inner" }))), h("slot", null))));
|
|
8377
|
-
}
|
|
8378
|
-
};
|
|
8379
|
-
BcmRadio.style = radioCss;
|
|
7300
|
+
BcmLabel.style = labelCss;
|
|
8380
7301
|
|
|
8381
|
-
const
|
|
7302
|
+
const switchCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");.size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}:host{display:inline-block;margin:0 0 8px 0}:host(.hidden){display:none}*{box-sizing:border-box}.wrapper{display:inline-flex;padding-top:0px;padding-bottom:5px}.wrapper .active-text{color:var(--bcm-color-prime-blue-6);margin-left:4px}.wrapper .inactive-text{color:var(--bcm-color-grey-6);margin-right:4px}.container{display:flex;justify-content:space-between;align-items:center;border-radius:16px;background-color:var(--bcm-color-grey-6);position:relative}.container .handle{padding:1px;position:absolute;background-color:var(--bcm-color-grey-1);display:inline-flex;align-items:center;justify-content:center;border-radius:16px;transition:all 0.2s ease-in-out;box-shadow:0px 2px 2px rgba(0, 0, 0, 0.1), 0px 3px 1px rgba(0, 0, 0, 0.05), 0px 1px 5px rgba(0, 0, 0, 0.1)}.container .icon-active{opacity:0}.container .icon-inactive{opacity:1}.container.small{width:28px;min-width:28px;height:16px;padding:4px}.container.small .handle{width:12px;height:12px;left:4px}.container.small.switch-checked .handle{left:12px}.container.small:active:not(.disabled) .handle{width:16px}.container.small:active.switch-checked:not(.disabled) .handle{left:8px}.container.small .spinner{box-sizing:border-box;display:inline-flex;width:9px;height:9px;border-radius:50%;border:1px solid var(--bcm-color-grey-1);border-top-color:var(--bcm-color-grey-6);animation:spinner 1.5s linear infinite}.container.medium{width:44px;min-width:44px;height:22px;padding:4px}.container.medium .handle{width:16px;height:16px;left:4px}.container.medium.switch-checked .handle{left:24px}.container.medium:active:not(.disabled) .handle{width:22px}.container.medium:active.switch-checked:not(.disabled) .handle{left:18px}.container.medium .spinner{box-sizing:border-box;display:inline-flex;width:13px;height:13px;border-radius:50%;border:1px solid var(--bcm-color-grey-1);border-top-color:var(--bcm-color-grey-6);animation:spinner 1.5s linear infinite}.container.switch-checked{background-color:var(--bcm-color-prime-blue-6)}.container.switch-checked .icon-active{color:var(--bcm-color-grey-1);opacity:1}.container.switch-checked .icon-inactive{opacity:0}.container.switch-checked .spinner{border-top-color:var(--bcm-color-prime-blue-6)}.wrapper.disabled{opacity:40%;cursor:not-allowed}@keyframes spinner{to{transform:rotate(360deg)}}input[type=checkbox]{position:absolute;width:0;height:0;opacity:0}.label{display:flex;flex-direction:column;color:var(--bcm-color-grey-9);padding-right:4px;margin-right:8px;margin-bottom:8px}.caption-area{min-height:20px}.input-caption{display:block}:host(.error) .label{color:var(--bcm-color-red-6) !important}.caption-default{color:#8C8C8C}.caption-primary{color:#4293CF}.caption-success{color:#52C41A}.caption-warning{color:#FA8C16}.caption-error{color:#F5222D}";
|
|
8382
7303
|
|
|
8383
|
-
const
|
|
7304
|
+
const BcmSwitch = class {
|
|
8384
7305
|
constructor(hostRef) {
|
|
8385
7306
|
registerInstance(this, hostRef);
|
|
8386
7307
|
this.change = createEvent(this, "bcm-change", 7);
|
|
8387
|
-
this.
|
|
8388
|
-
this.
|
|
8389
|
-
this.
|
|
8390
|
-
this.buttonStyle = 'solid';
|
|
7308
|
+
this.focus = createEvent(this, "bcm-focus", 7);
|
|
7309
|
+
this.blur = createEvent(this, "bcm-blur", 7);
|
|
7310
|
+
this.checked = false;
|
|
8391
7311
|
this.size = 'medium';
|
|
7312
|
+
this.pending = false;
|
|
8392
7313
|
this.disabled = false;
|
|
8393
7314
|
this.hidden = false;
|
|
7315
|
+
this.value = '';
|
|
8394
7316
|
this.label = null;
|
|
8395
7317
|
this.required = false;
|
|
8396
7318
|
this.noCaption = false;
|
|
8397
7319
|
this.captionType = 'default';
|
|
8398
|
-
this.radioOptions = [];
|
|
8399
|
-
this.usingSlots = true;
|
|
8400
|
-
}
|
|
8401
|
-
async setData(_data) {
|
|
8402
|
-
setTimeout(() => {
|
|
8403
|
-
this.options = _data;
|
|
8404
|
-
}, 100);
|
|
8405
|
-
return Promise.resolve(true);
|
|
8406
|
-
}
|
|
8407
|
-
async getValue() {
|
|
8408
|
-
return this.value;
|
|
8409
|
-
}
|
|
8410
|
-
async check(value) {
|
|
8411
|
-
this.defaultValue = value;
|
|
8412
|
-
this.value = value;
|
|
8413
|
-
}
|
|
8414
|
-
async setClear() {
|
|
8415
|
-
this.value = '';
|
|
8416
|
-
}
|
|
8417
|
-
async resetCaption() {
|
|
8418
|
-
this.caption = this.captionCache;
|
|
8419
|
-
this.captionType = this.captionTypeCache;
|
|
8420
|
-
this.captionError = null;
|
|
8421
|
-
}
|
|
8422
|
-
parseOptions(newValue) {
|
|
8423
|
-
if (newValue) {
|
|
8424
|
-
typeof newValue === 'string'
|
|
8425
|
-
? this.radioOptions = JSON.parse(newValue)
|
|
8426
|
-
: this.radioOptions = newValue;
|
|
8427
|
-
if (this.radioOptions.length > 0)
|
|
8428
|
-
this.usingSlots = false;
|
|
8429
|
-
}
|
|
8430
|
-
}
|
|
8431
|
-
// If checked radio changes, emits change event
|
|
8432
|
-
handleChange(newValue) {
|
|
8433
|
-
this.change.emit(newValue);
|
|
8434
|
-
}
|
|
8435
|
-
// Controls radios styles and states
|
|
8436
|
-
controlRadio(elements) {
|
|
8437
|
-
elements.forEach((radio) => {
|
|
8438
|
-
radio.checked = this.value ? radio.value === this.value : this.defaultValue ? radio.value === this.defaultValue : null;
|
|
8439
|
-
radio.disabled = this.disabled;
|
|
8440
|
-
radio.optionType = this.optionType;
|
|
8441
|
-
radio.buttonStyle = this.buttonStyle;
|
|
8442
|
-
radio.size = this.size;
|
|
8443
|
-
radio.addEventListener('bcm-change', (e) => {
|
|
8444
|
-
e.stopPropagation();
|
|
8445
|
-
if (e.detail.checked) {
|
|
8446
|
-
this.value = radio.value;
|
|
8447
|
-
}
|
|
8448
|
-
}, { once: true });
|
|
8449
|
-
});
|
|
8450
7320
|
}
|
|
8451
7321
|
connectedCallback() {
|
|
8452
7322
|
this.captionCache = this.caption;
|
|
8453
7323
|
this.captionTypeCache = this.captionType;
|
|
8454
7324
|
}
|
|
8455
|
-
|
|
8456
|
-
this.
|
|
8457
|
-
|
|
8458
|
-
|
|
8459
|
-
let elements = [];
|
|
8460
|
-
if (this.usingSlots) {
|
|
8461
|
-
elements = this.host.shadowRoot.querySelector('slot').assignedElements();
|
|
8462
|
-
this.childRadios = [];
|
|
8463
|
-
elements.map(el => {
|
|
8464
|
-
String(el.tagName).toLowerCase() == 'bcm-radio' && this.childRadios.push(el);
|
|
8465
|
-
});
|
|
8466
|
-
this.controlRadio(this.childRadios);
|
|
8467
|
-
}
|
|
8468
|
-
else {
|
|
8469
|
-
elements = Array.from(this.host.shadowRoot.querySelectorAll('bcm-radio'));
|
|
8470
|
-
this.controlRadio(elements);
|
|
8471
|
-
}
|
|
8472
|
-
}
|
|
8473
|
-
render() {
|
|
8474
|
-
const { label, required, noCaption, caption, captionError, captionType } = this;
|
|
8475
|
-
const classes = classnames('radio-group', {
|
|
8476
|
-
[this.direction]: this.optionType === 'default'
|
|
8477
|
-
});
|
|
8478
|
-
const hostClasses = classnames(this.hidden ? 'hidden' : null, {
|
|
8479
|
-
'error': captionType == 'error' ? true : false
|
|
8480
|
-
});
|
|
8481
|
-
const captionClasses = classnames('size-1', 'input-caption', 'caption-' + captionType);
|
|
8482
|
-
if (this.radioOptions) {
|
|
8483
|
-
return (h(Host, { class: hostClasses }, label && h("label", { class: "label size-1" }, " ", label, " ", required && ('*'), " "), h("div", { class: classes }, this.radioOptions && this.radioOptions.map(radio => (h("bcm-radio", { value: radio.value, disabled: radio.disabled, checked: radio.checked }, " ", radio.label, " "))), h("slot", null)), !noCaption && (h("div", { class: "caption-area" }, captionType == "error"
|
|
8484
|
-
? h("span", { class: captionClasses }, " ", captionError, " ")
|
|
8485
|
-
: caption && h("span", { class: captionClasses }, " ", caption, " ")))));
|
|
8486
|
-
}
|
|
8487
|
-
return (h(Host, { class: hostClasses }, h("div", { class: classes }, h("slot", null))));
|
|
8488
|
-
}
|
|
8489
|
-
get host() { return getElement(this); }
|
|
8490
|
-
static get watchers() { return {
|
|
8491
|
-
"options": ["parseOptions"],
|
|
8492
|
-
"value": ["handleChange"]
|
|
8493
|
-
}; }
|
|
8494
|
-
};
|
|
8495
|
-
BcmRadioGroup.style = groupCss;
|
|
8496
|
-
|
|
8497
|
-
const searchCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");.size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}:host{display:block}:host(.hidden){display:none}";
|
|
8498
|
-
|
|
8499
|
-
const lowercase$4 = (str) => str.toLowerCase();
|
|
8500
|
-
const BcmSearch = class {
|
|
8501
|
-
constructor(hostRef) {
|
|
8502
|
-
registerInstance(this, hostRef);
|
|
8503
|
-
this.bcmOnSearch = createEvent(this, "bcm-on-search", 7);
|
|
8504
|
-
this.bcmOnSearchValue = createEvent(this, "bcm-on-search-value", 7);
|
|
8505
|
-
this.data = [];
|
|
8506
|
-
this.searchFields = ['text', 'value' /*, ...*/];
|
|
8507
|
-
this.returnField = 'idx';
|
|
8508
|
-
this.searchSub = null;
|
|
8509
|
-
this.hidden = false;
|
|
8510
|
-
this.onlyChild = false;
|
|
8511
|
-
this.clearable = false;
|
|
8512
|
-
this.searchValue = '';
|
|
8513
|
-
this.searchPlaceholder = 'Search';
|
|
8514
|
-
this.disabled = false;
|
|
8515
|
-
this._internal_id = (Math.random() * 4).toString(16).replace('.', '');
|
|
8516
|
-
this.results = [];
|
|
7325
|
+
handleClick() {
|
|
7326
|
+
this.checked = this.input.checked;
|
|
7327
|
+
this.value = this.checked;
|
|
7328
|
+
this.change.emit(this.checked);
|
|
8517
7329
|
}
|
|
8518
7330
|
componentDidLoad() {
|
|
8519
|
-
this.
|
|
7331
|
+
this.value = this.checked;
|
|
8520
7332
|
}
|
|
8521
|
-
|
|
8522
|
-
|
|
7333
|
+
handleFocus() {
|
|
7334
|
+
this.focus.emit();
|
|
8523
7335
|
}
|
|
8524
|
-
|
|
8525
|
-
|
|
8526
|
-
await input.setValue(value);
|
|
8527
|
-
return value;
|
|
7336
|
+
handleBlur() {
|
|
7337
|
+
this.blur.emit();
|
|
8528
7338
|
}
|
|
8529
|
-
|
|
8530
|
-
|
|
8531
|
-
|
|
8532
|
-
|
|
8533
|
-
return true;
|
|
7339
|
+
componentWillRender() {
|
|
7340
|
+
if (this.pending) {
|
|
7341
|
+
this.disabled = true;
|
|
7342
|
+
}
|
|
8534
7343
|
}
|
|
8535
7344
|
async setClear() {
|
|
8536
|
-
|
|
8537
|
-
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
async searchArray(value, idFields = null) {
|
|
8542
|
-
// console.log(this.data)
|
|
8543
|
-
let cacheSearchFields = this.searchFields;
|
|
8544
|
-
let arrayResult = [];
|
|
8545
|
-
if (idFields) {
|
|
8546
|
-
this.searchFields = [idFields];
|
|
8547
|
-
}
|
|
8548
|
-
value.forEach(item => {
|
|
8549
|
-
// item = {[idFields]:item}
|
|
8550
|
-
this.results = [];
|
|
8551
|
-
// console.log(this.data)
|
|
8552
|
-
this.nestedSearch(this.data, item, true);
|
|
8553
|
-
arrayResult.push(...this.results);
|
|
8554
|
-
});
|
|
8555
|
-
this.searchFields = cacheSearchFields;
|
|
8556
|
-
return arrayResult;
|
|
8557
|
-
// const input = this.el.shadowRoot.querySelector("bcm-input");
|
|
8558
|
-
// await input.setValue( value )
|
|
8559
|
-
// return value
|
|
8560
|
-
}
|
|
8561
|
-
nestedSearch(items, value, equal = false) {
|
|
8562
|
-
var result;
|
|
8563
|
-
items.map((item) => {
|
|
8564
|
-
this.searchFields.map(searchField => {
|
|
8565
|
-
if (searchField in item) {
|
|
8566
|
-
// debugger;
|
|
8567
|
-
item[searchField] = lowercase$4(String(item[searchField]));
|
|
8568
|
-
if (this.onlyChild) {
|
|
8569
|
-
if (item[this.searchSub]) {
|
|
8570
|
-
var temp = this.nestedSearch(item[this.searchSub], value, equal);
|
|
8571
|
-
if (temp) {
|
|
8572
|
-
this.results.push((result = String(item[this.returnField])));
|
|
8573
|
-
this.results.push(temp);
|
|
8574
|
-
}
|
|
8575
|
-
}
|
|
8576
|
-
else {
|
|
8577
|
-
if (equal) {
|
|
8578
|
-
// console.log(value)
|
|
8579
|
-
if (item[searchField] == lowercase$4(String(value))) {
|
|
8580
|
-
// if (item == lowercase(value)) {
|
|
8581
|
-
this.results.push((result = String(item[this.returnField])));
|
|
8582
|
-
// this.results.push (result = String(item))
|
|
8583
|
-
}
|
|
8584
|
-
}
|
|
8585
|
-
else {
|
|
8586
|
-
if (item[searchField].indexOf(lowercase$4(value)) !== -1) {
|
|
8587
|
-
this.results.push((result = String(item[this.returnField])));
|
|
8588
|
-
}
|
|
8589
|
-
}
|
|
8590
|
-
}
|
|
8591
|
-
}
|
|
8592
|
-
else {
|
|
8593
|
-
if (item[this.searchSub]) {
|
|
8594
|
-
var temp = this.nestedSearch(item[this.searchSub], value, equal);
|
|
8595
|
-
if (temp) {
|
|
8596
|
-
this.results.push((result = String(item[this.returnField])));
|
|
8597
|
-
this.results.push(temp);
|
|
8598
|
-
}
|
|
8599
|
-
}
|
|
8600
|
-
if (equal) {
|
|
8601
|
-
// console.log(value)
|
|
8602
|
-
if (item[searchField] == lowercase$4(String(value))) {
|
|
8603
|
-
// if (item == lowercase(value)) {
|
|
8604
|
-
this.results.push((result = String(item[this.returnField])));
|
|
8605
|
-
// this.results.push (result = String(item))
|
|
8606
|
-
}
|
|
8607
|
-
}
|
|
8608
|
-
else {
|
|
8609
|
-
if (item[searchField].indexOf(lowercase$4(value)) !== -1) {
|
|
8610
|
-
this.results.push((result = String(item[this.returnField])));
|
|
8611
|
-
}
|
|
8612
|
-
}
|
|
8613
|
-
}
|
|
8614
|
-
}
|
|
8615
|
-
});
|
|
8616
|
-
});
|
|
8617
|
-
return result;
|
|
8618
|
-
}
|
|
8619
|
-
/**
|
|
8620
|
-
* @desc
|
|
8621
|
-
* @param value
|
|
8622
|
-
*/
|
|
8623
|
-
inputChange(value) {
|
|
8624
|
-
this.results = [];
|
|
8625
|
-
// data prop'unda arama yapılacak (searchFields prop'u içerisindeki alanlar ile)
|
|
8626
|
-
// arama sonucunda eşleyen itemların 'idx', index
|
|
8627
|
-
// değerleri, array şeklinde root component'e
|
|
8628
|
-
// event ile gönderilecek
|
|
8629
|
-
// Örneğin value == 'to' olduğunda aşağıdaki
|
|
8630
|
-
// sonuçlar filtrelenmeli
|
|
8631
|
-
// -->
|
|
8632
|
-
//{ text: 'Mateusz Eaton', idx: 2 },
|
|
8633
|
-
//{ text: 'Tony Vickers', idx: 3 },
|
|
8634
|
-
// result array'i eşleşen itemların
|
|
8635
|
-
// index numaralarını tutacak
|
|
8636
|
-
// results = [2, 3]
|
|
8637
|
-
// Örnek arama
|
|
8638
|
-
// #
|
|
8639
|
-
this.nestedSearch(this.data, value);
|
|
8640
|
-
this.results = Array.from(new Set(this.results));
|
|
8641
|
-
(value && ((this.results.length > 0 && this.bcmOnSearch.emit(this.results)) || this.bcmOnSearch.emit([-1]))) || this.bcmOnSearch.emit(true);
|
|
8642
|
-
this.bcmOnSearchValue.emit(value);
|
|
8643
|
-
}
|
|
8644
|
-
render() {
|
|
8645
|
-
const hostClasses = classnames(this.hidden ? 'hidden' : null);
|
|
8646
|
-
return (h(Host, { class: hostClasses }, h("bcm-input", { placeholder: this.searchPlaceholder, "no-caption": true, "no-margin": true, "full-width": true, disabled: this.disabled, type: "search", "on-bcm-change": e => this.inputChange(e.detail), value: this.searchValue })));
|
|
8647
|
-
}
|
|
8648
|
-
get el() { return getElement(this); }
|
|
8649
|
-
static get watchers() { return {
|
|
8650
|
-
"searchValue": ["inputChange"]
|
|
8651
|
-
}; }
|
|
8652
|
-
};
|
|
8653
|
-
BcmSearch.style = searchCss;
|
|
8654
|
-
|
|
8655
|
-
/**
|
|
8656
|
-
* 'size' prop predefined values
|
|
8657
|
-
*/
|
|
8658
|
-
var SizeProps;
|
|
8659
|
-
(function (SizeProps) {
|
|
8660
|
-
SizeProps["large"] = "large";
|
|
8661
|
-
SizeProps["medium"] = "medium";
|
|
8662
|
-
SizeProps["small"] = "small";
|
|
8663
|
-
})(SizeProps || (SizeProps = {}));
|
|
8664
|
-
/**
|
|
8665
|
-
* 'type' prop predefined values
|
|
8666
|
-
*/
|
|
8667
|
-
var TypeProps$1;
|
|
8668
|
-
(function (TypeProps) {
|
|
8669
|
-
TypeProps["normal"] = "normal";
|
|
8670
|
-
TypeProps["pane"] = "pane";
|
|
8671
|
-
TypeProps["stepper"] = "stepper";
|
|
8672
|
-
})(TypeProps$1 || (TypeProps$1 = {}));
|
|
8673
|
-
/**
|
|
8674
|
-
* 'direction' prop predefined values
|
|
8675
|
-
*/
|
|
8676
|
-
var DirectionProps;
|
|
8677
|
-
(function (DirectionProps) {
|
|
8678
|
-
DirectionProps["horizontal"] = "horizontal";
|
|
8679
|
-
DirectionProps["vertical"] = "vertical";
|
|
8680
|
-
})(DirectionProps || (DirectionProps = {}));
|
|
8681
|
-
|
|
8682
|
-
const tabCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");.size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}:host{display:block}:host(.hidden){display:none}slot[name=icon-suffix]::slotted(bcm-icon){margin-left:10px}slot[name=icon-prefix]::slotted(bcm-icon){margin-right:10px}.tab{position:relative;display:flex;justify-content:center;align-items:center;padding:var(--bcm-tab-vertical-space) 14px var(--bcm-tab-vertical-space) 14px;color:var(--bcm-color-grey-8);font-size:var(--bcm-tab-font-size);line-height:var(--bcm-tab-line-height);cursor:pointer;user-select:none}.tab.active{color:var(--bcm-color-prime-blue-6)}.tab.active::before{content:\"\";bottom:-2px;left:0;width:100%;height:2px;background-color:var(--bcm-color-prime-blue-6);position:absolute;z-index:1}.tab:hover{color:var(--bcm-color-prime-blue-5)}.tab:active,.tab:focus{color:var(--bcm-color-prime-blue-7)}.tab[disabled],.tab.disabled{color:var(--bcm-color-grey-6);cursor:not-allowed}.tab.closable:not(.pane){padding-left:0;padding-right:0}.tab.closable .close{margin-left:34px}.tab.pane{border:1px solid transparent;border-bottom:none;border-color:var(--bcm-color-grey-5);background-color:var(--bcm-color-grey-3);border-radius:2px 2px 0 0}.tab.pane.active{background-color:#ffffff}.badge{padding-left:8px;position:relative}.badge.blink:after{content:\"\";position:absolute;top:8px;left:9px;background:black;border-radius:50%;height:7px;width:7px;box-shadow:0 0 0 0 rgba(0, 0, 0, 0);transform:scale(1)}.badge.success:after{animation:pulsesuccess 2s infinite;background-color:#52C41A}.badge.error:after{animation:pulseerror 2s infinite;background-color:#F5222D}.badge.default:after{animation:pulsedefault 2s infinite;background-color:#D9D9D9}.badge.processing:after{animation:pulseprocessing 2s infinite;background-color:#4293CF}.badge.warning:after{animation:pulsewarning 2s infinite;background-color:#FA8C16}@keyframes pulsesuccess{0%{transform:scale(0.95);box-shadow:0 0 0 0 rgba(82, 196, 26, 0.7)}70%{transform:scale(1);box-shadow:0 0 0 10px rgba(0, 0, 0, 0)}100%{transform:scale(0.95);box-shadow:0 0 0 0 rgba(0, 0, 0, 0)}}@keyframes pulseerror{0%{transform:scale(0.95);box-shadow:0 0 0 0 rgba(245, 34, 45, 0.7)}70%{transform:scale(1);box-shadow:0 0 0 10px rgba(0, 0, 0, 0)}100%{transform:scale(0.95);box-shadow:0 0 0 0 rgba(0, 0, 0, 0)}}@keyframes pulsedefault{0%{transform:scale(0.95);box-shadow:0 0 0 0 rgba(217, 217, 217, 0.7)}70%{transform:scale(1);box-shadow:0 0 0 10px rgba(0, 0, 0, 0)}100%{transform:scale(0.95);box-shadow:0 0 0 0 rgba(0, 0, 0, 0)}}@keyframes pulseprocessing{0%{transform:scale(0.95);box-shadow:0 0 0 0 rgba(66, 147, 207, 0.7)}70%{transform:scale(1);box-shadow:0 0 0 10px rgba(0, 0, 0, 0)}100%{transform:scale(0.95);box-shadow:0 0 0 0 rgba(0, 0, 0, 0)}}@keyframes pulsewarning{0%{transform:scale(0.95);box-shadow:0 0 0 0 rgba(250, 140, 22, 0.7)}70%{transform:scale(1);box-shadow:0 0 0 10px rgba(0, 0, 0, 0)}100%{transform:scale(0.95);box-shadow:0 0 0 0 rgba(0, 0, 0, 0)}}";
|
|
8683
|
-
|
|
8684
|
-
const BcmTab = class {
|
|
8685
|
-
constructor(hostRef) {
|
|
8686
|
-
registerInstance(this, hostRef);
|
|
8687
|
-
this.click = createEvent(this, "bcm-click", 7);
|
|
8688
|
-
this.close = createEvent(this, "bcm-close", 7);
|
|
8689
|
-
/**
|
|
8690
|
-
* Component Properties
|
|
8691
|
-
*/
|
|
8692
|
-
this.type = TypeProps$1.normal;
|
|
8693
|
-
this.active = false;
|
|
8694
|
-
this.disabled = false;
|
|
8695
|
-
this.closable = false;
|
|
8696
|
-
this.tabId = (Math.random() * 4).toString(16).replace('.', '');
|
|
8697
|
-
this.formControl = null;
|
|
8698
|
-
this.hidden = false;
|
|
8699
|
-
this.status = 'default';
|
|
8700
|
-
this.badge = false;
|
|
8701
|
-
this.blink = false;
|
|
8702
|
-
}
|
|
8703
|
-
/**
|
|
8704
|
-
* @desc
|
|
8705
|
-
*/
|
|
8706
|
-
handleClose() {
|
|
8707
|
-
if (this.disabled)
|
|
8708
|
-
return;
|
|
8709
|
-
this.close.emit();
|
|
8710
|
-
}
|
|
8711
|
-
/**
|
|
8712
|
-
* @desc
|
|
8713
|
-
* @param event
|
|
8714
|
-
*/
|
|
8715
|
-
handleClick(event) {
|
|
8716
|
-
if (this.disabled)
|
|
8717
|
-
return;
|
|
8718
|
-
const targetElement = event.target;
|
|
8719
|
-
// Detect close icon clicked
|
|
8720
|
-
// #
|
|
8721
|
-
if (String(targetElement.tagName).toLowerCase() == 'bcm-icon' && targetElement.classList.contains('close')) {
|
|
8722
|
-
this.close.emit(event);
|
|
7345
|
+
if (this.input.checked == true) {
|
|
7346
|
+
this.input.checked = false;
|
|
7347
|
+
this.checked = this.input.checked;
|
|
7348
|
+
this.value = this.checked;
|
|
7349
|
+
this.change.emit(this.checked);
|
|
8723
7350
|
}
|
|
8724
|
-
else {
|
|
8725
|
-
this.click.emit(event);
|
|
8726
|
-
}
|
|
8727
|
-
}
|
|
8728
|
-
render() {
|
|
8729
|
-
const { active, disabled, closable } = this;
|
|
8730
|
-
const classes = classnames('tab', [this.type], {
|
|
8731
|
-
'active': active,
|
|
8732
|
-
'disabled': disabled,
|
|
8733
|
-
'closable': closable
|
|
8734
|
-
});
|
|
8735
|
-
const hostClasses = classnames(this.hidden ? 'hidden' : null);
|
|
8736
|
-
const badgeClasses = classnames('badge', this.status, {
|
|
8737
|
-
'blink': this.blink
|
|
8738
|
-
});
|
|
8739
|
-
return (h(Host, { class: hostClasses }, h("div", { class: classes, onClick: (event) => this.handleClick(event) }, h("slot", { name: "icon-prefix" }), h("slot", null), h("slot", { name: "icon-suffix" }), this.closable && (h("bcm-icon", { class: "close", icon: "close", color: "grey-10" })), this.badge && (h("bcm-badge", { class: badgeClasses, size: "small", status: this.status })))));
|
|
8740
7351
|
}
|
|
8741
|
-
|
|
8742
|
-
|
|
8743
|
-
|
|
8744
|
-
|
|
8745
|
-
const tabPaneCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");.size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}:host{width:100%;display:block}:host(.hidden){display:none}:host(:not(.active)){height:0 !important;overflow:hidden;padding:0 !important}:host(.active){display:block}";
|
|
8746
|
-
|
|
8747
|
-
/**
|
|
8748
|
-
* @desc
|
|
8749
|
-
* @param str
|
|
8750
|
-
*/
|
|
8751
|
-
const lowercase$5 = (str) => str.toLowerCase();
|
|
8752
|
-
const BcmTabPane = class {
|
|
8753
|
-
constructor(hostRef) {
|
|
8754
|
-
registerInstance(this, hostRef);
|
|
8755
|
-
this.size = 'medium';
|
|
8756
|
-
this.hidden = false;
|
|
8757
|
-
this.fullWidth = false;
|
|
8758
|
-
this.tab = (Math.random() * 4).toString(16).replace('.', '');
|
|
8759
|
-
this.active = false;
|
|
8760
|
-
}
|
|
8761
|
-
connectedCallback() { }
|
|
8762
|
-
disconnectedCallback() { }
|
|
8763
|
-
componentWillLoad() { }
|
|
8764
|
-
componentDidLoad() { }
|
|
8765
|
-
componentWillRender() { }
|
|
8766
|
-
componentDidRender() { }
|
|
8767
|
-
componentWillUpdate() { }
|
|
8768
|
-
componentDidUpdate() { }
|
|
8769
|
-
handleActiveTabPane(e) {
|
|
8770
|
-
if (lowercase$5(e.target.nodeName) === 'bcm-tab') {
|
|
8771
|
-
if (e.target.tabId === this.tab) {
|
|
8772
|
-
this.active = true;
|
|
8773
|
-
}
|
|
8774
|
-
else {
|
|
8775
|
-
this.active = false;
|
|
8776
|
-
}
|
|
8777
|
-
}
|
|
7352
|
+
async resetCaption() {
|
|
7353
|
+
this.caption = this.captionCache;
|
|
7354
|
+
this.captionType = this.captionTypeCache;
|
|
7355
|
+
this.captionError = null;
|
|
8778
7356
|
}
|
|
8779
7357
|
render() {
|
|
8780
|
-
const
|
|
8781
|
-
const
|
|
8782
|
-
|
|
7358
|
+
const { checked, size, activeIcon, inactiveIcon, activeText, inactiveText, pending, disabled, label, required, noCaption, captionType, captionError, caption } = this;
|
|
7359
|
+
const classes = classnames('container', size, {
|
|
7360
|
+
'switch-checked': checked,
|
|
7361
|
+
'disabled': disabled
|
|
7362
|
+
});
|
|
7363
|
+
const wrapperClass = classnames('wrapper', {
|
|
7364
|
+
'checked': checked,
|
|
7365
|
+
'disabled': disabled
|
|
7366
|
+
});
|
|
7367
|
+
const captionClasses = classnames('size-1', 'input-caption', 'caption-' + captionType);
|
|
7368
|
+
const isPermitted = (condition) => {
|
|
7369
|
+
return (condition && size === 'medium');
|
|
7370
|
+
};
|
|
7371
|
+
const isMedium = size === 'medium';
|
|
7372
|
+
const hostClasses = classnames('bcm-switch', this.hidden ? 'hidden' : null);
|
|
7373
|
+
return (h(Host, { class: hostClasses }, label && h("div", null, h("bcm-label", { tooltip: this.tooltip, type: captionType, value: label, required: required })), h("label", { class: wrapperClass }, isPermitted(inactiveText) && h("span", { class: "inactive-text size-1" }, inactiveText), h("div", { class: classes }, isMedium && h("bcm-icon", { icon: activeIcon, size: 14, class: "icon-active" }), h("span", { class: "handle" }, pending && h("span", { class: "spinner" })), isMedium && h("bcm-icon", { icon: inactiveIcon, size: 14, class: "icon-inactive" })), h("input", { onClick: () => this.handleClick(), onFocus: () => this.handleFocus(), onBlur: () => this.handleBlur(), ref: el => (this.input = el), checked: checked, type: "checkbox", class: "switch", disabled: disabled }), isPermitted(activeText) && h("span", { class: "active-text size-1" }, activeText)), !noCaption && (h("div", { class: "caption-area" }, captionType == "error"
|
|
7374
|
+
? h("span", { class: captionClasses }, " ", captionError, " ")
|
|
7375
|
+
: caption && h("span", { class: captionClasses }, " ", caption, " ")))));
|
|
8783
7376
|
}
|
|
8784
|
-
get el() { return getElement(this); }
|
|
8785
7377
|
};
|
|
8786
|
-
|
|
7378
|
+
BcmSwitch.style = switchCss;
|
|
8787
7379
|
|
|
8788
|
-
const
|
|
7380
|
+
const textareaCss = "@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}.size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}:host{display:inline-block;width:100%;margin:0 0 8px 0}:host(.hidden){display:none}.textarea-wrapper{width:256px}.textarea-wrapper.full-width{width:100%}.textarea-wrapper:hover .clear-button{opacity:1}.textarea-container{position:relative;width:100%;border:1px solid var(--bcm-color-grey-5);border-radius:2px}.textarea-container.empty .clear-button{display:none}.textarea-container.focused:not(.disabled){outline:none;border-color:var(--bcm-color-prime-blue-5);box-shadow:0px 0px 4px var(--bcm-color-prime-blue-6)}.textarea-container:hover:not(:disabled){border-color:var(--bcm-color-prime-blue-6)}.textarea-container textarea{resize:vertical;display:flex;flex:1 1 auto;align-items:center;color:var(--bcm-color-grey-8);width:100%;background-color:var(--bcm-color-grey-1);border:none;border-radius:2px;box-shadow:none;font-family:\"Roboto\", sans-serif;-webkit-appearance:none;box-sizing:border-box}.textarea-container textarea::-webkit-search-decoration,.textarea-container textarea::-webkit-search-cancel-button,.textarea-container textarea::-webkit-search-results-button,.textarea-container textarea::-webkit-search-results-decoration{-webkit-appearance:none}.textarea-container textarea::placeholder{color:var(--bcm-color-grey-6);user-select:none}.textarea-container textarea:focus:not(:disabled){outline:none;border-color:none;box-shadow:none}.textarea-container textarea:hover:not(:disabled){border-color:none}.textarea-container textarea:disabled{background-color:var(--bcm-color-grey-3);cursor:not-allowed}.textarea-container textarea.clearable{padding-right:32px}.resize-none textarea{resize:none}.resize-vertical textarea{resize:vertical}.resize-auto textarea{height:auto;resize:none}.label{display:flex;flex-direction:column;color:var(--bcm-color-grey-9);margin-bottom:4px}.caption-area{min-height:20px;display:flex;flex-direction:row;justify-content:space-between}.input-caption{display:block}.clear-button{position:absolute;opacity:0;right:10px;top:7px;display:inline-flex;align-items:center;border:none;background:none;padding:0;cursor:pointer}.clear-button:focus{outline:none}.textarea-footer{display:flex;justify-content:space-between;margin-bottom:8px;min-height:20px}.textarea-footer .count{color:var(--bcm-color-grey-7);margin-left:4px}.textarea-footer .count:only-child{margin-left:auto}.size-large{padding:7px 12px;min-height:38px}.size-large~.clear-button{top:12px}.size-medium{padding:4px 12px;min-height:30px}.size-medium~.clear-button{top:7px}.size-small{padding:0px 12px;min-height:20px}.size-small~.clear-button{top:2px}.caption-default{color:#8C8C8C}.caption-primary{color:#4293CF}.caption-success{color:#52C41A}.caption-warning{color:#FA8C16}.caption-error{color:#F5222D}.error .label{color:var(--bcm-color-red-6) !important}.error .textarea-container{border:1px solid var(--bcm-color-red-6) !important}";
|
|
8789
7381
|
|
|
8790
|
-
|
|
7382
|
+
let id$1 = 0;
|
|
7383
|
+
const BcmTextarea = class {
|
|
8791
7384
|
constructor(hostRef) {
|
|
8792
7385
|
registerInstance(this, hostRef);
|
|
8793
|
-
this.
|
|
7386
|
+
this.focus = createEvent(this, "bcm-focus", 7);
|
|
7387
|
+
this.blur = createEvent(this, "bcm-blur", 7);
|
|
7388
|
+
this.clear = createEvent(this, "bcm-clear", 7);
|
|
8794
7389
|
this.change = createEvent(this, "bcm-change", 7);
|
|
8795
|
-
this.
|
|
8796
|
-
|
|
8797
|
-
|
|
8798
|
-
|
|
8799
|
-
this.
|
|
8800
|
-
this.
|
|
8801
|
-
this.
|
|
8802
|
-
|
|
8803
|
-
* Component Properties
|
|
8804
|
-
*/
|
|
8805
|
-
this.size = SizeProps.large;
|
|
8806
|
-
this.type = TypeProps$1.normal;
|
|
8807
|
-
this.direction = DirectionProps.horizontal;
|
|
7390
|
+
this.input = createEvent(this, "bcm-input", 7);
|
|
7391
|
+
this.textareaId = `textarea-${++id$1}`;
|
|
7392
|
+
this.valueLength = 0;
|
|
7393
|
+
this.noCaption = false;
|
|
7394
|
+
this.captionType = 'default';
|
|
7395
|
+
this.rows = 1;
|
|
7396
|
+
this.size = 'medium';
|
|
7397
|
+
this.resize = 'vertical';
|
|
8808
7398
|
this.hidden = false;
|
|
8809
|
-
this.
|
|
8810
|
-
this.
|
|
8811
|
-
/**
|
|
8812
|
-
* Component States
|
|
8813
|
-
*/
|
|
8814
|
-
this.activeChild = 1;
|
|
8815
|
-
this.lineOpts = { top: '0px', left: '0px', right: '0px', width: '0px', height: '0px' };
|
|
8816
|
-
this.prevButton = null;
|
|
8817
|
-
this.nextButton = null;
|
|
8818
|
-
this.completeButton = null;
|
|
8819
|
-
this.prevButtonState = 'disabled';
|
|
8820
|
-
this.nextButtonState = 'disabled';
|
|
8821
|
-
this.completeButtonState = 'disabled';
|
|
8822
|
-
}
|
|
8823
|
-
async config(_config) {
|
|
8824
|
-
if (_config['prevButton']) {
|
|
8825
|
-
if (_config['prevButton']['id']) {
|
|
8826
|
-
var prevButtonId = "#" + _config['prevButton']['id'];
|
|
8827
|
-
this.prevButton = document.querySelector(prevButtonId);
|
|
8828
|
-
}
|
|
8829
|
-
if (_config['prevButton']['state']) {
|
|
8830
|
-
this.prevButtonState = _config['prevButton']['state'];
|
|
8831
|
-
}
|
|
8832
|
-
}
|
|
8833
|
-
if (_config['nextButton']) {
|
|
8834
|
-
if (_config['nextButton']['id']) {
|
|
8835
|
-
var nextButtonId = "#" + _config['nextButton']['id'];
|
|
8836
|
-
this.nextButton = document.querySelector(nextButtonId);
|
|
8837
|
-
}
|
|
8838
|
-
if (_config['nextButton']['state']) {
|
|
8839
|
-
this.nextButtonState = _config['nextButton']['state'];
|
|
8840
|
-
}
|
|
8841
|
-
}
|
|
8842
|
-
if (_config['completeButton']) {
|
|
8843
|
-
if (_config['completeButton']['id']) {
|
|
8844
|
-
var completeButtonId = "#" + _config['completeButton']['id'];
|
|
8845
|
-
this.completeButton = document.querySelector(completeButtonId);
|
|
8846
|
-
}
|
|
8847
|
-
if (_config['completeButton']['state']) {
|
|
8848
|
-
this.completeButtonState = _config['completeButton']['state'];
|
|
8849
|
-
}
|
|
8850
|
-
}
|
|
8851
|
-
this.buttonControl();
|
|
8852
|
-
return true;
|
|
8853
|
-
}
|
|
8854
|
-
async next() {
|
|
8855
|
-
var getFormId = "#" + this.tabs[this.getActive() - 1]["formControl"];
|
|
8856
|
-
var getForm = document.querySelector(getFormId);
|
|
8857
|
-
var formData = null;
|
|
8858
|
-
if (getForm) {
|
|
8859
|
-
formData = await getForm.submit();
|
|
8860
|
-
}
|
|
8861
|
-
if ((getForm && formData.isValid) || !getForm) {
|
|
8862
|
-
this.activeChild = this.getActive() + 1;
|
|
8863
|
-
this.active(this.tabs[this.getActive() - 1]["tabId"]);
|
|
8864
|
-
}
|
|
8865
|
-
return formData;
|
|
8866
|
-
}
|
|
8867
|
-
async prev() {
|
|
8868
|
-
this.activeChild = this.getActive() - 1;
|
|
8869
|
-
this.active(this.tabs[this.getActive() - 1]["tabId"]);
|
|
8870
|
-
return this.activeChild;
|
|
8871
|
-
}
|
|
8872
|
-
async complete() {
|
|
8873
|
-
const tabStatuses = [];
|
|
8874
|
-
var isValid = true;
|
|
8875
|
-
this.tabs.forEach(element => {
|
|
8876
|
-
if (element['formControl']) {
|
|
8877
|
-
const getFormId = "#" + element["formControl"];
|
|
8878
|
-
const getForm = document.querySelector(getFormId);
|
|
8879
|
-
if (getForm) {
|
|
8880
|
-
tabStatuses.push(getForm.submit());
|
|
8881
|
-
}
|
|
8882
|
-
}
|
|
8883
|
-
});
|
|
8884
|
-
const allStatuses = await Promise.all(tabStatuses);
|
|
8885
|
-
allStatuses.forEach(item => {
|
|
8886
|
-
if (item.isValid === false) {
|
|
8887
|
-
isValid = false;
|
|
8888
|
-
if (item.formName) {
|
|
8889
|
-
const formId = this.tabs.filter((input) => input['formControl'] == item.formName)[0]['tabId'];
|
|
8890
|
-
this.active(formId);
|
|
8891
|
-
}
|
|
8892
|
-
}
|
|
8893
|
-
});
|
|
8894
|
-
return { isValid: isValid, Forms: allStatuses };
|
|
8895
|
-
}
|
|
8896
|
-
async active(id) {
|
|
8897
|
-
var i = 0;
|
|
8898
|
-
this.activeChild = -1,
|
|
8899
|
-
await delay(100);
|
|
8900
|
-
getChilds(this.el, 'bcm-tab').forEach(items => {
|
|
8901
|
-
i++,
|
|
8902
|
-
items.tabId == id && (items.disabled = false,
|
|
8903
|
-
items.active = true,
|
|
8904
|
-
this.bcmTabsActiveItem.emit(items.tabId),
|
|
8905
|
-
this.activeChild = i);
|
|
8906
|
-
items.tabId != id && (items.active = false);
|
|
8907
|
-
});
|
|
7399
|
+
this.required = false;
|
|
7400
|
+
this.hasFocus = false;
|
|
8908
7401
|
}
|
|
8909
|
-
async
|
|
8910
|
-
|
|
7402
|
+
async setFocus() {
|
|
7403
|
+
this.textarea.focus();
|
|
8911
7404
|
}
|
|
8912
|
-
async
|
|
8913
|
-
|
|
7405
|
+
async removeFocus() {
|
|
7406
|
+
this.textarea.blur();
|
|
8914
7407
|
}
|
|
8915
|
-
async
|
|
8916
|
-
|
|
8917
|
-
items.tabId == id && (items.badge = true,
|
|
8918
|
-
items.blink = blink,
|
|
8919
|
-
items.status = "error");
|
|
8920
|
-
});
|
|
7408
|
+
async select() {
|
|
7409
|
+
return this.textarea.select();
|
|
8921
7410
|
}
|
|
8922
|
-
async
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
8927
|
-
});
|
|
7411
|
+
async setValue(value) {
|
|
7412
|
+
this.textarea.value = value;
|
|
7413
|
+
this.value = value;
|
|
7414
|
+
this.handleChange();
|
|
7415
|
+
return value;
|
|
8928
7416
|
}
|
|
8929
|
-
async
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
items.blink = blink,
|
|
8933
|
-
items.status = "warning");
|
|
8934
|
-
});
|
|
7417
|
+
async setClear() {
|
|
7418
|
+
this.textarea.value = '';
|
|
7419
|
+
this.value = '';
|
|
8935
7420
|
}
|
|
8936
|
-
async
|
|
8937
|
-
|
|
8938
|
-
|
|
8939
|
-
|
|
8940
|
-
items.status = "success");
|
|
8941
|
-
});
|
|
7421
|
+
async resetCaption() {
|
|
7422
|
+
this.caption = this.captionCache;
|
|
7423
|
+
this.captionType = this.captionTypeCache;
|
|
7424
|
+
this.captionError = null;
|
|
8942
7425
|
}
|
|
8943
|
-
async
|
|
8944
|
-
|
|
8945
|
-
items.tabId == id && (items.badge = false,
|
|
8946
|
-
items.blink = false,
|
|
8947
|
-
items.status = "default");
|
|
8948
|
-
});
|
|
7426
|
+
async getValue() {
|
|
7427
|
+
return this.value;
|
|
8949
7428
|
}
|
|
8950
|
-
|
|
8951
|
-
|
|
8952
|
-
|
|
8953
|
-
this.prevButton.setAttribute(this.prevButtonState, "true");
|
|
8954
|
-
}
|
|
8955
|
-
else {
|
|
8956
|
-
this.prevButton.removeAttribute(this.prevButtonState);
|
|
8957
|
-
}
|
|
8958
|
-
}
|
|
8959
|
-
if (this.nextButton) {
|
|
8960
|
-
if (this.getActive() == this.count) {
|
|
8961
|
-
this.nextButton.setAttribute(this.nextButtonState, "true");
|
|
8962
|
-
}
|
|
8963
|
-
else {
|
|
8964
|
-
this.nextButton.removeAttribute(this.nextButtonState);
|
|
8965
|
-
}
|
|
8966
|
-
}
|
|
8967
|
-
if (this.completeButton) {
|
|
8968
|
-
if (this.getActive() == this.count) {
|
|
8969
|
-
this.completeButton.removeAttribute(this.completeButtonState);
|
|
8970
|
-
}
|
|
8971
|
-
else {
|
|
8972
|
-
this.completeButton.setAttribute(this.completeButtonState, "true");
|
|
8973
|
-
}
|
|
8974
|
-
}
|
|
7429
|
+
handleFocus() {
|
|
7430
|
+
this.hasFocus = true;
|
|
7431
|
+
this.focus.emit();
|
|
8975
7432
|
}
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
componentDidRender() {
|
|
8980
|
-
if (!this.firstInit)
|
|
8981
|
-
return;
|
|
8982
|
-
let slotElements;
|
|
8983
|
-
slotElements = this.el.shadowRoot.querySelector('slot').assignedElements();
|
|
8984
|
-
this.tabs = [];
|
|
8985
|
-
this.activeChild = this.getActive();
|
|
8986
|
-
var isActive = false;
|
|
8987
|
-
var firstId = null;
|
|
8988
|
-
var i = 0;
|
|
8989
|
-
// Get only bcm-tab elements from
|
|
8990
|
-
// slot childs
|
|
8991
|
-
slotElements.map((element) => {
|
|
8992
|
-
i++;
|
|
8993
|
-
this.type == "stepper" && (element.disabled = true);
|
|
8994
|
-
if (!firstId) {
|
|
8995
|
-
firstId = element.tabId;
|
|
8996
|
-
}
|
|
8997
|
-
if (String(element.tagName).toLowerCase() == 'bcm-tab') {
|
|
8998
|
-
element.type = this.type;
|
|
8999
|
-
// Activate default tab
|
|
9000
|
-
// #
|
|
9001
|
-
if (this.tabs.push(element) - 1 == this.activeChild) {
|
|
9002
|
-
this.activateChild(this.activeChild);
|
|
9003
|
-
isActive = true;
|
|
9004
|
-
}
|
|
9005
|
-
}
|
|
9006
|
-
this.count = i;
|
|
9007
|
-
});
|
|
9008
|
-
if (!isActive) {
|
|
9009
|
-
this.active(firstId);
|
|
9010
|
-
}
|
|
9011
|
-
setTimeout(() => {
|
|
9012
|
-
this.el.shadowRoot.querySelector('.tabs').classList.add('animatable');
|
|
9013
|
-
}, 500);
|
|
7433
|
+
handleBlur() {
|
|
7434
|
+
this.hasFocus = false;
|
|
7435
|
+
this.blur.emit();
|
|
9014
7436
|
}
|
|
9015
|
-
|
|
9016
|
-
|
|
9017
|
-
|
|
9018
|
-
});
|
|
7437
|
+
handleChange() {
|
|
7438
|
+
this.value = this.textarea.value;
|
|
7439
|
+
this.change.emit(this.value);
|
|
9019
7440
|
}
|
|
9020
|
-
|
|
9021
|
-
|
|
9022
|
-
const childIndex = childs.findIndex(child => child.active);
|
|
9023
|
-
return childIndex >= 0 ? childIndex + 1 : 1;
|
|
7441
|
+
watchValue() {
|
|
7442
|
+
this.handleChange();
|
|
9024
7443
|
}
|
|
9025
|
-
|
|
9026
|
-
|
|
9027
|
-
|
|
9028
|
-
|
|
9029
|
-
let i = 1;
|
|
9030
|
-
while (child.previousElementSibling) {
|
|
9031
|
-
child = child.previousElementSibling;
|
|
9032
|
-
i++;
|
|
9033
|
-
}
|
|
9034
|
-
return i;
|
|
7444
|
+
handleInput() {
|
|
7445
|
+
this.value = this.textarea.value;
|
|
7446
|
+
this.setTextareaHeight();
|
|
7447
|
+
this.input.emit(this.value);
|
|
9035
7448
|
}
|
|
9036
|
-
|
|
9037
|
-
|
|
9038
|
-
|
|
9039
|
-
|
|
9040
|
-
|
|
9041
|
-
idx = idx - 1;
|
|
9042
|
-
const child = this.tabs[idx];
|
|
9043
|
-
if (child) {
|
|
9044
|
-
this.tabs.forEach((tab) => tab.active = false);
|
|
9045
|
-
child.active = true;
|
|
9046
|
-
child.disabled = false;
|
|
9047
|
-
this.transformLine(idx);
|
|
9048
|
-
this.firstInit && forceUpdate(this.el);
|
|
9049
|
-
this.firstInit = false;
|
|
9050
|
-
}
|
|
7449
|
+
handleClear(e) {
|
|
7450
|
+
this.value = '';
|
|
7451
|
+
this.clear.emit();
|
|
7452
|
+
this.textarea.focus();
|
|
7453
|
+
e.stopPropagation();
|
|
9051
7454
|
}
|
|
9052
|
-
|
|
9053
|
-
|
|
9054
|
-
|
|
9055
|
-
|
|
9056
|
-
transformLine(idx) {
|
|
9057
|
-
const tab = this.tabs[idx];
|
|
9058
|
-
if (this.direction == 'horizontal') {
|
|
9059
|
-
this.lineOpts.top = (tab.offsetTop + tab.offsetHeight) + 'px';
|
|
9060
|
-
this.lineOpts.left = tab.offsetLeft + 'px';
|
|
9061
|
-
this.lineOpts.width = tab.offsetWidth + 'px';
|
|
9062
|
-
this.lineOpts.right = 'unset';
|
|
9063
|
-
this.lineOpts.height = '2px';
|
|
7455
|
+
setTextareaHeight() {
|
|
7456
|
+
if (this.resize === 'auto') {
|
|
7457
|
+
this.textarea.style.height = 'auto';
|
|
7458
|
+
this.textarea.style.height = (this.textarea.scrollHeight + 2) + 'px';
|
|
9064
7459
|
}
|
|
9065
7460
|
else {
|
|
9066
|
-
this.
|
|
9067
|
-
this.lineOpts.left = 'unset';
|
|
9068
|
-
this.lineOpts.right = '0';
|
|
9069
|
-
this.lineOpts.width = '2px';
|
|
9070
|
-
this.lineOpts.height = tab.offsetHeight + 'px';
|
|
9071
|
-
}
|
|
9072
|
-
}
|
|
9073
|
-
/**
|
|
9074
|
-
* @desc
|
|
9075
|
-
*/
|
|
9076
|
-
getLineTransform() {
|
|
9077
|
-
return {
|
|
9078
|
-
'--bcm-tabs-line-top': this.lineOpts.top,
|
|
9079
|
-
'--bcm-tabs-line-left': this.lineOpts.left,
|
|
9080
|
-
'--bcm-tabs-line-width': this.lineOpts.width,
|
|
9081
|
-
'--bcm-tabs-line-right': this.lineOpts.right,
|
|
9082
|
-
'--bcm-tabs-line-height': this.lineOpts.height
|
|
9083
|
-
};
|
|
9084
|
-
}
|
|
9085
|
-
/**
|
|
9086
|
-
* @desc
|
|
9087
|
-
* @param event
|
|
9088
|
-
*/
|
|
9089
|
-
handleTabClick(event) {
|
|
9090
|
-
const targetElement = event.target;
|
|
9091
|
-
const childIdx = this.getChildIdx(targetElement);
|
|
9092
|
-
this.activeChild = null;
|
|
9093
|
-
this.activeChild = childIdx;
|
|
9094
|
-
}
|
|
9095
|
-
/**
|
|
9096
|
-
* @desc
|
|
9097
|
-
* @param event
|
|
9098
|
-
*/
|
|
9099
|
-
handleTabClose(event) {
|
|
9100
|
-
const targetElement = event.target;
|
|
9101
|
-
const childIdx = this.getChildIdx(targetElement);
|
|
9102
|
-
// Remove element
|
|
9103
|
-
// #
|
|
9104
|
-
targetElement.remove();
|
|
9105
|
-
this.tabs.splice(childIdx - 1, 1);
|
|
9106
|
-
if (childIdx === this.activeChild) {
|
|
9107
|
-
this.activeChild = 1;
|
|
9108
|
-
this.activateChild(1);
|
|
7461
|
+
this.textarea.style.height = undefined;
|
|
9109
7462
|
}
|
|
9110
7463
|
}
|
|
9111
|
-
|
|
9112
|
-
|
|
9113
|
-
|
|
9114
|
-
|
|
9115
|
-
|
|
9116
|
-
this.
|
|
9117
|
-
this.
|
|
9118
|
-
this.
|
|
7464
|
+
connectedCallback() {
|
|
7465
|
+
this.handleChange = this.handleChange.bind(this);
|
|
7466
|
+
this.handleBlur = this.handleBlur.bind(this);
|
|
7467
|
+
this.handleFocus = this.handleFocus.bind(this);
|
|
7468
|
+
this.handleInput = this.handleInput.bind(this);
|
|
7469
|
+
this.handleClear = this.handleClear.bind(this);
|
|
7470
|
+
this.setTextareaHeight = this.setTextareaHeight.bind(this);
|
|
7471
|
+
this.captionCache = this.caption;
|
|
7472
|
+
this.captionTypeCache = this.captionType;
|
|
9119
7473
|
}
|
|
9120
|
-
|
|
9121
|
-
|
|
9122
|
-
|
|
9123
|
-
|
|
9124
|
-
this.
|
|
9125
|
-
forceUpdate(this.el);
|
|
7474
|
+
componentWillRender() {
|
|
7475
|
+
this.valueLength = this.value ? this.value.length : 0;
|
|
7476
|
+
// this.fullWidth
|
|
7477
|
+
// ? this.el.style.width = '100%'
|
|
7478
|
+
// : this.el.style.width = 'initial'
|
|
9126
7479
|
}
|
|
9127
7480
|
render() {
|
|
9128
|
-
const
|
|
7481
|
+
const { fullWidth, size, rows, disabled, clearable, label, hasFocus, noCaption, caption, captionError, captionType, value, resize, maxLength, placeholder, valueLength, required } = this;
|
|
7482
|
+
const wrapperClasses = classnames('textarea-wrapper', {
|
|
7483
|
+
'full-width': fullWidth,
|
|
7484
|
+
'error': captionType == 'error' ? true : false
|
|
7485
|
+
});
|
|
7486
|
+
const contanerClasses = classnames('textarea-container', 'resize-' + resize, 'textarea-' + size, {
|
|
7487
|
+
'empty': (value === null || value === void 0 ? void 0 : value.length) < 1,
|
|
7488
|
+
'focused': hasFocus,
|
|
7489
|
+
'disabled': disabled,
|
|
7490
|
+
});
|
|
7491
|
+
const captionClasses = classnames('size-1', 'input-caption', 'caption-' + captionType);
|
|
7492
|
+
const countClasses = classnames('size-1', 'input-caption', 'caption-default');
|
|
7493
|
+
const textareaClasses = classnames('size-' + size, {
|
|
7494
|
+
'size-3': size === 'large',
|
|
7495
|
+
'size-2': size === 'small' || size === 'medium',
|
|
7496
|
+
'clearable': clearable
|
|
7497
|
+
});
|
|
9129
7498
|
const hostClasses = classnames(this.hidden ? 'hidden' : null);
|
|
9130
|
-
return (h(Host, { class: hostClasses }, h("div", { class:
|
|
7499
|
+
return (h(Host, { class: hostClasses }, h("div", { class: wrapperClasses }, label && h("div", null, h("bcm-label", { tooltip: this.tooltip, type: captionType, value: label, required: required, htmlFor: this.textareaId })), h("div", { class: contanerClasses }, h("textarea", { ref: el => (this.textarea = el), onInput: this.handleInput, onFocus: this.handleFocus, onChange: this.handleChange, onBlur: this.handleBlur, class: textareaClasses, id: this.textareaId, value: value, rows: rows, disabled: disabled, maxlength: maxLength, placeholder: placeholder }), clearable && (h("button", { class: "clear-button", onClick: this.handleClear }, h("bcm-icon", { icon: "close-circle", type: "fill", size: 18, color: "grey-7" })))), !noCaption || maxLength ? (h("div", { class: "caption-area" }, h("span", null, captionType == "error"
|
|
7500
|
+
? h("span", { class: captionClasses }, " ", captionError, " ")
|
|
7501
|
+
: caption && h("span", { class: captionClasses }, " ", caption, " ")), maxLength && h("span", { class: countClasses }, " ", `${valueLength}/${maxLength}`, " "))) : null)));
|
|
9131
7502
|
}
|
|
9132
7503
|
get el() { return getElement(this); }
|
|
9133
7504
|
static get watchers() { return {
|
|
9134
|
-
"
|
|
7505
|
+
"value": ["watchValue"]
|
|
9135
7506
|
}; }
|
|
9136
7507
|
};
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
const tabsContentCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");.size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}:host{width:100%;display:block;padding:8px}:host(.pane){border:1px solid transparent;border-top:none;border-color:var(--bcm-color-grey-5);border-radius:0 0 2px 2px}";
|
|
9140
|
-
|
|
9141
|
-
const BcmTabsContent = class {
|
|
9142
|
-
constructor(hostRef) {
|
|
9143
|
-
registerInstance(this, hostRef);
|
|
9144
|
-
this.size = 'medium';
|
|
9145
|
-
this.hidden = false;
|
|
9146
|
-
this.fullWidth = false;
|
|
9147
|
-
this.type = TypeProps$1.normal;
|
|
9148
|
-
}
|
|
9149
|
-
connectedCallback() { }
|
|
9150
|
-
disconnectedCallback() { }
|
|
9151
|
-
componentWillLoad() { }
|
|
9152
|
-
componentDidLoad() { }
|
|
9153
|
-
componentWillRender() { }
|
|
9154
|
-
componentDidRender() { }
|
|
9155
|
-
componentWillUpdate() { }
|
|
9156
|
-
componentDidUpdate() { }
|
|
9157
|
-
handleActivePane(e) {
|
|
9158
|
-
getChilds(this.el, 'bcm-tab-pane').forEach(items => {
|
|
9159
|
-
items.tab == e.detail && (items.active = true);
|
|
9160
|
-
items.tab != e.detail && (items.active = false);
|
|
9161
|
-
});
|
|
9162
|
-
}
|
|
9163
|
-
render() {
|
|
9164
|
-
const classes = classnames('tabs-content', this.size);
|
|
9165
|
-
const hostClasses = classnames(this.hidden ? 'hidden' : null, this.type);
|
|
9166
|
-
return (h(Host, { class: hostClasses }, h("div", { class: classes }, h("slot", null))));
|
|
9167
|
-
}
|
|
9168
|
-
get el() { return getElement(this); }
|
|
9169
|
-
};
|
|
9170
|
-
BcmTabsContent.style = tabsContentCss;
|
|
9171
|
-
|
|
9172
|
-
/**
|
|
9173
|
-
* 'color' prop predefined values
|
|
9174
|
-
*/
|
|
9175
|
-
var ColorProps$1;
|
|
9176
|
-
(function (ColorProps) {
|
|
9177
|
-
ColorProps["black"] = "black";
|
|
9178
|
-
ColorProps["white"] = "white";
|
|
9179
|
-
ColorProps["prime-blue"] = "prime-blue";
|
|
9180
|
-
ColorProps["grey"] = "grey";
|
|
9181
|
-
ColorProps["blue"] = "blue";
|
|
9182
|
-
ColorProps["warmyellow"] = "warmyellow";
|
|
9183
|
-
ColorProps["yellow"] = "yellow";
|
|
9184
|
-
ColorProps["limegreen"] = "limegreen";
|
|
9185
|
-
ColorProps["red"] = "red";
|
|
9186
|
-
ColorProps["darkorange"] = "darkorange";
|
|
9187
|
-
ColorProps["orange"] = "orange";
|
|
9188
|
-
ColorProps["green"] = "green";
|
|
9189
|
-
ColorProps["turquosie"] = "turquosie";
|
|
9190
|
-
ColorProps["cobaltblue"] = "cobaltblue";
|
|
9191
|
-
ColorProps["magenta"] = "magenta";
|
|
9192
|
-
ColorProps["purple"] = "purple";
|
|
9193
|
-
ColorProps["bc-red"] = "bc-red";
|
|
9194
|
-
ColorProps["bc-blue"] = "bc-blue";
|
|
9195
|
-
ColorProps["bc-green"] = "bc-green";
|
|
9196
|
-
ColorProps["bc-orange"] = "bc-orange";
|
|
9197
|
-
})(ColorProps$1 || (ColorProps$1 = {}));
|
|
7508
|
+
BcmTextarea.style = textareaCss;
|
|
9198
7509
|
|
|
9199
|
-
const
|
|
7510
|
+
const tooltipCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");.size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}:host{display:inline-flex}:host(.hidden){display:none}:host(:focus){outline:none}.tooltip{position:relative;}.tooltip .box{position:absolute;display:none;box-sizing:border-box;background-color:#262626;border:1px solid #262626;border-radius:2px;z-index:10700;width:max-content;padding:4px 8px;color:var(--bcm-color-grey-1)}.tooltip::after{content:\"\";position:absolute;display:none;border:6px solid;z-index:10700;pointer-events:none}.tooltip.open .box,.tooltip.open::after{display:block}.tooltip.top .box{bottom:100%;margin-bottom:8px}.tooltip.top::after{bottom:100%;margin-bottom:-4px;border-color:#262626 transparent transparent transparent}.tooltip.bottom .box{top:100%;margin-top:8px}.tooltip.bottom::after{top:100%;margin-top:-4px;border-color:transparent transparent #262626 transparent}.tooltip.left .box{right:100%;margin-right:8px}.tooltip.left::after{right:100%;margin-right:-4px;border-color:transparent transparent transparent #262626}.tooltip.right .box{left:100%;margin-left:8px}.tooltip.right::after{left:100%;margin-left:-4px;border-color:transparent #262626 transparent transparent}.tooltip.top.center .box,.tooltip.bottom.center .box{left:50%;transform:translateX(-50%)}.tooltip.top.center::after,.tooltip.bottom.center::after{left:50%;transform:translateX(-50%)}.tooltip.top.start .box,.tooltip.bottom.start .box{left:0}.tooltip.top.start::after,.tooltip.bottom.start::after{left:8px}.tooltip.top.end .box,.tooltip.bottom.end .box{right:0}.tooltip.top.end::after,.tooltip.bottom.end::after{right:8px}.tooltip.left.center .box,.tooltip.right.center .box{top:50%;transform:translateY(-50%)}.tooltip.left.center::after,.tooltip.right.center::after{top:50%;transform:translateY(-50%)}.tooltip.left.start .box,.tooltip.right.start .box{top:0}.tooltip.left.start::after,.tooltip.right.start::after{top:4px}.tooltip.left.end .box,.tooltip.right.end .box{bottom:0}.tooltip.left.end::after,.tooltip.right.end::after{bottom:4px}";
|
|
9200
7511
|
|
|
9201
|
-
const
|
|
7512
|
+
const BcmTooltip = class {
|
|
9202
7513
|
constructor(hostRef) {
|
|
9203
7514
|
registerInstance(this, hostRef);
|
|
9204
|
-
this.
|
|
9205
|
-
this.
|
|
9206
|
-
this.
|
|
9207
|
-
this.
|
|
9208
|
-
this.checked = false;
|
|
9209
|
-
this.value = '';
|
|
7515
|
+
this.onShow = createEvent(this, "bcm-show", 7);
|
|
7516
|
+
this.onHide = createEvent(this, "bcm-hide", 7);
|
|
7517
|
+
this.placement = 'top';
|
|
7518
|
+
this.trigger = 'hover';
|
|
9210
7519
|
this.hidden = false;
|
|
9211
|
-
this._id = (Math.random() * 4).toString(16).replace('.', '');
|
|
9212
|
-
this.maxWidth = false;
|
|
9213
7520
|
this._internal_id = (Math.random() * 4).toString(16).replace('.', '');
|
|
9214
7521
|
}
|
|
9215
|
-
|
|
9216
|
-
|
|
9217
|
-
|
|
7522
|
+
async show() {
|
|
7523
|
+
// Prevent subsequent calls
|
|
7524
|
+
if (this.open) {
|
|
7525
|
+
return;
|
|
9218
7526
|
}
|
|
7527
|
+
this.open = true;
|
|
7528
|
+
this.onShow.emit();
|
|
9219
7529
|
}
|
|
9220
|
-
|
|
9221
|
-
|
|
7530
|
+
async hide() {
|
|
7531
|
+
// Prevent subsequent calls
|
|
7532
|
+
if (!this.open) {
|
|
7533
|
+
return;
|
|
7534
|
+
}
|
|
7535
|
+
this.open = false;
|
|
7536
|
+
this.onHide.emit();
|
|
9222
7537
|
}
|
|
9223
|
-
|
|
9224
|
-
if (
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
|
|
9228
|
-
|
|
9229
|
-
};
|
|
7538
|
+
handleClickOutside(e) {
|
|
7539
|
+
if (!this.host.contains(e.target)) {
|
|
7540
|
+
if (this.open) {
|
|
7541
|
+
this.open = false;
|
|
7542
|
+
}
|
|
7543
|
+
}
|
|
9230
7544
|
}
|
|
9231
|
-
|
|
9232
|
-
|
|
9233
|
-
|
|
7545
|
+
async handleOpen() {
|
|
7546
|
+
await this.createElement();
|
|
7547
|
+
var tooltipBox = document.getElementById("box" + this._internal_id).shadowRoot.querySelector(".tooltip-box");
|
|
7548
|
+
if (tooltipBox && tooltipBox.querySelector(".box")) {
|
|
7549
|
+
var tooltipBoxIn = tooltipBox.querySelector(".box");
|
|
7550
|
+
popoverPlacement(tooltipBoxIn, this.host, this.placement, (place) => this.placement = place);
|
|
7551
|
+
tooltipBox.classList.toggle("open");
|
|
9234
7552
|
}
|
|
9235
|
-
|
|
9236
|
-
|
|
9237
|
-
|
|
9238
|
-
|
|
9239
|
-
|
|
7553
|
+
}
|
|
7554
|
+
async createElement() {
|
|
7555
|
+
var target = this.host.getBoundingClientRect();
|
|
7556
|
+
var placementString = String([...this.getPlacement()]).replace(',', ' ');
|
|
7557
|
+
var element;
|
|
7558
|
+
if (!document.getElementById("box" + this._internal_id)) {
|
|
7559
|
+
element = document.createElement("bcm-tooltip-box");
|
|
7560
|
+
element.setAttribute("id", "box" + this._internal_id);
|
|
7561
|
+
}
|
|
7562
|
+
else {
|
|
7563
|
+
element = document.getElementById("box" + this._internal_id);
|
|
7564
|
+
}
|
|
7565
|
+
element.setAttribute("message", this.message);
|
|
7566
|
+
// element.setAttribute("placement", placementString)
|
|
7567
|
+
element.style.position = "absolute";
|
|
7568
|
+
// element.style.top = target.top + "px"
|
|
7569
|
+
// element.style.left = (target.left + (target.width / 2)) + "px"
|
|
7570
|
+
element.setAttribute("placement", placementString);
|
|
7571
|
+
// element.style.zIndex = "999999999"
|
|
7572
|
+
document.body.appendChild(element);
|
|
7573
|
+
await delay(50);
|
|
7574
|
+
var tooltipBox = document.getElementById("box" + this._internal_id).shadowRoot.querySelector(".tooltip-box");
|
|
7575
|
+
if (tooltipBox && tooltipBox.querySelector(".box")) {
|
|
7576
|
+
var tooltipBoxIn = tooltipBox.querySelector(".box");
|
|
7577
|
+
popoverPlacement(tooltipBoxIn, this.host, this.placement, (place) => this.placement = place);
|
|
7578
|
+
}
|
|
7579
|
+
element.style.top = popoverBoxPlacement(this.placement, target)[0] + "px";
|
|
7580
|
+
element.style.left = popoverBoxPlacement(this.placement, target)[1] + "px";
|
|
7581
|
+
}
|
|
7582
|
+
hasTrigger(trigger) {
|
|
7583
|
+
return this.trigger === trigger;
|
|
7584
|
+
}
|
|
7585
|
+
getPlacement() {
|
|
7586
|
+
const placements = this.placement.split('-');
|
|
7587
|
+
if (placements.length === 1) {
|
|
7588
|
+
placements.push('center');
|
|
7589
|
+
}
|
|
7590
|
+
return placements;
|
|
7591
|
+
}
|
|
7592
|
+
/*
|
|
7593
|
+
Trigger Functions
|
|
7594
|
+
*/
|
|
7595
|
+
handleMouseOver() {
|
|
7596
|
+
if (this.hasTrigger('hover')) {
|
|
7597
|
+
this.show();
|
|
9240
7598
|
}
|
|
9241
|
-
return size;
|
|
9242
7599
|
}
|
|
9243
|
-
|
|
9244
|
-
this.
|
|
9245
|
-
|
|
7600
|
+
handleMouseOut() {
|
|
7601
|
+
if (this.hasTrigger('hover')) {
|
|
7602
|
+
this.hide();
|
|
7603
|
+
}
|
|
9246
7604
|
}
|
|
9247
|
-
|
|
9248
|
-
|
|
9249
|
-
|
|
9250
|
-
const hostClasses = classnames(this.hidden ? 'hidden' : null, this.maxWidth ? 'maxwidth' : null);
|
|
9251
|
-
if (type === 'add') {
|
|
9252
|
-
return (h(Host, { class: hostClasses }, h("button", { class: classes }, h("span", { class: "left" }, h("bcm-icon", { icon: "plus", type: "outlined", color: "grey-8", size: (Number(this.getSize(size, true)) + 2) })), value)));
|
|
7605
|
+
handleClick() {
|
|
7606
|
+
if (this.hasTrigger('click')) {
|
|
7607
|
+
this.open ? this.hide() : this.show();
|
|
9253
7608
|
}
|
|
9254
|
-
|
|
9255
|
-
|
|
7609
|
+
}
|
|
7610
|
+
handleFocus() {
|
|
7611
|
+
if (this.hasTrigger('focus')) {
|
|
7612
|
+
this.show();
|
|
9256
7613
|
}
|
|
9257
|
-
|
|
9258
|
-
|
|
7614
|
+
}
|
|
7615
|
+
handleBlur() {
|
|
7616
|
+
if (this.hasTrigger('focus')) {
|
|
7617
|
+
this.hide();
|
|
9259
7618
|
}
|
|
9260
|
-
return (h(Host, { class: hostClasses }, h("span", { class: classes, style: this.getColor(color) }, value)));
|
|
9261
7619
|
}
|
|
9262
|
-
|
|
7620
|
+
async componentDidRender() {
|
|
7621
|
+
await this.createElement();
|
|
7622
|
+
var tooltipBox = document.getElementById("box" + this._internal_id).shadowRoot.querySelector(".tooltip-box");
|
|
7623
|
+
if (tooltipBox && tooltipBox.querySelector(".box")) {
|
|
7624
|
+
var tooltipBoxIn = tooltipBox.querySelector(".box");
|
|
7625
|
+
popoverPlacement(tooltipBoxIn, this.host, this.placement, (place) => this.placement = place);
|
|
7626
|
+
}
|
|
7627
|
+
}
|
|
7628
|
+
render() {
|
|
7629
|
+
const classes = classnames('tooltip', ...this.getPlacement(), {
|
|
7630
|
+
// 'open': this.open
|
|
7631
|
+
});
|
|
7632
|
+
const hostClasses = classnames(this.hidden ? 'hidden' : null);
|
|
7633
|
+
return (h(Host, { class: hostClasses, onClick: () => this.handleClick(), onMouseOver: () => this.handleMouseOver(), onMouseOut: () => this.handleMouseOut(), onFocus: () => this.handleFocus(), onBlur: () => this.handleBlur(), tabindex: 0 }, h("span", { class: classes }, h("span", { class: "box size-2" }, this.message), h("slot", null))));
|
|
7634
|
+
}
|
|
7635
|
+
get host() { return getElement(this); }
|
|
9263
7636
|
static get watchers() { return {
|
|
9264
|
-
"
|
|
7637
|
+
"open": ["handleOpen"]
|
|
9265
7638
|
}; }
|
|
9266
7639
|
};
|
|
9267
|
-
|
|
7640
|
+
BcmTooltip.style = tooltipCss;
|
|
9268
7641
|
|
|
9269
|
-
const
|
|
7642
|
+
const tooltipBoxCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");.size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}:host{display:inline-flex}:host(.hidden){display:none}:host(:focus){outline:none}.tooltip-box{position:relative;}.tooltip-box .box{position:absolute;display:none;box-sizing:border-box;background-color:#262626;border:1px solid #262626;border-radius:2px;z-index:10700;width:max-content;padding:4px 8px;color:var(--bcm-color-grey-1)}.tooltip-box::after{content:\"\";position:absolute;display:none;border:6px solid;z-index:10700;pointer-events:none}.tooltip-box.open .box,.tooltip-box.open::after{display:block}.tooltip-box.top .box{bottom:100%;margin-bottom:8px}.tooltip-box.top::after{bottom:100%;margin-bottom:-4px;border-color:#262626 transparent transparent transparent}.tooltip-box.bottom .box{top:100%;margin-top:8px}.tooltip-box.bottom::after{top:100%;margin-top:-4px;border-color:transparent transparent #262626 transparent}.tooltip-box.left .box{right:100%;margin-right:8px}.tooltip-box.left::after{right:100%;margin-right:-4px;border-color:transparent transparent transparent #262626}.tooltip-box.right .box{left:100%;margin-left:8px}.tooltip-box.right::after{left:100%;margin-left:-4px;border-color:transparent #262626 transparent transparent}.tooltip-box.top.center .box,.tooltip-box.bottom.center .box{left:50%;transform:translateX(-50%)}.tooltip-box.top.center::after,.tooltip-box.bottom.center::after{left:50%;transform:translateX(-50%)}.tooltip-box.top.start .box,.tooltip-box.bottom.start .box{left:0}.tooltip-box.top.start::after,.tooltip-box.bottom.start::after{left:8px}.tooltip-box.top.end .box,.tooltip-box.bottom.end .box{right:0}.tooltip-box.top.end::after,.tooltip-box.bottom.end::after{right:8px}.tooltip-box.left.center .box,.tooltip-box.right.center .box{top:50%;transform:translateY(-50%)}.tooltip-box.left.center::after,.tooltip-box.right.center::after{top:50%;transform:translateY(-50%)}.tooltip-box.left.start .box,.tooltip-box.right.start .box{top:0}.tooltip-box.left.start::after,.tooltip-box.right.start::after{top:4px}.tooltip-box.left.end .box,.tooltip-box.right.end .box{bottom:0}.tooltip-box.left.end::after,.tooltip-box.right.end::after{bottom:4px}.tooltip-box a{color:var(--bcm-color-grey-1)}";
|
|
9270
7643
|
|
|
9271
|
-
const
|
|
7644
|
+
const BcmTooltipBox = class {
|
|
9272
7645
|
constructor(hostRef) {
|
|
9273
7646
|
registerInstance(this, hostRef);
|
|
9274
|
-
this.scale = 'size-4';
|
|
9275
|
-
this.weight = 'regular';
|
|
9276
|
-
this.color = 'grey-10';
|
|
9277
7647
|
this.hidden = false;
|
|
9278
7648
|
}
|
|
7649
|
+
connectedCallback() { }
|
|
7650
|
+
disconnectedCallback() { }
|
|
7651
|
+
componentWillLoad() { }
|
|
7652
|
+
componentDidLoad() { }
|
|
7653
|
+
componentWillRender() { }
|
|
7654
|
+
componentDidRender() { }
|
|
7655
|
+
componentWillUpdate() { }
|
|
7656
|
+
componentDidUpdate() { }
|
|
7657
|
+
async openBox(open) {
|
|
7658
|
+
this.open = open;
|
|
7659
|
+
}
|
|
9279
7660
|
render() {
|
|
9280
|
-
const classes = classnames(
|
|
7661
|
+
const classes = classnames('tooltip-box', this.open, this.placement);
|
|
7662
|
+
const boxClasses = classnames('box');
|
|
9281
7663
|
const hostClasses = classnames(this.hidden ? 'hidden' : null);
|
|
9282
|
-
return (h(Host, { class: hostClasses }, h("
|
|
7664
|
+
return (h(Host, { class: hostClasses }, h("div", { class: classes }, h("div", { class: boxClasses, innerHTML: this.message }))));
|
|
9283
7665
|
}
|
|
7666
|
+
get el() { return getElement(this); }
|
|
9284
7667
|
};
|
|
9285
|
-
|
|
7668
|
+
BcmTooltipBox.style = tooltipBoxCss;
|
|
9286
7669
|
|
|
9287
|
-
export {
|
|
7670
|
+
export { BcmButton as bcm_button, BcmCheckbox as bcm_checkbox, BcmCheckboxGroup as bcm_checkbox_group, BcmForm as bcm_form, BcmIcon as bcm_icon, BcmInput as bcm_input, BcmLabel as bcm_label, BcmSwitch as bcm_switch, BcmTextarea as bcm_textarea, BcmTooltip as bcm_tooltip, BcmTooltipBox as bcm_tooltip_box };
|