vxe-table 3.15.28 → 3.15.30

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/es/grid/src/grid.js +39 -42
  2. package/es/index.css +1 -1
  3. package/es/index.min.css +1 -1
  4. package/es/style.css +1 -1
  5. package/es/style.min.css +1 -1
  6. package/es/table/module/edit/mixin.js +11 -27
  7. package/es/table/module/export/mixin.js +65 -139
  8. package/es/table/module/filter/mixin.js +1 -0
  9. package/es/table/module/menu/mixin.js +2 -6
  10. package/es/table/module/validator/mixin.js +99 -41
  11. package/es/table/src/methods.js +110 -89
  12. package/es/table/src/table.js +6 -8
  13. package/es/table/style.css +6 -0
  14. package/es/table/style.min.css +1 -1
  15. package/es/ui/index.js +1 -1
  16. package/es/ui/src/log.js +1 -1
  17. package/es/vxe-table/style.css +6 -0
  18. package/es/vxe-table/style.min.css +1 -1
  19. package/lib/grid/src/grid.js +24 -26
  20. package/lib/grid/src/grid.min.js +1 -1
  21. package/lib/index.css +1 -1
  22. package/lib/index.min.css +1 -1
  23. package/lib/index.umd.js +358 -615
  24. package/lib/index.umd.min.js +1 -1
  25. package/lib/style.css +1 -1
  26. package/lib/style.min.css +1 -1
  27. package/lib/table/module/edit/mixin.js +11 -27
  28. package/lib/table/module/edit/mixin.min.js +1 -1
  29. package/lib/table/module/export/mixin.js +78 -168
  30. package/lib/table/module/export/mixin.min.js +1 -1
  31. package/lib/table/module/filter/mixin.js +1 -0
  32. package/lib/table/module/menu/mixin.js +2 -6
  33. package/lib/table/module/menu/mixin.min.js +1 -1
  34. package/lib/table/module/validator/mixin.js +97 -40
  35. package/lib/table/module/validator/mixin.min.js +1 -1
  36. package/lib/table/src/methods.js +121 -95
  37. package/lib/table/src/methods.min.js +1 -1
  38. package/lib/table/src/table.js +8 -10
  39. package/lib/table/src/table.min.js +1 -1
  40. package/lib/table/style/style.css +6 -0
  41. package/lib/table/style/style.min.css +1 -1
  42. package/lib/ui/index.js +1 -1
  43. package/lib/ui/index.min.js +1 -1
  44. package/lib/ui/src/log.js +1 -1
  45. package/lib/ui/src/log.min.js +1 -1
  46. package/lib/vxe-table/style/style.css +6 -0
  47. package/lib/vxe-table/style/style.min.css +1 -1
  48. package/package.json +1 -1
  49. package/packages/grid/src/grid.ts +39 -41
  50. package/packages/table/module/edit/mixin.ts +11 -27
  51. package/packages/table/module/export/mixin.ts +96 -158
  52. package/packages/table/module/filter/mixin.ts +1 -0
  53. package/packages/table/module/menu/mixin.ts +2 -6
  54. package/packages/table/module/validator/mixin.ts +101 -40
  55. package/packages/table/src/methods.ts +115 -90
  56. package/packages/table/src/table.ts +6 -8
  57. package/styles/components/table.scss +14 -0
  58. /package/es/{iconfont.1747176212818.ttf → iconfont.1747357311626.ttf} +0 -0
  59. /package/es/{iconfont.1747176212818.woff → iconfont.1747357311626.woff} +0 -0
  60. /package/es/{iconfont.1747176212818.woff2 → iconfont.1747357311626.woff2} +0 -0
  61. /package/lib/{iconfont.1747176212818.ttf → iconfont.1747357311626.ttf} +0 -0
  62. /package/lib/{iconfont.1747176212818.woff → iconfont.1747357311626.woff} +0 -0
  63. /package/lib/{iconfont.1747176212818.woff2 → iconfont.1747357311626.woff2} +0 -0
@@ -116,9 +116,7 @@ export default {
116
116
  this.handleOpenMenuEvent(evnt, layout, params)
117
117
  // 在 v4 中废弃事件 cell-context-menu、header-cell-context-menu、footer-cell-context-menu
118
118
  if (this.$listeners[`${typePrefix}cell-context-menu`]) {
119
- if (process.env.VUE_APP_VXE_ENV === 'development') {
120
- warnLog('vxe.error.delEvent', [`${typePrefix}cell-context-menu`, `${typePrefix}cell-menu`])
121
- }
119
+ warnLog('vxe.error.delEvent', [`${typePrefix}cell-context-menu`, `${typePrefix}cell-menu`])
122
120
  this.emitEvent(`${typePrefix}cell-context-menu`, params, evnt)
123
121
  } else {
124
122
  this.emitEvent(`${typePrefix}cell-menu`, params, evnt)
@@ -270,9 +268,7 @@ export default {
270
268
  }
271
269
  // 在 v4 中废弃事件 context-menu-click
272
270
  if (this.$listeners['context-menu-click']) {
273
- if (process.env.VUE_APP_VXE_ENV === 'development') {
274
- warnLog('vxe.error.delEvent', ['context-menu-click', 'menu-click'])
275
- }
271
+ warnLog('vxe.error.delEvent', ['context-menu-click', 'menu-click'])
276
272
  this.emitEvent('context-menu-click', params, evnt)
277
273
  } else {
278
274
  this.emitEvent('menu-click', params, evnt)
@@ -1,6 +1,6 @@
1
1
  import XEUtils from 'xe-utils'
2
2
  import { VxeUI } from '../../../ui'
3
- import { getFuncText, eqEmptyValue } from '../../../ui/src/utils'
3
+ import { getFuncText } from '../../../ui/src/utils'
4
4
  import { scrollToView } from '../../../ui/src/dom'
5
5
  import { handleFieldOrColumn, getRowid } from '../../src/util'
6
6
  import { warnLog, errLog } from '../../../ui/src/log'
@@ -41,27 +41,104 @@ class Rule {
41
41
  }
42
42
  }
43
43
 
44
- function validErrorRuleValue (rule: any, val: any) {
44
+ // 如果存在 pattern,判断正则
45
+ function validREValue (pattern: string | RegExp | undefined, val: string) {
46
+ if (pattern && !(XEUtils.isRegExp(pattern) ? pattern : new RegExp(pattern)).test(val)) {
47
+ return false
48
+ }
49
+ return true
50
+ }
51
+
52
+ // 如果存在 max,判断最大值
53
+ function validMaxValue (max: string | number | undefined, num: number) {
54
+ if (!XEUtils.eqNull(max) && num > XEUtils.toNumber(max)) {
55
+ return false
56
+ }
57
+ return true
58
+ }
59
+
60
+ // 如果存在 min,判断最小值
61
+ function validMinValue (min: string | number | undefined, num: number) {
62
+ if (!XEUtils.eqNull(min) && num < XEUtils.toNumber(min)) {
63
+ return false
64
+ }
65
+ return true
66
+ }
67
+
68
+ function validRuleValue (rule: VxeTableDefines.ValidatorRule, val: any, required: boolean | undefined) {
45
69
  const { type, min, max, pattern } = rule
70
+ const isArrType = type === 'array'
46
71
  const isNumType = type === 'number'
47
- const numVal = isNumType ? XEUtils.toNumber(val) : XEUtils.getSize(val)
48
- // 判断数值
49
- if (isNumType && isNaN(val)) {
50
- return true
51
- }
52
- // 如果存在 min,判断最小值
53
- if (!XEUtils.eqNull(min) && numVal < XEUtils.toNumber(min)) {
54
- return true
72
+ const isStrType = type === 'string'
73
+ const strVal = `${val}`
74
+ if (!validREValue(pattern, strVal)) {
75
+ return false
55
76
  }
56
- // 如果存在 max,判断最大值
57
- if (!XEUtils.eqNull(max) && numVal > XEUtils.toNumber(max)) {
58
- return true
77
+ if (isArrType) {
78
+ if (!XEUtils.isArray(val)) {
79
+ return false
80
+ }
81
+ if (required) {
82
+ if (!val.length) {
83
+ return false
84
+ }
85
+ }
86
+ if (!validMinValue(min, val.length)) {
87
+ return false
88
+ }
89
+ if (!validMaxValue(max, val.length)) {
90
+ return false
91
+ }
92
+ } else if (isNumType) {
93
+ const numVal = Number(val)
94
+ if (isNaN(numVal)) {
95
+ return false
96
+ }
97
+ if (!validMinValue(min, numVal)) {
98
+ return false
99
+ }
100
+ if (!validMaxValue(max, numVal)) {
101
+ return false
102
+ }
103
+ } else {
104
+ if (isStrType) {
105
+ if (!XEUtils.isString(val)) {
106
+ return false
107
+ }
108
+ }
109
+ if (required) {
110
+ if (!strVal) {
111
+ return false
112
+ }
113
+ }
114
+ if (!validMinValue(min, strVal.length)) {
115
+ return false
116
+ }
117
+ if (!validMaxValue(max, strVal.length)) {
118
+ return false
119
+ }
59
120
  }
60
- // 如果存在 pattern,正则校验
61
- if (pattern && !(XEUtils.isRegExp(pattern) ? pattern : new RegExp(pattern)).test(val)) {
62
- return true
121
+ return true
122
+ }
123
+
124
+ function checkRuleStatus (rule: VxeTableDefines.ValidatorRule, val: any) {
125
+ const { required } = rule
126
+ const isEmptyVal = XEUtils.eqNull(val)
127
+ if (required) {
128
+ if (isEmptyVal) {
129
+ return false
130
+ }
131
+ if (!validRuleValue(rule, val, required)) {
132
+ return false
133
+ }
134
+ } else {
135
+ if (!isEmptyVal) {
136
+ if (!validRuleValue(rule, val, required)) {
137
+ return false
138
+ }
139
+ }
63
140
  }
64
- return false
141
+ return true
65
142
  }
66
143
 
67
144
  export default {
@@ -70,10 +147,8 @@ export default {
70
147
  * 完整校验,和 validate 的区别就是会给有效数据中的每一行进行校验
71
148
  */
72
149
  _fullValidate (rows: any, cb: any) {
73
- if (process.env.VUE_APP_VXE_ENV === 'development') {
74
- if (XEUtils.isFunction(cb)) {
75
- warnLog('vxe.error.notValidators', ['fullValidate(rows, callback)', 'fullValidate(rows)'])
76
- }
150
+ if (XEUtils.isFunction(cb)) {
151
+ warnLog('vxe.error.notValidators', ['fullValidate(rows, callback)', 'fullValidate(rows)'])
77
152
  }
78
153
  return this.beginValidate(rows, null, cb, true)
79
154
  },
@@ -81,10 +156,8 @@ export default {
81
156
  * 快速校验,如果存在记录不通过的记录,则返回不再继续校验(异步校验除外)
82
157
  */
83
158
  _validate (rows: any, cb: any) {
84
- if (process.env.VUE_APP_VXE_ENV === 'development') {
85
- if (XEUtils.isFunction(cb)) {
86
- warnLog('vxe.error.notValidators', ['validate(rows, callback)', 'validate(rows)'])
87
- }
159
+ if (XEUtils.isFunction(cb)) {
160
+ warnLog('vxe.error.notValidators', ['validate(rows, callback)', 'validate(rows)'])
88
161
  }
89
162
  return this.beginValidate(rows, null, cb)
90
163
  },
@@ -326,7 +399,7 @@ export default {
326
399
  if (rules) {
327
400
  const cellValue = XEUtils.isUndefined(val) ? XEUtils.get(row, property) : val
328
401
  rules.forEach((rule: any) => {
329
- const { type, trigger, required, validator } = rule
402
+ const { trigger, validator } = rule
330
403
  if (validType === 'all' || !trigger || validType === trigger) {
331
404
  if (validator) {
332
405
  const validParams: any = {
@@ -348,9 +421,7 @@ export default {
348
421
  if (tcvMethod) {
349
422
  customValid = tcvMethod(validParams)
350
423
  } else {
351
- if (process.env.VUE_APP_VXE_ENV === 'development') {
352
- warnLog('vxe.error.notValidators', [validator])
353
- }
424
+ errLog('vxe.error.notValidators', [validator])
354
425
  }
355
426
  } else {
356
427
  errLog('vxe.error.notValidators', [validator])
@@ -373,17 +444,7 @@ export default {
373
444
  }
374
445
  }
375
446
  } else {
376
- const isArrType = type === 'array'
377
- const isArrVal = XEUtils.isArray(cellValue)
378
- let hasEmpty = true
379
- if (isArrType || isArrVal) {
380
- hasEmpty = !isArrVal || !cellValue.length
381
- } else if (XEUtils.isString(cellValue)) {
382
- hasEmpty = eqEmptyValue(cellValue.trim())
383
- } else {
384
- hasEmpty = eqEmptyValue(cellValue)
385
- }
386
- if (required ? (hasEmpty || validErrorRuleValue(rule, cellValue)) : (!hasEmpty && validErrorRuleValue(rule, cellValue))) {
447
+ if (!checkRuleStatus(rule, cellValue)) {
387
448
  this.validRuleErr = true
388
449
  errorRules.push(new Rule(rule))
389
450
  }
@@ -3,7 +3,7 @@ import { getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTarge
3
3
  import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils'
4
4
  import { VxeUI } from '../../ui'
5
5
  import Cell from './cell'
6
- import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, createHandleUpdateRowId, createHandleGetRowId, getRefElem } from './util'
6
+ import { getRowUniqueId, clearTableAllStatus, toFilters, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, createHandleUpdateRowId, createHandleGetRowId, getRefElem } from './util'
7
7
  import { getSlotVNs } from '../../ui/src/vn'
8
8
  import { warnLog, errLog } from '../../ui/src/log'
9
9
 
@@ -30,8 +30,9 @@ function eqCellValue (row1: any, row2: any, field: any) {
30
30
  return XEUtils.isEqual(val1, val2)
31
31
  }
32
32
 
33
- function getNextSortOrder (_vm: any, column: any) {
34
- const orders = _vm.sortOpts.orders
33
+ function getNextSortOrder ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, column: any) {
34
+ const sortOpts = $xeTable.computeSortOpts
35
+ const { orders = [] } = sortOpts
35
36
  const currOrder = column.order || null
36
37
  const oIndex = orders.indexOf(currOrder) + 1
37
38
  return orders[oIndex < orders.length ? oIndex : 0]
@@ -2019,8 +2020,59 @@ function removeFooterMerges ($xeTable: VxeTableConstructor & VxeTablePrivateMeth
2019
2020
  return rest
2020
2021
  }
2021
2022
 
2022
- function clearAllSort (_vm: any) {
2023
- _vm.tableFullColumn.forEach((column: any) => {
2023
+ function handleSortEvent ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, evnt: Event | null, sortConfs: VxeTableDefines.SortConfs | VxeTableDefines.SortConfs[], isUpdate?: boolean) {
2024
+ const sortOpts = $xeTable.computeSortOpts
2025
+ const { multiple, remote, orders } = sortOpts
2026
+ if (!XEUtils.isArray(sortConfs)) {
2027
+ sortConfs = [sortConfs]
2028
+ }
2029
+ if (sortConfs && sortConfs.length) {
2030
+ if (!multiple) {
2031
+ sortConfs = [sortConfs[0]]
2032
+ clearAllSort($xeTable)
2033
+ }
2034
+ let firstColumn: any = null
2035
+ sortConfs.forEach((confs: any, index: number) => {
2036
+ let { field, order } = confs
2037
+ let column = field
2038
+ if (XEUtils.isString(field)) {
2039
+ column = $xeTable.getColumnByField(field)
2040
+ }
2041
+ if (!firstColumn) {
2042
+ firstColumn = column
2043
+ }
2044
+ if (column && column.sortable) {
2045
+ if (orders && orders.indexOf(order) === -1) {
2046
+ order = getNextSortOrder($xeTable, column)
2047
+ }
2048
+ if (column.order !== order) {
2049
+ column.order = order
2050
+ }
2051
+ column.sortTime = Date.now() + index
2052
+ }
2053
+ })
2054
+ if (isUpdate) {
2055
+ if (!remote) {
2056
+ $xeTable.handleTableData(true)
2057
+ }
2058
+ }
2059
+ if (evnt) {
2060
+ $xeTable.handleColumnSortEvent(evnt, firstColumn)
2061
+ }
2062
+ return $xeTable.$nextTick().then(() => {
2063
+ updateRowOffsetTop($xeTable)
2064
+ $xeTable.updateCellAreas()
2065
+ return updateStyle($xeTable)
2066
+ })
2067
+ }
2068
+ return $xeTable.$nextTick()
2069
+ }
2070
+
2071
+ function clearAllSort ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
2072
+ const internalData = $xeTable as unknown as TableInternalData
2073
+
2074
+ const { tableFullColumn } = internalData
2075
+ tableFullColumn.forEach((column: any) => {
2024
2076
  column.order = null
2025
2077
  })
2026
2078
  }
@@ -3075,7 +3127,6 @@ function parseColumns ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, i
3075
3127
  // }
3076
3128
  // }
3077
3129
  // }
3078
- // if (process.env.VUE_APP_VXE_ENV === 'development') {
3079
3130
  // if (props.showHeader && !props.showHeaderOverflow) {
3080
3131
  // warnLog('vxe.error.reqProp', ['show-header-overflow'])
3081
3132
  // }
@@ -3088,7 +3139,6 @@ function parseColumns ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, i
3088
3139
  if (props.footerSpanMethod) {
3089
3140
  warnLog('vxe.error.scrollErrProp', ['footer-span-method'])
3090
3141
  }
3091
- // }
3092
3142
  if (isReset) {
3093
3143
  const { visibleSize } = handleVirtualXVisible($xeTable)
3094
3144
  scrollXStore.startIndex = 0
@@ -3288,7 +3338,7 @@ function checkLastSyncScroll ($xeTable: VxeTableConstructor & VxeTablePrivateMet
3288
3338
  const reactData = $xeTable as unknown as TableReactData
3289
3339
  const internalData = $xeTable as unknown as TableInternalData
3290
3340
 
3291
- const { scrollXLoad, scrollYLoad } = reactData
3341
+ const { scrollXLoad, scrollYLoad, isAllOverflow } = reactData
3292
3342
  const { lcsTimeout } = internalData
3293
3343
  if (lcsTimeout) {
3294
3344
  clearTimeout(lcsTimeout)
@@ -3303,13 +3353,19 @@ function checkLastSyncScroll ($xeTable: VxeTableConstructor & VxeTablePrivateMet
3303
3353
  internalData.inBodyScroll = false
3304
3354
  internalData.inFooterScroll = false
3305
3355
  internalData.scrollRenderType = ''
3306
- calcCellHeight($xeTable)
3356
+ if (!isAllOverflow) {
3357
+ calcCellHeight($xeTable)
3358
+ updateRowOffsetTop($xeTable)
3359
+ }
3307
3360
  if (isRollX && scrollXLoad) {
3308
3361
  $xeTable.updateScrollXData()
3309
3362
  }
3310
3363
  if (isRollY && scrollYLoad) {
3311
3364
  $xeTable.updateScrollYData().then(() => {
3312
- calcCellHeight($xeTable)
3365
+ if (!isAllOverflow) {
3366
+ calcCellHeight($xeTable)
3367
+ updateRowOffsetTop($xeTable)
3368
+ }
3313
3369
  $xeTable.updateScrollYSpace()
3314
3370
  })
3315
3371
  }
@@ -3780,9 +3836,7 @@ const Methods = {
3780
3836
  }
3781
3837
  this.tableData = tableData.slice(0)
3782
3838
  } else {
3783
- if (process.env.VUE_APP_VXE_ENV === 'development') {
3784
- warnLog('vxe.error.reqProp', ['keep-source'])
3785
- }
3839
+ errLog('vxe.error.reqProp', ['keep-source'])
3786
3840
  }
3787
3841
  return this.$nextTick()
3788
3842
  },
@@ -4026,16 +4080,12 @@ const Methods = {
4026
4080
  getVMRowIndex: createGetRowCacheProp('$index') as ((row: any) => number),
4027
4081
  // 在 v3 中废弃
4028
4082
  _getRowIndex (row: any) {
4029
- if (process.env.VUE_APP_VXE_ENV === 'development') {
4030
- warnLog('vxe.error.delFunc', ['_getRowIndex', 'getVTRowIndex'])
4031
- }
4083
+ warnLog('vxe.error.delFunc', ['_getRowIndex', 'getVTRowIndex'])
4032
4084
  return this.getVTRowIndex(row)
4033
4085
  },
4034
4086
  // 在 v3 中废弃
4035
4087
  $getRowIndex (row: any) {
4036
- if (process.env.VUE_APP_VXE_ENV === 'development') {
4037
- warnLog('vxe.error.delFunc', ['$getRowIndex', 'getVMRowIndex'])
4038
- }
4088
+ warnLog('vxe.error.delFunc', ['$getRowIndex', 'getVMRowIndex'])
4039
4089
  return this.getVMRowIndex(row)
4040
4090
  },
4041
4091
  /**
@@ -4055,16 +4105,12 @@ const Methods = {
4055
4105
  getVMColumnIndex: createGetColumnCacheProp('$index'),
4056
4106
  // 在 v3 中废弃
4057
4107
  _getColumnIndex (column: any) {
4058
- if (process.env.VUE_APP_VXE_ENV === 'development') {
4059
- warnLog('vxe.error.delFunc', ['_getColumnIndex', 'getVTColumnIndex'])
4060
- }
4108
+ warnLog('vxe.error.delFunc', ['_getColumnIndex', 'getVTColumnIndex'])
4061
4109
  return this.getVTColumnIndex(column)
4062
4110
  },
4063
4111
  // 在 v3 中废弃
4064
4112
  $getColumnIndex (column: any) {
4065
- if (process.env.VUE_APP_VXE_ENV === 'development') {
4066
- warnLog('vxe.error.delFunc', ['$getColumnIndex', 'getVMColumnIndex'])
4067
- }
4113
+ warnLog('vxe.error.delFunc', ['$getColumnIndex', 'getVMColumnIndex'])
4068
4114
  return this.getVMColumnIndex(column)
4069
4115
  },
4070
4116
  /**
@@ -4170,9 +4216,7 @@ const Methods = {
4170
4216
  const { transform } = treeOpts
4171
4217
  const { handleGetRowId } = createHandleGetRowId($xeTable)
4172
4218
  if (!keepSource) {
4173
- if (process.env.VUE_APP_VXE_ENV === 'development') {
4174
- errLog('vxe.error.reqProp', ['keep-source'])
4175
- }
4219
+ errLog('vxe.error.reqProp', ['keep-source'])
4176
4220
  return $xeTable.$nextTick()
4177
4221
  }
4178
4222
  let targetRows = rows
@@ -4812,6 +4856,7 @@ const Methods = {
4812
4856
  }
4813
4857
  XEUtils.eachTree([targetColumn], (column) => {
4814
4858
  column.fixed = fixed
4859
+ column.renderFixed = fixed
4815
4860
  })
4816
4861
  $xeTable.saveCustomStore('update:fixed')
4817
4862
  if (!status) {
@@ -4838,6 +4883,7 @@ const Methods = {
4838
4883
  if (targetColumn && targetColumn.fixed) {
4839
4884
  XEUtils.eachTree([targetColumn], (column) => {
4840
4885
  column.fixed = null
4886
+ column.renderFixed = null
4841
4887
  })
4842
4888
  $xeTable.saveCustomStore('update:fixed')
4843
4889
  if (!status) {
@@ -5760,10 +5806,8 @@ const Methods = {
5760
5806
  // 兼容老版本
5761
5807
  if (!evntList.length && type === 'event.clearEdit') {
5762
5808
  evntList = interceptor.get('event.clearActived')
5763
- if (process.env.VUE_APP_VXE_ENV === 'development') {
5764
- if (evntList.length) {
5765
- warnLog('vxe.error.delEvent', ['event.clearActived', 'event.clearEdit'])
5766
- }
5809
+ if (evntList.length) {
5810
+ warnLog('vxe.error.delEvent', ['event.clearActived', 'event.clearEdit'])
5767
5811
  }
5768
5812
  }
5769
5813
  // 兼容老版本
@@ -6427,10 +6471,14 @@ const Methods = {
6427
6471
  if (tooltipStore.column !== column || tooltipStore.row !== row || !tooltipStore.visible) {
6428
6472
  const ctEl = tdEl.querySelector<HTMLElement>('.vxe-cell--wrapper')
6429
6473
  let ovEl = null
6474
+ let tipEl = tdEl.querySelector<HTMLElement>(column.type === 'html' ? '.vxe-cell--html' : '.vxe-cell--label')
6430
6475
  if (column.treeNode) {
6431
6476
  ovEl = tdEl.querySelector<HTMLElement>('.vxe-tree-cell')
6432
6477
  }
6433
- handleTooltip($xeTable, evnt, tdEl, ovEl || ctEl, tdEl.querySelector<HTMLElement>('.vxe-cell--label') || tdEl.querySelector<HTMLElement>('.vxe-cell--wrapper'), params)
6478
+ if (!tipEl) {
6479
+ tipEl = ctEl
6480
+ }
6481
+ handleTooltip($xeTable, evnt, tdEl, ovEl || ctEl, tipEl, params)
6434
6482
  }
6435
6483
  },
6436
6484
  /**
@@ -6445,10 +6493,19 @@ const Methods = {
6445
6493
  const tdEl = evnt.currentTarget as HTMLTableCellElement
6446
6494
  handleTargetEnterEvent($xeTable, tooltipStore.column !== column || !!tooltipStore.row)
6447
6495
  if (tooltipStore.column !== column || !tooltipStore.visible) {
6448
- handleTooltip($xeTable, evnt, tdEl, tdEl.querySelector<HTMLElement>('.vxe-cell--wrapper'), tdEl.querySelector<HTMLElement>('.vxe-cell--label') || tdEl.querySelector('.vxe-cell--wrapper') as HTMLElement, params)
6496
+ const ctEl = tdEl.querySelector<HTMLElement>('.vxe-cell--wrapper')
6497
+ let ovEl = null
6498
+ let tipEl = tdEl.querySelector<HTMLElement>(column.type === 'html' ? '.vxe-cell--html' : '.vxe-cell--label')
6499
+ if (column.type === 'html') {
6500
+ ovEl = tdEl.querySelector<HTMLElement>('.vxe-cell--html')
6501
+ }
6502
+ if (!tipEl) {
6503
+ tipEl = ctEl
6504
+ }
6505
+ handleTooltip($xeTable, evnt, tdEl, ovEl || ctEl, tipEl, params)
6449
6506
  }
6450
6507
  },
6451
- openTooltip (target: any, content: any) {
6508
+ openTooltip (target: HTMLElement, content: string | number) {
6452
6509
  const { $refs } = this
6453
6510
  const commTip = $refs.refCommTooltip
6454
6511
  if (commTip) {
@@ -8524,49 +8581,13 @@ const Methods = {
8524
8581
  setSort (sortConfs: VxeTableDefines.SortConfs | VxeTableDefines.SortConfs[], isUpdate?: boolean) {
8525
8582
  const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
8526
8583
 
8527
- const sortOpts = $xeTable.computeSortOpts
8528
- const { multiple, remote, orders } = sortOpts
8529
- if (!XEUtils.isArray(sortConfs)) {
8530
- sortConfs = [sortConfs]
8531
- }
8532
- if (sortConfs && sortConfs.length) {
8533
- if (!multiple) {
8534
- sortConfs = [sortConfs[0]]
8535
- clearAllSort($xeTable)
8536
- }
8537
- let firstColumn: any = null
8538
- sortConfs.forEach((confs: any, index: number) => {
8539
- let { field, order } = confs
8540
- let column = field
8541
- if (XEUtils.isString(field)) {
8542
- column = $xeTable.getColumnByField(field)
8543
- }
8544
- if (!firstColumn) {
8545
- firstColumn = column
8546
- }
8547
- if (column && column.sortable) {
8548
- if (orders && orders.indexOf(order) === -1) {
8549
- order = getNextSortOrder($xeTable, column)
8550
- }
8551
- if (column.order !== order) {
8552
- column.order = order
8553
- }
8554
- column.sortTime = Date.now() + index
8555
- }
8556
- })
8557
- if (isUpdate) {
8558
- if (!remote) {
8559
- $xeTable.handleTableData(true)
8560
- }
8561
- $xeTable.handleColumnSortEvent(new Event('click'), firstColumn)
8562
- }
8563
- return $xeTable.$nextTick().then(() => {
8564
- updateRowOffsetTop($xeTable)
8565
- $xeTable.updateCellAreas()
8566
- return updateStyle($xeTable)
8567
- })
8568
- }
8569
- return $xeTable.$nextTick()
8584
+ // 已废弃,即将去掉事件触发 new Event('click') -> null
8585
+ return handleSortEvent($xeTable, new Event('click'), sortConfs, isUpdate)
8586
+ },
8587
+ setSortByEvent (evnt: Event, sortConfs: VxeTableDefines.SortConfs | VxeTableDefines.SortConfs[], isUpdate?: boolean) {
8588
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
8589
+
8590
+ return handleSortEvent($xeTable, evnt, sortConfs, isUpdate)
8570
8591
  },
8571
8592
  /**
8572
8593
  * 清空指定列的排序条件
@@ -8632,9 +8653,7 @@ const Methods = {
8632
8653
  },
8633
8654
  // 在 v3 中废弃
8634
8655
  getSortColumn () {
8635
- if (process.env.VUE_APP_VXE_ENV === 'development') {
8636
- warnLog('vxe.error.delFunc', ['getSortColumn', 'getSortColumns'])
8637
- }
8656
+ warnLog('vxe.error.delFunc', ['getSortColumn', 'getSortColumns'])
8638
8657
  return XEUtils.find(this.tableFullColumn, column => (column.sortable || column.remoteSort) && column.order)
8639
8658
  },
8640
8659
  isSort (fieldOrColumn: any) {
@@ -8658,6 +8677,18 @@ const Methods = {
8658
8677
  }
8659
8678
  return sortList
8660
8679
  },
8680
+ setFilterByEvent (evnt: Event, fieldOrColumn: VxeColumnPropTypes.Field | VxeTableDefines.ColumnInfo<any>, options: VxeColumnPropTypes.FilterItem[], isUpdate?: boolean) {
8681
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
8682
+
8683
+ const column = handleFieldOrColumn($xeTable, fieldOrColumn)
8684
+ if (column && column.filters) {
8685
+ column.filters = toFilters(options || [])
8686
+ if (isUpdate) {
8687
+ return $xeTable.handleColumnConfirmFilter(column, evnt)
8688
+ }
8689
+ }
8690
+ return $xeTable.$nextTick()
8691
+ },
8661
8692
  /**
8662
8693
  * 关闭筛选
8663
8694
  * @param {Event} evnt 事件
@@ -8790,9 +8821,7 @@ const Methods = {
8790
8821
  return $xeTable.$nextTick()
8791
8822
  },
8792
8823
  reloadExpandContent (row: any) {
8793
- if (process.env.VUE_APP_VXE_ENV === 'development') {
8794
- warnLog('vxe.error.delFunc', ['reloadExpandContent', 'reloadRowExpand'])
8795
- }
8824
+ warnLog('vxe.error.delFunc', ['reloadExpandContent', 'reloadRowExpand'])
8796
8825
  // 即将废弃
8797
8826
  return this.reloadRowExpand(row)
8798
8827
  },
@@ -8935,9 +8964,7 @@ const Methods = {
8935
8964
  return !!rowExpandedFlag && !!rowExpandedMaps[rowid]
8936
8965
  },
8937
8966
  isExpandByRow (row: any) {
8938
- if (process.env.VUE_APP_VXE_ENV === 'development') {
8939
- warnLog('vxe.error.delFunc', ['isExpandByRow', 'isRowExpandByRow'])
8940
- }
8967
+ warnLog('vxe.error.delFunc', ['isExpandByRow', 'isRowExpandByRow'])
8941
8968
  // 即将废弃
8942
8969
  return this.isRowExpandByRow(row)
8943
8970
  },
@@ -9178,9 +9205,7 @@ const Methods = {
9178
9205
  reloadTreeChilds (row: any) {
9179
9206
  const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
9180
9207
 
9181
- if (process.env.VUE_APP_VXE_ENV === 'development') {
9182
- warnLog('vxe.error.delFunc', ['reloadTreeChilds', 'reloadTreeExpand'])
9183
- }
9208
+ warnLog('vxe.error.delFunc', ['reloadTreeChilds', 'reloadTreeExpand'])
9184
9209
  // 即将废弃
9185
9210
  return $xeTable.reloadTreeExpand(row)
9186
9211
  },
@@ -1800,14 +1800,12 @@ export default {
1800
1800
  initTpImg()
1801
1801
  }
1802
1802
 
1803
- if (process.env.VUE_APP_VXE_ENV === 'development') {
1804
- const { $listeners } = this
1805
- if (!this.menuConfig && ($listeners['menu-click'] || $listeners['cell-menu'] || $listeners['header-cell-menu'] || $listeners['footer-cell-menu'])) {
1806
- warnLog('vxe.error.reqProp', ['menu-config'])
1807
- }
1808
- if (!this.tooltipConfig && ($listeners['cell-mouseenter'] || $listeners['cell-mouseleave'])) {
1809
- warnLog('vxe.error.reqProp', ['tooltip-config'])
1810
- }
1803
+ const { $listeners } = this
1804
+ if (!this.menuConfig && ($listeners['menu-click'] || $listeners['cell-menu'] || $listeners['header-cell-menu'] || $listeners['footer-cell-menu'])) {
1805
+ warnLog('vxe.error.reqProp', ['menu-config'])
1806
+ }
1807
+ if (!this.tooltipConfig && ($listeners['cell-mouseenter'] || $listeners['cell-mouseleave'])) {
1808
+ warnLog('vxe.error.reqProp', ['tooltip-config'])
1811
1809
  }
1812
1810
 
1813
1811
  // 使用已安装的组件,如果未安装则不渲染
@@ -1050,6 +1050,20 @@ $btnThemeList: (
1050
1050
  }
1051
1051
  }
1052
1052
  }
1053
+ .vxe-header--column {
1054
+ &.col--ellipsis {
1055
+ &.col--center {
1056
+ .vxe-cell--wrapper {
1057
+ justify-content: center;
1058
+ }
1059
+ }
1060
+ &.col--right {
1061
+ .vxe-cell--wrapper {
1062
+ justify-content: right;
1063
+ }
1064
+ }
1065
+ }
1066
+ }
1053
1067
  .vxe-header--column,
1054
1068
  .vxe-footer--column {
1055
1069
  &.col--ellipsis {