From 11a68a67f647d4013ec8a775a73c46aa277fb2c0 Mon Sep 17 00:00:00 2001 From: tengge1 <930372551@qq.com> Date: Sat, 21 Sep 2019 21:44:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E9=A1=B5=E7=BB=84=E4=BB=B6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ShadowEditor.Web/locales/zh-CN.json | 7 +++- ShadowEditor.Web/src/ui/image/ImageList.jsx | 22 ++++-------- ShadowEditor.Web/src/ui/table/DataGrid.jsx | 35 ++++++++++++++++++- .../src/ui/table/css/DataGrid.css | 33 +++++++++++++++++ 4 files changed, 79 insertions(+), 18 deletions(-) diff --git a/ShadowEditor.Web/locales/zh-CN.json b/ShadowEditor.Web/locales/zh-CN.json index b0174418..ecb7aa6d 100644 --- a/ShadowEditor.Web/locales/zh-CN.json +++ b/ShadowEditor.Web/locales/zh-CN.json @@ -745,5 +745,10 @@ "The name is already existed.": "该名称已经存在。", "Create Date": "创建日期", "Update Date": "更新日期", - "Status": "状态" + "Status": "状态", + "First Page": "第一页", + "Previous Page": "上一页", + "Current Page": "当前页", + "Next Page": "下一页", + "Last Page": "最后一页" } \ No newline at end of file diff --git a/ShadowEditor.Web/src/ui/image/ImageList.jsx b/ShadowEditor.Web/src/ui/image/ImageList.jsx index 6dfb7ef7..d4fe2742 100644 --- a/ShadowEditor.Web/src/ui/image/ImageList.jsx +++ b/ShadowEditor.Web/src/ui/image/ImageList.jsx @@ -33,7 +33,7 @@ class ImageList extends React.Component { } render() { - const { className, style, data, firstPageText, lastPageText, currentPageText, previousPageText, nextPageText } = this.props; + const { className, style, data } = this.props; const { pageSize, pageNum } = this.state; const totalPage = this.getTotalPage(); @@ -59,11 +59,11 @@ class ImageList extends React.Component { })}
- - - - - + + + + +
{_t('Total {{totalPage}} Pages', { totalPage: totalPage })}
@@ -158,11 +158,6 @@ ImageList.propTypes = { onClick: PropTypes.func, onEdit: PropTypes.func, onDelete: PropTypes.func, - firstPageText: PropTypes.string, - lastPageText: PropTypes.string, - currentPageText: PropTypes.string, - previousPageText: PropTypes.string, - nextPageText: PropTypes.string, }; ImageList.defaultProps = { @@ -172,11 +167,6 @@ ImageList.defaultProps = { onClick: null, onEdit: null, onDelete: null, - firstPageText: 'First Page', - lastPageText: 'Last Page', - currentPageText: 'Current Page', - previousPageText: 'Previous Page', - nextPageText: 'Next Page', }; export default ImageList; \ No newline at end of file diff --git a/ShadowEditor.Web/src/ui/table/DataGrid.jsx b/ShadowEditor.Web/src/ui/table/DataGrid.jsx index 3551394f..8094beb7 100644 --- a/ShadowEditor.Web/src/ui/table/DataGrid.jsx +++ b/ShadowEditor.Web/src/ui/table/DataGrid.jsx @@ -2,6 +2,8 @@ import './css/DataGrid.css'; import classNames from 'classnames/bind'; import PropTypes from 'prop-types'; import Column from '../common/Column.jsx'; +import IconButton from '../form/IconButton.jsx'; +import Input from '../form/Input.jsx'; /** * 数据表格 @@ -12,6 +14,11 @@ class DataGrid extends React.Component { super(props); this.handleClick = this.handleClick.bind(this, props.onSelect); + + this.handleFirstPage = this.handleFirstPage.bind(this); + this.handlePreviousPage = this.handlePreviousPage.bind(this); + this.handleNextPage = this.handleNextPage.bind(this); + this.handleLastPage = this.handleLastPage.bind(this); } render() { @@ -60,11 +67,21 @@ class DataGrid extends React.Component { ; - return
+ return
{head}
{body}
+ {pages &&
+ + + + + +
+ {_t('Total {{totalPage}} Pages', { totalPage: total })} +
+
}
; } @@ -76,6 +93,22 @@ class DataGrid extends React.Component { onSelect && onSelect(record); } + + handleFirstPage() { + + } + + handlePreviousPage() { + + } + + handleNextPage() { + + } + + handleLastPage() { + + } } DataGrid.propTypes = { diff --git a/ShadowEditor.Web/src/ui/table/css/DataGrid.css b/ShadowEditor.Web/src/ui/table/css/DataGrid.css index c31bd5d3..3f81c507 100644 --- a/ShadowEditor.Web/src/ui/table/css/DataGrid.css +++ b/ShadowEditor.Web/src/ui/table/css/DataGrid.css @@ -36,6 +36,10 @@ overflow-y: auto; } +.DataGrid.pages>.wrap { + height: calc(100% - 52px); +} + .DataGrid>.wrap>.body { width: 100%; border-collapse: collapse; @@ -68,4 +72,33 @@ .DataGrid>.wrap>.body>tbody>tr:nth-child(1)>td { border-top: none; +} + +.DataGrid>.page { + position: absolute; + left: 0; + bottom: 0; + width: 100%; + font-size: 12px; + padding: 2px 0; + border-top: 1px solid #ddd; + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-between; +} + +.DataGrid>.page>.IconButton { + width: 20px; + height: 20px; + margin: 0 2px; +} + +.DataGrid>.page>.IconButton>.iconfont { + font-size: 14px; +} + +.DataGrid>.page>.info { + margin: 0 8px 0 2px; + white-space: nowrap; } \ No newline at end of file