UNPKG

2.97 kBTypeScriptView Raw
1import { SetupContext, RenderFunction, ComponentPublicInstance } from 'vue'
2import { VXEComponent, VxeComponentBase, SizeType, VxeEvent, ValueOf } from './component'
3import { VxeButtonPropTypes, VxeButtonProps } from './button'
4
5/* eslint-disable no-use-before-define */
6
7/**
8 * 组件 - 按钮组
9 * @example import { VxeButtonGroup } from 'vxe-table'
10 */
11export const VxeButtonGroup: VXEComponent<VxeButtonGroupProps, VxeButtonGroupEventProps, VxeButtonGroupSlots>
12/**
13 * 组件 - 按钮组
14 */
15export const ButtonGroup: typeof VxeButtonGroup
16
17export type VxeButtonGroupInstance = ComponentPublicInstance<VxeButtonGroupProps, VxeButtonGroupConstructor>
18
19export interface VxeButtonGroupConstructor extends VxeComponentBase, VxeButtonGroupMethods {
20 props: VxeButtonGroupProps
21 context: SetupContext<VxeButtonGroupEmits>
22 getComputeMaps(): ButtonPrivateComputed
23 renderVN: RenderFunction
24}
25
26export type VxeButtonGroupProps = {
27 size?: VxeButtonGroupPropTypes.Size
28 options?: VxeButtonGroupPropTypes.Options
29 mode?: VxeButtonGroupPropTypes.Mode
30 status?: VxeButtonGroupPropTypes.Status
31 round?: VxeButtonGroupPropTypes.Round
32 circle?: VxeButtonGroupPropTypes.Circle
33 /**
34 * 是否禁用
35 */
36 disabled?: VxeButtonGroupPropTypes.Disabled
37 className?: VxeButtonGroupPropTypes.ClassName
38}
39
40export namespace VxeButtonGroupPropTypes {
41 export type Size = SizeType
42 export type Options = VxeButtonProps[]
43 export type Round = boolean
44 export type Circle = boolean
45 export type Disabled = boolean
46 export type Mode = VxeButtonPropTypes.Mode
47 export type Status = VxeButtonPropTypes.Status
48 export type ClassName = string | ((params: { $buttonGroup: VxeButtonGroupConstructor }) => string)
49}
50
51export interface ButtonPrivateComputed {
52}
53
54export interface ButtonGroupMethods {
55 dispatchEvent(type: ValueOf<VxeButtonGroupEmits>, params: any, evnt: Event): void
56}
57export interface VxeButtonGroupMethods extends ButtonGroupMethods { }
58
59export interface ButtonGroupPrivateMethods {
60 handleClick(params: {
61 name: VxeButtonPropTypes.Name
62 }, evnt: Event): void
63}
64export interface VxeButtonGroupPrivateMethods extends ButtonGroupPrivateMethods { }
65
66export type VxeButtonGroupEmits = [
67 'click'
68]
69
70export namespace VxeButtonGroupDefines {
71 interface ButtonGroupEventParams extends VxeEvent {
72 $buttonGroup: VxeButtonGroupConstructor
73 }
74
75 export interface ClickEventParams extends ButtonGroupEventParams { }
76}
77
78export type VxeButtonGroupEventProps = {
79 onClick?: VxeButtonGroupEvents.Click
80}
81
82export interface VxeButtonGroupListeners {
83 click?: VxeButtonGroupEvents.Click
84}
85
86export namespace VxeButtonGroupEvents {
87 export type Click = (params: VxeButtonGroupDefines.ClickEventParams) => void
88}
89
90export interface VxeButtonGroupSlots {
91 /**
92 * 自定义插槽模板
93 */
94 [key: string]: ((params: {
95 [key: string]: any
96 }) => any) | undefined
97}