@cqsjjb/jjb-react-admin-component 3.0.5 → 3.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SearchForm/index.d.ts +5 -1
- package/SearchForm/index.js +8 -2
- package/SearchForm/index.mjs +8 -2
- package/package.json +1 -1
package/SearchForm/index.d.ts
CHANGED
|
@@ -3,6 +3,10 @@ import * as React from 'react';
|
|
|
3
3
|
import { ComponentProps } from '../types';
|
|
4
4
|
|
|
5
5
|
interface searchFormProps extends ComponentProps {
|
|
6
|
+
/**
|
|
7
|
+
* @description form实例
|
|
8
|
+
*/
|
|
9
|
+
form?: any,
|
|
6
10
|
/**
|
|
7
11
|
* @description 样式
|
|
8
12
|
*/
|
|
@@ -38,7 +42,7 @@ interface searchFormProps extends ComponentProps {
|
|
|
38
42
|
/**
|
|
39
43
|
* @description 重置 按钮触发
|
|
40
44
|
*/
|
|
41
|
-
onReset?: () => void;
|
|
45
|
+
onReset?: (values: { [ p: string ]: any }) => void;
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
interface searchFormFc extends React.FC<searchFormProps> {
|
package/SearchForm/index.js
CHANGED
|
@@ -10,6 +10,7 @@ class searchForm extends React.Component {
|
|
|
10
10
|
};
|
|
11
11
|
getButtons() {
|
|
12
12
|
const {
|
|
13
|
+
form,
|
|
13
14
|
expand,
|
|
14
15
|
formLine,
|
|
15
16
|
colSize,
|
|
@@ -24,7 +25,10 @@ class searchForm extends React.Component {
|
|
|
24
25
|
}, "\u67E5\u8BE2"), /*#__PURE__*/React.createElement(Button, {
|
|
25
26
|
icon: /*#__PURE__*/React.createElement(UndoOutlined, null),
|
|
26
27
|
loading: loading,
|
|
27
|
-
onClick: () =>
|
|
28
|
+
onClick: () => {
|
|
29
|
+
form ? form.current.resetFields() : this.form.current.resetFields();
|
|
30
|
+
onReset(form ? form.current.getFieldsValue() : this.form.current.getFieldsValue());
|
|
31
|
+
}
|
|
28
32
|
}, "\u91CD\u7F6E"), expand && formLine.length / colSize > 1 && /*#__PURE__*/React.createElement(Button, {
|
|
29
33
|
icon: /*#__PURE__*/React.createElement(DoubleRightOutlined, {
|
|
30
34
|
style: {
|
|
@@ -64,6 +68,7 @@ class searchForm extends React.Component {
|
|
|
64
68
|
}
|
|
65
69
|
render() {
|
|
66
70
|
const {
|
|
71
|
+
form,
|
|
67
72
|
style,
|
|
68
73
|
colSize,
|
|
69
74
|
initialValues,
|
|
@@ -71,7 +76,7 @@ class searchForm extends React.Component {
|
|
|
71
76
|
} = this.props;
|
|
72
77
|
const formItemList = this.groupsList();
|
|
73
78
|
return /*#__PURE__*/React.createElement(Form, {
|
|
74
|
-
ref: this.form,
|
|
79
|
+
ref: form || this.form,
|
|
75
80
|
style: style,
|
|
76
81
|
initialValues: initialValues,
|
|
77
82
|
onFinish: values => onFinish(values)
|
|
@@ -102,6 +107,7 @@ searchForm.defaultProps = {
|
|
|
102
107
|
onFinish: () => {}
|
|
103
108
|
};
|
|
104
109
|
searchForm.propTypes = {
|
|
110
|
+
form: PropTypes.object,
|
|
105
111
|
style: PropTypes.object,
|
|
106
112
|
expand: PropTypes.bool,
|
|
107
113
|
colSize: PropTypes.number,
|
package/SearchForm/index.mjs
CHANGED
|
@@ -12,6 +12,7 @@ class searchForm extends React.Component {
|
|
|
12
12
|
|
|
13
13
|
getButtons () {
|
|
14
14
|
const {
|
|
15
|
+
form,
|
|
15
16
|
expand,
|
|
16
17
|
formLine,
|
|
17
18
|
colSize,
|
|
@@ -31,7 +32,10 @@ class searchForm extends React.Component {
|
|
|
31
32
|
<Button
|
|
32
33
|
icon={<UndoOutlined />}
|
|
33
34
|
loading={loading}
|
|
34
|
-
onClick={() =>
|
|
35
|
+
onClick={() => {
|
|
36
|
+
form?form.current.resetFields():this.form.current.resetFields()
|
|
37
|
+
onReset(form?form.current.getFieldsValue():this.form.current.getFieldsValue())
|
|
38
|
+
}}
|
|
35
39
|
>
|
|
36
40
|
重置
|
|
37
41
|
</Button>
|
|
@@ -87,6 +91,7 @@ class searchForm extends React.Component {
|
|
|
87
91
|
|
|
88
92
|
render () {
|
|
89
93
|
const {
|
|
94
|
+
form,
|
|
90
95
|
style,
|
|
91
96
|
colSize,
|
|
92
97
|
initialValues,
|
|
@@ -95,7 +100,7 @@ class searchForm extends React.Component {
|
|
|
95
100
|
const formItemList = this.groupsList();
|
|
96
101
|
return (
|
|
97
102
|
<Form
|
|
98
|
-
ref={this.form}
|
|
103
|
+
ref={ form || this.form}
|
|
99
104
|
style={style}
|
|
100
105
|
initialValues={initialValues}
|
|
101
106
|
onFinish={values => onFinish(values)}
|
|
@@ -133,6 +138,7 @@ searchForm.defaultProps = {
|
|
|
133
138
|
onFinish: () => {},
|
|
134
139
|
};
|
|
135
140
|
searchForm.propTypes = {
|
|
141
|
+
form: PropTypes.object,
|
|
136
142
|
style: PropTypes.object,
|
|
137
143
|
expand: PropTypes.bool,
|
|
138
144
|
colSize: PropTypes.number,
|