bw-pro-table 0.0.1

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.
Files changed (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +341 -0
  3. package/dist/bw-pro-table.css +2 -0
  4. package/dist/bw-pro-table.js +6414 -0
  5. package/dist/bw-pro-table.umd.cjs +62 -0
  6. package/dist/types/BwProTable.vue.d.ts +61 -0
  7. package/dist/types/BwProTableAdvancedFilter.vue.d.ts +17 -0
  8. package/dist/types/BwProTableBatchEditModal.vue.d.ts +23 -0
  9. package/dist/types/BwProTableColumnSearch.vue.d.ts +14 -0
  10. package/dist/types/BwProTableColumnSetting.vue.d.ts +14 -0
  11. package/dist/types/BwProTableContextMenu.vue.d.ts +20 -0
  12. package/dist/types/BwProTableCore.vue.d.ts +38 -0
  13. package/dist/types/BwProTableSearch.vue.d.ts +33 -0
  14. package/dist/types/BwProTableToolbar.vue.d.ts +84 -0
  15. package/dist/types/composables/index.d.ts +25 -0
  16. package/dist/types/composables/useBwKeyboard.d.ts +44 -0
  17. package/dist/types/composables/useBwPermission.d.ts +50 -0
  18. package/dist/types/composables/useBwRowEdit.d.ts +83 -0
  19. package/dist/types/composables/useBwRowSelection.d.ts +42 -0
  20. package/dist/types/composables/useColumnHeaderSearch.d.ts +28 -0
  21. package/dist/types/composables/useContextMenu.d.ts +54 -0
  22. package/dist/types/composables/useDragSort.d.ts +36 -0
  23. package/dist/types/composables/useExportExcel.d.ts +35 -0
  24. package/dist/types/composables/useImportExcel.d.ts +45 -0
  25. package/dist/types/composables/useLocale.d.ts +14 -0
  26. package/dist/types/composables/usePersistence.d.ts +60 -0
  27. package/dist/types/composables/useQueryParams.d.ts +38 -0
  28. package/dist/types/composables/useTableView.d.ts +36 -0
  29. package/dist/types/constants.d.ts +60 -0
  30. package/dist/types/drag-icon.vue.d.ts +14 -0
  31. package/dist/types/index.d.ts +20 -0
  32. package/dist/types/injection-keys.d.ts +59 -0
  33. package/dist/types/locales/en-US.d.ts +166 -0
  34. package/dist/types/locales/zh-CN.d.ts +6 -0
  35. package/dist/types/renderers/action-renderer.d.ts +6 -0
  36. package/dist/types/renderers/avatar-renderer.d.ts +6 -0
  37. package/dist/types/renderers/boolean-renderer.d.ts +6 -0
  38. package/dist/types/renderers/currency-renderer.d.ts +6 -0
  39. package/dist/types/renderers/date-renderer.d.ts +6 -0
  40. package/dist/types/renderers/image-renderer.d.ts +6 -0
  41. package/dist/types/renderers/index-renderer.d.ts +6 -0
  42. package/dist/types/renderers/index.d.ts +27 -0
  43. package/dist/types/renderers/link-renderer.d.ts +6 -0
  44. package/dist/types/renderers/number-renderer.d.ts +6 -0
  45. package/dist/types/renderers/progress-renderer.d.ts +6 -0
  46. package/dist/types/renderers/registry.d.ts +41 -0
  47. package/dist/types/renderers/tag-enum-renderer.d.ts +6 -0
  48. package/dist/types/renderers/text-renderer.d.ts +6 -0
  49. package/dist/types/types.d.ts +567 -0
  50. package/locales/en-US.ts +177 -0
  51. package/locales/zh-CN.ts +193 -0
  52. package/package.json +99 -0
@@ -0,0 +1,60 @@
1
+ import { type Ref } from 'vue';
2
+ import type { PersistedColumnState, ProColumnsType, PersistenceConfig, FilterValue, SortOrder } from '../types';
3
+ export interface UsePersistenceOptions {
4
+ /** 表格唯一标识 */
5
+ tableId?: string;
6
+ /** 缓存 key(与 tableId 二选一) */
7
+ cacheKey?: string;
8
+ /** 列定义 */
9
+ columns: Ref<ProColumnsType>;
10
+ /** 持久化配置 */
11
+ persistence?: false | PersistenceConfig;
12
+ }
13
+ export interface UsePersistenceReturn {
14
+ /** 是否启用持久化 */
15
+ enabled: boolean;
16
+ /** 加载持久化列配置 */
17
+ loadColumnState: () => PersistedColumnState[] | null;
18
+ /** 保存列配置 */
19
+ saveColumnState: (columns: PersistedColumnState[]) => void;
20
+ /** 保存分页大小 */
21
+ savePageSize: (pageSize: number) => void;
22
+ /** 加载分页大小 */
23
+ loadPageSize: () => number | null;
24
+ /** 保存当前页码 */
25
+ saveCurrentPage: (current: number) => void;
26
+ /** 加载当前页码 */
27
+ loadCurrentPage: () => number | null;
28
+ /** 保存密度 */
29
+ saveDensity: (density: 'small' | 'middle' | 'default') => void;
30
+ /** 加载密度 */
31
+ loadDensity: () => 'small' | 'middle' | 'default' | null;
32
+ /** 保存筛选状态 */
33
+ saveFilters: (filters: Record<string, FilterValue | null>) => void;
34
+ /** 加载筛选状态 */
35
+ loadFilters: () => Record<string, FilterValue | null> | null;
36
+ /** 保存排序状态 */
37
+ saveSorter: (sorter: {
38
+ field: string;
39
+ order: SortOrder;
40
+ } | null) => void;
41
+ /** 加载排序状态 */
42
+ loadSorter: () => {
43
+ field: string;
44
+ order: SortOrder;
45
+ } | null;
46
+ /** 清除所有缓存 */
47
+ clearCache: () => void;
48
+ /** 同步当前 columns 到缓存 */
49
+ syncColumnState: () => void;
50
+ }
51
+ /**
52
+ * usePersistence — 列配置持久化 composable
53
+ *
54
+ * 将列顺序、显隐、宽度、分页大小、密度持久化到 localStorage/sessionStorage/自定义存储。
55
+ * 键名格式:{keyPrefix}:{tableId}:cache
56
+ *
57
+ * 安全:多实例通过 tableId/cacheKey 命名空间隔离,互不干扰。
58
+ * 版本管理:支持数据版本迁移,自动处理旧版本数据。
59
+ */
60
+ export declare function usePersistence(options: UsePersistenceOptions): UsePersistenceReturn;
@@ -0,0 +1,38 @@
1
+ import { type Ref, type ComputedRef } from 'vue';
2
+ import type { SortOrder, FilterValue } from '../types';
3
+ export interface UseQueryParamsOptions {
4
+ /** 初始分页 */
5
+ initialPageSize?: number;
6
+ /** 请求防抖延迟(ms) */
7
+ debounceDelay?: number;
8
+ }
9
+ export interface QueryParams {
10
+ current: number;
11
+ pageSize: number;
12
+ sortField?: string;
13
+ sortOrder?: SortOrder;
14
+ [key: string]: any;
15
+ }
16
+ export interface UseQueryParamsReturn {
17
+ /** 当前查询参数 */
18
+ params: ComputedRef<QueryParams>;
19
+ /** 更新分页 */
20
+ updatePagination: (current: number, pageSize: number) => void;
21
+ /** 更新排序 */
22
+ updateSorter: (field: string, order: SortOrder) => void;
23
+ /** 更新筛选 */
24
+ updateFilter: (filters: Record<string, FilterValue | null>) => void;
25
+ /** 更新搜索参数 */
26
+ updateSearch: (searchParams: Record<string, any>) => void;
27
+ /** 重置所有参数 */
28
+ reset: () => void;
29
+ /** 防抖待处理的定时器 */
30
+ _debounceTimer: Ref<ReturnType<typeof setTimeout> | null>;
31
+ }
32
+ /**
33
+ * useQueryParams — 查询参数聚合 composable
34
+ *
35
+ * 聚合搜索、筛选、排序、分页参数,统一输出给 request 函数。
36
+ * 支持请求防抖,避免快速操作重复请求。
37
+ */
38
+ export declare function useQueryParams(options?: UseQueryParamsOptions): UseQueryParamsReturn;
@@ -0,0 +1,36 @@
1
+ import { type Ref } from 'vue';
2
+ import type { ViewConfig, PersistedColumnState, ProColumnsType } from '../types';
3
+ export interface UseTableViewOptions {
4
+ tableId: string;
5
+ columns?: Ref<ProColumnsType>;
6
+ defaultColumns?: PersistedColumnState[];
7
+ }
8
+ export interface UseTableViewReturn {
9
+ /** 所有视图列表 */
10
+ views: Ref<ViewConfig[]>;
11
+ /** 当前视图 */
12
+ currentView: Ref<ViewConfig | null>;
13
+ /** 是否显示视图管理 */
14
+ viewManagerVisible: Ref<boolean>;
15
+ /** 保存当前视图 */
16
+ saveView: (name: string) => void;
17
+ /** 加载视图 */
18
+ loadView: (viewId: string) => void;
19
+ /** 删除视图 */
20
+ deleteView: (viewId: string) => void;
21
+ /** 设为默认视图 */
22
+ setDefaultView: (viewId: string) => void;
23
+ /** 显示视图管理 */
24
+ showViewManager: () => void;
25
+ /** 隐藏视图管理 */
26
+ hideViewManager: () => void;
27
+ /** 视图变更回调(供父组件监听) */
28
+ onViewChange: Ref<((config: ViewConfig) => void) | null>;
29
+ }
30
+ /**
31
+ * useTableView — 视图保存/加载/管理 composable
32
+ *
33
+ * 将列配置+筛选+排序+分页保存为命名视图。
34
+ * 默认持久化到 localStorage,可选通过后端 API 共享视图。
35
+ */
36
+ export declare function useTableView(options: UseTableViewOptions): UseTableViewReturn;
@@ -0,0 +1,60 @@
1
+ import type { ValueType, PersistedTableState, TableState } from './types';
2
+ /** 默认每页条数 */
3
+ export declare const DEFAULT_PAGE_SIZE = 10;
4
+ /** 可选每页条数 */
5
+ export declare const DEFAULT_PAGE_SIZE_OPTIONS: string[];
6
+ /** 全局默认空单元格占位符 */
7
+ export declare const DEFAULT_EMPTY_TEXT = "-";
8
+ /** null / undefined / "" 的空值判断集 */
9
+ export declare const EMPTY_VALUES: ReadonlySet<unknown>;
10
+ /** localStorage 键前缀 */
11
+ export declare const PERSISTENCE_PREFIX = "bw-pro-table";
12
+ /** 持久化键生成 */
13
+ export declare const persistenceKey: (tableId: string) => string;
14
+ export declare const DEFAULT_PERSISTENCE_VERSION = "V1.0.0";
15
+ /** 当前持久化数据版本(供运行时校验使用) */
16
+ export declare const PERSISTED_DATA_VERSION = "V1.0.0";
17
+ /** 默认持久化状态 */
18
+ export declare const DEFAULT_PERSISTED_STATE: PersistedTableState;
19
+ /** 默认加载态 */
20
+ export declare const DEFAULT_LOADING_STATE: TableState;
21
+ /** 默认成功态 */
22
+ export declare const DEFAULT_SUCCESS_STATE: TableState;
23
+ /** 错误态生成函数 */
24
+ export declare const createErrorState: (message: string, reload?: () => void | Promise<void>) => TableState;
25
+ /** 默认日期格式 */
26
+ export declare const DEFAULT_DATE_FORMAT = "YYYY-MM-DD";
27
+ /** 默认日期时间格式 */
28
+ export declare const DEFAULT_DATETIME_FORMAT = "YYYY-MM-DD HH:mm:ss";
29
+ /** 所有支持的 valueType */
30
+ export declare const SUPPORTED_VALUE_TYPES: ValueType[];
31
+ /** 搜索栏默认折叠时显示的行数 */
32
+ export declare const DEFAULT_SEARCH_COLLAPSED_COUNT = 3;
33
+ /** 搜索栏默认 label 宽度 */
34
+ export declare const DEFAULT_SEARCH_LABEL_WIDTH = 80;
35
+ /** 不可搜索的 valueType 集合 */
36
+ export declare const UNSEARCHABLE_TYPES: ReadonlySet<string>;
37
+ /** 可列头搜索的 valueType 白名单(仅 text 类型列支持列头搜索,其他类型静默跳过) */
38
+ export declare const HEADER_SEARCHABLE_TYPES: ReadonlySet<string>;
39
+ /** 导出默认分片大小 */
40
+ export declare const DEFAULT_EXPORT_CHUNK_SIZE = 10000;
41
+ /** 导出最大行数警告阈值 */
42
+ export declare const DEFAULT_EXPORT_MAX_ROWS_WARNING = 50000;
43
+ /** 导出默认文件名 */
44
+ export declare const DEFAULT_EXPORT_FILENAME = "export";
45
+ /** 请求防抖延迟(ms) */
46
+ export declare const REQUEST_DEBOUNCE_DELAY = 300;
47
+ /** 键盘导航列键映射 */
48
+ export declare const KEYBOARD_NAV_KEYS: {
49
+ readonly UP: "ArrowUp";
50
+ readonly DOWN: "ArrowDown";
51
+ readonly LEFT: "ArrowLeft";
52
+ readonly RIGHT: "ArrowRight";
53
+ readonly TAB: "Tab";
54
+ readonly ENTER: "Enter";
55
+ readonly ESCAPE: "Escape";
56
+ readonly SPACE: " ";
57
+ readonly DELETE: "Delete";
58
+ };
59
+ /** 导入预览显示行数 */
60
+ export declare const IMPORT_PREVIEW_MAX_ROWS = 10;
@@ -0,0 +1,14 @@
1
+ interface Props {
2
+ draggable?: boolean;
3
+ }
4
+ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
+ dragend: (e: DragEvent) => any;
6
+ dragstart: (e: DragEvent) => any;
7
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
8
+ onDragend?: ((e: DragEvent) => any) | undefined;
9
+ onDragstart?: ((e: DragEvent) => any) | undefined;
10
+ }>, {
11
+ draggable: boolean;
12
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * BwProTable 组件入口
3
+ *
4
+ * 使用方式:
5
+ * ```ts
6
+ * import { BwProTable, defineColumnType } from 'bw-pro-table';
7
+ * ```
8
+ */
9
+ export { default as BwProTable } from './BwProTable.vue';
10
+ export { defineColumnType, ensureRenderers, getRendererSafe } from './renderers/index';
11
+ export { initBuiltinRenderers, resetRenderers } from './renderers/index';
12
+ export { BW_PRO_TABLE_KEY } from './injection-keys';
13
+ export type { BwProTableContext } from './injection-keys';
14
+ export { useQueryParams, useBwRowEdit, useBwRowSelection, useExportExcel, useImportExcel, usePersistence, useContextMenu, useDragSort, useBwKeyboard, useTableView, useBwPermission, useColumnHeaderSearch, } from './composables/index';
15
+ export type { ProColumnType, ProColumnsType, ValueType, ValueEnumItem, ValueEnumMap, ActionItem, FormRule, BwProTableProps, EditConfig, ContextMenuConfig, ContextMenuItem, DragConfig, ExportConfig, ImportConfig, ViewConfig, TableState, TableStatus, PersistedColumnState, PersistedTableState, StorageAdapter, PersistenceConfig, EditCommand, FilterOperator, AdvancedFilterCondition, AdvancedFilterGroup, } from './types';
16
+ export type { RendererFn, RendererContext } from './renderers/index';
17
+ export { DEFAULT_EMPTY_TEXT, DEFAULT_PAGE_SIZE, DEFAULT_DATE_FORMAT } from './constants';
18
+ export { default as zhCN } from './locales/zh-CN';
19
+ export { useLocale, mergeLocale, BW_PRO_TABLE_LOCALE_KEY } from './composables/useLocale';
20
+ export type { BwProTableLocale } from './types';
@@ -0,0 +1,59 @@
1
+ /**
2
+ * BwProTable provide/inject 类型安全 InjectionKey
3
+ */
4
+ import type { InjectionKey, Ref, ComputedRef } from 'vue';
5
+ import type { TableState } from './types';
6
+ export interface BwProTableContext {
7
+ /** 表格唯一标识 */
8
+ tableId: ComputedRef<string | undefined>;
9
+ /** 全量数据源 */
10
+ dataSource: Ref<any[]>;
11
+ /** 数据总数 */
12
+ total: Ref<number>;
13
+ /** 加载态 */
14
+ loading: ComputedRef<boolean>;
15
+ /** 搜索参数(搜索栏 + 表头筛选合并结果) */
16
+ searchParams: Ref<Record<string, any>> | ComputedRef<Record<string, any>>;
17
+ /** 选中行 keys */
18
+ selectedRowKeys: Ref<(string | number)[]>;
19
+ /** 选中行数据 */
20
+ selectedRows: Ref<any[]>;
21
+ /** 数据刷新 */
22
+ fetchData: () => Promise<void>;
23
+ /** 搜索 */
24
+ onSearch: (params: Record<string, any>) => void;
25
+ /** 刷新 */
26
+ onRefresh: () => void;
27
+ /** 清除筛选 */
28
+ onClearFilter: () => void;
29
+ /** 数据状态 */
30
+ tableState: Ref<TableState>;
31
+ /** 列头搜索参数(独立管道,Key → 搜索文本) */
32
+ headerSearchParams?: Ref<Record<string, string>>;
33
+ editingKeys: Ref<Set<string | number>>;
34
+ cellEditing: Ref<Map<string | number, Set<string>>>;
35
+ isCellEditing: (key: string | number, field: string) => boolean;
36
+ getDraftValue: (key: string | number, field: string) => any;
37
+ setDraftValue: (key: string | number, field: string, value: any) => void;
38
+ startCellEdit: (key: string | number, field: string) => void;
39
+ startRowEdit: (key: string | number) => void;
40
+ saveEdit: (key: string | number) => Promise<boolean>;
41
+ cancelEdit: (key: string | number) => void;
42
+ deleteRow: (key: string | number) => Promise<void>;
43
+ getFieldError: (key: string | number, field: string) => string | undefined;
44
+ undo: () => void;
45
+ redo: () => void;
46
+ addRow: (position?: 'top' | 'bottom') => void;
47
+ cloneRow: (key: string | number) => void;
48
+ /** 是否启用列拖拽排序 */
49
+ columnDraggable?: Ref<boolean>;
50
+ /** 表头拖拽后重排列(fromDataIndex → toDataIndex) */
51
+ reorderColumns?: (fromDataIndex: string, toDataIndex: string) => void;
52
+ /** 跨页选中 key 集合(仅跨页模式时注入) */
53
+ crossPageKeys?: Ref<Set<string | number>>;
54
+ /** 选中计数(computed,跨页模式下为全量数) */
55
+ selectionCount?: ComputedRef<number>;
56
+ /** 清空所有跨页选择 */
57
+ clearSelection?: () => void;
58
+ }
59
+ export declare const BW_PRO_TABLE_KEY: InjectionKey<BwProTableContext>;
@@ -0,0 +1,166 @@
1
+ /**
2
+ * BwProTable English locale
3
+ */
4
+ declare const _default: {
5
+ search: {
6
+ reset: string;
7
+ search: string;
8
+ expand: string;
9
+ collapse: string;
10
+ placeholder: string;
11
+ selectPlaceholder: string;
12
+ datePlaceholder: string;
13
+ inputPlaceholder: string;
14
+ selectPlaceholderWithTitle: string;
15
+ };
16
+ toolbar: {
17
+ refresh: string;
18
+ density: string;
19
+ densityDefault: string;
20
+ densityMiddle: string;
21
+ densitySmall: string;
22
+ fullscreen: string;
23
+ exitFullscreen: string;
24
+ columnSetting: string;
25
+ export: string;
26
+ clearFilter: string;
27
+ search: string;
28
+ border: string;
29
+ striped: string;
30
+ on: string;
31
+ off: string;
32
+ selected: string;
33
+ clearSelection: string;
34
+ };
35
+ table: {
36
+ total: string;
37
+ paginationTotal: string;
38
+ emptyText: string;
39
+ triggerAsc: string;
40
+ triggerDesc: string;
41
+ cancelSort: string;
42
+ };
43
+ columnSetting: {
44
+ title: string;
45
+ reset: string;
46
+ apply: string;
47
+ cancel: string;
48
+ };
49
+ edit: {
50
+ save: string;
51
+ cancel: string;
52
+ delete: string;
53
+ confirmDelete: string;
54
+ add: string;
55
+ batchEdit: string;
56
+ undo: string;
57
+ redo: string;
58
+ pleaseSelectField: string;
59
+ modifyField: string;
60
+ modifyValue: string;
61
+ selectedData: string;
62
+ placeholder: string;
63
+ selectPlaceholder: string;
64
+ validation: {
65
+ required: string;
66
+ number: string;
67
+ min: string;
68
+ max: string;
69
+ pattern: string;
70
+ };
71
+ };
72
+ export: {
73
+ excel: string;
74
+ csv: string;
75
+ selected: string;
76
+ success: string;
77
+ failed: string;
78
+ noData: string;
79
+ tooLarge: string;
80
+ selectFirst: string;
81
+ };
82
+ import: {
83
+ title: string;
84
+ selectFile: string;
85
+ preview: string;
86
+ columnMapping: string;
87
+ confirm: string;
88
+ cancel: string;
89
+ success: string;
90
+ failed: string;
91
+ template: string;
92
+ parseError: string;
93
+ emptyFile: string;
94
+ emptyValueField: string;
95
+ };
96
+ contextMenu: {
97
+ noActions: string;
98
+ view: string;
99
+ edit: string;
100
+ copy: string;
101
+ clone: string;
102
+ delete: string;
103
+ copyCell: string;
104
+ filterByCell: string;
105
+ sortAsc: string;
106
+ sortDesc: string;
107
+ hideColumn: string;
108
+ pinLeft: string;
109
+ pinRight: string;
110
+ autoSize: string;
111
+ };
112
+ view: {
113
+ save: string;
114
+ load: string;
115
+ delete: string;
116
+ setDefault: string;
117
+ name: string;
118
+ saved: string;
119
+ deleted: string;
120
+ switched: string;
121
+ enterName: string;
122
+ exists: string;
123
+ overWrite: string;
124
+ };
125
+ error: {
126
+ loadFailed: string;
127
+ retry: string;
128
+ required: string;
129
+ formatError: string;
130
+ };
131
+ selection: {
132
+ selectAllPages: string;
133
+ clearAll: string;
134
+ selectCurrentPage: string;
135
+ invertCurrentPage: string;
136
+ selectedCount: string;
137
+ clear: string;
138
+ };
139
+ filter: {
140
+ title: string;
141
+ equals: string;
142
+ notEquals: string;
143
+ contains: string;
144
+ greaterThan: string;
145
+ lessThan: string;
146
+ between: string;
147
+ isEmpty: string;
148
+ isNotEmpty: string;
149
+ field: string;
150
+ condition: string;
151
+ value: string;
152
+ startValue: string;
153
+ endValue: string;
154
+ addCondition: string;
155
+ reset: string;
156
+ apply: string;
157
+ and: string;
158
+ or: string;
159
+ };
160
+ boolean: {
161
+ true: string;
162
+ false: string;
163
+ placeholder: string;
164
+ };
165
+ };
166
+ export default _default;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * BwProTable 中文语言包
3
+ */
4
+ import type { BwProTableLocale } from '../types';
5
+ declare const zhCN: BwProTableLocale;
6
+ export default zhCN;
@@ -0,0 +1,6 @@
1
+ import type { RendererFn } from './registry';
2
+ /**
3
+ * 操作列渲染器 — valueType: 'action'
4
+ * 渲染按钮组,自动 fixed:'right',a-popconfirm 删除确认
5
+ */
6
+ export declare const actionRenderer: RendererFn;
@@ -0,0 +1,6 @@
1
+ import type { RendererFn } from './registry';
2
+ /**
3
+ * 头像渲染器 — valueType: 'avatar'
4
+ * 渲染 a-avatar + 名称
5
+ */
6
+ export declare const avatarRenderer: RendererFn;
@@ -0,0 +1,6 @@
1
+ import type { RendererFn } from './registry';
2
+ /**
3
+ * 布尔渲染器 — valueType: 'boolean'
4
+ * 渲染 ✓/✗ 图标或 a-switch 开关
5
+ */
6
+ export declare const booleanRenderer: RendererFn;
@@ -0,0 +1,6 @@
1
+ import type { RendererFn } from './registry';
2
+ /**
3
+ * 货币渲染器 — valueType: 'currency'
4
+ * 自动千分位 + 前缀/后缀符号(¥ / $ / %)
5
+ */
6
+ export declare const currencyRenderer: RendererFn;
@@ -0,0 +1,6 @@
1
+ import type { RendererFn } from './registry';
2
+ /**
3
+ * 日期渲染器 — valueType: 'date'
4
+ * 自动 dayjs 格式化,支持 dateFormat 配置
5
+ */
6
+ export declare const dateRenderer: RendererFn;
@@ -0,0 +1,6 @@
1
+ import type { RendererFn } from './registry';
2
+ /**
3
+ * 图片渲染器 — valueType: 'image'
4
+ * 缩略图展示 + a-image-preview-group 大图预览
5
+ */
6
+ export declare const imageRenderer: RendererFn;
@@ -0,0 +1,6 @@
1
+ import type { RendererFn } from './registry';
2
+ /**
3
+ * 序号渲染器 — valueType: 'index'
4
+ * 自动计算行号,支持跨页连续编号
5
+ */
6
+ export declare const indexRenderer: RendererFn;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * 渲染器统一导出 + 内置渲染器注册
3
+ *
4
+ * 使用方式:
5
+ * - 通过 ensureRenderers() 惰性初始化所有内置 valueType 渲染器
6
+ * - 通过 defineColumnType() 注册自定义 valueType
7
+ * - 初次调用 getRenderer/hasRenderer 前自动初始化
8
+ */
9
+ import { getRenderer } from './registry';
10
+ /**
11
+ * 惰性初始化所有内置渲染器(幂等,仅执行一次)
12
+ */
13
+ export declare function ensureRenderers(): void;
14
+ /**
15
+ * 初始化所有内置渲染器(与 ensureRenderers 等价,保留旧 API 兼容性)
16
+ */
17
+ export declare const initBuiltinRenderers: typeof ensureRenderers;
18
+ /**
19
+ * 获取渲染器(自动确保内置渲染器已初始化)
20
+ */
21
+ export declare function getRendererSafe(type: string): ReturnType<typeof getRenderer>;
22
+ export { registerRenderer, getRenderer, hasRenderer, defineColumnType } from './registry';
23
+ export type { RendererFn, RendererContext } from './registry';
24
+ /**
25
+ * 重置渲染器注册表(仅用于测试隔离)
26
+ */
27
+ export declare function resetRenderers(): void;
@@ -0,0 +1,6 @@
1
+ import type { RendererFn } from './registry';
2
+ /**
3
+ * 链接渲染器 — valueType: 'link'
4
+ * 渲染 a-typography-link,支持 href 模板或 onClick 回调
5
+ */
6
+ export declare const linkRenderer: RendererFn;
@@ -0,0 +1,6 @@
1
+ import type { RendererFn } from './registry';
2
+ /**
3
+ * 数字渲染器 — valueType: 'number'
4
+ * 自动千分位格式化,支持 precision 配置
5
+ */
6
+ export declare const numberRenderer: RendererFn;
@@ -0,0 +1,6 @@
1
+ import type { RendererFn } from './registry';
2
+ /**
3
+ * 进度条渲染器 — valueType: 'progress'
4
+ * 将数值渲染为 a-progress 组件
5
+ */
6
+ export declare const progressRenderer: RendererFn;
@@ -0,0 +1,41 @@
1
+ import type { ProColumnType } from '../types';
2
+ import type { VNode } from 'vue';
3
+ /**
4
+ * 渲染器上下文 — 每个 valueType 渲染器都接收此上下文
5
+ */
6
+ export interface RendererContext<RecordType = any> {
7
+ /** 当前列的值 */
8
+ value: any;
9
+ /** 当前行数据 */
10
+ record: RecordType;
11
+ /** 行索引 */
12
+ index: number;
13
+ /** 列配置 */
14
+ column: ProColumnType<RecordType>;
15
+ }
16
+ /**
17
+ * 渲染器函数签名
18
+ * 返回 VNode 或字符串 — 与 ant-design-vue customRender 兼容
19
+ */
20
+ export type RendererFn<RecordType = any> = (ctx: RendererContext<RecordType>) => VNode | string | number;
21
+ /**
22
+ * 注册渲染器
23
+ */
24
+ export declare function registerRenderer(type: string, renderer: RendererFn): void;
25
+ /**
26
+ * 获取渲染器
27
+ */
28
+ export declare function getRenderer(type: string): RendererFn | undefined;
29
+ /**
30
+ * 检查渲染器是否存在
31
+ */
32
+ export declare function hasRenderer(type: string): boolean;
33
+ /**
34
+ * 扩展 API — 用户可以注册自定义 valueType
35
+ * @example defineColumnType('custom', (ctx) => h('div', ctx.value))
36
+ */
37
+ export declare function defineColumnType(type: string, renderer: RendererFn): void;
38
+ /**
39
+ * 获取渲染器注册表(仅用于调试)
40
+ */
41
+ export declare function getRendererRegistry(): ReadonlyMap<string, RendererFn>;
@@ -0,0 +1,6 @@
1
+ import type { RendererFn } from './registry';
2
+ /**
3
+ * 标签/枚举渲染器 — valueType: 'tag'
4
+ * 根据 valueEnum 映射为 a-tag + 颜色
5
+ */
6
+ export declare const tagEnumRenderer: RendererFn;
@@ -0,0 +1,6 @@
1
+ import type { RendererFn } from './registry';
2
+ /**
3
+ * 文本渲染器 — valueType: 'text'
4
+ * 默认类型,自动应用 ellipsis + Tooltip
5
+ */
6
+ export declare const textRenderer: RendererFn;