@sdata/web-vue 1.7.1 → 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 (155) hide show
  1. package/dist/sd.css +182 -1
  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-allow-clear.d.ts +4 -0
  9. package/es/_hooks/use-allow-clear.js +20 -0
  10. package/es/_hooks/use-trigger.d.ts +4 -6
  11. package/es/_hooks/use-trigger.js +7 -5
  12. package/es/_utils/color.js +1 -18
  13. package/es/auto-complete/auto-complete.d.ts +1 -1
  14. package/es/auto-complete/auto-complete.js +4 -2
  15. package/es/auto-complete/index.d.ts +3 -3
  16. package/es/badge/badge.d.ts +1 -1
  17. package/es/badge/index.d.ts +3 -3
  18. package/es/carousel/carousel-arrow.vue.d.ts +1 -1
  19. package/es/carousel/carousel.d.ts +2 -2
  20. package/es/carousel/index.d.ts +6 -6
  21. package/es/cascader/cascader-panel.vue.d.ts +2 -2
  22. package/es/cascader/cascader.js +1 -1
  23. package/es/cascader/cascader.vue.d.ts +21 -11
  24. package/es/cascader/cascader.vue_vue_type_script_lang.js +4 -1
  25. package/es/cascader/index.d.ts +47 -26
  26. package/es/color-picker/color-picker.d.ts +115 -40
  27. package/es/color-picker/color-picker.js +146 -102
  28. package/es/color-picker/index.d.ts +217 -69
  29. package/es/color-picker/interface.d.ts +41 -0
  30. package/es/color-picker/palette.js +1 -1
  31. package/es/color-picker/panel.d.ts +73 -34
  32. package/es/color-picker/panel.js +423 -89
  33. package/es/color-picker/style/index.css +92 -1
  34. package/es/color-picker/style/index.scss +107 -1
  35. package/es/color-picker/utils.d.ts +89 -0
  36. package/es/color-picker/utils.js +456 -0
  37. package/es/config-provider/config-provider.vue.d.ts +10 -1
  38. package/es/config-provider/config-provider.vue_vue_type_script_lang.js +6 -1
  39. package/es/config-provider/context.d.ts +1 -0
  40. package/es/config-provider/index.d.ts +18 -3
  41. package/es/date-picker/index.d.ts +7 -6
  42. package/es/date-picker/picker.js +1 -1
  43. package/es/date-picker/picker.vue.d.ts +7 -6
  44. package/es/date-picker/picker.vue_vue_type_script_lang.js +4 -1
  45. package/es/date-picker/range-picker.js +1 -1
  46. package/es/date-picker/range-picker.vue.d.ts +7 -6
  47. package/es/date-picker/range-picker.vue_vue_type_script_lang.js +4 -1
  48. package/es/descriptions/descriptions.d.ts +2 -2
  49. package/es/descriptions/index.d.ts +6 -6
  50. package/es/drawer/drawer.vue_vue_type_script_lang.js +1 -1
  51. package/es/dropdown/dropdown-button.vue.d.ts +8 -8
  52. package/es/dropdown/dropdown-panel.vue.d.ts +2 -2
  53. package/es/dropdown/dropdown-submenu.vue.d.ts +8 -8
  54. package/es/dropdown/dropdown.vue.d.ts +8 -8
  55. package/es/dropdown/index.d.ts +32 -32
  56. package/es/ellipsis/ellipsis.vue.d.ts +13 -13
  57. package/es/ellipsis/ellipsis.vue_vue_type_script_lang.js +1 -1
  58. package/es/ellipsis/index.d.ts +56 -56
  59. package/es/ellipsis/performant-ellipsis.vue.d.ts +14 -14
  60. package/es/form/form-item-label.vue.d.ts +12 -12
  61. package/es/form/form-item.vue.d.ts +12 -12
  62. package/es/form/index.d.ts +12 -12
  63. package/es/grid/grid.vue.d.ts +1 -1
  64. package/es/grid/index.d.ts +3 -3
  65. package/es/image/image.vue.d.ts +12 -12
  66. package/es/image/preview-action.d.ts +12 -12
  67. package/es/image/preview-group.vue.d.ts +12 -12
  68. package/es/image/preview-toolbar.vue.d.ts +12 -12
  69. package/es/image/preview.vue.d.ts +12 -12
  70. package/es/index.css +182 -1
  71. package/es/index.js +2 -2
  72. package/es/input/input.js +4 -2
  73. package/es/input-number/input-number.js +4 -2
  74. package/es/input-tag/index.d.ts +6 -6
  75. package/es/input-tag/input-tag.d.ts +3 -3
  76. package/es/input-tag/input-tag.js +183 -32
  77. package/es/input-tag/style/index.css +45 -0
  78. package/es/input-tag/style/input-tag.scss +53 -0
  79. package/es/list/index.d.ts +3 -3
  80. package/es/list/list.d.ts +1 -1
  81. package/es/mention/mention.js +4 -2
  82. package/es/menu/sub-menu-pop.vue.d.ts +6 -6
  83. package/es/modal/modal.vue_vue_type_script_lang.js +1 -1
  84. package/es/overflow-list/index.d.ts +3 -3
  85. package/es/overflow-list/overflow-list.d.ts +1 -1
  86. package/es/pagination/page-options.vue.d.ts +188 -98
  87. package/es/popconfirm/index.d.ts +12 -12
  88. package/es/popconfirm/popconfirm.vue.d.ts +6 -6
  89. package/es/popover/index.d.ts +12 -12
  90. package/es/popover/popover.vue.d.ts +6 -6
  91. package/es/progress/index.d.ts +5 -5
  92. package/es/progress/line.vue.d.ts +1 -1
  93. package/es/progress/progress.vue.d.ts +2 -2
  94. package/es/rate/rate.js +4 -2
  95. package/es/scrollbar/index.d.ts +2 -2
  96. package/es/scrollbar/scrollbar.vue.d.ts +1 -1
  97. package/es/scrollbar/thumb.vue.d.ts +1 -1
  98. package/es/sd-vue.js +2 -2
  99. package/es/select/hooks/use-options.d.ts +9 -4
  100. package/es/select/hooks/use-options.js +2 -2
  101. package/es/select/hooks/use-select.d.ts +9 -4
  102. package/es/select/index.d.ts +188 -98
  103. package/es/select/interface.d.ts +57 -46
  104. package/es/select/select-dropdown.vue.d.ts +2 -2
  105. package/es/select/select.d.ts +107 -59
  106. package/es/select/select.js +182 -126
  107. package/es/select/utils.d.ts +1 -1
  108. package/es/select/utils.js +28 -10
  109. package/es/skeleton/index.d.ts +1 -1
  110. package/es/skeleton/line.vue.d.ts +1 -1
  111. package/es/slider/index.d.ts +27 -27
  112. package/es/slider/slider-button.vue.d.ts +12 -12
  113. package/es/slider/slider.vue.d.ts +13 -13
  114. package/es/space/index.d.ts +3 -3
  115. package/es/space/space.d.ts +1 -1
  116. package/es/statistic/index.d.ts +6 -6
  117. package/es/statistic/statistic.vue.d.ts +2 -2
  118. package/es/table/index.d.ts +6 -6
  119. package/es/table/table.d.ts +2 -2
  120. package/es/tabs/index.d.ts +9 -9
  121. package/es/tabs/tabs.d.ts +3 -3
  122. package/es/tag/index.d.ts +3 -3
  123. package/es/tag/tag.vue.d.ts +1 -1
  124. package/es/textarea/index.d.ts +3 -3
  125. package/es/textarea/textarea.vue.d.ts +1 -1
  126. package/es/textarea/textarea.vue_vue_type_script_lang.js +6 -2
  127. package/es/time-picker/index.d.ts +15 -12
  128. package/es/time-picker/time-picker.js +1 -1
  129. package/es/time-picker/time-picker.vue.d.ts +7 -6
  130. package/es/time-picker/time-picker.vue_vue_type_script_lang.js +4 -1
  131. package/es/tooltip/index.d.ts +12 -12
  132. package/es/tooltip/tooltip.vue.d.ts +6 -6
  133. package/es/transfer/index.d.ts +10 -10
  134. package/es/transfer/transfer-view.vue.d.ts +5 -5
  135. package/es/transfer/transfer.vue.d.ts +5 -5
  136. package/es/tree/index.d.ts +6 -6
  137. package/es/tree/tree.vue.d.ts +2 -2
  138. package/es/tree-select/hooks/use-selected-state.d.ts +2 -0
  139. package/es/tree-select/hooks/use-selected-state.js +26 -8
  140. package/es/tree-select/index.d.ts +268 -61
  141. package/es/tree-select/interface.d.ts +16 -3
  142. package/es/tree-select/panel.d.ts +6 -6
  143. package/es/tree-select/tree-select.js +29 -16
  144. package/es/tree-select/tree-select.vue.d.ts +144 -30
  145. package/es/tree-select/tree-select.vue_vue_type_script_lang.js +102 -22
  146. package/es/trigger/index.d.ts +6 -6
  147. package/es/trigger/trigger.d.ts +2 -2
  148. package/es/typography/operations.vue.d.ts +12 -12
  149. package/json/vetur-attributes.json +82 -178
  150. package/json/vetur-tags.json +24 -52
  151. package/json/web-types.json +164 -387
  152. package/package.json +9 -7
  153. package/es/color-picker/input-alpha.js +0 -32
  154. package/es/color-picker/input-hex.js +0 -73
  155. package/es/color-picker/input-rgb.js +0 -55
@@ -5,16 +5,21 @@ import { isNull, isObject, isUndefined } from "../_utils/is.js";
5
5
  import resize_observer_default from "../_components/resize-observer.js";
6
6
  import icon_hover_default from "../_components/icon-hover.js";
7
7
  import IconClose from "../icon/icon-close/index.js";
8
+ import { useAllowClear } from "../_hooks/use-allow-clear.js";
8
9
  import feedback_icon_default from "../_components/feedback-icon.js";
9
10
  import { useSize } from "../_hooks/use-size.js";
10
11
  import { INPUT_EVENTS } from "../_utils/constant.js";
11
12
  import { Backspace, Enter } from "../_utils/keycode.js";
12
13
  import { omit } from "../_utils/omit.js";
13
14
  import pick from "../_utils/pick.js";
15
+ import Ellipsis from "../ellipsis/index.js";
14
16
  import Tag from "../tag/index.js";
15
17
  import { getValueData } from "./utils.js";
16
- 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";
17
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
+ }
18
23
  var DEFAULT_FIELD_NAMES = {
19
24
  value: "value",
20
25
  label: "label",
@@ -54,7 +59,7 @@ var input_tag_default = /* @__PURE__ */ defineComponent({
54
59
  },
55
60
  size: { type: String },
56
61
  maxTagCount: {
57
- type: Number,
62
+ type: [Number, String],
58
63
  default: 0
59
64
  },
60
65
  retainInputValue: {
@@ -88,10 +93,12 @@ var input_tag_default = /* @__PURE__ */ defineComponent({
88
93
  "blur": (_ev) => true
89
94
  },
90
95
  setup(props, { emit, slots, attrs }) {
91
- const { size, disabled, error, uninjectFormItemContext, modelValue } = toRefs(props);
96
+ const { size, disabled, error, uninjectFormItemContext, modelValue, allowClear } = toRefs(props);
92
97
  const prefixCls = props.baseCls || getPrefixCls("input-tag");
98
+ const wrapperRef = ref();
93
99
  const inputRef = ref();
94
100
  const mirrorRef = ref();
101
+ const measureRef = ref();
95
102
  const { mergedSize: _mergedSize, mergedDisabled, mergedError, feedback, eventHandlers } = useFormItem({
96
103
  size,
97
104
  disabled,
@@ -99,6 +106,7 @@ var input_tag_default = /* @__PURE__ */ defineComponent({
99
106
  uninject: uninjectFormItemContext === null || uninjectFormItemContext === void 0 ? void 0 : uninjectFormItemContext.value
100
107
  });
101
108
  const { mergedSize } = useSize(_mergedSize);
109
+ const { mergedAllowClear } = useAllowClear(allowClear);
102
110
  const mergedFieldNames = computed(() => _objectSpread2(_objectSpread2({}, DEFAULT_FIELD_NAMES), props.fieldNames));
103
111
  const _focused = ref(false);
104
112
  const _value = ref(props.defaultValue);
@@ -116,7 +124,10 @@ var input_tag_default = /* @__PURE__ */ defineComponent({
116
124
  };
117
125
  });
118
126
  const inputStyle = reactive({ width: "12px" });
127
+ const responsiveVisibleTagCount = ref(null);
128
+ const responsiveTagMaxWidth = ref(0);
119
129
  const mergedFocused = computed(() => props.focused || _focused.value);
130
+ const isResponsiveMaxTagCount = computed(() => props.maxTagCount === "responsive");
120
131
  const updateInputValue = (value, ev) => {
121
132
  _inputValue.value = value;
122
133
  emit("update:inputValue", value);
@@ -164,22 +175,96 @@ var input_tag_default = /* @__PURE__ */ defineComponent({
164
175
  }
165
176
  };
166
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";
167
192
  const tags = computed(() => {
168
- if (props.maxTagCount > 0) {
169
- const invisibleTags = valueData.value.length - props.maxTagCount;
170
- if (invisibleTags > 0) {
171
- const result = valueData.value.slice(0, props.maxTagCount);
172
- const raw = {
173
- value: "__arco__more",
174
- label: `+${invisibleTags}...`,
175
- closable: false
176
- };
177
- result.push(_objectSpread2({ raw }, raw));
178
- 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
+ }
179
263
  }
180
264
  }
181
- return valueData.value;
182
- });
265
+ responsiveVisibleTagCount.value = 1;
266
+ responsiveTagMaxWidth.value = Math.max(availableWidth - getCounterWidth(totalTags - 1), 0);
267
+ };
183
268
  const updateValue = (value, ev) => {
184
269
  var _eventHandlers$value, _eventHandlers$value$;
185
270
  _value.value = value;
@@ -196,7 +281,7 @@ var input_tag_default = /* @__PURE__ */ defineComponent({
196
281
  updateValue([], e);
197
282
  emit("clear", e);
198
283
  };
199
- const showClearBtn = computed(() => !mergedDisabled.value && !props.readonly && props.allowClear && Boolean(computedValue.value.length));
284
+ const showClearBtn = computed(() => !mergedDisabled.value && !props.readonly && mergedAllowClear.value && Boolean(computedValue.value.length));
200
285
  const handlePressEnter = (e) => {
201
286
  if (computedInputValue.value) {
202
287
  var _computedValue$value2;
@@ -242,13 +327,28 @@ var input_tag_default = /* @__PURE__ */ defineComponent({
242
327
  };
243
328
  onMounted(() => {
244
329
  if (mirrorRef.value) setInputWidth(mirrorRef.value.offsetWidth);
330
+ nextTick(() => {
331
+ syncResponsiveTags();
332
+ });
245
333
  });
246
334
  const handleResize = () => {
247
335
  if (mirrorRef.value) setInputWidth(mirrorRef.value.offsetWidth);
336
+ nextTick(() => {
337
+ syncResponsiveTags();
338
+ });
248
339
  };
249
340
  watch(computedInputValue, (value) => {
250
341
  if (inputRef.value && !isComposition.value && value !== inputRef.value.value) inputRef.value.value = value;
251
342
  });
343
+ watch([
344
+ valueData,
345
+ computedInputValue,
346
+ () => props.maxTagCount
347
+ ], () => {
348
+ nextTick(() => {
349
+ syncResponsiveTags();
350
+ });
351
+ }, { deep: true });
252
352
  const cls = computed(() => [
253
353
  prefixCls,
254
354
  `${prefixCls}-size-${mergedSize.value}`,
@@ -258,7 +358,8 @@ var input_tag_default = /* @__PURE__ */ defineComponent({
258
358
  [`${prefixCls}-error`]: mergedError.value,
259
359
  [`${prefixCls}-focus`]: mergedFocused.value,
260
360
  [`${prefixCls}-readonly`]: props.readonly,
261
- [`${prefixCls}-has-tag`]: tags.value.length > 0,
361
+ [`${prefixCls}-responsive`]: isResponsiveMaxTagCount.value,
362
+ [`${prefixCls}-has-tag`]: valueData.value.length > 0,
262
363
  [`${prefixCls}-has-prefix`]: Boolean(slots.prefix),
263
364
  [`${prefixCls}-has-suffix`]: Boolean(slots.suffix) || showClearBtn.value || feedback.value,
264
365
  [`${prefixCls}-has-placeholder`]: !computedValue.value.length
@@ -266,36 +367,86 @@ var input_tag_default = /* @__PURE__ */ defineComponent({
266
367
  ]);
267
368
  const wrapperAttrs = computed(() => omit(attrs, INPUT_EVENTS));
268
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;
269
388
  const render = () => {
270
389
  var _slots$suffix;
271
390
  return createVNode("span", mergeProps({
391
+ "ref": wrapperRef,
272
392
  "class": cls.value,
273
393
  "onMousedown": handleMousedown
274
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,
275
399
  createVNode(resize_observer_default, { "onResize": handleResize }, { default: () => [createVNode("span", {
276
400
  "ref": mirrorRef,
277
401
  "class": `${prefixCls}-mirror`
278
- }, [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,
279
423
  slots.prefix && createVNode("span", { "class": `${prefixCls}-prefix` }, [slots.prefix()]),
280
424
  createVNode(TransitionGroup, {
281
425
  "tag": "span",
282
426
  "name": "input-tag-zoom",
283
- "class": [`${prefixCls}-inner`, { [`${prefixCls}-nowrap`]: props.tagNowrap }]
284
- }, { default: () => [tags.value.map((item, index) => createVNode(Tag, mergeProps({
285
- "key": `tag-${item.value}`,
286
- "class": `${prefixCls}-tag`,
287
- "closable": !mergedDisabled.value && !props.readonly && item.closable,
288
- "visible": true,
289
- "nowrap": props.tagNowrap
290
- }, item.tagProps, { "onClose": (ev) => handleRemove(item.value, index, ev) }), { default: () => {
291
- var _ref, _slots$tag, _slots$tag2, _props$formatTag;
292
- 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];
293
- } })), 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, {
294
445
  "ref": inputRef,
295
446
  "key": "input-tag-input",
296
447
  "class": `${prefixCls}-input`,
297
- "style": inputStyle,
298
- "placeholder": tags.value.length === 0 ? props.placeholder : void 0,
448
+ "style": getInputStyle.value,
449
+ "placeholder": valueData.value.length === 0 ? props.placeholder : void 0,
299
450
  "disabled": mergedDisabled.value,
300
451
  "readonly": props.readonly || props.disabledInput,
301
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);
@@ -229,6 +229,7 @@ $less-vars: (
229
229
 
230
230
  .#{$cls}-inner {
231
231
  flex: 1;
232
+ min-width: 0;
232
233
  overflow: hidden;
233
234
  line-height: 0;
234
235
 
@@ -237,9 +238,17 @@ $less-vars: (
237
238
  flex-wrap: wrap;
238
239
  }
239
240
 
241
+ &.#{$cls}-inner-responsive {
242
+ display: flex;
243
+ flex-wrap: nowrap;
244
+ align-items: center;
245
+ }
246
+
240
247
  .#{$cls}-tag {
241
248
  display: inline-flex;
249
+ flex-shrink: 0;
242
250
  align-items: center;
251
+ min-width: 0;
243
252
  margin-right: $input-tag-tag-margin-right;
244
253
  color: $input-tag-color-text_default;
245
254
  font-size: $input-tag-tag-font-size;
@@ -257,12 +266,32 @@ $less-vars: (
257
266
 
258
267
  @include icon-hover.icon-hover-bg($tag-prefix-cls, token.$tag-custom-color-icon-bg_hover);
259
268
  }
269
+
270
+ &.#{$cls}-tag-overflow {
271
+ flex-shrink: 1;
272
+ white-space: nowrap;
273
+ word-break: normal;
274
+
275
+ .#{theme.$prefix}-tag-text {
276
+ max-width: 100%;
277
+ }
278
+ }
279
+
280
+ &.#{$cls}-tag-counter {
281
+ flex-shrink: 0;
282
+ white-space: nowrap;
283
+ word-break: normal;
284
+ }
260
285
  }
261
286
 
262
287
  .#{$cls}-input {
263
288
  @include input-style();
264
289
 
265
290
  box-sizing: border-box;
291
+
292
+ .#{$cls}-inner-responsive & {
293
+ flex: 0 0 auto;
294
+ }
266
295
  }
267
296
  }
268
297
 
@@ -275,6 +304,30 @@ $less-vars: (
275
304
  pointer-events: none;
276
305
  }
277
306
 
307
+ .#{$cls}-resize-observer {
308
+ position: absolute;
309
+ inset: 0;
310
+ visibility: hidden;
311
+ pointer-events: none;
312
+ }
313
+
314
+ .#{$cls}-measure {
315
+ position: absolute;
316
+ top: 0;
317
+ left: 0;
318
+ display: inline-flex;
319
+ white-space: nowrap;
320
+ visibility: hidden;
321
+ pointer-events: none;
322
+ }
323
+
324
+ .#{$cls}-tag-ellipsis {
325
+ display: block;
326
+ min-width: 0;
327
+ max-width: 100%;
328
+ vertical-align: bottom;
329
+ }
330
+
278
331
  &.#{$cls}-focus {
279
332
  .#{$cls}-tag {
280
333
  background-color: $input-tag-tag-color-bg_focus;
@@ -68,8 +68,8 @@ declare const List: {
68
68
  size: "small" | "medium" | "large";
69
69
  loading: boolean;
70
70
  split: boolean;
71
- bordered: boolean;
72
71
  scrollbar: boolean | import("..").ScrollbarProps;
72
+ bordered: boolean;
73
73
  bottomOffset: number;
74
74
  maxHeight: string | number;
75
75
  hoverable: boolean;
@@ -139,8 +139,8 @@ declare const List: {
139
139
  size: "small" | "medium" | "large";
140
140
  loading: boolean;
141
141
  split: boolean;
142
- bordered: boolean;
143
142
  scrollbar: boolean | import("..").ScrollbarProps;
143
+ bordered: boolean;
144
144
  bottomOffset: number;
145
145
  maxHeight: string | number;
146
146
  hoverable: boolean;
@@ -212,8 +212,8 @@ declare const List: {
212
212
  size: "small" | "medium" | "large";
213
213
  loading: boolean;
214
214
  split: boolean;
215
- bordered: boolean;
216
215
  scrollbar: boolean | import("..").ScrollbarProps;
216
+ bordered: boolean;
217
217
  bottomOffset: number;
218
218
  maxHeight: string | number;
219
219
  hoverable: boolean;
package/es/list/list.d.ts CHANGED
@@ -111,8 +111,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
111
111
  size: "small" | "medium" | "large";
112
112
  loading: boolean;
113
113
  split: boolean;
114
- bordered: boolean;
115
114
  scrollbar: boolean | ScrollbarProps;
115
+ bordered: boolean;
116
116
  bottomOffset: number;
117
117
  maxHeight: string | number;
118
118
  hoverable: boolean;
@@ -3,6 +3,7 @@ import { _objectSpread2 } from "../_virtual/_@oxc-project_runtime@0.124.0/helper
3
3
  import { getPrefixCls } from "../_utils/global-config.js";
4
4
  import { isFunction, isNull, isUndefined } from "../_utils/is.js";
5
5
  import resize_observer_default from "../_components/resize-observer.js";
6
+ import { useAllowClear } from "../_hooks/use-allow-clear.js";
6
7
  import Input from "../input/index.js";
7
8
  import { getKeyFromValue } from "../select/utils.js";
8
9
  import { useSelect } from "../select/hooks/use-select.js";
@@ -62,6 +63,7 @@ var mention_default = /* @__PURE__ */ defineComponent({
62
63
  },
63
64
  setup(props, { emit, attrs, slots }) {
64
65
  const prefixCls = getPrefixCls("mention");
66
+ const { mergedAllowClear } = useAllowClear(toRef(props, "allowClear"));
65
67
  let styleDeclaration;
66
68
  const { mergedDisabled, eventHandlers } = useFormItem({ disabled: toRef(props, "disabled") });
67
69
  const { data, modelValue } = toRefs(props);
@@ -211,7 +213,7 @@ var mention_default = /* @__PURE__ */ defineComponent({
211
213
  var _computedValue$value;
212
214
  return createVNode("div", { "class": prefixCls }, [createVNode(resize_observer_default, { "onResize": handleResize }, { default: () => [createVNode(Textarea, mergeProps(attrs, {
213
215
  "ref": inputRef,
214
- "allowClear": props.allowClear,
216
+ "allowClear": mergedAllowClear.value,
215
217
  "modelValue": computedValue.value,
216
218
  "disabled": mergedDisabled.value,
217
219
  "onInput": handleInput,
@@ -251,7 +253,7 @@ var mention_default = /* @__PURE__ */ defineComponent({
251
253
  }, {
252
254
  default: () => [createVNode(Input, mergeProps(attrs, {
253
255
  "ref": inputRef,
254
- "allowClear": props.allowClear,
256
+ "allowClear": mergedAllowClear.value,
255
257
  "modelValue": computedValue.value,
256
258
  "disabled": mergedDisabled.value,
257
259
  "onInput": handleInput,
@@ -651,10 +651,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
651
651
  };
652
652
  }>> & Readonly<{
653
653
  onResize?: (() => any) | undefined;
654
+ onHide?: (() => any) | undefined;
655
+ onShow?: (() => any) | undefined;
654
656
  "onUpdate:popupVisible"?: ((_visible: boolean) => any) | undefined;
655
657
  onPopupVisibleChange?: ((_visible: boolean) => any) | undefined;
656
- onShow?: (() => any) | undefined;
657
- onHide?: (() => any) | undefined;
658
658
  }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
659
659
  'update:popupVisible': (_visible: boolean) => true;
660
660
  popupVisibleChange: (_visible: boolean) => true;
@@ -842,10 +842,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
842
842
  };
843
843
  }>> & Readonly<{
844
844
  onResize?: (() => any) | undefined;
845
+ onHide?: (() => any) | undefined;
846
+ onShow?: (() => any) | undefined;
845
847
  "onUpdate:popupVisible"?: ((_visible: boolean) => any) | undefined;
846
848
  onPopupVisibleChange?: ((_visible: boolean) => any) | undefined;
847
- onShow?: (() => any) | undefined;
848
- onHide?: (() => any) | undefined;
849
849
  }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, {
850
850
  disabled: boolean;
851
851
  unmountOnClose: boolean;
@@ -1024,10 +1024,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
1024
1024
  };
1025
1025
  }>> & Readonly<{
1026
1026
  onResize?: (() => any) | undefined;
1027
+ onHide?: (() => any) | undefined;
1028
+ onShow?: (() => any) | undefined;
1027
1029
  "onUpdate:popupVisible"?: ((_visible: boolean) => any) | undefined;
1028
1030
  onPopupVisibleChange?: ((_visible: boolean) => any) | undefined;
1029
- onShow?: (() => any) | undefined;
1030
- onHide?: (() => any) | undefined;
1031
1031
  }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
1032
1032
  'update:popupVisible': (_visible: boolean) => true;
1033
1033
  popupVisibleChange: (_visible: boolean) => true;
@@ -14,8 +14,8 @@ import { useI18n } from "../locale/index.js";
14
14
  import client_only_default from "../_components/client-only.js";
15
15
  import usePopupManager from "../_hooks/use-popup-manager.js";
16
16
  import { useTeleportContainer } from "../_hooks/use-teleport-container.js";
17
- import { useOverflow } from "../_hooks/use-overflow.js";
18
17
  import { _asyncToGenerator } from "../_virtual/_@oxc-project_runtime@0.124.0/helpers/asyncToGenerator.js";
18
+ import { useOverflow } from "../_hooks/use-overflow.js";
19
19
  import { useDraggable } from "./hooks/use-draggable.js";
20
20
  import { computed, defineComponent, onBeforeUnmount, onMounted, ref, toRefs, watch } from "vue";
21
21
  //#region components/modal/modal.vue?vue&type=script&lang.tsx
@@ -21,8 +21,8 @@ declare const OverflowList: {
21
21
  change: (_value: number) => true;
22
22
  }, import("vue").PublicProps, {
23
23
  from: "start" | "end";
24
- min: number;
25
24
  margin: number;
25
+ min: number;
26
26
  }, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
27
27
  P: {};
28
28
  B: {};
@@ -47,8 +47,8 @@ declare const OverflowList: {
47
47
  onChange?: ((_value: number) => any) | undefined;
48
48
  }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, {
49
49
  from: "start" | "end";
50
- min: number;
51
50
  margin: number;
51
+ min: number;
52
52
  }>;
53
53
  __isFragment?: never;
54
54
  __isTeleport?: never;
@@ -72,8 +72,8 @@ declare const OverflowList: {
72
72
  change: (_value: number) => true;
73
73
  }, string, {
74
74
  from: "start" | "end";
75
- min: number;
76
75
  margin: number;
76
+ min: number;
77
77
  }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {
78
78
  install: (app: App, options?: SDOptions) => void;
79
79
  };
@@ -31,7 +31,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
31
31
  onChange?: ((_value: number) => any) | undefined;
32
32
  }>, {
33
33
  from: "start" | "end";
34
- min: number;
35
34
  margin: number;
35
+ min: number;
36
36
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
37
37
  export default _default;