vue-devui 1.0.0-rc.11 → 1.0.0-rc.12

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 (94) hide show
  1. package/README.md +2 -2
  2. package/auto-complete/index.es.js +29 -8
  3. package/auto-complete/index.umd.js +16 -16
  4. package/auto-complete/style.css +1 -1
  5. package/badge/index.es.js +3 -1
  6. package/badge/index.umd.js +1 -1
  7. package/button/index.es.js +3 -2
  8. package/button/index.umd.js +6 -6
  9. package/collapse/index.es.js +20 -186
  10. package/collapse/index.umd.js +1 -1
  11. package/collapse/style.css +1 -1
  12. package/countdown/index.es.js +56 -13
  13. package/countdown/index.umd.js +1 -1
  14. package/{date-picker → date-picker-pro}/index.d.ts +0 -0
  15. package/date-picker-pro/index.es.js +10856 -0
  16. package/date-picker-pro/index.umd.js +27 -0
  17. package/date-picker-pro/package.json +7 -0
  18. package/date-picker-pro/style.css +1 -0
  19. package/dropdown/index.es.js +1 -1
  20. package/dropdown/index.umd.js +1 -1
  21. package/editable-select/index.es.js +98 -56
  22. package/editable-select/index.umd.js +1 -1
  23. package/editable-select/style.css +1 -1
  24. package/icon/index.es.js +3 -2
  25. package/icon/index.umd.js +1 -1
  26. package/input/index.es.js +35 -8
  27. package/input/index.umd.js +7 -7
  28. package/input/style.css +1 -1
  29. package/modal/index.es.js +3 -2
  30. package/modal/index.umd.js +1 -1
  31. package/modal/style.css +1 -1
  32. package/notification/index.es.js +3 -2
  33. package/notification/index.umd.js +1 -1
  34. package/nuxt/components/DRangeDatePickerPro.js +3 -0
  35. package/nuxt/components/DatePickerPro.js +3 -0
  36. package/nuxt/components/OptionGroup.js +3 -0
  37. package/nuxt/components/Step.js +3 -0
  38. package/nuxt/components/Steps.js +3 -0
  39. package/nuxt/components/TimePicker.js +3 -0
  40. package/nuxt/components/datePickerProCommonProps.js +3 -0
  41. package/nuxt/components/datePickerProPanelProps.js +3 -0
  42. package/nuxt/components/datePickerProProps.js +3 -0
  43. package/nuxt/components/stepProps.js +3 -0
  44. package/nuxt/components/stepsProps.js +3 -0
  45. package/nuxt/components/timerPickerPanelProps.js +3 -0
  46. package/package.json +1 -1
  47. package/pagination/index.es.js +25 -7
  48. package/pagination/index.umd.js +1 -1
  49. package/result/index.es.js +3 -2
  50. package/result/index.umd.js +1 -1
  51. package/search/index.es.js +39 -10
  52. package/search/index.umd.js +7 -7
  53. package/search/style.css +1 -1
  54. package/select/index.es.js +156 -219
  55. package/select/index.umd.js +13 -13
  56. package/select/style.css +1 -1
  57. package/splitter/index.es.js +27 -7
  58. package/splitter/index.umd.js +10 -10
  59. package/steps/index.d.ts +7 -0
  60. package/steps/index.es.js +385 -0
  61. package/steps/index.umd.js +1 -0
  62. package/{date-picker → steps}/package.json +1 -1
  63. package/steps/style.css +1 -0
  64. package/style.css +1 -1
  65. package/table/index.es.js +542 -267
  66. package/table/index.umd.js +15 -15
  67. package/table/style.css +1 -1
  68. package/tabs/index.es.js +1 -1
  69. package/tabs/index.umd.js +1 -1
  70. package/tabs/style.css +1 -1
  71. package/time-picker/index.d.ts +7 -0
  72. package/{date-picker → time-picker}/index.es.js +1371 -1038
  73. package/time-picker/index.umd.js +27 -0
  74. package/time-picker/package.json +7 -0
  75. package/time-picker/style.css +1 -0
  76. package/time-select/index.es.js +157 -219
  77. package/time-select/index.umd.js +14 -14
  78. package/time-select/style.css +1 -1
  79. package/timeline/index.es.js +3 -2
  80. package/timeline/index.umd.js +1 -1
  81. package/tooltip/index.es.js +1 -1
  82. package/tooltip/index.umd.js +1 -1
  83. package/tree/index.es.js +186 -59
  84. package/tree/index.umd.js +16 -16
  85. package/tree/style.css +1 -1
  86. package/upload/index.es.js +51 -25
  87. package/upload/index.umd.js +1 -1
  88. package/upload/style.css +1 -1
  89. package/vue-devui.es.js +3963 -1421
  90. package/vue-devui.umd.js +23 -23
  91. package/date-picker/index.umd.js +0 -27
  92. package/date-picker/style.css +0 -1
  93. package/nuxt/components/DatePicker.js +0 -3
  94. package/nuxt/components/StickSlider.js +0 -3
@@ -29,7 +29,7 @@ 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, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, computed, onMounted, Teleport, createTextVNode, onBeforeUnmount, toRef, onBeforeMount, vShow, resolveDynamicComponent, resolveComponent } from "vue";
32
+ import { defineComponent, watch, provide, reactive, toRefs, createVNode, onUnmounted, Transition, mergeProps, ref, unref, nextTick, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, computed, onMounted, Teleport, createTextVNode, onBeforeUnmount, toRef, onBeforeMount, vShow, resolveComponent, getCurrentInstance } from "vue";
33
33
  import { onClickOutside } from "@vueuse/core";
34
34
  import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
35
35
  function className(classStr, classOpt) {
@@ -1145,7 +1145,7 @@ var lodash = { exports: {} };
1145
1145
  function baseAt(object4, paths) {
1146
1146
  var index2 = -1, length = paths.length, result2 = Array2(length), skip = object4 == null;
1147
1147
  while (++index2 < length) {
1148
- result2[index2] = skip ? undefined$1 : get(object4, paths[index2]);
1148
+ result2[index2] = skip ? undefined$1 : get2(object4, paths[index2]);
1149
1149
  }
1150
1150
  return result2;
1151
1151
  }
@@ -1590,7 +1590,7 @@ var lodash = { exports: {} };
1590
1590
  return matchesStrictComparable(toKey(path), srcValue);
1591
1591
  }
1592
1592
  return function(object4) {
1593
- var objValue = get(object4, path);
1593
+ var objValue = get2(object4, path);
1594
1594
  return objValue === undefined$1 && objValue === srcValue ? hasIn(object4, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
1595
1595
  };
1596
1596
  }
@@ -4323,7 +4323,7 @@ var lodash = { exports: {} };
4323
4323
  function functionsIn(object4) {
4324
4324
  return object4 == null ? [] : baseFunctions(object4, keysIn(object4));
4325
4325
  }
4326
- function get(object4, path, defaultValue) {
4326
+ function get2(object4, path, defaultValue) {
4327
4327
  var result2 = object4 == null ? undefined$1 : baseGet(object4, path);
4328
4328
  return result2 === undefined$1 ? defaultValue : result2;
4329
4329
  }
@@ -5178,7 +5178,7 @@ var lodash = { exports: {} };
5178
5178
  lodash2.forInRight = forInRight;
5179
5179
  lodash2.forOwn = forOwn;
5180
5180
  lodash2.forOwnRight = forOwnRight;
5181
- lodash2.get = get;
5181
+ lodash2.get = get2;
5182
5182
  lodash2.gt = gt;
5183
5183
  lodash2.gte = gte;
5184
5184
  lodash2.has = has;
@@ -7734,7 +7734,7 @@ defineComponent({
7734
7734
  };
7735
7735
  }
7736
7736
  });
7737
- function useSelect(props, ctx, focus, blur, isSelectFocus) {
7737
+ function useSelect(props, ctx, focus, blur, isSelectFocus, t) {
7738
7738
  const formContext = inject(FORM_TOKEN, void 0);
7739
7739
  const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
7740
7740
  const ns2 = useNamespace("select");
@@ -7742,6 +7742,7 @@ function useSelect(props, ctx, focus, blur, isSelectFocus) {
7742
7742
  const dropdownRef = ref();
7743
7743
  const selectDisabled = computed(() => (formContext == null ? void 0 : formContext.disabled) || props.disabled);
7744
7744
  const selectSize = computed(() => (formContext == null ? void 0 : formContext.size) || props.size);
7745
+ const isObjectOption = ref(false);
7745
7746
  const isOpen = ref(false);
7746
7747
  const toggleChange = (bool) => {
7747
7748
  if (selectDisabled.value) {
@@ -7765,6 +7766,7 @@ function useSelect(props, ctx, focus, blur, isSelectFocus) {
7765
7766
  [ns2.m("focus")]: isSelectFocus.value
7766
7767
  });
7767
7768
  });
7769
+ const cacheOptions = /* @__PURE__ */ new Map();
7768
7770
  const mergeOptions = computed(() => {
7769
7771
  const { multiple, modelValue } = props;
7770
7772
  return props.options.map((item) => {
@@ -7788,11 +7790,13 @@ function useSelect(props, ctx, focus, blur, isSelectFocus) {
7788
7790
  option._checked = false;
7789
7791
  }
7790
7792
  }
7793
+ cacheOptions.set(option.value, option);
7791
7794
  return option;
7792
7795
  });
7793
7796
  });
7797
+ const getValuesOption = (values) => values.map((value) => cacheOptions.get(value));
7794
7798
  const injectOptions = ref(/* @__PURE__ */ new Map());
7795
- const updateInjectOptions = (item, operation) => {
7799
+ const updateInjectOptions = (item, operation, isObject2) => {
7796
7800
  if (operation === "add") {
7797
7801
  injectOptions.value.set(item.value, item);
7798
7802
  } else if (operation === "delete") {
@@ -7800,6 +7804,7 @@ function useSelect(props, ctx, focus, blur, isSelectFocus) {
7800
7804
  injectOptions.value.delete(item.value);
7801
7805
  }
7802
7806
  }
7807
+ isObjectOption.value = isObject2;
7803
7808
  };
7804
7809
  const getInjectOptions = (values) => {
7805
7810
  return values.map((value) => {
@@ -7824,10 +7829,10 @@ function useSelect(props, ctx, focus, blur, isSelectFocus) {
7824
7829
  const inputValue = computed(() => {
7825
7830
  var _a;
7826
7831
  if (props.multiple && Array.isArray(props.modelValue)) {
7827
- selectedOptions.value = getInjectOptions(props.modelValue).filter((item) => !!item);
7832
+ selectedOptions.value = getInjectOptions(props.modelValue).filter((item) => item ? true : false);
7828
7833
  return selectedOptions.value.map((item) => (item == null ? void 0 : item.name) || (item == null ? void 0 : item.value) || "").join(",");
7829
7834
  } else if (!Array.isArray(props.modelValue)) {
7830
- selectedOptions.value = getInjectOptions([props.modelValue]).filter((item) => !!item);
7835
+ selectedOptions.value = getInjectOptions([props.modelValue]).filter((item) => item ? true : false);
7831
7836
  return ((_a = selectedOptions.value[0]) == null ? void 0 : _a.name) || "";
7832
7837
  }
7833
7838
  return "";
@@ -7838,7 +7843,26 @@ function useSelect(props, ctx, focus, blur, isSelectFocus) {
7838
7843
  toggleChange(!isOpen.value);
7839
7844
  };
7840
7845
  const isSupportFilter = computed(() => lodash.exports.isFunction(props.filter) || typeof props.filter === "boolean" && props.filter);
7841
- const valueChange = (item, isObjectOption) => {
7846
+ const getMultipleSelected = (items) => {
7847
+ if (mergeOptions.value.length) {
7848
+ ctx.emit("value-change", getValuesOption(items).filter((item) => item ? true : false));
7849
+ } else if (isObjectOption.value) {
7850
+ const selectItems = getInjectOptions(items).filter((item) => item ? true : false);
7851
+ ctx.emit("value-change", selectItems);
7852
+ } else {
7853
+ ctx.emit("value-change", items);
7854
+ }
7855
+ };
7856
+ const getSingleSelected = (item) => {
7857
+ if (mergeOptions.value.length) {
7858
+ ctx.emit("value-change", getValuesOption([item.value])[0]);
7859
+ } else if (isObjectOption.value) {
7860
+ ctx.emit("value-change", item);
7861
+ } else {
7862
+ ctx.emit("value-change", item.value);
7863
+ }
7864
+ };
7865
+ const valueChange = (item) => {
7842
7866
  const { multiple } = props;
7843
7867
  let { modelValue } = props;
7844
7868
  if (multiple) {
@@ -7848,6 +7872,10 @@ function useSelect(props, ctx, focus, blur, isSelectFocus) {
7848
7872
  if (option) {
7849
7873
  option._checked = !option._checked;
7850
7874
  }
7875
+ const mergeOption = getValuesOption([item.value])[0];
7876
+ if (mergeOption) {
7877
+ mergeOption._checked = !mergeOption._checked;
7878
+ }
7851
7879
  if (index2 > -1) {
7852
7880
  checkedItems.splice(index2, 1);
7853
7881
  } else {
@@ -7861,11 +7889,12 @@ function useSelect(props, ctx, focus, blur, isSelectFocus) {
7861
7889
  if (isSupportFilter.value) {
7862
7890
  focus();
7863
7891
  }
7892
+ getMultipleSelected(checkedItems);
7864
7893
  } else {
7865
7894
  ctx.emit("update:modelValue", item.value);
7866
7895
  toggleChange(false);
7896
+ getSingleSelected(item);
7867
7897
  }
7868
- ctx.emit("value-change", isObjectOption ? item : item.value);
7869
7898
  };
7870
7899
  const handleClose = () => {
7871
7900
  isOpen.value = false;
@@ -7874,8 +7903,10 @@ function useSelect(props, ctx, focus, blur, isSelectFocus) {
7874
7903
  const handleClear = () => {
7875
7904
  if (props.multiple) {
7876
7905
  ctx.emit("update:modelValue", []);
7906
+ ctx.emit("value-change", []);
7877
7907
  } else {
7878
7908
  ctx.emit("update:modelValue", "");
7909
+ ctx.emit("value-change", "");
7879
7910
  }
7880
7911
  ctx.emit("clear");
7881
7912
  if (isOpen.value) {
@@ -7895,6 +7926,7 @@ function useSelect(props, ctx, focus, blur, isSelectFocus) {
7895
7926
  modelValue = checkedItems;
7896
7927
  ctx.emit("update:modelValue", modelValue);
7897
7928
  ctx.emit("remove-tag", data.value);
7929
+ getMultipleSelected(checkedItems);
7898
7930
  };
7899
7931
  const onFocus = (e) => {
7900
7932
  ctx.emit("focus", e);
@@ -7934,13 +7966,13 @@ function useSelect(props, ctx, focus, blur, isSelectFocus) {
7934
7966
  return label.toString().toLocaleLowerCase().includes(filterQuery.value.toLocaleLowerCase());
7935
7967
  }).length;
7936
7968
  if (isLoading.value) {
7937
- return props.loadingText;
7969
+ return props.loadingText || t("loadingText");
7938
7970
  }
7939
7971
  if (isSupportFilter.value && filterQuery.value && injectOptionsArray.value.length > 0 && visibleOptionsCount === 0) {
7940
- return props.noMatchText;
7972
+ return props.noMatchText || t("noMatchText");
7941
7973
  }
7942
7974
  if (injectOptionsArray.value.length === 0) {
7943
- return props.noDataText;
7975
+ return props.noDataText || t("noDataText");
7944
7976
  }
7945
7977
  return "";
7946
7978
  });
@@ -8011,7 +8043,7 @@ const selectProps = {
8011
8043
  },
8012
8044
  placeholder: {
8013
8045
  type: String,
8014
- default: "\u8BF7\u9009\u62E9"
8046
+ default: ""
8015
8047
  },
8016
8048
  multiple: {
8017
8049
  type: Boolean,
@@ -8051,11 +8083,11 @@ const selectProps = {
8051
8083
  },
8052
8084
  noDataText: {
8053
8085
  type: String,
8054
- default: "\u65E0\u6570\u636E"
8086
+ default: ""
8055
8087
  },
8056
8088
  noMatchText: {
8057
8089
  type: String,
8058
- default: "\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55"
8090
+ default: ""
8059
8091
  },
8060
8092
  loading: {
8061
8093
  type: Boolean,
@@ -8063,7 +8095,7 @@ const selectProps = {
8063
8095
  },
8064
8096
  loadingText: {
8065
8097
  type: String,
8066
- default: "\u52A0\u8F7D\u4E2D"
8098
+ default: ""
8067
8099
  },
8068
8100
  onToggleChange: {
8069
8101
  type: Function,
@@ -8102,7 +8134,17 @@ const selectContentProps = {
8102
8134
  default: ""
8103
8135
  }
8104
8136
  };
8137
+ const optionGroupProps = {
8138
+ label: {
8139
+ type: String
8140
+ },
8141
+ disabled: {
8142
+ type: Boolean,
8143
+ default: false
8144
+ }
8145
+ };
8105
8146
  const SELECT_TOKEN = Symbol("dSelect");
8147
+ const OPTION_GROUP_TOKEN = Symbol("dOptionGroup");
8106
8148
  const commonProps = {
8107
8149
  name: {
8108
8150
  type: String,
@@ -8559,6 +8601,7 @@ defineComponent({
8559
8601
  function useOption(props) {
8560
8602
  const ns2 = useNamespace("select");
8561
8603
  const select2 = inject(SELECT_TOKEN, null);
8604
+ const optionGroup = inject(OPTION_GROUP_TOKEN, null);
8562
8605
  const currentName = computed(() => {
8563
8606
  return props.name || props.value;
8564
8607
  });
@@ -8580,16 +8623,17 @@ function useOption(props) {
8580
8623
  _checked: false
8581
8624
  };
8582
8625
  });
8626
+ const isDisabled = computed(() => props.disabled || ((optionGroup == null ? void 0 : optionGroup.disabled) ? true : false));
8583
8627
  const isObjectOption = ref(!!props.name);
8584
8628
  const selectOptionCls = computed(() => {
8585
8629
  return className(ns2.e("item"), {
8586
8630
  active: isOptionSelected.value,
8587
- disabled: props.disabled
8631
+ disabled: isDisabled.value
8588
8632
  });
8589
8633
  });
8590
8634
  const optionSelect = () => {
8591
- if (!props.disabled) {
8592
- select2 == null ? void 0 : select2.valueChange(optionItem.value, isObjectOption.value);
8635
+ if (!isDisabled.value) {
8636
+ select2 == null ? void 0 : select2.valueChange(optionItem.value);
8593
8637
  }
8594
8638
  };
8595
8639
  const isVisible = computed(() => {
@@ -8601,10 +8645,10 @@ function useOption(props) {
8601
8645
  }
8602
8646
  });
8603
8647
  onBeforeMount(() => {
8604
- select2 == null ? void 0 : select2.updateInjectOptions(optionItem.value, "add");
8648
+ select2 == null ? void 0 : select2.updateInjectOptions(optionItem.value, "add", isObjectOption.value);
8605
8649
  });
8606
8650
  onBeforeUnmount(() => {
8607
- select2 == null ? void 0 : select2.updateInjectOptions(optionItem.value, "delete");
8651
+ select2 == null ? void 0 : select2.updateInjectOptions(optionItem.value, "delete", isObjectOption.value);
8608
8652
  });
8609
8653
  return {
8610
8654
  currentName,
@@ -8636,188 +8680,38 @@ var Option = defineComponent({
8636
8680
  };
8637
8681
  }
8638
8682
  });
8639
- const DEFAULT_PREFIX = "icon";
8640
- const iconProps = {
8641
- name: {
8642
- type: String,
8643
- default: "",
8644
- required: true
8645
- },
8646
- size: {
8647
- type: [Number, String],
8648
- default: "inherit"
8649
- },
8650
- color: {
8651
- type: String,
8652
- default: "inherit"
8653
- },
8654
- component: {
8655
- type: Object,
8656
- default: null
8657
- },
8658
- classPrefix: {
8659
- type: String,
8660
- default: DEFAULT_PREFIX
8661
- },
8662
- operable: {
8663
- type: Boolean,
8664
- default: false
8665
- },
8666
- disabled: {
8667
- type: Boolean,
8668
- default: false
8669
- },
8670
- rotate: {
8671
- type: [Number, String]
8672
- }
8673
- };
8674
- const svgIconProps = {
8675
- name: {
8676
- type: String,
8677
- default: "",
8678
- required: true
8679
- },
8680
- color: {
8681
- type: String,
8682
- default: "inherit"
8683
- },
8684
- size: {
8685
- type: [Number, String],
8686
- default: "inherit"
8687
- }
8688
- };
8689
- var icon = "";
8690
- var svgIcon = defineComponent({
8691
- name: "DSvgIcon",
8692
- props: svgIconProps,
8693
- setup(props) {
8694
- const {
8695
- name,
8696
- color,
8697
- size
8698
- } = toRefs(props);
8699
- const ns2 = useNamespace("svg-icon");
8700
- const iconName = computed(() => `#icon-${name.value}`);
8701
- const iconSize = computed(() => {
8702
- return typeof size.value === "number" ? `${size.value}px` : size.value;
8703
- });
8704
- const styles = {
8705
- width: iconSize.value,
8706
- height: iconSize.value
8707
- };
8708
- return () => {
8709
- return createVNode("svg", {
8710
- "class": ns2.b(),
8711
- "style": styles
8712
- }, [createVNode("use", {
8713
- "xlink:href": iconName.value,
8714
- "fill": color.value
8715
- }, null)]);
8716
- };
8717
- }
8718
- });
8719
- function isUrl(value) {
8720
- return /^((http|https):)?\/\//.test(value);
8721
- }
8722
- function useIconDom(props, ctx) {
8723
- const {
8724
- component,
8725
- name,
8726
- size,
8727
- color,
8728
- classPrefix,
8729
- rotate
8730
- } = toRefs(props);
8731
- const ns2 = useNamespace("icon");
8732
- const iconSize = computed(() => {
8733
- return typeof size.value === "number" ? `${size.value}px` : size.value;
8734
- });
8735
- const IconComponent = component.value ? resolveDynamicComponent(component.value) : resolveDynamicComponent(svgIcon);
8736
- const imgIconDom = () => {
8737
- return createVNode("img", mergeProps({
8738
- "src": name.value,
8739
- "alt": name.value.split("/")[name.value.split("/").length - 1],
8740
- "class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
8741
- "style": {
8742
- width: iconSize.value || "",
8743
- transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
8744
- }
8745
- }, ctx.attrs), null);
8746
- };
8747
- const svgIconDom = () => {
8748
- return createVNode(IconComponent, mergeProps({
8749
- "name": name.value,
8750
- "color": color.value,
8751
- "size": iconSize.value,
8752
- "class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
8753
- "style": {
8754
- transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
8755
- }
8756
- }, ctx.attrs), null);
8757
- };
8758
- const fontIconDom = () => {
8759
- const fontIconClass = /^icon-/.test(name.value) ? name.value : `${classPrefix.value}-${name.value}`;
8760
- return createVNode("i", mergeProps({
8761
- "class": [classPrefix.value, fontIconClass, (rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
8762
- "style": {
8763
- fontSize: iconSize.value,
8764
- color: color.value,
8765
- transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
8766
- }
8767
- }, ctx.attrs), null);
8768
- };
8769
- const iconDom = () => {
8770
- return component.value ? svgIconDom() : isUrl(name.value) ? imgIconDom() : fontIconDom();
8771
- };
8772
- return {
8773
- iconDom
8774
- };
8775
- }
8776
- var Icon = defineComponent({
8777
- name: "DIcon",
8778
- props: iconProps,
8779
- setup(props, ctx) {
8780
- const {
8781
- disabled,
8782
- operable
8783
- } = toRefs(props);
8784
- const {
8785
- iconDom
8786
- } = useIconDom(props, ctx);
8787
- const ns2 = useNamespace("icon");
8788
- const wrapClassed = computed(() => ({
8789
- [ns2.e("container")]: true,
8790
- [ns2.m("disabled")]: disabled.value,
8791
- [ns2.m("operable")]: operable.value
8792
- }));
8793
- const onClick = (e) => {
8794
- e.stopImmediatePropagation();
8795
- if (disabled.value) {
8796
- e.preventDefault();
8797
- }
8798
- };
8799
- return () => {
8800
- var _a, _b, _c, _d;
8801
- return createVNode("div", {
8802
- "class": wrapClassed.value,
8803
- "onClick": onClick
8804
- }, [(_b = (_a = ctx.slots).prefix) == null ? void 0 : _b.call(_a), iconDom(), (_d = (_c = ctx.slots).suffix) == null ? void 0 : _d.call(_c)]);
8805
- };
8806
- }
8807
- });
8808
- var iconGroup = "";
8809
- defineComponent({
8810
- name: "DIconGroup",
8811
- setup(_, ctx) {
8812
- const ns2 = useNamespace("icon-group");
8813
- return () => {
8814
- var _a, _b;
8815
- return createVNode("div", {
8816
- "class": ns2.b()
8817
- }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
8818
- };
8819
- }
8820
- });
8683
+ const AlertCloseIcon = () => createVNode("svg", {
8684
+ "width": "10px",
8685
+ "height": "10px",
8686
+ "viewBox": "0 0 10 10",
8687
+ "version": "1.1",
8688
+ "xmlns": "http://www.w3.org/2000/svg"
8689
+ }, [createVNode("g", {
8690
+ "stroke": "none",
8691
+ "stroke-width": "1",
8692
+ "fill": "none",
8693
+ "fill-rule": "evenodd"
8694
+ }, [createVNode("g", {
8695
+ "transform": "translate(-3.000000, -3.000000)",
8696
+ "fill-rule": "nonzero"
8697
+ }, [createVNode("path", {
8698
+ "d": "M11.6426,3.19816936 C11.9239974,2.91574512 12.4131626,2.93784891 12.7352108,3.24751057 C13.0571998,3.5572302 13.0901298,4.03723416 12.8087324,4.31965839 L9.14064666,7.99900183 L12.8087324,11.6803416 C13.0645482,11.9370909 13.0605893,12.3571292 12.8158402,12.6640749 L12.7352108,12.7524894 C12.4131626,13.0621511 11.9239974,13.0842548 11.6426,12.8018306 L8,9.14489021 L4.35740003,12.8018306 C4.10158422,13.05858 3.6740594,13.0636532 3.35648225,12.8298003 L3.26478919,12.7524894 C2.94280021,12.4427698 2.90987023,11.9627658 3.19126762,11.6803416 L6.8583349,7.99900183 L3.19126762,4.31965839 C2.93545181,4.06290908 2.93941068,3.64287076 3.18415975,3.3359251 L3.26478919,3.24751057 C3.58683735,2.93784891 4.07600264,2.91574512 4.35740003,3.19816936 L8,6.85411161 L11.6426,3.19816936 Z"
8699
+ }, null)])])]);
8700
+ const SelectArrowIcon = () => createVNode("svg", {
8701
+ "width": "1em",
8702
+ "height": "1em",
8703
+ "viewBox": "0 0 16 16",
8704
+ "version": "1.1",
8705
+ "xmlns": "http://www.w3.org/2000/svg"
8706
+ }, [createVNode("g", {
8707
+ "stroke": "none",
8708
+ "stroke-width": "1",
8709
+ "fill": "none",
8710
+ "fill-rule": "evenodd"
8711
+ }, [createVNode("path", {
8712
+ "d": "M12.1464466,6.85355339 L8.35355339,10.6464466 C8.15829124,10.8417088 7.84170876,10.8417088 7.64644661,10.6464466 L3.85355339,6.85355339 C3.65829124,6.65829124 3.65829124,6.34170876 3.85355339,6.14644661 C3.94732158,6.05267842 4.07449854,6 4.20710678,6 L11.7928932,6 C12.0690356,6 12.2928932,6.22385763 12.2928932,6.5 C12.2928932,6.63260824 12.2402148,6.7597852 12.1464466,6.85355339 Z",
8713
+ "fill-rule": "nonzero"
8714
+ }, null)])]);
8821
8715
  const tagProps = {
8822
8716
  type: {
8823
8717
  type: String,
@@ -8941,10 +8835,30 @@ var Tag = defineComponent({
8941
8835
  };
8942
8836
  }
8943
8837
  });
8838
+ const camelize = (name) => name.substring(1).replace(/^\S/, (s) => s.toLocaleLowerCase());
8839
+ function get(object4, path) {
8840
+ const keys = path.split(".");
8841
+ let result = object4;
8842
+ keys.forEach((key) => {
8843
+ var _a;
8844
+ result = (_a = result[key]) != null ? _a : "";
8845
+ });
8846
+ return result;
8847
+ }
8848
+ function createI18nTranslate(name, app, newPrefix) {
8849
+ const prefix = newPrefix || camelize(name) + ".";
8850
+ return (path) => {
8851
+ const messages2 = app == null ? void 0 : app.appContext.config.globalProperties.langMessages.value;
8852
+ const message = get(messages2, prefix + path) || get(messages2, path);
8853
+ return message;
8854
+ };
8855
+ }
8944
8856
  function useSelectContent(props) {
8945
8857
  const ns2 = useNamespace("select");
8946
8858
  const select2 = inject(SELECT_TOKEN);
8947
8859
  const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
8860
+ const app = getCurrentInstance();
8861
+ const t = createI18nTranslate("DSelect", app);
8948
8862
  const searchQuery = ref("");
8949
8863
  const selectedData = computed(() => {
8950
8864
  return (select2 == null ? void 0 : select2.selectedOptions) || [];
@@ -8978,7 +8892,8 @@ function useSelectContent(props) {
8978
8892
  [ns2.em("input", "sm")]: (select2 == null ? void 0 : select2.selectSize) === "sm"
8979
8893
  });
8980
8894
  });
8981
- const placeholder = computed(() => props.value.length > 0 ? "" : (select2 == null ? void 0 : select2.placeholder) || "");
8895
+ const tagSize = computed(() => (select2 == null ? void 0 : select2.selectSize) || "sm");
8896
+ const placeholder = computed(() => props.value.length > 0 ? "" : (select2 == null ? void 0 : select2.placeholder) || t("placeholder"));
8982
8897
  const isMultiple = computed(() => !!(select2 == null ? void 0 : select2.multiple));
8983
8898
  const handleClear = (e) => {
8984
8899
  e.preventDefault();
@@ -8986,7 +8901,7 @@ function useSelectContent(props) {
8986
8901
  select2 == null ? void 0 : select2.handleClear();
8987
8902
  };
8988
8903
  const tagDelete = (data) => {
8989
- if (data && data.value) {
8904
+ if (data && (data.value || data.value === 0)) {
8990
8905
  select2 == null ? void 0 : select2.tagDelete(data);
8991
8906
  }
8992
8907
  };
@@ -9013,6 +8928,7 @@ function useSelectContent(props) {
9013
8928
  isReadOnly,
9014
8929
  selectionCls,
9015
8930
  inputCls,
8931
+ tagSize,
9016
8932
  placeholder,
9017
8933
  isMultiple,
9018
8934
  handleClear,
@@ -9047,6 +8963,7 @@ var SelectContent = defineComponent({
9047
8963
  isReadOnly,
9048
8964
  selectionCls,
9049
8965
  inputCls,
8966
+ tagSize,
9050
8967
  placeholder,
9051
8968
  isMultiple,
9052
8969
  handleClear,
@@ -9067,7 +8984,8 @@ var SelectContent = defineComponent({
9067
8984
  e.stopPropagation();
9068
8985
  tagDelete(item);
9069
8986
  },
9070
- "key": item.value
8987
+ "key": item.value,
8988
+ "size": tagSize.value
9071
8989
  }, {
9072
8990
  default: () => [item.name]
9073
8991
  })), isSupportCollapseTags.value && selectedData.value.length >= 1 && createVNode(Tag, {
@@ -9076,7 +8994,8 @@ var SelectContent = defineComponent({
9076
8994
  e.preventDefault();
9077
8995
  e.stopPropagation();
9078
8996
  tagDelete(selectedData.value[0]);
9079
- }
8997
+ },
8998
+ "size": tagSize.value
9080
8999
  }, {
9081
9000
  default: () => [selectedData.value[0].name]
9082
9001
  }), isSupportCollapseTags.value && selectedData.value.length > 1 && createVNode(Popover, {
@@ -9093,7 +9012,8 @@ var SelectContent = defineComponent({
9093
9012
  e.stopPropagation();
9094
9013
  tagDelete(item);
9095
9014
  },
9096
- "key": item.value
9015
+ "key": item.value,
9016
+ "size": tagSize.value
9097
9017
  }, {
9098
9018
  default: () => [item.name]
9099
9019
  }))])
@@ -9124,13 +9044,9 @@ var SelectContent = defineComponent({
9124
9044
  }, null), createVNode("span", {
9125
9045
  "onClick": handleClear,
9126
9046
  "class": clearCls.value
9127
- }, [createVNode(Icon, {
9128
- "name": "close"
9129
- }, null)]), createVNode("span", {
9047
+ }, [createVNode(AlertCloseIcon, null, null)]), createVNode("span", {
9130
9048
  "class": arrowCls.value
9131
- }, [createVNode(Icon, {
9132
- "name": "select-arrow"
9133
- }, null)])]);
9049
+ }, [createVNode(SelectArrowIcon, null, null)])]);
9134
9050
  };
9135
9051
  }
9136
9052
  });
@@ -9163,6 +9079,8 @@ var Select = defineComponent({
9163
9079
  props: selectProps,
9164
9080
  emits: ["toggle-change", "value-change", "update:modelValue", "focus", "blur", "remove-tag", "clear"],
9165
9081
  setup(props, ctx) {
9082
+ const app = getCurrentInstance();
9083
+ const t = createI18nTranslate("DSelect", app);
9166
9084
  const selectRef = ref();
9167
9085
  const {
9168
9086
  isSelectFocus,
@@ -9194,7 +9112,7 @@ var Select = defineComponent({
9194
9112
  isDisabled,
9195
9113
  toggleChange,
9196
9114
  isShowCreateOption
9197
- } = useSelect(props, ctx, focus, blur, isSelectFocus);
9115
+ } = useSelect(props, ctx, focus, blur, isSelectFocus, t);
9198
9116
  const scrollbarNs = useNamespace("scrollbar");
9199
9117
  const ns2 = useNamespace("select");
9200
9118
  const dropdownCls = ns2.e("dropdown");
@@ -9268,13 +9186,32 @@ var Select = defineComponent({
9268
9186
  };
9269
9187
  }
9270
9188
  });
9189
+ var OptionGroup = defineComponent({
9190
+ name: "DOptionGroup",
9191
+ props: optionGroupProps,
9192
+ setup(props, ctx) {
9193
+ const ns2 = useNamespace("select");
9194
+ provide(OPTION_GROUP_TOKEN, reactive(__spreadValues({}, toRefs(props))));
9195
+ return () => {
9196
+ var _a;
9197
+ return createVNode("ul", {
9198
+ "class": ns2.e("group")
9199
+ }, [createVNode("li", {
9200
+ "class": ns2.e("group-title")
9201
+ }, [props.label || ""]), createVNode("li", null, [createVNode("ul", {
9202
+ "class": ns2.e("group-content")
9203
+ }, [((_a = ctx.slots) == null ? void 0 : _a.default) && ctx.slots.default()])])]);
9204
+ };
9205
+ }
9206
+ });
9271
9207
  var index = {
9272
9208
  title: "Select \u4E0B\u62C9\u6846",
9273
9209
  category: "\u6570\u636E\u5F55\u5165",
9274
- status: "90%",
9210
+ status: "100%",
9275
9211
  install(app) {
9276
9212
  app.component(Select.name, Select);
9277
9213
  app.component(Option.name, Option);
9214
+ app.component(OptionGroup.name, OptionGroup);
9278
9215
  }
9279
9216
  };
9280
- export { Option, Select, index as default };
9217
+ export { Option, OptionGroup, Select, index as default };