bkui-vue 0.0.1-beta.25 → 0.0.1-beta.26

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.
@@ -81,6 +81,7 @@ var __publicField = (obj, key, value) => {
81
81
  var transfer = "";
82
82
  var pagination = "";
83
83
  var timeline = "";
84
+ var resizeLayout = "";
84
85
  const BKLAYERD_INDEX_EFAULT_VALUE = {
85
86
  ["bottom"]: 0,
86
87
  ["content"]: 1,
@@ -9529,8 +9530,9 @@ ${$(r2)}`), n2;
9529
9530
  };
9530
9531
  });
9531
9532
  const handleManualShow = (val) => {
9533
+ var _a, _b;
9532
9534
  if (trigger.value === "manual" && isPopInstance) {
9533
- val ? popoverInstance.show() : popoverInstance.hide();
9535
+ val ? (_a = popoverInstance.show) == null ? void 0 : _a.call(popoverInstance) : (_b = popoverInstance.hide) == null ? void 0 : _b.call(popoverInstance);
9534
9536
  }
9535
9537
  };
9536
9538
  vue.watch(() => props.isShow, (val) => {
@@ -9607,7 +9609,7 @@ ${$(r2)}`), n2;
9607
9609
  "ref": refContent,
9608
9610
  "class": contentClass,
9609
9611
  "style": compStyle.value
9610
- }, customTheme), [(_c = (_b2 = (_a2 = ctx.slots).content) == null ? void 0 : _b2.call(_a2)) != null ? _c : content.value, arrow2 && vue.createVNode("div", {
9612
+ }, customTheme), [(_c = (_b2 = (_a2 = ctx.slots).content) == null ? void 0 : _b2.call(_a2)) != null ? _c : content.value, arrow2.value && vue.createVNode("div", {
9611
9613
  "class": "arrow",
9612
9614
  "data-popper-arrow": true
9613
9615
  }, null)])];
@@ -10359,22 +10361,79 @@ ${$(r2)}`), n2;
10359
10361
  cancelHover
10360
10362
  };
10361
10363
  }
10364
+ function useRegistry(data2) {
10365
+ const register = (item) => {
10366
+ if (!item)
10367
+ return;
10368
+ return data2.value.add(item);
10369
+ };
10370
+ const unregister = (item) => data2.value.delete(item);
10371
+ return {
10372
+ register,
10373
+ unregister
10374
+ };
10375
+ }
10362
10376
  function useDebouncedRef(value, delay = 200) {
10363
10377
  let timeout;
10378
+ let innerValue = value;
10364
10379
  return vue.customRef((track, trigger) => ({
10365
10380
  get() {
10366
10381
  track();
10367
- return value;
10382
+ return innerValue;
10368
10383
  },
10369
10384
  set(newValue) {
10370
10385
  clearTimeout(timeout);
10371
10386
  timeout = setTimeout(() => {
10372
- value = newValue;
10387
+ innerValue = newValue;
10373
10388
  trigger();
10374
10389
  }, delay);
10375
10390
  }
10376
10391
  }));
10377
10392
  }
10393
+ function usePopover(config) {
10394
+ const { popoverMinWidth } = config;
10395
+ const popperWidth = vue.ref("auto");
10396
+ const isPopoverShow = vue.ref(false);
10397
+ const onPopoverFirstUpdate = (instance) => {
10398
+ const { reference: reference2 } = instance.elements;
10399
+ popperWidth.value = Math.max(reference2.offsetWidth, popoverMinWidth);
10400
+ };
10401
+ const togglePopover = () => {
10402
+ isPopoverShow.value = !isPopoverShow.value;
10403
+ };
10404
+ const hidePopover = () => {
10405
+ isPopoverShow.value = false;
10406
+ };
10407
+ const showPopover = () => {
10408
+ isPopoverShow.value = true;
10409
+ };
10410
+ return {
10411
+ isPopoverShow,
10412
+ popperWidth,
10413
+ togglePopover,
10414
+ onPopoverFirstUpdate,
10415
+ hidePopover,
10416
+ showPopover
10417
+ };
10418
+ }
10419
+ function useRemoteSearch(method) {
10420
+ const searchKey = useDebouncedRef("");
10421
+ const searchLoading = vue.ref(false);
10422
+ vue.watch(searchKey, async () => {
10423
+ searchLoading.value = true;
10424
+ await method(searchKey.value);
10425
+ searchLoading.value = false;
10426
+ });
10427
+ return {
10428
+ searchKey,
10429
+ searchLoading
10430
+ };
10431
+ }
10432
+ function toLowerCase(value = "") {
10433
+ if (!value)
10434
+ return value;
10435
+ return String(value).trim().toLowerCase();
10436
+ }
10378
10437
  var BkOption = vue.defineComponent({
10379
10438
  name: "Option",
10380
10439
  props: {
@@ -10390,28 +10449,12 @@ ${$(r2)}`), n2;
10390
10449
  visible: true
10391
10450
  });
10392
10451
  const {
10393
- disabled,
10394
- label
10452
+ disabled
10395
10453
  } = vue.toRefs(props);
10396
10454
  const select2 = vue.inject(selectKey, null);
10397
10455
  const group = vue.inject(optionGroupKey, null);
10398
10456
  const selected = vue.computed(() => select2.selectedOptions.has(proxy));
10399
10457
  const multiple = vue.computed(() => select2 == null ? void 0 : select2.props.multiple);
10400
- vue.watchEffect(() => {
10401
- var _a;
10402
- if (group == null ? void 0 : group.groupCollapse) {
10403
- states.visible = false;
10404
- } else if (!(select2 == null ? void 0 : select2.isRemoteSearch) && (select2 == null ? void 0 : select2.searchKey)) {
10405
- states.visible = (_a = toLowerCase(String(label.value))) == null ? void 0 : _a.includes(toLowerCase(select2 == null ? void 0 : select2.searchKey));
10406
- } else {
10407
- states.visible = true;
10408
- }
10409
- });
10410
- const toLowerCase = (value = "") => {
10411
- if (!value)
10412
- return value;
10413
- return String(value).trim().toLowerCase();
10414
- };
10415
10458
  const handleOptionClick = () => {
10416
10459
  if (disabled.value)
10417
10460
  return;
@@ -10419,9 +10462,11 @@ ${$(r2)}`), n2;
10419
10462
  };
10420
10463
  vue.onBeforeMount(() => {
10421
10464
  select2 == null ? void 0 : select2.register(proxy);
10465
+ group == null ? void 0 : group.register(proxy);
10422
10466
  });
10423
10467
  vue.onBeforeUnmount(() => {
10424
10468
  select2 == null ? void 0 : select2.unregister(proxy);
10469
+ group == null ? void 0 : group.unregister(proxy);
10425
10470
  });
10426
10471
  return __spreadProps(__spreadValues({}, vue.toRefs(states)), {
10427
10472
  selected,
@@ -10455,41 +10500,38 @@ ${$(r2)}`), n2;
10455
10500
  setup(props, {
10456
10501
  emit
10457
10502
  }) {
10458
- const children = vue.ref([]);
10459
- const instance = vue.getCurrentInstance();
10503
+ const {
10504
+ proxy
10505
+ } = vue.getCurrentInstance();
10506
+ const select2 = vue.inject(selectKey, null);
10460
10507
  const states = vue.reactive({
10461
10508
  groupCollapse: props.collapse,
10462
10509
  visible: true
10463
10510
  });
10464
- const groupLabel = vue.computed(() => `${props.label} (${children.value.filter((option) => option.visible).length})`);
10465
- vue.provide(optionGroupKey, vue.reactive(__spreadProps(__spreadValues({}, vue.toRefs(props)), {
10466
- groupCollapse: vue.toRef(states, "groupCollapse")
10467
- })));
10468
- const flattedChildren = (node) => {
10469
- const children2 = [];
10470
- if (Array.isArray(node.children)) {
10471
- node.children.forEach((child) => {
10472
- var _a;
10473
- if (child.type && child.type.name === "Option" && child.component && child.component.proxy) {
10474
- children2.push(child.component.proxy);
10475
- } else if ((_a = child.children) == null ? void 0 : _a.length) {
10476
- children2.push(...flattedChildren(child));
10477
- }
10478
- });
10479
- }
10480
- return children2;
10481
- };
10511
+ const options = vue.ref(/* @__PURE__ */ new Set());
10512
+ const {
10513
+ register,
10514
+ unregister
10515
+ } = useRegistry(options);
10516
+ const groupLabel = vue.computed(() => `${props.label} (${[...options.value.values()].filter((option) => option.visible).length})`);
10482
10517
  const handleToggleCollapse = () => {
10483
- if (!props.collapsible)
10518
+ if (!props.collapsible || props.disabled)
10484
10519
  return;
10485
10520
  states.groupCollapse = !states.groupCollapse;
10486
10521
  emit("update:collapse", states.groupCollapse);
10487
10522
  };
10488
- vue.onMounted(() => {
10489
- children.value = flattedChildren(instance.subTree);
10523
+ vue.provide(optionGroupKey, vue.reactive(__spreadProps(__spreadValues({}, vue.toRefs(props)), {
10524
+ register,
10525
+ unregister,
10526
+ groupCollapse: vue.toRef(states, "groupCollapse")
10527
+ })));
10528
+ vue.onBeforeMount(() => {
10529
+ select2 == null ? void 0 : select2.registerGroup(proxy);
10530
+ });
10531
+ vue.onBeforeUnmount(() => {
10532
+ select2 == null ? void 0 : select2.unregisterGroup(proxy);
10490
10533
  });
10491
10534
  return __spreadProps(__spreadValues({}, vue.toRefs(states)), {
10492
- children,
10493
10535
  groupLabel,
10494
10536
  handleToggleCollapse
10495
10537
  });
@@ -10498,7 +10540,8 @@ ${$(r2)}`), n2;
10498
10540
  var _a, _b;
10499
10541
  const groupClass = classes({
10500
10542
  "bk-option-group": true,
10501
- collapsible: this.collapsible
10543
+ collapsible: this.collapsible,
10544
+ disabled: this.disabled
10502
10545
  });
10503
10546
  const groupLabelClass = classes({
10504
10547
  "bk-option-group-label": true,
@@ -10515,13 +10558,13 @@ ${$(r2)}`), n2;
10515
10558
  "onClick": this.handleToggleCollapse
10516
10559
  }, [this.$slots.label ? this.$slots.label() : vue.createVNode("span", {
10517
10560
  "class": "default-group-label"
10518
- }, [this.collapsible ? vue.createVNode(angleUpFill, {
10561
+ }, [this.collapsible && vue.createVNode(angleUpFill, {
10519
10562
  "class": groupLabelIconClass
10520
- }, null) : null, vue.createVNode("span", {
10563
+ }, null), vue.createVNode("span", {
10521
10564
  "class": "default-group-label-title"
10522
- }, [this.groupLabel])])]), vue.createVNode("ul", {
10565
+ }, [this.groupLabel])])]), vue.withDirectives(vue.createVNode("ul", {
10523
10566
  "class": "bk-option-group-content"
10524
- }, [(_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)])]), [[vue.vShow, this.visible]]);
10567
+ }, [(_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)]), [[vue.vShow, !this.groupCollapse]])]), [[vue.vShow, this.visible]]);
10525
10568
  }
10526
10569
  });
10527
10570
  var _populated = false;
@@ -10923,6 +10966,67 @@ ${$(r2)}`), n2;
10923
10966
  }
10924
10967
  }
10925
10968
  var Component$b = vue.defineComponent({
10969
+ name: "Tag",
10970
+ props: {
10971
+ theme: PropTypes.theme(["success", "info", "warning", "danger"]).def(""),
10972
+ closable: PropTypes.bool.def(false),
10973
+ type: PropTypes.commonType(["", "filled", "stroke"]).def(""),
10974
+ checkable: PropTypes.bool.def(false),
10975
+ checked: PropTypes.bool.def(false),
10976
+ radius: PropTypes.string.def("2px"),
10977
+ extCls: PropTypes.string.def("")
10978
+ },
10979
+ emits: ["change", "close"],
10980
+ slots: ["icon"],
10981
+ setup(props, {
10982
+ emit
10983
+ }) {
10984
+ const wrapperCls = vue.computed(() => classes({
10985
+ "bk-tag-closable": props.closable,
10986
+ "bk-tag-checkable": props.checkable,
10987
+ "bk-tag-check": props.checked,
10988
+ [`bk-tag-${props.type}`]: props.type,
10989
+ [`bk-tag-${props.theme}`]: props.theme,
10990
+ [props.extCls]: !!props.extCls
10991
+ }, "bk-tag"));
10992
+ const wrapperStyle = vue.computed(() => ({
10993
+ borderRadius: props.radius
10994
+ }));
10995
+ const handleClose = (e) => {
10996
+ e.preventDefault();
10997
+ e.stopPropagation();
10998
+ emit("close", e);
10999
+ };
11000
+ const handleClick = (e) => {
11001
+ e.preventDefault();
11002
+ e.stopPropagation();
11003
+ if (props.checkable) {
11004
+ emit("change", !props.checked);
11005
+ }
11006
+ };
11007
+ return {
11008
+ wrapperCls,
11009
+ wrapperStyle,
11010
+ handleClose,
11011
+ handleClick
11012
+ };
11013
+ },
11014
+ render() {
11015
+ var _a, _b;
11016
+ return vue.createVNode("div", {
11017
+ "class": this.wrapperCls,
11018
+ "style": this.wrapperStyle,
11019
+ "onClick": this.handleClick
11020
+ }, [this.$slots.icon ? vue.createVNode("span", {
11021
+ "class": "bk-tag-icon"
11022
+ }, [this.$slots.icon()]) : "", vue.createVNode("span", null, [(_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)]), this.closable ? vue.createVNode(error, {
11023
+ "class": "bk-tag-close",
11024
+ "onClick": this.handleClose
11025
+ }, null) : ""]);
11026
+ }
11027
+ });
11028
+ const BkTag = withInstall(Component$b);
11029
+ var Component$a = vue.defineComponent({
10926
11030
  name: "Select",
10927
11031
  directives: {
10928
11032
  clickoutside: ClickOutside
@@ -10930,43 +11034,84 @@ ${$(r2)}`), n2;
10930
11034
  props: {
10931
11035
  modelValue: PropTypes.any,
10932
11036
  multiple: PropTypes.bool.def(false),
10933
- placeholder: PropTypes.string.def("\u8BF7\u9009\u62E9"),
10934
11037
  disabled: PropTypes.bool.def(false),
10935
- size: PropTypes.size().def("small"),
11038
+ size: PropTypes.size().def("default"),
10936
11039
  clearable: PropTypes.bool.def(true),
10937
11040
  loading: PropTypes.bool.def(false),
10938
11041
  filterable: PropTypes.bool.def(false),
10939
11042
  remoteMethod: PropTypes.func,
10940
- scrollHeight: PropTypes.number.def(216)
11043
+ scrollHeight: PropTypes.number.def(216),
11044
+ showSelectAll: PropTypes.bool.def(false),
11045
+ popoverMinWidth: PropTypes.number.def(0),
11046
+ showOnInit: PropTypes.bool.def(false),
11047
+ multipleMode: PropTypes.oneOf(["default", "tag"]).def("default"),
11048
+ tagTheme: PropTypes.theme(["success", "info", "warning", "danger"]).def(""),
11049
+ behavior: PropTypes.oneOf(["normal", "simplicity"]).def("normal"),
11050
+ collapseTags: PropTypes.bool.def(false),
11051
+ noDataText: PropTypes.string.def("\u65E0\u6570\u636E"),
11052
+ noMatchText: PropTypes.string.def("\u65E0\u5339\u914D\u6570\u636E"),
11053
+ loadingText: PropTypes.string.def("\u52A0\u8F7D\u4E2D..."),
11054
+ placeholder: PropTypes.string.def("\u8BF7\u9009\u62E9"),
11055
+ selectAllText: PropTypes.string.def("\u5168\u90E8")
10941
11056
  },
10942
- emits: ["update:modelValue", "change", "toggle"],
11057
+ emits: ["update:modelValue", "change", "toggle", "clear"],
10943
11058
  setup(props, {
10944
11059
  emit
10945
11060
  }) {
10946
11061
  const {
10947
11062
  modelValue,
10948
11063
  disabled,
10949
- size,
10950
11064
  filterable,
10951
11065
  placeholder,
10952
11066
  multiple,
10953
11067
  remoteMethod,
10954
- loading: loading2
11068
+ loading: loading2,
11069
+ loadingText,
11070
+ noDataText,
11071
+ noMatchText,
11072
+ popoverMinWidth,
11073
+ showOnInit
10955
11074
  } = vue.toRefs(props);
10956
11075
  const states = vue.reactive({
10957
11076
  currentPlaceholder: placeholder.value,
10958
- options: /* @__PURE__ */ new Set(),
10959
11077
  selectedOptions: /* @__PURE__ */ new Set(),
10960
11078
  currentSelectedLabel: ""
10961
11079
  });
10962
- const selectTriggerRef = vue.ref();
10963
11080
  const inputRef = vue.ref();
10964
- const register = (option) => {
10965
- if (!option)
10966
- return;
10967
- return states.options.add(option);
10968
- };
10969
- const unregister = (option) => states.options.delete(option);
11081
+ const popoverRef = vue.ref();
11082
+ const options = vue.ref(/* @__PURE__ */ new Set());
11083
+ const groups = vue.ref(/* @__PURE__ */ new Set());
11084
+ const isDisabled = vue.computed(() => disabled.value || loading2.value);
11085
+ const selectedLabel = vue.computed(() => [...states.selectedOptions.values()].map((option) => option.label));
11086
+ const isAllSelected = vue.computed(() => [...options.value.values()].filter((option) => !option.disabled).every((option) => states.selectedOptions.has(option)));
11087
+ const isGroup = vue.computed(() => !!groups.value.size);
11088
+ const isOptionsEmpty = vue.computed(() => !options.value.size);
11089
+ const isSearchEmpty = vue.computed(() => {
11090
+ const data2 = [...options.value.values()];
11091
+ return data2.length && data2.every((option) => !option.visible);
11092
+ });
11093
+ const isRemoteSearch = vue.computed(() => typeof remoteMethod.value === "function");
11094
+ const isShowSelectContent = vue.computed(() => !(searchLoading.value || isOptionsEmpty.value || isSearchEmpty.value));
11095
+ const curContentText = vue.computed(() => {
11096
+ if (searchLoading.value) {
11097
+ return loadingText.value;
11098
+ }
11099
+ if (isOptionsEmpty.value) {
11100
+ return noDataText.value;
11101
+ }
11102
+ if (isSearchEmpty.value) {
11103
+ return noMatchText.value;
11104
+ }
11105
+ return "";
11106
+ });
11107
+ const {
11108
+ register,
11109
+ unregister
11110
+ } = useRegistry(options);
11111
+ const {
11112
+ register: registerGroup,
11113
+ unregister: unregisterGroup
11114
+ } = useRegistry(groups);
10970
11115
  const {
10971
11116
  isHover,
10972
11117
  setHover,
@@ -10977,63 +11122,63 @@ ${$(r2)}`), n2;
10977
11122
  handleFocus,
10978
11123
  handleBlur
10979
11124
  } = useFocus();
10980
- const handleInput = (e) => {
10981
- searchKey.value = e.target.value;
10982
- };
10983
- const isDisabled = vue.computed(() => disabled.value || loading2.value);
10984
- const selectClass = vue.computed(() => ({
10985
- "bk-select": true,
10986
- "popover-show": isPopoverShow.value,
10987
- "is-disabled": isDisabled.value,
10988
- "is-focus": isFocus.value,
10989
- [size.value]: true
10990
- }));
10991
- const selectedLabel = vue.computed(() => [...states.selectedOptions.values()].map((option) => option.label).join(","));
10992
- const popperWidth = vue.ref("auto");
10993
- const onPopoverFirstUpdate = (instance) => {
10994
- const {
10995
- reference: reference2
10996
- } = instance.elements;
10997
- popperWidth.value = reference2.offsetWidth;
10998
- };
10999
- const isPopoverShow = vue.ref(false);
11000
- const toggleMenu = () => {
11001
- if (isDisabled.value)
11002
- return;
11003
- isPopoverShow.value = !isPopoverShow.value;
11004
- emit("toggle", isPopoverShow.value);
11005
- };
11006
- const hidePopover = () => {
11007
- isPopoverShow.value = false;
11008
- handleBlur();
11009
- };
11010
- const showPopover = () => {
11011
- isPopoverShow.value = true;
11012
- };
11013
- vue.watch(isPopoverShow, () => {
11014
- handleResetState();
11125
+ const {
11126
+ popperWidth,
11127
+ isPopoverShow,
11128
+ onPopoverFirstUpdate,
11129
+ hidePopover,
11130
+ showPopover,
11131
+ togglePopover
11132
+ } = usePopover({
11133
+ popoverMinWidth: popoverMinWidth.value
11015
11134
  });
11016
- const handleResetState = () => {
11017
- if (!isRemoteSearch.value || isRemoteSearch.value && !isPopoverShow.value) {
11018
- searchKey.value = "";
11019
- }
11135
+ const defaultSearchMethod = (value) => {
11136
+ options.value.forEach((option) => {
11137
+ var _a;
11138
+ option.visible = (_a = toLowerCase(String(option.label))) == null ? void 0 : _a.includes(toLowerCase(value));
11139
+ });
11140
+ };
11141
+ const {
11142
+ searchKey,
11143
+ searchLoading
11144
+ } = useRemoteSearch(isRemoteSearch.value ? remoteMethod.value : defaultSearchMethod);
11145
+ const handleResetInputValue = () => {
11146
+ const label = selectedLabel.value.join(",");
11020
11147
  if (filterable.value && isPopoverShow.value) {
11021
- states.currentPlaceholder = selectedLabel.value || placeholder.value;
11148
+ states.currentPlaceholder = label || placeholder.value;
11022
11149
  states.currentSelectedLabel = "";
11023
11150
  } else {
11024
11151
  states.currentPlaceholder = placeholder.value;
11025
- states.currentSelectedLabel = selectedLabel.value;
11152
+ states.currentSelectedLabel = label;
11153
+ searchKey.value = "";
11026
11154
  }
11027
11155
  };
11156
+ vue.watch(isPopoverShow, () => {
11157
+ handleResetInputValue();
11158
+ });
11028
11159
  const emitChange = (val) => {
11029
11160
  if (val === modelValue.value)
11030
11161
  return;
11031
11162
  emit("change", val);
11032
11163
  emit("update:modelValue", val);
11033
11164
  };
11034
- const handleOptionSelected = (option) => {
11165
+ const handleTogglePopover = () => {
11035
11166
  if (isDisabled.value)
11036
11167
  return;
11168
+ togglePopover();
11169
+ emit("toggle", isPopoverShow.value);
11170
+ };
11171
+ const handleInput = (e) => {
11172
+ searchKey.value = e.target.value;
11173
+ };
11174
+ const selectedCallback = () => {
11175
+ inputRef.value.focus();
11176
+ popoverRef.value.update();
11177
+ !searchKey.value && handleResetInputValue();
11178
+ };
11179
+ const handleOptionSelected = (option) => {
11180
+ if (isDisabled.value || !option)
11181
+ return;
11037
11182
  if (multiple.value) {
11038
11183
  if (states.selectedOptions.has(option)) {
11039
11184
  states.selectedOptions.delete(option);
@@ -11047,129 +11192,195 @@ ${$(r2)}`), n2;
11047
11192
  emitChange(option.value);
11048
11193
  hidePopover();
11049
11194
  }
11050
- inputRef.value.focus();
11051
- handleResetState();
11195
+ selectedCallback();
11052
11196
  };
11053
11197
  const handleClear = (e) => {
11054
11198
  e.stopPropagation();
11055
11199
  states.selectedOptions.clear();
11056
- emitChange(multiple.value ? [] : "");
11057
11200
  hidePopover();
11058
- handleResetState();
11201
+ handleResetInputValue();
11202
+ emitChange(multiple.value ? [] : "");
11203
+ emit("clear", multiple.value ? [] : "");
11059
11204
  };
11060
- const searchKey = useDebouncedRef("");
11061
- const isRemoteSearch = vue.computed(() => typeof remoteMethod.value === "function");
11062
- const searchLoading = vue.ref(false);
11063
- vue.watchEffect(async () => {
11064
- if (!isRemoteSearch.value || !isPopoverShow.value || !searchKey.value)
11065
- return;
11066
- try {
11067
- searchLoading.value = true;
11068
- await remoteMethod.value(searchKey.value);
11069
- } catch (e) {
11070
- console.error(e);
11071
- } finally {
11072
- searchLoading.value = false;
11205
+ const handleToggleAll = () => {
11206
+ if (isAllSelected.value) {
11207
+ states.selectedOptions.clear();
11208
+ } else {
11209
+ options.value.forEach((option) => {
11210
+ if (option.disabled || states.selectedOptions.has(option))
11211
+ return;
11212
+ states.selectedOptions.add(option);
11213
+ });
11073
11214
  }
11074
- });
11075
- const isEmpty2 = vue.computed(() => [...states.options.values()].every((option) => !option.visible));
11215
+ selectedCallback();
11216
+ emitChange([...states.selectedOptions.values()].map((option) => option.value));
11217
+ };
11218
+ const handleClickOutside = () => {
11219
+ hidePopover();
11220
+ handleBlur();
11221
+ };
11076
11222
  vue.provide(selectKey, vue.reactive({
11077
11223
  props,
11078
- searchKey,
11079
11224
  selectedOptions: vue.unref(states.selectedOptions),
11080
- isRemoteSearch,
11081
11225
  register,
11082
11226
  unregister,
11227
+ registerGroup,
11228
+ unregisterGroup,
11083
11229
  handleOptionSelected
11084
11230
  }));
11085
11231
  vue.onMounted(() => {
11086
11232
  const initializeValue = Array.isArray(modelValue.value) ? modelValue.value : [modelValue.value];
11087
- states.options.forEach((option) => {
11233
+ options.value.forEach((option) => {
11088
11234
  if (initializeValue.includes(option.value)) {
11089
11235
  states.selectedOptions.add(option);
11090
11236
  }
11091
11237
  });
11092
- handleResetState();
11238
+ handleResetInputValue();
11239
+ setTimeout(() => {
11240
+ showOnInit.value && showPopover();
11241
+ });
11093
11242
  });
11094
11243
  return __spreadProps(__spreadValues({}, vue.toRefs(states)), {
11244
+ options,
11245
+ isDisabled,
11095
11246
  selectedLabel,
11096
- selectClass,
11097
11247
  isPopoverShow,
11098
11248
  isHover,
11099
11249
  popperWidth,
11100
- selectTriggerRef,
11250
+ popoverRef,
11101
11251
  inputRef,
11102
- searchKey,
11103
11252
  searchLoading,
11104
- isEmpty: isEmpty2,
11253
+ isOptionsEmpty,
11254
+ isSearchEmpty,
11105
11255
  isFocus,
11256
+ isShowSelectContent,
11257
+ curContentText,
11258
+ isGroup,
11259
+ searchKey,
11106
11260
  setHover,
11107
11261
  cancelHover,
11108
11262
  handleFocus,
11109
11263
  handleInput,
11110
- toggleMenu,
11264
+ handleTogglePopover,
11111
11265
  handleClear,
11112
11266
  onPopoverFirstUpdate,
11113
11267
  hidePopover,
11114
- showPopover
11268
+ showPopover,
11269
+ handleToggleAll,
11270
+ handleOptionSelected,
11271
+ handleClickOutside
11115
11272
  });
11116
11273
  },
11117
11274
  render() {
11275
+ const selectClass = classes({
11276
+ "bk-select": true,
11277
+ "popover-show": this.isPopoverShow,
11278
+ "is-disabled": this.isDisabled,
11279
+ "is-focus": this.isFocus,
11280
+ "is-filterable": this.filterable,
11281
+ [this.size]: true,
11282
+ [this.behavior]: true
11283
+ });
11118
11284
  const modifiers = [{
11119
11285
  name: "offset",
11120
11286
  options: {
11121
11287
  offset: [0, 4]
11122
11288
  }
11123
11289
  }];
11124
- const renderSelectRightIcon = () => {
11125
- if (this.loading) {
11126
- return vue.createVNode(spinner, {
11127
- "class": "spinner"
11128
- }, null);
11129
- }
11130
- if (this.clearable && this.isHover) {
11131
- return vue.createVNode(close$1, {
11132
- "class": "clear-icon",
11133
- "onClick": this.handleClear
11290
+ const renderSelectTrigger = () => {
11291
+ var _a, _b;
11292
+ const suffixIcon = () => {
11293
+ if (this.loading) {
11294
+ return vue.createVNode(BkLoading, {
11295
+ "class": "spinner",
11296
+ "mode": "spin",
11297
+ "size": "mini"
11298
+ }, null);
11299
+ }
11300
+ if (this.clearable && this.isHover) {
11301
+ return vue.createVNode(close$1, {
11302
+ "class": "clear-icon",
11303
+ "onClick": this.handleClear
11304
+ }, null);
11305
+ }
11306
+ return vue.createVNode(angleUp, {
11307
+ "class": "angle-up"
11134
11308
  }, null);
11135
- }
11136
- return vue.createVNode(angleUp, {
11137
- "class": "angle-up"
11138
- }, null);
11139
- };
11140
- const renderEmptySelect = () => {
11141
- if (this.searchLoading) {
11142
- return vue.withDirectives(vue.createVNode("div", {
11143
- "class": "bk-select-empty"
11144
- }, [vue.createVNode(spinner, {
11145
- "class": "spinner"
11146
- }, null), vue.createTextVNode("\u52A0\u8F7D\u4E2D...")]), [[vue.vShow, this.searchLoading]]);
11147
- }
11148
- if (this.isEmpty) {
11149
- return vue.withDirectives(vue.createVNode("div", {
11150
- "class": "bk-select-empty"
11151
- }, [vue.createTextVNode("\u65E0\u5339\u914D\u6570\u636E")]), [[vue.vShow, this.isEmpty]]);
11152
- }
11153
- return null;
11309
+ };
11310
+ const renderTriggerInput = () => {
11311
+ if (this.multipleMode === "tag") {
11312
+ return vue.createVNode("div", {
11313
+ "class": "bk-select-tag"
11314
+ }, [[...this.selectedOptions.values()].map((option) => vue.createVNode(BkTag, {
11315
+ "closable": true,
11316
+ "style": {
11317
+ marginTop: "3px"
11318
+ },
11319
+ "theme": this.tagTheme,
11320
+ "onClose": () => this.handleOptionSelected(option)
11321
+ }, {
11322
+ default: () => [option.label]
11323
+ })), vue.withDirectives(vue.createVNode("input", {
11324
+ "class": "bk-select-tag-input",
11325
+ "ref": "inputRef",
11326
+ "type": "text",
11327
+ "placeholder": !this.selectedOptions.size ? this.placeholder : "",
11328
+ "readonly": !this.filterable || !this.isPopoverShow,
11329
+ "onUpdate:modelValue": ($event) => this.searchKey = $event,
11330
+ "onFocus": this.handleFocus
11331
+ }, null), [[vue.vModelText, this.searchKey]])]);
11332
+ }
11333
+ return vue.withDirectives(vue.createVNode("input", {
11334
+ "ref": "inputRef",
11335
+ "type": "text",
11336
+ "class": "bk-select-input",
11337
+ "style": {
11338
+ paddingLeft: this.$slots.prefixIcon ? "20px" : "10px"
11339
+ },
11340
+ "onUpdate:modelValue": ($event) => this.currentSelectedLabel = $event,
11341
+ "placeholder": this.currentPlaceholder,
11342
+ "readonly": !this.filterable || !this.isPopoverShow,
11343
+ "onFocus": this.handleFocus,
11344
+ "onInput": this.handleInput
11345
+ }, null), [[vue.vModelText, this.currentSelectedLabel]]);
11346
+ };
11347
+ return vue.createVNode("div", {
11348
+ "class": "bk-select-trigger",
11349
+ "onClick": this.handleTogglePopover,
11350
+ "onMouseenter": this.setHover,
11351
+ "onMouseleave": this.cancelHover
11352
+ }, [this.$slots.prefixIcon ? vue.createVNode("span", {
11353
+ "class": "bk-select-prefix"
11354
+ }, [(_b = (_a = this.$slots).prefixIcon) == null ? void 0 : _b.call(_a)]) : null, renderTriggerInput(), suffixIcon()]);
11154
11355
  };
11155
11356
  const renderSelectContent = () => {
11156
11357
  var _a, _b;
11157
- return vue.createVNode("div", null, [renderEmptySelect(), vue.withDirectives(vue.createVNode("div", {
11358
+ return vue.createVNode("div", null, [!this.isShowSelectContent && vue.createVNode("div", {
11359
+ "class": "bk-select-empty"
11360
+ }, [this.searchLoading && vue.createVNode(BkLoading, {
11361
+ "class": "mr5",
11362
+ "mode": "spin",
11363
+ "size": "mini"
11364
+ }, null), this.curContentText]), vue.createVNode("div", {
11158
11365
  "class": "bk-select-content"
11159
11366
  }, [vue.createVNode("div", {
11160
11367
  "class": "bk-select-dropdown",
11161
11368
  "style": {
11162
11369
  maxHeight: `${this.scrollHeight}px`
11163
11370
  }
11164
- }, [vue.createVNode("ul", {
11371
+ }, [vue.withDirectives(vue.createVNode("ul", {
11165
11372
  "class": "bk-select-options"
11166
- }, [(_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)])]), this.$slots.extension ? vue.createVNode("div", {
11373
+ }, [this.multiple && this.showSelectAll && !this.searchKey && vue.createVNode("li", {
11374
+ "class": "bk-select-option",
11375
+ "onClick": this.handleToggleAll
11376
+ }, [this.selectAllText]), (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)]), [[vue.vShow, this.isShowSelectContent]])]), this.$slots.extension && vue.createVNode("div", {
11167
11377
  "class": "bk-select-extension"
11168
- }, [this.$slots.extension()]) : null]), [[vue.vShow, !this.searchLoading && !this.isEmpty]])]);
11378
+ }, [this.$slots.extension()])])]);
11169
11379
  };
11170
11380
  return vue.withDirectives(vue.createVNode("div", {
11171
- "class": this.selectClass
11381
+ "class": selectClass
11172
11382
  }, [vue.createVNode(BkPopover, {
11383
+ "ref": "popoverRef",
11173
11384
  "theme": "light",
11174
11385
  "trigger": "manual",
11175
11386
  "width": this.popperWidth,
@@ -11179,35 +11390,12 @@ ${$(r2)}`), n2;
11179
11390
  "modifiers": modifiers,
11180
11391
  "handleFirstUpdate": this.onPopoverFirstUpdate
11181
11392
  }, {
11182
- default: () => {
11183
- var _a, _b;
11184
- return vue.createVNode("div", {
11185
- "class": "bk-select-trigger",
11186
- "ref": "selectTriggerRef",
11187
- "onClick": this.toggleMenu,
11188
- "onMouseenter": this.setHover,
11189
- "onMouseleave": this.cancelHover
11190
- }, [this.$slots.prefixIcon ? vue.createVNode("span", {
11191
- "class": "bk-select-prefix"
11192
- }, [(_b = (_a = this.$slots).prefixIcon) == null ? void 0 : _b.call(_a)]) : null, vue.withDirectives(vue.createVNode("input", {
11193
- "ref": "inputRef",
11194
- "type": "text",
11195
- "class": "bk-select-input",
11196
- "style": {
11197
- paddingLeft: this.$slots.prefixIcon ? "20px" : "10px"
11198
- },
11199
- "onUpdate:modelValue": ($event) => this.currentSelectedLabel = $event,
11200
- "placeholder": this.currentPlaceholder,
11201
- "readonly": !this.filterable || !this.isPopoverShow,
11202
- "onFocus": this.handleFocus,
11203
- "onInput": this.handleInput
11204
- }, null), [[vue.vModelText, this.currentSelectedLabel]]), renderSelectRightIcon()]);
11205
- },
11393
+ default: () => renderSelectTrigger(),
11206
11394
  content: () => renderSelectContent()
11207
- })]), [[vue.resolveDirective("clickoutside"), this.hidePopover]]);
11395
+ })]), [[vue.resolveDirective("clickoutside"), this.handleClickOutside]]);
11208
11396
  }
11209
11397
  });
11210
- const BkSelect = withInstallProps(Component$b, { Option: BkOption, Group: OptionGroup });
11398
+ const BkSelect = withInstallProps(Component$a, { Option: BkOption, Group: OptionGroup });
11211
11399
  function _isSlot$1(s2) {
11212
11400
  return typeof s2 === "function" || Object.prototype.toString.call(s2) === "[object Object]" && !vue.isVNode(s2);
11213
11401
  }
@@ -11217,7 +11405,7 @@ ${$(r2)}`), n2;
11217
11405
  const sliderPops = Object.assign({}, propsMixin);
11218
11406
  sliderPops.width.default = "400";
11219
11407
  sliderPops.height.default = "100%";
11220
- var Component$a = vue.defineComponent({
11408
+ var Component$9 = vue.defineComponent({
11221
11409
  name: "Sideslider",
11222
11410
  components: {
11223
11411
  BkModal,
@@ -11274,7 +11462,7 @@ ${$(r2)}`), n2;
11274
11462
  });
11275
11463
  }
11276
11464
  });
11277
- const BkSideslider = withInstall(Component$a);
11465
+ const BkSideslider = withInstall(Component$9);
11278
11466
  const stepsProps = {
11279
11467
  theme: PropTypes.theme().def("primary"),
11280
11468
  size: PropTypes.size(),
@@ -11288,7 +11476,7 @@ ${$(r2)}`), n2;
11288
11476
  steps: PropTypes.array.def([]),
11289
11477
  beforeChange: PropTypes.func
11290
11478
  };
11291
- var Component$9 = vue.defineComponent({
11479
+ var Component$8 = vue.defineComponent({
11292
11480
  name: "Steps",
11293
11481
  props: stepsProps,
11294
11482
  emits: ["update:curStep", "click"],
@@ -11424,8 +11612,8 @@ ${$(r2)}`), n2;
11424
11612
  })]);
11425
11613
  }
11426
11614
  });
11427
- const BkSteps = withInstall(Component$9);
11428
- var Component$8 = vue.defineComponent({
11615
+ const BkSteps = withInstall(Component$8);
11616
+ var Component$7 = vue.defineComponent({
11429
11617
  name: "Switcher",
11430
11618
  props: {
11431
11619
  theme: PropTypes.theme().def(""),
@@ -11519,7 +11707,7 @@ ${$(r2)}`), n2;
11519
11707
  }, [isChecked.value ? props.onText : props.offText]) : ""]);
11520
11708
  }
11521
11709
  });
11522
- const BkSwitcher = withInstall(Component$8);
11710
+ const BkSwitcher = withInstall(Component$7);
11523
11711
  const EventProps$1 = {
11524
11712
  onContentScroll: Function
11525
11713
  };
@@ -11623,7 +11811,7 @@ ${$(r2)}`), n2;
11623
11811
  }
11624
11812
  }
11625
11813
  };
11626
- var Component$7 = vue.defineComponent({
11814
+ var Component$6 = vue.defineComponent({
11627
11815
  name: "VirtualRender",
11628
11816
  directives: {
11629
11817
  bkVirtualRender: virtualRender
@@ -11770,7 +11958,7 @@ ${$(r2)}`), n2;
11770
11958
  };
11771
11959
  }
11772
11960
  });
11773
- const BkVirtualRender = withInstall(Component$7);
11961
+ const BkVirtualRender = withInstall(Component$6);
11774
11962
  const BORDER_OPRIONS = ["none", "row", "col", "outer"];
11775
11963
  const EventProps = {
11776
11964
  onRowClick: Function
@@ -12170,7 +12358,7 @@ ${$(r2)}`), n2;
12170
12358
  return value.some((item) => layoutNameMap[item]);
12171
12359
  }, "layout \u7684\u503C\u53EA\u652F\u6301 * total\u3001list\u3001limit *").def(["total", "list", "limit"])
12172
12360
  };
12173
- var Component$6 = vue.defineComponent({
12361
+ var Component$5 = vue.defineComponent({
12174
12362
  name: "Pagination",
12175
12363
  props: paginationProps,
12176
12364
  emits: ["update:modelValue", "change", "update:limit", "limit-change"],
@@ -12236,7 +12424,7 @@ ${$(r2)}`), n2;
12236
12424
  })), this.renderSmallList()]);
12237
12425
  }
12238
12426
  });
12239
- const BkPagination = withInstall(Component$6);
12427
+ const BkPagination = withInstall(Component$5);
12240
12428
  class TablePlugins {
12241
12429
  constructor(props, ctx) {
12242
12430
  __publicField(this, "props", null);
@@ -12501,7 +12689,7 @@ ${$(r2)}`), n2;
12501
12689
  })]);
12502
12690
  }
12503
12691
  }
12504
- var Component$5 = vue.defineComponent({
12692
+ var Component$4 = vue.defineComponent({
12505
12693
  name: "Table",
12506
12694
  props: tableProps,
12507
12695
  emits: ["column-pick", "row-click", "page-limit-change", "page-value-change"],
@@ -12636,68 +12824,7 @@ ${$(r2)}`), n2;
12636
12824
  }, [props.pagination && tableRender.renderTableFooter(localPagination.value)])]);
12637
12825
  }
12638
12826
  });
12639
- const BkTable = withInstall(Component$5);
12640
- var Component$4 = vue.defineComponent({
12641
- name: "Tag",
12642
- props: {
12643
- theme: PropTypes.theme(["success", "info", "warning", "danger"]).def(""),
12644
- closable: PropTypes.bool.def(false),
12645
- type: PropTypes.commonType(["", "filled", "stroke"]).def(""),
12646
- checkable: PropTypes.bool.def(false),
12647
- checked: PropTypes.bool.def(false),
12648
- radius: PropTypes.string.def("2px"),
12649
- extCls: PropTypes.string.def("")
12650
- },
12651
- emits: ["change", "close"],
12652
- slots: ["icon"],
12653
- setup(props, {
12654
- emit
12655
- }) {
12656
- const wrapperCls = vue.computed(() => classes({
12657
- "bk-tag-closable": props.closable,
12658
- "bk-tag-checkable": props.checkable,
12659
- "bk-tag-check": props.checked,
12660
- [`bk-tag-${props.type}`]: props.type,
12661
- [`bk-tag-${props.theme}`]: props.theme,
12662
- [props.extCls]: !!props.extCls
12663
- }, "bk-tag"));
12664
- const wrapperStyle = vue.computed(() => ({
12665
- borderRadius: props.radius
12666
- }));
12667
- const handleClose = (e) => {
12668
- e.preventDefault();
12669
- e.stopPropagation();
12670
- emit("close", e);
12671
- };
12672
- const handleClick = (e) => {
12673
- e.preventDefault();
12674
- e.stopPropagation();
12675
- if (props.checkable) {
12676
- emit("change", !props.checked);
12677
- }
12678
- };
12679
- return {
12680
- wrapperCls,
12681
- wrapperStyle,
12682
- handleClose,
12683
- handleClick
12684
- };
12685
- },
12686
- render() {
12687
- var _a, _b;
12688
- return vue.createVNode("div", {
12689
- "class": this.wrapperCls,
12690
- "style": this.wrapperStyle,
12691
- "onClick": this.handleClick
12692
- }, [this.$slots.icon ? vue.createVNode("span", {
12693
- "class": "bk-tag-icon"
12694
- }, [this.$slots.icon()]) : "", vue.createVNode("span", null, [(_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)]), this.closable ? vue.createVNode(error, {
12695
- "class": "bk-tag-close",
12696
- "onClick": this.handleClose
12697
- }, null) : ""]);
12698
- }
12699
- });
12700
- const BkTag = withInstall(Component$4);
12827
+ const BkTable = withInstall(Component$4);
12701
12828
  var bkDivider = vue.defineComponent({
12702
12829
  name: "Divider",
12703
12830
  props: {