You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.7 KiB
62 lines
1.7 KiB
import "antd/es/space/style";
|
|
import _Space from "antd/es/space";
|
|
import "antd/es/button/style";
|
|
import _Button from "antd/es/button";
|
|
import React from 'react';
|
|
import { useIntl } from '@ant-design/pro-provider';
|
|
/**
|
|
* FormFooter 的组件,可以自动进行一些配置
|
|
* @param props
|
|
*/
|
|
|
|
var Submitter = function Submitter(props) {
|
|
var intl = useIntl();
|
|
|
|
if (props.render === false) {
|
|
return null;
|
|
}
|
|
|
|
var form = props.form,
|
|
onSubmit = props.onSubmit,
|
|
render = props.render,
|
|
onReset = props.onReset,
|
|
_props$searchConfig = props.searchConfig,
|
|
searchConfig = _props$searchConfig === void 0 ? {} : _props$searchConfig;
|
|
var _searchConfig$submitT = searchConfig.submitText,
|
|
submitText = _searchConfig$submitT === void 0 ? intl.getMessage('tableForm.submit', '提交') : _searchConfig$submitT,
|
|
_searchConfig$resetTe = searchConfig.resetText,
|
|
resetText = _searchConfig$resetTe === void 0 ? intl.getMessage('tableForm.reset', '重置') : _searchConfig$resetTe;
|
|
/**
|
|
* 默认的操作的逻辑
|
|
*/
|
|
|
|
var dom = [/*#__PURE__*/React.createElement(_Button, {
|
|
key: "rest",
|
|
onClick: function onClick() {
|
|
form.resetFields();
|
|
|
|
if (onReset) {
|
|
onReset();
|
|
}
|
|
}
|
|
}, resetText), /*#__PURE__*/React.createElement(_Button, {
|
|
key: "submit",
|
|
type: "primary",
|
|
onClick: function onClick() {
|
|
form.submit();
|
|
|
|
if (onSubmit) {
|
|
onSubmit();
|
|
}
|
|
}
|
|
}, submitText)];
|
|
var renderDom = render ? render(props, dom) : dom;
|
|
|
|
if (!renderDom || renderDom.length < 1) {
|
|
return null;
|
|
}
|
|
|
|
return /*#__PURE__*/React.createElement(_Space, null, renderDom);
|
|
};
|
|
|
|
export default Submitter; |