@cyberpunk-vue/components 1.13.5 → 1.13.6

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.
@@ -59,6 +59,18 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
59
59
  readonly defaultSort: {
60
60
  readonly type: import('vue').PropType<import('.').SortState>;
61
61
  };
62
+ readonly sortState: {
63
+ readonly type: import('vue').PropType<import('.').SortState>;
64
+ readonly default: undefined;
65
+ };
66
+ readonly manualSort: {
67
+ readonly type: BooleanConstructor;
68
+ readonly default: false;
69
+ };
70
+ readonly sortOrders: {
71
+ readonly type: import('vue').PropType<import('.').SortOrder[]>;
72
+ readonly default: () => (string | null)[];
73
+ };
62
74
  readonly color: {
63
75
  readonly type: StringConstructor;
64
76
  readonly default: "";
@@ -120,10 +132,11 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
120
132
  "onSelect-all"?: ((selection: import('.').SelectionPayload) => any) | undefined;
121
133
  "onCurrent-change"?: ((currentRow: any, oldRow: any) => any) | undefined;
122
134
  "onUpdate:checkedKeys"?: ((keys: (string | number)[]) => any) | undefined;
123
- "onSort-change"?: ((sortState: import('.').SortState) => any) | undefined;
135
+ "onSort-change"?: ((_sortState: import('.').SortChangePayload) => any) | undefined;
124
136
  "onRow-click"?: ((row: any, index: number, event: MouseEvent) => any) | undefined;
125
137
  "onSelection-change"?: ((selection: import('.').SelectionPayload) => any) | undefined;
126
138
  "onExpand-change"?: ((row: any, expanded: boolean) => any) | undefined;
139
+ "onUpdate:sortState"?: ((_sortState: import('.').SortState) => any) | undefined;
127
140
  }>, {
128
141
  clearSelection: () => void;
129
142
  setSelectionKeys: (keys: (string | number)[]) => void;
@@ -133,6 +146,8 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
133
146
  getHalfCheckedKeys: () => (string | number)[];
134
147
  getSelectionDetail: () => import('.').SelectionDetail;
135
148
  sort: (prop: string, order: import('.').SortOrder) => void;
149
+ clearSort: () => void;
150
+ getSortState: () => import('.').SortState;
136
151
  setCurrentRow: (row: any) => void;
137
152
  toggleRowExpansion: (row: any, expanded?: boolean) => void;
138
153
  expandAll: () => void;
@@ -143,10 +158,11 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
143
158
  "select-all": (selection: import('.').SelectionPayload) => void;
144
159
  "current-change": (currentRow: any, oldRow: any) => void;
145
160
  "update:checkedKeys": (keys: (string | number)[]) => void;
146
- "sort-change": (sortState: import('.').SortState) => void;
161
+ "sort-change": (_sortState: import('.').SortChangePayload) => void;
147
162
  "row-click": (row: any, index: number, event: MouseEvent) => void;
148
163
  "selection-change": (selection: import('.').SelectionPayload) => void;
149
164
  "expand-change": (row: any, expanded: boolean) => void;
165
+ "update:sortState": (_sortState: import('.').SortState) => void;
150
166
  }, import('vue').PublicProps, {
151
167
  readonly size: import('@cyberpunk-vue/hooks').Size;
152
168
  readonly data: any[];
@@ -165,6 +181,9 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
165
181
  readonly rowClassName: import('.').TableRowClassName;
166
182
  readonly emptyText: string;
167
183
  readonly rowKey: string | ((row: any) => string | number);
184
+ readonly sortState: import('.').SortState;
185
+ readonly manualSort: boolean;
186
+ readonly sortOrders: import('.').SortOrder[];
168
187
  readonly treeProps: import('.').TableTreeProps;
169
188
  readonly expandRowKeys: (string | number)[];
170
189
  readonly rowExpandable: (row: any) => boolean;
@@ -224,6 +243,18 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
224
243
  readonly defaultSort: {
225
244
  readonly type: import('vue').PropType<import('.').SortState>;
226
245
  };
246
+ readonly sortState: {
247
+ readonly type: import('vue').PropType<import('.').SortState>;
248
+ readonly default: undefined;
249
+ };
250
+ readonly manualSort: {
251
+ readonly type: BooleanConstructor;
252
+ readonly default: false;
253
+ };
254
+ readonly sortOrders: {
255
+ readonly type: import('vue').PropType<import('.').SortOrder[]>;
256
+ readonly default: () => (string | null)[];
257
+ };
227
258
  readonly color: {
228
259
  readonly type: StringConstructor;
229
260
  readonly default: "";
@@ -285,10 +316,11 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
285
316
  "onSelect-all"?: ((selection: import('.').SelectionPayload) => any) | undefined;
286
317
  "onCurrent-change"?: ((currentRow: any, oldRow: any) => any) | undefined;
287
318
  "onUpdate:checkedKeys"?: ((keys: (string | number)[]) => any) | undefined;
288
- "onSort-change"?: ((sortState: import('.').SortState) => any) | undefined;
319
+ "onSort-change"?: ((_sortState: import('.').SortChangePayload) => any) | undefined;
289
320
  "onRow-click"?: ((row: any, index: number, event: MouseEvent) => any) | undefined;
290
321
  "onSelection-change"?: ((selection: import('.').SelectionPayload) => any) | undefined;
291
322
  "onExpand-change"?: ((row: any, expanded: boolean) => any) | undefined;
323
+ "onUpdate:sortState"?: ((_sortState: import('.').SortState) => any) | undefined;
292
324
  }>, {
293
325
  clearSelection: () => void;
294
326
  setSelectionKeys: (keys: (string | number)[]) => void;
@@ -298,6 +330,8 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
298
330
  getHalfCheckedKeys: () => (string | number)[];
299
331
  getSelectionDetail: () => import('.').SelectionDetail;
300
332
  sort: (prop: string, order: import('.').SortOrder) => void;
333
+ clearSort: () => void;
334
+ getSortState: () => import('.').SortState;
301
335
  setCurrentRow: (row: any) => void;
302
336
  toggleRowExpansion: (row: any, expanded?: boolean) => void;
303
337
  expandAll: () => void;
@@ -321,6 +355,9 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
321
355
  readonly rowClassName: import('.').TableRowClassName;
322
356
  readonly emptyText: string;
323
357
  readonly rowKey: string | ((row: any) => string | number);
358
+ readonly sortState: import('.').SortState;
359
+ readonly manualSort: boolean;
360
+ readonly sortOrders: import('.').SortOrder[];
324
361
  readonly treeProps: import('.').TableTreeProps;
325
362
  readonly expandRowKeys: (string | number)[];
326
363
  readonly rowExpandable: (row: any) => boolean;
@@ -377,6 +414,18 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
377
414
  readonly defaultSort: {
378
415
  readonly type: import('vue').PropType<import('.').SortState>;
379
416
  };
417
+ readonly sortState: {
418
+ readonly type: import('vue').PropType<import('.').SortState>;
419
+ readonly default: undefined;
420
+ };
421
+ readonly manualSort: {
422
+ readonly type: BooleanConstructor;
423
+ readonly default: false;
424
+ };
425
+ readonly sortOrders: {
426
+ readonly type: import('vue').PropType<import('.').SortOrder[]>;
427
+ readonly default: () => (string | null)[];
428
+ };
380
429
  readonly color: {
381
430
  readonly type: StringConstructor;
382
431
  readonly default: "";
@@ -438,10 +487,11 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
438
487
  "onSelect-all"?: ((selection: import('.').SelectionPayload) => any) | undefined;
439
488
  "onCurrent-change"?: ((currentRow: any, oldRow: any) => any) | undefined;
440
489
  "onUpdate:checkedKeys"?: ((keys: (string | number)[]) => any) | undefined;
441
- "onSort-change"?: ((sortState: import('.').SortState) => any) | undefined;
490
+ "onSort-change"?: ((_sortState: import('.').SortChangePayload) => any) | undefined;
442
491
  "onRow-click"?: ((row: any, index: number, event: MouseEvent) => any) | undefined;
443
492
  "onSelection-change"?: ((selection: import('.').SelectionPayload) => any) | undefined;
444
493
  "onExpand-change"?: ((row: any, expanded: boolean) => any) | undefined;
494
+ "onUpdate:sortState"?: ((_sortState: import('.').SortState) => any) | undefined;
445
495
  }>, {
446
496
  clearSelection: () => void;
447
497
  setSelectionKeys: (keys: (string | number)[]) => void;
@@ -451,6 +501,8 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
451
501
  getHalfCheckedKeys: () => (string | number)[];
452
502
  getSelectionDetail: () => import('.').SelectionDetail;
453
503
  sort: (prop: string, order: import('.').SortOrder) => void;
504
+ clearSort: () => void;
505
+ getSortState: () => import('.').SortState;
454
506
  setCurrentRow: (row: any) => void;
455
507
  toggleRowExpansion: (row: any, expanded?: boolean) => void;
456
508
  expandAll: () => void;
@@ -461,10 +513,11 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
461
513
  "select-all": (selection: import('.').SelectionPayload) => void;
462
514
  "current-change": (currentRow: any, oldRow: any) => void;
463
515
  "update:checkedKeys": (keys: (string | number)[]) => void;
464
- "sort-change": (sortState: import('.').SortState) => void;
516
+ "sort-change": (_sortState: import('.').SortChangePayload) => void;
465
517
  "row-click": (row: any, index: number, event: MouseEvent) => void;
466
518
  "selection-change": (selection: import('.').SelectionPayload) => void;
467
519
  "expand-change": (row: any, expanded: boolean) => void;
520
+ "update:sortState": (_sortState: import('.').SortState) => void;
468
521
  }, string, {
469
522
  readonly size: import('@cyberpunk-vue/hooks').Size;
470
523
  readonly data: any[];
@@ -483,6 +536,9 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
483
536
  readonly rowClassName: import('.').TableRowClassName;
484
537
  readonly emptyText: string;
485
538
  readonly rowKey: string | ((row: any) => string | number);
539
+ readonly sortState: import('.').SortState;
540
+ readonly manualSort: boolean;
541
+ readonly sortOrders: import('.').SortOrder[];
486
542
  readonly treeProps: import('.').TableTreeProps;
487
543
  readonly expandRowKeys: (string | number)[];
488
544
  readonly rowExpandable: (row: any) => boolean;
@@ -12,6 +12,13 @@ export type TableSize = Size;
12
12
  * 排序方向
13
13
  */
14
14
  export type SortOrder = 'ascending' | 'descending' | null;
15
+ /**
16
+ * 列排序模式
17
+ * - `false`:不可排序
18
+ * - `true`:组件内部本地排序
19
+ * - `'custom'`:只维护排序 UI 与事件,由调用者远程排序
20
+ */
21
+ export type ColumnSortable = boolean | 'custom';
15
22
  /**
16
23
  * 排序配置
17
24
  */
@@ -19,6 +26,21 @@ export interface SortState {
19
26
  prop: string;
20
27
  order: SortOrder;
21
28
  }
29
+ /**
30
+ * sort-change 事件 payload
31
+ */
32
+ export interface SortChangePayload extends SortState {
33
+ /** 当前触发排序的列配置;通过编程式排序且未匹配到列时为 null */
34
+ column: TableColumnConfig | null;
35
+ }
36
+ /**
37
+ * 排序取值配置
38
+ */
39
+ export type SortBy = string | string[] | ((row: any) => any);
40
+ /**
41
+ * 自定义本地排序函数
42
+ */
43
+ export type SortMethod = (a: any, b: any, order: Exclude<SortOrder, null>) => number;
22
44
  /**
23
45
  * 树形 + 多选联动策略
24
46
  */
@@ -89,7 +111,13 @@ export interface TableColumnConfig {
89
111
  /** 最小列宽 */
90
112
  minWidth?: string | number;
91
113
  /** 是否可排序 */
92
- sortable: boolean;
114
+ sortable: ColumnSortable;
115
+ /** 自定义本地排序函数 */
116
+ sortMethod?: SortMethod;
117
+ /** 自定义排序取值字段或函数 */
118
+ sortBy?: SortBy;
119
+ /** 排序切换顺序 */
120
+ sortOrders?: SortOrder[];
93
121
  /** 特殊列类型 */
94
122
  columnType: 'default' | 'selection' | 'index' | 'expand';
95
123
  /** 内容对齐 */
@@ -118,10 +146,22 @@ export interface TableColumnConfig {
118
146
  * @exposes getSelectionDetail() - 获取结构化选中详情 { rows, keys, halfRows, halfKeys }
119
147
  * @exposes setSelectionKeys(keys) - 程序式设置选中 rowKey 数组
120
148
  * @exposes sort(prop, order) - 编程式排序
149
+ * @exposes clearSort() - 清空排序
150
+ * @exposes getSortState() - 获取当前排序状态
121
151
  * @exposes setCurrentRow(row) - 设置当前行
122
152
  * @exposes toggleRowExpand(row, expanded?) - 切换行展开(展开列模式)
123
153
  * @example
124
154
  * ```vue
155
+ * <!-- 远程排序:只维护排序状态,不做本地排序 -->
156
+ * <CpTable
157
+ * v-model:sort-state="sortState"
158
+ * :data="tableData"
159
+ * manual-sort
160
+ * @sort-change="fetchTableData"
161
+ * >
162
+ * <CpTableColumn prop="createdAt" label="创建时间" sortable />
163
+ * </CpTable>
164
+ *
125
165
  * <!-- 基础用法 -->
126
166
  * <CpTable :data="tableData" stripe border>
127
167
  * <CpTableColumn prop="name" label="姓名" sortable />
@@ -260,10 +300,53 @@ export declare const tableProps: {
260
300
  };
261
301
  /**
262
302
  * 默认排序
303
+ *
304
+ * 仅作为非受控模式下的初始排序状态;后续外部变更不会自动覆盖内部状态。
263
305
  */
264
306
  readonly defaultSort: {
265
307
  readonly type: PropType<SortState>;
266
308
  };
309
+ /**
310
+ * 受控排序状态(配合 `v-model:sort-state`)
311
+ *
312
+ * 传入后排序状态由外部维护;组件点击表头只触发 `update:sortState`
313
+ * 与 `sort-change`,视觉状态会跟随外部传回的新值。
314
+ *
315
+ * @example
316
+ * ```vue
317
+ * <CpTable v-model:sort-state="sortState" :data="rows" />
318
+ * ```
319
+ */
320
+ readonly sortState: {
321
+ readonly type: PropType<SortState>;
322
+ readonly default: undefined;
323
+ };
324
+ /**
325
+ * 手动排序模式
326
+ *
327
+ * 开启后组件只维护排序状态与排序图标,不会对 `data` 做本地排序。
328
+ * 适用于服务端排序、URL 状态同步、外部 store 管理等场景。
329
+ *
330
+ * 也可以在列上设置 `sortable="custom"` 仅让某一列进入手动排序。
331
+ *
332
+ * @default false
333
+ */
334
+ readonly manualSort: {
335
+ readonly type: BooleanConstructor;
336
+ readonly default: false;
337
+ };
338
+ /**
339
+ * 排序切换顺序
340
+ *
341
+ * 默认按升序、降序、取消排序循环。可传 `['descending', 'ascending']`
342
+ * 让列始终保持有序状态,不进入取消排序。
343
+ *
344
+ * @default ['ascending', 'descending', null]
345
+ */
346
+ readonly sortOrders: {
347
+ readonly type: PropType<SortOrder[]>;
348
+ readonly default: () => (string | null)[];
349
+ };
267
350
  /**
268
351
  * 自定义主题色(CSS 颜色值)
269
352
  * 优先级高于 type,设置后会覆盖 --cp-table-color
@@ -414,7 +497,7 @@ export type TableProps = ExtractPropTypes<typeof tableProps>;
414
497
  */
415
498
  export declare const tableEmits: {
416
499
  /** 排序变化 */
417
- 'sort-change': (sortState: SortState) => boolean;
500
+ 'sort-change': (_sortState: SortChangePayload) => boolean;
418
501
  /** 行点击 */
419
502
  'row-click': (row: any, index: number, event: MouseEvent) => boolean;
420
503
  /** 选中行变化 */
@@ -429,5 +512,7 @@ export declare const tableEmits: {
429
512
  'expand-change': (row: any, expanded: boolean) => boolean;
430
513
  /** 受控 checkedKeys 变化(用于 `v-model:checked-keys`) */
431
514
  'update:checkedKeys': (keys: (string | number)[]) => boolean;
515
+ /** 受控 sortState 变化(用于 `v-model:sort-state`) */
516
+ 'update:sortState': (_sortState: SortState) => boolean;
432
517
  };
433
518
  export type TableEmits = typeof tableEmits;
@@ -1,4 +1,4 @@
1
- import { SortOrder, SortState, SelectionDetail, SelectionPayload } from './table';
1
+ import { SortOrder, SortState, SortChangePayload, SelectionDetail, SelectionPayload } from './table';
2
2
  declare function __VLS_template(): {
3
3
  attrs: Partial<{}>;
4
4
  slots: {
@@ -56,6 +56,18 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
56
56
  readonly defaultSort: {
57
57
  readonly type: import('vue').PropType<SortState>;
58
58
  };
59
+ readonly sortState: {
60
+ readonly type: import('vue').PropType<SortState>;
61
+ readonly default: undefined;
62
+ };
63
+ readonly manualSort: {
64
+ readonly type: BooleanConstructor;
65
+ readonly default: false;
66
+ };
67
+ readonly sortOrders: {
68
+ readonly type: import('vue').PropType<SortOrder[]>;
69
+ readonly default: () => (string | null)[];
70
+ };
59
71
  readonly color: {
60
72
  readonly type: StringConstructor;
61
73
  readonly default: "";
@@ -129,6 +141,10 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
129
141
  getSelectionDetail: () => SelectionDetail;
130
142
  /** 排序 */
131
143
  sort: (prop: string, order: SortOrder) => void;
144
+ /** 清空排序 */
145
+ clearSort: () => void;
146
+ /** 获取当前排序状态 */
147
+ getSortState: () => SortState;
132
148
  /** 设置当前行 */
133
149
  setCurrentRow: (row: any) => void;
134
150
  /** 切换行展开(树形模式) */
@@ -144,10 +160,11 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
144
160
  "select-all": (selection: SelectionPayload) => void;
145
161
  "current-change": (currentRow: any, oldRow: any) => void;
146
162
  "update:checkedKeys": (keys: (string | number)[]) => void;
147
- "sort-change": (sortState: SortState) => void;
163
+ "sort-change": (_sortState: SortChangePayload) => void;
148
164
  "row-click": (row: any, index: number, event: MouseEvent) => void;
149
165
  "selection-change": (selection: SelectionPayload) => void;
150
166
  "expand-change": (row: any, expanded: boolean) => void;
167
+ "update:sortState": (_sortState: SortState) => void;
151
168
  }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
152
169
  readonly data: {
153
170
  readonly type: import('vue').PropType<any[]>;
@@ -194,6 +211,18 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
194
211
  readonly defaultSort: {
195
212
  readonly type: import('vue').PropType<SortState>;
196
213
  };
214
+ readonly sortState: {
215
+ readonly type: import('vue').PropType<SortState>;
216
+ readonly default: undefined;
217
+ };
218
+ readonly manualSort: {
219
+ readonly type: BooleanConstructor;
220
+ readonly default: false;
221
+ };
222
+ readonly sortOrders: {
223
+ readonly type: import('vue').PropType<SortOrder[]>;
224
+ readonly default: () => (string | null)[];
225
+ };
197
226
  readonly color: {
198
227
  readonly type: StringConstructor;
199
228
  readonly default: "";
@@ -255,10 +284,11 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
255
284
  "onSelect-all"?: ((selection: SelectionPayload) => any) | undefined;
256
285
  "onCurrent-change"?: ((currentRow: any, oldRow: any) => any) | undefined;
257
286
  "onUpdate:checkedKeys"?: ((keys: (string | number)[]) => any) | undefined;
258
- "onSort-change"?: ((sortState: SortState) => any) | undefined;
287
+ "onSort-change"?: ((_sortState: SortChangePayload) => any) | undefined;
259
288
  "onRow-click"?: ((row: any, index: number, event: MouseEvent) => any) | undefined;
260
289
  "onSelection-change"?: ((selection: SelectionPayload) => any) | undefined;
261
290
  "onExpand-change"?: ((row: any, expanded: boolean) => any) | undefined;
291
+ "onUpdate:sortState"?: ((_sortState: SortState) => any) | undefined;
262
292
  }>, {
263
293
  readonly size: import('@cyberpunk-vue/hooks').Size;
264
294
  readonly data: any[];
@@ -277,6 +307,9 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
277
307
  readonly rowClassName: import('./table').TableRowClassName;
278
308
  readonly emptyText: string;
279
309
  readonly rowKey: string | ((row: any) => string | number);
310
+ readonly sortState: SortState;
311
+ readonly manualSort: boolean;
312
+ readonly sortOrders: SortOrder[];
280
313
  readonly treeProps: import('./table').TableTreeProps;
281
314
  readonly expandRowKeys: (string | number)[];
282
315
  readonly rowExpandable: (row: any) => boolean;
@@ -30,9 +30,21 @@ export declare const CpTableColumn: import('../utils').SFCWithInstall<{
30
30
  readonly type: import('vue').PropType<string | number>;
31
31
  };
32
32
  readonly sortable: {
33
- readonly type: BooleanConstructor;
33
+ readonly type: import('vue').PropType<import('..').ColumnSortable>;
34
34
  readonly default: false;
35
35
  };
36
+ readonly sortMethod: {
37
+ readonly type: import('vue').PropType<import('..').SortMethod>;
38
+ readonly default: undefined;
39
+ };
40
+ readonly sortBy: {
41
+ readonly type: import('vue').PropType<import('..').SortBy>;
42
+ readonly default: undefined;
43
+ };
44
+ readonly sortOrders: {
45
+ readonly type: import('vue').PropType<import('..').SortOrder[]>;
46
+ readonly default: undefined;
47
+ };
36
48
  readonly align: {
37
49
  readonly type: import('vue').PropType<"left" | "center" | "right">;
38
50
  readonly default: "left";
@@ -45,8 +57,11 @@ export declare const CpTableColumn: import('../utils').SFCWithInstall<{
45
57
  readonly type: import('.').ColumnType;
46
58
  readonly label: string;
47
59
  readonly align: "left" | "right" | "center";
60
+ readonly sortOrders: import('..').SortOrder[];
48
61
  readonly prop: string;
49
- readonly sortable: boolean;
62
+ readonly sortable: import('..').ColumnSortable;
63
+ readonly sortMethod: import('..').SortMethod;
64
+ readonly sortBy: import('..').SortBy;
50
65
  readonly headerAlign: "" | "left" | "right" | "center";
51
66
  }, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
52
67
  P: {};
@@ -75,9 +90,21 @@ export declare const CpTableColumn: import('../utils').SFCWithInstall<{
75
90
  readonly type: import('vue').PropType<string | number>;
76
91
  };
77
92
  readonly sortable: {
78
- readonly type: BooleanConstructor;
93
+ readonly type: import('vue').PropType<import('..').ColumnSortable>;
79
94
  readonly default: false;
80
95
  };
96
+ readonly sortMethod: {
97
+ readonly type: import('vue').PropType<import('..').SortMethod>;
98
+ readonly default: undefined;
99
+ };
100
+ readonly sortBy: {
101
+ readonly type: import('vue').PropType<import('..').SortBy>;
102
+ readonly default: undefined;
103
+ };
104
+ readonly sortOrders: {
105
+ readonly type: import('vue').PropType<import('..').SortOrder[]>;
106
+ readonly default: undefined;
107
+ };
81
108
  readonly align: {
82
109
  readonly type: import('vue').PropType<"left" | "center" | "right">;
83
110
  readonly default: "left";
@@ -90,8 +117,11 @@ export declare const CpTableColumn: import('../utils').SFCWithInstall<{
90
117
  readonly type: import('.').ColumnType;
91
118
  readonly label: string;
92
119
  readonly align: "left" | "right" | "center";
120
+ readonly sortOrders: import('..').SortOrder[];
93
121
  readonly prop: string;
94
- readonly sortable: boolean;
122
+ readonly sortable: import('..').ColumnSortable;
123
+ readonly sortMethod: import('..').SortMethod;
124
+ readonly sortBy: import('..').SortBy;
95
125
  readonly headerAlign: "" | "left" | "right" | "center";
96
126
  }>;
97
127
  __isFragment?: never;
@@ -117,9 +147,21 @@ export declare const CpTableColumn: import('../utils').SFCWithInstall<{
117
147
  readonly type: import('vue').PropType<string | number>;
118
148
  };
119
149
  readonly sortable: {
120
- readonly type: BooleanConstructor;
150
+ readonly type: import('vue').PropType<import('..').ColumnSortable>;
121
151
  readonly default: false;
122
152
  };
153
+ readonly sortMethod: {
154
+ readonly type: import('vue').PropType<import('..').SortMethod>;
155
+ readonly default: undefined;
156
+ };
157
+ readonly sortBy: {
158
+ readonly type: import('vue').PropType<import('..').SortBy>;
159
+ readonly default: undefined;
160
+ };
161
+ readonly sortOrders: {
162
+ readonly type: import('vue').PropType<import('..').SortOrder[]>;
163
+ readonly default: undefined;
164
+ };
123
165
  readonly align: {
124
166
  readonly type: import('vue').PropType<"left" | "center" | "right">;
125
167
  readonly default: "left";
@@ -132,8 +174,11 @@ export declare const CpTableColumn: import('../utils').SFCWithInstall<{
132
174
  readonly type: import('.').ColumnType;
133
175
  readonly label: string;
134
176
  readonly align: "left" | "right" | "center";
177
+ readonly sortOrders: import('..').SortOrder[];
135
178
  readonly prop: string;
136
- readonly sortable: boolean;
179
+ readonly sortable: import('..').ColumnSortable;
180
+ readonly sortMethod: import('..').SortMethod;
181
+ readonly sortBy: import('..').SortBy;
137
182
  readonly headerAlign: "" | "left" | "right" | "center";
138
183
  }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
139
184
  $slots: Readonly<{
@@ -1,4 +1,5 @@
1
1
  import { ExtractPropTypes, PropType } from 'vue';
2
+ import { ColumnSortable, SortBy, SortMethod, SortOrder } from '../../table/src/table';
2
3
  /**
3
4
  * 列特殊类型
4
5
  * - `default` — 普通数据列
@@ -18,6 +19,7 @@ export type ColumnType = 'default' | 'selection' | 'index' | 'expand';
18
19
  * ```vue
19
20
  * <!-- 普通数据列 -->
20
21
  * <CpTableColumn prop="name" label="姓名" sortable />
22
+ * <CpTableColumn prop="createdAt" label="创建时间" sortable="custom" />
21
23
  *
22
24
  * <!-- 自定义单元格渲染 -->
23
25
  * <CpTableColumn prop="status" label="状态">
@@ -82,12 +84,48 @@ export declare const tableColumnProps: {
82
84
  };
83
85
  /**
84
86
  * 是否可排序
87
+ *
88
+ * - `false`:不可排序
89
+ * - `true`:使用 CpTable 内置本地排序
90
+ * - `'custom'`:只触发排序状态和事件,不做本地排序,适用于远程排序
91
+ *
85
92
  * @default false
86
93
  */
87
94
  readonly sortable: {
88
- readonly type: BooleanConstructor;
95
+ readonly type: PropType<ColumnSortable>;
89
96
  readonly default: false;
90
97
  };
98
+ /**
99
+ * 自定义本地排序函数
100
+ *
101
+ * 仅在 `sortable` 为 `true` 且表格未开启 `manualSort` 时生效。
102
+ * 返回值规则与 `Array.prototype.sort` 一致。
103
+ */
104
+ readonly sortMethod: {
105
+ readonly type: PropType<SortMethod>;
106
+ readonly default: undefined;
107
+ };
108
+ /**
109
+ * 自定义排序取值
110
+ *
111
+ * 支持字段名、字段名数组(依次比较)或函数。未设置时使用 `prop`。
112
+ * 可用于展示字段与排序字段不一致,或需要嵌套字段排序的场景。
113
+ */
114
+ readonly sortBy: {
115
+ readonly type: PropType<SortBy>;
116
+ readonly default: undefined;
117
+ };
118
+ /**
119
+ * 当前列的排序切换顺序
120
+ *
121
+ * 未设置时继承 CpTable 的 `sortOrders`。
122
+ *
123
+ * @default undefined
124
+ */
125
+ readonly sortOrders: {
126
+ readonly type: PropType<SortOrder[]>;
127
+ readonly default: undefined;
128
+ };
91
129
  /**
92
130
  * 内容对齐方式
93
131
  * @default 'left'
@@ -31,9 +31,21 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
31
31
  readonly type: import('vue').PropType<string | number>;
32
32
  };
33
33
  readonly sortable: {
34
- readonly type: BooleanConstructor;
34
+ readonly type: import('vue').PropType<import('../..').ColumnSortable>;
35
35
  readonly default: false;
36
36
  };
37
+ readonly sortMethod: {
38
+ readonly type: import('vue').PropType<import('../..').SortMethod>;
39
+ readonly default: undefined;
40
+ };
41
+ readonly sortBy: {
42
+ readonly type: import('vue').PropType<import('../..').SortBy>;
43
+ readonly default: undefined;
44
+ };
45
+ readonly sortOrders: {
46
+ readonly type: import('vue').PropType<import('../..').SortOrder[]>;
47
+ readonly default: undefined;
48
+ };
37
49
  readonly align: {
38
50
  readonly type: import('vue').PropType<"left" | "center" | "right">;
39
51
  readonly default: "left";
@@ -62,9 +74,21 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
62
74
  readonly type: import('vue').PropType<string | number>;
63
75
  };
64
76
  readonly sortable: {
65
- readonly type: BooleanConstructor;
77
+ readonly type: import('vue').PropType<import('../..').ColumnSortable>;
66
78
  readonly default: false;
67
79
  };
80
+ readonly sortMethod: {
81
+ readonly type: import('vue').PropType<import('../..').SortMethod>;
82
+ readonly default: undefined;
83
+ };
84
+ readonly sortBy: {
85
+ readonly type: import('vue').PropType<import('../..').SortBy>;
86
+ readonly default: undefined;
87
+ };
88
+ readonly sortOrders: {
89
+ readonly type: import('vue').PropType<import('../..').SortOrder[]>;
90
+ readonly default: undefined;
91
+ };
68
92
  readonly align: {
69
93
  readonly type: import('vue').PropType<"left" | "center" | "right">;
70
94
  readonly default: "left";
@@ -77,8 +101,11 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
77
101
  readonly type: import('./table-column').ColumnType;
78
102
  readonly label: string;
79
103
  readonly align: "left" | "right" | "center";
104
+ readonly sortOrders: import('../..').SortOrder[];
80
105
  readonly prop: string;
81
- readonly sortable: boolean;
106
+ readonly sortable: import('../..').ColumnSortable;
107
+ readonly sortMethod: import('../..').SortMethod;
108
+ readonly sortBy: import('../..').SortBy;
82
109
  readonly headerAlign: "" | "left" | "right" | "center";
83
110
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
84
111
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;