arthub-table 0.2.86 → 0.2.87-next.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.
@@ -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;
@@ -1013,6 +1040,10 @@ declare class DataGrid {
1013
1040
  onGroupHeaderStatRefresh?: (info: GroupHeaderStatRefreshInfo) => void;
1014
1041
  /** Footer 弹窗激活的列标识 key(弹窗打开时设置,关闭时清除),保持该列的下拉箭头和刷新图标始终显示 */
1015
1042
  footerPopoverActiveKey: string | null;
1043
+ /** 人员工时图标激活状态(弹窗打开时记录 groupId,关闭时置 null),用于绘制蓝色激活图标 */
1044
+ userWorkingHoursActiveState: {
1045
+ groupId: string | number;
1046
+ } | null;
1016
1047
  /** 组头弹窗激活状态(弹窗打开时设置,关闭时清除),包含列标识和分组 ID,确保只有对应分组的列显示激活样式 */
1017
1048
  groupHeaderPopoverActiveState: {
1018
1049
  key: string;
@@ -1571,6 +1602,12 @@ declare class DataGrid {
1571
1602
  * Called when data changes, interaction state changes, etc.
1572
1603
  */
1573
1604
  markDirty(): void;
1605
+ private mergeConditionalStyle;
1606
+ /** Apply a Worker result in one batch and trigger at most one canvas repaint. */
1607
+ applyConditionalStylePatches(patches: ConditionalStylePatch[]): void;
1608
+ clearConditionalStyles(rowIds?: Array<string | number>): void;
1609
+ /** Resolve row style first, then cell style. Callers must treat the returned cache entry as read-only. */
1610
+ getConditionalStyle(rowId: string | number | null | undefined, columnKey?: string): ConditionalStyle | undefined;
1574
1611
  /**
1575
1612
  * [PERF] 反注册本实例向 ImageManager 单例注册过的回调。
1576
1613
  * Vue 组件 onUnmounted 时调用,避免每次组件卸载/重建累计泄漏 callback
@@ -1921,6 +1958,12 @@ declare class DataGrid {
1921
1958
  y: number;
1922
1959
  height: number;
1923
1960
  } | null;
1961
+ private getSelectedCellInfoForRow;
1962
+ private updateRowHoverAction;
1963
+ isRowHoverActionAt(x: number, y: number): boolean;
1964
+ private drawRowHoverAction;
1965
+ triggerRowHoverAction(clientX: number, clientY: number): void;
1966
+ setRowHoverAction(action: DataGridOptions['rowHoverAction']): void;
1924
1967
  /**
1925
1968
  * 根据列 key 获取列的布局信息(精确的 x 偏移、宽度、冻结状态)
1926
1969
  * @param key - 列配置中的 key 属性
@@ -1978,6 +2021,8 @@ declare class DataGrid {
1978
2021
  width: number;
1979
2022
  height: number;
1980
2023
  } | null;
2024
+ /** 将 Canvas viewer 的显示对象转换为可读文本,供右键等外部 UI 使用。 */
2025
+ getCellDisplayText(cell: any): string;
1981
2026
  /**
1982
2027
  * 根据 canvas 局部坐标命中可见 cell(外部文件拖拽 hit-test 入口)。
1983
2028
  *
@@ -2499,6 +2544,12 @@ declare class DataGrid {
2499
2544
  * 若省略 groupId 但当前已有激活状态,则保留已有的 groupId(兼容外部只传 key 的调用)
2500
2545
  */
2501
2546
  setGroupHeaderPopoverActive(key: string | null, groupId?: string | number): void;
2547
+ /**
2548
+ * 设置人员工时图标的激活状态(弹窗打开时调用,关闭时传 null)。
2549
+ * 与 setGroupHeaderPopoverActive 不同:专用于"工时摘要弹窗"激活态,激活时该分组行的工时图标渲染为蓝色。
2550
+ * @param groupId - 分组 ID;传 null 表示关闭弹窗、清除激活状态
2551
+ */
2552
+ setUserWorkingHoursActive(groupId: string | number | null): void;
2502
2553
  /** 从 body.data 中查找指定 groupId 的 GroupRowData */
2503
2554
  private findGroupRowData;
2504
2555
  /**
@@ -116,6 +116,15 @@ declare class ImageManager {
116
116
  * @returns HTMLCanvasElement with colored icon, or null if source icon not yet loaded
117
117
  */
118
118
  getColoredFilterIcon(color: string, size?: number): HTMLCanvasElement | null;
119
+ /**
120
+ * 按目标色给"任意按需加载的图标"着色(通用版,供 GroupRow 等使用)。
121
+ * 复用类内已有的 recolorIcon(source-in 合成,不缓存、每次现算)。
122
+ * @param src 图标资源 URL(即 getCachedImage / loadImage 使用的同一个 src)
123
+ * @param color 目标填充色
124
+ * @param size 显示尺寸(正方形)
125
+ * @returns 着色后的 canvas;原图未加载完成时返回 null(调用方需兜底)
126
+ */
127
+ getColoredIcon(src: string, color: string, size?: number): HTMLCanvasElement | null;
119
128
  /**
120
129
  * Load settings icon (for nested column parent headers)
121
130
  */
@@ -271,6 +271,8 @@ export interface ThemeTokens {
271
271
  iconExpandActive: string;
272
272
  /** 筛选激活色(筛选命中该列时,筛选图标常驻且使用此色) */
273
273
  iconFilterActive: string;
274
+ /** 人员工时图标激活色(工时摘要弹窗打开时,该分组行工时图标使用此色) */
275
+ iconUserWorkingHoursActive: string;
274
276
  /** WfState 默认图标色 */
275
277
  iconWfStateDefault: string;
276
278
  /** 审核图标色 */
@@ -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.1",
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",