vue-devui 1.5.13 → 1.5.15-feat.1

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 (86) hide show
  1. package/auto-complete/index.es.js +3 -0
  2. package/auto-complete/index.umd.js +1 -1
  3. package/breadcrumb/index.es.js +3 -0
  4. package/breadcrumb/index.umd.js +1 -1
  5. package/checkbox/index.es.js +3 -0
  6. package/checkbox/index.umd.js +1 -1
  7. package/code-review/index.es.js +39 -14
  8. package/code-review/index.umd.js +14 -14
  9. package/date-picker-pro/index.es.js +3 -0
  10. package/date-picker-pro/index.umd.js +8 -8
  11. package/dropdown/index.es.js +3 -0
  12. package/dropdown/index.umd.js +1 -1
  13. package/editable-select/index.es.js +5 -1
  14. package/editable-select/index.umd.js +7 -7
  15. package/editor-md/index.es.js +1428 -1213
  16. package/editor-md/index.umd.js +45 -45
  17. package/editor-md/style.css +1 -1
  18. package/form/index.es.js +3 -0
  19. package/form/index.umd.js +1 -1
  20. package/git-graph/index.es.js +3 -0
  21. package/git-graph/index.umd.js +12 -12
  22. package/input/index.es.js +3 -0
  23. package/input/index.umd.js +6 -6
  24. package/input-number/index.es.js +3 -0
  25. package/input-number/index.umd.js +1 -1
  26. package/mention/index.es.js +3 -0
  27. package/mention/index.umd.js +1 -1
  28. package/menu/index.es.js +6 -2
  29. package/menu/index.umd.js +1 -1
  30. package/modal/index.es.js +3 -0
  31. package/modal/index.umd.js +1 -1
  32. package/nuxt/components/checkbox.js +3 -0
  33. package/overlay/index.es.js +3 -0
  34. package/overlay/index.umd.js +1 -1
  35. package/package.json +1 -1
  36. package/pagination/index.es.js +156 -292
  37. package/pagination/index.umd.js +18 -18
  38. package/pagination/style.css +1 -1
  39. package/popover/index.es.js +3 -0
  40. package/popover/index.umd.js +6 -6
  41. package/radio/index.es.js +3 -0
  42. package/radio/index.umd.js +1 -1
  43. package/search/index.es.js +3 -0
  44. package/search/index.umd.js +1 -1
  45. package/select/index.es.js +120 -265
  46. package/select/index.umd.js +17 -17
  47. package/select/style.css +1 -1
  48. package/splitter/index.es.js +14 -6
  49. package/splitter/index.umd.js +4 -4
  50. package/splitter/style.css +1 -1
  51. package/style.css +1 -1
  52. package/switch/index.es.js +3 -0
  53. package/switch/index.umd.js +1 -1
  54. package/table/index.es.js +14 -6
  55. package/table/index.umd.js +2 -2
  56. package/table/style.css +1 -1
  57. package/textarea/index.es.js +3 -0
  58. package/textarea/index.umd.js +1 -1
  59. package/time-picker/index.es.js +3 -0
  60. package/time-picker/index.umd.js +1 -1
  61. package/time-select/index.es.js +120 -265
  62. package/time-select/index.umd.js +18 -18
  63. package/time-select/style.css +1 -1
  64. package/tooltip/index.es.js +14 -6
  65. package/tooltip/index.umd.js +9 -9
  66. package/tooltip/style.css +1 -1
  67. package/tree/index.es.js +3 -0
  68. package/tree/index.umd.js +1 -1
  69. package/types/code-review/src/utils.d.ts +3 -3
  70. package/types/editable-select/src/editable-select.d.ts +1 -1
  71. package/types/editor-md/index.d.ts +1 -0
  72. package/types/editor-md/src/components/md-render.d.ts +1 -1
  73. package/types/editor-md/src/composables/use-editor-md.d.ts +3 -0
  74. package/types/editor-md/src/editor-md-types.d.ts +9 -1
  75. package/types/editor-md/src/editor-md.d.ts +6 -3
  76. package/types/editor-md/src/plugins/checkbox.d.ts +1 -0
  77. package/types/menu/src/menu-types.d.ts +4 -0
  78. package/types/menu/src/menu.d.ts +9 -0
  79. package/types/pagination/src/pagination-types.d.ts +4 -13
  80. package/types/pagination/src/pagination.d.ts +218 -0
  81. package/types/select/src/select-types.d.ts +4 -23
  82. package/types/select/src/select.d.ts +1 -19
  83. package/types/select/src/use-select.d.ts +1 -1
  84. package/types/tag/src/tag.d.ts +2 -2
  85. package/vue-devui.es.js +283 -263
  86. package/vue-devui.umd.js +50 -50
@@ -29,9 +29,9 @@ var __objRest = (source, exclude) => {
29
29
  }
30
30
  return target;
31
31
  };
32
- import { defineComponent, watch, provide, reactive, toRefs, createVNode, onUnmounted, Transition, mergeProps, ref, unref, nextTick, withModifiers, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, computed, onMounted, Teleport, createTextVNode, onBeforeUnmount, toRef, onBeforeMount, vShow, resolveComponent, getCurrentInstance, vModelText } from "vue";
33
- import "clipboard";
32
+ import { defineComponent, watch, provide, reactive, toRefs, createVNode, onUnmounted, Transition, mergeProps, ref, unref, nextTick, withModifiers, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, computed, onMounted, Teleport, createTextVNode, onBeforeUnmount, toRef, onBeforeMount, vShow, resolveComponent, getCurrentInstance } from "vue";
34
33
  import { onClickOutside } from "@vueuse/core";
34
+ import "clipboard";
35
35
  import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
36
36
  function className(classStr, classOpt) {
37
37
  let classname = classStr;
@@ -42,25 +42,6 @@ function className(classStr, classOpt) {
42
42
  }
43
43
  return classname;
44
44
  }
45
- function lockScroll() {
46
- if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
47
- const scrollTop = document.documentElement.scrollTop;
48
- const style = document.documentElement.getAttribute("style");
49
- document.documentElement.style.position = "fixed";
50
- document.documentElement.style.top = `-${scrollTop}px`;
51
- document.documentElement.style.width = document.documentElement.style.width || "100%";
52
- document.documentElement.style.overflowY = "scroll";
53
- return () => {
54
- if (style) {
55
- document.documentElement.setAttribute("style", style);
56
- } else {
57
- document.documentElement.removeAttribute("style");
58
- }
59
- document.documentElement.scrollTop = scrollTop;
60
- };
61
- }
62
- return;
63
- }
64
45
  function createBem$1(namespace, element, modifier) {
65
46
  let cls = namespace;
66
47
  if (element) {
@@ -5554,6 +5535,48 @@ const formProps = {
5554
5535
  };
5555
5536
  const FORM_TOKEN = Symbol("dForm");
5556
5537
  const STYLE_TOKEN = Symbol("dForm");
5538
+ function lockScroll() {
5539
+ if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
5540
+ const scrollTop = document.documentElement.scrollTop;
5541
+ const style = document.documentElement.getAttribute("style");
5542
+ document.documentElement.style.position = "fixed";
5543
+ document.documentElement.style.top = `-${scrollTop}px`;
5544
+ document.documentElement.style.width = document.documentElement.style.width || "100%";
5545
+ document.documentElement.style.overflowY = "scroll";
5546
+ return () => {
5547
+ if (style) {
5548
+ document.documentElement.setAttribute("style", style);
5549
+ } else {
5550
+ document.documentElement.removeAttribute("style");
5551
+ }
5552
+ document.documentElement.scrollTop = scrollTop;
5553
+ };
5554
+ }
5555
+ return;
5556
+ }
5557
+ function createBem(namespace, element, modifier) {
5558
+ let cls = namespace;
5559
+ if (element) {
5560
+ cls += `__${element}`;
5561
+ }
5562
+ if (modifier) {
5563
+ cls += `--${modifier}`;
5564
+ }
5565
+ return cls;
5566
+ }
5567
+ function useNamespace(block, needDot = false) {
5568
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
5569
+ const b = () => createBem(namespace);
5570
+ const e = (element) => element ? createBem(namespace, element) : "";
5571
+ const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
5572
+ const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
5573
+ return {
5574
+ b,
5575
+ e,
5576
+ m,
5577
+ em
5578
+ };
5579
+ }
5557
5580
  function useFieldCollection() {
5558
5581
  const itemContexts = [];
5559
5582
  const addItemContext = (field) => {
@@ -5621,7 +5644,7 @@ defineComponent({
5621
5644
  props: formProps,
5622
5645
  emits: ["validate"],
5623
5646
  setup(props, ctx) {
5624
- const ns2 = useNamespace$1("form");
5647
+ const ns2 = useNamespace("form");
5625
5648
  const {
5626
5649
  itemContexts,
5627
5650
  addItemContext,
@@ -5739,29 +5762,6 @@ function useFixedOverlay(props, ctx) {
5739
5762
  onUnmounted(removeBodyAdditions);
5740
5763
  return { onClick };
5741
5764
  }
5742
- function createBem(namespace, element, modifier) {
5743
- let cls = namespace;
5744
- if (element) {
5745
- cls += `__${element}`;
5746
- }
5747
- if (modifier) {
5748
- cls += `--${modifier}`;
5749
- }
5750
- return cls;
5751
- }
5752
- function useNamespace(block, needDot = false) {
5753
- const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
5754
- const b = () => createBem(namespace);
5755
- const e = (element) => element ? createBem(namespace, element) : "";
5756
- const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
5757
- const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
5758
- return {
5759
- b,
5760
- e,
5761
- m,
5762
- em
5763
- };
5764
- }
5765
5765
  var fixedOverlay = "";
5766
5766
  defineComponent({
5767
5767
  name: "DFixedOverlay",
@@ -5772,7 +5772,7 @@ defineComponent({
5772
5772
  const {
5773
5773
  modelValue
5774
5774
  } = toRefs(props);
5775
- const ns2 = useNamespace("fixed-overlay");
5775
+ const ns2 = useNamespace$1("fixed-overlay");
5776
5776
  const {
5777
5777
  onClick
5778
5778
  } = useFixedOverlay(props, ctx);
@@ -5889,6 +5889,9 @@ function useOverlay(props, emit) {
5889
5889
  ];
5890
5890
  props.showArrow && middleware.push(arrow({ element: arrowEl }));
5891
5891
  props.shiftOffset !== void 0 && middleware.push(shift());
5892
+ if (!overlayEl) {
5893
+ return;
5894
+ }
5892
5895
  const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
5893
5896
  strategy: "fixed",
5894
5897
  middleware
@@ -5938,7 +5941,7 @@ const FlexibleOverlay = defineComponent({
5938
5941
  emit,
5939
5942
  expose
5940
5943
  }) {
5941
- const ns2 = useNamespace("flexible-overlay");
5944
+ const ns2 = useNamespace$1("flexible-overlay");
5942
5945
  const {
5943
5946
  clickEventBubble
5944
5947
  } = toRefs(props);
@@ -5967,7 +5970,7 @@ const FlexibleOverlay = defineComponent({
5967
5970
  });
5968
5971
  const POPPER_TRIGGER_TOKEN = Symbol("popper-trigger");
5969
5972
  const isObject = (val) => val !== null && typeof val === "object";
5970
- const ns$1 = useNamespace("popper-trigger");
5973
+ const ns$1 = useNamespace$1("popper-trigger");
5971
5974
  function wrapContent(content) {
5972
5975
  return h("span", { class: ns$1.b() }, content);
5973
5976
  }
@@ -6154,7 +6157,7 @@ function usePopoverEvent(props, visible, origin) {
6154
6157
  });
6155
6158
  return { placement, handlePositionChange, onMouseenter, onMouseleave };
6156
6159
  }
6157
- const ns = useNamespace("popover");
6160
+ const ns = useNamespace$1("popover");
6158
6161
  function SuccessIcon$1() {
6159
6162
  return createVNode("svg", {
6160
6163
  "class": [ns.e("icon"), ns.em("icon", "success")],
@@ -6256,7 +6259,7 @@ var PopoverIcon = defineComponent({
6256
6259
  }
6257
6260
  },
6258
6261
  setup(props) {
6259
- const ns2 = useNamespace("popover");
6262
+ const ns2 = useNamespace$1("popover");
6260
6263
  return () => props.type && props.type !== "default" && createVNode("span", {
6261
6264
  "class": ns2.e("icon-wrap")
6262
6265
  }, [props.type === "success" && createVNode(SuccessIcon$1, null, null), props.type === "warning" && createVNode(WarningIcon, null, null), props.type === "info" && createVNode(InfoIcon, null, null), props.type === "error" && createVNode(ErrorIcon$1, null, null)]);
@@ -6293,7 +6296,7 @@ var Popover = defineComponent({
6293
6296
  const {
6294
6297
  overlayStyles
6295
6298
  } = usePopover(props, visible, placement, origin, popoverRef);
6296
- const ns2 = useNamespace("popover");
6299
+ const ns2 = useNamespace$1("popover");
6297
6300
  provide(POPPER_TRIGGER_TOKEN, origin);
6298
6301
  watch(visible, (newVal) => {
6299
6302
  if (newVal) {
@@ -6426,7 +6429,7 @@ function useFormLabel() {
6426
6429
  const formContext = inject(FORM_TOKEN);
6427
6430
  const formItemContext = inject(FORM_ITEM_TOKEN);
6428
6431
  const labelData = inject(LABEL_DATA);
6429
- const ns2 = useNamespace$1("form");
6432
+ const ns2 = useNamespace("form");
6430
6433
  const defaultTipsPopover = {
6431
6434
  content: "",
6432
6435
  position: ["top"],
@@ -6457,7 +6460,7 @@ var formLabel = "";
6457
6460
  var FormLabel = defineComponent({
6458
6461
  name: "DFormLabel",
6459
6462
  setup(_, ctx) {
6460
- const ns2 = useNamespace$1("form");
6463
+ const ns2 = useNamespace("form");
6461
6464
  const {
6462
6465
  labelClasses,
6463
6466
  labelInnerClasses,
@@ -6490,7 +6493,7 @@ const formControlProps = {
6490
6493
  };
6491
6494
  function useFormControl(props) {
6492
6495
  const labelData = inject(LABEL_DATA);
6493
- const ns2 = useNamespace$1("form");
6496
+ const ns2 = useNamespace("form");
6494
6497
  const { feedbackStatus } = toRefs(props);
6495
6498
  const controlClasses = computed(() => ({
6496
6499
  [ns2.e("control")]: true,
@@ -6522,7 +6525,7 @@ var FormControl = defineComponent({
6522
6525
  const formContext = inject(FORM_TOKEN);
6523
6526
  const formControl2 = ref();
6524
6527
  const popoverRef = ref();
6525
- const ns2 = useNamespace$1("form");
6528
+ const ns2 = useNamespace("form");
6526
6529
  const showPopoverClick = ref(true);
6527
6530
  const {
6528
6531
  controlClasses,
@@ -7613,7 +7616,7 @@ function getFieldValue(obj, path) {
7613
7616
  }
7614
7617
  function useFormItem(messageType, _rules, validateState) {
7615
7618
  const formContext = inject(FORM_TOKEN);
7616
- const ns2 = useNamespace$1("form");
7619
+ const ns2 = useNamespace("form");
7617
7620
  const itemClasses = computed(() => ({
7618
7621
  [`${ns2.em("item", "horizontal")}`]: formContext.layout === "horizontal",
7619
7622
  [`${ns2.em("item", "vertical")}`]: formContext.layout === "vertical",
@@ -7852,6 +7855,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
7852
7855
  const selectDisabled = computed(() => (formContext == null ? void 0 : formContext.disabled) || props.disabled);
7853
7856
  const selectSize = computed(() => props.size || (formContext == null ? void 0 : formContext.size) || "md");
7854
7857
  const isObjectOption = ref(false);
7858
+ const originRef = ref();
7855
7859
  const isOpen = ref(false);
7856
7860
  const toggleChange = (bool) => {
7857
7861
  if (selectDisabled.value) {
@@ -7861,14 +7865,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
7861
7865
  ctx.emit("toggle-change", bool);
7862
7866
  };
7863
7867
  onClickOutside(dropdownRef, () => {
7864
- var _a;
7865
- if (props.multiple && isOpen.value) {
7866
- (_a = selectRef.value) == null ? void 0 : _a.clearMultipleSearchKey();
7867
- onBlur();
7868
- }
7869
- if (isOpen.value) {
7870
- toggleChange(false);
7871
- }
7868
+ toggleChange(false);
7872
7869
  }, { ignore: [selectRef] });
7873
7870
  const dropdownMenuMultipleNs = useNamespace$1("dropdown-menu-multiple");
7874
7871
  const selectCls = computed(() => {
@@ -7981,11 +7978,8 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
7981
7978
  }
7982
7979
  };
7983
7980
  const valueChange = (item) => {
7984
- var _a;
7985
7981
  const { multiple } = props;
7986
7982
  let { modelValue } = props;
7987
- filterQuery.value = "";
7988
- handlerQueryFunc("");
7989
7983
  if (multiple) {
7990
7984
  const checkedItems = Array.isArray(modelValue) ? modelValue.slice() : [];
7991
7985
  const index2 = checkedItems.indexOf(item.value);
@@ -8012,7 +8006,6 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
8012
8006
  }
8013
8007
  getMultipleSelected(checkedItems);
8014
8008
  } else {
8015
- (_a = selectRef.value) == null ? void 0 : _a.clearSingleSearchKey();
8016
8009
  ctx.emit("update:modelValue", item.value);
8017
8010
  getSingleSelected(item);
8018
8011
  toggleChange(false);
@@ -8023,8 +8016,6 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
8023
8016
  ctx.emit("toggle-change", false);
8024
8017
  };
8025
8018
  const handleClear = () => {
8026
- filterQuery.value = "";
8027
- handlerQueryFunc("");
8028
8019
  if (props.multiple) {
8029
8020
  ctx.emit("update:modelValue", []);
8030
8021
  ctx.emit("value-change", []);
@@ -8037,6 +8028,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
8037
8028
  handleClose();
8038
8029
  blur();
8039
8030
  }
8031
+ filterQuery.value = "";
8040
8032
  };
8041
8033
  const tagDelete = (data) => {
8042
8034
  let { modelValue } = props;
@@ -8054,22 +8046,21 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
8054
8046
  ctx.emit("remove-tag", data.value);
8055
8047
  getMultipleSelected(checkedItems);
8056
8048
  };
8057
- const onFocus = () => {
8049
+ const onFocus = (e) => {
8050
+ ctx.emit("focus", e);
8058
8051
  if (!selectDisabled.value) {
8059
8052
  isSelectFocus.value = true;
8060
8053
  }
8061
8054
  };
8062
- const onBlur = () => {
8055
+ const onBlur = (e) => {
8056
+ ctx.emit("blur", e);
8063
8057
  if (!selectDisabled.value) {
8064
- setTimeout(() => {
8065
- filterQuery.value = "";
8066
- handlerQueryFunc("");
8067
- }, 150);
8068
8058
  isSelectFocus.value = false;
8069
8059
  }
8070
8060
  };
8071
8061
  const queryChange = (query) => {
8072
8062
  filterQuery.value = query;
8063
+ ctx.emit("input-change", query);
8073
8064
  };
8074
8065
  const isLoading = computed(() => typeof props.loading === "boolean" && props.loading);
8075
8066
  const debounceTime = computed(() => props.remote ? 300 : 0);
@@ -8097,7 +8088,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
8097
8088
  const emptyText = computed(() => {
8098
8089
  const visibleOptionsCount = injectOptionsArray.value.filter((item) => {
8099
8090
  const label = item.name || item.value;
8100
- return label.toString().toLocaleLowerCase().includes(filterQuery.value.trim().toLocaleLowerCase());
8091
+ return label.toString().toLocaleLowerCase().includes(filterQuery.value.toLocaleLowerCase().trim());
8101
8092
  }).length;
8102
8093
  if (isLoading.value) {
8103
8094
  return props.loadingText || t("loadingText");
@@ -8124,8 +8115,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
8124
8115
  }
8125
8116
  };
8126
8117
  watch(() => props.modelValue, () => {
8127
- formItemContext == null ? void 0 : formItemContext.validate("change").catch(() => {
8128
- });
8118
+ formItemContext == null ? void 0 : formItemContext.validate("change").catch((err) => console.warn(err));
8129
8119
  updateInjectOptionsStatus();
8130
8120
  }, { deep: true });
8131
8121
  watch(injectOptions, () => {
@@ -8140,17 +8130,10 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
8140
8130
  (_a = dropdownRef.value) == null ? void 0 : _a.updatePosition();
8141
8131
  }
8142
8132
  }, { flush: "post" });
8143
- watch(isSelectFocus, (val) => {
8144
- if (val) {
8145
- ctx.emit("focus");
8146
- } else {
8147
- ctx.emit("blur");
8148
- }
8149
- });
8150
- onMounted(updateInjectOptionsStatus);
8151
8133
  return {
8152
8134
  selectDisabled,
8153
8135
  selectSize,
8136
+ originRef,
8154
8137
  dropdownRef,
8155
8138
  isOpen,
8156
8139
  selectCls,
@@ -8175,7 +8158,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
8175
8158
  }
8176
8159
  const selectProps = {
8177
8160
  modelValue: {
8178
- type: [String, Number, Array, Boolean],
8161
+ type: [String, Number, Array],
8179
8162
  default: ""
8180
8163
  },
8181
8164
  "onUpdate:modelValue": {
@@ -8190,10 +8173,6 @@ const selectProps = {
8190
8173
  type: String,
8191
8174
  default: ""
8192
8175
  },
8193
- position: {
8194
- type: Array,
8195
- default: () => ["bottom", "top"]
8196
- },
8197
8176
  overview: {
8198
8177
  type: String,
8199
8178
  default: "border"
@@ -8265,10 +8244,6 @@ const selectProps = {
8265
8244
  multipleLimit: {
8266
8245
  type: Number,
8267
8246
  default: 0
8268
- },
8269
- showEmptyWhenUnmatched: {
8270
- type: Boolean,
8271
- default: true
8272
8247
  }
8273
8248
  };
8274
8249
  const optionProps = {
@@ -8565,7 +8540,7 @@ var Checkbox = defineComponent({
8565
8540
  props: checkboxProps,
8566
8541
  emits: ["change", "update:checked", "update:modelValue"],
8567
8542
  setup(props, ctx) {
8568
- const ns2 = useNamespace$1("checkbox");
8543
+ const ns2 = useNamespace("checkbox");
8569
8544
  const {
8570
8545
  mergedChecked,
8571
8546
  mergedDisabled,
@@ -8666,7 +8641,7 @@ defineComponent({
8666
8641
  props: checkboxGroupProps,
8667
8642
  emits: ["change", "update:modelValue"],
8668
8643
  setup(props, ctx) {
8669
- const ns2 = useNamespace$1("checkbox");
8644
+ const ns2 = useNamespace("checkbox");
8670
8645
  const {
8671
8646
  defaultOpt
8672
8647
  } = useCheckboxGroup(props, ctx);
@@ -8712,7 +8687,7 @@ defineComponent({
8712
8687
  props: checkboxProps,
8713
8688
  emits: ["change", "update:checked", "update:modelValue"],
8714
8689
  setup(props, ctx) {
8715
- const ns2 = useNamespace$1("checkbox-button");
8690
+ const ns2 = useNamespace("checkbox-button");
8716
8691
  const {
8717
8692
  mergedChecked,
8718
8693
  mergedDisabled,
@@ -8775,23 +8750,20 @@ function useOption(props) {
8775
8750
  return select2.modelValue === props.value;
8776
8751
  }
8777
8752
  });
8778
- const isDisabled = computed(() => props.disabled || ((optionGroup == null ? void 0 : optionGroup.disabled) ? true : false));
8779
8753
  const optionItem = computed(() => {
8780
8754
  return {
8781
8755
  name: props.name || props.value + "" || "",
8782
8756
  value: props.value,
8783
8757
  create: props.create,
8784
- _checked: false,
8785
- disabled: isDisabled.value
8758
+ _checked: false
8786
8759
  };
8787
8760
  });
8761
+ const isDisabled = computed(() => props.disabled || ((optionGroup == null ? void 0 : optionGroup.disabled) ? true : false));
8788
8762
  const isObjectOption = ref(!!props.name);
8789
8763
  const selectOptionCls = computed(() => {
8790
8764
  return className(ns2.e("item"), {
8791
8765
  active: isOptionSelected.value,
8792
- disabled: isDisabled.value,
8793
- [ns2.em("item", "sm")]: (select2 == null ? void 0 : select2.selectSize) === "sm",
8794
- [ns2.em("item", "lg")]: (select2 == null ? void 0 : select2.selectSize) === "lg"
8766
+ disabled: isDisabled.value
8795
8767
  });
8796
8768
  });
8797
8769
  const optionSelect = () => {
@@ -8907,7 +8879,7 @@ const tagProps = {
8907
8879
  }
8908
8880
  };
8909
8881
  function useClass(props) {
8910
- const ns2 = useNamespace("tag");
8882
+ const ns2 = useNamespace$1("tag");
8911
8883
  return computed(() => {
8912
8884
  const { type: type4, color, deletable } = props;
8913
8885
  return `${ns2.e("item")} ${ns2.m(type4 || (color ? "colorful" : "") || "default")} ${deletable ? ns2.m("deletable") : ""} ${ns2.m(props.size)}`;
@@ -8949,7 +8921,7 @@ var Tag = defineComponent({
8949
8921
  slots,
8950
8922
  emit
8951
8923
  }) {
8952
- const ns2 = useNamespace("tag");
8924
+ const ns2 = useNamespace$1("tag");
8953
8925
  const {
8954
8926
  type: type4,
8955
8927
  color,
@@ -9176,13 +9148,9 @@ function useSelectContent() {
9176
9148
  const ns2 = useNamespace$1("select");
9177
9149
  const select2 = inject(SELECT_TOKEN);
9178
9150
  const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
9179
- const styleType = inject(STYLE_TOKEN, void 0);
9180
9151
  const app = getCurrentInstance();
9181
9152
  const t = createI18nTranslate("DSelect", app);
9182
9153
  const searchQuery = ref("");
9183
- const singleSearchKey = ref("");
9184
- const singleInputRef = ref();
9185
- const singlePlaceholderWidth = computed(() => (select2 == null ? void 0 : select2.dropdownWidth) ? `${(select2 == null ? void 0 : select2.dropdownWidth) - 40}px` : "auto");
9186
9154
  const selectedData = computed(() => {
9187
9155
  return (select2 == null ? void 0 : select2.selectedOptions) || [];
9188
9156
  });
@@ -9200,37 +9168,21 @@ function useSelectContent() {
9200
9168
  const displayInputValue = computed(() => {
9201
9169
  var _a;
9202
9170
  if (select2 == null ? void 0 : select2.selectedOptions) {
9203
- return select2.selectedOptions.length > 1 ? select2.selectedOptions.map((item) => (item == null ? void 0 : item.name) || (item == null ? void 0 : item.value) || "").join(",") : ((_a = select2.selectedOptions[0]) == null ? void 0 : _a.name) || (select2.showEmptyWhenUnmatched ? "" : select2.modelValue);
9171
+ return select2.selectedOptions.length > 1 ? select2.selectedOptions.map((item) => (item == null ? void 0 : item.name) || (item == null ? void 0 : item.value) || "").join(",") : ((_a = select2.selectedOptions[0]) == null ? void 0 : _a.name) || "";
9204
9172
  } else {
9205
9173
  return "";
9206
9174
  }
9207
9175
  });
9208
- const isPlaceholderDark = computed(() => {
9209
- if (!singleSearchKey.value) {
9210
- if (isSelectDisable.value) {
9211
- return false;
9212
- }
9213
- if (!displayInputValue.value) {
9214
- return true;
9215
- } else {
9216
- return select2 == null ? void 0 : select2.isSelectFocus;
9217
- }
9218
- } else {
9219
- return false;
9220
- }
9221
- });
9222
9176
  const mergeClearable = computed(() => {
9223
9177
  return !isSelectDisable.value && !!(select2 == null ? void 0 : select2.allowClear) && (displayInputValue.value ? true : false);
9224
9178
  });
9225
9179
  const isDisabledTooltip = computed(() => {
9226
9180
  return !isSupportTagsTooltip.value || !!(select2 == null ? void 0 : select2.isOpen);
9227
9181
  });
9228
- const isSupportFilter = computed(() => lodash.exports.isFunction(select2 == null ? void 0 : select2.filter) || typeof (select2 == null ? void 0 : select2.filter) === "boolean" && (select2 == null ? void 0 : select2.filter));
9229
9182
  const selectionCls = computed(() => {
9230
9183
  return className(ns2.e("selection"), {
9231
9184
  [ns2.e("clearable")]: mergeClearable.value,
9232
- [ns2.em("selection", "error")]: isValidateError.value,
9233
- [ns2.em("selection", "gray-style")]: styleType === "gray"
9185
+ [ns2.em("selection", "error")]: isValidateError.value
9234
9186
  });
9235
9187
  });
9236
9188
  const inputCls = computed(() => {
@@ -9241,20 +9193,12 @@ function useSelectContent() {
9241
9193
  });
9242
9194
  const tagSize = computed(() => (select2 == null ? void 0 : select2.selectSize) || "sm");
9243
9195
  const placeholder = computed(() => displayInputValue.value ? "" : (select2 == null ? void 0 : select2.placeholder) || t("placeholder"));
9244
- const singlePlaceholder = computed(() => (select2 == null ? void 0 : select2.placeholder) || t("placeholder"));
9245
9196
  const isMultiple = computed(() => !!(select2 == null ? void 0 : select2.multiple));
9246
9197
  const handleClear = (e) => {
9247
9198
  e.preventDefault();
9248
9199
  e.stopPropagation();
9249
- searchQuery.value = "";
9250
- singleSearchKey.value = "";
9251
9200
  select2 == null ? void 0 : select2.handleClear();
9252
9201
  };
9253
- const onSingleInputWrapClick = () => {
9254
- if (!(select2 == null ? void 0 : select2.selectDisabled)) {
9255
- singleInputRef.value.focus();
9256
- }
9257
- };
9258
9202
  const tagDelete = (data) => {
9259
9203
  if (data && (data.value || data.value === 0)) {
9260
9204
  select2 == null ? void 0 : select2.tagDelete(data);
@@ -9264,67 +9208,39 @@ function useSelectContent() {
9264
9208
  select2 == null ? void 0 : select2.onFocus(e);
9265
9209
  };
9266
9210
  const onBlur = (e) => {
9267
- singleSearchKey.value = "";
9268
9211
  select2 == null ? void 0 : select2.onBlur(e);
9269
9212
  };
9270
- const onMultipleClick = () => {
9271
- if (select2 == null ? void 0 : select2.selectDisabled) {
9272
- return;
9273
- }
9274
- if (select2 == null ? void 0 : select2.isOpen) {
9275
- searchQuery.value = "";
9276
- select2 == null ? void 0 : select2.onBlur();
9277
- } else {
9278
- select2 == null ? void 0 : select2.onFocus();
9279
- }
9280
- };
9281
- const onArrowClick = () => {
9282
- if (isMultiple.value) {
9283
- onMultipleClick();
9284
- }
9285
- };
9286
9213
  const queryFilter = (e) => {
9287
9214
  e.preventDefault();
9288
9215
  e.stopPropagation();
9289
9216
  const query = e.target.value;
9290
- singleSearchKey.value = query;
9291
- searchQuery.value = query;
9292
9217
  if (!isReadOnly.value && (select2 == null ? void 0 : select2.debounceQueryFilter)) {
9293
9218
  select2 == null ? void 0 : select2.debounceQueryFilter(query);
9294
9219
  }
9295
9220
  };
9296
9221
  return {
9297
- singleInputRef,
9298
9222
  searchQuery,
9299
- singleSearchKey,
9300
9223
  selectedData,
9301
9224
  isSelectDisable,
9302
9225
  isSupportCollapseTags,
9303
9226
  isDisabledTooltip,
9304
- isSupportFilter,
9305
9227
  isReadOnly,
9306
9228
  selectionCls,
9307
9229
  inputCls,
9308
9230
  tagSize,
9309
9231
  placeholder,
9310
- singlePlaceholder,
9311
- singlePlaceholderWidth,
9312
9232
  isMultiple,
9313
9233
  displayInputValue,
9314
- isPlaceholderDark,
9315
- onSingleInputWrapClick,
9316
9234
  handleClear,
9317
9235
  tagDelete,
9318
9236
  onFocus,
9319
9237
  onBlur,
9320
- onMultipleClick,
9321
- onArrowClick,
9322
9238
  queryFilter
9323
9239
  };
9324
9240
  }
9325
9241
  var SelectContent = defineComponent({
9326
9242
  name: "SelectContent",
9327
- setup(_, ctx) {
9243
+ setup() {
9328
9244
  const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
9329
9245
  const ns2 = useNamespace$1("select");
9330
9246
  const clearCls = computed(() => ({
@@ -9338,71 +9254,44 @@ var SelectContent = defineComponent({
9338
9254
  const multipleCls = ns2.e("multiple");
9339
9255
  const multipleInputCls = ns2.em("multiple", "input");
9340
9256
  const {
9341
- singleInputRef,
9342
9257
  searchQuery,
9343
- singleSearchKey,
9344
9258
  selectedData,
9345
9259
  isSelectDisable,
9346
9260
  isSupportCollapseTags,
9347
9261
  isDisabledTooltip,
9348
9262
  isReadOnly,
9349
- isSupportFilter,
9350
9263
  selectionCls,
9351
9264
  inputCls,
9352
9265
  tagSize,
9353
9266
  placeholder,
9354
- singlePlaceholder,
9355
- singlePlaceholderWidth,
9356
9267
  isMultiple,
9357
- isPlaceholderDark,
9358
9268
  displayInputValue,
9359
- onSingleInputWrapClick,
9360
- onMultipleClick,
9361
- onArrowClick,
9362
9269
  handleClear,
9363
9270
  tagDelete,
9364
9271
  onFocus,
9365
9272
  onBlur,
9366
9273
  queryFilter
9367
9274
  } = useSelectContent();
9368
- const clearSingleSearchKey = () => {
9369
- singleSearchKey.value = "";
9370
- };
9371
- const clearMultipleSearchKey = () => {
9372
- searchQuery.value = "";
9373
- };
9374
- ctx.expose({
9375
- clearSingleSearchKey,
9376
- clearMultipleSearchKey
9377
- });
9378
9275
  return () => {
9379
9276
  return createVNode("div", {
9380
9277
  "class": selectionCls.value
9381
9278
  }, [isMultiple.value ? createVNode("div", {
9382
- "class": multipleCls,
9383
- "onClick": onMultipleClick
9279
+ "class": multipleCls
9384
9280
  }, [!isSupportCollapseTags.value && selectedData.value.length >= 1 && selectedData.value.map((item) => createVNode(Tag, {
9385
- "deletable": !(isSelectDisable.value || item.disabled),
9281
+ "deletable": true,
9386
9282
  "onTagDelete": withModifiers(() => tagDelete(item), ["prevent", "stop"]),
9387
9283
  "key": item.value,
9388
- "maxWidth": "78%",
9389
- "class": ["multiple-tag", {
9390
- disabled: isSelectDisable.value || item.disabled
9391
- }],
9392
9284
  "size": tagSize.value
9393
9285
  }, {
9394
9286
  default: () => [item.name]
9395
9287
  })), isSupportCollapseTags.value && selectedData.value.length >= 1 && createVNode(Tag, {
9396
9288
  "deletable": true,
9397
- "maxWidth": "75%",
9398
- "class": "multiple-tag",
9399
9289
  "onTagDelete": withModifiers(() => tagDelete(selectedData.value[0]), ["prevent", "stop"]),
9400
9290
  "size": tagSize.value
9401
9291
  }, {
9402
9292
  default: () => [selectedData.value[0].name]
9403
9293
  }), isSupportCollapseTags.value && selectedData.value.length > 1 && createVNode(Popover, {
9404
9294
  "trigger": "hover",
9405
- "auto-update-position": true,
9406
9295
  "disabled": isDisabledTooltip.value
9407
9296
  }, {
9408
9297
  default: () => createVNode(Tag, {
@@ -9414,49 +9303,39 @@ var SelectContent = defineComponent({
9414
9303
  "deletable": true,
9415
9304
  "onTagDelete": withModifiers(() => tagDelete(item), ["prevent", "stop"]),
9416
9305
  "key": item.value,
9417
- "class": "popover-tag",
9418
9306
  "size": tagSize.value
9419
9307
  }, {
9420
9308
  default: () => [item.name]
9421
9309
  }))])
9422
9310
  }), createVNode("div", {
9423
9311
  "class": multipleInputCls
9424
- }, [withDirectives(createVNode("input", {
9312
+ }, [createVNode("input", {
9425
9313
  "ref": "input",
9426
9314
  "value": searchQuery.value,
9427
9315
  "type": "text",
9428
9316
  "class": inputCls.value,
9429
9317
  "placeholder": placeholder.value,
9430
- "readonly": isReadOnly.value || !isSupportFilter.value,
9318
+ "readonly": isReadOnly.value,
9431
9319
  "disabled": isSelectDisable.value,
9432
- "onInput": queryFilter
9433
- }, null), [[vShow, !selectedData.value.length || isSupportFilter.value]])])]) : createVNode("div", {
9434
- "class": "single-inner-input",
9435
- "onClick": onSingleInputWrapClick
9436
- }, [!singleSearchKey.value && createVNode("span", {
9437
- "class": ["input-placeholder", {
9438
- "placeholder-dark": isPlaceholderDark.value
9439
- }],
9440
- "style": {
9441
- width: singlePlaceholderWidth.value
9442
- },
9443
- "title": displayInputValue.value || singlePlaceholder.value
9444
- }, [displayInputValue.value || singlePlaceholder.value]), withDirectives(createVNode("input", {
9445
- "ref": singleInputRef,
9320
+ "onInput": queryFilter,
9321
+ "onFocus": onFocus,
9322
+ "onBlur": onBlur
9323
+ }, null)])]) : createVNode("input", {
9324
+ "ref": "input",
9325
+ "value": displayInputValue.value,
9446
9326
  "type": "text",
9447
- "onUpdate:modelValue": ($event) => singleSearchKey.value = $event,
9448
9327
  "class": inputCls.value,
9328
+ "placeholder": placeholder.value,
9449
9329
  "readonly": isReadOnly.value,
9450
9330
  "disabled": isSelectDisable.value,
9451
9331
  "onFocus": onFocus,
9452
9332
  "onBlur": onBlur,
9453
9333
  "onInput": queryFilter
9454
- }, null), [[vModelText, singleSearchKey.value]])]), createVNode("span", {
9334
+ }, null), createVNode("span", {
9455
9335
  "onClick": handleClear,
9456
9336
  "class": clearCls.value
9457
9337
  }, [createVNode(AlertCloseIcon, null, null)]), createVNode("span", {
9458
- "class": arrowCls.value,
9459
- "onClick": onArrowClick
9338
+ "class": arrowCls.value
9460
9339
  }, [createVNode(SelectArrowIcon, null, null)])]);
9461
9340
  };
9462
9341
  }
@@ -9484,38 +9363,11 @@ function useSelectFunction(props, selectRef) {
9484
9363
  };
9485
9364
  return { isSelectFocus, focus, blur };
9486
9365
  }
9487
- function useSelectMenuSize(selectRef, dropdownRef, isOpen) {
9488
- const originRef = ref();
9489
- const dropdownWidth = ref(0);
9490
- let observer;
9491
- const updateDropdownWidth = () => {
9492
- var _a;
9493
- dropdownWidth.value = ((_a = originRef.value) == null ? void 0 : _a.getBoundingClientRect().width) || 0;
9494
- if (isOpen.value) {
9495
- dropdownRef.value.updatePosition();
9496
- }
9497
- };
9498
- const watchInputSize = () => {
9499
- if (window) {
9500
- observer = new window.ResizeObserver(updateDropdownWidth);
9501
- observer.observe(originRef.value);
9502
- }
9503
- };
9504
- onMounted(() => {
9505
- originRef.value = selectRef.value.$el;
9506
- watchInputSize();
9507
- updateDropdownWidth();
9508
- });
9509
- onBeforeUnmount(() => {
9510
- observer == null ? void 0 : observer.unobserve(originRef.value);
9511
- });
9512
- return { originRef, dropdownWidth };
9513
- }
9514
9366
  var select = "";
9515
9367
  var Select = defineComponent({
9516
9368
  name: "DSelect",
9517
9369
  props: selectProps,
9518
- emits: ["toggle-change", "value-change", "update:modelValue", "focus", "blur", "remove-tag", "clear", "load-more"],
9370
+ emits: ["toggle-change", "value-change", "update:modelValue", "focus", "blur", "remove-tag", "clear", "input-change"],
9519
9371
  setup(props, ctx) {
9520
9372
  const app = getCurrentInstance();
9521
9373
  const t = createI18nTranslate("DSelect", app);
@@ -9528,6 +9380,7 @@ var Select = defineComponent({
9528
9380
  const {
9529
9381
  selectDisabled,
9530
9382
  selectSize,
9383
+ originRef,
9531
9384
  dropdownRef,
9532
9385
  isOpen,
9533
9386
  selectCls,
@@ -9549,16 +9402,9 @@ var Select = defineComponent({
9549
9402
  isShowCreateOption
9550
9403
  } = useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t);
9551
9404
  const dropdownContainer = ref();
9552
- const {
9553
- originRef,
9554
- dropdownWidth
9555
- } = useSelectMenuSize(selectRef, dropdownRef, isOpen);
9556
9405
  const scrollbarNs = useNamespace$1("scrollbar");
9557
9406
  const ns2 = useNamespace$1("select");
9558
- const dropdownCls = {
9559
- [ns2.e("dropdown")]: true,
9560
- [ns2.em("dropdown", "multiple")]: props.multiple
9561
- };
9407
+ const dropdownCls = ns2.e("dropdown");
9562
9408
  const listCls = {
9563
9409
  [ns2.e("dropdown-list")]: true,
9564
9410
  [scrollbarNs.b()]: true
@@ -9570,8 +9416,17 @@ var Select = defineComponent({
9570
9416
  toggleChange
9571
9417
  });
9572
9418
  const isRender = ref(false);
9573
- onBeforeMount(() => {
9574
- isRender.value = true;
9419
+ const position = ref(["bottom-start", "top-start"]);
9420
+ const dropdownWidth = ref("0");
9421
+ const updateDropdownWidth = () => {
9422
+ var _a;
9423
+ dropdownWidth.value = ((_a = originRef == null ? void 0 : originRef.value) == null ? void 0 : _a.clientWidth) ? originRef.value.clientWidth + "px" : "100%";
9424
+ };
9425
+ watch(selectRef, (val) => {
9426
+ if (val) {
9427
+ originRef.value = val.$el;
9428
+ updateDropdownWidth();
9429
+ }
9575
9430
  });
9576
9431
  const scrollToBottom = () => {
9577
9432
  const compareHeight = dropdownContainer.value.scrollHeight - dropdownContainer.value.clientHeight;
@@ -9581,18 +9436,22 @@ var Select = defineComponent({
9581
9436
  }
9582
9437
  };
9583
9438
  onMounted(() => {
9439
+ isRender.value = true;
9440
+ updateDropdownWidth();
9441
+ window.addEventListener("resize", updateDropdownWidth);
9584
9442
  nextTick(() => {
9585
9443
  dropdownContainer.value.addEventListener("scroll", scrollToBottom);
9586
9444
  });
9587
9445
  });
9446
+ onUnmounted(() => {
9447
+ window.removeEventListener("resize", updateDropdownWidth);
9448
+ });
9588
9449
  provide(SELECT_TOKEN, reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
9589
9450
  selectDisabled,
9590
9451
  selectSize,
9591
9452
  isOpen,
9592
- isSelectFocus,
9593
9453
  selectedOptions,
9594
9454
  filterQuery,
9595
- dropdownWidth,
9596
9455
  valueChange,
9597
9456
  handleClear,
9598
9457
  updateInjectOptions,
@@ -9606,7 +9465,7 @@ var Select = defineComponent({
9606
9465
  "class": selectCls.value,
9607
9466
  "onClick": withModifiers(() => {
9608
9467
  toggleChange(!isOpen.value);
9609
- }, [])
9468
+ }, ["stop"])
9610
9469
  }, [createVNode(SelectContent, {
9611
9470
  "ref": selectRef
9612
9471
  }, null), createVNode(Teleport, {
@@ -9620,9 +9479,9 @@ var Select = defineComponent({
9620
9479
  "onUpdate:modelValue": ($event) => isRender.value = $event,
9621
9480
  "ref": dropdownRef,
9622
9481
  "origin": originRef.value,
9482
+ "align": "start",
9623
9483
  "offset": 4,
9624
- "place-strategy": "no-space",
9625
- "position": props.position,
9484
+ "position": position.value,
9626
9485
  "style": {
9627
9486
  visibility: isOpen.value ? "visible" : "hidden",
9628
9487
  "z-index": isOpen.value ? "var(--devui-z-index-dropdown, 1052)" : -1
@@ -9633,14 +9492,11 @@ var Select = defineComponent({
9633
9492
  return [createVNode("div", {
9634
9493
  "class": dropdownCls,
9635
9494
  "style": {
9636
- width: `${dropdownWidth.value}px`,
9495
+ width: `${dropdownWidth.value}`,
9637
9496
  visibility: isOpen.value ? "visible" : "hidden"
9638
9497
  }
9639
9498
  }, [withDirectives(createVNode("ul", {
9640
9499
  "class": listCls,
9641
- "style": {
9642
- padding: isShowEmptyText.value ? "0" : "12px"
9643
- },
9644
9500
  "ref": dropdownContainer
9645
9501
  }, [isShowCreateOption.value && createVNode(Option, {
9646
9502
  "value": filterQuery.value,
@@ -9660,8 +9516,7 @@ var Select = defineComponent({
9660
9516
  default: () => [props.multiple ? createVNode(Checkbox, {
9661
9517
  "modelValue": item._checked,
9662
9518
  "label": item.name,
9663
- "disabled": isDisabled(item),
9664
- "class": "select-checkbox"
9519
+ "disabled": isDisabled(item)
9665
9520
  }, null) : item.name || item.value]
9666
9521
  }))]), [[vShow, !isLoading.value]]), isShowEmptyText.value && createVNode("div", null, [((_c = ctx.slots) == null ? void 0 : _c.empty) && ctx.slots.empty(), !((_d = ctx.slots) == null ? void 0 : _d.empty) && createVNode("p", {
9667
9522
  "class": dropdownEmptyCls