mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-14 01:11:25 +08:00
refactor(components): [config-provider] export component instance type (#7979)
This commit is contained in:
parent
20317b9c02
commit
ac31116c3b
@ -1,8 +1,7 @@
|
|||||||
import { defineComponent, renderSlot, watch } from 'vue'
|
import { defineComponent, renderSlot, watch } from 'vue'
|
||||||
import { buildProps, definePropType } from '@element-plus/utils'
|
import { buildProps, definePropType } from '@element-plus/utils'
|
||||||
import { provideGlobalConfig } from '@element-plus/hooks'
|
import { provideGlobalConfig, useSizeProp } from '@element-plus/hooks'
|
||||||
|
|
||||||
import { componentSizes } from '@element-plus/constants'
|
|
||||||
import type { ExtractPropTypes } from 'vue'
|
import type { ExtractPropTypes } from 'vue'
|
||||||
import type { ExperimentalFeatures } from '@element-plus/tokens'
|
import type { ExperimentalFeatures } from '@element-plus/tokens'
|
||||||
import type { Language } from '@element-plus/locale'
|
import type { Language } from '@element-plus/locale'
|
||||||
@ -22,11 +21,7 @@ export const configProviderProps = buildProps({
|
|||||||
type: definePropType<Language>(Object),
|
type: definePropType<Language>(Object),
|
||||||
},
|
},
|
||||||
|
|
||||||
size: {
|
size: useSizeProp,
|
||||||
type: String,
|
|
||||||
values: componentSizes,
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
|
|
||||||
button: {
|
button: {
|
||||||
type: definePropType<ButtonConfigContext>(Object),
|
type: definePropType<ButtonConfigContext>(Object),
|
||||||
@ -46,17 +41,16 @@ export const configProviderProps = buildProps({
|
|||||||
type: definePropType<MessageConfigContext>(Object),
|
type: definePropType<MessageConfigContext>(Object),
|
||||||
},
|
},
|
||||||
|
|
||||||
zIndex: {
|
zIndex: Number,
|
||||||
type: Number,
|
|
||||||
},
|
|
||||||
|
|
||||||
namespace: {
|
namespace: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'el',
|
default: 'el',
|
||||||
},
|
},
|
||||||
} as const)
|
} as const)
|
||||||
|
export type ConfigProviderProps = ExtractPropTypes<typeof configProviderProps>
|
||||||
|
|
||||||
export default defineComponent({
|
const ConfigProvider = defineComponent({
|
||||||
name: 'ElConfigProvider',
|
name: 'ElConfigProvider',
|
||||||
props: configProviderProps,
|
props: configProviderProps,
|
||||||
|
|
||||||
@ -72,5 +66,6 @@ export default defineComponent({
|
|||||||
return () => renderSlot(slots, 'default', { config: config?.value })
|
return () => renderSlot(slots, 'default', { config: config?.value })
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
export type ConfigProviderInstance = InstanceType<typeof ConfigProvider>
|
||||||
|
|
||||||
export type ConfigProviderProps = ExtractPropTypes<typeof configProviderProps>
|
export default ConfigProvider
|
||||||
|
Loading…
Reference in New Issue
Block a user