vxe-table 4.8.7 → 4.8.9
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/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/src/body.js +4 -8
- package/es/table/src/cell.js +7 -3
- package/es/table/src/footer.js +2 -4
- package/es/table/src/table.js +191 -72
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +204 -85
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/src/body.js +4 -8
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +10 -3
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/footer.js +2 -4
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/table.js +188 -70
- 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 +2 -2
- package/packages/table/src/body.ts +4 -8
- package/packages/table/src/cell.ts +9 -5
- package/packages/table/src/footer.ts +2 -4
- package/packages/table/src/table.ts +189 -70
- /package/es/{iconfont.1731032736115.ttf → iconfont.1731144197614.ttf} +0 -0
- /package/es/{iconfont.1731032736115.woff → iconfont.1731144197614.woff} +0 -0
- /package/es/{iconfont.1731032736115.woff2 → iconfont.1731144197614.woff2} +0 -0
- /package/lib/{iconfont.1731032736115.ttf → iconfont.1731144197614.ttf} +0 -0
- /package/lib/{iconfont.1731032736115.woff → iconfont.1731144197614.woff} +0 -0
- /package/lib/{iconfont.1731032736115.woff2 → iconfont.1731144197614.woff2} +0 -0
package/lib/ui/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.VXETable=void 0,Object.defineProperty(exports,"VxeUI",{enumerable:!0,get:function(){return _core.VxeUI}}),exports.version=exports.validators=exports.use=exports.t=exports.setup=exports.setTheme=exports.setLanguage=exports.setIcon=exports.setI18n=exports.setConfig=exports.saveFile=exports.renderer=exports.readFile=exports.print=exports.modal=exports.menus=exports.log=exports.interceptor=exports.hooks=exports.globalResize=exports.globalEvents=exports.getTheme=exports.getIcon=exports.getI18n=exports.getConfig=exports.formats=exports.default=exports.config=exports.commands=exports.clipboard=exports._t=void 0;var _core=require("@vxe-ui/core"),_utils=require("./src/utils");const version=exports.version="4.8.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.VXETable=void 0,Object.defineProperty(exports,"VxeUI",{enumerable:!0,get:function(){return _core.VxeUI}}),exports.version=exports.validators=exports.use=exports.t=exports.setup=exports.setTheme=exports.setLanguage=exports.setIcon=exports.setI18n=exports.setConfig=exports.saveFile=exports.renderer=exports.readFile=exports.print=exports.modal=exports.menus=exports.log=exports.interceptor=exports.hooks=exports.globalResize=exports.globalEvents=exports.getTheme=exports.getIcon=exports.getI18n=exports.getConfig=exports.formats=exports.default=exports.config=exports.commands=exports.clipboard=exports._t=void 0;var _core=require("@vxe-ui/core"),_utils=require("./src/utils");const version=exports.version="4.8.9",iconPrefix=(_core.VxeUI.version=version,_core.VxeUI.tableVersion=version,_core.VxeUI.setConfig({emptyCell:" ",table:{fit:!0,showHeader:!0,animat:!0,delayHover:250,autoResize:!0,padding:!0,minHeight:144,resizeConfig:{refreshDelay:250},radioConfig:{strict:!0},dragConfig:{showRowIcon:!0},checkboxConfig:{strict:!0},tooltipConfig:{enterable:!0},validConfig:{showMessage:!0,autoClear:!0,autoPos:!0,message:"inline",msgMode:"single",theme:"normal"},columnConfig:{maxFixedSize:4},customConfig:{allowVisible:!0,allowResizable:!0,allowFixed:!0,allowSort:!0,showFooter:!0,placement:"top-right",modalOptions:{showMaximize:!0,mask:!0,lockView:!0,resize:!0,escClosable:!0}},sortConfig:{showIcon:!0,iconLayout:"vertical"},filterConfig:{showIcon:!0},treeConfig:{rowField:"id",parentField:"parentId",childrenField:"children",hasChildField:"hasChild",mapChildrenField:"_X_ROW_CHILD",indent:20,showIcon:!0},expandConfig:{showIcon:!0},editConfig:{showIcon:!0,showAsterisk:!0,autoFocus:!0},importConfig:{_typeMaps:{csv:1,html:1,xml:1,txt:1}},exportConfig:{_typeMaps:{csv:1,html:1,xml:1,txt:1}},printConfig:{},mouseConfig:{extension:!0},keyboardConfig:{isEsc:!0},areaConfig:{autoClear:!0,selectCellByHeader:!0},clipConfig:{isCopy:!0,isCut:!0,isPaste:!0},fnrConfig:{isFind:!0,isReplace:!0},scrollX:{gt:60},scrollY:{gt:100}},grid:{formConfig:{enabled:!0},pagerConfig:{enabled:!0},toolbarConfig:{enabled:!0},proxyConfig:{enabled:!0,autoLoad:!0,showResponseMsg:!0,showActiveMsg:!0,props:{list:null,result:"result",total:"page.total",message:"message"}}},toolbar:{}}),"vxe-table-icon-"),setTheme=(_core.VxeUI.setIcon({TABLE_SORT_ASC:iconPrefix+"caret-up",TABLE_SORT_DESC:iconPrefix+"caret-down",TABLE_FILTER_NONE:iconPrefix+"funnel",TABLE_FILTER_MATCH:iconPrefix+"funnel",TABLE_EDIT:iconPrefix+"edit",TABLE_TITLE_PREFIX:iconPrefix+"question-circle-fill",TABLE_TITLE_SUFFIX:iconPrefix+"question-circle-fill",TABLE_TREE_LOADED:iconPrefix+"spinner roll",TABLE_TREE_OPEN:iconPrefix+"caret-right rotate90",TABLE_TREE_CLOSE:iconPrefix+"caret-right",TABLE_EXPAND_LOADED:iconPrefix+"spinner roll",TABLE_EXPAND_OPEN:iconPrefix+"arrow-right rotate90",TABLE_EXPAND_CLOSE:iconPrefix+"arrow-right",TABLE_CHECKBOX_CHECKED:iconPrefix+"checkbox-checked-fill",TABLE_CHECKBOX_UNCHECKED:iconPrefix+"checkbox-unchecked",TABLE_CHECKBOX_INDETERMINATE:iconPrefix+"checkbox-indeterminate-fill",TABLE_RADIO_CHECKED:iconPrefix+"radio-checked-fill",TABLE_RADIO_UNCHECKED:iconPrefix+"radio-unchecked",TABLE_CUSTOM_SORT:iconPrefix+"drag-handle",TABLE_MENU_OPTIONS:iconPrefix+"arrow-right",TABLE_DRAG_ROW:iconPrefix+"drag-handle",TOOLBAR_TOOLS_REFRESH:iconPrefix+"repeat",TOOLBAR_TOOLS_REFRESH_LOADING:iconPrefix+"repeat roll",TOOLBAR_TOOLS_IMPORT:iconPrefix+"upload",TOOLBAR_TOOLS_EXPORT:iconPrefix+"download",TOOLBAR_TOOLS_PRINT:iconPrefix+"print",TOOLBAR_TOOLS_FULLSCREEN:iconPrefix+"fullscreen",TOOLBAR_TOOLS_MINIMIZE:iconPrefix+"minimize",TOOLBAR_TOOLS_CUSTOM:iconPrefix+"custom-column",TOOLBAR_TOOLS_FIXED_LEFT:iconPrefix+"fixed-left",TOOLBAR_TOOLS_FIXED_LEFT_ACTIVE:iconPrefix+"fixed-left-fill",TOOLBAR_TOOLS_FIXED_RIGHT:iconPrefix+"fixed-right",TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVE:iconPrefix+"fixed-right-fill"}),exports.setTheme=_core.VxeUI.setTheme),getTheme=exports.getTheme=_core.VxeUI.getTheme,setConfig=exports.setConfig=_core.VxeUI.setConfig,getConfig=exports.getConfig=_core.VxeUI.getConfig,setIcon=exports.setIcon=_core.VxeUI.setIcon,getIcon=exports.getIcon=_core.VxeUI.getIcon,setLanguage=exports.setLanguage=_core.VxeUI.setLanguage,setI18n=exports.setI18n=_core.VxeUI.setI18n,getI18n=exports.getI18n=_core.VxeUI.getI18n,globalEvents=exports.globalEvents=_core.VxeUI.globalEvents,globalResize=exports.globalResize=_core.VxeUI.globalResize,renderer=exports.renderer=_core.VxeUI.renderer,validators=exports.validators=_core.VxeUI.validators,menus=exports.menus=_core.VxeUI.menus,formats=exports.formats=_core.VxeUI.formats,commands=exports.commands=_core.VxeUI.commands,interceptor=exports.interceptor=_core.VxeUI.interceptor,clipboard=exports.clipboard=_core.VxeUI.clipboard,log=exports.log=_core.VxeUI.log,hooks=exports.hooks=_core.VxeUI.hooks,use=exports.use=_core.VxeUI.use,setup=e=>_core.VxeUI.setConfig(e),config=(exports.setup=setup,_core.VxeUI.setup=setup,e=>_core.VxeUI.setConfig(e)),t=(exports.config=config,_core.VxeUI.config=config,(e,o)=>_core.VxeUI.getI18n(e,o)),_t=(exports.t=t,_core.VxeUI.t=t,(e,o)=>(0,_utils.getFuncText)(e,o)),VXETable=(exports._t=_t,_core.VxeUI._t=_t,exports.VXETable=_core.VxeUI),saveFile=e=>_core.VxeUI.saveFile(e),readFile=(exports.saveFile=saveFile,e=>_core.VxeUI.readFile(e)),print=(exports.readFile=readFile,e=>_core.VxeUI.print(e)),modal=(exports.print=print,exports.modal={get(e){return _core.VxeUI.modal.get(e)},close(e){return _core.VxeUI.modal.close(e)},open(e){return _core.VxeUI.modal.open(e)},alert(e,o,r){return _core.VxeUI.modal.alert(e,o,r)},confirm(e,o,r){return _core.VxeUI.modal.confirm(e,o,r)},message(e,o){return _core.VxeUI.modal.message(e,o)},notification(e,o,r){return _core.VxeUI.modal.notification(e,o,r)}});var _default=exports.default=_core.VxeUI;
|
package/lib/ui/src/log.js
CHANGED
|
@@ -8,6 +8,6 @@ var _core = require("@vxe-ui/core");
|
|
|
8
8
|
const {
|
|
9
9
|
log
|
|
10
10
|
} = _core.VxeUI;
|
|
11
|
-
const version = `table v${"4.8.
|
|
11
|
+
const version = `table v${"4.8.9"}`;
|
|
12
12
|
const warnLog = exports.warnLog = log.create('warn', version);
|
|
13
13
|
const errLog = exports.errLog = log.create('error', version);
|
package/lib/ui/src/log.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.warnLog=exports.errLog=void 0;var _core=require("@vxe-ui/core");const log=_core.VxeUI["log"],version="table v4.8.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.warnLog=exports.errLog=void 0;var _core=require("@vxe-ui/core");const log=_core.VxeUI["log"],version="table v4.8.9",warnLog=exports.warnLog=log.create("warn",version),errLog=exports.errLog=log.create("error",version);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vxe-table",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.9",
|
|
4
4
|
"description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟树、列拖拽,懒加载、快捷菜单、数据校验、树形结构、打印、导入导出、自定义模板、渲染器、JSON 配置式...",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"update": "npm install --legacy-peer-deps",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"style": "lib/style.css",
|
|
29
29
|
"typings": "types/index.d.ts",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"vxe-pc-ui": "^4.2.
|
|
31
|
+
"vxe-pc-ui": "^4.2.49"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/resize-observer-browser": "^0.1.11",
|
|
@@ -548,11 +548,9 @@ export default defineComponent({
|
|
|
548
548
|
setScrollTop(leftElem, scrollTop)
|
|
549
549
|
setScrollTop(rightElem, scrollTop)
|
|
550
550
|
}
|
|
551
|
-
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
|
|
551
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
552
552
|
type: renderType,
|
|
553
|
-
fixed: fixedType
|
|
554
|
-
scrollTop,
|
|
555
|
-
scrollLeft
|
|
553
|
+
fixed: fixedType
|
|
556
554
|
})
|
|
557
555
|
}
|
|
558
556
|
if (xHandleEl) {
|
|
@@ -562,11 +560,9 @@ export default defineComponent({
|
|
|
562
560
|
tableInternalData.lastScrollLeft = scrollLeft
|
|
563
561
|
setScrollLeft(headerElem, scrollLeft)
|
|
564
562
|
setScrollLeft(footerElem, scrollLeft)
|
|
565
|
-
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
|
|
563
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
566
564
|
type: renderType,
|
|
567
|
-
fixed: fixedType
|
|
568
|
-
scrollTop,
|
|
569
|
-
scrollLeft
|
|
565
|
+
fixed: fixedType
|
|
570
566
|
})
|
|
571
567
|
}
|
|
572
568
|
}
|
|
@@ -71,17 +71,21 @@ function renderCellDragIcon (params: VxeTableDefines.CellRenderBodyParams) {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
function renderCellBaseVNs (params: VxeTableDefines.CellRenderBodyParams, content: VxeComponentSlotType | VxeComponentSlotType[]) {
|
|
74
|
-
const { $table, column } = params
|
|
74
|
+
const { $table, column, level } = params
|
|
75
75
|
const { dragSort } = column
|
|
76
|
-
const
|
|
76
|
+
const tableProps = $table.props
|
|
77
|
+
const { treeConfig } = tableProps
|
|
77
78
|
const { computeRowOpts, computeDragOpts } = $table.getComputeMaps()
|
|
78
79
|
const rowOpts = computeRowOpts.value
|
|
79
80
|
const dragOpts = computeDragOpts.value
|
|
80
81
|
const { showRowIcon, rowVisibleMethod } = dragOpts
|
|
82
|
+
const vns: VxeComponentSlotType[] = XEUtils.isArray(content) ? content : [content]
|
|
81
83
|
if (dragSort && rowOpts.drag && (showRowIcon && (!rowVisibleMethod || rowVisibleMethod(params)))) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
if (!treeConfig || !level) {
|
|
85
|
+
vns.unshift(
|
|
86
|
+
renderCellDragIcon(params)
|
|
87
|
+
)
|
|
88
|
+
}
|
|
85
89
|
}
|
|
86
90
|
return vns
|
|
87
91
|
}
|
|
@@ -80,11 +80,9 @@ export default defineComponent({
|
|
|
80
80
|
tableReactData.lastScrollTime = Date.now()
|
|
81
81
|
setScrollLeft(headerElem, scrollLeft)
|
|
82
82
|
setScrollLeft(bodyElem, scrollLeft)
|
|
83
|
-
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
|
|
83
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
84
84
|
type: renderType,
|
|
85
|
-
fixed: fixedType
|
|
86
|
-
scrollTop,
|
|
87
|
-
scrollLeft
|
|
85
|
+
fixed: fixedType
|
|
88
86
|
})
|
|
89
87
|
}
|
|
90
88
|
}
|
|
@@ -2955,11 +2955,9 @@ export default defineComponent({
|
|
|
2955
2955
|
reactData.lastScrollTime = Date.now()
|
|
2956
2956
|
handleSyncScrollX(scrollLeft)
|
|
2957
2957
|
$xeTable.triggerScrollXEvent(evnt)
|
|
2958
|
-
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
|
|
2958
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
2959
2959
|
type: 'table',
|
|
2960
|
-
fixed: ''
|
|
2961
|
-
scrollTop,
|
|
2962
|
-
scrollLeft
|
|
2960
|
+
fixed: ''
|
|
2963
2961
|
})
|
|
2964
2962
|
}
|
|
2965
2963
|
|
|
@@ -2988,11 +2986,9 @@ export default defineComponent({
|
|
|
2988
2986
|
reactData.lastScrollTime = Date.now()
|
|
2989
2987
|
handleSyncScrollY(scrollTop)
|
|
2990
2988
|
$xeTable.triggerScrollYEvent(evnt)
|
|
2991
|
-
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
|
|
2989
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
2992
2990
|
type: 'table',
|
|
2993
|
-
fixed: ''
|
|
2994
|
-
scrollTop,
|
|
2995
|
-
scrollLeft
|
|
2991
|
+
fixed: ''
|
|
2996
2992
|
})
|
|
2997
2993
|
}
|
|
2998
2994
|
|
|
@@ -3642,25 +3638,35 @@ export default defineComponent({
|
|
|
3642
3638
|
* 设置为固定列
|
|
3643
3639
|
*/
|
|
3644
3640
|
setColumnFixed (fieldOrColumn, fixed) {
|
|
3645
|
-
|
|
3646
|
-
const
|
|
3647
|
-
const isMaxFixedColumn = computeIsMaxFixedColumn.value
|
|
3641
|
+
let status = false
|
|
3642
|
+
const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn]
|
|
3648
3643
|
const columnOpts = computeColumnOpts.value
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3644
|
+
const isMaxFixedColumn = computeIsMaxFixedColumn.value
|
|
3645
|
+
for (let i = 0; i < cols.length; i++) {
|
|
3646
|
+
const item = cols[i]
|
|
3647
|
+
const column = handleFieldOrColumn($xeTable, item)
|
|
3648
|
+
const targetColumn = getRootColumn($xeTable, column as any)
|
|
3649
|
+
if (targetColumn && targetColumn.fixed !== fixed) {
|
|
3650
|
+
// 是否超过最大固定列数量
|
|
3651
|
+
if (!targetColumn.fixed && isMaxFixedColumn) {
|
|
3652
|
+
if (VxeUI.modal) {
|
|
3653
|
+
VxeUI.modal.message({
|
|
3654
|
+
status: 'error',
|
|
3655
|
+
content: getI18n('vxe.table.maxFixedCol', [columnOpts.maxFixedSize])
|
|
3656
|
+
})
|
|
3657
|
+
}
|
|
3658
|
+
return nextTick()
|
|
3659
|
+
}
|
|
3660
|
+
XEUtils.eachTree([targetColumn], (column) => {
|
|
3661
|
+
column.fixed = fixed
|
|
3662
|
+
})
|
|
3663
|
+
tablePrivateMethods.saveCustomStore('update:fixed')
|
|
3664
|
+
if (!status) {
|
|
3665
|
+
status = true
|
|
3657
3666
|
}
|
|
3658
|
-
return nextTick()
|
|
3659
3667
|
}
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
})
|
|
3663
|
-
tablePrivateMethods.saveCustomStore('update:fixed')
|
|
3668
|
+
}
|
|
3669
|
+
if (status) {
|
|
3664
3670
|
return tableMethods.refreshColumn()
|
|
3665
3671
|
}
|
|
3666
3672
|
return nextTick()
|
|
@@ -3669,13 +3675,22 @@ export default defineComponent({
|
|
|
3669
3675
|
* 取消指定固定列
|
|
3670
3676
|
*/
|
|
3671
3677
|
clearColumnFixed (fieldOrColumn) {
|
|
3672
|
-
|
|
3673
|
-
const
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3678
|
+
let status = false
|
|
3679
|
+
const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn]
|
|
3680
|
+
cols.forEach(item => {
|
|
3681
|
+
const column = handleFieldOrColumn($xeTable, item)
|
|
3682
|
+
const targetColumn = getRootColumn($xeTable, column as any)
|
|
3683
|
+
if (targetColumn && targetColumn.fixed) {
|
|
3684
|
+
XEUtils.eachTree([targetColumn], (column) => {
|
|
3685
|
+
column.fixed = null
|
|
3686
|
+
})
|
|
3687
|
+
tablePrivateMethods.saveCustomStore('update:fixed')
|
|
3688
|
+
if (!status) {
|
|
3689
|
+
status = true
|
|
3690
|
+
}
|
|
3691
|
+
}
|
|
3692
|
+
})
|
|
3693
|
+
if (status) {
|
|
3679
3694
|
return tableMethods.refreshColumn()
|
|
3680
3695
|
}
|
|
3681
3696
|
return nextTick()
|
|
@@ -3684,9 +3699,18 @@ export default defineComponent({
|
|
|
3684
3699
|
* 隐藏指定列
|
|
3685
3700
|
*/
|
|
3686
3701
|
hideColumn (fieldOrColumn) {
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3702
|
+
let status = false
|
|
3703
|
+
const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn]
|
|
3704
|
+
cols.forEach(item => {
|
|
3705
|
+
const column = handleFieldOrColumn($xeTable, item)
|
|
3706
|
+
if (column && column.visible) {
|
|
3707
|
+
column.visible = false
|
|
3708
|
+
if (!status) {
|
|
3709
|
+
status = true
|
|
3710
|
+
}
|
|
3711
|
+
}
|
|
3712
|
+
})
|
|
3713
|
+
if (status) {
|
|
3690
3714
|
return tablePrivateMethods.handleCustom()
|
|
3691
3715
|
}
|
|
3692
3716
|
return nextTick()
|
|
@@ -3695,25 +3719,43 @@ export default defineComponent({
|
|
|
3695
3719
|
* 显示指定列
|
|
3696
3720
|
*/
|
|
3697
3721
|
showColumn (fieldOrColumn) {
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3722
|
+
let status = false
|
|
3723
|
+
const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn]
|
|
3724
|
+
cols.forEach(item => {
|
|
3725
|
+
const column = handleFieldOrColumn($xeTable, item)
|
|
3726
|
+
if (column && !column.visible) {
|
|
3727
|
+
column.visible = true
|
|
3728
|
+
if (!status) {
|
|
3729
|
+
status = true
|
|
3730
|
+
}
|
|
3731
|
+
}
|
|
3732
|
+
})
|
|
3733
|
+
if (status) {
|
|
3701
3734
|
return tablePrivateMethods.handleCustom()
|
|
3702
3735
|
}
|
|
3703
3736
|
return nextTick()
|
|
3704
3737
|
},
|
|
3705
3738
|
setColumnWidth (fieldOrColumn, width) {
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
if (
|
|
3711
|
-
const
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3739
|
+
let status = false
|
|
3740
|
+
const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn]
|
|
3741
|
+
cols.forEach(item => {
|
|
3742
|
+
const column = handleFieldOrColumn($xeTable, item)
|
|
3743
|
+
if (column) {
|
|
3744
|
+
const colWidth = XEUtils.toInteger(width)
|
|
3745
|
+
let rdWidth = colWidth
|
|
3746
|
+
if (isScale(width)) {
|
|
3747
|
+
const tableBody = refTableBody.value
|
|
3748
|
+
const bodyElem = tableBody ? tableBody.$el as HTMLDivElement : null
|
|
3749
|
+
const bodyWidth = bodyElem ? bodyElem.clientWidth - 1 : 0
|
|
3750
|
+
rdWidth = Math.floor(colWidth * bodyWidth)
|
|
3751
|
+
}
|
|
3752
|
+
column.resizeWidth = rdWidth
|
|
3753
|
+
if (!status) {
|
|
3754
|
+
status = true
|
|
3755
|
+
}
|
|
3756
|
+
}
|
|
3757
|
+
})
|
|
3758
|
+
if (status) {
|
|
3717
3759
|
return tableMethods.refreshColumn()
|
|
3718
3760
|
}
|
|
3719
3761
|
return nextTick()
|
|
@@ -4668,16 +4710,34 @@ export default defineComponent({
|
|
|
4668
4710
|
*/
|
|
4669
4711
|
scrollTo (scrollLeft: number, scrollTop?: number) {
|
|
4670
4712
|
const tableBody = refTableBody.value
|
|
4713
|
+
const tableHeader = refTableHeader.value
|
|
4671
4714
|
const tableFooter = refTableFooter.value
|
|
4715
|
+
const leftBody = refTableLeftBody.value
|
|
4672
4716
|
const rightBody = refTableRightBody.value
|
|
4673
4717
|
const tableBodyElem = tableBody ? tableBody.$el as HTMLDivElement : null
|
|
4718
|
+
const leftBodyElem = leftBody ? leftBody.$el as HTMLDivElement : null
|
|
4674
4719
|
const rightBodyElem = rightBody ? rightBody.$el as HTMLDivElement : null
|
|
4720
|
+
const tableHeaderElem = tableHeader ? tableHeader.$el as HTMLDivElement : null
|
|
4675
4721
|
const tableFooterElem = tableFooter ? tableFooter.$el as HTMLDivElement : null
|
|
4676
4722
|
if (XEUtils.isNumber(scrollLeft)) {
|
|
4677
|
-
|
|
4723
|
+
const xHandleEl = refScrollXHandleElem.value
|
|
4724
|
+
if (xHandleEl) {
|
|
4725
|
+
setScrollLeft(xHandleEl, scrollLeft)
|
|
4726
|
+
} else {
|
|
4727
|
+
setScrollLeft(tableBodyElem, scrollLeft)
|
|
4728
|
+
setScrollLeft(tableHeaderElem, scrollLeft)
|
|
4729
|
+
setScrollLeft(tableFooterElem, scrollLeft)
|
|
4730
|
+
}
|
|
4678
4731
|
}
|
|
4679
4732
|
if (XEUtils.isNumber(scrollTop)) {
|
|
4680
|
-
|
|
4733
|
+
const yHandleEl = refScrollYHandleElem.value
|
|
4734
|
+
if (yHandleEl) {
|
|
4735
|
+
setScrollTop(yHandleEl, scrollTop)
|
|
4736
|
+
} else {
|
|
4737
|
+
setScrollTop(tableBodyElem, scrollTop)
|
|
4738
|
+
setScrollTop(leftBodyElem, scrollTop)
|
|
4739
|
+
setScrollTop(rightBodyElem, scrollTop)
|
|
4740
|
+
}
|
|
4681
4741
|
}
|
|
4682
4742
|
if (reactData.scrollXLoad || reactData.scrollYLoad) {
|
|
4683
4743
|
return new Promise(resolve => {
|
|
@@ -5531,6 +5591,17 @@ export default defineComponent({
|
|
|
5531
5591
|
}
|
|
5532
5592
|
}
|
|
5533
5593
|
|
|
5594
|
+
const updateRowDropOrigin = (row: any) => {
|
|
5595
|
+
const el = refElem.value
|
|
5596
|
+
if (el) {
|
|
5597
|
+
const clss = 'row--drag-origin'
|
|
5598
|
+
const rowid = getRowid($xeTable, row)
|
|
5599
|
+
XEUtils.arrayEach(el.querySelectorAll(`[rowid="${rowid}"]`), (elem) => {
|
|
5600
|
+
addClass(elem, clss)
|
|
5601
|
+
})
|
|
5602
|
+
}
|
|
5603
|
+
}
|
|
5604
|
+
|
|
5534
5605
|
const clearRowDropTarget = () => {
|
|
5535
5606
|
const el = refElem.value
|
|
5536
5607
|
if (el) {
|
|
@@ -5541,6 +5612,18 @@ export default defineComponent({
|
|
|
5541
5612
|
}
|
|
5542
5613
|
}
|
|
5543
5614
|
|
|
5615
|
+
const updateRowDropTarget = (row: any, dragPos: string) => {
|
|
5616
|
+
const el = refElem.value
|
|
5617
|
+
if (el) {
|
|
5618
|
+
const clss = 'row--drag-active-target'
|
|
5619
|
+
const rowid = getRowid($xeTable, row)
|
|
5620
|
+
XEUtils.arrayEach(el.querySelectorAll(`[rowid="${rowid}"]`), (elem) => {
|
|
5621
|
+
addClass(elem, clss)
|
|
5622
|
+
elem.setAttribute('drag-pos', dragPos)
|
|
5623
|
+
})
|
|
5624
|
+
}
|
|
5625
|
+
}
|
|
5626
|
+
|
|
5544
5627
|
const showRowDropTip = (evnt: DragEvent | MouseEvent) => {
|
|
5545
5628
|
const rdTipEl = refRowDragTipElem.value
|
|
5546
5629
|
if (!rdTipEl) {
|
|
@@ -6646,7 +6729,7 @@ export default defineComponent({
|
|
|
6646
6729
|
const treeOpts = computeTreeOpts.value
|
|
6647
6730
|
const { transform } = treeOpts
|
|
6648
6731
|
const { dragRow } = reactData
|
|
6649
|
-
const { afterFullData, tableFullData, prevDragRow, prevDragPos } = internalData
|
|
6732
|
+
const { afterFullData, afterTreeFullData, tableFullData, tableFullTreeData, prevDragRow, prevDragPos } = internalData
|
|
6650
6733
|
if (prevDragRow && dragRow) {
|
|
6651
6734
|
// 判断是否有拖动
|
|
6652
6735
|
if (prevDragRow !== dragRow) {
|
|
@@ -6663,18 +6746,36 @@ export default defineComponent({
|
|
|
6663
6746
|
}
|
|
6664
6747
|
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0
|
|
6665
6748
|
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6749
|
+
let oafIndex = -1
|
|
6750
|
+
let nafIndex = -1
|
|
6751
|
+
if (treeConfig) {
|
|
6752
|
+
// 移出源位置
|
|
6753
|
+
oafIndex = $xeTable.findRowIndexOf(afterTreeFullData, dragRow)
|
|
6754
|
+
const otfIndex = $xeTable.findRowIndexOf(tableFullTreeData, dragRow)
|
|
6755
|
+
afterTreeFullData.splice(oafIndex, 1)
|
|
6756
|
+
tableFullTreeData.splice(otfIndex, 1)
|
|
6757
|
+
|
|
6758
|
+
// 插新位置
|
|
6759
|
+
const pafIndex = $xeTable.findRowIndexOf(afterTreeFullData, prevDragRow)
|
|
6760
|
+
const ptfIndex = $xeTable.findRowIndexOf(tableFullTreeData, prevDragRow)
|
|
6761
|
+
nafIndex = pafIndex + dragOffsetIndex
|
|
6762
|
+
const ntfIndex = ptfIndex + dragOffsetIndex
|
|
6763
|
+
afterTreeFullData.splice(nafIndex, 0, dragRow)
|
|
6764
|
+
tableFullTreeData.splice(ntfIndex, 0, dragRow)
|
|
6765
|
+
} else {
|
|
6766
|
+
// 移出源位置
|
|
6767
|
+
oafIndex = $xeTable.findRowIndexOf(afterFullData, dragRow)
|
|
6768
|
+
const otfIndex = $xeTable.findRowIndexOf(tableFullData, dragRow)
|
|
6769
|
+
afterFullData.splice(oafIndex, 1)
|
|
6770
|
+
tableFullData.splice(otfIndex, 1)
|
|
6771
|
+
// 插新位置
|
|
6772
|
+
const pafIndex = $xeTable.findRowIndexOf(afterFullData, prevDragRow)
|
|
6773
|
+
const ptfIndex = $xeTable.findRowIndexOf(tableFullData, prevDragRow)
|
|
6774
|
+
nafIndex = pafIndex + dragOffsetIndex
|
|
6775
|
+
const ntfIndex = ptfIndex + dragOffsetIndex
|
|
6776
|
+
afterFullData.splice(nafIndex, 0, dragRow)
|
|
6777
|
+
tableFullData.splice(ntfIndex, 0, dragRow)
|
|
6778
|
+
}
|
|
6678
6779
|
|
|
6679
6780
|
reactData.isDragRowMove = true
|
|
6680
6781
|
$xeTable.cacheRowMap()
|
|
@@ -6724,8 +6825,7 @@ export default defineComponent({
|
|
|
6724
6825
|
const { dragRow } = reactData
|
|
6725
6826
|
const offsetY = evnt.clientY - trEl.getBoundingClientRect().y
|
|
6726
6827
|
const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom'
|
|
6727
|
-
|
|
6728
|
-
trEl.setAttribute('drag-pos', dragPos)
|
|
6828
|
+
updateRowDropTarget(row, dragPos)
|
|
6729
6829
|
internalData.prevDragRow = row
|
|
6730
6830
|
internalData.prevDragPos = dragPos
|
|
6731
6831
|
dispatchEvent('row-dragover', {
|
|
@@ -6754,7 +6854,7 @@ export default defineComponent({
|
|
|
6754
6854
|
}
|
|
6755
6855
|
reactData.dragRow = row
|
|
6756
6856
|
trEl.draggable = true
|
|
6757
|
-
|
|
6857
|
+
updateRowDropOrigin(row)
|
|
6758
6858
|
showRowDropTip(evnt)
|
|
6759
6859
|
updateRowDropTipContent(tdEl)
|
|
6760
6860
|
dispatchEvent('row-dragstart', params, evnt)
|
|
@@ -6771,7 +6871,7 @@ export default defineComponent({
|
|
|
6771
6871
|
triggerScrollXEvent () {
|
|
6772
6872
|
loadScrollXData()
|
|
6773
6873
|
},
|
|
6774
|
-
handleScrollEvent (evnt, isRollY, isRollX, params) {
|
|
6874
|
+
handleScrollEvent (evnt, isRollY, isRollX, scrollTop, scrollLeft, params) {
|
|
6775
6875
|
const { highlightHoverRow } = props
|
|
6776
6876
|
const tableBody = refTableBody.value
|
|
6777
6877
|
const bodyElem = tableBody ? tableBody.$el as HTMLDivElement : null
|
|
@@ -6787,20 +6887,39 @@ export default defineComponent({
|
|
|
6787
6887
|
if (tooltip && tooltip.reactData.visible) {
|
|
6788
6888
|
tooltip.close()
|
|
6789
6889
|
}
|
|
6790
|
-
if (isRollX) {
|
|
6791
|
-
tablePrivateMethods.checkScrolling()
|
|
6792
|
-
}
|
|
6793
6890
|
const bodyHeight = bodyElem ? bodyElem.clientHeight : 0
|
|
6794
6891
|
const bodyWidth = bodyElem ? bodyElem.clientWidth : 0
|
|
6795
6892
|
const scrollHeight = bodyElem ? bodyElem.scrollHeight : 0
|
|
6796
6893
|
const scrollWidth = bodyElem ? bodyElem.scrollWidth : 0
|
|
6894
|
+
let isTop = false
|
|
6895
|
+
let isBottom = false
|
|
6896
|
+
let isLeft = false
|
|
6897
|
+
let isRight = false
|
|
6898
|
+
if (isRollX) {
|
|
6899
|
+
isLeft = scrollLeft <= 0
|
|
6900
|
+
if (!isTop) {
|
|
6901
|
+
isRight = scrollLeft + bodyWidth >= scrollWidth
|
|
6902
|
+
}
|
|
6903
|
+
tablePrivateMethods.checkScrolling()
|
|
6904
|
+
} else {
|
|
6905
|
+
isTop = scrollTop <= 0
|
|
6906
|
+
if (!isTop) {
|
|
6907
|
+
isBottom = scrollTop + bodyHeight >= scrollHeight
|
|
6908
|
+
}
|
|
6909
|
+
}
|
|
6797
6910
|
const evntParams = {
|
|
6911
|
+
scrollTop,
|
|
6912
|
+
scrollLeft,
|
|
6798
6913
|
bodyHeight,
|
|
6799
6914
|
bodyWidth,
|
|
6800
6915
|
scrollHeight,
|
|
6801
6916
|
scrollWidth,
|
|
6802
6917
|
isX: isRollX,
|
|
6803
6918
|
isY: isRollY,
|
|
6919
|
+
isTop,
|
|
6920
|
+
isBottom,
|
|
6921
|
+
isLeft,
|
|
6922
|
+
isRight,
|
|
6804
6923
|
...params
|
|
6805
6924
|
}
|
|
6806
6925
|
dispatchEvent('scroll', evntParams, evnt)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|