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:
JeremyWuuuuu 2022-05-26 15:12:17 +08:00 committed by GitHub
parent ad262520cf
commit 4177e54964
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 15 deletions

View File

@ -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'],

View File

@ -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>

View File

@ -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>

View File

@ -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]