kui-vue 3.2.3 → 3.2.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 (64) hide show
  1. package/LICENSE +0 -0
  2. package/components/affix/affix.jsx +23 -75
  3. package/components/affix/demo/container.md +14 -7
  4. package/components/affix/index.md +6 -5
  5. package/components/anchor/demo/base.md +11 -11
  6. package/components/anchor/demo/index.vue +16 -16
  7. package/components/anchor/demo/info.md +6 -6
  8. package/components/anchor/index.js +2 -2
  9. package/components/anchor/index.md +3 -3
  10. package/components/avatar/avatar.jsx +63 -0
  11. package/components/avatar/demo/base.md +24 -0
  12. package/components/avatar/demo/change.md +40 -0
  13. package/components/avatar/demo/index.vue +20 -0
  14. package/components/avatar/demo/info.md +7 -0
  15. package/components/avatar/demo/types.md +23 -0
  16. package/components/avatar/index.js +2 -0
  17. package/components/avatar/index.md +7 -0
  18. package/components/avatar/styles/index.less +61 -0
  19. package/components/checkbox/styles/index.less +5 -1
  20. package/components/drawer/demo/target.md +0 -0
  21. package/components/icon/lib/dist.json +0 -0
  22. package/components/icon/lib/kui-icons.js +0 -0
  23. package/components/index.js +7 -1
  24. package/components/loading/demo/index.vue +17 -17
  25. package/components/loading/demo/info.md +54 -54
  26. package/components/loading/index.md +7 -7
  27. package/components/radio/styles/index.less +4 -1
  28. package/components/rate/demo/base.md +11 -11
  29. package/components/rate/demo/index.vue +29 -29
  30. package/components/rate/demo/info.md +7 -7
  31. package/components/rate/index.js +1 -1
  32. package/components/rate/index.md +11 -11
  33. package/components/rate/rate.jsx +93 -93
  34. package/components/slider/demo/base.md +35 -0
  35. package/components/slider/demo/index.vue +18 -0
  36. package/components/slider/demo/info.md +7 -0
  37. package/components/slider/demo/vertical.md +13 -0
  38. package/components/slider/index.md +7 -0
  39. package/components/slider/slider.jsx +58 -0
  40. package/components/slider/styles/index.less +60 -32
  41. package/components/space/demo/align.md +46 -0
  42. package/components/space/demo/base.md +20 -0
  43. package/components/space/demo/custom-size.md +35 -0
  44. package/components/space/demo/index.vue +25 -0
  45. package/components/space/demo/info.md +11 -0
  46. package/components/space/demo/size.md +35 -0
  47. package/components/space/demo/vertical.md +19 -0
  48. package/components/space/index.js +2 -0
  49. package/components/space/index.md +6 -0
  50. package/components/space/space.jsx +57 -0
  51. package/components/space/styles/index.less +23 -0
  52. package/components/styles/dark.less +3 -0
  53. package/components/styles/global-dark.less +35 -35
  54. package/components/styles/index.less +3 -0
  55. package/components/table/demo/base-render.md +1 -1
  56. package/components/table/demo/base.md +5 -2
  57. package/components/table/table.jsx +10 -7
  58. package/dist/k-ui-dark.css +1 -1
  59. package/dist/k-ui.css +1 -1
  60. package/dist/k-ui.js +2 -2
  61. package/package.json +3 -2
  62. package/components/slider/demo/slider.js +0 -5
  63. package/components/slider/slider.vue +0 -21
  64. package/components/slider/sliderButton.vue +0 -76
@@ -1,35 +1,63 @@
1
+ @import '../../styles/global.less';
1
2
  .k-slider {
2
- .k-slider-wrap {
3
- width: 100%;
4
- height: 6px;
5
- margin: 16px 0;
6
- background-color: #e9eaec;
7
- border-radius: 3px;
8
- vertical-align: middle;
9
- position: relative;
10
- cursor: pointer;
11
- .k-slider-bar {
12
- height: 6px;
13
- background-color: @main;
14
- border-radius: 3px;
15
- // border-top-left-radius: 3px;
16
- // border-bottom-left-radius: 3px;
17
- }
18
- .k-slider-button {
19
- width: 16px;
20
- height: 16px;
21
- border: 2px solid #57a3f3;
22
- border-radius: 50%;
23
- background-color: #fff;
24
- transition: all .2s linear;
25
- outline: 0;
26
- // transform: translate(-50%,-50%);
27
- top:0;
28
- position: absolute;
29
- // left: 50%;
30
- &:hover{
31
- // transform:translateX(-50%) scale(1.2)
32
- }
33
- }
3
+ width: 100%;
4
+ display: inline-block;
5
+ position: relative;
6
+ height: 12px;
7
+ font-size: 0;
8
+ &::before {
9
+ content: '';
10
+ position: absolute;
11
+ height: 4px;
12
+ border-radius: 2px;
13
+ background: @border-color;
14
+ top: 4px;
15
+ width: 100%;
16
+ left: 0;
17
+ }
18
+ .k-slider-bar {
19
+ position: relative;
20
+ z-index: 1;
21
+ margin-top: 4px;
22
+ -webkit-appearance: none;
23
+ // background: linear-gradient(to right, #1CE4FF 41.6777%, rgba(255, 255, 255, 0.3) 0%);
24
+ border-radius: 3px;
25
+ width: 100%;
26
+ // 轨道
27
+ &::-webkit-slider-runnable-track {
28
+ height: 4px;
29
+ border-radius: 3px;
30
+ // box-shadow: 0 1px 1px #def3f8, inset 0 .125em .125em #0d1112;
31
+ // background: @border-color;
32
+ border-radius: 2px;
34
33
  }
34
+ //滑块
35
+ &::-webkit-slider-thumb {
36
+ -webkit-appearance: none;
37
+ height: 12px;
38
+ width: 12px;
39
+ margin-top: -4px;
40
+ // background: @main;
41
+ border-radius: 50%;
42
+ border: 2px solid @main;
43
+ background-color: @back-color;
44
+
45
+ cursor: pointer;
46
+ }
47
+ &:disabled {
48
+ cursor: not-allowed;
49
+ }
50
+ &:focus {
51
+ &::-webkit-slider-thumb {
52
+ box-shadow: 0 0 0px 5px fadeout(@main,80%);
53
+ }
54
+ }
55
+ }
56
+ }
57
+
58
+ .k-slider-disabled {
59
+ opacity: .5;
60
+ // {
61
+ // -webkit-appearance: slider-vertical;
62
+ // }
35
63
  }
@@ -0,0 +1,46 @@
1
+ <cn>
2
+ #### 对齐
3
+ 设置对齐模式。
4
+ </cn>
5
+
6
+ ```vue
7
+ <template>
8
+ <div class="demo-space">
9
+ Align start
10
+ <Space align="start">
11
+ <Button size="large">large</Button>
12
+ <Button>default</Button>
13
+ <Button size="small">small</Button>
14
+ Start text
15
+ </Space>
16
+ <br/>
17
+ <br/>
18
+ Align end
19
+ <Space align="end">
20
+ <Button size="large">large</Button>
21
+ <Button>default</Button>
22
+ <Button size="small">small</Button>
23
+ End text
24
+ </Space>
25
+ <br/>
26
+ <br/>
27
+ Align center
28
+ <Space align="center">
29
+ <Button size="large">large</Button>
30
+ <Button>default</Button>
31
+ <Button size="small">small</Button>
32
+ Center text
33
+ </Space>
34
+ <br/>
35
+ <br/>
36
+ Align baseline
37
+ <Space align="start">
38
+ <Button>button</Button>
39
+ <span style="background:#eee">Baseline text</span>
40
+ </Space>
41
+ </div>
42
+ </template>
43
+ <style scoped>
44
+
45
+ </style>
46
+ ```
@@ -0,0 +1,20 @@
1
+ <cn>
2
+ #### 基本用法
3
+ 相邻组件水平间距。
4
+ </cn>
5
+
6
+ ```vue
7
+ <template>
8
+ <Space>
9
+ Space
10
+ <Button>Button</Button>
11
+ <Button icon="search">Button</Button>
12
+ <Tooltip placement="top">
13
+ <Button>Space</Button>
14
+ <template slot="title">
15
+ <p>I am space</p>
16
+ </template>
17
+ </Tooltip>
18
+ </Space>
19
+ </template>
20
+ ```
@@ -0,0 +1,35 @@
1
+ <cn>
2
+ #### 自定义尺寸
3
+ 自定义间距大小。
4
+ </cn>
5
+
6
+ ```vue
7
+ <template>
8
+ <div>
9
+ <Slider v-model="size" max="50"/>
10
+ <br/>
11
+ <br/>
12
+ <Space :size="size">
13
+ <Button type="primary">Primary</Button>
14
+ <Button type="danger">Danger</Button>
15
+ <Button>Default</Button>
16
+ <Button type="dashed">Dashed</Button>
17
+ <Button type="link">Link</Button>
18
+ </Space>
19
+ </div>
20
+ </template>
21
+ <script>
22
+ export default {
23
+ data() {
24
+ return {
25
+ size: 12,
26
+ };
27
+ },
28
+ methods:{
29
+ change(e){
30
+ this.size =e.target.value*1
31
+ }
32
+ }
33
+ };
34
+ </script>
35
+ ```
@@ -0,0 +1,25 @@
1
+ <script>
2
+ import Info from "./info";
3
+ import Base from "./base";
4
+ import Vertical from "./vertical";
5
+ import Align from "./align";
6
+ import Size from "./size";
7
+ import CustomSize from "./custom-size";
8
+
9
+ import CN from "../index.md";
10
+ export default {
11
+ render() {
12
+ return (
13
+ <div class="switch-demo">
14
+ <Info class="typo" />
15
+ <Base />
16
+ <Vertical />
17
+ <Size />
18
+ <Align />
19
+ <CustomSize />
20
+ <CN class="typo" />
21
+ </div>
22
+ );
23
+ },
24
+ };
25
+ </script>
@@ -0,0 +1,11 @@
1
+ # Space 间距
2
+ 设置组件之间的间距。
3
+
4
+ ## 何时使用
5
+
6
+ 避免组件紧贴在一起,拉开统一的空间。
7
+
8
+ - 适合行内元素的水平间距。
9
+ - 可以设置各种水平对齐方式。
10
+
11
+ ## 代码演示
@@ -0,0 +1,35 @@
1
+ <cn>
2
+ #### 间距大小
3
+ 间距预设大、中、小三种大小。
4
+ 通过设置 size 为 large middle 分别把间距设为大、中间距。若不设置 size,则间距为小。
5
+ </cn>
6
+
7
+ ```vue
8
+ <template>
9
+ <div>
10
+ <RadioGroup v-model="size">
11
+ <Radio value="small">Small</Radio>
12
+ <Radio value="middle">Middle</Radio>
13
+ <Radio value="large">Large</Radio>
14
+ </RadioGroup>
15
+ <br/>
16
+ <br/>
17
+ <Space :size="size">
18
+ <Button type="primary">Primary</Button>
19
+ <Button type="danger">Danger</Button>
20
+ <Button>Default</Button>
21
+ <Button type="dashed">Dashed</Button>
22
+ <Button type="link">Link</Button>
23
+ </Space>
24
+ </div>
25
+ </template>
26
+ <script>
27
+ export default {
28
+ data() {
29
+ return {
30
+ size: 'small',
31
+ };
32
+ },
33
+ };
34
+ </script>
35
+ ```
@@ -0,0 +1,19 @@
1
+ <cn>
2
+ #### 垂直间距
3
+ 相邻组件垂直间距。
4
+ </cn>
5
+
6
+ ```vue
7
+ <template>
8
+ <Space direction="vertical">
9
+ <Card title="Card" icon="heart" style="width:256px">
10
+ <p>card content</p>
11
+ <p>card content</p>
12
+ </Card>
13
+ <Card title="Card" icon="heart" style="width:256px">
14
+ <p>card content</p>
15
+ <p>card content</p>
16
+ </Card>
17
+ </Space>
18
+ </template>
19
+ ```
@@ -0,0 +1,2 @@
1
+ import Space from './space'
2
+ export default Space
@@ -0,0 +1,6 @@
1
+ ### Space API
2
+ | 属性 | 说明 | 类型 | 默认值 |
3
+ | --------- | -------- | ----------------------------- | ---------- |
4
+ | align | 对齐方式 | start , end ,center ,baseline | center |
5
+ | direction | 间距方向 | vertical,horizontal | horizontal |
6
+ | size | 间距大小 | small,middle,large,number | small |
@@ -0,0 +1,57 @@
1
+ import { getChild } from '../_tool/utils'
2
+ export default {
3
+ name: 'Space',
4
+ props: {
5
+ align: {
6
+ type: String,
7
+ default: 'center',
8
+ validator(value) {
9
+ return value ? ["start", "end", "center", "baseline"].indexOf(value) >= 0 : true;
10
+ }
11
+ },
12
+ direction: {
13
+ type: String,
14
+ default: 'horizontal',
15
+ validator(value) {
16
+ return ["vertical", "horizontal"].indexOf(value) >= 0;
17
+ }
18
+ },
19
+ size: {
20
+ type: [String, Number],
21
+ default: 'small',
22
+ validator(value) {
23
+ return typeof value == 'number' ? true : ["small", "middle", "large"].indexOf(value) >= 0;
24
+ }
25
+ }
26
+ },
27
+ render() {
28
+ let { align, direction, $slots, size } = this
29
+ const classes = ['k-space', {
30
+ [`k-space-${direction}`]: direction,
31
+ [`k-space-align-${align}`]: align,
32
+ }]
33
+ let mrs = { small: 8, middle: 16, large: 24 }
34
+
35
+ let mr = typeof size == 'number' ? size : mrs[size]
36
+
37
+ const childs = getChild(this.$slots.default)
38
+
39
+ let style = {}
40
+
41
+ if (direction == 'vertical') {
42
+ style.marginBottom = `${mr}px`
43
+ } else {
44
+ style.marginRight = `${mr}px`
45
+ }
46
+
47
+ return (
48
+ <div class={classes}>
49
+ {
50
+ childs.map((child) => {
51
+ return <div class="k-space-item" style={style}>{child}</div>
52
+ })
53
+ }
54
+ </div>
55
+ )
56
+ }
57
+ }
@@ -0,0 +1,23 @@
1
+ .k-space {
2
+ display: inline-flex;
3
+ }
4
+
5
+ .k-space-align-start {
6
+ align-items: flex-start;
7
+ }
8
+
9
+ .k-space-align-end {
10
+ align-items: flex-end;
11
+ }
12
+
13
+ .k-space-align-center {
14
+ align-items: center;
15
+ }
16
+
17
+ .k-space-align-baseline {
18
+ align-items: baseline;
19
+ }
20
+
21
+ .k-space-vertical {
22
+ flex-direction: column;
23
+ }
@@ -1,5 +1,6 @@
1
1
  @import '../alert/styles/index.less';
2
2
  @import '../affix/styles/index.less';
3
+ @import '../avatar/styles/index.less';
3
4
  @import '../badge/styles/index.less';
4
5
  @import '../backtop/styles/index.less';
5
6
  @import '../breadcrumb/styles/index.less';
@@ -31,8 +32,10 @@
31
32
  @import '../progress/styles/index.less';
32
33
  @import '../radio/styles/index.less';
33
34
  @import '../rate/styles/index.less';
35
+ @import '../space/styles/index.less';
34
36
  @import '../spin/styles/index.less';
35
37
  @import '../select/styles/index.less';
38
+ @import '../slider/styles/index.less';
36
39
  @import '../switch/styles/index.less';
37
40
  @import '../steps/styles/index.less';
38
41
  @import '../timeline/styles/index.less';
@@ -1,36 +1,36 @@
1
- @main: #3a95ff;
2
- @success: #00bb5d;
3
- @danger: darken(#ff3300,20%);
4
- @warning: #ffa500;
5
- @pink: lighten( purple, 45%);
6
- @red: lighten(red, 5%);
7
- @yellow: mix(yellow, orange, 50%);
8
- @orange: lighten(orange, 8%);
9
- @cyan: darken(cyan, 10%);
10
- @green: lighten(green, 15%);
11
- @blue: mix(blue, cyan, 50%);
12
- @purple: lighten(mix(purple,blue, 60%),30%);
13
- @geekblue: mix(blue, cyan, 70%); //极客蓝
14
- @magenta: mix(pink, red, 40%); //洋红
15
- @volcano: mix(red, orange, 60%); //火红
16
- @gold: lighten(gold, 10%);
17
- @lime: mix(green, yellow, 40%); //绿黄色
18
- @gray: #969696;
19
- @dark: rgba(0, 0, 0, .75);
20
- @gray: #969696;
21
- @dark: rgba(0, 0, 0, .75);
22
- @color: rgba(255, 255, 255, .75);
23
- @color-light: rgba(255, 255, 255, .65);
24
- @title-color: rgba(255, 255, 255, .85);
25
- @back-color: #1f1f1f;
26
- @mask-color: rgba(0, 0, 0, .6);
27
- @icon-color: rgba(255, 255, 255, .4);
28
- @hover-color:fadeout(@border-color, 60%); //item 的 hover 颜色
29
- @selected-color:fadeout(@main, 90%); //item 的 hover 颜色
30
- @radius: ~'2px';
31
- @border-color: #303030;
32
- @disable-border: darken(@border-color,5%);
33
- @disable-back: lighten(@back-color,20%);
34
- @disable-color: rgba(255, 255, 255, .3);
35
- @disable-light-color: rgba(255, 255, 255, .3);
1
+ @main: #3a95ff;
2
+ @success: #00bb5d;
3
+ @danger: darken(#ff3300,20%);
4
+ @warning: #ffa500;
5
+ @pink: lighten( purple, 45%);
6
+ @red: lighten(red, 5%);
7
+ @yellow: mix(yellow, orange, 50%);
8
+ @orange: lighten(orange, 8%);
9
+ @cyan: darken(cyan, 10%);
10
+ @green: lighten(green, 15%);
11
+ @blue: mix(blue, cyan, 50%);
12
+ @purple: lighten(mix(purple,blue, 60%),30%);
13
+ @geekblue: mix(blue, cyan, 70%); //极客蓝
14
+ @magenta: mix(pink, red, 40%); //洋红
15
+ @volcano: mix(red, orange, 60%); //火红
16
+ @gold: lighten(gold, 10%);
17
+ @lime: mix(green, yellow, 40%); //绿黄色
18
+ @gray: #969696;
19
+ @dark: rgba(0, 0, 0, .75);
20
+ @gray: #969696;
21
+ @dark: rgba(0, 0, 0, .75);
22
+ @color: rgba(255, 255, 255, .75);
23
+ @color-light: rgba(255, 255, 255, .65);
24
+ @title-color: rgba(255, 255, 255, .85);
25
+ @back-color: #1f1f1f;
26
+ @mask-color: rgba(0, 0, 0, .6);
27
+ @icon-color: rgba(255, 255, 255, .4);
28
+ @hover-color:fadeout(@border-color, 60%); //item 的 hover 颜色
29
+ @selected-color:fadeout(@main, 90%); //item 的 hover 颜色
30
+ @radius: ~'2px';
31
+ @border-color: #303030;
32
+ @disable-border: darken(@border-color,5%);
33
+ @disable-back: lighten(@back-color,20%);
34
+ @disable-color: rgba(255, 255, 255, .3);
35
+ @disable-light-color: rgba(255, 255, 255, .3);
36
36
  @dark-back: #22303f;
@@ -1,5 +1,6 @@
1
1
  @import '../alert/styles/index.less';
2
2
  @import '../affix/styles/index.less';
3
+ @import '../avatar/styles/index.less';
3
4
  @import '../badge/styles/index.less';
4
5
  @import '../backtop/styles/index.less';
5
6
  @import '../breadcrumb/styles/index.less';
@@ -31,8 +32,10 @@
31
32
  @import '../progress/styles/index.less';
32
33
  @import '../radio/styles/index.less';
33
34
  @import '../rate/styles/index.less';
35
+ @import '../space/styles/index.less';
34
36
  @import '../spin/styles/index.less';
35
37
  @import '../select/styles/index.less';
38
+ @import '../slider/styles/index.less';
36
39
  @import '../switch/styles/index.less';
37
40
  @import '../steps/styles/index.less';
38
41
  @import '../timeline/styles/index.less';
@@ -5,7 +5,7 @@
5
5
 
6
6
  ```vue
7
7
  <template>
8
- <Table :data="data" :columns="columns" />
8
+ <Table :data="data" :columns="columns"/>
9
9
  </template>
10
10
  <script>
11
11
  export default{
@@ -5,7 +5,7 @@
5
5
 
6
6
  ```vue
7
7
  <template>
8
- <Table :data="data" :columns="columns">
8
+ <Table :data="data" :columns="columns" @row-click="test">
9
9
  <template v-slot:tags="value">
10
10
  <Tag v-for="tag in value" :key="tag" :color="tag=='Python'?'red':'orange'">{{tag}}</Tag>
11
11
  </template>
@@ -13,7 +13,7 @@
13
13
  <Icon :type="value==1?'male':'female'" :color="value==1?'blue':'#f50cff'" size="15" />
14
14
  </template>
15
15
  <template v-slot:action="value,record,col">
16
- <Button size="small" @click="e=>show(record)">more</Button>
16
+ <Button size="small" @click.stop="e=>show(record)">more</Button>
17
17
  </template>
18
18
  </Table>
19
19
  </template>
@@ -43,6 +43,9 @@ export default {
43
43
  title: 'More',
44
44
  content: `Name:${record.name} <br/>Aage:${record.age} <br/>Gender:${record.gender == 0 ? 'boy' : 'gril'} <br/>Address:${record.address}`,
45
45
  })
46
+ },
47
+ test(data){
48
+ this.$Message.info('Test row click:'+data.name)
46
49
  }
47
50
  }
48
51
  }
@@ -150,15 +150,18 @@ export default {
150
150
  let trProps = {
151
151
  class: { 'k-table-row-hover': d._hover },
152
152
  key: (d.key || i).toString(),
153
+ on: {
154
+ click: () => {
155
+ this.$emit('row-click', d)
156
+ }
157
+ }
153
158
  }
154
159
  if (hasFixed) {
155
- trProps.on = {
156
- mouseenter: () => {
157
- this.$set(d, '_hover', true)
158
- },
159
- mouseleave: () => {
160
- this.$set(d, '_hover', false)
161
- }
160
+ trProps.on.mouseenter = () => {
161
+ this.$set(d, '_hover', true)
162
+ }
163
+ trProps.on.mouseleave = () => {
164
+ this.$set(d, '_hover', false)
162
165
  }
163
166
  }
164
167
  if (tr.length) {