Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
sage-front-framework
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
郁骅焌
sage-front-framework
Commits
c5229864
提交
c5229864
authored
7月 03, 2020
作者:
郁骅焌
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tijiao
上级
854642ec
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
177 行增加
和
15 行删除
+177
-15
index.jsx
src/components/Common/Table/index.jsx
+2
-2
index.jsx
...nents/Common/TableTool/components/ColumnSetting/index.jsx
+104
-0
style.less
...ents/Common/TableTool/components/ColumnSetting/style.less
+28
-0
index.jsx
src/components/Common/TableTool/index.jsx
+14
-3
BasicLayout.jsx
src/layouts/BasicLayout.jsx
+1
-1
BasicLayout.less
src/layouts/BasicLayout.less
+27
-8
index.jsx
src/pages/demo/crud/index.jsx
+1
-1
没有找到文件。
src/components/Common/Table/index.jsx
浏览文件 @
c5229864
...
@@ -31,7 +31,7 @@ const initState = {
...
@@ -31,7 +31,7 @@ const initState = {
* 9、onContextMenuRow
* 9、onContextMenuRow
* 10、toolOptionConfig
* 10、toolOptionConfig
* 11、hiddeTool 隐藏工具栏
* 11、hiddeTool 隐藏工具栏
* 表格工具['reload', 'hiddensearch', 'density', 'fullScreen']
* 表格工具['reload', 'hiddensearch', 'density', 'fullScreen'
, 'setting'
]
*/
*/
const
SageTable
=
React
.
forwardRef
((
props
,
ref
)
=>
{
const
SageTable
=
React
.
forwardRef
((
props
,
ref
)
=>
{
const
rootRef
=
useRef
(
null
);
const
rootRef
=
useRef
(
null
);
...
@@ -413,7 +413,7 @@ const SageTable = React.forwardRef((props, ref) => {
...
@@ -413,7 +413,7 @@ const SageTable = React.forwardRef((props, ref) => {
)
}
)
}
{
!
hiddeTool
?
(
{
!
hiddeTool
?
(
<
TableTool
tableSize=
{
tableSizeState
}
isFullscreen=
{
isFullscreen
}
{
...
tableToolProps
}
/>
<
TableTool
tableSize=
{
tableSizeState
}
isFullscreen=
{
isFullscreen
}
columns=
{
latestColumnsState
}
{
...
tableToolProps
}
/>
)
:
null
}
)
:
null
}
<
Table
<
Table
...
...
src/components/Common/TableTool/components/ColumnSetting/index.jsx
0 → 100644
浏览文件 @
c5229864
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
SettingOutlined
}
from
'@ant-design/icons'
;
import
{
Popover
,
Tooltip
,
Checkbox
}
from
'antd'
;
import
'./style.less'
const
CheckboxGroup
=
Checkbox
.
Group
;
const
ColumnSetting
=
(
props
)
=>
{
const
[
plainOptions
,
setPlainOptions
]
=
useState
([])
const
[
checkedList
,
setCheckedList
]
=
useState
([])
const
[
indeterminate
,
setIndeterminate
]
=
useState
(
true
)
const
[
checkAll
,
setCheckAll
]
=
useState
(
false
)
const
onChange
=
_checkedList
=>
{
setCheckedList
(
_checkedList
)
setIndeterminate
(
!!
_checkedList
.
length
&&
_checkedList
.
length
<
plainOptions
.
length
)
setCheckAll
(
_checkedList
.
length
===
plainOptions
.
length
)
};
useEffect
(()
=>
{
const
allOptions
=
[]
console
.
log
(
props
.
columns
)
props
.
columns
&&
props
.
columns
.
map
(
item
=>
{
allOptions
.
push
({
key
:
item
.
key
,
title
:
item
.
title
})
})
setPlainOptions
(
allOptions
)
},
[])
const
content
=
(
<
div
className=
"sage-table-column-setting-list"
>
{
plainOptions
.
map
((
item
,
index
)
=>
{
return
(
<
span
className=
"sage-table-column-setting-list-item"
key=
{
`columnKey_${item.key}`
}
>
<
Checkbox
onChange=
{
(
e
)
=>
{
// if (columnKey)
{
// const tempConfig = columnsMap[columnKey || ''] ||
{};
// const newSetting =
{
...
tempConfig
};
// if (e.target.checked)
{
// delete newSetting.show;
//
}
else
{
// newSetting.show = false;
//
}
// const columnKeyMap =
{
// ...columnsMap,
// [columnKey]: newSetting as ColumnsState,
//
};
// setColumnsMap(columnKeyMap);
//
}
}
}
//checked=
{
config
.
show
!==
false
}
>
{
item
.
title
}
</
Checkbox
>
</
span
>
)
})
}
</
div
>
);
return
(
<
Popover
placement=
"bottomRight"
content=
{
content
}
title=
{
<
div
className=
"sage-table-column-setting-title"
>
<
Checkbox
// indeterminate=
{
indeterminate
}
是否已选中
// checked=
{
selectedKeys
.
length
===
0
&&
selectedKeys
.
length
!==
localColumns
.
length
}
onChange=
{
(
e
)
=>
{
if
(
e
.
target
.
checked
)
{
// setAllSelectAction();
}
else
{
// setAllSelectAction(false);
}
}
}
>
列展示
</
Checkbox
>
<
a
onClick=
{
()
=>
{
console
.
log
(
'重置'
)
}
}
>
重置
</
a
>
</
div
>
}
trigger=
"click"
>
<
Tooltip
title=
"列设置"
>
<
SettingOutlined
className=
"table-tool-icon"
/>
</
Tooltip
>
</
Popover
>
);
};
export
default
ColumnSetting
;
src/components/Common/TableTool/components/ColumnSetting/style.less
0 → 100644
浏览文件 @
c5229864
.sage-pro-table {
.ant-popover-inner-content {
padding: 0;
}
}
.sage-table-column-setting-title {
display: flex;
align-items: center;
justify-content: space-between;
height: 32px;
}
.sage-table-column-setting-list {
display: flex;
flex-direction: column;
width: 100%;
max-height: 400px;
overflow: auto;
.sage-table-column-setting-list-item {
display: flex;
align-items: center;
width: 100%;
padding: 4px 16px;
}
}
\ No newline at end of file
src/components/Common/TableTool/index.jsx
浏览文件 @
c5229864
import
React
from
'react'
import
React
from
'react'
import
{
Tooltip
}
from
'antd'
import
{
Tooltip
}
from
'antd'
import
{
FileSearchOutlined
,
FileSyncOutlined
}
from
'@ant-design/icons'
;
import
{
FileSearchOutlined
,
FileSyncOutlined
,
SettingOutlined
}
from
'@ant-design/icons'
;
import
DensityIcon
from
'./components/DensityIcon/index'
import
DensityIcon
from
'./components/DensityIcon/index'
import
FullscreenIcon
from
'./components/FullscreenIcon/index'
import
FullscreenIcon
from
'./components/FullscreenIcon/index'
import
ColumnSetting
from
'./components/ColumnSetting'
import
'./style.less'
import
'./style.less'
const
defatultToolOption
=
[
'reload'
,
'hiddensearch'
,
'density'
,
'fullScreen'
]
const
defatultToolOption
=
[
'reload'
,
'hiddensearch'
,
'density'
,
'fullScreen'
,
'setting'
]
/**
/**
*
*
...
@@ -22,7 +23,8 @@ const SageTableTool = (props) => {
...
@@ -22,7 +23,8 @@ const SageTableTool = (props) => {
onChangeSize
,
onChangeSize
,
onHiddeSearch
,
onHiddeSearch
,
setFull
,
setFull
,
exitFull
exitFull
,
columns
}
=
props
}
=
props
// 控制工具按钮显示
// 控制工具按钮显示
...
@@ -71,6 +73,15 @@ const SageTableTool = (props) => {
...
@@ -71,6 +73,15 @@ const SageTableTool = (props) => {
</
span
>
</
span
>
)
)
break
;
break
;
case
'setting'
:
eachDom
=
(
<
span
className=
"sage-table-toolbar-item"
key=
{
`sage-table-toolbar-item-${item}`
}
>
<
Tooltip
title=
"列设置"
>
<
ColumnSetting
columns=
{
columns
}
/>
</
Tooltip
>
</
span
>
)
break
;
default
:
default
:
break
;
break
;
}
}
...
...
src/layouts/BasicLayout.jsx
浏览文件 @
c5229864
...
@@ -301,7 +301,7 @@ const BasicLayout = (props) => {
...
@@ -301,7 +301,7 @@ const BasicLayout = (props) => {
<
h1
className=
"sage-sidebar-title"
>
Sage FrameWork
</
h1
>
<
h1
className=
"sage-sidebar-title"
>
Sage FrameWork
</
h1
>
</
a
>
</
a
>
</
div
>
</
div
>
<
div
>
<
div
className=
"sage-sider-menu"
>
<
Menu
<
Menu
style=
{
{
width
:
'100%'
}
}
style=
{
{
width
:
'100%'
}
}
selectedKeys=
{
menuSelectedKeys
}
selectedKeys=
{
menuSelectedKeys
}
...
...
src/layouts/BasicLayout.less
浏览文件 @
c5229864
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
.sage-sidebar-container {
.sage-sidebar-container {
transition: width .28s;
transition: width .28s;
width: 205px!important;
width: 205px
!important;
background-color: #001529;
background-color: #001529;
height: 100%;
height: 100%;
position: fixed;
position: fixed;
...
@@ -32,20 +32,24 @@
...
@@ -32,20 +32,24 @@
line-height: 50px;
line-height: 50px;
text-align: center;
text-align: center;
overflow: hidden;
overflow: hidden;
a {
a {
display: inline-block;
display: inline-block;
width: 100%;
width: 100%;
overflow: hidden;
overflow: hidden;
}
}
.sage-sidebar-logo-link {
.sage-sidebar-logo-link {
height: 100%;
height: 100%;
width: 100%;
width: 100%;
.sage-sidebar-logo {
.sage-sidebar-logo {
width: 32px;
width: 32px;
height: 32px;
height: 32px;
vertical-align: middle;
vertical-align: middle;
margin-right: 6px;
margin-right: 6px;
}
}
.sage-sidebar-title {
.sage-sidebar-title {
display: inline-block;
display: inline-block;
margin: 0;
margin: 0;
...
@@ -53,7 +57,7 @@
...
@@ -53,7 +57,7 @@
font-weight: 600;
font-weight: 600;
line-height: 50px;
line-height: 50px;
font-size: 14px;
font-size: 14px;
font-family: Avenir,
Helvetica Neue,Arial,Helvetica,
sans-serif;
font-family: Avenir,
Helvetica Neue, Arial, Helvetica,
sans-serif;
vertical-align: middle;
vertical-align: middle;
}
}
}
}
...
@@ -75,8 +79,9 @@
...
@@ -75,8 +79,9 @@
overflow: hidden;
overflow: hidden;
position: relative;
position: relative;
background: #fff;
background: #fff;
-webkit-box-shadow: 0 1px 4px rgba(0,21,41,.08);
-webkit-box-shadow: 0 1px 4px rgba(0, 21, 41, .08);
box-shadow: 0 1px 4px rgba(0,21,41,.08);
box-shadow: 0 1px 4px rgba(0, 21, 41, .08);
.sage-hamburger-container {
.sage-hamburger-container {
line-height: 50px;
line-height: 50px;
height: 100%;
height: 100%;
...
@@ -85,8 +90,9 @@
...
@@ -85,8 +90,9 @@
-webkit-transition: background .3s;
-webkit-transition: background .3s;
transition: background .3s;
transition: background .3s;
-webkit-tap-highlight-color: transparent;
-webkit-tap-highlight-color: transparent;
&:hover {
&:hover {
background: rgba(0,
0,0,
.025);
background: rgba(0,
0, 0,
.025);
}
}
}
}
}
}
...
@@ -107,14 +113,27 @@
...
@@ -107,14 +113,27 @@
.hideSidebar {
.hideSidebar {
.sage-sidebar-container {
.sage-sidebar-container {
width:
80
px !important;
width:
48
px !important;
}
}
// 左侧导航栏菜单样式
.sage-sider-menu {
.ant-menu-item {
padding: 0 16px !important;
}
.ant-menu-submenu-title {
padding: 0 16px !important;
}
}
.sage-main-container {
.sage-main-container {
margin-left:
80
px;
margin-left:
48
px;
}
}
.sage-fixed-header {
.sage-fixed-header {
width: calc(100% -
80
px);
width: calc(100% -
48
px);
}
}
.sage-sidebar-logo {
.sage-sidebar-logo {
margin-right: 0 !important;
margin-right: 0 !important;
}
}
...
...
src/pages/demo/crud/index.jsx
浏览文件 @
c5229864
...
@@ -454,7 +454,7 @@ const CrudList = () => {
...
@@ -454,7 +454,7 @@ const CrudList = () => {
</>
</>
)
)
},
},
toolOptionConfig
:
[
'reload'
,
'hiddensearch'
,
'density'
,
'fullScreen'
]
//
toolOptionConfig: ['reload', 'hiddensearch', 'density', 'fullScreen']
}
}
// 窗口确认按钮
// 窗口确认按钮
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论