vxe-table 4.1.21 → 4.2.0-beta.0
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.en.md +1 -1
- package/README.md +2 -1
- package/README.zh-TW.md +1 -1
- package/es/edit/src/hook.js +2 -1
- package/es/export/src/hook.js +2 -1
- package/es/export/src/util.js +3 -5
- package/es/footer/src/footer.js +3 -2
- package/es/form/src/form-gather.js +1 -1
- package/es/form/src/form.js +2 -1
- package/es/grid/src/grid.js +2 -1
- package/es/header/src/header.js +1 -1
- package/es/modal/src/modal.js +2 -1
- package/es/table/src/body.js +24 -24
- package/es/table/src/columnInfo.js +4 -4
- package/es/table/src/props.js +5 -2
- package/es/table/src/table.js +18 -7
- package/es/table/src/util.js +5 -3
- package/es/toolbar/src/toolbar.js +2 -1
- package/es/tools/log.js +13 -0
- package/es/tools/utils.js +0 -12
- package/es/v-x-e-table/index.js +1 -0
- package/es/v-x-e-table/src/conf.js +3 -1
- package/es/v-x-e-table/src/interceptor.js +1 -1
- package/es/v-x-e-table/src/renderer.js +2 -1
- package/es/v-x-e-table/src/store.js +1 -1
- package/lib/edit/src/hook.js +7 -5
- package/lib/edit/src/hook.min.js +1 -1
- package/lib/export/src/hook.js +14 -12
- package/lib/export/src/hook.min.js +1 -1
- package/lib/export/src/util.js +7 -9
- package/lib/export/src/util.min.js +1 -1
- package/lib/footer/src/footer.js +7 -3
- package/lib/footer/src/footer.min.js +1 -1
- package/lib/form/src/form-gather.js +2 -2
- package/lib/form/src/form-gather.min.js +1 -1
- package/lib/form/src/form.js +4 -2
- package/lib/form/src/form.min.js +1 -1
- package/lib/grid/src/grid.js +16 -14
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/header/src/header.js +1 -1
- package/lib/header/src/header.min.js +1 -1
- package/lib/index.umd.js +991 -100
- package/lib/index.umd.min.js +1 -2
- package/lib/modal/src/modal.js +3 -1
- package/lib/modal/src/modal.min.js +1 -1
- package/lib/table/src/body.js +24 -25
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/columnInfo.js +12 -9
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/props.js +5 -2
- package/lib/table/src/table.js +76 -64
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +5 -3
- package/lib/table/src/util.min.js +1 -1
- package/lib/toolbar/src/toolbar.js +4 -2
- package/lib/toolbar/src/toolbar.min.js +1 -1
- package/lib/tools/log.js +29 -0
- package/lib/tools/log.min.js +1 -0
- package/lib/tools/utils.js +0 -20
- package/lib/tools/utils.min.js +1 -1
- package/lib/v-x-e-table/index.js +1 -0
- package/lib/v-x-e-table/index.min.js +1 -1
- package/lib/v-x-e-table/src/conf.js +3 -1
- package/lib/v-x-e-table/src/interceptor.js +3 -3
- package/lib/v-x-e-table/src/interceptor.min.js +1 -1
- package/lib/v-x-e-table/src/renderer.js +3 -1
- package/lib/v-x-e-table/src/renderer.min.js +1 -1
- package/lib/v-x-e-table/src/store.js +2 -2
- package/lib/v-x-e-table/src/store.min.js +1 -1
- package/package.json +2 -2
- package/packages/edit/src/hook.ts +2 -1
- package/packages/export/src/hook.ts +2 -1
- package/packages/export/src/util.ts +4 -6
- package/packages/footer/src/footer.ts +3 -2
- package/packages/form/src/form-gather.ts +1 -1
- package/packages/form/src/form.ts +2 -1
- package/packages/grid/src/grid.ts +2 -1
- package/packages/header/src/header.ts +1 -1
- package/packages/modal/src/modal.ts +2 -1
- package/packages/table/src/body.ts +24 -23
- package/packages/table/src/columnInfo.ts +4 -3
- package/packages/table/src/props.ts +5 -2
- package/packages/table/src/table.ts +16 -5
- package/packages/table/src/util.ts +5 -3
- package/packages/toolbar/src/toolbar.ts +2 -1
- package/packages/tools/log.ts +16 -0
- package/packages/tools/utils.ts +0 -15
- package/packages/v-x-e-table/index.ts +1 -0
- package/packages/v-x-e-table/src/conf.ts +3 -1
- package/packages/v-x-e-table/src/interceptor.ts +1 -1
- package/packages/v-x-e-table/src/renderer.ts +2 -1
- package/packages/v-x-e-table/src/store.ts +1 -1
- package/types/table.d.ts +35 -0
- package/types/v-x-e-table/index.d.ts +8 -0
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
height: [Number, String] as PropType<VxeTablePropTypes.Height>,
|
|
13
13
|
// 表格的最大高度
|
|
14
14
|
maxHeight: [Number, String] as PropType<VxeTablePropTypes.MaxHeight>,
|
|
15
|
-
//
|
|
15
|
+
// (即将废弃)所有列是否允许拖动列宽调整大小
|
|
16
16
|
resizable: { type: Boolean as PropType<VxeTablePropTypes.Resizable>, default: () => GlobalConfig.table.resizable },
|
|
17
17
|
// 是否带有斑马纹
|
|
18
18
|
stripe: { type: Boolean as PropType<VxeTablePropTypes.Stripe>, default: () => GlobalConfig.table.stripe },
|
|
@@ -88,9 +88,11 @@ export default {
|
|
|
88
88
|
showFooterOverflow: { type: [Boolean, String] as PropType<VxeTablePropTypes.ShowFooterOverflow>, default: () => GlobalConfig.table.showFooterOverflow },
|
|
89
89
|
|
|
90
90
|
/** 高级属性 */
|
|
91
|
-
//
|
|
91
|
+
// (即将废弃)columnKey 已废弃,被 column-config.useKey 替换
|
|
92
92
|
columnKey: Boolean as PropType<VxeTablePropTypes.ColumnKey>,
|
|
93
|
+
// (即将废弃)rowKey 已废弃,被 row-config.useKey 替换
|
|
93
94
|
rowKey: Boolean as PropType<VxeTablePropTypes.RowKey>,
|
|
95
|
+
// (即将废弃)rowId 已废弃,被 row-config.keyField 替换
|
|
94
96
|
rowId: { type: String as PropType<VxeTablePropTypes.RowId>, default: () => GlobalConfig.table.rowId },
|
|
95
97
|
zIndex: Number as PropType<VxeTablePropTypes.ZIndex>,
|
|
96
98
|
emptyText: { type: String as PropType<VxeTablePropTypes.EmptyText>, default: () => GlobalConfig.table.emptyText },
|
|
@@ -155,6 +157,7 @@ export default {
|
|
|
155
157
|
scrollY: Object as PropType<VxeTablePropTypes.ScrollY>,
|
|
156
158
|
// (即将废弃)优化相关
|
|
157
159
|
animat: { type: Boolean as PropType<VxeTablePropTypes.Animat>, default: () => GlobalConfig.table.animat },
|
|
160
|
+
// (可能会被废弃的参数,不要使用)
|
|
158
161
|
delayHover: { type: Number as PropType<VxeTablePropTypes.DelayHover>, default: () => GlobalConfig.table.delayHover as number },
|
|
159
162
|
// 额外的参数
|
|
160
163
|
params: Object as PropType<VxeTablePropTypes.Params>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { defineComponent, getCurrentInstance, h, createCommentVNode, ComponentPublicInstance, resolveComponent, ComponentOptions, reactive, ref, Ref, provide, inject, nextTick, onActivated, onDeactivated, onBeforeUnmount, onUnmounted, watch, computed, ComputedRef, onMounted } from 'vue'
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import { browse, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft, isNodeElement } from '../../tools/dom'
|
|
4
|
-
import {
|
|
4
|
+
import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../tools/utils'
|
|
5
|
+
import { warnLog, errLog, getLog } from '../../tools/log'
|
|
5
6
|
import { createResizeEvent, XEResizeObserver } from '../../tools/resize'
|
|
6
7
|
import { GlobalEvent, hasEventKey, EVENT_KEYS } from '../../tools/event'
|
|
7
8
|
import { useSize } from '../../hooks/size'
|
|
@@ -5718,16 +5719,26 @@ export default defineComponent({
|
|
|
5718
5719
|
const radioOpts = computeRadioOpts.value
|
|
5719
5720
|
const checkboxOpts = computeCheckboxOpts.value
|
|
5720
5721
|
const expandOpts = computeExpandOpts.value
|
|
5722
|
+
const rowOpts = computeRowOpts.value
|
|
5721
5723
|
|
|
5722
5724
|
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
|
5723
|
-
if (
|
|
5724
|
-
|
|
5725
|
+
// if (props.rowId) {
|
|
5726
|
+
// warnLog('vxe.error.delProp', ['rowId', 'row-config.keyField'])
|
|
5727
|
+
// }
|
|
5728
|
+
// if (props.rowKey) {
|
|
5729
|
+
// warnLog('vxe.error.delProp', ['rowId', 'row-config.useKey'])
|
|
5730
|
+
// }
|
|
5731
|
+
// if (props.columnKey) {
|
|
5732
|
+
// warnLog('vxe.error.delProp', ['rowId', 'column-config.useKey'])
|
|
5733
|
+
// }
|
|
5734
|
+
if (!(props.rowId || rowOpts.keyField) && (checkboxOpts.reserve || checkboxOpts.checkRowKeys || radioOpts.reserve || radioOpts.checkRowKey || expandOpts.expandRowKeys || treeOpts.expandRowKeys)) {
|
|
5735
|
+
warnLog('vxe.error.reqProp', ['row-config.keyField'])
|
|
5725
5736
|
}
|
|
5726
5737
|
if (props.editConfig && (editOpts.showStatus || editOpts.showUpdateStatus || editOpts.showInsertStatus) && !props.keepSource) {
|
|
5727
5738
|
warnLog('vxe.error.reqProp', ['keep-source'])
|
|
5728
5739
|
}
|
|
5729
|
-
if (treeConfig && treeOpts.line && (!props.rowKey || !showOverflow)) {
|
|
5730
|
-
warnLog('vxe.error.reqProp', ['row-
|
|
5740
|
+
if (treeConfig && treeOpts.line && (!props.rowKey || !rowOpts.useKey || !showOverflow)) {
|
|
5741
|
+
warnLog('vxe.error.reqProp', ['row-config.useKey | show-overflow'])
|
|
5731
5742
|
}
|
|
5732
5743
|
if (treeConfig && props.stripe) {
|
|
5733
5744
|
warnLog('vxe.error.noTree', ['stripe'])
|
|
@@ -44,14 +44,16 @@ export function getRowUniqueId () {
|
|
|
44
44
|
// 行主键 key
|
|
45
45
|
export function getRowkey ($xetable: VxeTableConstructor) {
|
|
46
46
|
const { props } = $xetable
|
|
47
|
+
const { computeRowOpts } = $xetable.getComputeMaps()
|
|
47
48
|
const { rowId } = props
|
|
48
|
-
|
|
49
|
+
const rowOpts = computeRowOpts.value
|
|
50
|
+
return rowId || rowOpts.keyField || '_X_ID'
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
// 行主键 value
|
|
52
54
|
export function getRowid ($xetable: VxeTableConstructor, row: any) {
|
|
53
|
-
const
|
|
54
|
-
return XEUtils.eqNull(
|
|
55
|
+
const rowid = XEUtils.get(row, getRowkey($xetable))
|
|
56
|
+
return XEUtils.eqNull(rowid) ? '' : encodeURIComponent(rowid)
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
export interface XEColumnInstance {
|
|
@@ -4,7 +4,8 @@ import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
|
4
4
|
import { VXETable } from '../../v-x-e-table'
|
|
5
5
|
import { useSize } from '../../hooks/size'
|
|
6
6
|
import { getEventTargetNode } from '../../tools/dom'
|
|
7
|
-
import {
|
|
7
|
+
import { formatText } from '../../tools/utils'
|
|
8
|
+
import { warnLog, errLog } from '../../tools/log'
|
|
8
9
|
import { GlobalEvent } from '../../tools/event'
|
|
9
10
|
|
|
10
11
|
import { VxeGridConstructor, GridPrivateMethods, ToolbarMethods, VxeToolbarConstructor, VxeToolbarEmits, VxeToolbarPropTypes, VxeTableConstructor, ToolbarPrivateRef, VxeTableMethods, VxeTablePrivateMethods, ToolbarReactData, VxeTableDefines } from '../../../types/all'
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import GlobalConfig from '../v-x-e-table/src/conf'
|
|
2
|
+
|
|
3
|
+
export function getLog (message: string, params?: any) {
|
|
4
|
+
return `[vxe-table v${process.env.VUE_APP_VXE_TABLE_VERSION}] ${GlobalConfig.i18n(message, params)}`
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function outLog (type: 'log' | 'warn' | 'error') {
|
|
8
|
+
return function (message: string, params?: any) {
|
|
9
|
+
const msg = getLog(message, params)
|
|
10
|
+
console[type](msg)
|
|
11
|
+
return msg
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const warnLog = outLog('warn')
|
|
16
|
+
export const errLog = outLog('error')
|
package/packages/tools/utils.ts
CHANGED
|
@@ -4,18 +4,6 @@ import GlobalConfig from '../v-x-e-table/src/conf'
|
|
|
4
4
|
let zindexIndex = 0
|
|
5
5
|
let lastZindex = 1
|
|
6
6
|
|
|
7
|
-
export function getLog (message: string, params?: any) {
|
|
8
|
-
return `[vxe-table] ${GlobalConfig.i18n(message, params)}`
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function outLog (type: 'log' | 'warn' | 'error') {
|
|
12
|
-
return function (message: string, params?: any) {
|
|
13
|
-
const msg = getLog(message, params)
|
|
14
|
-
console[type](msg)
|
|
15
|
-
return msg
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
7
|
export function isEnableConf (conf: any): boolean {
|
|
20
8
|
return conf && conf.enabled !== false
|
|
21
9
|
}
|
|
@@ -41,9 +29,6 @@ export function getLastZIndex () {
|
|
|
41
29
|
return lastZindex
|
|
42
30
|
}
|
|
43
31
|
|
|
44
|
-
export const warnLog = outLog('warn')
|
|
45
|
-
export const errLog = outLog('error')
|
|
46
|
-
|
|
47
32
|
export function hasChildrenList (item: any) {
|
|
48
33
|
return item && item.children && item.children.length > 0
|
|
49
34
|
}
|
|
@@ -28,6 +28,9 @@ const GlobalConfig: VXETableGlobalConfig = {
|
|
|
28
28
|
// emptyRender: {
|
|
29
29
|
// name: ''
|
|
30
30
|
// },
|
|
31
|
+
// rowConfig: {
|
|
32
|
+
// keyField: '_X_ID' // 行数据的唯一主键字段名
|
|
33
|
+
// },
|
|
31
34
|
radioConfig: {
|
|
32
35
|
// trigger: 'default'
|
|
33
36
|
strict: true
|
|
@@ -51,7 +54,6 @@ const GlobalConfig: VXETableGlobalConfig = {
|
|
|
51
54
|
// storage: false,
|
|
52
55
|
// checkMethod () {}
|
|
53
56
|
// },
|
|
54
|
-
// rowId: '_X_ID', // 行数据的唯一主键字段名
|
|
55
57
|
sortConfig: {
|
|
56
58
|
// remote: false,
|
|
57
59
|
// trigger: 'default',
|
|
@@ -2,7 +2,8 @@ import { h, resolveComponent, ComponentOptions } from 'vue'
|
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import GlobalConfig from './conf'
|
|
4
4
|
import { getCellValue, setCellValue } from '../../table/src/util'
|
|
5
|
-
import {
|
|
5
|
+
import { getFuncText, formatText, isEmptyValue } from '../../tools/utils'
|
|
6
|
+
import { warnLog } from '../../tools/log'
|
|
6
7
|
import { getOnName } from '../../tools/vn'
|
|
7
8
|
|
|
8
9
|
import { VxeGlobalRendererHandles, VxeGlobalRenderer, VxeColumnPropTypes } from '../../../types/all'
|
package/types/table.d.ts
CHANGED
|
@@ -1223,6 +1223,7 @@ export namespace VxeTablePropTypes {
|
|
|
1223
1223
|
* 列配置信息
|
|
1224
1224
|
*/
|
|
1225
1225
|
export interface ColumnConfig {
|
|
1226
|
+
useKey?: boolean;
|
|
1226
1227
|
isCurrent?: boolean;
|
|
1227
1228
|
isHover?: boolean;
|
|
1228
1229
|
resizable?: VxeColumnPropTypes.Resizable;
|
|
@@ -1235,6 +1236,8 @@ export namespace VxeTablePropTypes {
|
|
|
1235
1236
|
* 行配置信息
|
|
1236
1237
|
*/
|
|
1237
1238
|
export interface RowConfig {
|
|
1239
|
+
useKey?: boolean;
|
|
1240
|
+
keyField?: string;
|
|
1238
1241
|
isCurrent?: boolean;
|
|
1239
1242
|
isHover?: boolean;
|
|
1240
1243
|
height?: number;
|
|
@@ -1939,6 +1942,10 @@ export type VxeTableProps<D = any> = {
|
|
|
1939
1942
|
data?: VxeTablePropTypes.Data<D>;
|
|
1940
1943
|
height?: VxeTablePropTypes.Height;
|
|
1941
1944
|
maxHeight?: VxeTablePropTypes.MaxHeight;
|
|
1945
|
+
/**
|
|
1946
|
+
* 不建议使用,后续废弃
|
|
1947
|
+
* @deprecated
|
|
1948
|
+
*/
|
|
1942
1949
|
resizable?: VxeTablePropTypes.Resizable;
|
|
1943
1950
|
stripe?: VxeTablePropTypes.Stripe;
|
|
1944
1951
|
round?: VxeTablePropTypes.Round;
|
|
@@ -1952,6 +1959,10 @@ export type VxeTableProps<D = any> = {
|
|
|
1952
1959
|
highlightHoverRow?: VxeTablePropTypes.HighlightHoverRow;
|
|
1953
1960
|
highlightCurrentColumn?: VxeTablePropTypes.HighlightCurrentColumn;
|
|
1954
1961
|
highlightHoverColumn?: VxeTablePropTypes.HighlightHoverColumn;
|
|
1962
|
+
/**
|
|
1963
|
+
* 已废弃
|
|
1964
|
+
* @deprecated
|
|
1965
|
+
*/
|
|
1955
1966
|
highlightCell?: VxeTablePropTypes.HighlightCell;
|
|
1956
1967
|
showFooter?: VxeTablePropTypes.ShowFooter;
|
|
1957
1968
|
footerMethod?: VxeTablePropTypes.FooterMethod;
|
|
@@ -1974,8 +1985,20 @@ export type VxeTableProps<D = any> = {
|
|
|
1974
1985
|
showOverflow?: VxeTablePropTypes.ShowOverflow;
|
|
1975
1986
|
showHeaderOverflow?: VxeTablePropTypes.ShowHeaderOverflow;
|
|
1976
1987
|
showFooterOverflow?: VxeTablePropTypes.ShowFooterOverflow;
|
|
1988
|
+
/**
|
|
1989
|
+
* 请使用 column-config.useKey
|
|
1990
|
+
* @deprecated
|
|
1991
|
+
*/
|
|
1977
1992
|
columnKey?: VxeTablePropTypes.ColumnKey;
|
|
1993
|
+
/**
|
|
1994
|
+
* 请使用 row-config.useKey
|
|
1995
|
+
* @deprecated
|
|
1996
|
+
*/
|
|
1978
1997
|
rowKey?: VxeTablePropTypes.RowKey;
|
|
1998
|
+
/**
|
|
1999
|
+
* 请使用 row-config.keyField
|
|
2000
|
+
* @deprecated
|
|
2001
|
+
*/
|
|
1979
2002
|
rowId?: VxeTablePropTypes.RowId;
|
|
1980
2003
|
keepSource?: VxeTablePropTypes.KeepSource;
|
|
1981
2004
|
autoResize?: VxeTablePropTypes.AutoResize;
|
|
@@ -2006,8 +2029,20 @@ export type VxeTableProps<D = any> = {
|
|
|
2006
2029
|
editRules?: VxeTablePropTypes.EditRules;
|
|
2007
2030
|
emptyText?: VxeTablePropTypes.EmptyText;
|
|
2008
2031
|
emptyRender?: VxeTablePropTypes.EmptyRender;
|
|
2032
|
+
/**
|
|
2033
|
+
* 不建议使用,后续废弃
|
|
2034
|
+
* @deprecated
|
|
2035
|
+
*/
|
|
2009
2036
|
fit?: VxeTablePropTypes.Fit;
|
|
2037
|
+
/**
|
|
2038
|
+
* 不建议使用,后续废弃
|
|
2039
|
+
* @deprecated
|
|
2040
|
+
*/
|
|
2010
2041
|
animat?: VxeTablePropTypes.Animat;
|
|
2042
|
+
/**
|
|
2043
|
+
* 不建议使用,后续废弃
|
|
2044
|
+
* @deprecated
|
|
2045
|
+
*/
|
|
2011
2046
|
delayHover?: VxeTablePropTypes.DelayHover;
|
|
2012
2047
|
scrollX?: VxeTablePropTypes.ScrollX;
|
|
2013
2048
|
scrollY?: VxeTablePropTypes.ScrollY;
|