vxe-table 3.8.16 → 3.8.18

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.
Files changed (63) hide show
  1. package/lib/edit/src/mixin.js +39 -29
  2. package/lib/edit/src/mixin.min.js +1 -1
  3. package/lib/export/src/mixin.js +26 -6
  4. package/lib/export/src/mixin.min.js +1 -1
  5. package/lib/grid/src/grid.js +63 -20
  6. package/lib/grid/src/grid.min.js +1 -1
  7. package/lib/icon/style/{iconfont.1721369585843.ttf → iconfont.1723040514481.ttf} +0 -0
  8. package/lib/icon/style/iconfont.1723040514481.woff +0 -0
  9. package/lib/icon/style/iconfont.1723040514481.woff2 +0 -0
  10. package/lib/icon/style/style.css +81 -3
  11. package/lib/icon/style/style.min.css +81 -3
  12. package/lib/{iconfont.1721369585843.ttf → iconfont.1723040514481.ttf} +0 -0
  13. package/lib/iconfont.1723040514481.woff +0 -0
  14. package/lib/iconfont.1723040514481.woff2 +0 -0
  15. package/lib/index.css +1 -1
  16. package/lib/index.umd.js +180 -87
  17. package/lib/index.umd.min.js +1 -1
  18. package/lib/input/src/input.js +14 -6
  19. package/lib/input/src/input.min.js +1 -1
  20. package/lib/style.css +1 -1
  21. package/lib/style.min.css +1 -1
  22. package/lib/table/src/methods.js +25 -24
  23. package/lib/table/src/methods.min.js +1 -1
  24. package/lib/table/src/table.js +15 -3
  25. package/lib/table/src/table.min.js +1 -1
  26. package/lib/table/style/style.css +70 -46
  27. package/lib/table/style/style.min.css +1 -1
  28. package/lib/toolbar/src/toolbar.js +3 -0
  29. package/lib/toolbar/src/toolbar.min.js +1 -1
  30. package/lib/tools/log.js +1 -1
  31. package/lib/tools/log.min.js +1 -1
  32. package/lib/v-x-e-table/index.js +1 -1
  33. package/lib/v-x-e-table/index.min.js +1 -1
  34. package/lib/v-x-e-table/src/conf.js +2 -1
  35. package/lib/v-x-e-table/src/conf.min.js +1 -1
  36. package/lib/v-x-e-table/src/renderer.js +1 -1
  37. package/lib/v-x-e-table/src/renderer.min.js +1 -1
  38. package/lib/v-x-e-table/style/style.css +57 -3
  39. package/lib/v-x-e-table/style/style.min.css +1 -1
  40. package/lib/vxe-icon/style/style.css +81 -3
  41. package/lib/vxe-icon/style/style.min.css +1 -1
  42. package/lib/vxe-table/style/style.css +70 -46
  43. package/lib/vxe-table/style/style.min.css +1 -1
  44. package/package.json +2 -2
  45. package/packages/edit/src/mixin.js +10 -3
  46. package/packages/export/src/mixin.js +15 -4
  47. package/packages/grid/src/grid.js +48 -18
  48. package/packages/input/src/input.js +14 -8
  49. package/packages/table/src/methods.js +23 -22
  50. package/packages/table/src/table.js +40 -28
  51. package/packages/toolbar/src/toolbar.js +3 -0
  52. package/packages/v-x-e-table/src/conf.js +2 -1
  53. package/packages/v-x-e-table/src/renderer.js +1 -1
  54. package/styles/icon/iconfont.ttf +0 -0
  55. package/styles/icon/iconfont.woff +0 -0
  56. package/styles/icon/iconfont.woff2 +0 -0
  57. package/styles/icon.scss +53 -4
  58. package/styles/old-icon.scss +4 -0
  59. package/styles/table.scss +37 -17
  60. package/lib/icon/style/iconfont.1721369585843.woff +0 -0
  61. package/lib/icon/style/iconfont.1721369585843.woff2 +0 -0
  62. package/lib/iconfont.1721369585843.woff +0 -0
  63. package/lib/iconfont.1721369585843.woff2 +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vxe-table",
3
- "version": "3.8.16",
3
+ "version": "3.8.18",
4
4
  "description": "一个基于 vue 的 PC 端表单/表格组件,支持增删改查、虚拟树、列拖拽,懒加载、快捷菜单、数据校验、树形结构、打印导出、自定义模板、渲染器、JSON 配置式...",
5
5
  "scripts": {
6
6
  "update": "npm install --legacy-peer-deps",
@@ -27,7 +27,7 @@
27
27
  "typings": "types/index.d.ts",
28
28
  "dependencies": {
29
29
  "dom-zindex": "^1.0.4",
30
- "xe-utils": "^3.5.26"
30
+ "xe-utils": "^3.5.29"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/resize-observer-browser": "^0.1.11",
@@ -368,11 +368,18 @@ export default {
368
368
  * 获取表格数据集,包含新增、删除、修改
369
369
  */
370
370
  _getRecordset () {
371
+ const removeRecords = this.getRemoveRecords()
372
+ const pendingRecords = this.getPendingRecords()
373
+ const delRecords = removeRecords.concat(pendingRecords)
374
+ // 如果已经被删除,则无需放到更新数组
375
+ const updateRecords = this.getUpdateRecords().filter(row => {
376
+ return !delRecords.some(item => this.eqRow(item, row))
377
+ })
371
378
  return {
372
379
  insertRecords: this.getInsertRecords(),
373
- removeRecords: this.getRemoveRecords(),
374
- updateRecords: this.getUpdateRecords(),
375
- pendingRecords: this.getPendingRecords()
380
+ removeRecords,
381
+ updateRecords,
382
+ pendingRecords
376
383
  }
377
384
  },
378
385
  /**
@@ -828,6 +828,8 @@ function handleImport ($xetable, content, opts) {
828
828
  .then((data) => {
829
829
  let loadRest
830
830
  if (opts.mode === 'insert' || opts.mode === 'insertBottom') {
831
+ loadRest = $xetable.insertAt(data, -1)
832
+ } if (opts.mode === 'insertTop') {
831
833
  loadRest = $xetable.insert(data)
832
834
  } else {
833
835
  loadRest = $xetable.reloadData(data)
@@ -895,7 +897,7 @@ function handleFileImport ($xetable, file, opts) {
895
897
  $xetable._importResolve = _importResolve
896
898
  $xetable._importReject = _importReject
897
899
  if (window.FileReader) {
898
- const options = Object.assign({ mode: 'insertBottom' }, opts, { type, filename })
900
+ const options = Object.assign({ mode: 'insertTop' }, opts, { type, filename })
899
901
  if (options.remote) {
900
902
  if (importMethod) {
901
903
  Promise.resolve(importMethod({ file, options, $table: $xetable })).then(() => {
@@ -1328,6 +1330,8 @@ export default {
1328
1330
  if ($xegrid && !opts.remote) {
1329
1331
  const { beforeQueryAll, afterQueryAll, ajax = {}, props = {} } = $xegrid.proxyOpts
1330
1332
  const ajaxMethods = ajax.queryAll
1333
+ const queryAllSuccessMethods = ajax.queryAllSuccess
1334
+ const queryAllErrorMethods = ajax.queryAllError
1331
1335
 
1332
1336
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1333
1337
  if (!ajaxMethods) {
@@ -1346,14 +1350,21 @@ export default {
1346
1350
  options: opts
1347
1351
  }
1348
1352
  return Promise.resolve((beforeQueryAll || ajaxMethods)(params))
1349
- .catch(e => e)
1350
1353
  .then(rest => {
1351
1354
  opts.data = (props.list ? XEUtils.get(rest, props.list) : rest) || []
1352
1355
  if (afterQueryAll) {
1353
1356
  afterQueryAll(params)
1354
1357
  }
1358
+ if (queryAllSuccessMethods) {
1359
+ queryAllSuccessMethods({ ...params, response: rest })
1360
+ }
1355
1361
  return handleExport(this, opts)
1356
1362
  })
1363
+ .catch((rest) => {
1364
+ if (queryAllErrorMethods) {
1365
+ queryAllErrorMethods({ ...params, response: rest })
1366
+ }
1367
+ })
1357
1368
  }
1358
1369
  }
1359
1370
  } else if (mode === 'current') {
@@ -1442,10 +1453,10 @@ export default {
1442
1453
  _openImport (options) {
1443
1454
  const { importOpts } = this
1444
1455
  const defOpts = Object.assign({
1445
- mode: 'insertBottom',
1456
+ mode: 'insertTop',
1446
1457
  message: true,
1447
1458
  types: XEUtils.keys(importOpts._typeMaps),
1448
- modes: ['insertBottom', 'covering']
1459
+ modes: ['insertTop', 'covering']
1449
1460
  }, options, importOpts)
1450
1461
  const types = defOpts.types || []
1451
1462
  const modes = defOpts.modes || []
@@ -368,11 +368,15 @@ export default {
368
368
  }
369
369
  },
370
370
  computed: {
371
- isMsg () {
372
- return this.proxyOpts.message !== false
371
+ isRespMsg () {
372
+ const { proxyOpts } = this
373
+ return XEUtils.isBoolean(proxyOpts.message) ? proxyOpts.message : proxyOpts.showResponseMsg
374
+ },
375
+ isActiveMsg () {
376
+ return this.proxyOpts.showActiveMsg
373
377
  },
374
378
  proxyOpts () {
375
- return Object.assign({}, GlobalConfig.grid.proxyConfig, this.proxyConfig)
379
+ return XEUtils.merge({}, GlobalConfig.grid.proxyConfig, this.proxyConfig)
376
380
  },
377
381
  pagerOpts () {
378
382
  return Object.assign({}, GlobalConfig.grid.pagerConfig, this.pagerConfig)
@@ -571,7 +575,7 @@ export default {
571
575
  * @param {String/Object} code 字符串或对象
572
576
  */
573
577
  commitProxy (proxyTarget, ...args) {
574
- const { $refs, toolbar, toolbarConfig, toolbarOpts, proxyOpts, tablePage, pagerConfig, editRules, formData, isMsg, validConfig, pagerOpts } = this
578
+ const { $refs, toolbar, toolbarConfig, toolbarOpts, proxyOpts, tablePage, pagerConfig, editRules, formData, isRespMsg, isActiveMsg, validConfig, pagerOpts } = this
575
579
  const { beforeQuery, afterQuery, beforeDelete, afterDelete, beforeSave, afterSave, ajax = {} } = proxyOpts
576
580
  const resConfigs = proxyOpts.response || proxyOpts.props || {}
577
581
  const $xetable = $refs.xTable
@@ -621,6 +625,8 @@ export default {
621
625
  case 'reload':
622
626
  case 'query': {
623
627
  const ajaxMethods = ajax.query
628
+ const querySuccessMethods = ajax.querySuccess
629
+ const queryErrorMethods = ajax.queryError
624
630
  if (ajaxMethods) {
625
631
  const isInited = code === '_init'
626
632
  const isReload = code === 'reload'
@@ -660,7 +666,7 @@ export default {
660
666
  filterList = $xetable.getCheckedFilters()
661
667
  }
662
668
  }
663
- const params = {
669
+ const commitParams = {
664
670
  code,
665
671
  button,
666
672
  isInited,
@@ -676,7 +682,7 @@ export default {
676
682
  this.sortData = sortList
677
683
  this.filterData = filterList
678
684
  this.tableLoading = true
679
- const applyArgs = [params].concat(args)
685
+ const applyArgs = [commitParams].concat(args)
680
686
  return Promise.resolve((beforeQuery || ajaxMethods)(...applyArgs))
681
687
  .then(rest => {
682
688
  this.tableLoading = false
@@ -702,9 +708,15 @@ export default {
702
708
  if (afterQuery) {
703
709
  afterQuery(...applyArgs)
704
710
  }
711
+ if (querySuccessMethods) {
712
+ querySuccessMethods({ ...commitParams, response: rest })
713
+ }
705
714
  return { status: true }
706
- }).catch(() => {
715
+ }).catch((rest) => {
707
716
  this.tableLoading = false
717
+ if (queryErrorMethods) {
718
+ queryErrorMethods({ ...commitParams, response: rest })
719
+ }
708
720
  return { status: false }
709
721
  })
710
722
  } else {
@@ -716,11 +728,14 @@ export default {
716
728
  }
717
729
  case 'delete': {
718
730
  const ajaxMethods = ajax.delete
731
+ const deleteSuccessMethods = ajax.deleteSuccess
732
+ const deleteErrorMethods = ajax.deleteError
719
733
  if (ajaxMethods) {
720
734
  const selectRecords = $xetable.getCheckboxRecords()
721
735
  const removeRecords = selectRecords.filter(row => !$xetable.isInsertByRow(row))
722
736
  const body = { removeRecords }
723
- const applyArgs = [{ $grid: this, code, button, body, form: formData, options: ajaxMethods }].concat(args)
737
+ const commitParams = { $grid: this, code, button, body, form: formData, options: ajaxMethods }
738
+ const applyArgs = [commitParams].concat(args)
724
739
  if (selectRecords.length) {
725
740
  return this.handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', () => {
726
741
  if (!removeRecords.length) {
@@ -731,7 +746,7 @@ export default {
731
746
  .then(rest => {
732
747
  this.tableLoading = false
733
748
  $xetable.setPendingRow(removeRecords, false)
734
- if (isMsg) {
749
+ if (isRespMsg) {
735
750
  // 检测弹窗模块
736
751
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
737
752
  if (!VXETable.modal) {
@@ -745,11 +760,14 @@ export default {
745
760
  } else {
746
761
  this.commitProxy('query')
747
762
  }
763
+ if (deleteSuccessMethods) {
764
+ deleteSuccessMethods({ ...commitParams, response: rest })
765
+ }
748
766
  return { status: true }
749
767
  })
750
768
  .catch(rest => {
751
769
  this.tableLoading = false
752
- if (isMsg) {
770
+ if (isRespMsg) {
753
771
  // 检测弹窗模块
754
772
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
755
773
  if (!VXETable.modal) {
@@ -758,11 +776,14 @@ export default {
758
776
  }
759
777
  VXETable.modal.message({ id: code, content: this.getRespMsg(rest, 'vxe.grid.operError'), status: 'error' })
760
778
  }
779
+ if (deleteErrorMethods) {
780
+ deleteErrorMethods({ ...commitParams, response: rest })
781
+ }
761
782
  return { status: false }
762
783
  })
763
784
  })
764
785
  } else {
765
- if (isMsg) {
786
+ if (isActiveMsg) {
766
787
  // 检测弹窗模块
767
788
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
768
789
  if (!VXETable.modal) {
@@ -781,10 +802,13 @@ export default {
781
802
  }
782
803
  case 'save': {
783
804
  const ajaxMethods = ajax.save
805
+ const saveSuccessMethods = ajax.saveSuccess
806
+ const saveErrorMethods = ajax.saveError
784
807
  if (ajaxMethods) {
785
808
  const body = this.getRecordset()
786
809
  const { insertRecords, removeRecords, updateRecords, pendingRecords } = body
787
- const applyArgs = [{ $grid: this, code, button, body, form: formData, options: ajaxMethods }].concat(args)
810
+ const commitParams = { $grid: this, code, button, body, form: formData, options: ajaxMethods }
811
+ const applyArgs = [commitParams].concat(args)
788
812
  // 排除掉新增且标记为删除的数据
789
813
  if (insertRecords.length) {
790
814
  body.pendingRecords = pendingRecords.filter(row => insertRecords.indexOf(row) === -1)
@@ -809,7 +833,7 @@ export default {
809
833
  .then(rest => {
810
834
  this.tableLoading = false
811
835
  $xetable.clearPendingRow()
812
- if (isMsg) {
836
+ if (isRespMsg) {
813
837
  // 检测弹窗模块
814
838
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
815
839
  if (!VXETable.modal) {
@@ -823,11 +847,14 @@ export default {
823
847
  } else {
824
848
  this.commitProxy('query')
825
849
  }
850
+ if (saveSuccessMethods) {
851
+ saveSuccessMethods({ ...commitParams, response: rest })
852
+ }
826
853
  return { status: true }
827
854
  })
828
855
  .catch(rest => {
829
856
  this.tableLoading = false
830
- if (isMsg) {
857
+ if (isRespMsg) {
831
858
  // 检测弹窗模块
832
859
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
833
860
  if (!VXETable.modal) {
@@ -836,10 +863,13 @@ export default {
836
863
  }
837
864
  VXETable.modal.message({ id: code, content: this.getRespMsg(rest, 'vxe.grid.operError'), status: 'error' })
838
865
  }
866
+ if (saveErrorMethods) {
867
+ saveErrorMethods({ ...commitParams, response: rest })
868
+ }
839
869
  return { status: false }
840
870
  })
841
871
  } else {
842
- if (isMsg) {
872
+ if (isActiveMsg) {
843
873
  // 检测弹窗模块
844
874
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
845
875
  if (!VXETable.modal) {
@@ -883,7 +913,7 @@ export default {
883
913
  },
884
914
  handleDeleteRow (code, alertKey, callback) {
885
915
  const selectRecords = this.getCheckboxRecords()
886
- if (this.isMsg) {
916
+ if (this.isActiveMsg) {
887
917
  if (selectRecords.length) {
888
918
  return VXETable.modal.confirm({ id: `cfm_${code}`, content: GlobalConfig.i18n(alertKey), escClosable: true }).then(type => {
889
919
  if (type === 'confirm') {
@@ -931,13 +961,13 @@ export default {
931
961
  this.$emit('toolbar-tool-click', { code: tool.code, tool, $grid: this, $event: evnt })
932
962
  },
933
963
  triggerPendingEvent (code) {
934
- const { isMsg } = this
964
+ const { isActiveMsg } = this
935
965
  const selectRecords = this.getCheckboxRecords()
936
966
  if (selectRecords.length) {
937
967
  this.togglePendingRow(selectRecords)
938
968
  this.clearCheckboxRow()
939
969
  } else {
940
- if (isMsg) {
970
+ if (isActiveMsg) {
941
971
  // 检测弹窗模块
942
972
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
943
973
  if (!VXETable.modal) {
@@ -628,8 +628,8 @@ export default {
628
628
  type: String,
629
629
  default: () => XEUtils.eqNull(GlobalConfig.input.placeholder) ? GlobalConfig.i18n('vxe.base.pleaseInput') : GlobalConfig.input.placeholder
630
630
  },
631
- maxlength: [String, Number],
632
- autocomplete: { type: String, default: 'off' },
631
+ maxLength: [String, Number],
632
+ autoComplete: { type: String, default: 'off' },
633
633
  align: String,
634
634
  form: String,
635
635
  className: String,
@@ -673,7 +673,12 @@ export default {
673
673
  prefixIcon: String,
674
674
  suffixIcon: String,
675
675
  placement: String,
676
- transfer: { type: Boolean, default: () => GlobalConfig.input.transfer }
676
+ transfer: { type: Boolean, default: () => GlobalConfig.input.transfer },
677
+
678
+ // 已废弃
679
+ maxlength: [String, Number],
680
+ // 已废弃
681
+ autocomplete: String
677
682
  },
678
683
  inject: {
679
684
  $xeform: {
@@ -722,7 +727,8 @@ export default {
722
727
  return XEUtils.getSize(this.inputValue)
723
728
  },
724
729
  isCountError () {
725
- return this.maxlength && this.inputCount > XEUtils.toNumber(this.maxlength)
730
+ const { maxLength, maxlength } = this
731
+ return (maxLength || maxlength) && this.inputCount > XEUtils.toNumber(maxLength || maxlength)
726
732
  },
727
733
  stepValue () {
728
734
  const { type, step } = this
@@ -1047,9 +1053,9 @@ export default {
1047
1053
  return type
1048
1054
  },
1049
1055
  inpMaxlength () {
1050
- const { isNumType, maxlength } = this
1056
+ const { isNumType, maxLength, maxlength } = this
1051
1057
  // 数值最大长度限制 16 位,包含小数
1052
- return isNumType && !XEUtils.toNumber(maxlength) ? 16 : maxlength
1058
+ return isNumType && !XEUtils.toNumber(maxLength || maxlength) ? 16 : (maxLength || maxlength)
1053
1059
  },
1054
1060
  inpReadonly () {
1055
1061
  const { type, readonly, editable, multiple } = this
@@ -1135,7 +1141,7 @@ export default {
1135
1141
  GlobalEvent.off(this, 'blur')
1136
1142
  },
1137
1143
  render (h) {
1138
- const { name, form, inputType, inpPlaceholder, inpMaxlength, inpReadonly, className, controls, showWordCount, countMethod, inputValue, isDatePickerType, visiblePanel, isActivated, vSize, type, align, readonly, disabled, autocomplete } = this
1144
+ const { name, form, inputType, inpPlaceholder, inpMaxlength, inpReadonly, className, controls, showWordCount, countMethod, inputValue, isDatePickerType, visiblePanel, isActivated, vSize, type, align, readonly, disabled, autoComplete, autocomplete } = this
1139
1145
  const childs = []
1140
1146
  const prefix = rendePrefixIcon(h, this)
1141
1147
  const suffix = renderSuffixIcon(h, this)
@@ -1159,7 +1165,7 @@ export default {
1159
1165
  maxlength: inpMaxlength,
1160
1166
  readonly: inpReadonly,
1161
1167
  disabled,
1162
- autocomplete
1168
+ autocomplete: autoComplete || autocomplete
1163
1169
  },
1164
1170
  on: {
1165
1171
  keydown: this.keydownEvent,
@@ -392,11 +392,11 @@ const Methods = {
392
392
  if (childrenField === treeOpts.mapChildrenField) {
393
393
  errLog('vxe.error.errConflicts', ['tree-config.childrenField', 'tree-config.mapChildrenField'])
394
394
  }
395
- fullData.forEach(row => {
396
- if (row[childrenField] && row[childrenField].length) {
397
- warnLog('vxe.error.errConflicts', ['tree-config.transform', `row.${childrenField}`])
398
- }
399
- })
395
+ // fullData.forEach(row => {
396
+ // if (row[childrenField] && row[childrenField].length) {
397
+ // warnLog('vxe.error.errConflicts', ['tree-config.transform', `row.${childrenField}`])
398
+ // }
399
+ // })
400
400
  }
401
401
  treeData = XEUtils.toArrayTree(fullData, {
402
402
  key: treeOpts.rowField,
@@ -1694,13 +1694,12 @@ const Methods = {
1694
1694
  return this.refreshColumn(true)
1695
1695
  },
1696
1696
  handleCustomRestore (storeData) {
1697
- const { tableFullColumn } = this
1698
1697
  let { collectColumn } = this
1699
1698
  const { resizableData, sortData, visibleData, fixedData } = storeData
1700
1699
  let hasCustomSort = false
1701
1700
  // 处理还原
1702
1701
  if (resizableData || sortData || visibleData || fixedData) {
1703
- tableFullColumn.forEach(column => {
1702
+ XEUtils.eachTree(collectColumn, (column, index, items, path, parent) => {
1704
1703
  const colKey = column.getKey()
1705
1704
  // 支持一级
1706
1705
  if (!parent) {
@@ -1731,7 +1730,7 @@ const Methods = {
1731
1730
  * 还原自定义列操作状态
1732
1731
  */
1733
1732
  restoreCustomStorage () {
1734
- const { id, customConfig, customOpts } = this
1733
+ const { tableId, customConfig, customOpts } = this
1735
1734
  const { storage, restoreStore } = customOpts
1736
1735
  const isAllCustom = storage === true
1737
1736
  const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {})
@@ -1740,14 +1739,14 @@ const Methods = {
1740
1739
  const isCustomFixed = isAllCustom || storageOpts.fixed
1741
1740
  const isCustomSort = isAllCustom || storageOpts.sort
1742
1741
  if (customConfig && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort)) {
1743
- if (!id) {
1742
+ if (!tableId) {
1744
1743
  errLog('vxe.error.reqProp', ['id'])
1745
1744
  return
1746
1745
  }
1747
- const storeData = getCustomStorageMap(id)
1746
+ const storeData = getCustomStorageMap(tableId)
1748
1747
  if (restoreStore) {
1749
1748
  return Promise.resolve(
1750
- restoreStore({ id, type: 'restore', storeData })
1749
+ restoreStore({ id: tableId, type: 'restore', storeData })
1751
1750
  ).then(storeData => {
1752
1751
  if (!storeData) {
1753
1752
  return
@@ -1836,7 +1835,7 @@ const Methods = {
1836
1835
  return storeData
1837
1836
  },
1838
1837
  saveCustomStore (type) {
1839
- const { id, customOpts } = this
1838
+ const { tableId, customOpts } = this
1840
1839
  const { updateStore, storage } = customOpts
1841
1840
  const isAllCustom = storage === true
1842
1841
  const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {})
@@ -1845,7 +1844,7 @@ const Methods = {
1845
1844
  const isCustomFixed = isAllCustom || storageOpts.fixed
1846
1845
  const isCustomSort = isAllCustom || storageOpts.sort
1847
1846
  if (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort) {
1848
- if (!id) {
1847
+ if (!tableId) {
1849
1848
  errLog('vxe.error.reqProp', ['id'])
1850
1849
  return this.$nextTick()
1851
1850
  }
@@ -1859,12 +1858,12 @@ const Methods = {
1859
1858
  : this.getCustomStoreData()
1860
1859
  if (updateStore) {
1861
1860
  return updateStore({
1862
- id,
1861
+ id: tableId,
1863
1862
  type,
1864
1863
  storeData
1865
1864
  })
1866
1865
  } else {
1867
- setCustomStorageMap(id, type === 'reset' ? null : storeData)
1866
+ setCustomStorageMap(tableId, type === 'reset' ? null : storeData)
1868
1867
  }
1869
1868
  }
1870
1869
  return this.$nextTick()
@@ -2655,13 +2654,15 @@ const Methods = {
2655
2654
  this.clearSelected()
2656
2655
  }
2657
2656
  if (areaOpts.autoClear) {
2658
- const cellAreas = this.getCellAreas()
2659
- if (cellAreas.length && !getEventTargetNode(evnt, document.body, 'vxe-table--ignore-areas-clear').flag) {
2660
- this.preventEvent(evnt, 'event.clearAreas', {}, () => {
2661
- this.clearCellAreas()
2662
- this.clearCopyCellArea()
2663
- this.emitEvent('clear-cell-area-selection', { cellAreas }, evnt)
2664
- })
2657
+ if (this.getCellAreas) {
2658
+ const cellAreas = this.getCellAreas()
2659
+ if (cellAreas && cellAreas.length && !getEventTargetNode(evnt, document.body, 'vxe-table--ignore-areas-clear').flag) {
2660
+ this.preventEvent(evnt, 'event.clearAreas', {}, () => {
2661
+ this.clearCellAreas()
2662
+ this.clearCopyCellArea()
2663
+ this.emitEvent('clear-cell-area-selection', { cellAreas }, evnt)
2664
+ })
2665
+ }
2665
2666
  }
2666
2667
  }
2667
2668
  }
@@ -92,7 +92,7 @@ export default {
92
92
  mixins: [vSize],
93
93
  props: {
94
94
  /** 基本属性 */
95
- id: String,
95
+ id: [String, Function],
96
96
  // 数据
97
97
  data: Array,
98
98
  // 表格的高度
@@ -489,6 +489,16 @@ export default {
489
489
  }
490
490
  },
491
491
  computed: {
492
+ tableId () {
493
+ const { id } = this
494
+ if (id) {
495
+ if (XEUtils.isFunction(id)) {
496
+ return `${id({ $table: this }) || ''}`
497
+ }
498
+ return `${id}`
499
+ }
500
+ return ''
501
+ },
492
502
  validOpts () {
493
503
  return Object.assign({ message: 'default' }, GlobalConfig.table.validConfig, this.validConfig)
494
504
  },
@@ -1248,33 +1258,35 @@ export default {
1248
1258
  ctxMenuOpts
1249
1259
  }
1250
1260
  }) : _e(),
1251
- /**
1252
- * 通用提示
1253
- */
1254
- hasTip ? h('vxe-tooltip', {
1255
- ref: 'commTip',
1256
- props: {
1257
- isArrow: false,
1258
- enterable: false
1259
- }
1260
- }) : _e(),
1261
- /**
1262
- * 工具提示
1263
- */
1264
- hasTip ? h('vxe-tooltip', {
1265
- ref: 'tooltip',
1266
- props: Object.assign({}, this.tipConfig, this.tooltipStore.currOpts)
1267
- }) : _e(),
1268
- /**
1269
- * 校验提示
1270
- */
1271
- hasTip && this.editRules && validOpts.showMessage && (validOpts.message === 'default' ? !height : validOpts.message === 'tooltip') ? h('vxe-tooltip', {
1272
- ref: 'validTip',
1273
- class: [{
1274
- 'old-cell-valid': editRules && GlobalConfig.cellVaildMode === 'obsolete'
1275
- }, 'vxe-table--valid-error'],
1276
- props: validOpts.message === 'tooltip' || tableData.length === 1 ? validTipOpts : null
1277
- }) : _e()
1261
+ h('div', {}, [
1262
+ /**
1263
+ * 通用提示
1264
+ */
1265
+ hasTip ? h('vxe-tooltip', {
1266
+ ref: 'commTip',
1267
+ props: {
1268
+ isArrow: false,
1269
+ enterable: false
1270
+ }
1271
+ }) : _e(),
1272
+ /**
1273
+ * 工具提示
1274
+ */
1275
+ hasTip ? h('vxe-tooltip', {
1276
+ ref: 'tooltip',
1277
+ props: Object.assign({}, this.tipConfig, this.tooltipStore.currOpts)
1278
+ }) : _e(),
1279
+ /**
1280
+ * 校验提示
1281
+ */
1282
+ hasTip && this.editRules && validOpts.showMessage && (validOpts.message === 'default' ? !height : validOpts.message === 'tooltip') ? h('vxe-tooltip', {
1283
+ ref: 'validTip',
1284
+ class: [{
1285
+ 'old-cell-valid': editRules && GlobalConfig.cellVaildMode === 'obsolete'
1286
+ }, 'vxe-table--valid-error'],
1287
+ props: validOpts.message === 'tooltip' || tableData.length === 1 ? validTipOpts : null
1288
+ }) : _e()
1289
+ ])
1278
1290
  ])
1279
1291
  },
1280
1292
  methods
@@ -18,6 +18,7 @@ const renderDropdowns = (h, _vm, item, isBtn) => {
18
18
  disabled: child.disabled,
19
19
  loading: child.loading,
20
20
  type: child.type,
21
+ mode: child.mode,
21
22
  icon: child.icon,
22
23
  circle: child.circle,
23
24
  round: child.round,
@@ -63,6 +64,7 @@ function renderBtns (h, _vm) {
63
64
  disabled: item.disabled,
64
65
  loading: item.loading,
65
66
  type: item.type,
67
+ mode: item.mode,
66
68
  icon: item.icon,
67
69
  circle: item.circle,
68
70
  round: item.round,
@@ -112,6 +114,7 @@ function renderRightTools (h, _vm) {
112
114
  disabled: item.disabled,
113
115
  loading: item.loading,
114
116
  type: item.type,
117
+ mode: item.mode,
115
118
  icon: item.icon,
116
119
  circle: item.circle,
117
120
  round: item.round,
@@ -263,7 +263,8 @@ export default {
263
263
  proxyConfig: {
264
264
  enabled: true,
265
265
  autoLoad: true,
266
- message: true,
266
+ showResponseMsg: true,
267
+ showActiveMsg: true,
267
268
  props: {
268
269
  list: null,
269
270
  result: 'result',
@@ -470,7 +470,7 @@ function getSelectCellValue (renderOpts, { row, column }) {
470
470
  let selectItem
471
471
  const labelProp = optionProps.label || 'label'
472
472
  const valueProp = optionProps.value || 'value'
473
- if (!isEmptyValue(cellValue)) {
473
+ if (!(cellValue === null || cellValue === undefined)) {
474
474
  return XEUtils.map(props.multiple ? cellValue : [cellValue], optionGroups ? (value) => {
475
475
  const groupOptions = optionGroupProps.options || 'options'
476
476
  for (let index = 0; index < optionGroups.length; index++) {
Binary file
Binary file
Binary file