Skip to content

Commit

Permalink
fix(datepicker): fix single panel with enable-time-picker not availab…
Browse files Browse the repository at this point in the history
…le (Tencent#2353)

* fix(datepicker): fix single panel with enable-time-picker not available

* fix(datepicker): edit the type of popupVisible

* refactor(date-picker): change popupVisible from props into attrs
  • Loading branch information
Ericleungs authored and methodchen committed Aug 25, 2023
1 parent 448fff4 commit a0daf7d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/date-picker/DatePickerPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default defineComponent({
timePickerProps: datePickerProps.timePickerProps,
...datePickerPanelProps,
},
setup(props: TdDatePickerPanelProps, { emit }) {
setup(props: TdDatePickerPanelProps, { emit, attrs }) {
const {
cacheValue, value, year, month, time, onChange,
} = useSingleValue(props);
Expand Down Expand Up @@ -226,6 +226,8 @@ export default defineComponent({
timePickerProps: props.timePickerProps,
enableTimePicker: props.enableTimePicker,
presetsPlacement: props.presetsPlacement,
// 该属性在单独使用此panel时无特别意义, 不应该暴露为props
popupVisible: (attrs?.popupVisible as Boolean) ?? true,
onPanelClick,
onCellClick,
onJumperClick,
Expand Down
4 changes: 3 additions & 1 deletion src/date-picker/DateRangePickerPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default defineComponent({
panelPreselection: dateRangePickerProps.panelPreselection,
...dateRangePickerPanelProps,
},
setup(props: TdDateRangePickerPanelProps, { emit }) {
setup(props: TdDateRangePickerPanelProps, { emit, attrs }) {
const {
value, year, month, time, cacheValue, isFirstValueSelected, onChange,
} = useRangeValue(props);
Expand Down Expand Up @@ -374,6 +374,8 @@ export default defineComponent({
enableTimePicker: props.enableTimePicker,
presetsPlacement: props.presetsPlacement,
panelPreselection: props.panelPreselection,
// 该属性本身主要是联动父组件使用, 单独使用没有特别意义, 不应该暴露为props
popupVisible: (attrs?.popupVisible as Boolean) ?? true,
onPanelClick,
onCellClick,
onCellMouseEnter,
Expand Down

0 comments on commit a0daf7d

Please sign in to comment.