var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { Button, Space } from 'antd'; import { FooterToolbar, ProForm } from '@ant-design/pro-components'; import { useRoutes } from '@component/utils'; import routes from 'routes'; import { find } from 'lodash'; import { useLocation, useNavigate } from 'react-router-dom'; import { urlCacheData } from '@component/app'; import { stringify } from 'query-string'; export function GridForm(_a) { var { children, renderAction, isExit = true, submitter } = _a, props = __rest(_a, ["children", "renderAction", "isExit", "submitter"]); const location = useLocation(); const navigate = useNavigate(); function onCancel() { const item = find(routes, (item) => location.pathname === '/app/' + item.path); const path = '/app/' + item.auth; if (urlCacheData.has(path)) { const values = urlCacheData.get(path); urlCacheData.del(path); navigate(path + '?' + stringify(values)); } else { navigate(path); } } return (_jsx(ProForm, Object.assign({ className: "cciCgridForm", colon: false, labelWrap: true, grid: true, colProps: { span: 12, }, labelCol: { span: 6, // xl: 7, // xxl: 5, // lg: 8, }, labelAlign: "left", layout: "horizontal", submitter: Object.assign({ render: (_, dom) => (_jsx(FooterToolbar, { children: _jsxs(Space, { children: [renderAction && renderAction(), dom[1], isExit && (_jsx(Button, Object.assign({ danger: true, type: "button", onClick: onCancel }, { children: "\u9000\u51FA" })))] }) })) }, submitter) }, props, { children: children }))); }