kui-vue 3.2.11-rc5 → 3.2.11-rc6

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.
@@ -23,17 +23,46 @@ export default {
23
23
  render() {
24
24
  let { offset, span, $slots, flex } = this
25
25
  const gutter = this.Row.gutter
26
- const props = {
26
+ let props = {
27
27
  class: [`k-col`, {
28
28
  [`k-col-${span}`]: span,
29
- [`k-col-offset-${offset}`]: offset > 0 && offset <= 24
29
+ // [`k-col-offset-${offset}`]: offset > 0 && offset <= 24
30
30
  }],
31
31
  style: {
32
- paddingLeft: gutter ? `${gutter / 2}px` : null,
33
- paddingRight: gutter ? `${gutter / 2}px` : null,
34
- flex: flex ? this.parseFlex(flex) : null
32
+ // paddingLeft: gutter ? `${gutter / 2}px` : null,
33
+ // paddingRight: gutter ? `${gutter / 2}px` : null,
34
+ // flex: flex ? this.parseFlex(flex) : null
35
35
  }
36
36
  }
37
+ // console.log(gutter)
38
+ if (Array.isArray(gutter)) {
39
+ let [v = 0, h = 0] = gutter;
40
+ if ((v == h && v > 0)) {
41
+ props.style.padding = `${v / 2}px`
42
+ } else if (v > 0 && h > 0) {
43
+ props.style.padding = `${h / 2}px ${v / 2}px`
44
+ } else {
45
+ if (v > 0) {
46
+ props.style.paddingLeft = `${v / 2}px`
47
+ props.style.paddingRight = `${v / 2}px`
48
+ }
49
+ if (h > 0) {
50
+ props.style.paddingTop = `${v / 2}px`
51
+ props.style.paddingTop = `${v / 2}px`
52
+ }
53
+ }
54
+
55
+ } else if (!isNaN(Number(gutter)) && gutter > 0) {
56
+ props.style.paddingLeft = `${gutter / 2}px`
57
+ props.style.paddingRight = `${gutter / 2}px`
58
+ }
59
+ if (flex) {
60
+ props.style.flex = this.parseFlex(flex)
61
+ }
62
+ if (offset > 0 && offset <= 24) {
63
+ props.class.push(`k-col-offset-${offset}`)
64
+ }
65
+
37
66
  return (
38
67
  <div {...props}>
39
68
  {$slots.default}
@@ -1,25 +1,66 @@
1
1
  <cn>
2
2
  #### 分栏间隔
3
- 使用 `gutter` 熟悉来设置分栏的间隔
3
+ 使用 `gutter` 熟悉来设置分栏的间隔,如果需要垂直间距,可以写成数组形式 [水平间距, 垂直间距]
4
4
  </cn>
5
5
 
6
6
  ```vue
7
7
  <template>
8
8
  <div class="demo-grid">
9
+ gutter = 10
9
10
  <Row :gutter="10" class="row-gutter">
10
- <Col :span="6">
11
- <div>col-6</div>
12
- </Col>
13
- <Col :span="6">
14
- <div>col-6</div>
15
- </Col>
16
- <Col :span="6">
17
- <div>col-6</div>
11
+ <Col :span="12"><div>col-12</div></Col>
12
+ <Col :span="12"><div>col-12</div></Col>
13
+ </Row>
14
+ <br />
15
+ <br />
16
+ Horizontal Gutter (px):
17
+ <div style="width:55%;padding:10px;">
18
+ <Slider v-model="h"
19
+ :min="8"
20
+ :marks="{8:'8',16:'16',24:'24',32:'32',40:'40'}"
21
+ :max="40"
22
+ :step="null" />
23
+ </div>
24
+ Vertical Gutter (px):
25
+ <div style="width:55%;padding:10px;">
26
+ <Slider v-model="v"
27
+ :min="8"
28
+ :max="40"
29
+ :marks="{8:'8',16:'16',24:'24',32:'32',40:'40'}"
30
+ :step="null" />
31
+ </div>
32
+ Column Count:
33
+ <div style="width:55%;padding:10px;">
34
+ <Slider v-model="cols"
35
+ :min="2"
36
+ :marks="{2:'2',3:'3',4:'4',6:'6',8:'8',12:'12'}"
37
+ :max="12"
38
+ :step="null" />
39
+ </div>
40
+ <Row :gutter="[v,h]"
41
+ class="row-gutter">
42
+ <Col :span="24/cols"
43
+ v-for="c in cols"
44
+ :key="c">
45
+ <div>col-{{cols}}</div>
18
46
  </Col>
19
- <Col :span="6">
20
- <div>col-6</div>
47
+ <Col :span="24/cols"
48
+ v-for="x in cols"
49
+ :key="'_'+x">
50
+ <div>col-{{cols}}</div>
21
51
  </Col>
22
52
  </Row>
23
53
  </div>
24
54
  </template>
55
+ <script>
56
+ export default {
57
+ data() {
58
+ return {
59
+ h: 8,
60
+ v: 8,
61
+ cols: 4
62
+ }
63
+ }
64
+ }
65
+ </script>
25
66
  ```
@@ -1,13 +1,13 @@
1
1
  ### Row API
2
- | 属性 | 说明 | 类型 | 默认值 |
3
- |---------|----------------------------------------------------------------------------------|--------|---------|
4
- | align | flex 布局下的垂直对齐方式:`top` `middle` `bottom` | String | `top` |
5
- | justify | flex 布局下的水平排列方式:`start` `end` `center` `space-around` `space-between` | String | `start` |
6
- | gutter | 栅格间距,单位 px,左右平分 | Number | 0 |
7
- | type | 布局模式,可选 flex,现代浏览器 下有效 | String | |
2
+ | 属性 | 说明 | 类型 | 默认值 |
3
+ | ------- | -------------------------------------------------------------------------------- | ------------ | ------- |
4
+ | align | flex 布局下的垂直对齐方式:`top` `middle` `bottom` | String | `top` |
5
+ | justify | flex 布局下的水平排列方式:`start` `end` `center` `space-around` `space-between` | String | `start` |
6
+ | gutter | 栅格间距,单位 px,左右平分,使用数组形式同时设置 [水平间距, 垂直间距] | Number,Array | - |
7
+ | type | 布局模式,可选 flex,现代浏览器 下有效 | String | |
8
8
  ### Col API
9
9
  | 属性 | 说明 | 类型 | 默认值 |
10
- |--------|----------------------------------------|---------------|--------|
10
+ | ------ | -------------------------------------- | ------------- | ------ |
11
11
  | span | 栅格的占位格数,可选值为0~24的整数 | Number | - |
12
12
  | offset | 栅格左侧的间隔格数,可选值为1~24的整数 | Number | - |
13
13
  | flex | flex 布局填充 | Number,String | - |
@@ -36,11 +36,25 @@ export default {
36
36
  }
37
37
  }
38
38
  if (Array.isArray(gutter)) {
39
- props.style.gap = gutter + 'px'
40
- } else if (!isNaN(Number(gutter))) {
41
- props.style.marginLeft = gutter / -2 + "px"
42
- props.style.marginRight = gutter / -2 + "px"
43
- props.style.gap = gutter + 'px'
39
+ let [v = 0, h = 0] = gutter;
40
+ if ((v == h && v > 0)) {
41
+ props.style.margin = `-${v/2}px`
42
+ } else if (v > 0 && h > 0) {
43
+ props.style.margin = `-${h/2}px -${v/2}px`
44
+ } else {
45
+ if (v > 0) {
46
+ props.style.marginLeft = `-${v/2}px`
47
+ props.style.marginRight = `-${v/2}px`
48
+ }
49
+ if (h > 0) {
50
+ props.style.marginTop = `-${v/2}px`
51
+ props.style.marginTop = `-${v/2}px`
52
+ }
53
+ }
54
+
55
+ } else if (!isNaN(Number(gutter)) && gutter > 0) {
56
+ props.style.marginLeft = `-${gutter / 2}px`
57
+ props.style.marginRight = `-${gutter / 2}px`
44
58
  }
45
59
  return (<div {...props}>{$slots.default}</div >)
46
60
  }
@@ -44,17 +44,15 @@ export default {
44
44
  let { marks, step, min } = this
45
45
  if (!marks) return times(Math.round((percent + min) / step), step)
46
46
  let steps = Object.keys(marks)//, values = []
47
- steps = steps.map(x => x * 1 + min)
47
+ steps = steps.map(x => x - min)
48
48
  if (step) {
49
- steps.push(times(Math.round((percent + min) / step), step))
49
+ steps.push(times(Math.round((percent) / step), step))
50
50
  }
51
- // steps.forEach(x => {
52
- // values.push(x == 0 ? 0 : times(Math.round((percent + min) / x), x))
53
- // })
54
51
 
55
- let result = steps.reduce((x, y) => Math.abs(x - percent - min) > Math.abs(y - percent - min) ? y : x)
52
+ let result = steps.reduce((x, y) => Math.abs(x - percent) > Math.abs(y - percent) ? y : x)
53
+ // let result = steps.reduce((x, y) => Math.abs(x - percent) > Math.abs(y - percent) ? y : x)
56
54
  // console.log(percent, result, steps)
57
- return result
55
+ return result + min
58
56
  },
59
57
  getValue() {
60
58
  let { value = 0, range, min, max } = this, v;
package/dist/k-ui.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * kui-vue v3.2.11rc5
2
+ * kui-vue v3.2.11rc6
3
3
  * Copyright 2017-present, kui-vue.
4
4
  * All rights reserved.
5
5
  * Author: chuchur@qq.com / www.chuchur.com