|
@@ -5,6 +5,7 @@
|
|
import React from 'react';
|
|
import React from 'react';
|
|
import cls from 'classnames';
|
|
import cls from 'classnames';
|
|
import PropTypes from 'prop-types';
|
|
import PropTypes from 'prop-types';
|
|
|
|
+import { get } from 'lodash';
|
|
|
|
|
|
import DateInputFoundation, {
|
|
import DateInputFoundation, {
|
|
DateInputAdapter,
|
|
DateInputAdapter,
|
|
@@ -12,6 +13,7 @@ import DateInputFoundation, {
|
|
RangeType,
|
|
RangeType,
|
|
InsetInputChangeProps,
|
|
InsetInputChangeProps,
|
|
InsetInputChangeFoundationProps,
|
|
InsetInputChangeFoundationProps,
|
|
|
|
+ InsetInputProps
|
|
} from '@douyinfe/semi-foundation/datePicker/inputFoundation';
|
|
} from '@douyinfe/semi-foundation/datePicker/inputFoundation';
|
|
import { cssClasses, strings } from '@douyinfe/semi-foundation/datePicker/constants';
|
|
import { cssClasses, strings } from '@douyinfe/semi-foundation/datePicker/constants';
|
|
import { noop } from '@douyinfe/semi-foundation/utils/function';
|
|
import { noop } from '@douyinfe/semi-foundation/utils/function';
|
|
@@ -62,7 +64,7 @@ export default class DateInput extends BaseComponent<DateInputProps, {}> {
|
|
rangeInputStartRef: PropTypes.object,
|
|
rangeInputStartRef: PropTypes.object,
|
|
rangeInputEndRef: PropTypes.object,
|
|
rangeInputEndRef: PropTypes.object,
|
|
rangeSeparator: PropTypes.string,
|
|
rangeSeparator: PropTypes.string,
|
|
- insetInput: PropTypes.bool,
|
|
|
|
|
|
+ insetInput: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),
|
|
insetInputValue: PropTypes.object,
|
|
insetInputValue: PropTypes.object,
|
|
defaultPickerValue: PropTypes.oneOfType([
|
|
defaultPickerValue: PropTypes.oneOfType([
|
|
PropTypes.string,
|
|
PropTypes.string,
|
|
@@ -202,7 +204,7 @@ export default class DateInput extends BaseComponent<DateInputProps, {}> {
|
|
aria-label="Clear range input value"
|
|
aria-label="Clear range input value"
|
|
className={`${prefixCls}-range-input-clearbtn`}
|
|
className={`${prefixCls}-range-input-clearbtn`}
|
|
onMouseDown={e => !disabled && this.handleRangeInputClear(e)}>
|
|
onMouseDown={e => !disabled && this.handleRangeInputClear(e)}>
|
|
- {clearIcon ? clearIcon :<IconClear aria-hidden />}
|
|
|
|
|
|
+ {clearIcon ? clearIcon : <IconClear aria-hidden />}
|
|
</div>
|
|
</div>
|
|
) : null;
|
|
) : null;
|
|
}
|
|
}
|
|
@@ -313,10 +315,12 @@ export default class DateInput extends BaseComponent<DateInputProps, {}> {
|
|
rangeInputStartRef,
|
|
rangeInputStartRef,
|
|
rangeInputEndRef,
|
|
rangeInputEndRef,
|
|
density,
|
|
density,
|
|
|
|
+ insetInput,
|
|
} = this.props;
|
|
} = this.props;
|
|
|
|
|
|
const _isRangeType = type.includes('Range');
|
|
const _isRangeType = type.includes('Range');
|
|
const newInsetInputValue = this.foundation.getInsetInputValue({ value, insetInputValue });
|
|
const newInsetInputValue = this.foundation.getInsetInputValue({ value, insetInputValue });
|
|
|
|
+ const { dateStart, dateEnd, timeStart, timeEnd } = get(insetInput, 'placeholder', {}) as InsetInputProps['placeholder'];
|
|
const { datePlaceholder, timePlaceholder } = this.foundation.getInsetInputPlaceholder();
|
|
const { datePlaceholder, timePlaceholder } = this.foundation.getInsetInputPlaceholder();
|
|
|
|
|
|
const insetInputWrapperCls = `${prefixCls}-inset-input-wrapper`;
|
|
const insetInputWrapperCls = `${prefixCls}-inset-input-wrapper`;
|
|
@@ -327,7 +331,7 @@ export default class DateInput extends BaseComponent<DateInputProps, {}> {
|
|
<InsetDateInput
|
|
<InsetDateInput
|
|
forwardRef={rangeInputStartRef}
|
|
forwardRef={rangeInputStartRef}
|
|
insetInputValue={newInsetInputValue}
|
|
insetInputValue={newInsetInputValue}
|
|
- placeholder={datePlaceholder}
|
|
|
|
|
|
+ placeholder={dateStart ?? datePlaceholder}
|
|
valuePath={'monthLeft.dateInput'}
|
|
valuePath={'monthLeft.dateInput'}
|
|
onChange={this.handleInsetInputChange}
|
|
onChange={this.handleInsetInputChange}
|
|
onFocus={e => handleInsetDateFocus(e, 'rangeStart')}
|
|
onFocus={e => handleInsetDateFocus(e, 'rangeStart')}
|
|
@@ -335,7 +339,7 @@ export default class DateInput extends BaseComponent<DateInputProps, {}> {
|
|
<InsetTimeInput
|
|
<InsetTimeInput
|
|
disabled={!newInsetInputValue.monthLeft.dateInput}
|
|
disabled={!newInsetInputValue.monthLeft.dateInput}
|
|
insetInputValue={newInsetInputValue}
|
|
insetInputValue={newInsetInputValue}
|
|
- placeholder={timePlaceholder}
|
|
|
|
|
|
+ placeholder={timeStart ?? timePlaceholder}
|
|
type={type}
|
|
type={type}
|
|
valuePath={'monthLeft.timeInput'}
|
|
valuePath={'monthLeft.timeInput'}
|
|
onChange={this.handleInsetInputChange}
|
|
onChange={this.handleInsetInputChange}
|
|
@@ -347,7 +351,7 @@ export default class DateInput extends BaseComponent<DateInputProps, {}> {
|
|
<InsetDateInput
|
|
<InsetDateInput
|
|
forwardRef={rangeInputEndRef}
|
|
forwardRef={rangeInputEndRef}
|
|
insetInputValue={newInsetInputValue}
|
|
insetInputValue={newInsetInputValue}
|
|
- placeholder={datePlaceholder}
|
|
|
|
|
|
+ placeholder={dateEnd ?? datePlaceholder}
|
|
valuePath={'monthRight.dateInput'}
|
|
valuePath={'monthRight.dateInput'}
|
|
onChange={this.handleInsetInputChange}
|
|
onChange={this.handleInsetInputChange}
|
|
onFocus={e => handleInsetDateFocus(e, 'rangeEnd')}
|
|
onFocus={e => handleInsetDateFocus(e, 'rangeEnd')}
|
|
@@ -355,7 +359,7 @@ export default class DateInput extends BaseComponent<DateInputProps, {}> {
|
|
<InsetTimeInput
|
|
<InsetTimeInput
|
|
disabled={!newInsetInputValue.monthRight.dateInput}
|
|
disabled={!newInsetInputValue.monthRight.dateInput}
|
|
insetInputValue={newInsetInputValue}
|
|
insetInputValue={newInsetInputValue}
|
|
- placeholder={timePlaceholder}
|
|
|
|
|
|
+ placeholder={timeEnd ?? timePlaceholder}
|
|
type={type}
|
|
type={type}
|
|
valuePath={'monthRight.timeInput'}
|
|
valuePath={'monthRight.timeInput'}
|
|
onChange={this.handleInsetInputChange}
|
|
onChange={this.handleInsetInputChange}
|