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