@cqsjjb/jjb-react-admin-component 3.0.6 → 3.0.7
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.js +2 -2
- package/SearchForm/index.mjs +52 -39
- package/package.json +1 -1
package/SearchForm/index.js
CHANGED
|
@@ -75,7 +75,7 @@ class searchForm extends React.Component {
|
|
|
75
75
|
onFinish
|
|
76
76
|
} = this.props;
|
|
77
77
|
const formItemList = this.groupsList();
|
|
78
|
-
return /*#__PURE__*/React.createElement(Form, {
|
|
78
|
+
return formItemList.length > 0 ? /*#__PURE__*/React.createElement(Form, {
|
|
79
79
|
ref: form || this.form,
|
|
80
80
|
style: style,
|
|
81
81
|
initialValues: initialValues,
|
|
@@ -92,7 +92,7 @@ class searchForm extends React.Component {
|
|
|
92
92
|
span: 24 / colSize
|
|
93
93
|
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
94
94
|
noStyle: true
|
|
95
|
-
}, this.getButtons()))));
|
|
95
|
+
}, this.getButtons())))) : /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
searchForm.defaultProps = {
|
package/SearchForm/index.mjs
CHANGED
|
@@ -33,8 +33,12 @@ class searchForm extends React.Component {
|
|
|
33
33
|
icon={<UndoOutlined />}
|
|
34
34
|
loading={loading}
|
|
35
35
|
onClick={() => {
|
|
36
|
-
form
|
|
37
|
-
|
|
36
|
+
form
|
|
37
|
+
? form.current.resetFields()
|
|
38
|
+
: this.form.current.resetFields();
|
|
39
|
+
onReset(form
|
|
40
|
+
? form.current.getFieldsValue()
|
|
41
|
+
: this.form.current.getFieldsValue());
|
|
38
42
|
}}
|
|
39
43
|
>
|
|
40
44
|
重置
|
|
@@ -62,24 +66,24 @@ class searchForm extends React.Component {
|
|
|
62
66
|
}
|
|
63
67
|
|
|
64
68
|
groupsList () {
|
|
65
|
-
const arr = []
|
|
66
|
-
this.props.formLine.forEach(i=>{
|
|
69
|
+
const arr = [];
|
|
70
|
+
this.props.formLine.forEach(i => {
|
|
67
71
|
arr.push({
|
|
68
72
|
show: true,
|
|
69
73
|
node: i
|
|
70
|
-
})
|
|
71
|
-
})
|
|
74
|
+
});
|
|
75
|
+
});
|
|
72
76
|
if (this.props.expand && this.state.isOpen) {
|
|
73
77
|
return arr;
|
|
74
78
|
}
|
|
75
|
-
if(!this.props.expand && arr.length>3){
|
|
79
|
+
if (!this.props.expand && arr.length > 3) {
|
|
76
80
|
return arr;
|
|
77
81
|
}
|
|
78
|
-
arr.forEach((i,index)=> {
|
|
79
|
-
if(index>2){
|
|
80
|
-
i.show=false
|
|
82
|
+
arr.forEach((i, index) => {
|
|
83
|
+
if (index > 2) {
|
|
84
|
+
i.show = false;
|
|
81
85
|
}
|
|
82
|
-
})
|
|
86
|
+
});
|
|
83
87
|
return arr;
|
|
84
88
|
}
|
|
85
89
|
|
|
@@ -98,31 +102,37 @@ class searchForm extends React.Component {
|
|
|
98
102
|
onFinish
|
|
99
103
|
} = this.props;
|
|
100
104
|
const formItemList = this.groupsList();
|
|
101
|
-
return
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
{
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
105
|
+
return formItemList.length > 0
|
|
106
|
+
? (
|
|
107
|
+
<Form
|
|
108
|
+
ref={form || this.form}
|
|
109
|
+
style={style}
|
|
110
|
+
initialValues={initialValues}
|
|
111
|
+
onFinish={values => onFinish(values)}
|
|
112
|
+
>
|
|
113
|
+
<Row gutter={[ 16, 16 ]}>
|
|
114
|
+
{formItemList.map((item, index) => (
|
|
115
|
+
<Col
|
|
116
|
+
style={{
|
|
117
|
+
display: item.show
|
|
118
|
+
? 'block'
|
|
119
|
+
: 'none'
|
|
120
|
+
}}
|
|
121
|
+
key={index}
|
|
122
|
+
span={24 / colSize}
|
|
123
|
+
>
|
|
124
|
+
{item.node}
|
|
125
|
+
</Col>
|
|
126
|
+
))}
|
|
127
|
+
<Col span={24 / colSize}>
|
|
128
|
+
<Form.Item noStyle>
|
|
129
|
+
{this.getButtons()}
|
|
130
|
+
</Form.Item>
|
|
116
131
|
</Col>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
</Form.Item>
|
|
122
|
-
</Col>
|
|
123
|
-
</Row>
|
|
124
|
-
</Form>
|
|
125
|
-
);
|
|
132
|
+
</Row>
|
|
133
|
+
</Form>
|
|
134
|
+
)
|
|
135
|
+
: <></>;
|
|
126
136
|
}
|
|
127
137
|
}
|
|
128
138
|
|
|
@@ -133,9 +143,12 @@ searchForm.defaultProps = {
|
|
|
133
143
|
loading: false,
|
|
134
144
|
formLine: [],
|
|
135
145
|
initialValues: {},
|
|
136
|
-
onRef: () => {
|
|
137
|
-
|
|
138
|
-
|
|
146
|
+
onRef: () => {
|
|
147
|
+
},
|
|
148
|
+
onReset: () => {
|
|
149
|
+
},
|
|
150
|
+
onFinish: () => {
|
|
151
|
+
}
|
|
139
152
|
};
|
|
140
153
|
searchForm.propTypes = {
|
|
141
154
|
form: PropTypes.object,
|
|
@@ -147,6 +160,6 @@ searchForm.propTypes = {
|
|
|
147
160
|
initialValues: PropTypes.object,
|
|
148
161
|
onRef: PropTypes.func,
|
|
149
162
|
onReset: PropTypes.func,
|
|
150
|
-
onFinish: PropTypes.func
|
|
163
|
+
onFinish: PropTypes.func
|
|
151
164
|
};
|
|
152
165
|
export default searchForm;
|