UNPKG

27.8 kBTypeScriptView Raw
1import { RenderFunction, SetupContext, Ref, ComputedRef, ComponentPublicInstance, ComponentInternalInstance } from 'vue'
2import { VxeFormInstance, VxeFormProps, VxeFormDefines } from './form'
3import { VxeFormItemProps } from './form-item'
4import { VxeToolbarInstance, VxeToolbarProps, VxeToolbarPropTypes } from './toolbar'
5import { VxePagerInstance, VxePagerProps, VxePagerDefines } from './pager'
6import { VXEComponent, VxeComponentBase, VxeEvent, SizeType, ValueOf, SlotVNodeType } from './component'
7import { VxeTableDataRow, VxeTableDefines, VxeTableEmits, VxeTableConstructor, VxeTableProps, TablePublicMethods, VxeTableMethods, VxeTablePrivateMethods } from './table'
8
9/* eslint-disable no-use-before-define */
10
11/**
12 * 组件 - 配置式表格
13 * @example import { VxeGrid } from 'vxe-table'
14 */
15export const VxeGrid: VXEComponent<VxeGridProps<any>, VxeGridEventProps<any>, VxeGridSlots<any>>
16/**
17 * 组件 - 配置式表格
18 */
19export const Grid: typeof VxeGrid
20
21export type VxeGridInstance<D = any> = ComponentPublicInstance<VxeGridProps<D>, VxeGridConstructor<D>>
22
23export interface VxeGridConstructor<D = any> extends VxeComponentBase, VxeGridMethods<D> {
24 props: Readonly<VxeGridProps<D>>
25 context: SetupContext<VxeGridEmits>
26 instance: ComponentInternalInstance
27 reactData: GridReactData<D>
28 getRefMaps(): GridPrivateRef<D>
29 getComputeMaps(): GridPrivateComputed
30 renderVN: RenderFunction
31}
32
33export interface GridPrivateRef<D = VxeTableDataRow> {
34 refElem: Ref<HTMLDivElement>
35 refTable: Ref<ComponentPublicInstance<VxeTableProps<D>, VxeTableConstructor<D> & VxeTableMethods<D> & VxeTablePrivateMethods<D>>>
36 refForm: Ref<VxeFormInstance>
37 refToolbar: Ref<VxeToolbarInstance>
38 refPager: Ref<VxePagerInstance>
39}
40export interface VxeGridPrivateRef<D = VxeTableDataRow> extends GridPrivateRef<D> { }
41
42export interface GridPrivateComputed {
43 computeProxyOpts: ComputedRef<VxeGridPropTypes.ProxyOpts>
44 computePagerOpts: ComputedRef<VxeGridPropTypes.PagerOpts>
45 computeFormOpts: ComputedRef<VxeGridPropTypes.FormOpts>
46 computeToolbarOpts: ComputedRef<VxeGridPropTypes.ToolbarOpts>
47 computeZoomOpts: ComputedRef<VxeGridPropTypes.ZoomOpts>
48}
49
50export interface VxeGridPrivateComputed extends GridPrivateComputed { }
51
52export interface GridReactData<D = VxeTableDataRow> {
53 tableLoading: boolean
54 proxyInited: boolean
55 isZMax: boolean
56 tableData: D[]
57 filterData: VxeTableDefines.FilterCheckedParams<D>[]
58 formData: any
59 sortData: VxeTableDefines.SortCheckedParams<D>[]
60 tZindex: number
61 tablePage: {
62 total: number
63 pageSize: number
64 currentPage: number
65 }
66}
67
68export type VxeGridEmits = [
69 ...VxeTableEmits,
70
71 'page-change',
72 'form-submit',
73 'form-submit-invalid',
74 'form-reset',
75 'form-collapse',
76 'form-toggle-collapse',
77 'proxy-query',
78 'proxy-delete',
79 'proxy-save',
80 'toolbar-button-click',
81 'toolbar-tool-click',
82 'zoom'
83]
84
85export interface GridMethods<D = VxeTableDataRow> extends GridPublicMethods<D> {
86 dispatchEvent(type: ValueOf<VxeGridEmits>, params: any, evnt?: Event): void
87}
88
89export interface GridPublicMethods<D = VxeTableDataRow> {
90 /**
91 * 给数据代理提交指令
92 * @param code 指令编码
93 */
94 commitProxy(code: string | VxeToolbarPropTypes.ButtonConfig, ...args: any[]): Promise<any>
95 /**
96 * 获取表单项列表
97 */
98 getFormItems(): VxeFormItemProps[]
99 getFormItems(itemIndex?: number): VxeFormItemProps
100 /**
101 * 切换表格最大化/还原
102 */
103 zoom(): Promise<boolean>
104 /**
105 * 判断是否最大化显示
106 */
107 isMaximized(): boolean
108 /**
109 * 如果表格处于常规状态,则最大化表格
110 */
111 maximize(): Promise<any>
112 /**
113 * 如果表格处于最大化状态,则还原表格
114 */
115 revert(): Promise<any>
116 /**
117 * 获取数据代理信息
118 */
119 getProxyInfo(): {
120 data: D[]
121 filter: any
122 form: any
123 sort: VxeTableDefines.SortCheckedParams<D> | { [key: string]: any }
124 sorts: VxeTableDefines.SortCheckedParams<D>[]
125 pager: {
126 total: number
127 pageSize: number
128 currentPage: number
129 }
130 pendingRecords: D[]
131 } | null
132 /**
133 * 设置数据代理信息
134 */
135 // setProxyInfo(options: {
136 // /**
137 // * 修改表格数据
138 // */
139 // data?: any[]
140 // /**
141 // * 修改表单数据
142 // */
143 // form?: {
144 // [key: string]: any
145 // },
146 // /**
147 // * 修改分页数据
148 // */
149 // pager?: {
150 // pageSize?: number
151 // currentPage?: number
152 // }
153 // }): Promise<any>
154}
155
156export interface VxeGridMethods<D = VxeTableDataRow> extends GridMethods<D>, TablePublicMethods<D> { }
157
158export interface GridPrivateMethods<D = VxeTableDataRow> {
159 callSlot<T = any>(slotFunc: ((params: T) => SlotVNodeType | SlotVNodeType[]) | string | null, params: T): SlotVNodeType[]
160 extendTableMethods<T>(methodKeys: T[]): any
161 triggerToolbarCommitEvent(params: VxeToolbarPropTypes.ButtonConfig | VxeToolbarPropTypes.ToolConfig, evnt: Event): Promise<any>
162 triggerToolbarBtnEvent(button: VxeToolbarPropTypes.ButtonConfig, evnt: Event): void
163 triggerToolbarTolEvent(button: VxeToolbarPropTypes.ToolConfig, evnt: Event): void
164 triggerZoomEvent(evnt: Event): void
165 getParentHeight(): number
166 getExcludeHeight(): number
167}
168
169export interface VxeGridPrivateMethods<D = VxeTableDataRow> extends GridPrivateMethods<D> { }
170
171export namespace VxeGridPropTypes {
172 export type Size = SizeType
173
174 export type Layouts = ('Form' | 'Toolbar' | 'Top' | 'Table' | 'Bottom' | 'Pager')[]
175
176 export type Columns<D = VxeTableDataRow> = VxeTableDefines.ColumnOptions<D>[]
177
178 export interface PagerConfig extends VxePagerProps {
179 enabled?: boolean
180 slots?: any
181 }
182 export interface PagerOpts extends PagerConfig { }
183
184 interface ProxyAjaxQueryPageParams {
185 total: number
186 pageSize: number
187 currentPage: number
188 }
189
190 interface ProxyAjaxQuerySortCheckedParams<D = VxeTableDataRow> {
191 column: VxeTableDefines.ColumnInfo<D>
192 order: string
193 sortBy: string
194 field: string
195 property: string
196 }
197
198 interface ProxyAjaxQueryParams<D = VxeTableDataRow> {
199 $grid: VxeGridConstructor<D>
200 page: ProxyAjaxQueryPageParams
201 sort: ProxyAjaxQuerySortCheckedParams<D>
202 sorts: ProxyAjaxQuerySortCheckedParams<D>[]
203 filters: VxeTableDefines.FilterCheckedParams[]
204 form: {
205 [key: string]: any
206 }
207 }
208
209 interface ProxyAjaxQueryAllParams<D = VxeTableDataRow> {
210 $table: VxeTableConstructor<D>
211 $grid: VxeGridConstructor<D>
212 sort: ProxyAjaxQuerySortCheckedParams<D>
213 sorts: ProxyAjaxQuerySortCheckedParams<D>[]
214 filters: VxeTableDefines.FilterCheckedParams[]
215 form: {
216 [key: string]: any
217 }
218 options: any
219 }
220
221 interface ProxyAjaxDeleteParams<D = VxeTableDataRow> {
222 $grid: VxeGridConstructor<D>
223 body: {
224 removeRecords: D[]
225 }
226 }
227
228 interface ProxyAjaxSaveParams<D = VxeTableDataRow> {
229 $grid: VxeGridConstructor<D>
230 body: {
231 insertRecords: D[]
232 updateRecords: D[]
233 removeRecords: D[]
234 pendingRecords: D[]
235 }
236 }
237
238 export interface ProxyConfig<D = VxeTableDataRow> {
239 enabled?: boolean
240 autoLoad?: boolean
241 message?: boolean
242 seq?: boolean
243 sort?: boolean
244 filter?: boolean
245 form?: boolean
246 response?: {
247 list?: string | null | ((params: {
248 data: any
249 $grid: VxeGridConstructor<D>
250 }) => any[])
251 result?: string | ((params: {
252 data: any
253 $grid: VxeGridConstructor<D>
254 }) => any[])
255 total?: string | ((params: {
256 data: any
257 $grid: VxeGridConstructor<D>
258 }) => number)
259 message?: string | ((params: {
260 data: any
261 $grid: VxeGridConstructor<D>
262 }) => string)
263 }
264 ajax?: {
265 query?(params: ProxyAjaxQueryParams<D>, ...args: any[]): Promise<any>
266 queryAll?(params: ProxyAjaxQueryAllParams<D>, ...args: any[]): Promise<any>
267 delete?(params: ProxyAjaxDeleteParams<D>, ...args: any[]): Promise<any>
268 save?(params: ProxyAjaxSaveParams<D>, ...args: any[]): Promise<any>
269 }
270 [key: string]: any
271
272 /**
273 * 已废弃,请使用 proxy-config.response
274 * @deprecated
275 */
276 props?: {
277 /**
278 * 已废弃,请使用 proxy-config.response.list
279 * @deprecated
280 */
281 list?: string | null
282 /**
283 * 已废弃,请使用 proxy-config.response.result
284 * @deprecated
285 */
286 result?: string
287 /**
288 * 已废弃,请使用 proxy-config.response.total
289 * @deprecated
290 */
291 total?: string
292 /**
293 * 已废弃,请使用 proxy-config.response.message
294 * @deprecated
295 */
296 message?: string
297 }
298 }
299 export interface ProxyOpts<D = VxeTableDataRow> extends ProxyConfig<D> { }
300
301 export interface ToolbarOpts extends ToolbarConfig { }
302 export interface ToolbarConfig extends VxeToolbarProps {
303 enabled?: boolean
304 zoom?: boolean | {
305 escRestore?: boolean
306 iconIn?: string
307 iconOut?: string
308 }
309 slots?: {
310 buttons?: string | ((params: { [key: string]: any }) => SlotVNodeType | SlotVNodeType[])
311 tools?: string | ((params: { [key: string]: any }) => SlotVNodeType | SlotVNodeType[])
312 }
313 }
314
315 export interface FormConfig extends VxeFormProps {
316 enabled?: boolean
317 items?: VxeFormItemProps[]
318 }
319 export interface FormOpts extends FormConfig {
320 inited?: boolean
321 }
322
323 export interface ZoomConfig {
324 escRestore?: boolean
325 }
326 export interface ZoomOpts extends ZoomConfig { }
327}
328
329export type VxeGridProps<D = VxeTableDataRow> = VxeTableProps<D> & {
330 layouts?: VxeGridPropTypes.Layouts
331 columns?: VxeGridPropTypes.Columns<D>
332 pagerConfig?: VxeGridPropTypes.PagerConfig
333 proxyConfig?: VxeGridPropTypes.ProxyConfig<D>
334 toolbarConfig?: VxeGridPropTypes.ToolbarConfig
335 formConfig?: VxeGridPropTypes.FormConfig
336 zoomConfig?: VxeGridPropTypes.ZoomConfig
337}
338
339export namespace VxeGridDefines {
340 interface GridEventParams<D = VxeTableDataRow> extends VxeEvent {
341 $grid: VxeGridConstructor<D>
342 }
343
344 export interface KeydownEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.KeydownEventParams<D> { }
345 export interface PasteEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.PasteEventParams<D> { }
346 export interface CopyEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.CopyEventParams<D> { }
347 export interface CutEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.CutEventParams<D> { }
348 export interface CurrentChangeEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.CurrentChangeEventParams<D> { }
349 export interface RadioChangeEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.RadioChangeEventParams<D> { }
350 export interface CheckboxChangeEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.CheckboxChangeEventParams<D> { }
351 export interface CheckboxAllEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.CheckboxAllEventParams<D> { }
352 export interface CheckboxRangeStartEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.CheckboxRangeStartEventParams<D> { }
353 export interface CheckboxRangeChangeEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.CheckboxRangeChangeEventParams<D> { }
354 export interface CheckboxRangeEndEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.CheckboxRangeEndEventParams<D> { }
355 export interface CellClickEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.CellClickEventParams<D> { }
356 export interface CellDblclickEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.CellDblclickEventParams<D> { }
357 export interface CellMenuEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.CellMenuEventParams<D> { }
358 export interface CellMouseenterEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.CellMouseenterEventParams<D> { }
359 export interface CellMouseleaveEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.CellMouseleaveEventParams<D> { }
360 export interface HeaderCellClickEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.HeaderCellClickEventParams<D> { }
361 export interface HeaderCellDblclickEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.HeaderCellDblclickEventParams<D> { }
362 export interface HeaderCellMenuEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.HeaderCellMenuEventParams<D> { }
363 export interface FooterCellClickEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.FooterCellClickEventParams<D> { }
364 export interface FooterCellDblclickEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.FooterCellDblclickEventParams<D> { }
365 export interface FooterCellMenuEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.FooterCellMenuEventParams<D> { }
366 export interface SortChangeEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.SortChangeEventParams<D> { }
367 export interface FilterChangeEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.FilterChangeEventParams<D> { }
368 export interface FilterVisibleEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.FilterVisibleEventParams<D> { }
369 export interface ResizableChangeEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.ResizableChangeEventParams<D> { }
370 export interface ToggleRowExpandEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.ToggleRowExpandEventParams<D> { }
371 export interface ToggleTreeExpandEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.ToggleTreeExpandEventParams<D> { }
372 export interface MenuClickEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.MenuClickEventParams<D> { }
373 export interface EditClosedEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.EditClosedEventParams<D> { }
374 export interface EditActivedEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.EditActivedEventParams<D> { }
375 export interface EditDisabledEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.EditDisabledEventParams<D> { }
376 export interface ValidErrorEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.ValidErrorEventParams<D> { }
377 export interface ScrollEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.ScrollEventParams<D> { }
378 export interface CustomEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeTableDefines.CustomEventParams<D> { }
379
380 export interface ProxyQueryEventParams<D = VxeTableDataRow> extends GridEventParams<D> {
381 status: boolean
382 isReload: boolean
383 isInited: boolean
384 }
385 export interface ProxyDeleteEventParams<D = VxeTableDataRow> extends GridEventParams<D> {
386 status: boolean
387 }
388 export interface ProxySaveEventParams<D = VxeTableDataRow> extends GridEventParams<D> {
389 status: boolean
390 }
391 export interface PageChangeEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxePagerDefines.PageChangeEventParams { }
392 export interface FormSubmitEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeFormDefines.SubmitEventParams { }
393 export interface FormSubmitInvalidEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeFormDefines.SubmitInvalidParams { }
394 export interface FormResetEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeFormDefines.ResetEventParams { }
395 export interface FormCollapseEventParams<D = VxeTableDataRow> extends GridEventParams<D>, VxeFormDefines.CollapseEventParams { }
396
397 export interface ToolbarButtonClickParams {
398 code: string
399 button: VxeToolbarPropTypes.ButtonConfig
400 }
401 export interface ToolbarButtonClickEventParams<D = VxeTableDataRow> extends GridEventParams<D>, ToolbarButtonClickParams { }
402
403 export interface ToolbarToolClickParams {
404 code: string
405 tool: VxeToolbarPropTypes.ToolConfig
406 }
407 export interface ToolbarToolClickEventParams<D = VxeTableDataRow> extends GridEventParams<D>, ToolbarToolClickParams { }
408
409 export interface ZoomParams {
410 type: 'max' | 'revert'
411 }
412 export interface ZoomEventParams<D = VxeTableDataRow> extends GridEventParams<D>, ZoomParams { }
413}
414
415export interface VxeGridEventProps<D = VxeTableDataRow> {
416 onKeydown?: VxeGridEvents.Keydown<D>
417 onPaste?: VxeGridEvents.Paste<D>
418 onCopy?: VxeGridEvents.Copy<D>
419 onCut?: VxeGridEvents.Cut<D>
420 onCurrentChange?: VxeGridEvents.CurrentChange<D>
421 onRadioChange?: VxeGridEvents.RadioChange<D>
422 onCheckboxChange?: VxeGridEvents.CheckboxChange<D>
423 onCheckboxAll?: VxeGridEvents.CheckboxAll<D>
424 onCheckboxRangeStart?: VxeGridEvents.CheckboxRangeStart<D>
425 onCheckboxRangeChange?: VxeGridEvents.CheckboxRangeChange<D>
426 onCheckboxRangeEnd?: VxeGridEvents.CheckboxRangeEnd<D>
427 onCellClick?: VxeGridEvents.CellClick<D>
428 onCellDblclick?: VxeGridEvents.CellDblclick<D>
429 onCellMenu?: VxeGridEvents.CellMenu<D>
430 onCellMouseenter?: VxeGridEvents.CellMouseenter<D>
431 onCellMouseleave?: VxeGridEvents.CellMouseleave<D>
432 onHeaderCellClick?: VxeGridEvents.HeaderCellClick<D>
433 onHeaderCellDblclick?: VxeGridEvents.HeaderCellDblclick<D>
434 onHeaderCellMenu?: VxeGridEvents.HeaderCellMenu<D>
435 onFooterCellClick?: VxeGridEvents.FooterCellClick<D>
436 onFooterCellDblclick?: VxeGridEvents.FooterCellDblclick<D>
437 onFooterCellMenu?: VxeGridEvents.FooterCellMenu<D>
438 onSortChange?: VxeGridEvents.SortChange<D>
439 onFilterChange?: VxeGridEvents.FilterChange<D>
440 onFilterVisible?: VxeGridEvents.FilterVisible<D>
441 onResizableChange?: VxeGridEvents.ResizableChange<D>
442 onToggleRowExpand?: VxeGridEvents.ToggleRowExpand<D>
443 onToggleTreeExpand?: VxeGridEvents.ToggleTreeExpand<D>
444 onMenuClick?: VxeGridEvents.MenuClick<D>
445 onEditClosed?: VxeGridEvents.EditClosed<D>
446 onEditActived?: VxeGridEvents.EditActived<D>
447 onEditDisabled?: VxeGridEvents.EditDisabled<D>
448 onValidError?: VxeGridEvents.ValidError<D>
449 onScroll?: VxeGridEvents.Scroll<D>
450 onCustom?: VxeGridEvents.Custom<D>
451
452 // grid
453 onProxyQuery?: VxeGridEvents.ProxyQuery<D>
454 onProxyDelete?: VxeGridEvents.ProxyDelete<D>
455 onProxySave?: VxeGridEvents.ProxySave<D>
456 onPageChange?: VxeGridEvents.PageChange<D>
457 onFormSubmit?: VxeGridEvents.FormSubmit<D>
458 onFormSubmitInvalid?: VxeGridEvents.FormSubmitInvalid<D>
459 onFormReset?: VxeGridEvents.FormReset<D>
460 onFormCollapse?: VxeGridEvents.FormCollapse<D>
461 onToolbarButtonClick?: VxeGridEvents.ToolbarButtonClick<D>
462 onToolbarToolClick?: VxeGridEvents.ToolbarToolClick<D>
463 onZoom?: VxeGridEvents.Zoom<D>
464}
465
466export interface VxeGridListeners<D = VxeTableDataRow> {
467 keydown?: VxeGridEvents.Keydown<D>
468 paste?: VxeGridEvents.Paste<D>
469 copy?: VxeGridEvents.Copy<D>
470 cut?: VxeGridEvents.Cut<D>
471 currentChange?: VxeGridEvents.CurrentChange<D>
472 radioChange?: VxeGridEvents.RadioChange<D>
473 checkboxChange?: VxeGridEvents.CheckboxChange<D>
474 checkboxAll?: VxeGridEvents.CheckboxAll<D>
475 checkboxRangeStart?: VxeGridEvents.CheckboxRangeStart<D>
476 checkboxRangeChange?: VxeGridEvents.CheckboxRangeChange<D>
477 checkboxRangeEnd?: VxeGridEvents.CheckboxRangeEnd<D>
478 cellClick?: VxeGridEvents.CellClick<D>
479 cellDblclick?: VxeGridEvents.CellDblclick<D>
480 cellMenu?: VxeGridEvents.CellMenu<D>
481 cellMouseenter?: VxeGridEvents.CellMouseenter<D>
482 cellMouseleave?: VxeGridEvents.CellMouseleave<D>
483 headerCellClick?: VxeGridEvents.HeaderCellClick<D>
484 headerCellDblclick?: VxeGridEvents.HeaderCellDblclick<D>
485 headerCellMenu?: VxeGridEvents.HeaderCellMenu<D>
486 footerCellClick?: VxeGridEvents.FooterCellClick<D>
487 footerCellDblclick?: VxeGridEvents.FooterCellDblclick<D>
488 footerCellMenu?: VxeGridEvents.FooterCellMenu<D>
489 sortChange?: VxeGridEvents.SortChange<D>
490 filterChange?: VxeGridEvents.FilterChange<D>
491 filterVisible?: VxeGridEvents.FilterVisible<D>
492 resizableChange?: VxeGridEvents.ResizableChange<D>
493 toggleRowExpand?: VxeGridEvents.ToggleRowExpand<D>
494 toggleTreeExpand?: VxeGridEvents.ToggleTreeExpand<D>
495 menuClick?: VxeGridEvents.MenuClick<D>
496 editClosed?: VxeGridEvents.EditClosed<D>
497 editActived?: VxeGridEvents.EditActived<D>
498 editDisabled?: VxeGridEvents.EditDisabled<D>
499 validError?: VxeGridEvents.ValidError<D>
500 scroll?: VxeGridEvents.Scroll<D>
501 custom?: VxeGridEvents.Custom<D>
502
503 // grid
504 proxyQuery?: VxeGridEvents.ProxyQuery<D>
505 proxyDelete?: VxeGridEvents.ProxyDelete<D>
506 proxySave?: VxeGridEvents.ProxySave<D>
507 pageChange?: VxeGridEvents.PageChange<D>
508 formSubmit?: VxeGridEvents.FormSubmit<D>
509 formSubmitInvalid?: VxeGridEvents.FormSubmitInvalid<D>
510 formReset?: VxeGridEvents.FormReset<D>
511 formCollapse?: VxeGridEvents.FormCollapse<D>
512 toolbarButtonClick?: VxeGridEvents.ToolbarButtonClick<D>
513 toolbarToolClick?: VxeGridEvents.ToolbarToolClick<D>
514 zoom?: VxeGridEvents.Zoom<D>
515}
516
517export namespace VxeGridEvents {
518 export type Keydown<D = any> = (params: VxeGridDefines.KeydownEventParams<D>) => void
519 export type Paste<D = any> = (params: VxeGridDefines.PasteEventParams<D>) => void
520 export type Copy<D = any> = (params: VxeGridDefines.CopyEventParams<D>) => void
521 export type Cut<D = any> = (params: VxeGridDefines.CutEventParams<D>) => void
522 export type CurrentChange<D = any> = (params: VxeGridDefines.CurrentChangeEventParams<D>) => void
523 export type RadioChange<D = any> = (params: VxeGridDefines.RadioChangeEventParams<D>) => void
524 export type CheckboxChange<D = any> = (params: VxeGridDefines.CheckboxChangeEventParams<D>) => void
525 export type CheckboxAll<D = any> = (params: VxeGridDefines.CheckboxAllEventParams<D>) => void
526 export type CheckboxRangeStart<D = any> = (params: VxeGridDefines.CheckboxRangeStartEventParams<D>) => void
527 export type CheckboxRangeChange<D = any> = (params: VxeGridDefines.CheckboxRangeChangeEventParams<D>) => void
528 export type CheckboxRangeEnd<D = any> = (params: VxeGridDefines.CheckboxRangeEndEventParams<D>) => void
529 export type CellClick<D = any> = (params: VxeGridDefines.CellClickEventParams<D>) => void
530 export type CellDblclick<D = any> = (params: VxeGridDefines.CellDblclickEventParams<D>) => void
531 export type CellMenu<D = any> = (params: VxeGridDefines.CellMenuEventParams<D>) => void
532 export type CellMouseenter<D = any> = (params: VxeGridDefines.CellMouseenterEventParams<D>) => void
533 export type CellMouseleave<D = any> = (params: VxeGridDefines.CellMouseleaveEventParams<D>) => void
534 export type HeaderCellClick<D = any> = (params: VxeGridDefines.HeaderCellClickEventParams<D>) => void
535 export type HeaderCellDblclick<D = any> = (params: VxeGridDefines.HeaderCellDblclickEventParams<D>) => void
536 export type HeaderCellMenu<D = any> = (params: VxeGridDefines.HeaderCellMenuEventParams<D>) => void
537 export type FooterCellClick<D = any> = (params: VxeGridDefines.FooterCellClickEventParams<D>) => void
538 export type FooterCellDblclick<D = any> = (params: VxeGridDefines.FooterCellDblclickEventParams<D>) => void
539 export type FooterCellMenu<D = any> = (params: VxeGridDefines.FooterCellMenuEventParams<D>) => void
540 export type SortChange<D = any> = (params: VxeGridDefines.SortChangeEventParams<D>) => void
541 export type FilterChange<D = any> = (params: VxeGridDefines.FilterChangeEventParams<D>) => void
542 export type FilterVisible<D = any> = (params: VxeGridDefines.FilterVisibleEventParams<D>) => void
543 export type ResizableChange<D = any> = (params: VxeGridDefines.ResizableChangeEventParams<D>) => void
544 export type ToggleRowExpand<D = any> = (params: VxeGridDefines.ToggleRowExpandEventParams<D>) => void
545 export type ToggleTreeExpand<D = any> = (params: VxeGridDefines.ToggleTreeExpandEventParams<D>) => void
546 export type MenuClick<D = any> = (params: VxeGridDefines.MenuClickEventParams<D>) => void
547 export type EditClosed<D = any> = (params: VxeGridDefines.EditClosedEventParams<D>) => void
548 export type EditActived<D = any> = (params: VxeGridDefines.EditActivedEventParams<D>) => void
549 export type EditDisabled<D = any> = (params: VxeGridDefines.EditDisabledEventParams<D>) => void
550 export type ValidError<D = any> = (params: VxeGridDefines.ValidErrorEventParams<D>) => void
551 export type Scroll<D = any> = (params: VxeGridDefines.ScrollEventParams<D>) => void
552 export type Custom<D = any> = (params: VxeGridDefines.CustomEventParams<D>) => void
553
554 export type ProxyQuery<D = any> = (params: VxeGridDefines.ProxyQueryEventParams<D>) => void
555 export type ProxyDelete<D = any> = (params: VxeGridDefines.ProxyDeleteEventParams<D>) => void
556 export type ProxySave<D = any> = (params: VxeGridDefines.ProxySaveEventParams<D>) => void
557 export type PageChange<D = any> = (params: VxeGridDefines.PageChangeEventParams<D>) => void
558 export type FormSubmit<D = any> = (params: VxeGridDefines.FormSubmitEventParams<D>) => void
559 export type FormSubmitInvalid<D = any> = (params: VxeGridDefines.FormSubmitInvalidEventParams<D>) => void
560 export type FormReset<D = any> = (params: VxeGridDefines.FormResetEventParams<D>) => void
561 export type FormCollapse<D = any> = (params: VxeGridDefines.FormCollapseEventParams<D>) => void
562 export type ToolbarButtonClick<D = any> = (params: VxeGridDefines.ToolbarButtonClickEventParams<D>) => void
563 export type ToolbarToolClick<D = any> = (params: VxeGridDefines.ToolbarToolClickEventParams<D>) => void
564 export type Zoom<D = any> = (params: VxeGridDefines.ZoomEventParams<D>) => void
565}
566
567export interface VxeGridSlots<D = VxeTableDataRow> {
568 /**
569 * 自定义空数据时显示模板
570 */
571 empty?(params: {
572 $table: VxeTableConstructor<D>
573 $grid: VxeGridConstructor<D> | null | undefined
574 }): any
575 /**
576 * 自定义加载中模板
577 */
578 loading?(params: {
579 $table: VxeTableConstructor<D>
580 $grid: VxeGridConstructor<D> | null | undefined
581 }): any
582 /**
583 * 自定义表单模板
584 */
585 form?(params: {
586 $table: VxeTableConstructor<D>
587 $grid: VxeGridConstructor<D> | null | undefined
588 }): any
589 /**
590 * 自定义工具栏模板
591 */
592 toolbar?(params: {
593 $table: VxeTableConstructor<D>
594 $grid: VxeGridConstructor<D> | null | undefined
595 }): any
596 /**
597 * 自定义表格顶部模板
598 */
599 top?(params: {
600 $table: VxeTableConstructor<D>
601 $grid: VxeGridConstructor<D> | null | undefined
602 }): any
603 /**
604 * 表格底部模板
605 */
606 bottom?(params: {
607 $table: VxeTableConstructor<D>
608 $grid: VxeGridConstructor<D> | null | undefined
609 }): any
610 /**
611 * 自定义分页模板
612 */
613 pager?(params: {
614 $table: VxeTableConstructor<D>
615 $grid: VxeGridConstructor<D> | null | undefined
616 }): any
617
618 /**
619 * 自定义插槽模板
620 */
621 [key: string]: ((params: {
622 $table: VxeTableConstructor<D>
623 $grid: VxeGridConstructor<D> | null | undefined
624 row: D
625 rowIndex: number
626 $rowIndex: number
627 _rowIndex: number
628 column: VxeTableDefines.ColumnInfo<D>
629 columnIndex: number
630 $columnIndex: number
631 _columnIndex: number
632
633 checked?: boolean
634 indeterminate?: boolean
635
636 items: D[]
637
638 [key: string]: any
639 }) => any) | undefined
640}