yy-vue-easytable 2.27.2
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/LICENSE +22 -0
- package/README.md +187 -0
- package/libs/font/demo.css +539 -0
- package/libs/font/demo_index.html +400 -0
- package/libs/font/iconfont.css +57 -0
- package/libs/font/iconfont.eot +0 -0
- package/libs/font/iconfont.js +1 -0
- package/libs/font/iconfont.json +79 -0
- package/libs/font/iconfont.svg +56 -0
- package/libs/font/iconfont.ttf +0 -0
- package/libs/font/iconfont.woff +0 -0
- package/libs/font/iconfont.woff2 +0 -0
- package/libs/locale/lang/af-ZA.js +48 -0
- package/libs/locale/lang/en-US.js +48 -0
- package/libs/locale/lang/fr-FR.js +48 -0
- package/libs/locale/lang/ko-KR.js +48 -0
- package/libs/locale/lang/pt-BR.js +48 -0
- package/libs/locale/lang/ru-RU.js +48 -0
- package/libs/locale/lang/zh-CN.js +48 -0
- package/libs/locale/lang/zh-TW.js +48 -0
- package/libs/locale/lang/zu-ZA.js +48 -0
- package/libs/main.js +1 -0
- package/libs/theme-dark/base.css +1 -0
- package/libs/theme-dark/index.css +1253 -0
- package/libs/theme-dark/var.css +7 -0
- package/libs/theme-dark/ve-checkbox.css +150 -0
- package/libs/theme-dark/ve-contextmenu.css +71 -0
- package/libs/theme-dark/ve-dropdown.css +177 -0
- package/libs/theme-dark/ve-icon.css +10 -0
- package/libs/theme-dark/ve-loading.css +218 -0
- package/libs/theme-dark/ve-pagination.css +136 -0
- package/libs/theme-dark/ve-radio.css +111 -0
- package/libs/theme-dark/ve-select.css +50 -0
- package/libs/theme-dark/ve-table.css +385 -0
- package/libs/theme-default/base.css +1 -0
- package/libs/theme-default/index.css +1253 -0
- package/libs/theme-default/var.css +7 -0
- package/libs/theme-default/ve-checkbox.css +150 -0
- package/libs/theme-default/ve-contextmenu.css +71 -0
- package/libs/theme-default/ve-dropdown.css +177 -0
- package/libs/theme-default/ve-icon.css +10 -0
- package/libs/theme-default/ve-loading.css +218 -0
- package/libs/theme-default/ve-pagination.css +136 -0
- package/libs/theme-default/ve-radio.css +111 -0
- package/libs/theme-default/ve-select.css +50 -0
- package/libs/theme-default/ve-table.css +385 -0
- package/libs/umd/index.js +9 -0
- package/libs/ve-checkbox-group.js +1 -0
- package/libs/ve-checkbox.js +1 -0
- package/libs/ve-contextmenu.js +1 -0
- package/libs/ve-dropdown.js +1 -0
- package/libs/ve-icon.js +1 -0
- package/libs/ve-loading.js +1 -0
- package/libs/ve-locale.js +1 -0
- package/libs/ve-pagination.js +1 -0
- package/libs/ve-radio.js +1 -0
- package/libs/ve-select.js +1 -0
- package/libs/ve-table.js +1 -0
- package/package.json +142 -0
- package/packages/font/demo.css +539 -0
- package/packages/font/demo_index.html +400 -0
- package/packages/font/iconfont.css +57 -0
- package/packages/font/iconfont.eot +0 -0
- package/packages/font/iconfont.js +1 -0
- package/packages/font/iconfont.json +79 -0
- package/packages/font/iconfont.svg +56 -0
- package/packages/font/iconfont.ttf +0 -0
- package/packages/font/iconfont.woff +0 -0
- package/packages/font/iconfont.woff2 +0 -0
- package/packages/index.js +75 -0
- package/packages/src/comps/resize-observer/index.js +2 -0
- package/packages/src/comps/resize-observer/src/index.jsx +38 -0
- package/packages/src/directives/clickoutside.js +31 -0
- package/packages/src/directives/events-outside.js +79 -0
- package/packages/src/directives/focus.js +28 -0
- package/packages/src/locale/index.js +27 -0
- package/packages/src/locale/lang/af-ZA.js +29 -0
- package/packages/src/locale/lang/en-US.js +30 -0
- package/packages/src/locale/lang/fr-FR.js +29 -0
- package/packages/src/locale/lang/ko-KR.js +29 -0
- package/packages/src/locale/lang/pt-BR.js +29 -0
- package/packages/src/locale/lang/ru-RU.js +29 -0
- package/packages/src/locale/lang/zh-CN.js +30 -0
- package/packages/src/locale/lang/zh-TW.js +29 -0
- package/packages/src/locale/lang/zu-ZA.js +29 -0
- package/packages/src/mixins/emitter.js +39 -0
- package/packages/src/utils/animation-frame.js +39 -0
- package/packages/src/utils/auto-resize.js +179 -0
- package/packages/src/utils/constant.js +42 -0
- package/packages/src/utils/dom.js +239 -0
- package/packages/src/utils/event-key-codes.js +53 -0
- package/packages/src/utils/hooks-manager.js +76 -0
- package/packages/src/utils/index.js +161 -0
- package/packages/src/utils/mouse-event.js +24 -0
- package/packages/src/utils/random.js +6 -0
- package/packages/src/utils/request-animation-timeout.js +36 -0
- package/packages/src/utils/resize-event.js +40 -0
- package/packages/src/utils/scroll-bar.js +27 -0
- package/packages/style/ve-checkbox.less +179 -0
- package/packages/style/ve-contextmenu.less +76 -0
- package/packages/style/ve-dropdown.less +204 -0
- package/packages/style/ve-icon.less +3 -0
- package/packages/style/ve-loading.less +242 -0
- package/packages/style/ve-pagination.less +153 -0
- package/packages/style/ve-radio.less +126 -0
- package/packages/style/ve-select.less +48 -0
- package/packages/style/ve-table.less +539 -0
- package/packages/theme-dark/base.less +1 -0
- package/packages/theme-dark/index.less +12 -0
- package/packages/theme-dark/var.less +111 -0
- package/packages/theme-dark/ve-checkbox.less +2 -0
- package/packages/theme-dark/ve-contextmenu.less +2 -0
- package/packages/theme-dark/ve-dropdown.less +2 -0
- package/packages/theme-dark/ve-icon.less +2 -0
- package/packages/theme-dark/ve-loading.less +2 -0
- package/packages/theme-dark/ve-pagination.less +2 -0
- package/packages/theme-dark/ve-radio.less +2 -0
- package/packages/theme-dark/ve-select.less +2 -0
- package/packages/theme-dark/ve-table.less +2 -0
- package/packages/theme-default/base.less +1 -0
- package/packages/theme-default/index.less +12 -0
- package/packages/theme-default/var.less +111 -0
- package/packages/theme-default/ve-checkbox.less +2 -0
- package/packages/theme-default/ve-contextmenu.less +2 -0
- package/packages/theme-default/ve-dropdown.less +2 -0
- package/packages/theme-default/ve-icon.less +2 -0
- package/packages/theme-default/ve-loading.less +2 -0
- package/packages/theme-default/ve-pagination.less +2 -0
- package/packages/theme-default/ve-radio.less +2 -0
- package/packages/theme-default/ve-select.less +2 -0
- package/packages/theme-default/ve-table.less +2 -0
- package/packages/ve-checkbox/index.js +7 -0
- package/packages/ve-checkbox/src/index.jsx +175 -0
- package/packages/ve-checkbox/src/util/constant.js +14 -0
- package/packages/ve-checkbox/src/util/index.js +10 -0
- package/packages/ve-checkbox-group/index.js +7 -0
- package/packages/ve-checkbox-group/src/index.jsx +53 -0
- package/packages/ve-checkbox-group/src/util/constant.js +14 -0
- package/packages/ve-checkbox-group/src/util/index.js +10 -0
- package/packages/ve-contextmenu/index.js +7 -0
- package/packages/ve-contextmenu/src/index.jsx +731 -0
- package/packages/ve-contextmenu/src/util/constant.js +29 -0
- package/packages/ve-contextmenu/src/util/index.js +10 -0
- package/packages/ve-dropdown/index.js +7 -0
- package/packages/ve-dropdown/src/index.jsx +720 -0
- package/packages/ve-dropdown/src/util/constant.js +15 -0
- package/packages/ve-dropdown/src/util/index.js +10 -0
- package/packages/ve-icon/index.js +7 -0
- package/packages/ve-icon/src/index.jsx +52 -0
- package/packages/ve-icon/src/util/constant.js +10 -0
- package/packages/ve-icon/src/util/index.js +10 -0
- package/packages/ve-loading/index.js +8 -0
- package/packages/ve-loading/src/bounce.jsx +50 -0
- package/packages/ve-loading/src/flow.jsx +51 -0
- package/packages/ve-loading/src/grid.jsx +57 -0
- package/packages/ve-loading/src/index.js +106 -0
- package/packages/ve-loading/src/loading.jsx +63 -0
- package/packages/ve-loading/src/plane.jsx +38 -0
- package/packages/ve-loading/src/pulse.jsx +38 -0
- package/packages/ve-loading/src/util/constant.js +31 -0
- package/packages/ve-loading/src/util/index.js +10 -0
- package/packages/ve-loading/src/wave.jsx +53 -0
- package/packages/ve-locale/index.js +28 -0
- package/packages/ve-pagination/index.js +7 -0
- package/packages/ve-pagination/src/index.jsx +304 -0
- package/packages/ve-pagination/src/pager.jsx +166 -0
- package/packages/ve-pagination/src/util/constant.js +16 -0
- package/packages/ve-pagination/src/util/index.js +10 -0
- package/packages/ve-radio/index.js +7 -0
- package/packages/ve-radio/src/index.jsx +121 -0
- package/packages/ve-radio/src/util/constant.js +13 -0
- package/packages/ve-radio/src/util/index.js +10 -0
- package/packages/ve-select/index.js +7 -0
- package/packages/ve-select/src/index.jsx +193 -0
- package/packages/ve-select/src/util/constant.js +13 -0
- package/packages/ve-select/src/util/index.js +10 -0
- package/packages/ve-table/index.js +7 -0
- package/packages/ve-table/src/body/body-checkbox-content.jsx +126 -0
- package/packages/ve-table/src/body/body-radio-content.jsx +113 -0
- package/packages/ve-table/src/body/body-td.jsx +671 -0
- package/packages/ve-table/src/body/body-tr-scrolling.jsx +38 -0
- package/packages/ve-table/src/body/body-tr.jsx +383 -0
- package/packages/ve-table/src/body/expand-tr-icon.jsx +80 -0
- package/packages/ve-table/src/body/expand-tr.jsx +147 -0
- package/packages/ve-table/src/body/index.jsx +943 -0
- package/packages/ve-table/src/colgroup/index.jsx +48 -0
- package/packages/ve-table/src/column-resizer/index.jsx +318 -0
- package/packages/ve-table/src/editor/constant.js +5 -0
- package/packages/ve-table/src/editor/index.jsx +533 -0
- package/packages/ve-table/src/footer/footer-td.jsx +396 -0
- package/packages/ve-table/src/footer/footer-tr.jsx +249 -0
- package/packages/ve-table/src/footer/index.jsx +108 -0
- package/packages/ve-table/src/header/header-checkbox-content.jsx +69 -0
- package/packages/ve-table/src/header/header-filter-content.jsx +100 -0
- package/packages/ve-table/src/header/header-filter-custom-content.jsx +110 -0
- package/packages/ve-table/src/header/header-th.jsx +664 -0
- package/packages/ve-table/src/header/header-tr.jsx +255 -0
- package/packages/ve-table/src/header/index.jsx +195 -0
- package/packages/ve-table/src/index.jsx +4196 -0
- package/packages/ve-table/src/selection/constant.js +5 -0
- package/packages/ve-table/src/selection/index.jsx +1643 -0
- package/packages/ve-table/src/util/clipboard.js +428 -0
- package/packages/ve-table/src/util/constant.js +269 -0
- package/packages/ve-table/src/util/index.js +1585 -0
- package/packages/ve-table/src/util/store.js +14 -0
|
@@ -0,0 +1,943 @@
|
|
|
1
|
+
import BodyTr from "./body-tr";
|
|
2
|
+
import BodyTrScrolling from "./body-tr-scrolling";
|
|
3
|
+
import ExpandTr from "./expand-tr";
|
|
4
|
+
import VueDomResizeObserver from "../../../src/comps/resize-observer";
|
|
5
|
+
import {
|
|
6
|
+
getDomResizeObserverCompKey,
|
|
7
|
+
getFixedTotalWidthByColumnKey,
|
|
8
|
+
clsName,
|
|
9
|
+
} from "../util";
|
|
10
|
+
import { getValByUnit } from "../../../src/utils/index.js";
|
|
11
|
+
import emitter from "../../../src/mixins/emitter";
|
|
12
|
+
import {
|
|
13
|
+
COMPS_NAME,
|
|
14
|
+
EMIT_EVENTS,
|
|
15
|
+
COLUMN_TYPES,
|
|
16
|
+
EXPAND_TRIGGER_TYPES,
|
|
17
|
+
} from "../util/constant";
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
name: COMPS_NAME.VE_TABLE_BODY,
|
|
21
|
+
mixins: [emitter],
|
|
22
|
+
props: {
|
|
23
|
+
tableViewportWidth: {
|
|
24
|
+
type: Number,
|
|
25
|
+
default: 0,
|
|
26
|
+
},
|
|
27
|
+
columnsOptionResetTime: {
|
|
28
|
+
type: Number,
|
|
29
|
+
default: 0,
|
|
30
|
+
},
|
|
31
|
+
colgroups: {
|
|
32
|
+
type: Array,
|
|
33
|
+
required: true,
|
|
34
|
+
},
|
|
35
|
+
actualRenderTableData: {
|
|
36
|
+
type: Array,
|
|
37
|
+
required: true,
|
|
38
|
+
},
|
|
39
|
+
hasFixedColumn: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false,
|
|
42
|
+
},
|
|
43
|
+
allRowKeys: {
|
|
44
|
+
type: Array,
|
|
45
|
+
required: true,
|
|
46
|
+
},
|
|
47
|
+
// expand row option
|
|
48
|
+
expandOption: {
|
|
49
|
+
type: Object,
|
|
50
|
+
default: function () {
|
|
51
|
+
return null;
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
// checkbox option
|
|
55
|
+
checkboxOption: {
|
|
56
|
+
type: Object,
|
|
57
|
+
default: function () {
|
|
58
|
+
return null;
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
// radio option
|
|
62
|
+
radioOption: {
|
|
63
|
+
type: Object,
|
|
64
|
+
default: function () {
|
|
65
|
+
return null;
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
// virual scroll
|
|
69
|
+
virtualScrollOption: {
|
|
70
|
+
type: Object,
|
|
71
|
+
default: null,
|
|
72
|
+
},
|
|
73
|
+
// is virtual scroll
|
|
74
|
+
isVirtualScroll: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: false,
|
|
77
|
+
},
|
|
78
|
+
// is scrolling
|
|
79
|
+
showVirtualScrollingPlaceholder: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: false,
|
|
82
|
+
},
|
|
83
|
+
rowKeyFieldName: {
|
|
84
|
+
type: String,
|
|
85
|
+
default: null,
|
|
86
|
+
},
|
|
87
|
+
// cell style option
|
|
88
|
+
cellStyleOption: {
|
|
89
|
+
type: Object,
|
|
90
|
+
default: function () {
|
|
91
|
+
return null;
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
// cell span option
|
|
95
|
+
cellSpanOption: {
|
|
96
|
+
type: Object,
|
|
97
|
+
default: function () {
|
|
98
|
+
return null;
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
// highlight row key
|
|
102
|
+
highlightRowKey: {
|
|
103
|
+
type: [String, Number],
|
|
104
|
+
default: null,
|
|
105
|
+
},
|
|
106
|
+
// event custom option
|
|
107
|
+
eventCustomOption: {
|
|
108
|
+
type: Object,
|
|
109
|
+
default: function () {
|
|
110
|
+
return null;
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
// cell selection option
|
|
114
|
+
cellSelectionOption: {
|
|
115
|
+
type: Object,
|
|
116
|
+
default: function () {
|
|
117
|
+
return null;
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
// cell selection data
|
|
121
|
+
cellSelectionData: {
|
|
122
|
+
type: Object,
|
|
123
|
+
default: function () {
|
|
124
|
+
return null;
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
// cell selection range data
|
|
128
|
+
cellSelectionRangeData: {
|
|
129
|
+
type: Object,
|
|
130
|
+
default: function () {
|
|
131
|
+
return null;
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
bodyIndicatorRowKeys: {
|
|
135
|
+
type: Object,
|
|
136
|
+
default: function () {
|
|
137
|
+
return null;
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
// edit option
|
|
141
|
+
editOption: {
|
|
142
|
+
type: Object,
|
|
143
|
+
default: function () {
|
|
144
|
+
return null;
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
data() {
|
|
149
|
+
return {
|
|
150
|
+
// columns widths map
|
|
151
|
+
colsWidths: new Map(),
|
|
152
|
+
/*
|
|
153
|
+
internal expand row keys
|
|
154
|
+
1、当没有设置 expandedRowKeys 时生效
|
|
155
|
+
*/
|
|
156
|
+
internalExpandRowkeys: [],
|
|
157
|
+
/*
|
|
158
|
+
1、存储当前多选功能的rowkey 信息
|
|
159
|
+
*/
|
|
160
|
+
internalCheckboxSelectedRowKeys: [],
|
|
161
|
+
/*
|
|
162
|
+
1、存储当前单选功能的rowkey 信息
|
|
163
|
+
*/
|
|
164
|
+
internalRadioSelectedRowKey: null,
|
|
165
|
+
// virtual scroll preview rendered rowKey
|
|
166
|
+
virtualScrollPreviewRenderedRowKeys: [],
|
|
167
|
+
// virtual scroll repeat rendered rowKey
|
|
168
|
+
virtualScrollRepeatRenderedRowKeys: [],
|
|
169
|
+
};
|
|
170
|
+
},
|
|
171
|
+
computed: {
|
|
172
|
+
/*
|
|
173
|
+
column collenction info
|
|
174
|
+
1、style of each column
|
|
175
|
+
2、class of each column
|
|
176
|
+
*/
|
|
177
|
+
columnCollection() {
|
|
178
|
+
let columnCollection = [];
|
|
179
|
+
|
|
180
|
+
const { colgroups } = this;
|
|
181
|
+
|
|
182
|
+
colgroups.forEach((col) => {
|
|
183
|
+
const colKey = col.key;
|
|
184
|
+
|
|
185
|
+
let columnCollectionItem = {
|
|
186
|
+
colKey: colKey,
|
|
187
|
+
class: {
|
|
188
|
+
[clsName("last-left-fixed-column")]:
|
|
189
|
+
this.isLastLeftFixedColumn(col),
|
|
190
|
+
[clsName("first-right-fixed-column")]:
|
|
191
|
+
this.isfirstRightFixedColumn(col),
|
|
192
|
+
},
|
|
193
|
+
style: {},
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
const { fixed, align } = col;
|
|
197
|
+
|
|
198
|
+
columnCollectionItem.style["text-align"] = align || "center";
|
|
199
|
+
|
|
200
|
+
if (fixed) {
|
|
201
|
+
let totalWidth = 0;
|
|
202
|
+
// column index
|
|
203
|
+
const columnIndex = colgroups.findIndex(
|
|
204
|
+
(x) => x.key === colKey,
|
|
205
|
+
);
|
|
206
|
+
if (
|
|
207
|
+
(fixed === "left" && columnIndex > 0) ||
|
|
208
|
+
(fixed === "right" &&
|
|
209
|
+
columnIndex < colgroups.length - 1)
|
|
210
|
+
) {
|
|
211
|
+
totalWidth = getFixedTotalWidthByColumnKey({
|
|
212
|
+
colgroups,
|
|
213
|
+
colKey,
|
|
214
|
+
fixed,
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
totalWidth = getValByUnit(totalWidth);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
columnCollectionItem.style["left"] =
|
|
221
|
+
fixed === "left" ? totalWidth : "";
|
|
222
|
+
columnCollectionItem.style["right"] =
|
|
223
|
+
fixed === "right" ? totalWidth : "";
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
columnCollection.push(columnCollectionItem);
|
|
227
|
+
});
|
|
228
|
+
return columnCollection;
|
|
229
|
+
},
|
|
230
|
+
// expand column
|
|
231
|
+
expandColumn() {
|
|
232
|
+
return this.colgroups.find((x) => x.type === COLUMN_TYPES.EXPAND);
|
|
233
|
+
},
|
|
234
|
+
/*
|
|
235
|
+
是否是可控行展开
|
|
236
|
+
1、当设置了 expandedRowKeys 属性时则为可控行展开
|
|
237
|
+
*/
|
|
238
|
+
isControlledExpand() {
|
|
239
|
+
return (
|
|
240
|
+
this.expandOption &&
|
|
241
|
+
Array.isArray(this.expandOption.expandedRowKeys)
|
|
242
|
+
);
|
|
243
|
+
},
|
|
244
|
+
|
|
245
|
+
// expanded row keys
|
|
246
|
+
expandedRowkeys() {
|
|
247
|
+
return this.isControlledExpand
|
|
248
|
+
? this.expandOption.expandedRowKeys
|
|
249
|
+
: this.internalExpandRowkeys;
|
|
250
|
+
},
|
|
251
|
+
|
|
252
|
+
// disable row selected row keys
|
|
253
|
+
disableCheckboxSelectedRowKeys() {
|
|
254
|
+
let result = [];
|
|
255
|
+
|
|
256
|
+
const { checkboxOption, internalCheckboxSelectedRowKeys } = this;
|
|
257
|
+
|
|
258
|
+
if (!checkboxOption) {
|
|
259
|
+
return result;
|
|
260
|
+
}
|
|
261
|
+
const { disableSelectedRowKeys } = checkboxOption;
|
|
262
|
+
|
|
263
|
+
if (
|
|
264
|
+
internalCheckboxSelectedRowKeys.length > 0 &&
|
|
265
|
+
Array.isArray(disableSelectedRowKeys) &&
|
|
266
|
+
disableSelectedRowKeys.length > 0
|
|
267
|
+
) {
|
|
268
|
+
disableSelectedRowKeys.forEach((rowkey) => {
|
|
269
|
+
if (internalCheckboxSelectedRowKeys.includes(rowkey)) {
|
|
270
|
+
result.push(rowkey);
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
return result;
|
|
276
|
+
},
|
|
277
|
+
|
|
278
|
+
// disable row unselected row keys
|
|
279
|
+
disableCheckboxUnselectedRowKeys() {
|
|
280
|
+
let result = [];
|
|
281
|
+
|
|
282
|
+
const { checkboxOption, internalCheckboxSelectedRowKeys } = this;
|
|
283
|
+
|
|
284
|
+
if (!checkboxOption) {
|
|
285
|
+
return result;
|
|
286
|
+
}
|
|
287
|
+
const { disableSelectedRowKeys } = checkboxOption;
|
|
288
|
+
|
|
289
|
+
if (
|
|
290
|
+
Array.isArray(disableSelectedRowKeys) &&
|
|
291
|
+
disableSelectedRowKeys.length > 0
|
|
292
|
+
) {
|
|
293
|
+
disableSelectedRowKeys.forEach((rowkey) => {
|
|
294
|
+
if (!internalCheckboxSelectedRowKeys.includes(rowkey)) {
|
|
295
|
+
result.push(rowkey);
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
return result;
|
|
301
|
+
},
|
|
302
|
+
|
|
303
|
+
/*
|
|
304
|
+
is row keys selected all
|
|
305
|
+
为 true 的条件:选中数量 + 禁用选中数量 === 总量
|
|
306
|
+
*/
|
|
307
|
+
isCheckboxSelectedAll() {
|
|
308
|
+
if (this.allRowKeys.length > 0) {
|
|
309
|
+
if (
|
|
310
|
+
this.internalCheckboxSelectedRowKeys.length +
|
|
311
|
+
this.disableCheckboxUnselectedRowKeys.length ===
|
|
312
|
+
this.allRowKeys.length
|
|
313
|
+
) {
|
|
314
|
+
return true;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
return false;
|
|
319
|
+
},
|
|
320
|
+
// is checkbox indeterminate
|
|
321
|
+
isCheckboxIndeterminate() {
|
|
322
|
+
const { internalCheckboxSelectedRowKeys, allRowKeys } = this;
|
|
323
|
+
|
|
324
|
+
return (
|
|
325
|
+
internalCheckboxSelectedRowKeys.length > 0 &&
|
|
326
|
+
internalCheckboxSelectedRowKeys.length < allRowKeys.length
|
|
327
|
+
);
|
|
328
|
+
},
|
|
329
|
+
// 是否是受控属性(取决于selectedRowKey)
|
|
330
|
+
isControlledRadio() {
|
|
331
|
+
const { radioOption } = this;
|
|
332
|
+
|
|
333
|
+
return (
|
|
334
|
+
radioOption &&
|
|
335
|
+
Object.keys(radioOption).includes("selectedRowKey")
|
|
336
|
+
);
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
watch: {
|
|
340
|
+
// watch expand Option
|
|
341
|
+
expandOption: {
|
|
342
|
+
handler: function () {
|
|
343
|
+
this.initInternalExpandRowKeys();
|
|
344
|
+
},
|
|
345
|
+
immediate: true,
|
|
346
|
+
},
|
|
347
|
+
// watch expandOption expandedRowKeys
|
|
348
|
+
"expandOption.expandedRowKeys": {
|
|
349
|
+
handler: function () {
|
|
350
|
+
this.initInternalExpandRowKeys();
|
|
351
|
+
},
|
|
352
|
+
},
|
|
353
|
+
// watch checkbox option
|
|
354
|
+
checkboxOption: {
|
|
355
|
+
handler: function () {
|
|
356
|
+
this.initInternalCheckboxSelectedRowKeys();
|
|
357
|
+
},
|
|
358
|
+
immediate: true,
|
|
359
|
+
},
|
|
360
|
+
// watch selectedRowKeys
|
|
361
|
+
"checkboxOption.selectedRowKeys": {
|
|
362
|
+
handler: function () {
|
|
363
|
+
this.resetInternalCheckboxSelectedRowKeys();
|
|
364
|
+
},
|
|
365
|
+
},
|
|
366
|
+
// watch internalCheckboxSelectedRowKeys
|
|
367
|
+
internalCheckboxSelectedRowKeys: {
|
|
368
|
+
handler: function () {
|
|
369
|
+
// send to checkbox all(in header)
|
|
370
|
+
this.sendToCheckboxAll();
|
|
371
|
+
},
|
|
372
|
+
},
|
|
373
|
+
// watch checkbox option
|
|
374
|
+
radioOption: {
|
|
375
|
+
handler: function () {
|
|
376
|
+
this.initInternalRadioSelectedRowKey();
|
|
377
|
+
},
|
|
378
|
+
immediate: true,
|
|
379
|
+
},
|
|
380
|
+
// watch selectedRowKeys
|
|
381
|
+
"radioOption.selectedRowKey": {
|
|
382
|
+
handler: function () {
|
|
383
|
+
this.initInternalRadioSelectedRowKey();
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
},
|
|
387
|
+
methods: {
|
|
388
|
+
// is last left fixed column
|
|
389
|
+
isLastLeftFixedColumn(column) {
|
|
390
|
+
let result = false;
|
|
391
|
+
|
|
392
|
+
const { colgroups } = this;
|
|
393
|
+
|
|
394
|
+
const { fixed } = column;
|
|
395
|
+
|
|
396
|
+
if (fixed === "left") {
|
|
397
|
+
const { field } = column;
|
|
398
|
+
const leftFixedColumns = colgroups.filter(
|
|
399
|
+
(x) => x.fixed === "left",
|
|
400
|
+
);
|
|
401
|
+
const index = leftFixedColumns.findIndex(
|
|
402
|
+
(x) => x.field === field,
|
|
403
|
+
);
|
|
404
|
+
|
|
405
|
+
if (index === leftFixedColumns.length - 1) {
|
|
406
|
+
result = true;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
return result;
|
|
410
|
+
},
|
|
411
|
+
|
|
412
|
+
// is first right fixed column
|
|
413
|
+
isfirstRightFixedColumn(column) {
|
|
414
|
+
let result = false;
|
|
415
|
+
|
|
416
|
+
const { colgroups } = this;
|
|
417
|
+
|
|
418
|
+
const { fixed } = column;
|
|
419
|
+
|
|
420
|
+
if (fixed === "right") {
|
|
421
|
+
const { field } = column;
|
|
422
|
+
const rightFixedColumns = colgroups.filter(
|
|
423
|
+
(x) => x.fixed === "right",
|
|
424
|
+
);
|
|
425
|
+
|
|
426
|
+
if (rightFixedColumns[0].field === field) {
|
|
427
|
+
result = true;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
return result;
|
|
431
|
+
},
|
|
432
|
+
|
|
433
|
+
/*
|
|
434
|
+
* @expandRowChange
|
|
435
|
+
* @desc row expand change
|
|
436
|
+
* @param {object} rowData - row data
|
|
437
|
+
* @param {number} rowIndex - row index
|
|
438
|
+
*/
|
|
439
|
+
expandRowChange(rowData, rowIndex) {
|
|
440
|
+
const {
|
|
441
|
+
expandOption,
|
|
442
|
+
internalExpandRowkeys,
|
|
443
|
+
expandedRowkeys,
|
|
444
|
+
rowKeyFieldName,
|
|
445
|
+
} = this;
|
|
446
|
+
|
|
447
|
+
// deal before expand row method
|
|
448
|
+
if (typeof expandOption.beforeExpandRowChange === "function") {
|
|
449
|
+
const beforeExpandRowResult =
|
|
450
|
+
expandOption.beforeExpandRowChange({
|
|
451
|
+
beforeExpandedRowKeys: expandedRowkeys,
|
|
452
|
+
row: rowData,
|
|
453
|
+
rowIndex,
|
|
454
|
+
});
|
|
455
|
+
// interrupt execute
|
|
456
|
+
if (beforeExpandRowResult === false) {
|
|
457
|
+
return false;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
const rowKey = rowData[rowKeyFieldName];
|
|
462
|
+
|
|
463
|
+
const rowKeyIndex = internalExpandRowkeys.indexOf(rowKey);
|
|
464
|
+
if (rowKeyIndex > -1) {
|
|
465
|
+
internalExpandRowkeys.splice(rowKeyIndex, 1);
|
|
466
|
+
} else {
|
|
467
|
+
internalExpandRowkeys.push(rowKey);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
// deal after expand row method
|
|
471
|
+
if (typeof expandOption.afterExpandRowChange === "function") {
|
|
472
|
+
expandOption.afterExpandRowChange({
|
|
473
|
+
afterExpandedRowKeys: internalExpandRowkeys,
|
|
474
|
+
row: rowData,
|
|
475
|
+
rowIndex,
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
},
|
|
479
|
+
|
|
480
|
+
/*
|
|
481
|
+
* @rowClick
|
|
482
|
+
* @desc row expand click event
|
|
483
|
+
* @param {object} rowData - row data
|
|
484
|
+
* @param {number} rowIndex - row index
|
|
485
|
+
*/
|
|
486
|
+
rowClick({ rowData, rowIndex }) {
|
|
487
|
+
const {
|
|
488
|
+
expandOption,
|
|
489
|
+
isExpandRow,
|
|
490
|
+
expandRowChange,
|
|
491
|
+
rowKeyFieldName,
|
|
492
|
+
} = this;
|
|
493
|
+
|
|
494
|
+
// 行高亮功能
|
|
495
|
+
if (rowKeyFieldName) {
|
|
496
|
+
const rowKey = rowData[rowKeyFieldName];
|
|
497
|
+
this.$emit(EMIT_EVENTS.HIGHLIGHT_ROW_CHANGE, { rowKey });
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
// 行展开功能
|
|
501
|
+
if (!isExpandRow({ rowData, rowIndex })) {
|
|
502
|
+
return false;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
const trigger = expandOption.trigger;
|
|
506
|
+
|
|
507
|
+
// expand row by click row
|
|
508
|
+
if (trigger === EXPAND_TRIGGER_TYPES.ROW) {
|
|
509
|
+
expandRowChange(rowData, rowIndex);
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
|
|
513
|
+
/*
|
|
514
|
+
* @isExpandRow
|
|
515
|
+
* @desc is expand row
|
|
516
|
+
* @param {object} rowData - row data
|
|
517
|
+
* @param {number} rowIndex - row index
|
|
518
|
+
*/
|
|
519
|
+
isExpandRow({ rowData, rowIndex }) {
|
|
520
|
+
let result = false;
|
|
521
|
+
|
|
522
|
+
const { expandColumn, expandOption } = this;
|
|
523
|
+
|
|
524
|
+
if (expandColumn && expandOption) {
|
|
525
|
+
// 是否允许展开
|
|
526
|
+
let expandable = true;
|
|
527
|
+
if (typeof expandOption.expandable === "function") {
|
|
528
|
+
expandable = expandOption.expandable({
|
|
529
|
+
row: rowData,
|
|
530
|
+
column: expandColumn,
|
|
531
|
+
rowIndex,
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
if (expandable !== false) {
|
|
536
|
+
result = true;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
return result;
|
|
541
|
+
},
|
|
542
|
+
|
|
543
|
+
/*
|
|
544
|
+
* @tdSizeChange
|
|
545
|
+
* @desc td size change
|
|
546
|
+
* @param {any} key - column key
|
|
547
|
+
* @param {number|string} width - column real width
|
|
548
|
+
*/
|
|
549
|
+
tdSizeChange({ key, width }) {
|
|
550
|
+
const { colsWidths } = this;
|
|
551
|
+
colsWidths.set(key, width);
|
|
552
|
+
this.$emit(EMIT_EVENTS.BODY_CELL_WIDTH_CHANGE, colsWidths);
|
|
553
|
+
},
|
|
554
|
+
|
|
555
|
+
// init internal expand row keys
|
|
556
|
+
initInternalExpandRowKeys() {
|
|
557
|
+
const { expandOption, isControlledExpand, allRowKeys } = this;
|
|
558
|
+
|
|
559
|
+
if (!expandOption) {
|
|
560
|
+
return false;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
if (isControlledExpand) {
|
|
564
|
+
this.internalExpandRowkeys =
|
|
565
|
+
expandOption.expandedRowKeys.slice(0);
|
|
566
|
+
} else if (expandOption.defaultExpandAllRows) {
|
|
567
|
+
this.internalExpandRowkeys = allRowKeys;
|
|
568
|
+
} else if (expandOption.defaultExpandedRowKeys) {
|
|
569
|
+
this.internalExpandRowkeys =
|
|
570
|
+
expandOption.defaultExpandedRowKeys.slice(0);
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
// get expand row
|
|
574
|
+
getExpandRowComp({ rowData, rowIndex }) {
|
|
575
|
+
if (this.isExpandRow({ rowData, rowIndex })) {
|
|
576
|
+
const expandTrProps = {
|
|
577
|
+
props: {
|
|
578
|
+
tableViewportWidth: this.tableViewportWidth,
|
|
579
|
+
colgroups: this.colgroups,
|
|
580
|
+
expandOption: this.expandOption,
|
|
581
|
+
expandedRowkeys: this.expandedRowkeys,
|
|
582
|
+
expandColumn: this.expandColumn,
|
|
583
|
+
rowKeyFieldName: this.rowKeyFieldName,
|
|
584
|
+
rowData,
|
|
585
|
+
rowIndex,
|
|
586
|
+
},
|
|
587
|
+
};
|
|
588
|
+
|
|
589
|
+
return <ExpandTr {...expandTrProps} />;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
return null;
|
|
593
|
+
},
|
|
594
|
+
|
|
595
|
+
// send to checkbox all
|
|
596
|
+
sendToCheckboxAll() {
|
|
597
|
+
const { isCheckboxSelectedAll, isCheckboxIndeterminate } = this;
|
|
598
|
+
|
|
599
|
+
this.dispatch(
|
|
600
|
+
COMPS_NAME.VE_TABLE,
|
|
601
|
+
EMIT_EVENTS.CHECKBOX_SELECTED_ALL_INFO,
|
|
602
|
+
{
|
|
603
|
+
isIndeterminate: isCheckboxIndeterminate,
|
|
604
|
+
isSelected: isCheckboxSelectedAll,
|
|
605
|
+
},
|
|
606
|
+
);
|
|
607
|
+
},
|
|
608
|
+
|
|
609
|
+
// init internal Radio SelectedRowKey
|
|
610
|
+
initInternalRadioSelectedRowKey() {
|
|
611
|
+
const { radioOption, isControlledRadio } = this;
|
|
612
|
+
|
|
613
|
+
if (!radioOption) {
|
|
614
|
+
return false;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
const { selectedRowKey, defaultSelectedRowKey } = radioOption;
|
|
618
|
+
|
|
619
|
+
this.internalRadioSelectedRowKey = isControlledRadio
|
|
620
|
+
? selectedRowKey
|
|
621
|
+
: defaultSelectedRowKey;
|
|
622
|
+
},
|
|
623
|
+
|
|
624
|
+
// init internal Checkbox SelectedRowKeys
|
|
625
|
+
initInternalCheckboxSelectedRowKeys() {
|
|
626
|
+
let result = [];
|
|
627
|
+
const { checkboxOption, allRowKeys } = this;
|
|
628
|
+
|
|
629
|
+
if (!checkboxOption) {
|
|
630
|
+
return false;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
const {
|
|
634
|
+
selectedRowKeys,
|
|
635
|
+
defaultSelectedAllRows,
|
|
636
|
+
defaultSelectedRowKeys,
|
|
637
|
+
} = checkboxOption;
|
|
638
|
+
|
|
639
|
+
if (Array.isArray(selectedRowKeys)) {
|
|
640
|
+
result = selectedRowKeys;
|
|
641
|
+
} else if (defaultSelectedAllRows) {
|
|
642
|
+
result = allRowKeys;
|
|
643
|
+
} else if (Array.isArray(defaultSelectedRowKeys)) {
|
|
644
|
+
result = defaultSelectedRowKeys;
|
|
645
|
+
}
|
|
646
|
+
this.internalCheckboxSelectedRowKeys = result;
|
|
647
|
+
},
|
|
648
|
+
// reset internalCheckboxSelectedRowKeys by selectedRowKeys
|
|
649
|
+
resetInternalCheckboxSelectedRowKeys() {
|
|
650
|
+
this.internalCheckboxSelectedRowKeys =
|
|
651
|
+
this.checkboxOption.selectedRowKeys.slice(0);
|
|
652
|
+
},
|
|
653
|
+
|
|
654
|
+
/*
|
|
655
|
+
* @checkboxSelectedRowChange
|
|
656
|
+
* @desc selected row change
|
|
657
|
+
* @param {number|string} rowKey - rowKey
|
|
658
|
+
* @param {bool} isSelected
|
|
659
|
+
*/
|
|
660
|
+
checkboxSelectedRowChange({ rowKey, isSelected }) {
|
|
661
|
+
const {
|
|
662
|
+
checkboxOption,
|
|
663
|
+
internalCheckboxSelectedRowKeys,
|
|
664
|
+
rowKeyFieldName,
|
|
665
|
+
} = this;
|
|
666
|
+
const { selectedRowChange, selectedRowKeys } = checkboxOption;
|
|
667
|
+
|
|
668
|
+
let internalCheckboxSelectedRowKeysTemp =
|
|
669
|
+
internalCheckboxSelectedRowKeys.slice(0);
|
|
670
|
+
|
|
671
|
+
// will selected
|
|
672
|
+
const rowKeyIndex =
|
|
673
|
+
internalCheckboxSelectedRowKeysTemp.indexOf(rowKey);
|
|
674
|
+
if (isSelected) {
|
|
675
|
+
// bug fixed:通过行点击触发,导致key重复的问题
|
|
676
|
+
if (rowKeyIndex === -1) {
|
|
677
|
+
internalCheckboxSelectedRowKeysTemp.push(rowKey);
|
|
678
|
+
}
|
|
679
|
+
} else {
|
|
680
|
+
if (rowKeyIndex > -1) {
|
|
681
|
+
internalCheckboxSelectedRowKeysTemp.splice(rowKeyIndex, 1);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
// 非可控才改变 internalCheckboxSelectedRowKeys
|
|
686
|
+
if (!Array.isArray(selectedRowKeys)) {
|
|
687
|
+
this.internalCheckboxSelectedRowKeys =
|
|
688
|
+
internalCheckboxSelectedRowKeysTemp;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
selectedRowChange({
|
|
692
|
+
row: this.actualRenderTableData.find(
|
|
693
|
+
(x) => x[rowKeyFieldName] === rowKey,
|
|
694
|
+
),
|
|
695
|
+
isSelected,
|
|
696
|
+
selectedRowKeys: internalCheckboxSelectedRowKeysTemp,
|
|
697
|
+
});
|
|
698
|
+
},
|
|
699
|
+
|
|
700
|
+
/*
|
|
701
|
+
* @checkboxSelectedAllChange
|
|
702
|
+
* @desc selected all change
|
|
703
|
+
* @param {bool} isSelected - is selected
|
|
704
|
+
*/
|
|
705
|
+
checkboxSelectedAllChange({ isSelected }) {
|
|
706
|
+
const {
|
|
707
|
+
checkboxOption,
|
|
708
|
+
internalCheckboxSelectedRowKeys,
|
|
709
|
+
allRowKeys,
|
|
710
|
+
disableCheckboxSelectedRowKeys,
|
|
711
|
+
disableCheckboxUnselectedRowKeys,
|
|
712
|
+
} = this;
|
|
713
|
+
const { selectedAllChange, selectedRowKeys } = checkboxOption;
|
|
714
|
+
|
|
715
|
+
let internalCheckboxSelectedRowKeysTemp =
|
|
716
|
+
internalCheckboxSelectedRowKeys.slice(0);
|
|
717
|
+
// selected all
|
|
718
|
+
if (isSelected) {
|
|
719
|
+
// except disable Row Unselected keys
|
|
720
|
+
let allSelectedKeys = allRowKeys.slice(0);
|
|
721
|
+
if (disableCheckboxUnselectedRowKeys.length > 0) {
|
|
722
|
+
disableCheckboxUnselectedRowKeys.forEach((rowkey) => {
|
|
723
|
+
let index = allSelectedKeys.indexOf(rowkey);
|
|
724
|
+
if (index > -1) {
|
|
725
|
+
allSelectedKeys.splice(index, 1);
|
|
726
|
+
}
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
internalCheckboxSelectedRowKeysTemp = allSelectedKeys;
|
|
731
|
+
} else {
|
|
732
|
+
// except disable Row Selected keys
|
|
733
|
+
internalCheckboxSelectedRowKeysTemp =
|
|
734
|
+
disableCheckboxSelectedRowKeys;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
// 非可控才改变 internalCheckboxSelectedRowKeys
|
|
738
|
+
if (!Array.isArray(selectedRowKeys)) {
|
|
739
|
+
this.internalCheckboxSelectedRowKeys =
|
|
740
|
+
internalCheckboxSelectedRowKeysTemp;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
selectedAllChange &&
|
|
744
|
+
selectedAllChange({
|
|
745
|
+
isSelected,
|
|
746
|
+
selectedRowKeys: internalCheckboxSelectedRowKeysTemp,
|
|
747
|
+
//changeRowKeys:
|
|
748
|
+
});
|
|
749
|
+
},
|
|
750
|
+
|
|
751
|
+
/*
|
|
752
|
+
* @radioSelectedRowChange
|
|
753
|
+
* @desc selected all change
|
|
754
|
+
* @param {number|string} rowKey - rowKey
|
|
755
|
+
*/
|
|
756
|
+
radioSelectedRowChange({ rowKey }) {
|
|
757
|
+
const { radioOption, rowKeyFieldName, isControlledRadio } = this;
|
|
758
|
+
|
|
759
|
+
const { selectedRowChange } = radioOption;
|
|
760
|
+
|
|
761
|
+
// 非受控
|
|
762
|
+
if (!isControlledRadio) {
|
|
763
|
+
this.internalRadioSelectedRowKey = rowKey;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
selectedRowChange({
|
|
767
|
+
row: this.actualRenderTableData.find(
|
|
768
|
+
(x) => x[rowKeyFieldName] === rowKey,
|
|
769
|
+
),
|
|
770
|
+
});
|
|
771
|
+
},
|
|
772
|
+
// get tr key
|
|
773
|
+
getTrKey({ rowData, rowIndex }) {
|
|
774
|
+
let result = rowIndex;
|
|
775
|
+
|
|
776
|
+
const { rowKeyFieldName } = this;
|
|
777
|
+
if (rowKeyFieldName) {
|
|
778
|
+
result = rowData[rowKeyFieldName];
|
|
779
|
+
}
|
|
780
|
+
return result;
|
|
781
|
+
},
|
|
782
|
+
|
|
783
|
+
/*
|
|
784
|
+
rendering row keys
|
|
785
|
+
virtual scrolling will invoke
|
|
786
|
+
*/
|
|
787
|
+
renderingRowKeys(rowKeys) {
|
|
788
|
+
const {
|
|
789
|
+
virtualScrollPreviewRenderedRowKeys: previewRenderedRowKeys,
|
|
790
|
+
} = this;
|
|
791
|
+
|
|
792
|
+
this.virtualScrollRepeatRenderedRowKeys = rowKeys.filter(
|
|
793
|
+
(rowKey) => {
|
|
794
|
+
return previewRenderedRowKeys.indexOf(rowKey) != -1;
|
|
795
|
+
},
|
|
796
|
+
);
|
|
797
|
+
|
|
798
|
+
this.virtualScrollPreviewRenderedRowKeys = rowKeys;
|
|
799
|
+
},
|
|
800
|
+
},
|
|
801
|
+
mounted() {
|
|
802
|
+
// receive checkbox row selected change from VE_TABLE_BODY_CHECKBOX_CONTENT
|
|
803
|
+
this.$on(EMIT_EVENTS.CHECKBOX_SELECTED_ROW_CHANGE, (params) => {
|
|
804
|
+
this.checkboxSelectedRowChange(params);
|
|
805
|
+
});
|
|
806
|
+
|
|
807
|
+
// receive checkbox row selected change from VE_TABLE_BODY_CHECKBOX_CONTENT
|
|
808
|
+
this.$on(EMIT_EVENTS.CHECKBOX_SELECTED_ALL_CHANGE, (params) => {
|
|
809
|
+
this.checkboxSelectedAllChange(params);
|
|
810
|
+
});
|
|
811
|
+
|
|
812
|
+
// receive radio row selected change from VE_TABLE_BODY_RADIO_CONTENT
|
|
813
|
+
this.$on(EMIT_EVENTS.RADIO_SELECTED_ROW_CHANGE, (params) => {
|
|
814
|
+
this.radioSelectedRowChange(params);
|
|
815
|
+
});
|
|
816
|
+
|
|
817
|
+
// recieve tr click
|
|
818
|
+
this.$on(EMIT_EVENTS.BODY_ROW_CLICK, (params) => {
|
|
819
|
+
this.rowClick(params);
|
|
820
|
+
});
|
|
821
|
+
|
|
822
|
+
if (this.checkboxOption) {
|
|
823
|
+
// 这里 nextTick 解决由于子组件先初始化,导致父组件无法接收消息的问题
|
|
824
|
+
this.$nextTick(() => {
|
|
825
|
+
this.sendToCheckboxAll();
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
},
|
|
829
|
+
render() {
|
|
830
|
+
const {
|
|
831
|
+
colgroups,
|
|
832
|
+
actualRenderTableData,
|
|
833
|
+
expandOption,
|
|
834
|
+
expandRowChange,
|
|
835
|
+
isExpandRow,
|
|
836
|
+
getExpandRowComp,
|
|
837
|
+
expandedRowkeys,
|
|
838
|
+
checkboxOption,
|
|
839
|
+
radioOption,
|
|
840
|
+
rowKeyFieldName,
|
|
841
|
+
tdSizeChange,
|
|
842
|
+
internalCheckboxSelectedRowKeys,
|
|
843
|
+
internalRadioSelectedRowKey,
|
|
844
|
+
isVirtualScroll,
|
|
845
|
+
cellStyleOption,
|
|
846
|
+
showVirtualScrollingPlaceholder,
|
|
847
|
+
} = this;
|
|
848
|
+
|
|
849
|
+
const { virtualScrollRepeatRenderedRowKeys } = this;
|
|
850
|
+
|
|
851
|
+
return (
|
|
852
|
+
<tbody>
|
|
853
|
+
{/* Measure each column width with additional hidden col */}
|
|
854
|
+
<tr style="height:0;">
|
|
855
|
+
{colgroups.map((column) => {
|
|
856
|
+
const measureTdProps = {
|
|
857
|
+
key: getDomResizeObserverCompKey(
|
|
858
|
+
column.key,
|
|
859
|
+
this.columnsOptionResetTime,
|
|
860
|
+
),
|
|
861
|
+
props: {
|
|
862
|
+
tagName: "td",
|
|
863
|
+
id: column.key,
|
|
864
|
+
},
|
|
865
|
+
on: {
|
|
866
|
+
"on-dom-resize-change": tdSizeChange,
|
|
867
|
+
},
|
|
868
|
+
style: {
|
|
869
|
+
padding: 0,
|
|
870
|
+
border: 0,
|
|
871
|
+
height: 0,
|
|
872
|
+
},
|
|
873
|
+
};
|
|
874
|
+
return <VueDomResizeObserver {...measureTdProps} />;
|
|
875
|
+
})}
|
|
876
|
+
</tr>
|
|
877
|
+
{actualRenderTableData.map((rowData, rowIndex) => {
|
|
878
|
+
const trProps = {
|
|
879
|
+
key: this.getTrKey({ rowData, rowIndex }),
|
|
880
|
+
props: {
|
|
881
|
+
rowIndex,
|
|
882
|
+
rowData,
|
|
883
|
+
colgroups,
|
|
884
|
+
expandOption,
|
|
885
|
+
expandedRowkeys,
|
|
886
|
+
checkboxOption,
|
|
887
|
+
radioOption,
|
|
888
|
+
rowKeyFieldName,
|
|
889
|
+
allRowKeys: this.allRowKeys,
|
|
890
|
+
expandRowChange,
|
|
891
|
+
internalCheckboxSelectedRowKeys,
|
|
892
|
+
internalRadioSelectedRowKey,
|
|
893
|
+
isVirtualScroll,
|
|
894
|
+
isExpandRow: isExpandRow({
|
|
895
|
+
rowData,
|
|
896
|
+
rowIndex,
|
|
897
|
+
}),
|
|
898
|
+
cellStyleOption,
|
|
899
|
+
cellSpanOption: this.cellSpanOption,
|
|
900
|
+
highlightRowKey: this.highlightRowKey,
|
|
901
|
+
eventCustomOption: this.eventCustomOption,
|
|
902
|
+
cellSelectionData: this.cellSelectionData,
|
|
903
|
+
editOption: this.editOption,
|
|
904
|
+
columnCollection: this.columnCollection,
|
|
905
|
+
cellSelectionRangeData: this.cellSelectionRangeData,
|
|
906
|
+
bodyIndicatorRowKeys: this.bodyIndicatorRowKeys,
|
|
907
|
+
},
|
|
908
|
+
};
|
|
909
|
+
|
|
910
|
+
if (showVirtualScrollingPlaceholder) {
|
|
911
|
+
const trPropsScrolling = {
|
|
912
|
+
key: this.getTrKey({ rowData, rowIndex }),
|
|
913
|
+
props: {
|
|
914
|
+
colgroups,
|
|
915
|
+
},
|
|
916
|
+
};
|
|
917
|
+
|
|
918
|
+
if (
|
|
919
|
+
virtualScrollRepeatRenderedRowKeys.indexOf(
|
|
920
|
+
rowData[this.rowKeyFieldName],
|
|
921
|
+
) != -1
|
|
922
|
+
) {
|
|
923
|
+
return [
|
|
924
|
+
// body tr
|
|
925
|
+
<BodyTr {...trProps} />,
|
|
926
|
+
];
|
|
927
|
+
} else {
|
|
928
|
+
return <BodyTrScrolling {...trPropsScrolling} />;
|
|
929
|
+
}
|
|
930
|
+
} else {
|
|
931
|
+
return [
|
|
932
|
+
// body tr
|
|
933
|
+
<BodyTr {...trProps} />,
|
|
934
|
+
// expand row
|
|
935
|
+
getExpandRowComp({ rowData, rowIndex }),
|
|
936
|
+
];
|
|
937
|
+
}
|
|
938
|
+
})}
|
|
939
|
+
{this.$slots.default}
|
|
940
|
+
</tbody>
|
|
941
|
+
);
|
|
942
|
+
},
|
|
943
|
+
};
|