From b9af62420f872f7ff870aab82d7e0a2e1b82edd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=99=93=E9=9D=99?= <17600756968@163.com> Date: Mon, 20 Jul 2020 16:01:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E6=9C=9F=E7=BB=84=E4=BB=B6=E5=A4=B1?= =?UTF-8?q?=E5=8E=BB=E7=84=A6=E7=82=B9=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apolloTable/component/base/edit/date/index.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/components/apolloTable/component/base/edit/date/index.tsx b/components/apolloTable/component/base/edit/date/index.tsx index 774c069..07be80f 100644 --- a/components/apolloTable/component/base/edit/date/index.tsx +++ b/components/apolloTable/component/base/edit/date/index.tsx @@ -5,7 +5,7 @@ import { antiAssign } from '../../../../utils/utils'; import styles from './styles.less'; export const ApolloDate = (props: any) => { - const { origin, onChange } = props; + const { origin, onChange, showTime } = props; const selfProps = antiAssign(props, ['onChange', 'columnConfig']); const isOpen = useRef(); const changeValue = (date, dateString) => { @@ -16,9 +16,15 @@ export const ApolloDate = (props: any) => { onChange(date, dateString); } }; - const inputOnBlurFn = (e: boolean) => { + const dateOnBlurFn = (e: boolean) => { isOpen.current = e; }; + const timeOnBlurFn = (e: boolean) => { + isOpen.current = e; + if (typeof onBlurFn === 'function' && !e) { + onBlurFn(props); + } + }; return (origin === 'editForm' ? { popupStyle={{ width: '350px' }} {...selfProps} onChange={changeValue} - onOpenChange={inputOnBlurFn} + onOpenChange={showTime ? timeOnBlurFn : dateOnBlurFn} /> :