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

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 (39) hide show
  1. package/dist/index.cjs.js +27 -27
  2. package/dist/index.esm.js +466 -212
  3. package/dist/index.umd.js +26 -26
  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/loading/loading.css +4 -3
  14. package/lib/loading/loading.less +4 -3
  15. package/lib/loading/loading.variable.css +4 -3
  16. package/lib/pagination/index.js +1 -1
  17. package/lib/select/common.d.ts +4 -4
  18. package/lib/select/index.d.ts +563 -212
  19. package/lib/select/index.js +1 -1
  20. package/lib/select/option.d.ts +11 -4
  21. package/lib/select/select.css +31 -59
  22. package/lib/select/select.d.ts +168 -62
  23. package/lib/select/select.less +43 -51
  24. package/lib/select/select.variable.css +31 -59
  25. package/lib/select/selectTagInput.d.ts +71 -0
  26. package/lib/select/type.d.ts +9 -5
  27. package/lib/shared/index.js +1 -1
  28. package/lib/tab/index.d.ts +7 -7
  29. package/lib/tab/tab.d.ts +2 -2
  30. package/lib/table/index.js +1 -1
  31. package/lib/table/props.d.ts +1 -0
  32. package/lib/tag-input/index.d.ts +4 -4
  33. package/lib/tag-input/index.js +1 -1
  34. package/lib/tag-input/tag-input.d.ts +1 -1
  35. package/lib/transfer/index.js +1 -1
  36. package/lib/transfer/transfer.css +41 -60
  37. package/lib/transfer/transfer.less +55 -82
  38. package/lib/transfer/transfer.variable.css +41 -60
  39. 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([
@@ -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]
@@ -14561,6 +14811,9 @@ var Component$9 = defineComponent({
14561
14811
  onMounted(() => {
14562
14812
  observerIns = observerResize(root.value, () => {
14563
14813
  resolveColumnWidth(root.value, colgroups, 20);
14814
+ if (props.height === "100%") {
14815
+ resetTableHeight(root.value);
14816
+ }
14564
14817
  }, 60, true);
14565
14818
  observerIns.start();
14566
14819
  });
@@ -15117,12 +15370,12 @@ var Component$8 = defineComponent({
15117
15370
  e == null ? void 0 : e.stopPropagation();
15118
15371
  removeTag(data2, index);
15119
15372
  clearInput();
15120
- handleChange("remove");
15373
+ handleChange("remove", data2);
15121
15374
  tagInputRef.value.style.width = `${INPUT_MIN_WIDTH}px`;
15122
15375
  };
15123
- const handleChange = (type) => {
15376
+ const handleChange = (type, data2) => {
15124
15377
  emit("change", tagList.value);
15125
- emit(type);
15378
+ emit(type, data2);
15126
15379
  emit("update:modelValue", tagList.value);
15127
15380
  };
15128
15381
  const handleClear = (e) => {
@@ -15458,54 +15711,57 @@ var Component$8 = defineComponent({
15458
15711
  "isShow": this.popoverProps.isShow,
15459
15712
  "modifiers": this.popoverProps.modifiers
15460
15713
  }, {
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]),
15714
+ default: () => {
15715
+ var _a, _b, _c;
15716
+ return createVNode("div", {
15717
+ "class": this.triggerClass
15718
+ }, [createVNode("ul", {
15719
+ "class": "tag-list",
15720
+ "ref": "tagListRef",
15721
+ "style": {
15722
+ marginLeft: `${this.leftSpace}px`
15723
+ }
15724
+ }, [this.selectedTagList.map((item, index) => {
15725
+ const tooltips2 = {
15726
+ boundary: "window",
15727
+ theme: "light",
15728
+ distance: 12,
15729
+ content: item[this.tooltipKey],
15730
+ disabled: !this.tooltipKey
15731
+ };
15732
+ return withDirectives(createVNode("li", {
15733
+ "class": "tag-item",
15734
+ "onClick": this.tagFocus
15735
+ }, [createVNode(TagRender, {
15736
+ "node": item,
15737
+ "tpl": this.tagTpl,
15738
+ "displayKey": this.displayKey
15739
+ }, null), this.showTagClose ? createVNode(error, {
15740
+ "class": "remove-tag",
15741
+ "onClick": this.handleTagRemove.bind(this, item, index)
15742
+ }, null) : null]), [[resolveDirective("bk-tooltips"), tooltips2]]);
15743
+ }), withDirectives(createVNode("li", {
15744
+ "ref": "tagInputItemRef",
15745
+ "id": "tagInputItem",
15746
+ "class": "tag-input-item",
15747
+ "role": "input"
15748
+ }, [withDirectives(createVNode("input", {
15749
+ "type": "text",
15750
+ "class": "tag-input",
15751
+ "ref": "tagInputRef",
15752
+ "onUpdate:modelValue": ($event) => this.curInputValue = $event,
15753
+ "onInput": this.handleInput,
15754
+ "onFocus": this.handleFocus,
15755
+ "onBlur": this.handleBlur,
15756
+ "onKeydown": this.handleKeydown,
15757
+ "onPaste": this.handlePaste
15758
+ }, null), [[vModelText, this.curInputValue]])]), [[vShow, this.isEdit]])]), withDirectives(createVNode("p", {
15759
+ "class": "placeholder"
15760
+ }, [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, {
15761
+ "class": "clear-icon",
15762
+ "onClick": this.handleClear
15763
+ }, null)]);
15764
+ },
15509
15765
  content: () => createVNode("div", {
15510
15766
  "class": "bk-selector-list"
15511
15767
  }, [createVNode("ul", {
@@ -21080,9 +21336,7 @@ var Component$4 = defineComponent({
21080
21336
  };
21081
21337
  return this.$slots[dirct] ? createVNode("div", {
21082
21338
  "class": "slot-header"
21083
- }, [createVNode("div", {
21084
- "class": "slot-content"
21085
- }, [this.$slots[dirct]()])]) : createVNode("div", {
21339
+ }, [this.$slots[dirct]()]) : createVNode("div", {
21086
21340
  "class": "header"
21087
21341
  }, [`${titleText}\uFF08\u5171${this.dataList.length}\u6761\uFF09`, createVNode("span", {
21088
21342
  "class": {