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,81 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="drop-down-cell display-flex justify-content-space-around">
|
3
|
+
<Dropdown trigger="click" @on-click="onClickItem">
|
4
|
+
<div>
|
5
|
+
<!--{{ items[cell.row[cell.column.key]] }}-->
|
6
|
+
<!-- <template v-if="mapItems">
|
7
|
+
{{ mapItems[cell.row[cell.column.key]] }}
|
8
|
+
</template>
|
9
|
+
<template v-else>
|
10
|
+
{{ cell.row[cell.column.key] }}
|
11
|
+
</template>-->
|
12
|
+
{{ mapItems[cell.row[cell.column.key]] }}
|
13
|
+
<md-icon type="baseline-arrow_drop_down" v-show="editable"></md-icon>
|
14
|
+
</div>
|
15
|
+
<DropdownMenu slot="list" v-show="editable">
|
16
|
+
<template v-if="mapItems">
|
17
|
+
<DropdownItem v-for="(item, key) in keys" :key="key" :name="item">{{ mapItems[item] }}</DropdownItem>
|
18
|
+
</template>
|
19
|
+
<!--<template v-else>-->
|
20
|
+
<!--<DropdownItem v-for="(item, key) in cell.column.dropdownList" :key="key" :name="item">{{ item }}</DropdownItem>-->
|
21
|
+
<!--</template>-->
|
22
|
+
</DropdownMenu>
|
23
|
+
</Dropdown>
|
24
|
+
</div>
|
25
|
+
</template>
|
26
|
+
|
27
|
+
<script>
|
28
|
+
export default {
|
29
|
+
name: "drop-down-cell",
|
30
|
+
model: {
|
31
|
+
prop: "cell"
|
32
|
+
},
|
33
|
+
props: {
|
34
|
+
mapItems: Object,
|
35
|
+
cell: Object,
|
36
|
+
editable: {
|
37
|
+
type: Boolean,
|
38
|
+
default: false
|
39
|
+
}
|
40
|
+
},
|
41
|
+
computed: {
|
42
|
+
keys() {
|
43
|
+
return Object.keys(this.mapItems);
|
44
|
+
}
|
45
|
+
},
|
46
|
+
watch: {
|
47
|
+
editable(to) {
|
48
|
+
console.log(to);
|
49
|
+
},
|
50
|
+
mapItems(to) {}
|
51
|
+
},
|
52
|
+
created() {
|
53
|
+
// console.log(this.mapItems, this.cell.row[this.cell.column.key]);
|
54
|
+
},
|
55
|
+
data() {
|
56
|
+
return {};
|
57
|
+
},
|
58
|
+
methods: {
|
59
|
+
onClickItem(val) {
|
60
|
+
this.$nextTick(() => {
|
61
|
+
this.cell["row"][this.cell["column"]["key"]] = val;
|
62
|
+
console.log("dropdown cell", this.cell);
|
63
|
+
this.$emit("on-change", this.cell);
|
64
|
+
});
|
65
|
+
}
|
66
|
+
}
|
67
|
+
};
|
68
|
+
</script>
|
69
|
+
<style>
|
70
|
+
.ivu-select-dropdown {
|
71
|
+
border-radius: 0;
|
72
|
+
max-height: 200px !important;
|
73
|
+
overflow: auto !important;
|
74
|
+
}
|
75
|
+
</style>
|
76
|
+
|
77
|
+
<style lang="less" scoped>
|
78
|
+
.drop-down-cell {
|
79
|
+
cursor: pointer;
|
80
|
+
}
|
81
|
+
</style>
|
@@ -0,0 +1,143 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="table-expand">
|
3
|
+
<!--<Table :columns="col"-->
|
4
|
+
<!--:data="row"-->
|
5
|
+
<!--:show-header="false"-->
|
6
|
+
<!--@on-row-click="memberTrclick"-->
|
7
|
+
<!--ref="selection"-->
|
8
|
+
<!-->-->
|
9
|
+
<!--</Table>-->
|
10
|
+
<can-edit-table
|
11
|
+
refs="tableCustom"
|
12
|
+
:border="false"
|
13
|
+
:columns-list="col"
|
14
|
+
@on-change="onChangeTable"
|
15
|
+
@on-selection-change ="onSelectionChangeTable"
|
16
|
+
ref="selection"
|
17
|
+
@on-delete="onDelete"
|
18
|
+
@on-change-input="onChangeInput"
|
19
|
+
v-on="$listeners"
|
20
|
+
v-model="cloneRow"></can-edit-table>
|
21
|
+
|
22
|
+
|
23
|
+
<!-- <md-table-draggable
|
24
|
+
v-model="row"
|
25
|
+
:columns-list="col"
|
26
|
+
:show-header="false"
|
27
|
+
@on-start="handleOnstart1"
|
28
|
+
@on-end="handleOnend1"
|
29
|
+
ref="selection"
|
30
|
+
></md-table-draggable>-->
|
31
|
+
|
32
|
+
</div>
|
33
|
+
|
34
|
+
</template>
|
35
|
+
|
36
|
+
<script>
|
37
|
+
import CanEditTable from './can-edit'
|
38
|
+
|
39
|
+
export default {
|
40
|
+
name: "editable-expand",
|
41
|
+
props:{
|
42
|
+
row:Array,
|
43
|
+
col:Array,
|
44
|
+
isSelectedAll:Boolean
|
45
|
+
},
|
46
|
+
components:{
|
47
|
+
CanEditTable
|
48
|
+
},
|
49
|
+
watch:{
|
50
|
+
row:{
|
51
|
+
immediate:true,
|
52
|
+
handler(to) {
|
53
|
+
this.cloneRow = JSON.parse(JSON.stringify(to));
|
54
|
+
}
|
55
|
+
},
|
56
|
+
isSelectedAll:{
|
57
|
+
immediate:true,
|
58
|
+
handler(to) {
|
59
|
+
/*this.$nextTick(()=>{
|
60
|
+
setTimeout(()=>{
|
61
|
+
this.$refs.selection.selectAll(to);
|
62
|
+
})
|
63
|
+
})*/
|
64
|
+
}
|
65
|
+
}
|
66
|
+
/* "$refs.selection":{
|
67
|
+
immediate:true,
|
68
|
+
handler(to) {
|
69
|
+
console.log("$refs.selection",to);
|
70
|
+
to && this.$refs.selection.selectAll(this.isSelectedAll);
|
71
|
+
}
|
72
|
+
}*/
|
73
|
+
},
|
74
|
+
data(){
|
75
|
+
return{
|
76
|
+
//行数据
|
77
|
+
trRow: '',
|
78
|
+
cloneRow:{}
|
79
|
+
}
|
80
|
+
},
|
81
|
+
created() {
|
82
|
+
// this.cloneRow = JSON.parse(JSON.stringify(this.row));
|
83
|
+
},
|
84
|
+
mounted() {
|
85
|
+
/* this.$nextTick(()=>{
|
86
|
+
this.$refs.selection.selectAll(this.isSelectedAll);
|
87
|
+
})*/
|
88
|
+
},
|
89
|
+
methods:{
|
90
|
+
onDelete(val, index, currentRow) {
|
91
|
+
this.$emit('on-delete-expand-table', val, index, currentRow)
|
92
|
+
},
|
93
|
+
onSelectionChangeTable(selection) {
|
94
|
+
this.$emit('on-selection-change-expand-table', selection)
|
95
|
+
},
|
96
|
+
onChangeTable(data, index, currentRow) {
|
97
|
+
// console.log("<<<<<<,onChangeTable")
|
98
|
+
this.$emit('on-change-expand-table', data, index, currentRow);
|
99
|
+
},
|
100
|
+
handleOnend1() {
|
101
|
+
|
102
|
+
},
|
103
|
+
memberTrclick(row){
|
104
|
+
this.trRow = row;
|
105
|
+
window.getApp.$emit('APP_EXPAND_MODIFY',this.trRow);
|
106
|
+
},
|
107
|
+
onChangeInput(row, index, key) {
|
108
|
+
this.$emit('on-change-input', row , index, key)
|
109
|
+
},
|
110
|
+
}
|
111
|
+
}
|
112
|
+
</script>
|
113
|
+
|
114
|
+
<style lang="less">
|
115
|
+
.ivu-table td, .ivu-table th {
|
116
|
+
height: 36px !important;
|
117
|
+
}
|
118
|
+
|
119
|
+
</style>
|
120
|
+
|
121
|
+
<style lang="less">
|
122
|
+
td.ivu-table-expanded-cell {
|
123
|
+
padding: 0 !important;
|
124
|
+
background: white;
|
125
|
+
|
126
|
+
}
|
127
|
+
.table-expand {
|
128
|
+
|
129
|
+
|
130
|
+
.ivu-table-wrapper {
|
131
|
+
border: 0;
|
132
|
+
.ivu-table-header {
|
133
|
+
display: none;
|
134
|
+
}
|
135
|
+
}
|
136
|
+
.ivu-table-row {
|
137
|
+
td{
|
138
|
+
/*padding-left: 36px;*/
|
139
|
+
}
|
140
|
+
}
|
141
|
+
}
|
142
|
+
|
143
|
+
</style>
|
@@ -0,0 +1,97 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="table-expand">
|
3
|
+
<!--<Table :columns="col"-->
|
4
|
+
<!--:data="row"-->
|
5
|
+
<!--:show-header="false"-->
|
6
|
+
<!--@on-row-click="memberTrclick"-->
|
7
|
+
<!--ref="selection"-->
|
8
|
+
<!-->-->
|
9
|
+
<!--</Table>-->
|
10
|
+
<md-table-draggable
|
11
|
+
v-model="row"
|
12
|
+
:columns-list="col"
|
13
|
+
:show-header="false"
|
14
|
+
@on-start="handleOnstart1"
|
15
|
+
@on-end="handleOnend1"
|
16
|
+
ref="selection"
|
17
|
+
:row-class-name="rowClassName"
|
18
|
+
></md-table-draggable>
|
19
|
+
</div>
|
20
|
+
</template>
|
21
|
+
|
22
|
+
<script>
|
23
|
+
import MdTableDraggable from "@/components/md-table/draggable";
|
24
|
+
export default {
|
25
|
+
name: "table-expand",
|
26
|
+
props: {
|
27
|
+
row: Array,
|
28
|
+
col: Array,
|
29
|
+
isSelectedAll: Boolean
|
30
|
+
},
|
31
|
+
components: {
|
32
|
+
MdTableDraggable
|
33
|
+
},
|
34
|
+
watch: {
|
35
|
+
isSelectedAll(to, from) {
|
36
|
+
this.$refs.selection.selectAll(to);
|
37
|
+
}
|
38
|
+
},
|
39
|
+
data() {
|
40
|
+
return {
|
41
|
+
//行数据
|
42
|
+
trRow: ""
|
43
|
+
};
|
44
|
+
},
|
45
|
+
mounted() {
|
46
|
+
this.$nextTick(() => {
|
47
|
+
this.$refs.selection.selectAll(this.isSelectedAll);
|
48
|
+
});
|
49
|
+
},
|
50
|
+
methods: {
|
51
|
+
rowClassName(row, index) {
|
52
|
+
console.log(".>>>>", row.name, row.childList);
|
53
|
+
|
54
|
+
if (!row.childList) {
|
55
|
+
return "display-none-expand";
|
56
|
+
}
|
57
|
+
},
|
58
|
+
handleOnstart1() {},
|
59
|
+
handleOnend1() {},
|
60
|
+
memberTrclick(row) {
|
61
|
+
this.trRow = row;
|
62
|
+
window.getApp.$emit("APP_EXPAND_MODIFY", this.trRow);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
};
|
66
|
+
</script>
|
67
|
+
|
68
|
+
<style lang="less">
|
69
|
+
.ivu-table .display-none-expand .ivu-table-cell-expand {
|
70
|
+
display: none;
|
71
|
+
}
|
72
|
+
|
73
|
+
.ivu-table td,
|
74
|
+
.ivu-table th {
|
75
|
+
height: 36px !important;
|
76
|
+
}
|
77
|
+
</style>
|
78
|
+
|
79
|
+
<style lang="less">
|
80
|
+
td.ivu-table-expanded-cell {
|
81
|
+
padding: 0 !important;
|
82
|
+
background: white;
|
83
|
+
}
|
84
|
+
.table-expand {
|
85
|
+
.ivu-table-wrapper {
|
86
|
+
border: 0;
|
87
|
+
.ivu-table-header {
|
88
|
+
display: none;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
.ivu-table-row {
|
92
|
+
td {
|
93
|
+
/*padding-left: 36px;*/
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
</style>
|
@@ -0,0 +1,53 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<i-table v-bind="$attrs" v-on="$listeners">
|
4
|
+
<!-- <template slot="header">
|
5
|
+
<md-filter-bar :columns="columnsList" @on-change="$emit('on-filter-change')" style="border: 0;width: 100%"></md-filter-bar>
|
6
|
+
</template>-->
|
7
|
+
</i-table>
|
8
|
+
<Page :total="totalSize"
|
9
|
+
size="small"
|
10
|
+
show-total
|
11
|
+
show-elevator
|
12
|
+
show-sizer
|
13
|
+
v-if="paging"
|
14
|
+
class="table-page"
|
15
|
+
@on-change="$emit('on-page-change')"
|
16
|
+
@on-page-size-change="$emit('on-page-size-change')" style="margin-top: 20px;text-align: right;z-index: 1005;"></Page>
|
17
|
+
</div>
|
18
|
+
</template>
|
19
|
+
|
20
|
+
<script>
|
21
|
+
// import MdFilterBar from '../md-filter-bar/index'
|
22
|
+
import iTable from './iview-table/table'
|
23
|
+
|
24
|
+
export default {
|
25
|
+
name:'md-table',
|
26
|
+
props:{
|
27
|
+
totalSize:{
|
28
|
+
type:Number,
|
29
|
+
default:0
|
30
|
+
},
|
31
|
+
columnsList: Array,
|
32
|
+
paging:{
|
33
|
+
type:Boolean,
|
34
|
+
default:false,
|
35
|
+
}
|
36
|
+
},
|
37
|
+
computed:{
|
38
|
+
},
|
39
|
+
components:{
|
40
|
+
// MdFilterBar,
|
41
|
+
iTable
|
42
|
+
},
|
43
|
+
data () {
|
44
|
+
return {
|
45
|
+
};
|
46
|
+
},
|
47
|
+
created() {
|
48
|
+
},
|
49
|
+
methods:{
|
50
|
+
}
|
51
|
+
|
52
|
+
};
|
53
|
+
</script>
|
@@ -0,0 +1,99 @@
|
|
1
|
+
<template>
|
2
|
+
<div :class="classes" ref="cell">
|
3
|
+
<template v-if="renderType === 'index'"><span>{{naturalIndex + 1}}</span></template>
|
4
|
+
<template v-if="renderType === 'selection'">
|
5
|
+
<Checkbox :value="checked" @click.native.stop="handleClick" @on-change="toggleSelect" :disabled="disabled"></Checkbox>
|
6
|
+
</template>
|
7
|
+
<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 === 'expand' && !row._disableExpand">
|
10
|
+
<div :class="expandCls" @click="toggleExpand">
|
11
|
+
<Icon type="ios-arrow-right"></Icon>
|
12
|
+
</div>
|
13
|
+
</template>
|
14
|
+
<Cell
|
15
|
+
v-if="renderType === 'render'"
|
16
|
+
:row="row"
|
17
|
+
:column="column"
|
18
|
+
:index="index"
|
19
|
+
:render="column.render"></Cell>
|
20
|
+
</div>
|
21
|
+
</template>
|
22
|
+
<script>
|
23
|
+
import Cell from './expand';
|
24
|
+
// import Icon from '../icon/icon.vue';
|
25
|
+
// import Checkbox from '../checkbox/checkbox.vue';
|
26
|
+
|
27
|
+
export default {
|
28
|
+
name: 'TableCell',
|
29
|
+
// components: { Icon, Checkbox, Cell },
|
30
|
+
components: { Cell },
|
31
|
+
props: {
|
32
|
+
prefixCls: String,
|
33
|
+
row: Object,
|
34
|
+
column: Object,
|
35
|
+
naturalIndex: Number, // index of rebuildData
|
36
|
+
index: Number, // _index of data
|
37
|
+
checked: Boolean,
|
38
|
+
disabled: Boolean,
|
39
|
+
expanded: Boolean,
|
40
|
+
fixed: {
|
41
|
+
type: [Boolean, String],
|
42
|
+
default: false
|
43
|
+
}
|
44
|
+
},
|
45
|
+
data () {
|
46
|
+
return {
|
47
|
+
renderType: '',
|
48
|
+
uid: -1,
|
49
|
+
context: this.$parent.$parent.$parent.currentContext
|
50
|
+
};
|
51
|
+
},
|
52
|
+
computed: {
|
53
|
+
classes () {
|
54
|
+
return [
|
55
|
+
`${this.prefixCls}-cell`,
|
56
|
+
{
|
57
|
+
[`${this.prefixCls}-hidden`]: !this.fixed && this.column.fixed && (this.column.fixed === 'left' || this.column.fixed === 'right'),
|
58
|
+
[`${this.prefixCls}-cell-ellipsis`]: this.column.ellipsis || false,
|
59
|
+
[`${this.prefixCls}-cell-with-expand`]: this.renderType === 'expand'
|
60
|
+
}
|
61
|
+
];
|
62
|
+
},
|
63
|
+
expandCls () {
|
64
|
+
return [
|
65
|
+
`${this.prefixCls}-cell-expand`,
|
66
|
+
{
|
67
|
+
[`${this.prefixCls}-cell-expand-expanded`]: this.expanded
|
68
|
+
}
|
69
|
+
];
|
70
|
+
}
|
71
|
+
},
|
72
|
+
methods: {
|
73
|
+
toggleSelect () {
|
74
|
+
this.$parent.$parent.$parent.toggleSelect(this.index);
|
75
|
+
},
|
76
|
+
toggleExpand () {
|
77
|
+
this.$parent.$parent.$parent.toggleExpand(this.index);
|
78
|
+
},
|
79
|
+
handleClick () {
|
80
|
+
// 放置 Checkbox 冒泡
|
81
|
+
}
|
82
|
+
},
|
83
|
+
created () {
|
84
|
+
if (this.column.type === 'index') {
|
85
|
+
this.renderType = 'index';
|
86
|
+
} else if (this.column.type === 'selection') {
|
87
|
+
this.renderType = 'selection';
|
88
|
+
} else if (this.column.type === 'html') {
|
89
|
+
this.renderType = 'html';
|
90
|
+
} else if (this.column.type === 'expand') {
|
91
|
+
this.renderType = 'expand';
|
92
|
+
} else if (this.column.render) {
|
93
|
+
this.renderType = 'render';
|
94
|
+
} else {
|
95
|
+
this.renderType = 'normal';
|
96
|
+
}
|
97
|
+
}
|
98
|
+
};
|
99
|
+
</script>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
export default {
|
2
|
+
name: 'TableExpand',
|
3
|
+
functional: true,
|
4
|
+
props: {
|
5
|
+
row: Object,
|
6
|
+
render: Function,
|
7
|
+
index: Number,
|
8
|
+
column: {
|
9
|
+
type: Object,
|
10
|
+
default: null
|
11
|
+
}
|
12
|
+
},
|
13
|
+
render: (h, ctx) => {
|
14
|
+
const params = {
|
15
|
+
row: ctx.props.row,
|
16
|
+
index: ctx.props.index
|
17
|
+
};
|
18
|
+
if (ctx.props.column) params.column = ctx.props.column;
|
19
|
+
return ctx.props.render(h, params);
|
20
|
+
}
|
21
|
+
};
|
@@ -0,0 +1,76 @@
|
|
1
|
+
function has (browser) {
|
2
|
+
const ua = navigator.userAgent;
|
3
|
+
if (browser === 'ie') {
|
4
|
+
const isIE = ua.indexOf('compatible') > -1 && ua.indexOf('MSIE') > -1;
|
5
|
+
if (isIE) {
|
6
|
+
const reIE = new RegExp('MSIE (\\d+\\.\\d+);');
|
7
|
+
reIE.test(ua);
|
8
|
+
return parseFloat(RegExp['$1']);
|
9
|
+
} else {
|
10
|
+
return false;
|
11
|
+
}
|
12
|
+
} else {
|
13
|
+
return ua.indexOf(browser) > -1;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
const csv = {
|
18
|
+
_isIE11 () {
|
19
|
+
let iev = 0;
|
20
|
+
const ieold = (/MSIE (\d+\.\d+);/.test(navigator.userAgent));
|
21
|
+
const trident = !!navigator.userAgent.match(/Trident\/7.0/);
|
22
|
+
const rv = navigator.userAgent.indexOf('rv:11.0');
|
23
|
+
|
24
|
+
if (ieold) {
|
25
|
+
iev = Number(RegExp.$1);
|
26
|
+
}
|
27
|
+
if (navigator.appVersion.indexOf('MSIE 10') !== -1) {
|
28
|
+
iev = 10;
|
29
|
+
}
|
30
|
+
if (trident && rv !== -1) {
|
31
|
+
iev = 11;
|
32
|
+
}
|
33
|
+
|
34
|
+
return iev === 11;
|
35
|
+
},
|
36
|
+
|
37
|
+
_isEdge () {
|
38
|
+
return /Edge/.test(navigator.userAgent);
|
39
|
+
},
|
40
|
+
|
41
|
+
_getDownloadUrl (text) {
|
42
|
+
const BOM = '\uFEFF';
|
43
|
+
// Add BOM to text for open in excel correctly
|
44
|
+
if (window.Blob && window.URL && window.URL.createObjectURL) {
|
45
|
+
const csvData = new Blob([BOM + text], { type: 'text/csv' });
|
46
|
+
return URL.createObjectURL(csvData);
|
47
|
+
} else {
|
48
|
+
return 'data:attachment/csv;charset=utf-8,' + BOM + encodeURIComponent(text);
|
49
|
+
}
|
50
|
+
},
|
51
|
+
|
52
|
+
download (filename, text) {
|
53
|
+
if (has('ie') && has('ie') < 10) {
|
54
|
+
// has module unable identify ie11 and Edge
|
55
|
+
const oWin = window.top.open('about:blank', '_blank');
|
56
|
+
oWin.document.charset = 'utf-8';
|
57
|
+
oWin.document.write(text);
|
58
|
+
oWin.document.close();
|
59
|
+
oWin.document.execCommand('SaveAs', filename);
|
60
|
+
oWin.close();
|
61
|
+
} else if (has('ie') === 10 || this._isIE11() || this._isEdge()) {
|
62
|
+
const BOM = '\uFEFF';
|
63
|
+
const csvData = new Blob([BOM + text], { type: 'text/csv' });
|
64
|
+
navigator.msSaveBlob(csvData, filename);
|
65
|
+
} else {
|
66
|
+
const link = document.createElement('a');
|
67
|
+
link.download = filename;
|
68
|
+
link.href = this._getDownloadUrl(text);
|
69
|
+
document.body.appendChild(link);
|
70
|
+
link.click();
|
71
|
+
document.body.removeChild(link);
|
72
|
+
}
|
73
|
+
}
|
74
|
+
};
|
75
|
+
|
76
|
+
export default csv;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export default {
|
2
|
+
name: 'TableRenderHeader',
|
3
|
+
functional: true,
|
4
|
+
props: {
|
5
|
+
render: Function,
|
6
|
+
column: Object,
|
7
|
+
index: Number
|
8
|
+
},
|
9
|
+
render: (h, ctx) => {
|
10
|
+
const params = {
|
11
|
+
column: ctx.props.column,
|
12
|
+
index: ctx.props.index
|
13
|
+
};
|
14
|
+
return ctx.props.render(h, params);
|
15
|
+
}
|
16
|
+
};
|
@@ -0,0 +1,31 @@
|
|
1
|
+
export default {
|
2
|
+
methods: {
|
3
|
+
alignCls (column, row = {}) {
|
4
|
+
let cellClassName = '';
|
5
|
+
if (row.cellClassName && column.key && row.cellClassName[column.key]) {
|
6
|
+
cellClassName = row.cellClassName[column.key];
|
7
|
+
}
|
8
|
+
return [
|
9
|
+
{
|
10
|
+
[`${cellClassName}`]: cellClassName, // cell className
|
11
|
+
[`${column.className}`]: column.className, // column className
|
12
|
+
[`${this.prefixCls}-column-${column.align}`]: column.align,
|
13
|
+
[`${this.prefixCls}-hidden`]: (this.fixed === 'left' && column.fixed !== 'left') || (this.fixed === 'right' && column.fixed !== 'right') || (!this.fixed && column.fixed && (column.fixed === 'left' || column.fixed === 'right'))
|
14
|
+
}
|
15
|
+
];
|
16
|
+
},
|
17
|
+
isPopperShow (column) {
|
18
|
+
return column.filters && ((!this.fixed && !column.fixed) || (this.fixed === 'left' && column.fixed === 'left') || (this.fixed === 'right' && column.fixed === 'right'));
|
19
|
+
},
|
20
|
+
setCellWidth (column) {
|
21
|
+
let width = '';
|
22
|
+
if (column.width) {
|
23
|
+
width = column.width;
|
24
|
+
} else if (this.columnsWidth[column._index]) {
|
25
|
+
width = this.columnsWidth[column._index].width;
|
26
|
+
}
|
27
|
+
if (width === '0') width = '';
|
28
|
+
return width;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
};
|