arthub-table 0.2.0-beta.13 → 0.2.0-beta.15
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/viewers/index.d.ts +0 -3
- package/dist/types/core/viewers/types.d.ts +0 -53
- package/package.json +1 -1
- package/dist/types/core/viewers/RelatedTaskViewer.d.ts +0 -76
|
@@ -40,7 +40,6 @@ export { default as ModuleColExpandViewer } from './ModuleColExpandViewer';
|
|
|
40
40
|
export { default as ChildrenViewer } from './ChildrenViewer';
|
|
41
41
|
export { default as OnlyShowErrorViewer } from './OnlyShowErrorViewer';
|
|
42
42
|
export { default as PerspectiveViewer } from './PerspectiveViewer';
|
|
43
|
-
export { default as RelatedTaskViewer } from './RelatedTaskViewer';
|
|
44
43
|
import TextViewer from './TextViewer';
|
|
45
44
|
import DropdownViewer from './DropdownViewer';
|
|
46
45
|
import ImageViewer from './ImageViewer';
|
|
@@ -77,7 +76,6 @@ import ModuleColExpandViewer from './ModuleColExpandViewer';
|
|
|
77
76
|
import ChildrenViewer from './ChildrenViewer';
|
|
78
77
|
import OnlyShowErrorViewer from './OnlyShowErrorViewer';
|
|
79
78
|
import PerspectiveViewer from './PerspectiveViewer';
|
|
80
|
-
import RelatedTaskViewer from './RelatedTaskViewer';
|
|
81
79
|
/**
|
|
82
80
|
* Register all default viewers
|
|
83
81
|
* Call this function once during application initialization
|
|
@@ -128,5 +126,4 @@ export declare const defaultViewers: {
|
|
|
128
126
|
children: typeof ChildrenViewer;
|
|
129
127
|
'only-show-error': typeof OnlyShowErrorViewer;
|
|
130
128
|
perspective: typeof PerspectiveViewer;
|
|
131
|
-
'related-task': typeof RelatedTaskViewer;
|
|
132
129
|
};
|
|
@@ -1262,56 +1262,3 @@ export interface RichTextViewerData extends CellViewerData {
|
|
|
1262
1262
|
/** 占位符文本,默认 '-' */
|
|
1263
1263
|
placeholder?: string;
|
|
1264
1264
|
}
|
|
1265
|
-
/**
|
|
1266
|
-
* Related-task display field item
|
|
1267
|
-
*/
|
|
1268
|
-
export interface RelatedTaskDisplayField {
|
|
1269
|
-
/** Field key (e.g. 'estimate_start_date') */
|
|
1270
|
-
key: string;
|
|
1271
|
-
/** Field display label (e.g. '预计开始时间') */
|
|
1272
|
-
label: string;
|
|
1273
|
-
/** Raw field value */
|
|
1274
|
-
value: any;
|
|
1275
|
-
/** Formatted display value (e.g. '2026/03/02') */
|
|
1276
|
-
displayValue: string;
|
|
1277
|
-
/** Whether this field is a file-type field */
|
|
1278
|
-
isFileType: boolean;
|
|
1279
|
-
/** File data for file-type fields (cover images, etc.) */
|
|
1280
|
-
fileData?: Array<{
|
|
1281
|
-
coverUrl: string;
|
|
1282
|
-
assetId?: number;
|
|
1283
|
-
status?: number;
|
|
1284
|
-
fileFormat?: string;
|
|
1285
|
-
}>;
|
|
1286
|
-
/** File meta key for file-type fields (e.g. 'deliverable') */
|
|
1287
|
-
fileMeta?: string;
|
|
1288
|
-
/** Node ID that owns this file (for opening asset detail) */
|
|
1289
|
-
nodeId?: number;
|
|
1290
|
-
}
|
|
1291
|
-
/**
|
|
1292
|
-
* Related-task Viewer data interface
|
|
1293
|
-
* Displays the first related task's configured display fields
|
|
1294
|
-
*/
|
|
1295
|
-
export interface RelatedTaskViewerData extends CellViewerData {
|
|
1296
|
-
/** Structured value containing related task info */
|
|
1297
|
-
value: {
|
|
1298
|
-
/** First related task node ID */
|
|
1299
|
-
firstRelatedTaskId: number;
|
|
1300
|
-
/** First related task name */
|
|
1301
|
-
firstRelatedTaskName: string;
|
|
1302
|
-
/** Display label for the task name field (e.g. "名称") */
|
|
1303
|
-
firstRelatedTaskLabel?: string;
|
|
1304
|
-
/** All related node IDs (for future interactions) */
|
|
1305
|
-
allRelatedNodeIds: number[];
|
|
1306
|
-
/** Display fields with resolved values */
|
|
1307
|
-
displayFields: RelatedTaskDisplayField[];
|
|
1308
|
-
} | null;
|
|
1309
|
-
/** Thumbnail fit mode for file-type fields (synced from imageDisplayMode config) */
|
|
1310
|
-
thumbnailFit?: 'contain' | 'cover' | 'fill' | 'height-full' | 'width-full';
|
|
1311
|
-
/** Callback when user clicks a file thumbnail — opens asset detail page */
|
|
1312
|
-
onFileGoToDetail?: (file: {
|
|
1313
|
-
assetId: number;
|
|
1314
|
-
id: number;
|
|
1315
|
-
ids: number[];
|
|
1316
|
-
}, data: any) => void;
|
|
1317
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arthub-table",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.15",
|
|
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",
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RelatedTaskViewer - Related task cell renderer (Canvas implementation)
|
|
3
|
-
* Displays the first related task's configured display fields.
|
|
4
|
-
*
|
|
5
|
-
* Layout modes:
|
|
6
|
-
* - Single-line (default): task name | thumbnails | "label: value" pairs — all horizontal, vertically centered
|
|
7
|
-
* - Multi-line (when row is expanded by nested columns): one field per line, vertically stacked
|
|
8
|
-
*/
|
|
9
|
-
import type { CellViewer, ViewerRenderContext, RelatedTaskViewerData } from './types';
|
|
10
|
-
declare class RelatedTaskViewer implements CellViewer<RelatedTaskViewerData> {
|
|
11
|
-
readonly type = "related-task";
|
|
12
|
-
private imageManager;
|
|
13
|
-
/** Track failed image URLs to avoid retrying */
|
|
14
|
-
private failedImages;
|
|
15
|
-
private _sm;
|
|
16
|
-
private get TEXT_COLOR();
|
|
17
|
-
private get LABEL_COLOR();
|
|
18
|
-
private get EMPTY_TEXT_COLOR();
|
|
19
|
-
private get DASHED_BORDER_COLOR();
|
|
20
|
-
constructor();
|
|
21
|
-
/**
|
|
22
|
-
* Calculate thumbnail height for single-line mode.
|
|
23
|
-
* Max height = cell height - top/bottom padding (4px each).
|
|
24
|
-
*/
|
|
25
|
-
private getSingleLineThumbnailHeight;
|
|
26
|
-
/**
|
|
27
|
-
* Calculate thumbnail width for a given image, maintaining aspect ratio.
|
|
28
|
-
* If no image is cached yet, returns thumbHeight (square placeholder).
|
|
29
|
-
*/
|
|
30
|
-
private getThumbnailWidth;
|
|
31
|
-
/**
|
|
32
|
-
* Draw an image within the given area according to the specified fit mode.
|
|
33
|
-
* Mirrors the logic in FileViewer.drawPreviewImage and ImageViewer.drawImageWithFit.
|
|
34
|
-
*/
|
|
35
|
-
private drawImageWithFit;
|
|
36
|
-
/**
|
|
37
|
-
* Draw the related task cell content
|
|
38
|
-
*/
|
|
39
|
-
draw(context: ViewerRenderContext, data: RelatedTaskViewerData): void;
|
|
40
|
-
private drawSingleLine;
|
|
41
|
-
/**
|
|
42
|
-
* Draw a single inline thumbnail at the given position (for single-line mode).
|
|
43
|
-
* @returns The X position after the thumbnail(s)
|
|
44
|
-
*/
|
|
45
|
-
private drawInlineThumbnail;
|
|
46
|
-
private drawMultiLine;
|
|
47
|
-
/**
|
|
48
|
-
* Draw empty placeholder — consistent with other viewers
|
|
49
|
-
*/
|
|
50
|
-
private drawEmptyPlaceholder;
|
|
51
|
-
/**
|
|
52
|
-
* Draw a file status/format icon when coverUrl is not available.
|
|
53
|
-
* Uses the same getIconByFileStatus logic as FileViewer for visual consistency.
|
|
54
|
-
*/
|
|
55
|
-
private drawFileStatusIcon;
|
|
56
|
-
/**
|
|
57
|
-
* Draw a dashed rectangle placeholder for unloaded/missing images
|
|
58
|
-
*/
|
|
59
|
-
private drawDashedPlaceholder;
|
|
60
|
-
/**
|
|
61
|
-
* Truncate text to fit within maxWidth, appending ellipsis if needed
|
|
62
|
-
*/
|
|
63
|
-
private truncateText;
|
|
64
|
-
/**
|
|
65
|
-
* Handle click events on the cell.
|
|
66
|
-
* Detects clicks on file thumbnails and triggers onFileGoToDetail callback.
|
|
67
|
-
*/
|
|
68
|
-
onClick(context: ViewerRenderContext, data: RelatedTaskViewerData, localX: number, localY: number): boolean;
|
|
69
|
-
/**
|
|
70
|
-
* Get cursor style for hover — show pointer on file thumbnails
|
|
71
|
-
*/
|
|
72
|
-
getHitArea(context: ViewerRenderContext, data: RelatedTaskViewerData, localX: number, localY: number): string | null;
|
|
73
|
-
private calculateSingleLineThumbnailAreas;
|
|
74
|
-
private calculateMultiLineThumbnailAreas;
|
|
75
|
-
}
|
|
76
|
-
export default RelatedTaskViewer;
|