@juzhenfe/page-model 3.14.9 → 3.14.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,23 +1,26 @@
1
1
  /// <reference path="../../types/common.d.ts" />
2
2
 
3
- import { PaginationProps } from "element-plus";
4
- import { Sort } from "element-plus/es/components/table/src/table/defaults";
3
+ import { PaginationProps } from 'element-plus'
4
+ import { Sort } from 'element-plus/es/components/table/src/table/defaults'
5
5
  import TableManagerDefault from './constructor'
6
- import { Component } from "vue";
7
- import { type FilterItemTypeEnum, type FilterMatchModeEnum} from "./components/table-column/components/filter-zone/utils";
6
+ import { Component } from 'vue'
7
+ import {
8
+ type FilterItemTypeEnum,
9
+ type FilterMatchModeEnum,
10
+ } from './components/table-column/components/filter-zone/utils'
8
11
 
9
12
  declare global {
10
13
  namespace PageModel {
11
14
  type TableManager = TableManagerDefault
12
15
 
13
16
  type Pagination = {
14
- show?: boolean;
15
- } & Partial<PaginationProps>;
17
+ show?: boolean
18
+ } & Partial<PaginationProps>
16
19
 
17
20
  type TableDataExportModel = {
18
- data: any[];
19
- columns: any[];
20
- filename: string;
21
+ data: any[]
22
+ columns: any[]
23
+ filename: string
21
24
  }
22
25
 
23
26
  /**
@@ -27,180 +30,212 @@ declare global {
27
30
  /**
28
31
  * 列的属性
29
32
  */
30
- prop: string;
33
+ prop: string
31
34
  /**
32
35
  * 过滤类型
33
36
  */
34
- filterType?: FilterItemTypeEnum;
37
+ filterType?: FilterItemTypeEnum
35
38
  /**
36
39
  * 筛选条件文本
37
40
  */
38
- filterLabel?: string;
41
+ filterLabel?: string
39
42
  /**
40
43
  * 筛选项
41
44
  */
42
- filterOptions?: Array<{ label: string; value: string | boolean | number }>;
45
+ filterOptions?: Array<{ label: string; value: string | boolean | number }>
43
46
  /**
44
47
  * 当前条件
45
48
  */
46
- condition?: FilterMatchModeEnum;
49
+ condition?: FilterMatchModeEnum
47
50
  /**
48
51
  * 输入的值
49
52
  */
50
- value?: any;
53
+ value?: any
51
54
  }
52
55
 
53
56
  type SortOption = 'ascending' | 'descending' | null
54
57
 
58
+ /**
59
+ * 工具栏事件
60
+ */
61
+ type ToolBoxEvent =
62
+ | 'export'
63
+ | 'fullscreen'
64
+ | 'colunm-tool'
65
+ | 'filter'
66
+ | 'sort'
67
+
55
68
  /**
56
69
  * 列排序参数
57
70
  */
58
71
  type TableColumnSortParamsItem = {
59
- prop: string;
60
- order?: SortOption;
61
- label?: string;
72
+ prop: string
73
+ order?: SortOption
74
+ label?: string
62
75
  }
63
76
 
64
77
  type TableProps = {
65
- size?: Size;
66
- border?: boolean;
67
- resizable?: boolean;
68
- elementLoadingText?: string;
69
- height?: string | number;
70
- maxHeight?: string | number;
71
- fit?: boolean;
72
- stripe?: boolean;
73
- rowKey?: string;
74
- showHeader?: boolean;
75
- showSummary?: boolean;
76
- sumText?: string;
77
- summaryMethod?: AnyFunction;
78
- rowClassName?: string | AnyFunction;
79
- rowStyle?: AnyObject | AnyFunction;
80
- cellClassName?: string | AnyFunction;
81
- cellStyle?: AnyObject | AnyFunction;
82
- headerRowClassName?: string | AnyFunction;
83
- headerRowStyle?: AnyObject | AnyFunction;
84
- headerCellClassName?: string | AnyFunction;
85
- headerCellStyle?: AnyObject | AnyFunction;
86
- highlightCurrentRow?: boolean;
87
- currentRowKey?: string | number;
88
- emptyText?: string;
89
- expandRowKeys?: any[];
90
- defaultExpandAll?: boolean;
91
- defaultSort?: Sort;
92
- tooltipEffect?: string;
93
- spanMethod?: AnyFunction;
94
- selectOnIndeterminate?: boolean;
95
- indent?: number;
78
+ size?: Size
79
+ border?: boolean
80
+ resizable?: boolean
81
+ elementLoadingText?: string
82
+ height?: string | number
83
+ maxHeight?: string | number
84
+ fit?: boolean
85
+ stripe?: boolean
86
+ rowKey?: string
87
+ showHeader?: boolean
88
+ showSummary?: boolean
89
+ sumText?: string
90
+ summaryMethod?: AnyFunction
91
+ rowClassName?: string | AnyFunction
92
+ rowStyle?: AnyObject | AnyFunction
93
+ cellClassName?: string | AnyFunction
94
+ cellStyle?: AnyObject | AnyFunction
95
+ headerRowClassName?: string | AnyFunction
96
+ headerRowStyle?: AnyObject | AnyFunction
97
+ headerCellClassName?: string | AnyFunction
98
+ headerCellStyle?: AnyObject | AnyFunction
99
+ highlightCurrentRow?: boolean
100
+ currentRowKey?: string | number
101
+ emptyText?: string
102
+ expandRowKeys?: any[]
103
+ defaultExpandAll?: boolean
104
+ defaultSort?: Sort
105
+ tooltipEffect?: string
106
+ spanMethod?: AnyFunction
107
+ selectOnIndeterminate?: boolean
108
+ indent?: number
96
109
  treeProps?: {
97
- hasChildren?: string;
98
- children?: string;
99
- };
100
- lazy?: boolean;
101
- load?: AnyFunction;
102
- _customSummary?: boolean;
110
+ hasChildren?: string
111
+ children?: string
112
+ }
113
+ lazy?: boolean
114
+ load?: AnyFunction
115
+ _customSummary?: boolean
103
116
  }
104
117
 
105
118
  type TableEvents<MODEL = any> = {
106
- select?: (selection: any[], row: MODEL) => void;
107
- selectAll?: (selection: any[]) => void;
108
- selectionChange?: (selection: any[]) => void;
109
- cellMouseEnter?: (row: MODEL, column: any, cell: any, event: any) => void;
110
- cellMouseLeave?: (row: MODEL, column: any, cell: any, event: any) => void;
111
- cellClick?: (row: MODEL, column: any, cell: any, event: any) => void;
112
- cellDblclick?: (row: MODEL, column: any, cell: any, event: any) => void;
113
- rowClick?: (row: MODEL, column: any, event: any) => void;
114
- rowContextmenu?: (row: MODEL, column: any, event: any) => void;
115
- rowDblclick?: (row: MODEL, column: any, event: any) => void;
116
- headerClick?: (row: MODEL, column: any, event: any) => void;
117
- headerContextmenu?: (column: any, event: any) => void;
118
- sortChange?: ({ column, prop, order }: { column: any, prop: string, order: SortOption }) => void;
119
- filterChange?: (filters: any[]) => void;
120
- currentChange?: (currentRow: MODEL, oldCurrentRow: MODEL) => void;
121
- headerDragend?: (newWidth: number, oldWidth: number, column: any, event: any) => void;
122
- expandChange?: (row: MODEL, expanded: any) => void;
119
+ select?: (selection: any[], row: MODEL) => void
120
+ selectAll?: (selection: any[]) => void
121
+ selectionChange?: (selection: any[]) => void
122
+ cellMouseEnter?: (row: MODEL, column: any, cell: any, event: any) => void
123
+ cellMouseLeave?: (row: MODEL, column: any, cell: any, event: any) => void
124
+ cellClick?: (row: MODEL, column: any, cell: any, event: any) => void
125
+ cellDblclick?: (row: MODEL, column: any, cell: any, event: any) => void
126
+ rowClick?: (row: MODEL, column: any, event: any) => void
127
+ rowContextmenu?: (row: MODEL, column: any, event: any) => void
128
+ rowDblclick?: (row: MODEL, column: any, event: any) => void
129
+ headerClick?: (row: MODEL, column: any, event: any) => void
130
+ headerContextmenu?: (column: any, event: any) => void
131
+ sortChange?: ({
132
+ column,
133
+ prop,
134
+ order,
135
+ }: {
136
+ column: any
137
+ prop: string
138
+ order: SortOption
139
+ }) => void
140
+ filterChange?: (filters: any[]) => void
141
+ currentChange?: (currentRow: MODEL, oldCurrentRow: MODEL) => void
142
+ headerDragend?: (
143
+ newWidth: number,
144
+ oldWidth: number,
145
+ column: any,
146
+ event: any
147
+ ) => void
148
+ expandChange?: (row: MODEL, expanded: any) => void
123
149
  }
124
150
 
125
151
  type Table<MODEL = any, CTX = any> = {
126
- els: TableBaseItem<MODEL, CTX>[];
127
- pagination?: Pagination;
128
- loadingDirectiveName?: string;
129
- props?: ConvertFunctionContext<TableProps, CTX>;
152
+ els: TableBaseItem<MODEL, CTX>[]
153
+ pagination?: Pagination
154
+ loadingDirectiveName?: string
155
+ props?: ConvertFunctionContext<TableProps, CTX>
130
156
  events?: ConvertFunctionContext<TableEvents<MODEL>, CTX>
131
157
  /**
132
158
  * 是否可拖拽
133
159
  */
134
- dragable?: boolean;
160
+ dragable?: boolean
135
161
 
136
162
  /**
137
163
  * 是否保存列筛选
138
164
  */
139
- saveFilter?: boolean;
165
+ saveFilter?: boolean
140
166
 
141
167
  /**
142
168
  * 是否保存列排序
143
169
  */
144
- saveSort?: boolean;
170
+ saveSort?: boolean
145
171
 
146
172
  /**
147
173
  * 显示工具列
148
174
  */
149
- showTools?: boolean;
175
+ showTools?: boolean
150
176
  /**
151
177
  * 是否显示汇总
152
178
  */
153
- showSummary?: boolean;
179
+ showSummary?: boolean
154
180
  /**
155
181
  * 显示索引列
156
182
  */
157
- showIndex?: boolean;
183
+ showIndex?: boolean
158
184
  /**
159
185
  * 显示多选条数提示
160
186
  */
161
- showSelectableTip?: boolean;
187
+ showSelectableTip?: boolean
162
188
  /**
163
189
  * 是否多选
164
190
  */
165
- selectable?: boolean;
191
+ selectable?: boolean
166
192
  /**
167
193
  * 点击行自动选中
168
194
  */
169
- rowClickSelect?: boolean;
195
+ rowClickSelect?: boolean
170
196
  /**
171
197
  * 多选的操作按钮
172
198
  */
173
- selectableButtons?: Button<MODEL, CTX>[];
199
+ selectableButtons?: Button<MODEL, CTX>[]
174
200
  /**
175
201
  * 多选操作独自存活
176
202
  */
177
- selectableButtonLiveAlone?: boolean;
203
+ selectableButtonLiveAlone?: boolean
178
204
  /**
179
205
  * 开启单选
180
206
  */
181
- showRadio?: boolean;
207
+ showRadio?: boolean
182
208
  // 是否可编辑
183
- editable?: boolean;
209
+ editable?: boolean
184
210
  // 汇总结果处理
185
- summaryProcessFn?: (...rest: any[]) => any;
211
+ summaryProcessFn?: (...rest: any[]) => any
186
212
  /**
187
213
  * 汇总过程处理
188
- * @param this
214
+ * @param this
189
215
  * @param data 数据列表
190
216
  * @param prop 当前列表的prop
191
217
  * @param summaryType 合计类型 1累加 2汇总条数
192
- * @returns
218
+ * @returns
193
219
  */
194
- summaryItemFn?: (this: any, data: any[], prop: string, summaryType: number) => any;
220
+ summaryItemFn?: (
221
+ this: any,
222
+ data: any[],
223
+ prop: string,
224
+ summaryType: number
225
+ ) => any
195
226
  // 本地筛选工具
196
- showStaticFilter?: boolean;
227
+ showStaticFilter?: boolean
197
228
  // 保存筛选到本地
198
- saveStaticFilter?: boolean;
229
+ saveStaticFilter?: boolean
199
230
  // xlsx配置
200
231
  xlsx?: {
201
232
  // 单元格合并规则
202
- mergeFn?: (this: TableManager, exportData: MODEL[], columns: TableBaseItem<MODEL, CTX>[]) => { s: { r: number, c: number }, e: { r: number, c: number } }[]
203
- };
233
+ mergeFn?: (
234
+ this: TableManager,
235
+ exportData: MODEL[],
236
+ columns: TableBaseItem<MODEL, CTX>[]
237
+ ) => { s: { r: number; c: number }; e: { r: number; c: number } }[]
238
+ }
204
239
 
205
240
  /**
206
241
  * 提供外部多选导出数据
@@ -211,40 +246,61 @@ declare global {
211
246
  * 操作栏
212
247
  */
213
248
  operate?: {
214
- width?: string | number;
215
- els: Button<MODEL, CTX>[];
216
- props?: TableBaseItemProps;
217
- };
249
+ width?: string | number
250
+ els: Button<MODEL, CTX>[]
251
+ props?: TableBaseItemProps
252
+ }
253
+
254
+ /**
255
+ * 上下文菜单
256
+ */
257
+ contextMenu?: {
258
+ /**
259
+ * 是否包含操作栏
260
+ */
261
+ containOperation?: boolean
262
+ /**
263
+ * 其它项
264
+ */
265
+ els?: Button<MODEL, CTX>[]
266
+ }
267
+
218
268
  /**
219
269
  * 工具箱
220
270
  */
221
- toolbox?: ('export' | 'fullscreen' | 'colunm-tool' | 'filter' | 'sort')[]
271
+ toolbox?: ToolBoxEvent[]
222
272
 
223
273
  /**
224
274
  * 工具栏显示模式
225
275
  */
226
- toolboxShowMode?: 'button' | 'icon';
276
+ toolboxShowMode?: 'button' | 'icon'
227
277
 
228
278
  /**
229
279
  * 扩展工具栏
230
280
  */
231
281
  extendsToolbox?: {
232
- icon: Component;
233
- text?: string;
234
- event: string;
282
+ icon: Component
283
+ text?: string
284
+ event: string
235
285
  }[]
236
286
  /**
237
287
  * 列筛选参数处理函数
238
288
  */
239
- columnParamsProcessFn?: (this: TableManager, paramsList: PageModel.TableColumnParamsItem[]) => unknown
289
+ columnParamsProcessFn?: (
290
+ this: TableManager,
291
+ paramsList: PageModel.TableColumnParamsItem[]
292
+ ) => unknown
240
293
  /**
241
294
  * 列筛选参数查询立即执行
242
295
  */
243
- columnParamsQueryImmediate?: boolean;
296
+ columnParamsQueryImmediate?: boolean
244
297
  /**
245
298
  * 列排序参数处理函数
246
299
  */
247
- columnSortParamsProcessFn?: (this: TableManager, sortParamsList: PageModel.TableColumnSortParamsItem[]) => unknown
300
+ columnSortParamsProcessFn?: (
301
+ this: TableManager,
302
+ sortParamsList: PageModel.TableColumnSortParamsItem[]
303
+ ) => unknown
248
304
  }
249
305
  }
250
306
  }