UNPKG

2.76 kBTypeScriptView Raw
1import { SetupContext, RenderFunction, ComponentPublicInstance } from 'vue'
2import { VXEComponent, VxeComponentBase, VxeEvent, ValueOf } from './component'
3import { VxeRadioPropTypes } from './radio'
4
5/* eslint-disable no-use-before-define */
6
7/**
8 * 组件 - 单选框按钮
9 * @example import { VxeRadioButton } from 'vxe-table'
10 */
11export const VxeRadioButton: VXEComponent<VxeRadioButtonProps, VxeRadioButtonEventProps, VxeRadioButtonSlots>
12/**
13 * 组件 - 单选框按钮
14 */
15export const RadioButton: typeof VxeRadioButton
16
17export type VxeRadioButtonInstance = ComponentPublicInstance<VxeRadioButtonProps, VxeRadioButtonConstructor>
18
19export interface VxeRadioButtonConstructor extends VxeComponentBase, VxeRadioButtonMethods {
20 props: VxeRadioButtonProps
21 context: SetupContext<VxeRadioButtonEmits>
22 renderVN: RenderFunction
23}
24
25export interface RadioButtonMethods {
26 dispatchEvent(type: ValueOf<VxeRadioButtonEmits>, params: any, evnt: Event): void
27}
28export interface VxeRadioButtonMethods extends RadioButtonMethods { }
29
30export interface RadioButtonPrivateMethods { }
31export interface VxeRadioButtonPrivateMethods extends RadioButtonPrivateMethods { }
32
33export type VxeRadioButtonEmits = [
34 'update:modelValue',
35 'change'
36]
37
38export type VxeRadioButtonProps = {
39 size?: VxeRadioButtonPropTypes.Size
40 modelValue?: VxeRadioButtonPropTypes.ModelValue
41 /**
42 * 严格模式,不允许取消
43 */
44 strict?: VxeRadioButtonPropTypes.Strict
45 label?: VxeRadioButtonPropTypes.Label
46 title?: VxeRadioButtonPropTypes.Title
47 content?: VxeRadioButtonPropTypes.Content
48 disabled?: VxeRadioButtonPropTypes.Disabled
49}
50
51export namespace VxeRadioButtonPropTypes {
52 export type Size = VxeRadioPropTypes.Size
53 export type ModelValue = any
54 export type Strict = boolean
55 export type Label = VxeRadioPropTypes.Label
56 export type Title = string | number
57 export type Content = string | number
58 export type Disabled = boolean
59}
60
61export namespace VxeRadioButtonDefines {
62 interface RadioButtonEventParams extends VxeEvent {
63 $radioButton: VxeRadioButtonConstructor
64 }
65
66 export interface ChangeParams {
67 label: any
68 }
69 export interface ChangeEventParams extends RadioButtonEventParams, ChangeParams { }
70}
71
72export type VxeRadioButtonEventProps = {
73 onChange?: VxeRadioButtonEvents.Change
74}
75
76export interface VxeRadioButtonListeners {
77 change?: VxeRadioButtonEvents.Change
78}
79
80export namespace VxeRadioButtonEvents {
81 export type Change = (params: VxeRadioButtonDefines.ChangeEventParams) => void
82}
83
84export interface VxeRadioButtonSlots {
85 /**
86 * 自定义插槽模板
87 */
88 [key: string]: ((params: {
89 [key: string]: any
90 }) => any) | undefined
91}