Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-vue-admin
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-vue-admin
Commits
4b384b13
提交
4b384b13
authored
10月 20, 2020
作者:
vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
perf: perf TableAction
上级
5a6db8c6
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
41 行增加
和
132 行删除
+41
-132
CHANGELOG.zh_CN.md
CHANGELOG.zh_CN.md
+2
-0
CellResize.tsx
src/components/Table/src/components/CellResize.tsx
+0
-72
TableAction.tsx
src/components/Table/src/components/TableAction.tsx
+37
-58
renderEditableCell.tsx
src/components/Table/src/components/renderEditableCell.tsx
+2
-2
没有找到文件。
CHANGELOG.zh_CN.md
浏览文件 @
4b384b13
...
@@ -8,11 +8,13 @@
...
@@ -8,11 +8,13 @@
### ⚡ Performance Improvements
### ⚡ Performance Improvements
-
优化首屏体积大小
-
优化首屏体积大小
-
优化 TableAction 组件
### 🐛 Bug Fixes
### 🐛 Bug Fixes
-
修复一级菜单折叠显示菜单名问题
-
修复一级菜单折叠显示菜单名问题
-
修复预览命令不打包问题
-
修复预览命令不打包问题
-
修复表格 actionColOptions 参数不生效问题
# 2.0.0-rc.3 (2020-10-19)
# 2.0.0-rc.3 (2020-10-19)
...
...
src/components/Table/src/components/CellResize.tsx
deleted
100644 → 0
浏览文件 @
5a6db8c6
import
{
defineComponent
,
ref
,
computed
,
unref
}
from
'vue'
;
import
{
injectTable
}
from
'../hooks/useProvinceTable'
;
import
{
getSlot
}
from
'/@/utils/helper/tsxHelper'
;
import
VueDraggableResizable
from
'vue-draggable-resizable'
;
export
default
defineComponent
({
name
:
'DragResize'
,
setup
(
props
,
{
slots
,
attrs
})
{
const
elRef
=
ref
<
HTMLTableRowElement
|
null
>
(
null
);
const
draggingMapRef
=
ref
<
{
[
key
in
string
]:
number
|
string
}
>
({});
const
tableInstance
=
injectTable
();
const
getColumnsRef
=
computed
(()
=>
{
const
columns
=
tableInstance
.
getColumns
();
columns
.
forEach
((
col
)
=>
{
const
{
key
}
=
col
;
if
(
key
)
{
draggingMapRef
.
value
[
key
]
=
col
.
width
as
number
;
}
});
return
columns
;
});
return
()
=>
{
const
{
key
=
''
,
...
restProps
}
=
{
...
attrs
};
const
col
=
unref
(
getColumnsRef
).
find
((
col
)
=>
{
const
k
=
col
.
dataIndex
||
col
.
key
;
return
k
===
key
;
});
if
(
!
col
||
!
col
.
width
)
{
return
<
th
{
...
restProps
}
>
{
getSlot
(
slots
,
'default'
)
}
</
th
>;
}
const
onDrag
=
(
x
:
number
)
=>
{
draggingMapRef
.
value
[
key
]
=
0
;
col
.
width
=
Math
.
max
(
x
,
1
);
};
const
onDragstop
=
()
=>
{
const
el
=
unref
(
elRef
);
if
(
!
el
)
{
return
;
}
draggingMapRef
.
value
[
key
]
=
el
.
getBoundingClientRect
().
width
;
};
return
(
<
th
{
...
restProps
}
class=
"resize-table-th"
ref=
{
elRef
}
style=
{
{
width
:
`${col.width}px`
,
}
}
>
{
getSlot
(
slots
,
'default'
)
}
<
VueDraggableResizable
key=
{
col
.
key
}
class=
"table-draggable-handle"
w=
{
10
}
x=
{
draggingMapRef
.
value
[
key
]
||
col
.
width
}
z=
{
1
}
axis=
"x"
draggable=
{
true
}
resizable=
{
false
}
onDragging=
{
onDrag
}
onDragstop=
{
onDragstop
}
/>
</
th
>
);
};
},
});
src/components/Table/src/components/TableAction.tsx
浏览文件 @
4b384b13
...
@@ -16,33 +16,17 @@ export default defineComponent({
...
@@ -16,33 +16,17 @@ export default defineComponent({
type
:
Array
as
PropType
<
ActionItem
[]
>
,
type
:
Array
as
PropType
<
ActionItem
[]
>
,
default
:
null
,
default
:
null
,
},
},
moreText
:
{
type
:
String
as
PropType
<
string
>
,
default
:
'更多'
,
},
},
},
setup
(
props
)
{
setup
(
props
)
{
// 增加按钮的TYPE和COLOR
function
renderButton
(
action
:
ActionItem
,
index
:
number
)
{
return
()
=>
{
const
{
disabled
=
false
,
label
,
icon
,
color
=
''
,
type
=
'link'
}
=
action
;
const
{
dropDownActions
=
[],
actions
}
=
props
;
return
(
<
div
class=
{
prefixCls
}
>
{
actions
&&
actions
.
length
&&
actions
.
map
((
action
,
index
)
=>
{
const
{
disabled
=
false
,
label
,
icon
,
color
=
''
,
type
=
'link'
,
popConfirm
=
null
,
}
=
action
;
const
button
=
(
const
button
=
(
<
Button
<
Button
type=
{
type
}
size=
"small"
disabled=
{
disabled
}
color=
{
color
}
{
...
action
}
key=
{
index
}
>
type=
{
type
}
size=
"small"
disabled=
{
disabled
}
color=
{
color
}
{
...
action
}
key=
{
index
}
>
{
()
=>
(
{
()
=>
(
<>
<>
{
label
}
{
label
}
...
@@ -51,7 +35,14 @@ export default defineComponent({
...
@@ -51,7 +35,14 @@ export default defineComponent({
)
}
)
}
</
Button
>
</
Button
>
);
);
if
(
popConfirm
!==
null
)
{
return
button
;
}
function
renderPopConfirm
(
action
:
ActionItem
,
index
:
number
)
{
const
{
popConfirm
=
null
}
=
action
;
if
(
!
popConfirm
)
{
return
renderButton
(
action
,
index
);
}
const
{
const
{
title
,
title
,
okText
=
'确定'
,
okText
=
'确定'
,
...
@@ -70,60 +61,48 @@ export default defineComponent({
...
@@ -70,60 +61,48 @@ export default defineComponent({
cancelText=
{
cancelText
}
cancelText=
{
cancelText
}
icon=
{
icon
}
icon=
{
icon
}
>
>
{
()
=>
button
}
{
()
=>
renderButton
(
action
,
index
)
}
</
Popconfirm
>
</
Popconfirm
>
);
);
}
}
return
button
;
})
}
const
dropdownDefaultSLot
=
()
=>
(
{
dropDownActions
&&
dropDownActions
.
length
&&
(
<
Dropdown
>
{
{
default
:
()
=>
(
<
Button
type=
"link"
size=
"small"
>
<
Button
type=
"link"
size=
"small"
>
{
{
{
{
default
:
()
=>
(
default
:
()
=>
(
<>
<>
更多
{
props
.
moreText
}
<
DownOutlined
/>
<
DownOutlined
/>
</>
</>
),
),
}
}
}
}
</
Button
>
</
Button
>
),
);
// 增加按钮的TYPE和COLOR
return
()
=>
{
const
{
dropDownActions
=
[],
actions
}
=
props
;
return
(
<
div
class=
{
prefixCls
}
>
{
actions
?.
map
((
action
,
index
)
=>
{
return
renderPopConfirm
(
action
,
index
);
})
}
{
dropDownActions
?.
length
&&
(
<
Dropdown
>
{
{
default
:
dropdownDefaultSLot
,
overlay
:
()
=>
{
overlay
:
()
=>
{
return
(
return
(
<
Menu
>
<
Menu
>
{
{
{
{
default
:
()
=>
{
default
:
()
=>
{
return
dropDownActions
.
map
((
action
,
index
)
=>
{
return
dropDownActions
.
map
((
action
,
index
)
=>
{
const
{
const
{
disabled
=
false
}
=
action
;
disabled
=
false
,
label
,
icon
,
color
=
''
,
type
=
'link'
,
}
=
action
;
return
(
return
(
<
Menu
.
Item
key=
{
`${index}`
}
disabled=
{
disabled
}
>
<
Menu
.
Item
key=
{
`${index}`
}
disabled=
{
disabled
}
>
{
()
=>
(
{
()
=>
{
<
Button
return
renderPopConfirm
(
action
,
index
);
type=
{
type
}
size=
"small"
{
...
action
}
disabled=
{
disabled
}
color=
{
color
}
>
{
{
default
:
()
=>
(
<>
{
label
}
{
icon
&&
<
Icon
icon=
{
icon
}
/>
}
</>
),
}
}
}
}
</
Button
>
)
}
</
Menu
.
Item
>
</
Menu
.
Item
>
);
);
});
});
...
...
src/components/Table/src/components/renderEditableCell.tsx
浏览文件 @
4b384b13
...
@@ -46,7 +46,7 @@ const EditableCell = defineComponent({
...
@@ -46,7 +46,7 @@ const EditableCell = defineComponent({
const
currentValueRef
=
ref
<
string
|
boolean
>
(
props
.
value
);
const
currentValueRef
=
ref
<
string
|
boolean
>
(
props
.
value
);
function
handleChange
(
e
:
ChangeEvent
|
string
|
boolean
)
{
function
handleChange
(
e
:
ChangeEvent
|
string
|
boolean
)
{
if
(
(
e
as
ChangeEvent
).
target
&&
Reflect
.
has
((
e
as
ChangeEvent
)
.
target
,
'value'
))
{
if
(
Reflect
.
has
((
e
as
ChangeEvent
)?
.
target
,
'value'
))
{
currentValueRef
.
value
=
(
e
as
ChangeEvent
).
target
.
value
;
currentValueRef
.
value
=
(
e
as
ChangeEvent
).
target
.
value
;
}
}
if
(
isString
(
e
)
||
isBoolean
(
e
))
{
if
(
isString
(
e
)
||
isBoolean
(
e
))
{
...
@@ -58,7 +58,7 @@ const EditableCell = defineComponent({
...
@@ -58,7 +58,7 @@ const EditableCell = defineComponent({
isEditRef
.
value
=
true
;
isEditRef
.
value
=
true
;
nextTick
(()
=>
{
nextTick
(()
=>
{
const
el
=
unref
(
elRef
);
const
el
=
unref
(
elRef
);
el
&&
el
.
focus
&&
el
.
focus
();
el
?
.
focus
();
});
});
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论