Skip to content

Commit

Permalink
feat(date-picker): remove inline on <DatePicker> (#1892)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonguo committed Sep 9, 2021
1 parent fdba307 commit 83a77df
Show file tree
Hide file tree
Showing 5 changed files with 235 additions and 105 deletions.
1 change: 0 additions & 1 deletion docs/pages/components/date-picker/en-US/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ Learn more in [Accessibility](/guide/accessibility).
| hideHours | (hour:number, date:Date) => boolean | Hidden hours |
| hideMinutes | (minute:number, date:Date) => boolean | Hidden minutes |
| hideSeconds | (second:number, date:Date) => boolean | Hidden seconds |
| inline | boolean | Display date panel when component initial |
| isoWeek | boolean | ISO 8601 standard, each calendar week begins on Monday and Sunday on the seventh day |
| limitEndYear | number `(1000)` | Set the lower limit of the available year relative to the current selection date |
| locale | [CalendarLocaleType](/guide/i18n/#calendar) | Locale text |
Expand Down
1 change: 0 additions & 1 deletion docs/pages/components/date-picker/zh-CN/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@
| hideHours | (hour:number, date:Date) => boolean | 隐藏小时 |
| hideMinutes | (minute:number, date:Date) => boolean | 隐藏分钟 |
| hideSeconds | (second:number, date:Date) => boolean | 隐藏秒 |
| inline | boolean | 默认显示日历面板 |
| isoWeek | boolean | ISO 8601 标准, 每个日历星期从星期一开始,星期日为第 7 天 |
| limitEndYear | number `(1000)` | 相对当前选择日期,设置可选年份下限 |
| locale | [CalendarLocaleType](/zh/guide/i18n/#calendar) | 本地化的文本 |
Expand Down
18 changes: 6 additions & 12 deletions src/DatePicker/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ export interface DatePickerProps
/** Format date */
format?: string;

/** Display date panel when component initial */
/**
* Display date panel when component initial
*
* @deprecated use <Calendar> instead
**/
inline?: boolean;

/** ISO 8601 standard, each calendar week begins on Monday and Sunday on the seventh day */
Expand Down Expand Up @@ -141,7 +145,6 @@ const DatePicker: RsRefForwardingComponent<'div', DatePickerProps> = React.forwa
defaultValue,
disabled,
format: formatStr,
inline,
isoWeek,
limitEndYear,
locale: overrideLocale,
Expand Down Expand Up @@ -177,7 +180,7 @@ const DatePicker: RsRefForwardingComponent<'div', DatePickerProps> = React.forwa
'DatePicker',
overrideLocale
);
const { merge, prefix, withClassPrefix } = useClassNames(classPrefix);
const { merge, prefix } = useClassNames(classPrefix);

const [value, setValue] = useControlled<Date>(valueProp, defaultValue);
const { calendarDate, setCalendarDate } = useCalendarDate(valueProp, calendarDefaultDate);
Expand Down Expand Up @@ -540,14 +543,6 @@ const DatePicker: RsRefForwardingComponent<'div', DatePickerProps> = React.forwa
[formatStr]
);

if (inline) {
return (
<Component ref={rootRef} className={merge(className, withClassPrefix('date-inline'))}>
{calendar}
</Component>
);
}

return (
<PickerToggleTrigger
trigger="active"
Expand Down Expand Up @@ -607,7 +602,6 @@ DatePicker.propTypes = {
hideHours: PropTypes.func,
hideMinutes: PropTypes.func,
hideSeconds: PropTypes.func,
inline: PropTypes.bool,
isoWeek: PropTypes.bool,
limitEndYear: PropTypes.number,
onChange: PropTypes.func,
Expand Down
Loading

0 comments on commit 83a77df

Please sign in to comment.