kui-vue 3.6.1 → 3.6.3
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/card/card.jsx +19 -9
- package/components/card/demo/basic.md +3 -3
- package/components/card/demo/border.md +1 -7
- package/components/card/demo/index.jsx +9 -7
- package/components/card/demo/notitle.md +23 -0
- package/components/card/styles/index.less +5 -3
- package/components/checkbox/checkbox.jsx +17 -16
- package/components/checkbox/checkboxGroup.jsx +1 -1
- package/components/checkbox/styles/index.less +1 -0
- 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/collapse/styles/index.less +2 -2
- 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/colorPicker/mode.jsx +1 -1
- package/components/components.js +3 -0
- package/components/datePicker/demo/size.md +1 -1
- package/components/drawer/demo/target.md +2 -2
- package/components/dropdown/demo/basic.md +1 -1
- package/components/dropdown/dropdownButton.jsx +18 -7
- package/components/dropdown/styles/index.less +1 -0
- 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/flex/demo/size.md +14 -5
- package/components/form/demo/align.md +10 -10
- package/components/form/demo/customvalid.md +1 -1
- package/components/form/demo/dynamicvalid.md +1 -1
- package/components/form/demo/length.md +1 -13
- package/components/form/demo/valid.md +11 -3
- package/components/form/form.jsx +2 -2
- 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 +19 -15
- package/components/input/inputBox.jsx +2 -2
- package/components/inputNumber/demo/basic.md +1 -0
- package/components/inputNumber/demo/format.md +3 -8
- package/components/inputNumber/inputNumber.jsx +116 -139
- package/components/inputNumber/styles/index.less +3 -3
- package/components/layout/demo/layout5.md +0 -1
- package/components/locale/de.js +1 -0
- package/components/locale/el.js +1 -0
- package/components/locale/en.js +1 -0
- package/components/locale/fr.js +1 -0
- package/components/locale/it.js +1 -0
- package/components/locale/ja.js +1 -0
- package/components/locale/ko.js +1 -0
- package/components/locale/ru.js +1 -0
- package/components/locale/th.js +1 -0
- package/components/locale/uk.js +1 -0
- package/components/locale/vi.js +1 -0
- package/components/locale/zh-CN.js +1 -0
- package/components/locale/zh-TW.js +1 -0
- package/components/menu/demo/collapsed.md +9 -9
- package/components/menu/index.md +1 -0
- package/components/message/demo/close.md +1 -1
- package/components/message/group.jsx +13 -6
- 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 +30 -6
- package/components/rate/star.jsx +20 -5
- package/components/select/demo/size.md +1 -1
- package/components/select/select.jsx +5 -4
- package/components/slider/demo/vertical.md +2 -1
- package/components/slider/demo/withNumber.md +0 -2
- package/components/slider/index.md +2 -3
- package/components/slider/slider.jsx +296 -291
- package/components/slider/styles/index.less +11 -12
- package/components/slider/thumb.jsx +70 -148
- package/components/space/styles/index.less +3 -1
- package/components/spin/demo/container.md +1 -1
- package/components/spin/demo/mode.md +1 -1
- package/components/spin/index.md +6 -5
- package/components/statCard/countup.js +254 -0
- package/components/statCard/countup.jsx +45 -0
- package/components/statCard/demo/basic.md +31 -0
- package/components/statCard/demo/card.md +40 -0
- package/components/statCard/demo/index.jsx +19 -0
- package/components/statCard/demo/info.md +9 -0
- package/components/statCard/demo/with-card.md +43 -0
- package/components/statCard/index.js +3 -0
- package/components/statCard/index.md +28 -0
- package/components/statCard/rollup.jsx +64 -0
- package/components/statCard/statCard.jsx +42 -0
- package/components/statCard/statNumber.jsx +53 -0
- package/components/statCard/styles/index.less +76 -0
- package/components/styles/color.less +4 -2
- package/components/styles/index.less +1 -0
- package/components/styles/sys.less +2 -3
- package/components/styles/var.less +1 -0
- package/components/switch/switch.jsx +1 -3
- package/components/table/demo/col-row-span.md +1 -1
- package/components/table/demo/fixed-col-head.md +1 -1
- package/components/table/demo/head-span.md +2 -2
- package/components/table/demo/size.md +2 -2
- package/components/table/demo/table-check.md +11 -1
- package/components/table/index.md +13 -12
- package/components/table/styles/index.less +67 -58
- package/components/table/table.jsx +7 -5
- package/components/tabs/demo/sample.md +1 -8
- package/components/tabs/index.md +9 -9
- package/components/tabs/tabs.jsx +7 -5
- 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/treeselect/treeselect.jsx +5 -3
- package/components/upload/demo/custom.md +5 -2
- package/components/upload/demo/exceed.md +1 -1
- package/components/upload/demo/pictures.md +14 -0
- package/components/upload/fileList.jsx +24 -47
- package/components/upload/index.md +13 -4
- package/components/upload/selector.jsx +37 -117
- package/components/upload/styles/index.less +2 -3
- package/components/upload/upload.jsx +189 -117
- package/components/utils/number.js +79 -65
- package/components/utils/placement.js +62 -35
- package/dist/k-ui.cjs.js +2 -2
- package/dist/k-ui.css +2 -2
- package/dist/k-ui.d.ts +172 -129
- package/dist/k-ui.esm.js +2 -2
- package/dist/k-ui.umd.js +2 -2
- package/dist/locale/de.js +2 -2
- package/dist/locale/el.js +2 -2
- package/dist/locale/en.js +2 -2
- package/dist/locale/fr.js +2 -2
- package/dist/locale/it.js +2 -2
- package/dist/locale/ja.js +2 -2
- package/dist/locale/ko.js +2 -2
- package/dist/locale/ru.js +2 -2
- package/dist/locale/th.js +2 -2
- package/dist/locale/ua.js +1 -1
- package/dist/locale/uk.js +2 -2
- package/dist/locale/vi.js +2 -2
- package/dist/locale/zh-CN.js +2 -2
- package/dist/locale/zh-TW.js +2 -2
- package/package.json +3 -1
- package/types/checkbox/Checkbox.d.ts +1 -1
- package/types/collapse/Collapse.d.ts +1 -1
- package/types/index.d.ts +14 -10
- 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/rate/Rate.d.ts +1 -1
- package/types/slider/Slider.d.ts +7 -6
- package/types/statCard/StatCard.d.ts +20 -0
- package/types/statCard/StatNumber.d.ts +26 -0
- package/types/switch/Switch.d.ts +1 -2
- package/types/table/Table.d.ts +1 -0
- 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
|
@@ -1,18 +1,13 @@
|
|
|
1
|
+
import { ref, defineComponent, watch, inject, computed } from "vue";
|
|
2
|
+
import Big from "big.js";
|
|
1
3
|
import Input from "../input/input";
|
|
2
4
|
import Icon from "../icon";
|
|
3
5
|
import { withInstall } from "../utils/vue";
|
|
4
|
-
import {
|
|
5
|
-
add,
|
|
6
|
-
subtract,
|
|
7
|
-
toFixed,
|
|
8
|
-
isValidNumber,
|
|
9
|
-
isEmpty,
|
|
10
|
-
toDecimalString,
|
|
11
|
-
} from "../utils/number";
|
|
12
|
-
import { ChevronUp } from "kui-icons";
|
|
13
|
-
import { ref, defineComponent, watch, inject } from "vue";
|
|
6
|
+
import { ChevronUp, ChevronDown } from "kui-icons";
|
|
14
7
|
import { sizeMap, filterSize } from "../utils/size";
|
|
8
|
+
import { normalize, isValidBig } from "../utils/number";
|
|
15
9
|
const InputNumber = defineComponent({
|
|
10
|
+
name: "InputNumber",
|
|
16
11
|
props: {
|
|
17
12
|
value: [Array, Number, String],
|
|
18
13
|
min: { type: Number, default: -Infinity },
|
|
@@ -38,179 +33,161 @@ const InputNumber = defineComponent({
|
|
|
38
33
|
default: 1,
|
|
39
34
|
},
|
|
40
35
|
theme: String,
|
|
41
|
-
// placeholder: String,
|
|
42
36
|
icon: [String, Array],
|
|
43
37
|
id: String,
|
|
44
38
|
},
|
|
45
|
-
setup(
|
|
39
|
+
setup(props, { slots, attrs, emit, listeners }) {
|
|
46
40
|
const parentSize = inject("size", null);
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (!isValidNumber(v)) {
|
|
54
|
-
if (isEmpty(v)) {
|
|
55
|
-
input = "";
|
|
56
|
-
output = "";
|
|
57
|
-
} else {
|
|
58
|
-
input = String(v);
|
|
59
|
-
output = formatter ? parser?.(String(v)) || v : String(v);
|
|
60
|
-
}
|
|
61
|
-
} else {
|
|
62
|
-
if (/e/i.test(v) && sync) {
|
|
63
|
-
v = toDecimalString(v);
|
|
64
|
-
}
|
|
65
|
-
input = String(v);
|
|
66
|
-
output = v;
|
|
67
|
-
}
|
|
68
|
-
if (formatter) {
|
|
69
|
-
const value = parser?.(String(input)) || input;
|
|
70
|
-
input = formatter(String(value));
|
|
41
|
+
const innerValue = ref("");
|
|
42
|
+
const userInput = ref(null);
|
|
43
|
+
|
|
44
|
+
const clamp = (val) => {
|
|
45
|
+
if (!isValidBig(val)) {
|
|
46
|
+
return val === "" ? "" : innerValue.value;
|
|
71
47
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
let b = new Big(val);
|
|
51
|
+
|
|
52
|
+
if (props.max !== Infinity && b.gt(props.max)) b = new Big(props.max);
|
|
53
|
+
if (props.min !== -Infinity && b.lt(props.min)) b = new Big(props.min);
|
|
54
|
+
|
|
55
|
+
return props.precision !== undefined
|
|
56
|
+
? b.toFixed(props.precision)
|
|
57
|
+
: b.toFixed();
|
|
58
|
+
} catch (e) {
|
|
59
|
+
return innerValue.value;
|
|
83
60
|
}
|
|
84
|
-
// console.log(`origin: ${v}`, `input: ${input}`, `output: ${output}`);
|
|
85
|
-
return { input, output };
|
|
86
61
|
};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
isUp == 1
|
|
102
|
-
? add(String(outputValue.value), String(step))
|
|
103
|
-
: subtract(String(outputValue.value), String(step));
|
|
104
|
-
const { input, output } = getValue(value, true);
|
|
105
|
-
|
|
106
|
-
// return
|
|
107
|
-
inputValue.value = input;
|
|
108
|
-
outputValue.value = output;
|
|
109
|
-
e.preventDefault();
|
|
110
|
-
|
|
111
|
-
emit("input", output);
|
|
112
|
-
// emit("update:value", output);
|
|
113
|
-
emit("change", { target: { value: output } });
|
|
62
|
+
|
|
63
|
+
watch(
|
|
64
|
+
() => props.value,
|
|
65
|
+
(val) => {
|
|
66
|
+
const next = normalize(val, props.precision);
|
|
67
|
+
if (next !== innerValue.value) {
|
|
68
|
+
innerValue.value = next;
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
{ immediate: true }
|
|
72
|
+
);
|
|
73
|
+
const emitValue = (value) => {
|
|
74
|
+
emit("input", value);
|
|
75
|
+
emit("change", value);
|
|
114
76
|
};
|
|
77
|
+
const displayValue = computed(() => {
|
|
78
|
+
if (userInput.value !== null) return userInput.value;
|
|
115
79
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
80
|
+
if (innerValue.value === "") return "";
|
|
81
|
+
return props.formatter
|
|
82
|
+
? props.formatter(innerValue.value)
|
|
83
|
+
: innerValue.value;
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const triggerUpdate = (val) => {
|
|
87
|
+
const parsed = props.parser ? props.parser(val) : val;
|
|
88
|
+
const clampedStr = clamp(parsed);
|
|
89
|
+
innerValue.value = clampedStr;
|
|
90
|
+
userInput.value = null;
|
|
91
|
+
const output = clampedStr === "" ? undefined : Number(clampedStr);
|
|
92
|
+
emitValue(output);
|
|
123
93
|
};
|
|
124
|
-
const onUpdate = (e) => {
|
|
125
|
-
const v = e; //.target.value;
|
|
126
|
-
const { input, output } = getValue(v, false, false);
|
|
127
|
-
inputValue.value = input;
|
|
128
|
-
// e.target.value = input;
|
|
129
94
|
|
|
130
|
-
|
|
95
|
+
const handleInput = (val) => {
|
|
96
|
+
userInput.value = val;
|
|
97
|
+
const parsed = props.parser ? props.parser(val) : val;
|
|
98
|
+
if (val === "") {
|
|
99
|
+
innerValue.value = "";
|
|
100
|
+
emitValue(undefined);
|
|
131
101
|
return;
|
|
132
102
|
}
|
|
133
|
-
|
|
134
|
-
if ((
|
|
135
|
-
|
|
103
|
+
|
|
104
|
+
if (isValidBig(parsed)) {
|
|
105
|
+
const bigVal = new Big(parsed);
|
|
106
|
+
const normalizedStr = bigVal.toFixed();
|
|
107
|
+
|
|
108
|
+
innerValue.value = normalizedStr;
|
|
109
|
+
emitValue(Number(normalizedStr));
|
|
110
|
+
|
|
111
|
+
if (props.formatter) {
|
|
112
|
+
const formatted = props.formatter(normalizedStr);
|
|
113
|
+
if (formatted !== userInput.value) {
|
|
114
|
+
userInput.value = formatted;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
136
117
|
}
|
|
137
|
-
outputValue.value = output;
|
|
138
|
-
emit("input", output);
|
|
139
|
-
// emit("update:value", output);
|
|
140
|
-
// e.preventDefault();
|
|
141
118
|
};
|
|
142
|
-
watch(
|
|
143
|
-
() => ps.value,
|
|
144
|
-
(v) => {
|
|
145
|
-
const { input, output } = getValue(v, false);
|
|
146
119
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
120
|
+
const handleBlur = (event) => {
|
|
121
|
+
triggerUpdate(
|
|
122
|
+
userInput.value !== null ? userInput.value : innerValue.value
|
|
123
|
+
);
|
|
124
|
+
emit("blur", event);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const stepAction = (type) => {
|
|
128
|
+
if (props.disabled || props.readonly) return;
|
|
129
|
+
|
|
130
|
+
const current = isValidBig(innerValue.value) ? innerValue.value : 0;
|
|
131
|
+
const next =
|
|
132
|
+
type === "up"
|
|
133
|
+
? new Big(current).plus(props.step)
|
|
134
|
+
: new Big(current).minus(props.step);
|
|
135
|
+
|
|
136
|
+
triggerUpdate(next.toFixed());
|
|
159
137
|
};
|
|
160
138
|
return () => {
|
|
161
139
|
// const { suffix } = ps;
|
|
162
140
|
|
|
163
|
-
const
|
|
164
|
-
attrs: { ...attrs, readonly:
|
|
165
|
-
// ...ps,
|
|
141
|
+
const inputProps = {
|
|
142
|
+
attrs: { ...attrs, readonly: props.readonly },
|
|
166
143
|
props: {
|
|
167
144
|
inputType: "input-number",
|
|
168
|
-
value:
|
|
145
|
+
value: displayValue.value,
|
|
169
146
|
clearable: false,
|
|
170
|
-
size:
|
|
171
|
-
disabled:
|
|
172
|
-
suffix:
|
|
173
|
-
prefix:
|
|
174
|
-
icon:
|
|
175
|
-
theme:
|
|
176
|
-
|
|
147
|
+
size: props.size || filterSize(parentSize),
|
|
148
|
+
disabled: props.disabled,
|
|
149
|
+
suffix: props.suffix,
|
|
150
|
+
prefix: props.prefix,
|
|
151
|
+
icon: props.icon,
|
|
152
|
+
theme: props.theme,
|
|
153
|
+
placeholder: props.placeholder,
|
|
177
154
|
},
|
|
178
155
|
on: {
|
|
179
156
|
...listeners,
|
|
180
|
-
input:
|
|
181
|
-
|
|
157
|
+
input: handleInput,
|
|
158
|
+
blur: handleBlur,
|
|
159
|
+
keydown: (e) => {
|
|
160
|
+
if (e.key === "ArrowUp") {
|
|
161
|
+
e.preventDefault();
|
|
162
|
+
stepAction("up");
|
|
163
|
+
}
|
|
164
|
+
if (e.key === "ArrowDown") {
|
|
165
|
+
e.preventDefault();
|
|
166
|
+
stepAction("down");
|
|
167
|
+
}
|
|
182
168
|
},
|
|
183
|
-
change: (e) => {},
|
|
184
|
-
blur: (e) => blurHandle(e),
|
|
185
|
-
keydown: (e) => onKeyDown(e),
|
|
186
169
|
},
|
|
187
|
-
// onInput: (e) => {
|
|
188
|
-
// onUpdate(e);
|
|
189
|
-
// },
|
|
190
|
-
// onChange: (e) => {},
|
|
191
|
-
// onBlur: (e) => blurHandle(e),
|
|
192
|
-
// onKeydown: (e) => onKeyDown(e),
|
|
193
170
|
};
|
|
194
171
|
return (
|
|
195
172
|
<Input
|
|
196
|
-
{...
|
|
173
|
+
{...inputProps}
|
|
197
174
|
scopedSlots={{
|
|
198
175
|
suffix: () => slots.suffix?.(),
|
|
199
176
|
prefix: () => slots.prefix?.(),
|
|
200
177
|
controls: () =>
|
|
201
|
-
|
|
178
|
+
props.controls && !props.readonly && !props.disabled ? (
|
|
202
179
|
<div class="k-input-number-controls">
|
|
203
180
|
<span
|
|
204
181
|
class="k-input-number-control"
|
|
205
|
-
onClick={(
|
|
182
|
+
onClick={() => stepAction("up")}
|
|
206
183
|
>
|
|
207
184
|
<Icon type={ChevronUp} />
|
|
208
185
|
</span>
|
|
209
186
|
<span
|
|
210
187
|
class="k-input-number-control"
|
|
211
|
-
onClick={(
|
|
188
|
+
onClick={() => stepAction("down")}
|
|
212
189
|
>
|
|
213
|
-
<Icon type={
|
|
190
|
+
<Icon type={ChevronDown} />
|
|
214
191
|
</span>
|
|
215
192
|
</div>
|
|
216
193
|
) : null,
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
&:not(.k-input-number-light, .k-input-number-disabled):hover {
|
|
23
23
|
border-color: var(--kui-color-main);
|
|
24
24
|
}
|
|
25
|
-
&:
|
|
25
|
+
&:not(.k-input-number-disabled):hover {
|
|
26
26
|
.k-input-number-controls {
|
|
27
27
|
opacity: 1;
|
|
28
28
|
width: 20px;
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
outline-offset: 1px;
|
|
112
112
|
outline: 2px solid var(--kui-color-main-80);
|
|
113
113
|
}
|
|
114
|
-
.k-input-number-focus:not(.k-input-number-light) {
|
|
114
|
+
.k-input-number-focus:not(.k-input-number-light, .k-input-number-disabled) {
|
|
115
115
|
border-color: var(--kui-color-main);
|
|
116
116
|
box-shadow: 0 0 0 2px var(--kui-color-main-90);
|
|
117
117
|
}
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
width: auto;
|
|
127
127
|
padding-right: var(--kui-padding-inline);
|
|
128
128
|
|
|
129
|
-
&:not(.k-input-number-light):hover {
|
|
129
|
+
&:not(.k-input-number-light, .k-input-number-disabled):hover {
|
|
130
130
|
border-color: var(--kui-color-main);
|
|
131
131
|
}
|
|
132
132
|
|
package/components/locale/de.js
CHANGED
package/components/locale/el.js
CHANGED
package/components/locale/en.js
CHANGED
package/components/locale/fr.js
CHANGED
package/components/locale/it.js
CHANGED
package/components/locale/ja.js
CHANGED
package/components/locale/ko.js
CHANGED
package/components/locale/ru.js
CHANGED
package/components/locale/th.js
CHANGED
package/components/locale/uk.js
CHANGED
package/components/locale/vi.js
CHANGED
|
@@ -23,18 +23,18 @@
|
|
|
23
23
|
<MenuItem key="1-1" :icon="Mail">Option 1</MenuItem>
|
|
24
24
|
<MenuItem key="1-2" :icon="Grid"><span>Option 2</span></MenuItem>
|
|
25
25
|
<SubMenu key="sub2" :icon="Heart" title="Navigation Two">
|
|
26
|
-
<MenuItem key="2-1">Option 5</MenuItem>
|
|
27
|
-
<MenuItem key="2-2">Option 6</MenuItem>
|
|
28
|
-
<SubMenu title="SubMenu" key="sub2-1">
|
|
29
|
-
<MenuItem key="2-3">Option 7</MenuItem>
|
|
30
|
-
<MenuItem key="2-4">Option 8</MenuItem>
|
|
26
|
+
<MenuItem key="2-1" :icon="Mail">Option 5</MenuItem>
|
|
27
|
+
<MenuItem key="2-2" :icon="Mail">Option 6</MenuItem>
|
|
28
|
+
<SubMenu title="SubMenu" key="sub2-1" :icon="Mail">
|
|
29
|
+
<MenuItem key="2-3" :icon="Mail">Option 7</MenuItem>
|
|
30
|
+
<MenuItem key="2-4" :icon="Mail">Option 8</MenuItem>
|
|
31
31
|
</SubMenu>
|
|
32
32
|
</SubMenu>
|
|
33
33
|
<SubMenu key="sub3" :icon="Settings" title="Navigation Three">
|
|
34
|
-
<MenuItem key="3-1">Option 9</MenuItem>
|
|
35
|
-
<MenuItem key="3-2">Option 10</MenuItem>
|
|
36
|
-
<MenuItem key="3-3">Option 11</MenuItem>
|
|
37
|
-
<MenuItem key="3-4">Option 12</MenuItem>
|
|
34
|
+
<MenuItem key="3-1" :icon="Mail">Option 9</MenuItem>
|
|
35
|
+
<MenuItem key="3-2" :icon="Mail">Option 10</MenuItem>
|
|
36
|
+
<MenuItem key="3-3" :icon="Mail">Option 11</MenuItem>
|
|
37
|
+
<MenuItem key="3-4" :icon="Mail">Option 12</MenuItem>
|
|
38
38
|
</SubMenu>
|
|
39
39
|
</Menu>
|
|
40
40
|
</div>
|
package/components/menu/index.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
| 属性 | 说明 | 类型 | 默认值 |
|
|
6
6
|
| -------------------- | ---------------------------------------- | ------------------------------------------------- | -------- |
|
|
7
|
+
| value(v-model) | 当前选中的菜单项 | String: [] | light |
|
|
7
8
|
| theme | 主题颜色 | String: light dark | light |
|
|
8
9
|
| v-model:openKeys | 当前展开的 SubMenu 菜单项 key 数组 | String[] | - |
|
|
9
10
|
| v-model:selectedKeys | 当前选中的菜单项,可使用 v-model 绑定 | String[] | - |
|
|
@@ -12,19 +12,23 @@ 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;
|
|
25
25
|
};
|
|
26
|
-
options.duration > 0 &&
|
|
27
|
-
|
|
26
|
+
options.duration > 0 &&
|
|
27
|
+
(timer = setTimeout(callback, options.duration * 1000, key));
|
|
28
|
+
if (
|
|
29
|
+
(closable === true && noticeType == "message") ||
|
|
30
|
+
noticeType == "notice"
|
|
31
|
+
) {
|
|
28
32
|
options.onClose = () => callback(key);
|
|
29
33
|
}
|
|
30
34
|
group.value.push(options);
|
|
@@ -59,8 +63,11 @@ export default defineComponent({
|
|
|
59
63
|
delete ps.key;
|
|
60
64
|
const props = {
|
|
61
65
|
key: item.key,
|
|
62
|
-
props: { ...ps }
|
|
63
|
-
|
|
66
|
+
props: { ...ps },
|
|
67
|
+
on: {
|
|
68
|
+
close: () => ps.onClose?.(),
|
|
69
|
+
},
|
|
70
|
+
};
|
|
64
71
|
return <Notice {...props} />;
|
|
65
72
|
});
|
|
66
73
|
return (
|
|
@@ -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 | - |
|