vxe-table 3.15.29 → 3.15.31
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 +39 -42
- package/es/style.css +1 -1
- package/es/table/module/edit/mixin.js +11 -27
- package/es/table/module/export/mixin.js +75 -143
- package/es/table/module/menu/mixin.js +2 -6
- package/es/table/module/validator/mixin.js +99 -41
- package/es/table/src/methods.js +12 -36
- package/es/table/src/table.js +6 -8
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +24 -26
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +271 -572
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/edit/mixin.js +11 -27
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/export/mixin.js +101 -184
- package/lib/table/module/export/mixin.min.js +1 -1
- package/lib/table/module/menu/mixin.js +2 -6
- package/lib/table/module/menu/mixin.min.js +1 -1
- package/lib/table/module/validator/mixin.js +97 -40
- package/lib/table/module/validator/mixin.min.js +1 -1
- package/lib/table/src/methods.js +12 -36
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +8 -10
- package/lib/table/src/table.min.js +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +1 -1
- package/packages/grid/src/grid.ts +39 -41
- package/packages/table/module/edit/mixin.ts +11 -27
- package/packages/table/module/export/mixin.ts +105 -162
- package/packages/table/module/menu/mixin.ts +2 -6
- package/packages/table/module/validator/mixin.ts +101 -40
- package/packages/table/src/methods.ts +12 -36
- package/packages/table/src/table.ts +6 -8
- /package/es/{iconfont.1747286367921.ttf → iconfont.1747621179042.ttf} +0 -0
- /package/es/{iconfont.1747286367921.woff → iconfont.1747621179042.woff} +0 -0
- /package/es/{iconfont.1747286367921.woff2 → iconfont.1747621179042.woff2} +0 -0
- /package/lib/{iconfont.1747286367921.ttf → iconfont.1747621179042.ttf} +0 -0
- /package/lib/{iconfont.1747286367921.woff → iconfont.1747621179042.woff} +0 -0
- /package/lib/{iconfont.1747286367921.woff2 → iconfont.1747621179042.woff2} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import XEUtils from 'xe-utils'
|
|
2
2
|
import { VxeUI } from '../../../ui'
|
|
3
|
-
import { getFuncText
|
|
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
|
-
|
|
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
|
|
48
|
-
|
|
49
|
-
if (
|
|
50
|
-
return
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
|
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 (
|
|
74
|
-
|
|
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 (
|
|
85
|
-
|
|
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 {
|
|
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
|
-
|
|
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
|
-
|
|
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
|
}
|
|
@@ -3127,7 +3127,6 @@ function parseColumns ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, i
|
|
|
3127
3127
|
// }
|
|
3128
3128
|
// }
|
|
3129
3129
|
// }
|
|
3130
|
-
// if (process.env.VUE_APP_VXE_ENV === 'development') {
|
|
3131
3130
|
// if (props.showHeader && !props.showHeaderOverflow) {
|
|
3132
3131
|
// warnLog('vxe.error.reqProp', ['show-header-overflow'])
|
|
3133
3132
|
// }
|
|
@@ -3140,7 +3139,6 @@ function parseColumns ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, i
|
|
|
3140
3139
|
if (props.footerSpanMethod) {
|
|
3141
3140
|
warnLog('vxe.error.scrollErrProp', ['footer-span-method'])
|
|
3142
3141
|
}
|
|
3143
|
-
// }
|
|
3144
3142
|
if (isReset) {
|
|
3145
3143
|
const { visibleSize } = handleVirtualXVisible($xeTable)
|
|
3146
3144
|
scrollXStore.startIndex = 0
|
|
@@ -3838,9 +3836,7 @@ const Methods = {
|
|
|
3838
3836
|
}
|
|
3839
3837
|
this.tableData = tableData.slice(0)
|
|
3840
3838
|
} else {
|
|
3841
|
-
|
|
3842
|
-
warnLog('vxe.error.reqProp', ['keep-source'])
|
|
3843
|
-
}
|
|
3839
|
+
errLog('vxe.error.reqProp', ['keep-source'])
|
|
3844
3840
|
}
|
|
3845
3841
|
return this.$nextTick()
|
|
3846
3842
|
},
|
|
@@ -4084,16 +4080,12 @@ const Methods = {
|
|
|
4084
4080
|
getVMRowIndex: createGetRowCacheProp('$index') as ((row: any) => number),
|
|
4085
4081
|
// 在 v3 中废弃
|
|
4086
4082
|
_getRowIndex (row: any) {
|
|
4087
|
-
|
|
4088
|
-
warnLog('vxe.error.delFunc', ['_getRowIndex', 'getVTRowIndex'])
|
|
4089
|
-
}
|
|
4083
|
+
warnLog('vxe.error.delFunc', ['_getRowIndex', 'getVTRowIndex'])
|
|
4090
4084
|
return this.getVTRowIndex(row)
|
|
4091
4085
|
},
|
|
4092
4086
|
// 在 v3 中废弃
|
|
4093
4087
|
$getRowIndex (row: any) {
|
|
4094
|
-
|
|
4095
|
-
warnLog('vxe.error.delFunc', ['$getRowIndex', 'getVMRowIndex'])
|
|
4096
|
-
}
|
|
4088
|
+
warnLog('vxe.error.delFunc', ['$getRowIndex', 'getVMRowIndex'])
|
|
4097
4089
|
return this.getVMRowIndex(row)
|
|
4098
4090
|
},
|
|
4099
4091
|
/**
|
|
@@ -4113,16 +4105,12 @@ const Methods = {
|
|
|
4113
4105
|
getVMColumnIndex: createGetColumnCacheProp('$index'),
|
|
4114
4106
|
// 在 v3 中废弃
|
|
4115
4107
|
_getColumnIndex (column: any) {
|
|
4116
|
-
|
|
4117
|
-
warnLog('vxe.error.delFunc', ['_getColumnIndex', 'getVTColumnIndex'])
|
|
4118
|
-
}
|
|
4108
|
+
warnLog('vxe.error.delFunc', ['_getColumnIndex', 'getVTColumnIndex'])
|
|
4119
4109
|
return this.getVTColumnIndex(column)
|
|
4120
4110
|
},
|
|
4121
4111
|
// 在 v3 中废弃
|
|
4122
4112
|
$getColumnIndex (column: any) {
|
|
4123
|
-
|
|
4124
|
-
warnLog('vxe.error.delFunc', ['$getColumnIndex', 'getVMColumnIndex'])
|
|
4125
|
-
}
|
|
4113
|
+
warnLog('vxe.error.delFunc', ['$getColumnIndex', 'getVMColumnIndex'])
|
|
4126
4114
|
return this.getVMColumnIndex(column)
|
|
4127
4115
|
},
|
|
4128
4116
|
/**
|
|
@@ -4228,9 +4216,7 @@ const Methods = {
|
|
|
4228
4216
|
const { transform } = treeOpts
|
|
4229
4217
|
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
4230
4218
|
if (!keepSource) {
|
|
4231
|
-
|
|
4232
|
-
errLog('vxe.error.reqProp', ['keep-source'])
|
|
4233
|
-
}
|
|
4219
|
+
errLog('vxe.error.reqProp', ['keep-source'])
|
|
4234
4220
|
return $xeTable.$nextTick()
|
|
4235
4221
|
}
|
|
4236
4222
|
let targetRows = rows
|
|
@@ -5820,10 +5806,8 @@ const Methods = {
|
|
|
5820
5806
|
// 兼容老版本
|
|
5821
5807
|
if (!evntList.length && type === 'event.clearEdit') {
|
|
5822
5808
|
evntList = interceptor.get('event.clearActived')
|
|
5823
|
-
if (
|
|
5824
|
-
|
|
5825
|
-
warnLog('vxe.error.delEvent', ['event.clearActived', 'event.clearEdit'])
|
|
5826
|
-
}
|
|
5809
|
+
if (evntList.length) {
|
|
5810
|
+
warnLog('vxe.error.delEvent', ['event.clearActived', 'event.clearEdit'])
|
|
5827
5811
|
}
|
|
5828
5812
|
}
|
|
5829
5813
|
// 兼容老版本
|
|
@@ -8669,9 +8653,7 @@ const Methods = {
|
|
|
8669
8653
|
},
|
|
8670
8654
|
// 在 v3 中废弃
|
|
8671
8655
|
getSortColumn () {
|
|
8672
|
-
|
|
8673
|
-
warnLog('vxe.error.delFunc', ['getSortColumn', 'getSortColumns'])
|
|
8674
|
-
}
|
|
8656
|
+
warnLog('vxe.error.delFunc', ['getSortColumn', 'getSortColumns'])
|
|
8675
8657
|
return XEUtils.find(this.tableFullColumn, column => (column.sortable || column.remoteSort) && column.order)
|
|
8676
8658
|
},
|
|
8677
8659
|
isSort (fieldOrColumn: any) {
|
|
@@ -8839,9 +8821,7 @@ const Methods = {
|
|
|
8839
8821
|
return $xeTable.$nextTick()
|
|
8840
8822
|
},
|
|
8841
8823
|
reloadExpandContent (row: any) {
|
|
8842
|
-
|
|
8843
|
-
warnLog('vxe.error.delFunc', ['reloadExpandContent', 'reloadRowExpand'])
|
|
8844
|
-
}
|
|
8824
|
+
warnLog('vxe.error.delFunc', ['reloadExpandContent', 'reloadRowExpand'])
|
|
8845
8825
|
// 即将废弃
|
|
8846
8826
|
return this.reloadRowExpand(row)
|
|
8847
8827
|
},
|
|
@@ -8984,9 +8964,7 @@ const Methods = {
|
|
|
8984
8964
|
return !!rowExpandedFlag && !!rowExpandedMaps[rowid]
|
|
8985
8965
|
},
|
|
8986
8966
|
isExpandByRow (row: any) {
|
|
8987
|
-
|
|
8988
|
-
warnLog('vxe.error.delFunc', ['isExpandByRow', 'isRowExpandByRow'])
|
|
8989
|
-
}
|
|
8967
|
+
warnLog('vxe.error.delFunc', ['isExpandByRow', 'isRowExpandByRow'])
|
|
8990
8968
|
// 即将废弃
|
|
8991
8969
|
return this.isRowExpandByRow(row)
|
|
8992
8970
|
},
|
|
@@ -9227,9 +9205,7 @@ const Methods = {
|
|
|
9227
9205
|
reloadTreeChilds (row: any) {
|
|
9228
9206
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
9229
9207
|
|
|
9230
|
-
|
|
9231
|
-
warnLog('vxe.error.delFunc', ['reloadTreeChilds', 'reloadTreeExpand'])
|
|
9232
|
-
}
|
|
9208
|
+
warnLog('vxe.error.delFunc', ['reloadTreeChilds', 'reloadTreeExpand'])
|
|
9233
9209
|
// 即将废弃
|
|
9234
9210
|
return $xeTable.reloadTreeExpand(row)
|
|
9235
9211
|
},
|
|
@@ -1800,14 +1800,12 @@ export default {
|
|
|
1800
1800
|
initTpImg()
|
|
1801
1801
|
}
|
|
1802
1802
|
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
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
|
// 使用已安装的组件,如果未安装则不渲染
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|