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.
Files changed (122) hide show
  1. package/components/card/demo/border.md +1 -1
  2. package/components/card/demo/notitle.md +1 -1
  3. package/components/drawer/drawer.jsx +48 -74
  4. package/components/drawer/styles/index.less +38 -67
  5. package/components/dropdown/demo/rightmenu.md +1 -1
  6. package/components/dropdown/styles/index.less +180 -24
  7. package/components/form/demo/valid.md +1 -0
  8. package/components/grid/demo/align.md +5 -5
  9. package/components/grid/demo/basic.md +2 -2
  10. package/components/grid/demo/fill.md +8 -8
  11. package/components/grid/demo/flex.md +7 -7
  12. package/components/grid/demo/gutter.md +2 -4
  13. package/components/grid/demo/offset.md +5 -5
  14. package/components/input/demo/icon.md +9 -2
  15. package/components/input/demo/theme.md +1 -1
  16. package/components/layout/demo/layout2.md +0 -12
  17. package/components/menu/styles/index.less +229 -375
  18. package/components/select/demo/filterable.md +1 -0
  19. package/components/select/demo/multiple.md +3 -0
  20. package/components/select/select.jsx +19 -17
  21. package/components/statCard/demo/with-card.md +1 -1
  22. package/components/table/demo/custom-header.md +1 -1
  23. package/components/tabs/demo/sample.md +1 -1
  24. package/components/treeselect/treeselect.jsx +13 -15
  25. package/components/utils/vnode.jsx +46 -25
  26. package/dist/k-ui.cjs.js +2 -2
  27. package/dist/k-ui.css +2 -2
  28. package/dist/k-ui.d.ts +95 -95
  29. package/dist/k-ui.esm.js +2 -2
  30. package/dist/k-ui.umd.js +2 -2
  31. package/dist/locale/de.js +1 -1
  32. package/dist/locale/el.js +1 -1
  33. package/dist/locale/en.js +1 -1
  34. package/dist/locale/fr.js +1 -1
  35. package/dist/locale/it.js +1 -1
  36. package/dist/locale/ja.js +1 -1
  37. package/dist/locale/ko.js +1 -1
  38. package/dist/locale/ru.js +1 -1
  39. package/dist/locale/th.js +1 -1
  40. package/dist/locale/ua.js +2 -2
  41. package/dist/locale/uk.js +1 -1
  42. package/dist/locale/vi.js +1 -1
  43. package/dist/locale/zh-CN.js +1 -1
  44. package/dist/locale/zh-TW.js +1 -1
  45. package/package.json +1 -1
  46. package/types/affix/Affix.d.ts +1 -1
  47. package/types/alert/Alert.d.ts +1 -1
  48. package/types/avatar/Avatar.d.ts +1 -1
  49. package/types/backtop/BackTop.d.ts +1 -1
  50. package/types/badge/Badge.d.ts +1 -1
  51. package/types/breadcrumb/Breadcrumb.d.ts +1 -1
  52. package/types/breadcrumb/BreadcrumbItem.d.ts +1 -1
  53. package/types/button/Button.d.ts +1 -1
  54. package/types/button/ButtonGroup.d.ts +1 -1
  55. package/types/card/Card.d.ts +1 -1
  56. package/types/carousel/Carousel.d.ts +1 -1
  57. package/types/carousel/CarouselItem.d.ts +1 -1
  58. package/types/checkbox/Checkbox.d.ts +1 -1
  59. package/types/checkbox/CheckboxGroup.d.ts +1 -1
  60. package/types/collapse/Collapse.d.ts +1 -1
  61. package/types/collapse/CollapsePanel.d.ts +1 -1
  62. package/types/colorPicker/ColorPicker.d.ts +1 -1
  63. package/types/datePicker/DatePicker.d.ts +1 -1
  64. package/types/descriptions/Descriptions.d.ts +1 -1
  65. package/types/descriptions/DescriptionsItem.d.ts +1 -1
  66. package/types/divider/Divider.d.ts +1 -1
  67. package/types/drawer/Drawer.d.ts +2 -2
  68. package/types/dropdown/Dropdown.d.ts +1 -1
  69. package/types/dropdown/DropdownButton.d.ts +1 -1
  70. package/types/empty/Empty.d.ts +1 -1
  71. package/types/flex/Flex.d.ts +1 -1
  72. package/types/form/Form.d.ts +1 -1
  73. package/types/form/formitem.d.ts +1 -1
  74. package/types/grid/Col.d.ts +1 -1
  75. package/types/grid/Row.d.ts +1 -1
  76. package/types/icon/Icon.d.ts +1 -1
  77. package/types/image/ImageGroup.d.ts +1 -1
  78. package/types/image/KImage.d.ts +1 -1
  79. package/types/index.d.ts +2 -2
  80. package/types/input/Input.d.ts +1 -1
  81. package/types/input/InputGroup.d.ts +1 -1
  82. package/types/input/TextArea.d.ts +1 -1
  83. package/types/inputNumber/InputNumber.d.ts +1 -1
  84. package/types/layout/sider.d.ts +1 -1
  85. package/types/loading/loading.d.ts +1 -1
  86. package/types/menu/Menu.d.ts +1 -1
  87. package/types/menu/MenuDivider.d.ts +1 -1
  88. package/types/menu/MenuGroup.d.ts +1 -1
  89. package/types/menu/MenuItem.d.ts +1 -1
  90. package/types/menu/SubMenu.d.ts +1 -1
  91. package/types/modal/Modal.d.ts +1 -1
  92. package/types/page/Page.d.ts +1 -1
  93. package/types/popconfirm/Popconfirm.d.ts +1 -1
  94. package/types/poptip/Poptip.d.ts +1 -1
  95. package/types/progress/Progress.d.ts +1 -1
  96. package/types/radio/Radio.d.ts +1 -1
  97. package/types/radio/RadioButton.d.ts +1 -1
  98. package/types/radio/RadioGroup.d.ts +1 -1
  99. package/types/rate/Rate.d.ts +1 -1
  100. package/types/select/Option.d.ts +1 -1
  101. package/types/select/Select.d.ts +1 -1
  102. package/types/skeleton/Skeleton.d.ts +1 -1
  103. package/types/skeleton/SkeletonAvatar.d.ts +1 -1
  104. package/types/skeleton/SkeletonButton.d.ts +1 -1
  105. package/types/skeleton/SkeletonImage.d.ts +1 -1
  106. package/types/skeleton/SkeletonText.d.ts +1 -1
  107. package/types/slider/Slider.d.ts +1 -1
  108. package/types/space/Space.d.ts +1 -1
  109. package/types/spin/Spin.d.ts +1 -1
  110. package/types/statCard/StatCard.d.ts +1 -1
  111. package/types/statCard/StatNumber.d.ts +1 -1
  112. package/types/switch/Switch.d.ts +1 -1
  113. package/types/table/Table.d.ts +1 -1
  114. package/types/tabs/TabPanel.d.ts +1 -1
  115. package/types/tabs/Tabs.d.ts +1 -1
  116. package/types/tag/Tag.d.ts +1 -1
  117. package/types/timeline/TimeLine.d.ts +1 -1
  118. package/types/timeline/TimeLineItem.d.ts +1 -1
  119. package/types/tooltip/Tooltip.d.ts +1 -1
  120. package/types/tree/Tree.d.ts +1 -1
  121. package/types/treeselect/TreeSelect.d.ts +1 -1
  122. package/types/upload/Upload.d.ts +1 -1
@@ -1,6 +1,7 @@
1
1
  <cn>
2
2
  ### 过滤 和 搜索
3
3
  通过设置 `filterable` 值来呈现过滤模式
4
+ 注意: filterable 和 onSearch 不可以同时使用,搜索的结果会被过滤
4
5
  </cn>
5
6
 
6
7
  ```vue
@@ -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 ((!visible.value || optionsData.value.size == 0) && ctxFocused.value) {
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
- onBeforeMount(() => {
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
- const result = ps.multiple ? currentValue.value : currentValue.value[0];
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
- emit("input", ps.multiple ? [] : "");
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
- emit("input", currentValue.value);
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
  }
@@ -4,7 +4,7 @@
4
4
 
5
5
  ```vue
6
6
  <template>
7
- <Space vertical class="demo-back">
7
+ <Space vertical class="demo-view-fill">
8
8
  <Card :bordered="false">
9
9
  <StatNumber
10
10
  v-model="value"
@@ -58,7 +58,7 @@ const columns = [
58
58
  {
59
59
  title: "Operate",
60
60
  key: "action",
61
- width: 80,
61
+ width: 90,
62
62
  },
63
63
  ];
64
64
  const show = (record) => {
@@ -5,7 +5,7 @@
5
5
 
6
6
  ```vue
7
7
  <template>
8
- <div class="demo-back">
8
+ <div class="demo-view-fill">
9
9
  <Tabs v-model="current" sample @change="change">
10
10
  <TabPanel key="1" title="Tab 1">
11
11
  <p>Content of Tab Pane 1</p>
@@ -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
- emit("input", ps.multiple ? [] : "");
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
- emit("input", result);
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
- const result = ps.multiple ? currentValue.value : currentValue.value[0];
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
- emit("input", currentValue.value);
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
- // export function getChildrenV3(VNodes) {
34
- // const result = [];
35
- // const loop = (nodes) => {
36
- // nodes?.forEach((vnode) => {
37
- // if (!isVNode(vnode)) return;
38
- // console.log(vnode.type);
39
- // if (vnode.type === Comment) return;
40
- // if (vnode.type === Text && vnode.children?.toString().trim() === "")
41
- // return;
42
-
43
- // // 处理 Fragment 节点
44
- // if (vnode.type === Fragment && Array.isArray(vnode.children)) {
45
- // loop(vnode.children);
46
- // return;
47
- // }
48
-
49
- // result.push(vnode);
50
- // });
51
- // };
52
-
53
- // loop(VNodes);
54
- // return result;
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
+ };