vxe-table 3.7.0-beta.6 → 3.7.0-beta.7
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/README.md +4 -8
- package/lib/filter/src/mixin.js +13 -7
- package/lib/filter/src/mixin.min.js +1 -1
- package/lib/form/src/form.js +24 -4
- package/lib/form/src/form.min.js +1 -1
- package/lib/grid/src/grid.js +7 -3
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.umd.js +349 -89
- package/lib/index.umd.min.js +1 -1
- package/lib/input/src/input.js +6 -1
- package/lib/input/src/input.min.js +1 -1
- package/lib/locale/lang/en-US.js +7 -0
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +7 -0
- package/lib/locale/lang/es-ES.js +7 -0
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +7 -0
- package/lib/locale/lang/ja-JP.js +7 -0
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +7 -0
- package/lib/locale/lang/zh-CN.js +7 -0
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +7 -0
- package/lib/locale/lang/zh-HK.min.js +1 -1
- package/lib/locale/lang/zh-HK.umd.js +7 -0
- package/lib/locale/lang/zh-MO.min.js +1 -1
- package/lib/locale/lang/zh-MO.umd.js +7 -0
- package/lib/locale/lang/zh-TC.js +7 -0
- package/lib/locale/lang/zh-TC.min.js +1 -1
- package/lib/locale/lang/zh-TC.umd.js +7 -0
- package/lib/locale/lang/zh-TW.min.js +1 -1
- package/lib/locale/lang/zh-TW.umd.js +7 -0
- package/lib/menu/src/mixin.js +3 -3
- package/lib/menu/src/mixin.min.js +1 -1
- package/lib/select/src/select.js +6 -1
- package/lib/select/src/select.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/src/cell.js +2 -0
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/columnInfo.js +6 -6
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/methods.js +43 -16
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +11 -24
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +2 -2
- package/lib/table/style/style.min.css +1 -1
- package/lib/textarea/src/textarea.js +6 -1
- package/lib/textarea/src/textarea.min.js +1 -1
- package/lib/toolbar/src/toolbar.js +18 -6
- package/lib/toolbar/src/toolbar.min.js +1 -1
- package/lib/tools/log.js +1 -1
- package/lib/tools/log.min.js +1 -1
- package/lib/v-x-e-table/index.js +3 -1
- package/lib/v-x-e-table/index.min.js +1 -1
- package/lib/v-x-e-table/src/commands.js +58 -2
- package/lib/v-x-e-table/src/commands.min.js +1 -1
- package/lib/v-x-e-table/src/conf.js +4 -1
- package/lib/v-x-e-table/src/conf.min.js +1 -1
- package/lib/v-x-e-table/src/formats.js +58 -2
- package/lib/v-x-e-table/src/formats.min.js +1 -1
- package/lib/v-x-e-table/src/menus.js +58 -2
- package/lib/v-x-e-table/src/menus.min.js +1 -1
- package/lib/v-x-e-table/src/store.js +5 -2
- package/lib/v-x-e-table/src/store.min.js +1 -1
- package/lib/v-x-e-table/src/validators.js +15 -0
- package/lib/v-x-e-table/src/validators.min.js +1 -0
- package/lib/validator/src/mixin.js +26 -4
- package/lib/validator/src/mixin.min.js +1 -1
- package/package.json +2 -2
- package/packages/filter/src/mixin.js +5 -1
- package/packages/form/src/form.js +24 -5
- package/packages/grid/src/grid.js +7 -3
- package/packages/input/src/input.js +4 -1
- package/packages/locale/lang/en-US.js +7 -0
- package/packages/locale/lang/es-ES.js +7 -0
- package/packages/locale/lang/ja-JP.js +7 -0
- package/packages/locale/lang/zh-CN.js +7 -0
- package/packages/locale/lang/zh-TC.js +7 -0
- package/packages/menu/src/mixin.js +3 -3
- package/packages/select/src/select.js +4 -1
- package/packages/table/src/cell.js +2 -0
- package/packages/table/src/columnInfo.js +6 -6
- package/packages/table/src/methods.js +36 -15
- package/packages/table/src/table.js +5 -1
- package/packages/textarea/src/textarea.js +4 -1
- package/packages/toolbar/src/toolbar.js +18 -6
- package/packages/v-x-e-table/index.js +2 -0
- package/packages/v-x-e-table/src/commands.js +48 -2
- package/packages/v-x-e-table/src/conf.js +4 -1
- package/packages/v-x-e-table/src/formats.js +48 -2
- package/packages/v-x-e-table/src/menus.js +48 -2
- package/packages/v-x-e-table/src/store.js +4 -2
- package/packages/v-x-e-table/src/validators.js +7 -0
- package/packages/validator/src/mixin.js +25 -4
- package/styles/table.scss +2 -2
- package/types/form.d.ts +14 -12
- package/types/table.d.ts +4 -0
- package/types/v-x-e-table/commands.d.ts +21 -13
- package/types/v-x-e-table/formats.d.ts +19 -12
- package/types/v-x-e-table/index.d.ts +7 -1
- package/types/v-x-e-table/menus.d.ts +17 -6
- package/types/v-x-e-table/validators.d.ts +30 -0
- package/types/validator.d.ts +15 -4
- /package/lib/icon/style/{iconfont.1689639571797.ttf → iconfont.1690156580206.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1689639571797.woff → iconfont.1690156580206.woff} +0 -0
- /package/lib/icon/style/{iconfont.1689639571797.woff2 → iconfont.1690156580206.woff2} +0 -0
- /package/lib/{iconfont.1689639571797.ttf → iconfont.1690156580206.ttf} +0 -0
- /package/lib/{iconfont.1689639571797.woff → iconfont.1690156580206.woff} +0 -0
- /package/lib/{iconfont.1689639571797.woff2 → iconfont.1690156580206.woff2} +0 -0
|
@@ -249,10 +249,10 @@ export default {
|
|
|
249
249
|
ctxMenuLinkEvent (evnt, menu) {
|
|
250
250
|
// 如果一级菜单有配置 code 则允许点击,否则不能点击
|
|
251
251
|
if (!menu.disabled && (menu.code || !menu.children || !menu.children.length)) {
|
|
252
|
-
const
|
|
252
|
+
const gMenuOpts = VXETable.menus.get(menu.code)
|
|
253
253
|
const params = Object.assign({ menu, $grid: this.$xegrid, $table: this, $event: evnt }, this.ctxMenuStore.args)
|
|
254
|
-
if (
|
|
255
|
-
|
|
254
|
+
if (gMenuOpts && gMenuOpts.menuMethod) {
|
|
255
|
+
gMenuOpts.menuMethod(params, evnt)
|
|
256
256
|
}
|
|
257
257
|
// 在 v4 中废弃事件 context-menu-click
|
|
258
258
|
if (this.$listeners['context-menu-click']) {
|
|
@@ -241,7 +241,10 @@ export default {
|
|
|
241
241
|
props: {
|
|
242
242
|
value: null,
|
|
243
243
|
clearable: Boolean,
|
|
244
|
-
placeholder:
|
|
244
|
+
placeholder: {
|
|
245
|
+
type: String,
|
|
246
|
+
default: () => XEUtils.eqNull(GlobalConfig.select.placeholder) ? GlobalConfig.i18n('vxe.base.pleaseSelect') : GlobalConfig.select.placeholder
|
|
247
|
+
},
|
|
245
248
|
loading: Boolean,
|
|
246
249
|
disabled: Boolean,
|
|
247
250
|
multiple: Boolean,
|
|
@@ -639,6 +639,7 @@ export const Cell = {
|
|
|
639
639
|
},
|
|
640
640
|
on: {
|
|
641
641
|
click (evnt) {
|
|
642
|
+
evnt.stopPropagation()
|
|
642
643
|
$table.triggerSortEvent(evnt, column, 'asc')
|
|
643
644
|
}
|
|
644
645
|
}
|
|
@@ -652,6 +653,7 @@ export const Cell = {
|
|
|
652
653
|
},
|
|
653
654
|
on: {
|
|
654
655
|
click (evnt) {
|
|
656
|
+
evnt.stopPropagation()
|
|
655
657
|
$table.triggerSortEvent(evnt, column, 'desc')
|
|
656
658
|
}
|
|
657
659
|
}
|
|
@@ -40,14 +40,14 @@ export class ColumnInfo {
|
|
|
40
40
|
}
|
|
41
41
|
if (formatter) {
|
|
42
42
|
if (XEUtils.isString(formatter)) {
|
|
43
|
-
const
|
|
44
|
-
if (!XEUtils.isFunction(
|
|
45
|
-
errLog('vxe.error.
|
|
43
|
+
const gFormatOpts = formats.get(formatter) || XEUtils[formatter]
|
|
44
|
+
if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.formatMethod)) {
|
|
45
|
+
errLog('vxe.error.notFormats', [formatter])
|
|
46
46
|
}
|
|
47
47
|
} else if (XEUtils.isArray(formatter)) {
|
|
48
|
-
const
|
|
49
|
-
if (!XEUtils.isFunction(
|
|
50
|
-
errLog('vxe.error.
|
|
48
|
+
const gFormatOpts = formats.get(formatter[0]) || XEUtils[formatter[0]]
|
|
49
|
+
if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.formatMethod)) {
|
|
50
|
+
errLog('vxe.error.notFormats', [formatter[0]])
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -2049,6 +2049,7 @@ const Methods = {
|
|
|
2049
2049
|
},
|
|
2050
2050
|
updateHeight () {
|
|
2051
2051
|
this.customHeight = calcHeight(this, 'height')
|
|
2052
|
+
this.customMinHeight = calcHeight(this, 'minHeight')
|
|
2052
2053
|
this.customMaxHeight = calcHeight(this, 'maxHeight')
|
|
2053
2054
|
},
|
|
2054
2055
|
updateStyle () {
|
|
@@ -2058,6 +2059,7 @@ const Methods = {
|
|
|
2058
2059
|
fullColumnIdData,
|
|
2059
2060
|
tableColumn,
|
|
2060
2061
|
customHeight,
|
|
2062
|
+
customMinHeight,
|
|
2061
2063
|
customMaxHeight,
|
|
2062
2064
|
border,
|
|
2063
2065
|
headerHeight,
|
|
@@ -2170,15 +2172,22 @@ const Methods = {
|
|
|
2170
2172
|
} else if (layout === 'body') {
|
|
2171
2173
|
const emptyBlockElem = elemStore[`${name}-${layout}-emptyBlock`]
|
|
2172
2174
|
if (isNodeElement(wrapperElem)) {
|
|
2175
|
+
const bodyMinHeight = fixedType ? ((customMinHeight - headerHeight - footerHeight) - (showFooter ? 0 : scrollbarHeight)) : (customMinHeight - headerHeight - footerHeight)
|
|
2176
|
+
let bodyMaxHeight = 0
|
|
2173
2177
|
if (customMaxHeight) {
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2178
|
+
bodyMaxHeight = Math.max(bodyMinHeight, fixedType ? (customMaxHeight - headerHeight - (showFooter ? 0 : scrollbarHeight)) : (customMaxHeight - headerHeight - footerHeight))
|
|
2179
|
+
wrapperElem.style.maxHeight = `${bodyMaxHeight}px`
|
|
2180
|
+
}
|
|
2181
|
+
if (customHeight > 0) {
|
|
2182
|
+
let bodyHeight = fixedType ? ((customHeight > 0 ? customHeight - headerHeight - footerHeight : tableHeight) - (showFooter ? 0 : scrollbarHeight)) : (customHeight - headerHeight - footerHeight)
|
|
2183
|
+
if (bodyMaxHeight) {
|
|
2184
|
+
bodyHeight = Math.min(bodyMaxHeight, bodyHeight)
|
|
2180
2185
|
}
|
|
2186
|
+
wrapperElem.style.height = `${Math.max(bodyMinHeight, bodyHeight)}px`
|
|
2187
|
+
} else {
|
|
2188
|
+
wrapperElem.style.height = ''
|
|
2181
2189
|
}
|
|
2190
|
+
wrapperElem.style.minHeight = `${bodyMinHeight}px`
|
|
2182
2191
|
}
|
|
2183
2192
|
|
|
2184
2193
|
// 如果是固定列
|
|
@@ -3757,7 +3766,10 @@ const Methods = {
|
|
|
3757
3766
|
} else {
|
|
3758
3767
|
this.sort({ field, order })
|
|
3759
3768
|
}
|
|
3760
|
-
const params = { column, field, property: field, order: column.order, sortList: this.getSortColumns() }
|
|
3769
|
+
const params = { $table: this, $event: evnt, column, field, property: field, order: column.order, sortList: this.getSortColumns(), sortTime: column.sortTime }
|
|
3770
|
+
if (this.mouseConfig && this.mouseOpts.area && this.handleSortEvent) {
|
|
3771
|
+
return this.handleSortEvent(evnt, params)
|
|
3772
|
+
}
|
|
3761
3773
|
this.emitEvent('sort-change', params, evnt)
|
|
3762
3774
|
}
|
|
3763
3775
|
},
|
|
@@ -3972,7 +3984,16 @@ const Methods = {
|
|
|
3972
3984
|
* @param {Boolean} expanded 是否展开
|
|
3973
3985
|
*/
|
|
3974
3986
|
setAllRowExpand (expanded) {
|
|
3975
|
-
|
|
3987
|
+
const { treeConfig, treeOpts, tableFullData, tableFullTreeData } = this
|
|
3988
|
+
let expandedRows = []
|
|
3989
|
+
if (treeConfig) {
|
|
3990
|
+
XEUtils.eachTree(tableFullTreeData, (row) => {
|
|
3991
|
+
expandedRows.push(row)
|
|
3992
|
+
}, treeOpts)
|
|
3993
|
+
} else {
|
|
3994
|
+
expandedRows = tableFullData
|
|
3995
|
+
}
|
|
3996
|
+
return this.setRowExpand(expandedRows, expanded)
|
|
3976
3997
|
},
|
|
3977
3998
|
handleAsyncRowExpand (row) {
|
|
3978
3999
|
const rest = this.fullAllDataRowMap.get(row)
|
|
@@ -4671,12 +4692,12 @@ const Methods = {
|
|
|
4671
4692
|
* 如果组件值 v-model 发生 change 时,调用改函数用于更新某一列编辑状态
|
|
4672
4693
|
* 如果单元格配置了校验规则,则会进行校验
|
|
4673
4694
|
*/
|
|
4674
|
-
updateStatus (
|
|
4695
|
+
updateStatus (slotParams, cellValue) {
|
|
4675
4696
|
const customVal = !XEUtils.isUndefined(cellValue)
|
|
4676
4697
|
return this.$nextTick().then(() => {
|
|
4677
4698
|
const { $refs, editRules, validStore } = this
|
|
4678
|
-
if (
|
|
4679
|
-
const { row, column } =
|
|
4699
|
+
if (slotParams && $refs.tableBody && editRules) {
|
|
4700
|
+
const { row, column } = slotParams
|
|
4680
4701
|
const type = 'change'
|
|
4681
4702
|
if (this.hasCellRules(type, row, column)) {
|
|
4682
4703
|
const cell = this.getCell(row, column)
|
|
@@ -4843,11 +4864,11 @@ const Methods = {
|
|
|
4843
4864
|
}
|
|
4844
4865
|
const formatParams = { cellValue, row, rowIndex: this.getRowIndex(row), column, columnIndex: this.getColumnIndex(column) }
|
|
4845
4866
|
if (XEUtils.isString(formatter)) {
|
|
4846
|
-
const
|
|
4847
|
-
cellLabel =
|
|
4867
|
+
const gFormatOpts = formats.get(formatter)
|
|
4868
|
+
cellLabel = gFormatOpts && gFormatOpts.formatMethod ? gFormatOpts.formatMethod(formatParams) : ''
|
|
4848
4869
|
} else if (XEUtils.isArray(formatter)) {
|
|
4849
|
-
const
|
|
4850
|
-
cellLabel =
|
|
4870
|
+
const gFormatOpts = formats.get(formatter[0])
|
|
4871
|
+
cellLabel = gFormatOpts && gFormatOpts.formatMethod ? gFormatOpts.formatMethod(formatParams, ...formatter.slice(1)) : ''
|
|
4851
4872
|
} else {
|
|
4852
4873
|
cellLabel = formatter(formatParams)
|
|
4853
4874
|
}
|
|
@@ -96,6 +96,8 @@ export default {
|
|
|
96
96
|
data: Array,
|
|
97
97
|
// 表格的高度
|
|
98
98
|
height: [Number, String],
|
|
99
|
+
// 表格的最小高度
|
|
100
|
+
minHeight: { type: [Number, String], default: () => GlobalConfig.table.minHeight },
|
|
99
101
|
// 表格的最大高度
|
|
100
102
|
maxHeight: [Number, String],
|
|
101
103
|
// 已废弃,被 column-config.resizable 替换
|
|
@@ -1015,11 +1017,13 @@ export default {
|
|
|
1015
1017
|
hasTip,
|
|
1016
1018
|
columnOpts,
|
|
1017
1019
|
rowOpts,
|
|
1018
|
-
loadingOpts
|
|
1020
|
+
loadingOpts,
|
|
1021
|
+
editRules
|
|
1019
1022
|
} = this
|
|
1020
1023
|
const { leftList, rightList } = columnStore
|
|
1021
1024
|
return h('div', {
|
|
1022
1025
|
class: ['vxe-table', 'vxe-table--render-default', `tid_${tId}`, vSize ? `size--${vSize}` : '', `border--${tableBorder}`, {
|
|
1026
|
+
[`vaild-msg--${validOpts.msgMode}`]: !!editRules,
|
|
1023
1027
|
'vxe-editable': !!editConfig,
|
|
1024
1028
|
'cell--highlight': highlightCell,
|
|
1025
1029
|
'cell--selected': mouseConfig && mouseOpts.selected,
|
|
@@ -18,7 +18,10 @@ export default {
|
|
|
18
18
|
name: String,
|
|
19
19
|
readonly: Boolean,
|
|
20
20
|
disabled: Boolean,
|
|
21
|
-
placeholder:
|
|
21
|
+
placeholder: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: () => XEUtils.eqNull(GlobalConfig.textarea.placeholder) ? GlobalConfig.i18n('vxe.base.pleaseInput') : GlobalConfig.textarea.placeholder
|
|
24
|
+
},
|
|
22
25
|
maxlength: [String, Number],
|
|
23
26
|
rows: { type: [String, Number], default: 2 },
|
|
24
27
|
cols: { type: [String, Number], default: null },
|
|
@@ -649,10 +649,16 @@ export default {
|
|
|
649
649
|
if ($xegrid) {
|
|
650
650
|
$xegrid.triggerToolbarBtnEvent(item, evnt)
|
|
651
651
|
} else {
|
|
652
|
-
const
|
|
652
|
+
const gCommandOpts = VXETable.commands.get(code)
|
|
653
653
|
const params = { code, button: item, $table: $xetable, $grid: $xegrid, $event: evnt }
|
|
654
|
-
if (
|
|
655
|
-
commandMethod
|
|
654
|
+
if (gCommandOpts) {
|
|
655
|
+
if (gCommandOpts.commandMethod) {
|
|
656
|
+
gCommandOpts.commandMethod(params)
|
|
657
|
+
} else {
|
|
658
|
+
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
|
659
|
+
errLog('vxe.error.notCommands', [code])
|
|
660
|
+
}
|
|
661
|
+
}
|
|
656
662
|
}
|
|
657
663
|
this.$emit('button-click', params)
|
|
658
664
|
}
|
|
@@ -665,10 +671,16 @@ export default {
|
|
|
665
671
|
if ($xegrid) {
|
|
666
672
|
$xegrid.triggerToolbarTolEvent(item, evnt)
|
|
667
673
|
} else {
|
|
668
|
-
const
|
|
674
|
+
const gCommandOpts = VXETable.commands.get(code)
|
|
669
675
|
const params = { code, tool: item, $xegrid, $table: $xetable, $event: evnt }
|
|
670
|
-
if (
|
|
671
|
-
commandMethod
|
|
676
|
+
if (gCommandOpts) {
|
|
677
|
+
if (gCommandOpts.commandMethod) {
|
|
678
|
+
gCommandOpts.commandMethod(params)
|
|
679
|
+
} else {
|
|
680
|
+
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
|
681
|
+
errLog('vxe.error.notCommands', [code])
|
|
682
|
+
}
|
|
683
|
+
}
|
|
672
684
|
}
|
|
673
685
|
this.$emit('tool-click', params)
|
|
674
686
|
}
|
|
@@ -5,6 +5,7 @@ import { renderer } from './src/renderer'
|
|
|
5
5
|
import { commands } from './src/commands'
|
|
6
6
|
import { menus } from './src/menus'
|
|
7
7
|
import { formats } from './src/formats'
|
|
8
|
+
import { validators } from './src/validators'
|
|
8
9
|
import { setup } from './src/setup'
|
|
9
10
|
import { UtilTools } from '../tools/utils'
|
|
10
11
|
import { errLog } from '../tools/log'
|
|
@@ -98,6 +99,7 @@ export const VXETable = {
|
|
|
98
99
|
commands,
|
|
99
100
|
formats,
|
|
100
101
|
menus,
|
|
102
|
+
validators,
|
|
101
103
|
config,
|
|
102
104
|
t,
|
|
103
105
|
_t
|
|
@@ -1,6 +1,52 @@
|
|
|
1
|
-
import
|
|
1
|
+
import XEUtils from 'xe-utils'
|
|
2
|
+
import { warnLog } from '../../tools/log'
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
class VXECommandsStore {
|
|
5
|
+
constructor () {
|
|
6
|
+
this.store = {}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
mixin (options) {
|
|
10
|
+
XEUtils.each(options, (item, key) => {
|
|
11
|
+
this.add(key, item)
|
|
12
|
+
})
|
|
13
|
+
return VXECommandsStore
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
get (name) {
|
|
17
|
+
return this.store[name]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
add (name, render) {
|
|
21
|
+
const conf = this.store[name]
|
|
22
|
+
// 兼容
|
|
23
|
+
if (XEUtils.isFunction(render)) {
|
|
24
|
+
// warnLog('vxe.error.delProp', ['callback', 'commandMethod'])
|
|
25
|
+
render = {
|
|
26
|
+
commandMethod: render
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// 检测是否覆盖
|
|
31
|
+
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
|
32
|
+
const confKeys = XEUtils.keys(conf)
|
|
33
|
+
XEUtils.each(render, (item, key) => {
|
|
34
|
+
if (confKeys.includes(key)) {
|
|
35
|
+
warnLog('vxe.error.coverProp', [name, key])
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
this.store[name] = conf ? XEUtils.merge(conf, render) : render
|
|
40
|
+
return VXECommandsStore
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
delete (name) {
|
|
44
|
+
delete this.store[name]
|
|
45
|
+
return VXECommandsStore
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const commands = new VXECommandsStore()
|
|
4
50
|
|
|
5
51
|
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
|
6
52
|
Object.assign(commands, { _name: 'Commands' })
|
|
@@ -13,6 +13,7 @@ export default {
|
|
|
13
13
|
animat: true,
|
|
14
14
|
delayHover: 250,
|
|
15
15
|
autoResize: true,
|
|
16
|
+
minHeight: 144,
|
|
16
17
|
// keepSource: false,
|
|
17
18
|
// showOverflow: null,
|
|
18
19
|
// showHeaderOverflow: null,
|
|
@@ -46,7 +47,9 @@ export default {
|
|
|
46
47
|
},
|
|
47
48
|
validConfig: {
|
|
48
49
|
showMessage: true,
|
|
49
|
-
|
|
50
|
+
autoClear: true,
|
|
51
|
+
message: 'inline',
|
|
52
|
+
msgMode: 'single'
|
|
50
53
|
},
|
|
51
54
|
columnConfig: {
|
|
52
55
|
maxFixedSize: 4
|
|
@@ -1,6 +1,52 @@
|
|
|
1
|
-
import
|
|
1
|
+
import XEUtils from 'xe-utils'
|
|
2
|
+
import { warnLog } from '../../tools/log'
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
class VXEFormatsStore {
|
|
5
|
+
constructor () {
|
|
6
|
+
this.store = {}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
mixin (options) {
|
|
10
|
+
XEUtils.each(options, (item, key) => {
|
|
11
|
+
this.add(key, item)
|
|
12
|
+
})
|
|
13
|
+
return VXEFormatsStore
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
get (name) {
|
|
17
|
+
return this.store[name]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
add (name, render) {
|
|
21
|
+
const conf = this.store[name]
|
|
22
|
+
// 兼容
|
|
23
|
+
if (XEUtils.isFunction(render)) {
|
|
24
|
+
// warnLog('vxe.error.delProp', ['callback', 'formatMethod'])
|
|
25
|
+
render = {
|
|
26
|
+
formatMethod: render
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// 检测是否覆盖
|
|
31
|
+
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
|
32
|
+
const confKeys = XEUtils.keys(conf)
|
|
33
|
+
XEUtils.each(render, (item, key) => {
|
|
34
|
+
if (confKeys.includes(key)) {
|
|
35
|
+
warnLog('vxe.error.coverProp', [name, key])
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
this.store[name] = conf ? XEUtils.merge(conf, render) : render
|
|
40
|
+
return VXEFormatsStore
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
delete (name) {
|
|
44
|
+
delete this.store[name]
|
|
45
|
+
return VXEFormatsStore
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const formats = new VXEFormatsStore()
|
|
4
50
|
|
|
5
51
|
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
|
6
52
|
Object.assign(formats, { _name: 'Formats' })
|
|
@@ -1,6 +1,52 @@
|
|
|
1
|
-
import
|
|
1
|
+
import XEUtils from 'xe-utils'
|
|
2
|
+
import { warnLog } from '../../tools/log'
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
class VXEMenusStore {
|
|
5
|
+
constructor () {
|
|
6
|
+
this.store = {}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
mixin (options) {
|
|
10
|
+
XEUtils.each(options, (item, key) => {
|
|
11
|
+
this.add(key, item)
|
|
12
|
+
})
|
|
13
|
+
return VXEMenusStore
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
get (name) {
|
|
17
|
+
return this.store[name]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
add (name, render) {
|
|
21
|
+
const conf = this.store[name]
|
|
22
|
+
// 兼容
|
|
23
|
+
if (XEUtils.isFunction(render)) {
|
|
24
|
+
// warnLog('vxe.error.delProp', ['callback', 'menuMethod'])
|
|
25
|
+
render = {
|
|
26
|
+
menuMethod: render
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// 检测是否覆盖
|
|
31
|
+
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
|
32
|
+
const confKeys = XEUtils.keys(conf)
|
|
33
|
+
XEUtils.each(render, (item, key) => {
|
|
34
|
+
if (confKeys.includes(key)) {
|
|
35
|
+
warnLog('vxe.error.coverProp', [name, key])
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
this.store[name] = conf ? XEUtils.merge(conf, render) : render
|
|
40
|
+
return VXEMenusStore
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
delete (name) {
|
|
44
|
+
delete this.store[name]
|
|
45
|
+
return VXEMenusStore
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const menus = new VXEMenusStore()
|
|
4
50
|
|
|
5
51
|
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
|
6
52
|
Object.assign(menus, { _name: 'Menus' })
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import XEUtils from 'xe-utils'
|
|
2
|
+
import VXETable from '../../v-x-e-table'
|
|
2
3
|
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
3
4
|
import { eqEmptyValue, getFuncText } from '../../tools/utils'
|
|
5
|
+
import { warnLog, errLog } from '../../tools/log'
|
|
4
6
|
import DomTools from '../../tools/dom'
|
|
5
7
|
|
|
6
8
|
/**
|
|
@@ -248,10 +250,10 @@ export default {
|
|
|
248
250
|
if (rules) {
|
|
249
251
|
const cellValue = XEUtils.isUndefined(val) ? XEUtils.get(row, property) : val
|
|
250
252
|
rules.forEach(rule => {
|
|
251
|
-
const { type, trigger, required } = rule
|
|
253
|
+
const { type, trigger, required, validator } = rule
|
|
252
254
|
if (validType === 'all' || !trigger || validType === trigger) {
|
|
253
|
-
if (
|
|
254
|
-
const
|
|
255
|
+
if (validator) {
|
|
256
|
+
const validParams = {
|
|
255
257
|
cellValue,
|
|
256
258
|
rule,
|
|
257
259
|
rules,
|
|
@@ -261,7 +263,26 @@ export default {
|
|
|
261
263
|
columnIndex: this.getColumnIndex(column),
|
|
262
264
|
field: column.property,
|
|
263
265
|
$table: this
|
|
264
|
-
}
|
|
266
|
+
}
|
|
267
|
+
let customValid
|
|
268
|
+
if (XEUtils.isString(validator)) {
|
|
269
|
+
const gvItem = VXETable.validators.get(validator)
|
|
270
|
+
if (gvItem) {
|
|
271
|
+
if (gvItem.cellValidatorMethod) {
|
|
272
|
+
customValid = gvItem.cellValidatorMethod(validParams)
|
|
273
|
+
} else {
|
|
274
|
+
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
|
275
|
+
warnLog('vxe.error.notValidators', [validator])
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
} else {
|
|
279
|
+
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
|
280
|
+
errLog('vxe.error.notValidators', [validator])
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
} else {
|
|
284
|
+
customValid = validator(validParams)
|
|
285
|
+
}
|
|
265
286
|
if (customValid) {
|
|
266
287
|
if (XEUtils.isError(customValid)) {
|
|
267
288
|
this.validRuleErr = true
|
package/styles/table.scss
CHANGED
|
@@ -1230,8 +1230,8 @@
|
|
|
1230
1230
|
position: relative;
|
|
1231
1231
|
&:before {
|
|
1232
1232
|
content: "";
|
|
1233
|
-
top: $vxe-table-cell-dirty-width;
|
|
1234
|
-
left: $vxe-table-cell-dirty-width;
|
|
1233
|
+
top: calc($vxe-table-cell-dirty-width * -1);
|
|
1234
|
+
left: calc($vxe-table-cell-dirty-width * -1);
|
|
1235
1235
|
position: absolute;
|
|
1236
1236
|
border-width: $vxe-table-cell-dirty-width;
|
|
1237
1237
|
border-style: solid;
|
package/types/form.d.ts
CHANGED
|
@@ -83,18 +83,7 @@ export interface FormRule {
|
|
|
83
83
|
* 使用自定义校验函数,接收一个 Promise
|
|
84
84
|
* @param params 参数
|
|
85
85
|
*/
|
|
86
|
-
validator?(params:
|
|
87
|
-
$form: Form,
|
|
88
|
-
itemValue: any,
|
|
89
|
-
rule: FormRule;
|
|
90
|
-
rules: FormRule[];
|
|
91
|
-
data: any;
|
|
92
|
-
field: string
|
|
93
|
-
/**
|
|
94
|
-
* @deprecated
|
|
95
|
-
*/
|
|
96
|
-
property: string
|
|
97
|
-
}): void | Error | Promise<any>
|
|
86
|
+
validator?(params: FormRuleValidatorParams): void | Error | Promise<any>
|
|
98
87
|
/**
|
|
99
88
|
* 提示消息
|
|
100
89
|
*/
|
|
@@ -103,6 +92,19 @@ export interface FormRule {
|
|
|
103
92
|
maxWidth?: number;
|
|
104
93
|
}
|
|
105
94
|
|
|
95
|
+
export interface FormRuleValidatorParams {
|
|
96
|
+
$form: Form,
|
|
97
|
+
itemValue: any,
|
|
98
|
+
rule: FormRule;
|
|
99
|
+
rules: FormRule[];
|
|
100
|
+
data: any;
|
|
101
|
+
field: string
|
|
102
|
+
/**
|
|
103
|
+
* @deprecated
|
|
104
|
+
*/
|
|
105
|
+
property: string
|
|
106
|
+
}
|
|
107
|
+
|
|
106
108
|
/**
|
|
107
109
|
* 校验规则配置项
|
|
108
110
|
*/
|
package/types/table.d.ts
CHANGED
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
import { ToolbarButtonConfig } from '../toolbar'
|
|
2
|
-
import {
|
|
2
|
+
import { Table } from '../table'
|
|
3
3
|
|
|
4
4
|
/* eslint-disable no-use-before-define */
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
export namespace VxeGlobalCommandsHandles {
|
|
7
|
+
export interface CommandsOptions {
|
|
8
|
+
commandMethod?: (params: CommandMethodParams, ...args: any[]) => void
|
|
9
|
+
}
|
|
10
|
+
export interface CommandMethodParams {
|
|
11
|
+
$table: Table;
|
|
12
|
+
code: string;
|
|
13
|
+
button?: ToolbarButtonConfig;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
7
16
|
|
|
8
17
|
/**
|
|
9
|
-
*
|
|
18
|
+
* 全局格式化
|
|
10
19
|
*/
|
|
11
|
-
export
|
|
12
|
-
mixin(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
button?: ToolbarButtonConfig;
|
|
20
|
+
export interface VxeGlobalCommands {
|
|
21
|
+
mixin(opts: {
|
|
22
|
+
[name: string]: VxeGlobalCommandsHandles.CommandsOptions | ((params: VxeGlobalCommandsHandles.CommandMethodParams, ...args: any[]) => void)
|
|
23
|
+
}): VxeGlobalCommands
|
|
24
|
+
has(name: string): boolean
|
|
25
|
+
get(name: string): VxeGlobalCommandsHandles.CommandsOptions
|
|
26
|
+
add(name: string, options: VxeGlobalCommandsHandles.CommandsOptions | ((params: VxeGlobalCommandsHandles.CommandMethodParams, ...args: any[]) => void)): VxeGlobalCommands
|
|
27
|
+
delete(name: string): void
|
|
28
|
+
forEach(callback: (options: VxeGlobalCommandsHandles.CommandsOptions, name: string) => void): void
|
|
21
29
|
}
|