Commit ce05efcc authored by 李晓静's avatar 李晓静

时间区间组件修改

parents 8ec56b67 8fb5d5cb
import React from 'react';
import React, { useRef } from 'react';
import { DatePicker } from 'antd';
import styles from './styles.less';
import { onBlurFn } from '../onBlurFn';
import { antiAssign } from '../../../../utils/utils';
import styles from './styles.less';
const { RangePicker } = DatePicker;
export const ApolloDateRange = (props: any) => {
const { onChange, placeholder, beginDatePlaceholder, endDatePlaceholder } = props;
const { onChange, placeholder, showTime, beginDatePlaceholder, endDatePlaceholder, origin } = props;
const selfProps = antiAssign(props, ['onChange', 'columnConfig']);
const changeValue = (dates, dateStrings) => {
const isOpen = useRef();
const changeValue = (date, dateString) => {
if (typeof onChange === 'function') {
onChange(dates, dateStrings);
if (typeof onBlurFn === 'function' && !isOpen.current) {
onBlurFn({ ...props, value: date });
}
onChange(date, dateString);
}
};
const dateOnBlurFn = (e: boolean) => {
isOpen.current = e;
};
const timeOnBlurFn = (e: boolean) => {
isOpen.current = e;
if (typeof onBlurFn === 'function' && !e) {
onBlurFn(props);
}
};
return (
return (origin === 'editForm' ?
<RangePicker
className={styles.date}
dropdownClassName={styles.dropdownClassName}
// popupStyle={{ width: '350px' }}
{...selfProps}
placeholder={[beginDatePlaceholder || placeholder, endDatePlaceholder || placeholder]}
onChange={changeValue}
onOpenChange={showTime ? timeOnBlurFn : dateOnBlurFn}
/> :
<RangePicker
className={styles.date}
dropdownClassName={styles.dropdownClassName}
......
......@@ -2,9 +2,8 @@
.wrap {
position: relative;
// width: 580px;
width: 100%;
min-width: 580px;
.titleCls {
position: absolute;
left: 26px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment