kui-vue 3.6.7 → 3.6.9
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/alert/demo/basic.md +2 -2
- package/components/alert/demo/close.md +2 -2
- package/components/alert/demo/customIcon.md +2 -2
- package/components/alert/styles/index.less +0 -1
- package/components/avatar/styles/index.less +1 -1
- package/components/datePicker/datepicker.jsx +0 -5
- package/components/form/demo/valid.md +8 -7
- package/components/image/demo/group.md +1 -1
- package/components/image/group.jsx +10 -4
- package/components/image/image.jsx +47 -99
- package/components/image/preview.jsx +130 -116
- package/components/image/styles/index.less +219 -224
- package/components/image/utils.js +31 -0
- package/components/input/demo/event.md +0 -1
- package/components/input/inputBox.jsx +1 -1
- package/components/inputNumber/styles/index.less +2 -2
- package/components/layout/demo/layout5.md +0 -1
- package/components/loading/loading.jsx +5 -21
- package/components/modal/styles/index.less +1 -0
- package/components/page/demo/basic.md +3 -3
- package/components/page/demo/size.md +4 -4
- package/components/page/demo/sizer-elevator.md +6 -6
- package/components/page/index.md +1 -1
- package/components/page/page.jsx +8 -8
- package/components/progress/progress.jsx +23 -5
- package/components/progress/styles/index.less +7 -6
- package/components/select/demo/theme.md +2 -1
- package/components/select/select.jsx +1 -1
- package/components/select/styles/index.less +1 -1
- package/components/slider/demo/formatter.md +8 -9
- package/components/slider/slider.jsx +3 -4
- package/components/slider/thumb.jsx +4 -3
- package/components/space/demo/compact.md +9 -9
- package/components/statCard/countup.jsx +8 -0
- package/components/statCard/demo/card.md +2 -2
- package/components/statCard/index.md +12 -7
- package/components/statCard/statCard.jsx +12 -0
- package/components/styles/less-css-var.less +4 -0
- package/components/styles/less-var.less +1 -1
- package/components/table/table.jsx +1 -1
- package/components/tabs/styles/index.less +2 -2
- package/dist/k-ui.cjs.js +2 -2
- package/dist/k-ui.css +2 -2
- package/dist/k-ui.d.ts +183 -179
- 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/index.d.ts +16 -16
- package/types/page/Page.d.ts +1 -1
- package/types/slider/Slider.d.ts +1 -0
- package/types/statCard/StatCard.d.ts +3 -0
- package/types/table/Table.d.ts +1 -1
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
```vue
|
|
7
7
|
<template>
|
|
8
|
-
<
|
|
8
|
+
<Space vertical block>
|
|
9
9
|
<Alert :showIcon="false" type="success">Success Text</Alert>
|
|
10
10
|
<Alert :showIcon="false" type="info">Info Text</Alert>
|
|
11
11
|
<Alert :showIcon="false" type="warning">Warning Text</Alert>
|
|
12
12
|
<Alert :showIcon="false" type="error">Error Text</Alert>
|
|
13
|
-
</
|
|
13
|
+
</Space>
|
|
14
14
|
</template>
|
|
15
15
|
```
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
```vue
|
|
7
7
|
<template>
|
|
8
|
-
<
|
|
8
|
+
<Space vertical block>
|
|
9
9
|
<Alert type="success" showIcon closable>Success Text</Alert>
|
|
10
10
|
<Alert type="info" showIcon closable>Info Text</Alert>
|
|
11
11
|
<Alert type="warning" showIcon closable>Warning Text</Alert>
|
|
@@ -17,6 +17,6 @@
|
|
|
17
17
|
message="Success Tip"
|
|
18
18
|
description="Congratulations, the operation is successful."
|
|
19
19
|
/>
|
|
20
|
-
</
|
|
20
|
+
</Space>
|
|
21
21
|
</template>
|
|
22
22
|
```
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
```vue
|
|
7
7
|
<template>
|
|
8
|
-
<
|
|
8
|
+
<Space vertical block>
|
|
9
9
|
<Alert type="success" showIcon :icon="LogoAlipay">Success Text</Alert>
|
|
10
10
|
<Alert type="info" showIcon :icon="LogoWechat">Info Text</Alert>
|
|
11
11
|
<Alert type="warning" showIcon :icon="LogoApple">Warning Text</Alert>
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
message="Error"
|
|
40
40
|
description="Encountered an error, please press any key to continue."
|
|
41
41
|
/>
|
|
42
|
-
</
|
|
42
|
+
</Space>
|
|
43
43
|
</template>
|
|
44
44
|
<script setup>
|
|
45
45
|
import { LogoAlipay, LogoWechat, LogoApple, LogoGoogle } from "kui-icons";
|
|
@@ -3,10 +3,8 @@ import {
|
|
|
3
3
|
ref,
|
|
4
4
|
watch,
|
|
5
5
|
inject,
|
|
6
|
-
onMounted,
|
|
7
6
|
computed,
|
|
8
7
|
onUnmounted,
|
|
9
|
-
reactive,
|
|
10
8
|
nextTick,
|
|
11
9
|
} from "vue";
|
|
12
10
|
import dayjs from "dayjs";
|
|
@@ -113,7 +111,6 @@ const DatePicker = defineComponent({
|
|
|
113
111
|
return locale.value.name || "zh-cn";
|
|
114
112
|
});
|
|
115
113
|
|
|
116
|
-
// --- 状态定义 ---
|
|
117
114
|
const isVisible = ref(false);
|
|
118
115
|
const isFocus = ref(false);
|
|
119
116
|
const rendered = ref(false);
|
|
@@ -123,9 +120,7 @@ const DatePicker = defineComponent({
|
|
|
123
120
|
const transOrigin = ref("bottom");
|
|
124
121
|
const refPopper = ref(null);
|
|
125
122
|
const refSelection = ref(null);
|
|
126
|
-
// console.log(local);
|
|
127
123
|
|
|
128
|
-
// DOM 引用,用于滚动计算
|
|
129
124
|
const timeColRefs = ref({});
|
|
130
125
|
|
|
131
126
|
// 面板显示的基准日期
|
|
@@ -22,30 +22,31 @@
|
|
|
22
22
|
</RadioGroup>
|
|
23
23
|
</FormItem>
|
|
24
24
|
<FormItem label="E-mail" prop="email">
|
|
25
|
-
<Input clearable placeholder="Email"/>
|
|
25
|
+
<Input clearable placeholder="Email" />
|
|
26
26
|
</FormItem>
|
|
27
27
|
<FormItem label="Number" prop="number">
|
|
28
|
-
<InputNumber placeholder="Number"/>
|
|
28
|
+
<InputNumber placeholder="Number" />
|
|
29
29
|
</FormItem>
|
|
30
30
|
<FormItem label="Password" prop="password">
|
|
31
|
-
<Input type="password" placeholder="password"/>
|
|
31
|
+
<Input type="password" placeholder="password" />
|
|
32
32
|
</FormItem>
|
|
33
33
|
<FormItem label="Confirm Password" prop="repassword">
|
|
34
|
-
<Input type="password" placeholder="Confirm Password"/>
|
|
34
|
+
<Input type="password" placeholder="Confirm Password" />
|
|
35
35
|
</FormItem>
|
|
36
36
|
<FormItem label="Phone Number" prop="phone">
|
|
37
|
-
<Input placeholder="Phone Number"/>
|
|
37
|
+
<Input placeholder="Phone Number" />
|
|
38
38
|
</FormItem>
|
|
39
39
|
<FormItem label="Captcha" prop="captcha">
|
|
40
|
-
<Input placeholder="Captcha"
|
|
40
|
+
<Input placeholder="Captcha">
|
|
41
41
|
<Button
|
|
42
42
|
slot="suffix"
|
|
43
43
|
:size="size"
|
|
44
44
|
:disabled="time != 60"
|
|
45
45
|
style="width:100px;"
|
|
46
46
|
@click="sendCode"
|
|
47
|
-
>{{ time == 60 ? "获取验证码" : time + "(s)" }}</Button
|
|
48
47
|
>
|
|
48
|
+
{{ time == 60 ? "获取验证码" : time + "(s)" }}
|
|
49
|
+
</Button>
|
|
49
50
|
</Input>
|
|
50
51
|
</FormItem>
|
|
51
52
|
<FormItem label="Country">
|
|
@@ -31,7 +31,7 @@ const data = [
|
|
|
31
31
|
"https://cdn.chuchur.com/upload/cat/cat2.webp",
|
|
32
32
|
"https://cdn.chuchur.com/upload/cat/cat3.webp",
|
|
33
33
|
"https://cdn.chuchur.com/upload/cat/cat4.jpg",
|
|
34
|
-
"https://cdn.chuchur.com/upload/cat/cat5
|
|
34
|
+
"https://cdn.chuchur.com/upload/cat/cat5---.jpg",
|
|
35
35
|
];
|
|
36
36
|
</script>
|
|
37
37
|
```
|
|
@@ -7,7 +7,7 @@ const ImageGroup = defineComponent({
|
|
|
7
7
|
props: {
|
|
8
8
|
data: Array,
|
|
9
9
|
},
|
|
10
|
-
setup(props, {
|
|
10
|
+
setup(props, { slots }) {
|
|
11
11
|
const data = ref(props.data || []);
|
|
12
12
|
const preview = ref();
|
|
13
13
|
const show = (options) => {
|
|
@@ -33,14 +33,20 @@ const ImageGroup = defineComponent({
|
|
|
33
33
|
data.value.splice(index, 1);
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
|
|
37
|
-
provide("ImageGroup", { show, register, unregister, data, togglePanel });
|
|
38
|
-
|
|
39
36
|
const destroy = () => {
|
|
40
37
|
if (preview.value) {
|
|
41
38
|
document.body.removeChild(preview.value.$el);
|
|
39
|
+
preview.value = null;
|
|
42
40
|
}
|
|
43
41
|
};
|
|
42
|
+
provide("ImageGroup", {
|
|
43
|
+
show,
|
|
44
|
+
destroy,
|
|
45
|
+
register,
|
|
46
|
+
unregister,
|
|
47
|
+
data,
|
|
48
|
+
togglePanel,
|
|
49
|
+
});
|
|
44
50
|
|
|
45
51
|
onUnmounted(() => {
|
|
46
52
|
destroy();
|
|
@@ -5,13 +5,12 @@ import {
|
|
|
5
5
|
onBeforeUnmount,
|
|
6
6
|
watch,
|
|
7
7
|
inject,
|
|
8
|
-
computed,
|
|
9
8
|
} from "vue";
|
|
10
9
|
import Icon from "../icon";
|
|
11
10
|
import newInstance from "./instance";
|
|
12
11
|
import { Loading, IconImage, EyeOutline } from "kui-icons";
|
|
13
12
|
import { withInstall } from "../utils/vue";
|
|
14
|
-
import
|
|
13
|
+
import { loadImage } from "./utils";
|
|
15
14
|
|
|
16
15
|
const KImage = defineComponent({
|
|
17
16
|
name: "KImage",
|
|
@@ -29,48 +28,41 @@ const KImage = defineComponent({
|
|
|
29
28
|
},
|
|
30
29
|
setup(props, { emit, slots, expose, listeners }) {
|
|
31
30
|
const loading = ref(false);
|
|
32
|
-
const
|
|
31
|
+
const showPlaceholder = ref(false);
|
|
33
32
|
const imageUrl = ref(null);
|
|
34
|
-
const error = ref(false);
|
|
35
33
|
const imgWidth = ref(0);
|
|
36
34
|
const imgHeight = ref(0);
|
|
37
35
|
|
|
38
36
|
const preview = ref();
|
|
39
37
|
const ImageGroup = inject("ImageGroup", null);
|
|
40
|
-
const injectedLocale = inject("locale", zhCN);
|
|
41
|
-
|
|
42
|
-
const locale = computed(() => {
|
|
43
|
-
return injectedLocale instanceof Object && "value" in injectedLocale
|
|
44
|
-
? injectedLocale.value
|
|
45
|
-
: injectedLocale;
|
|
46
|
-
});
|
|
47
38
|
|
|
48
39
|
// global api
|
|
49
40
|
const togglePanel = () => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
if (preview.value) {
|
|
55
|
-
preview.value.togglePanel();
|
|
41
|
+
const instance = ImageGroup || preview.value;
|
|
42
|
+
if (instance) {
|
|
43
|
+
instance.togglePanel();
|
|
56
44
|
}
|
|
57
45
|
};
|
|
58
46
|
// global api
|
|
59
|
-
const show = (
|
|
47
|
+
const show = (props) => {
|
|
60
48
|
if (ImageGroup) {
|
|
61
|
-
ImageGroup.show(
|
|
49
|
+
ImageGroup.show(props);
|
|
62
50
|
return;
|
|
63
51
|
}
|
|
64
52
|
if (!preview.value) {
|
|
65
|
-
preview.value = newInstance({ ...
|
|
53
|
+
preview.value = newInstance({ ...props });
|
|
66
54
|
}
|
|
67
|
-
preview.value.show();
|
|
55
|
+
preview.value.show(props);
|
|
68
56
|
};
|
|
69
57
|
|
|
70
58
|
// global api
|
|
71
59
|
const destroy = () => {
|
|
72
60
|
if (preview.value) {
|
|
73
61
|
document.body.removeChild(preview.value.$el);
|
|
62
|
+
preview.value = null;
|
|
63
|
+
}
|
|
64
|
+
if (ImageGroup) {
|
|
65
|
+
ImageGroup.destroy();
|
|
74
66
|
}
|
|
75
67
|
};
|
|
76
68
|
|
|
@@ -78,11 +70,14 @@ const KImage = defineComponent({
|
|
|
78
70
|
|
|
79
71
|
const showPreview = (e) => {
|
|
80
72
|
const { origin, src } = props;
|
|
81
|
-
if ((!src && !origin) ||
|
|
73
|
+
if ((!src && !origin) || showPlaceholder.value || loading.value) return;
|
|
82
74
|
const options = {
|
|
83
75
|
on: {
|
|
84
76
|
close: () => {
|
|
85
77
|
emit("close");
|
|
78
|
+
setTimeout(() => {
|
|
79
|
+
destroy();
|
|
80
|
+
}, 200);
|
|
86
81
|
},
|
|
87
82
|
switch: (index) => {
|
|
88
83
|
emit("switch", index);
|
|
@@ -96,79 +91,32 @@ const KImage = defineComponent({
|
|
|
96
91
|
scopedSlots: { ...slots },
|
|
97
92
|
};
|
|
98
93
|
|
|
99
|
-
|
|
100
|
-
show(options);
|
|
101
|
-
} else {
|
|
102
|
-
loading.value = true;
|
|
103
|
-
loadImage(
|
|
104
|
-
origin,
|
|
105
|
-
() => {
|
|
106
|
-
loading.value = false;
|
|
107
|
-
options.props.src = origin;
|
|
108
|
-
show(options);
|
|
109
|
-
},
|
|
110
|
-
() => {
|
|
111
|
-
loading.value = false;
|
|
112
|
-
}
|
|
113
|
-
);
|
|
114
|
-
}
|
|
94
|
+
show(options);
|
|
115
95
|
e.preventDefault();
|
|
116
96
|
};
|
|
117
97
|
|
|
118
|
-
const loadImage = (src, callback, err) => {
|
|
119
|
-
if (!src) return;
|
|
120
|
-
|
|
121
|
-
let image = new Image();
|
|
122
|
-
let isCompleted = false;
|
|
123
|
-
|
|
124
|
-
const cleanup = () => {
|
|
125
|
-
if (isCompleted) return;
|
|
126
|
-
isCompleted = true;
|
|
127
|
-
image.onload = null;
|
|
128
|
-
image.onerror = null;
|
|
129
|
-
image = null;
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
image.onload = () => {
|
|
133
|
-
if (!isCompleted) {
|
|
134
|
-
const { width, height } = image;
|
|
135
|
-
callback && callback({ width, height });
|
|
136
|
-
}
|
|
137
|
-
cleanup();
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
image.onerror = () => {
|
|
141
|
-
if (!isCompleted) {
|
|
142
|
-
err && err();
|
|
143
|
-
}
|
|
144
|
-
cleanup();
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
image.src = src;
|
|
148
|
-
};
|
|
149
|
-
|
|
150
98
|
const reload = () => {
|
|
151
99
|
const { src, placeholder } = props;
|
|
152
100
|
if (src) {
|
|
101
|
+
loading.value = true;
|
|
153
102
|
loadImage(
|
|
154
103
|
src,
|
|
155
104
|
({ width, height }) => {
|
|
156
|
-
|
|
105
|
+
showPlaceholder.value = false;
|
|
106
|
+
loading.value = false;
|
|
157
107
|
imageUrl.value = src;
|
|
158
|
-
error.value = false;
|
|
159
108
|
imgWidth.value = width;
|
|
160
109
|
imgHeight.value = height;
|
|
161
110
|
},
|
|
162
111
|
() => {
|
|
163
|
-
|
|
164
|
-
|
|
112
|
+
loading.value = false;
|
|
113
|
+
showPlaceholder.value = true;
|
|
165
114
|
imageUrl.value = placeholder || null;
|
|
166
|
-
}
|
|
115
|
+
},
|
|
167
116
|
);
|
|
168
117
|
} else {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
imageUrl.value = null;
|
|
118
|
+
showPlaceholder.value = true;
|
|
119
|
+
imageUrl.value = placeholder || null;
|
|
172
120
|
}
|
|
173
121
|
};
|
|
174
122
|
|
|
@@ -176,7 +124,7 @@ const KImage = defineComponent({
|
|
|
176
124
|
() => props.src,
|
|
177
125
|
() => {
|
|
178
126
|
reload();
|
|
179
|
-
}
|
|
127
|
+
},
|
|
180
128
|
);
|
|
181
129
|
|
|
182
130
|
onMounted(() => {
|
|
@@ -185,9 +133,6 @@ const KImage = defineComponent({
|
|
|
185
133
|
});
|
|
186
134
|
|
|
187
135
|
onBeforeUnmount(() => {
|
|
188
|
-
// if (preview) {
|
|
189
|
-
// preview.destroy();
|
|
190
|
-
// }
|
|
191
136
|
destroy();
|
|
192
137
|
ImageGroup?.unregister(props.origin || props.src);
|
|
193
138
|
});
|
|
@@ -212,26 +157,29 @@ const KImage = defineComponent({
|
|
|
212
157
|
src: imageUrl.value,
|
|
213
158
|
},
|
|
214
159
|
};
|
|
160
|
+
const nodes = [];
|
|
161
|
+
|
|
162
|
+
if (loading.value) {
|
|
163
|
+
nodes.push(
|
|
164
|
+
<div class="k-image-loading">
|
|
165
|
+
<Icon type={Loading} spin class="k-image-loading-icon" />
|
|
166
|
+
</div>,
|
|
167
|
+
);
|
|
168
|
+
} else {
|
|
169
|
+
if (showPlaceholder.value) {
|
|
170
|
+
if (imageUrl.value) {
|
|
171
|
+
nodes.push(<img {...imgProps} />);
|
|
172
|
+
} else {
|
|
173
|
+
nodes.push(<Icon type={IconImage} class="k-image-error" />);
|
|
174
|
+
}
|
|
175
|
+
} else {
|
|
176
|
+
nodes.push(<img {...imgProps} />);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
215
179
|
|
|
216
180
|
return (
|
|
217
181
|
<div {...containerProps}>
|
|
218
|
-
{
|
|
219
|
-
<img {...imgProps} />
|
|
220
|
-
) : null}
|
|
221
|
-
{(!showImg.value || error.value) && !placeholder ? (
|
|
222
|
-
<Icon type={IconImage} class="k-image-error" />
|
|
223
|
-
) : null}
|
|
224
|
-
{loading.value ? (
|
|
225
|
-
<div class="k-image-loading" key="image-loading">
|
|
226
|
-
<Icon type={Loading} spin class="k-image-loading-icon" />
|
|
227
|
-
</div>
|
|
228
|
-
) : null}
|
|
229
|
-
{!loading.value && !error.value ? (
|
|
230
|
-
<div class="k-image-preview-mask">
|
|
231
|
-
<Icon type={EyeOutline} />
|
|
232
|
-
{locale?.value.k.image.preview}
|
|
233
|
-
</div>
|
|
234
|
-
) : null}
|
|
182
|
+
{nodes}
|
|
235
183
|
{slots.default?.()}
|
|
236
184
|
</div>
|
|
237
185
|
);
|