@cqsjjb/jjb-react-admin-component 3.0.4 → 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 +11 -2
- package/SearchForm/index.mjs +11 -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: {
|
|
@@ -47,6 +51,9 @@ class searchForm extends React.Component {
|
|
|
47
51
|
if (this.props.expand && this.state.isOpen) {
|
|
48
52
|
return arr;
|
|
49
53
|
}
|
|
54
|
+
if (!this.props.expand && arr.length > 3) {
|
|
55
|
+
return arr;
|
|
56
|
+
}
|
|
50
57
|
arr.forEach((i, index) => {
|
|
51
58
|
if (index > 2) {
|
|
52
59
|
i.show = false;
|
|
@@ -61,6 +68,7 @@ class searchForm extends React.Component {
|
|
|
61
68
|
}
|
|
62
69
|
render() {
|
|
63
70
|
const {
|
|
71
|
+
form,
|
|
64
72
|
style,
|
|
65
73
|
colSize,
|
|
66
74
|
initialValues,
|
|
@@ -68,7 +76,7 @@ class searchForm extends React.Component {
|
|
|
68
76
|
} = this.props;
|
|
69
77
|
const formItemList = this.groupsList();
|
|
70
78
|
return /*#__PURE__*/React.createElement(Form, {
|
|
71
|
-
ref: this.form,
|
|
79
|
+
ref: form || this.form,
|
|
72
80
|
style: style,
|
|
73
81
|
initialValues: initialValues,
|
|
74
82
|
onFinish: values => onFinish(values)
|
|
@@ -99,6 +107,7 @@ searchForm.defaultProps = {
|
|
|
99
107
|
onFinish: () => {}
|
|
100
108
|
};
|
|
101
109
|
searchForm.propTypes = {
|
|
110
|
+
form: PropTypes.object,
|
|
102
111
|
style: PropTypes.object,
|
|
103
112
|
expand: PropTypes.bool,
|
|
104
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>
|
|
@@ -68,6 +72,9 @@ class searchForm extends React.Component {
|
|
|
68
72
|
if (this.props.expand && this.state.isOpen) {
|
|
69
73
|
return arr;
|
|
70
74
|
}
|
|
75
|
+
if(!this.props.expand && arr.length>3){
|
|
76
|
+
return arr;
|
|
77
|
+
}
|
|
71
78
|
arr.forEach((i,index)=> {
|
|
72
79
|
if(index>2){
|
|
73
80
|
i.show=false
|
|
@@ -84,6 +91,7 @@ class searchForm extends React.Component {
|
|
|
84
91
|
|
|
85
92
|
render () {
|
|
86
93
|
const {
|
|
94
|
+
form,
|
|
87
95
|
style,
|
|
88
96
|
colSize,
|
|
89
97
|
initialValues,
|
|
@@ -92,7 +100,7 @@ class searchForm extends React.Component {
|
|
|
92
100
|
const formItemList = this.groupsList();
|
|
93
101
|
return (
|
|
94
102
|
<Form
|
|
95
|
-
ref={this.form}
|
|
103
|
+
ref={ form || this.form}
|
|
96
104
|
style={style}
|
|
97
105
|
initialValues={initialValues}
|
|
98
106
|
onFinish={values => onFinish(values)}
|
|
@@ -130,6 +138,7 @@ searchForm.defaultProps = {
|
|
|
130
138
|
onFinish: () => {},
|
|
131
139
|
};
|
|
132
140
|
searchForm.propTypes = {
|
|
141
|
+
form: PropTypes.object,
|
|
133
142
|
style: PropTypes.object,
|
|
134
143
|
expand: PropTypes.bool,
|
|
135
144
|
colSize: PropTypes.number,
|