kui-vue 3.6.0 → 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/{readme.md → README.md} +4 -10
  2. package/components/button/demo/group.md +1 -1
  3. package/components/card/card.jsx +1 -1
  4. package/components/checkbox/checkboxGroup.jsx +4 -4
  5. package/components/checkbox/demo/group.md +17 -6
  6. package/components/checkbox/styles/index.less +4 -11
  7. package/components/colorPicker/colorpicker.jsx +5 -6
  8. package/components/colorPicker/demo/customTrigger.md +2 -2
  9. package/components/colorPicker/demo/mode.md +1 -4
  10. package/components/datePicker/datepicker.jsx +19 -11
  11. package/components/datePicker/demo/basic.md +15 -6
  12. package/components/datePicker/demo/lang.md +2 -2
  13. package/components/drawer/drawer.jsx +2 -2
  14. package/components/dropdown/dropdown.jsx +9 -40
  15. package/components/form/demo/valid.md +1 -0
  16. package/components/image/image.jsx +1 -0
  17. package/components/input/index.md +1 -1
  18. package/components/inputNumber/demo/basic.md +12 -5
  19. package/components/inputNumber/demo/format.md +0 -5
  20. package/components/inputNumber/index.md +1 -1
  21. package/components/inputNumber/inputNumber.jsx +3 -5
  22. package/components/inputNumber/styles/index.less +64 -64
  23. package/components/menu/submenu.jsx +5 -5
  24. package/components/page/page.jsx +0 -1
  25. package/components/popconfirm/popconfirm.jsx +4 -4
  26. package/components/poptip/poptip.jsx +4 -4
  27. package/components/radio/demo/group.md +16 -6
  28. package/components/radio/demo/radioButton.md +3 -8
  29. package/components/radio/radioGroup.jsx +8 -11
  30. package/components/radio/styles/index.less +10 -21
  31. package/components/select/demo/basic.md +16 -7
  32. package/components/select/demo/filterable.md +4 -2
  33. package/components/select/index.md +23 -22
  34. package/components/select/option.jsx +7 -3
  35. package/components/select/select.jsx +43 -36
  36. package/components/select/styles/index.less +1 -0
  37. package/components/slider/demo/basic.md +2 -1
  38. package/components/slider/demo/withNumber.md +3 -3
  39. package/components/slider/slider.jsx +0 -25
  40. package/components/space/styles/index.less +3 -1
  41. package/components/styles/sys.less +3 -0
  42. package/components/switch/switch.jsx +15 -5
  43. package/components/table/styles/index.less +10 -5
  44. package/components/table/table.jsx +98 -69
  45. package/components/tooltip/tooltip.jsx +3 -3
  46. package/components/treeselect/demo/size.md +2 -2
  47. package/components/treeselect/treeselect.jsx +15 -20
  48. package/components/utils/placement.js +137 -126
  49. package/dist/k-ui.cjs.js +2 -2
  50. package/dist/k-ui.css +2 -2
  51. package/dist/k-ui.d.ts +118 -115
  52. package/dist/k-ui.esm.js +2 -2
  53. package/dist/k-ui.umd.js +2 -2
  54. package/dist/locale/de.js +1 -1
  55. package/dist/locale/el.js +1 -1
  56. package/dist/locale/en.js +1 -1
  57. package/dist/locale/fr.js +1 -1
  58. package/dist/locale/it.js +1 -1
  59. package/dist/locale/ja.js +1 -1
  60. package/dist/locale/ko.js +1 -1
  61. package/dist/locale/ru.js +1 -1
  62. package/dist/locale/th.js +1 -1
  63. package/dist/locale/uk.js +1 -1
  64. package/dist/locale/vi.js +1 -1
  65. package/dist/locale/zh-CN.js +1 -1
  66. package/dist/locale/zh-TW.js +1 -1
  67. package/package.json +5 -5
  68. package/test/i18n@8.x.html +6 -2
  69. package/types/image/KImage.d.ts +1 -0
  70. package/types/index.d.ts +10 -10
  71. package/types/switch/Switch.d.ts +2 -0
  72. package/components/steps/index.js +0 -4
  73. package/components/steps/step.vue +0 -82
  74. package/components/steps/steps.vue +0 -68
  75. package/components/steps/styles/index.less +0 -198
@@ -70,16 +70,10 @@ Using a script tag for global use:
70
70
  <Button type="primary" @click="test">Primary</Button>
71
71
  </div>
72
72
  </template>
73
- <script>
74
- export default {
75
- data() {
76
- return {};
77
- },
78
- methods: {
79
- test() {
80
- this.$message.info("Hello kui !");
81
- },
82
- },
73
+ <script setup>
74
+ import { message } from "kui-vue";
75
+ const test = () => {
76
+ message.info("Hello kui !");
83
77
  };
84
78
  </script>
85
79
  ```
@@ -13,7 +13,7 @@
13
13
  <DropdownButton>
14
14
  Dropdown
15
15
  <template #overlay>
16
- <Menu @click="handleMenuClick">
16
+ <Menu @select="handleMenuClick">
17
17
  <MenuItem key="1">
18
18
  <Icon :type="PersonAddOutline" />
19
19
  1st menu item
@@ -31,7 +31,7 @@ const Card = defineComponent({
31
31
  {titleNode}
32
32
  {extraNode}
33
33
  </div>
34
- {selfSlot ? <div class="k-card-body">{selfSlot}</div> : null}
34
+ {selfSlot ? <div class="k-card-body k-scroll">{selfSlot}</div> : null}
35
35
  </div>
36
36
  );
37
37
  };
@@ -1,5 +1,5 @@
1
1
  import Checkbox from "./checkbox";
2
- import { defineComponent, watch, toRefs } from "vue";
2
+ import { defineComponent, watch, toRefs, computed } from "vue";
3
3
  import { withInstall } from "../utils/vue";
4
4
  import { getChildren } from "../utils/element";
5
5
 
@@ -57,7 +57,7 @@ const CheckboxGroup = defineComponent({
57
57
  emit("change", val);
58
58
  };
59
59
 
60
- const optionsData = () => {
60
+ const optionsData = computed(() => {
61
61
  let { options } = props;
62
62
  if (!options) {
63
63
  options = [];
@@ -74,10 +74,10 @@ const CheckboxGroup = defineComponent({
74
74
  });
75
75
  }
76
76
  return options;
77
- };
77
+ });
78
78
 
79
79
  return () => {
80
- let options = optionsData();
80
+ let options = optionsData.value;
81
81
  let nodes = [];
82
82
  options.forEach((option) =>
83
83
  nodes.push(
@@ -7,11 +7,11 @@
7
7
  <template>
8
8
  <Space vertical>
9
9
  use options
10
- <code>value: {{ value1 }}</code>
11
- <CheckboxGroup :options="options" v-model="value1" />
10
+ <code>value: {{ value }}</code>
11
+ <CheckboxGroup :options="options" v-model="value" />
12
12
  <br />
13
13
  use children
14
- <CheckboxGroup v-model="value1" theme="light">
14
+ <CheckboxGroup v-model="value" theme="light">
15
15
  <Checkbox
16
16
  :label="item.label"
17
17
  :value="item.value"
@@ -23,13 +23,24 @@
23
23
  </template>
24
24
  <script setup>
25
25
  import { ref } from "vue";
26
- const value1 = ref(["apple", "grape"]);
27
- const options = [
26
+ const value = ref(["apple", "grape"]);
27
+ const options = ref([
28
28
  { label: "Apple", value: "apple" },
29
29
  { label: "Orange", value: "orange" },
30
30
  { label: "Banana", value: "banana" },
31
31
  { label: "Pear", value: "pear" },
32
32
  { label: "Grape", value: "grape" },
33
- ];
33
+ ]);
34
+
35
+ // 异步更新数据
36
+ setTimeout(() => {
37
+ options.value = [
38
+ { label: "Apple1", value: "apple" },
39
+ { label: "Orange1", value: "orange" },
40
+ { label: "Banana1", value: "banana" },
41
+ { label: "Pear1", value: "pear" },
42
+ { label: "Grape1", value: "grape" },
43
+ ];
44
+ }, 1000);
34
45
  </script>
35
46
  ```
@@ -156,18 +156,11 @@
156
156
  display: inline-flex;
157
157
  flex-shrink: 0;
158
158
  align-items: center;
159
-
160
- .k-checkbox {
161
- margin-right: 16px;
162
- }
159
+ flex-wrap: wrap;
160
+ gap: 16px;
163
161
  }
164
162
 
165
163
  .k-checkbox-group-vertical {
166
- display: block;
167
-
168
- .k-checkbox {
169
- display: block;
170
- margin-right: 0;
171
- margin-bottom: 16px;
172
- }
164
+ flex-direction: column;
165
+ align-items: self-start;
173
166
  }
@@ -72,12 +72,11 @@ const ColorPicker = defineComponent({
72
72
  },
73
73
 
74
74
  setup(ps, { emit, slots }) {
75
- // todo 编码格式 时, 要双击 才能先中.
76
75
  const currentMode = ref(ps.mode);
77
76
  const currentColor = ref(ps.value || "#000000ff");
78
77
  const visible = ref(ps.show);
79
78
  const refPopper = ref();
80
- const refCtx = ref();
79
+ const refSelection = ref();
81
80
  const left = ref(0);
82
81
  const top = ref(0);
83
82
  const currentPlacement = ref(ps.placement);
@@ -107,7 +106,7 @@ const ColorPicker = defineComponent({
107
106
  const updatePopPosition = () => {
108
107
  nextTick(() => {
109
108
  setPlacement({
110
- refCtx,
109
+ refSelection,
111
110
  refPopper,
112
111
  currentPlacement,
113
112
  transOrigin,
@@ -117,7 +116,7 @@ const ColorPicker = defineComponent({
117
116
  });
118
117
  };
119
118
  const outsideClick = (e) => {
120
- const ctx = refCtx.value?.$el || refCtx.value;
119
+ const ctx = refSelection.value?.$el || refSelection.value;
121
120
  if (
122
121
  refPopper.value &&
123
122
  !refPopper.value.contains(e.target) &&
@@ -327,7 +326,7 @@ const ColorPicker = defineComponent({
327
326
  {cloneNodes(
328
327
  slots.default(),
329
328
  {
330
- ref: refCtx,
329
+ ref: refSelection,
331
330
  on: {
332
331
  click: () => triggerClick && toggle(!visible.value),
333
332
  mouseenter: () => !triggerClick && toggle(true),
@@ -342,7 +341,7 @@ const ColorPicker = defineComponent({
342
341
  {drop}
343
342
  </span>
344
343
  ) : (
345
- <div class={style} ref={refCtx} v-resize={updatePopPosition}>
344
+ <div class={style} ref={refSelection} v-resize={updatePopPosition}>
346
345
  <div
347
346
  class="k-color-picker-selection"
348
347
  onMouseenter={() => !triggerClick && toggle(true)}
@@ -7,13 +7,13 @@
7
7
  <template>
8
8
  <Space class="demo-color-picker" vertical>
9
9
  <Space>
10
- <ColorPicker v-model="color1">
10
+ <ColorPicker v-model:value="color1">
11
11
  <Button type="primary">Open</Button>
12
12
  </ColorPicker>
13
13
  {{ color1 }}
14
14
  </Space>
15
15
  <Space>
16
- <ColorPicker v-model="color2" trigger="hover">
16
+ <ColorPicker v-model:value="color2" trigger="hover">
17
17
  <Button type="primary">Hover</Button>
18
18
  </ColorPicker>
19
19
  {{ color2 }}
@@ -8,10 +8,7 @@
8
8
  <Space class="demo-color-picker" vertical>
9
9
  <Space> <ColorPicker v-model="color1" /> HEX: {{ color1 }} </Space>
10
10
  <Space>
11
- <ColorPicker v-model="color2" mode="rgb" /> RGB: {{ color2 }}
12
- </Space>
13
- <Space>
14
- <ColorPicker v-model="color3" mode="hsl" /> HSL: {{ color3 }}
11
+ <ColorPicker v-model:value="color3" mode="hsl" /> HSL: {{ color3 }}
15
12
  </Space>
16
13
  </Space>
17
14
  </template>
@@ -122,7 +122,7 @@ const DatePicker = defineComponent({
122
122
  const top = ref(0);
123
123
  const transOrigin = ref("bottom");
124
124
  const refPopper = ref(null);
125
- const refCtx = ref(null);
125
+ const refSelection = ref(null);
126
126
  // console.log(local);
127
127
 
128
128
  // DOM 引用,用于滚动计算
@@ -218,7 +218,6 @@ const DatePicker = defineComponent({
218
218
 
219
219
  const syncTextFromValue = () => {
220
220
  const fmt = getFormat();
221
- const fmtDate = (d) => (d ? d.locale(localeName.value).format(fmt) : "");
222
221
  // 空值
223
222
  if (!innerValue.value) {
224
223
  textValue.value = "";
@@ -227,13 +226,12 @@ const DatePicker = defineComponent({
227
226
  return;
228
227
  }
229
228
 
229
+ const fmtDate = (d) => (d ? d.locale(localeName.value).format(fmt) : "");
230
230
  // Range 模式
231
231
  if (Array.isArray(innerValue.value)) {
232
232
  const [start, end] = innerValue.value;
233
233
  textValueStart.value = start ? start.format(fmt) : "";
234
234
  textValueEnd.value = end ? end.format(fmt) : "";
235
- // 兼容单 input 显示 (虽然现在是双input,保留逻辑防止出错)
236
- textValue.value = innerValue.value.map((d) => fmtDate(d)).join(" - ");
237
235
  } else {
238
236
  textValue.value = fmtDate(innerValue.value);
239
237
  }
@@ -245,7 +243,11 @@ const DatePicker = defineComponent({
245
243
  if (props.valueType === "unix") {
246
244
  d = dayjs.unix(Number(val));
247
245
  } else {
248
- d = dayjs(val);
246
+ const fmt = getFormat();
247
+ d = dayjs(val, fmt, localeName.value);
248
+ if (!d.isValid()) {
249
+ d = dayjs(val);
250
+ }
249
251
  }
250
252
 
251
253
  return d.isValid() ? d.locale(localeName.value) : null;
@@ -406,7 +408,7 @@ const DatePicker = defineComponent({
406
408
  };
407
409
 
408
410
  const handleClickOutside = (e) => {
409
- const ctx = refCtx.value;
411
+ const ctx = refSelection.value;
410
412
  const popper = refPopper.value;
411
413
  if (
412
414
  popper &&
@@ -414,9 +416,9 @@ const DatePicker = defineComponent({
414
416
  ctx &&
415
417
  !ctx.contains(e.target)
416
418
  ) {
419
+ syncTextFromValue();
417
420
  isVisible.value = false;
418
421
  isFocus.value = false;
419
- syncTextFromValue();
420
422
  }
421
423
  };
422
424
  const timeLabelClick = (e, direction) => {
@@ -795,7 +797,10 @@ const DatePicker = defineComponent({
795
797
  i === curr ? "active" : "",
796
798
  isDisabled ? "k-picker-time-disabled" : "",
797
799
  ]}
798
- onClick={() => !isDisabled && handleTimeScrollPick(type, i)}
800
+ onClick={(e) => {
801
+ e.stopPropagation();
802
+ !isDisabled && handleTimeScrollPick(type, i);
803
+ }}
799
804
  >
800
805
  {String(i).padStart(2, "0")}
801
806
  </li>
@@ -878,7 +883,7 @@ const DatePicker = defineComponent({
878
883
  const updatePosition = () => {
879
884
  nextTick(() => {
880
885
  setPlacement({
881
- refCtx,
886
+ refSelection,
882
887
  refPopper,
883
888
  currentPlacement,
884
889
  transOrigin,
@@ -913,7 +918,10 @@ const DatePicker = defineComponent({
913
918
  { "k-datepicker-light": props.theme == "light" },
914
919
  { "k-datepicker-circle": props.shape == "circle" },
915
920
  ];
916
- const showClear = props.clearable && textValue.value && !props.disabled;
921
+ const showClear =
922
+ props.clearable &&
923
+ (textValue.value || (textValueStart.value && textValueStart.value)) &&
924
+ !props.disabled;
917
925
  const selectCls = [
918
926
  "k-datepicker-selection",
919
927
  {
@@ -1067,7 +1075,7 @@ const DatePicker = defineComponent({
1067
1075
  ) : null;
1068
1076
 
1069
1077
  return (
1070
- <div class={classes} ref={refCtx} tabindex={0}>
1078
+ <div class={classes} ref={refSelection} tabindex={0}>
1071
1079
  <div class={selectCls} onClick={togglePanel}>
1072
1080
  {renderInput()}
1073
1081
  <Icon type={dateIcon} class="k-icon-calendar" />
@@ -6,15 +6,24 @@
6
6
  ```vue
7
7
  <template>
8
8
  <Space wrap vertical>
9
- <DatePicker mode="year" />
10
- <DatePicker mode="month" />
11
- <DatePicker mode="date" />
12
- <DatePicker mode="time" @change="(v) => console.log(v)" />
13
- <DatePicker mode="dateTime" v-model="value" />
9
+ <code>v-model : {{ year }}</code>
10
+ <DatePicker mode="year" v-model="year"/>
11
+ <code>v-model : {{ month }}</code>
12
+ <DatePicker mode="month" v-model="month"/>
13
+ <code>v-model : {{ date }}</code>
14
+ <DatePicker mode="date" v-model="date"/>
15
+ <code>v-model : {{ time }}</code>
16
+ <DatePicker mode="time" v-model="time" />
17
+ <code>v-model : {{ datetime }}</code>
18
+ <DatePicker mode="dateTime" v-model="datetime" />
14
19
  </Space>
15
20
  </template>
16
21
  <script setup>
17
22
  import { ref } from "vue";
18
- const value = ref("2021-01-01 20:20:20");
23
+ const datetime = ref("2021-01-01 20:20:20");
24
+ const time = ref("20:20:20");
25
+ const year = ref("2025");
26
+ const month = ref("2025-10");
27
+ const date = ref("2025-12-12");
19
28
  </script>
20
29
  ```
@@ -19,7 +19,7 @@ import { ref } from "vue";
19
19
  import dayjs from "dayjs";
20
20
  const value = ref("2021-01-01 20:20:20");
21
21
 
22
- import "dayjs/locale/en-gb";
23
- dayjs.locale("en-gb");
22
+ import "dayjs/locale/en";
23
+ dayjs.locale("en");
24
24
  </script>
25
25
  ```
@@ -186,9 +186,9 @@ const Drawer = defineComponent({
186
186
  ];
187
187
  let styles = {};
188
188
  if (placement == "left" || placement == "right")
189
- styles.width = /%/.test(width) ? width : width + "px";
189
+ styles.width = typeof width === "number" ? `${width}px` : width;
190
190
  if (placement == "top" || placement == "bottom")
191
- styles.height = /%/.test(height) ? height : height + "px";
191
+ styles.height = typeof height === "number" ? `${height}px` : height;
192
192
 
193
193
  let maskNode = null;
194
194
  if (ps.mask) {
@@ -55,7 +55,7 @@ const Dropdown = defineComponent({
55
55
 
56
56
  setup(ps, { slots, emit, attrs, listeners }) {
57
57
  const visible = ref(ps.show);
58
- const refCtx = ref(null);
58
+ const refSelection = ref(null);
59
59
  const currentPlacement = ref(ps.placement);
60
60
  const transOrigin = ref("bottom");
61
61
  const refPopper = ref();
@@ -90,7 +90,7 @@ const Dropdown = defineComponent({
90
90
  );
91
91
 
92
92
  const outsideClick = (e) => {
93
- const ctx = refCtx.value?.$el || refCtx.value;
93
+ const ctx = refSelection.value?.$el || refSelection.value;
94
94
  if (!refPopper.value) return;
95
95
  if (
96
96
  (!refPopper.value.contains(e.target) &&
@@ -101,10 +101,12 @@ const Dropdown = defineComponent({
101
101
  visible.value = false;
102
102
  }
103
103
  };
104
- const updatePosition = () => {
104
+ const updatePosition = (e) => {
105
+ const position = e ? { x: e.clientX, y: e.clientY } : null;
105
106
  nextTick(() => {
106
107
  setPlacement({
107
- refCtx,
108
+ refSelection,
109
+ position,
108
110
  refPopper,
109
111
  currentPlacement,
110
112
  transOrigin,
@@ -113,39 +115,6 @@ const Dropdown = defineComponent({
113
115
  });
114
116
  });
115
117
  };
116
- const showContextmenu = (e) => {
117
- if (!refPopper.value) return;
118
- // todo : when the menu is opened, then resize the window at this time, the position is not accurate.
119
- let pickerHeight = refPopper.value.offsetHeight;
120
- let pickerWidth = refPopper.value.offsetWidth;
121
- let clientHeight = document.documentElement.clientHeight;
122
- let clientWidth = document.documentElement.clientWidth;
123
-
124
- let offsetTop =
125
- document.body.scrollTop ||
126
- document.documentElement.scrollTop ||
127
- window.scrollY;
128
- let offsetLeft =
129
- document.body.scrollLeft ||
130
- document.documentElement.scrollLeft ||
131
- window.scrollX;
132
- let x = e.clientX + offsetLeft;
133
- let y = e.clientY + offsetTop;
134
- let showInRight = clientWidth - e.clientX > pickerWidth;
135
- let showInBottom = clientHeight - e.clientY > pickerHeight;
136
- let transformOrigin = "top center";
137
-
138
- if (!showInRight) {
139
- x -= pickerWidth;
140
- }
141
- if (!showInBottom) {
142
- y -= pickerHeight;
143
- transformOrigin = "bottom center";
144
- }
145
- left.value = x;
146
- top.value = y;
147
- transOrigin.value = transformOrigin;
148
- };
149
118
  const toggle = (open, e) => {
150
119
  if (open) {
151
120
  if (!rendered.value) {
@@ -154,12 +123,12 @@ const Dropdown = defineComponent({
154
123
  nextTick(() => {
155
124
  visible.value = true;
156
125
  emit("update:visible", true);
157
- e ? showContextmenu(e) : updatePosition();
126
+ updatePosition(e);
158
127
  });
159
128
  } else {
160
129
  visible.value = true;
161
130
  emit("update:visible", true);
162
- e ? showContextmenu(e) : updatePosition();
131
+ updatePosition(e);
163
132
  }
164
133
  } else {
165
134
  visible.value = false;
@@ -298,7 +267,7 @@ const Dropdown = defineComponent({
298
267
  const ctxNode = cloneVNode(
299
268
  nodes.length == 1 ? nodes[0] : <span>{nodes}</span>,
300
269
  {
301
- ref: refCtx,
270
+ ref: refSelection,
302
271
  ...pp,
303
272
  },
304
273
  true,
@@ -131,6 +131,7 @@ const validateReadme = (rule, value, callback) => {
131
131
  const labelCol = { span: 6 };
132
132
  const wrapperCol = { span: 16 };
133
133
  const time = ref(60);
134
+ const timer = ref(null);
134
135
  const size = ref("default");
135
136
  const formRef = ref(null);
136
137
  const treeData = [
@@ -23,6 +23,7 @@ const KImage = defineComponent({
23
23
  height: [String, Number],
24
24
  width: [String, Number],
25
25
  placeholder: String,
26
+ data: Array,
26
27
  imgStyle: Object,
27
28
  showPanel: Boolean,
28
29
  },
@@ -9,7 +9,7 @@
9
9
  | prefix | 扩展前缀 | String,Slot | - |
10
10
  | search | 搜索事件的回调 | Function | right |
11
11
  | theme | theme='light' 时呈现浅色主题 | String | right |
12
- | clearable | 是否现示清除按钮 | Boolean | false |
12
+ | clearable | 是否显示清除按钮 | Boolean | false |
13
13
  | visiblePassword | 密码出事化明文显示 | Boolean | false |
14
14
  | visiblePasswordIcon | 是否显示切换按钮或者控制密码显隐 | Boolean | true |
15
15
 
@@ -5,12 +5,19 @@
5
5
 
6
6
  ```vue
7
7
  <template>
8
- <Space style="font-size:12px;" vertical>
8
+ <Space style="font-size:12px;max-width:200px" block vertical>
9
9
  <InputNumber v-model="value" />
10
- <ButtonGroup>
11
- <Button @click="value-=1">-</Button>
12
- <Button @click="value+=1">+</Button>
13
- </ButtonGroup>
10
+
11
+ <code>readonly</code>
12
+ <InputNumber v-model="value" readonly />
13
+ <code>disabled</code>
14
+ <InputNumber v-model="value" disabled />
15
+ <code>group</code>
16
+ <InputGroup>
17
+ <Button @click="value -= 1" theme="outline">-</Button>
18
+ <InputNumber v-model="value" :controls="false" />
19
+ <Button @click="value += 1" theme="outline">+</Button>
20
+ </InputGroup>
14
21
  </Space>
15
22
  </template>
16
23
  <script setup>
@@ -34,11 +34,6 @@
34
34
  :formatter="(value) => `${value}%`"
35
35
  :parser="(value) => value.replace('%', '')"
36
36
  />
37
- <code>只能输入数字,输出: {{ n6 }}</code>
38
- <InputNumber
39
- v-model="n6"
40
- :formatter="(value) => value.replace(/\D/g, '')"
41
- />
42
37
  <code>自定义 ,输出:{{ n7 }}</code>
43
38
  <InputNumber
44
39
  v-model="n7"
@@ -15,4 +15,4 @@
15
15
  | suffix | 自定义后缀 | String,slot | - |
16
16
  | prefix | 前缀内容 | String,slot | - |
17
17
  | controls | 是否显示增减按钮 | Boolean | true |
18
- | clearable | 是否现示清除按钮 | Boolean | false |
18
+ | clearable | 是否显示清除按钮 | Boolean | false |
@@ -103,7 +103,6 @@ const InputNumber = defineComponent({
103
103
  : subtract(String(outputValue.value), String(step));
104
104
  const { input, output } = getValue(value, true);
105
105
 
106
- // console.log(input,output)
107
106
  // return
108
107
  inputValue.value = input;
109
108
  outputValue.value = output;
@@ -125,7 +124,6 @@ const InputNumber = defineComponent({
125
124
  const onUpdate = (e) => {
126
125
  const v = e; //.target.value;
127
126
  const { input, output } = getValue(v, false, false);
128
- // console.log("update", `origin: ${v}`, `input: ${input}`, `output: ${output}`);
129
127
  inputValue.value = input;
130
128
  // e.target.value = input;
131
129
 
@@ -152,7 +150,7 @@ const InputNumber = defineComponent({
152
150
  );
153
151
  const blurHandle = (e) => {
154
152
  const { input, output } = getValue(outputValue.value, true, true);
155
-
153
+ // console.log(input, output)
156
154
  inputValue.value = input;
157
155
  outputValue.value = output;
158
156
  emit("input", output);
@@ -163,7 +161,7 @@ const InputNumber = defineComponent({
163
161
  // const { suffix } = ps;
164
162
 
165
163
  const props = {
166
- attrs: { ...attrs },
164
+ attrs: { ...attrs, readonly: ps.readonly },
167
165
  // ...ps,
168
166
  props: {
169
167
  inputType: "input-number",
@@ -200,7 +198,7 @@ const InputNumber = defineComponent({
200
198
  suffix: () => slots.suffix?.(),
201
199
  prefix: () => slots.prefix?.(),
202
200
  controls: () =>
203
- ps.controls ? (
201
+ ps.controls && !ps.readonly ? (
204
202
  <div class="k-input-number-controls">
205
203
  <span
206
204
  class="k-input-number-control"