bkui-vue 0.0.1-beta.25 → 0.0.1-beta.28
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/bkui-vue.cjs.js +1368 -296
- package/dist/bkui-vue.esm.js +1369 -298
- package/dist/bkui-vue.umd.js +1368 -296
- package/dist/style.css +585 -72
- package/lib/components.d.ts +1 -0
- package/lib/pagination/index.d.ts +3 -3
- package/lib/pagination/index.js +1 -1
- package/lib/pagination/pagination.d.ts +1 -1
- package/lib/pagination/type.d.ts +1 -1
- package/lib/popover/index.js +1 -1
- package/lib/resize-layout/index.d.ts +336 -0
- package/lib/resize-layout/index.js +1 -0
- package/lib/resize-layout/resize-layout.css +189 -0
- package/lib/resize-layout/resize-layout.d.ts +127 -0
- package/lib/resize-layout/resize-layout.less +233 -0
- package/lib/resize-layout/resize-layout.variable.css +282 -0
- package/lib/select/common.d.ts +23 -27
- package/lib/select/index.d.ts +530 -145
- package/lib/select/index.js +12 -12
- package/lib/select/optionGroup.d.ts +0 -76
- package/lib/select/select.css +156 -46
- package/lib/select/select.d.ts +150 -39
- package/lib/select/select.less +136 -75
- package/lib/select/select.variable.css +156 -46
- package/lib/select/type.d.ts +31 -0
- package/lib/styles/index.d.ts +2 -0
- package/lib/styles/index.js +1 -1
- package/lib/swiper/index.js +1 -1
- package/lib/swiper/swiper.css +14 -14
- package/lib/swiper/swiper.less +93 -77
- package/lib/swiper/swiper.variable.css +14 -14
- package/lib/table/table.css +1 -1
- package/lib/table/table.less +1 -1
- package/lib/table/table.variable.css +1 -1
- package/lib/tag/index.js +1 -1
- package/lib/tag/tag.css +11 -5
- package/lib/tag/tag.less +12 -5
- package/lib/tag/tag.variable.css +11 -5
- package/lib/tag-input/common.d.ts +24 -0
- package/lib/tag-input/index.d.ts +2 -0
- package/lib/tag-input/index.js +1 -0
- package/lib/tag-input/list-tag-render.d.ts +47 -0
- package/lib/tag-input/tag-input.css +208 -0
- package/lib/tag-input/tag-input.d.ts +374 -0
- package/lib/tag-input/tag-input.less +250 -0
- package/lib/tag-input/tag-input.variable.css +301 -0
- package/lib/tag-input/tag-props.d.ts +131 -0
- package/lib/tag-input/tag-render.d.ts +38 -0
- package/lib/tree/index.js +1 -1
- package/lib/tree/tree.css +6 -6
- package/lib/tree/tree.less +7 -6
- package/lib/tree/tree.variable.css +6 -6
- package/package.json +3 -3
package/dist/bkui-vue.umd.js
CHANGED
@@ -81,6 +81,8 @@ var __publicField = (obj, key, value) => {
|
|
81
81
|
var transfer = "";
|
82
82
|
var pagination = "";
|
83
83
|
var timeline = "";
|
84
|
+
var resizeLayout = "";
|
85
|
+
var tagInput = "";
|
84
86
|
const BKLAYERD_INDEX_EFAULT_VALUE = {
|
85
87
|
["bottom"]: 0,
|
86
88
|
["content"]: 1,
|
@@ -9529,8 +9531,9 @@ ${$(r2)}`), n2;
|
|
9529
9531
|
};
|
9530
9532
|
});
|
9531
9533
|
const handleManualShow = (val) => {
|
9534
|
+
var _a, _b;
|
9532
9535
|
if (trigger.value === "manual" && isPopInstance) {
|
9533
|
-
val ? popoverInstance.show() : popoverInstance.hide();
|
9536
|
+
val ? (_a = popoverInstance.show) == null ? void 0 : _a.call(popoverInstance) : (_b = popoverInstance.hide) == null ? void 0 : _b.call(popoverInstance);
|
9534
9537
|
}
|
9535
9538
|
};
|
9536
9539
|
vue.watch(() => props.isShow, (val) => {
|
@@ -9607,7 +9610,7 @@ ${$(r2)}`), n2;
|
|
9607
9610
|
"ref": refContent,
|
9608
9611
|
"class": contentClass,
|
9609
9612
|
"style": compStyle.value
|
9610
|
-
}, customTheme), [(_c = (_b2 = (_a2 = ctx.slots).content) == null ? void 0 : _b2.call(_a2)) != null ? _c : content.value, arrow2 && vue.createVNode("div", {
|
9613
|
+
}, customTheme), [(_c = (_b2 = (_a2 = ctx.slots).content) == null ? void 0 : _b2.call(_a2)) != null ? _c : content.value, arrow2.value && vue.createVNode("div", {
|
9611
9614
|
"class": "arrow",
|
9612
9615
|
"data-popper-arrow": true
|
9613
9616
|
}, null)])];
|
@@ -10359,22 +10362,79 @@ ${$(r2)}`), n2;
|
|
10359
10362
|
cancelHover
|
10360
10363
|
};
|
10361
10364
|
}
|
10362
|
-
function
|
10365
|
+
function useRegistry(data2) {
|
10366
|
+
const register = (item) => {
|
10367
|
+
if (!item)
|
10368
|
+
return;
|
10369
|
+
return data2.value.add(item);
|
10370
|
+
};
|
10371
|
+
const unregister = (item) => data2.value.delete(item);
|
10372
|
+
return {
|
10373
|
+
register,
|
10374
|
+
unregister
|
10375
|
+
};
|
10376
|
+
}
|
10377
|
+
function useDebouncedRef$1(value, delay = 200) {
|
10363
10378
|
let timeout;
|
10379
|
+
let innerValue = value;
|
10364
10380
|
return vue.customRef((track, trigger) => ({
|
10365
10381
|
get() {
|
10366
10382
|
track();
|
10367
|
-
return
|
10383
|
+
return innerValue;
|
10368
10384
|
},
|
10369
10385
|
set(newValue) {
|
10370
10386
|
clearTimeout(timeout);
|
10371
10387
|
timeout = setTimeout(() => {
|
10372
|
-
|
10388
|
+
innerValue = newValue;
|
10373
10389
|
trigger();
|
10374
10390
|
}, delay);
|
10375
10391
|
}
|
10376
10392
|
}));
|
10377
10393
|
}
|
10394
|
+
function usePopover(config) {
|
10395
|
+
const { popoverMinWidth } = config;
|
10396
|
+
const popperWidth = vue.ref("auto");
|
10397
|
+
const isPopoverShow = vue.ref(false);
|
10398
|
+
const onPopoverFirstUpdate = (instance) => {
|
10399
|
+
const { reference: reference2 } = instance.elements;
|
10400
|
+
popperWidth.value = Math.max(reference2.offsetWidth, popoverMinWidth);
|
10401
|
+
};
|
10402
|
+
const togglePopover = () => {
|
10403
|
+
isPopoverShow.value = !isPopoverShow.value;
|
10404
|
+
};
|
10405
|
+
const hidePopover = () => {
|
10406
|
+
isPopoverShow.value = false;
|
10407
|
+
};
|
10408
|
+
const showPopover = () => {
|
10409
|
+
isPopoverShow.value = true;
|
10410
|
+
};
|
10411
|
+
return {
|
10412
|
+
isPopoverShow,
|
10413
|
+
popperWidth,
|
10414
|
+
togglePopover,
|
10415
|
+
onPopoverFirstUpdate,
|
10416
|
+
hidePopover,
|
10417
|
+
showPopover
|
10418
|
+
};
|
10419
|
+
}
|
10420
|
+
function useRemoteSearch(method) {
|
10421
|
+
const searchKey = useDebouncedRef$1("");
|
10422
|
+
const searchLoading = vue.ref(false);
|
10423
|
+
vue.watch(searchKey, async () => {
|
10424
|
+
searchLoading.value = true;
|
10425
|
+
await method(searchKey.value);
|
10426
|
+
searchLoading.value = false;
|
10427
|
+
});
|
10428
|
+
return {
|
10429
|
+
searchKey,
|
10430
|
+
searchLoading
|
10431
|
+
};
|
10432
|
+
}
|
10433
|
+
function toLowerCase(value = "") {
|
10434
|
+
if (!value)
|
10435
|
+
return value;
|
10436
|
+
return String(value).trim().toLowerCase();
|
10437
|
+
}
|
10378
10438
|
var BkOption = vue.defineComponent({
|
10379
10439
|
name: "Option",
|
10380
10440
|
props: {
|
@@ -10390,28 +10450,12 @@ ${$(r2)}`), n2;
|
|
10390
10450
|
visible: true
|
10391
10451
|
});
|
10392
10452
|
const {
|
10393
|
-
disabled
|
10394
|
-
label
|
10453
|
+
disabled
|
10395
10454
|
} = vue.toRefs(props);
|
10396
10455
|
const select2 = vue.inject(selectKey, null);
|
10397
10456
|
const group = vue.inject(optionGroupKey, null);
|
10398
10457
|
const selected = vue.computed(() => select2.selectedOptions.has(proxy));
|
10399
10458
|
const multiple = vue.computed(() => select2 == null ? void 0 : select2.props.multiple);
|
10400
|
-
vue.watchEffect(() => {
|
10401
|
-
var _a;
|
10402
|
-
if (group == null ? void 0 : group.groupCollapse) {
|
10403
|
-
states.visible = false;
|
10404
|
-
} else if (!(select2 == null ? void 0 : select2.isRemoteSearch) && (select2 == null ? void 0 : select2.searchKey)) {
|
10405
|
-
states.visible = (_a = toLowerCase(String(label.value))) == null ? void 0 : _a.includes(toLowerCase(select2 == null ? void 0 : select2.searchKey));
|
10406
|
-
} else {
|
10407
|
-
states.visible = true;
|
10408
|
-
}
|
10409
|
-
});
|
10410
|
-
const toLowerCase = (value = "") => {
|
10411
|
-
if (!value)
|
10412
|
-
return value;
|
10413
|
-
return String(value).trim().toLowerCase();
|
10414
|
-
};
|
10415
10459
|
const handleOptionClick = () => {
|
10416
10460
|
if (disabled.value)
|
10417
10461
|
return;
|
@@ -10419,9 +10463,11 @@ ${$(r2)}`), n2;
|
|
10419
10463
|
};
|
10420
10464
|
vue.onBeforeMount(() => {
|
10421
10465
|
select2 == null ? void 0 : select2.register(proxy);
|
10466
|
+
group == null ? void 0 : group.register(proxy);
|
10422
10467
|
});
|
10423
10468
|
vue.onBeforeUnmount(() => {
|
10424
10469
|
select2 == null ? void 0 : select2.unregister(proxy);
|
10470
|
+
group == null ? void 0 : group.unregister(proxy);
|
10425
10471
|
});
|
10426
10472
|
return __spreadProps(__spreadValues({}, vue.toRefs(states)), {
|
10427
10473
|
selected,
|
@@ -10455,41 +10501,38 @@ ${$(r2)}`), n2;
|
|
10455
10501
|
setup(props, {
|
10456
10502
|
emit
|
10457
10503
|
}) {
|
10458
|
-
const
|
10459
|
-
|
10504
|
+
const {
|
10505
|
+
proxy
|
10506
|
+
} = vue.getCurrentInstance();
|
10507
|
+
const select2 = vue.inject(selectKey, null);
|
10460
10508
|
const states = vue.reactive({
|
10461
10509
|
groupCollapse: props.collapse,
|
10462
10510
|
visible: true
|
10463
10511
|
});
|
10464
|
-
const
|
10465
|
-
|
10466
|
-
|
10467
|
-
|
10468
|
-
|
10469
|
-
|
10470
|
-
if (Array.isArray(node.children)) {
|
10471
|
-
node.children.forEach((child) => {
|
10472
|
-
var _a;
|
10473
|
-
if (child.type && child.type.name === "Option" && child.component && child.component.proxy) {
|
10474
|
-
children2.push(child.component.proxy);
|
10475
|
-
} else if ((_a = child.children) == null ? void 0 : _a.length) {
|
10476
|
-
children2.push(...flattedChildren(child));
|
10477
|
-
}
|
10478
|
-
});
|
10479
|
-
}
|
10480
|
-
return children2;
|
10481
|
-
};
|
10512
|
+
const options = vue.ref(/* @__PURE__ */ new Set());
|
10513
|
+
const {
|
10514
|
+
register,
|
10515
|
+
unregister
|
10516
|
+
} = useRegistry(options);
|
10517
|
+
const groupLabel = vue.computed(() => `${props.label} (${[...options.value.values()].filter((option) => option.visible).length})`);
|
10482
10518
|
const handleToggleCollapse = () => {
|
10483
|
-
if (!props.collapsible)
|
10519
|
+
if (!props.collapsible || props.disabled)
|
10484
10520
|
return;
|
10485
10521
|
states.groupCollapse = !states.groupCollapse;
|
10486
10522
|
emit("update:collapse", states.groupCollapse);
|
10487
10523
|
};
|
10488
|
-
vue.
|
10489
|
-
|
10524
|
+
vue.provide(optionGroupKey, vue.reactive(__spreadProps(__spreadValues({}, vue.toRefs(props)), {
|
10525
|
+
register,
|
10526
|
+
unregister,
|
10527
|
+
groupCollapse: vue.toRef(states, "groupCollapse")
|
10528
|
+
})));
|
10529
|
+
vue.onBeforeMount(() => {
|
10530
|
+
select2 == null ? void 0 : select2.registerGroup(proxy);
|
10531
|
+
});
|
10532
|
+
vue.onBeforeUnmount(() => {
|
10533
|
+
select2 == null ? void 0 : select2.unregisterGroup(proxy);
|
10490
10534
|
});
|
10491
10535
|
return __spreadProps(__spreadValues({}, vue.toRefs(states)), {
|
10492
|
-
children,
|
10493
10536
|
groupLabel,
|
10494
10537
|
handleToggleCollapse
|
10495
10538
|
});
|
@@ -10498,7 +10541,8 @@ ${$(r2)}`), n2;
|
|
10498
10541
|
var _a, _b;
|
10499
10542
|
const groupClass = classes({
|
10500
10543
|
"bk-option-group": true,
|
10501
|
-
collapsible: this.collapsible
|
10544
|
+
collapsible: this.collapsible,
|
10545
|
+
disabled: this.disabled
|
10502
10546
|
});
|
10503
10547
|
const groupLabelClass = classes({
|
10504
10548
|
"bk-option-group-label": true,
|
@@ -10515,13 +10559,13 @@ ${$(r2)}`), n2;
|
|
10515
10559
|
"onClick": this.handleToggleCollapse
|
10516
10560
|
}, [this.$slots.label ? this.$slots.label() : vue.createVNode("span", {
|
10517
10561
|
"class": "default-group-label"
|
10518
|
-
}, [this.collapsible
|
10562
|
+
}, [this.collapsible && vue.createVNode(angleUpFill, {
|
10519
10563
|
"class": groupLabelIconClass
|
10520
|
-
}, null)
|
10564
|
+
}, null), vue.createVNode("span", {
|
10521
10565
|
"class": "default-group-label-title"
|
10522
|
-
}, [this.groupLabel])])]), vue.createVNode("ul", {
|
10566
|
+
}, [this.groupLabel])])]), vue.withDirectives(vue.createVNode("ul", {
|
10523
10567
|
"class": "bk-option-group-content"
|
10524
|
-
}, [(_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)])]), [[vue.vShow, this.visible]]);
|
10568
|
+
}, [(_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)]), [[vue.vShow, !this.groupCollapse]])]), [[vue.vShow, this.visible]]);
|
10525
10569
|
}
|
10526
10570
|
});
|
10527
10571
|
var _populated = false;
|
@@ -10923,6 +10967,69 @@ ${$(r2)}`), n2;
|
|
10923
10967
|
}
|
10924
10968
|
}
|
10925
10969
|
var Component$b = vue.defineComponent({
|
10970
|
+
name: "Tag",
|
10971
|
+
props: {
|
10972
|
+
theme: PropTypes.theme(["success", "info", "warning", "danger"]).def(""),
|
10973
|
+
closable: PropTypes.bool.def(false),
|
10974
|
+
type: PropTypes.commonType(["", "filled", "stroke"]).def(""),
|
10975
|
+
checkable: PropTypes.bool.def(false),
|
10976
|
+
checked: PropTypes.bool.def(false),
|
10977
|
+
radius: PropTypes.string.def("2px"),
|
10978
|
+
extCls: PropTypes.string.def("")
|
10979
|
+
},
|
10980
|
+
emits: ["change", "close"],
|
10981
|
+
slots: ["icon"],
|
10982
|
+
setup(props, {
|
10983
|
+
emit
|
10984
|
+
}) {
|
10985
|
+
const wrapperCls = vue.computed(() => classes({
|
10986
|
+
"bk-tag-closable": props.closable,
|
10987
|
+
"bk-tag-checkable": props.checkable,
|
10988
|
+
"bk-tag-check": props.checked,
|
10989
|
+
[`bk-tag-${props.type}`]: props.type,
|
10990
|
+
[`bk-tag-${props.theme}`]: props.theme,
|
10991
|
+
[props.extCls]: !!props.extCls
|
10992
|
+
}, "bk-tag"));
|
10993
|
+
const wrapperStyle = vue.computed(() => ({
|
10994
|
+
borderRadius: props.radius
|
10995
|
+
}));
|
10996
|
+
const handleClose = (e) => {
|
10997
|
+
e.preventDefault();
|
10998
|
+
e.stopPropagation();
|
10999
|
+
emit("close", e);
|
11000
|
+
};
|
11001
|
+
const handleClick = (e) => {
|
11002
|
+
e.preventDefault();
|
11003
|
+
e.stopPropagation();
|
11004
|
+
if (props.checkable) {
|
11005
|
+
emit("change", !props.checked);
|
11006
|
+
}
|
11007
|
+
};
|
11008
|
+
return {
|
11009
|
+
wrapperCls,
|
11010
|
+
wrapperStyle,
|
11011
|
+
handleClose,
|
11012
|
+
handleClick
|
11013
|
+
};
|
11014
|
+
},
|
11015
|
+
render() {
|
11016
|
+
var _a, _b;
|
11017
|
+
return vue.createVNode("div", {
|
11018
|
+
"class": this.wrapperCls,
|
11019
|
+
"style": this.wrapperStyle,
|
11020
|
+
"onClick": this.handleClick
|
11021
|
+
}, [this.$slots.icon ? vue.createVNode("span", {
|
11022
|
+
"class": "bk-tag-icon"
|
11023
|
+
}, [this.$slots.icon()]) : "", vue.createVNode("span", {
|
11024
|
+
"class": "bk-tag-text"
|
11025
|
+
}, [(_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)]), this.closable ? vue.createVNode(error, {
|
11026
|
+
"class": "bk-tag-close",
|
11027
|
+
"onClick": this.handleClose
|
11028
|
+
}, null) : ""]);
|
11029
|
+
}
|
11030
|
+
});
|
11031
|
+
const BkTag = withInstall(Component$b);
|
11032
|
+
var Component$a = vue.defineComponent({
|
10926
11033
|
name: "Select",
|
10927
11034
|
directives: {
|
10928
11035
|
clickoutside: ClickOutside
|
@@ -10930,43 +11037,84 @@ ${$(r2)}`), n2;
|
|
10930
11037
|
props: {
|
10931
11038
|
modelValue: PropTypes.any,
|
10932
11039
|
multiple: PropTypes.bool.def(false),
|
10933
|
-
placeholder: PropTypes.string.def("\u8BF7\u9009\u62E9"),
|
10934
11040
|
disabled: PropTypes.bool.def(false),
|
10935
|
-
size: PropTypes.size().def("
|
11041
|
+
size: PropTypes.size().def("default"),
|
10936
11042
|
clearable: PropTypes.bool.def(true),
|
10937
11043
|
loading: PropTypes.bool.def(false),
|
10938
11044
|
filterable: PropTypes.bool.def(false),
|
10939
11045
|
remoteMethod: PropTypes.func,
|
10940
|
-
scrollHeight: PropTypes.number.def(216)
|
11046
|
+
scrollHeight: PropTypes.number.def(216),
|
11047
|
+
showSelectAll: PropTypes.bool.def(false),
|
11048
|
+
popoverMinWidth: PropTypes.number.def(0),
|
11049
|
+
showOnInit: PropTypes.bool.def(false),
|
11050
|
+
multipleMode: PropTypes.oneOf(["default", "tag"]).def("default"),
|
11051
|
+
tagTheme: PropTypes.theme(["success", "info", "warning", "danger"]).def(""),
|
11052
|
+
behavior: PropTypes.oneOf(["normal", "simplicity"]).def("normal"),
|
11053
|
+
collapseTags: PropTypes.bool.def(false),
|
11054
|
+
noDataText: PropTypes.string.def("\u65E0\u6570\u636E"),
|
11055
|
+
noMatchText: PropTypes.string.def("\u65E0\u5339\u914D\u6570\u636E"),
|
11056
|
+
loadingText: PropTypes.string.def("\u52A0\u8F7D\u4E2D..."),
|
11057
|
+
placeholder: PropTypes.string.def("\u8BF7\u9009\u62E9"),
|
11058
|
+
selectAllText: PropTypes.string.def("\u5168\u90E8")
|
10941
11059
|
},
|
10942
|
-
emits: ["update:modelValue", "change", "toggle"],
|
11060
|
+
emits: ["update:modelValue", "change", "toggle", "clear"],
|
10943
11061
|
setup(props, {
|
10944
11062
|
emit
|
10945
11063
|
}) {
|
10946
11064
|
const {
|
10947
11065
|
modelValue,
|
10948
11066
|
disabled,
|
10949
|
-
size,
|
10950
11067
|
filterable,
|
10951
11068
|
placeholder,
|
10952
11069
|
multiple,
|
10953
11070
|
remoteMethod,
|
10954
|
-
loading: loading2
|
11071
|
+
loading: loading2,
|
11072
|
+
loadingText,
|
11073
|
+
noDataText,
|
11074
|
+
noMatchText,
|
11075
|
+
popoverMinWidth,
|
11076
|
+
showOnInit
|
10955
11077
|
} = vue.toRefs(props);
|
10956
11078
|
const states = vue.reactive({
|
10957
11079
|
currentPlaceholder: placeholder.value,
|
10958
|
-
options: /* @__PURE__ */ new Set(),
|
10959
11080
|
selectedOptions: /* @__PURE__ */ new Set(),
|
10960
11081
|
currentSelectedLabel: ""
|
10961
11082
|
});
|
10962
|
-
const selectTriggerRef = vue.ref();
|
10963
11083
|
const inputRef = vue.ref();
|
10964
|
-
const
|
10965
|
-
|
10966
|
-
|
10967
|
-
|
10968
|
-
|
10969
|
-
const
|
11084
|
+
const popoverRef = vue.ref();
|
11085
|
+
const options = vue.ref(/* @__PURE__ */ new Set());
|
11086
|
+
const groups = vue.ref(/* @__PURE__ */ new Set());
|
11087
|
+
const isDisabled = vue.computed(() => disabled.value || loading2.value);
|
11088
|
+
const selectedLabel = vue.computed(() => [...states.selectedOptions.values()].map((option) => option.label));
|
11089
|
+
const isAllSelected = vue.computed(() => [...options.value.values()].filter((option) => !option.disabled).every((option) => states.selectedOptions.has(option)));
|
11090
|
+
const isGroup = vue.computed(() => !!groups.value.size);
|
11091
|
+
const isOptionsEmpty = vue.computed(() => !options.value.size);
|
11092
|
+
const isSearchEmpty = vue.computed(() => {
|
11093
|
+
const data2 = [...options.value.values()];
|
11094
|
+
return data2.length && data2.every((option) => !option.visible);
|
11095
|
+
});
|
11096
|
+
const isRemoteSearch = vue.computed(() => typeof remoteMethod.value === "function");
|
11097
|
+
const isShowSelectContent = vue.computed(() => !(searchLoading.value || isOptionsEmpty.value || isSearchEmpty.value));
|
11098
|
+
const curContentText = vue.computed(() => {
|
11099
|
+
if (searchLoading.value) {
|
11100
|
+
return loadingText.value;
|
11101
|
+
}
|
11102
|
+
if (isOptionsEmpty.value) {
|
11103
|
+
return noDataText.value;
|
11104
|
+
}
|
11105
|
+
if (isSearchEmpty.value) {
|
11106
|
+
return noMatchText.value;
|
11107
|
+
}
|
11108
|
+
return "";
|
11109
|
+
});
|
11110
|
+
const {
|
11111
|
+
register,
|
11112
|
+
unregister
|
11113
|
+
} = useRegistry(options);
|
11114
|
+
const {
|
11115
|
+
register: registerGroup,
|
11116
|
+
unregister: unregisterGroup
|
11117
|
+
} = useRegistry(groups);
|
10970
11118
|
const {
|
10971
11119
|
isHover,
|
10972
11120
|
setHover,
|
@@ -10977,63 +11125,63 @@ ${$(r2)}`), n2;
|
|
10977
11125
|
handleFocus,
|
10978
11126
|
handleBlur
|
10979
11127
|
} = useFocus();
|
10980
|
-
const
|
10981
|
-
|
10982
|
-
|
10983
|
-
|
10984
|
-
|
10985
|
-
|
10986
|
-
|
10987
|
-
|
10988
|
-
|
10989
|
-
[size.value]: true
|
10990
|
-
}));
|
10991
|
-
const selectedLabel = vue.computed(() => [...states.selectedOptions.values()].map((option) => option.label).join(","));
|
10992
|
-
const popperWidth = vue.ref("auto");
|
10993
|
-
const onPopoverFirstUpdate = (instance) => {
|
10994
|
-
const {
|
10995
|
-
reference: reference2
|
10996
|
-
} = instance.elements;
|
10997
|
-
popperWidth.value = reference2.offsetWidth;
|
10998
|
-
};
|
10999
|
-
const isPopoverShow = vue.ref(false);
|
11000
|
-
const toggleMenu = () => {
|
11001
|
-
if (isDisabled.value)
|
11002
|
-
return;
|
11003
|
-
isPopoverShow.value = !isPopoverShow.value;
|
11004
|
-
emit("toggle", isPopoverShow.value);
|
11005
|
-
};
|
11006
|
-
const hidePopover = () => {
|
11007
|
-
isPopoverShow.value = false;
|
11008
|
-
handleBlur();
|
11009
|
-
};
|
11010
|
-
const showPopover = () => {
|
11011
|
-
isPopoverShow.value = true;
|
11012
|
-
};
|
11013
|
-
vue.watch(isPopoverShow, () => {
|
11014
|
-
handleResetState();
|
11128
|
+
const {
|
11129
|
+
popperWidth,
|
11130
|
+
isPopoverShow,
|
11131
|
+
onPopoverFirstUpdate,
|
11132
|
+
hidePopover,
|
11133
|
+
showPopover,
|
11134
|
+
togglePopover
|
11135
|
+
} = usePopover({
|
11136
|
+
popoverMinWidth: popoverMinWidth.value
|
11015
11137
|
});
|
11016
|
-
const
|
11017
|
-
|
11018
|
-
|
11019
|
-
|
11138
|
+
const defaultSearchMethod = (value) => {
|
11139
|
+
options.value.forEach((option) => {
|
11140
|
+
var _a;
|
11141
|
+
option.visible = (_a = toLowerCase(String(option.label))) == null ? void 0 : _a.includes(toLowerCase(value));
|
11142
|
+
});
|
11143
|
+
};
|
11144
|
+
const {
|
11145
|
+
searchKey,
|
11146
|
+
searchLoading
|
11147
|
+
} = useRemoteSearch(isRemoteSearch.value ? remoteMethod.value : defaultSearchMethod);
|
11148
|
+
const handleResetInputValue = () => {
|
11149
|
+
const label = selectedLabel.value.join(",");
|
11020
11150
|
if (filterable.value && isPopoverShow.value) {
|
11021
|
-
states.currentPlaceholder =
|
11151
|
+
states.currentPlaceholder = label || placeholder.value;
|
11022
11152
|
states.currentSelectedLabel = "";
|
11023
11153
|
} else {
|
11024
11154
|
states.currentPlaceholder = placeholder.value;
|
11025
|
-
states.currentSelectedLabel =
|
11155
|
+
states.currentSelectedLabel = label;
|
11156
|
+
searchKey.value = "";
|
11026
11157
|
}
|
11027
11158
|
};
|
11159
|
+
vue.watch(isPopoverShow, () => {
|
11160
|
+
handleResetInputValue();
|
11161
|
+
});
|
11028
11162
|
const emitChange = (val) => {
|
11029
11163
|
if (val === modelValue.value)
|
11030
11164
|
return;
|
11031
11165
|
emit("change", val);
|
11032
11166
|
emit("update:modelValue", val);
|
11033
11167
|
};
|
11034
|
-
const
|
11168
|
+
const handleTogglePopover = () => {
|
11035
11169
|
if (isDisabled.value)
|
11036
11170
|
return;
|
11171
|
+
togglePopover();
|
11172
|
+
emit("toggle", isPopoverShow.value);
|
11173
|
+
};
|
11174
|
+
const handleInput = (e) => {
|
11175
|
+
searchKey.value = e.target.value;
|
11176
|
+
};
|
11177
|
+
const selectedCallback = () => {
|
11178
|
+
inputRef.value.focus();
|
11179
|
+
popoverRef.value.update();
|
11180
|
+
!searchKey.value && handleResetInputValue();
|
11181
|
+
};
|
11182
|
+
const handleOptionSelected = (option) => {
|
11183
|
+
if (isDisabled.value || !option)
|
11184
|
+
return;
|
11037
11185
|
if (multiple.value) {
|
11038
11186
|
if (states.selectedOptions.has(option)) {
|
11039
11187
|
states.selectedOptions.delete(option);
|
@@ -11047,129 +11195,195 @@ ${$(r2)}`), n2;
|
|
11047
11195
|
emitChange(option.value);
|
11048
11196
|
hidePopover();
|
11049
11197
|
}
|
11050
|
-
|
11051
|
-
handleResetState();
|
11198
|
+
selectedCallback();
|
11052
11199
|
};
|
11053
11200
|
const handleClear = (e) => {
|
11054
11201
|
e.stopPropagation();
|
11055
11202
|
states.selectedOptions.clear();
|
11056
|
-
emitChange(multiple.value ? [] : "");
|
11057
11203
|
hidePopover();
|
11058
|
-
|
11204
|
+
handleResetInputValue();
|
11205
|
+
emitChange(multiple.value ? [] : "");
|
11206
|
+
emit("clear", multiple.value ? [] : "");
|
11059
11207
|
};
|
11060
|
-
const
|
11061
|
-
|
11062
|
-
|
11063
|
-
|
11064
|
-
|
11065
|
-
|
11066
|
-
|
11067
|
-
|
11068
|
-
|
11069
|
-
} catch (e) {
|
11070
|
-
console.error(e);
|
11071
|
-
} finally {
|
11072
|
-
searchLoading.value = false;
|
11208
|
+
const handleToggleAll = () => {
|
11209
|
+
if (isAllSelected.value) {
|
11210
|
+
states.selectedOptions.clear();
|
11211
|
+
} else {
|
11212
|
+
options.value.forEach((option) => {
|
11213
|
+
if (option.disabled || states.selectedOptions.has(option))
|
11214
|
+
return;
|
11215
|
+
states.selectedOptions.add(option);
|
11216
|
+
});
|
11073
11217
|
}
|
11074
|
-
|
11075
|
-
|
11218
|
+
selectedCallback();
|
11219
|
+
emitChange([...states.selectedOptions.values()].map((option) => option.value));
|
11220
|
+
};
|
11221
|
+
const handleClickOutside = () => {
|
11222
|
+
hidePopover();
|
11223
|
+
handleBlur();
|
11224
|
+
};
|
11076
11225
|
vue.provide(selectKey, vue.reactive({
|
11077
11226
|
props,
|
11078
|
-
searchKey,
|
11079
11227
|
selectedOptions: vue.unref(states.selectedOptions),
|
11080
|
-
isRemoteSearch,
|
11081
11228
|
register,
|
11082
11229
|
unregister,
|
11230
|
+
registerGroup,
|
11231
|
+
unregisterGroup,
|
11083
11232
|
handleOptionSelected
|
11084
11233
|
}));
|
11085
11234
|
vue.onMounted(() => {
|
11086
11235
|
const initializeValue = Array.isArray(modelValue.value) ? modelValue.value : [modelValue.value];
|
11087
|
-
|
11236
|
+
options.value.forEach((option) => {
|
11088
11237
|
if (initializeValue.includes(option.value)) {
|
11089
11238
|
states.selectedOptions.add(option);
|
11090
11239
|
}
|
11091
11240
|
});
|
11092
|
-
|
11241
|
+
handleResetInputValue();
|
11242
|
+
setTimeout(() => {
|
11243
|
+
showOnInit.value && showPopover();
|
11244
|
+
});
|
11093
11245
|
});
|
11094
11246
|
return __spreadProps(__spreadValues({}, vue.toRefs(states)), {
|
11247
|
+
options,
|
11248
|
+
isDisabled,
|
11095
11249
|
selectedLabel,
|
11096
|
-
selectClass,
|
11097
11250
|
isPopoverShow,
|
11098
11251
|
isHover,
|
11099
11252
|
popperWidth,
|
11100
|
-
|
11253
|
+
popoverRef,
|
11101
11254
|
inputRef,
|
11102
|
-
searchKey,
|
11103
11255
|
searchLoading,
|
11104
|
-
|
11256
|
+
isOptionsEmpty,
|
11257
|
+
isSearchEmpty,
|
11105
11258
|
isFocus,
|
11259
|
+
isShowSelectContent,
|
11260
|
+
curContentText,
|
11261
|
+
isGroup,
|
11262
|
+
searchKey,
|
11106
11263
|
setHover,
|
11107
11264
|
cancelHover,
|
11108
11265
|
handleFocus,
|
11109
11266
|
handleInput,
|
11110
|
-
|
11267
|
+
handleTogglePopover,
|
11111
11268
|
handleClear,
|
11112
11269
|
onPopoverFirstUpdate,
|
11113
11270
|
hidePopover,
|
11114
|
-
showPopover
|
11271
|
+
showPopover,
|
11272
|
+
handleToggleAll,
|
11273
|
+
handleOptionSelected,
|
11274
|
+
handleClickOutside
|
11115
11275
|
});
|
11116
11276
|
},
|
11117
11277
|
render() {
|
11278
|
+
const selectClass = classes({
|
11279
|
+
"bk-select": true,
|
11280
|
+
"popover-show": this.isPopoverShow,
|
11281
|
+
"is-disabled": this.isDisabled,
|
11282
|
+
"is-focus": this.isFocus,
|
11283
|
+
"is-filterable": this.filterable,
|
11284
|
+
[this.size]: true,
|
11285
|
+
[this.behavior]: true
|
11286
|
+
});
|
11118
11287
|
const modifiers = [{
|
11119
11288
|
name: "offset",
|
11120
11289
|
options: {
|
11121
11290
|
offset: [0, 4]
|
11122
11291
|
}
|
11123
11292
|
}];
|
11124
|
-
const
|
11125
|
-
|
11126
|
-
|
11127
|
-
|
11128
|
-
|
11129
|
-
|
11130
|
-
|
11131
|
-
|
11132
|
-
|
11133
|
-
|
11293
|
+
const renderSelectTrigger = () => {
|
11294
|
+
var _a, _b;
|
11295
|
+
const suffixIcon = () => {
|
11296
|
+
if (this.loading) {
|
11297
|
+
return vue.createVNode(BkLoading, {
|
11298
|
+
"class": "spinner",
|
11299
|
+
"mode": "spin",
|
11300
|
+
"size": "mini"
|
11301
|
+
}, null);
|
11302
|
+
}
|
11303
|
+
if (this.clearable && this.isHover) {
|
11304
|
+
return vue.createVNode(close$1, {
|
11305
|
+
"class": "clear-icon",
|
11306
|
+
"onClick": this.handleClear
|
11307
|
+
}, null);
|
11308
|
+
}
|
11309
|
+
return vue.createVNode(angleUp, {
|
11310
|
+
"class": "angle-up"
|
11134
11311
|
}, null);
|
11135
|
-
}
|
11136
|
-
|
11137
|
-
"
|
11138
|
-
|
11139
|
-
|
11140
|
-
|
11141
|
-
|
11142
|
-
|
11143
|
-
|
11144
|
-
|
11145
|
-
|
11146
|
-
|
11147
|
-
|
11148
|
-
|
11149
|
-
|
11150
|
-
|
11151
|
-
|
11152
|
-
|
11153
|
-
|
11312
|
+
};
|
11313
|
+
const renderTriggerInput = () => {
|
11314
|
+
if (this.multipleMode === "tag") {
|
11315
|
+
return vue.createVNode("div", {
|
11316
|
+
"class": "bk-select-tag"
|
11317
|
+
}, [[...this.selectedOptions.values()].map((option) => vue.createVNode(BkTag, {
|
11318
|
+
"closable": true,
|
11319
|
+
"style": {
|
11320
|
+
marginTop: "3px"
|
11321
|
+
},
|
11322
|
+
"theme": this.tagTheme,
|
11323
|
+
"onClose": () => this.handleOptionSelected(option)
|
11324
|
+
}, {
|
11325
|
+
default: () => [option.label]
|
11326
|
+
})), vue.withDirectives(vue.createVNode("input", {
|
11327
|
+
"class": "bk-select-tag-input",
|
11328
|
+
"ref": "inputRef",
|
11329
|
+
"type": "text",
|
11330
|
+
"placeholder": !this.selectedOptions.size ? this.placeholder : "",
|
11331
|
+
"readonly": !this.filterable || !this.isPopoverShow,
|
11332
|
+
"onUpdate:modelValue": ($event) => this.searchKey = $event,
|
11333
|
+
"onFocus": this.handleFocus
|
11334
|
+
}, null), [[vue.vModelText, this.searchKey]])]);
|
11335
|
+
}
|
11336
|
+
return vue.withDirectives(vue.createVNode("input", {
|
11337
|
+
"ref": "inputRef",
|
11338
|
+
"type": "text",
|
11339
|
+
"class": "bk-select-input",
|
11340
|
+
"style": {
|
11341
|
+
paddingLeft: this.$slots.prefixIcon ? "20px" : "10px"
|
11342
|
+
},
|
11343
|
+
"onUpdate:modelValue": ($event) => this.currentSelectedLabel = $event,
|
11344
|
+
"placeholder": this.currentPlaceholder,
|
11345
|
+
"readonly": !this.filterable || !this.isPopoverShow,
|
11346
|
+
"onFocus": this.handleFocus,
|
11347
|
+
"onInput": this.handleInput
|
11348
|
+
}, null), [[vue.vModelText, this.currentSelectedLabel]]);
|
11349
|
+
};
|
11350
|
+
return vue.createVNode("div", {
|
11351
|
+
"class": "bk-select-trigger",
|
11352
|
+
"onClick": this.handleTogglePopover,
|
11353
|
+
"onMouseenter": this.setHover,
|
11354
|
+
"onMouseleave": this.cancelHover
|
11355
|
+
}, [this.$slots.prefixIcon ? vue.createVNode("span", {
|
11356
|
+
"class": "bk-select-prefix"
|
11357
|
+
}, [(_b = (_a = this.$slots).prefixIcon) == null ? void 0 : _b.call(_a)]) : null, renderTriggerInput(), suffixIcon()]);
|
11154
11358
|
};
|
11155
11359
|
const renderSelectContent = () => {
|
11156
11360
|
var _a, _b;
|
11157
|
-
return vue.createVNode("div", null, [
|
11361
|
+
return vue.createVNode("div", null, [!this.isShowSelectContent && vue.createVNode("div", {
|
11362
|
+
"class": "bk-select-empty"
|
11363
|
+
}, [this.searchLoading && vue.createVNode(BkLoading, {
|
11364
|
+
"class": "mr5",
|
11365
|
+
"mode": "spin",
|
11366
|
+
"size": "mini"
|
11367
|
+
}, null), this.curContentText]), vue.createVNode("div", {
|
11158
11368
|
"class": "bk-select-content"
|
11159
11369
|
}, [vue.createVNode("div", {
|
11160
11370
|
"class": "bk-select-dropdown",
|
11161
11371
|
"style": {
|
11162
11372
|
maxHeight: `${this.scrollHeight}px`
|
11163
11373
|
}
|
11164
|
-
}, [vue.createVNode("ul", {
|
11374
|
+
}, [vue.withDirectives(vue.createVNode("ul", {
|
11165
11375
|
"class": "bk-select-options"
|
11166
|
-
}, [
|
11376
|
+
}, [this.multiple && this.showSelectAll && !this.searchKey && vue.createVNode("li", {
|
11377
|
+
"class": "bk-select-option",
|
11378
|
+
"onClick": this.handleToggleAll
|
11379
|
+
}, [this.selectAllText]), (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)]), [[vue.vShow, this.isShowSelectContent]])]), this.$slots.extension && vue.createVNode("div", {
|
11167
11380
|
"class": "bk-select-extension"
|
11168
|
-
}, [this.$slots.extension()])
|
11381
|
+
}, [this.$slots.extension()])])]);
|
11169
11382
|
};
|
11170
11383
|
return vue.withDirectives(vue.createVNode("div", {
|
11171
|
-
"class":
|
11384
|
+
"class": selectClass
|
11172
11385
|
}, [vue.createVNode(BkPopover, {
|
11386
|
+
"ref": "popoverRef",
|
11173
11387
|
"theme": "light",
|
11174
11388
|
"trigger": "manual",
|
11175
11389
|
"width": this.popperWidth,
|
@@ -11179,35 +11393,12 @@ ${$(r2)}`), n2;
|
|
11179
11393
|
"modifiers": modifiers,
|
11180
11394
|
"handleFirstUpdate": this.onPopoverFirstUpdate
|
11181
11395
|
}, {
|
11182
|
-
default: () =>
|
11183
|
-
var _a, _b;
|
11184
|
-
return vue.createVNode("div", {
|
11185
|
-
"class": "bk-select-trigger",
|
11186
|
-
"ref": "selectTriggerRef",
|
11187
|
-
"onClick": this.toggleMenu,
|
11188
|
-
"onMouseenter": this.setHover,
|
11189
|
-
"onMouseleave": this.cancelHover
|
11190
|
-
}, [this.$slots.prefixIcon ? vue.createVNode("span", {
|
11191
|
-
"class": "bk-select-prefix"
|
11192
|
-
}, [(_b = (_a = this.$slots).prefixIcon) == null ? void 0 : _b.call(_a)]) : null, vue.withDirectives(vue.createVNode("input", {
|
11193
|
-
"ref": "inputRef",
|
11194
|
-
"type": "text",
|
11195
|
-
"class": "bk-select-input",
|
11196
|
-
"style": {
|
11197
|
-
paddingLeft: this.$slots.prefixIcon ? "20px" : "10px"
|
11198
|
-
},
|
11199
|
-
"onUpdate:modelValue": ($event) => this.currentSelectedLabel = $event,
|
11200
|
-
"placeholder": this.currentPlaceholder,
|
11201
|
-
"readonly": !this.filterable || !this.isPopoverShow,
|
11202
|
-
"onFocus": this.handleFocus,
|
11203
|
-
"onInput": this.handleInput
|
11204
|
-
}, null), [[vue.vModelText, this.currentSelectedLabel]]), renderSelectRightIcon()]);
|
11205
|
-
},
|
11396
|
+
default: () => renderSelectTrigger(),
|
11206
11397
|
content: () => renderSelectContent()
|
11207
|
-
})]), [[vue.resolveDirective("clickoutside"), this.
|
11398
|
+
})]), [[vue.resolveDirective("clickoutside"), this.handleClickOutside]]);
|
11208
11399
|
}
|
11209
11400
|
});
|
11210
|
-
const BkSelect = withInstallProps(Component$
|
11401
|
+
const BkSelect = withInstallProps(Component$a, { Option: BkOption, Group: OptionGroup });
|
11211
11402
|
function _isSlot$1(s2) {
|
11212
11403
|
return typeof s2 === "function" || Object.prototype.toString.call(s2) === "[object Object]" && !vue.isVNode(s2);
|
11213
11404
|
}
|
@@ -11217,7 +11408,7 @@ ${$(r2)}`), n2;
|
|
11217
11408
|
const sliderPops = Object.assign({}, propsMixin);
|
11218
11409
|
sliderPops.width.default = "400";
|
11219
11410
|
sliderPops.height.default = "100%";
|
11220
|
-
var Component$
|
11411
|
+
var Component$9 = vue.defineComponent({
|
11221
11412
|
name: "Sideslider",
|
11222
11413
|
components: {
|
11223
11414
|
BkModal,
|
@@ -11274,7 +11465,7 @@ ${$(r2)}`), n2;
|
|
11274
11465
|
});
|
11275
11466
|
}
|
11276
11467
|
});
|
11277
|
-
const BkSideslider = withInstall(Component$
|
11468
|
+
const BkSideslider = withInstall(Component$9);
|
11278
11469
|
const stepsProps = {
|
11279
11470
|
theme: PropTypes.theme().def("primary"),
|
11280
11471
|
size: PropTypes.size(),
|
@@ -11288,7 +11479,7 @@ ${$(r2)}`), n2;
|
|
11288
11479
|
steps: PropTypes.array.def([]),
|
11289
11480
|
beforeChange: PropTypes.func
|
11290
11481
|
};
|
11291
|
-
var Component$
|
11482
|
+
var Component$8 = vue.defineComponent({
|
11292
11483
|
name: "Steps",
|
11293
11484
|
props: stepsProps,
|
11294
11485
|
emits: ["update:curStep", "click"],
|
@@ -11424,8 +11615,8 @@ ${$(r2)}`), n2;
|
|
11424
11615
|
})]);
|
11425
11616
|
}
|
11426
11617
|
});
|
11427
|
-
const BkSteps = withInstall(Component$
|
11428
|
-
var Component$
|
11618
|
+
const BkSteps = withInstall(Component$8);
|
11619
|
+
var Component$7 = vue.defineComponent({
|
11429
11620
|
name: "Switcher",
|
11430
11621
|
props: {
|
11431
11622
|
theme: PropTypes.theme().def(""),
|
@@ -11519,7 +11710,7 @@ ${$(r2)}`), n2;
|
|
11519
11710
|
}, [isChecked.value ? props.onText : props.offText]) : ""]);
|
11520
11711
|
}
|
11521
11712
|
});
|
11522
|
-
const BkSwitcher = withInstall(Component$
|
11713
|
+
const BkSwitcher = withInstall(Component$7);
|
11523
11714
|
const EventProps$1 = {
|
11524
11715
|
onContentScroll: Function
|
11525
11716
|
};
|
@@ -11623,7 +11814,7 @@ ${$(r2)}`), n2;
|
|
11623
11814
|
}
|
11624
11815
|
}
|
11625
11816
|
};
|
11626
|
-
var Component$
|
11817
|
+
var Component$6 = vue.defineComponent({
|
11627
11818
|
name: "VirtualRender",
|
11628
11819
|
directives: {
|
11629
11820
|
bkVirtualRender: virtualRender
|
@@ -11770,7 +11961,7 @@ ${$(r2)}`), n2;
|
|
11770
11961
|
};
|
11771
11962
|
}
|
11772
11963
|
});
|
11773
|
-
const BkVirtualRender = withInstall(Component$
|
11964
|
+
const BkVirtualRender = withInstall(Component$6);
|
11774
11965
|
const BORDER_OPRIONS = ["none", "row", "col", "outer"];
|
11775
11966
|
const EventProps = {
|
11776
11967
|
onRowClick: Function
|
@@ -11858,27 +12049,27 @@ ${$(r2)}`), n2;
|
|
11858
12049
|
const {
|
11859
12050
|
proxy
|
11860
12051
|
} = vue.getCurrentInstance();
|
11861
|
-
const localCurrent = vue.ref(
|
12052
|
+
const localCurrent = vue.ref(1);
|
11862
12053
|
const isPagePreDisabled = vue.computed(() => localCurrent.value === 1);
|
11863
|
-
const isPageNextDisabled = vue.computed(() => localCurrent.value === proxy.
|
12054
|
+
const isPageNextDisabled = vue.computed(() => localCurrent.value === proxy.totalPageNum);
|
11864
12055
|
const showPreBatch = vue.ref(false);
|
11865
12056
|
const showNextBatch = vue.ref(false);
|
11866
12057
|
const list = vue.computed(() => {
|
11867
12058
|
showPreBatch.value = false;
|
11868
12059
|
showNextBatch.value = false;
|
11869
12060
|
const stack = [];
|
11870
|
-
if (proxy.
|
11871
|
-
for (let i2 = 2; i2 <= proxy.
|
12061
|
+
if (proxy.totalPageNum <= PAGE_ITEMS_NUM) {
|
12062
|
+
for (let i2 = 2; i2 <= proxy.totalPageNum - 1; i2++) {
|
11872
12063
|
stack.push(i2);
|
11873
12064
|
}
|
11874
12065
|
return stack;
|
11875
12066
|
}
|
11876
12067
|
const pageItemsNumHalf = Math.floor(PAGE_ITEMS_NUM / 2);
|
11877
|
-
if (proxy.
|
12068
|
+
if (proxy.totalPageNum > PAGE_ITEMS_NUM) {
|
11878
12069
|
showPreBatch.value = localCurrent.value - pageItemsNumHalf > 2;
|
11879
|
-
showNextBatch.value = localCurrent.value + pageItemsNumHalf < proxy.
|
12070
|
+
showNextBatch.value = localCurrent.value + pageItemsNumHalf < proxy.totalPageNum - 1;
|
11880
12071
|
}
|
11881
|
-
const start2 = Math.min(proxy.
|
12072
|
+
const start2 = Math.min(proxy.totalPageNum - PAGE_ITEMS_NUM, Math.max(2, localCurrent.value - pageItemsNumHalf));
|
11882
12073
|
for (let i2 = start2; i2 < start2 + PAGE_ITEMS_NUM; i2++) {
|
11883
12074
|
stack.push(i2);
|
11884
12075
|
}
|
@@ -11886,19 +12077,19 @@ ${$(r2)}`), n2;
|
|
11886
12077
|
});
|
11887
12078
|
vue.watch(() => proxy.modelValue, (modelValue) => {
|
11888
12079
|
vue.nextTick(() => {
|
11889
|
-
if (modelValue >= 1 && modelValue <= proxy.
|
12080
|
+
if (modelValue >= 1 && modelValue <= proxy.totalPageNum) {
|
11890
12081
|
localCurrent.value = modelValue;
|
11891
12082
|
} else if (modelValue < 1) {
|
11892
12083
|
localCurrent.value = 1;
|
11893
12084
|
} else {
|
11894
|
-
localCurrent.value = proxy.
|
12085
|
+
localCurrent.value = proxy.totalPageNum;
|
11895
12086
|
}
|
11896
12087
|
});
|
11897
12088
|
});
|
11898
12089
|
vue.nextTick(() => {
|
11899
|
-
vue.watch(() => proxy.
|
11900
|
-
if (localCurrent.value >
|
11901
|
-
localCurrent.value =
|
12090
|
+
vue.watch(() => proxy.totalPageNum, (totalPageNum) => {
|
12091
|
+
if (localCurrent.value > totalPageNum) {
|
12092
|
+
localCurrent.value = totalPageNum;
|
11902
12093
|
}
|
11903
12094
|
});
|
11904
12095
|
});
|
@@ -11914,17 +12105,17 @@ ${$(r2)}`), n2;
|
|
11914
12105
|
}
|
11915
12106
|
localCurrent.value = localCurrent.value + 1;
|
11916
12107
|
};
|
11917
|
-
const handleItemClick = (
|
11918
|
-
if (
|
12108
|
+
const handleItemClick = (totalPageNum) => {
|
12109
|
+
if (totalPageNum === localCurrent.value) {
|
11919
12110
|
return;
|
11920
12111
|
}
|
11921
|
-
localCurrent.value =
|
12112
|
+
localCurrent.value = totalPageNum;
|
11922
12113
|
};
|
11923
12114
|
const handlePreBatch = () => {
|
11924
12115
|
localCurrent.value = Math.max(1, localCurrent.value - PAGE_ITEMS_NUM);
|
11925
12116
|
};
|
11926
12117
|
const handleNextBatch = () => {
|
11927
|
-
localCurrent.value = Math.min(proxy.
|
12118
|
+
localCurrent.value = Math.min(proxy.totalPageNum, localCurrent.value + PAGE_ITEMS_NUM);
|
11928
12119
|
};
|
11929
12120
|
const render = ({
|
11930
12121
|
isFirst,
|
@@ -11963,14 +12154,14 @@ ${$(r2)}`), n2;
|
|
11963
12154
|
"key": "next-batch",
|
11964
12155
|
"class": "bk-pagination-list-next-batch",
|
11965
12156
|
"onClick": handleNextBatch
|
11966
|
-
}, [vue.createVNode(ellipsis, null, null)]), proxy.
|
12157
|
+
}, [vue.createVNode(ellipsis, null, null)]), proxy.totalPageNum > 1 && vue.createVNode("div", {
|
11967
12158
|
"class": {
|
11968
12159
|
"bk-pagination-list-item": true,
|
11969
|
-
"is-active": localCurrent.value === proxy.
|
12160
|
+
"is-active": localCurrent.value === proxy.totalPageNum
|
11970
12161
|
},
|
11971
12162
|
"key": "last",
|
11972
|
-
"onClick": () => handleItemClick(proxy.
|
11973
|
-
}, [proxy.
|
12163
|
+
"onClick": () => handleItemClick(proxy.totalPageNum)
|
12164
|
+
}, [proxy.totalPageNum]), vue.createVNode("div", {
|
11974
12165
|
"class": {
|
11975
12166
|
"bk-pagination-list-pre": true,
|
11976
12167
|
"is-disabled": isPageNextDisabled.value
|
@@ -11990,23 +12181,23 @@ ${$(r2)}`), n2;
|
|
11990
12181
|
const isFocused = vue.ref(false);
|
11991
12182
|
const localCurrent = vue.ref(1);
|
11992
12183
|
const isPagePreDisabled = vue.computed(() => localCurrent.value === 1);
|
11993
|
-
const isPageNextDisabled = vue.computed(() => localCurrent.value === proxy.
|
12184
|
+
const isPageNextDisabled = vue.computed(() => localCurrent.value === proxy.totalPageNum);
|
11994
12185
|
let inputMemo = 0;
|
11995
12186
|
const list = vue.computed(() => {
|
11996
12187
|
const stack = [];
|
11997
|
-
for (let i2 = 1; i2 <= proxy.
|
12188
|
+
for (let i2 = 1; i2 <= proxy.totalPageNum; i2++) {
|
11998
12189
|
stack.push(i2);
|
11999
12190
|
}
|
12000
12191
|
return stack;
|
12001
12192
|
});
|
12002
12193
|
vue.watch(() => proxy.modelValue, (modelValue) => {
|
12003
12194
|
vue.nextTick(() => {
|
12004
|
-
if (modelValue >= 1 && modelValue <= proxy.
|
12195
|
+
if (modelValue >= 1 && modelValue <= proxy.totalPageNum) {
|
12005
12196
|
localCurrent.value = modelValue;
|
12006
12197
|
} else if (modelValue < 1) {
|
12007
12198
|
localCurrent.value = 1;
|
12008
12199
|
} else {
|
12009
|
-
localCurrent.value = proxy.
|
12200
|
+
localCurrent.value = proxy.totalPageNum;
|
12010
12201
|
}
|
12011
12202
|
inputMemo = localCurrent.value;
|
12012
12203
|
});
|
@@ -12014,9 +12205,9 @@ ${$(r2)}`), n2;
|
|
12014
12205
|
immediate: true
|
12015
12206
|
});
|
12016
12207
|
vue.nextTick(() => {
|
12017
|
-
vue.watch(() => proxy.
|
12018
|
-
if (localCurrent.value >
|
12019
|
-
localCurrent.value =
|
12208
|
+
vue.watch(() => proxy.totalPageNum, (totalPageNum) => {
|
12209
|
+
if (localCurrent.value > totalPageNum) {
|
12210
|
+
localCurrent.value = totalPageNum;
|
12020
12211
|
}
|
12021
12212
|
});
|
12022
12213
|
});
|
@@ -12053,7 +12244,7 @@ ${$(r2)}`), n2;
|
|
12053
12244
|
const handlePageEditorInput = (event) => {
|
12054
12245
|
const $target = event.target;
|
12055
12246
|
const value = Number($target.textContent);
|
12056
|
-
if (!value || value < 1 || value > proxy.
|
12247
|
+
if (!value || value < 1 || value > proxy.totalPageNum || value === localCurrent.value) {
|
12057
12248
|
return;
|
12058
12249
|
}
|
12059
12250
|
inputMemo = value;
|
@@ -12101,7 +12292,7 @@ ${$(r2)}`), n2;
|
|
12101
12292
|
"onKeydown": handlePageEditorKeydown
|
12102
12293
|
}, [localCurrent.value]), vue.createVNode("span", null, [vue.createTextVNode("/")]), vue.createVNode("span", {
|
12103
12294
|
"class": "bk-pagination-small-list-total"
|
12104
|
-
}, [proxy.
|
12295
|
+
}, [proxy.totalPageNum])]),
|
12105
12296
|
content: () => vue.createVNode("div", {
|
12106
12297
|
"class": "bk-pagination-picker-list"
|
12107
12298
|
}, [list.value.map((item) => vue.createVNode("div", {
|
@@ -12170,12 +12361,12 @@ ${$(r2)}`), n2;
|
|
12170
12361
|
return value.some((item) => layoutNameMap[item]);
|
12171
12362
|
}, "layout \u7684\u503C\u53EA\u652F\u6301 * total\u3001list\u3001limit *").def(["total", "list", "limit"])
|
12172
12363
|
};
|
12173
|
-
var Component$
|
12364
|
+
var Component$5 = vue.defineComponent({
|
12174
12365
|
name: "Pagination",
|
12175
12366
|
props: paginationProps,
|
12176
12367
|
emits: ["update:modelValue", "change", "update:limit", "limit-change"],
|
12177
12368
|
setup(props, context) {
|
12178
|
-
const
|
12369
|
+
const totalPageNum = vue.ref(0);
|
12179
12370
|
const {
|
12180
12371
|
count,
|
12181
12372
|
limit
|
@@ -12194,7 +12385,8 @@ ${$(r2)}`), n2;
|
|
12194
12385
|
render: renderLimit
|
12195
12386
|
} = useLimit();
|
12196
12387
|
vue.watch([count, localLimit, limit], ([count2, localLimit2]) => {
|
12197
|
-
|
12388
|
+
const total = Math.ceil(count2 / localLimit2);
|
12389
|
+
totalPageNum.value = total < 1 ? 1 : total;
|
12198
12390
|
}, {
|
12199
12391
|
immediate: true
|
12200
12392
|
});
|
@@ -12210,7 +12402,7 @@ ${$(r2)}`), n2;
|
|
12210
12402
|
context.emit("limit-change", localLimit2);
|
12211
12403
|
});
|
12212
12404
|
return {
|
12213
|
-
|
12405
|
+
totalPageNum,
|
12214
12406
|
renderTotal,
|
12215
12407
|
renderList,
|
12216
12408
|
renderLimit,
|
@@ -12225,7 +12417,7 @@ ${$(r2)}`), n2;
|
|
12225
12417
|
});
|
12226
12418
|
const layoutMap = {
|
12227
12419
|
total: this.renderTotal,
|
12228
|
-
list: this.renderList,
|
12420
|
+
list: this.small ? this.renderSmallList : this.renderList,
|
12229
12421
|
limit: this.renderLimit
|
12230
12422
|
};
|
12231
12423
|
return vue.createVNode("div", {
|
@@ -12233,10 +12425,10 @@ ${$(r2)}`), n2;
|
|
12233
12425
|
}, [this.layout.map((layout, index) => layoutMap[layout]({
|
12234
12426
|
isFirst: index === 0,
|
12235
12427
|
isLast: index === this.layout.length - 1
|
12236
|
-
}))
|
12428
|
+
}))]);
|
12237
12429
|
}
|
12238
12430
|
});
|
12239
|
-
const BkPagination = withInstall(Component$
|
12431
|
+
const BkPagination = withInstall(Component$5);
|
12240
12432
|
class TablePlugins {
|
12241
12433
|
constructor(props, ctx) {
|
12242
12434
|
__publicField(this, "props", null);
|
@@ -12501,7 +12693,7 @@ ${$(r2)}`), n2;
|
|
12501
12693
|
})]);
|
12502
12694
|
}
|
12503
12695
|
}
|
12504
|
-
var Component$
|
12696
|
+
var Component$4 = vue.defineComponent({
|
12505
12697
|
name: "Table",
|
12506
12698
|
props: tableProps,
|
12507
12699
|
emits: ["column-pick", "row-click", "page-limit-change", "page-value-change"],
|
@@ -12636,68 +12828,940 @@ ${$(r2)}`), n2;
|
|
12636
12828
|
}, [props.pagination && tableRender.renderTableFooter(localPagination.value)])]);
|
12637
12829
|
}
|
12638
12830
|
});
|
12639
|
-
const BkTable = withInstall(Component$
|
12640
|
-
|
12641
|
-
|
12642
|
-
|
12643
|
-
|
12644
|
-
|
12645
|
-
|
12646
|
-
|
12647
|
-
|
12648
|
-
|
12649
|
-
|
12831
|
+
const BkTable = withInstall(Component$4);
|
12832
|
+
const INPUT_MIN_WIDTH = 12;
|
12833
|
+
function useDebouncedRef(value, delay = 200) {
|
12834
|
+
let timeout;
|
12835
|
+
let innerValue = value;
|
12836
|
+
return vue.customRef((track, trigger) => ({
|
12837
|
+
get() {
|
12838
|
+
track();
|
12839
|
+
return innerValue;
|
12840
|
+
},
|
12841
|
+
set(newValue) {
|
12842
|
+
clearTimeout(timeout);
|
12843
|
+
timeout = setTimeout(() => {
|
12844
|
+
innerValue = newValue;
|
12845
|
+
trigger();
|
12846
|
+
}, delay);
|
12847
|
+
}
|
12848
|
+
}));
|
12849
|
+
}
|
12850
|
+
function usePage(pageSize) {
|
12851
|
+
const state = vue.reactive({
|
12852
|
+
curPage: 1,
|
12853
|
+
totalSize: 0,
|
12854
|
+
totalPage: 0,
|
12855
|
+
pageSize,
|
12856
|
+
isPageLoading: false,
|
12857
|
+
curPageList: [],
|
12858
|
+
renderListPaged: []
|
12859
|
+
});
|
12860
|
+
const initPage = (allList = []) => {
|
12861
|
+
state.curPage = 1;
|
12862
|
+
state.totalSize = allList.length;
|
12863
|
+
state.totalPage = Math.ceil(state.totalSize / state.pageSize) || 1;
|
12864
|
+
const list = [];
|
12865
|
+
if (state.pageSize > 0) {
|
12866
|
+
for (let i2 = 0; i2 < state.totalSize; i2 += state.pageSize) {
|
12867
|
+
list.push(allList.slice(i2, i2 + state.pageSize));
|
12868
|
+
}
|
12869
|
+
}
|
12870
|
+
state.renderListPaged.splice(0, state.renderListPaged.length, ...list);
|
12871
|
+
state.curPageList.splice(0, state.curPageList.length, ...state.renderListPaged[state.curPage - 1] || []);
|
12872
|
+
};
|
12873
|
+
const pageChange = (page) => {
|
12874
|
+
state.curPage = page;
|
12875
|
+
state.curPageList.splice(state.curPageList.length, 0, ...state.renderListPaged[state.curPage - 1] || []);
|
12876
|
+
state.isPageLoading = false;
|
12877
|
+
};
|
12878
|
+
return {
|
12879
|
+
pageState: state,
|
12880
|
+
initPage,
|
12881
|
+
pageChange
|
12882
|
+
};
|
12883
|
+
}
|
12884
|
+
function useFlatList(props) {
|
12885
|
+
const {
|
12886
|
+
useGroup,
|
12887
|
+
saveKey,
|
12888
|
+
displayKey,
|
12889
|
+
list
|
12890
|
+
} = vue.toRefs(props);
|
12891
|
+
const flatList = vue.reactive([]);
|
12892
|
+
vue.watch([useGroup, saveKey, displayKey, list], () => {
|
12893
|
+
let formatList = list.value;
|
12894
|
+
if (useGroup.value) {
|
12895
|
+
formatList = list.value.reduce((formatList2, item) => {
|
12896
|
+
let children = [];
|
12897
|
+
if (item.children) {
|
12898
|
+
children = item.children.map((child) => __spreadValues({
|
12899
|
+
group: {
|
12900
|
+
groupId: item[saveKey.value],
|
12901
|
+
groupName: item[displayKey.value]
|
12902
|
+
}
|
12903
|
+
}, child));
|
12904
|
+
}
|
12905
|
+
return formatList2.concat(children);
|
12906
|
+
}, []);
|
12907
|
+
}
|
12908
|
+
flatList.splice(0, flatList.length, ...formatList);
|
12909
|
+
}, { immediate: true, deep: true });
|
12910
|
+
return flatList;
|
12911
|
+
}
|
12912
|
+
const getCharLength = (str) => {
|
12913
|
+
const len = str.length;
|
12914
|
+
let bitLen = 0;
|
12915
|
+
for (let i2 = 0; i2 < len; i2++) {
|
12916
|
+
if ((str.charCodeAt(i2) & 65280) !== 0) {
|
12917
|
+
bitLen += 1;
|
12918
|
+
}
|
12919
|
+
bitLen += 1;
|
12920
|
+
}
|
12921
|
+
return bitLen;
|
12922
|
+
};
|
12923
|
+
var ListTagRender = vue.defineComponent({
|
12924
|
+
name: "ListTagRender",
|
12925
|
+
props: {
|
12926
|
+
node: PropTypes.object,
|
12927
|
+
searchKey: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
12928
|
+
displayKey: PropTypes.string,
|
12929
|
+
searchKeyword: PropTypes.string,
|
12930
|
+
tpl: {
|
12931
|
+
type: Function,
|
12932
|
+
default: null
|
12933
|
+
}
|
12934
|
+
},
|
12935
|
+
render() {
|
12936
|
+
const highlightKeyword = (value) => {
|
12937
|
+
if (this.searchKeyword) {
|
12938
|
+
const keywordReg = new RegExp(`(${this.searchKeyword})`, "i");
|
12939
|
+
return value.replace(keywordReg, '<strong class="highlight-text">$1</strong>');
|
12940
|
+
}
|
12941
|
+
return value;
|
12942
|
+
};
|
12943
|
+
if (this.tpl) {
|
12944
|
+
return this.tpl(this.node, highlightKeyword, vue.h, this);
|
12945
|
+
}
|
12946
|
+
const displayText = this.node[this.displayKey];
|
12947
|
+
return vue.createVNode("div", {
|
12948
|
+
"class": "bk-selector-node"
|
12949
|
+
}, [vue.createVNode("span", {
|
12950
|
+
"class": "text",
|
12951
|
+
"innerHTML": highlightKeyword(displayText)
|
12952
|
+
}, [displayText])]);
|
12953
|
+
}
|
12954
|
+
});
|
12955
|
+
const tagProps = () => ({
|
12956
|
+
modelValue: PropTypes.arrayOf(PropTypes.string).def([]),
|
12957
|
+
placeholder: PropTypes.string.def("\u8BF7\u8F93\u5165\u5E76\u6309 Enter \u7ED3\u675F"),
|
12958
|
+
list: PropTypes.arrayOf(PropTypes.object).def([]),
|
12959
|
+
disabled: PropTypes.bool.def(false),
|
12960
|
+
tooltipKey: PropTypes.string.def(""),
|
12961
|
+
saveKey: PropTypes.string.def("id"),
|
12962
|
+
displayKey: PropTypes.string.def("name"),
|
12963
|
+
hasDeleteIcon: PropTypes.bool.def(false),
|
12964
|
+
clearable: PropTypes.bool.def(true),
|
12965
|
+
trigger: PropTypes.commonType(["focus", "search"]).def("search"),
|
12966
|
+
searchKey: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]).def("name"),
|
12967
|
+
useGroup: PropTypes.bool.def(false),
|
12968
|
+
allowCreate: PropTypes.bool.def(false),
|
12969
|
+
maxData: PropTypes.number.def(-1),
|
12970
|
+
maxResult: PropTypes.number.def(10),
|
12971
|
+
contentMaxHeight: PropTypes.number.def(300),
|
12972
|
+
contentWidth: PropTypes.number.def(190),
|
12973
|
+
separator: PropTypes.string.def(""),
|
12974
|
+
allowNextFocus: PropTypes.bool.def(true),
|
12975
|
+
allowAutoMatch: PropTypes.bool.def(false),
|
12976
|
+
showClearOnlyHover: PropTypes.bool.def(false),
|
12977
|
+
leftSpace: PropTypes.number.def(0),
|
12978
|
+
createTagValidator: {
|
12979
|
+
type: Function,
|
12980
|
+
default: null
|
12981
|
+
},
|
12982
|
+
filterCallback: {
|
12983
|
+
type: Function,
|
12984
|
+
default: null
|
12985
|
+
},
|
12986
|
+
tagTpl: {
|
12987
|
+
type: Function,
|
12988
|
+
default: null
|
12989
|
+
},
|
12990
|
+
tpl: {
|
12991
|
+
type: Function,
|
12992
|
+
default: null
|
12993
|
+
},
|
12994
|
+
pasteFn: {
|
12995
|
+
type: Function,
|
12996
|
+
default: null
|
12997
|
+
}
|
12998
|
+
});
|
12999
|
+
var TagRender = vue.defineComponent({
|
13000
|
+
name: "TagRender",
|
13001
|
+
props: {
|
13002
|
+
node: PropTypes.object,
|
13003
|
+
displayKey: PropTypes.string,
|
13004
|
+
tpl: {
|
13005
|
+
type: Function,
|
13006
|
+
default: null
|
13007
|
+
}
|
13008
|
+
},
|
13009
|
+
render() {
|
13010
|
+
if (this.tpl) {
|
13011
|
+
return this.tpl(this.node, vue.h, this);
|
13012
|
+
}
|
13013
|
+
return vue.createVNode("div", {
|
13014
|
+
"class": "tag"
|
13015
|
+
}, [vue.createVNode("span", {
|
13016
|
+
"class": "text"
|
13017
|
+
}, [this.node[this.displayKey]])]);
|
13018
|
+
}
|
13019
|
+
});
|
13020
|
+
var TagInput = vue.defineComponent({
|
13021
|
+
name: "BkTagInput",
|
13022
|
+
directives: {
|
13023
|
+
bkTooltips: tooltips
|
12650
13024
|
},
|
12651
|
-
|
12652
|
-
|
13025
|
+
props: tagProps(),
|
13026
|
+
emits: ["update:modelValue", "change", "select", "blur", "remove", "removeAll"],
|
12653
13027
|
setup(props, {
|
12654
13028
|
emit
|
12655
13029
|
}) {
|
12656
|
-
const
|
12657
|
-
|
12658
|
-
|
12659
|
-
|
12660
|
-
|
12661
|
-
|
12662
|
-
|
12663
|
-
|
12664
|
-
|
12665
|
-
|
13030
|
+
const state = vue.reactive({
|
13031
|
+
isEdit: false,
|
13032
|
+
isHover: false,
|
13033
|
+
focusItemIndex: props.allowCreate ? -1 : 0
|
13034
|
+
});
|
13035
|
+
const popoverProps = vue.reactive({
|
13036
|
+
isShow: false,
|
13037
|
+
width: 190,
|
13038
|
+
modifiers: [{
|
13039
|
+
name: "offset",
|
13040
|
+
options: {
|
13041
|
+
offset: [0, 4]
|
13042
|
+
}
|
13043
|
+
}]
|
13044
|
+
});
|
13045
|
+
const {
|
13046
|
+
maxResult
|
13047
|
+
} = vue.toRefs(props);
|
13048
|
+
const {
|
13049
|
+
pageState,
|
13050
|
+
initPage,
|
13051
|
+
pageChange
|
13052
|
+
} = usePage(maxResult);
|
13053
|
+
const curInputValue = useDebouncedRef("", 150);
|
13054
|
+
const tagInputRef = vue.ref(null);
|
13055
|
+
const bkTagSelectorRef = vue.ref(null);
|
13056
|
+
const tagListRef = vue.ref(null);
|
13057
|
+
const tagInputItemRef = vue.ref(null);
|
13058
|
+
const selectorListRef = vue.ref(null);
|
13059
|
+
const popoverRef = vue.ref(null);
|
13060
|
+
const timer = vue.ref(null);
|
13061
|
+
const showTagClose = vue.computed(() => !props.disabled && props.hasDeleteIcon);
|
13062
|
+
const isSingleSelect = vue.computed(() => props.maxData === 1);
|
13063
|
+
const isShowPlaceholder = vue.computed(() => listState.selectedTagList.length === 0 && curInputValue.value === "" && !state.isEdit);
|
13064
|
+
const isShowClear = vue.computed(() => props.clearable && !props.disabled && listState.selectedTagList.length !== 0 && (props.showClearOnlyHover ? state.isHover : true));
|
13065
|
+
const triggerClass = vue.computed(() => ({
|
13066
|
+
"bk-tag-input-trigger": true,
|
13067
|
+
active: state.isEdit,
|
13068
|
+
disabled: props.disabled
|
12666
13069
|
}));
|
12667
|
-
|
12668
|
-
|
13070
|
+
vue.watch([() => [...props.modelValue], () => [...props.list]], () => {
|
13071
|
+
initData();
|
13072
|
+
});
|
13073
|
+
vue.watch(curInputValue, (value) => {
|
13074
|
+
const hasShowCount = pageState.curPageList.length !== 0;
|
13075
|
+
if (value !== "" && hasShowCount || value === "" && props.trigger === "focus") {
|
13076
|
+
popoverProps.isShow = true;
|
13077
|
+
} else if (props.trigger !== "focus" || !hasShowCount) {
|
13078
|
+
popoverProps.isShow = false;
|
13079
|
+
}
|
13080
|
+
});
|
13081
|
+
vue.watch(() => popoverProps.isShow, (show) => {
|
13082
|
+
changePopoverOffset();
|
13083
|
+
if (show) {
|
13084
|
+
if (selectorListRef.value) {
|
13085
|
+
vue.nextTick(() => {
|
13086
|
+
selectorListRef.value.scrollTop = 0;
|
13087
|
+
});
|
13088
|
+
selectorListRef.value.removeEventListener("scroll", scrollHandler);
|
13089
|
+
selectorListRef.value.addEventListener("scroll", scrollHandler);
|
13090
|
+
}
|
13091
|
+
}
|
13092
|
+
});
|
13093
|
+
const changePopoverOffset = () => {
|
13094
|
+
var _a, _b;
|
13095
|
+
const left2 = isSingleSelect.value ? 0 : (_a = tagInputItemRef.value) == null ? void 0 : _a.offsetLeft;
|
13096
|
+
popoverProps.modifiers = [{
|
13097
|
+
name: "offset",
|
13098
|
+
options: {
|
13099
|
+
offset: [left2, 4]
|
13100
|
+
}
|
13101
|
+
}];
|
13102
|
+
(_b = popoverRef.value) == null ? void 0 : _b.update();
|
13103
|
+
};
|
13104
|
+
const scrollHandler = () => {
|
13105
|
+
if (pageState.isPageLoading || selectorListRef.value.scrollTop === 0) {
|
13106
|
+
return;
|
13107
|
+
}
|
13108
|
+
const {
|
13109
|
+
scrollTop,
|
13110
|
+
offsetHeight,
|
13111
|
+
scrollHeight
|
13112
|
+
} = selectorListRef.value;
|
13113
|
+
if (scrollTop + offsetHeight >= scrollHeight) {
|
13114
|
+
const curPage = pageState.curPage + 1;
|
13115
|
+
if (curPage <= pageState.totalPage) {
|
13116
|
+
pageState.isPageLoading = true;
|
13117
|
+
setTimeout(() => {
|
13118
|
+
pageChange(curPage);
|
13119
|
+
}, 500);
|
13120
|
+
}
|
13121
|
+
}
|
13122
|
+
};
|
13123
|
+
const getSelectedTagNodes = () => {
|
13124
|
+
var _a;
|
13125
|
+
const nodes = Array.from(((_a = tagListRef.value) == null ? void 0 : _a.childNodes) || []);
|
13126
|
+
return nodes.filter((node) => node.nodeType !== Node.TEXT_NODE);
|
13127
|
+
};
|
13128
|
+
const focusInputTrigger = (e) => {
|
13129
|
+
if (props.disabled)
|
13130
|
+
return;
|
13131
|
+
if (e == null ? void 0 : e.target) {
|
13132
|
+
const {
|
13133
|
+
className
|
13134
|
+
} = e.target;
|
13135
|
+
if (className.indexOf("bk-tag-input-trigger") > -1 || className.indexOf("tag-list") > -1) {
|
13136
|
+
tagListRef.value.appendChild(tagInputItemRef.value);
|
13137
|
+
}
|
13138
|
+
}
|
13139
|
+
clearTimeout(timer.value);
|
13140
|
+
if (isSingleSelect.value && tagList.value.length) {
|
13141
|
+
listState.tagListCache = [...tagList.value];
|
13142
|
+
listState.selectedTagListCache = [...listState.selectedTagList];
|
13143
|
+
curInputValue.value = listState.selectedTagListCache[0][props.saveKey];
|
13144
|
+
removeTag(listState.selectedTagList[0], 0);
|
13145
|
+
handleInput();
|
13146
|
+
}
|
13147
|
+
state.isEdit = true;
|
13148
|
+
vue.nextTick(() => {
|
13149
|
+
var _a;
|
13150
|
+
(_a = tagInputRef.value) == null ? void 0 : _a.focus();
|
13151
|
+
if (props.trigger === "focus" && listState.localList.length !== 0) {
|
13152
|
+
filterData();
|
13153
|
+
if (popoverProps.isShow) {
|
13154
|
+
changePopoverOffset();
|
13155
|
+
} else {
|
13156
|
+
popoverProps.isShow = true;
|
13157
|
+
}
|
13158
|
+
}
|
13159
|
+
});
|
13160
|
+
};
|
13161
|
+
const listState = vue.reactive({
|
13162
|
+
localList: [],
|
13163
|
+
tagListCache: [],
|
13164
|
+
selectedTagList: [],
|
13165
|
+
selectedTagListCache: []
|
13166
|
+
});
|
13167
|
+
const tagList = vue.computed(() => listState.selectedTagList.map((tag2) => tag2[props.saveKey]));
|
13168
|
+
const formatList = useFlatList(props);
|
13169
|
+
const renderList = vue.computed(() => {
|
13170
|
+
if (props.useGroup) {
|
13171
|
+
const groupMap = {};
|
13172
|
+
pageState.curPageList.forEach((item, index) => {
|
13173
|
+
item.__index__ = index;
|
13174
|
+
if (!groupMap[item.group.groupId]) {
|
13175
|
+
groupMap[item.group.groupId] = {
|
13176
|
+
id: item.group.groupId,
|
13177
|
+
name: item.group.groupName,
|
13178
|
+
children: []
|
13179
|
+
};
|
13180
|
+
}
|
13181
|
+
groupMap[item.group.groupId].children.push(item);
|
13182
|
+
});
|
13183
|
+
return Object.keys(groupMap).map((key) => groupMap[key]);
|
13184
|
+
}
|
13185
|
+
return pageState.curPageList;
|
13186
|
+
});
|
13187
|
+
const initData = () => {
|
13188
|
+
const {
|
13189
|
+
saveKey,
|
13190
|
+
modelValue,
|
13191
|
+
displayKey,
|
13192
|
+
allowCreate,
|
13193
|
+
trigger
|
13194
|
+
} = props;
|
13195
|
+
listState.selectedTagList = [];
|
13196
|
+
listState.localList = [...formatList];
|
13197
|
+
if (modelValue.length) {
|
13198
|
+
modelValue.forEach((tag2) => {
|
13199
|
+
const value = listState.localList.find((val) => tag2 === val[saveKey]);
|
13200
|
+
if (value !== void 0) {
|
13201
|
+
listState.selectedTagList.push(value);
|
13202
|
+
} else if (allowCreate && !tagList.value.includes(tag2)) {
|
13203
|
+
listState.selectedTagList.push({
|
13204
|
+
[saveKey]: tag2,
|
13205
|
+
[displayKey]: tag2
|
13206
|
+
});
|
13207
|
+
}
|
13208
|
+
});
|
13209
|
+
if (!isSingleSelect.value) {
|
13210
|
+
listState.localList = listState.localList.filter((val) => !modelValue.includes(val[saveKey]));
|
13211
|
+
}
|
13212
|
+
}
|
13213
|
+
if (trigger === "focus") {
|
13214
|
+
filterData();
|
13215
|
+
}
|
13216
|
+
};
|
13217
|
+
const filterData = (value = "") => {
|
13218
|
+
const {
|
13219
|
+
searchKey,
|
13220
|
+
filterCallback
|
13221
|
+
} = props;
|
13222
|
+
const lowerCaseValue = value.toLowerCase();
|
13223
|
+
let filterData2 = [];
|
13224
|
+
if (typeof filterCallback === "function") {
|
13225
|
+
filterData2 = filterCallback(lowerCaseValue, searchKey, listState.localList) || [];
|
13226
|
+
} else {
|
13227
|
+
if (Array.isArray(searchKey)) {
|
13228
|
+
const filterDataList = searchKey.map((searchKey2) => listState.localList.filter((item) => item[searchKey2].toLowerCase().indexOf(lowerCaseValue) !== -1));
|
13229
|
+
filterData2 = Array.from(new Set(filterDataList.flat()));
|
13230
|
+
} else {
|
13231
|
+
filterData2 = listState.localList.filter((item) => item[searchKey].toLowerCase().indexOf(lowerCaseValue) !== -1);
|
13232
|
+
}
|
13233
|
+
}
|
13234
|
+
initPage(filterData2);
|
13235
|
+
};
|
13236
|
+
const activeClass = (data2, index) => {
|
13237
|
+
const style = {
|
13238
|
+
"bk-selector-actived": false,
|
13239
|
+
"bk-selector-selected": tagList.value.includes(data2[props.saveKey])
|
13240
|
+
};
|
13241
|
+
if (props.useGroup) {
|
13242
|
+
style["bk-selector-actived"] = data2.__index__ === state.focusItemIndex;
|
13243
|
+
} else {
|
13244
|
+
style["bk-selector-actived"] = index === state.focusItemIndex;
|
13245
|
+
}
|
13246
|
+
return style;
|
13247
|
+
};
|
13248
|
+
vue.onMounted(() => {
|
13249
|
+
initData();
|
13250
|
+
});
|
13251
|
+
const clearSingleCache = () => {
|
13252
|
+
listState.tagListCache = [];
|
13253
|
+
listState.selectedTagListCache = [];
|
13254
|
+
listState.selectedTagList = [];
|
13255
|
+
};
|
13256
|
+
const clearInput = () => {
|
13257
|
+
curInputValue.value = "";
|
13258
|
+
};
|
13259
|
+
const getTagInputItemSite = () => {
|
13260
|
+
if (isSingleSelect.value) {
|
13261
|
+
return 0;
|
13262
|
+
}
|
13263
|
+
const childNodes = getSelectedTagNodes();
|
13264
|
+
const index = childNodes.findIndex(({
|
13265
|
+
id
|
13266
|
+
}) => id === "tagInputItem");
|
13267
|
+
return index >= 0 ? index : 0;
|
13268
|
+
};
|
13269
|
+
const swapElementPositions = (newNode, referenceNode, isNextElementSibling = false) => {
|
13270
|
+
if (!referenceNode || !newNode)
|
13271
|
+
return;
|
13272
|
+
let swap = referenceNode;
|
13273
|
+
if (isNextElementSibling) {
|
13274
|
+
swap = referenceNode.nextElementSibling || null;
|
13275
|
+
}
|
13276
|
+
referenceNode.parentNode.insertBefore(newNode, swap);
|
13277
|
+
};
|
13278
|
+
const handleInput = (e) => {
|
13279
|
+
const {
|
13280
|
+
maxData,
|
13281
|
+
trigger,
|
13282
|
+
allowCreate
|
13283
|
+
} = props;
|
13284
|
+
if (maxData === -1 || maxData > tagList.value.length) {
|
13285
|
+
const {
|
13286
|
+
value
|
13287
|
+
} = (e == null ? void 0 : e.target) ? e.target : curInputValue;
|
13288
|
+
const charLen = getCharLength(value);
|
13289
|
+
if (charLen) {
|
13290
|
+
filterData(value);
|
13291
|
+
tagInputRef.value.style.width = `${charLen * INPUT_MIN_WIDTH}px`;
|
13292
|
+
} else {
|
13293
|
+
if (trigger === "focus") {
|
13294
|
+
filterData();
|
13295
|
+
}
|
13296
|
+
}
|
13297
|
+
} else {
|
13298
|
+
handleBlur();
|
13299
|
+
curInputValue.value = "";
|
13300
|
+
popoverProps.isShow = false;
|
13301
|
+
}
|
13302
|
+
state.isEdit = true;
|
13303
|
+
state.focusItemIndex = allowCreate ? -1 : 0;
|
13304
|
+
};
|
13305
|
+
const handleFocus = () => {
|
13306
|
+
var _a;
|
13307
|
+
popoverProps.width = isSingleSelect.value ? (_a = bkTagSelectorRef.value) == null ? void 0 : _a.clientWidth : props.contentWidth;
|
13308
|
+
};
|
13309
|
+
const handleBlur = () => {
|
13310
|
+
timer.value = setTimeout(() => {
|
13311
|
+
const inputValue = curInputValue.value;
|
13312
|
+
clearInput();
|
13313
|
+
state.isEdit = false;
|
13314
|
+
if (isSingleSelect.value) {
|
13315
|
+
const [oldValue] = listState.tagListCache;
|
13316
|
+
if (inputValue && inputValue === oldValue && listState.selectedTagListCache.length) {
|
13317
|
+
addTag(listState.selectedTagListCache[0], "select");
|
13318
|
+
} else {
|
13319
|
+
handleChange("remove");
|
13320
|
+
}
|
13321
|
+
} else if (props.allowAutoMatch && inputValue) {
|
13322
|
+
const matchItem = pageState.curPageList.find((item) => {
|
13323
|
+
if (Array.isArray(props.searchKey)) {
|
13324
|
+
const searchValue = props.searchKey.map((key) => item[key]);
|
13325
|
+
return searchValue.includes(inputValue);
|
13326
|
+
}
|
13327
|
+
return item[props.searchKey] === inputValue;
|
13328
|
+
});
|
13329
|
+
if (matchItem) {
|
13330
|
+
handleTagSelected(matchItem, "select");
|
13331
|
+
} else if (props.allowCreate) {
|
13332
|
+
handleTagSelected(inputValue, "custom");
|
13333
|
+
}
|
13334
|
+
}
|
13335
|
+
popoverProps.isShow = false;
|
13336
|
+
emit("blur", inputValue, tagList.value);
|
13337
|
+
}, 50);
|
13338
|
+
};
|
13339
|
+
const handleTagSelected = (item, type, e) => {
|
13340
|
+
e == null ? void 0 : e.stopPropagation();
|
13341
|
+
if (!item || item.disabled) {
|
13342
|
+
return;
|
13343
|
+
}
|
13344
|
+
if (isSingleSelect.value) {
|
13345
|
+
clearSingleCache();
|
13346
|
+
}
|
13347
|
+
addTag(item, type);
|
13348
|
+
handleChange("select");
|
13349
|
+
clearInput();
|
13350
|
+
popoverProps.isShow = false;
|
13351
|
+
};
|
13352
|
+
const handleTagRemove = (data2, index, e) => {
|
13353
|
+
e == null ? void 0 : e.stopPropagation();
|
13354
|
+
removeTag(data2, index);
|
13355
|
+
clearInput();
|
13356
|
+
handleChange("remove");
|
13357
|
+
tagInputRef.value.style.width = `${INPUT_MIN_WIDTH}px`;
|
13358
|
+
};
|
13359
|
+
const handleChange = (type) => {
|
13360
|
+
emit("change", tagList.value);
|
13361
|
+
emit(type);
|
13362
|
+
emit("update:modelValue", tagList.value);
|
13363
|
+
};
|
13364
|
+
const handleClear = (e) => {
|
12669
13365
|
e.stopPropagation();
|
12670
|
-
|
13366
|
+
const removeList = listState.selectedTagList;
|
13367
|
+
listState.selectedTagList = [];
|
13368
|
+
const existList = formatList.filter((item) => removeList.some((removeItem) => removeItem[props.saveKey] === item[props.saveKey]));
|
13369
|
+
if ((props.allowCreate && existList.length !== 0 || !props.allowCreate) && !isSingleSelect.value) {
|
13370
|
+
listState.localList.push(...existList);
|
13371
|
+
}
|
13372
|
+
handleChange("removeAll");
|
12671
13373
|
};
|
12672
|
-
const
|
13374
|
+
const updateScrollTop = () => {
|
13375
|
+
const panelInfo = {
|
13376
|
+
height: selectorListRef.value.clientHeight,
|
13377
|
+
yAxis: selectorListRef.value.getBoundingClientRect().y
|
13378
|
+
};
|
13379
|
+
vue.nextTick(() => {
|
13380
|
+
const activeObj = selectorListRef.value.querySelector(".bk-selector-actived");
|
13381
|
+
if (!activeObj) {
|
13382
|
+
return;
|
13383
|
+
}
|
13384
|
+
const activeInfo = {
|
13385
|
+
height: activeObj.clientHeight,
|
13386
|
+
yAxis: activeObj.getBoundingClientRect().y
|
13387
|
+
};
|
13388
|
+
if (activeInfo.yAxis < panelInfo.yAxis) {
|
13389
|
+
selectorListRef.value.scrollTop = selectorListRef.value.scrollTop - (panelInfo.yAxis - activeInfo.yAxis);
|
13390
|
+
}
|
13391
|
+
const distanceToBottom = activeInfo.yAxis + activeInfo.height - panelInfo.yAxis;
|
13392
|
+
if (distanceToBottom > panelInfo.height) {
|
13393
|
+
selectorListRef.value.scrollTop = selectorListRef.value.scrollTop + distanceToBottom - panelInfo.height;
|
13394
|
+
}
|
13395
|
+
});
|
13396
|
+
};
|
13397
|
+
const backspaceHandler = (index, target) => {
|
13398
|
+
const nodes = getSelectedTagNodes();
|
13399
|
+
swapElementPositions(tagInputItemRef.value, nodes[index - 1]);
|
13400
|
+
listState.selectedTagList.splice(index - 1, 1);
|
13401
|
+
focusInputTrigger();
|
13402
|
+
const isExistInit = formatList.some((item) => item === target[props.saveKey]);
|
13403
|
+
if ((props.allowCreate && isExistInit || !props.allowCreate) && !isSingleSelect.value) {
|
13404
|
+
listState.localList.push(target);
|
13405
|
+
}
|
13406
|
+
tagInputRef.value = `${INPUT_MIN_WIDTH}px`;
|
13407
|
+
handleChange("remove");
|
13408
|
+
};
|
13409
|
+
const handleKeydown = (e) => {
|
13410
|
+
if (pageState.isPageLoading) {
|
13411
|
+
return;
|
13412
|
+
}
|
13413
|
+
let target;
|
13414
|
+
const val = e.target.value;
|
13415
|
+
const valLen = getCharLength(val);
|
13416
|
+
const tagInputItemIndex = getTagInputItemSite();
|
13417
|
+
const nodes = getSelectedTagNodes();
|
13418
|
+
switch (e.code) {
|
13419
|
+
case "ArrowUp":
|
13420
|
+
e.preventDefault();
|
13421
|
+
if (!popoverProps.isShow) {
|
13422
|
+
return;
|
13423
|
+
}
|
13424
|
+
state.focusItemIndex = state.focusItemIndex - 1;
|
13425
|
+
state.focusItemIndex = state.focusItemIndex < 0 ? -1 : state.focusItemIndex;
|
13426
|
+
if (state.focusItemIndex === -1) {
|
13427
|
+
state.focusItemIndex = pageState.curPageList.length - 1;
|
13428
|
+
}
|
13429
|
+
updateScrollTop();
|
13430
|
+
break;
|
13431
|
+
case "ArrowDown":
|
13432
|
+
e.preventDefault();
|
13433
|
+
if (!popoverProps.isShow) {
|
13434
|
+
return;
|
13435
|
+
}
|
13436
|
+
state.focusItemIndex = state.focusItemIndex + 1;
|
13437
|
+
state.focusItemIndex = state.focusItemIndex > pageState.curPageList.length - 1 ? pageState.curPageList.length : state.focusItemIndex;
|
13438
|
+
if (state.focusItemIndex === pageState.curPageList.length) {
|
13439
|
+
state.focusItemIndex = 0;
|
13440
|
+
}
|
13441
|
+
updateScrollTop();
|
13442
|
+
break;
|
13443
|
+
case "ArrowLeft":
|
13444
|
+
state.isEdit = true;
|
13445
|
+
if (!valLen) {
|
13446
|
+
if (tagInputItemIndex < 1) {
|
13447
|
+
return;
|
13448
|
+
}
|
13449
|
+
swapElementPositions(tagInputItemRef.value, nodes[tagInputItemIndex - 1]);
|
13450
|
+
focusInputTrigger();
|
13451
|
+
}
|
13452
|
+
break;
|
13453
|
+
case "ArrowRight":
|
13454
|
+
state.isEdit = true;
|
13455
|
+
if (!valLen) {
|
13456
|
+
if (tagInputItemIndex === nodes.length - 1) {
|
13457
|
+
return;
|
13458
|
+
}
|
13459
|
+
swapElementPositions(nodes[tagInputItemIndex + 1], tagInputItemRef.value);
|
13460
|
+
focusInputTrigger();
|
13461
|
+
}
|
13462
|
+
break;
|
13463
|
+
case "Enter":
|
13464
|
+
case "NumpadEnter":
|
13465
|
+
if (!props.allowCreate && popoverProps.isShow || props.allowCreate && state.focusItemIndex >= 0 && popoverProps.isShow) {
|
13466
|
+
handleTagSelected(pageState.curPageList[state.focusItemIndex], "select", e);
|
13467
|
+
} else if (props.allowCreate) {
|
13468
|
+
handleTagSelected(curInputValue.value, "custom", e);
|
13469
|
+
}
|
13470
|
+
e.preventDefault();
|
13471
|
+
break;
|
13472
|
+
case "Backspace":
|
13473
|
+
if (tagInputItemIndex !== 0 && !curInputValue.value) {
|
13474
|
+
target = listState.selectedTagList[tagInputItemIndex - 1];
|
13475
|
+
backspaceHandler(tagInputItemIndex, target);
|
13476
|
+
}
|
13477
|
+
break;
|
13478
|
+
}
|
13479
|
+
};
|
13480
|
+
const defaultPasteFn = (value) => {
|
13481
|
+
const target = [];
|
13482
|
+
const textArr = value.split(";");
|
13483
|
+
textArr.forEach((item) => {
|
13484
|
+
if (item.match(/^[a-zA-Z][a-zA-Z_]+/g)) {
|
13485
|
+
const finalItem = item.match(/^[a-zA-Z][a-zA-Z_]+/g).join("");
|
13486
|
+
target.push({
|
13487
|
+
[props.saveKey]: finalItem,
|
13488
|
+
[props.displayKey]: finalItem
|
13489
|
+
});
|
13490
|
+
}
|
13491
|
+
});
|
13492
|
+
return target;
|
13493
|
+
};
|
13494
|
+
const handlePaste = (e) => {
|
12673
13495
|
e.preventDefault();
|
12674
|
-
|
12675
|
-
|
12676
|
-
|
13496
|
+
if (isSingleSelect.value) {
|
13497
|
+
return false;
|
13498
|
+
}
|
13499
|
+
const {
|
13500
|
+
maxData,
|
13501
|
+
saveKey,
|
13502
|
+
pasteFn
|
13503
|
+
} = props;
|
13504
|
+
const value = e.clipboardData.getData("text");
|
13505
|
+
const valArr = pasteFn ? pasteFn(value) : defaultPasteFn(value);
|
13506
|
+
let tags = valArr.map((value2) => value2[saveKey]);
|
13507
|
+
if (tags.length) {
|
13508
|
+
const nodes = getSelectedTagNodes();
|
13509
|
+
const index = getTagInputItemSite();
|
13510
|
+
const localInitData = listState.localList.map((data2) => data2[saveKey]);
|
13511
|
+
tags = tags.filter((tag2) => (tag2 == null ? void 0 : tag2.trim()) && !tagList.value.includes(tag2) && localInitData.includes(tag2));
|
13512
|
+
if (maxData !== -1) {
|
13513
|
+
const selectedLength = listState.selectedTagList.length;
|
13514
|
+
if (selectedLength < maxData) {
|
13515
|
+
const differ = maxData - selectedLength;
|
13516
|
+
if (tags.length > differ) {
|
13517
|
+
tags = [...tags.slice(0, differ)];
|
13518
|
+
}
|
13519
|
+
} else {
|
13520
|
+
tags = [];
|
13521
|
+
}
|
13522
|
+
}
|
13523
|
+
const localTags = listState.localList.filter((tag2) => tags.includes(tag2[saveKey]));
|
13524
|
+
if (tags.length) {
|
13525
|
+
listState.selectedTagList.splice(index, 0, ...localTags);
|
13526
|
+
swapElementPositions(tagInputItemRef.value, nodes[index]);
|
13527
|
+
tagInputRef.value.style.width = `${INPUT_MIN_WIDTH}px`;
|
13528
|
+
listState.localList = listState.localList.filter((val) => !tags.includes(val[saveKey]));
|
13529
|
+
handleChange("select");
|
13530
|
+
focusInputTrigger();
|
13531
|
+
}
|
12677
13532
|
}
|
12678
13533
|
};
|
12679
|
-
|
12680
|
-
|
12681
|
-
|
12682
|
-
|
12683
|
-
|
13534
|
+
const tagFocus = (e) => {
|
13535
|
+
if (props.disabled) {
|
13536
|
+
return;
|
13537
|
+
}
|
13538
|
+
swapElementPositions(tagInputItemRef.value, e.currentTarget, true);
|
13539
|
+
tagInputRef.value.style.width = `${INPUT_MIN_WIDTH}px`;
|
13540
|
+
popoverProps.isShow && changePopoverOffset();
|
13541
|
+
};
|
13542
|
+
const addTag = (item, type) => {
|
13543
|
+
if (listState.selectedTagList.length >= props.maxData && props.maxData !== -1)
|
13544
|
+
return;
|
13545
|
+
const {
|
13546
|
+
separator,
|
13547
|
+
saveKey,
|
13548
|
+
displayKey,
|
13549
|
+
createTagValidator
|
13550
|
+
} = props;
|
13551
|
+
const targetIndex = getTagInputItemSite();
|
13552
|
+
let moveCount = 1;
|
13553
|
+
let isSelected = false;
|
13554
|
+
let newValue;
|
13555
|
+
const validateTag = (value) => {
|
13556
|
+
if (typeof createTagValidator === "function") {
|
13557
|
+
return createTagValidator(value);
|
13558
|
+
}
|
13559
|
+
return true;
|
13560
|
+
};
|
13561
|
+
const existTag = (value) => listState.localList.find((tag2) => tag2[saveKey] === value);
|
13562
|
+
if (type === "custom") {
|
13563
|
+
if (separator) {
|
13564
|
+
let tags = item.split(separator);
|
13565
|
+
tags = tags.filter((tag2) => (tag2 == null ? void 0 : tag2.trim()) && !tagList.value.includes(tag2) && validateTag(tag2));
|
13566
|
+
const localTags = tags.map((tag2) => existTag(tag2) || {
|
13567
|
+
[saveKey]: tag2,
|
13568
|
+
[displayKey]: tag2
|
13569
|
+
});
|
13570
|
+
if (tags.length) {
|
13571
|
+
listState.selectedTagList.splice(targetIndex, 0, ...localTags);
|
13572
|
+
moveCount = localTags.length;
|
13573
|
+
isSelected = true;
|
13574
|
+
}
|
13575
|
+
} else {
|
13576
|
+
const isObject2 = typeof item === "object";
|
13577
|
+
newValue = isObject2 ? item[saveKey] : item.trim();
|
13578
|
+
newValue = newValue.replace(/\s+/g, "");
|
13579
|
+
if (newValue !== void 0 && !tagList.value.includes(newValue) && validateTag(newValue)) {
|
13580
|
+
const localItem = existTag(newValue) || (isObject2 ? item : {
|
13581
|
+
[saveKey]: newValue,
|
13582
|
+
[displayKey]: newValue
|
13583
|
+
});
|
13584
|
+
listState.selectedTagList.splice(targetIndex, 0, localItem);
|
13585
|
+
isSelected = true;
|
13586
|
+
}
|
13587
|
+
}
|
13588
|
+
} else if (item) {
|
13589
|
+
newValue = item[saveKey];
|
13590
|
+
if (newValue !== void 0 && !tagList.value.includes(newValue)) {
|
13591
|
+
listState.selectedTagList.splice(targetIndex, 0, item);
|
13592
|
+
isSelected = true;
|
13593
|
+
}
|
13594
|
+
}
|
13595
|
+
if (isSelected) {
|
13596
|
+
vue.nextTick(() => {
|
13597
|
+
for (let count = 1; count <= moveCount; count++) {
|
13598
|
+
const nodes = getSelectedTagNodes();
|
13599
|
+
const site = nodes[targetIndex + count];
|
13600
|
+
swapElementPositions(site, tagInputItemRef.value);
|
13601
|
+
}
|
13602
|
+
tagInputRef.value.style.width = `${INPUT_MIN_WIDTH}px`;
|
13603
|
+
if (!isSingleSelect.value) {
|
13604
|
+
props.allowNextFocus && focusInputTrigger();
|
13605
|
+
listState.localList = listState.localList.filter((val) => !tagList.value.includes(val[saveKey]));
|
13606
|
+
}
|
13607
|
+
});
|
13608
|
+
}
|
13609
|
+
};
|
13610
|
+
const removeTag = (data2, index) => {
|
13611
|
+
listState.selectedTagList.splice(index, 1);
|
13612
|
+
const isExistInit = formatList.some((item) => item === data2[props.saveKey]);
|
13613
|
+
if ((props.allowCreate && isExistInit || !props.allowCreate) && !isSingleSelect.value) {
|
13614
|
+
listState.localList.push(data2);
|
13615
|
+
}
|
12684
13616
|
};
|
13617
|
+
return __spreadProps(__spreadValues(__spreadValues(__spreadValues({
|
13618
|
+
popoverProps
|
13619
|
+
}, vue.toRefs(state)), vue.toRefs(listState)), vue.toRefs(pageState)), {
|
13620
|
+
isShowPlaceholder,
|
13621
|
+
isShowClear,
|
13622
|
+
curInputValue,
|
13623
|
+
formatList,
|
13624
|
+
renderList,
|
13625
|
+
showTagClose,
|
13626
|
+
tagInputRef,
|
13627
|
+
bkTagSelectorRef,
|
13628
|
+
tagListRef,
|
13629
|
+
tagInputItemRef,
|
13630
|
+
selectorListRef,
|
13631
|
+
popoverRef,
|
13632
|
+
triggerClass,
|
13633
|
+
focusInputTrigger,
|
13634
|
+
activeClass,
|
13635
|
+
handleInput,
|
13636
|
+
handleFocus,
|
13637
|
+
handleBlur,
|
13638
|
+
handleTagSelected,
|
13639
|
+
handleTagRemove,
|
13640
|
+
handleClear,
|
13641
|
+
tagFocus,
|
13642
|
+
handleKeydown,
|
13643
|
+
handlePaste
|
13644
|
+
});
|
12685
13645
|
},
|
12686
13646
|
render() {
|
12687
|
-
|
13647
|
+
const renderSelectorList = () => {
|
13648
|
+
if (this.useGroup) {
|
13649
|
+
return this.renderList.map((group) => vue.createVNode("li", {
|
13650
|
+
"class": "bk-selector-group-item"
|
13651
|
+
}, [vue.createVNode("span", {
|
13652
|
+
"class": "group-name"
|
13653
|
+
}, [group.name, vue.createTextVNode(" ("), group.children.length, vue.createTextVNode(")")]), vue.createVNode("ul", {
|
13654
|
+
"class": "bk-selector-group-list-item"
|
13655
|
+
}, [group.children.map((item, index) => vue.createVNode("li", {
|
13656
|
+
"class": ["bk-selector-list-item", {
|
13657
|
+
disabled: item.disabled
|
13658
|
+
}, this.activeClass(item, index)],
|
13659
|
+
"onClick": this.handleTagSelected.bind(this, item, "select")
|
13660
|
+
}, [vue.createVNode(ListTagRender, {
|
13661
|
+
"node": item,
|
13662
|
+
"displayKey": this.displayKey,
|
13663
|
+
"tpl": this.tpl,
|
13664
|
+
"searchKey": this.searchKey,
|
13665
|
+
"searchKeyword": this.curInputValue
|
13666
|
+
}, null)]))])]));
|
13667
|
+
}
|
13668
|
+
return this.renderList.map((item, index) => vue.createVNode("li", {
|
13669
|
+
"class": ["bk-selector-list-item", {
|
13670
|
+
disabled: item.disabled
|
13671
|
+
}, this.activeClass(item, index)],
|
13672
|
+
"onClick": this.handleTagSelected.bind(this, item, "select")
|
13673
|
+
}, [vue.createVNode(ListTagRender, {
|
13674
|
+
"node": item,
|
13675
|
+
"displayKey": this.displayKey,
|
13676
|
+
"tpl": this.tpl,
|
13677
|
+
"searchKey": this.searchKey,
|
13678
|
+
"searchKeyword": this.curInputValue
|
13679
|
+
}, null)]));
|
13680
|
+
};
|
12688
13681
|
return vue.createVNode("div", {
|
12689
|
-
"class":
|
12690
|
-
"
|
12691
|
-
"onClick": this.
|
12692
|
-
|
12693
|
-
"
|
12694
|
-
}, [
|
12695
|
-
"
|
12696
|
-
"
|
12697
|
-
|
13682
|
+
"class": "bk-tag-input",
|
13683
|
+
"ref": "bkTagSelectorRef",
|
13684
|
+
"onClick": this.focusInputTrigger,
|
13685
|
+
"onMouseenter": () => this.isHover = true,
|
13686
|
+
"onMouseleave": () => this.isHover = false
|
13687
|
+
}, [vue.createVNode(BkPopover, {
|
13688
|
+
"ref": "popoverRef",
|
13689
|
+
"theme": "light",
|
13690
|
+
"trigger": "manual",
|
13691
|
+
"placement": "bottom-start",
|
13692
|
+
"arrow": false,
|
13693
|
+
"width": this.popoverProps.width,
|
13694
|
+
"isShow": this.popoverProps.isShow,
|
13695
|
+
"modifiers": this.popoverProps.modifiers
|
13696
|
+
}, {
|
13697
|
+
default: () => vue.createVNode("div", {
|
13698
|
+
"class": this.triggerClass
|
13699
|
+
}, [vue.createVNode("ul", {
|
13700
|
+
"class": "tag-list",
|
13701
|
+
"ref": "tagListRef",
|
13702
|
+
"style": {
|
13703
|
+
marginLeft: `${this.leftSpace}px`
|
13704
|
+
}
|
13705
|
+
}, [this.selectedTagList.map((item, index) => {
|
13706
|
+
const tooltips2 = {
|
13707
|
+
boundary: "window",
|
13708
|
+
theme: "light",
|
13709
|
+
distance: 12,
|
13710
|
+
content: item[this.tooltipKey],
|
13711
|
+
disabled: !this.tooltipKey
|
13712
|
+
};
|
13713
|
+
return vue.withDirectives(vue.createVNode("li", {
|
13714
|
+
"class": "tag-item",
|
13715
|
+
"onClick": this.tagFocus
|
13716
|
+
}, [vue.createVNode(TagRender, {
|
13717
|
+
"node": item,
|
13718
|
+
"tpl": this.tagTpl,
|
13719
|
+
"displayKey": this.displayKey
|
13720
|
+
}, null), this.showTagClose ? vue.createVNode(error, {
|
13721
|
+
"class": "remove-tag",
|
13722
|
+
"onClick": this.handleTagRemove.bind(this, item, index)
|
13723
|
+
}, null) : null]), [[vue.resolveDirective("bk-tooltips"), tooltips2]]);
|
13724
|
+
}), vue.withDirectives(vue.createVNode("li", {
|
13725
|
+
"ref": "tagInputItemRef",
|
13726
|
+
"id": "tagInputItem",
|
13727
|
+
"class": "tag-input-item",
|
13728
|
+
"role": "input"
|
13729
|
+
}, [vue.withDirectives(vue.createVNode("input", {
|
13730
|
+
"type": "text",
|
13731
|
+
"class": "tag-input",
|
13732
|
+
"ref": "tagInputRef",
|
13733
|
+
"onUpdate:modelValue": ($event) => this.curInputValue = $event,
|
13734
|
+
"onInput": this.handleInput,
|
13735
|
+
"onFocus": this.handleFocus,
|
13736
|
+
"onBlur": this.handleBlur,
|
13737
|
+
"onKeydown": this.handleKeydown,
|
13738
|
+
"onPaste": this.handlePaste
|
13739
|
+
}, null), [[vue.vModelText, this.curInputValue]])]), [[vue.vShow, this.isEdit]])]), vue.withDirectives(vue.createVNode("p", {
|
13740
|
+
"class": "placeholder"
|
13741
|
+
}, [this.placeholder]), [[vue.vShow, this.isShowPlaceholder]]), this.isShowClear ? vue.createVNode(close$1, {
|
13742
|
+
"class": "clear-icon",
|
13743
|
+
"onClick": this.handleClear
|
13744
|
+
}, null) : null]),
|
13745
|
+
content: () => vue.createVNode("div", {
|
13746
|
+
"class": "bk-selector-list"
|
13747
|
+
}, [vue.createVNode("ul", {
|
13748
|
+
"ref": "selectorListRef",
|
13749
|
+
"style": {
|
13750
|
+
"max-height": `${this.contentMaxHeight}px`
|
13751
|
+
},
|
13752
|
+
"class": "outside-ul"
|
13753
|
+
}, [renderSelectorList(), this.isPageLoading ? vue.createVNode("li", {
|
13754
|
+
"class": "bk-selector-list-item loading"
|
13755
|
+
}, [vue.createVNode(BkLoading, {
|
13756
|
+
"theme": "primary",
|
13757
|
+
"size": BkLoadingSize.Small
|
13758
|
+
}, null)]) : null])])
|
13759
|
+
})]);
|
12698
13760
|
}
|
12699
13761
|
});
|
12700
|
-
|
13762
|
+
TagInput.install = (Vue) => {
|
13763
|
+
Vue.component(TagInput.name, TagInput);
|
13764
|
+
};
|
12701
13765
|
var bkDivider = vue.defineComponent({
|
12702
13766
|
name: "Divider",
|
12703
13767
|
props: {
|
@@ -18339,35 +19403,41 @@ ${$(r2)}`), n2;
|
|
18339
19403
|
const outputData = [];
|
18340
19404
|
let order2 = 0;
|
18341
19405
|
const schema = /* @__PURE__ */ new Map();
|
18342
|
-
function
|
19406
|
+
function getCachedTreeNodeAttr(uuid2, node, attr, cachedAttr) {
|
18343
19407
|
const cached = (cachedSchema || []).find((item) => item.__uuid === uuid2);
|
18344
19408
|
if (cached) {
|
18345
|
-
return cached
|
19409
|
+
return cached[cachedAttr];
|
18346
19410
|
}
|
18347
|
-
return node
|
19411
|
+
return node[attr];
|
19412
|
+
}
|
19413
|
+
function isCachedTreeNodeOpened(uuid2, node) {
|
19414
|
+
return getCachedTreeNodeAttr(uuid2, node, "isOpen", "__isOpen");
|
19415
|
+
}
|
19416
|
+
function isCachedTreeNodeChecked(uuid2, node) {
|
19417
|
+
return getCachedTreeNodeAttr(uuid2, node, "checked", "__checked");
|
18348
19418
|
}
|
18349
19419
|
function flatten(array, depth = 0, parent = null, path = null) {
|
18350
|
-
|
19420
|
+
const arrLength = array.length;
|
19421
|
+
for (let i2 = 0; i2 < arrLength; i2++) {
|
18351
19422
|
const item = array[i2];
|
18352
19423
|
if (Array.isArray(item)) {
|
18353
19424
|
flatten(item, depth, parent, path);
|
18354
19425
|
} else {
|
18355
19426
|
if (typeof item === "object" && item !== null) {
|
18356
19427
|
const uuid2 = item.__uuid || uuid_1.v4();
|
18357
|
-
const isOpen = isCachedTreeNodeOpened(uuid2, item);
|
18358
19428
|
const currentPath = path !== null ? `${path}-${i2}` : `${i2}`;
|
19429
|
+
const hasChildren = !!(item[children] || []).length;
|
18359
19430
|
const attrs = {
|
18360
19431
|
__depth: depth,
|
18361
19432
|
__index: i2,
|
18362
19433
|
__uuid: uuid2,
|
18363
19434
|
__parentId: parent,
|
18364
|
-
|
18365
|
-
__hasChild: !!(item[children] || []).length,
|
19435
|
+
__hasChild: hasChildren,
|
18366
19436
|
__path: currentPath,
|
18367
19437
|
__isRoot: parent === null,
|
18368
19438
|
__order: order2,
|
18369
|
-
__isOpen:
|
18370
|
-
__checked:
|
19439
|
+
__isOpen: isCachedTreeNodeOpened(uuid2, item) && hasChildren,
|
19440
|
+
__checked: isCachedTreeNodeChecked(uuid2, item),
|
18371
19441
|
[children]: null
|
18372
19442
|
};
|
18373
19443
|
Object.assign(item, { __uuid: uuid2 });
|
@@ -19053,6 +20123,7 @@ ${$(r2)}`), n2;
|
|
19053
20123
|
Switcher: BkSwitcher,
|
19054
20124
|
Table: BkTable,
|
19055
20125
|
Tag: BkTag,
|
20126
|
+
TagInput,
|
19056
20127
|
Divider: BkDivider,
|
19057
20128
|
Tab: BKTab,
|
19058
20129
|
TabPanel: BKTabPanel,
|
@@ -19127,6 +20198,7 @@ ${$(r2)}`), n2;
|
|
19127
20198
|
exports2.TabPanel = BKTabPanel;
|
19128
20199
|
exports2.Table = BkTable;
|
19129
20200
|
exports2.Tag = BkTag;
|
20201
|
+
exports2.TagInput = TagInput;
|
19130
20202
|
exports2.Transfer = Transfer;
|
19131
20203
|
exports2.Tree = BkTree;
|
19132
20204
|
exports2.VirtualRender = BkVirtualRender;
|