kui-vue 3.6.1 → 3.6.2
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.
- package/components/button/demo/size.md +1 -1
- package/components/checkbox/checkbox.jsx +17 -16
- package/components/checkbox/checkboxGroup.jsx +1 -1
- package/components/collapse/collapse.jsx +9 -10
- package/components/collapse/demo/accordion.md +2 -2
- package/components/collapse/demo/basic.md +2 -2
- package/components/collapse/demo/extra.md +2 -2
- package/components/collapse/demo/nesting.md +4 -4
- package/components/collapse/demo/sample.md +2 -2
- package/components/collapse/index.md +6 -6
- package/components/colorPicker/demo/basic.md +14 -2
- package/components/colorPicker/demo/index.jsx +0 -8
- package/components/colorPicker/demo/size.md +24 -10
- package/components/datePicker/demo/size.md +1 -1
- package/components/dropdown/dropdownButton.jsx +18 -7
- package/components/empty/demo/basic.md +1 -3
- package/components/empty/demo/nodesc.md +1 -3
- package/components/empty/demo/used.md +4 -6
- package/components/empty/empty.jsx +19 -17
- package/components/empty/styles/index.less +18 -5
- package/components/form/demo/align.md +10 -10
- package/components/form/demo/valid.md +2 -2
- package/components/form/form.jsx +1 -1
- package/components/form/formitem.jsx +1 -1
- package/components/image/preview.jsx +1 -1
- package/components/input/demo/basic.md +1 -1
- package/components/input/demo/group.md +1 -1
- package/components/input/input.jsx +7 -5
- package/components/input/inputBox.jsx +2 -2
- package/components/message/demo/close.md +1 -1
- package/components/message/group.jsx +2 -2
- package/components/message/index.md +1 -1
- package/components/message/inner.jsx +26 -7
- package/components/notice/demo/close.md +1 -1
- package/components/notice/index.md +1 -1
- package/components/page/styles/index.less +7 -1
- package/components/popconfirm/popconfirm.jsx +14 -16
- package/components/progress/progress.jsx +1 -1
- package/components/radio/radio.jsx +14 -11
- package/components/radio/radioButton.jsx +1 -1
- package/components/radio/radioGroup.jsx +1 -1
- package/components/rate/demo/basic.md +12 -2
- package/components/rate/demo/character.md +16 -2
- package/components/rate/demo/index.jsx +0 -8
- package/components/rate/demo/tips.md +15 -5
- package/components/rate/rate.jsx +24 -5
- package/components/select/demo/size.md +1 -1
- package/components/select/select.jsx +0 -1
- package/components/space/styles/index.less +3 -1
- package/components/spin/index.md +6 -5
- package/components/switch/switch.jsx +1 -3
- package/components/table/demo/size.md +1 -1
- package/components/tabs/tabs.jsx +1 -1
- package/components/tooltip/tooltip.jsx +13 -8
- package/components/treeselect/demo/basic.md +11 -8
- package/components/treeselect/demo/size.md +4 -3
- package/components/treeselect/demo/theme.md +0 -1
- package/components/upload/upload.jsx +0 -1
- package/components/utils/placement.js +58 -31
- package/dist/k-ui.cjs.js +2 -2
- package/dist/k-ui.css +2 -2
- package/dist/k-ui.d.ts +187 -186
- package/dist/k-ui.esm.js +2 -2
- package/dist/k-ui.umd.js +2 -2
- package/dist/locale/de.js +1 -1
- package/dist/locale/el.js +1 -1
- package/dist/locale/en.js +1 -1
- package/dist/locale/fr.js +1 -1
- package/dist/locale/it.js +1 -1
- package/dist/locale/ja.js +1 -1
- package/dist/locale/ko.js +1 -1
- package/dist/locale/ru.js +1 -1
- package/dist/locale/th.js +1 -1
- package/dist/locale/ua.js +2 -2
- package/dist/locale/uk.js +1 -1
- package/dist/locale/vi.js +1 -1
- package/dist/locale/zh-CN.js +1 -1
- package/dist/locale/zh-TW.js +1 -1
- package/package.json +1 -1
- package/types/checkbox/Checkbox.d.ts +1 -1
- package/types/collapse/Collapse.d.ts +1 -1
- package/types/index.d.ts +16 -16
- package/types/popconfirm/Popconfirm.d.ts +1 -0
- package/types/radio/Radio.d.ts +1 -1
- package/types/radio/RadioButton.d.ts +1 -1
- package/types/switch/Switch.d.ts +1 -2
- package/types/tooltip/Tooltip.d.ts +1 -0
- package/components/base/collapse.jsx +0 -15
- package/components/base/input.jsx +0 -210
- package/components/colorPicker/demo/disabled.md +0 -16
- package/components/colorPicker/demo/disabledAlpha.md +0 -13
- package/components/colorPicker/demo/mode.md +0 -21
- package/components/colorPicker/demo/presets.md +0 -17
- package/components/rate/demo/clear.md +0 -13
- package/components/rate/demo/custom.md +0 -23
- package/components/rate/demo/disabled.md +0 -12
- package/components/rate/demo/half.md +0 -12
- package/components/utils/element.js +0 -122
|
@@ -86,8 +86,8 @@ const Input = defineComponent({
|
|
|
86
86
|
const togglePassword = (e) => {
|
|
87
87
|
if (ps.disabled) return;
|
|
88
88
|
showPassword.value = !showPassword.value;
|
|
89
|
-
let type = showPassword.value ? "text" : "password";
|
|
90
|
-
inputRef.value.type = type;
|
|
89
|
+
// let type = showPassword.value ? "text" : "password";
|
|
90
|
+
// inputRef.value.type = type;
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
const searchEvent = (e) => {
|
|
@@ -158,7 +158,7 @@ const Input = defineComponent({
|
|
|
158
158
|
inputRef: inputRef,
|
|
159
159
|
inputType,
|
|
160
160
|
value: currentValue.value,
|
|
161
|
-
showPassword:
|
|
161
|
+
showPassword: showPassword.value,
|
|
162
162
|
},
|
|
163
163
|
on: {
|
|
164
164
|
...listeners,
|
|
@@ -180,9 +180,11 @@ const Input = defineComponent({
|
|
|
180
180
|
let textInput = <InputBox {...inputProps} />;
|
|
181
181
|
|
|
182
182
|
if (!multiple) return textInput;
|
|
183
|
-
|
|
184
183
|
let clearableShow =
|
|
185
|
-
clearable &&
|
|
184
|
+
clearable &&
|
|
185
|
+
!isEmpty(currentValue.value) &&
|
|
186
|
+
type != "password" &&
|
|
187
|
+
attrs.readonly === undefined;
|
|
186
188
|
const props = {
|
|
187
189
|
class: {
|
|
188
190
|
[`k-${inputType}`]: true,
|
|
@@ -60,8 +60,8 @@ export default defineComponent({
|
|
|
60
60
|
// onBlur: handleBlur,
|
|
61
61
|
// onInput: handleInput,
|
|
62
62
|
};
|
|
63
|
-
if (
|
|
64
|
-
props.type = "text";
|
|
63
|
+
if (ps.showPassword === true && type == "password") {
|
|
64
|
+
props.attrs.type = "text";
|
|
65
65
|
}
|
|
66
66
|
return <input {...props} single />;
|
|
67
67
|
};
|
|
@@ -12,13 +12,13 @@ export default defineComponent({
|
|
|
12
12
|
const group = ref([]);
|
|
13
13
|
|
|
14
14
|
const show = (options) => {
|
|
15
|
-
let { duration,
|
|
15
|
+
let { duration, onClose, closable, noticeType } = options;
|
|
16
16
|
let key = getUuid();
|
|
17
17
|
options.key = key;
|
|
18
18
|
options.duration = isNaN(Number(duration)) ? 3.5 : duration;
|
|
19
19
|
let timer;
|
|
20
20
|
let callback = (key) => {
|
|
21
|
-
typeof
|
|
21
|
+
typeof onClose === "function" && onClose();
|
|
22
22
|
group.value = group.value.filter((item) => item.key !== key);
|
|
23
23
|
clearTimeout(timer);
|
|
24
24
|
timer = null;
|
|
@@ -21,6 +21,6 @@
|
|
|
21
21
|
| content | 提示内容 | String,Vnode | - |
|
|
22
22
|
| duration | 自动关闭的延时,单位秒,0 为 不自动关闭 | Number | 3 |
|
|
23
23
|
| closable | 是否可手动关闭 | Boolean | false |
|
|
24
|
-
|
|
|
24
|
+
| onClose | 关闭时的回调 | Function | - |
|
|
25
25
|
| icon | 自定义图标 | String | - |
|
|
26
26
|
| color | 自定义图标颜色 | String | - |
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import Icon from "../icon";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Close,
|
|
4
|
+
InformationCircle,
|
|
5
|
+
CloseCircle,
|
|
6
|
+
CheckmarkCircle,
|
|
7
|
+
AlertCircle,
|
|
8
|
+
} from "kui-icons";
|
|
3
9
|
import { defineComponent } from "vue";
|
|
4
10
|
export default defineComponent({
|
|
5
11
|
props: {
|
|
@@ -8,13 +14,16 @@ export default defineComponent({
|
|
|
8
14
|
content: [String, Object],
|
|
9
15
|
icon: [String, Array],
|
|
10
16
|
color: String,
|
|
17
|
+
duration: Number,
|
|
11
18
|
closable: Boolean,
|
|
12
19
|
noticeType: { type: String, default: "message" },
|
|
13
|
-
onClose: { type: Function, default: () => { } },
|
|
14
20
|
},
|
|
15
|
-
setup(ps) {
|
|
21
|
+
setup(ps, { emit }) {
|
|
22
|
+
const onClose = () => {
|
|
23
|
+
emit("close");
|
|
24
|
+
};
|
|
16
25
|
return () => {
|
|
17
|
-
let { noticeType, type, content, title,
|
|
26
|
+
let { noticeType, type, content, title, closable, icon, color } = ps;
|
|
18
27
|
const classes = [
|
|
19
28
|
`k-${noticeType}-box`,
|
|
20
29
|
{
|
|
@@ -30,17 +39,27 @@ export default defineComponent({
|
|
|
30
39
|
};
|
|
31
40
|
const children = [];
|
|
32
41
|
if (type in icons) {
|
|
33
|
-
children.push(
|
|
42
|
+
children.push(
|
|
43
|
+
<Icon
|
|
44
|
+
type={icon || icons[type]}
|
|
45
|
+
color={color}
|
|
46
|
+
class={`k-${noticeType}-icon`}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
34
49
|
}
|
|
35
50
|
if (noticeType == "message") {
|
|
36
51
|
children.push(<span>{content}</span>);
|
|
37
52
|
if (closable) {
|
|
38
|
-
children.push(
|
|
53
|
+
children.push(
|
|
54
|
+
<Icon class="k-message-close" type={Close} onClick={onClose} />
|
|
55
|
+
);
|
|
39
56
|
}
|
|
40
57
|
} else {
|
|
41
58
|
children.push(<div class="k-notice-title">{title}</div>);
|
|
42
59
|
children.push(<div class="k-notice-desc">{content}</div>);
|
|
43
|
-
children.push(
|
|
60
|
+
children.push(
|
|
61
|
+
<Icon class="k-notice-close" type={Close} onClick={onClose} />
|
|
62
|
+
);
|
|
44
63
|
}
|
|
45
64
|
return (
|
|
46
65
|
<div class={classes}>
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
| title | 通知提醒的标题 | String | - |
|
|
20
20
|
| content | 提示内容 | String ,vndoe | - |
|
|
21
21
|
| duration | 自动关闭的延时,单位秒,不关闭可以写 0 | Number | 3 |
|
|
22
|
-
|
|
|
22
|
+
| onClose | 关闭时的回调 | Function | - |
|
|
23
23
|
| icon | 自定义图标 | String | - |
|
|
24
24
|
| color | 自定义图标颜色 | String | - |
|
|
@@ -158,7 +158,13 @@
|
|
|
158
158
|
cursor: not-allowed;
|
|
159
159
|
.k-pager-item {
|
|
160
160
|
color: var(--kui-color-disabled);
|
|
161
|
-
border-color: var(--kui-color-
|
|
161
|
+
border-color: var(--kui-color-disable-border);
|
|
162
|
+
}
|
|
163
|
+
.k-pager-item-active {
|
|
164
|
+
color: var(--kui-color-disabled);
|
|
165
|
+
:hover {
|
|
166
|
+
color: var(--kui-color-disabled);
|
|
167
|
+
}
|
|
162
168
|
}
|
|
163
169
|
* {
|
|
164
170
|
cursor: not-allowed;
|
|
@@ -23,6 +23,7 @@ const Popconfirm = defineComponent({
|
|
|
23
23
|
},
|
|
24
24
|
props: {
|
|
25
25
|
dark: Boolean,
|
|
26
|
+
show: Boolean,
|
|
26
27
|
title: [String, Number, Object, Array],
|
|
27
28
|
size: String,
|
|
28
29
|
width: [Number, String],
|
|
@@ -100,6 +101,10 @@ const Popconfirm = defineComponent({
|
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
);
|
|
104
|
+
const updateShow = (value) => {
|
|
105
|
+
visible.value = value;
|
|
106
|
+
emit("update:show", value);
|
|
107
|
+
};
|
|
103
108
|
const outsideClick = (e) => {
|
|
104
109
|
const ctx = refSelection.value?.$el || refSelection.value;
|
|
105
110
|
if (
|
|
@@ -108,7 +113,7 @@ const Popconfirm = defineComponent({
|
|
|
108
113
|
ctx &&
|
|
109
114
|
!ctx.contains(e.target)
|
|
110
115
|
) {
|
|
111
|
-
|
|
116
|
+
updateShow(false);
|
|
112
117
|
}
|
|
113
118
|
};
|
|
114
119
|
const mouseEnter = () => {
|
|
@@ -116,29 +121,22 @@ const Popconfirm = defineComponent({
|
|
|
116
121
|
rendered.value = true;
|
|
117
122
|
document.addEventListener("click", outsideClick);
|
|
118
123
|
nextTick(() => {
|
|
119
|
-
|
|
124
|
+
updateShow(true);
|
|
120
125
|
updatePosition();
|
|
121
126
|
});
|
|
122
127
|
} else {
|
|
123
128
|
clearTimeout(showTimer.value);
|
|
124
|
-
|
|
129
|
+
updateShow(true);
|
|
125
130
|
updatePosition();
|
|
126
131
|
}
|
|
127
132
|
};
|
|
128
|
-
const hide = () => {
|
|
129
|
-
hideTimer.value = setTimeout(() => {
|
|
130
|
-
if (!ps.show) {
|
|
131
|
-
visible.value = false;
|
|
132
|
-
}
|
|
133
|
-
}, 300);
|
|
134
|
-
};
|
|
135
133
|
const ok = () => {
|
|
136
|
-
|
|
134
|
+
updateShow(false);
|
|
137
135
|
emit("ok");
|
|
138
136
|
};
|
|
139
137
|
|
|
140
138
|
const cancel = () => {
|
|
141
|
-
|
|
139
|
+
updateShow(false);
|
|
142
140
|
emit("cancel");
|
|
143
141
|
};
|
|
144
142
|
return () => {
|
|
@@ -183,24 +181,24 @@ const Popconfirm = defineComponent({
|
|
|
183
181
|
on: {
|
|
184
182
|
mouseenter: () => {
|
|
185
183
|
clearTimeout(hideTimer.value);
|
|
186
|
-
|
|
184
|
+
updateShow(true);
|
|
187
185
|
},
|
|
188
186
|
mouseleave: () => {
|
|
189
187
|
showTimer.value = setTimeout(() => {
|
|
190
188
|
if (!ps.show) {
|
|
191
|
-
|
|
189
|
+
updateShow(false);
|
|
192
190
|
}
|
|
193
191
|
}, 300);
|
|
194
192
|
},
|
|
195
193
|
},
|
|
196
194
|
// onMouseenter: () => {
|
|
197
195
|
// clearTimeout(hideTimer.value);
|
|
198
|
-
//
|
|
196
|
+
// updateShow(true;
|
|
199
197
|
// },
|
|
200
198
|
// onMouseleave: () => {
|
|
201
199
|
// showTimer.value = setTimeout(() => {
|
|
202
200
|
// if (!ps.show) {
|
|
203
|
-
//
|
|
201
|
+
// updateShow(false;
|
|
204
202
|
// }
|
|
205
203
|
// }, 300);
|
|
206
204
|
// },
|
|
@@ -89,7 +89,7 @@ const Progress = defineComponent({
|
|
|
89
89
|
// front color
|
|
90
90
|
style = {
|
|
91
91
|
strokeDasharray: `${(percent / 100) * (len - (dashboard ? gap : 0))}px ${len}px`, //长度,间距 ,实线和虚线的长度
|
|
92
|
-
transition: `stroke-dasharray .3s ease 0s
|
|
92
|
+
transition: `stroke-dasharray .3s ease 0s,opacity 0.3s ease 0s`,
|
|
93
93
|
strokeDashoffset: dashboard ? -gap / 2 : 0,
|
|
94
94
|
stroke: strokeColor,
|
|
95
95
|
strokeLinecap: strokeLinecap,
|
|
@@ -14,7 +14,7 @@ const Radio = defineComponent({
|
|
|
14
14
|
|
|
15
15
|
// [Vue 3 Upgrade]: Vue 2 use checked & model
|
|
16
16
|
checked: {
|
|
17
|
-
type: Boolean,
|
|
17
|
+
type: [Boolean, Number],
|
|
18
18
|
default: false,
|
|
19
19
|
},
|
|
20
20
|
value: { type: [String, Number, Boolean] },
|
|
@@ -40,25 +40,28 @@ const Radio = defineComponent({
|
|
|
40
40
|
}
|
|
41
41
|
);
|
|
42
42
|
|
|
43
|
-
const
|
|
44
|
-
if (props.disabled || isChecked.value) return;
|
|
45
|
-
const checked = e.target.checked;
|
|
46
|
-
|
|
43
|
+
const emitValue = (checked) => {
|
|
47
44
|
isChecked.value = checked;
|
|
48
|
-
// [Vue 3 Upgrade]: emit("update:modelValue", targetChecked);
|
|
49
45
|
emit("change", {
|
|
50
46
|
checked: checked,
|
|
51
47
|
value: props.value,
|
|
52
|
-
label: props.label,
|
|
48
|
+
label: props.label || slots.default?.(),
|
|
53
49
|
});
|
|
54
50
|
emit("input", checked);
|
|
55
51
|
};
|
|
56
|
-
const
|
|
57
|
-
|
|
52
|
+
const onChange = (e) => {
|
|
53
|
+
if (props.disabled || isChecked.value) return;
|
|
54
|
+
const checked = e.target.checked;
|
|
55
|
+
e.preventDefault();
|
|
56
|
+
e.stopPropagation();
|
|
57
|
+
emitValue(checked);
|
|
58
|
+
};
|
|
59
|
+
const triggerCheck = (e) => {
|
|
58
60
|
if (e.code == "Space") {
|
|
59
|
-
onChange({ target: { checked: !isChecked.value } });
|
|
60
61
|
e.preventDefault();
|
|
61
62
|
e.stopPropagation();
|
|
63
|
+
if (props.disabled || isChecked.value) return;
|
|
64
|
+
emitValue(!isChecked.value);
|
|
62
65
|
}
|
|
63
66
|
};
|
|
64
67
|
return () => {
|
|
@@ -76,7 +79,7 @@ const Radio = defineComponent({
|
|
|
76
79
|
const labelNode = props.label || slots.default?.();
|
|
77
80
|
|
|
78
81
|
return (
|
|
79
|
-
<label class={classes} tabindex="0" onKeydown={
|
|
82
|
+
<label class={classes} tabindex="0" onKeydown={triggerCheck}>
|
|
80
83
|
<span class="k-radio-symbol">
|
|
81
84
|
<input
|
|
82
85
|
type="radio"
|
|
@@ -2,7 +2,7 @@ import { defineComponent, ref, watch, computed } from "vue";
|
|
|
2
2
|
import Radio from "./radio.jsx";
|
|
3
3
|
import RadioButton from "./radioButton.jsx";
|
|
4
4
|
import { withInstall } from "../utils/vue";
|
|
5
|
-
import { getChildren } from "../utils/
|
|
5
|
+
import { getChildren } from "../utils/vnode";
|
|
6
6
|
|
|
7
7
|
const RadioGroup = defineComponent({
|
|
8
8
|
name: "RadioGroup",
|
|
@@ -6,13 +6,23 @@
|
|
|
6
6
|
```vue
|
|
7
7
|
<template>
|
|
8
8
|
<Space vertical>
|
|
9
|
+
<code>v-model: {{ value }}</code>
|
|
10
|
+
<Rate v-model="value" />
|
|
11
|
+
<code>show score</code>
|
|
12
|
+
<Rate :value="2.5" showScore />
|
|
13
|
+
<code>size = 30</code>
|
|
9
14
|
<Rate :size="30" :value="2" />
|
|
10
|
-
<
|
|
15
|
+
<code>custom icon</code>
|
|
16
|
+
<Rate :icon="Heart" color="red" :value="2.5" :size="30" />
|
|
17
|
+
<code>allowHalf = true</code>
|
|
11
18
|
<Rate :icon="Heart" allowHalf color="red" :value="2.5" :size="30" />
|
|
12
|
-
|
|
19
|
+
<code>disabled (readonly)</code>
|
|
20
|
+
<Rate :value="3.7" disabled showScore/>
|
|
13
21
|
</Space>
|
|
14
22
|
</template>
|
|
15
23
|
<script setup>
|
|
24
|
+
import { ref } from "vue";
|
|
16
25
|
import { Heart } from "kui-icons";
|
|
26
|
+
const value = ref(3);
|
|
17
27
|
</script>
|
|
18
28
|
```
|
|
@@ -7,11 +7,25 @@
|
|
|
7
7
|
<template>
|
|
8
8
|
<Space vertical>
|
|
9
9
|
<Rate :icon="Heart" allowHalf :value="1.5" />
|
|
10
|
-
<
|
|
10
|
+
<code>character = A</code>
|
|
11
|
+
<Rate character="A" allowHalf :value="2.5" />
|
|
12
|
+
<code>character = 龍</code>
|
|
11
13
|
<Rate character="龍" allowHalf :value="3.5" :size="24" />
|
|
14
|
+
<br />
|
|
15
|
+
<code>count = 9</code>
|
|
16
|
+
<Rate :character="(i) => i" :value="2" :count="9" />
|
|
17
|
+
<Rate :icon="(i) => icons[i - 1]" :value="3" />
|
|
12
18
|
</Space>
|
|
13
19
|
</template>
|
|
14
20
|
<script setup>
|
|
15
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
Heart,
|
|
23
|
+
VolumeOff,
|
|
24
|
+
VolumeLow,
|
|
25
|
+
VolumeMedium,
|
|
26
|
+
VolumeHigh,
|
|
27
|
+
VolumeMute,
|
|
28
|
+
} from "kui-icons";
|
|
29
|
+
const icons = [VolumeOff, VolumeLow, VolumeMedium, VolumeHigh, VolumeMute];
|
|
16
30
|
</script>
|
|
17
31
|
```
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import Info from "./info.md";
|
|
2
2
|
import Basic from './basic.md';
|
|
3
|
-
import Half from "./half.md";
|
|
4
3
|
import Tips from "./tips.md";
|
|
5
|
-
import Disabled from "./disabled.md";
|
|
6
|
-
import Clear from "./clear.md";
|
|
7
4
|
import Character from "./character.md";
|
|
8
|
-
import Custom from "./custom.md";
|
|
9
5
|
|
|
10
6
|
import CN from "../index.md";
|
|
11
7
|
export default {
|
|
@@ -14,12 +10,8 @@ export default {
|
|
|
14
10
|
<div class="demo-rate">
|
|
15
11
|
<Info />
|
|
16
12
|
<Basic />
|
|
17
|
-
<Half />
|
|
18
13
|
<Tips />
|
|
19
|
-
<Disabled />
|
|
20
|
-
<Clear />
|
|
21
14
|
<Character />
|
|
22
|
-
<Custom />
|
|
23
15
|
<CN />
|
|
24
16
|
</div>
|
|
25
17
|
);
|
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
<cn>
|
|
2
|
-
### 文案展现
|
|
2
|
+
### 文案展现 / 允许清除
|
|
3
3
|
给评分组件加上文案展示。
|
|
4
4
|
</cn>
|
|
5
5
|
|
|
6
6
|
```vue
|
|
7
7
|
<template>
|
|
8
|
-
<Space>
|
|
9
|
-
<
|
|
10
|
-
|
|
8
|
+
<Space vertical>
|
|
9
|
+
<Space>
|
|
10
|
+
<Rate :tooltips="desc" v-model="value" />
|
|
11
|
+
{{ tipText }}
|
|
12
|
+
</Space>
|
|
13
|
+
<br />
|
|
14
|
+
<code>allowClear = true</code>
|
|
15
|
+
<Rate :allowClear="true" :value="3" />
|
|
16
|
+
<code>allowClear = false</code>
|
|
17
|
+
<Rate :allowClear="false" :value="3" />
|
|
11
18
|
</Space>
|
|
12
19
|
</template>
|
|
13
20
|
<script setup>
|
|
14
|
-
import { ref } from "vue";
|
|
21
|
+
import { ref, computed } from "vue";
|
|
15
22
|
const value = ref(3);
|
|
16
23
|
const desc = ["terrible", "bad", "normal", "good", "wonderful"];
|
|
24
|
+
const tipText = computed(() => {
|
|
25
|
+
return desc[value.value - 1];
|
|
26
|
+
});
|
|
17
27
|
</script>
|
|
18
28
|
```
|
package/components/rate/rate.jsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Star from "./star";
|
|
2
|
-
import { defineComponent, ref } from "vue";
|
|
3
|
-
import { withInstall } from
|
|
2
|
+
import { defineComponent, ref, watch } from "vue";
|
|
3
|
+
import { withInstall } from "../utils/vue";
|
|
4
4
|
const Rate = defineComponent({
|
|
5
5
|
name: "Rate",
|
|
6
6
|
props: {
|
|
@@ -20,6 +20,12 @@ const Rate = defineComponent({
|
|
|
20
20
|
const initValue = ref(ps.value);
|
|
21
21
|
const tempValue = ref();
|
|
22
22
|
const cleared = ref(false);
|
|
23
|
+
watch(
|
|
24
|
+
() => ps.value,
|
|
25
|
+
(v) => {
|
|
26
|
+
initValue.value = v;
|
|
27
|
+
}
|
|
28
|
+
);
|
|
23
29
|
const update = (t, index, percent) => {
|
|
24
30
|
if (t == "M") {
|
|
25
31
|
if (cleared.value) return;
|
|
@@ -41,6 +47,7 @@ const Rate = defineComponent({
|
|
|
41
47
|
}
|
|
42
48
|
// emit("update:value", initValue.value); //for 3
|
|
43
49
|
emit("input", initValue.value);
|
|
50
|
+
emit("change", initValue.value);
|
|
44
51
|
}
|
|
45
52
|
};
|
|
46
53
|
|
|
@@ -51,7 +58,17 @@ const Rate = defineComponent({
|
|
|
51
58
|
|
|
52
59
|
return () => {
|
|
53
60
|
const tpValue = tempValue.value || initValue.value;
|
|
54
|
-
let {
|
|
61
|
+
let {
|
|
62
|
+
count,
|
|
63
|
+
allowHalf,
|
|
64
|
+
character,
|
|
65
|
+
disabled,
|
|
66
|
+
tooltips = [],
|
|
67
|
+
icon,
|
|
68
|
+
showScore,
|
|
69
|
+
size,
|
|
70
|
+
color,
|
|
71
|
+
} = ps;
|
|
55
72
|
const stars = [];
|
|
56
73
|
if (isNaN(Number(count)) || count <= 0) {
|
|
57
74
|
count = 5;
|
|
@@ -76,7 +93,7 @@ const Rate = defineComponent({
|
|
|
76
93
|
},
|
|
77
94
|
on: {
|
|
78
95
|
update: update,
|
|
79
|
-
}
|
|
96
|
+
},
|
|
80
97
|
// onUpdate: update, //for 3
|
|
81
98
|
};
|
|
82
99
|
stars.push(<Star {...sp} />);
|
|
@@ -95,7 +112,9 @@ const Rate = defineComponent({
|
|
|
95
112
|
return (
|
|
96
113
|
<div {...props}>
|
|
97
114
|
{stars}
|
|
98
|
-
{showScore ?
|
|
115
|
+
{showScore ? (
|
|
116
|
+
<span class="k-rate-score">{initValue.value}</span>
|
|
117
|
+
) : null}
|
|
99
118
|
</div>
|
|
100
119
|
);
|
|
101
120
|
};
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
```vue
|
|
7
7
|
<template>
|
|
8
8
|
<Space vertical block>
|
|
9
|
-
<RadioGroup v-model="size" @change="setSize">
|
|
9
|
+
<RadioGroup v-model="size" @change="setSize" type="button">
|
|
10
10
|
<RadioButton value="large" label="large" />
|
|
11
11
|
<RadioButton value="default" label="default" />
|
|
12
12
|
<RadioButton value="small" label="small" />
|
|
@@ -276,7 +276,6 @@ const Select = defineComponent({
|
|
|
276
276
|
currentValue.value = currentValue.value.filter((v) => v !== value);
|
|
277
277
|
} else {
|
|
278
278
|
currentValue.value.push(value);
|
|
279
|
-
labelText.value.push(label);
|
|
280
279
|
}
|
|
281
280
|
updatePosition();
|
|
282
281
|
if (hasSearchEvent || ps.filterable) {
|
package/components/spin/index.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
## Radio API
|
|
2
2
|
|
|
3
|
-
| 属性 | 说明 | 类型
|
|
4
|
-
| ----- | --------------------------------------------- |
|
|
5
|
-
| value | 是否加载状态,可以使用 `v-model` 双向绑定数据 | Boolean
|
|
6
|
-
| mode | 展示spin类型,提供4中展示方式 | String
|
|
7
|
-
| delay | 延迟显示加载效果的时间(防止闪烁) | Number (毫秒)
|
|
3
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
4
|
+
| ----- | --------------------------------------------- | --------------------- | ------ |
|
|
5
|
+
| value | 是否加载状态,可以使用 `v-model` 双向绑定数据 | Boolean | false |
|
|
6
|
+
| mode | 展示spin类型,提供4中展示方式 | String | - |
|
|
7
|
+
| delay | 延迟显示加载效果的时间(防止闪烁) | Number (毫秒) | 500 |
|
|
8
|
+
| size | 设置加载效果的大小 | `large,default,small` | - |
|
|
@@ -10,11 +10,10 @@ const Switch = defineComponent({
|
|
|
10
10
|
},
|
|
11
11
|
props: {
|
|
12
12
|
checked: {
|
|
13
|
-
type: Boolean,
|
|
13
|
+
type: [Boolean, Number],
|
|
14
14
|
default: false,
|
|
15
15
|
},
|
|
16
16
|
// checked: [Boolean, Number], //for 3
|
|
17
|
-
value: [Boolean, Number], //for 2
|
|
18
17
|
type: String,
|
|
19
18
|
disabled: Boolean,
|
|
20
19
|
loading: Boolean,
|
|
@@ -31,7 +30,6 @@ const Switch = defineComponent({
|
|
|
31
30
|
const isChecked = ref(ps.checked);
|
|
32
31
|
watch(
|
|
33
32
|
() => ps.checked,
|
|
34
|
-
// () => ps.value,
|
|
35
33
|
(nv, no) => {
|
|
36
34
|
isChecked.value = nv;
|
|
37
35
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<template>
|
|
8
8
|
<div>
|
|
9
9
|
<Space>
|
|
10
|
-
Size:<RadioGroup v-model="size" size="small">
|
|
10
|
+
Size:<RadioGroup v-model="size" size="small" type="button">
|
|
11
11
|
<RadioButton value="large" label="Large" />
|
|
12
12
|
<RadioButton value="default" label="Default" />
|
|
13
13
|
<RadioButton value="small" label="Small" />
|
package/components/tabs/tabs.jsx
CHANGED