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