kui-vue 3.6.3 → 3.6.4
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/card/demo/border.md +1 -1
- package/components/card/demo/notitle.md +1 -1
- package/components/drawer/drawer.jsx +48 -74
- package/components/drawer/styles/index.less +38 -67
- package/components/dropdown/demo/rightmenu.md +1 -1
- package/components/dropdown/styles/index.less +180 -24
- package/components/form/demo/valid.md +1 -0
- package/components/grid/demo/align.md +5 -5
- package/components/grid/demo/basic.md +2 -2
- package/components/grid/demo/fill.md +8 -8
- package/components/grid/demo/flex.md +7 -7
- package/components/grid/demo/gutter.md +2 -4
- package/components/grid/demo/offset.md +5 -5
- package/components/input/demo/icon.md +9 -2
- package/components/input/demo/theme.md +1 -1
- package/components/layout/demo/layout2.md +0 -12
- package/components/menu/styles/index.less +229 -375
- package/components/select/demo/filterable.md +1 -0
- package/components/select/demo/multiple.md +3 -0
- package/components/select/select.jsx +19 -17
- package/components/statCard/demo/with-card.md +1 -1
- package/components/table/demo/custom-header.md +1 -1
- package/components/tabs/demo/sample.md +1 -1
- package/components/treeselect/treeselect.jsx +13 -15
- package/components/utils/vnode.jsx +46 -25
- package/dist/k-ui.cjs.js +2 -2
- package/dist/k-ui.css +2 -2
- package/dist/k-ui.d.ts +95 -95
- 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/affix/Affix.d.ts +1 -1
- package/types/alert/Alert.d.ts +1 -1
- package/types/avatar/Avatar.d.ts +1 -1
- package/types/backtop/BackTop.d.ts +1 -1
- package/types/badge/Badge.d.ts +1 -1
- package/types/breadcrumb/Breadcrumb.d.ts +1 -1
- package/types/breadcrumb/BreadcrumbItem.d.ts +1 -1
- package/types/button/Button.d.ts +1 -1
- package/types/button/ButtonGroup.d.ts +1 -1
- package/types/card/Card.d.ts +1 -1
- package/types/carousel/Carousel.d.ts +1 -1
- package/types/carousel/CarouselItem.d.ts +1 -1
- package/types/checkbox/Checkbox.d.ts +1 -1
- package/types/checkbox/CheckboxGroup.d.ts +1 -1
- package/types/collapse/Collapse.d.ts +1 -1
- package/types/collapse/CollapsePanel.d.ts +1 -1
- package/types/colorPicker/ColorPicker.d.ts +1 -1
- package/types/datePicker/DatePicker.d.ts +1 -1
- package/types/descriptions/Descriptions.d.ts +1 -1
- package/types/descriptions/DescriptionsItem.d.ts +1 -1
- package/types/divider/Divider.d.ts +1 -1
- package/types/drawer/Drawer.d.ts +2 -2
- package/types/dropdown/Dropdown.d.ts +1 -1
- package/types/dropdown/DropdownButton.d.ts +1 -1
- package/types/empty/Empty.d.ts +1 -1
- package/types/flex/Flex.d.ts +1 -1
- package/types/form/Form.d.ts +1 -1
- package/types/form/formitem.d.ts +1 -1
- package/types/grid/Col.d.ts +1 -1
- package/types/grid/Row.d.ts +1 -1
- package/types/icon/Icon.d.ts +1 -1
- package/types/image/ImageGroup.d.ts +1 -1
- package/types/image/KImage.d.ts +1 -1
- package/types/index.d.ts +2 -2
- package/types/input/Input.d.ts +1 -1
- package/types/input/InputGroup.d.ts +1 -1
- package/types/input/TextArea.d.ts +1 -1
- package/types/inputNumber/InputNumber.d.ts +1 -1
- package/types/layout/sider.d.ts +1 -1
- package/types/loading/loading.d.ts +1 -1
- package/types/menu/Menu.d.ts +1 -1
- package/types/menu/MenuDivider.d.ts +1 -1
- package/types/menu/MenuGroup.d.ts +1 -1
- package/types/menu/MenuItem.d.ts +1 -1
- package/types/menu/SubMenu.d.ts +1 -1
- package/types/modal/Modal.d.ts +1 -1
- package/types/page/Page.d.ts +1 -1
- package/types/popconfirm/Popconfirm.d.ts +1 -1
- package/types/poptip/Poptip.d.ts +1 -1
- package/types/progress/Progress.d.ts +1 -1
- package/types/radio/Radio.d.ts +1 -1
- package/types/radio/RadioButton.d.ts +1 -1
- package/types/radio/RadioGroup.d.ts +1 -1
- package/types/rate/Rate.d.ts +1 -1
- package/types/select/Option.d.ts +1 -1
- package/types/select/Select.d.ts +1 -1
- package/types/skeleton/Skeleton.d.ts +1 -1
- package/types/skeleton/SkeletonAvatar.d.ts +1 -1
- package/types/skeleton/SkeletonButton.d.ts +1 -1
- package/types/skeleton/SkeletonImage.d.ts +1 -1
- package/types/skeleton/SkeletonText.d.ts +1 -1
- package/types/slider/Slider.d.ts +1 -1
- package/types/space/Space.d.ts +1 -1
- package/types/spin/Spin.d.ts +1 -1
- package/types/statCard/StatCard.d.ts +1 -1
- package/types/statCard/StatNumber.d.ts +1 -1
- package/types/switch/Switch.d.ts +1 -1
- package/types/table/Table.d.ts +1 -1
- package/types/tabs/TabPanel.d.ts +1 -1
- package/types/tabs/Tabs.d.ts +1 -1
- package/types/tag/Tag.d.ts +1 -1
- package/types/timeline/TimeLine.d.ts +1 -1
- package/types/timeline/TimeLineItem.d.ts +1 -1
- package/types/tooltip/Tooltip.d.ts +1 -1
- package/types/tree/Tree.d.ts +1 -1
- package/types/treeselect/TreeSelect.d.ts +1 -1
- package/types/upload/Upload.d.ts +1 -1
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
```vue
|
|
7
7
|
<template>
|
|
8
8
|
<Space vertical block>
|
|
9
|
+
<code>v-model: {{value1}}</code>
|
|
9
10
|
use options to set options
|
|
10
11
|
<Select v-model="value1" block :options="data" multiple />
|
|
11
12
|
<br />
|
|
13
|
+
<code>v-model: {{value2}}</code>
|
|
12
14
|
use children to set options
|
|
13
15
|
<Select v-model="value2" block multiple>
|
|
14
16
|
<Option :value="0">Grape</Option>
|
|
@@ -18,6 +20,7 @@
|
|
|
18
20
|
<Option :value="4" label="Pear" />
|
|
19
21
|
</Select>
|
|
20
22
|
<br />
|
|
23
|
+
<code>v-model: {{value3}}</code>
|
|
21
24
|
maxTagCount:
|
|
22
25
|
<Select v-model="value3" block :maxTagCount="2" :options="data" multiple />
|
|
23
26
|
</Space>
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
onMounted,
|
|
21
21
|
computed,
|
|
22
22
|
onBeforeUpdate,
|
|
23
|
+
onBeforeUnmount,
|
|
23
24
|
// cloneVNode,
|
|
24
25
|
} from "vue";
|
|
25
26
|
|
|
@@ -138,6 +139,7 @@ const Select = defineComponent({
|
|
|
138
139
|
|
|
139
140
|
const scrollOptionIntoView = () => {
|
|
140
141
|
const containerEl = refPopper.value;
|
|
142
|
+
if (!containerEl) return;
|
|
141
143
|
const optionEl = refPopper.value.children[0].children[activeIndex.value];
|
|
142
144
|
const optionTop = optionEl.offsetTop;
|
|
143
145
|
const optionHeight = optionEl.offsetHeight;
|
|
@@ -148,7 +150,10 @@ const Select = defineComponent({
|
|
|
148
150
|
};
|
|
149
151
|
const onKeydown = (e) => {
|
|
150
152
|
const key = e.key;
|
|
151
|
-
if (
|
|
153
|
+
if (
|
|
154
|
+
(!visible.value || optionsData.value.length == 0) &&
|
|
155
|
+
ctxFocused.value
|
|
156
|
+
) {
|
|
152
157
|
if (key === "ArrowDown" || key === "ArrowUp") {
|
|
153
158
|
toggle();
|
|
154
159
|
}
|
|
@@ -196,7 +201,7 @@ const Select = defineComponent({
|
|
|
196
201
|
}
|
|
197
202
|
}
|
|
198
203
|
};
|
|
199
|
-
|
|
204
|
+
onBeforeUnmount(() => {
|
|
200
205
|
document.removeEventListener("keydown", onKeydown);
|
|
201
206
|
document.removeEventListener("click", outsideClick);
|
|
202
207
|
});
|
|
@@ -206,7 +211,7 @@ const Select = defineComponent({
|
|
|
206
211
|
optionsData.value.forEach((item) => {
|
|
207
212
|
lookup.set(item.value, item.label);
|
|
208
213
|
});
|
|
209
|
-
return currentValue.value.map(val => lookup.get(val) ?? val);
|
|
214
|
+
return currentValue.value.map((val) => lookup.get(val) ?? val);
|
|
210
215
|
});
|
|
211
216
|
|
|
212
217
|
const updatePosition = () => {
|
|
@@ -292,11 +297,7 @@ const Select = defineComponent({
|
|
|
292
297
|
clearQuery();
|
|
293
298
|
activeIndex.value = -1;
|
|
294
299
|
}
|
|
295
|
-
|
|
296
|
-
// emit("update:value", result);
|
|
297
|
-
emit("input", result);
|
|
298
|
-
|
|
299
|
-
emit("change", result);
|
|
300
|
+
emitValue();
|
|
300
301
|
emit("select", { value, label, selected });
|
|
301
302
|
};
|
|
302
303
|
const searchInput = (e) => {
|
|
@@ -335,17 +336,23 @@ const Select = defineComponent({
|
|
|
335
336
|
});
|
|
336
337
|
}
|
|
337
338
|
};
|
|
338
|
-
|
|
339
|
+
const emitValue = () => {
|
|
340
|
+
const result = ps.multiple
|
|
341
|
+
? currentValue.value
|
|
342
|
+
: currentValue.value[0] || null;
|
|
343
|
+
emit("input", result);
|
|
344
|
+
emit("change", result);
|
|
345
|
+
};
|
|
339
346
|
const removeTag = (e, index) => {
|
|
340
347
|
if (ps.disabled) return;
|
|
341
348
|
currentValue.value.splice(index, 1);
|
|
342
349
|
e.stopPropagation();
|
|
343
350
|
updatePosition();
|
|
351
|
+
emitValue();
|
|
344
352
|
};
|
|
345
353
|
const onClear = (e) => {
|
|
346
354
|
currentValue.value = [];
|
|
347
|
-
|
|
348
|
-
emit("change", ps.multiple ? [] : "");
|
|
355
|
+
emitValue();
|
|
349
356
|
clearQuery();
|
|
350
357
|
e.stopPropagation();
|
|
351
358
|
};
|
|
@@ -450,12 +457,7 @@ const Select = defineComponent({
|
|
|
450
457
|
currentValue.value.length > 0
|
|
451
458
|
) {
|
|
452
459
|
currentValue.value = currentValue.value.slice(0, -1);
|
|
453
|
-
|
|
454
|
-
// emit("update:value", currentValue.value);
|
|
455
|
-
emit(
|
|
456
|
-
"change",
|
|
457
|
-
ps.multiple ? currentValue.value : currentValue.value[0] || ""
|
|
458
|
-
);
|
|
460
|
+
emitValue();
|
|
459
461
|
updatePosition();
|
|
460
462
|
}
|
|
461
463
|
}
|
|
@@ -207,18 +207,24 @@ const TreeSelect = defineComponent({
|
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
209
|
};
|
|
210
|
+
const emitValue = () => {
|
|
211
|
+
const result = ps.multiple
|
|
212
|
+
? currentValue.value
|
|
213
|
+
: currentValue.value[0] || null;
|
|
214
|
+
emit("input", result);
|
|
215
|
+
emit("change", result);
|
|
216
|
+
};
|
|
210
217
|
|
|
211
218
|
const removeTag = (e, index) => {
|
|
212
219
|
if (ps.disabled) return;
|
|
213
220
|
currentValue.value.splice(index, 1);
|
|
214
221
|
e.stopPropagation();
|
|
222
|
+
emitValue();
|
|
215
223
|
updatePosition();
|
|
216
224
|
};
|
|
217
225
|
const onClear = (e) => {
|
|
218
226
|
currentValue.value = [];
|
|
219
|
-
|
|
220
|
-
emit("change", ps.multiple ? [] : "");
|
|
221
|
-
|
|
227
|
+
emitValue();
|
|
222
228
|
clearQuery();
|
|
223
229
|
e.stopPropagation();
|
|
224
230
|
};
|
|
@@ -263,7 +269,7 @@ const TreeSelect = defineComponent({
|
|
|
263
269
|
optionsData.value.forEach((item) => {
|
|
264
270
|
lookup.set(item.value, item.label);
|
|
265
271
|
});
|
|
266
|
-
return currentValue.value.map(val => lookup.get(val) ?? val);
|
|
272
|
+
return currentValue.value.map((val) => lookup.get(val) ?? val);
|
|
267
273
|
});
|
|
268
274
|
|
|
269
275
|
const optionsData = computed(() => {
|
|
@@ -303,7 +309,7 @@ const TreeSelect = defineComponent({
|
|
|
303
309
|
const onCheck = ({ key }, checked, checkedKeys) => {
|
|
304
310
|
const result = [...checkedKeys];
|
|
305
311
|
currentValue.value = result;
|
|
306
|
-
|
|
312
|
+
emitValue();
|
|
307
313
|
};
|
|
308
314
|
const onSelect = (item) => {
|
|
309
315
|
const { key: value, title: label } = { ...item };
|
|
@@ -329,10 +335,7 @@ const TreeSelect = defineComponent({
|
|
|
329
335
|
visible.value = false;
|
|
330
336
|
clearQuery();
|
|
331
337
|
}
|
|
332
|
-
|
|
333
|
-
// emit("update:value", result);
|
|
334
|
-
emit("input", result);
|
|
335
|
-
emit("change", result);
|
|
338
|
+
emitValue();
|
|
336
339
|
emit("select", value, label, selected);
|
|
337
340
|
};
|
|
338
341
|
const renderTree = () => {
|
|
@@ -369,12 +372,7 @@ const TreeSelect = defineComponent({
|
|
|
369
372
|
currentValue.value.length > 0
|
|
370
373
|
) {
|
|
371
374
|
currentValue.value = currentValue.value.slice(0, -1);
|
|
372
|
-
|
|
373
|
-
// emit("update:value", currentValue.value);
|
|
374
|
-
emit(
|
|
375
|
-
"change",
|
|
376
|
-
ps.multiple ? currentValue.value : currentValue.value[0] || ""
|
|
377
|
-
);
|
|
375
|
+
emitValue();
|
|
378
376
|
updatePosition();
|
|
379
377
|
}
|
|
380
378
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// import { isVNode, Comment, Fragment, Text, cloneVNode } from "vue"; // for v3
|
|
2
2
|
// import Vue from "vue";
|
|
3
3
|
// const { Comment, Fragment, Text } = Vue;
|
|
4
|
-
|
|
4
|
+
import hashId from "hash-sum";
|
|
5
5
|
import { isVNode, cloneVNode } from "../utils/vue";
|
|
6
6
|
export function cloneNodes(vnode, props, merge = false, child) {
|
|
7
7
|
return vnode.length == 1
|
|
8
|
-
? cloneVNode(vnode[0], props, merge
|
|
8
|
+
? cloneVNode(vnode[0], props, merge)
|
|
9
9
|
: cloneVNode(<span>{vnode}</span>, props, merge, child);
|
|
10
10
|
}
|
|
11
11
|
export function getChildren(VNodes) {
|
|
@@ -30,26 +30,47 @@ export function getChildren(VNodes) {
|
|
|
30
30
|
loop(VNodes);
|
|
31
31
|
return result;
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
33
|
+
let scrollbarWidth = null;
|
|
34
|
+
|
|
35
|
+
const getScrollbarWidth = () => {
|
|
36
|
+
if (scrollbarWidth !== null) {
|
|
37
|
+
return scrollbarWidth;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const outer = document.createElement("div");
|
|
41
|
+
outer.style.visibility = "hidden";
|
|
42
|
+
outer.style.overflow = "scroll";
|
|
43
|
+
outer.style.msOverflowStyle = "scrollbar";
|
|
44
|
+
document.body.appendChild(outer);
|
|
45
|
+
|
|
46
|
+
const inner = document.createElement("div");
|
|
47
|
+
outer.appendChild(inner);
|
|
48
|
+
|
|
49
|
+
scrollbarWidth = outer.offsetWidth - outer.clientWidth;
|
|
50
|
+
|
|
51
|
+
outer.parentNode.removeChild(outer);
|
|
52
|
+
|
|
53
|
+
return scrollbarWidth;
|
|
54
|
+
};
|
|
55
|
+
const injectedStyles = new Map();
|
|
56
|
+
export const toggleContainerScroll = (target, lock) => {
|
|
57
|
+
if (!target || target != document.body) return;
|
|
58
|
+
if (lock) {
|
|
59
|
+
if (injectedStyles.has("body")) return;
|
|
60
|
+
const scrollbarWidth = getScrollbarWidth();
|
|
61
|
+
const styleElement = document.createElement("style");
|
|
62
|
+
styleElement.type = "text/css";
|
|
63
|
+
const styleContent = `html body { overflow: hidden !important; width: calc(100vw - ${scrollbarWidth}px); }`;
|
|
64
|
+
styleElement.appendChild(document.createTextNode(styleContent));
|
|
65
|
+
document.head.appendChild(styleElement);
|
|
66
|
+
|
|
67
|
+
injectedStyles.set("body", styleElement);
|
|
68
|
+
} else {
|
|
69
|
+
// 移除对应的样式
|
|
70
|
+
const styleElement = injectedStyles.get("body");
|
|
71
|
+
if (styleElement && styleElement.parentNode) {
|
|
72
|
+
styleElement.parentNode.removeChild(styleElement);
|
|
73
|
+
injectedStyles.delete("body");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|