1 | import { RenderFunction, SetupContext, ComponentPublicInstance, Ref } from 'vue'
|
2 | import { VXEComponent, VxeComponentBase, VxeEvent, SizeType, ValueOf, SlotVNodeType } from './component'
|
3 |
|
4 |
|
5 |
|
6 | export declare const VxeDrawer: VXEComponent<VxeDrawerProps, VxeDrawerEventProps>
|
7 |
|
8 | export type VxeDrawerInstance = ComponentPublicInstance<VxeDrawerProps, VxeDrawerConstructor>
|
9 |
|
10 | export interface VxeDrawerConstructor extends VxeComponentBase, VxeDrawerMethods {
|
11 | props: VxeDrawerProps
|
12 | context: SetupContext<VxeDrawerEmits>
|
13 | reactData: DrawerReactData
|
14 | getRefMaps(): DrawerPrivateRef
|
15 | getComputeMaps(): DrawerPrivateComputed
|
16 | renderVN: RenderFunction
|
17 | }
|
18 |
|
19 | export interface DrawerPrivateRef {
|
20 | refElem: Ref<HTMLDivElement | undefined>
|
21 | }
|
22 | export interface VxeDrawerPrivateRef extends DrawerPrivateRef { }
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | export type DrawerPosition = 'top' | 'bottom' | 'left' | 'right'
|
28 |
|
29 |
|
30 |
|
31 |
|
32 | export type DrawerEventTypes = 'model' | 'mask' | 'close' | 'confirm' | 'cancel' | 'exit' | 'exist'
|
33 |
|
34 | export namespace VxeDrawerPropTypes {
|
35 | export type Size = SizeType
|
36 | export type ModelValue = boolean
|
37 | export type ID = string | null
|
38 | export type Loading = boolean
|
39 | export type ClassName = string
|
40 | export type Position = DrawerPosition
|
41 | export type Title = string | number
|
42 | export type Content = number | string | null
|
43 | export type ShowCancelButton = boolean | null
|
44 | export type CancelButtonText = string
|
45 | export type ShowConfirmButton = boolean | null
|
46 | export type ConfirmButtonText = string
|
47 | export type LockView = boolean
|
48 | export type LockScroll = boolean
|
49 | export type Mask = boolean
|
50 | export type MaskClosable = boolean
|
51 | export type EscClosable = boolean
|
52 | export type ShowHeader = boolean
|
53 | export type ShowFooter = boolean
|
54 | export type ShowClose = boolean
|
55 | export type Width = number | string
|
56 | export type Height = number | string
|
57 | export type ZIndex = number
|
58 | export type DestroyOnClose = boolean
|
59 | export type ShowTitleOverflow = boolean
|
60 | export type Transfer = boolean
|
61 | export type BeforeHideMethod = (params: VxeDrawerDefines.DrawerVisibleParams) => Promise<any>
|
62 | export type Slots = VxeDrawerSlots
|
63 | }
|
64 |
|
65 | export type VxeDrawerProps = {
|
66 | size?: VxeDrawerPropTypes.Size
|
67 | modelValue?: VxeDrawerPropTypes.ModelValue
|
68 | id?: VxeDrawerPropTypes.ID
|
69 | loading?: VxeDrawerPropTypes.Loading
|
70 | className?: VxeDrawerPropTypes.ClassName
|
71 | position?: VxeDrawerPropTypes.Position
|
72 | title?: VxeDrawerPropTypes.Title
|
73 | content?: VxeDrawerPropTypes.Content
|
74 | showCancelButton?: VxeDrawerPropTypes.ShowCancelButton
|
75 | cancelButtonText?: VxeDrawerPropTypes.CancelButtonText
|
76 | showConfirmButton?: VxeDrawerPropTypes.ShowConfirmButton
|
77 | confirmButtonText?: VxeDrawerPropTypes.ConfirmButtonText
|
78 | lockView?: VxeDrawerPropTypes.LockView
|
79 | lockScroll?: VxeDrawerPropTypes.LockScroll
|
80 | mask?: VxeDrawerPropTypes.Mask
|
81 | maskClosable?: VxeDrawerPropTypes.MaskClosable
|
82 | escClosable?: VxeDrawerPropTypes.EscClosable
|
83 | showHeader?: VxeDrawerPropTypes.ShowHeader
|
84 | showFooter?: VxeDrawerPropTypes.ShowFooter
|
85 | showClose?: VxeDrawerPropTypes.ShowClose
|
86 | width?: VxeDrawerPropTypes.Width
|
87 | height?: VxeDrawerPropTypes.Height
|
88 | zIndex?: VxeDrawerPropTypes.ZIndex
|
89 | destroyOnClose?: VxeDrawerPropTypes.DestroyOnClose
|
90 | showTitleOverflow?: VxeDrawerPropTypes.ShowTitleOverflow
|
91 | transfer?: VxeDrawerPropTypes.Transfer
|
92 | beforeHideMethod?: VxeDrawerPropTypes.BeforeHideMethod
|
93 | slots?: VxeDrawerPropTypes.Slots
|
94 | }
|
95 |
|
96 | export interface DrawerPrivateComputed {
|
97 | }
|
98 | export interface VxeDrawerPrivateComputed extends DrawerPrivateComputed { }
|
99 |
|
100 | export interface DrawerReactData {
|
101 | inited: boolean
|
102 | visible: boolean
|
103 | contentVisible: boolean
|
104 | drawerZIndex: number
|
105 | firstOpen: boolean
|
106 | }
|
107 |
|
108 | export interface DrawerMethods {
|
109 | dispatchEvent(type: ValueOf<VxeDrawerEmits>, params: any, evnt?: Event): void
|
110 | |
111 |
|
112 |
|
113 | open(): Promise<any>
|
114 | |
115 |
|
116 |
|
117 | close(): Promise<any>
|
118 | |
119 |
|
120 |
|
121 | getBox(): HTMLElement
|
122 | }
|
123 | export interface VxeDrawerMethods extends DrawerMethods { }
|
124 |
|
125 | export interface DrawerPrivateMethods { }
|
126 | export interface VxeDrawerPrivateMethods extends DrawerPrivateMethods { }
|
127 |
|
128 | export type VxeDrawerEmits = [
|
129 | 'update:modelValue',
|
130 | 'show',
|
131 | 'hide',
|
132 | 'before-hide',
|
133 | 'close',
|
134 | 'confirm',
|
135 | 'cancel'
|
136 | ]
|
137 |
|
138 |
|
139 |
|
140 |
|
141 | export interface DrawerController {
|
142 | |
143 |
|
144 |
|
145 |
|
146 | open(options: VxeDrawerDefines.DrawerOptions): Promise<DrawerEventTypes>
|
147 | |
148 |
|
149 |
|
150 |
|
151 | get(id: string): VxeDrawerConstructor & VxeDrawerMethods
|
152 | |
153 |
|
154 |
|
155 |
|
156 | close(id?: VxeDrawerPropTypes.ID): Promise<any>
|
157 | }
|
158 |
|
159 | export namespace VxeDrawerDefines {
|
160 | export interface DrawerEventParams extends VxeEvent {
|
161 | $drawer: VxeDrawerConstructor
|
162 | }
|
163 |
|
164 | export interface DrawerOptions extends VxeDrawerProps, VxeDrawerEventProps {
|
165 | key?: string | number
|
166 | }
|
167 |
|
168 | export interface DrawerVisibleParams {
|
169 | type: DrawerEventTypes
|
170 | }
|
171 |
|
172 | interface DrawerBaseParams extends DrawerVisibleParams { }
|
173 |
|
174 | export interface ShowParams extends DrawerBaseParams { }
|
175 | export interface ShowEventParams extends DrawerEventParams, ShowParams { }
|
176 |
|
177 | export interface HideParams extends DrawerBaseParams { }
|
178 | export interface HideEventParams extends DrawerEventParams, HideParams { }
|
179 |
|
180 | export interface BeforeHideParams extends DrawerBaseParams { }
|
181 | export interface BeforeHideEventParams extends DrawerEventParams, BeforeHideParams { }
|
182 |
|
183 | export interface ConfirmParams extends DrawerBaseParams { }
|
184 | export interface ConfirmEventParams extends DrawerEventParams, ConfirmParams { }
|
185 |
|
186 | export interface CancelParams extends DrawerBaseParams { }
|
187 | export interface CancelEventParams extends DrawerEventParams, CancelParams { }
|
188 |
|
189 | export interface CloseParams extends DrawerBaseParams { }
|
190 | export interface CloseEventParams extends DrawerEventParams, CloseParams { }
|
191 |
|
192 | export interface ZoomParams extends DrawerBaseParams { }
|
193 | export interface ZoomEventParams extends DrawerEventParams, ZoomParams { }
|
194 |
|
195 | export interface ResizeParams extends DrawerBaseParams { }
|
196 | export interface ResizeEventParams extends DrawerEventParams, ResizeParams { }
|
197 |
|
198 | export interface MoveParams extends DrawerBaseParams { }
|
199 | export interface MoveEventParams extends DrawerEventParams, MoveParams { }
|
200 | }
|
201 |
|
202 | export type VxeDrawerEventProps = {
|
203 | onShow?: VxeDrawerEvents.Show
|
204 | onHide?: VxeDrawerEvents.Hide
|
205 | onBeforeHide?: VxeDrawerEvents.BeforeHide
|
206 | onConfirm?: VxeDrawerEvents.Confirm
|
207 | onCancel?: VxeDrawerEvents.Cancel
|
208 | onClose?: VxeDrawerEvents.Close
|
209 | }
|
210 |
|
211 | export interface VxeDrawerListeners {
|
212 | show?: VxeDrawerEvents.Show
|
213 | hide?: VxeDrawerEvents.Hide
|
214 | beforeHide?: VxeDrawerEvents.BeforeHide
|
215 | confirm?: VxeDrawerEvents.Confirm
|
216 | cancel?: VxeDrawerEvents.Cancel
|
217 | close?: VxeDrawerEvents.Close
|
218 | }
|
219 |
|
220 | export namespace VxeDrawerEvents {
|
221 | export type Show = (params: VxeDrawerDefines.ShowEventParams) => void
|
222 | export type Hide = (params: VxeDrawerDefines.HideEventParams) => void
|
223 | export type BeforeHide = (params: VxeDrawerDefines.BeforeHideEventParams) => void
|
224 | export type Confirm = (params: VxeDrawerDefines.ConfirmEventParams) => void
|
225 | export type Cancel = (params: VxeDrawerDefines.CancelEventParams) => void
|
226 | export type Close = (params: VxeDrawerDefines.CloseEventParams) => void
|
227 | }
|
228 |
|
229 | export namespace VxeDrawerSlotTypes {
|
230 | export interface DefaultSlotParams {
|
231 | $drawer: VxeDrawerConstructor & VxeDrawerMethods
|
232 | }
|
233 | export interface HeaderSlotParams extends DefaultSlotParams { }
|
234 | export interface TitleSlotParams extends DefaultSlotParams { }
|
235 | export interface FooterSlotParams extends DefaultSlotParams { }
|
236 | }
|
237 |
|
238 | export interface VxeDrawerSlots {
|
239 | |
240 |
|
241 |
|
242 | default?(params: VxeDrawerSlotTypes.DefaultSlotParams): SlotVNodeType[] | SlotVNodeType
|
243 | |
244 |
|
245 |
|
246 | header?(params: VxeDrawerSlotTypes.HeaderSlotParams): SlotVNodeType[] | SlotVNodeType
|
247 | |
248 |
|
249 |
|
250 | title?(params: VxeDrawerSlotTypes.TitleSlotParams): SlotVNodeType[] | SlotVNodeType
|
251 | |
252 |
|
253 |
|
254 | corner?(params: VxeDrawerSlotTypes.TitleSlotParams): SlotVNodeType[] | SlotVNodeType
|
255 | |
256 |
|
257 |
|
258 | footer?(params: VxeDrawerSlotTypes.FooterSlotParams): SlotVNodeType[] | SlotVNodeType
|
259 | }
|
260 |
|
261 | export const Drawer: typeof VxeDrawer
|
262 | export default VxeDrawer
|