Commit 12fd2dc5807a57c76a18aa415de7116569738147
Committed by
GitHub
Merge branch '2.0' into table_render
Showing
19 changed files
with
443 additions
and
77 deletions
Show diff stats
1 | +<template> | ||
2 | + <Table width="550" border :columns="columns2" :data="data3"></Table> | ||
3 | +</template> | ||
4 | +<script> | ||
5 | + export default { | ||
6 | + name: 'etable', | ||
7 | + data () { | ||
8 | + return { | ||
9 | + columns2: [ | ||
10 | + { | ||
11 | + title: '姓名', | ||
12 | + key: 'name', | ||
13 | + width: 100, | ||
14 | + fixed: 'left' | ||
15 | + }, | ||
16 | + { | ||
17 | + title: '年龄', | ||
18 | + key: 'age', | ||
19 | + width: 100 | ||
20 | + }, | ||
21 | + { | ||
22 | + title: '省份', | ||
23 | + key: 'province', | ||
24 | + width: 100 | ||
25 | + }, | ||
26 | + { | ||
27 | + title: '市区', | ||
28 | + key: 'city', | ||
29 | + width: 100 | ||
30 | + }, | ||
31 | + { | ||
32 | + title: '地址', | ||
33 | + key: 'address', | ||
34 | + width: 200 | ||
35 | + }, | ||
36 | + { | ||
37 | + title: '邮编', | ||
38 | + key: 'zip', | ||
39 | + width: 100 | ||
40 | + }, | ||
41 | + { | ||
42 | + title: '操作', | ||
43 | + key: 'action', | ||
44 | + fixed: 'right', | ||
45 | + width: 120, | ||
46 | + render: (h, params) => { | ||
47 | + return h('div', [ | ||
48 | + h('Button', { | ||
49 | + props: { | ||
50 | + type: 'text', | ||
51 | + size: 'small' | ||
52 | + } | ||
53 | + }, '查看'), | ||
54 | + h('Button', { | ||
55 | + props: { | ||
56 | + type: 'text', | ||
57 | + size: 'small' | ||
58 | + } | ||
59 | + }, '编辑') | ||
60 | + ]); | ||
61 | + } | ||
62 | + } | ||
63 | + ], | ||
64 | + data3: [ | ||
65 | + { | ||
66 | + name: '王小明', | ||
67 | + age: 18, | ||
68 | + address: '北京市朝阳区芍药居', | ||
69 | + province: '北京市', | ||
70 | + city: '朝阳区', | ||
71 | + zip: 100000 | ||
72 | + }, | ||
73 | + { | ||
74 | + name: '张小刚', | ||
75 | + age: 25, | ||
76 | + address: '北京市海淀区西二旗', | ||
77 | + province: '北京市', | ||
78 | + city: '海淀区', | ||
79 | + zip: 100000 | ||
80 | + }, | ||
81 | + { | ||
82 | + name: '李小红', | ||
83 | + age: 30, | ||
84 | + address: '上海市浦东新区世纪大道', | ||
85 | + province: '上海市', | ||
86 | + city: '浦东新区', | ||
87 | + zip: 100000 | ||
88 | + }, | ||
89 | + { | ||
90 | + name: '周小伟', | ||
91 | + age: 26, | ||
92 | + address: '深圳市南山区深南大道', | ||
93 | + province: '广东', | ||
94 | + city: '南山区', | ||
95 | + zip: 100000 | ||
96 | + } | ||
97 | + ] | ||
98 | + } | ||
99 | + } | ||
100 | + } | ||
101 | +</script> |
examples/routers/notice.vue
examples/routers/table.vue
1 | <template> | 1 | <template> |
2 | - <div> | ||
3 | - <Table border :columns="columns7" :data="data6"></Table> | ||
4 | - <Button @click="handleAdd"> + 1</Button> | ||
5 | - </div> | 2 | + <Table border :columns="columns7" :data="data6" @on-expand="expand"></Table> |
6 | </template> | 3 | </template> |
7 | <script> | 4 | <script> |
8 | - import abc from '../components/test.vue'; | 5 | + import etable from '../components/table.vue'; |
9 | export default { | 6 | export default { |
10 | - components: { abc }, | 7 | + components: { etable }, |
11 | data () { | 8 | data () { |
12 | return { | 9 | return { |
13 | - data1: 1, | ||
14 | - self: this, | ||
15 | columns7: [ | 10 | columns7: [ |
16 | { | 11 | { |
12 | + type: 'expand', | ||
13 | + width: 50, | ||
14 | + render: (h, params) => { | ||
15 | +// return h(etable); | ||
16 | + return h('div', params.row.name) | ||
17 | + } | ||
18 | + }, | ||
19 | + { | ||
17 | title: '姓名', | 20 | title: '姓名', |
18 | key: 'name', | 21 | key: 'name', |
19 | -// render (row, column, index) { | ||
20 | -// return `<abc></abc>`; | ||
21 | -// } | ||
22 | - render: (h, row, column, index) => { | 22 | + render: (h, params) => { |
23 | return h('div', [ | 23 | return h('div', [ |
24 | - h('Button',{ | ||
25 | - on: { | ||
26 | - click: this.handleClick | 24 | + h('Icon', { |
25 | + props: { | ||
26 | + type: 'person' | ||
27 | } | 27 | } |
28 | - }, 'hello') | ||
29 | - ]) | 28 | + }), |
29 | + h('strong', params.row.name) | ||
30 | + ]); | ||
30 | } | 31 | } |
31 | }, | 32 | }, |
32 | { | 33 | { |
33 | title: '年龄', | 34 | title: '年龄', |
34 | - key: 'age' | 35 | + key: 'age', |
36 | + sortable: true | ||
35 | }, | 37 | }, |
36 | { | 38 | { |
37 | title: '地址', | 39 | title: '地址', |
@@ -42,9 +44,35 @@ | @@ -42,9 +44,35 @@ | ||
42 | key: 'action', | 44 | key: 'action', |
43 | width: 150, | 45 | width: 150, |
44 | align: 'center', | 46 | align: 'center', |
45 | -// render (row, column, index) { | ||
46 | -// return `<i-button type="primary" size="small" @click="show(${index})">查看</i-button> <i-button type="error" size="small" @click="remove(${index})">删除</i-button>`; | ||
47 | -// } | 47 | + render: (h, params) => { |
48 | + return h('div', [ | ||
49 | + h('Button', { | ||
50 | + props: { | ||
51 | + type: 'primary', | ||
52 | + size: 'small' | ||
53 | + }, | ||
54 | + style: { | ||
55 | + marginRight: '5px' | ||
56 | + }, | ||
57 | + on: { | ||
58 | + click: () => { | ||
59 | + this.show(params.index) | ||
60 | + } | ||
61 | + } | ||
62 | + }, '查看'), | ||
63 | + h('Button', { | ||
64 | + props: { | ||
65 | + type: 'error', | ||
66 | + size: 'small' | ||
67 | + }, | ||
68 | + on: { | ||
69 | + click: () => { | ||
70 | + this.remove(params.index) | ||
71 | + } | ||
72 | + } | ||
73 | + }, '删除') | ||
74 | + ]); | ||
75 | + } | ||
48 | } | 76 | } |
49 | ], | 77 | ], |
50 | data6: [ | 78 | data6: [ |
@@ -61,7 +89,8 @@ | @@ -61,7 +89,8 @@ | ||
61 | { | 89 | { |
62 | name: '李小红', | 90 | name: '李小红', |
63 | age: 30, | 91 | age: 30, |
64 | - address: '上海市浦东新区世纪大道' | 92 | + address: '上海市浦东新区世纪大道', |
93 | + _expanded: true | ||
65 | }, | 94 | }, |
66 | { | 95 | { |
67 | name: '周小伟', | 96 | name: '周小伟', |
@@ -71,11 +100,6 @@ | @@ -71,11 +100,6 @@ | ||
71 | ] | 100 | ] |
72 | } | 101 | } |
73 | }, | 102 | }, |
74 | - computed: { | ||
75 | - ttt () { | ||
76 | - return this.data1 + 1; | ||
77 | - } | ||
78 | - }, | ||
79 | methods: { | 103 | methods: { |
80 | show (index) { | 104 | show (index) { |
81 | this.$Modal.info({ | 105 | this.$Modal.info({ |
@@ -86,11 +110,9 @@ | @@ -86,11 +110,9 @@ | ||
86 | remove (index) { | 110 | remove (index) { |
87 | this.data6.splice(index, 1); | 111 | this.data6.splice(index, 1); |
88 | }, | 112 | }, |
89 | - handleAdd () { | ||
90 | - this.data1++; | ||
91 | - }, | ||
92 | - handleClick () { | ||
93 | - this.$Message.info('111') | 113 | + expand (row, s) { |
114 | +// console.log(row); | ||
115 | +// console.log(s); | ||
94 | } | 116 | } |
95 | } | 117 | } |
96 | } | 118 | } |
examples/routers/transfer.vue
@@ -178,7 +178,7 @@ | @@ -178,7 +178,7 @@ | ||
178 | setTimeout(function() { | 178 | setTimeout(function() { |
179 | console.log('--1'); | 179 | console.log('--1'); |
180 | // _this.data1 = null; | 180 | // _this.data1 = null; |
181 | - _this.data1 = _this.getMockData1(); | 181 | +// _this.data1 = _this.getMockData1(); |
182 | console.log('-fetch-', _this.data1); | 182 | console.log('-fetch-', _this.data1); |
183 | 183 | ||
184 | }, 1500); | 184 | }, 1500); |
src/components/back-top/back-top.vue
@@ -67,7 +67,8 @@ | @@ -67,7 +67,8 @@ | ||
67 | this.backTop = window.pageYOffset >= this.height; | 67 | this.backTop = window.pageYOffset >= this.height; |
68 | }, | 68 | }, |
69 | back () { | 69 | back () { |
70 | - scrollTop(window, document.body.scrollTop, 0, this.duration); | 70 | + const sTop = document.documentElement.scrollTop || document.body.scrollTop; |
71 | + scrollTop(window, sTop, 0, this.duration); | ||
71 | this.$emit('on-click'); | 72 | this.$emit('on-click'); |
72 | } | 73 | } |
73 | } | 74 | } |
src/components/input/input.vue
@@ -37,6 +37,7 @@ | @@ -37,6 +37,7 @@ | ||
37 | :readonly="readonly" | 37 | :readonly="readonly" |
38 | :name="name" | 38 | :name="name" |
39 | :value="value" | 39 | :value="value" |
40 | + :autofocus="autofocus" | ||
40 | @keyup.enter="handleEnter" | 41 | @keyup.enter="handleEnter" |
41 | @focus="handleFocus" | 42 | @focus="handleFocus" |
42 | @blur="handleBlur" | 43 | @blur="handleBlur" |
src/components/select/select.vue
src/components/table/cell.vue
@@ -4,18 +4,25 @@ | @@ -4,18 +4,25 @@ | ||
4 | <template v-if="renderType === 'selection'"> | 4 | <template v-if="renderType === 'selection'"> |
5 | <Checkbox :value="checked" @on-change="toggleSelect" :disabled="disabled"></Checkbox> | 5 | <Checkbox :value="checked" @on-change="toggleSelect" :disabled="disabled"></Checkbox> |
6 | </template> | 6 | </template> |
7 | + | ||
7 | <template v-if="renderType === 'html'"><span v-html="row[column.key]"></span></template> | 8 | <template v-if="renderType === 'html'"><span v-html="row[column.key]"></span></template> |
8 | <template v-if="renderType === 'normal'"><span>{{row[column.key]}}</span></template> | 9 | <template v-if="renderType === 'normal'"><span>{{row[column.key]}}</span></template> |
10 | + <template v-if="renderType === 'expand'"> | ||
11 | + <div :class="expandCls" @click="toggleExpand"> | ||
12 | + <Icon type="ios-arrow-right"></Icon> | ||
13 | + </div> | ||
14 | + </template> | ||
9 | </div> | 15 | </div> |
10 | </template> | 16 | </template> |
11 | <script> | 17 | <script> |
12 | import Vue from 'vue'; | 18 | import Vue from 'vue'; |
19 | + import Icon from '../icon/icon.vue'; | ||
13 | import Checkbox from '../checkbox/checkbox.vue'; | 20 | import Checkbox from '../checkbox/checkbox.vue'; |
14 | import { findComponentUpward } from '../../utils/assist'; | 21 | import { findComponentUpward } from '../../utils/assist'; |
15 | 22 | ||
16 | export default { | 23 | export default { |
17 | name: 'TableCell', | 24 | name: 'TableCell', |
18 | - components: { Checkbox }, | 25 | + components: { Icon, Checkbox }, |
19 | props: { | 26 | props: { |
20 | prefixCls: String, | 27 | prefixCls: String, |
21 | row: Object, | 28 | row: Object, |
@@ -24,6 +31,7 @@ | @@ -24,6 +31,7 @@ | ||
24 | index: Number, // _index of data | 31 | index: Number, // _index of data |
25 | checked: Boolean, | 32 | checked: Boolean, |
26 | disabled: Boolean, | 33 | disabled: Boolean, |
34 | + expanded: Boolean, | ||
27 | fixed: { | 35 | fixed: { |
28 | type: [Boolean, String], | 36 | type: [Boolean, String], |
29 | default: false | 37 | default: false |
@@ -42,20 +50,30 @@ | @@ -42,20 +50,30 @@ | ||
42 | `${this.prefixCls}-cell`, | 50 | `${this.prefixCls}-cell`, |
43 | { | 51 | { |
44 | [`${this.prefixCls}-hidden`]: !this.fixed && this.column.fixed && (this.column.fixed === 'left' || this.column.fixed === 'right'), | 52 | [`${this.prefixCls}-hidden`]: !this.fixed && this.column.fixed && (this.column.fixed === 'left' || this.column.fixed === 'right'), |
45 | - [`${this.prefixCls}-cell-ellipsis`]: this.column.ellipsis || false | 53 | + [`${this.prefixCls}-cell-ellipsis`]: this.column.ellipsis || false, |
54 | + [`${this.prefixCls}-cell-with-expand`]: this.renderType === 'expand' | ||
55 | + } | ||
56 | + ]; | ||
57 | + }, | ||
58 | + expandCls () { | ||
59 | + return [ | ||
60 | + `${this.prefixCls}-cell-expand`, | ||
61 | + { | ||
62 | + [`${this.prefixCls}-cell-expand-expanded`]: this.expanded | ||
46 | } | 63 | } |
47 | ]; | 64 | ]; |
48 | } | 65 | } |
49 | }, | 66 | }, |
50 | methods: { | 67 | methods: { |
51 | compile () { | 68 | compile () { |
52 | - if (this.column.render) { | 69 | + if (this.column.render && this.renderType === 'render') { |
53 | // 兼容真 Render,后期废弃旧用法 | 70 | // 兼容真 Render,后期废弃旧用法 |
54 | let isRealRender = true; | 71 | let isRealRender = true; |
55 | const Table = findComponentUpward(this, 'Table'); | 72 | const Table = findComponentUpward(this, 'Table'); |
56 | if (Table.context) isRealRender = false; | 73 | if (Table.context) isRealRender = false; |
57 | 74 | ||
58 | if (isRealRender) { | 75 | if (isRealRender) { |
76 | + this.$el.innerHTML = ''; | ||
59 | const component = new Vue({ | 77 | const component = new Vue({ |
60 | functional: true, | 78 | functional: true, |
61 | render: (h) => { | 79 | render: (h) => { |
@@ -114,6 +132,9 @@ | @@ -114,6 +132,9 @@ | ||
114 | }, | 132 | }, |
115 | toggleSelect () { | 133 | toggleSelect () { |
116 | this.$parent.$parent.toggleSelect(this.index); | 134 | this.$parent.$parent.toggleSelect(this.index); |
135 | + }, | ||
136 | + toggleExpand () { | ||
137 | + this.$parent.$parent.toggleExpand(this.index); | ||
117 | } | 138 | } |
118 | }, | 139 | }, |
119 | created () { | 140 | created () { |
@@ -123,6 +144,8 @@ | @@ -123,6 +144,8 @@ | ||
123 | this.renderType = 'selection'; | 144 | this.renderType = 'selection'; |
124 | } else if (this.column.type === 'html') { | 145 | } else if (this.column.type === 'html') { |
125 | this.renderType = 'html'; | 146 | this.renderType = 'html'; |
147 | + } else if (this.column.type === 'expand') { | ||
148 | + this.renderType = 'expand'; | ||
126 | } else if (this.column.render) { | 149 | } else if (this.column.render) { |
127 | this.renderType = 'render'; | 150 | this.renderType = 'render'; |
128 | } else { | 151 | } else { |
1 | +<template> | ||
2 | + <div ref="cell"></div> | ||
3 | +</template> | ||
4 | +<script> | ||
5 | + import Vue from 'vue'; | ||
6 | + export default { | ||
7 | + name: 'TableExpand', | ||
8 | + props: { | ||
9 | + row: Object, | ||
10 | + render: Function, | ||
11 | + index: Number, | ||
12 | + }, | ||
13 | + methods: { | ||
14 | + compile () { | ||
15 | + if (this.render) { | ||
16 | + this.$el.innerHTML = ''; | ||
17 | + const component = new Vue({ | ||
18 | + functional: true, | ||
19 | + render: (h) => { | ||
20 | + return this.render(h, { | ||
21 | + row: this.row, | ||
22 | + index: this.index | ||
23 | + }); | ||
24 | + } | ||
25 | + }); | ||
26 | + const Cell = component.$mount(); | ||
27 | + this.$refs.cell.appendChild(Cell.$el); | ||
28 | + } | ||
29 | + } | ||
30 | + }, | ||
31 | + mounted () { | ||
32 | + this.$nextTick(() => { | ||
33 | + this.compile(); | ||
34 | + }); | ||
35 | + } | ||
36 | + }; | ||
37 | +</script> | ||
0 | \ No newline at end of file | 38 | \ No newline at end of file |
src/components/table/table-body.vue
@@ -4,39 +4,47 @@ | @@ -4,39 +4,47 @@ | ||
4 | <col v-for="(column, index) in columns" :width="setCellWidth(column, index, false)"> | 4 | <col v-for="(column, index) in columns" :width="setCellWidth(column, index, false)"> |
5 | </colgroup> | 5 | </colgroup> |
6 | <tbody :class="[prefixCls + '-tbody']"> | 6 | <tbody :class="[prefixCls + '-tbody']"> |
7 | - <tr | ||
8 | - v-for="(row, index) in data" | ||
9 | - :key="row" | ||
10 | - :class="rowClasses(row._index)" | ||
11 | - @mouseenter.stop="handleMouseIn(row._index)" | ||
12 | - @mouseleave.stop="handleMouseOut(row._index)" | ||
13 | - @click.stop="clickCurrentRow(row._index)" | ||
14 | - @dblclick.stop="dblclickCurrentRow(row._index)"> | ||
15 | - <td v-for="column in columns" :class="alignCls(column, row)"> | ||
16 | - <Cell | ||
17 | - :fixed="fixed" | ||
18 | - :prefix-cls="prefixCls" | ||
19 | - :row="row" | ||
20 | - :column="column" | ||
21 | - :natural-index="index" | ||
22 | - :index="row._index" | ||
23 | - :checked="rowChecked(row._index)" | ||
24 | - :disabled="rowDisabled(row._index)" | 7 | + <template v-for="(row, index) in data"> |
8 | + <tr | ||
9 | + :key="row" | ||
10 | + :class="rowClasses(row._index)" | ||
11 | + @mouseenter.stop="handleMouseIn(row._index)" | ||
12 | + @mouseleave.stop="handleMouseOut(row._index)" | ||
13 | + @click.stop="clickCurrentRow(row._index)" | ||
14 | + @dblclick.stop="dblclickCurrentRow(row._index)"> | ||
15 | + <td v-for="column in columns" :class="alignCls(column, row)"> | ||
16 | + <Cell | ||
17 | + :fixed="fixed" | ||
18 | + :prefix-cls="prefixCls" | ||
19 | + :row="row" | ||
20 | + :column="column" | ||
21 | + :natural-index="index" | ||
22 | + :index="row._index" | ||
23 | + :checked="rowChecked(row._index)" | ||
24 | + :disabled="rowDisabled(row._index)" | ||
25 | + :expanded="rowExpanded(row._index)" | ||
25 | ></Cell> | 26 | ></Cell> |
26 | - </td> | ||
27 | - </tr> | 27 | + </td> |
28 | + </tr> | ||
29 | + <tr v-if="rowExpanded(row._index)"> | ||
30 | + <td :colspan="columns.length" :class="prefixCls + '-expanded-cell'"> | ||
31 | + <Expand :row="row" :render="expandRender" :index="row._index"></Expand> | ||
32 | + </td> | ||
33 | + </tr> | ||
34 | + </template> | ||
28 | </tbody> | 35 | </tbody> |
29 | </table> | 36 | </table> |
30 | </template> | 37 | </template> |
31 | <script> | 38 | <script> |
32 | // todo :key="row" | 39 | // todo :key="row" |
33 | import Cell from './cell.vue'; | 40 | import Cell from './cell.vue'; |
41 | + import Expand from './expand.vue'; | ||
34 | import Mixin from './mixin'; | 42 | import Mixin from './mixin'; |
35 | 43 | ||
36 | export default { | 44 | export default { |
37 | name: 'TableBody', | 45 | name: 'TableBody', |
38 | mixins: [ Mixin ], | 46 | mixins: [ Mixin ], |
39 | - components: { Cell }, | 47 | + components: { Cell, Expand }, |
40 | props: { | 48 | props: { |
41 | prefixCls: String, | 49 | prefixCls: String, |
42 | styleObject: Object, | 50 | styleObject: Object, |
@@ -49,6 +57,20 @@ | @@ -49,6 +57,20 @@ | ||
49 | default: false | 57 | default: false |
50 | } | 58 | } |
51 | }, | 59 | }, |
60 | + computed: { | ||
61 | + expandRender () { | ||
62 | + let render = function () { | ||
63 | + return ''; | ||
64 | + }; | ||
65 | + for (let i = 0; i < this.columns.length; i++) { | ||
66 | + const column = this.columns[i]; | ||
67 | + if (column.type && column.type === 'expand') { | ||
68 | + if (column.render) render = column.render; | ||
69 | + } | ||
70 | + } | ||
71 | + return render; | ||
72 | + } | ||
73 | + }, | ||
52 | methods: { | 74 | methods: { |
53 | rowClasses (_index) { | 75 | rowClasses (_index) { |
54 | return [ | 76 | return [ |
@@ -66,6 +88,9 @@ | @@ -66,6 +88,9 @@ | ||
66 | rowDisabled(_index){ | 88 | rowDisabled(_index){ |
67 | return this.objData[_index] && this.objData[_index]._isDisabled; | 89 | return this.objData[_index] && this.objData[_index]._isDisabled; |
68 | }, | 90 | }, |
91 | + rowExpanded(_index){ | ||
92 | + return this.objData[_index] && this.objData[_index]._isExpanded; | ||
93 | + }, | ||
69 | rowClsName (_index) { | 94 | rowClsName (_index) { |
70 | return this.$parent.rowClassName(this.objData[_index], _index); | 95 | return this.$parent.rowClassName(this.objData[_index], _index); |
71 | }, | 96 | }, |
src/components/table/table-head.vue
@@ -7,7 +7,8 @@ | @@ -7,7 +7,8 @@ | ||
7 | <tr> | 7 | <tr> |
8 | <th v-for="(column, index) in columns" :class="alignCls(column)"> | 8 | <th v-for="(column, index) in columns" :class="alignCls(column)"> |
9 | <div :class="cellClasses(column)"> | 9 | <div :class="cellClasses(column)"> |
10 | - <template v-if="column.type === 'selection'"><Checkbox :value="isSelectAll" @on-change="selectAll"></Checkbox></template> | 10 | + <template v-if="column.type === 'expand'"></template> |
11 | + <template v-else-if="column.type === 'selection'"><Checkbox :value="isSelectAll" @on-change="selectAll"></Checkbox></template> | ||
11 | <template v-else> | 12 | <template v-else> |
12 | <span v-html="renderHeader(column, index)"></span> | 13 | <span v-html="renderHeader(column, index)"></span> |
13 | <span :class="[prefixCls + '-sort']" v-if="column.sortable"> | 14 | <span :class="[prefixCls + '-sort']" v-if="column.sortable"> |
src/components/table/table.vue
@@ -404,6 +404,18 @@ | @@ -404,6 +404,18 @@ | ||
404 | } | 404 | } |
405 | this.$emit('on-selection-change', selection); | 405 | this.$emit('on-selection-change', selection); |
406 | }, | 406 | }, |
407 | + toggleExpand (_index) { | ||
408 | + let data = {}; | ||
409 | + | ||
410 | + for (let i in this.objData) { | ||
411 | + if (parseInt(i) === _index) { | ||
412 | + data = this.objData[i]; | ||
413 | + } | ||
414 | + } | ||
415 | + const status = !data._isExpanded; | ||
416 | + this.objData[_index]._isExpanded = status; | ||
417 | + this.$emit('on-expand', JSON.parse(JSON.stringify(this.cloneData[_index])), status); | ||
418 | + }, | ||
407 | selectAll (status) { | 419 | selectAll (status) { |
408 | // this.rebuildData.forEach((data) => { | 420 | // this.rebuildData.forEach((data) => { |
409 | // if(this.objData[data._index]._isDisabled){ | 421 | // if(this.objData[data._index]._isDisabled){ |
@@ -581,9 +593,9 @@ | @@ -581,9 +593,9 @@ | ||
581 | this.data.forEach((row, index) => { | 593 | this.data.forEach((row, index) => { |
582 | const newRow = deepCopy(row);// todo 直接替换 | 594 | const newRow = deepCopy(row);// todo 直接替换 |
583 | newRow._isHover = false; | 595 | newRow._isHover = false; |
584 | - if(newRow._disabled){ | 596 | + if (newRow._disabled) { |
585 | newRow._isDisabled = newRow._disabled; | 597 | newRow._isDisabled = newRow._disabled; |
586 | - }else{ | 598 | + } else { |
587 | newRow._isDisabled = false; | 599 | newRow._isDisabled = false; |
588 | } | 600 | } |
589 | if (newRow._checked) { | 601 | if (newRow._checked) { |
@@ -591,6 +603,11 @@ | @@ -591,6 +603,11 @@ | ||
591 | } else { | 603 | } else { |
592 | newRow._isChecked = false; | 604 | newRow._isChecked = false; |
593 | } | 605 | } |
606 | + if (newRow._expanded) { | ||
607 | + newRow._isExpanded = newRow._expanded; | ||
608 | + } else { | ||
609 | + newRow._isExpanded = false; | ||
610 | + } | ||
594 | if (newRow._highlight) { | 611 | if (newRow._highlight) { |
595 | newRow._isHighlight = newRow._highlight; | 612 | newRow._isHighlight = newRow._highlight; |
596 | } else { | 613 | } else { |
src/components/transfer/list.vue
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | <div :class="classes" :style="listStyle"> | 2 | <div :class="classes" :style="listStyle"> |
3 | <div :class="prefixCls + '-header'"> | 3 | <div :class="prefixCls + '-header'"> |
4 | <Checkbox :value="checkedAll" :disabled="checkedAllDisabled" @on-change="toggleSelectAll"></Checkbox> | 4 | <Checkbox :value="checkedAll" :disabled="checkedAllDisabled" @on-change="toggleSelectAll"></Checkbox> |
5 | - <span>{{ title }}</span> | 5 | + <span :class="prefixCls + '-header-title'" @click="toggleSelectAll(!checkedAll)">{{ title }}</span> |
6 | <span :class="prefixCls + '-header-count'">{{ count }}</span> | 6 | <span :class="prefixCls + '-header-count'">{{ count }}</span> |
7 | </div> | 7 | </div> |
8 | <div :class="bodyClasses"> | 8 | <div :class="bodyClasses"> |
1 | +export default { | ||
2 | + i: { | ||
3 | + select: { | ||
4 | + placeholder: 'Выбрать', | ||
5 | + noMatch: 'Нет соответствующих данных', | ||
6 | + loading: 'Загрузка' | ||
7 | + }, | ||
8 | + table: { | ||
9 | + noDataText: 'Нет данных', | ||
10 | + noFilteredDataText: 'Нет данных по фильтру', | ||
11 | + confirmFilter: 'Подтвердить', | ||
12 | + resetFilter: 'Сброс', | ||
13 | + clearFilter: 'Все' | ||
14 | + }, | ||
15 | + datepicker: { | ||
16 | + selectDate: 'Выбрать дату', | ||
17 | + selectTime: 'Выбрать время', | ||
18 | + startTime: 'Начальное время', | ||
19 | + endTime: 'Конечное время', | ||
20 | + clear: 'Очистить', | ||
21 | + ok: 'OK', | ||
22 | + month: '', | ||
23 | + month1: 'Январь', | ||
24 | + month2: 'Февраль', | ||
25 | + month3: 'Март', | ||
26 | + month4: 'Апрель', | ||
27 | + month5: 'Май', | ||
28 | + month6: 'Июнь', | ||
29 | + month7: 'Июль', | ||
30 | + month8: 'Август', | ||
31 | + month9: 'Сентябрь', | ||
32 | + month10: 'Октябрь', | ||
33 | + month11: 'Ноябрь', | ||
34 | + month12: 'Декабрь', | ||
35 | + year: '', | ||
36 | + weeks: { | ||
37 | + sun: 'Вс', | ||
38 | + mon: 'Пн', | ||
39 | + tue: 'Вт', | ||
40 | + wed: 'Ср', | ||
41 | + thu: 'Чт', | ||
42 | + fri: 'Пт', | ||
43 | + sat: 'Сб' | ||
44 | + }, | ||
45 | + months: { | ||
46 | + m1: 'Янв', | ||
47 | + m2: 'Фев', | ||
48 | + m3: 'Мар', | ||
49 | + m4: 'Апр', | ||
50 | + m5: 'Май', | ||
51 | + m6: 'Июн', | ||
52 | + m7: 'Июл', | ||
53 | + m8: 'Авг', | ||
54 | + m9: 'Сен', | ||
55 | + m10: 'Окт', | ||
56 | + m11: 'Ноя', | ||
57 | + m12: 'Дек' | ||
58 | + } | ||
59 | + }, | ||
60 | + transfer: { | ||
61 | + titles: { | ||
62 | + source: 'Источник', | ||
63 | + target: 'Цель' | ||
64 | + }, | ||
65 | + filterPlaceholder: 'Искать здесь', | ||
66 | + notFoundText: 'Не Найдено' | ||
67 | + }, | ||
68 | + modal: { | ||
69 | + okText: 'OK', | ||
70 | + cancelText: 'Отменить' | ||
71 | + }, | ||
72 | + poptip: { | ||
73 | + okText: 'OK', | ||
74 | + cancelText: 'Отменить' | ||
75 | + }, | ||
76 | + page: { | ||
77 | + prev: 'Пред. страница', | ||
78 | + next: 'След. страница', | ||
79 | + total: 'Всего', | ||
80 | + item: 'пункт', | ||
81 | + items: 'пункты', | ||
82 | + prev5: 'Пред. 5 страниц', | ||
83 | + next5: 'След. 5 страниц', | ||
84 | + page: '/page', | ||
85 | + goto: 'Идти к', | ||
86 | + p: '' | ||
87 | + }, | ||
88 | + rate: { | ||
89 | + star: 'Звезда', | ||
90 | + stars: 'Звезды' | ||
91 | + }, | ||
92 | + tree: { | ||
93 | + emptyText: 'Нет данных' | ||
94 | + } | ||
95 | + } | ||
96 | +}; | ||
0 | \ No newline at end of file | 97 | \ No newline at end of file |
src/styles/components/notice.less
@@ -50,6 +50,7 @@ | @@ -50,6 +50,7 @@ | ||
50 | white-space: nowrap; | 50 | white-space: nowrap; |
51 | } | 51 | } |
52 | &-with-desc &-title{ | 52 | &-with-desc &-title{ |
53 | + font-weight: bold; | ||
53 | margin-bottom: 8px; | 54 | margin-bottom: 8px; |
54 | } | 55 | } |
55 | &-with-desc&-with-icon &-title{ | 56 | &-with-desc&-with-icon &-title{ |
@@ -58,7 +59,8 @@ | @@ -58,7 +59,8 @@ | ||
58 | 59 | ||
59 | &-desc { | 60 | &-desc { |
60 | font-size: 12px; | 61 | font-size: 12px; |
61 | - color: @legend-color; | 62 | + //color: @legend-color; |
63 | + color: @text-color; | ||
62 | text-align: justify; | 64 | text-align: justify; |
63 | line-height: 1.5; | 65 | line-height: 1.5; |
64 | } | 66 | } |
src/styles/components/table.less
@@ -145,6 +145,24 @@ | @@ -145,6 +145,24 @@ | ||
145 | overflow: hidden; | 145 | overflow: hidden; |
146 | text-overflow: ellipsis; | 146 | text-overflow: ellipsis; |
147 | } | 147 | } |
148 | + | ||
149 | + &-with-expand{ | ||
150 | + height: 47px; | ||
151 | + line-height: 47px; | ||
152 | + padding: 0; | ||
153 | + text-align: center; | ||
154 | + } | ||
155 | + | ||
156 | + &-expand{ | ||
157 | + cursor: pointer; | ||
158 | + transition: transform @transition-time @ease-in-out; | ||
159 | + i{ | ||
160 | + font-size: @font-size-base; | ||
161 | + } | ||
162 | + &-expanded{ | ||
163 | + transform: rotate(90deg); | ||
164 | + } | ||
165 | + } | ||
148 | } | 166 | } |
149 | &-hidden{ | 167 | &-hidden{ |
150 | visibility: hidden; | 168 | visibility: hidden; |
@@ -156,6 +174,11 @@ | @@ -156,6 +174,11 @@ | ||
156 | vertical-align: middle; | 174 | vertical-align: middle; |
157 | } | 175 | } |
158 | 176 | ||
177 | + td&-expanded-cell{ | ||
178 | + padding: 20px 50px; | ||
179 | + background: @table-thead-bg; | ||
180 | + } | ||
181 | + | ||
159 | &-stripe &-body, | 182 | &-stripe &-body, |
160 | &-stripe &-fixed-body | 183 | &-stripe &-fixed-body |
161 | { | 184 | { |
@@ -184,6 +207,13 @@ | @@ -184,6 +207,13 @@ | ||
184 | height: 60px; | 207 | height: 60px; |
185 | line-height: 60px; | 208 | line-height: 60px; |
186 | } | 209 | } |
210 | + .@{table-prefix-cls}-cell-with-expand{ | ||
211 | + height: 59px; | ||
212 | + line-height: 59px; | ||
213 | + i{ | ||
214 | + font-size: @font-size-base+2; | ||
215 | + } | ||
216 | + } | ||
187 | } | 217 | } |
188 | 218 | ||
189 | &-small{ | 219 | &-small{ |
@@ -197,6 +227,10 @@ | @@ -197,6 +227,10 @@ | ||
197 | height: 40px; | 227 | height: 40px; |
198 | line-height: 40px; | 228 | line-height: 40px; |
199 | } | 229 | } |
230 | + .@{table-prefix-cls}-cell-with-expand{ | ||
231 | + height: 39px; | ||
232 | + line-height: 39px; | ||
233 | + } | ||
200 | } | 234 | } |
201 | 235 | ||
202 | &-row-highlight, | 236 | &-row-highlight, |
src/styles/components/transfer.less
src/styles/custom.less
@@ -3,25 +3,25 @@ | @@ -3,25 +3,25 @@ | ||
3 | @css-prefix-iconfont : ivu-icon; | 3 | @css-prefix-iconfont : ivu-icon; |
4 | 4 | ||
5 | // Color | 5 | // Color |
6 | -@primary-color : #3399ff; | 6 | +@primary-color : #2d8cf0; |
7 | @info-color : #2db7f5; | 7 | @info-color : #2db7f5; |
8 | -@success-color : #00cc66; | 8 | +@success-color : #19be6b; |
9 | @warning-color : #ff9900; | 9 | @warning-color : #ff9900; |
10 | -@error-color : #ff3300; | ||
11 | -@link-color : #3399ff; | 10 | +@error-color : #ed3f14; |
11 | +@link-color : #2D8cF0; | ||
12 | @link-hover-color : tint(@link-color, 20%); | 12 | @link-hover-color : tint(@link-color, 20%); |
13 | @link-active-color : shade(@link-color, 5%); | 13 | @link-active-color : shade(@link-color, 5%); |
14 | @selected-color : fade(@primary-color, 90%); | 14 | @selected-color : fade(@primary-color, 90%); |
15 | @tooltip-color : #fff; | 15 | @tooltip-color : #fff; |
16 | -@subsidiary-color : #9ea7b4; | 16 | +@subsidiary-color : #80848f; |
17 | @rate-star-color : #f5a623; | 17 | @rate-star-color : #f5a623; |
18 | 18 | ||
19 | // Base | 19 | // Base |
20 | @body-background : #fff; | 20 | @body-background : #fff; |
21 | @font-family : "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif; | 21 | @font-family : "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif; |
22 | @code-family : Consolas,Menlo,Courier,monospace; | 22 | @code-family : Consolas,Menlo,Courier,monospace; |
23 | -@title-color : #464c5b; | ||
24 | -@text-color : #657180; | 23 | +@title-color : #1c2438; |
24 | +@text-color : #495060; | ||
25 | @font-size-base : 14px; | 25 | @font-size-base : 14px; |
26 | @font-size-small : 12px; | 26 | @font-size-small : 12px; |
27 | @line-height-base : 1.5; | 27 | @line-height-base : 1.5; |
@@ -31,16 +31,16 @@ | @@ -31,16 +31,16 @@ | ||
31 | @cursor-disabled : not-allowed; | 31 | @cursor-disabled : not-allowed; |
32 | 32 | ||
33 | // Border color | 33 | // Border color |
34 | -@border-color-base : #d7dde4; // outside | ||
35 | -@border-color-split : #e3e8ee; // inside | 34 | +@border-color-base : #dddee1; // outside |
35 | +@border-color-split : #e9eaec; // inside | ||
36 | 36 | ||
37 | // Background color | 37 | // Background color |
38 | @background-color-base : #f7f7f7; // base | 38 | @background-color-base : #f7f7f7; // base |
39 | @background-color-select-hover: @input-disabled-bg; | 39 | @background-color-select-hover: @input-disabled-bg; |
40 | @tooltip-bg : rgba(70, 76, 91, .9); | 40 | @tooltip-bg : rgba(70, 76, 91, .9); |
41 | @head-bg : #f9fafc; | 41 | @head-bg : #f9fafc; |
42 | -@table-thead-bg : #f5f7f9; | ||
43 | -@table-td-stripe-bg : #f5f7f9; | 42 | +@table-thead-bg : #f8f8f9; |
43 | +@table-td-stripe-bg : #f8f8f9; | ||
44 | @table-td-hover-bg : #ebf7ff; | 44 | @table-td-hover-bg : #ebf7ff; |
45 | @table-td-highlight-bg : #ebf7ff; | 45 | @table-td-highlight-bg : #ebf7ff; |
46 | @menu-dark-active-bg : #313540; | 46 | @menu-dark-active-bg : #313540; |
@@ -66,7 +66,7 @@ | @@ -66,7 +66,7 @@ | ||
66 | @btn-border-radius-small: 3px; | 66 | @btn-border-radius-small: 3px; |
67 | @btn-group-border : shade(@primary-color, 5%); | 67 | @btn-group-border : shade(@primary-color, 5%); |
68 | 68 | ||
69 | -@btn-disable-color : #c3cbd6; | 69 | +@btn-disable-color : #bbbec4; |
70 | @btn-disable-bg : @background-color-base; | 70 | @btn-disable-bg : @background-color-base; |
71 | @btn-disable-border : @border-color-base; | 71 | @btn-disable-border : @border-color-base; |
72 | 72 |
src/styles/mixins/button.less
@@ -133,7 +133,7 @@ | @@ -133,7 +133,7 @@ | ||
133 | line-height: @line-height-base; | 133 | line-height: @line-height-base; |
134 | user-select: none; | 134 | user-select: none; |
135 | .button-size(@btn-padding-base; @btn-font-size; @btn-border-radius); | 135 | .button-size(@btn-padding-base; @btn-font-size; @btn-border-radius); |
136 | - transform: translate3d(0, 0, 0); | 136 | + //transform: translate3d(0, 0, 0); |
137 | //transition: all @transition-time linear; | 137 | //transition: all @transition-time linear; |
138 | transition: color @transition-time linear, background-color @transition-time linear, border @transition-time linear; | 138 | transition: color @transition-time linear, background-color @transition-time linear, border @transition-time linear; |
139 | 139 |