vxe-table 3.15.26 → 3.15.27
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/style.css +1 -1
- package/es/table/src/cell.js +3 -1
- package/es/table/src/methods.js +2 -6
- package/es/table/src/table.js +30 -1
- package/es/table/src/util.js +21 -17
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +73 -26
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/src/cell.js +3 -1
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/methods.js +4 -6
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +32 -0
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +33 -17
- 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 +1 -1
- package/packages/table/src/cell.ts +3 -1
- package/packages/table/src/methods.ts +2 -6
- package/packages/table/src/table.ts +41 -7
- package/packages/table/src/util.ts +24 -19
- /package/es/{iconfont.1747024909816.ttf → iconfont.1747094784148.ttf} +0 -0
- /package/es/{iconfont.1747024909816.woff → iconfont.1747094784148.woff} +0 -0
- /package/es/{iconfont.1747024909816.woff2 → iconfont.1747094784148.woff2} +0 -0
- /package/lib/{iconfont.1747024909816.ttf → iconfont.1747094784148.ttf} +0 -0
- /package/lib/{iconfont.1747024909816.woff → iconfont.1747094784148.woff} +0 -0
- /package/lib/{iconfont.1747024909816.woff2 → iconfont.1747094784148.woff2} +0 -0
|
@@ -2,7 +2,7 @@ import { CreateElement } from 'vue'
|
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import { getFuncText, isEnableConf } from '../../ui/src/utils'
|
|
4
4
|
import { initTpImg } from '../../ui/src/dom'
|
|
5
|
-
import { createHandleGetRowId, getCellHeight } from './util'
|
|
5
|
+
import { createHandleGetRowId, getCellHeight, hasDeepKey } from './util'
|
|
6
6
|
import { VxeUI } from '../../ui'
|
|
7
7
|
import methods from './methods'
|
|
8
8
|
import TableBodyComponent from './body'
|
|
@@ -30,6 +30,14 @@ import type { VxeTableConstructor, VxeTablePrivateMethods, TableInternalData, Ta
|
|
|
30
30
|
|
|
31
31
|
const { getConfig, getIcon, getI18n, renderer, globalResize, globalEvents, globalMixins, renderEmptyElement } = VxeUI
|
|
32
32
|
|
|
33
|
+
function handleKeyField ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
34
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
35
|
+
|
|
36
|
+
const keyField = $xeTable.computeRowField
|
|
37
|
+
internalData.currKeyField = keyField
|
|
38
|
+
internalData.isCurrDeepKey = hasDeepKey(keyField)
|
|
39
|
+
}
|
|
40
|
+
|
|
33
41
|
/**
|
|
34
42
|
* 渲染浮固定列
|
|
35
43
|
* 分别渲染左边固定列和右边固定列
|
|
@@ -730,6 +738,13 @@ export default {
|
|
|
730
738
|
}
|
|
731
739
|
return ''
|
|
732
740
|
},
|
|
741
|
+
computeRowField () {
|
|
742
|
+
const $xeTable = this
|
|
743
|
+
const props = $xeTable
|
|
744
|
+
|
|
745
|
+
const rowOpts = $xeTable.computeRowOpts
|
|
746
|
+
return `${props.rowId || rowOpts.keyField || '_X_ROW_KEY'}`
|
|
747
|
+
},
|
|
733
748
|
validOpts () {
|
|
734
749
|
return this.computeValidOpts
|
|
735
750
|
},
|
|
@@ -1202,12 +1217,12 @@ export default {
|
|
|
1202
1217
|
return fixedSize
|
|
1203
1218
|
},
|
|
1204
1219
|
fixedColumnSize () {
|
|
1205
|
-
const $xeTable = this
|
|
1220
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1206
1221
|
|
|
1207
1222
|
return $xeTable.computeFixedColumnSize
|
|
1208
1223
|
},
|
|
1209
1224
|
computeIsMaxFixedColumn () {
|
|
1210
|
-
const $xeTable = this
|
|
1225
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1211
1226
|
|
|
1212
1227
|
const fixedColumnSize = $xeTable.computeFixedColumnSize
|
|
1213
1228
|
const columnOpts = $xeTable.columnOpts
|
|
@@ -1252,8 +1267,8 @@ export default {
|
|
|
1252
1267
|
return false
|
|
1253
1268
|
},
|
|
1254
1269
|
computeVirtualScrollBars () {
|
|
1255
|
-
const $xeTable = this
|
|
1256
|
-
const reactData = $xeTable
|
|
1270
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1271
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
1257
1272
|
|
|
1258
1273
|
const { overflowX, scrollXLoad, overflowY, scrollYLoad } = reactData
|
|
1259
1274
|
return {
|
|
@@ -1333,7 +1348,7 @@ export default {
|
|
|
1333
1348
|
this.reScrollFlag++
|
|
1334
1349
|
},
|
|
1335
1350
|
reScrollFlag () {
|
|
1336
|
-
const $xeTable = this
|
|
1351
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1337
1352
|
|
|
1338
1353
|
$xeTable.$nextTick(() => {
|
|
1339
1354
|
$xeTable.recalculate(true).then(() => $xeTable.refreshScroll())
|
|
@@ -1365,7 +1380,7 @@ export default {
|
|
|
1365
1380
|
this.footFlag++
|
|
1366
1381
|
},
|
|
1367
1382
|
footFlag () {
|
|
1368
|
-
const $xeTable = this
|
|
1383
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1369
1384
|
|
|
1370
1385
|
$xeTable.updateFooter()
|
|
1371
1386
|
},
|
|
@@ -1395,6 +1410,21 @@ export default {
|
|
|
1395
1410
|
const $xeTable = this
|
|
1396
1411
|
|
|
1397
1412
|
$xeTable.handleUpdateRowGroup(val)
|
|
1413
|
+
},
|
|
1414
|
+
computeRowField () {
|
|
1415
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1416
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
1417
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
1418
|
+
|
|
1419
|
+
// 行主键被改变,重载表格
|
|
1420
|
+
const { inited, tableFullData } = internalData
|
|
1421
|
+
if (inited) {
|
|
1422
|
+
handleKeyField($xeTable)
|
|
1423
|
+
reactData.tableData = []
|
|
1424
|
+
$xeTable.$nextTick(() => {
|
|
1425
|
+
$xeTable.reloadData(tableFullData)
|
|
1426
|
+
})
|
|
1427
|
+
}
|
|
1398
1428
|
}
|
|
1399
1429
|
} as any,
|
|
1400
1430
|
created () {
|
|
@@ -1404,6 +1434,8 @@ export default {
|
|
|
1404
1434
|
|
|
1405
1435
|
Object.assign($xeTable, {
|
|
1406
1436
|
tZindex: 0,
|
|
1437
|
+
currKeyField: '',
|
|
1438
|
+
isCurrDeepKey: false,
|
|
1407
1439
|
elemStore: {},
|
|
1408
1440
|
// 存放横向 X 虚拟滚动相关的信息
|
|
1409
1441
|
scrollXStore: {
|
|
@@ -1514,6 +1546,8 @@ export default {
|
|
|
1514
1546
|
swYTotal: 0
|
|
1515
1547
|
})
|
|
1516
1548
|
|
|
1549
|
+
handleKeyField($xeTable)
|
|
1550
|
+
|
|
1517
1551
|
const { data, exportConfig, importConfig, treeConfig, showOverflow, highlightCurrentRow, highlightCurrentColumn } = props
|
|
1518
1552
|
const { scrollXStore, scrollYStore } = internalData
|
|
1519
1553
|
const columnOpts = $xeTable.computeColumnOpts
|
|
@@ -97,39 +97,44 @@ export function getRowUniqueId () {
|
|
|
97
97
|
return XEUtils.uniqueId('row_')
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
export function hasDeepKey (rowKey: string) {
|
|
101
|
+
return rowKey.indexOf('.') > -1
|
|
102
|
+
}
|
|
103
|
+
|
|
100
104
|
// 行主键 key
|
|
101
105
|
export function getRowkey ($xeTable: VxeTableConstructor) {
|
|
102
|
-
const
|
|
103
|
-
const
|
|
104
|
-
return
|
|
106
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
107
|
+
const { currKeyField } = internalData
|
|
108
|
+
return currKeyField
|
|
105
109
|
}
|
|
106
110
|
|
|
107
111
|
// 行主键 value
|
|
108
112
|
export function getRowid ($xeTable: VxeTableConstructor, row: any) {
|
|
109
|
-
const
|
|
110
|
-
|
|
113
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
114
|
+
const { isCurrDeepKey, currKeyField } = internalData
|
|
115
|
+
return row ? encodeRowid((isCurrDeepKey ? getDeepRowIdByKey : getFastRowIdByKey)(row, currKeyField)) : ''
|
|
111
116
|
}
|
|
112
117
|
|
|
113
118
|
export function createHandleUpdateRowId ($xeTable: VxeTableConstructor) {
|
|
114
|
-
const
|
|
115
|
-
const
|
|
116
|
-
const updateRId =
|
|
119
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
120
|
+
const { isCurrDeepKey, currKeyField } = internalData
|
|
121
|
+
const updateRId = isCurrDeepKey ? updateDeepRowKey : updateFastRowKey
|
|
117
122
|
return {
|
|
118
|
-
rowKey,
|
|
123
|
+
rowKey: currKeyField,
|
|
119
124
|
handleUpdateRowId (row: any) {
|
|
120
|
-
return row ? updateRId(row,
|
|
125
|
+
return row ? updateRId(row, currKeyField) : ''
|
|
121
126
|
}
|
|
122
127
|
}
|
|
123
128
|
}
|
|
124
129
|
|
|
125
130
|
export function createHandleGetRowId ($xeTable: VxeTableConstructor) {
|
|
126
|
-
const
|
|
127
|
-
const
|
|
128
|
-
const getRId =
|
|
131
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
132
|
+
const { isCurrDeepKey, currKeyField } = internalData
|
|
133
|
+
const getRId = isCurrDeepKey ? getDeepRowIdByKey : getFastRowIdByKey
|
|
129
134
|
return {
|
|
130
|
-
rowKey,
|
|
135
|
+
rowKey: currKeyField,
|
|
131
136
|
handleGetRowId (row: any) {
|
|
132
|
-
return row ? getRId(row,
|
|
137
|
+
return row ? encodeRowid(getRId(row, currKeyField)) : ''
|
|
133
138
|
}
|
|
134
139
|
}
|
|
135
140
|
}
|
|
@@ -144,7 +149,7 @@ function getDeepRowIdByKey (row: any, rowKey: string) {
|
|
|
144
149
|
}
|
|
145
150
|
|
|
146
151
|
export function updateDeepRowKey (row: any, rowKey: string) {
|
|
147
|
-
let rowid = getDeepRowIdByKey(row, rowKey)
|
|
152
|
+
let rowid = encodeRowid(getDeepRowIdByKey(row, rowKey))
|
|
148
153
|
if (eqEmptyValue(rowid)) {
|
|
149
154
|
rowid = getRowUniqueId()
|
|
150
155
|
XEUtils.set(row, rowKey, rowid)
|
|
@@ -157,7 +162,7 @@ function getFastRowIdByKey (row: any, rowKey: string) {
|
|
|
157
162
|
}
|
|
158
163
|
|
|
159
164
|
export function updateFastRowKey (row: any, rowKey: string) {
|
|
160
|
-
let rowid = getFastRowIdByKey(row, rowKey)
|
|
165
|
+
let rowid = encodeRowid(getFastRowIdByKey(row, rowKey))
|
|
161
166
|
if (eqEmptyValue(rowid)) {
|
|
162
167
|
rowid = getRowUniqueId()
|
|
163
168
|
row[rowKey] = rowid
|
|
@@ -165,7 +170,7 @@ export function updateFastRowKey (row: any, rowKey: string) {
|
|
|
165
170
|
return rowid
|
|
166
171
|
}
|
|
167
172
|
|
|
168
|
-
function getPaddingLeftRightSize (elem:
|
|
173
|
+
function getPaddingLeftRightSize (elem: HTMLElement | null) {
|
|
169
174
|
if (elem) {
|
|
170
175
|
const computedStyle = getComputedStyle(elem)
|
|
171
176
|
const paddingLeft = XEUtils.toNumber(computedStyle.paddingLeft)
|
|
@@ -175,7 +180,7 @@ function getPaddingLeftRightSize (elem: any) {
|
|
|
175
180
|
return 0
|
|
176
181
|
}
|
|
177
182
|
|
|
178
|
-
function getElementMarginAndWidth (elem:
|
|
183
|
+
function getElementMarginAndWidth (elem: HTMLElement | null) {
|
|
179
184
|
if (elem) {
|
|
180
185
|
const computedStyle = getComputedStyle(elem)
|
|
181
186
|
const marginLeft = XEUtils.toNumber(computedStyle.marginLeft)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|