kui-vue 3.4.4 → 3.4.6

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 (56) hide show
  1. package/components/_tool/clone.js +0 -1
  2. package/components/avatar/AvatarGroup.jsx +1 -1
  3. package/components/base/input.jsx +2 -2
  4. package/components/base/pop.jsx +2 -2
  5. package/components/button/button.jsx +6 -3
  6. package/components/button/demo/disabled.md +5 -5
  7. package/components/button/demo/light.md +0 -1
  8. package/components/button/demo/size.md +12 -13
  9. package/components/button/index.md +12 -9
  10. package/components/button/styles/index.less +5 -2
  11. package/components/datePicker/styles/datepicker.less +2 -0
  12. package/components/dropdown/dropdown.jsx +1 -1
  13. package/components/flex/demo/align.md +37 -0
  14. package/components/flex/demo/base.md +27 -0
  15. package/components/flex/demo/index.vue +23 -0
  16. package/components/flex/demo/info.md +14 -0
  17. package/components/flex/demo/size.md +46 -0
  18. package/components/flex/demo/wrap.md +26 -0
  19. package/components/flex/flex.jsx +50 -0
  20. package/components/flex/index.js +2 -0
  21. package/components/flex/index.md +8 -0
  22. package/components/flex/styles/index.less +54 -0
  23. package/components/form/styles/index.less +2 -4
  24. package/components/icon/demo/search.vue +18 -27
  25. package/components/index.js +4 -2
  26. package/components/input/demo/group.md +106 -0
  27. package/components/input/demo/index.vue +2 -0
  28. package/components/input/demo/suffix.md +5 -10
  29. package/components/input/index.js +2 -1
  30. package/components/input/inputGroup.jsx +63 -0
  31. package/components/input/styles/index.less +59 -5
  32. package/components/inputNumber/styles/index.less +0 -1
  33. package/components/popconfirm/popconfirm.jsx +1 -1
  34. package/components/poptip/demo/base.md +1 -1
  35. package/components/poptip/styles/index.less +15 -9
  36. package/components/radio/group.jsx +12 -0
  37. package/components/select/styles/index.less +2 -2
  38. package/components/slider/slider.jsx +6 -2
  39. package/components/space/demo/align.md +25 -23
  40. package/components/space/demo/compact-button-vertical.md +56 -0
  41. package/components/space/demo/compact-button.md +60 -0
  42. package/components/space/demo/compact.md +106 -0
  43. package/components/space/demo/custom-size.md +0 -2
  44. package/components/space/demo/index.vue +11 -3
  45. package/components/space/demo/split.md +15 -0
  46. package/components/space/demo/wrap.md +2 -2
  47. package/components/space/index.md +9 -6
  48. package/components/space/space.jsx +61 -36
  49. package/components/space/styles/index.less +67 -9
  50. package/components/styles/index.less +1 -0
  51. package/components/styles/sys.less +11 -1
  52. package/components/tooltip/styles/index.less +0 -1
  53. package/components/tooltip/tooltip.jsx +1 -1
  54. package/dist/k-ui.css +2 -2
  55. package/dist/k-ui.js +2 -2
  56. package/package.json +1 -1
@@ -0,0 +1,60 @@
1
+ <cn>
2
+ #### Button 紧凑布局
3
+ Button 组件紧凑排列的示例。
4
+ </cn>
5
+
6
+ ```vue
7
+ <template>
8
+ <Space vertical size="middle">
9
+ <space compact>
10
+ <Tooltip placement="top" title="Copy">
11
+ <Button :icon="CloudDownloadOutline"></Button>
12
+ </Tooltip>
13
+ <Button :icon="GameControllerOutline"></Button>
14
+ <Button :icon="HeartOutline"></Button>
15
+ <Button :icon="MailOutline"></Button>
16
+ <Button :icon="ShirtOutline"></Button>
17
+ <Dropdown placement="bottom-right">
18
+ <Button :icon="Ellipsis"></Button>
19
+ <Menu slot="content">
20
+ <MenuItem>
21
+ <a href="javascript:;">1st menu item</a>
22
+ </MenuItem>
23
+ <MenuItem>
24
+ <a href="javascript:;">2nd menu item</a>
25
+ </MenuItem>
26
+ <MenuItem>
27
+ <a href="javascript:;">3rd menu item</a>
28
+ </MenuItem>
29
+ </Menu>
30
+ </Dropdown>
31
+ </space>
32
+ <space compact>
33
+ <Button type="primary">Button1</Button>
34
+ <Button type="primary">Button2</Button>
35
+ <Button type="primary">Button3</Button>
36
+ <Button type="primary">Button4</Button>
37
+ </space>
38
+ <space compact>
39
+ <Button>Button1</Button>
40
+ <Button>Button2</Button>
41
+ <Button>Button3</Button>
42
+ <Button :icon="ShirtOutline" disabled></Button>
43
+ <Button :icon="ShirtOutline"></Button>
44
+ <Button>Button4</Button>
45
+ </space>
46
+
47
+ </Space>
48
+ </template>
49
+ <script>
50
+ import { Copy ,CloudDownloadOutline,Ellipsis,GameControllerOutline,HeartOutline,MailOutline,ShirtOutline} from 'kui-icons'
51
+ export default{
52
+ data(){
53
+ return{
54
+ Copy ,CloudDownloadOutline,GameControllerOutline,
55
+ HeartOutline,MailOutline,ShirtOutline,Ellipsis
56
+ }
57
+ }
58
+ }
59
+ </script>
60
+ ```
@@ -0,0 +1,106 @@
1
+ <cn>
2
+ #### 紧凑布局组合
3
+ 使用 compact 让表单组件之间紧凑连接且合并边框。
4
+ </cn>
5
+
6
+ ```vue
7
+ <template>
8
+ <Space vertical size="middle">
9
+ <space compact>
10
+ <Input style="width:20%" value="027" />
11
+ <Input style="width:30%" value="28398987" />
12
+ </space>
13
+ <Space compact size="small">
14
+ <Input :style="{ width: 'calc(100% - 200px)' }" value="https://k-ui.cn" />
15
+ <Button type="primary">Submit</Button>
16
+ </Space>
17
+ <Space compact>
18
+ <Input :style="{ width: 'calc(100% - 200px)' }" value="https://k-ui.cn" />
19
+ <Button type="primary">Submit</Button>
20
+ </Space>
21
+ <Space compact>
22
+ <Input :style="{ width: 'calc(100% - 200px)' }" value="git@gitee.com:chuchur/kui-vue.git" />
23
+ <Tooltip title="copy git url">
24
+ <Button :icon="Copy"></Button>
25
+ </Tooltip>
26
+ </Space>
27
+ <Space compact>
28
+ <Select value="Shenzheng" clearable>
29
+ <Option value="Wuhan">Wuhan001</Option>
30
+ <Option value="Shenzheng">Shenzheng</Option>
31
+ </Select>
32
+ <Input :style="{ width: '50%' }" value="Nanshan District, Shenzheng" />
33
+ </Space>
34
+ <Space compact>
35
+ <Select clearable multiple :value="['Wuhan001']" :style="{ width: '50%' }">
36
+ <Option value="Wuhan001">Wuhan001</Option>
37
+ <Option value="Shenzheng">Shenzheng</Option>
38
+ </Select>
39
+ <Input :style="{ width: '50%' }" value="Nanshan District, Shenzheng" />
40
+ </Space>
41
+ <Space compact>
42
+ <Input :style="{ width: '30%' }" value="0755" />
43
+ <Input clearable :style="{ width: '50%' }" value="28398987" />
44
+ <Input :style="{ width: '20%' }" value="+1" />
45
+ </Space>
46
+ <Space compact>
47
+ <Select value="Option1">
48
+ <Option value="Option1">Option1</Option>
49
+ <Option value="Option2">Option2</Option>
50
+ </Select>
51
+ <Input :style="{ width: '50%' }" value="input content" />
52
+ <InputNumber :value="12" />
53
+ </Space>
54
+ <Space compact>
55
+ <Input :style="{ width: '50%' }" value="input content" />
56
+ <DatePicker />
57
+ </Space>
58
+ <Space compact>
59
+ <DatePicker mode="dateRange"/>
60
+ <Input :style="{ width: '30%' }" value="input content" />
61
+ <Button type="primary">查询</Button>
62
+ </Space>
63
+ <Space compact>
64
+ <Input :style="{ width: '30%' }" value="input content" />
65
+ <DatePicker mdoe="dateRange"/>
66
+ </Space>
67
+ <Space compact>
68
+ <Select value="Option1-1">
69
+ <Option value="Option1-1">Option1-1</Option>
70
+ <Option value="Option1-2">Option1-2</Option>
71
+ </Select>
72
+ <Select value="Option2-2">
73
+ <Option value="Option2-1">Option2-1</Option>
74
+ <Option value="Option2-2">Option2-2</Option>
75
+ </Select>
76
+ </Space>
77
+ <Space compact>
78
+ <Select value="1">
79
+ <Option value="1">Between</Option>
80
+ <Option value="2">Except</Option>
81
+ </Select>
82
+ <Input :style="{ width: '100px', textAlig: 'center' }" placeholder="Minimum" />
83
+ <Input :style="{
84
+ width: '30px',
85
+ borderLef: 0,
86
+ borderRight: 0,
87
+ pointerEvents: 'none',
88
+ }" placeholder="~" disabled />
89
+ <Input :style="{
90
+ width: '100px',
91
+ textAlig: 'center',
92
+ }" placeholder="Maximum" />
93
+ </Space>
94
+ </Space>
95
+ </template>
96
+ <script>
97
+ import { Copy } from 'kui-icons'
98
+ export default{
99
+ data(){
100
+ return{
101
+ Copy
102
+ }
103
+ }
104
+ }
105
+ </script>
106
+ ```
@@ -7,8 +7,6 @@
7
7
  <template>
8
8
  <div>
9
9
  <Slider v-model="size" :max="50"/>
10
- <br/>
11
- <br/>
12
10
  <Space :size="size">
13
11
  <Button type="primary">Primary</Button>
14
12
  <Button type="danger">Danger</Button>
@@ -4,21 +4,29 @@ import Base from "./base.md";
4
4
  import Vertical from "./vertical.md";
5
5
  import Align from "./align.md";
6
6
  import Size from "./size.md";
7
- import Warp from "./wrap.md";
8
7
  import CustomSize from "./custom-size.md";
8
+ import Warp from "./wrap.md";
9
+ import Split from "./split.md";
10
+ import Compact from "./compact.md";
11
+ import CompactButton from "./compact-button.md";
12
+ import CompactButtonVertical from "./compact-button-vertical.md";
9
13
 
10
14
  import CN from "../index.md";
11
15
  export default {
12
16
  render() {
13
17
  return (
14
18
  <div class="demo-space">
15
- <Info />
19
+ <Info />
16
20
  <Base />
17
21
  <Vertical />
18
22
  <Size />
19
23
  <Align />
20
24
  <CustomSize />
21
- <Warp />
25
+ <Warp />
26
+ <Split />
27
+ <Compact />
28
+ <CompactButton />
29
+ <CompactButtonVertical/>
22
30
  <CN />
23
31
  </div>
24
32
  );
@@ -0,0 +1,15 @@
1
+ <cn>
2
+ #### 分隔符
3
+ 相邻组件分隔符。
4
+ </cn>
5
+
6
+ ```vue
7
+ <template>
8
+ <Space>
9
+ <Divider slot="split" type="vertical"></Divider>
10
+ <a href="#" type="link">Edit</a>
11
+ <a href="#" type="link">Save</a>
12
+ <a href="#" type="link">Delete</a>
13
+ </Space>
14
+ </template>
15
+ ```
@@ -5,8 +5,8 @@
5
5
 
6
6
  ```vue
7
7
  <template>
8
- <Space :size="[8,20]" wrap style="width:200px;">
9
- <Button size="small" v-for="x in 10" :key="x">Wrap</Button>
8
+ <Space :size="[8,20]" wrap>
9
+ <Button size="small" v-for="x in 25" :key="x">Wrap</Button>
10
10
  </Space>
11
11
  </template>
12
12
  ```
@@ -1,7 +1,10 @@
1
1
  ## Space API
2
- | 属性 | 说明 | 类型 | 默认值 |
3
- | -------- | ------------ | ----------------------------- | ------ |
4
- | align | 对齐方式 | start , end ,center ,baseline | center |
5
- | vertical | 是否垂直显示 | Boolean | false |
6
- | size | 间距大小 | small,middle,large,number | small |
7
- | wrap | 是否换行 | Boolean | false |
2
+ | 属性 | 说明 | 类型 | 默认值 |
3
+ | -------- | ---------------------------- | ----------------------------- | ------ |
4
+ | align | 对齐方式 | start , end ,center ,baseline | center |
5
+ | vertical | 是否垂直显示 | Boolean | false |
6
+ | size | 间距大小 | small,middle,large,number | small |
7
+ | wrap | 是否换行 | Boolean | false |
8
+ | split | 设置拆分 | v-slot | - |
9
+ | compact | 是否使用经凑模式 | Boolean | false |
10
+ | block | 将宽度调整为父元素宽度的选项 | Boolean | false |
@@ -1,62 +1,87 @@
1
- // import { getChild } from '../_tool/utils'
1
+ import { getChild } from '../_tool/utils'
2
+ import cloneVNode from '../_tool/clone'
2
3
  export default {
3
4
  name: 'Space',
4
5
  props: {
5
6
  align: {
6
7
  type: String,
7
- default: 'center',
8
8
  validator(value) {
9
9
  return value ? ["start", "end", "center", "baseline"].indexOf(value) >= 0 : true;
10
10
  }
11
11
  },
12
12
  vertical: Boolean,
13
13
  wrap: Boolean,
14
+ block: Boolean,
15
+ compact: Boolean,
14
16
  size: {
15
17
  type: [String, Number, Array],
16
- default: 'small',
17
- // validator(value) {
18
- // return typeof value == 'number' || Array.isArray(value) ? true : ["small", "middle", "large"].indexOf(value) >= 0;
19
- // }
18
+ // default: 'small',
19
+ validator(value) {
20
+ return (typeof value == 'number' || Array.isArray(value)) ? true : ["small", "middle", "large"].indexOf(value) >= 0;
21
+ }
20
22
  }
21
23
  },
22
24
  render() {
23
- let { align, vertical, $slots, size, wrap } = this
25
+ let { align, vertical, $slots, size, wrap, compact, block } = this
26
+ align = (!vertical && !align) ? 'center' : align
24
27
  const props = {
28
+ style: {},
25
29
  class: ['k-space', {
26
30
  [`k-space-vertical`]: vertical,
27
- [`k-space-lg`]: size == 'large',
28
- [`k-space-md`]: size == 'middle',
31
+ [`k-space-compact`]: compact,
29
32
  [`k-space-wrap`]: wrap,
33
+ [`k-space-block`]: block,
30
34
  [`k-space-align-${align}`]: align,
31
- }]
35
+ }],
36
+ on: {
37
+ ...this.$listeners
38
+ }
32
39
  }
33
- if (Array.isArray(size)) {
34
- props.style = { gap: `${size[1]}px ${size[0]}px` }
35
- } else if (size !== undefined && size !== null && !/small|large/.test(size)) {
36
- props.style = { gap: `${size}px` }
40
+ if (!size && !compact) {
41
+ props.style.gap = '8px'
37
42
  }
38
- // let mrs = { small: 8, middle: 16, large: 24 }
39
-
40
- // let mr = typeof size == 'number' ? size : mrs[size]
41
-
42
- // const childs = getChild(this.$slots.default)
43
-
44
- // let style = {}
43
+ if (!compact) {
44
+ if (Array.isArray(size)) {
45
+ props.style = { gap: `${size[1]}px ${size[0]}px` }
46
+ } else if (/small|middle|large/.test(size)) {
47
+ let sizes = { small: 8, middle: 16, large: 24 }
48
+ props.style.gap = sizes[size] + 'px'
49
+ } else if (size !== undefined && size !== null) {
50
+ props.style.gap = `${size}px`
51
+ }
52
+ }
53
+ let childs = $slots.default
54
+ let split = $slots.split
55
+ if (compact) {
56
+ childs = getChild(this.$slots.default)
57
+ let newChilds = []
58
+ for (let i = 0; i < childs.length; i++) {
59
+ let pre = vertical ? 'vertical-' : ''
60
+ let child = cloneVNode(childs[i], {
61
+ props: {
62
+ size
63
+ },
64
+ class: {
65
+ [`k-space-${pre}first-item`]: i == 0,
66
+ [`k-space-${pre}item`]: i > 0 && i < childs.length - 1,
67
+ [`k-space-${pre}last-item`]: i == childs.length - 1,
68
+ }
69
+ })
70
+ newChilds.push(child)
71
+ }
72
+ childs = newChilds
45
73
 
46
- // if (direction == 'vertical') {
47
- // style.marginBottom = `${mr}px`
48
- // } else {
49
- // style.marginRight = `${mr}px`
50
- // }
51
- return <div {...props}>{$slots.default}</div>
52
- // return (
53
- // <div class={classes}>
54
- // {
55
- // childs.map((child, i) => {
56
- // return <div class="k-space-item" style={i != childs.length - 1 ? style : null}>{child}</div>
57
- // })
58
- // }
59
- // </div>
60
- // )
74
+ } else if (split) {
75
+ childs = getChild(this.$slots.default)
76
+ let newChilds = []
77
+ for (let i = 0; i < childs.length; i++) {
78
+ newChilds.push(childs[i])
79
+ if (i < childs.length - 1) {
80
+ newChilds.push(split)
81
+ }
82
+ }
83
+ childs = newChilds
84
+ }
85
+ return <div {...props}>{childs}</div>
61
86
  }
62
87
  }
@@ -1,22 +1,15 @@
1
1
  .k-space {
2
2
  display: inline-flex;
3
- gap: 8px;
4
3
  }
5
4
 
6
- .k-space-md {
7
- display: inline-flex;
8
- gap: 16px;
5
+ .k-space-block {
6
+ width: 100%;
9
7
  }
10
8
 
11
9
  .k-space-wrap {
12
10
  flex-wrap: wrap;
13
11
  }
14
12
 
15
- .k-space-lg {
16
- display: inline-flex;
17
- gap: 24px;
18
- }
19
-
20
13
  .k-space-align-start {
21
14
  align-items: flex-start;
22
15
  }
@@ -35,4 +28,69 @@
35
28
 
36
29
  .k-space-vertical {
37
30
  flex-direction: column;
31
+ }
32
+
33
+ .k-space-compact {
34
+ .k-space-first-item {
35
+ border-top-right-radius: 0;
36
+ border-bottom-right-radius: 0;
37
+ margin-right: -1px;
38
+
39
+ &:hover {
40
+ z-index: 1;
41
+ }
42
+ }
43
+
44
+ .k-space-item {
45
+ border-radius: 0;
46
+ margin-right: -1px;
47
+
48
+ &:hover {
49
+ z-index: 1;
50
+ }
51
+ }
52
+
53
+ .k-select-open,
54
+ .k-datepicker-open {
55
+ z-index: 1;
56
+ }
57
+
58
+ .k-space-last-item {
59
+ border-top-left-radius: 0;
60
+ border-bottom-left-radius: 0;
61
+
62
+ &:hover {
63
+ z-index: 1;
64
+ }
65
+ }
66
+
67
+
68
+ .k-space-vertical-first-item {
69
+ border-bottom-left-radius: 0;
70
+ border-bottom-right-radius: 0;
71
+ margin-bottom: -1px;
72
+
73
+ &:hover {
74
+ z-index: 1;
75
+ }
76
+ }
77
+
78
+ .k-space-vertical-item {
79
+ border-radius: 0;
80
+ margin-bottom: -1px;
81
+
82
+ &:hover {
83
+ z-index: 1;
84
+ }
85
+ }
86
+
87
+ .k-space-vertical-last-item {
88
+ border-top-left-radius: 0;
89
+ border-top-right-radius: 0;
90
+
91
+ &:hover {
92
+ z-index: 1;
93
+ }
94
+ }
95
+
38
96
  }
@@ -18,6 +18,7 @@
18
18
  @import '../dropdown/styles/index.less';
19
19
  @import '../empty/styles/index.less';
20
20
  @import '../form/styles/index.less';
21
+ @import '../flex/styles/index.less';
21
22
  @import '../grid/styles/index.less';
22
23
  @import '../icon/styles/index.less';
23
24
  @import '../input/styles/index.less';
@@ -20,17 +20,27 @@
20
20
  height: 8px;
21
21
  padding: 2px;
22
22
  }
23
+
23
24
  &::-webkit-scrollbar-track {}
25
+
24
26
  &::-webkit-scrollbar-thumb {
25
27
  border-radius: 8px;
26
28
  width: 6px;
27
29
  height: 6px;
28
30
  background-color: var(--kui-color-border);
29
31
  }
30
- &::-webkit-scrollbar-corner, ::-webkit-resizer {
32
+
33
+ &::-webkit-scrollbar-corner,
34
+ ::-webkit-resizer {
31
35
  background-color: transparent !important;
32
36
  }
37
+
33
38
  &::-webkit-scrollbar-track {
34
39
  background-color: transparent !important;
35
40
  }
41
+ }
42
+
43
+ a {
44
+ color: var(--kui-color-main);
45
+ text-decoration: none;
36
46
  }
@@ -26,7 +26,6 @@
26
26
  .k-tooltip-title {
27
27
  padding: 8px 12px;
28
28
  font-size: 14px;
29
- text-align: center;
30
29
  }
31
30
 
32
31
  .k-tooltip-arrow {
@@ -4,7 +4,7 @@ export default {
4
4
  props: {
5
5
  dark: Boolean,
6
6
  transfer: { type: Boolean, default: true },
7
- title: String,
7
+ title: [String, Number, Object, Array],
8
8
  color: String,
9
9
  trigger: String,
10
10
  width: [Number, String],