bkui-vue 0.0.1-beta.81 → 0.0.1-beta.84

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 (50) hide show
  1. package/dist/index.cjs.js +29 -29
  2. package/dist/index.esm.js +518 -255
  3. package/dist/index.umd.js +29 -29
  4. package/dist/style.css +1 -1
  5. package/lib/button/button.css +16 -11
  6. package/lib/button/button.d.ts +0 -10
  7. package/lib/button/button.less +28 -13
  8. package/lib/button/button.variable.css +16 -11
  9. package/lib/button/index.d.ts +1 -16
  10. package/lib/button/index.js +1 -1
  11. package/lib/cascader/cascader.d.ts +1 -1
  12. package/lib/cascader/index.d.ts +4 -4
  13. package/lib/input/input.css +4 -1
  14. package/lib/input/input.less +4 -1
  15. package/lib/input/input.variable.css +4 -1
  16. package/lib/loading/loading.css +4 -3
  17. package/lib/loading/loading.less +4 -3
  18. package/lib/loading/loading.variable.css +4 -3
  19. package/lib/pagination/index.js +1 -1
  20. package/lib/select/common.d.ts +4 -4
  21. package/lib/select/index.d.ts +563 -212
  22. package/lib/select/index.js +1 -1
  23. package/lib/select/option.d.ts +11 -4
  24. package/lib/select/select.css +31 -59
  25. package/lib/select/select.d.ts +168 -62
  26. package/lib/select/select.less +43 -51
  27. package/lib/select/select.variable.css +31 -59
  28. package/lib/select/selectTagInput.d.ts +71 -0
  29. package/lib/select/type.d.ts +9 -5
  30. package/lib/shared/index.js +1 -1
  31. package/lib/tab/index.d.ts +7 -7
  32. package/lib/tab/tab.d.ts +2 -2
  33. package/lib/table/index.d.ts +16 -5
  34. package/lib/table/index.js +1 -1
  35. package/lib/table/props.d.ts +4 -1
  36. package/lib/table/render.d.ts +1 -1
  37. package/lib/table/table.css +26 -7
  38. package/lib/table/table.d.ts +7 -2
  39. package/lib/table/table.less +29 -6
  40. package/lib/table/table.variable.css +26 -7
  41. package/lib/table/use-common.d.ts +4 -2
  42. package/lib/tag-input/index.d.ts +4 -4
  43. package/lib/tag-input/index.js +1 -1
  44. package/lib/tag-input/tag-input.d.ts +1 -1
  45. package/lib/transfer/index.js +1 -1
  46. package/lib/transfer/transfer.css +41 -60
  47. package/lib/transfer/transfer.less +55 -82
  48. package/lib/transfer/transfer.variable.css +41 -60
  49. package/lib/tree/index.js +1 -1
  50. package/package.json +1 -1
package/dist/index.esm.js CHANGED
@@ -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, getCurrentInstance, nextTick, Transition, provide, inject, createTextVNode, withDirectives, vShow, isVNode, Fragment, toRefs, customRef, onBeforeMount, toRef, unref, resolveDirective, vModelText, watchEffect, onUpdated, render, onUnmounted, Teleport, withModifiers } from "vue";
36
+ import { createVNode, h as h$1, mergeProps, defineComponent, reactive, ref, computed, watch, onMounted, onBeforeUnmount, getCurrentInstance, nextTick, Transition, provide, inject, createTextVNode, withDirectives, vShow, isVNode, Fragment, toRefs, customRef, onBeforeMount, toRef, vModelText, resolveDirective, watchEffect, onUpdated, render, onUnmounted, Teleport, withModifiers } from "vue";
37
37
  var reset = "";
38
38
  var alert = "";
39
39
  var affix = "";
@@ -1759,7 +1759,7 @@ class BKPopover {
1759
1759
  if (this.isSameElement(event2.target, this.reference) || this.reference.contains(event2.target)) {
1760
1760
  this.show(event2);
1761
1761
  } else {
1762
- if (this.isShow && !this.isSameElement(event2.target, this.popperRefer)) {
1762
+ if (this.isShow && !this.isSameElement(event2.target, this.popperRefer) && !this.popperRefer.contains(event2.target)) {
1763
1763
  this.hide();
1764
1764
  }
1765
1765
  }
@@ -8818,7 +8818,6 @@ const buttonProps = {
8818
8818
  loadingMode: PropTypes.commonType(Object.values(BkLoadingMode)),
8819
8819
  outline: PropTypes.bool,
8820
8820
  text: PropTypes.bool,
8821
- circle: PropTypes.bool,
8822
8821
  nativeType: {
8823
8822
  type: String
8824
8823
  }
@@ -8845,7 +8844,6 @@ var Component$v = defineComponent({
8845
8844
  "is-disabled": props.disabled,
8846
8845
  "is-outline": props.outline,
8847
8846
  "is-text": isText.value,
8848
- "is-circle": props.circle,
8849
8847
  [`${btnClsPrefix}-${props.size}`]: props.size && btnSizes.includes(props.size),
8850
8848
  "no-slot": !showSlot
8851
8849
  }, `${themeCls} ${btnClsPrefix} ${hoverTheme}`);
@@ -11044,11 +11042,16 @@ function useHover() {
11044
11042
  }
11045
11043
  function useRegistry(data2) {
11046
11044
  const register = (item) => {
11047
- if (!item)
11045
+ if (!item || data2.value.find((d2) => d2 === item))
11048
11046
  return;
11049
- return data2.value.add(item);
11047
+ return data2.value.push(item);
11048
+ };
11049
+ const unregister = (item) => {
11050
+ const index = data2.value.findIndex((d2) => d2 === item);
11051
+ if (index > -1) {
11052
+ data2.value.splice(index, 1);
11053
+ }
11050
11054
  };
11051
- const unregister = (item) => data2.value.delete(item);
11052
11055
  return {
11053
11056
  register,
11054
11057
  unregister
@@ -11064,10 +11067,15 @@ function useDebouncedRef(value, delay = 200) {
11064
11067
  },
11065
11068
  set(newValue) {
11066
11069
  clearTimeout(timeout);
11067
- timeout = setTimeout(() => {
11070
+ if (newValue === void 0 || newValue === "") {
11068
11071
  innerValue = newValue;
11069
11072
  trigger();
11070
- }, delay);
11073
+ } else {
11074
+ timeout = setTimeout(() => {
11075
+ innerValue = newValue;
11076
+ trigger();
11077
+ }, delay);
11078
+ }
11071
11079
  }
11072
11080
  }));
11073
11081
  }
@@ -11097,13 +11105,19 @@ function usePopover(config) {
11097
11105
  showPopover
11098
11106
  };
11099
11107
  }
11100
- function useRemoteSearch(method) {
11108
+ function useRemoteSearch(method, callBack) {
11101
11109
  const searchKey = useDebouncedRef("");
11102
11110
  const searchLoading = ref(false);
11103
11111
  watch(searchKey, async () => {
11104
- searchLoading.value = true;
11105
- await method(searchKey.value);
11106
- searchLoading.value = false;
11112
+ try {
11113
+ searchLoading.value = true;
11114
+ await method(searchKey.value);
11115
+ searchLoading.value = false;
11116
+ } catch (err) {
11117
+ console.error(err);
11118
+ } finally {
11119
+ callBack == null ? void 0 : callBack();
11120
+ }
11107
11121
  });
11108
11122
  return {
11109
11123
  searchKey,
@@ -11118,8 +11132,8 @@ function toLowerCase(value = "") {
11118
11132
  var BkOption = defineComponent({
11119
11133
  name: "Option",
11120
11134
  props: {
11121
- value: PropTypes.oneOfType([String, Number, Boolean]),
11122
- label: PropTypes.oneOfType([String, Number]),
11135
+ value: PropTypes.any,
11136
+ label: PropTypes.string,
11123
11137
  disabled: PropTypes.bool.def(false)
11124
11138
  },
11125
11139
  setup(props) {
@@ -11130,17 +11144,25 @@ var BkOption = defineComponent({
11130
11144
  visible: true
11131
11145
  });
11132
11146
  const {
11133
- disabled
11147
+ disabled,
11148
+ value
11134
11149
  } = toRefs(props);
11135
11150
  const select2 = inject(selectKey, null);
11136
11151
  const group = inject(optionGroupKey, null);
11137
- const selected = computed(() => select2.selectedOptions.has(proxy));
11138
- const multiple = computed(() => select2 == null ? void 0 : select2.props.multiple);
11152
+ const selected = computed(() => {
11153
+ var _a;
11154
+ return (_a = select2 == null ? void 0 : select2.selected) == null ? void 0 : _a.some((data2) => data2.value === value.value);
11155
+ });
11156
+ const multiple = computed(() => select2 == null ? void 0 : select2.multiple);
11157
+ const isHover = computed(() => (select2 == null ? void 0 : select2.activeOptionValue) === value.value);
11139
11158
  const handleOptionClick = () => {
11140
11159
  if (disabled.value)
11141
11160
  return;
11142
11161
  select2 == null ? void 0 : select2.handleOptionSelected(proxy);
11143
11162
  };
11163
+ const handleMouseEnter = () => {
11164
+ select2.activeOptionValue = value.value;
11165
+ };
11144
11166
  onBeforeMount(() => {
11145
11167
  select2 == null ? void 0 : select2.register(proxy);
11146
11168
  group == null ? void 0 : group.register(proxy);
@@ -11152,7 +11174,9 @@ var BkOption = defineComponent({
11152
11174
  return __spreadProps(__spreadValues({}, toRefs(states)), {
11153
11175
  selected,
11154
11176
  multiple,
11155
- handleOptionClick
11177
+ isHover,
11178
+ handleOptionClick,
11179
+ handleMouseEnter
11156
11180
  });
11157
11181
  },
11158
11182
  render() {
@@ -11161,12 +11185,13 @@ var BkOption = defineComponent({
11161
11185
  "is-selected": this.selected,
11162
11186
  "is-disabled": this.disabled,
11163
11187
  "is-multiple": this.multiple,
11164
- "is-hover": false,
11188
+ "is-hover": this.isHover,
11165
11189
  "bk-select-option": true
11166
11190
  });
11167
11191
  return withDirectives(createVNode("li", {
11168
11192
  "class": selectItemClass,
11169
- "onClick": this.handleOptionClick
11193
+ "onClick": this.handleOptionClick,
11194
+ "onMouseenter": this.handleMouseEnter
11170
11195
  }, [(_c = (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)) != null ? _c : createVNode("span", null, [this.label])]), [[vShow, this.visible]]);
11171
11196
  }
11172
11197
  });
@@ -11189,7 +11214,7 @@ var OptionGroup = defineComponent({
11189
11214
  groupCollapse: props.collapse,
11190
11215
  visible: true
11191
11216
  });
11192
- const options = ref(/* @__PURE__ */ new Set());
11217
+ const options = ref([]);
11193
11218
  const {
11194
11219
  register,
11195
11220
  unregister
@@ -11709,6 +11734,85 @@ var Component$g = defineComponent({
11709
11734
  }
11710
11735
  });
11711
11736
  const BkTag = withInstall(Component$g);
11737
+ var SelectTagInput = defineComponent({
11738
+ name: "SelectTagInput",
11739
+ props: {
11740
+ selected: {
11741
+ type: Array,
11742
+ default: () => []
11743
+ },
11744
+ tagTheme: PropTypes.theme(["success", "info", "warning", "danger"]).def(""),
11745
+ placeholder: PropTypes.string.def(""),
11746
+ filterable: PropTypes.bool.def(false),
11747
+ allowCreate: PropTypes.bool.def(false),
11748
+ modelValue: PropTypes.any
11749
+ },
11750
+ emits: ["update:modelValue", "remove", "focus", "enter"],
11751
+ setup(props, {
11752
+ emit
11753
+ }) {
11754
+ const {
11755
+ modelValue
11756
+ } = toRefs(props);
11757
+ const value = ref(modelValue.value);
11758
+ const inputRef = ref();
11759
+ watch(modelValue, () => {
11760
+ value.value = modelValue.value;
11761
+ });
11762
+ const handleRemoveTag = (data2) => {
11763
+ emit("remove", data2);
11764
+ };
11765
+ const handleFocus = () => {
11766
+ emit("focus");
11767
+ };
11768
+ const focus = () => {
11769
+ var _a;
11770
+ (_a = inputRef.value) == null ? void 0 : _a.focus();
11771
+ };
11772
+ const handleInput = (e) => {
11773
+ emit("update:modelValue", e.target.value);
11774
+ };
11775
+ const handleKeydown = (e) => {
11776
+ switch (e.code) {
11777
+ case "Enter": {
11778
+ emit("enter", e.target.value, e);
11779
+ break;
11780
+ }
11781
+ }
11782
+ };
11783
+ return {
11784
+ value,
11785
+ inputRef,
11786
+ handleRemoveTag,
11787
+ handleFocus,
11788
+ focus,
11789
+ handleInput,
11790
+ handleKeydown
11791
+ };
11792
+ },
11793
+ render() {
11794
+ var _a, _b, _c, _d;
11795
+ return createVNode("div", {
11796
+ "class": "bk-select-tag"
11797
+ }, [(_b = (_a = this.$slots) == null ? void 0 : _a.prefix) == null ? void 0 : _b.call(_a), this.selected.map((data2) => createVNode(BkTag, {
11798
+ "closable": true,
11799
+ "theme": this.tagTheme,
11800
+ "onClose": () => this.handleRemoveTag(data2)
11801
+ }, {
11802
+ default: () => [data2.label]
11803
+ })), withDirectives(createVNode("input", {
11804
+ "class": "bk-select-tag-input",
11805
+ "ref": "inputRef",
11806
+ "type": "text",
11807
+ "placeholder": !this.selected.length ? this.placeholder : "",
11808
+ "readonly": !this.filterable,
11809
+ "onUpdate:modelValue": ($event) => this.value = $event,
11810
+ "onFocus": this.handleFocus,
11811
+ "onInput": this.handleInput,
11812
+ "onKeydown": this.handleKeydown
11813
+ }, null), [[vModelText, this.value]]), (_d = (_c = this.$slots) == null ? void 0 : _c.suffix) == null ? void 0 : _d.call(_c)]);
11814
+ }
11815
+ });
11712
11816
  var Component$f = defineComponent({
11713
11817
  name: "Select",
11714
11818
  directives: {
@@ -11736,7 +11840,8 @@ var Component$f = defineComponent({
11736
11840
  loadingText: PropTypes.string.def("\u52A0\u8F7D\u4E2D..."),
11737
11841
  placeholder: PropTypes.string.def("\u8BF7\u9009\u62E9"),
11738
11842
  selectAllText: PropTypes.string.def("\u5168\u90E8"),
11739
- scrollLoading: PropTypes.bool.def(false)
11843
+ scrollLoading: PropTypes.bool.def(false),
11844
+ allowCreate: PropTypes.bool.def(false)
11740
11845
  },
11741
11846
  emits: ["update:modelValue", "change", "toggle", "clear", "scroll-end"],
11742
11847
  setup(props, {
@@ -11746,7 +11851,6 @@ var Component$f = defineComponent({
11746
11851
  modelValue,
11747
11852
  disabled,
11748
11853
  filterable,
11749
- placeholder,
11750
11854
  multiple,
11751
11855
  remoteMethod,
11752
11856
  loading: loading2,
@@ -11754,27 +11858,46 @@ var Component$f = defineComponent({
11754
11858
  noDataText,
11755
11859
  noMatchText,
11756
11860
  popoverMinWidth,
11757
- showOnInit
11861
+ showOnInit,
11862
+ multipleMode,
11863
+ allowCreate
11758
11864
  } = toRefs(props);
11759
- const states = reactive({
11760
- currentPlaceholder: placeholder.value,
11761
- selectedOptions: /* @__PURE__ */ new Set(),
11762
- currentSelectedLabel: ""
11763
- });
11764
11865
  const inputRef = ref();
11765
11866
  const popoverRef = ref();
11766
- const options = ref(/* @__PURE__ */ new Set());
11767
- const groups = ref(/* @__PURE__ */ new Set());
11867
+ const selectTagInputRef = ref();
11868
+ const options = ref([]);
11869
+ const groups = ref([]);
11870
+ const selected = ref([]);
11871
+ const activeOptionValue = ref();
11872
+ const optionsMap = computed(() => {
11873
+ const data2 = /* @__PURE__ */ new Map();
11874
+ options.value.forEach((option) => {
11875
+ data2.set(option.value, option);
11876
+ });
11877
+ return data2;
11878
+ });
11879
+ watch(modelValue, () => {
11880
+ var _a;
11881
+ handleSetSelectedData();
11882
+ if (multipleMode.value === "tag") {
11883
+ (_a = popoverRef.value) == null ? void 0 : _a.update();
11884
+ }
11885
+ });
11768
11886
  const isDisabled = computed(() => disabled.value || loading2.value);
11769
- const selectedLabel = computed(() => [...states.selectedOptions.values()].map((option) => option.label));
11770
- const isAllSelected = computed(() => [...options.value.values()].filter((option) => !option.disabled).every((option) => states.selectedOptions.has(option)));
11771
- const isGroup = computed(() => !!groups.value.size);
11772
- const isOptionsEmpty = computed(() => !options.value.size);
11773
- const isSearchEmpty = computed(() => {
11774
- const data2 = [...options.value.values()];
11775
- return data2.length && data2.every((option) => !option.visible);
11776
- });
11777
- const isRemoteSearch = computed(() => typeof remoteMethod.value === "function");
11887
+ const selectedLabel = computed(() => selected.value.map((data2) => data2.label));
11888
+ const isAllSelected = computed(() => {
11889
+ const normalSelectedValues = options.value.reduce((pre, option) => {
11890
+ if (!option.disabled) {
11891
+ pre.push(option.value);
11892
+ }
11893
+ return pre;
11894
+ }, []);
11895
+ return normalSelectedValues.length <= selected.value.length && normalSelectedValues.every((val) => selected.value.some((data2) => data2.value === val));
11896
+ });
11897
+ const isGroup = computed(() => !!groups.value.length);
11898
+ const isOptionsEmpty = computed(() => !options.value.length);
11899
+ const isSearchEmpty = computed(() => options.value.length && options.value.every((option) => !option.visible));
11900
+ const isRemoteSearch = computed(() => filterable.value && typeof remoteMethod.value === "function");
11778
11901
  const isShowSelectContent = computed(() => !(searchLoading.value || isOptionsEmpty.value || isSearchEmpty.value));
11779
11902
  const curContentText = computed(() => {
11780
11903
  if (searchLoading.value) {
@@ -11816,7 +11939,28 @@ var Component$f = defineComponent({
11816
11939
  } = usePopover({
11817
11940
  popoverMinWidth: popoverMinWidth.value
11818
11941
  });
11942
+ const isInput = computed(() => (filterable.value || allowCreate.value) && isPopoverShow.value);
11943
+ watch(isPopoverShow, (isShow) => {
11944
+ if (!isShow) {
11945
+ searchKey.value = "";
11946
+ } else {
11947
+ focus();
11948
+ initActiveOptionValue();
11949
+ }
11950
+ });
11951
+ const initActiveOptionValue = () => {
11952
+ var _a, _b;
11953
+ const firstValue = (_a = selected.value[0]) == null ? void 0 : _a.value;
11954
+ const option = optionsMap.value.get(firstValue);
11955
+ if (option && !option.disabled && option.visible) {
11956
+ activeOptionValue.value = firstValue;
11957
+ } else {
11958
+ activeOptionValue.value = (_b = options.value.find((option2) => !option2.disabled && option2.visible)) == null ? void 0 : _b.value;
11959
+ }
11960
+ };
11819
11961
  const defaultSearchMethod = (value) => {
11962
+ if (!filterable.value)
11963
+ return;
11820
11964
  options.value.forEach((option) => {
11821
11965
  var _a;
11822
11966
  option.visible = (_a = toLowerCase(String(option.label))) == null ? void 0 : _a.includes(toLowerCase(value));
@@ -11825,21 +11969,7 @@ var Component$f = defineComponent({
11825
11969
  const {
11826
11970
  searchKey,
11827
11971
  searchLoading
11828
- } = useRemoteSearch(isRemoteSearch.value ? remoteMethod.value : defaultSearchMethod);
11829
- const handleResetInputValue = () => {
11830
- const label = selectedLabel.value.join(",");
11831
- if (filterable.value && isPopoverShow.value) {
11832
- states.currentPlaceholder = label || placeholder.value;
11833
- states.currentSelectedLabel = "";
11834
- } else {
11835
- states.currentPlaceholder = placeholder.value;
11836
- states.currentSelectedLabel = label;
11837
- searchKey.value = "";
11838
- }
11839
- };
11840
- watch(isPopoverShow, () => {
11841
- handleResetInputValue();
11842
- });
11972
+ } = useRemoteSearch(isRemoteSearch.value ? remoteMethod.value : defaultSearchMethod, initActiveOptionValue);
11843
11973
  const emitChange = (val) => {
11844
11974
  if (val === modelValue.value)
11845
11975
  return;
@@ -11852,52 +11982,88 @@ var Component$f = defineComponent({
11852
11982
  togglePopover();
11853
11983
  emit("toggle", isPopoverShow.value);
11854
11984
  };
11855
- const handleInput = (e) => {
11856
- searchKey.value = e.target.value;
11985
+ const handleInputChange = (value) => {
11986
+ if (!filterable.value)
11987
+ return;
11988
+ searchKey.value = value;
11857
11989
  };
11858
- const selectedCallback = () => {
11859
- inputRef.value.focus();
11860
- popoverRef.value.update();
11861
- !searchKey.value && handleResetInputValue();
11990
+ const handleInputEnter = (value, e) => {
11991
+ if (!allowCreate.value || !value || filterable.value && options.value.find((data3) => toLowerCase(data3.label) === toLowerCase(value)))
11992
+ return;
11993
+ const data2 = optionsMap.value.get(value);
11994
+ if (data2)
11995
+ return;
11996
+ e.stopPropagation();
11997
+ if (multiple.value) {
11998
+ selected.value.push({
11999
+ label: value,
12000
+ value
12001
+ });
12002
+ emitChange(selected.value.map((data3) => data3.value));
12003
+ } else {
12004
+ selected.value = [{
12005
+ label: value,
12006
+ value
12007
+ }];
12008
+ emitChange(value);
12009
+ hidePopover();
12010
+ }
12011
+ searchKey.value = "";
11862
12012
  };
11863
12013
  const handleOptionSelected = (option) => {
11864
12014
  if (isDisabled.value || !option)
11865
12015
  return;
11866
12016
  if (multiple.value) {
11867
- if (states.selectedOptions.has(option)) {
11868
- states.selectedOptions.delete(option);
12017
+ const index = selected.value.findIndex((data2) => data2.value === option.value);
12018
+ if (index > -1) {
12019
+ selected.value.splice(index, 1);
11869
12020
  } else {
11870
- states.selectedOptions.add(option);
12021
+ selected.value.push({
12022
+ label: option.label,
12023
+ value: option.value
12024
+ });
11871
12025
  }
11872
- emitChange([...states.selectedOptions.values()].map((option2) => option2.value));
12026
+ emitChange(selected.value.map((data2) => data2.value));
11873
12027
  } else {
11874
- states.selectedOptions.clear();
11875
- states.selectedOptions.add(option);
12028
+ selected.value = [{
12029
+ label: option.label,
12030
+ value: option.value
12031
+ }];
11876
12032
  emitChange(option.value);
11877
12033
  hidePopover();
11878
12034
  }
11879
- selectedCallback();
12035
+ focus();
12036
+ };
12037
+ const focus = () => {
12038
+ var _a, _b;
12039
+ if (multipleMode.value === "tag") {
12040
+ (_a = selectTagInputRef.value) == null ? void 0 : _a.focus();
12041
+ } else {
12042
+ (_b = inputRef.value) == null ? void 0 : _b.focus();
12043
+ }
11880
12044
  };
11881
12045
  const handleClear = (e) => {
11882
12046
  e.stopPropagation();
11883
- states.selectedOptions.clear();
11884
- hidePopover();
11885
- handleResetInputValue();
12047
+ selected.value = [];
11886
12048
  emitChange(multiple.value ? [] : "");
11887
12049
  emit("clear", multiple.value ? [] : "");
12050
+ hidePopover();
11888
12051
  };
11889
12052
  const handleToggleAll = () => {
11890
12053
  if (isAllSelected.value) {
11891
- states.selectedOptions.clear();
12054
+ selected.value = [];
11892
12055
  } else {
11893
12056
  options.value.forEach((option) => {
11894
- if (option.disabled || states.selectedOptions.has(option))
12057
+ if (option.disabled || selected.value.find((data2) => data2.value === option.value))
11895
12058
  return;
11896
- states.selectedOptions.add(option);
12059
+ selected.value.push({
12060
+ label: option.label,
12061
+ value: option.value
12062
+ });
11897
12063
  });
11898
12064
  }
11899
- selectedCallback();
11900
- emitChange([...states.selectedOptions.values()].map((option) => option.value));
12065
+ emitChange(selected.value.map((data2) => data2.value));
12066
+ focus();
11901
12067
  };
11902
12068
  const handleScroll = (e) => {
11903
12069
  const {
@@ -11909,13 +12075,75 @@ var Component$f = defineComponent({
11909
12075
  emit("scroll-end");
11910
12076
  }
11911
12077
  };
12078
+ const handleDeleteTag = (data2) => {
12079
+ const index = selected.value.findIndex((select2) => select2.value === data2.value);
12080
+ if (index > -1) {
12081
+ selected.value.splice(index, 1);
12082
+ emitChange(selected.value.map((select2) => select2.value));
12083
+ }
12084
+ };
12085
+ const handleGetLabelByValue = (val) => {
12086
+ var _a, _b, _c;
12087
+ return ((_b = (_a = optionsMap.value) == null ? void 0 : _a.get(val)) == null ? void 0 : _b.label) || ((_c = selected.value.find((data2) => data2.value === val)) == null ? void 0 : _c.label) || val;
12088
+ };
12089
+ const handleSetSelectedData = () => {
12090
+ if (Array.isArray(modelValue.value)) {
12091
+ selected.value = modelValue.value.map((val) => ({
12092
+ label: handleGetLabelByValue(val),
12093
+ value: val
12094
+ }));
12095
+ } else if (modelValue.value !== void 0) {
12096
+ selected.value = [{
12097
+ label: handleGetLabelByValue(modelValue.value),
12098
+ value: modelValue.value
12099
+ }];
12100
+ }
12101
+ };
12102
+ const handleKeydown = (e) => {
12103
+ var _a, _b;
12104
+ const availableOptions = options.value.filter((option) => !option.disabled && option.visible);
12105
+ const index = availableOptions.findIndex((option) => option.value === activeOptionValue.value);
12106
+ if (!availableOptions.length || index === -1)
12107
+ return;
12108
+ switch (e.code) {
12109
+ case "ArrowDown": {
12110
+ e.preventDefault();
12111
+ const nextIndex = index >= availableOptions.length - 1 ? 0 : index + 1;
12112
+ activeOptionValue.value = (_a = availableOptions[nextIndex]) == null ? void 0 : _a.value;
12113
+ break;
12114
+ }
12115
+ case "ArrowUp": {
12116
+ e.preventDefault();
12117
+ const preIndex = index === 0 ? availableOptions.length - 1 : index - 1;
12118
+ activeOptionValue.value = (_b = availableOptions[preIndex]) == null ? void 0 : _b.value;
12119
+ break;
12120
+ }
12121
+ case "Backspace": {
12122
+ if (!multiple.value || !selected.value.length || searchKey.value.length)
12123
+ return;
12124
+ selected.value.pop();
12125
+ emitChange(selected.value.map((data2) => data2.value));
12126
+ break;
12127
+ }
12128
+ case "Enter": {
12129
+ if (!isPopoverShow.value) {
12130
+ isPopoverShow.value = true;
12131
+ } else {
12132
+ const option = options.value.find((option2) => option2.value === activeOptionValue.value);
12133
+ handleOptionSelected(option);
12134
+ }
12135
+ break;
12136
+ }
12137
+ }
12138
+ };
11912
12139
  const handleClickOutside = () => {
11913
12140
  hidePopover();
11914
12141
  handleBlur();
11915
12142
  };
11916
12143
  provide(selectKey, reactive({
11917
- props,
11918
- selectedOptions: unref(states.selectedOptions),
12144
+ multiple,
12145
+ selected,
12146
+ activeOptionValue,
11919
12147
  register,
11920
12148
  unregister,
11921
12149
  registerGroup,
@@ -11923,18 +12151,14 @@ var Component$f = defineComponent({
11923
12151
  handleOptionSelected
11924
12152
  }));
11925
12153
  onMounted(() => {
11926
- const initializeValue = Array.isArray(modelValue.value) ? modelValue.value : [modelValue.value];
11927
- options.value.forEach((option) => {
11928
- if (initializeValue.includes(option.value)) {
11929
- states.selectedOptions.add(option);
11930
- }
11931
- });
11932
- handleResetInputValue();
12154
+ handleSetSelectedData();
11933
12155
  setTimeout(() => {
11934
12156
  showOnInit.value && showPopover();
11935
12157
  });
11936
12158
  });
11937
- return __spreadProps(__spreadValues({}, toRefs(states)), {
12159
+ return {
12160
+ selected,
12161
+ isInput,
11938
12162
  options,
11939
12163
  isDisabled,
11940
12164
  selectedLabel,
@@ -11943,6 +12167,7 @@ var Component$f = defineComponent({
11943
12167
  popperWidth,
11944
12168
  popoverRef,
11945
12169
  inputRef,
12170
+ selectTagInputRef,
11946
12171
  searchLoading,
11947
12172
  isOptionsEmpty,
11948
12173
  isSearchEmpty,
@@ -11954,7 +12179,6 @@ var Component$f = defineComponent({
11954
12179
  setHover,
11955
12180
  cancelHover,
11956
12181
  handleFocus,
11957
- handleInput,
11958
12182
  handleTogglePopover,
11959
12183
  handleClear,
11960
12184
  onPopoverFirstUpdate,
@@ -11963,8 +12187,12 @@ var Component$f = defineComponent({
11963
12187
  handleToggleAll,
11964
12188
  handleOptionSelected,
11965
12189
  handleClickOutside,
11966
- handleScroll
11967
- });
12190
+ handleScroll,
12191
+ handleDeleteTag,
12192
+ handleInputChange,
12193
+ handleInputEnter,
12194
+ handleKeydown
12195
+ };
11968
12196
  },
11969
12197
  render() {
11970
12198
  const selectClass = classes({
@@ -11982,73 +12210,73 @@ var Component$f = defineComponent({
11982
12210
  offset: [0, 4]
11983
12211
  }
11984
12212
  }];
11985
- const renderSelectTrigger = () => {
11986
- var _a, _b;
11987
- const suffixIcon = () => {
11988
- if (this.loading) {
11989
- return createVNode(BkLoading, {
11990
- "loading": true,
11991
- "class": "spinner",
11992
- "mode": "spin",
11993
- "size": "mini"
11994
- }, null);
11995
- }
11996
- if (this.clearable && this.isHover) {
11997
- return createVNode(close$1, {
11998
- "class": "clear-icon",
11999
- "onClick": this.handleClear
12000
- }, null);
12001
- }
12002
- return createVNode(angleUp, {
12003
- "class": "angle-up"
12213
+ const suffixIcon = () => {
12214
+ if (this.loading) {
12215
+ return createVNode(BkLoading, {
12216
+ "loading": true,
12217
+ "class": "spinner",
12218
+ "mode": "spin",
12219
+ "size": "mini"
12004
12220
  }, null);
12005
- };
12006
- const renderTriggerInput = () => {
12007
- if (this.multipleMode === "tag") {
12008
- return createVNode("div", {
12009
- "class": "bk-select-tag"
12010
- }, [[...this.selectedOptions.values()].map((option) => createVNode(BkTag, {
12011
- "closable": true,
12012
- "style": {
12013
- marginTop: "3px"
12014
- },
12015
- "theme": this.tagTheme,
12016
- "onClose": () => this.handleOptionSelected(option)
12017
- }, {
12018
- default: () => [option.label]
12019
- })), withDirectives(createVNode("input", {
12020
- "class": "bk-select-tag-input",
12021
- "ref": "inputRef",
12022
- "type": "text",
12023
- "placeholder": !this.selectedOptions.size ? this.placeholder : "",
12024
- "readonly": !this.filterable || !this.isPopoverShow,
12025
- "onUpdate:modelValue": ($event) => this.searchKey = $event,
12026
- "onFocus": this.handleFocus
12027
- }, null), [[vModelText, this.searchKey]])]);
12028
- }
12029
- return withDirectives(createVNode("input", {
12030
- "ref": "inputRef",
12031
- "type": "text",
12032
- "class": "bk-select-input",
12033
- "style": {
12034
- paddingLeft: this.$slots.prefixIcon ? "20px" : "10px"
12035
- },
12036
- "onUpdate:modelValue": ($event) => this.currentSelectedLabel = $event,
12037
- "placeholder": this.currentPlaceholder,
12038
- "readonly": !this.filterable || !this.isPopoverShow,
12221
+ }
12222
+ if (this.clearable && this.isHover && this.selected.length) {
12223
+ return createVNode(close$1, {
12224
+ "class": "clear-icon",
12225
+ "onClick": this.handleClear
12226
+ }, null);
12227
+ }
12228
+ return createVNode(angleUp, {
12229
+ "class": "angle-up"
12230
+ }, null);
12231
+ };
12232
+ const renderTriggerInput = () => {
12233
+ if (this.multipleMode === "tag") {
12234
+ return createVNode(SelectTagInput, {
12235
+ "ref": "selectTagInputRef",
12236
+ "modelValue": this.searchKey,
12237
+ "onUpdate:modelValue": ($event) => this.searchKey = $event,
12238
+ "selected": this.selected,
12239
+ "tagTheme": this.tagTheme,
12240
+ "placeholder": this.placeholder,
12241
+ "filterable": this.isInput,
12039
12242
  "onFocus": this.handleFocus,
12040
- "onInput": this.handleInput
12041
- }, null), [[vModelText, this.currentSelectedLabel]]);
12042
- };
12043
- return createVNode("div", {
12044
- "class": "bk-select-trigger",
12045
- "onClick": this.handleTogglePopover,
12046
- "onMouseenter": this.setHover,
12047
- "onMouseleave": this.cancelHover
12048
- }, [this.$slots.prefixIcon ? createVNode("span", {
12049
- "class": "bk-select-prefix"
12050
- }, [(_b = (_a = this.$slots).prefixIcon) == null ? void 0 : _b.call(_a)]) : null, renderTriggerInput(), suffixIcon()]);
12243
+ "onRemove": this.handleDeleteTag,
12244
+ "onEnter": this.handleInputEnter
12245
+ }, {
12246
+ prefix: () => {
12247
+ var _a, _b;
12248
+ return (_b = (_a = this.$slots).prefix) == null ? void 0 : _b.call(_a);
12249
+ },
12250
+ suffix: () => suffixIcon()
12251
+ });
12252
+ }
12253
+ return createVNode(BkInput, {
12254
+ "ref": "inputRef",
12255
+ "type": "text",
12256
+ "modelValue": this.isInput ? this.searchKey : this.selectedLabel.join(","),
12257
+ "placeholder": this.isInput ? this.selectedLabel.join(",") || this.placeholder : this.placeholder,
12258
+ "readonly": !this.isInput,
12259
+ "disabled": this.isDisabled,
12260
+ "behavior": this.behavior,
12261
+ "size": this.size,
12262
+ "onFocus": this.handleFocus,
12263
+ "onInput": this.handleInputChange,
12264
+ "onEnter": this.handleInputEnter
12265
+ }, {
12266
+ prefix: () => {
12267
+ var _a, _b;
12268
+ return (_b = (_a = this.$slots).prefix) == null ? void 0 : _b.call(_a);
12269
+ },
12270
+ suffix: () => suffixIcon()
12271
+ });
12051
12272
  };
12273
+ const renderSelectTrigger = () => createVNode("div", {
12274
+ "class": "bk-select-trigger",
12275
+ "onClick": this.handleTogglePopover,
12276
+ "onMouseenter": this.setHover,
12277
+ "onMouseleave": this.cancelHover,
12278
+ "onKeydown": this.handleKeydown
12279
+ }, [renderTriggerInput()]);
12052
12280
  const renderSelectContent = () => {
12053
12281
  var _a, _b;
12054
12282
  return createVNode("div", null, [!this.isShowSelectContent && createVNode("div", {
@@ -12068,7 +12296,7 @@ var Component$f = defineComponent({
12068
12296
  "onScroll": this.handleScroll
12069
12297
  }, [withDirectives(createVNode("ul", {
12070
12298
  "class": "bk-select-options"
12071
- }, [this.multiple && this.showSelectAll && !this.searchKey && createVNode("li", {
12299
+ }, [this.multiple && this.showSelectAll && (!this.searchKey || !this.filterable) && createVNode("li", {
12072
12300
  "class": "bk-select-option",
12073
12301
  "onClick": this.handleToggleAll
12074
12302
  }, [this.selectAllText]), (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a), this.scrollLoading && createVNode("li", {
@@ -12815,12 +13043,33 @@ const resolveColumnWidth = (root, colgroups, autoWidth = 20) => {
12815
13043
  } = root.getBoundingClientRect() || {};
12816
13044
  let avgWidth = width - 4;
12817
13045
  const avgColIndexList = [];
13046
+ const getMinWidth = (col, computedWidth) => {
13047
+ const {
13048
+ minWidth = void 0
13049
+ } = col;
13050
+ if (minWidth === void 0) {
13051
+ return computedWidth;
13052
+ }
13053
+ let calcMinWidth = computedWidth;
13054
+ if (/^\d+\.?\d*$/.test(`${minWidth}`)) {
13055
+ calcMinWidth = Number(minWidth);
13056
+ }
13057
+ if (/^\d+\.?\d*%$/.test(`${minWidth}`)) {
13058
+ calcMinWidth = Number(minWidth) * width / 100;
13059
+ }
13060
+ if (/^\d+\.?\d*px$/i.test(`${minWidth}`)) {
13061
+ calcMinWidth = Number(`${minWidth}`.replace(/px/i, ""));
13062
+ }
13063
+ return calcMinWidth;
13064
+ };
12818
13065
  const resolveColNumberWidth = (col, numWidth, resetAvgWidth = true) => {
13066
+ const minWidth = getMinWidth(col, numWidth);
13067
+ const computedWidth = numWidth < minWidth ? minWidth : numWidth;
12819
13068
  Object.assign(col, {
12820
- calcWidth: numWidth
13069
+ calcWidth: computedWidth
12821
13070
  });
12822
13071
  if (resetAvgWidth) {
12823
- avgWidth = avgWidth - numWidth;
13072
+ avgWidth = avgWidth - computedWidth;
12824
13073
  if (avgWidth < 0) {
12825
13074
  avgWidth = 0;
12826
13075
  }
@@ -13210,6 +13459,7 @@ const tableProps = {
13210
13459
  field: PropTypes.oneOfType([PropTypes.func.def(() => ""), PropTypes.string.def("")]),
13211
13460
  render: PropTypes.oneOfType([PropTypes.func.def(() => ""), PropTypes.string.def("")]),
13212
13461
  width: PropTypes.oneOfType([PropTypes.number.def(void 0), PropTypes.string.def("auto")]),
13462
+ minWidth: PropTypes.oneOfType([PropTypes.number.def(void 0), PropTypes.string.def("auto")]).def(),
13213
13463
  type: PropTypes.commonType(["selection", "index", "expand", "none"], "columnType").def("none"),
13214
13464
  resizable: PropTypes.bool.def(true),
13215
13465
  fixed: PropTypes.oneOfType([
@@ -13232,7 +13482,7 @@ const tableProps = {
13232
13482
  PropTypes.bool,
13233
13483
  PropTypes.string
13234
13484
  ]).def(false)
13235
- })),
13485
+ })).def([]),
13236
13486
  activeColumn: PropTypes.oneOfType([PropTypes.number.def(-1), PropTypes.arrayOf(PropTypes.number.def(-1))]),
13237
13487
  columnPick: PropTypes.commonType(["multi", "single", "disabled"], "columnPick").def("disabled"),
13238
13488
  height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).def("auto"),
@@ -13306,7 +13556,7 @@ var useLimit = () => {
13306
13556
  "disabled": proxy.disabled
13307
13557
  }, _isSlot$2(_slot = proxy.limitList.map((num, index) => createVNode(BkOption, {
13308
13558
  "value": num,
13309
- "label": num,
13559
+ "label": `${num}`,
13310
13560
  "key": `${index}_${num}`
13311
13561
  }, null))) ? _slot : {
13312
13562
  default: () => [_slot]
@@ -14131,6 +14381,14 @@ class TableRender {
14131
14381
  }, [this.renderColGroup(), this.renderHeader()])];
14132
14382
  }
14133
14383
  renderTableBodySchema(rows) {
14384
+ var _a, _b, _c;
14385
+ if (!rows.length) {
14386
+ return (_c = (_b = (_a = this.context.slots).empty) == null ? void 0 : _b.call(_a)) != null ? _c : createVNode(BodyEmpty, {
14387
+ "filterList": rows,
14388
+ "list": this.props.data,
14389
+ "emptyText": this.props.emptyText
14390
+ }, null);
14391
+ }
14134
14392
  return createVNode("table", {
14135
14393
  "cellpadding": 0,
14136
14394
  "cellspacing": 0
@@ -14276,11 +14534,10 @@ class TableRender {
14276
14534
  }, [renderHeadCell(column, index)])]))])]);
14277
14535
  }
14278
14536
  renderTBody(rows) {
14279
- var _a, _b, _c;
14280
14537
  const {
14281
14538
  getFixedColumnStyleResolve
14282
14539
  } = useFixedColumn(this.props, this.colgroups);
14283
- return createVNode("tbody", null, [rows.length ? rows.map((row, rowIndex) => {
14540
+ return createVNode("tbody", null, [rows.map((row, rowIndex) => {
14284
14541
  const rowStyle = {
14285
14542
  "--row-height": `${this.getRowHeight(row, rowIndex)}px`
14286
14543
  };
@@ -14300,14 +14557,7 @@ class TableRender {
14300
14557
  }, [createVNode("div", {
14301
14558
  "class": "cell"
14302
14559
  }, [this.renderCell(row, column, rowIndex, rows)])]))]);
14303
- }) : createVNode("tr", null, [createVNode("td", {
14304
- "colspan": this.props.columns.length,
14305
- "class": "empty-cell"
14306
- }, [(_c = (_b = (_a = this.context.slots).empty) == null ? void 0 : _b.call(_a)) != null ? _c : createVNode(BodyEmpty, {
14307
- "filterList": rows,
14308
- "list": this.props.data,
14309
- "emptyText": this.props.emptyText
14310
- }, null)])])]);
14560
+ })]);
14311
14561
  }
14312
14562
  handleRowClick(e, row, index, rows) {
14313
14563
  this.context.emit("rowClick", e, row, index, rows, this);
@@ -14344,7 +14594,7 @@ class TableRender {
14344
14594
  return this.reactiveProp.setting;
14345
14595
  }
14346
14596
  }
14347
- const useClass = (props, root, reactiveProp) => {
14597
+ const useClass = (props, root, reactiveProp, pageData) => {
14348
14598
  const autoHeight = ref(200);
14349
14599
  const hasScrollY = ref(false);
14350
14600
  const hasFooter = computed(() => props.pagination && props.data.length);
@@ -14363,9 +14613,9 @@ const useClass = (props, root, reactiveProp) => {
14363
14613
  "--scroll-head-left": `-${reactiveProp.scrollTranslateX}px`,
14364
14614
  "--scroll-left": `${reactiveProp.scrollTranslateX}px`
14365
14615
  }));
14366
- const contentClass = classes({
14616
+ const contentClass = {
14367
14617
  [resolveClassName("table-body")]: true
14368
- });
14618
+ };
14369
14619
  const footerClass = computed(() => classes({
14370
14620
  [resolveClassName("table-footer")]: true,
14371
14621
  ["is-hidden"]: !props.pagination || !props.data.length
@@ -14399,7 +14649,7 @@ const useClass = (props, root, reactiveProp) => {
14399
14649
  const maxHeight = resolveMaxHeight - resolveHeadHeight - resolveFooterHeight;
14400
14650
  const minHeight = resolveMinHeight - resolveHeadHeight - resolveFooterHeight;
14401
14651
  Object.assign(contentStyle, {
14402
- display: "block",
14652
+ display: (pageData == null ? void 0 : pageData.length) ? "block" : false,
14403
14653
  "max-height": `${maxHeight}px`,
14404
14654
  "min-height": `${minHeight}px`,
14405
14655
  height
@@ -14439,7 +14689,8 @@ var Component$9 = defineComponent({
14439
14689
  props: tableProps,
14440
14690
  emits: EMIT_EVENT_TYPES,
14441
14691
  setup(props, ctx) {
14442
- const colgroups = reactive(props.columns.map((col) => __spreadProps(__spreadValues({}, col), {
14692
+ var _a;
14693
+ const colgroups = reactive(((_a = props.columns) != null ? _a : []).map((col) => __spreadProps(__spreadValues({}, col), {
14443
14694
  calcWidth: null,
14444
14695
  resizeWidth: null,
14445
14696
  listeners: /* @__PURE__ */ new Map()
@@ -14484,7 +14735,7 @@ var Component$9 = defineComponent({
14484
14735
  updateBorderClass,
14485
14736
  resetTableHeight,
14486
14737
  hasFooter
14487
- } = useClass(props, root, reactiveProp);
14738
+ } = useClass(props, root, reactiveProp, pageData);
14488
14739
  const {
14489
14740
  renderFixedColumns,
14490
14741
  fixedWrapperClass
@@ -14533,14 +14784,14 @@ var Component$9 = defineComponent({
14533
14784
  index
14534
14785
  });
14535
14786
  }).on(EVENTS$1.ON_SETTING_CHANGE, (args) => {
14536
- var _a, _b;
14787
+ var _a2, _b;
14537
14788
  const {
14538
14789
  checked = [],
14539
14790
  size,
14540
14791
  height
14541
14792
  } = args;
14542
14793
  checked.length && resolveColumnWidth(root.value, colgroups, 20);
14543
- (_b = (_a = refVirtualRender.value) == null ? void 0 : _a.reset) == null ? void 0 : _b.call(_a);
14794
+ (_b = (_a2 = refVirtualRender.value) == null ? void 0 : _a2.reset) == null ? void 0 : _b.call(_a2);
14544
14795
  ctx.emit(EMITEVENTS.SETTING_CHANGE, {
14545
14796
  checked,
14546
14797
  size,
@@ -14561,6 +14812,9 @@ var Component$9 = defineComponent({
14561
14812
  onMounted(() => {
14562
14813
  observerIns = observerResize(root.value, () => {
14563
14814
  resolveColumnWidth(root.value, colgroups, 20);
14815
+ if (props.height === "100%") {
14816
+ resetTableHeight(root.value);
14817
+ }
14564
14818
  }, 60, true);
14565
14819
  observerIns.start();
14566
14820
  });
@@ -14572,6 +14826,13 @@ var Component$9 = defineComponent({
14572
14826
  ctx.expose({
14573
14827
  plugins: tableRender.plugins
14574
14828
  });
14829
+ const tableBodyClass = __spreadProps(__spreadValues({}, contentClass), {
14830
+ "__is-empty": !pageData.length
14831
+ });
14832
+ const tableBodyContentClass = {
14833
+ [resolveClassName("table-body-content")]: true,
14834
+ "with-virtual-render": props.virtualEnabled
14835
+ };
14575
14836
  return () => createVNode("div", {
14576
14837
  "class": tableClass.value,
14577
14838
  "style": wrapperStyle.value,
@@ -14584,9 +14845,10 @@ var Component$9 = defineComponent({
14584
14845
  createVNode(BkVirtualRender, {
14585
14846
  "ref": refVirtualRender,
14586
14847
  "lineHeight": tableRender.getRowHeight,
14587
- "class": contentClass,
14848
+ "class": tableBodyClass,
14588
14849
  "style": contentStyle,
14589
14850
  "list": pageData,
14851
+ "contentClassName": tableBodyContentClass,
14590
14852
  "onContentScroll": handleScrollChanged,
14591
14853
  "throttleDelay": 0,
14592
14854
  "scrollEvent": true,
@@ -15117,12 +15379,12 @@ var Component$8 = defineComponent({
15117
15379
  e == null ? void 0 : e.stopPropagation();
15118
15380
  removeTag(data2, index);
15119
15381
  clearInput();
15120
- handleChange("remove");
15382
+ handleChange("remove", data2);
15121
15383
  tagInputRef.value.style.width = `${INPUT_MIN_WIDTH}px`;
15122
15384
  };
15123
- const handleChange = (type) => {
15385
+ const handleChange = (type, data2) => {
15124
15386
  emit("change", tagList.value);
15125
- emit(type);
15387
+ emit(type, data2);
15126
15388
  emit("update:modelValue", tagList.value);
15127
15389
  };
15128
15390
  const handleClear = (e) => {
@@ -15458,54 +15720,57 @@ var Component$8 = defineComponent({
15458
15720
  "isShow": this.popoverProps.isShow,
15459
15721
  "modifiers": this.popoverProps.modifiers
15460
15722
  }, {
15461
- default: () => createVNode("div", {
15462
- "class": this.triggerClass
15463
- }, [createVNode("ul", {
15464
- "class": "tag-list",
15465
- "ref": "tagListRef",
15466
- "style": {
15467
- marginLeft: `${this.leftSpace}px`
15468
- }
15469
- }, [this.selectedTagList.map((item, index) => {
15470
- const tooltips2 = {
15471
- boundary: "window",
15472
- theme: "light",
15473
- distance: 12,
15474
- content: item[this.tooltipKey],
15475
- disabled: !this.tooltipKey
15476
- };
15477
- return withDirectives(createVNode("li", {
15478
- "class": "tag-item",
15479
- "onClick": this.tagFocus
15480
- }, [createVNode(TagRender, {
15481
- "node": item,
15482
- "tpl": this.tagTpl,
15483
- "displayKey": this.displayKey
15484
- }, null), this.showTagClose ? createVNode(error, {
15485
- "class": "remove-tag",
15486
- "onClick": this.handleTagRemove.bind(this, item, index)
15487
- }, null) : null]), [[resolveDirective("bk-tooltips"), tooltips2]]);
15488
- }), withDirectives(createVNode("li", {
15489
- "ref": "tagInputItemRef",
15490
- "id": "tagInputItem",
15491
- "class": "tag-input-item",
15492
- "role": "input"
15493
- }, [withDirectives(createVNode("input", {
15494
- "type": "text",
15495
- "class": "tag-input",
15496
- "ref": "tagInputRef",
15497
- "onUpdate:modelValue": ($event) => this.curInputValue = $event,
15498
- "onInput": this.handleInput,
15499
- "onFocus": this.handleFocus,
15500
- "onBlur": this.handleBlur,
15501
- "onKeydown": this.handleKeydown,
15502
- "onPaste": this.handlePaste
15503
- }, null), [[vModelText, this.curInputValue]])]), [[vShow, this.isEdit]])]), withDirectives(createVNode("p", {
15504
- "class": "placeholder"
15505
- }, [this.placeholder]), [[vShow, this.isShowPlaceholder]]), this.isShowClear ? createVNode(close$1, {
15506
- "class": "clear-icon",
15507
- "onClick": this.handleClear
15508
- }, null) : null]),
15723
+ default: () => {
15724
+ var _a, _b, _c;
15725
+ return createVNode("div", {
15726
+ "class": this.triggerClass
15727
+ }, [createVNode("ul", {
15728
+ "class": "tag-list",
15729
+ "ref": "tagListRef",
15730
+ "style": {
15731
+ marginLeft: `${this.leftSpace}px`
15732
+ }
15733
+ }, [this.selectedTagList.map((item, index) => {
15734
+ const tooltips2 = {
15735
+ boundary: "window",
15736
+ theme: "light",
15737
+ distance: 12,
15738
+ content: item[this.tooltipKey],
15739
+ disabled: !this.tooltipKey
15740
+ };
15741
+ return withDirectives(createVNode("li", {
15742
+ "class": "tag-item",
15743
+ "onClick": this.tagFocus
15744
+ }, [createVNode(TagRender, {
15745
+ "node": item,
15746
+ "tpl": this.tagTpl,
15747
+ "displayKey": this.displayKey
15748
+ }, null), this.showTagClose ? createVNode(error, {
15749
+ "class": "remove-tag",
15750
+ "onClick": this.handleTagRemove.bind(this, item, index)
15751
+ }, null) : null]), [[resolveDirective("bk-tooltips"), tooltips2]]);
15752
+ }), withDirectives(createVNode("li", {
15753
+ "ref": "tagInputItemRef",
15754
+ "id": "tagInputItem",
15755
+ "class": "tag-input-item",
15756
+ "role": "input"
15757
+ }, [withDirectives(createVNode("input", {
15758
+ "type": "text",
15759
+ "class": "tag-input",
15760
+ "ref": "tagInputRef",
15761
+ "onUpdate:modelValue": ($event) => this.curInputValue = $event,
15762
+ "onInput": this.handleInput,
15763
+ "onFocus": this.handleFocus,
15764
+ "onBlur": this.handleBlur,
15765
+ "onKeydown": this.handleKeydown,
15766
+ "onPaste": this.handlePaste
15767
+ }, null), [[vModelText, this.curInputValue]])]), [[vShow, this.isEdit]])]), withDirectives(createVNode("p", {
15768
+ "class": "placeholder"
15769
+ }, [this.placeholder]), [[vShow, this.isShowPlaceholder]]), (_c = (_b = (_a = this.$slots) == null ? void 0 : _a.suffix) == null ? void 0 : _b.call(_a)) != null ? _c : this.isShowClear && createVNode(close$1, {
15770
+ "class": "clear-icon",
15771
+ "onClick": this.handleClear
15772
+ }, null)]);
15773
+ },
15509
15774
  content: () => createVNode("div", {
15510
15775
  "class": "bk-selector-list"
15511
15776
  }, [createVNode("ul", {
@@ -21080,9 +21345,7 @@ var Component$4 = defineComponent({
21080
21345
  };
21081
21346
  return this.$slots[dirct] ? createVNode("div", {
21082
21347
  "class": "slot-header"
21083
- }, [createVNode("div", {
21084
- "class": "slot-content"
21085
- }, [this.$slots[dirct]()])]) : createVNode("div", {
21348
+ }, [this.$slots[dirct]()]) : createVNode("div", {
21086
21349
  "class": "header"
21087
21350
  }, [`${titleText}\uFF08\u5171${this.dataList.length}\u6761\uFF09`, createVNode("span", {
21088
21351
  "class": {
@@ -22095,7 +22358,19 @@ var useTreeInit = (props) => {
22095
22358
  }
22096
22359
  return uid || item[NODE_ATTRIBUTES.UUID] || uuid_1.v4();
22097
22360
  }
22361
+ const cachedDefaultVal = {
22362
+ [NODE_ATTRIBUTES.IS_OPEN]: () => false,
22363
+ [NODE_ATTRIBUTES.IS_CHECKED]: () => false,
22364
+ [NODE_ATTRIBUTES.IS_MATCH]: () => true,
22365
+ [NODE_ATTRIBUTES.IS_SELECTED]: (uuid2) => props2.selected === uuid2,
22366
+ [NODE_ATTRIBUTES.IS_CACHED]: () => false,
22367
+ [NODE_ATTRIBUTES.IS_ASYNC]: () => null
22368
+ };
22098
22369
  function getCachedTreeNodeAttr(uuid2, node, cachedAttr, defVal = void 0) {
22370
+ let defaultValue = defVal;
22371
+ if (defVal === void 0 && typeof cachedDefaultVal[cachedAttr] === "function") {
22372
+ defaultValue = cachedDefaultVal[cachedAttr](uuid2, node);
22373
+ }
22099
22374
  const sourceAttr = NODE_SOURCE_ATTRS[cachedAttr];
22100
22375
  if (Object.prototype.hasOwnProperty.call(node, sourceAttr)) {
22101
22376
  return node[sourceAttr];
@@ -22106,27 +22381,15 @@ var useTreeInit = (props) => {
22106
22381
  result = cached[cachedAttr];
22107
22382
  }
22108
22383
  if (result === void 0 || result === null) {
22109
- result = defVal;
22384
+ result = defaultValue;
22110
22385
  }
22111
22386
  return result;
22112
22387
  }
22113
- function isCachedTreeNodeOpened(uuid2, node) {
22114
- return getCachedTreeNodeAttr(uuid2, node, NODE_ATTRIBUTES.IS_OPEN, false);
22115
- }
22116
- function isCachedTreeNodeChecked(uuid2, node) {
22117
- return getCachedTreeNodeAttr(uuid2, node, NODE_ATTRIBUTES.IS_CHECKED, false);
22118
- }
22119
- function isCachedTreeNodeMatch(uuid2, node) {
22120
- return getCachedTreeNodeAttr(uuid2, node, NODE_ATTRIBUTES.IS_MATCH, true);
22121
- }
22122
22388
  function isCachedTreeNodeSelected(uuid2, node) {
22123
- return getCachedTreeNodeAttr(uuid2, node, NODE_ATTRIBUTES.IS_SELECTED, false);
22124
- }
22125
- function isCachedTreeNodeHasCached(uuid2, node) {
22126
- return getCachedTreeNodeAttr(uuid2, node, NODE_ATTRIBUTES.IS_CACHED, false);
22127
- }
22128
- function isCachedTreeNodeAsync(uuid2, node) {
22129
- return getCachedTreeNodeAttr(uuid2, node, NODE_ATTRIBUTES.IS_ASYNC, null);
22389
+ if (!props2.selectable) {
22390
+ return false;
22391
+ }
22392
+ return getCachedTreeNodeAttr(uuid2, node, NODE_ATTRIBUTES.IS_SELECTED, props2.selected === uuid2);
22130
22393
  }
22131
22394
  function isCachedTreeNodeLoading(uuid2, node) {
22132
22395
  if (Object.prototype.hasOwnProperty.call(node, NODE_ATTRIBUTES.IS_LOADING)) {
@@ -22157,12 +22420,12 @@ var useTreeInit = (props) => {
22157
22420
  [NODE_ATTRIBUTES.PATH]: currentPath,
22158
22421
  [NODE_ATTRIBUTES.IS_ROOT]: parent === null,
22159
22422
  [NODE_ATTRIBUTES.ORDER]: order2,
22160
- [NODE_ATTRIBUTES.IS_SELECTED]: props2.selectable ? isCachedTreeNodeSelected(uuid2, item) : false,
22161
- [NODE_ATTRIBUTES.IS_MATCH]: isCachedTreeNodeMatch(uuid2, item),
22162
- [NODE_ATTRIBUTES.IS_OPEN]: isCachedTreeNodeOpened(uuid2, item),
22163
- [NODE_ATTRIBUTES.IS_CHECKED]: isCachedTreeNodeChecked(uuid2, item),
22164
- [NODE_ATTRIBUTES.IS_CACHED]: isCachedTreeNodeHasCached(uuid2, item),
22165
- [NODE_ATTRIBUTES.IS_ASYNC]: isCachedTreeNodeAsync(uuid2, item),
22423
+ [NODE_ATTRIBUTES.IS_SELECTED]: isCachedTreeNodeSelected(uuid2, item),
22424
+ [NODE_ATTRIBUTES.IS_MATCH]: getCachedTreeNodeAttr(uuid2, item, NODE_ATTRIBUTES.IS_MATCH),
22425
+ [NODE_ATTRIBUTES.IS_OPEN]: getCachedTreeNodeAttr(uuid2, item, NODE_ATTRIBUTES.IS_OPEN),
22426
+ [NODE_ATTRIBUTES.IS_CHECKED]: getCachedTreeNodeAttr(uuid2, item, NODE_ATTRIBUTES.IS_CHECKED),
22427
+ [NODE_ATTRIBUTES.IS_CACHED]: getCachedTreeNodeAttr(uuid2, item, NODE_ATTRIBUTES.IS_CACHED),
22428
+ [NODE_ATTRIBUTES.IS_ASYNC]: getCachedTreeNodeAttr(uuid2, item, NODE_ATTRIBUTES.IS_ASYNC),
22166
22429
  [NODE_ATTRIBUTES.IS_LOADING]: isCachedTreeNodeLoading(uuid2, item),
22167
22430
  [children]: null
22168
22431
  };