@juzhenfe/page-model 3.14.10 → 3.14.12

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,27 +30,27 @@ 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
@@ -55,157 +58,184 @@ declare global {
55
58
  /**
56
59
  * 工具栏事件
57
60
  */
58
- type ToolBoxEvent = 'export' | 'fullscreen' | 'colunm-tool' | 'filter' | 'sort'
61
+ type ToolBoxEvent =
62
+ | 'export'
63
+ | 'fullscreen'
64
+ | 'colunm-tool'
65
+ | 'filter'
66
+ | 'sort'
59
67
 
60
68
  /**
61
69
  * 列排序参数
62
70
  */
63
71
  type TableColumnSortParamsItem = {
64
- prop: string;
65
- order?: SortOption;
66
- label?: string;
72
+ prop: string
73
+ order?: SortOption
74
+ label?: string
67
75
  }
68
76
 
69
77
  type TableProps = {
70
- size?: Size;
71
- border?: boolean;
72
- resizable?: boolean;
73
- elementLoadingText?: string;
74
- height?: string | number;
75
- maxHeight?: string | number;
76
- fit?: boolean;
77
- stripe?: boolean;
78
- rowKey?: string;
79
- showHeader?: boolean;
80
- showSummary?: boolean;
81
- sumText?: string;
82
- summaryMethod?: AnyFunction;
83
- rowClassName?: string | AnyFunction;
84
- rowStyle?: AnyObject | AnyFunction;
85
- cellClassName?: string | AnyFunction;
86
- cellStyle?: AnyObject | AnyFunction;
87
- headerRowClassName?: string | AnyFunction;
88
- headerRowStyle?: AnyObject | AnyFunction;
89
- headerCellClassName?: string | AnyFunction;
90
- headerCellStyle?: AnyObject | AnyFunction;
91
- highlightCurrentRow?: boolean;
92
- currentRowKey?: string | number;
93
- emptyText?: string;
94
- expandRowKeys?: any[];
95
- defaultExpandAll?: boolean;
96
- defaultSort?: Sort;
97
- tooltipEffect?: string;
98
- spanMethod?: AnyFunction;
99
- selectOnIndeterminate?: boolean;
100
- 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
101
109
  treeProps?: {
102
- hasChildren?: string;
103
- children?: string;
104
- };
105
- lazy?: boolean;
106
- load?: AnyFunction;
107
- _customSummary?: boolean;
110
+ hasChildren?: string
111
+ children?: string
112
+ }
113
+ lazy?: boolean
114
+ load?: AnyFunction
115
+ _customSummary?: boolean
108
116
  }
109
117
 
110
118
  type TableEvents<MODEL = any> = {
111
- select?: (selection: any[], row: MODEL) => void;
112
- selectAll?: (selection: any[]) => void;
113
- selectionChange?: (selection: any[]) => void;
114
- cellMouseEnter?: (row: MODEL, column: any, cell: any, event: any) => void;
115
- cellMouseLeave?: (row: MODEL, column: any, cell: any, event: any) => void;
116
- cellClick?: (row: MODEL, column: any, cell: any, event: any) => void;
117
- cellDblclick?: (row: MODEL, column: any, cell: any, event: any) => void;
118
- rowClick?: (row: MODEL, column: any, event: any) => void;
119
- rowContextmenu?: (row: MODEL, column: any, event: any) => void;
120
- rowDblclick?: (row: MODEL, column: any, event: any) => void;
121
- headerClick?: (row: MODEL, column: any, event: any) => void;
122
- headerContextmenu?: (column: any, event: any) => void;
123
- sortChange?: ({ column, prop, order }: { column: any, prop: string, order: SortOption }) => void;
124
- filterChange?: (filters: any[]) => void;
125
- currentChange?: (currentRow: MODEL, oldCurrentRow: MODEL) => void;
126
- headerDragend?: (newWidth: number, oldWidth: number, column: any, event: any) => void;
127
- 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
128
149
  }
129
150
 
130
151
  type Table<MODEL = any, CTX = any> = {
131
- els: TableBaseItem<MODEL, CTX>[];
132
- pagination?: Pagination;
133
- loadingDirectiveName?: string;
134
- props?: ConvertFunctionContext<TableProps, CTX>;
152
+ els: TableBaseItem<MODEL, CTX>[]
153
+ pagination?: Pagination
154
+ loadingDirectiveName?: string
155
+ props?: ConvertFunctionContext<TableProps, CTX>
135
156
  events?: ConvertFunctionContext<TableEvents<MODEL>, CTX>
136
157
  /**
137
158
  * 是否可拖拽
138
159
  */
139
- dragable?: boolean;
160
+ dragable?: boolean
140
161
 
141
162
  /**
142
163
  * 是否保存列筛选
143
164
  */
144
- saveFilter?: boolean;
165
+ saveFilter?: boolean
145
166
 
146
167
  /**
147
168
  * 是否保存列排序
148
169
  */
149
- saveSort?: boolean;
170
+ saveSort?: boolean
150
171
 
151
172
  /**
152
173
  * 显示工具列
153
174
  */
154
- showTools?: boolean;
175
+ showTools?: boolean
155
176
  /**
156
177
  * 是否显示汇总
157
178
  */
158
- showSummary?: boolean;
179
+ showSummary?: boolean
159
180
  /**
160
181
  * 显示索引列
161
182
  */
162
- showIndex?: boolean;
183
+ showIndex?: boolean
163
184
  /**
164
185
  * 显示多选条数提示
165
186
  */
166
- showSelectableTip?: boolean;
187
+ showSelectableTip?: boolean
167
188
  /**
168
189
  * 是否多选
169
190
  */
170
- selectable?: boolean;
191
+ selectable?: boolean
171
192
  /**
172
193
  * 点击行自动选中
173
194
  */
174
- rowClickSelect?: boolean;
195
+ rowClickSelect?: boolean
175
196
  /**
176
197
  * 多选的操作按钮
177
198
  */
178
- selectableButtons?: Button<MODEL, CTX>[];
199
+ selectableButtons?: Button<MODEL, CTX>[]
179
200
  /**
180
201
  * 多选操作独自存活
181
202
  */
182
- selectableButtonLiveAlone?: boolean;
203
+ selectableButtonLiveAlone?: boolean
183
204
  /**
184
205
  * 开启单选
185
206
  */
186
- showRadio?: boolean;
207
+ showRadio?: boolean
187
208
  // 是否可编辑
188
- editable?: boolean;
209
+ editable?: boolean
189
210
  // 汇总结果处理
190
- summaryProcessFn?: (...rest: any[]) => any;
211
+ summaryProcessFn?: (...rest: any[]) => any
191
212
  /**
192
213
  * 汇总过程处理
193
- * @param this
214
+ * @param this
194
215
  * @param data 数据列表
195
216
  * @param prop 当前列表的prop
196
217
  * @param summaryType 合计类型 1累加 2汇总条数
197
- * @returns
218
+ * @returns
198
219
  */
199
- 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
200
226
  // 本地筛选工具
201
- showStaticFilter?: boolean;
227
+ showStaticFilter?: boolean
202
228
  // 保存筛选到本地
203
- saveStaticFilter?: boolean;
229
+ saveStaticFilter?: boolean
204
230
  // xlsx配置
205
231
  xlsx?: {
206
232
  // 单元格合并规则
207
- mergeFn?: (this: TableManager, exportData: MODEL[], columns: TableBaseItem<MODEL, CTX>[]) => { s: { r: number, c: number }, e: { r: number, c: number } }[]
208
- };
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
+ }
209
239
 
210
240
  /**
211
241
  * 提供外部多选导出数据
@@ -216,10 +246,25 @@ declare global {
216
246
  * 操作栏
217
247
  */
218
248
  operate?: {
219
- width?: string | number;
220
- els: Button<MODEL, CTX>[];
221
- props?: TableBaseItemProps;
222
- };
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
+
223
268
  /**
224
269
  * 工具箱
225
270
  */
@@ -228,28 +273,34 @@ declare global {
228
273
  /**
229
274
  * 工具栏显示模式
230
275
  */
231
- toolboxShowMode?: 'button' | 'icon';
276
+ toolboxShowMode?: 'button' | 'icon'
232
277
 
233
278
  /**
234
279
  * 扩展工具栏
235
280
  */
236
281
  extendsToolbox?: {
237
- icon: Component;
238
- text?: string;
239
- event: string;
282
+ icon: Component
283
+ text?: string
284
+ event: string
240
285
  }[]
241
286
  /**
242
287
  * 列筛选参数处理函数
243
288
  */
244
- columnParamsProcessFn?: (this: TableManager, paramsList: PageModel.TableColumnParamsItem[]) => unknown
289
+ columnParamsProcessFn?: (
290
+ this: TableManager,
291
+ paramsList: PageModel.TableColumnParamsItem[]
292
+ ) => unknown
245
293
  /**
246
294
  * 列筛选参数查询立即执行
247
295
  */
248
- columnParamsQueryImmediate?: boolean;
296
+ columnParamsQueryImmediate?: boolean
249
297
  /**
250
298
  * 列排序参数处理函数
251
299
  */
252
- columnSortParamsProcessFn?: (this: TableManager, sortParamsList: PageModel.TableColumnSortParamsItem[]) => unknown
300
+ columnSortParamsProcessFn?: (
301
+ this: TableManager,
302
+ sortParamsList: PageModel.TableColumnSortParamsItem[]
303
+ ) => unknown
253
304
  }
254
305
  }
255
306
  }