vxe-table 4.9.30 → 4.9.32
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/grid/src/grid.js +1 -1
- package/es/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/edit/hook.js +40 -16
- package/es/table/module/export/hook.js +8 -5
- package/es/table/module/filter/panel.js +6 -4
- package/es/table/src/table.js +15 -8
- package/es/table/style.css +3 -25
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +2 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +3 -25
- package/es/vxe-table/style.min.css +1 -1
- package/lib/grid/src/grid.js +1 -1
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +85 -35
- 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/edit/hook.js +50 -16
- package/lib/table/module/edit/hook.min.js +1 -1
- package/lib/table/module/export/hook.js +7 -4
- package/lib/table/module/export/hook.min.js +1 -1
- package/lib/table/module/filter/panel.js +9 -3
- package/lib/table/module/filter/panel.min.js +1 -1
- package/lib/table/src/table.js +15 -9
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +3 -25
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +2 -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/lib/vxe-table/style/style.css +3 -25
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/grid/src/grid.ts +1 -1
- package/packages/table/module/edit/hook.ts +41 -17
- package/packages/table/module/export/hook.ts +11 -7
- package/packages/table/module/filter/panel.ts +6 -4
- package/packages/table/src/table.ts +15 -8
- package/packages/ui/index.ts +1 -0
- package/styles/components/table.scss +3 -22
- /package/es/{iconfont.1734489196175.ttf → iconfont.1734659096070.ttf} +0 -0
- /package/es/{iconfont.1734489196175.woff → iconfont.1734659096070.woff} +0 -0
- /package/es/{iconfont.1734489196175.woff2 → iconfont.1734659096070.woff2} +0 -0
- /package/lib/{iconfont.1734489196175.ttf → iconfont.1734659096070.ttf} +0 -0
- /package/lib/{iconfont.1734489196175.woff → iconfont.1734659096070.woff} +0 -0
- /package/lib/{iconfont.1734489196175.woff2 → iconfont.1734659096070.woff2} +0 -0
|
@@ -10,7 +10,7 @@ import type { TableEditMethods, TableEditPrivateMethods } from '../../../../type
|
|
|
10
10
|
|
|
11
11
|
const { getConfig, renderer, hooks, getI18n } = VxeUI
|
|
12
12
|
|
|
13
|
-
const tableEditMethodKeys: (keyof TableEditMethods)[] = ['insert', 'insertAt', 'insertNextAt', 'remove', 'removeCheckboxRow', 'removeRadioRow', 'removeCurrentRow', 'getRecordset', 'getInsertRecords', 'getRemoveRecords', 'getUpdateRecords', 'getEditRecord', 'getActiveRecord', 'getSelectedCell', 'clearEdit', 'clearActived', 'clearSelected', 'isEditByRow', 'isActiveByRow', 'setEditRow', 'setActiveRow', 'setEditCell', 'setActiveCell', 'setSelectCell']
|
|
13
|
+
const tableEditMethodKeys: (keyof TableEditMethods)[] = ['insert', 'insertAt', 'insertNextAt', 'insertChild', 'insertChildAt', 'insertChildNextAt', 'remove', 'removeCheckboxRow', 'removeRadioRow', 'removeCurrentRow', 'getRecordset', 'getInsertRecords', 'getRemoveRecords', 'getUpdateRecords', 'getEditRecord', 'getActiveRecord', 'getSelectedCell', 'clearEdit', 'clearActived', 'clearSelected', 'isEditByRow', 'isActiveByRow', 'setEditRow', 'setActiveRow', 'setEditCell', 'setActiveCell', 'setSelectCell']
|
|
14
14
|
|
|
15
15
|
hooks.add('tableEditModule', {
|
|
16
16
|
setupTable ($xeTable) {
|
|
@@ -104,7 +104,7 @@ hooks.add('tableEditModule', {
|
|
|
104
104
|
})
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
const handleInsertRowAt = (records: any,
|
|
107
|
+
const handleInsertRowAt = (records: any, targetRow: any, isInsertNextRow?: boolean) => {
|
|
108
108
|
const { treeConfig } = props
|
|
109
109
|
const { mergeList, editStore } = reactData
|
|
110
110
|
const { tableFullTreeData, afterFullData, tableFullData, fullDataRowIdData, fullAllDataRowIdData } = internalData
|
|
@@ -115,7 +115,7 @@ hooks.add('tableEditModule', {
|
|
|
115
115
|
records = [records]
|
|
116
116
|
}
|
|
117
117
|
const newRecords: any[] = reactive($xeTable.defineField(records.map((record: any) => Object.assign(treeConfig && transform ? { [mapChildrenField]: [], [childrenField]: [] } : {}, record))))
|
|
118
|
-
if (XEUtils.eqNull(
|
|
118
|
+
if (XEUtils.eqNull(targetRow)) {
|
|
119
119
|
// 如果为虚拟树
|
|
120
120
|
if (treeConfig && transform) {
|
|
121
121
|
insertTreeRow(newRecords, false)
|
|
@@ -137,7 +137,7 @@ hooks.add('tableEditModule', {
|
|
|
137
137
|
})
|
|
138
138
|
}
|
|
139
139
|
} else {
|
|
140
|
-
if (
|
|
140
|
+
if (targetRow === -1) {
|
|
141
141
|
// 如果为虚拟树
|
|
142
142
|
if (treeConfig && transform) {
|
|
143
143
|
insertTreeRow(newRecords, true)
|
|
@@ -161,7 +161,7 @@ hooks.add('tableEditModule', {
|
|
|
161
161
|
} else {
|
|
162
162
|
// 如果为虚拟树
|
|
163
163
|
if (treeConfig && transform) {
|
|
164
|
-
const matchMapObj = XEUtils.findTree(tableFullTreeData, item =>
|
|
164
|
+
const matchMapObj = XEUtils.findTree(tableFullTreeData, item => targetRow[rowField] === item[rowField], { children: mapChildrenField })
|
|
165
165
|
if (matchMapObj) {
|
|
166
166
|
const { parent: parentRow } = matchMapObj
|
|
167
167
|
const parentMapChilds = parentRow ? parentRow[mapChildrenField] : tableFullTreeData
|
|
@@ -191,7 +191,7 @@ hooks.add('tableEditModule', {
|
|
|
191
191
|
|
|
192
192
|
// 源
|
|
193
193
|
if (parentRow) {
|
|
194
|
-
const matchObj = XEUtils.findTree(tableFullTreeData, item =>
|
|
194
|
+
const matchObj = XEUtils.findTree(tableFullTreeData, item => targetRow[rowField] === item[rowField], { children: childrenField })
|
|
195
195
|
if (matchObj) {
|
|
196
196
|
const parentChilds = matchObj.items
|
|
197
197
|
let targetIndex = matchObj.index
|
|
@@ -213,12 +213,12 @@ hooks.add('tableEditModule', {
|
|
|
213
213
|
}
|
|
214
214
|
let afIndex = -1
|
|
215
215
|
// 如果是可视索引
|
|
216
|
-
if (XEUtils.isNumber(
|
|
217
|
-
if (
|
|
218
|
-
afIndex =
|
|
216
|
+
if (XEUtils.isNumber(targetRow)) {
|
|
217
|
+
if (targetRow < afterFullData.length) {
|
|
218
|
+
afIndex = targetRow
|
|
219
219
|
}
|
|
220
220
|
} else {
|
|
221
|
-
afIndex = $xeTable.findRowIndexOf(afterFullData,
|
|
221
|
+
afIndex = $xeTable.findRowIndexOf(afterFullData, targetRow)
|
|
222
222
|
}
|
|
223
223
|
// 如果是插入指定行的下一行
|
|
224
224
|
if (isInsertNextRow) {
|
|
@@ -228,7 +228,7 @@ hooks.add('tableEditModule', {
|
|
|
228
228
|
throw new Error(getI18n('vxe.error.unableInsert'))
|
|
229
229
|
}
|
|
230
230
|
afterFullData.splice(afIndex, 0, ...newRecords)
|
|
231
|
-
tableFullData.splice($xeTable.findRowIndexOf(tableFullData,
|
|
231
|
+
tableFullData.splice($xeTable.findRowIndexOf(tableFullData, targetRow), 0, ...newRecords)
|
|
232
232
|
// 刷新单元格合并
|
|
233
233
|
mergeList.forEach((mergeItem: any) => {
|
|
234
234
|
const { row: mergeRowIndex, rowspan: mergeRowspan } = mergeItem
|
|
@@ -268,6 +268,21 @@ hooks.add('tableEditModule', {
|
|
|
268
268
|
})
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
+
const handleInsertChildRowAt = (records: any, parentRow: any, targetRow: any, isInsertNextRow?: boolean) => {
|
|
272
|
+
const { treeConfig } = props
|
|
273
|
+
const treeOpts = computeTreeOpts.value
|
|
274
|
+
const { transform, rowField, parentField } = treeOpts
|
|
275
|
+
if (treeConfig && transform) {
|
|
276
|
+
if (!XEUtils.isArray(records)) {
|
|
277
|
+
records = [records]
|
|
278
|
+
}
|
|
279
|
+
return handleInsertRowAt(records.map((item: any) => Object.assign({}, item, { [parentField]: parentRow[rowField] })), targetRow, isInsertNextRow)
|
|
280
|
+
} else {
|
|
281
|
+
errLog('vxe.error.errProp', ['tree-config.treeConfig=false', 'tree-config.treeConfig=true'])
|
|
282
|
+
}
|
|
283
|
+
return Promise.resolve({ row: null, rows: [] })
|
|
284
|
+
}
|
|
285
|
+
|
|
271
286
|
const handleClearEdit = (evnt: Event | null, targetRow?: any) => {
|
|
272
287
|
const { mouseConfig } = props
|
|
273
288
|
const { editStore } = reactData
|
|
@@ -316,7 +331,7 @@ hooks.add('tableEditModule', {
|
|
|
316
331
|
*
|
|
317
332
|
* @param {*} records
|
|
318
333
|
*/
|
|
319
|
-
insert (records
|
|
334
|
+
insert (records) {
|
|
320
335
|
return handleInsertRowAt(records, null)
|
|
321
336
|
},
|
|
322
337
|
/**
|
|
@@ -325,13 +340,22 @@ hooks.add('tableEditModule', {
|
|
|
325
340
|
* 如果 row 为 -1 则从插入到底部,如果为树结构,则插入到目标节点底部
|
|
326
341
|
* 如果 row 为有效行则插入到该行的位置,如果为树结构,则有插入到效的目标节点该行的位置
|
|
327
342
|
* @param {Object/Array} records 新的数据
|
|
328
|
-
* @param {Row}
|
|
343
|
+
* @param {Row} targetRow 指定行
|
|
329
344
|
*/
|
|
330
|
-
insertAt (records
|
|
331
|
-
return handleInsertRowAt(records,
|
|
345
|
+
insertAt (records, targetRow) {
|
|
346
|
+
return handleInsertRowAt(records, targetRow)
|
|
347
|
+
},
|
|
348
|
+
insertNextAt (records, targetRow) {
|
|
349
|
+
return handleInsertRowAt(records, targetRow, true)
|
|
350
|
+
},
|
|
351
|
+
insertChild (records, parentRow) {
|
|
352
|
+
return handleInsertChildRowAt(records, parentRow, null)
|
|
353
|
+
},
|
|
354
|
+
insertChildAt (records, parentRow, targetRow) {
|
|
355
|
+
return handleInsertChildRowAt(records, parentRow, targetRow)
|
|
332
356
|
},
|
|
333
|
-
|
|
334
|
-
return
|
|
357
|
+
insertChildNextAt (records, parentRow, targetRow) {
|
|
358
|
+
return handleInsertChildRowAt(records, parentRow, targetRow, true)
|
|
335
359
|
},
|
|
336
360
|
/**
|
|
337
361
|
* 删除指定行数据
|
|
@@ -2,7 +2,7 @@ import { inject, nextTick } from 'vue'
|
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import { VxeUI } from '../../../ui'
|
|
4
4
|
import { isColumnInfo, mergeBodyMethod, getCellValue } from '../../src/util'
|
|
5
|
-
import { parseFile, formatText } from '../../../ui/src/utils'
|
|
5
|
+
import { parseFile, formatText, eqEmptyValue } from '../../../ui/src/utils'
|
|
6
6
|
import { createHtmlPage, getExportBlobByContent } from './util'
|
|
7
7
|
import { warnLog, errLog } from '../../../ui/src/log'
|
|
8
8
|
|
|
@@ -320,6 +320,10 @@ hooks.add('tableExportModule', {
|
|
|
320
320
|
return XEUtils.isBoolean(cellValue) ? (cellValue ? 'TRUE' : 'FALSE') : cellValue
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
+
const toStringValue = (cellValue: any) => {
|
|
324
|
+
return eqEmptyValue(cellValue) ? '' : `${cellValue}`
|
|
325
|
+
}
|
|
326
|
+
|
|
323
327
|
const getBodyLabelData = (opts: any, columns: any[], datas: any[]) => {
|
|
324
328
|
const { isAllExpand, mode } = opts
|
|
325
329
|
const { treeConfig } = props
|
|
@@ -347,7 +351,7 @@ hooks.add('tableExportModule', {
|
|
|
347
351
|
_expand: hasRowChild && $xeTable.isTreeExpandByRow(row)
|
|
348
352
|
}
|
|
349
353
|
columns.forEach((column, $columnIndex) => {
|
|
350
|
-
let cellValue: string | number | boolean = ''
|
|
354
|
+
let cellValue: string | number | boolean | null = ''
|
|
351
355
|
const renderOpts = column.editRender || column.cellRender
|
|
352
356
|
let bodyExportMethod = column.exportMethod || columnOpts.exportMethod
|
|
353
357
|
if (!bodyExportMethod && renderOpts && renderOpts.name) {
|
|
@@ -382,7 +386,7 @@ hooks.add('tableExportModule', {
|
|
|
382
386
|
if (opts.original) {
|
|
383
387
|
cellValue = getCellValue(row, column)
|
|
384
388
|
} else {
|
|
385
|
-
cellValue =
|
|
389
|
+
cellValue = $xeTable.getCellLabel(row, column)
|
|
386
390
|
if (column.type === 'html') {
|
|
387
391
|
htmlCellElem.innerHTML = cellValue
|
|
388
392
|
cellValue = htmlCellElem.innerText.trim()
|
|
@@ -395,7 +399,7 @@ hooks.add('tableExportModule', {
|
|
|
395
399
|
}
|
|
396
400
|
}
|
|
397
401
|
}
|
|
398
|
-
item[column.id] =
|
|
402
|
+
item[column.id] = toStringValue(cellValue)
|
|
399
403
|
})
|
|
400
404
|
expandMaps.set(row, 1)
|
|
401
405
|
rest.push(Object.assign(item, row))
|
|
@@ -408,7 +412,7 @@ hooks.add('tableExportModule', {
|
|
|
408
412
|
_row: row
|
|
409
413
|
}
|
|
410
414
|
columns.forEach((column, $columnIndex) => {
|
|
411
|
-
let cellValue: string | number | boolean = ''
|
|
415
|
+
let cellValue: string | number | boolean | null = ''
|
|
412
416
|
const renderOpts = column.editRender || column.cellRender
|
|
413
417
|
let bodyExportMethod = column.exportMethod || columnOpts.exportMethod
|
|
414
418
|
if (!bodyExportMethod && renderOpts && renderOpts.name) {
|
|
@@ -440,7 +444,7 @@ hooks.add('tableExportModule', {
|
|
|
440
444
|
if (opts.original) {
|
|
441
445
|
cellValue = getCellValue(row, column)
|
|
442
446
|
} else {
|
|
443
|
-
cellValue =
|
|
447
|
+
cellValue = $xeTable.getCellLabel(row, column)
|
|
444
448
|
if (column.type === 'html') {
|
|
445
449
|
htmlCellElem.innerHTML = cellValue
|
|
446
450
|
cellValue = htmlCellElem.innerText.trim()
|
|
@@ -453,7 +457,7 @@ hooks.add('tableExportModule', {
|
|
|
453
457
|
}
|
|
454
458
|
}
|
|
455
459
|
}
|
|
456
|
-
item[column.id] =
|
|
460
|
+
item[column.id] = toStringValue(cellValue)
|
|
457
461
|
})
|
|
458
462
|
return item
|
|
459
463
|
})
|
|
@@ -198,11 +198,13 @@ export default defineComponent({
|
|
|
198
198
|
const renderVN = () => {
|
|
199
199
|
const { filterStore } = props
|
|
200
200
|
const { initStore } = tableReactData
|
|
201
|
-
const { column } = filterStore
|
|
201
|
+
const { visible, multiple, column } = filterStore
|
|
202
202
|
const filterRender = column ? column.filterRender : null
|
|
203
203
|
const compConf = isEnableConf(filterRender) ? renderer.get(filterRender.name) : null
|
|
204
204
|
const filterClassName = compConf ? (compConf.tableFilterClassName || compConf.filterClassName) : ''
|
|
205
205
|
const params = Object.assign({}, tableInternalData._currFilterParams, { $panel, $table: $xeTable })
|
|
206
|
+
const filterOpts = computeFilterOpts.value
|
|
207
|
+
const { destroyOnClose } = filterOpts
|
|
206
208
|
return h('div', {
|
|
207
209
|
class: [
|
|
208
210
|
'vxe-table--filter-wrapper',
|
|
@@ -210,12 +212,12 @@ export default defineComponent({
|
|
|
210
212
|
getPropClass(filterClassName, params),
|
|
211
213
|
{
|
|
212
214
|
'is--animat': $xeTable.props.animat,
|
|
213
|
-
'is--multiple':
|
|
214
|
-
'is--active':
|
|
215
|
+
'is--multiple': multiple,
|
|
216
|
+
'is--active': visible
|
|
215
217
|
}
|
|
216
218
|
],
|
|
217
219
|
style: filterStore.style
|
|
218
|
-
}, initStore.filter && column ? renderOptions(filterRender, compConf).concat(renderFooters()) : [])
|
|
220
|
+
}, initStore.filter && (destroyOnClose ? visible : true) && column ? renderOptions(filterRender, compConf).concat(renderFooters()) : [])
|
|
219
221
|
}
|
|
220
222
|
|
|
221
223
|
return renderVN
|
|
@@ -4924,18 +4924,25 @@ export default defineComponent({
|
|
|
4924
4924
|
const rowRest = fullAllDataRowIdData[getRowid($xeTable, row)]
|
|
4925
4925
|
return rowRest && !!rowRest.treeLoaded
|
|
4926
4926
|
},
|
|
4927
|
-
clearTreeExpandLoaded (
|
|
4927
|
+
clearTreeExpandLoaded (rows: any) {
|
|
4928
4928
|
const { treeExpandedMaps } = reactData
|
|
4929
4929
|
const { fullAllDataRowIdData } = internalData
|
|
4930
4930
|
const treeOpts = computeTreeOpts.value
|
|
4931
|
-
const { transform
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
rowRest.treeLoaded = false
|
|
4936
|
-
if (treeExpandedMaps[rowid]) {
|
|
4937
|
-
delete treeExpandedMaps[rowid]
|
|
4931
|
+
const { transform } = treeOpts
|
|
4932
|
+
if (rows) {
|
|
4933
|
+
if (!XEUtils.isArray(rows)) {
|
|
4934
|
+
rows = [rows]
|
|
4938
4935
|
}
|
|
4936
|
+
rows.forEach((row: any) => {
|
|
4937
|
+
const rowid = getRowid($xeTable, row)
|
|
4938
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
4939
|
+
if (rowRest) {
|
|
4940
|
+
rowRest.treeLoaded = false
|
|
4941
|
+
if (treeExpandedMaps[rowid]) {
|
|
4942
|
+
delete treeExpandedMaps[rowid]
|
|
4943
|
+
}
|
|
4944
|
+
}
|
|
4945
|
+
})
|
|
4939
4946
|
}
|
|
4940
4947
|
if (transform) {
|
|
4941
4948
|
handleVirtualTreeToList()
|
package/packages/ui/index.ts
CHANGED
|
@@ -78,17 +78,6 @@
|
|
|
78
78
|
.vxe-ico-picker {
|
|
79
79
|
width: 100%;
|
|
80
80
|
}
|
|
81
|
-
.vxe-cell--tree-node {
|
|
82
|
-
.vxe-input,
|
|
83
|
-
.vxe-textarea,
|
|
84
|
-
.vxe-select,
|
|
85
|
-
.vxe-tree-select,
|
|
86
|
-
.vxe-date-picker,
|
|
87
|
-
.vxe-number-input,
|
|
88
|
-
.vxe-ico-picker {
|
|
89
|
-
width: 100%;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
81
|
}
|
|
93
82
|
}
|
|
94
83
|
}
|
|
@@ -110,6 +99,9 @@
|
|
|
110
99
|
width: 100%;
|
|
111
100
|
}
|
|
112
101
|
& > .vxe-cell--tree-node {
|
|
102
|
+
.vxe-default-input,
|
|
103
|
+
.vxe-default-textarea,
|
|
104
|
+
.vxe-default-select,
|
|
113
105
|
.vxe-input,
|
|
114
106
|
.vxe-textarea,
|
|
115
107
|
.vxe-select,
|
|
@@ -138,17 +130,6 @@
|
|
|
138
130
|
& > .vxe-ico-picker {
|
|
139
131
|
width: 100%;
|
|
140
132
|
}
|
|
141
|
-
& > .vxe-cell--tree-node {
|
|
142
|
-
.vxe-input,
|
|
143
|
-
.vxe-textarea,
|
|
144
|
-
.vxe-select,
|
|
145
|
-
.vxe-tree-select,
|
|
146
|
-
.vxe-date-picker,
|
|
147
|
-
.vxe-number-input,
|
|
148
|
-
.vxe-ico-picker {
|
|
149
|
-
width: 100%;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
133
|
}
|
|
153
134
|
.vxe-cell,
|
|
154
135
|
.vxe-table--filter-template {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|