From cb68fd346da5c130b809b6c1267673dfd01453af Mon Sep 17 00:00:00 2001 From: tengge1 <930372551@qq.com> Date: Thu, 19 Sep 2019 21:29:17 +0800 Subject: [PATCH] =?UTF-8?q?SearchField.jsx=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ShadowEditor.Web/locales/zh-CN.json | 4 +- .../src/editor/assets/AnimationPanel.jsx | 2 + .../src/editor/assets/AudioPanel.jsx | 2 + .../src/editor/assets/CharacterPanel.jsx | 2 +- .../src/editor/assets/MapPanel.jsx | 2 +- .../src/editor/assets/MaterialPanel.jsx | 2 +- .../src/editor/assets/ModelPanel.jsx | 2 + .../src/editor/assets/ParticlePanel.jsx | 2 +- .../src/editor/assets/PrefabPanel.jsx | 2 +- .../src/editor/assets/ScenePanel.jsx | 2 +- .../src/editor/assets/ScreenshotPanel.jsx | 2 +- .../src/editor/assets/VideoPanel.jsx | 2 +- .../editor/menu/window/RoleManageWindow.jsx | 25 +++++-- .../menu/window/css/RoleManageWindow.css | 10 +++ ShadowEditor.Web/src/ui/form/SearchField.jsx | 21 +++--- ShadowEditor.Web/src/ui/form/css/Button.css | 1 + ShadowEditor.Web/src/ui/table/DataGrid.jsx | 66 +++++++++---------- .../src/ui/table/css/DataGrid.css | 4 +- 18 files changed, 92 insertions(+), 61 deletions(-) diff --git a/ShadowEditor.Web/locales/zh-CN.json b/ShadowEditor.Web/locales/zh-CN.json index 8178b0ec..b0174418 100644 --- a/ShadowEditor.Web/locales/zh-CN.json +++ b/ShadowEditor.Web/locales/zh-CN.json @@ -743,7 +743,7 @@ "Role Management": "角色管理", "Authority Management": "权限管理", "The name is already existed.": "该名称已经存在。", - "Create Time": "创建时间", - "Update Time": "最后更新时间", + "Create Date": "创建日期", + "Update Date": "更新日期", "Status": "状态" } \ No newline at end of file diff --git a/ShadowEditor.Web/src/editor/assets/AnimationPanel.jsx b/ShadowEditor.Web/src/editor/assets/AnimationPanel.jsx index 8d6d2144..0b12a2e3 100644 --- a/ShadowEditor.Web/src/editor/assets/AnimationPanel.jsx +++ b/ShadowEditor.Web/src/editor/assets/AnimationPanel.jsx @@ -63,6 +63,8 @@ class AnimationPanel extends React.Component { {_t('Create')} + {_t('Edit')} + {_t('Delete')} + + - + - - - + + + @@ -85,6 +96,10 @@ class RoleManageWindow extends React.Component { app.removeElement(this); } + renderDate(value) { + return value.split(' ')[0]; + } + renderStatus(value) { return value === 0 ? '启用' : '禁用'; } diff --git a/ShadowEditor.Web/src/editor/menu/window/css/RoleManageWindow.css b/ShadowEditor.Web/src/editor/menu/window/css/RoleManageWindow.css index 256a251a..9bac909e 100644 --- a/ShadowEditor.Web/src/editor/menu/window/css/RoleManageWindow.css +++ b/ShadowEditor.Web/src/editor/menu/window/css/RoleManageWindow.css @@ -5,6 +5,16 @@ bottom: 0; } +.Window.RoleManageWindow>.wrap>.content>.Toolbar>.Button { + height: 20px; + line-height: 20px; + font-size: 12px; +} + +.Window.RoleManageWindow>.wrap>.content>.Toolbar>.SearchField { + width: 240px; +} + .Window.RoleManageWindow>.wrap>.content>.DataGrid { height: calc(100% - 25px); } \ No newline at end of file diff --git a/ShadowEditor.Web/src/ui/form/SearchField.jsx b/ShadowEditor.Web/src/ui/form/SearchField.jsx index 83816cbf..243ca0be 100644 --- a/ShadowEditor.Web/src/ui/form/SearchField.jsx +++ b/ShadowEditor.Web/src/ui/form/SearchField.jsx @@ -30,14 +30,11 @@ class SearchField extends React.Component { } render() { - const { className, style, data, placeholder, addHidden } = this.props; + const { className, style, data, placeholder, showAddButton, showFilterButton } = this.props; const { value, categories, filterShow } = this.state; return - + {showAddButton && } - - + onClick={this.handleShowFilter}>} + {showFilterButton && -1} onChange={this.handleCheckBoxChange}> {_t('No Type')} @@ -68,7 +65,7 @@ class SearchField extends React.Component { {n.Name} ; })} - + } ; } @@ -153,10 +150,11 @@ SearchField.propTypes = { value: PropTypes.string, data: PropTypes.array, placeholder: PropTypes.string, + showAddButton: PropTypes.bool, + showFilterButton: PropTypes.bool, onAdd: PropTypes.func, onChange: PropTypes.func, onInput: PropTypes.func, - addHidden: PropTypes.bool, }; SearchField.defaultProps = { @@ -165,10 +163,11 @@ SearchField.defaultProps = { value: '', data: [], placeholder: 'Enter a keyword', + showAddButton: false, + showFilterButton: false, onAdd: null, onChange: null, onInput: null, - addHidden: false, }; export default SearchField; \ No newline at end of file diff --git a/ShadowEditor.Web/src/ui/form/css/Button.css b/ShadowEditor.Web/src/ui/form/css/Button.css index 08a588f9..d9f4e03d 100644 --- a/ShadowEditor.Web/src/ui/form/css/Button.css +++ b/ShadowEditor.Web/src/ui/form/css/Button.css @@ -2,6 +2,7 @@ height: 24px; margin: 0 4px; padding: 0 8px; + line-height: 24px; color: #fff; background-color: #e74c3c; border: none; diff --git a/ShadowEditor.Web/src/ui/table/DataGrid.jsx b/ShadowEditor.Web/src/ui/table/DataGrid.jsx index 0a00300d..a4557301 100644 --- a/ShadowEditor.Web/src/ui/table/DataGrid.jsx +++ b/ShadowEditor.Web/src/ui/table/DataGrid.jsx @@ -18,45 +18,45 @@ class DataGrid extends React.Component { render() { const { className, style, children, pages, data, keyField, pageSize, pageNum, total, selected } = this.props; + // 表格列 const columns = children.props.children.map(n => { - return { - type: n.props.type, - field: n.props.field, - title: n.props.title, - renderer: n.props.renderer, - }; + return n.props; }); - const header = - - {columns.map(n => { - let field = n.type === 'number' ? 'number' : n.field; - return {n.title}; - })} - - ; - - const body = - {data.map((row, i) => { - return - {columns.map(col => { - if (col.type === 'number') { - const value = col.renderer ? col.renderer(i + 1, row, col) : (i + 1); - return {value}; - } else { - const value = col.renderer ? col.renderer(row[col.field]) : row[col.field]; - return {value}; - } + // 表格头 + const head = + + + {columns.map(n => { + let field = n.type === 'number' ? 'number' : n.field; + return {n.title}; })} - ; - })} - ; + + + ; + + // 表格体 + const body = + + {data.map((row, i) => { + return + {columns.map(col => { + if (col.type === 'number') { + const value = col.renderer ? col.renderer(i + 1, row, col) : (i + 1); + return {value}; + } else { + const value = col.renderer ? col.renderer(row[col.field]) : row[col.field]; + return {value}; + } + })} + ; + })} + + ; return - - {header} - {body} - + {head} + {body} ; } diff --git a/ShadowEditor.Web/src/ui/table/css/DataGrid.css b/ShadowEditor.Web/src/ui/table/css/DataGrid.css index f89ecc80..389d7e98 100644 --- a/ShadowEditor.Web/src/ui/table/css/DataGrid.css +++ b/ShadowEditor.Web/src/ui/table/css/DataGrid.css @@ -34,14 +34,14 @@ background-color: #3399ff; } -.DataGrid>table>thead>tr>td, +.DataGrid>table>thead>tr>th, .DataGrid>table>tbody>tr>td { padding: 0 16px; border: 1px solid #ebebeb; box-sizing: border-box; } -.DataGrid>table>thead>tr>td.number, +.DataGrid>table>thead>tr>th.number, .DataGrid>table>tbody>tr>td.number { width: 60px; } \ No newline at end of file