UNPKG

2.68 kBTypeScriptView Raw
1import { SetupContext, RenderFunction, ComponentPublicInstance } from 'vue'
2import { VXEComponent, VxeComponentBase, VxeEvent, SizeType, ValueOf } from './component'
3
4/* eslint-disable no-use-before-define */
5
6/**
7 * 组件 - 单选框
8 * @example import { VxeRadio } from 'vxe-table'
9 */
10export const VxeRadio: VXEComponent<VxeRadioProps, VxeRadioEventProps, VxeRadioSlots>
11/**
12 * 组件 - 单选框
13 */
14export const Radio: typeof VxeRadio
15
16export type VxeRadioInstance = ComponentPublicInstance<VxeRadioProps, VxeRadioConstructor>
17
18export interface VxeRadioConstructor extends VxeComponentBase, VxeRadioMethods {
19 props: VxeRadioProps
20 context: SetupContext<VxeRadioEmits>
21 renderVN: RenderFunction
22}
23
24export type VxeRadioProps = {
25 size?: VxeRadioPropTypes.Size
26 /**
27 * 严格模式,不允许取消
28 */
29 strict?: VxeRadioPropTypes.Strict
30 /**
31 * 绑定值
32 */
33 modelValue?: VxeRadioPropTypes.ModelValue
34 /**
35 * 值
36 */
37 label?: VxeRadioPropTypes.Label
38 /**
39 * 原生 title 属性
40 */
41 title?: VxeRadioPropTypes.Title
42 /**
43 * 内容
44 */
45 content?: VxeRadioPropTypes.Content
46 /**
47 * 是否禁用
48 */
49 disabled?: VxeRadioPropTypes.Disabled
50 /**
51 * 原生 title 属性
52 */
53 name?: VxeRadioPropTypes.Name
54}
55
56export namespace VxeRadioPropTypes {
57 export type Size = SizeType
58 export type Strict = boolean
59 export type ModelValue = any
60 export type Label = any
61 export type Title = string | number
62 export type Content = string | number
63 export type Disabled = boolean
64 export type Name = string
65}
66
67export interface RadioMethods {
68 dispatchEvent(type: ValueOf<VxeRadioEmits>, params: any, evnt: Event): void
69}
70export interface VxeRadioMethods extends RadioMethods { }
71
72export interface RadioPrivateMethods { }
73export interface VxeRadioPrivateMethods extends RadioPrivateMethods { }
74
75export type VxeRadioEmits = [
76 'update:modelValue',
77 'change'
78]
79
80export namespace VxeRadioDefines {
81 interface RadioEventParams extends VxeEvent {
82 $radio: VxeRadioConstructor
83 }
84
85 export interface ChangeParams {
86 label: any
87 }
88 export interface ChangeEventParams extends RadioEventParams, ChangeParams { }
89}
90
91export type VxeRadioEventProps = {
92 onChange?: VxeRadioEvents.Change
93}
94
95export interface VxeRadioListeners {
96 change?: VxeRadioEvents.Change
97}
98
99export namespace VxeRadioEvents {
100 export type Change = (params: VxeRadioDefines.ChangeEventParams) => void
101}
102
103export interface VxeRadioSlots {
104 /**
105 * 自定义插槽模板
106 */
107 [key: string]: ((params: {
108 [key: string]: any
109 }) => any) | undefined
110}