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