mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-13 17:05:47 +08:00
refactor(components): [date-picker] extract props (#7899)
* refactor(components): [date-picker] extract props - Extract props for panel-month-range * chore: remove unused type
This commit is contained in:
parent
ad262520cf
commit
4177e54964
@ -102,20 +102,15 @@ import dayjs from 'dayjs'
|
||||
import ElIcon from '@element-plus/components/icon'
|
||||
import { useLocale } from '@element-plus/hooks'
|
||||
import { DArrowLeft, DArrowRight } from '@element-plus/icons-vue'
|
||||
import { panelMonthRangeProps } from '../props/panel-month-range'
|
||||
import MonthTable from './basic-month-table.vue'
|
||||
|
||||
import type { PropType } from 'vue'
|
||||
import type { Dayjs } from 'dayjs'
|
||||
|
||||
export default defineComponent({
|
||||
components: { MonthTable, ElIcon, DArrowLeft, DArrowRight },
|
||||
|
||||
props: {
|
||||
unlinkPanels: Boolean,
|
||||
parsedValue: {
|
||||
type: Array as PropType<Dayjs[]>,
|
||||
},
|
||||
},
|
||||
props: panelMonthRangeProps,
|
||||
|
||||
emits: ['pick', 'set-picker-option'],
|
||||
|
||||
|
@ -1,15 +1,11 @@
|
||||
import { buildProps, definePropType } from '@element-plus/utils'
|
||||
import { panelSharedProps } from './shared'
|
||||
import { buildProps } from '@element-plus/utils'
|
||||
import { panelRangeSharedProps, panelSharedProps } from './shared'
|
||||
|
||||
import type { ExtractPropTypes } from 'vue'
|
||||
import type { Dayjs } from 'dayjs'
|
||||
|
||||
export const panelDateRangeProps = buildProps({
|
||||
...panelSharedProps,
|
||||
unlinkPanels: Boolean,
|
||||
parsedValue: {
|
||||
type: definePropType<Dayjs[]>(Array),
|
||||
},
|
||||
...panelRangeSharedProps,
|
||||
} as const)
|
||||
|
||||
export type PanelDateRangeProps = ExtractPropTypes<typeof panelDateRangeProps>
|
||||
|
@ -0,0 +1,10 @@
|
||||
import { buildProps } from '@element-plus/utils'
|
||||
import { panelRangeSharedProps } from './shared'
|
||||
|
||||
import type { ExtractPropTypes } from 'vue'
|
||||
|
||||
export const panelMonthRangeProps = buildProps({
|
||||
...panelRangeSharedProps,
|
||||
} as const)
|
||||
|
||||
export type PanelMonthRangeProps = ExtractPropTypes<typeof panelMonthRangeProps>
|
@ -43,7 +43,14 @@ export const panelSharedProps = buildProps({
|
||||
required: true,
|
||||
values: datePickTypes,
|
||||
},
|
||||
})
|
||||
} as const)
|
||||
|
||||
export const panelRangeSharedProps = buildProps({
|
||||
unlinkPanels: Boolean,
|
||||
parsedValue: {
|
||||
type: definePropType<Dayjs[]>(Array),
|
||||
},
|
||||
} as const)
|
||||
|
||||
export const selectionModeWithDefault = (
|
||||
mode: typeof selectionModes[number]
|
||||
|
Loading…
Reference in New Issue
Block a user