UNPKG

3.28 kBTypeScriptView Raw
1import { SetupContext, RenderFunction, ComponentPublicInstance, ComputedRef } from 'vue'
2import { VXEComponent, VxeComponentBase, SizeType, VxeEvent, ValueOf } from './component'
3import { VxeGlobalRendererHandles } from './v-x-e-table'
4import { VxeCheckboxPropTypes } from './checkbox'
5
6/* eslint-disable no-use-before-define */
7
8/**
9 * 组件 - 复选框组
10 * @example import { VxeCheckboxGroup } from 'vxe-table'
11 */
12export const VxeCheckboxGroup: VXEComponent<VxeCheckboxGroupProps, VxeCheckboxGroupEventProps, VxeCheckboxGroupSlots>
13/**
14 * 组件 - 复选框组
15 */
16export const CheckboxGroup: typeof VxeCheckboxGroup
17
18export type VxeCheckboxGroupInstance = ComponentPublicInstance<VxeCheckboxGroupProps, VxeCheckboxGroupConstructor>
19
20export interface VxeCheckboxGroupConstructor extends VxeComponentBase, VxeCheckboxGroupMethods {
21 props: VxeCheckboxGroupProps
22 context: SetupContext<VxeCheckboxGroupEmits>
23 getComputeMaps(): CheckboxPrivateComputed
24 renderVN: RenderFunction
25}
26
27export type VxeCheckboxGroupProps = {
28 size?: VxeCheckboxGroupPropTypes.Size
29 options?: VxeCheckboxGroupPropTypes.Options
30 optionProps?: VxeCheckboxGroupPropTypes.OptionProps
31 /**
32 * 绑定值
33 */
34 modelValue?: VxeCheckboxGroupPropTypes.ModelValue
35 max?: VxeCheckboxGroupPropTypes.Max
36 /**
37 * 是否禁用
38 */
39 disabled?: VxeCheckboxGroupPropTypes.Disabled
40}
41
42export namespace VxeCheckboxGroupPropTypes {
43 export type Size = SizeType
44 export type ModelValue = any[]
45 export type Options = {
46 value?: VxeCheckboxPropTypes.Label
47 label?: VxeCheckboxPropTypes.Content
48
49 [key: string]: any
50 }[]
51 export type OptionProps = VxeGlobalRendererHandles.RenderOptionProps
52 export type Max = string | number
53 export type Disabled = boolean
54}
55
56export interface CheckboxPrivateComputed {
57 computeIsMaximize: ComputedRef<boolean>
58}
59
60export interface CheckboxGroupMethods {
61 dispatchEvent(type: ValueOf<VxeCheckboxGroupEmits>, params: any, evnt: Event): void
62}
63export interface VxeCheckboxGroupMethods extends CheckboxGroupMethods { }
64
65export interface CheckboxGroupPrivateMethods {
66 handleChecked(params: {
67 checked: boolean
68 value: VxeCheckboxPropTypes.ModelValue
69 label: VxeCheckboxPropTypes.Label
70 }, evnt: Event): void
71}
72export interface VxeCheckboxGroupPrivateMethods extends CheckboxGroupPrivateMethods { }
73
74export type VxeCheckboxGroupEmits = [
75 'update:modelValue',
76 'change'
77]
78
79export namespace VxeCheckboxGroupDefines {
80 interface CheckboxGroupEventParams extends VxeEvent {
81 $checkboxGroup: VxeCheckboxGroupConstructor
82 }
83
84 export type ChangeParams = {
85 checklist: any[]
86 }
87 export interface ChangeEventParams extends CheckboxGroupEventParams, ChangeParams { }
88}
89
90export type VxeCheckboxGroupEventProps = {
91 onChange?: VxeCheckboxGroupEvents.Change
92}
93
94export interface VxeCheckboxGroupListeners {
95 change?: VxeCheckboxGroupEvents.Change
96}
97
98export namespace VxeCheckboxGroupEvents {
99 export type Change = (params: VxeCheckboxGroupDefines.ChangeEventParams) => void
100}
101
102export interface VxeCheckboxGroupSlots {
103 /**
104 * 自定义插槽模板
105 */
106 [key: string]: ((params: {
107 [key: string]: any
108 }) => any) | undefined
109}