arthub-table 0.2.86 → 0.2.87-next.0

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.
@@ -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,8 @@ declare class DataGrid {
862
882
  private _customTokens;
863
883
  edgeScroller: EdgeScroller;
864
884
  rowIdMap: Map<string, number>;
885
+ private conditionalRowStyles;
886
+ private conditionalCellStyles;
865
887
  selectedRowIds: Set<string>;
866
888
  selectedGroupIds: Set<string>;
867
889
  lastSelectedRowIndex: number;
@@ -980,6 +1002,11 @@ declare class DataGrid {
980
1002
  }) => void;
981
1003
  /** 行右键菜单回调 */
982
1004
  onRowContextMenu?: (info: RowContextMenuInfo) => void;
1005
+ rowHoverAction?: DataGridOptions['rowHoverAction'];
1006
+ onRowHoverActionClick?: (info: RowHoverActionInfo) => void;
1007
+ private _rowHoverActionInfo;
1008
+ private _rowHoverActionIcon;
1009
+ private _rowHoverActionIconTheme;
983
1010
  onModuleOverflowClick?: (modules: any[], rowData: any, rowIndex: number, colIndex: number) => void;
984
1011
  onAddRow?: (groupInfo?: any) => void;
985
1012
  onScroll?: (scrollX: number, scrollY: number) => void;
@@ -1571,6 +1598,12 @@ declare class DataGrid {
1571
1598
  * Called when data changes, interaction state changes, etc.
1572
1599
  */
1573
1600
  markDirty(): void;
1601
+ private mergeConditionalStyle;
1602
+ /** Apply a Worker result in one batch and trigger at most one canvas repaint. */
1603
+ applyConditionalStylePatches(patches: ConditionalStylePatch[]): void;
1604
+ clearConditionalStyles(rowIds?: Array<string | number>): void;
1605
+ /** Resolve row style first, then cell style. Callers must treat the returned cache entry as read-only. */
1606
+ getConditionalStyle(rowId: string | number | null | undefined, columnKey?: string): ConditionalStyle | undefined;
1574
1607
  /**
1575
1608
  * [PERF] 反注册本实例向 ImageManager 单例注册过的回调。
1576
1609
  * Vue 组件 onUnmounted 时调用,避免每次组件卸载/重建累计泄漏 callback
@@ -1921,6 +1954,12 @@ declare class DataGrid {
1921
1954
  y: number;
1922
1955
  height: number;
1923
1956
  } | null;
1957
+ private getSelectedCellInfoForRow;
1958
+ private updateRowHoverAction;
1959
+ isRowHoverActionAt(x: number, y: number): boolean;
1960
+ private drawRowHoverAction;
1961
+ triggerRowHoverAction(clientX: number, clientY: number): void;
1962
+ setRowHoverAction(action: DataGridOptions['rowHoverAction']): void;
1924
1963
  /**
1925
1964
  * 根据列 key 获取列的布局信息(精确的 x 偏移、宽度、冻结状态)
1926
1965
  * @param key - 列配置中的 key 属性
@@ -1978,6 +2017,8 @@ declare class DataGrid {
1978
2017
  width: number;
1979
2018
  height: number;
1980
2019
  } | null;
2020
+ /** 将 Canvas viewer 的显示对象转换为可读文本,供右键等外部 UI 使用。 */
2021
+ getCellDisplayText(cell: any): string;
1981
2022
  /**
1982
2023
  * 根据 canvas 局部坐标命中可见 cell(外部文件拖拽 hit-test 入口)。
1983
2024
  *
@@ -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();
@@ -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.86",
3
+ "version": "0.2.87-next.0",
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",