mirror of
https://github.com/element-plus/element-plus.git
synced 2025-01-24 11:05:17 +08:00
refactor(components): [input-number] export component instance type (#7886)
* refactor(components): [input-number] export component instance type * chore: fix props
This commit is contained in:
parent
ce54397999
commit
efdab3ba8b
@ -1,6 +1,8 @@
|
||||
import { isNil } from 'lodash-unified'
|
||||
import { useSizeProp } from '@element-plus/hooks'
|
||||
import { buildProps, isNumber } from '@element-plus/utils'
|
||||
import { componentSizes } from '@element-plus/constants'
|
||||
import type { ExtractPropTypes } from 'vue'
|
||||
import type InputNumber from './input-number.vue'
|
||||
|
||||
export const inputNumberProps = buildProps({
|
||||
id: {
|
||||
@ -11,10 +13,7 @@ export const inputNumberProps = buildProps({
|
||||
type: Number,
|
||||
default: 1,
|
||||
},
|
||||
stepStrictly: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
stepStrictly: Boolean,
|
||||
max: {
|
||||
type: Number,
|
||||
default: Number.POSITIVE_INFINITY,
|
||||
@ -23,17 +22,9 @@ export const inputNumberProps = buildProps({
|
||||
type: Number,
|
||||
default: Number.NEGATIVE_INFINITY,
|
||||
},
|
||||
modelValue: {
|
||||
type: Number,
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
values: componentSizes,
|
||||
},
|
||||
modelValue: Number,
|
||||
disabled: Boolean,
|
||||
size: useSizeProp,
|
||||
controls: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
@ -58,6 +49,7 @@ export const inputNumberProps = buildProps({
|
||||
val >= 0 && val === Number.parseInt(`${val}`, 10),
|
||||
},
|
||||
} as const)
|
||||
export type InputNumberProps = ExtractPropTypes<typeof inputNumberProps>
|
||||
|
||||
export const inputNumberEmits = {
|
||||
change: (prev: number | undefined, cur: number | undefined) => prev !== cur,
|
||||
@ -66,3 +58,6 @@ export const inputNumberEmits = {
|
||||
input: (val: number | null | undefined) => isNumber(val) || isNil(val),
|
||||
'update:modelValue': (val: number | undefined) => isNumber(val) || isNil(val),
|
||||
}
|
||||
export type InputNumberEmits = typeof inputNumberEmits
|
||||
|
||||
export type InputNumberInstance = InstanceType<typeof InputNumber>
|
||||
|
Loading…
Reference in New Issue
Block a user