UNPKG

2.99 kBTypeScriptView Raw
1import { SetupContext, RenderFunction, ComponentPublicInstance } from 'vue'
2import { VXEComponent, VxeComponentBase, SizeType, VxeEvent, ValueOf } from './component'
3import { VxeGlobalRendererHandles } from './v-x-e-table'
4import { VxeRadioPropTypes } from './radio'
5
6/* eslint-disable no-use-before-define */
7
8/**
9 * 组件 - 单选框组
10 * @example import { VxeRadioGroup } from 'vxe-table'
11 */
12export const VxeRadioGroup: VXEComponent<VxeRadioGroupProps, VxeRadioGroupEventProps, VxeRadioGroupSlots>
13/**
14 * 组件 - 单选框组
15 */
16export const RadioGroup: typeof VxeRadioGroup
17
18export type VxeRadioGroupInstance = ComponentPublicInstance<VxeRadioGroupProps, VxeRadioGroupConstructor>
19
20export interface VxeRadioGroupConstructor extends VxeComponentBase, VxeRadioGroupMethods {
21 name: string
22 props: VxeRadioGroupProps
23 context: SetupContext<VxeRadioGroupEmits>
24 renderVN: RenderFunction
25}
26
27export type VxeRadioGroupEmits = [
28 'update:modelValue',
29 'change'
30]
31
32export type VxeRadioGroupProps = {
33 size?: VxeRadioGroupPropTypes.Size
34 type?: VxeRadioGroupPropTypes.Type
35 options?: VxeRadioGroupPropTypes.Options
36 optionProps?: VxeRadioGroupPropTypes.OptionProps
37 /**
38 * 严格模式,不允许取消
39 */
40 strict?: VxeRadioGroupPropTypes.Strict
41 modelValue?: VxeRadioGroupPropTypes.ModelValue
42 disabled?: VxeRadioGroupPropTypes.Disabled
43}
44
45export namespace VxeRadioGroupPropTypes {
46 export type Size = SizeType
47 export type Type = 'button' | 'default' | '' | null
48 export type Options = {
49 value?: VxeRadioPropTypes.Label
50 label?: VxeRadioPropTypes.Content
51
52 [key: string]: any
53 }[]
54 export type OptionProps = VxeGlobalRendererHandles.RenderOptionProps
55 export type ModelValue = any
56 export type Strict = boolean
57 export type Disabled = boolean
58}
59
60export interface RadioGroupMethods {
61 dispatchEvent(type: ValueOf<VxeRadioGroupEmits>, params: any, evnt?: Event): void
62}
63export interface VxeRadioGroupMethods extends RadioGroupMethods { }
64
65export interface RadioGroupPrivateMethods {
66 handleChecked(params: { label: any }, evnt: Event): void
67}
68export interface VxeRadioGroupPrivateMethods extends RadioGroupPrivateMethods { }
69
70export namespace VxeRadioGroupDefines {
71 interface RadioGroupEventParams extends VxeEvent {
72 $radioGroup: VxeRadioGroupConstructor
73 }
74
75 export interface ChangeParams {
76 label: any
77 }
78 export interface ChangeEventParams extends RadioGroupEventParams, ChangeParams { }
79}
80
81export type VxeRadioGroupEventProps = {
82 onChange?: VxeRadioGroupEvents.Change
83}
84
85export interface VxeRadioGroupListeners {
86 change?: VxeRadioGroupEvents.Change
87}
88
89export namespace VxeRadioGroupEvents {
90 export type Change = (params: VxeRadioGroupDefines.ChangeEventParams) => void
91}
92
93export interface VxeRadioGroupSlots {
94 /**
95 * 自定义插槽模板
96 */
97 [key: string]: ((params: {
98 [key: string]: any
99 }) => any) | undefined
100}