vxe-table 3.10.15 → 3.11.0
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/README.md +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/custom/mixin.js +5 -1
- package/es/table/module/edit/mixin.js +24 -15
- package/es/table/module/validator/mixin.js +31 -10
- package/es/table/src/body.js +40 -24
- package/es/table/src/cell.js +75 -32
- package/es/table/src/footer.js +159 -131
- package/es/table/src/header.js +128 -90
- package/es/table/src/methods.js +292 -66
- package/es/table/src/props.js +5 -1
- package/es/table/src/table.js +64 -20
- package/es/table/style.css +33 -20
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +9 -4
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +33 -20
- package/es/vxe-table/style.min.css +1 -1
- package/helper/vetur/attributes.json +1 -1
- package/helper/vetur/tags.json +1 -1
- package/lib/index.umd.js +945 -460
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/custom/mixin.js +5 -1
- package/lib/table/module/custom/mixin.min.js +1 -1
- package/lib/table/module/edit/mixin.js +24 -15
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/validator/mixin.js +31 -10
- package/lib/table/module/validator/mixin.min.js +1 -1
- package/lib/table/src/body.js +31 -15
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +82 -35
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/footer.js +198 -161
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +169 -128
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +321 -69
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/props.js +5 -1
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +70 -20
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +33 -20
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +9 -4
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-table/style/style.css +33 -20
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +3 -3
- package/packages/table/module/custom/mixin.ts +5 -1
- package/packages/table/module/edit/mixin.ts +24 -15
- package/packages/table/module/validator/mixin.ts +33 -10
- package/packages/table/src/body.ts +43 -25
- package/packages/table/src/cell.ts +120 -67
- package/packages/table/src/footer.ts +164 -150
- package/packages/table/src/header.ts +136 -90
- package/packages/table/src/methods.ts +304 -68
- package/packages/table/src/props.ts +5 -1
- package/packages/table/src/table.ts +71 -19
- package/packages/ui/index.ts +8 -3
- package/styles/components/table.scss +42 -35
- /package/es/{iconfont.1731574584971.ttf → iconfont.1731890707082.ttf} +0 -0
- /package/es/{iconfont.1731574584971.woff → iconfont.1731890707082.woff} +0 -0
- /package/es/{iconfont.1731574584971.woff2 → iconfont.1731890707082.woff2} +0 -0
- /package/lib/{iconfont.1731574584971.ttf → iconfont.1731890707082.ttf} +0 -0
- /package/lib/{iconfont.1731574584971.woff → iconfont.1731890707082.woff} +0 -0
- /package/lib/{iconfont.1731574584971.woff2 → iconfont.1731890707082.woff2} +0 -0
|
@@ -5,6 +5,8 @@ import { scrollToView } from '../../../ui/src/dom'
|
|
|
5
5
|
import { handleFieldOrColumn, getRowid } from '../../src/util'
|
|
6
6
|
import { warnLog, errLog } from '../../../ui/src/log'
|
|
7
7
|
|
|
8
|
+
import type { VxeTableDefines } from '../../../../types'
|
|
9
|
+
|
|
8
10
|
const { getConfig, validators } = VxeUI
|
|
9
11
|
|
|
10
12
|
/**
|
|
@@ -73,7 +75,7 @@ export default {
|
|
|
73
75
|
warnLog('vxe.error.notValidators', ['fullValidate(rows, callback)', 'fullValidate(rows)'])
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
|
-
return this.beginValidate(rows, cb, true)
|
|
78
|
+
return this.beginValidate(rows, null, cb, true)
|
|
77
79
|
},
|
|
78
80
|
/**
|
|
79
81
|
* 快速校验,如果存在记录不通过的记录,则返回不再继续校验(异步校验除外)
|
|
@@ -84,7 +86,27 @@ export default {
|
|
|
84
86
|
warnLog('vxe.error.notValidators', ['validate(rows, callback)', 'validate(rows)'])
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
|
-
return this.beginValidate(rows, cb)
|
|
89
|
+
return this.beginValidate(rows, null, cb)
|
|
90
|
+
},
|
|
91
|
+
/**
|
|
92
|
+
* 完整校验单元格,和 validateField 的区别就是会给有效数据中的每一行进行校验
|
|
93
|
+
*/
|
|
94
|
+
_fullValidateField (rows: any, fieldOrColumn: any) {
|
|
95
|
+
const colList = (XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : (fieldOrColumn ? [fieldOrColumn] : [])).map(column => handleFieldOrColumn(this, column))
|
|
96
|
+
if (colList.length) {
|
|
97
|
+
return this.beginValidate(rows, colList, null, true)
|
|
98
|
+
}
|
|
99
|
+
return this.$nextTick()
|
|
100
|
+
},
|
|
101
|
+
/**
|
|
102
|
+
* 快速校验单元格,如果存在记录不通过的记录,则返回不再继续校验(异步校验除外)
|
|
103
|
+
*/
|
|
104
|
+
_validateField (rows: any, fieldOrColumn: any) {
|
|
105
|
+
const colList = (XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : (fieldOrColumn ? [fieldOrColumn] : [])).map(column => handleFieldOrColumn(this, column))
|
|
106
|
+
if (colList.length) {
|
|
107
|
+
return this.beginValidate(rows, colList, null)
|
|
108
|
+
}
|
|
109
|
+
return this.$nextTick()
|
|
88
110
|
},
|
|
89
111
|
/**
|
|
90
112
|
* 聚焦到校验通过的单元格并弹出校验错误提示
|
|
@@ -131,7 +153,7 @@ export default {
|
|
|
131
153
|
* 如果只传 callback 否则默认验证整个表格数据
|
|
132
154
|
* 返回 Promise 对象,或者使用回调方式
|
|
133
155
|
*/
|
|
134
|
-
beginValidate (rows: any, cb: any, isFull: any) {
|
|
156
|
+
beginValidate (rows: any, cols: VxeTableDefines.ColumnInfo[] | null, cb: any, isFull: any) {
|
|
135
157
|
const validRest: any = {}
|
|
136
158
|
const { editRules, afterFullData, visibleColumn, treeConfig, treeOpts } = this
|
|
137
159
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
@@ -154,12 +176,13 @@ export default {
|
|
|
154
176
|
this.clearValidate()
|
|
155
177
|
const validErrMaps: any = {}
|
|
156
178
|
if (editRules) {
|
|
157
|
-
const columns = this.getColumns()
|
|
179
|
+
const columns = cols && cols.length ? cols : this.getColumns()
|
|
158
180
|
const handleVaild = (row: any) => {
|
|
159
181
|
if (isFull || !this.validRuleErr) {
|
|
160
182
|
const colVailds: any[] = []
|
|
161
183
|
columns.forEach((column: any) => {
|
|
162
|
-
|
|
184
|
+
const field = XEUtils.isString(column) ? column : column.field
|
|
185
|
+
if ((isFull || !this.validRuleErr) && XEUtils.has(editRules, field)) {
|
|
163
186
|
colVailds.push(
|
|
164
187
|
this.validCellRules('all', row, column)
|
|
165
188
|
.catch(({ rule, rules }: any) => {
|
|
@@ -170,11 +193,11 @@ export default {
|
|
|
170
193
|
row,
|
|
171
194
|
columnIndex: this.getColumnIndex(column),
|
|
172
195
|
column,
|
|
173
|
-
field
|
|
196
|
+
field,
|
|
174
197
|
$table: this
|
|
175
198
|
}
|
|
176
|
-
if (!validRest[
|
|
177
|
-
validRest[
|
|
199
|
+
if (!validRest[field]) {
|
|
200
|
+
validRest[field] = []
|
|
178
201
|
}
|
|
179
202
|
validErrMaps[`${getRowid(this, row)}:${column.id}`] = {
|
|
180
203
|
column,
|
|
@@ -182,7 +205,7 @@ export default {
|
|
|
182
205
|
rule,
|
|
183
206
|
content: rule.content
|
|
184
207
|
}
|
|
185
|
-
validRest[
|
|
208
|
+
validRest[field].push(rest)
|
|
186
209
|
if (!isFull) {
|
|
187
210
|
this.validRuleErr = true
|
|
188
211
|
return Promise.reject(rest)
|
|
@@ -371,7 +394,7 @@ export default {
|
|
|
371
394
|
const { validOpts, validErrorMaps } = this
|
|
372
395
|
const validTip = this.$refs.validTip
|
|
373
396
|
const rowList = XEUtils.isArray(rows) ? rows : (rows ? [rows] : [])
|
|
374
|
-
const colList = (XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : (fieldOrColumn ? [fieldOrColumn] : []).map(column => handleFieldOrColumn(this, column))
|
|
397
|
+
const colList = (XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : (fieldOrColumn ? [fieldOrColumn] : [])).map(column => handleFieldOrColumn(this, column))
|
|
375
398
|
let validErrMaps: any = {}
|
|
376
399
|
if (validTip && validTip.visible) {
|
|
377
400
|
validTip.close()
|
|
@@ -337,7 +337,9 @@ function renderRows (h: CreateElement, _vm: any, $xeTable: any, fixedType: any,
|
|
|
337
337
|
fullAllDataRowIdData,
|
|
338
338
|
rowOpts,
|
|
339
339
|
pendingRowList,
|
|
340
|
-
pendingRowMaps
|
|
340
|
+
pendingRowMaps,
|
|
341
|
+
columnOpts,
|
|
342
|
+
isDragColMove
|
|
341
343
|
} = $xeTable
|
|
342
344
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
343
345
|
const rows: any[] = []
|
|
@@ -393,32 +395,48 @@ function renderRows (h: CreateElement, _vm: any, $xeTable: any, fixedType: any,
|
|
|
393
395
|
rowChildren = row[childrenField]
|
|
394
396
|
isExpandTree = rowChildren && rowChildren.length && !!treeExpandedMaps[rowid]
|
|
395
397
|
}
|
|
398
|
+
const trClass = [
|
|
399
|
+
'vxe-body--row',
|
|
400
|
+
treeConfig ? `row--level-${rowLevel}` : '',
|
|
401
|
+
{
|
|
402
|
+
'row--stripe': stripe && ($xeTable.getVTRowIndex(row) + 1) % 2 === 0,
|
|
403
|
+
'is--new': isNewRow,
|
|
404
|
+
'is--expand-row': isExpandRow,
|
|
405
|
+
'is--expand-tree': isExpandTree,
|
|
406
|
+
'row--new': isNewRow && (editOpts.showStatus || editOpts.showInsertStatus),
|
|
407
|
+
'row--radio': radioOpts.highlight && $xeTable.selectRadioRow === row,
|
|
408
|
+
'row--checked': checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
|
|
409
|
+
'row--pending': pendingRowList.length && !!pendingRowMaps[rowid]
|
|
410
|
+
},
|
|
411
|
+
rowClassName ? (XEUtils.isFunction(rowClassName) ? rowClassName(params) : rowClassName) : ''
|
|
412
|
+
]
|
|
413
|
+
const tdVNs = tableColumn.map((column: any, $columnIndex: any) => {
|
|
414
|
+
return renderColumn(h, _vm, $xeTable, seq, rowid, fixedType, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, tableColumn, tableData)
|
|
415
|
+
})
|
|
396
416
|
rows.push(
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
'row--stripe': stripe && ($xeTable.getVTRowIndex(row) + 1) % 2 === 0,
|
|
403
|
-
'is--new': isNewRow,
|
|
404
|
-
'is--expand-row': isExpandRow,
|
|
405
|
-
'is--expand-tree': isExpandTree,
|
|
406
|
-
'row--new': isNewRow && (editOpts.showStatus || editOpts.showInsertStatus),
|
|
407
|
-
'row--radio': radioOpts.highlight && $xeTable.selectRadioRow === row,
|
|
408
|
-
'row--checked': checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
|
|
409
|
-
'row--pending': pendingRowList.length && !!pendingRowMaps[rowid]
|
|
417
|
+
columnOpts.drag
|
|
418
|
+
? h('transition-group', {
|
|
419
|
+
props: {
|
|
420
|
+
tag: 'tr',
|
|
421
|
+
name: `vxe-header--col-list${isDragColMove ? '' : '-disabled'}`
|
|
410
422
|
},
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
423
|
+
class: trClass,
|
|
424
|
+
attrs: {
|
|
425
|
+
rowid
|
|
426
|
+
},
|
|
427
|
+
style: rowStyle ? (XEUtils.isFunction(rowStyle) ? rowStyle(params) : rowStyle) : null,
|
|
428
|
+
key: rowKey || rowOpts.useKey || rowOpts.drag || treeConfig ? rowid : $rowIndex,
|
|
429
|
+
nativeOn: trOn
|
|
430
|
+
}, tdVNs)
|
|
431
|
+
: h('tr', {
|
|
432
|
+
class: trClass,
|
|
433
|
+
attrs: {
|
|
434
|
+
rowid
|
|
435
|
+
},
|
|
436
|
+
style: rowStyle ? (XEUtils.isFunction(rowStyle) ? rowStyle(params) : rowStyle) : null,
|
|
437
|
+
key: rowKey || rowOpts.useKey || rowOpts.drag || treeConfig ? rowid : $rowIndex,
|
|
438
|
+
on: trOn
|
|
439
|
+
}, tdVNs)
|
|
422
440
|
)
|
|
423
441
|
// 如果行被展开了
|
|
424
442
|
if (isExpandRow) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateElement } from 'vue'
|
|
1
|
+
import { CreateElement, VNode } from 'vue'
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import { VxeUI } from '../../ui'
|
|
4
4
|
import { getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils'
|
|
@@ -6,6 +6,8 @@ import { updateCellTitle } from '../../ui/src/dom'
|
|
|
6
6
|
import { createColumn, getRowid } from './util'
|
|
7
7
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
8
8
|
|
|
9
|
+
import type { VxeTableDefines } from '../../../types'
|
|
10
|
+
|
|
9
11
|
const { getI18n, getIcon, renderer, formats, renderEmptyElement } = VxeUI
|
|
10
12
|
|
|
11
13
|
function renderTitlePrefixIcon (h: CreateElement, params: any) {
|
|
@@ -50,9 +52,12 @@ function renderTitleSuffixIcon (h: CreateElement, params: any) {
|
|
|
50
52
|
|
|
51
53
|
function renderCellDragIcon (h: CreateElement, params: any) {
|
|
52
54
|
const { $table } = params
|
|
53
|
-
const
|
|
54
|
-
const {
|
|
55
|
-
const
|
|
55
|
+
const tableProps = $table
|
|
56
|
+
const { dragConfig } = tableProps
|
|
57
|
+
const rowDragOpts = $table.computeRowDragOpts
|
|
58
|
+
const { icon, disabledMethod } = rowDragOpts
|
|
59
|
+
const rDisabledMethod = disabledMethod || (dragConfig ? dragConfig.rowDisabledMethod : null)
|
|
60
|
+
const isDisabled = rDisabledMethod && rDisabledMethod(params)
|
|
56
61
|
return h('span', {
|
|
57
62
|
key: 'dg',
|
|
58
63
|
class: ['vxe-cell--drag-handle', {
|
|
@@ -68,21 +73,22 @@ function renderCellDragIcon (h: CreateElement, params: any) {
|
|
|
68
73
|
}
|
|
69
74
|
}, [
|
|
70
75
|
h('i', {
|
|
71
|
-
class: rowIcon || getIcon().TABLE_DRAG_ROW
|
|
76
|
+
class: icon || (dragConfig ? dragConfig.rowIcon : '') || getIcon().TABLE_DRAG_ROW
|
|
72
77
|
})
|
|
73
78
|
])
|
|
74
79
|
}
|
|
75
80
|
|
|
76
81
|
function renderCellBaseVNs (h: CreateElement, params: any, content: any) {
|
|
77
|
-
const { $table, column,
|
|
82
|
+
const { $table, column, level } = params
|
|
78
83
|
const { dragSort } = column
|
|
79
84
|
const tableProps = $table
|
|
80
|
-
const { treeConfig } = tableProps
|
|
85
|
+
const { treeConfig, dragConfig } = tableProps
|
|
81
86
|
const rowOpts = $table.computeRowOpts
|
|
82
|
-
const
|
|
83
|
-
const {
|
|
87
|
+
const rowDragOpts = $table.computeRowDragOpts
|
|
88
|
+
const { showIcon, visibleMethod } = rowDragOpts
|
|
89
|
+
const rVisibleMethod = visibleMethod || (dragConfig ? dragConfig.rowVisibleMethod : null)
|
|
84
90
|
const vns: any[] = XEUtils.isArray(content) ? content : [content]
|
|
85
|
-
if (dragSort && rowOpts.drag && (showRowIcon && (!
|
|
91
|
+
if (dragSort && rowOpts.drag && ((showIcon || (dragConfig ? dragConfig.showRowIcon : false)) && (!rVisibleMethod || rVisibleMethod(params)))) {
|
|
86
92
|
if (!treeConfig || !level) {
|
|
87
93
|
vns.unshift(
|
|
88
94
|
renderCellDragIcon(h, params)
|
|
@@ -92,6 +98,47 @@ function renderCellBaseVNs (h: CreateElement, params: any, content: any) {
|
|
|
92
98
|
return vns
|
|
93
99
|
}
|
|
94
100
|
|
|
101
|
+
function renderHeaderCellDragIcon (h: CreateElement, params: VxeTableDefines.CellRenderHeaderParams) {
|
|
102
|
+
const { $table, column } = params
|
|
103
|
+
const columnOpts = $table.computeColumnOpts
|
|
104
|
+
const columnDragOpts = $table.computeColumnDragOpts
|
|
105
|
+
const { showIcon, icon, visibleMethod, disabledMethod } = columnDragOpts
|
|
106
|
+
const isDisabled = disabledMethod && disabledMethod(params)
|
|
107
|
+
if (columnOpts.drag && showIcon && (!visibleMethod || visibleMethod(params))) {
|
|
108
|
+
if (!(column.fixed || column.parentId)) {
|
|
109
|
+
return h('span', {
|
|
110
|
+
key: 'dg',
|
|
111
|
+
class: ['vxe-cell--drag-handle', {
|
|
112
|
+
'is--disabled': isDisabled
|
|
113
|
+
}],
|
|
114
|
+
on: {
|
|
115
|
+
mousedown (evnt: MouseEvent) {
|
|
116
|
+
if (!isDisabled) {
|
|
117
|
+
$table.handleHeaderCellDragMousedownEvent(evnt, params)
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
mouseup: $table.handleHeaderCellDragMouseupEvent
|
|
121
|
+
}
|
|
122
|
+
}, [
|
|
123
|
+
h('i', {
|
|
124
|
+
class: icon || getIcon().TABLE_DRAG_COLUMN
|
|
125
|
+
})
|
|
126
|
+
])
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return renderEmptyElement($table)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function renderHeaderCellBaseVNs (h: CreateElement, params: VxeTableDefines.CellRenderHeaderParams, content: VNode | VNode[]) {
|
|
133
|
+
const vns = [
|
|
134
|
+
renderTitlePrefixIcon(h, params),
|
|
135
|
+
renderHeaderCellDragIcon(h, params),
|
|
136
|
+
...(XEUtils.isArray(content) ? content : [content]),
|
|
137
|
+
renderTitleSuffixIcon(h, params)
|
|
138
|
+
]
|
|
139
|
+
return vns
|
|
140
|
+
}
|
|
141
|
+
|
|
95
142
|
function renderTitleContent (h: CreateElement, params: any, content: any) {
|
|
96
143
|
const { $table, column } = params
|
|
97
144
|
const { type, showHeaderOverflow } = column
|
|
@@ -252,7 +299,7 @@ export const Cell = {
|
|
|
252
299
|
return createColumn($xetable, _vm, renMaps)
|
|
253
300
|
},
|
|
254
301
|
/**
|
|
255
|
-
*
|
|
302
|
+
* 列头标题
|
|
256
303
|
*/
|
|
257
304
|
renderHeaderTitle (h: any, params: any) {
|
|
258
305
|
const { $table, column } = params
|
|
@@ -271,7 +318,7 @@ export const Cell = {
|
|
|
271
318
|
return renderTitleContent(h, params, formatText(column.getTitle(), 1))
|
|
272
319
|
},
|
|
273
320
|
renderDefaultHeader (h: CreateElement, params: any) {
|
|
274
|
-
return
|
|
321
|
+
return renderHeaderCellBaseVNs(h, params, Cell.renderHeaderTitle(h, params))
|
|
275
322
|
},
|
|
276
323
|
renderDefaultCell (h: CreateElement, params: any) {
|
|
277
324
|
const { $table, row, column } = params
|
|
@@ -380,12 +427,12 @@ export const Cell = {
|
|
|
380
427
|
},
|
|
381
428
|
|
|
382
429
|
/**
|
|
383
|
-
*
|
|
430
|
+
* 序号
|
|
384
431
|
*/
|
|
385
432
|
renderSeqHeader (h: CreateElement, params: any) {
|
|
386
433
|
const { $table, column } = params
|
|
387
434
|
const { slots } = column
|
|
388
|
-
return renderTitleContent(h, params, slots && slots.header ? $table.callSlot(slots.header, params, h) : formatText(column.getTitle(), 1))
|
|
435
|
+
return renderHeaderCellBaseVNs(h, params, renderTitleContent(h, params, slots && slots.header ? $table.callSlot(slots.header, params, h) : formatText(column.getTitle(), 1)))
|
|
389
436
|
},
|
|
390
437
|
renderSeqCell (h: CreateElement, params: any) {
|
|
391
438
|
const { $table, column } = params
|
|
@@ -412,13 +459,15 @@ export const Cell = {
|
|
|
412
459
|
const { slots } = column
|
|
413
460
|
const headerSlot = slots ? slots.header : null
|
|
414
461
|
const titleSlot = slots ? slots.title : null
|
|
415
|
-
return
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
462
|
+
return renderHeaderCellBaseVNs(h, params,
|
|
463
|
+
renderTitleContent(h, params, headerSlot
|
|
464
|
+
? $table.callSlot(headerSlot, params, h)
|
|
465
|
+
: [
|
|
466
|
+
h('span', {
|
|
467
|
+
class: 'vxe-radio--label'
|
|
468
|
+
}, titleSlot ? $table.callSlot(titleSlot, params, h) : formatText(column.getTitle(), 1))
|
|
469
|
+
])
|
|
470
|
+
)
|
|
422
471
|
},
|
|
423
472
|
renderRadioCell (h: CreateElement, params: any) {
|
|
424
473
|
const { $table, column, isHidden } = params
|
|
@@ -500,38 +549,40 @@ export const Cell = {
|
|
|
500
549
|
}
|
|
501
550
|
const checkboxParams = { ...params, checked: isAllCheckboxSelected, disabled: isAllCheckboxDisabled, indeterminate: isAllCheckboxIndeterminate }
|
|
502
551
|
if (headerSlot) {
|
|
503
|
-
return renderTitleContent(h, checkboxParams, $table.callSlot(headerSlot, checkboxParams, h))
|
|
552
|
+
return renderHeaderCellBaseVNs(h, params, renderTitleContent(h, checkboxParams, $table.callSlot(headerSlot, checkboxParams, h)))
|
|
504
553
|
}
|
|
505
554
|
if (checkboxOpts.checkStrictly ? !checkboxOpts.showHeader : checkboxOpts.showHeader === false) {
|
|
506
|
-
return renderTitleContent(h, checkboxParams, [
|
|
555
|
+
return renderHeaderCellBaseVNs(h, params, renderTitleContent(h, checkboxParams, [
|
|
507
556
|
h('span', {
|
|
508
557
|
class: 'vxe-checkbox--label'
|
|
509
558
|
}, titleSlot ? $table.callSlot(titleSlot, checkboxParams, h) : headerTitle)
|
|
510
|
-
])
|
|
559
|
+
]))
|
|
511
560
|
}
|
|
512
|
-
return
|
|
513
|
-
h
|
|
514
|
-
class: ['vxe-cell--checkbox', {
|
|
515
|
-
'is--checked': isAllCheckboxSelected,
|
|
516
|
-
'is--disabled': isAllCheckboxDisabled,
|
|
517
|
-
'is--indeterminate': isAllCheckboxIndeterminate
|
|
518
|
-
}],
|
|
519
|
-
attrs: {
|
|
520
|
-
title: getI18n('vxe.table.allTitle')
|
|
521
|
-
},
|
|
522
|
-
on
|
|
523
|
-
}, [
|
|
561
|
+
return renderHeaderCellBaseVNs(h, params,
|
|
562
|
+
renderTitleContent(h, checkboxParams, [
|
|
524
563
|
h('span', {
|
|
525
|
-
class: ['vxe-checkbox
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
564
|
+
class: ['vxe-cell--checkbox', {
|
|
565
|
+
'is--checked': isAllCheckboxSelected,
|
|
566
|
+
'is--disabled': isAllCheckboxDisabled,
|
|
567
|
+
'is--indeterminate': isAllCheckboxIndeterminate
|
|
568
|
+
}],
|
|
569
|
+
attrs: {
|
|
570
|
+
title: getI18n('vxe.table.allTitle')
|
|
571
|
+
},
|
|
572
|
+
on
|
|
573
|
+
}, [
|
|
574
|
+
h('span', {
|
|
575
|
+
class: ['vxe-checkbox--icon', isAllCheckboxIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isAllCheckboxSelected ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
|
|
576
|
+
})
|
|
577
|
+
].concat(titleSlot || headerTitle
|
|
578
|
+
? [
|
|
579
|
+
h('span', {
|
|
580
|
+
class: 'vxe-checkbox--label'
|
|
581
|
+
}, titleSlot ? $table.callSlot(titleSlot, checkboxParams, h) : headerTitle)
|
|
582
|
+
]
|
|
583
|
+
: []))
|
|
584
|
+
])
|
|
585
|
+
)
|
|
535
586
|
},
|
|
536
587
|
renderCheckboxCell (h: CreateElement, params: any) {
|
|
537
588
|
const { $table, row, column, isHidden } = params
|
|
@@ -748,16 +799,14 @@ export const Cell = {
|
|
|
748
799
|
* 排序和筛选
|
|
749
800
|
*/
|
|
750
801
|
renderSortAndFilterHeader (h: CreateElement, params: any) {
|
|
751
|
-
return Cell.
|
|
752
|
-
.concat(Cell.renderSortIcon(h, params))
|
|
753
|
-
.concat(Cell.renderFilterIcon(h, params))
|
|
802
|
+
return renderHeaderCellBaseVNs(h, params, Cell.renderHeaderTitle(h, params).concat(Cell.renderSortIcon(h, params)))
|
|
754
803
|
},
|
|
755
804
|
|
|
756
805
|
/**
|
|
757
806
|
* 排序
|
|
758
807
|
*/
|
|
759
808
|
renderSortHeader (h: CreateElement, params: any) {
|
|
760
|
-
return Cell.
|
|
809
|
+
return renderHeaderCellBaseVNs(h, params, Cell.renderHeaderTitle(h, params).concat(Cell.renderSortIcon(h, params)))
|
|
761
810
|
},
|
|
762
811
|
renderSortIcon (h: CreateElement, params: any) {
|
|
763
812
|
const { $table, column } = params
|
|
@@ -804,7 +853,7 @@ export const Cell = {
|
|
|
804
853
|
* 筛选
|
|
805
854
|
*/
|
|
806
855
|
renderFilterHeader (h: CreateElement, params: any) {
|
|
807
|
-
return Cell.
|
|
856
|
+
return renderHeaderCellBaseVNs(h, params, Cell.renderHeaderTitle(h, params).concat(Cell.renderFilterIcon(h, params)))
|
|
808
857
|
},
|
|
809
858
|
renderFilterIcon (h: CreateElement, params: any) {
|
|
810
859
|
const { $table, column, hasFilter } = params
|
|
@@ -849,22 +898,26 @@ export const Cell = {
|
|
|
849
898
|
isRequired = columnRules.some((rule: any) => rule.required)
|
|
850
899
|
}
|
|
851
900
|
}
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
901
|
+
let editIconVNs: VNode[] = []
|
|
902
|
+
if (isEnableConf(editConfig)) {
|
|
903
|
+
editIconVNs = [
|
|
904
|
+
isRequired && editOpts.showAsterisk
|
|
905
|
+
? h('i', {
|
|
906
|
+
class: 'vxe-cell--required-icon'
|
|
907
|
+
})
|
|
908
|
+
: renderEmptyElement($table),
|
|
909
|
+
isEnableConf(editRender) && editOpts.showIcon
|
|
910
|
+
? h('i', {
|
|
911
|
+
class: ['vxe-cell--edit-icon', editOpts.icon || getIcon().TABLE_EDIT]
|
|
912
|
+
})
|
|
913
|
+
: renderEmptyElement($table)
|
|
914
|
+
]
|
|
915
|
+
}
|
|
916
|
+
return renderHeaderCellBaseVNs(h, params,
|
|
917
|
+
editIconVNs.concat(Cell.renderHeaderTitle(h, params))
|
|
918
|
+
.concat(sortable || remoteSort ? Cell.renderSortIcon(h, params) : [])
|
|
919
|
+
.concat(filters ? Cell.renderFilterIcon(h, params) : [])
|
|
920
|
+
)
|
|
868
921
|
},
|
|
869
922
|
// 行格编辑模式
|
|
870
923
|
renderRowEdit (h: CreateElement, params: any) {
|