Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-vue-admin
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-vue-admin
Commits
cdf0a600
提交
cdf0a600
authored
1月 12, 2021
作者:
vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
perf: perf table
上级
efbde0d5
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
40 行增加
和
23 行删除
+40
-23
PopConfirmButton.vue
src/components/Button/src/PopConfirmButton.vue
+2
-1
index.ts
src/components/Table/index.ts
+0
-2
TableAction.vue
src/components/Table/src/components/TableAction.vue
+19
-2
EditableCell.vue
...components/Table/src/components/editable/EditableCell.vue
+13
-0
helper.ts
src/components/Table/src/components/editable/helper.ts
+3
-3
useTableScroll.ts
src/components/Table/src/hooks/useTableScroll.ts
+1
-1
index.less
src/components/Table/src/style/index.less
+2
-13
PersonTable.vue
src/views/demo/page/form/high/PersonTable.vue
+0
-1
没有找到文件。
src/components/Button/src/PopConfirmButton.vue
浏览文件 @
cdf0a600
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
inheritAttrs
:
false
,
inheritAttrs
:
false
,
components
:
{
Popconfirm
,
BasicButton
},
components
:
{
Popconfirm
,
BasicButton
},
props
:
{
props
:
{
size
:
propTypes
.
oneOf
([
'large'
,
'default'
,
'small'
]).
def
(),
enable
:
propTypes
.
bool
.
def
(
true
),
enable
:
propTypes
.
bool
.
def
(
true
),
okText
:
propTypes
.
string
,
okText
:
propTypes
.
string
,
cancelText
:
propTypes
.
string
,
cancelText
:
propTypes
.
string
,
...
@@ -31,7 +32,7 @@
...
@@ -31,7 +32,7 @@
return
popValues
;
return
popValues
;
});
});
return
()
=>
{
return
()
=>
{
const
Button
=
h
(
BasicButton
,
omit
(
unref
(
attrs
),
'icon'
),
extendSlots
(
slots
));
const
Button
=
h
(
BasicButton
,
unref
(
getBindValues
),
extendSlots
(
slots
));
if
(
!
props
.
enable
)
{
if
(
!
props
.
enable
)
{
return
Button
;
return
Button
;
}
}
...
...
src/components/Table/index.ts
浏览文件 @
cdf0a600
...
@@ -2,11 +2,9 @@ import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
...
@@ -2,11 +2,9 @@ import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
export
{
default
as
BasicTable
}
from
'./src/BasicTable.vue'
;
export
{
default
as
BasicTable
}
from
'./src/BasicTable.vue'
;
export
{
default
as
TableAction
}
from
'./src/components/TableAction.vue'
;
export
{
default
as
TableAction
}
from
'./src/components/TableAction.vue'
;
// export { default as TableImg } from './src/components/TableImg.vue';
export
{
default
as
EditTableHeaderIcon
}
from
'./src/components/EditTableHeaderIcon.vue'
;
export
{
default
as
EditTableHeaderIcon
}
from
'./src/components/EditTableHeaderIcon.vue'
;
export
const
TableImg
=
createAsyncComponent
(()
=>
import
(
'./src/components/TableImg.vue'
));
export
const
TableImg
=
createAsyncComponent
(()
=>
import
(
'./src/components/TableImg.vue'
));
// export const TableAction = createAsyncComponent(() => import('./src/components/TableAction.vue'));
export
*
from
'./src/types/table'
;
export
*
from
'./src/types/table'
;
export
*
from
'./src/types/pagination'
;
export
*
from
'./src/types/pagination'
;
...
...
src/components/Table/src/components/TableAction.vue
浏览文件 @
cdf0a600
...
@@ -5,7 +5,10 @@
...
@@ -5,7 +5,10 @@
<Icon
:icon=
"action.icon"
class=
"mr-1"
v-if=
"action.icon"
/>
<Icon
:icon=
"action.icon"
class=
"mr-1"
v-if=
"action.icon"
/>
{{
action
.
label
}}
{{
action
.
label
}}
</PopConfirmButton>
</PopConfirmButton>
<Divider
type=
"vertical"
v-if=
"divider && index
<
getActions
.
length
"
/>
<Divider
type=
"vertical"
v-if=
"divider && index
<
getActions
.
length
-
(
dropDownActions
?
0
:
1
)"
/>
</
template
>
</
template
>
<Dropdown
:trigger=
"['hover']"
:dropMenuList=
"getDropList"
v-if=
"dropDownActions"
>
<Dropdown
:trigger=
"['hover']"
:dropMenuList=
"getDropList"
v-if=
"dropDownActions"
>
<slot
name=
"more"
/>
<slot
name=
"more"
/>
...
@@ -44,17 +47,31 @@
...
@@ -44,17 +47,31 @@
},
},
setup
(
props
)
{
setup
(
props
)
{
const
{
prefixCls
}
=
useDesign
(
'basic-table-action'
);
const
{
prefixCls
}
=
useDesign
(
'basic-table-action'
);
let
table
=
{};
let
table
:
Partial
<
TableActionType
>
=
{};
if
(
!
props
.
outside
)
{
if
(
!
props
.
outside
)
{
table
=
useTableContext
();
table
=
useTableContext
();
}
}
// const getSize = computed(() => {
// const size = table?.getSize?.();
// if (size === 'middle' || !size) {
// return;
// }
// if (size === 'default') {
// return 'large';
// }
// return size;
// });
const
getActions
=
computed
(()
=>
{
const
getActions
=
computed
(()
=>
{
return
(
props
.
actions
||
[]).
map
((
action
)
=>
{
return
(
props
.
actions
||
[]).
map
((
action
)
=>
{
const
{
popConfirm
}
=
action
;
const
{
popConfirm
}
=
action
;
// const size = unref(getSize);
return
{
return
{
type
:
'link'
,
type
:
'link'
,
size
:
'small'
,
size
:
'small'
,
// ...(size ? { size } : {}),
...
action
,
...
action
,
...(
popConfirm
||
{}),
...(
popConfirm
||
{}),
onConfirm
:
popConfirm
?.
confirm
,
onConfirm
:
popConfirm
?.
confirm
,
...
...
src/components/Table/src/components/editable/EditableCell.vue
浏览文件 @
cdf0a600
...
@@ -85,6 +85,18 @@
...
@@ -85,6 +85,18 @@
return
unref
(
ruleMessage
)
&&
unref
(
ruleVisible
);
return
unref
(
ruleMessage
)
&&
unref
(
ruleVisible
);
});
});
// const getSize = computed(() => {
// const size = table?.getSize?.();
// if (size === 'middle' || !size) {
// return;
// }
// if (size === 'default') {
// return 'large';
// }
// return size;
// });
const
getIsCheckComp
=
computed
(()
=>
{
const
getIsCheckComp
=
computed
(()
=>
{
const
component
=
unref
(
getComponent
);
const
component
=
unref
(
getComponent
);
return
[
'Checkbox'
,
'Switch'
].
includes
(
component
);
return
[
'Checkbox'
,
'Switch'
].
includes
(
component
);
...
@@ -300,6 +312,7 @@
...
@@ -300,6 +312,7 @@
handleOptionsChange
,
handleOptionsChange
,
getWrapperStyle
,
getWrapperStyle
,
getRowEditable
,
getRowEditable
,
// getSize,
};
};
},
},
});
});
...
...
src/components/Table/src/components/editable/helper.ts
浏览文件 @
cdf0a600
...
@@ -8,10 +8,10 @@ const { t } = useI18n();
...
@@ -8,10 +8,10 @@ const { t } = useI18n();
*/
*/
export
function
createPlaceholderMessage
(
component
:
ComponentType
)
{
export
function
createPlaceholderMessage
(
component
:
ComponentType
)
{
if
(
component
.
includes
(
'Input'
))
{
if
(
component
.
includes
(
'Input'
))
{
return
t
(
'com
ponent.form.inpu
t'
);
return
t
(
'com
mon.inputTex
t'
);
}
}
if
(
component
.
includes
(
'Picker'
))
{
if
(
component
.
includes
(
'Picker'
))
{
return
t
(
'com
ponent.form.choose
'
);
return
t
(
'com
mon.chooseText
'
);
}
}
if
(
if
(
...
@@ -20,7 +20,7 @@ export function createPlaceholderMessage(component: ComponentType) {
...
@@ -20,7 +20,7 @@ export function createPlaceholderMessage(component: ComponentType) {
component
.
includes
(
'Radio'
)
||
component
.
includes
(
'Radio'
)
||
component
.
includes
(
'Switch'
)
component
.
includes
(
'Switch'
)
)
{
)
{
return
t
(
'com
ponent.form.choose
'
);
return
t
(
'com
mon.chooseText
'
);
}
}
return
''
;
return
''
;
}
}
src/components/Table/src/hooks/useTableScroll.ts
浏览文件 @
cdf0a600
...
@@ -143,7 +143,7 @@ export function useTableScroll(
...
@@ -143,7 +143,7 @@ export function useTableScroll(
const
table
=
unref
(
tableElRef
);
const
table
=
unref
(
tableElRef
);
const
tableWidth
=
table
?.
$el
?.
offsetWidth
??
0
;
const
tableWidth
=
table
?.
$el
?.
offsetWidth
??
0
;
return
tableWidth
>
width
?
tableWidth
-
24
:
width
;
return
tableWidth
>
width
?
'100%'
:
width
;
});
});
const
getScrollRef
=
computed
(()
=>
{
const
getScrollRef
=
computed
(()
=>
{
...
...
src/components/Table/src/style/index.less
浏览文件 @
cdf0a600
...
@@ -51,7 +51,7 @@
...
@@ -51,7 +51,7 @@
//
//
.
ant-table
{
.
ant-table
{
width:
100
%
;
width:
100
%
;
overflow-x:
auto
;
overflow-x:
hidden
;
border:
none
;
border:
none
;
&-title
{
&-title
{
...
@@ -107,22 +107,11 @@
...
@@ -107,22 +107,11 @@
border:
1
px
solid
@border-color
!important
;
border:
1
px
solid
@border-color
!important
;
}
}
.
ant-table
td
{
white-space:
nowrap
;
}
.
ant-table-tbody
>
tr
>
td,
.
ant-table-tbody
>
tr
>
td,
.
ant-table-tbody
>
tr
>
th,
.
ant-table-tbody
>
tr
>
th,
.
ant-table-thead
>
tr
>
td,
.
ant-table-thead
>
tr
>
td,
.
ant-table-thead
>
tr
>
th
{
.
ant-table-thead
>
tr
>
th
{
white-space:
pre
;
white-space:
nowrap
;
}
.
ant-table-tbody
>
tr
>
td
>
span,
.
ant-table-tbody
>
tr
>
th
>
span,
.
ant-table-thead
>
tr
>
td
>
span,
.
ant-table-thead
>
tr
>
th
>
span
{
display:
block
;
}
}
.
ant-table-row-cell-last
{
.
ant-table-row-cell-last
{
...
...
src/views/demo/page/form/high/PersonTable.vue
浏览文件 @
cdf0a600
...
@@ -30,7 +30,6 @@
...
@@ -30,7 +30,6 @@
title
:
'工号'
,
title
:
'工号'
,
dataIndex
:
'no'
,
dataIndex
:
'no'
,
editRow
:
true
,
editRow
:
true
,
// customRender: renderEditableRow({ dataIndex: 'no', placeholder: '请输入工号' }),
// customRender: renderEditableRow({ dataIndex: 'no', placeholder: '请输入工号' }),
},
},
{
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论