vxe-table 3.4.3-beta.0 → 3.4.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vxe-table",
3
- "version": "3.4.3-beta.0",
3
+ "version": "3.4.6",
4
4
  "description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟列表、虚拟树、懒加载、快捷菜单、数据校验、树形结构、打印导出、表单渲染、数据分页、弹窗、自定义模板、渲染器、贼灵活的配置项、扩展接口等...",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -35,20 +35,14 @@
35
35
  "@vue/cli-service": "~4.4.0",
36
36
  "@vue/eslint-config-standard": "^5.1.2",
37
37
  "@vue/eslint-config-typescript": "^5.0.2",
38
- "ant-design-vue": "^1.7.8",
39
- "codemirror": "^5.53.2",
40
38
  "core-js": "^3.6.5",
41
- "dayjs": "^1.10.4",
42
39
  "del": "^5.1.0",
43
- "element-ui": "^2.15.6",
44
40
  "eslint": "^6.7.2",
45
41
  "eslint-plugin-import": "^2.20.2",
46
42
  "eslint-plugin-node": "^11.1.0",
47
43
  "eslint-plugin-promise": "^4.2.1",
48
44
  "eslint-plugin-standard": "^4.0.0",
49
45
  "eslint-plugin-vue": "^6.2.2",
50
- "exceljs": "^4.2.1",
51
- "font-awesome": "^4.7.0",
52
46
  "gulp": "^4.0.2",
53
47
  "gulp-autoprefixer": "^6.1.0",
54
48
  "gulp-babel": "^8.0.0",
@@ -60,15 +54,9 @@
60
54
  "gulp-sass": "^4.1.0",
61
55
  "gulp-sourcemaps": "^2.6.5",
62
56
  "gulp-uglify": "^3.0.2",
63
- "highlight.js": "^10.5.0",
64
- "jsbarcode": "^3.11.0",
65
- "jspdf": "^2.3.1",
66
57
  "node-sass": "^4.14.0",
67
- "qrcode": "^1.4.4",
68
58
  "sass-loader": "^8.0.2",
69
- "sortablejs": "^1.10.2",
70
59
  "typescript": "~3.9.3",
71
- "view-design": "^4.6.1",
72
60
  "vue": "^2.6.14",
73
61
  "vue-class-component": "^7.2.3",
74
62
  "vue-i18n": "^8.18.1",
@@ -76,15 +64,6 @@
76
64
  "vue-router": "^3.2.0",
77
65
  "vue-template-compiler": "^2.6.14",
78
66
  "vuex": "^3.4.0",
79
- "vxe-table-plugin-antd": "^1.11.3",
80
- "vxe-table-plugin-charts": "^1.7.1",
81
- "vxe-table-plugin-element": "^1.11.3",
82
- "vxe-table-plugin-export-pdf": "^1.9.2",
83
- "vxe-table-plugin-export-xlsx": "^2.2.1",
84
- "vxe-table-plugin-iview": "^1.11.4",
85
- "vxe-table-plugin-menus": "^2.0.2",
86
- "vxe-table-plugin-renderer": "^1.3.5",
87
- "vxe-table-plugin-shortcut-key": "^1.5.1",
88
67
  "xe-ajax": "^4.0.5",
89
68
  "xe-clipboard": "^1.10.1",
90
69
  "xe-utils": "^3.4.0",
@@ -5,6 +5,41 @@ import { browse } from '../../tools/src/dom'
5
5
 
6
6
  const { getRowid } = UtilTools
7
7
 
8
+ function insertTreeRow (_vm, newRecords, isAppend) {
9
+ const { treeFullData, afterFullData, fullDataRowIdData, fullAllDataRowIdData, treeOpts } = _vm
10
+ const funcName = isAppend ? 'push' : 'unshift'
11
+ newRecords.forEach(item => {
12
+ const parentRowId = item[treeOpts.parentField]
13
+ const rowid = getRowid(_vm, item)
14
+ const matchObj = parentRowId ? XEUtils.findTree(treeFullData, item => parentRowId === item[treeOpts.rowField], treeOpts) : null
15
+ if (matchObj) {
16
+ const { item: parentRow } = matchObj
17
+ const parentRest = fullAllDataRowIdData[getRowid(_vm, parentRow)]
18
+ const parentLevel = parentRest ? parentRest.level : 0
19
+ let parentChilds = parentRow[treeOpts.children]
20
+ if (!XEUtils.isArray(parentChilds)) {
21
+ parentChilds = parentRow[treeOpts.children] = []
22
+ }
23
+ parentChilds[funcName](item)
24
+ const rest = { row: item, rowid, index: -1, _index: -1, $index: -1, items: parentChilds, parent, level: parentLevel + 1 }
25
+ fullDataRowIdData[rowid] = rest
26
+ fullAllDataRowIdData[rowid] = rest
27
+ } else {
28
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
29
+ if (parentRowId) {
30
+ UtilTools.warn('vxe.error.unableInsert')
31
+ }
32
+ }
33
+ afterFullData[funcName](item)
34
+ treeFullData[funcName](item)
35
+ const rest = { row: item, rowid, index: -1, _index: -1, $index: -1, items: treeFullData, parent: null, level: 0 }
36
+ fullDataRowIdData[rowid] = rest
37
+ fullAllDataRowIdData[rowid] = rest
38
+ }
39
+ })
40
+ _vm.updateVirtualTreeData()
41
+ }
42
+
8
43
  export default {
9
44
  methods: {
10
45
  /**
@@ -25,39 +60,15 @@ export default {
25
60
  */
26
61
  _insertAt (records, row) {
27
62
  const { treeFullData, mergeList, afterFullData, editStore, sYOpts, scrollYLoad, tableFullData, treeConfig, fullDataRowIdData, fullAllDataRowIdData, treeOpts } = this
63
+ const { transform } = treeOpts
28
64
  if (!XEUtils.isArray(records)) {
29
65
  records = [records]
30
66
  }
31
67
  const newRecords = records.map(record => this.defineField(Object.assign({}, record)))
32
68
  if (!row) {
33
69
  // 如果为虚拟树
34
- if (treeConfig && treeOpts.transform) {
35
- newRecords.forEach(item => {
36
- const parentRowId = item[treeOpts.parentField]
37
- const rowid = getRowid(this, item)
38
- if (parentRowId) {
39
- const matchObj = XEUtils.findTree(treeFullData, item => parentRowId === item[treeOpts.rowField], treeOpts)
40
- if (matchObj) {
41
- const { item: parentRow } = matchObj
42
- const parentRest = fullAllDataRowIdData[getRowid(this, parentRow)]
43
- const parentLevel = parentRest ? parentRest.level : 0
44
- let parentChilds = parentRow[treeOpts.children]
45
- if (!XEUtils.isArray(parentChilds)) {
46
- parentChilds = parentRow[treeOpts.children] = []
47
- }
48
- parentChilds.push(item)
49
- const rest = { row: item, rowid, index: -1, _index: -1, $index: -1, items: parentChilds, parent, level: parentLevel + 1 }
50
- fullDataRowIdData[rowid] = rest
51
- fullAllDataRowIdData[rowid] = rest
52
- } else {
53
- // 父节点不存在
54
- }
55
- } else {
56
- afterFullData.unshift(item)
57
- treeFullData.unshift(item)
58
- }
59
- })
60
- this.updateVirtualTreeData()
70
+ if (treeConfig && transform) {
71
+ insertTreeRow(this, newRecords, false)
61
72
  } else {
62
73
  afterFullData.unshift(...newRecords)
63
74
  tableFullData.unshift(...newRecords)
@@ -71,39 +82,78 @@ export default {
71
82
  }
72
83
  } else {
73
84
  if (row === -1) {
74
- afterFullData.push(...newRecords)
75
- tableFullData.push(...newRecords)
76
- // 刷新单元格合并
77
- mergeList.forEach(mergeItem => {
78
- const { row: mergeRowIndex, rowspan: mergeRowspan } = mergeItem
79
- if (mergeRowIndex + mergeRowspan > afterFullData.length) {
80
- mergeItem.rowspan = mergeRowspan + newRecords.length
81
- }
82
- })
83
- } else {
84
- if (treeConfig) {
85
- throw new Error(UtilTools.getLog('vxe.error.noTree', ['insert']))
86
- }
87
- const afIndex = afterFullData.indexOf(row)
88
- if (afIndex === -1) {
89
- throw new Error(UtilTools.error('vxe.error.unableInsert'))
85
+ // 如果为虚拟树
86
+ if (treeConfig && transform) {
87
+ insertTreeRow(this, newRecords, true)
88
+ } else {
89
+ afterFullData.push(...newRecords)
90
+ tableFullData.push(...newRecords)
91
+ // 刷新单元格合并
92
+ mergeList.forEach(mergeItem => {
93
+ const { row: mergeRowIndex, rowspan: mergeRowspan } = mergeItem
94
+ if (mergeRowIndex + mergeRowspan > afterFullData.length) {
95
+ mergeItem.rowspan = mergeRowspan + newRecords.length
96
+ }
97
+ })
90
98
  }
91
- afterFullData.splice(afIndex, 0, ...newRecords)
92
- tableFullData.splice(tableFullData.indexOf(row), 0, ...newRecords)
93
- // 刷新单元格合并
94
- mergeList.forEach(mergeItem => {
95
- const { row: mergeRowIndex, rowspan: mergeRowspan } = mergeItem
96
- if (mergeRowIndex > afIndex) {
97
- mergeItem.row = mergeRowIndex + newRecords.length
98
- } else if (mergeRowIndex + mergeRowspan > afIndex) {
99
- mergeItem.rowspan = mergeRowspan + newRecords.length
99
+ } else {
100
+ // 如果为虚拟树
101
+ if (treeConfig && transform) {
102
+ const matchObj = XEUtils.findTree(treeFullData, item => row[treeOpts.rowField] === item[treeOpts.rowField], treeOpts)
103
+ if (matchObj) {
104
+ const { parent: parentRow } = matchObj
105
+ const parentChilds = matchObj.items
106
+ const parentRest = fullAllDataRowIdData[getRowid(this, parentRow)]
107
+ const parentLevel = parentRest ? parentRest.level : 0
108
+ newRecords.forEach((item, i) => {
109
+ const rowid = getRowid(this, item)
110
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
111
+ if (item[treeOpts.parentField]) {
112
+ if (parentRow && item[treeOpts.parentField] !== parentRow[treeOpts.rowField]) {
113
+ UtilTools.error('vxe.error.errProp', [`${treeOpts.parentField}=${item[treeOpts.parentField]}`, `${treeOpts.parentField}=${parentRow[treeOpts.rowField]}`])
114
+ }
115
+ }
116
+ }
117
+ if (parentRow) {
118
+ item[treeOpts.parentField] = parentRow[treeOpts.rowField]
119
+ }
120
+ parentChilds.splice(matchObj.index + i, 0, item)
121
+ const rest = { row: item, rowid, index: -1, _index: -1, $index: -1, items: parentChilds, parent: parentRow, level: parentLevel + 1 }
122
+ fullDataRowIdData[rowid] = rest
123
+ fullAllDataRowIdData[rowid] = rest
124
+ })
125
+ this.updateVirtualTreeData()
126
+ } else {
127
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
128
+ UtilTools.warn('vxe.error.unableInsert')
129
+ }
130
+ insertTreeRow(this, newRecords, true)
100
131
  }
101
- })
132
+ } else {
133
+ if (treeConfig) {
134
+ throw new Error(UtilTools.getLog('vxe.error.noTree', ['insert']))
135
+ }
136
+ const afIndex = afterFullData.indexOf(row)
137
+ if (afIndex === -1) {
138
+ throw new Error(UtilTools.error('vxe.error.unableInsert'))
139
+ }
140
+ afterFullData.splice(afIndex, 0, ...newRecords)
141
+ tableFullData.splice(tableFullData.indexOf(row), 0, ...newRecords)
142
+ // 刷新单元格合并
143
+ mergeList.forEach(mergeItem => {
144
+ const { row: mergeRowIndex, rowspan: mergeRowspan } = mergeItem
145
+ if (mergeRowIndex > afIndex) {
146
+ mergeItem.row = mergeRowIndex + newRecords.length
147
+ } else if (mergeRowIndex + mergeRowspan > afIndex) {
148
+ mergeItem.rowspan = mergeRowspan + newRecords.length
149
+ }
150
+ })
151
+ }
102
152
  }
103
153
  }
104
154
  editStore.insertList.unshift(...newRecords)
105
155
  this.scrollYLoad = !treeConfig && sYOpts.gt > -1 && sYOpts.gt < tableFullData.length
106
- this.handleTableData()
156
+ this.handleTableData(transform)
107
157
  this.updateFooter()
108
158
  this.cacheRowMap()
109
159
  this.checkSelectionStatus()
@@ -128,6 +178,7 @@ export default {
128
178
  */
129
179
  _remove (rows) {
130
180
  const { afterFullData, tableFullData, treeFullData, treeConfig, mergeList, editStore, checkboxOpts, selection, isInsertByRow, sYOpts, scrollYLoad, treeOpts } = this
181
+ const { transform } = treeOpts
131
182
  const { actived, removeList, insertList } = editStore
132
183
  const { checkField: property } = checkboxOpts
133
184
  let rest = []
@@ -159,7 +210,7 @@ export default {
159
210
  this.clearMergeCells()
160
211
  } else {
161
212
  // 如果为虚拟树
162
- if (treeConfig && treeOpts.transform) {
213
+ if (treeConfig && transform) {
163
214
  rows.forEach((row) => {
164
215
  const rowid = getRowid(this, row)
165
216
  const matchObj = XEUtils.findTree(treeFullData, item => rowid === getRowid(this, item), treeOpts)
@@ -208,7 +259,7 @@ export default {
208
259
  }
209
260
  })
210
261
  this.scrollYLoad = !treeConfig && sYOpts.gt > -1 && sYOpts.gt < tableFullData.length
211
- this.handleTableData()
262
+ this.handleTableData(transform)
212
263
  this.updateFooter()
213
264
  this.cacheRowMap()
214
265
  this.checkSelectionStatus()
@@ -40,10 +40,16 @@ function hasTreeChildren ($xetable, row) {
40
40
  return row[treeOpts.children] && row[treeOpts.children].length > 0
41
41
  }
42
42
 
43
- function getSeq ($xetable, row, rowIndex, column, columnIndex) {
43
+ function getSeq ($xetable, row, rowIndex, column, columnIndex, paths) {
44
44
  const seqOpts = $xetable.seqOpts
45
45
  const seqMethod = seqOpts.seqMethod || column.seqMethod
46
- return seqMethod ? seqMethod({ row, rowIndex, column, columnIndex }) : (seqOpts.startIndex + rowIndex + 1)
46
+ if (seqMethod) {
47
+ return seqMethod({ row, rowIndex, column, columnIndex })
48
+ }
49
+ if (paths) {
50
+ return paths.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('')
51
+ }
52
+ return seqOpts.startIndex + rowIndex + 1
47
53
  }
48
54
 
49
55
  function defaultFilterExportColumn (column) {
@@ -73,10 +79,11 @@ function getLabelData ($xetable, opts, columns, datas) {
73
79
  if (treeConfig) {
74
80
  // 如果是树表格只允许导出数据源
75
81
  const rest = []
82
+ const expandMaps = new Map()
76
83
  XEUtils.eachTree(datas, (item, rowIndex, items, path, parent, nodes) => {
77
84
  const row = item._row || item
78
85
  const parentRow = parent && parent._row ? parent._row : parent
79
- if ((isAllExpand || !parentRow || $xetable.isTreeExpandByRow(parentRow))) {
86
+ if ((isAllExpand || !parentRow || (expandMaps.has(parentRow) && $xetable.isTreeExpandByRow(parentRow)))) {
80
87
  const hasRowChild = hasTreeChildren($xetable, row)
81
88
  const item = {
82
89
  _row: row,
@@ -99,7 +106,7 @@ function getLabelData ($xetable, opts, columns, datas) {
99
106
  } else {
100
107
  switch (column.type) {
101
108
  case 'seq':
102
- cellValue = getSeq($xetable, row, rowIndex, column, columnIndex)
109
+ cellValue = getSeq($xetable, row, rowIndex, column, columnIndex, path)
103
110
  break
104
111
  case 'checkbox':
105
112
  cellValue = toBooleanValue($xetable.isCheckedByCheckboxRow(row))
@@ -130,6 +137,7 @@ function getLabelData ($xetable, opts, columns, datas) {
130
137
  }
131
138
  item[column.id] = XEUtils.toValueString(cellValue)
132
139
  })
140
+ expandMaps.set(row, 1)
133
141
  rest.push(Object.assign(item, row))
134
142
  }
135
143
  }, treeOpts)
@@ -154,7 +162,7 @@ function getLabelData ($xetable, opts, columns, datas) {
154
162
  } else {
155
163
  switch (column.type) {
156
164
  case 'seq':
157
- cellValue = getSeq($xetable, row, rowIndex, column, columnIndex)
165
+ cellValue = getSeq($xetable, row, rowIndex, column, columnIndex, null)
158
166
  break
159
167
  case 'checkbox':
160
168
  cellValue = toBooleanValue($xetable.isCheckedByCheckboxRow(row))
@@ -227,6 +235,9 @@ function getFooterData (opts, footerTableData) {
227
235
 
228
236
  function getCsvCellTypeLabel (column, cellValue) {
229
237
  if (cellValue) {
238
+ if (column.type === 'seq') {
239
+ return `\t${cellValue}`
240
+ }
230
241
  switch (column.cellType) {
231
242
  case 'string':
232
243
  if (!isNaN(cellValue)) {
@@ -670,7 +670,11 @@ export default {
670
670
  body.insertRecords = insertRecords.filter(row => pendingRecords.indexOf(row) === -1)
671
671
  }
672
672
  // 只校验新增和修改的数据
673
- return this.validate(body.insertRecords.concat(updateRecords)).then(() => {
673
+ return this.validate(body.insertRecords.concat(updateRecords)).then((errMap) => {
674
+ if (errMap) {
675
+ // 如果校验不通过
676
+ return
677
+ }
674
678
  if (body.insertRecords.length || removeRecords.length || updateRecords.length || body.pendingRecords.length) {
675
679
  this.tableLoading = true
676
680
  return Promise.resolve((beforeSave || ajaxMethods)(...applyArgs))
@@ -715,7 +719,7 @@ export default {
715
719
  VXETable.modal.message({ id: code, content: GlobalConfig.i18n('vxe.grid.dataUnchanged'), status: 'info' })
716
720
  }
717
721
  }
718
- }).catch(errMap => errMap)
722
+ })
719
723
  } else {
720
724
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
721
725
  UtilTools.error('vxe.error.notFunc', ['proxy-config.ajax.save'])
@@ -44,9 +44,16 @@ function getDateQuarter (date) {
44
44
  return 4
45
45
  }
46
46
 
47
+ function toFloatValueFixed (inputValue, digitsValue) {
48
+ if (/^-/.test('' + inputValue)) {
49
+ return XEUtils.toFixed(XEUtils.ceil(inputValue, digitsValue), digitsValue)
50
+ }
51
+ return XEUtils.toFixed(XEUtils.floor(inputValue, digitsValue), digitsValue)
52
+ }
53
+
47
54
  function getNumberValue (_vm, val) {
48
55
  const { type, exponential, digitsValue, inpMaxlength } = _vm
49
- const restVal = (type === 'float' ? XEUtils.toFixed(XEUtils.floor(val, digitsValue), digitsValue) : XEUtils.toValueString(val))
56
+ const restVal = (type === 'float' ? toFloatValueFixed(val, digitsValue) : XEUtils.toValueString(val))
50
57
  if (exponential && (val === restVal || XEUtils.toValueString(val).toLowerCase() === XEUtils.toNumber(restVal).toExponential())) {
51
58
  return val
52
59
  }
@@ -1255,7 +1262,7 @@ export default {
1255
1262
  this.changeValue()
1256
1263
  } else if (type === 'float') {
1257
1264
  if (inputValue) {
1258
- const validValue = XEUtils.toFixed(XEUtils.floor(inputValue, digitsValue), digitsValue)
1265
+ const validValue = toFloatValueFixed(inputValue, digitsValue)
1259
1266
  if (inputValue !== validValue) {
1260
1267
  this.emitModel(validValue, { type: 'init' })
1261
1268
  }
@@ -464,16 +464,12 @@ const Methods = {
464
464
  const oRow = tableSourceData[rowIndex]
465
465
  if (oRow && row) {
466
466
  if (field) {
467
- XEUtils.set(oRow, field, XEUtils.get(record || row, field))
467
+ const newValue = XEUtils.get(record || row, field)
468
+ XEUtils.set(row, field, newValue)
469
+ XEUtils.set(oRow, field, newValue)
468
470
  } else {
469
- if (record) {
470
- tableSourceData[rowIndex] = record
471
- XEUtils.clear(row, undefined)
472
- Object.assign(row, this.defineField(Object.assign({}, record)))
473
- this.cacheRowMap(true)
474
- } else {
475
- XEUtils.destructuring(oRow, XEUtils.clone(row, true))
476
- }
471
+ const newRecord = XEUtils.clone({ ...record }, true)
472
+ XEUtils.destructuring(oRow, Object.assign(row, newRecord))
477
473
  }
478
474
  }
479
475
  this.tableData = tableData.slice(0)
@@ -2101,7 +2097,7 @@ const Methods = {
2101
2097
  * 表格键盘事件
2102
2098
  */
2103
2099
  keydownEvent (evnt) {
2104
- const { filterStore, ctxMenuStore, editStore, keyboardConfig, mouseConfig, mouseOpts } = this
2100
+ const { filterStore, ctxMenuStore, editStore, keyboardConfig, mouseConfig, mouseOpts, keyboardOpts } = this
2105
2101
  const { actived } = editStore
2106
2102
  const { keyCode } = evnt
2107
2103
  const isEsc = keyCode === 27
@@ -2114,13 +2110,15 @@ const Methods = {
2114
2110
  // 如果按下了 Esc 键,关闭快捷菜单、筛选
2115
2111
  this.closeFilter()
2116
2112
  this.closeMenu()
2117
- // 如果是激活编辑状态,则取消编辑
2118
- if (actived.row) {
2119
- const params = actived.args
2120
- this.clearActived(evnt)
2121
- // 如果配置了选中功能,则为选中状态
2122
- if (mouseConfig && mouseOpts.selected) {
2123
- this.$nextTick(() => this.handleSelected(params, evnt))
2113
+ if (keyboardConfig && keyboardOpts.isEsc) {
2114
+ // 如果是激活编辑状态,则取消编辑
2115
+ if (actived.row) {
2116
+ const params = actived.args
2117
+ this.clearActived(evnt)
2118
+ // 如果配置了选中功能,则为选中状态
2119
+ if (mouseConfig && mouseOpts.selected) {
2120
+ this.$nextTick(() => this.handleSelected(params, evnt))
2121
+ }
2124
2122
  }
2125
2123
  }
2126
2124
  }
@@ -2927,6 +2925,16 @@ const Methods = {
2927
2925
  const { fullDataRowIdData, afterFullData, checkboxReserveRowMap, checkboxOpts, treeConfig, treeOpts } = this
2928
2926
  const reserveSelection = []
2929
2927
  if (checkboxOpts.reserve) {
2928
+ const afterFullIdMaps = {}
2929
+ if (treeConfig) {
2930
+ XEUtils.eachTree(afterFullData, row => {
2931
+ afterFullIdMaps[getRowid(this, row)] = 1
2932
+ }, treeOpts)
2933
+ } else {
2934
+ afterFullData.forEach(row => {
2935
+ afterFullIdMaps[getRowid(this, row)] = 1
2936
+ })
2937
+ }
2930
2938
  XEUtils.each(checkboxReserveRowMap, (oldRow, oldRowid) => {
2931
2939
  if (oldRow) {
2932
2940
  if (isFull) {
@@ -2934,14 +2942,8 @@ const Methods = {
2934
2942
  reserveSelection.push(oldRow)
2935
2943
  }
2936
2944
  } else {
2937
- if (treeConfig) {
2938
- if (!XEUtils.findTree(afterFullData, row => getRowid(this, row) === oldRowid, treeOpts)) {
2939
- reserveSelection.push(oldRow)
2940
- }
2941
- } else {
2942
- if (!afterFullData.some(row => getRowid(this, row) === oldRowid)) {
2943
- reserveSelection.push(oldRow)
2944
- }
2945
+ if (!afterFullIdMaps[oldRowid]) {
2946
+ reserveSelection.push(oldRow)
2945
2947
  }
2946
2948
  }
2947
2949
  }
@@ -114,15 +114,15 @@ export default {
114
114
  footerAlign: { type: String, default: () => GlobalConfig.table.footerAlign },
115
115
  // 是否显示表头
116
116
  showHeader: { type: Boolean, default: () => GlobalConfig.table.showHeader },
117
- // 是否要高亮当前选中行
117
+ // (即将废弃)是否要高亮当前选中行
118
118
  highlightCurrentRow: { type: Boolean, default: () => GlobalConfig.table.highlightCurrentRow },
119
- // 鼠标移到行是否要高亮显示
119
+ // (即将废弃)鼠标移到行是否要高亮显示
120
120
  highlightHoverRow: { type: Boolean, default: () => GlobalConfig.table.highlightHoverRow },
121
- // 是否要高亮当前选中列
121
+ // (即将废弃)是否要高亮当前选中列
122
122
  highlightCurrentColumn: { type: Boolean, default: () => GlobalConfig.table.highlightCurrentColumn },
123
- // 鼠标移到列是否要高亮显示
123
+ // (即将废弃)鼠标移到列是否要高亮显示
124
124
  highlightHoverColumn: { type: Boolean, default: () => GlobalConfig.table.highlightHoverColumn },
125
- // 激活单元格编辑时是否高亮显示
125
+ // (即将废弃)激活单元格编辑时是否高亮显示
126
126
  highlightCell: Boolean,
127
127
  // 是否显示表尾合计
128
128
  showFooter: Boolean,
@@ -235,7 +235,7 @@ export default {
235
235
  scrollX: Object,
236
236
  // 纵向虚拟滚动配置项
237
237
  scrollY: Object,
238
- // 优化相关
238
+ // (即将废弃)优化相关
239
239
  animat: { type: Boolean, default: () => GlobalConfig.table.animat },
240
240
  delayHover: { type: Number, default: () => GlobalConfig.table.delayHover },
241
241
  // 额外的参数
@@ -11,6 +11,7 @@ export default {
11
11
  showHeader: true,
12
12
  animat: true,
13
13
  delayHover: 250,
14
+ autoResize: true,
14
15
  // keepSource: false,
15
16
  // showOverflow: null,
16
17
  // showHeaderOverflow: null,
@@ -18,7 +19,6 @@ export default {
18
19
  // resizeInterval: 500,
19
20
  // size: null,
20
21
  // zIndex: null,
21
- // autoResize: false,
22
22
  // stripe: false,
23
23
  // border: false,
24
24
  // round: false,
@@ -91,6 +91,9 @@ export default {
91
91
  mouseConfig: {
92
92
  extension: true
93
93
  },
94
+ keyboardConfig: {
95
+ isEsc: true
96
+ },
94
97
  areaConfig: {
95
98
  selectCellByHeader: true
96
99
  },
@@ -151,21 +151,21 @@ export default {
151
151
  const ruleProps = Object.keys(validRest)
152
152
  return this.$nextTick().then(() => {
153
153
  if (ruleProps.length) {
154
- return Promise.reject(validRest[ruleProps[0]][0])
154
+ return validRest[ruleProps[0]][0]
155
155
  }
156
156
  if (cb) {
157
157
  cb()
158
158
  }
159
159
  })
160
160
  }).catch(firstErrParams => {
161
- return new Promise((resolve, reject) => {
161
+ return new Promise((resolve) => {
162
162
  const finish = () => {
163
163
  this.$nextTick(() => {
164
164
  if (cb) {
165
165
  cb(validRest)
166
166
  resolve()
167
167
  } else {
168
- reject(validRest)
168
+ resolve(validRest)
169
169
  }
170
170
  })
171
171
  }
package/types/table.d.ts CHANGED
@@ -803,9 +803,12 @@ export declare class Table extends VXETableComponent {
803
803
  */
804
804
  insert(records: RecordInfo | RecordInfo[]): Promise<{ row: RowInfo, rows: RowInfo[] }>;
805
805
  /**
806
- * 往表格插入临时数据,从指定位置插入一行或多行;第二个参数:row 指定位置、null从第一行插入、-1 从最后插入
807
- * @param records 新数据
808
- * @param row 指定行
806
+ * 往表格指定行中插入临时数据
807
+ * 如果 row 为空则从插入到顶部,如果为树结构,则插入到目标节点顶部
808
+ * 如果 row 为 -1 则从插入到底部,如果为树结构,则插入到目标节点底部
809
+ * 如果 row 为有效行则插入到该行的位置,如果为树结构,则有插入到效的目标节点该行的位置
810
+ * @param {Object/Array} records 新的数据
811
+ * @param {Row} row 指定行
809
812
  */
810
813
  insertAt(records: RecordInfo | RecordInfo[], row: RowInfo | -1 | null): Promise<{ row: RowInfo, rows: RowInfo[] }>;
811
814
  /**
@@ -859,9 +862,9 @@ export declare class Table extends VXETableComponent {
859
862
  */
860
863
  clearActived(): Promise<any>;
861
864
  /**
862
- * 用于 mouse-config.area,用于清除鼠标选择的区域
865
+ * 用于 mouse-config.area,用于清除鼠标选择的区域,可以指定清除的区域
863
866
  */
864
- clearCellAreas(): Promise<any>;
867
+ clearCellAreas(area?: number | MouseCellArea): Promise<any>;
865
868
  /**
866
869
  * 用于 edit-config,获取已激活的行数据
867
870
  */
@@ -901,9 +904,9 @@ export declare class Table extends VXETableComponent {
901
904
  * @param areaConfigs 指定区域
902
905
  */
903
906
  setCellAreas(areaConfigs: CellAreaConfig[], activeArea?: {
904
- area?: MouseCellArea;
905
- column: ColumnInfo;
906
- row: RowInfo;
907
+ area?: number | MouseCellArea;
908
+ column?: number | ColumnInfo;
909
+ row?: number | RowInfo;
907
910
  }): Promise<any>;
908
911
  /**
909
912
  * 用于 mouse-config.area,设置活动的区域的单元格
@@ -911,8 +914,8 @@ export declare class Table extends VXETableComponent {
911
914
  */
912
915
  setActiveCellArea(activeArea: {
913
916
  area: MouseCellArea;
914
- column: ColumnInfo;
915
- row: RowInfo;
917
+ column: number | ColumnInfo;
918
+ row: number | RowInfo;
916
919
  }): Promise<any>;
917
920
  /**
918
921
  * 临时合并单元格,如果为数组则合并多个
@@ -27,6 +27,8 @@ export interface RendererMapOptions {
27
27
  renderFilter?(h: CreateElement, renderOpts: ColumnFilterRenderOptions, params: ColumnFilterRenderParams): VNode[] | string[];
28
28
  filterMethod?(params: ColumnFilterMethodParams): boolean;
29
29
  filterResetMethod?(params: ColumnFilterResetParams): void;
30
+ // 默认行为
31
+ defaultFilterMethod?(params: ColumnFilterMethodParams): boolean;
30
32
 
31
33
  // 单元格渲染
32
34
  renderHeader?(h: CreateElement, renderOpts: ColumnCellRenderOptions | ColumnEditRenderOptions, params: ColumnCellRenderParams | ColumnEditRenderParams): VNode[] | string[];
@@ -66,7 +68,7 @@ export class RenderOptions {
66
68
  /**
67
69
  * 渲染器名称
68
70
  */
69
- name: string;
71
+ name?: string;
70
72
  /**
71
73
  * 目标组件渲染的参数
72
74
  */