arthub-table 0.2.49-next.1 → 0.2.49

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.
@@ -19,8 +19,9 @@ declare class CpPersonViewer implements CellViewer<CpPersonViewerData> {
19
19
  private _sm;
20
20
  /**
21
21
  * 每个 cell 内"被截断的 CP person 名称"几何缓存。
22
- * Key: `${rowIndex}-${colIndex}`;不主动清理,依赖 draw 重绘覆盖。
23
- * 单例 viewer,无需考虑跨 grid 隔离。
22
+ * 二级结构 WeakMap<scope, Map<`${rowIndex}-${colIndex}`, CpPersonOverflowInfo[]>>:
23
+ * - 外层 scope 区分 DataGrid 与内部 NestedGrid,避免内外层相同 rowIndex/colIndex 互相覆盖
24
+ * - 作用域实例被 GC 后 WeakMap 自动释放,无需主动清理
24
25
  */
25
26
  private _personOverflowCache;
26
27
  private get avatarColors();
@@ -10,9 +10,10 @@ import type { CellViewer, ViewerRenderContext, DropdownViewerData } from './type
10
10
  declare class DropdownViewer implements CellViewer<DropdownViewerData> {
11
11
  readonly type = "select";
12
12
  /**
13
- * 多选 tag 几何与"是否截断"缓存(仅 drawMultipleTags 分支写入)。
14
- * Key: `${rowIndex}-${colIndex}`;不主动清理,依赖 draw 重绘覆盖。
15
- * 单例 viewer,无需考虑跨 grid 隔离。
13
+ * 多选 tag 几何与"是否截断"缓存(仅 drawMultipleTags / drawSingleOption 分支写入)。
14
+ * 二级结构 WeakMap<scope, Map<`${rowIndex}-${colIndex}`, DropdownTagOverflowInfo[]>>:
15
+ * - 外层 scope 区分 DataGrid 与内部 NestedGrid,避免内外层相同 rowIndex/colIndex 互相覆盖
16
+ * - 作用域实例被 GC 后 WeakMap 自动释放,无需主动清理
16
17
  */
17
18
  private _tagOverflowCache;
18
19
  /**
@@ -14,8 +14,9 @@ declare class ModuleViewer implements CellViewer<ModuleViewerData> {
14
14
  readonly type = "module";
15
15
  /**
16
16
  * drawColoredTags 时每个 cell 内所有 tag 的几何与"是否截断"信息缓存。
17
- * - Key: `${rowIndex}-${colIndex}`
18
- * - Value: 数组,对应 drawColoredTags 实际绘制的 tag 序列
17
+ * 二级结构 WeakMap<scope, Map<`${rowIndex}-${colIndex}`, ModuleTagOverflowInfo[]>>:
18
+ * - 外层 scope 区分 DataGrid 与内部 NestedGrid,避免内外层相同 rowIndex/colIndex 互相覆盖
19
+ * - 作用域实例被 GC 后 WeakMap 自动释放,无需主动清理
19
20
  *
20
21
  * 写入:drawColoredTags 末尾覆盖式写入
21
22
  * 读取:getTooltip 用 localX/localY 命中后查询
@@ -13,8 +13,9 @@ declare class PersonViewer implements CellViewer<PersonViewerData> {
13
13
  private _sm;
14
14
  /**
15
15
  * 每个 cell 内"被截断的 person 名称"几何缓存。
16
- * Key: `${rowIndex}-${colIndex}`;不主动清理,依赖 draw 重绘覆盖。
17
- * 单例 viewer,无需考虑跨 grid 隔离。
16
+ * 二级结构 WeakMap<scope, Map<`${rowIndex}-${colIndex}`, PersonOverflowInfo[]>>:
17
+ * - 外层 scope 用于区分 DataGrid 与其内部各个 NestedGrid,避免内外层 rowIndex/colIndex 相同时互相覆盖
18
+ * - 作用域实例被 GC 后 WeakMap 自动释放,无需主动清理
18
19
  */
19
20
  private _personOverflowCache;
20
21
  private get avatarColors();
@@ -11,19 +11,19 @@ declare class TextViewer implements CellViewer<TextViewerData> {
11
11
  readonly type = "text";
12
12
  /**
13
13
  * drawMultiTags 时每个 cell 内所有 tag 的几何与"是否截断"信息缓存。
14
- * - Key: `${rowIndex}-${colIndex}`
15
- * - Value: 数组,对应 drawMultiTags 实际绘制的 tag 序列
14
+ * 二级结构 WeakMap<scope, Map<`${rowIndex}-${colIndex}`, TagOverflowInfo[]>>:
15
+ * - 外层 scope 区分 DataGrid 与内部 NestedGrid,避免内外层相同 rowIndex/colIndex 互相覆盖
16
+ * - 作用域实例被 GC 后 WeakMap 自动释放,无需主动清理
16
17
  *
17
18
  * 写入:drawMultiTags 末尾覆盖式写入
18
19
  * 读取:getTooltip 用 localX/localY 命中后查询
19
20
  * 清理策略:依赖 draw 自动刷新(每次重绘同 key 覆盖),不主动清理。
20
- * 该 viewer 在 ViewerRegistry 中是单例,所以缓存是单例级的,不需考虑跨 grid 隔离。
21
21
  */
22
22
  private _multiTagOverflowCache;
23
23
  /**
24
24
  * 单文本场景(普通 draw 分支)的"上一次绘制时的渲染区域"缓存。
25
- * - Key: `${rowIndex}-${colIndex}`
26
- * - Value: { x, y, width, height, padding, fontSize }
25
+ * 二级结构 WeakMap<scope, Map<`${rowIndex}-${colIndex}`, geometry>>,
26
+ * 区分 DataGrid 与内部 NestedGrid。
27
27
  *
28
28
  * 写入:draw() 普通文本分支末尾写入
29
29
  * 读取:getTooltip 调用时按需通过 ctx.measureText 临时判定是否溢出
@@ -43,6 +43,14 @@ export interface ViewerRenderContext {
43
43
  fillColor: string;
44
44
  /** Callback to request redraw */
45
45
  requestRedraw: () => void;
46
+ /**
47
+ * Cache scope key for viewer-internal per-cell caches (e.g. tag overflow info).
48
+ * - Top-level DataGrid cells: default = grid itself
49
+ * - NestedGrid inner cells: pass the inner NestedGrid instance so nested cells
50
+ * don't collide with outer grid cells that share the same rowIndex/colIndex.
51
+ * Viewers should use this via `resolveCacheScope(context)` from `./utils`.
52
+ */
53
+ cacheScope?: object;
46
54
  /** 鼠标点击时的视口 clientX(仅在 onClick/onDblClick 调用链中可用) */
47
55
  clientX?: number;
48
56
  /** 鼠标点击时的视口 clientY(仅在 onClick/onDblClick 调用链中可用) */
@@ -17,3 +17,17 @@ export declare function resolveCssColor(color: string | undefined | null, fallba
17
17
  * 在主题切换等场景下调用,确保重新解析颜色
18
18
  */
19
19
  export declare function clearCssColorCache(): void;
20
+ /**
21
+ * 解析 viewer 缓存作用域。
22
+ * NestedGrid 会显式传入 cacheScope(内层 NestedGrid 实例),保证内层 cell 与外层 cell
23
+ * 的缓存互不覆盖;未显式传入时回退到 context.grid(外层 DataGrid 实例)。
24
+ */
25
+ export declare function resolveCacheScope(context: {
26
+ grid: object;
27
+ cacheScope?: object;
28
+ }): object;
29
+ /**
30
+ * 从二级 WeakMap 缓存中按作用域取子 Map,作用域被 GC 后自动释放,避免内存泄漏。
31
+ * 用法:const cache = getPerScopeCache(this._weakCache, resolveCacheScope(context));
32
+ */
33
+ export declare function getPerScopeCache<K, V>(perScopeCaches: WeakMap<object, Map<K, V>>, scope: object): Map<K, V>;
@@ -213,6 +213,12 @@ export interface TestHooksAPI {
213
213
  * @returns Row data object or null if not found
214
214
  */
215
215
  getRowData: (rowId: string | number) => Record<string, any> | null;
216
+ /**
217
+ * 返回当前 body.data 的浅拷贝(视觉顺序),每项含 id / nodeId / name。
218
+ * 用于 e2e 在视觉顺序下批量获取主任务 rowId(pipeline-count-display 等场景)。
219
+ * 不存在 body.data 时回退到 _fullData。
220
+ */
221
+ getDataRows: () => Array<Record<string, any>>;
216
222
  /**
217
223
  * 获取组头行搜索命中高亮状态。
218
224
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arthub-table",
3
- "version": "0.2.49-next.1",
3
+ "version": "0.2.49",
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",