md-iview 1.0.12
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -0
- package/package.json +116 -0
- package/src/components/libs/util.js +117 -0
- package/src/components/md-error-page/403.less +92 -0
- package/src/components/md-error-page/403.vue +34 -0
- package/src/components/md-error-page/404.less +60 -0
- package/src/components/md-error-page/404.vue +34 -0
- package/src/components/md-error-page/500.less +73 -0
- package/src/components/md-error-page/500.vue +36 -0
- package/src/components/md-error-page/demo/index.less +22 -0
- package/src/components/md-error-page/demo/index.vue +97 -0
- package/src/components/md-form-item/index.js +3 -0
- package/src/components/md-icon/icon.vue +77 -0
- package/src/components/md-icon/icons.js +5 -0
- package/src/components/md-icon/index.js +11 -0
- package/src/components/md-icon/style/index.less +1 -0
- package/src/components/md-loading/index.js +55 -0
- package/src/components/md-loading/index.vue +53 -0
- package/src/components/md-loading/md-loading.js +38 -0
- package/src/components/md-print/demo/index.vue +260 -0
- package/src/components/md-print/index.js +123 -0
- package/src/components/md-rich-editor/index.vue +69 -0
- package/src/components/md-rich-editor/module/image-extend/index.js +216 -0
- package/src/components/md-scroll-bar/demo/index.vue +102 -0
- package/src/components/md-scroll-bar/index.js +3 -0
- package/src/components/md-scroll-bar/index.less +90 -0
- package/src/components/md-scroll-bar/index.vue +250 -0
- package/src/components/md-select/index.js +7 -0
- package/src/components/md-select/select.vue +841 -0
- package/src/components/md-shrinkable-menu/components/sidebarMenu.vue +167 -0
- package/src/components/md-shrinkable-menu/components/sidebarMenuShrink.vue +119 -0
- package/src/components/md-shrinkable-menu/demo/data/cachePage.js +1 -0
- package/src/components/md-shrinkable-menu/demo/data/currentPath.js +9 -0
- package/src/components/md-shrinkable-menu/demo/data/menu.js +575 -0
- package/src/components/md-shrinkable-menu/demo/data/menu2.js +1017 -0
- package/src/components/md-shrinkable-menu/demo/data/pageTagsList.js +153 -0
- package/src/components/md-shrinkable-menu/demo/index.less +297 -0
- package/src/components/md-shrinkable-menu/demo/index.vue +285 -0
- package/src/components/md-shrinkable-menu/index.vue +112 -0
- package/src/components/md-shrinkable-menu/sidebar.vue +195 -0
- package/src/components/md-shrinkable-menu/styles/menu.less +5 -0
- package/src/components/md-shrinkable-menu/styles/sidebar.less +363 -0
- package/src/components/md-split-pane/demo/index.vue +101 -0
- package/src/components/md-split-pane/index.js +3 -0
- package/src/components/md-split-pane/index.less +93 -0
- package/src/components/md-split-pane/index.vue +230 -0
- package/src/components/md-table/action-tooltip.vue +45 -0
- package/src/components/md-table/can-edit-v2.vue +823 -0
- package/src/components/md-table/can-edit.vue +723 -0
- package/src/components/md-table/custom-cell.vue +71 -0
- package/src/components/md-table/date-picker-cell-v2.vue +48 -0
- package/src/components/md-table/date-picker-cell.vue +39 -0
- package/src/components/md-table/demo/data/search.js +67 -0
- package/src/components/md-table/demo/data/table2csv.js +200 -0
- package/src/components/md-table/demo/data/table2excel.js +239 -0
- package/src/components/md-table/demo/data/table_data.js +251 -0
- package/src/components/md-table/demo/editable-table.vue +144 -0
- package/src/components/md-table/demo/exportable-table.vue +124 -0
- package/src/components/md-table/demo/widgets/header-search.vue +88 -0
- package/src/components/md-table/drop-down-cell-v2.vue +87 -0
- package/src/components/md-table/drop-down-cell.vue +81 -0
- package/src/components/md-table/editable-expand.vue +143 -0
- package/src/components/md-table/expand.vue +97 -0
- package/src/components/md-table/index.vue +53 -0
- package/src/components/md-table/iview-table/cell.vue +99 -0
- package/src/components/md-table/iview-table/expand.js +21 -0
- package/src/components/md-table/iview-table/export-csv.js +76 -0
- package/src/components/md-table/iview-table/header.js +16 -0
- package/src/components/md-table/iview-table/index.js +2 -0
- package/src/components/md-table/iview-table/mixin.js +31 -0
- package/src/components/md-table/iview-table/table-body.vue +101 -0
- package/src/components/md-table/iview-table/table-head.vue +311 -0
- package/src/components/md-table/iview-table/table-tr.vue +31 -0
- package/src/components/md-table/iview-table/table.vue +1026 -0
- package/src/components/md-table/iview-table/util.js +93 -0
- package/src/components/md-table/libs/table2excel.js +100 -0
- package/src/components/md-table/select-cell-v2.vue +64 -0
- package/src/components/md-table/select-cell.vue +46 -0
- package/src/components/md-table/table.less +76 -0
- package/src/components/md-toolbar/index.vue +171 -0
- package/src/components/md-tree/index.js +2 -0
- package/src/components/md-tree/node.vue +238 -0
- package/src/components/md-tree/render.js +17 -0
- package/src/components/md-tree/tree.vue +241 -0
- package/src/components/utilities/can.js +35 -0
- package/src/directives/index.js +34 -0
- package/src/directives/resize.js +27 -0
- package/src/directives/scroll.js +27 -0
- package/src/directives/style/bg-color.js +23 -0
- package/src/directives/style/color.js +23 -0
- package/src/directives/style/font-size.js +23 -0
- package/src/directives/style/height.js +23 -0
- package/src/directives/style/lineHeight.js +23 -0
- package/src/directives/style/margin.js +48 -0
- package/src/directives/style/opacity.js +23 -0
- package/src/directives/style/padding.js +48 -0
- package/src/directives/style/width.js +24 -0
- package/src/index.js +442 -0
- package/src/locale/lang.js +5 -0
- package/src/mixins/colorable.js +51 -0
- package/src/style/color/bezierEasing.less +110 -0
- package/src/style/color/colorPalette.less +75 -0
- package/src/style/color/colors.less +146 -0
- package/src/style/color/tinyColor.less +1184 -0
- package/src/style/common.less +72 -0
- package/src/style/components/_ripple.less +60 -0
- package/src/style/components/_shrinkable-menu.less +46 -0
- package/src/style/components/_toolbar.less +96 -0
- package/src/style/components/index.less +3 -0
- package/src/style/components/rich-editor.less +6 -0
- package/src/style/index.less +10 -0
- package/src/style/theme.less +155 -0
- package/src/utils/color.js +46 -0
- package/src/utils/console.js +105 -0
- package/src/utils/load.js +79 -0
- package/src/utils/mask.js +139 -0
- package/src/utils/mixins.js +5 -0
- package/src/utils/validate.js +271 -0
@@ -0,0 +1,101 @@
|
|
1
|
+
<template>
|
2
|
+
<table cellspacing="0" cellpadding="0" border="0" :style="styleObject">
|
3
|
+
<colgroup>
|
4
|
+
<col v-for="(column, index) in columns" :width="setCellWidth(column)">
|
5
|
+
</colgroup>
|
6
|
+
<tbody :class="[prefixCls + '-tbody']">
|
7
|
+
<template v-for="(row, index) in data">
|
8
|
+
<table-tr
|
9
|
+
:row="row"
|
10
|
+
:key="row._rowKey"
|
11
|
+
:prefix-cls="prefixCls"
|
12
|
+
@mouseenter.native.stop="handleMouseIn(row._index)"
|
13
|
+
@mouseleave.native.stop="handleMouseOut(row._index)"
|
14
|
+
@click.native="clickCurrentRow(row._index)"
|
15
|
+
@dblclick.native.stop="dblclickCurrentRow(row._index)">
|
16
|
+
<td v-for="column in columns" :class="alignCls(column, row)">
|
17
|
+
<Cell
|
18
|
+
:fixed="fixed"
|
19
|
+
:prefix-cls="prefixCls"
|
20
|
+
:row="row"
|
21
|
+
:key="column._columnKey"
|
22
|
+
:column="column"
|
23
|
+
:natural-index="index"
|
24
|
+
:index="row._index"
|
25
|
+
:checked="rowChecked(row._index)"
|
26
|
+
:disabled="rowDisabled(row._index)"
|
27
|
+
:expanded="rowExpanded(row._index)"
|
28
|
+
></Cell>
|
29
|
+
</td>
|
30
|
+
</table-tr>
|
31
|
+
<tr v-if="rowExpanded(row._index)" :class="{[prefixCls + '-expanded-hidden']: fixed}">
|
32
|
+
<td :colspan="columns.length" :class="prefixCls + '-expanded-cell'">
|
33
|
+
<Expand :key="row._rowKey" :row="row" :render="expandRender" :index="row._index"></Expand>
|
34
|
+
</td>
|
35
|
+
</tr>
|
36
|
+
</template>
|
37
|
+
</tbody>
|
38
|
+
</table>
|
39
|
+
</template>
|
40
|
+
<script>
|
41
|
+
// todo :key="row"
|
42
|
+
import TableTr from './table-tr.vue';
|
43
|
+
import Cell from './cell.vue';
|
44
|
+
import Expand from './expand.js';
|
45
|
+
import Mixin from './mixin';
|
46
|
+
|
47
|
+
export default {
|
48
|
+
name: 'TableBody',
|
49
|
+
mixins: [ Mixin ],
|
50
|
+
components: { Cell, Expand, TableTr },
|
51
|
+
props: {
|
52
|
+
prefixCls: String,
|
53
|
+
styleObject: Object,
|
54
|
+
columns: Array,
|
55
|
+
data: Array, // rebuildData
|
56
|
+
objData: Object,
|
57
|
+
columnsWidth: Object,
|
58
|
+
fixed: {
|
59
|
+
type: [Boolean, String],
|
60
|
+
default: false
|
61
|
+
}
|
62
|
+
},
|
63
|
+
computed: {
|
64
|
+
expandRender () {
|
65
|
+
let render = function () {
|
66
|
+
return '';
|
67
|
+
};
|
68
|
+
for (let i = 0; i < this.columns.length; i++) {
|
69
|
+
const column = this.columns[i];
|
70
|
+
if (column.type && column.type === 'expand') {
|
71
|
+
if (column.render) render = column.render;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
return render;
|
75
|
+
}
|
76
|
+
},
|
77
|
+
methods: {
|
78
|
+
rowChecked (_index) {
|
79
|
+
return this.objData[_index] && this.objData[_index]._isChecked;
|
80
|
+
},
|
81
|
+
rowDisabled(_index){
|
82
|
+
return this.objData[_index] && this.objData[_index]._isDisabled;
|
83
|
+
},
|
84
|
+
rowExpanded(_index){
|
85
|
+
return this.objData[_index] && this.objData[_index]._isExpanded;
|
86
|
+
},
|
87
|
+
handleMouseIn (_index) {
|
88
|
+
this.$parent.handleMouseIn(_index);
|
89
|
+
},
|
90
|
+
handleMouseOut (_index) {
|
91
|
+
this.$parent.handleMouseOut(_index);
|
92
|
+
},
|
93
|
+
clickCurrentRow (_index) {
|
94
|
+
this.$parent.clickCurrentRow(_index);
|
95
|
+
},
|
96
|
+
dblclickCurrentRow (_index) {
|
97
|
+
this.$parent.dblclickCurrentRow(_index);
|
98
|
+
}
|
99
|
+
}
|
100
|
+
};
|
101
|
+
</script>
|
@@ -0,0 +1,311 @@
|
|
1
|
+
<template>
|
2
|
+
<table cellspacing="0" cellpadding="0" border="0" :style="styles">
|
3
|
+
<colgroup>
|
4
|
+
<col v-for="(column, index) in columns" :width="setCellWidth(column)">
|
5
|
+
<col v-if="$parent.showVerticalScrollBar" :width="$parent.scrollBarWidth"/>
|
6
|
+
</colgroup>
|
7
|
+
<thead>
|
8
|
+
<tr v-for="(cols, rowIndex) in headRows">
|
9
|
+
<th
|
10
|
+
@mouseup.stop="handleMouseUp($event)"
|
11
|
+
@mousemove.stop="handleMouseMove($event)"
|
12
|
+
@mousedown.stop="handleMouseDown($event, column)"
|
13
|
+
:style="cursorResize"
|
14
|
+
v-for="(column, index) in cols"
|
15
|
+
:colspan="column.colSpan"
|
16
|
+
:rowspan="column.rowSpan"
|
17
|
+
:class="alignCls(column)">
|
18
|
+
<div :class="cellClasses(column)">
|
19
|
+
<template v-if="column.type === 'expand'">
|
20
|
+
<span v-if="!column.renderHeader">{{ column.title || '' }}</span>
|
21
|
+
<render-header v-else :render="column.renderHeader" :column="column"
|
22
|
+
:index="index"></render-header>
|
23
|
+
</template>
|
24
|
+
<template v-else-if="column.type === 'selection'">
|
25
|
+
<Checkbox :value="isSelectAll" :disabled="!data.length" @on-change="selectAll"></Checkbox>
|
26
|
+
</template>
|
27
|
+
<template v-else>
|
28
|
+
<span v-if="!column.renderHeader" :class="{[prefixCls + '-cell-sort']: column.sortable}"
|
29
|
+
@click="handleSortByHead(getColumn(rowIndex, index)._index)">{{ column.title || '#' }}</span>
|
30
|
+
<render-header v-else :render="column.renderHeader" :column="column"
|
31
|
+
:index="index"></render-header>
|
32
|
+
<span :class="[prefixCls + '-sort']" v-if="column.sortable">
|
33
|
+
<i class="ivu-icon ivu-icon-arrow-up-b"
|
34
|
+
:class="{on: getColumn(rowIndex, index)._sortType === 'asc'}"
|
35
|
+
@click="handleSort(getColumn(rowIndex, index)._index, 'asc')"></i>
|
36
|
+
<i class="ivu-icon ivu-icon-arrow-down-b"
|
37
|
+
:class="{on: getColumn(rowIndex, index)._sortType === 'desc'}"
|
38
|
+
@click="handleSort(getColumn(rowIndex, index)._index, 'desc')"></i>
|
39
|
+
</span>
|
40
|
+
<Poptip
|
41
|
+
v-if="isPopperShow(column)"
|
42
|
+
v-model="getColumn(rowIndex, index)._filterVisible"
|
43
|
+
placement="bottom"
|
44
|
+
popper-class="ivu-table-popper"
|
45
|
+
transfer
|
46
|
+
@on-popper-hide="handleFilterHide(getColumn(rowIndex, index)._index)">
|
47
|
+
<span :class="[prefixCls + '-filter']">
|
48
|
+
<i class="ivu-icon ivu-icon-funnel"
|
49
|
+
:class="{on: getColumn(rowIndex, index)._isFiltered}"></i>
|
50
|
+
</span>
|
51
|
+
|
52
|
+
<div slot="content" :class="[prefixCls + '-filter-list']"
|
53
|
+
v-if="getColumn(rowIndex, index)._filterMultiple">
|
54
|
+
<div :class="[prefixCls + '-filter-list-item']">
|
55
|
+
<checkbox-group v-model="getColumn(rowIndex, index)._filterChecked">
|
56
|
+
<checkbox v-for="(item, index) in column.filters" :key="index"
|
57
|
+
:label="item.value">{{ item.label }}
|
58
|
+
</checkbox>
|
59
|
+
</checkbox-group>
|
60
|
+
</div>
|
61
|
+
<div :class="[prefixCls + '-filter-footer']">
|
62
|
+
<i-button type="text" size="small"
|
63
|
+
:disabled="!getColumn(rowIndex, index)._filterChecked.length"
|
64
|
+
@click.native="handleFilter(getColumn(rowIndex, index)._index)">{{
|
65
|
+
t('i.table.confirmFilter') }}
|
66
|
+
</i-button>
|
67
|
+
<i-button type="text" size="small"
|
68
|
+
@click.native="handleReset(getColumn(rowIndex, index)._index)">{{
|
69
|
+
t('i.table.resetFilter') }}
|
70
|
+
</i-button>
|
71
|
+
</div>
|
72
|
+
</div>
|
73
|
+
<div slot="content" :class="[prefixCls + '-filter-list']" v-else>
|
74
|
+
<ul :class="[prefixCls + '-filter-list-single']">
|
75
|
+
<li
|
76
|
+
:class="itemAllClasses(getColumn(rowIndex, index))"
|
77
|
+
@click="handleReset(getColumn(rowIndex, index)._index)">{{
|
78
|
+
t('i.table.clearFilter') }}
|
79
|
+
</li>
|
80
|
+
<li
|
81
|
+
:class="itemClasses(getColumn(rowIndex, index), item)"
|
82
|
+
v-for="item in column.filters"
|
83
|
+
@click="handleSelect(getColumn(rowIndex, index)._index, item.value)">{{
|
84
|
+
item.label }}
|
85
|
+
</li>
|
86
|
+
</ul>
|
87
|
+
</div>
|
88
|
+
</Poptip>
|
89
|
+
</template>
|
90
|
+
</div>
|
91
|
+
</th>
|
92
|
+
|
93
|
+
<th v-if="$parent.showVerticalScrollBar && rowIndex===0" :class='scrollBarCellClass()'
|
94
|
+
:rowspan="headRows.length"></th>
|
95
|
+
</tr>
|
96
|
+
</thead>
|
97
|
+
</table>
|
98
|
+
</template>
|
99
|
+
<script>
|
100
|
+
// import CheckboxGroup from '../checkbox/checkbox-group.vue';
|
101
|
+
// import Checkbox from '../checkbox/checkbox.vue';
|
102
|
+
// import Poptip from '../poptip/poptip.vue';
|
103
|
+
// import iButton from '../button/button.vue';
|
104
|
+
import iButton from 'iview/src/components/button/button';
|
105
|
+
import renderHeader from './header';
|
106
|
+
import Mixin from './mixin';
|
107
|
+
import Locale from 'iview/src/mixins/locale';
|
108
|
+
|
109
|
+
export default {
|
110
|
+
name: 'TableHead',
|
111
|
+
mixins: [Mixin, Locale],
|
112
|
+
// components: { CheckboxGroup, Checkbox, Poptip, iButton, renderHeader },
|
113
|
+
components: {iButton, renderHeader},
|
114
|
+
props: {
|
115
|
+
prefixCls: String,
|
116
|
+
styleObject: Object,
|
117
|
+
columns: Array,
|
118
|
+
objData: Object,
|
119
|
+
data: Array, // rebuildData
|
120
|
+
columnsWidth: Object,
|
121
|
+
fixed: {
|
122
|
+
type: [Boolean, String],
|
123
|
+
default: false
|
124
|
+
},
|
125
|
+
columnRows: Array,
|
126
|
+
fixedColumnRows: Array
|
127
|
+
},
|
128
|
+
computed: {
|
129
|
+
styles() {
|
130
|
+
const style = Object.assign({}, this.styleObject);
|
131
|
+
const width = parseInt(this.styleObject.width);
|
132
|
+
style.width = `${width}px`;
|
133
|
+
return style;
|
134
|
+
},
|
135
|
+
isSelectAll() {
|
136
|
+
let isSelectAll = true;
|
137
|
+
if (!this.data.length) isSelectAll = false;
|
138
|
+
if (!this.data.find(item => !item._disabled)) isSelectAll = false; // #1751
|
139
|
+
for (let i = 0; i < this.data.length; i++) {
|
140
|
+
if (!this.objData[this.data[i]._index]._isChecked && !this.objData[this.data[i]._index]._isDisabled) {
|
141
|
+
isSelectAll = false;
|
142
|
+
break;
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
return isSelectAll;
|
147
|
+
},
|
148
|
+
headRows() {
|
149
|
+
const isGroup = this.columnRows.length > 1;
|
150
|
+
if (isGroup) {
|
151
|
+
return this.fixed ? this.fixedColumnRows : this.columnRows;
|
152
|
+
} else {
|
153
|
+
return [this.columns];
|
154
|
+
}
|
155
|
+
}
|
156
|
+
},
|
157
|
+
data() {
|
158
|
+
return {
|
159
|
+
isDragging: false,
|
160
|
+
dragIndex: null,
|
161
|
+
dragX: 0,
|
162
|
+
dragWidth: 0,
|
163
|
+
cursorResize: false
|
164
|
+
}
|
165
|
+
},
|
166
|
+
mounted() {
|
167
|
+
document.onmouseup = (e, val) => {
|
168
|
+
if (this.isDragging) {
|
169
|
+
this.handleMouseUp(e)
|
170
|
+
}
|
171
|
+
}
|
172
|
+
},
|
173
|
+
methods: {
|
174
|
+
handleMouseUp(e) {
|
175
|
+
this.isDragging = false;
|
176
|
+
let offset = e.clientX - this.dragX;
|
177
|
+
let columnWidth = this.columnsWidth[this.dragIndex].width;
|
178
|
+
let width = columnWidth + offset;
|
179
|
+
width = width <= 60 ? 60 : width;
|
180
|
+
this.dragWidth = width;
|
181
|
+
|
182
|
+
this.columnsWidth[this.dragIndex].width = this.dragWidth;
|
183
|
+
this.columns[this.dragIndex].width = this.dragWidth;
|
184
|
+
this.columns[this.dragIndex]._width = this.dragWidth;
|
185
|
+
this.$emit('on-drag-up', e.clientX)
|
186
|
+
},
|
187
|
+
handleMouseMove(e) {
|
188
|
+
let rect = e.target.getBoundingClientRect()
|
189
|
+
if (e.clientX - rect.left < 10) {
|
190
|
+
this.cursorResize = "cursor:col-resize";
|
191
|
+
}
|
192
|
+
if (this.isDragging) {
|
193
|
+
|
194
|
+
let left = document.getElementsByClassName('ivu-table-header')[0].getBoundingClientRect().left;
|
195
|
+
let offset = e.clientX - left;
|
196
|
+
this.$emit('on-drag-move', offset)
|
197
|
+
}
|
198
|
+
},
|
199
|
+
handleMouseDown(e, val) {
|
200
|
+
this.isDragging = true;
|
201
|
+
this.dragIndex = val._index;
|
202
|
+
this.dragX = e.clientX;
|
203
|
+
let left = document.getElementsByClassName('ivu-table-header')[0].getBoundingClientRect().left;
|
204
|
+
this.$emit('on-drag-down', e.clientX - left)
|
205
|
+
},
|
206
|
+
cellClasses(column) {
|
207
|
+
return [
|
208
|
+
`${this.prefixCls}-cell`,
|
209
|
+
{
|
210
|
+
[`${this.prefixCls}-hidden`]: !this.fixed && column.fixed && (column.fixed === 'left' || column.fixed === 'right')
|
211
|
+
}
|
212
|
+
];
|
213
|
+
},
|
214
|
+
scrollBarCellClass() {
|
215
|
+
let hasRightFixed = false;
|
216
|
+
for (let i in this.headRows) {
|
217
|
+
for (let j in this.headRows[i]) {
|
218
|
+
if (this.headRows[i][j].fixed === 'right') {
|
219
|
+
hasRightFixed = true;
|
220
|
+
break;
|
221
|
+
}
|
222
|
+
if (hasRightFixed) break;
|
223
|
+
}
|
224
|
+
}
|
225
|
+
return [
|
226
|
+
{
|
227
|
+
[`${this.prefixCls}-hidden`]: hasRightFixed
|
228
|
+
}
|
229
|
+
];
|
230
|
+
},
|
231
|
+
itemClasses(column, item) {
|
232
|
+
return [
|
233
|
+
`${this.prefixCls}-filter-select-item`,
|
234
|
+
{
|
235
|
+
[`${this.prefixCls}-filter-select-item-selected`]: column._filterChecked[0] === item.value
|
236
|
+
}
|
237
|
+
];
|
238
|
+
},
|
239
|
+
itemAllClasses(column) {
|
240
|
+
return [
|
241
|
+
`${this.prefixCls}-filter-select-item`,
|
242
|
+
{
|
243
|
+
[`${this.prefixCls}-filter-select-item-selected`]: !column._filterChecked.length
|
244
|
+
}
|
245
|
+
];
|
246
|
+
},
|
247
|
+
selectAll() {
|
248
|
+
const status = !this.isSelectAll;
|
249
|
+
this.$parent.selectAll(status);
|
250
|
+
},
|
251
|
+
handleSort(index, type) {
|
252
|
+
const column = this.columns[index];
|
253
|
+
const _index = column._index;
|
254
|
+
|
255
|
+
if (column._sortType === type) {
|
256
|
+
type = 'normal';
|
257
|
+
}
|
258
|
+
this.$parent.handleSort(_index, type);
|
259
|
+
},
|
260
|
+
handleSortByHead(index) {
|
261
|
+
const column = this.columns[index];
|
262
|
+
if (column.sortable) {
|
263
|
+
const type = column._sortType;
|
264
|
+
if (type === 'normal') {
|
265
|
+
this.handleSort(index, 'asc');
|
266
|
+
} else if (type === 'asc') {
|
267
|
+
this.handleSort(index, 'desc');
|
268
|
+
} else {
|
269
|
+
this.handleSort(index, 'normal');
|
270
|
+
}
|
271
|
+
}
|
272
|
+
},
|
273
|
+
handleFilter(index) {
|
274
|
+
this.$parent.handleFilter(index);
|
275
|
+
},
|
276
|
+
handleSelect(index, value) {
|
277
|
+
this.$parent.handleFilterSelect(index, value);
|
278
|
+
},
|
279
|
+
handleReset(index) {
|
280
|
+
this.$parent.handleFilterReset(index);
|
281
|
+
},
|
282
|
+
handleFilterHide(index) {
|
283
|
+
this.$parent.handleFilterHide(index);
|
284
|
+
},
|
285
|
+
// 因为表头嵌套不是深拷贝,所以没有 _ 开头的方法,在 isGroup 下用此列
|
286
|
+
getColumn(rowIndex, index) {
|
287
|
+
const isGroup = this.columnRows.length > 1;
|
288
|
+
|
289
|
+
if (isGroup) {
|
290
|
+
const id = this.headRows[rowIndex][index].__id;
|
291
|
+
return this.columns.filter(item => item.__id === id)[0];
|
292
|
+
} else {
|
293
|
+
return this.headRows[rowIndex][index];
|
294
|
+
}
|
295
|
+
}
|
296
|
+
}
|
297
|
+
};
|
298
|
+
</script>
|
299
|
+
|
300
|
+
<style>
|
301
|
+
.no-selected {
|
302
|
+
-webkit-user-select: none; /*Chrome/ Safari/ Opear新版本*/
|
303
|
+
-moz-user-select: none; /*Foxfire */
|
304
|
+
-ms-user-select: none; /*Internet Explorer/ Edge*/
|
305
|
+
-o-user-select: none; /*Opear老版本*/
|
306
|
+
-khtml-user-select: none; /* Konqueror */
|
307
|
+
-webkit-touch-callout: none; /* iOS Safari */
|
308
|
+
user-select: none;
|
309
|
+
/* Nonprefixed version, currently not supported by any browser */
|
310
|
+
}
|
311
|
+
</style>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<template>
|
2
|
+
<tr :class="rowClasses(row._index)"><slot></slot></tr>
|
3
|
+
</template>
|
4
|
+
<script>
|
5
|
+
export default {
|
6
|
+
props: {
|
7
|
+
row: Object,
|
8
|
+
prefixCls: String
|
9
|
+
},
|
10
|
+
computed: {
|
11
|
+
objData () {
|
12
|
+
return this.$parent.objData;
|
13
|
+
}
|
14
|
+
},
|
15
|
+
methods: {
|
16
|
+
rowClasses (_index) {
|
17
|
+
return [
|
18
|
+
`${this.prefixCls}-row`,
|
19
|
+
this.rowClsName(_index),
|
20
|
+
{
|
21
|
+
[`${this.prefixCls}-row-highlight`]: this.objData[_index] && this.objData[_index]._isHighlight,
|
22
|
+
[`${this.prefixCls}-row-hover`]: this.objData[_index] && this.objData[_index]._isHover
|
23
|
+
}
|
24
|
+
];
|
25
|
+
},
|
26
|
+
rowClsName (_index) {
|
27
|
+
return this.$parent.$parent.rowClassName(this.objData[_index], _index);
|
28
|
+
},
|
29
|
+
}
|
30
|
+
};
|
31
|
+
</script>
|