UNPKG

3.17 kBTypeScriptView Raw
1import { VNode } from 'vue'
2import { Table } from './table'
3import { ColumnOptions } from './column'
4import { FormOptions } from './form'
5import { FormItemOptions } from './form-item'
6import { ToolbarOptions } from './toolbar'
7import { PagerOptions } from './pager'
8import { RowInfo } from './component'
9
10/**
11 * 高级表格
12 */
13export declare class Grid extends Table {
14 /**
15 * 列配置
16 */
17 columns?: GridColumns[];
18 /**
19 * 分页配置项
20 */
21 pagerConfig?: GridPagerConfig;
22 /**
23 * 数据代理配置项
24 */
25 proxyConfig?: GridProxyConfig;
26 proxyOpts: GridProxyConfig;
27 /**
28 * 工具栏配置
29 */
30 toolbarConfig?: GridToolbarConfig;
31 /**
32 * 表单配置项
33 */
34 formConfig?: GridFormOptions;
35 formOpts: GridFormOptions;
36
37 /**
38 * 给数据代理提交指令
39 * @param code 指令编码
40 */
41 commitProxy(code: string): Promise<any>;
42 /**
43 * 获取表单项列表
44 */
45 getFormItems(index?: number): FormItemOptions[];
46 /**
47 * 获取已标记删除的数据
48 */
49 getPendingRecords(): RowInfo[];
50 /**
51 * 切换表格最大化/还原
52 */
53 zoom(): Promise<boolean>;
54 /**
55 * 判断是否最大化显示
56 */
57 isMaximized(): boolean;
58 /**
59 * 如果表格处于常规状态,则最大化表格
60 */
61 maximize(): Promise<any>;
62 /**
63 * 如果表格处于最大化状态,则还原表格
64 */
65 revert(): Promise<any>;
66 /**
67 * 获取数据代理信息
68 */
69 getProxyInfo(): {
70 data: any;
71 filter: any;
72 form: any;
73 sort: any;
74 pager: any;
75 pendingRecords: any[];
76 };
77 [key: string]: any;
78}
79
80export interface GridProxyQueryPageParams {
81 pageSize: number;
82 currentPage: number;
83}
84
85export interface GridProxyQuerySortParams {
86 order: string;
87 property: string;
88}
89
90export interface GridProxyQueryFiltersParams {
91 property: string;
92 values: any[];
93}
94
95export interface GridProxyConfig {
96 autoLoad?: boolean;
97 message?: boolean;
98 seq?: boolean;
99 sort?: boolean;
100 filter?: boolean;
101 form?: boolean;
102 props?: {
103 list?: string;
104 result?: string;
105 total?: string;
106 message?: string;
107 };
108 ajax?: {
109 query?(params: { page: GridProxyQueryPageParams, sort: GridProxyQuerySortParams, filters: GridProxyQueryFiltersParams[], form: any }, ...args: any[]): Promise<any>;
110 delete?(params: { body: { removeRecords: any[] } }, ...args: any[]): Promise<any>;
111 save?(params: { body: { insertRecords: any[], updateRecords: any[], removeRecords: any[], pendingRecords: any[] } }, ...args: any[]): Promise<any>;
112 }
113 [key: string]: any;
114}
115
116export interface GridPagerConfig extends PagerOptions {
117 [key: string]: any;
118}
119
120export interface GridColumns extends ColumnOptions {
121 children?: GridColumns[];
122}
123
124export interface GridToolbarConfig extends ToolbarOptions {
125 zoom?: boolean | {
126 escRestore?: boolean;
127 iconIn?: string;
128 iconOut?: string;
129 };
130 slots?: {
131 buttons?(): VNode[] | string[];
132 tools?(): VNode[] | string[];
133 }
134}
135
136export interface GridFormOptions extends FormOptions {
137 [key: string]: any;
138}