From 79f72f1c8a3bd5a47015be87f342fcabd99212aa Mon Sep 17 00:00:00 2001 From: leexsoft-mac Date: Mon, 18 May 2020 16:46:16 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/field/search/date_time.js | 2 +- lib/page/search.d.ts | 10 ++--- lib/page/search.js | 14 +++++-- src/field/search/date_time.tsx | 1 + src/page/search.tsx | 75 ++++++++++++++++++++++------------ 5 files changed, 65 insertions(+), 37 deletions(-) diff --git a/lib/field/search/date_time.js b/lib/field/search/date_time.js index 07c45cb..940ff0c 100644 --- a/lib/field/search/date_time.js +++ b/lib/field/search/date_time.js @@ -73,7 +73,7 @@ class DateTime extends React.PureComponent { const endTime = field.options.endTimeValue > 0 ? moment_1.default(field.options.endTimeValue * this._timestampScale()) : undefined; return (React.createElement(antd_1.Form.Item, { label: label }, form.getFieldDecorator(Storage.Prefix + field.name, { initialValue: [startTime, endTime], - })(React.createElement(RangePicker, { onChange: this._onChange, format: field.options.dateFormat, showTime: field.options.hasTime })))); + })(React.createElement(RangePicker, { onChange: this._onChange, format: field.options.dateFormat, showTime: field.options.hasTime, style: { width: "auto" } })))); } } Storage.set(Field.DateTime.Type, (option) => React.createElement(DateTime, Object.assign({}, option))); diff --git a/lib/page/search.d.ts b/lib/page/search.d.ts index a0a6441..00b82fb 100644 --- a/lib/page/search.d.ts +++ b/lib/page/search.d.ts @@ -7,13 +7,13 @@ interface Props { */ title?: React.ReactNode; /** - * 按钮列的列宽。 + * 按钮新行。 */ - buttonSpan: number; + buttonNewRow: boolean; /** - * 按钮列的对齐。 + * 按钮列的列宽,仅在buttonNewRow=false时生效。 */ - buttonAlign: 'right' | 'left' | 'center' | undefined; + buttonSpan: number; /** * 字段列表。 */ @@ -50,5 +50,5 @@ declare class SearchComponent extends React.PureComponent) => void; _onReset: (e: React.MouseEvent) => void; } -declare const _default: import("antd/lib/form/interface").ConnectedComponentClass>; +declare const _default: import("antd/lib/form/interface").ConnectedComponentClass>; export default _default; diff --git a/lib/page/search.js b/lib/page/search.js index 4630c3e..9652c94 100644 --- a/lib/page/search.js +++ b/lib/page/search.js @@ -58,11 +58,17 @@ class SearchComponent extends React.PureComponent { return (React.createElement(antd_1.Collapse, { accordion: true, defaultActiveKey: "1", className: "xc-search-form", expandIconPosition: "right", expandIcon: ({ isActive }) => React.createElement(antd_1.Icon, { type: "caret-right", rotate: isActive ? 90 : 0 }) }, React.createElement(Panel, { header: this.props.title, key: "1" }, React.createElement(antd_1.Form, { onSubmit: this._onSubmit }, - React.createElement(antd_1.Row, { gutter: [16, 8] }, + React.createElement(antd_1.Row, { gutter: [8, 8] }, this._renderFields(), - React.createElement(antd_1.Col, { span: this.props.buttonSpan, style: { textAlign: this.props.buttonAlign } }, - React.createElement(antd_1.Button, { className: "xc-button-search", icon: "search", type: "primary", htmlType: "submit" }, "搜索"), - React.createElement(antd_1.Button, { className: "xc-button-reset", icon: "redo", type: "default", onClick: this._onReset }, "重置"))))))); + !this.props.buttonNewRow && + React.createElement(antd_1.Col, { span: this.props.buttonSpan, style: { textAlign: "right" } }, + React.createElement(antd_1.Button, { className: "xc-button-search", icon: "search", type: "primary", htmlType: "submit" }, "搜索"), + React.createElement(antd_1.Button, { className: "xc-button-reset", icon: "redo", type: "default", onClick: this._onReset }, "重置"))), + this.props.buttonNewRow && + React.createElement(antd_1.Row, null, + React.createElement(antd_1.Col, { style: { textAlign: "right" } }, + React.createElement(antd_1.Button, { className: "xc-button-search", icon: "search", type: "primary", htmlType: "submit" }, "搜索"), + React.createElement(antd_1.Button, { className: "xc-button-reset", icon: "redo", type: "default", onClick: this._onReset }, "重置"))))))); } } SearchComponent.defaultProps = { diff --git a/src/field/search/date_time.tsx b/src/field/search/date_time.tsx index 38bafd8..328a7a5 100644 --- a/src/field/search/date_time.tsx +++ b/src/field/search/date_time.tsx @@ -28,6 +28,7 @@ class DateTime extends React.PureComponent { onChange={this._onChange} format={field.options.dateFormat} showTime={field.options.hasTime} + style={{ width: "auto" }} /> )} diff --git a/src/page/search.tsx b/src/page/search.tsx index a0c8a41..0b9695f 100644 --- a/src/page/search.tsx +++ b/src/page/search.tsx @@ -12,13 +12,13 @@ interface Props { */ title?: React.ReactNode; /** - * 按钮列的列宽。 + * 按钮新行。 */ - buttonSpan: number; + buttonNewRow: boolean; /** - * 按钮列的对齐。 + * 按钮列的列宽,仅在buttonNewRow=false时生效。 */ - buttonAlign: 'right' | 'left' | 'center' | undefined; + buttonSpan: number; /** * 字段列表。 */ @@ -61,33 +61,54 @@ class SearchComponent extends React.PureComponent { >
- + {this._renderFields()} - - - - + {!this.props.buttonNewRow && + + + + + } + {this.props.buttonNewRow && + + + + + + + }
- + ); } -- Gitee From 5c79f55070871cd8da7eb39e098812e82ca0be75 Mon Sep 17 00:00:00 2001 From: leexsoft-mac Date: Mon, 18 May 2020 17:16:23 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B42?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/page/search.js | 6 +++--- src/page/search.tsx | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/page/search.js b/lib/page/search.js index 9652c94..7607b5a 100644 --- a/lib/page/search.js +++ b/lib/page/search.js @@ -58,15 +58,15 @@ class SearchComponent extends React.PureComponent { return (React.createElement(antd_1.Collapse, { accordion: true, defaultActiveKey: "1", className: "xc-search-form", expandIconPosition: "right", expandIcon: ({ isActive }) => React.createElement(antd_1.Icon, { type: "caret-right", rotate: isActive ? 90 : 0 }) }, React.createElement(Panel, { header: this.props.title, key: "1" }, React.createElement(antd_1.Form, { onSubmit: this._onSubmit }, - React.createElement(antd_1.Row, { gutter: [8, 8] }, + React.createElement(antd_1.Row, { gutter: [16, 8] }, this._renderFields(), !this.props.buttonNewRow && - React.createElement(antd_1.Col, { span: this.props.buttonSpan, style: { textAlign: "right" } }, + React.createElement(antd_1.Col, { span: this.props.buttonSpan, className: "xc-button-col" }, React.createElement(antd_1.Button, { className: "xc-button-search", icon: "search", type: "primary", htmlType: "submit" }, "搜索"), React.createElement(antd_1.Button, { className: "xc-button-reset", icon: "redo", type: "default", onClick: this._onReset }, "重置"))), this.props.buttonNewRow && React.createElement(antd_1.Row, null, - React.createElement(antd_1.Col, { style: { textAlign: "right" } }, + React.createElement(antd_1.Col, { className: "xc-button-col" }, React.createElement(antd_1.Button, { className: "xc-button-search", icon: "search", type: "primary", htmlType: "submit" }, "搜索"), React.createElement(antd_1.Button, { className: "xc-button-reset", icon: "redo", type: "default", onClick: this._onReset }, "重置"))))))); } diff --git a/src/page/search.tsx b/src/page/search.tsx index 0b9695f..2aaafff 100644 --- a/src/page/search.tsx +++ b/src/page/search.tsx @@ -61,10 +61,10 @@ class SearchComponent extends React.PureComponent { >
- + {this._renderFields()} {!this.props.buttonNewRow && - + - - - +
+ + +
}
-- Gitee From a3e7d8baa516b7f975d13c1934e09e9b4bbe6efb Mon Sep 17 00:00:00 2001 From: leexsoft-mac Date: Mon, 18 May 2020 17:33:36 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B44?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/page/search.js | 2 +- src/page/search.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/page/search.js b/lib/page/search.js index f34ac18..08b6f15 100644 --- a/lib/page/search.js +++ b/lib/page/search.js @@ -58,7 +58,7 @@ class SearchComponent extends React.PureComponent { return (React.createElement(antd_1.Collapse, { accordion: true, defaultActiveKey: "1", className: "xc-search-form", expandIconPosition: "right", expandIcon: ({ isActive }) => React.createElement(antd_1.Icon, { type: "caret-right", rotate: isActive ? 90 : 0 }) }, React.createElement(Panel, { header: this.props.title, key: "1" }, React.createElement(antd_1.Form, { onSubmit: this._onSubmit }, - React.createElement(antd_1.Row, { gutter: [16, 8] }, + React.createElement(antd_1.Row, { gutter: 8 }, this._renderFields(), !this.props.buttonNewRow && React.createElement(antd_1.Col, { span: this.props.buttonSpan, style: { textAlign: "right" } }, diff --git a/src/page/search.tsx b/src/page/search.tsx index 147b566..23b5a49 100644 --- a/src/page/search.tsx +++ b/src/page/search.tsx @@ -61,7 +61,7 @@ class SearchComponent extends React.PureComponent { >
- + {this._renderFields()} {!this.props.buttonNewRow && -- Gitee