arthub-table 0.2.88 → 0.2.89
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/arthub-table.common.js +1 -1
- package/dist/arthub-table.common.js.map +1 -1
- package/dist/arthub-table.umd.js +1 -1
- package/dist/arthub-table.umd.js.map +1 -1
- package/dist/arthub-table.umd.min.js +1 -1
- package/dist/arthub-table.umd.min.js.map +1 -1
- package/dist/types/core/DataGrid.d.ts +44 -1
- package/dist/types/core/conditionalStyle.d.ts +4 -0
- package/dist/types/core/types.d.ts +22 -0
- package/dist/types/core/viewers/PersonViewer.d.ts +2 -0
- package/dist/types/core/viewers/TaskNodeViewer.d.ts +2 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@ import Histories from "./History";
|
|
|
12
12
|
import { StyleManager, type TableTheme } from "./StyleManager";
|
|
13
13
|
import EdgeScroller from "./EdgeScroller";
|
|
14
14
|
import { type HeaderConfig } from "./util";
|
|
15
|
-
import { type FooterCellClickInfo, type FooterData, type FooterCellData, type GroupHeaderCellClickInfo, type GroupHeaderCellHoverInfo, type FooterStatRefreshInfo, type GroupHeaderStatRefreshInfo } from "./types";
|
|
15
|
+
import { type FooterCellClickInfo, type FooterData, type FooterCellData, type GroupHeaderCellClickInfo, type GroupHeaderCellHoverInfo, type FooterStatRefreshInfo, type GroupHeaderStatRefreshInfo, type ConditionalStyle, type ConditionalStylePatch, type ActiveCellInfo } from "./types";
|
|
16
16
|
import { type PerformanceMonitor } from "./PerformanceMonitor";
|
|
17
17
|
interface Column extends HeaderConfig {
|
|
18
18
|
children?: Column[];
|
|
@@ -137,6 +137,8 @@ interface RowContextMenuInfo {
|
|
|
137
137
|
clientX: number;
|
|
138
138
|
/** 鼠标屏幕 Y 坐标 */
|
|
139
139
|
clientY: number;
|
|
140
|
+
/** 右键发生时的不可变源单元格快照,供“快速生成规则”使用。 */
|
|
141
|
+
sourceCell?: ActiveCellInfo;
|
|
140
142
|
/** Canvas 行索引(供外部通过 isRowCheckedByIndex 查询选中状态) */
|
|
141
143
|
_canvasRowIndex?: number;
|
|
142
144
|
/** 右键行是否处于选中(checked)状态 */
|
|
@@ -146,6 +148,20 @@ interface RowContextMenuInfo {
|
|
|
146
148
|
/** Row 对象内部的 _rowId,和 selectedRowIds 中的 key 格式一致 */
|
|
147
149
|
_internalRowId?: string;
|
|
148
150
|
}
|
|
151
|
+
/** Row hover action context. sourceCell is limited to the hovered row. */
|
|
152
|
+
export interface RowHoverActionInfo {
|
|
153
|
+
rowData: RowData;
|
|
154
|
+
rowIndex: number;
|
|
155
|
+
sourceCell?: ActiveCellInfo;
|
|
156
|
+
position: {
|
|
157
|
+
x: number;
|
|
158
|
+
y: number;
|
|
159
|
+
width: number;
|
|
160
|
+
height: number;
|
|
161
|
+
};
|
|
162
|
+
clientX?: number;
|
|
163
|
+
clientY?: number;
|
|
164
|
+
}
|
|
149
165
|
export interface DataGridOptions {
|
|
150
166
|
width?: number | string;
|
|
151
167
|
height?: number | string;
|
|
@@ -429,6 +445,10 @@ export interface DataGridOptions {
|
|
|
429
445
|
}) => void;
|
|
430
446
|
/** 行右键菜单回调:行区域右键时触发 */
|
|
431
447
|
onRowContextMenu?: (info: RowContextMenuInfo) => void;
|
|
448
|
+
/** 行 hover 时是否展示通用“更多”操作。 */
|
|
449
|
+
rowHoverAction?: boolean;
|
|
450
|
+
/** 行 hover 操作点击回调。 */
|
|
451
|
+
onRowHoverActionClick?: (info: RowHoverActionInfo) => void;
|
|
432
452
|
onModuleOverflowClick?: (modules: any[], rowData: any, rowIndex: number, colIndex: number) => void;
|
|
433
453
|
onAddRow?: (groupInfo?: any) => void;
|
|
434
454
|
/** 表头排序图标点击回调 */
|
|
@@ -862,6 +882,10 @@ declare class DataGrid {
|
|
|
862
882
|
private _customTokens;
|
|
863
883
|
edgeScroller: EdgeScroller;
|
|
864
884
|
rowIdMap: Map<string, number>;
|
|
885
|
+
private conditionalRowStyles;
|
|
886
|
+
private conditionalCellStyles;
|
|
887
|
+
/** 行、单元格样式同时命中时复用合并结果,避免每一帧为每个单元格创建临时对象。 */
|
|
888
|
+
private resolvedConditionalCellStyles;
|
|
865
889
|
selectedRowIds: Set<string>;
|
|
866
890
|
selectedGroupIds: Set<string>;
|
|
867
891
|
lastSelectedRowIndex: number;
|
|
@@ -980,6 +1004,11 @@ declare class DataGrid {
|
|
|
980
1004
|
}) => void;
|
|
981
1005
|
/** 行右键菜单回调 */
|
|
982
1006
|
onRowContextMenu?: (info: RowContextMenuInfo) => void;
|
|
1007
|
+
rowHoverAction?: DataGridOptions['rowHoverAction'];
|
|
1008
|
+
onRowHoverActionClick?: (info: RowHoverActionInfo) => void;
|
|
1009
|
+
private _rowHoverActionInfo;
|
|
1010
|
+
private _rowHoverActionIcon;
|
|
1011
|
+
private _rowHoverActionIconTheme;
|
|
983
1012
|
onModuleOverflowClick?: (modules: any[], rowData: any, rowIndex: number, colIndex: number) => void;
|
|
984
1013
|
onAddRow?: (groupInfo?: any) => void;
|
|
985
1014
|
onScroll?: (scrollX: number, scrollY: number) => void;
|
|
@@ -1575,6 +1604,12 @@ declare class DataGrid {
|
|
|
1575
1604
|
* Called when data changes, interaction state changes, etc.
|
|
1576
1605
|
*/
|
|
1577
1606
|
markDirty(): void;
|
|
1607
|
+
private mergeConditionalStyle;
|
|
1608
|
+
/** Apply a Worker result in one batch and trigger at most one canvas repaint. */
|
|
1609
|
+
applyConditionalStylePatches(patches: ConditionalStylePatch[]): void;
|
|
1610
|
+
clearConditionalStyles(rowIds?: Array<string | number>): void;
|
|
1611
|
+
/** Resolve row style first, then cell style. Callers must treat the returned cache entry as read-only. */
|
|
1612
|
+
getConditionalStyle(rowId: string | number | null | undefined, columnKey?: string): ConditionalStyle | undefined;
|
|
1578
1613
|
/**
|
|
1579
1614
|
* [PERF] 反注册本实例向 ImageManager 单例注册过的回调。
|
|
1580
1615
|
* Vue 组件 onUnmounted 时调用,避免每次组件卸载/重建累计泄漏 callback
|
|
@@ -1925,6 +1960,12 @@ declare class DataGrid {
|
|
|
1925
1960
|
y: number;
|
|
1926
1961
|
height: number;
|
|
1927
1962
|
} | null;
|
|
1963
|
+
private getSelectedCellInfoForRow;
|
|
1964
|
+
private updateRowHoverAction;
|
|
1965
|
+
isRowHoverActionAt(x: number, y: number): boolean;
|
|
1966
|
+
private drawRowHoverAction;
|
|
1967
|
+
triggerRowHoverAction(clientX: number, clientY: number): void;
|
|
1968
|
+
setRowHoverAction(action: DataGridOptions['rowHoverAction']): void;
|
|
1928
1969
|
/**
|
|
1929
1970
|
* 根据列 key 获取列的布局信息(精确的 x 偏移、宽度、冻结状态)
|
|
1930
1971
|
* @param key - 列配置中的 key 属性
|
|
@@ -1982,6 +2023,8 @@ declare class DataGrid {
|
|
|
1982
2023
|
width: number;
|
|
1983
2024
|
height: number;
|
|
1984
2025
|
} | null;
|
|
2026
|
+
/** 将 Canvas viewer 的显示对象转换为可读文本,供右键等外部 UI 使用。 */
|
|
2027
|
+
getCellDisplayText(cell: any): string;
|
|
1985
2028
|
/**
|
|
1986
2029
|
* 根据 canvas 局部坐标命中可见 cell(外部文件拖拽 hit-test 入口)。
|
|
1987
2030
|
*
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Resolve the stable render row id used by both cell and row-header conditional styles. */
|
|
2
|
+
export declare function getConditionalStyleRowId(rowData: Record<string, unknown> | undefined, rowKey: string, rowId?: unknown): string | number | undefined;
|
|
3
|
+
/** Blend a translucent conditional background once before canvas text and icons are drawn. */
|
|
4
|
+
export declare function compositeConditionalBackground(foreground: string, background: string): string;
|
|
@@ -1,4 +1,26 @@
|
|
|
1
1
|
import type { ViewerOption } from './viewers/types';
|
|
2
|
+
/** Runtime style produced by conditional-format rules. `null` clears an existing value. */
|
|
3
|
+
export interface ConditionalStyle {
|
|
4
|
+
backgroundColor?: string | null;
|
|
5
|
+
color?: string | null;
|
|
6
|
+
fontWeight?: 'normal' | 'bold' | null;
|
|
7
|
+
}
|
|
8
|
+
/** A batched conditional-format update addressed by the stable DataGrid row id. */
|
|
9
|
+
export interface ConditionalStylePatch {
|
|
10
|
+
rowId: string | number;
|
|
11
|
+
rowStyle?: ConditionalStyle | null;
|
|
12
|
+
cellStyles?: Record<string, ConditionalStyle | null>;
|
|
13
|
+
}
|
|
14
|
+
/** Immutable snapshot used by context-menu based rule creation. */
|
|
15
|
+
export interface ActiveCellInfo {
|
|
16
|
+
rowId: string;
|
|
17
|
+
rowIndex: number;
|
|
18
|
+
colIndex: number;
|
|
19
|
+
columnKey: string;
|
|
20
|
+
rawValue: unknown;
|
|
21
|
+
displayValue: string;
|
|
22
|
+
rowData: Record<string, any>;
|
|
23
|
+
}
|
|
2
24
|
export interface CellData {
|
|
3
25
|
value?: any;
|
|
4
26
|
text?: string;
|
|
@@ -11,6 +11,8 @@ declare class PersonViewer implements CellViewer<PersonViewerData> {
|
|
|
11
11
|
readonly type = "person";
|
|
12
12
|
private imageManager;
|
|
13
13
|
private _sm;
|
|
14
|
+
/** The active cell style is shared by the small person-card drawing helpers in one synchronous draw pass. */
|
|
15
|
+
private _cellStyle;
|
|
14
16
|
/**
|
|
15
17
|
* 每个 cell 内"被截断的 person 名称"几何缓存。
|
|
16
18
|
* 二级结构 WeakMap<scope, Map<`${rowIndex}-${colIndex}`, PersonOverflowInfo[]>>:
|
|
@@ -23,6 +23,8 @@ declare class TaskNodeViewer implements CellViewer<TaskNodeViewerData> {
|
|
|
23
23
|
/** 记录加载失败的图标 URL,避免反复重试 */
|
|
24
24
|
private failedIcons;
|
|
25
25
|
private _sm;
|
|
26
|
+
/** Conditional formatting is injected per draw and must never be cached in node data. */
|
|
27
|
+
private _cellStyle;
|
|
26
28
|
private get NODE_ITEM_BG_COLOR();
|
|
27
29
|
private get TEXT_COLOR();
|
|
28
30
|
private get EMPTY_TEXT_COLOR();
|
package/dist/types/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import DataGrid from './components/index.vue';
|
|
|
8
8
|
declare const install: (app: App) => void;
|
|
9
9
|
export { install };
|
|
10
10
|
export default DataGrid;
|
|
11
|
-
export type { CellData, CellStyle, RowData, ColData, DataGridOptions, Position, Size, Rect, Range, CellRange, HistoryItem, ValidatorRule, ColumnType, ColumnConfig, SelectorState, EditorState, AutofillState, RangeState, DrawOptions, TextOptions, ClipboardState, EventHandlers, Direction, ScrollDirection, GroupLevel, SeparateLevel, BaseGroupedRowData, GroupRowData, SeparateRowData, NormalRowData, GroupedTableRowData, GroupRowStyle, SeparatorRowStyle, StatisticOption, FooterCellData, FooterData, FooterCellClickInfo, } from './core/types';
|
|
11
|
+
export type { CellData, CellStyle, RowData, ColData, DataGridOptions, Position, Size, Rect, Range, CellRange, HistoryItem, ValidatorRule, ColumnType, ColumnConfig, SelectorState, EditorState, AutofillState, RangeState, DrawOptions, TextOptions, ClipboardState, EventHandlers, ConditionalStyle, ConditionalStylePatch, ActiveCellInfo, Direction, ScrollDirection, GroupLevel, SeparateLevel, BaseGroupedRowData, GroupRowData, SeparateRowData, NormalRowData, GroupedTableRowData, GroupRowStyle, SeparatorRowStyle, StatisticOption, FooterCellData, FooterData, FooterCellClickInfo, } from './core/types';
|
|
12
12
|
export { isGroupRow, isSeparateRow, isNormalRow, isRowSelectable, GROUP_TABLE_CONSTANTS, DEFAULT_GROUP_STYLES, DEFAULT_SEPARATOR_STYLES, } from './core/types';
|
|
13
13
|
export type { CellBounds, ViewerRenderContext, ViewerDragState, CellViewer, CellViewerData, ViewerOption, ViewerStyle, TextViewerData, DropdownViewerData, ImageViewerData, PreImageViewerData, PersonViewerData, PersonInfo, ProgressViewerData, DatetimeViewerData, CaseTimeViewerData, BooleanViewerData, StatusViewerData, StatusOption, GroupHeaderViewerData, GroupNameViewerData, GroupNameTagItem, GroupNamePersonItem, SeparatorRowViewerData, PunchViewerData, PunchValue, ModuleInfo, ModuleViewerData, TextViewerChildCountTextPart, TextViewerChildCountIconPart, TextViewerChildCountRenderResult, TextViewerChildCountRenderer, TextViewerWithSwitcherData, FileItem, FileViewerData, HyperlinkTextViewerData, IUpstreamModule, IUpstreamReminderProperties, IUpstreamSyncProperty, IUpstreamFieldViewItem, UpstreamViewerData, TaskNodeItem, TaskNodeViewerData, NestedGridViewerData, NestedColumnConfig, ViewerConstructor, ViewerFactory, ViewerTypeMap, ViewerType, TypedCellData, TableActionButtonOption, TableActionButtonViewerData, } from './core/viewers/types';
|
|
14
14
|
export { isTextViewerData, isDropdownViewerData, isPersonViewerData, isProgressViewerData, isNestedGridViewerData, } from './core/viewers/types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arthub-table",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.89",
|
|
4
4
|
"description": "High-performance canvas-based table/grid component for Vue 3 with TypeScript support, featuring virtual scrolling, cell viewers, grouped rows, and nested grids.",
|
|
5
5
|
"main": "dist/arthub-table.common.js",
|
|
6
6
|
"module": "dist/arthub-table.umd.min.js",
|