@sdata/web-vue 3.11.0 → 3.13.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 (109) hide show
  1. package/dist/sd.css +147 -15
  2. package/dist/sd.min.css +43 -1
  3. package/es/_components/picker/input-range.vue.d.ts +6 -7
  4. package/es/_components/picker/input-range.vue_vue_type_script_setup_true_lang.js +63 -46
  5. package/es/_components/picker/input.vue.d.ts +5 -6
  6. package/es/_components/picker/input.vue_vue_type_script_setup_true_lang.js +52 -35
  7. package/es/_hooks/use-readonly-tip.d.ts +11 -0
  8. package/es/_hooks/use-readonly-tip.js +66 -0
  9. package/es/auto-complete/auto-complete.d.ts +9 -0
  10. package/es/auto-complete/auto-complete.js +11 -1
  11. package/es/auto-complete/index.d.ts +15 -0
  12. package/es/button/button.vue.d.ts +16 -7
  13. package/es/button/button.vue_vue_type_script_setup_true_lang.js +57 -31
  14. package/es/button/index.d.ts +11 -0
  15. package/es/button/interface.d.ts +2 -0
  16. package/es/card/card.d.ts +312 -0
  17. package/es/card/card.js +39 -7
  18. package/es/card/index.d.ts +616 -0
  19. package/es/card/style/index.css +23 -0
  20. package/es/card/style/index.scss +31 -0
  21. package/es/cascader/cascader.vue.d.ts +9 -8
  22. package/es/cascader/cascader.vue_vue_type_script_setup_true_lang.js +149 -128
  23. package/es/cascader/types.d.ts +1 -0
  24. package/es/color-picker/color-picker.d.ts +9 -0
  25. package/es/color-picker/color-picker.js +33 -11
  26. package/es/color-picker/index.d.ts +15 -0
  27. package/es/config-provider/context.d.ts +9 -9
  28. package/es/copy/copy.vue_vue_type_script_setup_true_lang.js +1 -1
  29. package/es/date-picker/index.d.ts +3 -6
  30. package/es/date-picker/picker.vue.d.ts +2 -3
  31. package/es/date-picker/picker.vue_vue_type_script_setup_true_lang.js +5 -5
  32. package/es/date-picker/range-picker.vue.d.ts +2 -3
  33. package/es/date-picker/range-picker.vue_vue_type_script_setup_true_lang.js +4 -4
  34. package/es/drawer/drawer.vue_vue_type_script_setup_true_lang.js +3 -3
  35. package/es/empty/empty.js +1 -1
  36. package/es/file-previewer/file-previewer.vue_vue_type_script_setup_true_lang.js +1 -1
  37. package/es/image/image.vue_vue_type_script_setup_true_lang.js +1 -1
  38. package/es/image/preview-action.d.ts +7 -127
  39. package/es/image/preview.vue_vue_type_script_setup_true_lang.js +2 -2
  40. package/es/index.css +147 -15
  41. package/es/index.js +3 -3
  42. package/es/input/index.d.ts +6 -6
  43. package/es/input/input.d.ts +3 -3
  44. package/es/input/input.js +18 -6
  45. package/es/input-number/index.d.ts +9 -9
  46. package/es/input-number/input-number.d.ts +5 -5
  47. package/es/input-number/input-number.js +8 -8
  48. package/es/input-tag/index.d.ts +6 -6
  49. package/es/input-tag/input-tag.d.ts +3 -3
  50. package/es/input-tag/input-tag.js +16 -7
  51. package/es/locale/interface.d.ts +1 -0
  52. package/es/locale/lang/en-us.js +1 -0
  53. package/es/locale/lang/zh-cn.js +1 -0
  54. package/es/locale/lang/zh-tw.js +1 -0
  55. package/es/mention/index.d.ts +15 -0
  56. package/es/mention/mention.d.ts +9 -0
  57. package/es/mention/mention.js +12 -1
  58. package/es/menu/base-menu.vue_vue_type_script_setup_true_lang.js +1 -1
  59. package/es/modal/modal.vue_vue_type_script_setup_true_lang.js +3 -3
  60. package/es/pagination/pagination.js +1 -1
  61. package/es/popconfirm/popconfirm.vue_vue_type_script_setup_true_lang.js +2 -2
  62. package/es/popover/popover.vue_vue_type_script_setup_true_lang.js +1 -1
  63. package/es/rate/index.d.ts +6 -6
  64. package/es/rate/rate.d.ts +3 -3
  65. package/es/rate/rate.js +17 -7
  66. package/es/scrollbar/scrollbar.vue_vue_type_script_setup_true_lang.js +1 -1
  67. package/es/scrollbar/style/index.css +57 -15
  68. package/es/scrollbar/style/index.scss +63 -15
  69. package/es/sd-vue.js +3 -3
  70. package/es/secret/secret.vue_vue_type_script_setup_true_lang.js +1 -1
  71. package/es/select/index.d.ts +15 -0
  72. package/es/select/select.d.ts +9 -0
  73. package/es/select/select.js +28 -5
  74. package/es/style/normalize.scss +68 -0
  75. package/es/table/table-th.js +2 -2
  76. package/es/tabs/context.d.ts +2 -0
  77. package/es/tabs/index.d.ts +32 -0
  78. package/es/tabs/style/index.css +29 -0
  79. package/es/tabs/style/index.scss +38 -0
  80. package/es/tabs/tab-pane.vue.d.ts +4 -2
  81. package/es/tabs/tab-pane.vue_vue_type_script_setup_true_lang.js +19 -3
  82. package/es/tabs/tabs.d.ts +19 -0
  83. package/es/tabs/tabs.js +23 -2
  84. package/es/textarea/index.d.ts +15 -0
  85. package/es/textarea/textarea.vue.d.ts +11 -2
  86. package/es/textarea/textarea.vue_vue_type_script_setup_true_lang.js +71 -46
  87. package/es/time-picker/index.d.ts +3 -6
  88. package/es/time-picker/panel.vue_vue_type_script_setup_true_lang.js +1 -1
  89. package/es/time-picker/time-picker.vue.d.ts +2 -3
  90. package/es/time-picker/time-picker.vue_vue_type_script_setup_true_lang.js +8 -5
  91. package/es/toolbar/toolbar.vue_vue_type_script_setup_true_lang.js +1 -1
  92. package/es/tooltip/index.d.ts +8 -127
  93. package/es/tooltip/interface.d.ts +17 -0
  94. package/es/tooltip/tooltip.vue.d.ts +5 -88
  95. package/es/tooltip/tooltip.vue_vue_type_script_setup_true_lang.js +8 -69
  96. package/es/tour/tour.vue_vue_type_script_setup_true_lang.js +1 -1
  97. package/es/tree/tree.vue_vue_type_script_setup_true_lang.js +1 -1
  98. package/es/tree-select/tree-select.vue.d.ts +16 -10
  99. package/es/tree-select/tree-select.vue_vue_type_script_setup_true_lang.js +156 -133
  100. package/es/typography/base.js +1 -1
  101. package/es/upload/upload-button.js +1 -1
  102. package/es/verification-code/index.d.ts +15 -6
  103. package/es/verification-code/verification-code.d.ts +9 -3
  104. package/es/verification-code/verification-code.js +4 -1
  105. package/json/vetur-attributes.json +48 -7
  106. package/json/vetur-tags.json +17 -5
  107. package/json/web-types.json +99 -10
  108. package/package.json +1 -1
  109. package/es/style/base.scss +0 -18
@@ -2,13 +2,13 @@ import { PropType } from 'vue';
2
2
  import { Dayjs } from 'dayjs';
3
3
  declare function focus(index?: number): void;
4
4
  declare function blur(): void;
5
- declare var __VLS_1: {}, __VLS_3: {}, __VLS_18: {};
5
+ declare var __VLS_8: {}, __VLS_10: {}, __VLS_25: {};
6
6
  type __VLS_Slots = {} & {
7
- prefix?: (props: typeof __VLS_1) => any;
7
+ prefix?: (props: typeof __VLS_8) => any;
8
8
  } & {
9
- separator?: (props: typeof __VLS_3) => any;
9
+ separator?: (props: typeof __VLS_10) => any;
10
10
  } & {
11
- 'suffix-icon'?: (props: typeof __VLS_18) => any;
11
+ 'suffix-icon'?: (props: typeof __VLS_25) => any;
12
12
  };
13
13
  declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
14
14
  size: {
@@ -28,7 +28,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
28
28
  default: boolean;
29
29
  };
30
30
  readonly: {
31
- type: BooleanConstructor;
31
+ type: (StringConstructor | BooleanConstructor)[];
32
32
  };
33
33
  allowClear: {
34
34
  type: BooleanConstructor;
@@ -75,7 +75,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
75
75
  default: boolean;
76
76
  };
77
77
  readonly: {
78
- type: BooleanConstructor;
78
+ type: (StringConstructor | BooleanConstructor)[];
79
79
  };
80
80
  allowClear: {
81
81
  type: BooleanConstructor;
@@ -103,7 +103,6 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
103
103
  "onUpdate:focusedIndex"?: ((_index: number) => any) | undefined;
104
104
  }>, {
105
105
  error: boolean;
106
- readonly: boolean;
107
106
  value: (Dayjs | undefined)[];
108
107
  disabled: boolean | boolean[];
109
108
  placeholder: string[];
@@ -5,8 +5,10 @@ import { isArray, isDayjs, isFunction, isNumber, isUndefined } from "../../_util
5
5
  import icon_hover_default from "../icon-hover.js";
6
6
  import IconClose from "../../icon/icon-close/index.js";
7
7
  import feedback_icon_default from "../feedback-icon.js";
8
+ import { isReadonlyModificationKey, useReadonlyTip, useReadonlyTipText } from "../../_hooks/use-readonly-tip.js";
8
9
  import { useSize } from "../../_hooks/use-size.js";
9
- import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeProps, normalizeClass, openBlock, ref, renderSlot, toRefs, unref, useSlots, withCtx, withKeys } from "vue";
10
+ import Tooltip from "../../tooltip/index.js";
11
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeProps, normalizeClass, openBlock, ref, renderSlot, toRef, toRefs, unref, useSlots, withCtx, withKeys } from "vue";
10
12
  //#region components/_components/picker/input-range.vue?vue&type=script&setup=true&lang.ts
11
13
  var _hoisted_1 = [
12
14
  "disabled",
@@ -29,7 +31,7 @@ var input_range_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
29
31
  type: [Boolean, Array],
30
32
  default: false
31
33
  },
32
- readonly: { type: Boolean },
34
+ readonly: { type: [Boolean, String] },
33
35
  allowClear: { type: Boolean },
34
36
  placeholder: {
35
37
  type: Array,
@@ -62,6 +64,8 @@ var input_range_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
62
64
  error
63
65
  });
64
66
  const { mergedSize } = useSize(_mergedSize);
67
+ const { tipVisible, show: showReadonlyTip } = useReadonlyTip(toRef(props, "readonly"), mergedDisabled);
68
+ const readonlyTipText = useReadonlyTipText(toRef(props, "readonly"));
65
69
  const refInput0 = ref();
66
70
  const refInput1 = ref();
67
71
  const getDisabled = (index) => {
@@ -110,6 +114,9 @@ var input_range_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
110
114
  function onPressTab(e) {
111
115
  e.preventDefault();
112
116
  }
117
+ function onReadonlyKeydown(e) {
118
+ if (props.readonly && !mergedDisabled.value && isReadonlyModificationKey(e)) showReadonlyTip();
119
+ }
113
120
  function onClear(e) {
114
121
  emit("clear", e);
115
122
  }
@@ -127,51 +134,61 @@ var input_range_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
127
134
  blur
128
135
  });
129
136
  return (_ctx, _cache) => {
130
- return openBlock(), createElementBlock("div", { class: normalizeClass(classNames.value) }, [
131
- _ctx.$slots.prefix ? (openBlock(), createElementBlock("div", {
132
- key: 0,
133
- class: normalizeClass(`${unref(prefixCls)}-prefix`)
134
- }, [renderSlot(_ctx.$slots, "prefix")], 2)) : createCommentVNode("", true),
135
- createElementVNode("div", { class: normalizeClass(getInputWrapClassName(0)) }, [createElementVNode("input", mergeProps({
136
- ref_key: "refInput0",
137
- ref: refInput0,
138
- disabled: disabled0.value,
139
- placeholder: __props.placeholder[0],
140
- value: displayValue0.value
141
- }, __props.readonly ? { readonly: true } : {}, {
142
- onInput: onChange,
143
- onKeydown: [withKeys(onPressEnter, ["enter"]), withKeys(onPressTab, ["tab"])],
144
- onClick: _cache[0] || (_cache[0] = () => changeFocusedInput(0))
145
- }), null, 16, _hoisted_1)], 2),
146
- createElementVNode("span", { class: normalizeClass(`${unref(prefixCls)}-separator`) }, [renderSlot(_ctx.$slots, "separator", {}, () => [_cache[2] || (_cache[2] = createTextVNode(" - ", -1))])], 2),
147
- createElementVNode("div", { class: normalizeClass(getInputWrapClassName(1)) }, [createElementVNode("input", mergeProps({
148
- ref_key: "refInput1",
149
- ref: refInput1,
150
- disabled: disabled1.value,
151
- placeholder: __props.placeholder[1],
152
- value: displayValue1.value
153
- }, __props.readonly ? { readonly: true } : {}, {
154
- onInput: onChange,
155
- onKeydown: [withKeys(onPressEnter, ["enter"]), withKeys(onPressTab, ["tab"])],
156
- onClick: _cache[1] || (_cache[1] = () => changeFocusedInput(1))
157
- }), null, 16, _hoisted_2)], 2),
158
- createElementVNode("div", { class: normalizeClass(`${unref(prefixCls)}-suffix`) }, [
159
- __props.allowClear && !unref(mergedDisabled) && unref(value).length === 2 ? (openBlock(), createBlock(icon_hover_default, {
137
+ return openBlock(), createBlock(unref(Tooltip), {
138
+ "popup-visible": unref(tipVisible),
139
+ content: unref(readonlyTipText),
140
+ position: "top"
141
+ }, {
142
+ default: withCtx(() => [createElementVNode("div", {
143
+ class: normalizeClass(classNames.value),
144
+ onKeydown: onReadonlyKeydown
145
+ }, [
146
+ _ctx.$slots.prefix ? (openBlock(), createElementBlock("div", {
160
147
  key: 0,
161
- prefix: unref(prefixCls),
162
- class: normalizeClass(`${unref(prefixCls)}-clear-icon`),
163
- onClick: onClear
164
- }, {
165
- default: withCtx(() => [createVNode(unref(IconClose))]),
166
- _: 1
167
- }, 8, ["prefix", "class"])) : createCommentVNode("", true),
168
- createElementVNode("span", { class: normalizeClass(`${unref(prefixCls)}-suffix-icon`) }, [renderSlot(_ctx.$slots, "suffix-icon")], 2),
169
- unref(feedback) ? (openBlock(), createBlock(feedback_icon_default, {
170
- key: 1,
171
- type: unref(feedback)
172
- }, null, 8, ["type"])) : createCommentVNode("", true)
173
- ], 2)
174
- ], 2);
148
+ class: normalizeClass(`${unref(prefixCls)}-prefix`)
149
+ }, [renderSlot(_ctx.$slots, "prefix")], 2)) : createCommentVNode("", true),
150
+ createElementVNode("div", { class: normalizeClass(getInputWrapClassName(0)) }, [createElementVNode("input", mergeProps({
151
+ ref_key: "refInput0",
152
+ ref: refInput0,
153
+ disabled: disabled0.value,
154
+ placeholder: __props.placeholder[0],
155
+ value: displayValue0.value
156
+ }, __props.readonly ? { readonly: true } : {}, {
157
+ onInput: onChange,
158
+ onKeydown: [withKeys(onPressEnter, ["enter"]), withKeys(onPressTab, ["tab"])],
159
+ onClick: _cache[0] || (_cache[0] = () => changeFocusedInput(0))
160
+ }), null, 16, _hoisted_1)], 2),
161
+ createElementVNode("span", { class: normalizeClass(`${unref(prefixCls)}-separator`) }, [renderSlot(_ctx.$slots, "separator", {}, () => [_cache[2] || (_cache[2] = createTextVNode(" - ", -1))])], 2),
162
+ createElementVNode("div", { class: normalizeClass(getInputWrapClassName(1)) }, [createElementVNode("input", mergeProps({
163
+ ref_key: "refInput1",
164
+ ref: refInput1,
165
+ disabled: disabled1.value,
166
+ placeholder: __props.placeholder[1],
167
+ value: displayValue1.value
168
+ }, __props.readonly ? { readonly: true } : {}, {
169
+ onInput: onChange,
170
+ onKeydown: [withKeys(onPressEnter, ["enter"]), withKeys(onPressTab, ["tab"])],
171
+ onClick: _cache[1] || (_cache[1] = () => changeFocusedInput(1))
172
+ }), null, 16, _hoisted_2)], 2),
173
+ createElementVNode("div", { class: normalizeClass(`${unref(prefixCls)}-suffix`) }, [
174
+ __props.allowClear && !unref(mergedDisabled) && unref(value).length === 2 ? (openBlock(), createBlock(icon_hover_default, {
175
+ key: 0,
176
+ prefix: unref(prefixCls),
177
+ class: normalizeClass(`${unref(prefixCls)}-clear-icon`),
178
+ onClick: onClear
179
+ }, {
180
+ default: withCtx(() => [createVNode(unref(IconClose))]),
181
+ _: 1
182
+ }, 8, ["prefix", "class"])) : createCommentVNode("", true),
183
+ createElementVNode("span", { class: normalizeClass(`${unref(prefixCls)}-suffix-icon`) }, [renderSlot(_ctx.$slots, "suffix-icon")], 2),
184
+ unref(feedback) ? (openBlock(), createBlock(feedback_icon_default, {
185
+ key: 1,
186
+ type: unref(feedback)
187
+ }, null, 8, ["type"])) : createCommentVNode("", true)
188
+ ], 2)
189
+ ], 34)]),
190
+ _: 3
191
+ }, 8, ["popup-visible", "content"]);
175
192
  };
176
193
  }
177
194
  }));
@@ -2,11 +2,11 @@ import { PropType } from 'vue';
2
2
  import { Dayjs } from 'dayjs';
3
3
  declare function focus(): void;
4
4
  declare function blur(): void;
5
- declare var __VLS_1: {}, __VLS_16: {};
5
+ declare var __VLS_8: {}, __VLS_23: {};
6
6
  type __VLS_Slots = {} & {
7
- prefix?: (props: typeof __VLS_1) => any;
7
+ prefix?: (props: typeof __VLS_8) => any;
8
8
  } & {
9
- 'suffix-icon'?: (props: typeof __VLS_16) => any;
9
+ 'suffix-icon'?: (props: typeof __VLS_23) => any;
10
10
  };
11
11
  declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
12
12
  size: {
@@ -19,7 +19,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
19
19
  type: BooleanConstructor;
20
20
  };
21
21
  readonly: {
22
- type: BooleanConstructor;
22
+ type: (StringConstructor | BooleanConstructor)[];
23
23
  };
24
24
  error: {
25
25
  type: BooleanConstructor;
@@ -59,7 +59,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
59
59
  type: BooleanConstructor;
60
60
  };
61
61
  readonly: {
62
- type: BooleanConstructor;
62
+ type: (StringConstructor | BooleanConstructor)[];
63
63
  };
64
64
  error: {
65
65
  type: BooleanConstructor;
@@ -87,7 +87,6 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
87
87
  "onPress-enter"?: (() => any) | undefined;
88
88
  }>, {
89
89
  error: boolean;
90
- readonly: boolean;
91
90
  disabled: boolean;
92
91
  allowClear: boolean;
93
92
  focused: boolean;
@@ -5,8 +5,10 @@ import { isDayjs, isFunction } from "../../_utils/is.js";
5
5
  import icon_hover_default from "../icon-hover.js";
6
6
  import IconClose from "../../icon/icon-close/index.js";
7
7
  import feedback_icon_default from "../feedback-icon.js";
8
+ import { isReadonlyModificationKey, useReadonlyTip, useReadonlyTipText } from "../../_hooks/use-readonly-tip.js";
8
9
  import { useSize } from "../../_hooks/use-size.js";
9
- import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, normalizeClass, openBlock, ref, renderSlot, toRefs, unref, useSlots, withCtx, withKeys } from "vue";
10
+ import Tooltip from "../../tooltip/index.js";
11
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, normalizeClass, openBlock, ref, renderSlot, toRef, toRefs, unref, useSlots, withCtx, withKeys } from "vue";
10
12
  //#region components/_components/picker/input.vue?vue&type=script&setup=true&lang.ts
11
13
  var _hoisted_1 = [
12
14
  "disabled",
@@ -19,7 +21,7 @@ var input_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComp
19
21
  size: { type: String },
20
22
  focused: { type: Boolean },
21
23
  disabled: { type: Boolean },
22
- readonly: { type: Boolean },
24
+ readonly: { type: [Boolean, String] },
23
25
  error: { type: Boolean },
24
26
  allowClear: { type: Boolean },
25
27
  placeholder: { type: String },
@@ -47,6 +49,8 @@ var input_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComp
47
49
  error
48
50
  });
49
51
  const { mergedSize } = useSize(_mergedSize);
52
+ const { tipVisible, show: showReadonlyTip } = useReadonlyTip(toRef(props, "readonly"), mergedDisabled);
53
+ const readonlyTipText = useReadonlyTipText(toRef(props, "readonly"));
50
54
  const prefixCls = getPrefixCls("picker");
51
55
  const classNames = computed(() => [
52
56
  prefixCls,
@@ -75,6 +79,9 @@ var input_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComp
75
79
  function onBlur(e) {
76
80
  emit("blur", e);
77
81
  }
82
+ function onReadonlyKeydown(e) {
83
+ if (props.readonly && !mergedDisabled.value && isReadonlyModificationKey(e)) showReadonlyTip();
84
+ }
78
85
  function focus() {
79
86
  refInput.value && refInput.value.focus && refInput.value.focus();
80
87
  }
@@ -86,40 +93,50 @@ var input_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComp
86
93
  blur
87
94
  });
88
95
  return (_ctx, _cache) => {
89
- return openBlock(), createElementBlock("div", { class: normalizeClass(classNames.value) }, [
90
- _ctx.$slots.prefix ? (openBlock(), createElementBlock("div", {
91
- key: 0,
92
- class: normalizeClass(`${unref(prefixCls)}-prefix`)
93
- }, [renderSlot(_ctx.$slots, "prefix")], 2)) : createCommentVNode("", true),
94
- createElementVNode("div", { class: normalizeClass(`${unref(prefixCls)}-input`) }, [createElementVNode("input", mergeProps({
95
- ref_key: "refInput",
96
- ref: refInput,
97
- disabled: unref(mergedDisabled),
98
- placeholder: __props.placeholder,
99
- class: `${unref(prefixCls)}-start-time`,
100
- value: displayValue.value
101
- }, __props.readonly ? { readonly: true } : {}, {
102
- onKeydown: withKeys(onPressEnter, ["enter"]),
103
- onInput: onChange,
104
- onBlur
105
- }), null, 16, _hoisted_1)], 2),
106
- createElementVNode("div", { class: normalizeClass(`${unref(prefixCls)}-suffix`) }, [
107
- __props.allowClear && !unref(mergedDisabled) && displayValue.value ? (openBlock(), createBlock(icon_hover_default, {
96
+ return openBlock(), createBlock(unref(Tooltip), {
97
+ "popup-visible": unref(tipVisible),
98
+ content: unref(readonlyTipText),
99
+ position: "top"
100
+ }, {
101
+ default: withCtx(() => [createElementVNode("div", {
102
+ class: normalizeClass(classNames.value),
103
+ onKeydown: onReadonlyKeydown
104
+ }, [
105
+ _ctx.$slots.prefix ? (openBlock(), createElementBlock("div", {
108
106
  key: 0,
109
- prefix: unref(prefixCls),
110
- class: normalizeClass(`${unref(prefixCls)}-clear-icon`),
111
- onClick: onClear
112
- }, {
113
- default: withCtx(() => [createVNode(unref(IconClose))]),
114
- _: 1
115
- }, 8, ["prefix", "class"])) : createCommentVNode("", true),
116
- createElementVNode("span", { class: normalizeClass(`${unref(prefixCls)}-suffix-icon`) }, [renderSlot(_ctx.$slots, "suffix-icon")], 2),
117
- unref(feedback) ? (openBlock(), createBlock(feedback_icon_default, {
118
- key: 1,
119
- type: unref(feedback)
120
- }, null, 8, ["type"])) : createCommentVNode("", true)
121
- ], 2)
122
- ], 2);
107
+ class: normalizeClass(`${unref(prefixCls)}-prefix`)
108
+ }, [renderSlot(_ctx.$slots, "prefix")], 2)) : createCommentVNode("", true),
109
+ createElementVNode("div", { class: normalizeClass(`${unref(prefixCls)}-input`) }, [createElementVNode("input", mergeProps({
110
+ ref_key: "refInput",
111
+ ref: refInput,
112
+ disabled: unref(mergedDisabled),
113
+ placeholder: __props.placeholder,
114
+ class: `${unref(prefixCls)}-start-time`,
115
+ value: displayValue.value
116
+ }, __props.readonly ? { readonly: true } : {}, {
117
+ onKeydown: withKeys(onPressEnter, ["enter"]),
118
+ onInput: onChange,
119
+ onBlur
120
+ }), null, 16, _hoisted_1)], 2),
121
+ createElementVNode("div", { class: normalizeClass(`${unref(prefixCls)}-suffix`) }, [
122
+ __props.allowClear && !unref(mergedDisabled) && displayValue.value ? (openBlock(), createBlock(icon_hover_default, {
123
+ key: 0,
124
+ prefix: unref(prefixCls),
125
+ class: normalizeClass(`${unref(prefixCls)}-clear-icon`),
126
+ onClick: onClear
127
+ }, {
128
+ default: withCtx(() => [createVNode(unref(IconClose))]),
129
+ _: 1
130
+ }, 8, ["prefix", "class"])) : createCommentVNode("", true),
131
+ createElementVNode("span", { class: normalizeClass(`${unref(prefixCls)}-suffix-icon`) }, [renderSlot(_ctx.$slots, "suffix-icon")], 2),
132
+ unref(feedback) ? (openBlock(), createBlock(feedback_icon_default, {
133
+ key: 1,
134
+ type: unref(feedback)
135
+ }, null, 8, ["type"])) : createCommentVNode("", true)
136
+ ], 2)
137
+ ], 34)]),
138
+ _: 3
139
+ }, 8, ["popup-visible", "content"]);
123
140
  };
124
141
  }
125
142
  }));
@@ -0,0 +1,11 @@
1
+ import { Ref } from 'vue';
2
+ export declare const isReadonlyModificationKey: (e: KeyboardEvent) => boolean;
3
+ export interface UseReadonlyTipOptions {
4
+ duration?: number;
5
+ }
6
+ export declare const useReadonlyTip: (readonly: Ref<boolean | string | undefined>, disabled: Ref<boolean>, options?: UseReadonlyTipOptions) => {
7
+ tipVisible: Ref<boolean, boolean>;
8
+ show: () => void;
9
+ hide: () => void;
10
+ };
11
+ export declare const useReadonlyTipText: (readonly: Ref<boolean | string | undefined>) => import("vue").ComputedRef<string>;
@@ -0,0 +1,66 @@
1
+ import { useI18n } from "../locale/index.js";
2
+ import { computed, onBeforeUnmount, ref } from "vue";
3
+ //#region components/_hooks/use-readonly-tip.ts
4
+ var DEFAULT_DURATION = 2e3;
5
+ /**
6
+ * @zh 判断按键是否会修改输入框的值,用于在只读状态下提示用户
7
+ * @en Whether the keystroke would modify the input value, used to prompt the user in readonly state
8
+ * @param e
9
+ */
10
+ var isReadonlyModificationKey = (e) => {
11
+ const { key, ctrlKey, metaKey, altKey } = e;
12
+ if ((ctrlKey || metaKey) && (key === "v" || key === "V" || key === "x" || key === "X")) return true;
13
+ if (ctrlKey || metaKey || altKey) return false;
14
+ return key.length === 1 || key === "Backspace" || key === "Delete";
15
+ };
16
+ /**
17
+ * @zh 只读模式提示。在用户尝试修改只读组件时短暂显示 tooltip,每次新的修改尝试都会重置隐藏计时器。
18
+ * @en Readonly tip. Briefly shows a tooltip when the user attempts to modify a readonly component;
19
+ * each new attempt resets the hide timer.
20
+ * @param readonly
21
+ * @param disabled
22
+ * @param options
23
+ */
24
+ var useReadonlyTip = (readonly, disabled, options) => {
25
+ var _options$duration;
26
+ const duration = (_options$duration = options === null || options === void 0 ? void 0 : options.duration) !== null && _options$duration !== void 0 ? _options$duration : DEFAULT_DURATION;
27
+ const tipVisible = ref(false);
28
+ let timer = null;
29
+ const hide = () => {
30
+ if (timer) {
31
+ clearTimeout(timer);
32
+ timer = null;
33
+ }
34
+ tipVisible.value = false;
35
+ };
36
+ const show = () => {
37
+ if (!readonly.value || disabled.value) return;
38
+ if (timer) clearTimeout(timer);
39
+ tipVisible.value = true;
40
+ timer = setTimeout(() => {
41
+ tipVisible.value = false;
42
+ timer = null;
43
+ }, duration);
44
+ };
45
+ onBeforeUnmount(hide);
46
+ return {
47
+ tipVisible,
48
+ show,
49
+ hide
50
+ };
51
+ };
52
+ /**
53
+ * @zh 获取只读提示文案:readonly 为字符串时直接使用该字符串,否则取自 i18n 的 `readonlyTip`(缺失时回退英文)
54
+ * @en Returns the readonly tip text: if `readonly` is a string, use it directly;
55
+ * otherwise fall back to i18n `readonlyTip` (English when missing).
56
+ */
57
+ var useReadonlyTipText = (readonly) => {
58
+ const { t } = useI18n();
59
+ return computed(() => {
60
+ if (typeof readonly.value === "string") return readonly.value;
61
+ const text = t("readonlyTip");
62
+ return text === "readonlyTip" ? "Read-only mode" : text;
63
+ });
64
+ };
65
+ //#endregion
66
+ export { isReadonlyModificationKey, useReadonlyTip, useReadonlyTipText };
@@ -15,6 +15,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
15
15
  type: BooleanConstructor;
16
16
  default: boolean;
17
17
  };
18
+ readonly: {
19
+ type: (StringConstructor | BooleanConstructor)[];
20
+ default: boolean;
21
+ };
18
22
  data: {
19
23
  type: PropType<(string | number | SelectOptionData | SelectOptionGroup)[]>;
20
24
  default: () => never[];
@@ -67,6 +71,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
67
71
  type: BooleanConstructor;
68
72
  default: boolean;
69
73
  };
74
+ readonly: {
75
+ type: (StringConstructor | BooleanConstructor)[];
76
+ default: boolean;
77
+ };
70
78
  data: {
71
79
  type: PropType<(string | number | SelectOptionData | SelectOptionGroup)[]>;
72
80
  default: () => never[];
@@ -101,6 +109,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
101
109
  onDropdownScroll?: ((_ev: Event) => any) | undefined;
102
110
  onDropdownReachBottom?: ((_ev: Event) => any) | undefined;
103
111
  }>, {
112
+ readonly: string | boolean;
104
113
  data: (string | number | SelectOptionData | SelectOptionGroup)[];
105
114
  disabled: boolean;
106
115
  defaultValue: string;
@@ -5,11 +5,11 @@ import virtual_list_default from "../_components/virtual-list/index.js";
5
5
  import { useAllowClear } from "../_hooks/use-allow-clear.js";
6
6
  import { useDropdownVirtualListProps } from "../_hooks/use-dropdown-virtual-list-props.js";
7
7
  import { resolveDropdownVirtualListProps } from "../_utils/virtual-dropdown.js";
8
+ import Trigger from "../trigger/index.js";
8
9
  import Input from "../input/index.js";
9
10
  import { getKeyFromValue } from "../select/utils.js";
10
11
  import { useSelect } from "../select/hooks/use-select.js";
11
12
  import select_dropdown_default from "../select/select-dropdown.js";
12
- import Trigger from "../trigger/index.js";
13
13
  import { computed, createVNode, defineComponent, mergeProps, ref, toRef, toRefs, watch } from "vue";
14
14
  //#region components/auto-complete/auto-complete.tsx
15
15
  var DEFAULT_AUTOCOMPLETE_VIRTUAL_ITEM_SIZE = 36;
@@ -43,6 +43,14 @@ var auto_complete_default = /* @__PURE__ */ defineComponent({
43
43
  default: false
44
44
  },
45
45
  /**
46
+ * @zh 是否为只读状态
47
+ * @en Whether it is read-only
48
+ */
49
+ readonly: {
50
+ type: [Boolean, String],
51
+ default: false
52
+ },
53
+ /**
46
54
  * @zh 用于自动提示的数据
47
55
  * @en Data used for auto-complete
48
56
  */
@@ -185,6 +193,7 @@ var auto_complete_default = /* @__PURE__ */ defineComponent({
185
193
  return resolveDropdownVirtualListProps(mergedDropdownVirtualListProps.value, props.triggerProps, DEFAULT_AUTOCOMPLETE_VIRTUAL_ITEM_SIZE);
186
194
  });
187
195
  const handlePopupVisibleChange = (popupVisible) => {
196
+ if (popupVisible && props.readonly) return;
188
197
  _popupVisible.value = popupVisible;
189
198
  };
190
199
  const strictFilterOption = (inputValue, option) => {
@@ -308,6 +317,7 @@ var auto_complete_default = /* @__PURE__ */ defineComponent({
308
317
  "allowClear": mergedAllowClear.value,
309
318
  "modelValue": computedValue.value,
310
319
  "disabled": mergedDisabled.value,
320
+ "readonly": props.readonly,
311
321
  "onInput": handleInputValueChange,
312
322
  "onClear": handleClear
313
323
  }, { onKeydown: handleKeyDown }), slots)],
@@ -24,6 +24,10 @@ declare const AutoComplete: {
24
24
  type: BooleanConstructor;
25
25
  default: boolean;
26
26
  };
27
+ readonly: {
28
+ type: (StringConstructor | BooleanConstructor)[];
29
+ default: boolean;
30
+ };
27
31
  data: {
28
32
  type: import("vue").PropType<(string | number | SelectOptionData | SelectOptionGroup)[]>;
29
33
  default: () => never[];
@@ -72,6 +76,7 @@ declare const AutoComplete: {
72
76
  dropdownScroll: (_ev: Event) => true;
73
77
  dropdownReachBottom: (_ev: Event) => true;
74
78
  }, import("vue").PublicProps, {
79
+ readonly: string | boolean;
75
80
  data: (string | number | SelectOptionData | SelectOptionGroup)[];
76
81
  disabled: boolean;
77
82
  defaultValue: string;
@@ -99,6 +104,10 @@ declare const AutoComplete: {
99
104
  type: BooleanConstructor;
100
105
  default: boolean;
101
106
  };
107
+ readonly: {
108
+ type: (StringConstructor | BooleanConstructor)[];
109
+ default: boolean;
110
+ };
102
111
  data: {
103
112
  type: import("vue").PropType<(string | number | SelectOptionData | SelectOptionGroup)[]>;
104
113
  default: () => never[];
@@ -139,6 +148,7 @@ declare const AutoComplete: {
139
148
  focus(): void;
140
149
  blur(): void;
141
150
  }, {
151
+ readonly: string | boolean;
142
152
  data: (string | number | SelectOptionData | SelectOptionGroup)[];
143
153
  disabled: boolean;
144
154
  defaultValue: string;
@@ -163,6 +173,10 @@ declare const AutoComplete: {
163
173
  type: BooleanConstructor;
164
174
  default: boolean;
165
175
  };
176
+ readonly: {
177
+ type: (StringConstructor | BooleanConstructor)[];
178
+ default: boolean;
179
+ };
166
180
  data: {
167
181
  type: import("vue").PropType<(string | number | SelectOptionData | SelectOptionGroup)[]>;
168
182
  default: () => never[];
@@ -211,6 +225,7 @@ declare const AutoComplete: {
211
225
  dropdownScroll: (_ev: Event) => true;
212
226
  dropdownReachBottom: (_ev: Event) => true;
213
227
  }, string, {
228
+ readonly: string | boolean;
214
229
  data: (string | number | SelectOptionData | SelectOptionGroup)[];
215
230
  disabled: boolean;
216
231
  defaultValue: string;
@@ -1,19 +1,22 @@
1
1
  import type { PropType } from 'vue';
2
+ import type { TooltipProps } from '../tooltip';
2
3
  import { Status, Size, BorderShape } from '../_utils/constant';
3
4
  import { ButtonTypes } from './constants';
4
- declare var __VLS_6: {}, __VLS_8: {}, __VLS_10: {}, __VLS_17: {}, __VLS_19: {}, __VLS_21: {};
5
+ declare var __VLS_13: {}, __VLS_15: {}, __VLS_17: {}, __VLS_24: {}, __VLS_26: {}, __VLS_28: {}, __VLS_31: {};
5
6
  type __VLS_Slots = {} & {
6
- icon?: (props: typeof __VLS_6) => any;
7
+ icon?: (props: typeof __VLS_13) => any;
7
8
  } & {
8
- default?: (props: typeof __VLS_8) => any;
9
+ default?: (props: typeof __VLS_15) => any;
9
10
  } & {
10
- default?: (props: typeof __VLS_10) => any;
11
+ default?: (props: typeof __VLS_17) => any;
11
12
  } & {
12
- icon?: (props: typeof __VLS_17) => any;
13
+ icon?: (props: typeof __VLS_24) => any;
13
14
  } & {
14
- default?: (props: typeof __VLS_19) => any;
15
+ default?: (props: typeof __VLS_26) => any;
15
16
  } & {
16
- default?: (props: typeof __VLS_21) => any;
17
+ default?: (props: typeof __VLS_28) => any;
18
+ } & {
19
+ tooltip?: (props: typeof __VLS_31) => any;
17
20
  };
18
21
  declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
19
22
  type: {
@@ -52,6 +55,9 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
52
55
  default: boolean;
53
56
  };
54
57
  href: StringConstructor;
58
+ tooltip: {
59
+ type: PropType<string | TooltipProps>;
60
+ };
55
61
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
56
62
  click: (_ev: MouseEvent) => any;
57
63
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -91,6 +97,9 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
91
97
  default: boolean;
92
98
  };
93
99
  href: StringConstructor;
100
+ tooltip: {
101
+ type: PropType<string | TooltipProps>;
102
+ };
94
103
  }>> & Readonly<{
95
104
  onClick?: ((_ev: MouseEvent) => any) | undefined;
96
105
  }>, {