@canvas-components/list-table 0.3.18 → 0.3.20

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.
package/dist/index.d.ts CHANGED
@@ -1,21 +1,20 @@
1
+ import * as antDesignIcons from '@ant-design/icons-svg';
2
+ import { CanvasChartPieOption, CanvasChartRadarOption, CanvasChartGaugeOption, CanvasChartSparklineOption } from '@canvas-components/chart';
1
3
  import { CanvasScrollbarOptions, XlsxExportOptions } from '@canvas-components/utils';
2
4
  export { CanvasScrollbarAxisOptions as ListTableScrollbarAxisOptions } from '@canvas-components/utils';
3
- import { CanvasChartSparklineOption } from '@canvas-components/chart';
4
5
 
5
6
  /**
6
7
  * 排序状态。
7
8
  */
8
- interface ListTableSortState {
9
- key: string | null;
10
- order: "ascend" | "descend" | null;
11
- }
9
+ type ListTableSortState = ListTableSortItem[];
12
10
  /**
13
11
  * 多列排序项。
14
12
  */
15
13
  interface ListTableSortItem {
16
14
  key: string;
17
15
  order: "ascend" | "descend";
18
- priority: number;
16
+ /** 配置了多列排序时的优先级;未配置表示单列排序。 */
17
+ priority?: number;
19
18
  }
20
19
  /**
21
20
  * 过滤匹配模式。
@@ -174,7 +173,7 @@ interface ListTableQueryChangeExtra<RecordType> {
174
173
  filteredDataSource: RecordType[];
175
174
  rawFilters: ListTableFilterState;
176
175
  sorter: ListTableSortState;
177
- sorters?: ListTableSortItem[];
176
+ sorters: ListTableSortItem[];
178
177
  }
179
178
 
180
179
  /**
@@ -293,6 +292,53 @@ interface ListTableDebugSnapshot {
293
292
  hitTest?: DebugHitTestResult;
294
293
  }
295
294
 
295
+ /** 可单独控制持久化的表格配置;列设置及条件格式使用各自已有开关。 */
296
+ type ListTableCacheCategory = "sort" | "filter" | "summary" | "alignment" | "dataFormat" | "density" | "zoom";
297
+ /** 未指定的缓存类别默认开启,持久化需要 storageKey。 */
298
+ type ListTableCachePreferences = Partial<Record<ListTableCacheCategory, boolean>>;
299
+
300
+ /** 上传单元格的值,始终使用文件数组;selected 表示仅本地选择,尚未上传。 */
301
+ interface ListTableUploadFile {
302
+ uid: string;
303
+ name: string;
304
+ type?: string;
305
+ size?: number;
306
+ url?: string;
307
+ thumbUrl?: string;
308
+ status?: "selected" | "uploading" | "done" | "error";
309
+ percent?: number;
310
+ error?: string;
311
+ response?: unknown;
312
+ originFileObj?: File;
313
+ }
314
+ /** 自定义上传请求,关闭编辑或移除文件时调用返回的 abort。 */
315
+ interface ListTableUploadRequest {
316
+ file: File;
317
+ onProgress: (percent: number) => void;
318
+ onSuccess: (response: unknown) => void;
319
+ onError: (error: Error) => void;
320
+ }
321
+ /** 原生上传编辑配置,不依赖框架;未设置 action/customRequest 时仅选择本地文件。 */
322
+ interface ListTableUploadConfig {
323
+ accept?: string;
324
+ multiple?: boolean;
325
+ maxCount?: number;
326
+ /** 文件大小上限,单位字节。 */
327
+ maxSize?: number;
328
+ action?: string;
329
+ name?: string;
330
+ headers?: Record<string, string>;
331
+ data?: Record<string, string | Blob>;
332
+ withCredentials?: boolean;
333
+ /** 返回 false 保留文件但不上传;抛出错误则拒绝文件。 */
334
+ beforeUpload?: (file: File) => boolean | void | Promise<boolean | void>;
335
+ customRequest?: (request: ListTableUploadRequest) => void | {
336
+ abort: () => void;
337
+ };
338
+ /** 默认读取响应对象的 url 字段,可按实际服务端协议覆盖。 */
339
+ getResponseUrl?: (response: unknown, file: File) => string | undefined;
340
+ }
341
+
296
342
  /** Canvas 区域支持的 CSS 属性。长度支持数字(px)或 px 字符串,padding 支持 1~2 值。 */
297
343
  interface ListTableCSSProperties {
298
344
  backgroundColor?: string;
@@ -379,6 +425,61 @@ interface ListTableTheme {
379
425
  headerFontWeight: string;
380
426
  }
381
427
 
428
+ /** 当前列原始值的条件比较方式。 */
429
+ type ListTableConditionalOperator = "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "between" | "contains" | "empty" | "notEmpty";
430
+ /** 当前列的一项比较条件。 */
431
+ interface ListTableConditionalFormatCondition {
432
+ /** 与上一条件的关系;首项忽略。且优先于或,未指定时兼容规则的统一关系。 */
433
+ relation?: "and" | "or";
434
+ operator: ListTableConditionalOperator;
435
+ value?: string | number;
436
+ endValue?: string | number;
437
+ }
438
+ /** 条件格式规则,按数组顺序匹配,首条命中的背景生效。 */
439
+ interface ListTableConditionalFormatRule {
440
+ id: string;
441
+ name?: string;
442
+ /** 兼容旧版单条件配置;conditions 存在时优先采用条件列表。 */
443
+ operator?: ListTableConditionalOperator;
444
+ value?: string | number;
445
+ endValue?: string | number;
446
+ conditions?: ListTableConditionalFormatCondition[];
447
+ /** 兼容旧版统一关系;各条件的 relation 优先,默认且。 */
448
+ conditionRelation?: "and" | "or";
449
+ backgroundColor: string;
450
+ /** 命中规则时的单元格文本颜色。 */
451
+ textColor: string;
452
+ }
453
+
454
+ /** 原有短名称,保留已经调整过的图形和评分外观。 */
455
+ declare const listTableBuiltinIconNames: readonly ["star", "sun", "moon", "check", "close", "circle", "check-circle", "close-circle", "clock-circle", "info-circle", "question-circle", "warning", "loading", "plus", "minus", "plus-circle", "minus-circle", "up", "down", "left", "right", "arrow-up", "arrow-down", "arrow-left", "arrow-right", "search", "edit", "delete", "copy", "save", "upload", "download", "reload", "ellipsis", "file", "file-text", "file-pdf", "folder", "folder-open", "picture", "user", "team", "calendar", "filter", "sort-ascending", "sort-descending", "link", "eye", "lock", "unlock", "home", "mail", "setting", "header-sort", "header-sort-ascending", "header-sort-descending", "header-filter", "header-fixed"];
456
+ /** 官方图标使用原始名称,例如 AccountBookOutlined、HeartFilled、SmileTwoTone。 */
457
+ type ListTableAntdIconName = keyof typeof antDesignIcons;
458
+ type ListTableBuiltinIconName = (typeof listTableBuiltinIconNames)[number];
459
+ /** 全量官方图标定义为纯数据,不包含 React 运行时。 */
460
+ declare const listTableAntdIconNames: ListTableAntdIconName[];
461
+ /** 支持的全部单元格图标名称。 */
462
+ type ListTableSymbolType = ListTableBuiltinIconName | ListTableAntdIconName;
463
+ declare const listTableIconNames: readonly ListTableSymbolType[];
464
+ /** 评分控件仅使用可部分填充的图形,不随普通图标扩展。 */
465
+ type ListTableRateSymbolType = "star" | "sun" | "moon";
466
+
467
+ /** TreeSelect 的原生树节点,value 在树内唯一。 */
468
+ interface ListTableTreeSelectNode {
469
+ title: string;
470
+ value: string | number;
471
+ key?: string | number;
472
+ disabled?: boolean;
473
+ selectable?: boolean;
474
+ children?: ListTableTreeSelectNode[];
475
+ }
476
+ /** 排序配置;compare 按升序返回负数、零、正数,降序由表格自动反转。 */
477
+ type ListTableSorter<RecordType> = boolean | {
478
+ /** 多列排序优先级,数值越大越优先。 */
479
+ multiple?: number;
480
+ /** 自定义记录比较,优先于 sortValueGetter;大数据使用主线程可取消分片。 */
481
+ compare?: (a: RecordType, b: RecordType) => number;
482
+ };
382
483
  /**
383
484
  * 汇总类型说明:
384
485
  * - `sum`:对当前列做求和
@@ -431,6 +532,8 @@ interface ListTableSummaryConfig<RecordType = Record<string, unknown>> {
431
532
  roundingMode?: ListTableSummaryRoundingMode;
432
533
  /** 是否保留精度补齐产生的无效零,默认不保留。 */
433
534
  preserveTrailingZeros?: boolean;
535
+ /** 是否展示“求和: ”等汇总方式前缀,默认开启。 */
536
+ showTypePrefix?: boolean;
434
537
  }
435
538
  /**
436
539
  * 路径索引定义。
@@ -461,12 +564,9 @@ type ListTableSparklineSize = "small" | "medium" | number | [number, number] | {
461
564
  width?: number;
462
565
  height?: number;
463
566
  };
464
- type ListTableChartType = "sparkline" | (string & {});
567
+ type ListTableChartType = "sparkline" | "pie" | "radar" | "gauge" | (string & {});
465
568
  type ListTableChartSize = ListTableSparklineSize;
466
569
  type ListTableRateSize = "small" | "medium" | "large" | number;
467
- type ListTableRateSymbolType = "star" | "sun" | "moon";
468
- /** 单元格内置图标名称。 */
469
- type ListTableSymbolType = ListTableRateSymbolType | "check" | "close";
470
570
  type ListTableButtonType = "primary" | "default" | "dashed" | "text" | "link";
471
571
  type ListTableButtonSize = "small" | "middle" | "medium" | "large";
472
572
  /**
@@ -620,6 +720,34 @@ interface ListTableProgressCellContent<RecordType = any> extends ListTableBaseCe
620
720
  successColor?: string;
621
721
  strokeWidth?: number;
622
722
  }
723
+ /** 时间轴节点;title 为时间标签,content 为事件描述,不接受 ReactNode。 */
724
+ interface ListTableTimelineItem {
725
+ title?: string;
726
+ content: string;
727
+ /** 支持 blue、green、red、gray 以及自定义颜色。 */
728
+ color?: string;
729
+ position?: "start" | "end";
730
+ /** 进行中节点使用缺口圆环和虚线连接,不创建持续动画。 */
731
+ loading?: boolean;
732
+ /** 可复用全部内置图标;clock、cross 保留为时间轴快捷名称。 */
733
+ icon?: ListTableSymbolType | "clock" | "cross";
734
+ }
735
+ /** 原生纵向时间轴。配合 rowHeight: "auto" 展示完整内容。 */
736
+ interface ListTableTimelineCellContent<RecordType = any> extends ListTableBaseCellContent<RecordType> {
737
+ type: "timeline";
738
+ items: ListTableTimelineItem[];
739
+ mode?: "start" | "end" | "alternate";
740
+ reverse?: boolean;
741
+ variant?: "outlined" | "filled";
742
+ /** 默认宽度 220,窄列自动收缩并换行。 */
743
+ width?: number;
744
+ /** 节点之间的额外留白,默认 12px。 */
745
+ itemGap?: number;
746
+ /** 节点图标直径,默认 16px,最大不超过文字行高。 */
747
+ dotSize?: number;
748
+ lineColor?: string;
749
+ titleColor?: string;
750
+ }
623
751
  /**
624
752
  * 通用单元格图表片段基类。
625
753
  */
@@ -628,6 +756,8 @@ interface ListTableBaseChartCellContent<RecordType = any, ChartType extends stri
628
756
  /** 是否允许点击预览,默认开启。 */
629
757
  preview?: boolean;
630
758
  chartType: ChartType;
759
+ /** 仅保留主要图形;折线图只绘制折线。 */
760
+ simple?: boolean;
631
761
  option: Option;
632
762
  size?: ListTableChartSize;
633
763
  }
@@ -644,6 +774,8 @@ interface ListTableSparklineChartCellContent<RecordType = any> extends ListTable
644
774
  /** 是否允许点击预览,默认开启。 */
645
775
  preview?: boolean;
646
776
  chartType: "sparkline";
777
+ /** 仅绘制折线或柱体,隐藏坐标轴、图例等辅助元素。 */
778
+ simple?: boolean;
647
779
  option?: CanvasChartSparklineOption;
648
780
  values?: number[];
649
781
  min?: number;
@@ -660,7 +792,13 @@ interface ListTableSparklineChartCellContent<RecordType = any> extends ListTable
660
792
  /**
661
793
  * 单元格图表片段。
662
794
  */
663
- type ListTableChartCellContent<RecordType = any> = ListTableSparklineChartCellContent<RecordType> | ListTableCustomChartCellContent<RecordType>;
795
+ type ListTablePieChartCellContent<RecordType = any> = ListTableBaseChartCellContent<RecordType, "pie", CanvasChartPieOption>;
796
+ /** 单元格雷达图配置。 */
797
+ type ListTableRadarChartCellContent<RecordType = any> = ListTableBaseChartCellContent<RecordType, "radar", CanvasChartRadarOption>;
798
+ /** 单元格仪表盘配置。 */
799
+ type ListTableGaugeChartCellContent<RecordType = any> = ListTableBaseChartCellContent<RecordType, "gauge", CanvasChartGaugeOption>;
800
+ /** 单元格内置及自定义图表。 */
801
+ type ListTableChartCellContent<RecordType = any> = ListTablePieChartCellContent<RecordType> | ListTableRadarChartCellContent<RecordType> | ListTableGaugeChartCellContent<RecordType> | ListTableSparklineChartCellContent<RecordType> | ListTableCustomChartCellContent<RecordType>;
664
802
  /**
665
803
  * 单元格评分片段。
666
804
  */
@@ -684,6 +822,8 @@ interface ListTableRateCellContent<RecordType = any> extends ListTableBaseCellCo
684
822
  interface ListTableIconCellContent<RecordType = any> extends ListTableBaseCellContent<RecordType> {
685
823
  type: "icon";
686
824
  icon: ListTableSymbolType;
825
+ /** 官方 TwoTone 图标的主色,或 [主色, 副色];未指定时使用 color。 */
826
+ twoToneColor?: string | [string, string];
687
827
  color?: string;
688
828
  size?: number;
689
829
  }
@@ -813,6 +953,8 @@ interface ListTableNestedTableColumn {
813
953
  formItemProps?: ListTableFormItemProps<Record<string, unknown>>;
814
954
  fixed?: "left" | "right";
815
955
  allowSort?: boolean;
956
+ /** 配置 multiple 开启多列排序,数值越大优先级越高。 */
957
+ sorter?: ListTableSorter<Record<string, unknown>>;
816
958
  sortValueGetter?: (record: Record<string, unknown>) => string | number | null | undefined;
817
959
  defaultSortOrder?: "ascend" | "descend";
818
960
  allowFilter?: boolean;
@@ -847,7 +989,7 @@ interface ListTableNestedTableCellContent<RecordType = any> extends ListTableBas
847
989
  /**
848
990
  * 单元格内容定义。
849
991
  */
850
- type ListTableCellContent<RecordType = any> = ListTableArrowCellContent<RecordType> | ListTableIconCellContent<RecordType> | ListTableTextCellContent<RecordType> | ListTableMoneyCellContent<RecordType> | ListTableLinkCellContent<RecordType> | ListTableImageCellContent<RecordType> | ListTableProgressCellContent<RecordType> | ListTableChartCellContent<RecordType> | ListTableRateCellContent<RecordType> | ListTableButtonCellContent<RecordType> | ListTableQrCodeCellContent<RecordType> | ListTableBarcodeCellContent<RecordType> | ListTableColorCellContent<RecordType> | ListTableTagCellContent<RecordType> | ListTableSelectionCellContent<RecordType> | ListTableSwitchCellContent<RecordType> | ListTableNestedTableCellContent<RecordType>;
992
+ type ListTableCellContent<RecordType = any> = ListTableArrowCellContent<RecordType> | ListTableIconCellContent<RecordType> | ListTableTextCellContent<RecordType> | ListTableMoneyCellContent<RecordType> | ListTableLinkCellContent<RecordType> | ListTableImageCellContent<RecordType> | ListTableProgressCellContent<RecordType> | ListTableTimelineCellContent<RecordType> | ListTableChartCellContent<RecordType> | ListTableRateCellContent<RecordType> | ListTableButtonCellContent<RecordType> | ListTableQrCodeCellContent<RecordType> | ListTableBarcodeCellContent<RecordType> | ListTableColorCellContent<RecordType> | ListTableTagCellContent<RecordType> | ListTableSelectionCellContent<RecordType> | ListTableSwitchCellContent<RecordType> | ListTableNestedTableCellContent<RecordType>;
851
993
  /**
852
994
  * 单元格跨度配置。
853
995
  *
@@ -869,13 +1011,17 @@ type ListTableCellRender<RecordType> = (value: unknown, record: RecordType, rowI
869
1011
  *
870
1012
  * 采用可扩展枚举,便于后续继续补充原生编辑器实现。
871
1013
  */
872
- type ListTableEditValueType = "text" | "number" | "input-range" | "year" | "quarter" | "month" | "time" | "datetime" | "timerange" | "date" | "date-range" | "datetime-range" | "color" | "select" | "auto-complete";
1014
+ type ListTableEditValueType = "text" | "number" | "input-range" | "year" | "quarter" | "month" | "time" | "datetime" | "timerange" | "date" | "date-range" | "datetime-range" | "color" | "select" | "cascader" | "tree-select" | "upload" | "auto-complete";
873
1015
  /**
874
1016
  * 下拉编辑选项。
875
1017
  */
876
1018
  interface ListTableEditOption {
877
1019
  label: string;
878
1020
  value: string | number;
1021
+ /** 是否禁用该选项及其下级。 */
1022
+ disabled?: boolean;
1023
+ /** Cascader 的下级选项。 */
1024
+ children?: ListTableEditOption[];
879
1025
  }
880
1026
  /**
881
1027
  * 下拉编辑选项过滤函数。
@@ -900,6 +1046,26 @@ interface ListTableFormItemPropsConfig<RecordType = Record<string, unknown>> {
900
1046
  max?: number | string;
901
1047
  step?: number | string;
902
1048
  options?: ListTableEditOption[];
1049
+ /** TreeSelect 树节点,使用 title/value/children,value 在树内唯一。 */
1050
+ treeData?: ListTableTreeSelectNode[];
1051
+ /** 原生文件上传配置。 */
1052
+ upload?: ListTableUploadConfig;
1053
+ /** TreeSelect 初始展开全部节点。 */
1054
+ treeDefaultExpandAll?: boolean;
1055
+ /** TreeSelect 初始展开节点 key,未指定 key 时使用 value。 */
1056
+ treeDefaultExpandedKeys?: (string | number)[];
1057
+ /** Cascader 是否允许选择非末级,默认 false。 */
1058
+ changeOnSelect?: boolean;
1059
+ /** 开启多选:Cascader 使用二维路径数组,TreeSelect 使用节点值数组。 */
1060
+ multiple?: boolean;
1061
+ /** 多选回填策略:完整父级或末级路径,默认 SHOW_PARENT。 */
1062
+ showCheckedStrategy?: "SHOW_PARENT" | "SHOW_CHILD";
1063
+ /** Cascader 展开下级的方式,默认 click。 */
1064
+ expandTrigger?: "click" | "hover";
1065
+ /** Cascader / TreeSelect 是否允许清空,默认 true。 */
1066
+ allowClear?: boolean;
1067
+ /** Cascader 路径显示文本,默认使用 / 分隔。 */
1068
+ displayRender?: (labels: string[], selectedOptions: ListTableEditOption[]) => string;
903
1069
  /** 是否开启下拉选项搜索。 */
904
1070
  showSearch?: boolean;
905
1071
  /** 自定义下拉选项过滤逻辑,仅在开启搜索时生效。 */
@@ -965,7 +1131,8 @@ interface ListTableColumn<RecordType = Record<string, unknown>> {
965
1131
  allowSort?: boolean;
966
1132
  sortValueGetter?: (record: RecordType) => string | number | null | undefined;
967
1133
  defaultSortOrder?: "ascend" | "descend";
968
- sortPriority?: number;
1134
+ /** 配置 multiple 开启多列排序,数值越大优先级越高。 */
1135
+ sorter?: ListTableSorter<RecordType>;
969
1136
  allowFilter?: boolean;
970
1137
  filterModes?: Array<"fuzzy" | "exact">;
971
1138
  filterValueGetter?: (record: RecordType) => unknown;
@@ -979,12 +1146,16 @@ interface ListTableColumn<RecordType = Record<string, unknown>> {
979
1146
  * 用法参考 AntD Table 的 `onCell`。
980
1147
  */
981
1148
  onCell?: (value: unknown, record: RecordType, rowIndex: number, column: ListTableColumn<RecordType>) => ListTableCellSpan | null | undefined;
982
- cellType?: "text" | "money" | "link" | "image" | "qrcode" | "barcode" | "color" | "progress" | "chart" | "rate" | "checkbox" | "radio" | "switch" | "tag" | "button" | "custom";
1149
+ cellType?: "text" | "money" | "link" | "image" | "qrcode" | "barcode" | "color" | "progress" | "timeline" | "chart" | "rate" | "checkbox" | "radio" | "switch" | "tag" | "button" | "custom";
983
1150
  cellStyle?: ListTableCellStyle;
984
1151
  /** 金额单元格格式配置,仅在 `cellType: "money"` 时生效。 */
985
1152
  moneyFormat?: ListTableMoneyFormatOptions;
986
1153
  /** 通过列设置覆盖的数据显示格式。 */
987
1154
  dataFormat?: ListTableDataFormat;
1155
+ /** 仅当前列数据单元格生效的条件背景规则,首条命中优先。 */
1156
+ conditionalFormats?: ListTableConditionalFormatRule[];
1157
+ /** 是否缓存当前列条件格式,默认开启;持久化需要 storageKey。 */
1158
+ cacheConditionalFormats?: boolean;
988
1159
  headerStyle?: ListTableCellStyle;
989
1160
  /** 汇总单元格样式,优先于表格 styles.summary。 */
990
1161
  summaryStyle?: ListTableCellStyle;
@@ -1108,6 +1279,12 @@ interface ListTableDangerConfirmRequest {
1108
1279
  onConfirm: () => void;
1109
1280
  onCancel: () => void;
1110
1281
  }
1282
+ /** 导出前确认文件名称。 */
1283
+ interface ListTableExportNameRequest {
1284
+ fileName: string;
1285
+ onConfirm: (fileName: string) => void;
1286
+ onCancel: () => void;
1287
+ }
1111
1288
  interface HeaderContextMenuColumnItem {
1112
1289
  key: string;
1113
1290
  title: string;
@@ -1118,6 +1295,11 @@ interface HeaderContextMenuColumnItem {
1118
1295
  }
1119
1296
  type HeaderContextMenuDensity = "comfortable" | "middle" | "compact" | "ultra-compact" | "auto";
1120
1297
  interface HeaderContextMenuConfig {
1298
+ conditionalFormats?: ListTableConditionalFormatRule[];
1299
+ cacheConditionalFormats?: boolean;
1300
+ /** 是否已配置持久化存储标识。 */
1301
+ conditionalFormatCacheAvailable?: boolean;
1302
+ onChangeConditionalFormats?: (rules: ListTableConditionalFormatRule[], cache?: boolean) => void;
1121
1303
  x: number;
1122
1304
  y: number;
1123
1305
  columns?: HeaderContextMenuColumnItem[];
@@ -1131,6 +1313,10 @@ interface HeaderContextMenuConfig {
1131
1313
  onCopyRowText?: () => void;
1132
1314
  onCopyRowJson?: () => void;
1133
1315
  onCopySelection?: () => void;
1316
+ /** 复制表格为 PNG 图片。 */
1317
+ onCopyImage?: (scope: "all" | "selection" | "viewport") => void;
1318
+ onExportImage?: (scope: "all" | "selection" | "viewport") => void;
1319
+ canCopySelectionImage?: boolean;
1134
1320
  onOpenSearch?: () => void;
1135
1321
  customSelection?: {
1136
1322
  startRow: number;
@@ -1184,6 +1370,11 @@ interface HeaderContextMenuConfig {
1184
1370
  */
1185
1371
  onChangeZoom?: (zoom: number) => void;
1186
1372
  onToggleColumn?: (columnKey: string, visible: boolean) => void;
1373
+ cacheColumnSettings?: boolean;
1374
+ columnSettingsCacheAvailable?: boolean;
1375
+ onChangeColumnSettingsCache?: (enabled: boolean) => void;
1376
+ cachePreferences?: ListTableCachePreferences;
1377
+ onChangeCachePreference?: (category: ListTableCacheCategory, enabled: boolean) => void;
1187
1378
  alignment?: {
1188
1379
  headerHorizontal: ListTableHorizontalAlign;
1189
1380
  headerVertical: "top" | "middle" | "bottom";
@@ -1200,6 +1391,7 @@ interface HeaderContextMenuConfig {
1200
1391
  summaryPrecision?: number;
1201
1392
  summaryRoundingMode?: ListTableSummaryRoundingMode;
1202
1393
  summaryPreserveTrailingZeros?: boolean;
1394
+ summaryShowTypePrefix?: boolean;
1203
1395
  onToggleSummary?: () => void;
1204
1396
  onChangeSummaryTitle?: (title: string) => void;
1205
1397
  onClearSummary?: () => void;
@@ -1207,6 +1399,7 @@ interface HeaderContextMenuConfig {
1207
1399
  onChangeSummaryPrecision?: (precision: number | undefined) => void;
1208
1400
  onChangeSummaryRoundingMode?: (mode: ListTableSummaryRoundingMode) => void;
1209
1401
  onChangeSummaryPreserveTrailingZeros?: (value: boolean) => void;
1402
+ onChangeSummaryShowTypePrefix?: (value: boolean) => void;
1210
1403
  onClose: () => void;
1211
1404
  }
1212
1405
  interface ListTableSearchRequest {
@@ -1234,10 +1427,14 @@ interface PaginationConfig {
1234
1427
  onChange?: (page: number, pageSize: number) => void;
1235
1428
  onPageSizeChange?: (page: number, pageSize: number) => void;
1236
1429
  }
1237
- type ListTableEditorValueType = "text" | "number" | "input-range" | "year" | "quarter" | "month" | "time" | "datetime" | "timerange" | "date" | "date-range" | "datetime-range" | "color" | "select" | "auto-complete";
1430
+ type ListTableEditorValueType = "text" | "number" | "input-range" | "year" | "quarter" | "month" | "time" | "datetime" | "timerange" | "date" | "date-range" | "datetime-range" | "color" | "select" | "cascader" | "tree-select" | "upload" | "auto-complete";
1238
1431
  interface ListTableEditorOption {
1239
1432
  label: string;
1240
1433
  value: string | number;
1434
+ /** 是否禁用该选项及其下级。 */
1435
+ disabled?: boolean;
1436
+ /** Cascader 的下级选项。 */
1437
+ children?: ListTableEditorOption[];
1241
1438
  }
1242
1439
  type ListTableEditorFilterOption = (input: string, option: ListTableEditorOption) => boolean;
1243
1440
  /**
@@ -1245,6 +1442,7 @@ type ListTableEditorFilterOption = (input: string, option: ListTableEditorOption
1245
1442
  */
1246
1443
  type ListTableEditorAutoCompleteEnter = (input: string) => ListTableEditorOption[] | void | Promise<ListTableEditorOption[] | void>;
1247
1444
  interface ListTableEditorConfig {
1445
+ upload?: ListTableUploadConfig;
1248
1446
  valueType?: ListTableEditorValueType;
1249
1447
  format?: ListTableFormItemFormatter<any>;
1250
1448
  placeholder?: string;
@@ -1252,6 +1450,24 @@ interface ListTableEditorConfig {
1252
1450
  max?: number | string;
1253
1451
  step?: number | string;
1254
1452
  options?: ListTableEditorOption[];
1453
+ /** TreeSelect 树节点。 */
1454
+ treeData?: ListTableTreeSelectNode[];
1455
+ /** 初始展开全部树节点。 */
1456
+ treeDefaultExpandAll?: boolean;
1457
+ /** 初始展开节点 key。 */
1458
+ treeDefaultExpandedKeys?: (string | number)[];
1459
+ /** Cascader 是否允许选择非末级。 */
1460
+ changeOnSelect?: boolean;
1461
+ /** 开启多选:Cascader 使用二维路径数组,TreeSelect 使用节点值数组。 */
1462
+ multiple?: boolean;
1463
+ /** 多选回填策略,默认 SHOW_PARENT。 */
1464
+ showCheckedStrategy?: "SHOW_PARENT" | "SHOW_CHILD";
1465
+ /** Cascader 展开下级的方式。 */
1466
+ expandTrigger?: "click" | "hover";
1467
+ /** Cascader / TreeSelect 是否允许清空。 */
1468
+ allowClear?: boolean;
1469
+ /** Cascader 路径显示文本。 */
1470
+ displayRender?: (labels: string[], selectedOptions: ListTableEditorOption[]) => string;
1255
1471
  showSearch?: boolean;
1256
1472
  filterOption?: ListTableEditorFilterOption;
1257
1473
  onPressEnter?: ListTableEditorAutoCompleteEnter;
@@ -1332,6 +1548,8 @@ interface ListTablePaginationAdapter {
1332
1548
  destroy(): void;
1333
1549
  }
1334
1550
  interface CreateCellEditorSessionParams {
1551
+ /** 聚焦时是否全选内容;空单元格由首次键入打开时为 false。 */
1552
+ selectOnFocus?: boolean;
1335
1553
  rect: ListTableEditorRect;
1336
1554
  clipRect?: ListTableEditorRect;
1337
1555
  hostRect?: ListTableEditorRect;
@@ -1345,6 +1563,8 @@ interface CreateCellEditorSessionParams {
1345
1563
  }
1346
1564
  type ListTableEditorNavigateDirection = "up" | "down" | "prev" | "next";
1347
1565
  interface ListTableEditorRequest {
1566
+ /** 聚焦时是否全选内容;false 时光标置于输入内容末尾。 */
1567
+ selectOnFocus?: boolean;
1348
1568
  /** 当前编辑单元格标识,用于切换单元格时重置编辑器状态。 */
1349
1569
  editorKey?: string;
1350
1570
  rect: ListTableEditorRect;
@@ -1505,7 +1725,7 @@ type ListTableHighlightMode = "cell" | "row" | "column" | "cross";
1505
1725
  /**
1506
1726
  * 右键菜单功能项。
1507
1727
  */
1508
- type ListTableContextMenuFeature = "copy" | "search" | "export" | "downloadContent" | "rowCollapse" | "columnCollapse" | "freeze" | "reset" | "sort" | "density" | "zoom" | "columnWidth" | "alignment" | "dataFormat" | "grouping" | "columnVisibility";
1728
+ type ListTableContextMenuFeature = "copy" | "search" | "export" | "downloadContent" | "rowCollapse" | "columnCollapse" | "freeze" | "reset" | "sort" | "density" | "zoom" | "columnWidth" | "alignment" | "dataFormat" | "conditionalFormat" | "cache" | "grouping" | "columnVisibility";
1509
1729
  /**
1510
1730
  * 数据分组配置。
1511
1731
  */
@@ -1639,9 +1859,10 @@ type ListTableServerSummaryValues = ReadonlyMap<string, string | number | bigint
1639
1859
  * AntD 风格的排序结果。
1640
1860
  */
1641
1861
  interface ListTableQuerySorter {
1642
- columnKey: string | null;
1862
+ columnKey: string;
1643
1863
  field?: TableColumnDataIndex;
1644
- order: ListTableSortState["order"];
1864
+ order: "ascend" | "descend";
1865
+ priority?: number;
1645
1866
  }
1646
1867
  /**
1647
1868
  * 分页配置。
@@ -1705,7 +1926,7 @@ interface ListTableRowSelectionOptions<RecordType> {
1705
1926
  /**
1706
1927
  * AntD 风格的四参数查询回调。
1707
1928
  */
1708
- type ListTableQueryChange<RecordType> = (pagination: ListTableQueryPagination, filters: ListTableQueryFilters, sorter: ListTableQuerySorter, extra: ListTableQueryChangeExtra<RecordType>) => void;
1929
+ type ListTableQueryChange<RecordType> = (pagination: ListTableQueryPagination, filters: ListTableQueryFilters, sorter: ListTableQuerySorter[], extra: ListTableQueryChangeExtra<RecordType>) => void;
1709
1930
  /** 本地查询失败通知。 */
1710
1931
  interface ListTableQueryErrorInfo {
1711
1932
  /** 失败的查询动作。 */
@@ -1807,6 +2028,8 @@ interface ListTableExpandableOptions<RecordType = Record<string, unknown>> {
1807
2028
  * UI 适配层配置。
1808
2029
  */
1809
2030
  interface ListTableUiOptions {
2031
+ /** 导出文件名输入弹窗;未提供时使用浏览器输入框。 */
2032
+ onExportNameRequest?: (request: ListTableExportNameRequest | null) => void;
1810
2033
  editorFactory?: ListTableEditorFactory;
1811
2034
  paginationAdapter?: ListTablePaginationAdapter;
1812
2035
  onEditorRequest?: (request: ListTableEditorRequest | null) => void;
@@ -1821,6 +2044,10 @@ interface ListTableUiOptions {
1821
2044
  onDangerConfirmRequest?: (request: ListTableDangerConfirmRequest | null) => void;
1822
2045
  /** 持久化配置或内部操作改变表格密度时通知适配层。 */
1823
2046
  onDensityChange?: (density: 26 | 32 | 48 | 56 | "auto") => void;
2047
+ /** 同步列设置缓存开关。 */
2048
+ onColumnSettingsCacheChange?: (enabled: boolean) => void;
2049
+ /** 同步各类配置的缓存偏好。 */
2050
+ onCachePreferencesChange?: (preferences: ListTableCachePreferences) => void;
1824
2051
  }
1825
2052
  /**
1826
2053
  * 行选择器配置。
@@ -1844,6 +2071,11 @@ interface ListTableImagePreviewRequest {
1844
2071
  * 表格配置。
1845
2072
  */
1846
2073
  interface ListTableOptions<RecordType = Record<string, unknown>> {
2074
+ /** 工具栏、实例与右键导出的默认文件名及弹窗开关。 */
2075
+ exportOptions?: {
2076
+ fileName?: string;
2077
+ promptFileName?: boolean;
2078
+ };
1847
2079
  type?: "list";
1848
2080
  rowKey?: TableColumnDataIndex | ((record: RecordType, index: number) => string | number);
1849
2081
  /**
@@ -1932,6 +2164,10 @@ interface ListTableOptions<RecordType = Record<string, unknown>> {
1932
2164
  * 分页尺寸单独保存到 localStorage,初始化时恢复;显式 pagination.pageSize 优先于缓存。
1933
2165
  */
1934
2166
  storageKey?: string;
2167
+ /** 是否缓存列宽、显隐、固定与顺序,默认开启;需要 storageKey。 */
2168
+ cacheColumnSettings?: boolean;
2169
+ /** 分类缓存开关;不影响当前展示,只控制保存与刷新恢复。 */
2170
+ cachePreferences?: ListTableCachePreferences;
1935
2171
  /**
1936
2172
  * 受控列设置的修订号。修订号变化时以当前传入的列配置为准并写回持久化存储。
1937
2173
  *
@@ -1977,9 +2213,11 @@ type ListTableDensity = 26 | 32 | 48 | 56 | "auto";
1977
2213
  * XLSX 导出参数。
1978
2214
  */
1979
2215
  interface ListTableExportXlsxOptions extends XlsxExportOptions {
2216
+ /** 导出前输入文件名称,默认 true。 */
2217
+ promptFileName?: boolean;
1980
2218
  /** 导出文件名,可省略 `.xlsx` 扩展名。 */
1981
2219
  fileName?: string;
1982
- /** 是否在数据末尾追加按当前列配置计算的汇总行。 */
2220
+ /** 是否在数据末尾追加按当前列配置计算的汇总行,默认跟随表格汇总行的显示状态。 */
1983
2221
  includeSummary?: boolean;
1984
2222
  /** 导出失败通知;已保存的分文件不会撤回,取消不触发此回调。 */
1985
2223
  onError?: (error: unknown) => void;
@@ -2067,6 +2305,8 @@ declare class ListTable<RecordType = Record<string, unknown>> {
2067
2305
  * 设置并持久化内置表格密度。
2068
2306
  */
2069
2307
  changeDensity(density: ListTableDensity): void;
2308
+ /** 设置列设置缓存开关,不改变当前列展示。 */
2309
+ setColumnSettingsCache(enabled: boolean): void;
2070
2310
  /**
2071
2311
  * 销毁实例。
2072
2312
  */
@@ -2139,4 +2379,4 @@ interface ListTableValidationTarget {
2139
2379
  columnKey: string;
2140
2380
  }
2141
2381
 
2142
- export { type CreateCellEditorSessionParams, type DebugHitTestResult, EXPAND_COLUMN, type FilterPanelConfig, type FilterPanelOptionItem, type FilterPanelTexts, type FixedPopupConfig, type HeaderContextMenuColumnItem, type HeaderContextMenuConfig, type HeaderContextMenuDensity, ListTable, type ListTableAutoMergeRule, type ListTableBarcodeCellContent, type ListTableBarcodeFormat, type ListTableButtonCellContent, type ListTableButtonPopconfirmOptions, type ListTableButtonSize, type ListTableButtonType, type ListTableCSSProperties, type ListTableCarouselScrollOptions, type ListTableCellContent, type ListTableCellContentClickContext, type ListTableCellEditorSession, type ListTableCellSpan, type ListTableCellStyle, type ListTableChartCellContent, type ListTableChartSize, type ListTableChartType, type ListTableColorCellContent, type ListTableColumn, type ListTableContextMenuFeature, type ListTableContextMenuOptions, type ListTableCustomChartCellContent, type ListTableDangerConfirmRequest, type ListTableDataFormat, type ListTableDataFormatOptions, type ListTableDataFormatType, type ListTableDebugOptions, type ListTableDebugSnapshot, type ListTableDensity, type ListTableEditAutoCompleteEnter, type ListTableEditFilterOption, type ListTableEditOption, type ListTableEditValueType, type ListTableEditable, type ListTableEditorAutoCompleteEnter, type ListTableEditorConfig, type ListTableEditorFactory, type ListTableEditorFilterOption, type ListTableEditorNavigateDirection, type ListTableEditorOption, type ListTableEditorRect, type ListTableEditorRequest, type ListTableEditorTheme, type ListTableEditorValueType, type ListTableExperimentalOptions, type ListTableExportXlsxOptions, type ListTableFilterCondition$1 as ListTableFilterCondition, type ListTableFilterConditionOperator, type ListTableFilterConditionRelation, type ListTableFilterMatchMode, type ListTableFilterOption, type ListTableFilterOptionValue, type ListTableFilterPanelAdapter, type ListTableFilterState, type ListTableFilterType, type ListTableFilterValue$1 as ListTableFilterValue, type ListTableFixedPopupAdapter, type ListTableFormItemProps, type ListTableFormItemPropsConfig, type ListTableFormRule, type ListTableFormRules, type ListTableGroupingOptions, type ListTableHeaderContextMenuAdapter, type ListTableHighlightMode, type ListTableHorizontalAlign, type ListTableIconCellContent, type ListTableImageCellContent, type ListTableImageObjectFit, type ListTableImagePreviewRequest, type ListTableLoadingAdapter, type ListTableLoadingRequest, type ListTableMergeCellOptions, type ListTableNestedTableCellContent, type ListTableNestedTableColumn, type ListTableOffscreenCanvasStatusInfo, type ListTableOptions, type ListTablePaginationAdapter, type ListTablePaginationCSSProperties, type ListTablePaginationOptions, type ListTablePaginationStyleSlot, type ListTablePaginationStyles, type ListTablePerformanceMetric, type ListTableProgressCellContent, type ListTableProgressShape, type ListTableProgressSize, type ListTableQrCodeCellContent, type ListTableQrCodeLevel, type ListTableQueryChange, type ListTableQueryChangeExtra, type ListTableQueryFilters, type ListTableQueryOptions, type ListTableQueryPagination, type ListTableQuerySorter, type ListTableRateCellContent, type ListTableRateSize, type ListTableRateSymbolType, type ListTableRowDragMode, type ListTableRowDragOptions, type ListTableRowDragPayload, type ListTableRowDragSourceInfo, type ListTableRowDragZone, type ListTableRowEventProps, type ListTableRowSelectionChangeInfo, type ListTableRowSelectionOptions, type ListTableRowSelectorOptions, type ListTableScrollToOptions, type ListTableScrollbarCSSProperties, type ListTableScrollbarOptions, type ListTableSearchRequest, type ListTableSelectionState, type ListTableServerSummaryValues, type ListTableSortItem, type ListTableSortState, type ListTableSparklineChartCellContent, type ListTableSparklineSize, type ListTableStyles, type ListTableSummaryConfig, type ListTableSummaryRoundingMode, type ListTableSummaryType, type ListTableSymbolType, type ListTableTagCellContent, type ListTableTheme, type ListTableTooltipAdapter, type ListTableTooltipRequest, type ListTableUiOptions, type ListTableValidationError, type ListTableValidationErrorField, type ListTableValidationFailure, type ListTableValidationTarget, type PaginationConfig, ROW_SELECTION_COLUMN, type RenderCellDescriptor, SELECTION_COLUMN, getListTableStoredPageSize, resetListTableStoredColumnConfig };
2382
+ export { type CreateCellEditorSessionParams, type DebugHitTestResult, EXPAND_COLUMN, type FilterPanelConfig, type FilterPanelOptionItem, type FilterPanelTexts, type FixedPopupConfig, type HeaderContextMenuColumnItem, type HeaderContextMenuConfig, type HeaderContextMenuDensity, ListTable, type ListTableAntdIconName, type ListTableAutoMergeRule, type ListTableBarcodeCellContent, type ListTableBarcodeFormat, type ListTableBuiltinIconName, type ListTableButtonCellContent, type ListTableButtonPopconfirmOptions, type ListTableButtonSize, type ListTableButtonType, type ListTableCSSProperties, type ListTableCacheCategory, type ListTableCachePreferences, type ListTableCarouselScrollOptions, type ListTableCellContent, type ListTableCellContentClickContext, type ListTableCellEditorSession, type ListTableCellSpan, type ListTableCellStyle, type ListTableChartCellContent, type ListTableChartSize, type ListTableChartType, type ListTableColorCellContent, type ListTableColumn, type ListTableConditionalFormatCondition, type ListTableConditionalFormatRule, type ListTableConditionalOperator, type ListTableContextMenuFeature, type ListTableContextMenuOptions, type ListTableCustomChartCellContent, type ListTableDangerConfirmRequest, type ListTableDataFormat, type ListTableDataFormatOptions, type ListTableDataFormatType, type ListTableDebugOptions, type ListTableDebugSnapshot, type ListTableDensity, type ListTableEditAutoCompleteEnter, type ListTableEditFilterOption, type ListTableEditOption, type ListTableEditValueType, type ListTableEditable, type ListTableEditorAutoCompleteEnter, type ListTableEditorConfig, type ListTableEditorFactory, type ListTableEditorFilterOption, type ListTableEditorNavigateDirection, type ListTableEditorOption, type ListTableEditorRect, type ListTableEditorRequest, type ListTableEditorTheme, type ListTableEditorValueType, type ListTableExperimentalOptions, type ListTableExportNameRequest, type ListTableExportXlsxOptions, type ListTableFilterCondition$1 as ListTableFilterCondition, type ListTableFilterConditionOperator, type ListTableFilterConditionRelation, type ListTableFilterMatchMode, type ListTableFilterOption, type ListTableFilterOptionValue, type ListTableFilterPanelAdapter, type ListTableFilterState, type ListTableFilterType, type ListTableFilterValue$1 as ListTableFilterValue, type ListTableFixedPopupAdapter, type ListTableFormItemProps, type ListTableFormItemPropsConfig, type ListTableFormRule, type ListTableFormRules, type ListTableGaugeChartCellContent, type ListTableGroupingOptions, type ListTableHeaderContextMenuAdapter, type ListTableHighlightMode, type ListTableHorizontalAlign, type ListTableIconCellContent, type ListTableImageCellContent, type ListTableImageObjectFit, type ListTableImagePreviewRequest, type ListTableLoadingAdapter, type ListTableLoadingRequest, type ListTableMergeCellOptions, type ListTableNestedTableCellContent, type ListTableNestedTableColumn, type ListTableOffscreenCanvasStatusInfo, type ListTableOptions, type ListTablePaginationAdapter, type ListTablePaginationCSSProperties, type ListTablePaginationOptions, type ListTablePaginationStyleSlot, type ListTablePaginationStyles, type ListTablePerformanceMetric, type ListTablePieChartCellContent, type ListTableProgressCellContent, type ListTableProgressShape, type ListTableProgressSize, type ListTableQrCodeCellContent, type ListTableQrCodeLevel, type ListTableQueryChange, type ListTableQueryChangeExtra, type ListTableQueryFilters, type ListTableQueryOptions, type ListTableQueryPagination, type ListTableQuerySorter, type ListTableRadarChartCellContent, type ListTableRateCellContent, type ListTableRateSize, type ListTableRateSymbolType, type ListTableRowDragMode, type ListTableRowDragOptions, type ListTableRowDragPayload, type ListTableRowDragSourceInfo, type ListTableRowDragZone, type ListTableRowEventProps, type ListTableRowSelectionChangeInfo, type ListTableRowSelectionOptions, type ListTableRowSelectorOptions, type ListTableScrollToOptions, type ListTableScrollbarCSSProperties, type ListTableScrollbarOptions, type ListTableSearchRequest, type ListTableSelectionState, type ListTableServerSummaryValues, type ListTableSortItem, type ListTableSortState, type ListTableSorter, type ListTableSparklineChartCellContent, type ListTableSparklineSize, type ListTableStyles, type ListTableSummaryConfig, type ListTableSummaryRoundingMode, type ListTableSummaryType, type ListTableSymbolType, type ListTableTagCellContent, type ListTableTheme, type ListTableTimelineCellContent, type ListTableTimelineItem, type ListTableTooltipAdapter, type ListTableTooltipRequest, type ListTableTreeSelectNode, type ListTableUiOptions, type ListTableUploadConfig, type ListTableUploadFile, type ListTableUploadRequest, type ListTableValidationError, type ListTableValidationErrorField, type ListTableValidationFailure, type ListTableValidationTarget, type PaginationConfig, ROW_SELECTION_COLUMN, type RenderCellDescriptor, SELECTION_COLUMN, getListTableStoredPageSize, listTableAntdIconNames, listTableBuiltinIconNames, listTableIconNames, resetListTableStoredColumnConfig };