@sdata/web-vue 1.8.0 → 1.9.0

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 (120) hide show
  1. package/dist/sd.css +90 -0
  2. package/dist/sd.min.css +1 -1
  3. package/es/_components/input-label/input-label.js +30 -24
  4. package/es/_components/select-view/interface.d.ts +1 -0
  5. package/es/_components/select-view/select-view.d.ts +12 -3
  6. package/es/_components/select-view/select-view.js +38 -28
  7. package/es/_components/select-view/style/index.css +45 -0
  8. package/es/_hooks/use-trigger.d.ts +4 -6
  9. package/es/_hooks/use-trigger.js +7 -5
  10. package/es/auto-complete/auto-complete.d.ts +1 -1
  11. package/es/auto-complete/index.d.ts +3 -3
  12. package/es/badge/badge.d.ts +1 -1
  13. package/es/badge/index.d.ts +3 -3
  14. package/es/carousel/carousel-arrow.vue.d.ts +1 -1
  15. package/es/carousel/carousel.d.ts +2 -2
  16. package/es/carousel/index.d.ts +6 -6
  17. package/es/cascader/cascader-panel.vue.d.ts +2 -2
  18. package/es/cascader/cascader.vue.d.ts +20 -11
  19. package/es/cascader/index.d.ts +44 -26
  20. package/es/config-provider/config-provider.vue.d.ts +1 -1
  21. package/es/config-provider/index.d.ts +3 -3
  22. package/es/date-picker/index.d.ts +6 -6
  23. package/es/date-picker/picker.vue.d.ts +6 -6
  24. package/es/date-picker/range-picker.vue.d.ts +6 -6
  25. package/es/descriptions/descriptions.d.ts +2 -2
  26. package/es/descriptions/index.d.ts +6 -6
  27. package/es/drawer/drawer.vue_vue_type_script_lang.js +1 -1
  28. package/es/dropdown/dropdown-button.vue.d.ts +8 -8
  29. package/es/dropdown/dropdown-panel.vue.d.ts +2 -2
  30. package/es/dropdown/dropdown-submenu.vue.d.ts +8 -8
  31. package/es/dropdown/dropdown.vue.d.ts +8 -8
  32. package/es/dropdown/index.d.ts +32 -32
  33. package/es/ellipsis/ellipsis.vue.d.ts +13 -13
  34. package/es/ellipsis/ellipsis.vue_vue_type_script_lang.js +1 -1
  35. package/es/ellipsis/index.d.ts +56 -56
  36. package/es/ellipsis/performant-ellipsis.vue.d.ts +14 -14
  37. package/es/form/form-item-label.vue.d.ts +12 -12
  38. package/es/form/form-item.vue.d.ts +12 -12
  39. package/es/form/index.d.ts +12 -12
  40. package/es/grid/grid.vue.d.ts +1 -1
  41. package/es/grid/index.d.ts +3 -3
  42. package/es/image/image.vue.d.ts +12 -12
  43. package/es/image/preview-action.d.ts +12 -12
  44. package/es/image/preview-group.vue.d.ts +12 -12
  45. package/es/image/preview-toolbar.vue.d.ts +12 -12
  46. package/es/image/preview.vue.d.ts +12 -12
  47. package/es/index.css +90 -0
  48. package/es/index.js +2 -2
  49. package/es/input-tag/index.d.ts +6 -6
  50. package/es/input-tag/input-tag.d.ts +3 -3
  51. package/es/input-tag/input-tag.js +179 -30
  52. package/es/input-tag/style/index.css +45 -0
  53. package/es/input-tag/style/input-tag.scss +53 -0
  54. package/es/list/index.d.ts +3 -3
  55. package/es/list/list.d.ts +1 -1
  56. package/es/menu/sub-menu-pop.vue.d.ts +6 -6
  57. package/es/modal/modal.vue_vue_type_script_lang.js +1 -1
  58. package/es/overflow-list/index.d.ts +3 -3
  59. package/es/overflow-list/overflow-list.d.ts +1 -1
  60. package/es/pagination/page-options.vue.d.ts +188 -98
  61. package/es/popconfirm/index.d.ts +12 -12
  62. package/es/popconfirm/popconfirm.vue.d.ts +6 -6
  63. package/es/popover/index.d.ts +12 -12
  64. package/es/popover/popover.vue.d.ts +6 -6
  65. package/es/progress/index.d.ts +5 -5
  66. package/es/progress/line.vue.d.ts +1 -1
  67. package/es/progress/progress.vue.d.ts +2 -2
  68. package/es/scrollbar/index.d.ts +2 -2
  69. package/es/scrollbar/scrollbar.vue.d.ts +1 -1
  70. package/es/scrollbar/thumb.vue.d.ts +1 -1
  71. package/es/sd-vue.js +2 -2
  72. package/es/select/hooks/use-options.d.ts +9 -4
  73. package/es/select/hooks/use-options.js +2 -2
  74. package/es/select/hooks/use-select.d.ts +9 -4
  75. package/es/select/index.d.ts +188 -98
  76. package/es/select/interface.d.ts +57 -46
  77. package/es/select/select-dropdown.vue.d.ts +2 -2
  78. package/es/select/select.d.ts +107 -59
  79. package/es/select/select.js +179 -125
  80. package/es/select/utils.d.ts +1 -1
  81. package/es/select/utils.js +28 -10
  82. package/es/skeleton/index.d.ts +1 -1
  83. package/es/skeleton/line.vue.d.ts +1 -1
  84. package/es/slider/index.d.ts +27 -27
  85. package/es/slider/slider-button.vue.d.ts +12 -12
  86. package/es/slider/slider.vue.d.ts +13 -13
  87. package/es/space/index.d.ts +3 -3
  88. package/es/space/space.d.ts +1 -1
  89. package/es/statistic/index.d.ts +6 -6
  90. package/es/statistic/statistic.vue.d.ts +2 -2
  91. package/es/table/index.d.ts +6 -6
  92. package/es/table/table.d.ts +2 -2
  93. package/es/tabs/index.d.ts +9 -9
  94. package/es/tabs/tabs.d.ts +3 -3
  95. package/es/tag/index.d.ts +3 -3
  96. package/es/tag/tag.vue.d.ts +1 -1
  97. package/es/time-picker/index.d.ts +12 -12
  98. package/es/time-picker/time-picker.vue.d.ts +6 -6
  99. package/es/tooltip/index.d.ts +12 -12
  100. package/es/tooltip/tooltip.vue.d.ts +6 -6
  101. package/es/transfer/index.d.ts +10 -10
  102. package/es/transfer/transfer-view.vue.d.ts +5 -5
  103. package/es/transfer/transfer.vue.d.ts +5 -5
  104. package/es/tree/index.d.ts +6 -6
  105. package/es/tree/tree.vue.d.ts +2 -2
  106. package/es/tree-select/hooks/use-selected-state.d.ts +2 -0
  107. package/es/tree-select/hooks/use-selected-state.js +26 -8
  108. package/es/tree-select/index.d.ts +265 -61
  109. package/es/tree-select/interface.d.ts +16 -3
  110. package/es/tree-select/panel.d.ts +6 -6
  111. package/es/tree-select/tree-select.js +28 -15
  112. package/es/tree-select/tree-select.vue.d.ts +143 -30
  113. package/es/tree-select/tree-select.vue_vue_type_script_lang.js +100 -23
  114. package/es/trigger/index.d.ts +6 -6
  115. package/es/trigger/trigger.d.ts +2 -2
  116. package/es/typography/operations.vue.d.ts +12 -12
  117. package/json/vetur-attributes.json +36 -158
  118. package/json/vetur-tags.json +10 -46
  119. package/json/web-types.json +79 -366
  120. package/package.json +7 -7
package/es/index.css CHANGED
@@ -2012,6 +2012,7 @@ body {
2012
2012
  }
2013
2013
  .sd-select-view-multiple .sd-select-view-inner {
2014
2014
  flex: 1;
2015
+ min-width: 0;
2015
2016
  overflow: hidden;
2016
2017
  line-height: 0;
2017
2018
  }
@@ -2019,9 +2020,16 @@ body {
2019
2020
  display: flex;
2020
2021
  flex-wrap: wrap;
2021
2022
  }
2023
+ .sd-select-view-multiple .sd-select-view-inner.sd-select-view-inner-responsive {
2024
+ display: flex;
2025
+ flex-wrap: nowrap;
2026
+ align-items: center;
2027
+ }
2022
2028
  .sd-select-view-multiple .sd-select-view-inner .sd-select-view-tag {
2023
2029
  display: inline-flex;
2030
+ flex-shrink: 0;
2024
2031
  align-items: center;
2032
+ min-width: 0;
2025
2033
  margin-right: 4px;
2026
2034
  color: var(--color-text-1);
2027
2035
  font-size: 12px;
@@ -2039,6 +2047,19 @@ body {
2039
2047
  .sd-select-view-multiple .sd-select-view-inner .sd-select-view-tag.sd-tag-custom-color .sd-icon-hover.sd-tag-icon-hover:hover::before {
2040
2048
  background-color: rgba(255, 255, 255, 0.2);
2041
2049
  }
2050
+ .sd-select-view-multiple .sd-select-view-inner .sd-select-view-tag.sd-select-view-tag-overflow {
2051
+ flex-shrink: 1;
2052
+ white-space: nowrap;
2053
+ word-break: normal;
2054
+ }
2055
+ .sd-select-view-multiple .sd-select-view-inner .sd-select-view-tag.sd-select-view-tag-overflow .sd-tag-text {
2056
+ max-width: 100%;
2057
+ }
2058
+ .sd-select-view-multiple .sd-select-view-inner .sd-select-view-tag.sd-select-view-tag-counter {
2059
+ flex-shrink: 0;
2060
+ white-space: nowrap;
2061
+ word-break: normal;
2062
+ }
2042
2063
  .sd-select-view-multiple .sd-select-view-inner .sd-select-view-input {
2043
2064
  width: 100%;
2044
2065
  padding-right: 0;
@@ -2065,6 +2086,9 @@ body {
2065
2086
  .sd-select-view-multiple .sd-select-view-inner .sd-select-view-input {
2066
2087
  box-sizing: border-box;
2067
2088
  }
2089
+ .sd-select-view-inner-responsive .sd-select-view-multiple .sd-select-view-inner .sd-select-view-input {
2090
+ flex: 0 0 auto;
2091
+ }
2068
2092
  .sd-select-view-multiple .sd-select-view-mirror {
2069
2093
  position: absolute;
2070
2094
  top: 0;
@@ -2073,6 +2097,27 @@ body {
2073
2097
  visibility: hidden;
2074
2098
  pointer-events: none;
2075
2099
  }
2100
+ .sd-select-view-multiple .sd-select-view-resize-observer {
2101
+ position: absolute;
2102
+ inset: 0;
2103
+ visibility: hidden;
2104
+ pointer-events: none;
2105
+ }
2106
+ .sd-select-view-multiple .sd-select-view-measure {
2107
+ position: absolute;
2108
+ top: 0;
2109
+ left: 0;
2110
+ display: inline-flex;
2111
+ white-space: nowrap;
2112
+ visibility: hidden;
2113
+ pointer-events: none;
2114
+ }
2115
+ .sd-select-view-multiple .sd-select-view-tag-ellipsis {
2116
+ display: block;
2117
+ min-width: 0;
2118
+ max-width: 100%;
2119
+ vertical-align: bottom;
2120
+ }
2076
2121
  .sd-select-view-multiple.sd-select-view-focus .sd-select-view-tag {
2077
2122
  background-color: var(--color-fill-2);
2078
2123
  border-color: var(--color-fill-2);
@@ -10160,6 +10205,7 @@ body {
10160
10205
  }
10161
10206
  .sd-input-tag .sd-input-tag-inner {
10162
10207
  flex: 1;
10208
+ min-width: 0;
10163
10209
  overflow: hidden;
10164
10210
  line-height: 0;
10165
10211
  }
@@ -10167,9 +10213,16 @@ body {
10167
10213
  display: flex;
10168
10214
  flex-wrap: wrap;
10169
10215
  }
10216
+ .sd-input-tag .sd-input-tag-inner.sd-input-tag-inner-responsive {
10217
+ display: flex;
10218
+ flex-wrap: nowrap;
10219
+ align-items: center;
10220
+ }
10170
10221
  .sd-input-tag .sd-input-tag-inner .sd-input-tag-tag {
10171
10222
  display: inline-flex;
10223
+ flex-shrink: 0;
10172
10224
  align-items: center;
10225
+ min-width: 0;
10173
10226
  margin-right: 4px;
10174
10227
  color: var(--color-text-1);
10175
10228
  font-size: 12px;
@@ -10187,6 +10240,19 @@ body {
10187
10240
  .sd-input-tag .sd-input-tag-inner .sd-input-tag-tag.sd-tag-custom-color .sd-icon-hover.sd-tag-icon-hover:hover::before {
10188
10241
  background-color: rgba(255, 255, 255, 0.2);
10189
10242
  }
10243
+ .sd-input-tag .sd-input-tag-inner .sd-input-tag-tag.sd-input-tag-tag-overflow {
10244
+ flex-shrink: 1;
10245
+ white-space: nowrap;
10246
+ word-break: normal;
10247
+ }
10248
+ .sd-input-tag .sd-input-tag-inner .sd-input-tag-tag.sd-input-tag-tag-overflow .sd-tag-text {
10249
+ max-width: 100%;
10250
+ }
10251
+ .sd-input-tag .sd-input-tag-inner .sd-input-tag-tag.sd-input-tag-tag-counter {
10252
+ flex-shrink: 0;
10253
+ white-space: nowrap;
10254
+ word-break: normal;
10255
+ }
10190
10256
  .sd-input-tag .sd-input-tag-inner .sd-input-tag-input {
10191
10257
  width: 100%;
10192
10258
  padding-right: 0;
@@ -10213,6 +10279,9 @@ body {
10213
10279
  .sd-input-tag .sd-input-tag-inner .sd-input-tag-input {
10214
10280
  box-sizing: border-box;
10215
10281
  }
10282
+ .sd-input-tag-inner-responsive .sd-input-tag .sd-input-tag-inner .sd-input-tag-input {
10283
+ flex: 0 0 auto;
10284
+ }
10216
10285
  .sd-input-tag .sd-input-tag-mirror {
10217
10286
  position: absolute;
10218
10287
  top: 0;
@@ -10221,6 +10290,27 @@ body {
10221
10290
  visibility: hidden;
10222
10291
  pointer-events: none;
10223
10292
  }
10293
+ .sd-input-tag .sd-input-tag-resize-observer {
10294
+ position: absolute;
10295
+ inset: 0;
10296
+ visibility: hidden;
10297
+ pointer-events: none;
10298
+ }
10299
+ .sd-input-tag .sd-input-tag-measure {
10300
+ position: absolute;
10301
+ top: 0;
10302
+ left: 0;
10303
+ display: inline-flex;
10304
+ white-space: nowrap;
10305
+ visibility: hidden;
10306
+ pointer-events: none;
10307
+ }
10308
+ .sd-input-tag .sd-input-tag-tag-ellipsis {
10309
+ display: block;
10310
+ min-width: 0;
10311
+ max-width: 100%;
10312
+ vertical-align: bottom;
10313
+ }
10224
10314
  .sd-input-tag.sd-input-tag-focus .sd-input-tag-tag {
10225
10315
  background-color: var(--color-fill-2);
10226
10316
  border-color: var(--color-fill-2);
package/es/index.js CHANGED
@@ -33,6 +33,8 @@ import Breadcrumb from "./breadcrumb/index.js";
33
33
  import radio_group_default from "./radio/radio-group.js";
34
34
  import Radio from "./radio/index.js";
35
35
  import optgroup_default from "./select/optgroup.js";
36
+ import Tooltip from "./tooltip/index.js";
37
+ import Ellipsis, { PerformantEllipsis } from "./ellipsis/index.js";
36
38
  import Tag from "./tag/index.js";
37
39
  import InputTag from "./input-tag/index.js";
38
40
  import Select from "./select/index.js";
@@ -61,8 +63,6 @@ import descriptions_item_default from "./descriptions/descriptions-item.js";
61
63
  import Descriptions from "./descriptions/index.js";
62
64
  import Divider from "./divider/index.js";
63
65
  import Drawer from "./drawer/index.js";
64
- import Tooltip from "./tooltip/index.js";
65
- import Ellipsis, { PerformantEllipsis } from "./ellipsis/index.js";
66
66
  import grid_col_default from "./grid/grid-col.js";
67
67
  import grid_item_default from "./grid/grid-item.js";
68
68
  import grid_row_default from "./grid/grid-row.js";
@@ -36,7 +36,7 @@ declare const InputTag: {
36
36
  type: import("vue").PropType<import("..").Size>;
37
37
  };
38
38
  maxTagCount: {
39
- type: NumberConstructor;
39
+ type: import("vue").PropType<number | "responsive">;
40
40
  default: number;
41
41
  };
42
42
  retainInputValue: {
@@ -100,7 +100,7 @@ declare const InputTag: {
100
100
  disabledInput: boolean;
101
101
  uninjectFormItemContext: boolean;
102
102
  defaultInputValue: string;
103
- maxTagCount: number;
103
+ maxTagCount: number | "responsive";
104
104
  retainInputValue: boolean | {
105
105
  create?: boolean;
106
106
  blur?: boolean;
@@ -148,7 +148,7 @@ declare const InputTag: {
148
148
  type: import("vue").PropType<import("..").Size>;
149
149
  };
150
150
  maxTagCount: {
151
- type: NumberConstructor;
151
+ type: import("vue").PropType<number | "responsive">;
152
152
  default: number;
153
153
  };
154
154
  retainInputValue: {
@@ -202,7 +202,7 @@ declare const InputTag: {
202
202
  disabledInput: boolean;
203
203
  uninjectFormItemContext: boolean;
204
204
  defaultInputValue: string;
205
- maxTagCount: number;
205
+ maxTagCount: number | "responsive";
206
206
  retainInputValue: boolean | {
207
207
  create?: boolean;
208
208
  blur?: boolean;
@@ -247,7 +247,7 @@ declare const InputTag: {
247
247
  type: import("vue").PropType<import("..").Size>;
248
248
  };
249
249
  maxTagCount: {
250
- type: NumberConstructor;
250
+ type: import("vue").PropType<number | "responsive">;
251
251
  default: number;
252
252
  };
253
253
  retainInputValue: {
@@ -311,7 +311,7 @@ declare const InputTag: {
311
311
  disabledInput: boolean;
312
312
  uninjectFormItemContext: boolean;
313
313
  defaultInputValue: string;
314
- maxTagCount: number;
314
+ maxTagCount: number | "responsive";
315
315
  retainInputValue: boolean | {
316
316
  create?: boolean;
317
317
  blur?: boolean;
@@ -35,7 +35,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
35
35
  type: PropType<Size>;
36
36
  };
37
37
  maxTagCount: {
38
- type: NumberConstructor;
38
+ type: PropType<number | "responsive">;
39
39
  default: number;
40
40
  };
41
41
  retainInputValue: {
@@ -113,7 +113,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
113
113
  type: PropType<Size>;
114
114
  };
115
115
  maxTagCount: {
116
- type: NumberConstructor;
116
+ type: PropType<number | "responsive">;
117
117
  default: number;
118
118
  };
119
119
  retainInputValue: {
@@ -161,7 +161,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
161
161
  disabledInput: boolean;
162
162
  uninjectFormItemContext: boolean;
163
163
  defaultInputValue: string;
164
- maxTagCount: number;
164
+ maxTagCount: number | "responsive";
165
165
  retainInputValue: boolean | {
166
166
  create?: boolean;
167
167
  blur?: boolean;
@@ -12,10 +12,14 @@ import { INPUT_EVENTS } from "../_utils/constant.js";
12
12
  import { Backspace, Enter } from "../_utils/keycode.js";
13
13
  import { omit } from "../_utils/omit.js";
14
14
  import pick from "../_utils/pick.js";
15
+ import Ellipsis from "../ellipsis/index.js";
15
16
  import Tag from "../tag/index.js";
16
17
  import { getValueData } from "./utils.js";
17
- import { TransitionGroup, computed, createVNode, defineComponent, mergeProps, nextTick, onMounted, reactive, ref, toRefs, watch } from "vue";
18
+ import { TransitionGroup, computed, createVNode, defineComponent, isVNode, mergeProps, nextTick, onMounted, reactive, ref, toRefs, watch } from "vue";
18
19
  //#region components/input-tag/input-tag.tsx
20
+ function _isSlot(s) {
21
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
22
+ }
19
23
  var DEFAULT_FIELD_NAMES = {
20
24
  value: "value",
21
25
  label: "label",
@@ -55,7 +59,7 @@ var input_tag_default = /* @__PURE__ */ defineComponent({
55
59
  },
56
60
  size: { type: String },
57
61
  maxTagCount: {
58
- type: Number,
62
+ type: [Number, String],
59
63
  default: 0
60
64
  },
61
65
  retainInputValue: {
@@ -91,8 +95,10 @@ var input_tag_default = /* @__PURE__ */ defineComponent({
91
95
  setup(props, { emit, slots, attrs }) {
92
96
  const { size, disabled, error, uninjectFormItemContext, modelValue, allowClear } = toRefs(props);
93
97
  const prefixCls = props.baseCls || getPrefixCls("input-tag");
98
+ const wrapperRef = ref();
94
99
  const inputRef = ref();
95
100
  const mirrorRef = ref();
101
+ const measureRef = ref();
96
102
  const { mergedSize: _mergedSize, mergedDisabled, mergedError, feedback, eventHandlers } = useFormItem({
97
103
  size,
98
104
  disabled,
@@ -118,7 +124,10 @@ var input_tag_default = /* @__PURE__ */ defineComponent({
118
124
  };
119
125
  });
120
126
  const inputStyle = reactive({ width: "12px" });
127
+ const responsiveVisibleTagCount = ref(null);
128
+ const responsiveTagMaxWidth = ref(0);
121
129
  const mergedFocused = computed(() => props.focused || _focused.value);
130
+ const isResponsiveMaxTagCount = computed(() => props.maxTagCount === "responsive");
122
131
  const updateInputValue = (value, ev) => {
123
132
  _inputValue.value = value;
124
133
  emit("update:inputValue", value);
@@ -166,22 +175,96 @@ var input_tag_default = /* @__PURE__ */ defineComponent({
166
175
  }
167
176
  };
168
177
  const valueData = computed(() => getValueData(computedValue.value, mergedFieldNames.value));
178
+ const visibleTagCount = computed(() => {
179
+ if (isResponsiveMaxTagCount.value) {
180
+ var _responsiveVisibleTag;
181
+ if (!valueData.value.length) return 0;
182
+ return Math.min(valueData.value.length, Math.max(1, (_responsiveVisibleTag = responsiveVisibleTagCount.value) !== null && _responsiveVisibleTag !== void 0 ? _responsiveVisibleTag : valueData.value.length));
183
+ }
184
+ if (typeof props.maxTagCount === "number" && props.maxTagCount > 0) return Math.min(props.maxTagCount, valueData.value.length);
185
+ return valueData.value.length;
186
+ });
187
+ const hiddenTagCount = computed(() => {
188
+ const count = valueData.value.length - visibleTagCount.value;
189
+ return count > 0 ? count : 0;
190
+ });
191
+ const isOverflowCounterTag = (value) => value === "__arco__more";
169
192
  const tags = computed(() => {
170
- if (props.maxTagCount > 0) {
171
- const invisibleTags = valueData.value.length - props.maxTagCount;
172
- if (invisibleTags > 0) {
173
- const result = valueData.value.slice(0, props.maxTagCount);
174
- const raw = {
175
- value: "__arco__more",
176
- label: `+${invisibleTags}...`,
177
- closable: false
178
- };
179
- result.push(_objectSpread2({ raw }, raw));
180
- return result;
193
+ const visibleTags = valueData.value.slice(0, visibleTagCount.value);
194
+ if (!hiddenTagCount.value) return visibleTags;
195
+ const raw = {
196
+ value: "__arco__more",
197
+ label: `+${hiddenTagCount.value}`,
198
+ closable: false
199
+ };
200
+ return visibleTags.concat(_objectSpread2({ raw }, raw));
201
+ });
202
+ const getOuterWidth = (element) => {
203
+ if (!element) return 0;
204
+ const style = window.getComputedStyle(element);
205
+ const marginLeft = Number.parseFloat(style.marginLeft || "0") || 0;
206
+ const marginRight = Number.parseFloat(style.marginRight || "0") || 0;
207
+ return element.offsetWidth + marginLeft + marginRight;
208
+ };
209
+ const getCounterWidth = (hiddenCount) => {
210
+ if (!measureRef.value || hiddenCount <= 0) return 0;
211
+ return getOuterWidth(measureRef.value.querySelector(`[data-hidden-count="${hiddenCount}"]`));
212
+ };
213
+ const syncResponsiveTags = () => {
214
+ var _inputRef$value$offse, _inputRef$value;
215
+ if (!isResponsiveMaxTagCount.value) {
216
+ responsiveVisibleTagCount.value = null;
217
+ responsiveTagMaxWidth.value = 0;
218
+ return;
219
+ }
220
+ const totalTags = valueData.value.length;
221
+ if (totalTags <= 1) {
222
+ responsiveVisibleTagCount.value = totalTags;
223
+ responsiveTagMaxWidth.value = 0;
224
+ return;
225
+ }
226
+ const wrapperElement = wrapperRef.value;
227
+ const measureElement = measureRef.value;
228
+ const innerElement = wrapperElement === null || wrapperElement === void 0 ? void 0 : wrapperElement.querySelector(`.${prefixCls}-inner`);
229
+ if (!wrapperElement || !measureElement || !innerElement) {
230
+ responsiveVisibleTagCount.value = totalTags;
231
+ responsiveTagMaxWidth.value = 0;
232
+ return;
233
+ }
234
+ const inputWidth = ((_inputRef$value$offse = (_inputRef$value = inputRef.value) === null || _inputRef$value === void 0 ? void 0 : _inputRef$value.offsetWidth) !== null && _inputRef$value$offse !== void 0 ? _inputRef$value$offse : Number.parseFloat(inputStyle.width)) || 12;
235
+ const availableWidth = Math.max(innerElement.clientWidth - inputWidth, 0);
236
+ if (availableWidth <= 0) {
237
+ responsiveVisibleTagCount.value = 1;
238
+ responsiveTagMaxWidth.value = 0;
239
+ return;
240
+ }
241
+ const tagWidths = Array.from(measureElement.querySelectorAll(`.${prefixCls}-tag`)).slice(0, totalTags).map(getOuterWidth);
242
+ for (let candidate = totalTags; candidate >= 1; candidate -= 1) {
243
+ const hiddenCount = totalTags - candidate;
244
+ const counterWidth = getCounterWidth(hiddenCount);
245
+ const visibleWidth = tagWidths.slice(0, candidate).reduce((sum, width) => sum + width, 0);
246
+ if (hiddenCount === 0 && visibleWidth <= availableWidth) {
247
+ responsiveVisibleTagCount.value = candidate;
248
+ responsiveTagMaxWidth.value = 0;
249
+ return;
250
+ }
251
+ if (hiddenCount > 0 && candidate > 1 && visibleWidth + counterWidth <= availableWidth) {
252
+ responsiveVisibleTagCount.value = candidate;
253
+ responsiveTagMaxWidth.value = 0;
254
+ return;
255
+ }
256
+ if (hiddenCount > 0 && candidate === 1) {
257
+ const leadTagWidth = Math.max(availableWidth - counterWidth, 0);
258
+ if (leadTagWidth > 0) {
259
+ responsiveVisibleTagCount.value = 1;
260
+ responsiveTagMaxWidth.value = leadTagWidth;
261
+ return;
262
+ }
181
263
  }
182
264
  }
183
- return valueData.value;
184
- });
265
+ responsiveVisibleTagCount.value = 1;
266
+ responsiveTagMaxWidth.value = Math.max(availableWidth - getCounterWidth(totalTags - 1), 0);
267
+ };
185
268
  const updateValue = (value, ev) => {
186
269
  var _eventHandlers$value, _eventHandlers$value$;
187
270
  _value.value = value;
@@ -244,13 +327,28 @@ var input_tag_default = /* @__PURE__ */ defineComponent({
244
327
  };
245
328
  onMounted(() => {
246
329
  if (mirrorRef.value) setInputWidth(mirrorRef.value.offsetWidth);
330
+ nextTick(() => {
331
+ syncResponsiveTags();
332
+ });
247
333
  });
248
334
  const handleResize = () => {
249
335
  if (mirrorRef.value) setInputWidth(mirrorRef.value.offsetWidth);
336
+ nextTick(() => {
337
+ syncResponsiveTags();
338
+ });
250
339
  };
251
340
  watch(computedInputValue, (value) => {
252
341
  if (inputRef.value && !isComposition.value && value !== inputRef.value.value) inputRef.value.value = value;
253
342
  });
343
+ watch([
344
+ valueData,
345
+ computedInputValue,
346
+ () => props.maxTagCount
347
+ ], () => {
348
+ nextTick(() => {
349
+ syncResponsiveTags();
350
+ });
351
+ }, { deep: true });
254
352
  const cls = computed(() => [
255
353
  prefixCls,
256
354
  `${prefixCls}-size-${mergedSize.value}`,
@@ -260,7 +358,8 @@ var input_tag_default = /* @__PURE__ */ defineComponent({
260
358
  [`${prefixCls}-error`]: mergedError.value,
261
359
  [`${prefixCls}-focus`]: mergedFocused.value,
262
360
  [`${prefixCls}-readonly`]: props.readonly,
263
- [`${prefixCls}-has-tag`]: tags.value.length > 0,
361
+ [`${prefixCls}-responsive`]: isResponsiveMaxTagCount.value,
362
+ [`${prefixCls}-has-tag`]: valueData.value.length > 0,
264
363
  [`${prefixCls}-has-prefix`]: Boolean(slots.prefix),
265
364
  [`${prefixCls}-has-suffix`]: Boolean(slots.suffix) || showClearBtn.value || feedback.value,
266
365
  [`${prefixCls}-has-placeholder`]: !computedValue.value.length
@@ -268,36 +367,86 @@ var input_tag_default = /* @__PURE__ */ defineComponent({
268
367
  ]);
269
368
  const wrapperAttrs = computed(() => omit(attrs, INPUT_EVENTS));
270
369
  const inputAttrs = computed(() => pick(attrs, INPUT_EVENTS));
370
+ const renderTagContent = (item, index) => {
371
+ var _ref, _slots$tag, _slots$tag2, _props$formatTag;
372
+ const content = (_ref = (_slots$tag = (_slots$tag2 = slots.tag) === null || _slots$tag2 === void 0 ? void 0 : _slots$tag2.call(slots, { data: item.raw })) !== null && _slots$tag !== void 0 ? _slots$tag : (_props$formatTag = props.formatTag) === null || _props$formatTag === void 0 ? void 0 : _props$formatTag.call(props, item.raw)) !== null && _ref !== void 0 ? _ref : item.label;
373
+ if (!isResponsiveMaxTagCount.value || hiddenTagCount.value === 0 || index !== 0 || responsiveTagMaxWidth.value <= 0) return content;
374
+ return createVNode(Ellipsis, { "class": `${prefixCls}-tag-ellipsis` }, _isSlot(content) ? content : { default: () => [content] });
375
+ };
376
+ const getTagStyle = (index) => {
377
+ if (!isResponsiveMaxTagCount.value || hiddenTagCount.value === 0 || index !== 0 || responsiveTagMaxWidth.value <= 0) return;
378
+ return { maxWidth: `${responsiveTagMaxWidth.value}px` };
379
+ };
380
+ const getInputStyle = computed(() => {
381
+ if (!isResponsiveMaxTagCount.value) return inputStyle;
382
+ return _objectSpread2(_objectSpread2({}, inputStyle), {}, {
383
+ flex: "0 0 auto",
384
+ minWidth: inputStyle.width
385
+ });
386
+ });
387
+ const isCompressedResponsiveTag = (index, value) => isResponsiveMaxTagCount.value && !isOverflowCounterTag(value) && hiddenTagCount.value > 0 && index === 0 && responsiveTagMaxWidth.value > 0;
271
388
  const render = () => {
272
389
  var _slots$suffix;
273
390
  return createVNode("span", mergeProps({
391
+ "ref": wrapperRef,
274
392
  "class": cls.value,
275
393
  "onMousedown": handleMousedown
276
394
  }, wrapperAttrs.value), [
395
+ isResponsiveMaxTagCount.value && valueData.value.length > 0 ? createVNode(resize_observer_default, { "onResize": handleResize }, { default: () => [createVNode("span", {
396
+ "class": `${prefixCls}-resize-observer`,
397
+ "aria-hidden": "true"
398
+ }, null)] }) : null,
277
399
  createVNode(resize_observer_default, { "onResize": handleResize }, { default: () => [createVNode("span", {
278
400
  "ref": mirrorRef,
279
401
  "class": `${prefixCls}-mirror`
280
- }, [tags.value.length > 0 ? compositionValue.value || computedInputValue.value : compositionValue.value || computedInputValue.value || props.placeholder])] }),
402
+ }, [valueData.value.length > 0 ? compositionValue.value || computedInputValue.value : compositionValue.value || computedInputValue.value || props.placeholder])] }),
403
+ isResponsiveMaxTagCount.value && valueData.value.length > 1 ? createVNode("span", {
404
+ "ref": measureRef,
405
+ "class": `${prefixCls}-measure`,
406
+ "aria-hidden": "true"
407
+ }, [valueData.value.map((item) => createVNode(Tag, mergeProps({
408
+ "key": `measure-tag-${item.value}`,
409
+ "class": `${prefixCls}-tag`,
410
+ "visible": true,
411
+ "nowrap": true
412
+ }, item.tagProps), { default: () => {
413
+ var _ref2, _slots$tag3, _slots$tag4, _props$formatTag2;
414
+ return [(_ref2 = (_slots$tag3 = (_slots$tag4 = slots.tag) === null || _slots$tag4 === void 0 ? void 0 : _slots$tag4.call(slots, { data: item.raw })) !== null && _slots$tag3 !== void 0 ? _slots$tag3 : (_props$formatTag2 = props.formatTag) === null || _props$formatTag2 === void 0 ? void 0 : _props$formatTag2.call(props, item.raw)) !== null && _ref2 !== void 0 ? _ref2 : item.label];
415
+ } })), Array.from({ length: valueData.value.length - 1 }, (_, index) => index + 1).map((hiddenCount) => createVNode(Tag, {
416
+ "key": `measure-counter-${hiddenCount}`,
417
+ "class": `${prefixCls}-tag ${prefixCls}-tag-counter`,
418
+ "data-overflow-counter": "true",
419
+ "data-hidden-count": hiddenCount,
420
+ "visible": true,
421
+ "nowrap": true
422
+ }, { default: () => [`+${hiddenCount}`] }))]) : null,
281
423
  slots.prefix && createVNode("span", { "class": `${prefixCls}-prefix` }, [slots.prefix()]),
282
424
  createVNode(TransitionGroup, {
283
425
  "tag": "span",
284
426
  "name": "input-tag-zoom",
285
- "class": [`${prefixCls}-inner`, { [`${prefixCls}-nowrap`]: props.tagNowrap }]
286
- }, { default: () => [tags.value.map((item, index) => createVNode(Tag, mergeProps({
287
- "key": `tag-${item.value}`,
288
- "class": `${prefixCls}-tag`,
289
- "closable": !mergedDisabled.value && !props.readonly && item.closable,
290
- "visible": true,
291
- "nowrap": props.tagNowrap
292
- }, item.tagProps, { "onClose": (ev) => handleRemove(item.value, index, ev) }), { default: () => {
293
- var _ref, _slots$tag, _slots$tag2, _props$formatTag;
294
- return [(_ref = (_slots$tag = (_slots$tag2 = slots.tag) === null || _slots$tag2 === void 0 ? void 0 : _slots$tag2.call(slots, { data: item.raw })) !== null && _slots$tag !== void 0 ? _slots$tag : (_props$formatTag = props.formatTag) === null || _props$formatTag === void 0 ? void 0 : _props$formatTag.call(props, item.raw)) !== null && _ref !== void 0 ? _ref : item.label];
295
- } })), createVNode("input", mergeProps(inputAttrs.value, {
427
+ "class": [`${prefixCls}-inner`, {
428
+ [`${prefixCls}-inner-responsive`]: isResponsiveMaxTagCount.value,
429
+ [`${prefixCls}-nowrap`]: props.tagNowrap
430
+ }]
431
+ }, { default: () => [tags.value.map((item, index) => {
432
+ let _slot;
433
+ return createVNode(Tag, mergeProps({
434
+ "key": `tag-${item.value}`,
435
+ "class": [`${prefixCls}-tag`, {
436
+ [`${prefixCls}-tag-counter`]: isOverflowCounterTag(item.value),
437
+ [`${prefixCls}-tag-overflow`]: isCompressedResponsiveTag(index, item.value)
438
+ }],
439
+ "closable": !mergedDisabled.value && !props.readonly && item.closable,
440
+ "visible": true,
441
+ "nowrap": props.tagNowrap || isResponsiveMaxTagCount.value,
442
+ "style": getTagStyle(index)
443
+ }, item.tagProps, { "onClose": (ev) => handleRemove(item.value, index, ev) }), _isSlot(_slot = renderTagContent(item, index)) ? _slot : { default: () => [_slot] });
444
+ }), createVNode("input", mergeProps(inputAttrs.value, {
296
445
  "ref": inputRef,
297
446
  "key": "input-tag-input",
298
447
  "class": `${prefixCls}-input`,
299
- "style": inputStyle,
300
- "placeholder": tags.value.length === 0 ? props.placeholder : void 0,
448
+ "style": getInputStyle.value,
449
+ "placeholder": valueData.value.length === 0 ? props.placeholder : void 0,
301
450
  "disabled": mergedDisabled.value,
302
451
  "readonly": props.readonly || props.disabledInput,
303
452
  "onInput": handleInput,
@@ -587,6 +587,7 @@
587
587
  }
588
588
  .sd-input-tag .sd-input-tag-inner {
589
589
  flex: 1;
590
+ min-width: 0;
590
591
  overflow: hidden;
591
592
  line-height: 0;
592
593
  }
@@ -594,9 +595,16 @@
594
595
  display: flex;
595
596
  flex-wrap: wrap;
596
597
  }
598
+ .sd-input-tag .sd-input-tag-inner.sd-input-tag-inner-responsive {
599
+ display: flex;
600
+ flex-wrap: nowrap;
601
+ align-items: center;
602
+ }
597
603
  .sd-input-tag .sd-input-tag-inner .sd-input-tag-tag {
598
604
  display: inline-flex;
605
+ flex-shrink: 0;
599
606
  align-items: center;
607
+ min-width: 0;
600
608
  margin-right: 4px;
601
609
  color: var(--color-text-1);
602
610
  font-size: 12px;
@@ -614,6 +622,19 @@
614
622
  .sd-input-tag .sd-input-tag-inner .sd-input-tag-tag.sd-tag-custom-color .sd-icon-hover.sd-tag-icon-hover:hover::before {
615
623
  background-color: rgba(255, 255, 255, 0.2);
616
624
  }
625
+ .sd-input-tag .sd-input-tag-inner .sd-input-tag-tag.sd-input-tag-tag-overflow {
626
+ flex-shrink: 1;
627
+ white-space: nowrap;
628
+ word-break: normal;
629
+ }
630
+ .sd-input-tag .sd-input-tag-inner .sd-input-tag-tag.sd-input-tag-tag-overflow .sd-tag-text {
631
+ max-width: 100%;
632
+ }
633
+ .sd-input-tag .sd-input-tag-inner .sd-input-tag-tag.sd-input-tag-tag-counter {
634
+ flex-shrink: 0;
635
+ white-space: nowrap;
636
+ word-break: normal;
637
+ }
617
638
  .sd-input-tag .sd-input-tag-inner .sd-input-tag-input {
618
639
  width: 100%;
619
640
  padding-right: 0;
@@ -640,6 +661,9 @@
640
661
  .sd-input-tag .sd-input-tag-inner .sd-input-tag-input {
641
662
  box-sizing: border-box;
642
663
  }
664
+ .sd-input-tag-inner-responsive .sd-input-tag .sd-input-tag-inner .sd-input-tag-input {
665
+ flex: 0 0 auto;
666
+ }
643
667
  .sd-input-tag .sd-input-tag-mirror {
644
668
  position: absolute;
645
669
  top: 0;
@@ -648,6 +672,27 @@
648
672
  visibility: hidden;
649
673
  pointer-events: none;
650
674
  }
675
+ .sd-input-tag .sd-input-tag-resize-observer {
676
+ position: absolute;
677
+ inset: 0;
678
+ visibility: hidden;
679
+ pointer-events: none;
680
+ }
681
+ .sd-input-tag .sd-input-tag-measure {
682
+ position: absolute;
683
+ top: 0;
684
+ left: 0;
685
+ display: inline-flex;
686
+ white-space: nowrap;
687
+ visibility: hidden;
688
+ pointer-events: none;
689
+ }
690
+ .sd-input-tag .sd-input-tag-tag-ellipsis {
691
+ display: block;
692
+ min-width: 0;
693
+ max-width: 100%;
694
+ vertical-align: bottom;
695
+ }
651
696
  .sd-input-tag.sd-input-tag-focus .sd-input-tag-tag {
652
697
  background-color: var(--color-fill-2);
653
698
  border-color: var(--color-fill-2);