zartui 2.0.80 → 2.0.82
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.
- package/es/dropdown-item/index.js +22 -2
- package/es/index.js +4 -3
- package/es/style/var.less +6 -1
- package/es/table/index.css +1 -1
- package/es/table/index.js +171 -232
- package/es/table/index.less +116 -55
- package/es/table/style/index.js +8 -0
- package/es/table/style/less.js +8 -0
- package/es/table/type.js +6 -0
- package/es/text-ellipsis/index.css +1 -0
- package/es/text-ellipsis/index.js +213 -0
- package/es/text-ellipsis/index.less +13 -0
- package/es/text-ellipsis/style/index.js +9 -0
- package/es/text-ellipsis/style/less.js +9 -0
- package/lib/dropdown-item/index.js +22 -1
- package/lib/index.css +1 -1
- package/lib/index.js +6 -2
- package/lib/index.less +3 -2
- package/lib/style/var.less +6 -1
- package/lib/table/index.css +1 -1
- package/lib/table/index.js +175 -232
- package/lib/table/index.less +116 -55
- package/lib/table/style/index.js +8 -0
- package/lib/table/style/less.js +8 -0
- package/lib/table/type.js +11 -0
- package/lib/text-ellipsis/index.css +1 -0
- package/lib/text-ellipsis/index.js +223 -0
- package/lib/text-ellipsis/index.less +13 -0
- package/lib/text-ellipsis/style/index.js +9 -0
- package/lib/text-ellipsis/style/less.js +9 -0
- package/lib/zart.js +407 -225
- package/lib/zart.min.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Utils
|
|
2
2
|
import { createNamespace } from '../utils';
|
|
3
|
-
import { off, on } from '../utils/dom/event';
|
|
3
|
+
import { off, on } from '../utils/dom/event';
|
|
4
|
+
import { deepClone } from '../utils/deep-clone'; // Mixins
|
|
4
5
|
|
|
5
6
|
import { PortalMixin } from '../mixins/portal';
|
|
6
7
|
import { ChildrenMixin } from '../mixins/relation'; // Components
|
|
@@ -21,6 +22,7 @@ export default createComponent({
|
|
|
21
22
|
}), ChildrenMixin('ztDropdownMenu')],
|
|
22
23
|
props: {
|
|
23
24
|
value: null,
|
|
25
|
+
resetDefaultValue: null,
|
|
24
26
|
title: String,
|
|
25
27
|
disabled: Boolean,
|
|
26
28
|
titleClass: String,
|
|
@@ -144,11 +146,17 @@ export default createComponent({
|
|
|
144
146
|
}
|
|
145
147
|
},
|
|
146
148
|
select: function select(value) {
|
|
149
|
+
// 标识是否是取消选中这一元素
|
|
150
|
+
var isCancelSelect = true;
|
|
151
|
+
|
|
147
152
|
if (this.innerValue.indexOf(value) >= 0) {
|
|
148
153
|
this.innerValue.splice(this.innerValue.indexOf(value), 1);
|
|
149
154
|
} else {
|
|
150
155
|
this.innerValue.push(value);
|
|
156
|
+
isCancelSelect = false;
|
|
151
157
|
}
|
|
158
|
+
|
|
159
|
+
this.$emit('item-select', value, isCancelSelect);
|
|
152
160
|
},
|
|
153
161
|
isSelect: function isSelect(value) {
|
|
154
162
|
if (this.innerValue.indexOf(value) >= 0) {
|
|
@@ -158,13 +166,23 @@ export default createComponent({
|
|
|
158
166
|
return false;
|
|
159
167
|
},
|
|
160
168
|
reset: function reset() {
|
|
161
|
-
this.
|
|
169
|
+
if (Array.isArray(this.resetDefaultValue)) {
|
|
170
|
+
this.innerValue = deepClone(this.resetDefaultValue);
|
|
171
|
+
} else {
|
|
172
|
+
this.innerValue = [];
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
this.$emit('reset', this.innerValue);
|
|
162
176
|
},
|
|
163
177
|
confirm: function confirm() {
|
|
164
178
|
this.showPopup = false;
|
|
165
179
|
this.$emit('input', this.innerValue);
|
|
166
180
|
this.$emit('change', this.innerValue);
|
|
167
181
|
this.$emit('confirm', this.innerValue);
|
|
182
|
+
},
|
|
183
|
+
// @exposed-api 给灵珑侧提供的实现修改已选中值的函数
|
|
184
|
+
updateInnerValue: function updateInnerValue(updateValue) {
|
|
185
|
+
this.innerValue = updateValue;
|
|
168
186
|
}
|
|
169
187
|
},
|
|
170
188
|
render: function render() {
|
|
@@ -233,6 +251,8 @@ export default createComponent({
|
|
|
233
251
|
_this3.$emit('input', option.value);
|
|
234
252
|
|
|
235
253
|
_this3.$emit('change', option.value);
|
|
254
|
+
|
|
255
|
+
_this3.$emit('item-select', option.value);
|
|
236
256
|
}
|
|
237
257
|
}
|
|
238
258
|
}
|
package/es/index.js
CHANGED
|
@@ -71,13 +71,14 @@ import TabbarItem from './tabbar-item';
|
|
|
71
71
|
import Table from './table';
|
|
72
72
|
import Tabs from './tabs';
|
|
73
73
|
import Tag from './tag';
|
|
74
|
+
import TextEllipsis from './text-ellipsis';
|
|
74
75
|
import Timeline from './timeline';
|
|
75
76
|
import Toast from './toast';
|
|
76
77
|
import Uploader from './uploader';
|
|
77
|
-
var version = '2.0.
|
|
78
|
+
var version = '2.0.82';
|
|
78
79
|
|
|
79
80
|
function install(Vue) {
|
|
80
|
-
var components = [ActionSheet, Area, Avatar, BackTop, Badge, Button, Calendar, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, FoldDialog, Form, Grid, GridItem, HierarchySelect, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, Lazyload, List, Loading, Locale, MediaPicker, MediaPlayer, MultiplePicker, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, Timeline, Toast, Uploader];
|
|
81
|
+
var components = [ActionSheet, Area, Avatar, BackTop, Badge, Button, Calendar, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, FoldDialog, Form, Grid, GridItem, HierarchySelect, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, Lazyload, List, Loading, Locale, MediaPicker, MediaPlayer, MultiplePicker, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, TextEllipsis, Timeline, Toast, Uploader];
|
|
81
82
|
components.forEach(function (item) {
|
|
82
83
|
if (item.install) {
|
|
83
84
|
Vue.use(item);
|
|
@@ -91,7 +92,7 @@ if (typeof window !== 'undefined' && window.Vue) {
|
|
|
91
92
|
install(window.Vue);
|
|
92
93
|
}
|
|
93
94
|
|
|
94
|
-
export { install, version, ActionSheet, Area, Avatar, BackTop, Badge, Button, Calendar, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, FoldDialog, Form, Grid, GridItem, HierarchySelect, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, Lazyload, List, Loading, Locale, MediaPicker, MediaPlayer, MultiplePicker, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, Timeline, Toast, Uploader };
|
|
95
|
+
export { install, version, ActionSheet, Area, Avatar, BackTop, Badge, Button, Calendar, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, FoldDialog, Form, Grid, GridItem, HierarchySelect, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, Lazyload, List, Loading, Locale, MediaPicker, MediaPlayer, MultiplePicker, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, TextEllipsis, Timeline, Toast, Uploader };
|
|
95
96
|
export default {
|
|
96
97
|
install: install,
|
|
97
98
|
version: version
|
package/es/style/var.less
CHANGED
|
@@ -1066,11 +1066,16 @@
|
|
|
1066
1066
|
@backtop-box-shadow: 0 4px 12px 0 rgba(5,140,230,0.40);
|
|
1067
1067
|
|
|
1068
1068
|
// Table
|
|
1069
|
-
@table-border-radius: @border-radius-lg;
|
|
1070
1069
|
@table-head-height: 40px;
|
|
1071
1070
|
@table-head-font-size: 14px;
|
|
1071
|
+
@table-head-color: @blue;
|
|
1072
|
+
@table-head-background: #E6F5FF;
|
|
1073
|
+
@table-body-background: #F5FAFF;
|
|
1072
1074
|
@table-row-height: 40px;
|
|
1073
1075
|
@table-row-font-size: 14px;
|
|
1076
|
+
@table-row-color: #2D4B73;
|
|
1077
|
+
@table-row-background: #fff;
|
|
1078
|
+
@table-sort-default-color: #c8c9cc;
|
|
1074
1079
|
|
|
1075
1080
|
// Fold-Dialog
|
|
1076
1081
|
@foldDialog-padding: 0 16px 12px 16px;
|
package/es/table/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.zt2-table{
|
|
1
|
+
.zt2-table table{border-collapse:separate;border-spacing:0;width:100%;table-layout:auto;box-sizing:border-box}.zt2-table--fixed{overflow:auto scroll}.zt2-table--fixed::-webkit-scrollbar{width:0;height:0}.zt2-table--fixed table{table-layout:fixed}.zt2-table--thead-fixed{position:-webkit-sticky!important;position:sticky!important;z-index:2}.zt2-table--fix-left{position:-webkit-sticky!important;position:sticky!important;z-index:2}.zt2-table--bordered{border-left:1px solid #f0f0f0}.zt2-table--bordered>table{border-top:1px solid #f0f0f0}.zt2-table--bordered .zt2-table__thead>tr>th{border-right:1px solid #f0f0f0;border-bottom:1px solid #f0f0f0}.zt2-table--bordered .zt2-table__tbody>tr>td{border-bottom:1px solid #f0f0f0;border-right:1px solid #f0f0f0}.zt2-table__thead>tr>th{box-sizing:border-box;overflow-wrap:break-word;height:40px;font-weight:600;font-size:14px;color:#0091fa;text-align:center;line-height:40px;background:#e6f5ff}.zt2-table__head{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.zt2-table__head-sort{display:-webkit-inline-box;display:-webkit-inline-flex;display:inline-flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;color:#c8c9cc}.zt2-table__sort-active{color:#0091fa}.zt2-table__tbody>tr>td{box-sizing:border-box;overflow-wrap:break-word;height:40px;font-size:14px;color:#2d4b73;text-align:center;line-height:40px;background:#fff}.zt2-table--striped .zt2-table__tbody>tr:nth-child(even)>td{background:#f5faff}.zt2-table--left-last{border-right:none!important}.zt2-table--left-last::after{content:"";position:absolute;top:0;right:-10px;width:10px;height:100%;opacity:.06;background-image:-webkit-linear-gradient(left,#000 0,rgba(0,0,0,0) 100%);background-image:linear-gradient(90deg,#000 0,rgba(0,0,0,0) 100%)}
|
package/es/table/index.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import { createNamespace } from '../utils';
|
|
2
|
-
import
|
|
3
|
+
import Icon from '../icon/index';
|
|
4
|
+
import TextEllipsis from '../text-ellipsis/index';
|
|
5
|
+
import { SortOrderEnum } from './type';
|
|
3
6
|
|
|
4
7
|
var _createNamespace = createNamespace('table'),
|
|
5
8
|
createComponent = _createNamespace[0],
|
|
6
9
|
bem = _createNamespace[1];
|
|
7
10
|
|
|
8
|
-
var defaultData = function defaultData() {
|
|
9
|
-
return {};
|
|
10
|
-
};
|
|
11
|
-
|
|
12
11
|
export default createComponent({
|
|
13
12
|
props: {
|
|
14
13
|
headList: {
|
|
@@ -19,268 +18,208 @@ export default createComponent({
|
|
|
19
18
|
type: Array,
|
|
20
19
|
default: []
|
|
21
20
|
},
|
|
22
|
-
|
|
21
|
+
bordered: {
|
|
23
22
|
type: Boolean,
|
|
24
23
|
default: true
|
|
25
24
|
},
|
|
26
|
-
|
|
27
|
-
type: String,
|
|
28
|
-
default: "#000"
|
|
29
|
-
},
|
|
30
|
-
headBackground: {
|
|
31
|
-
type: String,
|
|
32
|
-
default: "#fafafa"
|
|
33
|
-
},
|
|
34
|
-
dataColor: {
|
|
35
|
-
type: String,
|
|
36
|
-
default: "#000"
|
|
37
|
-
},
|
|
38
|
-
dataBackground: {
|
|
39
|
-
type: String,
|
|
40
|
-
default: "#fff"
|
|
41
|
-
},
|
|
42
|
-
hideTableHead: {
|
|
25
|
+
striped: {
|
|
43
26
|
type: Boolean,
|
|
44
27
|
default: false
|
|
45
28
|
}
|
|
46
29
|
},
|
|
47
30
|
data: function data() {
|
|
48
|
-
return
|
|
31
|
+
return {
|
|
32
|
+
pingedLeft: false,
|
|
33
|
+
sortOrder: '',
|
|
34
|
+
sortKey: ''
|
|
35
|
+
};
|
|
49
36
|
},
|
|
50
37
|
computed: {
|
|
51
|
-
|
|
38
|
+
fixedColumn: function fixedColumn() {
|
|
52
39
|
return this.headList.filter(function (v) {
|
|
53
|
-
return v.
|
|
40
|
+
return v.fixed;
|
|
54
41
|
});
|
|
55
42
|
},
|
|
56
|
-
|
|
57
|
-
return this.
|
|
58
|
-
return v.fixedRight;
|
|
59
|
-
});
|
|
43
|
+
fixed: function fixed() {
|
|
44
|
+
return this.fixedColumn.length > 0;
|
|
60
45
|
},
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
var columnTotalWidth = 0;
|
|
75
|
-
this.headList.forEach(function (v, i) {
|
|
76
|
-
var dom = document.getElementById("tableHead" + i);
|
|
77
|
-
|
|
78
|
-
if (dom) {
|
|
79
|
-
columnTotalWidth += dom.clientWidth || 0;
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
var box = document.getElementById("normalBoxID");
|
|
83
|
-
var boxWidth = 0;
|
|
84
|
-
|
|
85
|
-
if (box) {
|
|
86
|
-
boxWidth = box.clientWidth;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (this.fixedColumnLeft && this.fixedColumnLeft.length || this.fixedColumnRight && this.fixedColumnRight.length) {
|
|
90
|
-
// 当表格横向出现滚动时,给固定列加一个box-shadow
|
|
91
|
-
var fixedBoxRight = document.getElementById("fixedRightBoxID");
|
|
92
|
-
|
|
93
|
-
if (fixedBoxRight && columnTotalWidth > boxWidth) {
|
|
94
|
-
fixedBoxRight.classList.add("shadow");
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (box) {
|
|
98
|
-
box.addEventListener("scroll", function (e) {
|
|
99
|
-
var fixedBoxLeft = document.getElementById("fixedLeftBoxID");
|
|
100
|
-
|
|
101
|
-
if (fixedBoxLeft) {
|
|
102
|
-
if (e && e.target && e.target.scrollLeft > 0) {
|
|
103
|
-
fixedBoxLeft.classList.add("shadow");
|
|
104
|
-
} else {
|
|
105
|
-
fixedBoxLeft.classList.remove("shadow");
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (fixedBoxRight) {
|
|
110
|
-
if (e && e.target && e.target.scrollLeft + e.target.clientWidth >= columnTotalWidth - 1) {
|
|
111
|
-
fixedBoxRight.classList.remove("shadow");
|
|
112
|
-
} else {
|
|
113
|
-
fixedBoxRight.classList.add("shadow");
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
} // 获取需固定列的实际宽度,用于设置绝对定位元素的宽度
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
var fixedLeftIndexList = this.headList.map(function (v, i) {
|
|
122
|
-
if (v.fixedLeft) {
|
|
123
|
-
return "tableHead" + i;
|
|
124
|
-
} else {
|
|
125
|
-
return "";
|
|
126
|
-
}
|
|
127
|
-
}).filter(function (v) {
|
|
128
|
-
return v !== "";
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
if (fixedLeftIndexList.length > 0) {
|
|
132
|
-
fixedLeftIndexList.forEach(function (current, index) {
|
|
133
|
-
var fixedDom = document.getElementById("fixedHeadLeft" + index);
|
|
134
|
-
var normalDom = document.getElementById(current);
|
|
135
|
-
|
|
136
|
-
if (fixedDom && normalDom) {
|
|
137
|
-
fixedDom.style.width = normalDom.offsetWidth + "px";
|
|
46
|
+
formatColumns: function formatColumns() {
|
|
47
|
+
var _this = this;
|
|
48
|
+
|
|
49
|
+
var columns = [];
|
|
50
|
+
var left = 0;
|
|
51
|
+
this.headList.forEach(function (element, index) {
|
|
52
|
+
var column = {};
|
|
53
|
+
var preColumn = _this.headList[index - 1];
|
|
54
|
+
var nextColumn = _this.headList[index + 1];
|
|
55
|
+
|
|
56
|
+
if (element.sorter && element.defaultSortOrder) {
|
|
57
|
+
_this.sortOrder = element.defaultSortOrder || '';
|
|
58
|
+
_this.sortKey = element.key;
|
|
138
59
|
}
|
|
139
|
-
}, 0);
|
|
140
|
-
} // 获取需固定列的实际宽度,用于设置绝对定位元素的宽度
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
var fixedRightIndexList = this.headList.map(function (v, i) {
|
|
144
|
-
if (v.fixedRight) {
|
|
145
|
-
return "tableHead" + i;
|
|
146
|
-
} else {
|
|
147
|
-
return "";
|
|
148
|
-
}
|
|
149
|
-
}).filter(function (v) {
|
|
150
|
-
return v !== "";
|
|
151
|
-
});
|
|
152
60
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
if (fixedDom && normalDom) {
|
|
159
|
-
fixedDom.style.width = normalDom.offsetWidth + "px";
|
|
61
|
+
if (preColumn) {
|
|
62
|
+
left += Number(preColumn.width.split('px')[0]);
|
|
63
|
+
column.left = left + "px";
|
|
64
|
+
} else {
|
|
65
|
+
column.left = 0;
|
|
160
66
|
}
|
|
161
|
-
}, 0); // 当存在右侧固定列,且列宽度不足以撑满容器时,将最后一列宽度拉长到填满
|
|
162
|
-
|
|
163
|
-
if (columnTotalWidth < boxWidth) {
|
|
164
|
-
var lastColumn = document.getElementById("tableHead" + (this.headList.length - 1));
|
|
165
67
|
|
|
166
|
-
if (
|
|
167
|
-
|
|
168
|
-
lastColumn.style.width = "unset";
|
|
169
|
-
lastColumn.style.flex = "1";
|
|
68
|
+
if (element.fixed && !nextColumn.fixed) {
|
|
69
|
+
column.lastFixLeft = true;
|
|
170
70
|
}
|
|
171
|
-
|
|
71
|
+
|
|
72
|
+
columns.push(_extends({}, element, column));
|
|
73
|
+
});
|
|
74
|
+
return columns;
|
|
172
75
|
}
|
|
173
76
|
},
|
|
174
|
-
watch: {},
|
|
175
77
|
methods: {
|
|
176
|
-
|
|
177
|
-
var
|
|
178
|
-
|
|
179
|
-
var
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
background: this.headBackground
|
|
186
|
-
};
|
|
187
|
-
var dataStyle = {
|
|
188
|
-
color: this.dataColor,
|
|
189
|
-
background: this.dataBackground
|
|
190
|
-
};
|
|
191
|
-
var idName = "tableHead" + index;
|
|
192
|
-
|
|
193
|
-
if (isFixed === "left") {
|
|
194
|
-
idName = "fixedHeadLeft" + index;
|
|
78
|
+
onScroll: function onScroll(_ref) {
|
|
79
|
+
var currentTarget = _ref.currentTarget,
|
|
80
|
+
scrollLeft = _ref.scrollLeft;
|
|
81
|
+
var mergedScrollLeft = typeof scrollLeft === 'number' ? scrollLeft : currentTarget.scrollLeft;
|
|
82
|
+
this.pingedLeft = mergedScrollLeft > 0;
|
|
83
|
+
},
|
|
84
|
+
getNextSortOrder: function getNextSortOrder(type) {
|
|
85
|
+
if (!type) {
|
|
86
|
+
return SortOrderEnum.ASCEND;
|
|
195
87
|
}
|
|
196
88
|
|
|
197
|
-
if (
|
|
198
|
-
|
|
89
|
+
if (type === SortOrderEnum.ASCEND) {
|
|
90
|
+
return SortOrderEnum.DESCEND;
|
|
199
91
|
}
|
|
200
92
|
|
|
201
|
-
|
|
93
|
+
return '';
|
|
94
|
+
},
|
|
95
|
+
onHeaderClick: function onHeaderClick(data) {
|
|
96
|
+
if (!data.sorter) return;
|
|
97
|
+
this.sortOrder = this.getNextSortOrder(data.key === this.sortKey ? this.sortOrder : '');
|
|
98
|
+
this.sortKey = data.key;
|
|
99
|
+
this.$emit('sort', {
|
|
100
|
+
order: this.sortOrder,
|
|
101
|
+
key: data.key
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
getHead: function getHead(colData) {
|
|
105
|
+
var _this2 = this;
|
|
106
|
+
|
|
107
|
+
var h = this.$createElement;
|
|
202
108
|
|
|
203
|
-
if ((
|
|
204
|
-
|
|
205
|
-
|
|
109
|
+
if ((colData == null ? void 0 : colData.colSpan) !== 0) {
|
|
110
|
+
return h("th", {
|
|
111
|
+
"class": bem({
|
|
112
|
+
'fix-left': colData.fixed,
|
|
113
|
+
'left-last': colData.lastFixLeft && this.pingedLeft
|
|
114
|
+
}),
|
|
115
|
+
"style": {
|
|
116
|
+
left: colData.fixed ? colData.left : ''
|
|
117
|
+
},
|
|
118
|
+
"attrs": {
|
|
119
|
+
"colspan": (colData == null ? void 0 : colData.colSpan) !== 1 ? colData == null ? void 0 : colData.colSpan : null
|
|
120
|
+
}
|
|
121
|
+
}, [h("div", {
|
|
122
|
+
"class": bem('head'),
|
|
123
|
+
"on": {
|
|
124
|
+
"click": function click() {
|
|
125
|
+
return _this2.onHeaderClick(colData);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}, [colData.ellipsis ? h(TextEllipsis, {
|
|
129
|
+
"attrs": {
|
|
130
|
+
"content": colData.label,
|
|
131
|
+
"expandType": "dialog"
|
|
132
|
+
}
|
|
133
|
+
}) : colData.label, colData.sorter ? h("span", {
|
|
134
|
+
"class": bem('head-sort')
|
|
135
|
+
}, [h(Icon, {
|
|
136
|
+
"class": [colData.key === this.sortKey && this.sortOrder === SortOrderEnum.ASCEND ? bem('sort-active') : ''],
|
|
137
|
+
"attrs": {
|
|
138
|
+
"name": "spinner-shrink",
|
|
139
|
+
"size": "12"
|
|
140
|
+
},
|
|
141
|
+
"style": {
|
|
142
|
+
marginBottom: '-3px'
|
|
143
|
+
}
|
|
144
|
+
}), h(Icon, {
|
|
145
|
+
"class": [colData.key === this.sortKey && this.sortOrder === SortOrderEnum.DESCEND ? bem('sort-active') : ''],
|
|
146
|
+
"attrs": {
|
|
147
|
+
"name": "spinner-expand",
|
|
148
|
+
"size": "12"
|
|
149
|
+
},
|
|
150
|
+
"style": {
|
|
151
|
+
marginTop: '-3px'
|
|
152
|
+
}
|
|
153
|
+
})]) : ''])]);
|
|
206
154
|
}
|
|
155
|
+
},
|
|
156
|
+
onClick: function onClick() {},
|
|
157
|
+
getBody: function getBody(rowData, rowIndex) {
|
|
158
|
+
var _this3 = this;
|
|
207
159
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
"id": idName
|
|
212
|
-
},
|
|
213
|
-
"style": isFixed ? "" : headObj.width ? "width:" + headObj.width + ";" : ""
|
|
214
|
-
}, [h("div", {
|
|
215
|
-
"directives": [{
|
|
216
|
-
name: "show",
|
|
217
|
-
value: !hideTableHead
|
|
218
|
-
}],
|
|
219
|
-
"class": [bem("head-item"), BORDER_TOP_BOTTOM],
|
|
220
|
-
"style": headItemStyle
|
|
221
|
-
}, [headRender]), this.dataList.map(function (data) {
|
|
222
|
-
var hide = (headObj.fixedLeft || headObj.fixedRight) && !isFixed;
|
|
160
|
+
var h = this.$createElement;
|
|
161
|
+
return h("tr", [this.formatColumns.map(function (colData) {
|
|
162
|
+
var _additionalCellProps, _additionalCellProps2, _additionalCellProps3, _additionalCellProps4, _additionalCellProps5, _additionalCellProps6;
|
|
223
163
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
"style": dataStyle
|
|
229
|
-
});
|
|
230
|
-
} else if (data[headObj.key] && data[headObj.key].id && slots("data" + data[headObj.key].id)) {
|
|
231
|
-
return slots("data" + data[headObj.key].id);
|
|
232
|
-
} else {
|
|
233
|
-
return h("div", {
|
|
234
|
-
"class": [bem("table-data"), BORDER_BOTTOM],
|
|
235
|
-
"style": dataStyle
|
|
236
|
-
}, [data[headObj.key]]);
|
|
164
|
+
var additionalCellProps;
|
|
165
|
+
|
|
166
|
+
if (colData.customCell) {
|
|
167
|
+
additionalCellProps = colData.customCell(rowData, rowIndex);
|
|
237
168
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
return
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
169
|
+
|
|
170
|
+
var style = _extends({}, colData.style);
|
|
171
|
+
|
|
172
|
+
style.left = colData.fixed ? colData.left : '';
|
|
173
|
+
return ((_additionalCellProps = additionalCellProps) == null ? void 0 : _additionalCellProps.rowSpan) !== 0 && ((_additionalCellProps2 = additionalCellProps) == null ? void 0 : _additionalCellProps2.colSpan) !== 0 && h("td", {
|
|
174
|
+
"on": {
|
|
175
|
+
"click": function click() {
|
|
176
|
+
return colData.onClick && colData.onClick(rowData, rowIndex);
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"class": bem({
|
|
180
|
+
'fix-left': colData.fixed,
|
|
181
|
+
'left-last': colData.lastFixLeft && _this3.pingedLeft
|
|
182
|
+
}),
|
|
183
|
+
"attrs": {
|
|
184
|
+
"colspan": ((_additionalCellProps3 = additionalCellProps) == null ? void 0 : _additionalCellProps3.colSpan) !== 1 ? (_additionalCellProps4 = additionalCellProps) == null ? void 0 : _additionalCellProps4.colSpan : null,
|
|
185
|
+
"rowspan": ((_additionalCellProps5 = additionalCellProps) == null ? void 0 : _additionalCellProps5.rowSpan) !== 1 ? (_additionalCellProps6 = additionalCellProps) == null ? void 0 : _additionalCellProps6.rowSpan : null
|
|
186
|
+
},
|
|
187
|
+
"style": style
|
|
188
|
+
}, [colData.ellipsis ? h(TextEllipsis, {
|
|
189
|
+
"attrs": {
|
|
190
|
+
"content": rowData[colData.key],
|
|
191
|
+
"expandType": "dialog"
|
|
192
|
+
}
|
|
193
|
+
}) : rowData[colData.key]]);
|
|
194
|
+
})]);
|
|
247
195
|
}
|
|
248
196
|
},
|
|
249
197
|
render: function render(h) {
|
|
250
|
-
var
|
|
198
|
+
var _this4 = this;
|
|
251
199
|
|
|
252
|
-
var showFixed = this.dataList && this.dataList.length;
|
|
253
200
|
return h("div", {
|
|
254
|
-
"class": bem(
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
},
|
|
259
|
-
"
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
"
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}],
|
|
278
|
-
"attrs": {
|
|
279
|
-
"id": "fixedRightBoxID"
|
|
280
|
-
},
|
|
281
|
-
"class": bem("fixed-right-box")
|
|
282
|
-
}, [this.fixedColumnRight.map(function (x, i) {
|
|
283
|
-
return _this.genColumn(x, i, "right");
|
|
284
|
-
})])]);
|
|
201
|
+
"class": bem({
|
|
202
|
+
fixed: this.fixed,
|
|
203
|
+
bordered: this.bordered,
|
|
204
|
+
striped: this.striped
|
|
205
|
+
}),
|
|
206
|
+
"on": {
|
|
207
|
+
"scroll": this.onScroll
|
|
208
|
+
}
|
|
209
|
+
}, [h("table", [h("colgroup", [this.headList.map(function (item) {
|
|
210
|
+
return h("col", {
|
|
211
|
+
"style": {
|
|
212
|
+
width: item.width
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
})]), h("thead", {
|
|
216
|
+
"class": bem('thead')
|
|
217
|
+
}, [h("tr", [this.formatColumns.map(function (colData) {
|
|
218
|
+
return _this4.getHead(colData);
|
|
219
|
+
})])]), h("tbody", {
|
|
220
|
+
"class": bem('tbody')
|
|
221
|
+
}, [this.dataList.map(function (rowData, rowIndex) {
|
|
222
|
+
return _this4.getBody(rowData, rowIndex);
|
|
223
|
+
})])])]);
|
|
285
224
|
}
|
|
286
225
|
});
|