vxe-table 3.21.3 → 3.21.5
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/locale/lang/ar-EG.js +2 -2
- package/es/locale/lang/de-DE.js +1 -1
- package/es/locale/lang/en-US.js +1 -1
- package/es/locale/lang/fr-FR.js +2 -2
- package/es/locale/lang/hu-HU.js +1 -1
- package/es/locale/lang/hy-AM.js +1 -1
- package/es/locale/lang/id-ID.js +2 -2
- package/es/locale/lang/it-IT.js +1 -1
- package/es/locale/lang/ko-KR.js +1 -1
- package/es/locale/lang/ms-MY.js +2 -2
- package/es/locale/lang/nb-NO.js +2 -2
- package/es/locale/lang/pt-BR.js +2 -2
- package/es/locale/lang/th-TH.js +1 -1
- package/es/locale/lang/ug-CN.js +1 -1
- package/es/locale/lang/uk-UA.js +1 -1
- package/es/locale/lang/uz-UZ.js +1 -1
- package/es/style.css +1 -1
- package/es/table/module/export/mixin.js +74 -14
- package/es/table/src/cell.js +15 -8
- package/es/table/src/columnInfo.js +1 -4
- package/es/table/src/methods.js +84 -0
- package/es/table/src/util.js +1 -0
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +128 -52
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.js +2 -2
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/ar-EG.umd.js +2 -2
- package/lib/locale/lang/de-DE.js +1 -1
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/de-DE.umd.js +1 -1
- package/lib/locale/lang/en-US.js +1 -1
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +1 -1
- package/lib/locale/lang/fr-FR.js +2 -2
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/fr-FR.umd.js +2 -2
- package/lib/locale/lang/hu-HU.js +1 -1
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +1 -1
- package/lib/locale/lang/hy-AM.js +1 -1
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/hy-AM.umd.js +1 -1
- package/lib/locale/lang/id-ID.js +2 -2
- package/lib/locale/lang/id-ID.min.js +1 -1
- package/lib/locale/lang/id-ID.umd.js +2 -2
- package/lib/locale/lang/it-IT.js +1 -1
- package/lib/locale/lang/it-IT.min.js +1 -1
- package/lib/locale/lang/it-IT.umd.js +1 -1
- package/lib/locale/lang/ko-KR.js +1 -1
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +1 -1
- package/lib/locale/lang/ms-MY.js +2 -2
- package/lib/locale/lang/ms-MY.min.js +1 -1
- package/lib/locale/lang/ms-MY.umd.js +2 -2
- package/lib/locale/lang/nb-NO.js +2 -2
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/nb-NO.umd.js +2 -2
- package/lib/locale/lang/pt-BR.js +2 -2
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +2 -2
- package/lib/locale/lang/th-TH.js +1 -1
- package/lib/locale/lang/th-TH.min.js +1 -1
- package/lib/locale/lang/th-TH.umd.js +1 -1
- package/lib/locale/lang/ug-CN.js +1 -1
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/ug-CN.umd.js +1 -1
- package/lib/locale/lang/uk-UA.js +1 -1
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +1 -1
- package/lib/locale/lang/uz-UZ.js +1 -1
- package/lib/locale/lang/uz-UZ.min.js +1 -1
- package/lib/locale/lang/uz-UZ.umd.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/export/mixin.js +107 -33
- package/lib/table/module/export/mixin.min.js +1 -1
- package/lib/table/src/cell.js +14 -9
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/columnInfo.js +1 -5
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/methods.js +3 -3
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/util.js +1 -0
- package/lib/table/src/util.min.js +1 -1
- package/lib/ui/index.js +1 -1
- 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/package.json +2 -2
- package/packages/locale/lang/ar-EG.ts +850 -850
- package/packages/locale/lang/de-DE.ts +850 -850
- package/packages/locale/lang/en-US.ts +850 -850
- package/packages/locale/lang/es-ES.ts +850 -850
- package/packages/locale/lang/fr-FR.ts +850 -850
- package/packages/locale/lang/hu-HU.ts +850 -850
- package/packages/locale/lang/hy-AM.ts +850 -850
- package/packages/locale/lang/id-ID.ts +850 -850
- package/packages/locale/lang/it-IT.ts +850 -850
- package/packages/locale/lang/ja-JP.ts +850 -850
- package/packages/locale/lang/ko-KR.ts +850 -850
- package/packages/locale/lang/ms-MY.ts +850 -850
- package/packages/locale/lang/nb-NO.ts +850 -850
- package/packages/locale/lang/pt-BR.ts +850 -850
- package/packages/locale/lang/ru-RU.ts +850 -850
- package/packages/locale/lang/th-TH.ts +850 -850
- package/packages/locale/lang/ug-CN.ts +850 -850
- package/packages/locale/lang/uk-UA.ts +850 -850
- package/packages/locale/lang/uz-UZ.ts +850 -850
- package/packages/locale/lang/vi-VN.ts +850 -850
- package/packages/locale/lang/zh-CHT.ts +850 -850
- package/packages/table/module/export/mixin.ts +73 -15
- package/packages/table/src/cell.ts +14 -8
- package/packages/table/src/columnInfo.ts +1 -5
- package/packages/table/src/methods.ts +85 -0
- package/packages/table/src/util.ts +1 -0
- /package/es/{iconfont.1779843521280.ttf → iconfont.1780200130470.ttf} +0 -0
- /package/es/{iconfont.1779843521280.woff → iconfont.1780200130470.woff} +0 -0
- /package/es/{iconfont.1779843521280.woff2 → iconfont.1780200130470.woff2} +0 -0
- /package/lib/{iconfont.1779843521280.ttf → iconfont.1780200130470.ttf} +0 -0
- /package/lib/{iconfont.1779843521280.woff → iconfont.1780200130470.woff} +0 -0
- /package/lib/{iconfont.1779843521280.woff2 → iconfont.1780200130470.woff2} +0 -0
|
@@ -56,13 +56,15 @@ const toStringValue = (cellValue: any) => {
|
|
|
56
56
|
return eqEmptyValue(cellValue) ? '' : `${cellValue}`
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
function getBodyLabelData ($xeTable: VxeTableConstructor, opts: VxeTablePropTypes.ExportHandleOptions, columns: VxeTableDefines.ColumnInfo[], datas: any[]) {
|
|
59
|
+
function getBodyLabelData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: VxeTablePropTypes.ExportHandleOptions, columns: VxeTableDefines.ColumnInfo[], datas: any[]) {
|
|
60
60
|
const props = $xeTable
|
|
61
61
|
const reactData = $xeTable as unknown as TableReactData
|
|
62
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
62
63
|
|
|
63
|
-
const { isTreeAllExpanded, isRowGroupAllExpanded, mode } = opts
|
|
64
|
+
const { isTreeAllExpanded, isRowGroupAllExpanded, mode: expMode } = opts
|
|
64
65
|
const { treeConfig } = props
|
|
65
66
|
const { isRowGroupStatus } = reactData
|
|
67
|
+
const { fullColumnFieldData } = internalData
|
|
66
68
|
const radioOpts = $xeTable.computeRadioOpts
|
|
67
69
|
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
68
70
|
const treeOpts = $xeTable.computeTreeOpts
|
|
@@ -74,8 +76,7 @@ function getBodyLabelData ($xeTable: VxeTableConstructor, opts: VxeTablePropType
|
|
|
74
76
|
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
75
77
|
if (isRowGroupStatus) {
|
|
76
78
|
// 如果是数据分组
|
|
77
|
-
|
|
78
|
-
const { mapChildrenField } = aggregateOpts
|
|
79
|
+
const { mode: aggMode, showTotal, totalMethod, countFields, contentMethod, formatValuesMethod, mapChildrenField } = aggregateOpts
|
|
79
80
|
const rest: any[] = []
|
|
80
81
|
const expandMaps: Record<string, boolean> = {}
|
|
81
82
|
const useMaps: Record<string, boolean> = {}
|
|
@@ -96,8 +97,9 @@ function getBodyLabelData ($xeTable: VxeTableConstructor, opts: VxeTablePropType
|
|
|
96
97
|
_expand: hasRowChild && $xeTable.isRowExpandByRow(row)
|
|
97
98
|
}
|
|
98
99
|
columns.forEach((column, $columnIndex) => {
|
|
100
|
+
const { field, editRender, cellRender, aggFunc, rowGroupNode } = column
|
|
99
101
|
let cellValue: string | number | boolean | null = ''
|
|
100
|
-
const renderOpts =
|
|
102
|
+
const renderOpts = editRender || cellRender
|
|
101
103
|
let bodyExportMethod: VxeColumnPropTypes.ExportMethod | undefined = column.exportMethod || columnOpts.exportMethod
|
|
102
104
|
if (!bodyExportMethod && renderOpts && renderOpts.name) {
|
|
103
105
|
const compConf = renderer.get(renderOpts.name)
|
|
@@ -114,21 +116,75 @@ function getBodyLabelData ($xeTable: VxeTableConstructor, opts: VxeTablePropType
|
|
|
114
116
|
switch (column.type) {
|
|
115
117
|
case 'seq': {
|
|
116
118
|
const seqVal = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('')
|
|
117
|
-
cellValue =
|
|
119
|
+
cellValue = expMode === 'all' ? seqVal : getSeq($xeTable, seqVal, row, $rowIndex, column, $columnIndex)
|
|
118
120
|
break
|
|
119
121
|
}
|
|
120
|
-
case 'checkbox':
|
|
122
|
+
case 'checkbox': {
|
|
121
123
|
cellValue = toBooleanValue($xeTable.isCheckedByCheckboxRow(row))
|
|
122
124
|
item._checkboxLabel = checkboxOpts.labelField ? XEUtils.get(row, checkboxOpts.labelField) : ''
|
|
123
125
|
item._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({ $table: $xeTable, row })
|
|
124
126
|
break
|
|
125
|
-
|
|
127
|
+
}
|
|
128
|
+
case 'radio': {
|
|
126
129
|
cellValue = toBooleanValue($xeTable.isCheckedByRadioRow(row))
|
|
127
130
|
item._radioLabel = radioOpts.labelField ? XEUtils.get(row, radioOpts.labelField) : ''
|
|
128
131
|
item._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({ $table: $xeTable, row })
|
|
129
132
|
break
|
|
130
|
-
|
|
131
|
-
|
|
133
|
+
}
|
|
134
|
+
default: {
|
|
135
|
+
if (field && row.isAggregate) {
|
|
136
|
+
const aggRow: VxeTableDefines.AggregateRowInfo = row
|
|
137
|
+
const aggData = aggRow.aggData
|
|
138
|
+
const currAggData = aggData ? aggData[field] : null
|
|
139
|
+
const groupField = aggRow.groupField
|
|
140
|
+
const groupContent = aggRow.groupContent
|
|
141
|
+
const childList = mapChildrenField ? (aggRow[mapChildrenField] || []) : []
|
|
142
|
+
const childCount = aggRow.childCount
|
|
143
|
+
const colRest = fullColumnFieldData[groupField] || {}
|
|
144
|
+
const ctParams = {
|
|
145
|
+
$table: $xeTable,
|
|
146
|
+
groupField,
|
|
147
|
+
groupColumn: (colRest ? colRest.column : null) as VxeTableDefines.ColumnInfo,
|
|
148
|
+
column,
|
|
149
|
+
groupValue: groupContent,
|
|
150
|
+
childList,
|
|
151
|
+
childCount,
|
|
152
|
+
aggValue: null as any,
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* 已废弃
|
|
156
|
+
* @deprecated
|
|
157
|
+
*/
|
|
158
|
+
children: childList,
|
|
159
|
+
/**
|
|
160
|
+
* 已废弃
|
|
161
|
+
* @deprecated
|
|
162
|
+
*/
|
|
163
|
+
totalValue: childCount
|
|
164
|
+
}
|
|
165
|
+
if (aggMode === 'column' ? field === aggRow.groupField : rowGroupNode) {
|
|
166
|
+
cellValue = groupContent
|
|
167
|
+
if (contentMethod) {
|
|
168
|
+
cellValue = `${contentMethod(ctParams)}`
|
|
169
|
+
}
|
|
170
|
+
if (showTotal) {
|
|
171
|
+
cellValue = getI18n('vxe.table.rowGroupContentTotal', [cellValue, totalMethod ? totalMethod(ctParams) : childCount, childCount])
|
|
172
|
+
}
|
|
173
|
+
} else if ($xeTable.getPivotTableAggregateCellAggValue) {
|
|
174
|
+
const aggParams = {
|
|
175
|
+
$table: $xeTable,
|
|
176
|
+
row,
|
|
177
|
+
column
|
|
178
|
+
}
|
|
179
|
+
cellValue = $xeTable.getPivotTableAggregateCellAggValue(aggParams)
|
|
180
|
+
} else if (aggFunc === true || (countFields && countFields.includes(field))) {
|
|
181
|
+
cellValue = currAggData ? currAggData.value : childCount
|
|
182
|
+
ctParams.aggValue = cellValue
|
|
183
|
+
if (formatValuesMethod) {
|
|
184
|
+
cellValue = formatValuesMethod(ctParams)
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
} else if (opts.original) {
|
|
132
188
|
cellValue = getCellValue(row, column)
|
|
133
189
|
} else {
|
|
134
190
|
cellValue = $xeTable.getCellLabel(row, column)
|
|
@@ -142,6 +198,8 @@ function getBodyLabelData ($xeTable: VxeTableConstructor, opts: VxeTablePropType
|
|
|
142
198
|
}
|
|
143
199
|
}
|
|
144
200
|
}
|
|
201
|
+
break
|
|
202
|
+
}
|
|
145
203
|
}
|
|
146
204
|
}
|
|
147
205
|
item[column.id] = toStringValue(cellValue)
|
|
@@ -196,7 +254,7 @@ function getBodyLabelData ($xeTable: VxeTableConstructor, opts: VxeTablePropType
|
|
|
196
254
|
switch (column.type) {
|
|
197
255
|
case 'seq': {
|
|
198
256
|
const seqVal = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('')
|
|
199
|
-
cellValue =
|
|
257
|
+
cellValue = expMode === 'all' ? seqVal : getSeq($xeTable, seqVal, row, $rowIndex, column, $columnIndex)
|
|
200
258
|
break
|
|
201
259
|
}
|
|
202
260
|
case 'checkbox':
|
|
@@ -257,7 +315,7 @@ function getBodyLabelData ($xeTable: VxeTableConstructor, opts: VxeTablePropType
|
|
|
257
315
|
switch (column.type) {
|
|
258
316
|
case 'seq': {
|
|
259
317
|
const seqValue = $rowIndex + 1
|
|
260
|
-
cellValue =
|
|
318
|
+
cellValue = expMode === 'all' ? seqValue : getSeq($xeTable, seqValue, row, $rowIndex, column, $columnIndex)
|
|
261
319
|
break
|
|
262
320
|
}
|
|
263
321
|
case 'checkbox':
|
|
@@ -312,7 +370,7 @@ function getBooleanValue (cellValue: any) {
|
|
|
312
370
|
function getHeaderTitle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: VxeTablePropTypes.ExportHandleOptions, column: VxeTableDefines.ColumnInfo) {
|
|
313
371
|
const columnOpts = $xeTable.computeColumnOpts
|
|
314
372
|
const headExportMethod = column.headerExportMethod || columnOpts.headerExportMethod
|
|
315
|
-
return headExportMethod ? headExportMethod({ column, options: opts, $table: $xeTable }) : ((opts.isTitle ?
|
|
373
|
+
return headExportMethod ? headExportMethod({ column, options: opts, $table: $xeTable }) : ((opts.isTitle ? $xeTable.getHeaderCellLabel(column) : column.field) || '')
|
|
316
374
|
}
|
|
317
375
|
|
|
318
376
|
function getFooterCellValue ($xeTable: any, opts: VxeTablePropTypes.ExportHandleOptions, row: any, column: VxeTableDefines.ColumnInfo) {
|
|
@@ -888,12 +946,12 @@ function handleImport ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, c
|
|
|
888
946
|
const tableTitleMaps: Record<string, VxeTableDefines.ColumnInfo> = {}
|
|
889
947
|
tableFullColumn.forEach((column) => {
|
|
890
948
|
const field = column.field
|
|
891
|
-
const title =
|
|
949
|
+
const title = $xeTable.getHeaderCellLabel(column)
|
|
892
950
|
if (field) {
|
|
893
951
|
tableFieldMaps[field] = column
|
|
894
952
|
}
|
|
895
953
|
if (title) {
|
|
896
|
-
tableTitleMaps[
|
|
954
|
+
tableTitleMaps[title] = column
|
|
897
955
|
}
|
|
898
956
|
})
|
|
899
957
|
const tableConf = {
|
|
@@ -379,7 +379,7 @@ export const Cell = {
|
|
|
379
379
|
return getSlotVNs(renderTitleContent(h, params, rtHeader.call($table, h, renderOpts, params))) as VNode[]
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
|
-
return renderTitleContent(h, params,
|
|
382
|
+
return renderTitleContent(h, params, $table.getHeaderCellLabel(column))
|
|
383
383
|
},
|
|
384
384
|
renderDefaultHeader (h: CreateElement, params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
|
|
385
385
|
return renderHeaderCellBaseVNs(h, params, Cell.renderHeaderTitle(h, params))
|
|
@@ -391,7 +391,7 @@ export const Cell = {
|
|
|
391
391
|
const tableInternalData = $table as unknown as TableInternalData
|
|
392
392
|
const { isRowGroupStatus } = tableReactData
|
|
393
393
|
const { editConfig } = tableProps
|
|
394
|
-
const { field, slots, editRender, cellRender, rowGroupNode, aggFunc
|
|
394
|
+
const { field, slots, editRender, cellRender, rowGroupNode, aggFunc } = column
|
|
395
395
|
const isEnableEdit = editConfig && isEnableConf(editConfig)
|
|
396
396
|
const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null
|
|
397
397
|
const cellRenderOpts = isEnableConf(cellRender) ? cellRender : null
|
|
@@ -464,8 +464,9 @@ export const Cell = {
|
|
|
464
464
|
return renderCellBaseVNs(h, params, $table.callSlot(defaultSlot, params, h))
|
|
465
465
|
}
|
|
466
466
|
const renderOpts = editRenderOpts || cellRenderOpts
|
|
467
|
-
//
|
|
468
|
-
|
|
467
|
+
// 如果是编辑表格:renderTableCell > formatter
|
|
468
|
+
// 如果是查看表格:renderTableDefault > formatter
|
|
469
|
+
if (renderOpts) {
|
|
469
470
|
const compConf = renderer.get(renderOpts.name)
|
|
470
471
|
if (compConf) {
|
|
471
472
|
const renderFn = editRenderOpts ? (compConf.renderTableCell || compConf.renderCell) : (compConf.renderTableDefault || compConf.renderDefault)
|
|
@@ -622,7 +623,12 @@ export const Cell = {
|
|
|
622
623
|
if (rowGroupList.length) {
|
|
623
624
|
const aggregateOpts = $table.computeAggregateOpts
|
|
624
625
|
const { mode } = aggregateOpts
|
|
625
|
-
if (mode === 'column'
|
|
626
|
+
if (mode === 'column') {
|
|
627
|
+
if (row.groupField && column.field === row.groupField) {
|
|
628
|
+
return [Cell.renderRowGroupBtn(h, params, cellVNodes)]
|
|
629
|
+
}
|
|
630
|
+
return cellVNodes
|
|
631
|
+
} else if (rowGroupNode) {
|
|
626
632
|
return [Cell.renderRowGroupBtn(h, params, cellVNodes)]
|
|
627
633
|
}
|
|
628
634
|
}
|
|
@@ -635,7 +641,7 @@ export const Cell = {
|
|
|
635
641
|
renderSeqHeader (h: CreateElement, params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
|
|
636
642
|
const { $table, column } = params
|
|
637
643
|
const { slots } = column
|
|
638
|
-
return renderHeaderCellBaseVNs(h, params, renderTitleContent(h, params, slots && slots.header ? $table.callSlot(slots.header, params, h) :
|
|
644
|
+
return renderHeaderCellBaseVNs(h, params, renderTitleContent(h, params, slots && slots.header ? $table.callSlot(slots.header, params, h) : $table.getHeaderCellLabel(column)))
|
|
639
645
|
},
|
|
640
646
|
renderSeqCell (h: CreateElement, params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
|
|
641
647
|
const { $table, column } = params
|
|
@@ -670,7 +676,7 @@ export const Cell = {
|
|
|
670
676
|
: [
|
|
671
677
|
h('span', {
|
|
672
678
|
class: 'vxe-radio--label'
|
|
673
|
-
}, titleSlot ? $table.callSlot(titleSlot, params, h) :
|
|
679
|
+
}, titleSlot ? $table.callSlot(titleSlot, params, h) : $table.getHeaderCellLabel(column))
|
|
674
680
|
])
|
|
675
681
|
)
|
|
676
682
|
},
|
|
@@ -746,7 +752,7 @@ export const Cell = {
|
|
|
746
752
|
const titleSlot = slots ? slots.title : null
|
|
747
753
|
const checkboxOpts = $table.computeCheckboxOpts
|
|
748
754
|
const { checkStrictly, showHeader, headerTitle } = checkboxOpts
|
|
749
|
-
const colTitle =
|
|
755
|
+
const colTitle = $table.getHeaderCellLabel(column)
|
|
750
756
|
const ons: Record<string, any> = {}
|
|
751
757
|
if (!isHidden) {
|
|
752
758
|
ons.click = (evnt: MouseEvent) => {
|
|
@@ -16,7 +16,7 @@ export class ColumnInfo {
|
|
|
16
16
|
const $xeGantt = $xeTable.$xeGantt
|
|
17
17
|
const $xeGGWrapper = $xeGrid || $xeGantt
|
|
18
18
|
|
|
19
|
-
const { field, editRender, filterRender
|
|
19
|
+
const { field, editRender, filterRender } = _vm
|
|
20
20
|
|
|
21
21
|
const colId = _vm.colId || XEUtils.uniqueId('col_')
|
|
22
22
|
|
|
@@ -29,10 +29,6 @@ export class ColumnInfo {
|
|
|
29
29
|
|
|
30
30
|
const filters = toFilters(_vm.filters, colId)
|
|
31
31
|
|
|
32
|
-
if (headerFormatter) {
|
|
33
|
-
errLog('vxe.error.notProp', ['header-formatter'])
|
|
34
|
-
}
|
|
35
|
-
|
|
36
32
|
const types = ['seq', 'checkbox', 'radio', 'expand', 'html']
|
|
37
33
|
if (_vm.type && types.indexOf(_vm.type) === -1) {
|
|
38
34
|
warnLog('vxe.error.errProp', [`type=${_vm.type}`, types.join(', ')])
|
|
@@ -3931,6 +3931,7 @@ function handleInitColumn ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
|
|
|
3931
3931
|
loadScrollXData($xeTable)
|
|
3932
3932
|
}
|
|
3933
3933
|
})
|
|
3934
|
+
$xeTable.clearHeaderFormatterCache()
|
|
3934
3935
|
$xeTable.clearMergeCells()
|
|
3935
3936
|
$xeTable.clearMergeFooterItems()
|
|
3936
3937
|
$xeTable.handleTableData(true)
|
|
@@ -5626,6 +5627,89 @@ const tableMethods: any = {
|
|
|
5626
5627
|
}
|
|
5627
5628
|
return $xeTable.$nextTick()
|
|
5628
5629
|
},
|
|
5630
|
+
getHeaderCellLabel (fieldOrColumn: string | VxeTableDefines.ColumnInfo) {
|
|
5631
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
5632
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
5633
|
+
|
|
5634
|
+
const column = handleFieldOrColumn($xeTable, fieldOrColumn)
|
|
5635
|
+
if (!column) {
|
|
5636
|
+
return null
|
|
5637
|
+
}
|
|
5638
|
+
const { headerFormatter } = column
|
|
5639
|
+
const _columnIndex = $xeTable.getVTColumnIndex(column)
|
|
5640
|
+
let cellLabel = column.getTitle()
|
|
5641
|
+
if (headerFormatter) {
|
|
5642
|
+
let formatData: Record<string, VxeTableDefines.RowCacheFormatObj> | undefined
|
|
5643
|
+
const { headerFullDataColData } = internalData
|
|
5644
|
+
const colid = column.id
|
|
5645
|
+
let colRest = headerFullDataColData[colid]
|
|
5646
|
+
if (!colRest) {
|
|
5647
|
+
colRest = headerFullDataColData[colid] = {}
|
|
5648
|
+
}
|
|
5649
|
+
const formatObj = colRest.formatObj
|
|
5650
|
+
if (formatObj && formatObj.value === cellLabel) {
|
|
5651
|
+
return formatObj.label
|
|
5652
|
+
}
|
|
5653
|
+
const headFormatParams = {
|
|
5654
|
+
$table: $xeTable,
|
|
5655
|
+
cellTitle: cellLabel,
|
|
5656
|
+
cellValue: cellLabel,
|
|
5657
|
+
column,
|
|
5658
|
+
_columnIndex,
|
|
5659
|
+
columnIndex: $xeTable.getColumnIndex(column)
|
|
5660
|
+
}
|
|
5661
|
+
if (XEUtils.isString(headerFormatter)) {
|
|
5662
|
+
const gFormatOpts = formats.get(headerFormatter)
|
|
5663
|
+
const fcFormatMethod = gFormatOpts ? gFormatOpts.tableHeaderCellFormatMethod : null
|
|
5664
|
+
cellLabel = XEUtils.toValueString(fcFormatMethod ? fcFormatMethod(headFormatParams) : '')
|
|
5665
|
+
} else if (XEUtils.isArray(headerFormatter)) {
|
|
5666
|
+
const gFormatOpts = formats.get(headerFormatter[0])
|
|
5667
|
+
const fcFormatMethod = gFormatOpts ? gFormatOpts.tableHeaderCellFormatMethod : null
|
|
5668
|
+
cellLabel = XEUtils.toValueString(fcFormatMethod ? fcFormatMethod(headFormatParams, ...headerFormatter.slice(1)) : '')
|
|
5669
|
+
} else {
|
|
5670
|
+
cellLabel = XEUtils.toValueString(headerFormatter(headFormatParams))
|
|
5671
|
+
}
|
|
5672
|
+
if (formatData) {
|
|
5673
|
+
colRest.formatObj = { value: cellLabel, label: cellLabel }
|
|
5674
|
+
}
|
|
5675
|
+
}
|
|
5676
|
+
return cellLabel
|
|
5677
|
+
},
|
|
5678
|
+
updateHeaderCellLabel (fieldOrColumn: string | VxeTableDefines.ColumnInfo) {
|
|
5679
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
5680
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
5681
|
+
|
|
5682
|
+
const column = handleFieldOrColumn($xeTable, fieldOrColumn)
|
|
5683
|
+
if (!column) {
|
|
5684
|
+
return ''
|
|
5685
|
+
}
|
|
5686
|
+
const { headerFullDataColData } = internalData
|
|
5687
|
+
const colid = column.id
|
|
5688
|
+
const colRest = headerFullDataColData[colid]
|
|
5689
|
+
if (colRest) {
|
|
5690
|
+
colRest.formatObj = undefined
|
|
5691
|
+
}
|
|
5692
|
+
return $xeTable.getHeaderCellLabel(column)
|
|
5693
|
+
},
|
|
5694
|
+
clearHeaderFormatterCache (isUpdate?: boolean) {
|
|
5695
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
5696
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
5697
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
5698
|
+
|
|
5699
|
+
const { tableColumn } = reactData
|
|
5700
|
+
const { headerFullDataColData } = internalData
|
|
5701
|
+
XEUtils.each(headerFullDataColData, (colRest: VxeTableDefines.HeaderColCacheItem) => {
|
|
5702
|
+
if (colRest.formatObj) {
|
|
5703
|
+
colRest.formatObj = undefined
|
|
5704
|
+
}
|
|
5705
|
+
})
|
|
5706
|
+
if (isUpdate) {
|
|
5707
|
+
tableColumn.forEach(column => {
|
|
5708
|
+
$xeTable.getHeaderCellLabel(column)
|
|
5709
|
+
})
|
|
5710
|
+
}
|
|
5711
|
+
return $xeTable.$nextTick()
|
|
5712
|
+
},
|
|
5629
5713
|
getFooterCellLabel (row: any, fieldOrColumn: string | VxeTableDefines.ColumnInfo) {
|
|
5630
5714
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
5631
5715
|
const reactData = $xeTable as unknown as TableReactData
|
|
@@ -12876,6 +12960,7 @@ const tableMethods: any = {
|
|
|
12876
12960
|
footData = visibleColumn.length ? footerMethod({ columns: visibleColumn, data: afterFullData, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }) : []
|
|
12877
12961
|
}
|
|
12878
12962
|
reactData.footerTableData = footData
|
|
12963
|
+
$xeTable.clearFooterFormatterCache()
|
|
12879
12964
|
$xeTable.handleUpdateFooterMerge()
|
|
12880
12965
|
$xeTable.dispatchEvent('footer-data-change', {
|
|
12881
12966
|
visibleColumn: internalData.visibleColumn,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|