vxe-table 4.1.6 → 4.1.9
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/button/src/button.js +14 -14
- package/es/edit/src/hook.js +3 -3
- package/es/export/src/hook.js +17 -6
- package/es/filter/src/hook.js +20 -1
- package/es/grid/src/grid.js +6 -2
- package/es/table/src/body.js +11 -14
- package/es/table/src/cell.js +16 -14
- package/es/table/src/props.js +6 -6
- package/es/table/src/table.js +102 -89
- package/es/table/src/util.js +3 -0
- package/es/tools/dom.js +2 -8
- package/es/v-x-e-table/src/conf.js +3 -0
- package/lib/button/src/button.js +15 -14
- package/lib/button/src/button.min.js +1 -1
- package/lib/edit/src/hook.js +3 -0
- package/lib/edit/src/hook.min.js +1 -1
- package/lib/export/src/hook.js +25 -10
- package/lib/export/src/hook.min.js +1 -1
- package/lib/filter/src/hook.js +23 -0
- package/lib/filter/src/hook.min.js +1 -1
- package/lib/grid/src/grid.js +6 -3
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +307 -208
- package/lib/index.umd.min.js +1 -1
- package/lib/table/src/body.js +8 -16
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +16 -16
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/props.js +6 -6
- package/lib/table/src/table.js +158 -114
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +7 -0
- package/lib/table/src/util.min.js +1 -1
- package/lib/tools/dom.js +2 -9
- package/lib/tools/dom.min.js +1 -1
- package/lib/v-x-e-table/src/conf.js +3 -0
- package/lib/v-x-e-table/src/conf.min.js +1 -1
- package/package.json +1 -1
- package/packages/button/src/button.ts +14 -14
- package/packages/edit/src/hook.ts +3 -3
- package/packages/export/src/hook.ts +17 -6
- package/packages/filter/src/hook.ts +20 -1
- package/packages/grid/src/grid.ts +6 -2
- package/packages/table/src/body.ts +11 -14
- package/packages/table/src/cell.ts +16 -14
- package/packages/table/src/props.ts +6 -6
- package/packages/table/src/table.ts +102 -89
- package/packages/table/src/util.ts +4 -0
- package/packages/tools/dom.ts +2 -7
- package/packages/v-x-e-table/src/conf.ts +3 -0
- package/types/filter.d.ts +5 -0
- package/types/plugins/pro.d.ts +5 -0
- package/types/table.d.ts +12 -2
package/package.json
CHANGED
|
@@ -142,38 +142,38 @@ export default defineComponent({
|
|
|
142
142
|
const panelStyle: { [key: string]: string | number } = {
|
|
143
143
|
zIndex: panelIndex
|
|
144
144
|
}
|
|
145
|
-
const {
|
|
145
|
+
const { top, left, boundingTop, visibleHeight, visibleWidth } = getAbsolutePos(targetElem)
|
|
146
146
|
let panelPlacement = 'bottom'
|
|
147
147
|
if (transfer) {
|
|
148
|
-
let
|
|
149
|
-
let
|
|
148
|
+
let btnLeft = left + targetWidth - panelWidth
|
|
149
|
+
let btnTop = top + targetHeight
|
|
150
150
|
if (placement === 'top') {
|
|
151
151
|
panelPlacement = 'top'
|
|
152
|
-
|
|
152
|
+
btnTop = top - panelHeight
|
|
153
153
|
} else if (!placement) {
|
|
154
154
|
// 如果下面不够放,则向上
|
|
155
|
-
if (
|
|
155
|
+
if (boundingTop + targetHeight + panelHeight + marginSize > visibleHeight) {
|
|
156
156
|
panelPlacement = 'top'
|
|
157
|
-
|
|
157
|
+
btnTop = top - panelHeight
|
|
158
158
|
}
|
|
159
159
|
// 如果上面不够放,则向下(优先)
|
|
160
|
-
if (
|
|
160
|
+
if (btnTop < marginSize) {
|
|
161
161
|
panelPlacement = 'bottom'
|
|
162
|
-
|
|
162
|
+
btnTop = top + targetHeight
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
// 如果溢出右边
|
|
166
|
-
if (
|
|
167
|
-
|
|
166
|
+
if (btnLeft + panelWidth + marginSize > visibleWidth) {
|
|
167
|
+
btnLeft -= btnLeft + panelWidth + marginSize - visibleWidth
|
|
168
168
|
}
|
|
169
169
|
// 如果溢出左边
|
|
170
|
-
if (
|
|
171
|
-
|
|
170
|
+
if (btnLeft < marginSize) {
|
|
171
|
+
btnLeft = marginSize
|
|
172
172
|
}
|
|
173
173
|
Object.assign(panelStyle, {
|
|
174
|
-
left: `${
|
|
174
|
+
left: `${btnLeft}px`,
|
|
175
175
|
right: 'auto',
|
|
176
|
-
top: `${
|
|
176
|
+
top: `${btnTop}px`,
|
|
177
177
|
minWidth: `${targetWidth}px`
|
|
178
178
|
})
|
|
179
179
|
} else {
|
|
@@ -76,7 +76,7 @@ const editHook: VxeGlobalHooksHandles.HookOptions = {
|
|
|
76
76
|
parentChilds = parentRow[treeOpts.children] = []
|
|
77
77
|
}
|
|
78
78
|
parentChilds[funcName](item)
|
|
79
|
-
const rest = { row: item, rowid, index: -1, _index: -1, $index: -1, items: parentChilds, parent, level: parentLevel + 1 }
|
|
79
|
+
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, items: parentChilds, parent, level: parentLevel + 1 }
|
|
80
80
|
fullDataRowIdData[rowid] = rest
|
|
81
81
|
fullAllDataRowIdData[rowid] = rest
|
|
82
82
|
} else {
|
|
@@ -87,7 +87,7 @@ const editHook: VxeGlobalHooksHandles.HookOptions = {
|
|
|
87
87
|
}
|
|
88
88
|
afterFullData[funcName](item)
|
|
89
89
|
treeFullData[funcName](item)
|
|
90
|
-
const rest = { row: item, rowid, index: -1, _index: -1, $index: -1, items: treeFullData, parent: null, level: 0 }
|
|
90
|
+
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, items: treeFullData, parent: null, level: 0 }
|
|
91
91
|
fullDataRowIdData[rowid] = rest
|
|
92
92
|
fullAllDataRowIdData[rowid] = rest
|
|
93
93
|
}
|
|
@@ -176,7 +176,7 @@ const editHook: VxeGlobalHooksHandles.HookOptions = {
|
|
|
176
176
|
item[treeOpts.parentField] = parentRow[treeOpts.rowField]
|
|
177
177
|
}
|
|
178
178
|
parentChilds.splice(matchObj.index + i, 0, item)
|
|
179
|
-
const rest = { row: item, rowid, index: -1, _index: -1, $index: -1, items: parentChilds, parent: parentRow, level: parentLevel + 1 }
|
|
179
|
+
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, items: parentChilds, parent: parentRow, level: parentLevel + 1 }
|
|
180
180
|
fullDataRowIdData[rowid] = rest
|
|
181
181
|
fullAllDataRowIdData[rowid] = rest
|
|
182
182
|
})
|
|
@@ -2,7 +2,7 @@ import { inject, nextTick } from 'vue'
|
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
4
4
|
import { VXETable } from '../../v-x-e-table'
|
|
5
|
-
import { isColumnInfo, mergeBodyMethod, getCellValue } from '../../table/src/util'
|
|
5
|
+
import { isColumnInfo, mergeBodyMethod, getCellValue, toTreePathSeq } from '../../table/src/util'
|
|
6
6
|
import { errLog, warnLog, parseFile, formatText } from '../../tools/utils'
|
|
7
7
|
import { readLocalFile, handlePrint, saveLocalFile, createHtmlPage, getExportBlobByContent } from './util'
|
|
8
8
|
|
|
@@ -100,6 +100,9 @@ function getFooterData (opts: any, footerTableData: any) {
|
|
|
100
100
|
|
|
101
101
|
function getCsvCellTypeLabel (column: any, cellValue: any) {
|
|
102
102
|
if (cellValue) {
|
|
103
|
+
if (column.type === 'seq') {
|
|
104
|
+
return `\t${cellValue}`
|
|
105
|
+
}
|
|
103
106
|
switch (column.cellType) {
|
|
104
107
|
case 'string':
|
|
105
108
|
if (!isNaN(cellValue)) {
|
|
@@ -292,10 +295,16 @@ const tableExportHook: VxeGlobalHooksHandles.HookOptions = {
|
|
|
292
295
|
return row[treeOpts.children] && row[treeOpts.children].length
|
|
293
296
|
}
|
|
294
297
|
|
|
295
|
-
const getSeq = (row: any, rowIndex: any, column: any, columnIndex: any) => {
|
|
298
|
+
const getSeq = (row: any, rowIndex: any, column: any, columnIndex: any, path: string[] | null) => {
|
|
296
299
|
const seqOpts = computeSeqOpts.value
|
|
297
300
|
const seqMethod = seqOpts.seqMethod || column.seqMethod
|
|
298
|
-
|
|
301
|
+
if (seqMethod) {
|
|
302
|
+
return seqMethod({ row, rowIndex, column, columnIndex })
|
|
303
|
+
}
|
|
304
|
+
if (path) {
|
|
305
|
+
return toTreePathSeq(path)
|
|
306
|
+
}
|
|
307
|
+
return seqOpts.startIndex + rowIndex + 1
|
|
299
308
|
}
|
|
300
309
|
|
|
301
310
|
const toBooleanValue = (cellValue: any) => {
|
|
@@ -314,10 +323,11 @@ const tableExportHook: VxeGlobalHooksHandles.HookOptions = {
|
|
|
314
323
|
if (treeConfig) {
|
|
315
324
|
// 如果是树表格只允许导出数据源
|
|
316
325
|
const rest: any[] = []
|
|
326
|
+
const expandMaps: Map<any, number> = new Map()
|
|
317
327
|
XEUtils.eachTree(datas, (item, rowIndex, items, path, parent, nodes) => {
|
|
318
328
|
const row = item._row || item
|
|
319
329
|
const parentRow = parent && parent._row ? parent._row : parent
|
|
320
|
-
if ((isAllExpand || !parentRow || $xetable.isTreeExpandByRow(parentRow))) {
|
|
330
|
+
if ((isAllExpand || !parentRow || (expandMaps.has(parentRow) && $xetable.isTreeExpandByRow(parentRow)))) {
|
|
321
331
|
const hasRowChild = hasTreeChildren(row)
|
|
322
332
|
const item: any = {
|
|
323
333
|
_row: row,
|
|
@@ -340,7 +350,7 @@ const tableExportHook: VxeGlobalHooksHandles.HookOptions = {
|
|
|
340
350
|
} else {
|
|
341
351
|
switch (column.type) {
|
|
342
352
|
case 'seq':
|
|
343
|
-
cellValue = getSeq(row, rowIndex, column, columnIndex)
|
|
353
|
+
cellValue = getSeq(row, rowIndex, column, columnIndex, path)
|
|
344
354
|
break
|
|
345
355
|
case 'checkbox':
|
|
346
356
|
cellValue = toBooleanValue($xetable.isCheckedByCheckboxRow(row))
|
|
@@ -371,6 +381,7 @@ const tableExportHook: VxeGlobalHooksHandles.HookOptions = {
|
|
|
371
381
|
}
|
|
372
382
|
item[column.id] = XEUtils.toValueString(cellValue)
|
|
373
383
|
})
|
|
384
|
+
expandMaps.set(row, 1)
|
|
374
385
|
rest.push(Object.assign(item, row))
|
|
375
386
|
}
|
|
376
387
|
}, treeOpts)
|
|
@@ -395,7 +406,7 @@ const tableExportHook: VxeGlobalHooksHandles.HookOptions = {
|
|
|
395
406
|
} else {
|
|
396
407
|
switch (column.type) {
|
|
397
408
|
case 'seq':
|
|
398
|
-
cellValue = getSeq(row, rowIndex, column, columnIndex)
|
|
409
|
+
cellValue = getSeq(row, rowIndex, column, columnIndex, [])
|
|
399
410
|
break
|
|
400
411
|
case 'checkbox':
|
|
401
412
|
cellValue = toBooleanValue($xetable.isCheckedByCheckboxRow(row))
|
|
@@ -2,7 +2,7 @@ import { nextTick } from 'vue'
|
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import { VXETable } from '../../v-x-e-table'
|
|
4
4
|
import { toFilters, handleFieldOrColumn } from '../../table/src/util'
|
|
5
|
-
import { getDomNode } from '../../tools/dom'
|
|
5
|
+
import { getDomNode, triggerEvent } from '../../tools/dom'
|
|
6
6
|
|
|
7
7
|
import { VxeGlobalHooksHandles, TableFilterMethods, TableFilterPrivateMethods } from '../../../types/all'
|
|
8
8
|
|
|
@@ -172,6 +172,25 @@ const tableFilterHook: VxeGlobalHooksHandles.HookOptions = {
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
const filterMethods: TableFilterMethods = {
|
|
175
|
+
/**
|
|
176
|
+
* 手动弹出筛选面板
|
|
177
|
+
* @param column
|
|
178
|
+
*/
|
|
179
|
+
openFilter (fieldOrColumn) {
|
|
180
|
+
const column = handleFieldOrColumn($xetable, fieldOrColumn)
|
|
181
|
+
if (column && column.filters) {
|
|
182
|
+
const { elemStore } = internalData
|
|
183
|
+
const { fixed } = column
|
|
184
|
+
return $xetable.scrollToColumn(column).then(() => {
|
|
185
|
+
const headerWrapperElem = elemStore[`${fixed || 'main'}-header-wrapper`] || elemStore['main-header-wrapper']
|
|
186
|
+
if (headerWrapperElem) {
|
|
187
|
+
const filterBtnElem = headerWrapperElem.querySelector(`.vxe-header--column.${column.id} .vxe-filter--btn`)
|
|
188
|
+
triggerEvent(filterBtnElem, 'click')
|
|
189
|
+
}
|
|
190
|
+
})
|
|
191
|
+
}
|
|
192
|
+
return nextTick()
|
|
193
|
+
},
|
|
175
194
|
/**
|
|
176
195
|
* 修改筛选条件列表
|
|
177
196
|
* @param {ColumnInfo} fieldOrColumn 列或字段名
|
|
@@ -871,7 +871,11 @@ export default defineComponent({
|
|
|
871
871
|
body.insertRecords = insertRecords.filter((row) => $xetable.findRowIndexOf(pendingRecords, row) === -1)
|
|
872
872
|
}
|
|
873
873
|
// 只校验新增和修改的数据
|
|
874
|
-
return $xetable.validate(body.insertRecords.concat(updateRecords)).then(() => {
|
|
874
|
+
return $xetable.validate(body.insertRecords.concat(updateRecords)).then((errMap) => {
|
|
875
|
+
if (errMap) {
|
|
876
|
+
// 如果校验不通过
|
|
877
|
+
return
|
|
878
|
+
}
|
|
875
879
|
if (body.insertRecords.length || removeRecords.length || updateRecords.length || body.pendingRecords.length) {
|
|
876
880
|
reactData.tableLoading = true
|
|
877
881
|
return Promise.resolve((beforeSave || ajaxMethods)(...applyArgs))
|
|
@@ -916,7 +920,7 @@ export default defineComponent({
|
|
|
916
920
|
VXETable.modal.message({ id: code, content: GlobalConfig.i18n('vxe.grid.dataUnchanged'), status: 'info' })
|
|
917
921
|
}
|
|
918
922
|
}
|
|
919
|
-
})
|
|
923
|
+
})
|
|
920
924
|
} else {
|
|
921
925
|
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
|
922
926
|
errLog('vxe.error.notFunc', ['proxy-config.ajax.save'])
|
|
@@ -108,7 +108,7 @@ export default defineComponent({
|
|
|
108
108
|
/**
|
|
109
109
|
* 渲染列
|
|
110
110
|
*/
|
|
111
|
-
const renderColumn = (
|
|
111
|
+
const renderColumn = (seq: number | string, rowid: string, fixedType: any, rowLevel: number, row: any, rowIndex: number, $rowIndex: number, _rowIndex: number, column: any, $columnIndex: number, columns: any, items: any[]) => {
|
|
112
112
|
const { columnKey, height, showOverflow: allColumnOverflow, cellClassName, cellStyle, align: allAlign, spanMethod, mouseConfig, editConfig, editRules, tooltipConfig } = tableProps
|
|
113
113
|
const { tableData, overflowX, scrollYLoad, currentColumn, mergeList, editStore, validStore, isAllOverflow } = tableReactData
|
|
114
114
|
const { afterFullData } = tableInternalData
|
|
@@ -138,7 +138,7 @@ export default defineComponent({
|
|
|
138
138
|
const hasValidError = validStore.row === row && validStore.column === column
|
|
139
139
|
const showValidTip = editRules && validOpts.showMessage && (validOpts.message === 'default' ? (height || tableData.length > 1) : validOpts.message === 'inline')
|
|
140
140
|
const attrs: any = { colid: column.id }
|
|
141
|
-
const params: VxeTableDefines.CellRenderBodyParams = { $table: $xetable,
|
|
141
|
+
const params: VxeTableDefines.CellRenderBodyParams = { $table: $xetable, seq, rowid, row, rowIndex, $rowIndex, _rowIndex, column, columnIndex, $columnIndex, _columnIndex, fixed: fixedType, type: renderType, isHidden: fixedHiddenColumn, level: rowLevel, visibleData: afterFullData, data: tableData, items }
|
|
142
142
|
// 虚拟滚动不支持动态高度
|
|
143
143
|
if (scrollYLoad && !hasEllipsis) {
|
|
144
144
|
showEllipsis = hasEllipsis = true
|
|
@@ -291,10 +291,10 @@ export default defineComponent({
|
|
|
291
291
|
}, tdVNs)
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
-
const renderRows = (
|
|
294
|
+
const renderRows = (fixedType: any, tableData: any, tableColumn: any) => {
|
|
295
295
|
const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, showOverflow: allColumnOverflow, editConfig, treeConfig } = tableProps
|
|
296
296
|
const { hasFixedColumn, treeExpandeds, scrollYLoad, editStore, rowExpandeds, expandColumn, selectRow } = tableReactData
|
|
297
|
-
const {
|
|
297
|
+
const { fullDataRowIdData } = tableInternalData
|
|
298
298
|
const checkboxOpts = computeCheckboxOpts.value
|
|
299
299
|
const radioOpts = computeRadioOpts.value
|
|
300
300
|
const treeOpts = computeTreeOpts.value
|
|
@@ -304,10 +304,6 @@ export default defineComponent({
|
|
|
304
304
|
tableData.forEach((row: any, $rowIndex: any) => {
|
|
305
305
|
const trOn: any = {}
|
|
306
306
|
let rowIndex = $rowIndex
|
|
307
|
-
let seq = rowIndex + 1
|
|
308
|
-
if (scrollYLoad) {
|
|
309
|
-
seq += scrollYStore.startIndex
|
|
310
|
-
}
|
|
311
307
|
const _rowIndex = $xetable.getVTRowIndex(row)
|
|
312
308
|
// 确保任何情况下 rowIndex 都精准指向真实 data 索引
|
|
313
309
|
rowIndex = $xetable.getRowIndex(row)
|
|
@@ -327,9 +323,10 @@ export default defineComponent({
|
|
|
327
323
|
}
|
|
328
324
|
}
|
|
329
325
|
const rowid = getRowid($xetable, row)
|
|
330
|
-
const rest =
|
|
326
|
+
const rest = fullDataRowIdData[rowid]
|
|
331
327
|
const rowLevel = rest ? rest.level : 0
|
|
332
|
-
const
|
|
328
|
+
const seq = rest ? rest.seq : -1
|
|
329
|
+
const params = { $table: $xetable, seq, rowid, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex }
|
|
333
330
|
let isNewRow = false
|
|
334
331
|
if (editConfig) {
|
|
335
332
|
isNewRow = $xetable.findRowIndexOf(editStore.insertList, row) > -1
|
|
@@ -348,7 +345,7 @@ export default defineComponent({
|
|
|
348
345
|
key: rowKey || treeConfig ? rowid : $rowIndex,
|
|
349
346
|
...trOn
|
|
350
347
|
}, tableColumn.map((column: any, $columnIndex: any) => {
|
|
351
|
-
return renderColumn(
|
|
348
|
+
return renderColumn(seq, rowid, fixedType, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, tableColumn, tableData)
|
|
352
349
|
}))
|
|
353
350
|
)
|
|
354
351
|
// 如果行被展开了
|
|
@@ -361,7 +358,7 @@ export default defineComponent({
|
|
|
361
358
|
}
|
|
362
359
|
const { showOverflow } = expandColumn
|
|
363
360
|
const hasEllipsis = (XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow)) ? allColumnOverflow : showOverflow
|
|
364
|
-
const expandParams = { $table: $xetable,
|
|
361
|
+
const expandParams = { $table: $xetable, seq, column: expandColumn, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex }
|
|
365
362
|
rows.push(
|
|
366
363
|
h('tr', {
|
|
367
364
|
class: 'vxe-body--expanded-row',
|
|
@@ -390,7 +387,7 @@ export default defineComponent({
|
|
|
390
387
|
if (treeConfig && !scrollYLoad && treeExpandeds.length) {
|
|
391
388
|
const rowChildren = row[treeOpts.children]
|
|
392
389
|
if (rowChildren && rowChildren.length && $xetable.findRowIndexOf(treeExpandeds, row) > -1) {
|
|
393
|
-
rows.push(...renderRows(
|
|
390
|
+
rows.push(...renderRows(fixedType, rowChildren, tableColumn))
|
|
394
391
|
}
|
|
395
392
|
}
|
|
396
393
|
})
|
|
@@ -689,7 +686,7 @@ export default defineComponent({
|
|
|
689
686
|
*/
|
|
690
687
|
h('tbody', {
|
|
691
688
|
ref: refBodyTBody
|
|
692
|
-
}, renderRows(
|
|
689
|
+
}, renderRows(fixedType, tableData, tableColumn))
|
|
693
690
|
]),
|
|
694
691
|
h('div', {
|
|
695
692
|
class: 'vxe-table--checkbox-range'
|
|
@@ -107,16 +107,16 @@ export const Cell = {
|
|
|
107
107
|
}
|
|
108
108
|
switch (type) {
|
|
109
109
|
case 'seq':
|
|
110
|
-
renConfs.renderHeader = Cell.
|
|
111
|
-
renConfs.renderCell = treeNode ? Cell.renderTreeIndexCell : Cell.
|
|
110
|
+
renConfs.renderHeader = Cell.renderSeqHeader
|
|
111
|
+
renConfs.renderCell = treeNode ? Cell.renderTreeIndexCell : Cell.renderSeqCell
|
|
112
112
|
break
|
|
113
113
|
case 'radio':
|
|
114
114
|
renConfs.renderHeader = Cell.renderRadioHeader
|
|
115
115
|
renConfs.renderCell = treeNode ? Cell.renderTreeRadioCell : Cell.renderRadioCell
|
|
116
116
|
break
|
|
117
117
|
case 'checkbox':
|
|
118
|
-
renConfs.renderHeader = Cell.
|
|
119
|
-
renConfs.renderCell = checkboxOpts.checkField ? (treeNode ? Cell.renderTreeSelectionCellByProp : Cell.
|
|
118
|
+
renConfs.renderHeader = Cell.renderCheckboxHeader
|
|
119
|
+
renConfs.renderCell = checkboxOpts.checkField ? (treeNode ? Cell.renderTreeSelectionCellByProp : Cell.renderCheckboxCellByProp) : (treeNode ? Cell.renderTreeSelectionCell : Cell.renderCheckboxCell)
|
|
120
120
|
break
|
|
121
121
|
case 'expand':
|
|
122
122
|
renConfs.renderCell = Cell.renderExpandCell
|
|
@@ -268,14 +268,16 @@ export const Cell = {
|
|
|
268
268
|
/**
|
|
269
269
|
* 索引
|
|
270
270
|
*/
|
|
271
|
-
|
|
271
|
+
renderSeqHeader (params: VxeTableDefines.CellRenderHeaderParams) {
|
|
272
272
|
const { $table, column } = params
|
|
273
273
|
const { slots } = column
|
|
274
274
|
const headerSlot = slots ? slots.header : null
|
|
275
275
|
return renderTitleContent(params, headerSlot ? $table.callSlot(headerSlot, params) : formatText(column.getTitle(), 1))
|
|
276
276
|
},
|
|
277
|
-
|
|
277
|
+
renderSeqCell (params: VxeTableDefines.CellRenderBodyParams) {
|
|
278
278
|
const { $table, column } = params
|
|
279
|
+
const { props } = $table
|
|
280
|
+
const { treeConfig } = props
|
|
279
281
|
const { computeSeqOpts } = $table.getComputeMaps()
|
|
280
282
|
const seqOpts = computeSeqOpts.value
|
|
281
283
|
const { slots } = column
|
|
@@ -283,12 +285,12 @@ export const Cell = {
|
|
|
283
285
|
if (defaultSlot) {
|
|
284
286
|
return $table.callSlot(defaultSlot, params)
|
|
285
287
|
}
|
|
286
|
-
const {
|
|
288
|
+
const { seq } = params
|
|
287
289
|
const seqMethod = seqOpts.seqMethod
|
|
288
|
-
return [formatText(seqMethod ? seqMethod(params) :
|
|
290
|
+
return [formatText(seqMethod ? seqMethod(params) : treeConfig ? seq : (seqOpts.startIndex || 0) + (seq as number), 1)]
|
|
289
291
|
},
|
|
290
292
|
renderTreeIndexCell (params: VxeTableDefines.CellRenderBodyParams) {
|
|
291
|
-
return Cell.renderTreeIcon(params, Cell.
|
|
293
|
+
return Cell.renderTreeIcon(params, Cell.renderSeqCell(params) as VNode[])
|
|
292
294
|
},
|
|
293
295
|
|
|
294
296
|
/**
|
|
@@ -371,7 +373,7 @@ export const Cell = {
|
|
|
371
373
|
/**
|
|
372
374
|
* 多选
|
|
373
375
|
*/
|
|
374
|
-
|
|
376
|
+
renderCheckboxHeader (params: VxeTableDefines.CellRenderHeaderParams) {
|
|
375
377
|
const { $table, column, isHidden } = params
|
|
376
378
|
const { reactData } = $table
|
|
377
379
|
const { computeIsAllCheckboxDisabled, computeCheckboxOpts } = $table.getComputeMaps()
|
|
@@ -431,7 +433,7 @@ export const Cell = {
|
|
|
431
433
|
] : []))
|
|
432
434
|
])
|
|
433
435
|
},
|
|
434
|
-
|
|
436
|
+
renderCheckboxCell (params: VxeTableDefines.CellRenderBodyParams) {
|
|
435
437
|
const { $table, row, column, isHidden } = params
|
|
436
438
|
const { props, reactData } = $table
|
|
437
439
|
const { treeConfig } = props
|
|
@@ -500,9 +502,9 @@ export const Cell = {
|
|
|
500
502
|
]
|
|
501
503
|
},
|
|
502
504
|
renderTreeSelectionCell (params: VxeTableDefines.CellRenderBodyParams) {
|
|
503
|
-
return Cell.renderTreeIcon(params, Cell.
|
|
505
|
+
return Cell.renderTreeIcon(params, Cell.renderCheckboxCell(params))
|
|
504
506
|
},
|
|
505
|
-
|
|
507
|
+
renderCheckboxCellByProp (params: VxeTableDefines.CellRenderBodyParams) {
|
|
506
508
|
const { $table, row, column, isHidden } = params
|
|
507
509
|
const { props, reactData } = $table
|
|
508
510
|
const { treeConfig } = props
|
|
@@ -571,7 +573,7 @@ export const Cell = {
|
|
|
571
573
|
]
|
|
572
574
|
},
|
|
573
575
|
renderTreeSelectionCellByProp (params: VxeTableDefines.CellRenderBodyParams) {
|
|
574
|
-
return Cell.renderTreeIcon(params, Cell.
|
|
576
|
+
return Cell.renderTreeIcon(params, Cell.renderCheckboxCellByProp(params))
|
|
575
577
|
},
|
|
576
578
|
|
|
577
579
|
/**
|
|
@@ -34,15 +34,15 @@ export default {
|
|
|
34
34
|
footerAlign: { type: String as PropType<VxeTablePropTypes.FooterAlign>, default: () => GlobalConfig.table.footerAlign },
|
|
35
35
|
// 是否显示表头
|
|
36
36
|
showHeader: { type: Boolean as PropType<VxeTablePropTypes.ShowHeader>, default: () => GlobalConfig.table.showHeader },
|
|
37
|
-
//
|
|
37
|
+
// (即将废弃)是否要高亮当前选中行
|
|
38
38
|
highlightCurrentRow: { type: Boolean as PropType<VxeTablePropTypes.HighlightCurrentRow>, default: () => GlobalConfig.table.highlightCurrentRow },
|
|
39
|
-
//
|
|
39
|
+
// (即将废弃)鼠标移到行是否要高亮显示
|
|
40
40
|
highlightHoverRow: { type: Boolean as PropType<VxeTablePropTypes.HighlightHoverRow>, default: () => GlobalConfig.table.highlightHoverRow },
|
|
41
|
-
//
|
|
41
|
+
// (即将废弃)是否要高亮当前选中列
|
|
42
42
|
highlightCurrentColumn: { type: Boolean as PropType<VxeTablePropTypes.HighlightCurrentColumn>, default: () => GlobalConfig.table.highlightCurrentColumn },
|
|
43
|
-
//
|
|
43
|
+
// (即将废弃)鼠标移到列是否要高亮显示
|
|
44
44
|
highlightHoverColumn: { type: Boolean as PropType<VxeTablePropTypes.HighlightHoverColumn>, default: () => GlobalConfig.table.highlightHoverColumn },
|
|
45
|
-
//
|
|
45
|
+
// (即将废弃)激活单元格编辑时是否高亮显示
|
|
46
46
|
highlightCell: Boolean as PropType<VxeTablePropTypes.HighlightCell>,
|
|
47
47
|
// 是否显示表尾合计
|
|
48
48
|
showFooter: Boolean as PropType<VxeTablePropTypes.ShowFooter>,
|
|
@@ -153,7 +153,7 @@ export default {
|
|
|
153
153
|
scrollX: Object as PropType<VxeTablePropTypes.ScrollX>,
|
|
154
154
|
// 纵向虚拟滚动配置项
|
|
155
155
|
scrollY: Object as PropType<VxeTablePropTypes.ScrollY>,
|
|
156
|
-
//
|
|
156
|
+
// (即将废弃)优化相关
|
|
157
157
|
animat: { type: Boolean as PropType<VxeTablePropTypes.Animat>, default: () => GlobalConfig.table.animat },
|
|
158
158
|
delayHover: { type: Number as PropType<VxeTablePropTypes.DelayHover>, default: () => GlobalConfig.table.delayHover as number },
|
|
159
159
|
// 额外的参数
|