From c69a258b106331271bf069b770e25b3a3c439234 Mon Sep 17 00:00:00 2001 From: fangsmile Date: Mon, 16 Jun 2025 12:32:23 +0000 Subject: [PATCH 01/22] docs: generate changelog of release v1.19.0 --- docs/assets/changelog/en/release.md | 26 ++++++++++++++++++++++++++ docs/assets/changelog/zh/release.md | 26 ++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/docs/assets/changelog/en/release.md b/docs/assets/changelog/en/release.md index 13dedd7976..7a10f03b39 100644 --- a/docs/assets/changelog/en/release.md +++ b/docs/assets/changelog/en/release.md @@ -1,3 +1,29 @@ +# v1.19.0 + +2025-06-16 + + +**🆕 New feature** + +- **@visactor/vtable-gantt**: add task-bar minSize config [#4016](https://github.com/VisActor/VTable/issues/4016) +- **@visactor/vtable-gantt**: support different dependency link line has differrent style [#4016](https://github.com/VisActor/VTable/issues/4016) +- **@visactor/vtable**: add containerFit config to support table size +- **@visactor/vtable**: add wps fill-handle plugin +- **@visactor/vtable**: add clearColWidthCache for updateColumns api + +**🐛 Bug fix** + +- **@visactor/vtable**: some taskShowMode should compute all row height on vtable [#4011](https://github.com/VisActor/VTable/issues/4011) +- **@visactor/vtable**: group release so gif can stop animation [#4029](https://github.com/VisActor/VTable/issues/4029) + +**🔧 Configuration releated** + +- **@visactor/vtable**: update vrender 1.0.0 + + + +[more detail about v1.19.0](https://github.com/VisActor/VTable/releases/tag/v1.19.0) + # v1.18.5 2025-06-09 diff --git a/docs/assets/changelog/zh/release.md b/docs/assets/changelog/zh/release.md index 7dbf7969e1..d6dd55dea2 100644 --- a/docs/assets/changelog/zh/release.md +++ b/docs/assets/changelog/zh/release.md @@ -1,3 +1,29 @@ +# v1.19.0 + +2025-06-16 + + +**🆕 新增功能** + +- **@visactor/vtable-gantt**: add task-bar minSize config [#4016](https://github.com/VisActor/VTable/issues/4016) +- **@visactor/vtable-gantt**: support different dependency link line has differrent style [#4016](https://github.com/VisActor/VTable/issues/4016) +- **@visactor/vtable**: add containerFit config to support table size +- **@visactor/vtable**: add wps fill-handle plugin +- **@visactor/vtable**: add clearColWidthCache for updateColumns api + +**🐛 功能修复** + +- **@visactor/vtable**: some taskShowMode should compute all row height on vtable [#4011](https://github.com/VisActor/VTable/issues/4011) +- **@visactor/vtable**: group release so gif can stop animation [#4029](https://github.com/VisActor/VTable/issues/4029) + +**🔧 项目配置** + +- **@visactor/vtable**: update vrender 1.0.0 + + + +[更多详情请查看 v1.19.0](https://github.com/VisActor/VTable/releases/tag/v1.19.0) + # v1.18.5 2025-06-09 From e9b8ad92693c0c0660abcc1ffdfb3befbeb5856e Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Tue, 17 Jun 2025 10:36:31 +0800 Subject: [PATCH 02/22] chore: update change log --- docs/assets/changelog/zh/release.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/assets/changelog/zh/release.md b/docs/assets/changelog/zh/release.md index d6dd55dea2..18eb974359 100644 --- a/docs/assets/changelog/zh/release.md +++ b/docs/assets/changelog/zh/release.md @@ -4,22 +4,22 @@ **🆕 新增功能** - -- **@visactor/vtable-gantt**: add task-bar minSize config [#4016](https://github.com/VisActor/VTable/issues/4016) -- **@visactor/vtable-gantt**: support different dependency link line has differrent style [#4016](https://github.com/VisActor/VTable/issues/4016) -- **@visactor/vtable**: add containerFit config to support table size -- **@visactor/vtable**: add wps fill-handle plugin -- **@visactor/vtable**: add clearColWidthCache for updateColumns api + +- **@visactor/vtable-gantt**: 添加任务条最小尺寸配置 [#4016](https://github.com/VisActor/VTable/issues/4016) +- **@visactor/vtable-gantt**: 支持不同依赖关系连接线具有不同样式 [#4016](https://github.com/VisActor/VTable/issues/4016) +- **@visactor/vtable**: 添加 containerFit 配置以支持表格尺寸适配 +- **@visactor/vtable**: 添加 仿WPS 填充柄功能插件 +- **@visactor/vtable**: 为 updateColumns API 添加 clearColWidthCache 配置项,用于清除列宽缓存 **🐛 功能修复** - -- **@visactor/vtable**: some taskShowMode should compute all row height on vtable [#4011](https://github.com/VisActor/VTable/issues/4011) -- **@visactor/vtable**: group release so gif can stop animation [#4029](https://github.com/VisActor/VTable/issues/4029) + +- **@visactor/vtable**: 某些 taskShowMode 应该计算 vtable 上的所有行高 [#4011](https://github.com/VisActor/VTable/issues/4011) +- **@visactor/vtable**: gif 停止动画时释放资源 [#4029](https://github.com/VisActor/VTable/issues/4029) **🔧 项目配置** - -- **@visactor/vtable**: update vrender 1.0.0 - + +- **@visactor/vtable**: 更新至 vrender 1.0.0 + [更多详情请查看 v1.19.0](https://github.com/VisActor/VTable/releases/tag/v1.19.0) From 2109a8a9b6700738e91af444444131aa5db68639 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Tue, 17 Jun 2025 11:16:26 +0800 Subject: [PATCH 03/22] chore: update github ci --- .github/ISSUE_TEMPLATE/bug_report.yml | 6 ++-- .github/ISSUE_TEMPLATE/feaure_request.yml | 4 +-- .../option/en/common/option-secondary.md | 31 +++++++++--------- .../option/zh/common/option-secondary.md | 32 ++++++++++--------- 4 files changed, 38 insertions(+), 35 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index b4fadf5185..b7207b1d17 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -10,8 +10,8 @@ body: For usage questions, please use the following resources: - - Read the [docs](https://www.visactor.io/) - - Find in [examples](https://www.visactor.io/) + - Read the [docs](https://www.visactor.io/vtable) + - Find in [examples](https://www.visactor.io/vtable/example) - Look for / ask questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/visactor) For non-technical support or general questions, you can email [xuanhun521@126.com](mailto:xuanhun521@126.com). @@ -41,7 +41,7 @@ body: attributes: label: Link to Minimal Reproduction description: | - If the reproduction does not need a build setup, please provide a link to [Official Editor](TODO), [JSFiddle](TODO), [JSBin](https://jsbin.com/) or [CodePen](TODO). If it requires a build setup, you can use [CodeSandbox](https://codesandbox.io/p/sandbox/vtable-bug-report-dd9pfl?file=%2Fsrc%2Findex.ts%3A57%2C11) or provide a GitHub repo. + If the reproduction does not need a build setup, please provide a link to [Official Editor](https://www.visactor.io/vtable/demo/table-type/list-table), [codesandbox](https://codesandbox.io/p/sandbox/vtable-list-table-jw8yr8). If it requires a build setup, you can use [CodeSandbox](https://codesandbox.io/p/sandbox/vtable-bug-report-dd9pfl?file=%2Fsrc%2Findex.ts%3A57%2C11) or provide a GitHub repo. The reproduction should be **minimal** - i.e. it should contain only the bare minimum amount of code needed to show the bug. Please do not just fill in a random link. The issue will be closed if no valid reproduction is provided. [Why?](https://antfu.me/posts/why-reproductions-are-required) diff --git a/.github/ISSUE_TEMPLATE/feaure_request.yml b/.github/ISSUE_TEMPLATE/feaure_request.yml index 34d0f3eb40..1b73d54567 100644 --- a/.github/ISSUE_TEMPLATE/feaure_request.yml +++ b/.github/ISSUE_TEMPLATE/feaure_request.yml @@ -10,8 +10,8 @@ body: For usage questions, please use the following resources: - - Read the [docs](https://www.visactor.io/) - - Find in [examples](https://www.visactor.io//) + - Read the [docs](https://www.visactor.io/vtable) + - Find in [examples](https://www.visactor.io/vtable/example) - Look for / ask questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/visactors) For non-technical support or general questions, you can email [xuanhun521@126.com](mailto:xuanhun521@126.com). diff --git a/docs/assets/option/en/common/option-secondary.md b/docs/assets/option/en/common/option-secondary.md index 8d7f83cb86..0955cba72e 100644 --- a/docs/assets/option/en/common/option-secondary.md +++ b/docs/assets/option/en/common/option-secondary.md @@ -42,6 +42,22 @@ When calculating the content width, the limited area participates in the calcula - 'only-body': Only the body cell content is calculated. - 'normal': Normal calculation, that is, calculating the header and body cell contents. +#${prefix} containerFit(Object) + +Configuration for adapting the table frame to the container dimensions while preserving content size. + +```javascript +containerFit: { + width: true, // boolean + height: true // boolean +} +``` + +- `width`: Whether to adapt the table frame width to the container width +- `height`: Whether to adapt the table frame height to the container height + +Unlike adaptive mode (`widthMode: 'adaptive'` or `heightMode: 'adaptive'`) which stretches content to fill the container, `containerFit` maintains the original content dimensions and fills remaining space appropriately. + #${prefix} autoWrapText(boolean) = false Whether to automatically wrap text @@ -676,18 +692,3 @@ Validate when the drag to move position ends. validateDragOrderOnEnd?: (source: CellAddress, target: CellAddress) => boolean; ``` -#${prefix} containerFit(Object) - -Configuration for adapting the table frame to the container dimensions while preserving content size. - -```javascript -containerFit: { - width: true, // boolean - height: true // boolean -} -``` - -- `width`: Whether to adapt the table frame width to the container width -- `height`: Whether to adapt the table frame height to the container height - -Unlike adaptive mode (`widthMode: 'adaptive'` or `heightMode: 'adaptive'`) which stretches content to fill the container, `containerFit` maintains the original content dimensions and fills remaining space appropriately. diff --git a/docs/assets/option/zh/common/option-secondary.md b/docs/assets/option/zh/common/option-secondary.md index 0c6d897e48..0f37efc37a 100644 --- a/docs/assets/option/zh/common/option-secondary.md +++ b/docs/assets/option/zh/common/option-secondary.md @@ -42,6 +42,23 @@ adaptive 模式下高度的适应策略,默认为 'only-body'。 - 'only-body':只计算 body 单元格内容。 - 'normal':正常计算,即计算表头和 body 单元格内容。 +#${prefix} containerFit(Object) + +配置表格框架适应容器尺寸,同时保持内容大小不变。 + +```javascript +containerFit: { + width: true, // boolean + height: true // boolean +} +``` + +- `width`: 是否让表格框架宽度适应容器宽度 +- `height`: 是否让表格框架高度适应容器高度 + +与自适应模式(`widthMode: 'adaptive'` 或 `heightMode: 'adaptive'`)拉伸内容以填充容器不同,`containerFit` 保持原始内容尺寸,并适当填充剩余空间。 + + #${prefix} autoWrapText(boolean) = false 是否自动换行 @@ -672,18 +689,3 @@ animationAppear?: boolean | { validateDragOrderOnEnd?: (source: CellAddress, target: CellAddress) => boolean; ``` -#${prefix} containerFit(Object) - -配置表格框架适应容器尺寸,同时保持内容大小不变。 - -```javascript -containerFit: { - width: true, // boolean - height: true // boolean -} -``` - -- `width`: 是否让表格框架宽度适应容器宽度 -- `height`: 是否让表格框架高度适应容器高度 - -与自适应模式(`widthMode: 'adaptive'` 或 `heightMode: 'adaptive'`)拉伸内容以填充容器不同,`containerFit` 保持原始内容尺寸,并适当填充剩余空间。 From c9def80484073cd3214a8be1cc4be84aa6cfcfc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=9D=A8=E6=9E=9A?= Date: Tue, 17 Jun 2025 18:37:28 +0800 Subject: [PATCH 04/22] fix(containerFit): the calculation of row heights and canvas draw range height --- packages/vtable/src/core/BaseTable.ts | 32 +++++++++++++---- packages/vtable/src/layout/row-height-map.ts | 20 +++++++++++ .../group-contribution-render.ts | 36 +++++++++++-------- 3 files changed, 68 insertions(+), 20 deletions(-) diff --git a/packages/vtable/src/core/BaseTable.ts b/packages/vtable/src/core/BaseTable.ts index fab2086a7a..8d9915e5a5 100644 --- a/packages/vtable/src/core/BaseTable.ts +++ b/packages/vtable/src/core/BaseTable.ts @@ -1430,6 +1430,8 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { !isDefaultRowHeightIsAuto && this.internalProps._heightResizedRowMap.size === 0 ) { + /** 底部冻结开始行 */ + const bottomFrozenStartRow = this.rowCount - this.bottomFrozenRowCount; // part in header for (let i = startRow; i < Math.min(endRow + 1, this.columnHeaderLevelCount); i++) { h += this.getRowHeight(i); @@ -1438,14 +1440,30 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { if (endRow >= this.columnHeaderLevelCount) { h += this.defaultRowHeight * - (Math.min(endRow, this.rowCount - this.bottomFrozenRowCount - 1) - - Math.max(this.columnHeaderLevelCount, startRow) + - 1); + (Math.min(endRow, bottomFrozenStartRow - 1) - Math.max(this.columnHeaderLevelCount, startRow) + 1); } + /** 当前底部冻结的行高 */ + let currentBottomFrozenRowsHeight = 0; // part in bottom frozen // last axis row height is default header row height in pivot chart - for (let i = this.rowCount - this.bottomFrozenRowCount; i < endRow + 1; i++) { - h += this.getRowHeight(i); + for (let i = bottomFrozenStartRow; i < endRow + 1; i++) { + currentBottomFrozenRowsHeight += this.getRowHeight(i); + } + h += currentBottomFrozenRowsHeight; + if ( + !!this.containerFit?.height && + this.bottomFrozenRowCount > 0 && + h < this.tableNoFrameHeight && + endRow >= bottomFrozenStartRow + ) { + // 配置了冻结行固定在底部+存在冻结行+当前总行高小于表格高度+传入的结尾行在底部冻结行以上 + const tableHeight = this.tableNoFrameHeight; + if (endRow === this.rowCount - 1) { + // 当前行是最后一行 + h = tableHeight; + } else { + h = tableHeight - this.getBottomFrozenRowsHeight() + currentBottomFrozenRowsHeight; + } } } else { if (this.options.customConfig?._disableColumnAndRowSizeRound) { @@ -2715,7 +2733,9 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { // const lineWidths = toBoxArray(this.internalProps.theme.frameStyle?.borderLineWidth ?? [null]); // const shadowWidths = toBoxArray(this.internalProps.theme.frameStyle?.shadowBlur ?? [0]); const width = Math.min(this.tableNoFrameWidth, this.getAllColsWidth()); - const height = Math.min(this.tableNoFrameHeight, this.getAllRowsHeight()); + const height = this.containerFit?.height + ? this.tableNoFrameHeight + : Math.min(this.tableNoFrameHeight, this.getAllRowsHeight()); // Math.max(lineWidths[3] ?? 0, shadowWidths[3] ?? 0), // Math.max(lineWidths[1] ?? 0, shadowWidths[1] ?? 0), return new Rect(this.tableX, this.tableY, width, height); diff --git a/packages/vtable/src/layout/row-height-map.ts b/packages/vtable/src/layout/row-height-map.ts index eee1199d2b..7cc08c9db8 100644 --- a/packages/vtable/src/layout/row-height-map.ts +++ b/packages/vtable/src/layout/row-height-map.ts @@ -150,18 +150,38 @@ export class NumberRangeMap { getCumulativeSum(position: number) { let sum = 0; + /** 当前底部冻结的行高 */ + let currentBottomFrozenRowsHeight = 0; + /** 底部冻结行是否没有缓存 */ + let isBottomFrozenRowNoCache = false; + /** 底部冻结开始行 */ + const bottomFrozenStartRow = + this.table.rowCount > 0 && this.table.bottomFrozenRowCount > 0 + ? this.table.rowCount - this.table.bottomFrozenRowCount + : -1; for (let i = position; i >= 0; i--) { if (this.cumulativeSum.has(i)) { sum += this.cumulativeSum.get(i); break; } else { sum += this.data.get(i) ?? this.table.getRowHeight(i); + if (i >= bottomFrozenStartRow && bottomFrozenStartRow !== -1) { + currentBottomFrozenRowsHeight = sum; + isBottomFrozenRowNoCache = i === bottomFrozenStartRow; + } } // if (i === position && this.cumulativeSum.has(i + 1)) { // sum += this.cumulativeSum.get(i + 1) - (this.data.get(i + 1) ?? this.table.getRowHeight(i + 1)); // break; // } } + if (isBottomFrozenRowNoCache && !!this.table.containerFit?.height && !!this.table.bottomFrozenRowCount) { + // 当底部冻结行没有进入缓存且配置了底部冻结行显示在最底部时,此时分情况判断 + const tableHeight = this.table.tableNoFrameHeight || 0; + if (sum < tableHeight) { + sum = tableHeight - this.table.getBottomFrozenRowsHeight() + currentBottomFrozenRowsHeight; + } + } this.cumulativeSum.set(position, sum); return sum; } diff --git a/packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts b/packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts index 6f34f65a1d..9716ddb6af 100644 --- a/packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts +++ b/packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts @@ -1082,20 +1082,28 @@ function getCellSizeForDraw(group: any, width: number, height: number, bottomRig col = mergeInfo.end.col; row = mergeInfo.end.row; } - - if (col === table.colCount - 1 && !bottomRight) { - width -= 1; - } else if (col === table.frozenColCount - 1 && table.scrollLeft && !bottomRight) { - width -= 1; - } else if (col === 0 && bottomRight) { - width -= 1; - } - if (row === table.rowCount - 1 && !bottomRight) { - height -= 1; - } else if (row === table.frozenRowCount - 1 && table.scrollTop && !bottomRight) { - height -= 1; - } else if (row === 0 && bottomRight) { - height -= 1; + if (!bottomRight) { + // 边框剪切方向是左上 + if (col === table.colCount - 1 || (col === table.frozenColCount - 1 && table.scrollLeft)) { + width -= 1; + } + if ( + row === table.rowCount - 1 || + (row === table.frozenRowCount - 1 && table.scrollTop) || + (!!table.containerFit?.height && + !!table.bottomFrozenRowCount && + row === table.rowCount - table.bottomFrozenRowCount - 1) + ) { + height -= 1; + } + } else { + // 边框剪切方向是右下 + if (col === 0) { + width -= 1; + } + if (row === 0) { + height -= 1; + } } } else if (group.role === 'corner-frozen') { if (table.scrollLeft && !bottomRight) { From 3c474607b712c29d8320d807dbf53add8e947ffa Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Wed, 18 Jun 2025 11:51:25 +0800 Subject: [PATCH 05/22] fix: copy not work when after copy tooltip text #3968 --- packages/vtable/examples/index.html | 4 +++- packages/vtable/src/event/listener/table-group.ts | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/vtable/examples/index.html b/packages/vtable/examples/index.html index 69f6ad7a75..ea8509c66d 100644 --- a/packages/vtable/examples/index.html +++ b/packages/vtable/examples/index.html @@ -20,7 +20,9 @@
-
+
+

test test test

+
diff --git a/packages/vtable/src/event/listener/table-group.ts b/packages/vtable/src/event/listener/table-group.ts index 8abf037a60..f28ba7eb55 100644 --- a/packages/vtable/src/event/listener/table-group.ts +++ b/packages/vtable/src/event/listener/table-group.ts @@ -395,6 +395,7 @@ export function bindTableGroupListener(eventManager: EventManager) { event: e.nativeEvent }); } + table.internalProps.focusControl.focus(); // table.eventManager.isPointerDownOnTable = true; // setTimeout(() => { // table.eventManager.isPointerDownOnTable = false; From 15f264a4cf0f5edbeaff974eb8313fee524896f0 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Wed, 18 Jun 2025 11:51:49 +0800 Subject: [PATCH 06/22] docs: update changlog of rush --- .../fix-copy-not-work-3968_2025-06-18-03-51.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vtable/fix-copy-not-work-3968_2025-06-18-03-51.json diff --git a/common/changes/@visactor/vtable/fix-copy-not-work-3968_2025-06-18-03-51.json b/common/changes/@visactor/vtable/fix-copy-not-work-3968_2025-06-18-03-51.json new file mode 100644 index 0000000000..c4429a6597 --- /dev/null +++ b/common/changes/@visactor/vtable/fix-copy-not-work-3968_2025-06-18-03-51.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: copy not work when after copy tooltip text #3968\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file From 66c6eb813129554f529e85498d4573ccb051f6a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=9D=A8=E6=9E=9A?= Date: Wed, 18 Jun 2025 14:23:54 +0800 Subject: [PATCH 07/22] fix(containerFit): the calculation of col widths and canvas draw range width --- packages/vtable/src/core/BaseTable.ts | 104 +++++++++++++++--- .../group-contribution-render.ts | 8 +- packages/vtable/src/ts-types/base-table.ts | 1 + 3 files changed, 94 insertions(+), 19 deletions(-) diff --git a/packages/vtable/src/core/BaseTable.ts b/packages/vtable/src/core/BaseTable.ts index 8d9915e5a5..96afd4a34e 100644 --- a/packages/vtable/src/core/BaseTable.ts +++ b/packages/vtable/src/core/BaseTable.ts @@ -1269,7 +1269,11 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { // use default column width if no width in colWidthsMap const adjustW = this.getColWidth(endCol); // } - const addWidth = cachedLowerColWidth + adjustW; + let addWidth = cachedLowerColWidth + adjustW; + if (this.rightFrozenColCount > 0 && endCol === this.colCount - this.rightFrozenColCount) { + // 当结束列大于右侧冻结起始列,说明带差值的列已经计入了缓存,不用计算,此处只需计算传入列正好在右侧起始冻结列的情况 + addWidth = this._getRangeSizeForContainerFit(startCol, endCol, addWidth, 'col'); + } // 合法地址存入缓存 if (startCol >= 0 && endCol >= 0 && !Number.isNaN(addWidth)) { this._colRangeWidthsMap.set(`$${startCol}$${endCol}`, Math.round(addWidth)); @@ -1281,6 +1285,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { for (let col = startCol; col <= endCol; col++) { w += this.getColWidth(col); } + w = this._getRangeSizeForContainerFit(startCol, endCol, w, 'col'); // this.colWidthsMap.each(startCol, endCol, (width, col) => { // // adaptive模式下,不受max min配置影响,直接使用width @@ -1449,22 +1454,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { for (let i = bottomFrozenStartRow; i < endRow + 1; i++) { currentBottomFrozenRowsHeight += this.getRowHeight(i); } - h += currentBottomFrozenRowsHeight; - if ( - !!this.containerFit?.height && - this.bottomFrozenRowCount > 0 && - h < this.tableNoFrameHeight && - endRow >= bottomFrozenStartRow - ) { - // 配置了冻结行固定在底部+存在冻结行+当前总行高小于表格高度+传入的结尾行在底部冻结行以上 - const tableHeight = this.tableNoFrameHeight; - if (endRow === this.rowCount - 1) { - // 当前行是最后一行 - h = tableHeight; - } else { - h = tableHeight - this.getBottomFrozenRowsHeight() + currentBottomFrozenRowsHeight; - } - } + h = this._getRangeSizeForContainerFit(startRow, endRow, h + currentBottomFrozenRowsHeight, 'row'); } else { if (this.options.customConfig?._disableColumnAndRowSizeRound) { // for (let i = startRow; i <= endRow; i++) { @@ -1495,6 +1485,82 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { // } return Math.round(h); } + /** + * @description: 获取 containerFit 模式下的指定范围的总列宽/行高 + * @param {number} start + * @param {number} end + * @param {number} totalSize 总列宽/行高 + * @return {*} + */ + _getRangeSizeForContainerFit(start: number, end: number, totalSize: number, type: 'col' | 'row' = 'col') { + if (!isFinite(start) || !isFinite(end)) { + return totalSize; + } + const keyMap: { + /** 目标范围总数量 */ + totalCount: 'colCount' | 'rowCount'; + /** 冻结数量 */ + frozenCount: 'rightFrozenColCount' | 'bottomFrozenRowCount'; + /** 自适应类型 */ + fitType: 'width' | 'height'; + /** 表格尺寸 */ + tableSize: 'tableNoFrameWidth' | 'tableNoFrameHeight'; + /** 获取单个行/列尺寸的方法 */ + getSize: 'getColWidth' | 'getRowHeight'; + } = + type === 'col' + ? { + totalCount: 'colCount', + frozenCount: 'rightFrozenColCount', + fitType: 'width', + tableSize: 'tableNoFrameWidth', + getSize: 'getColWidth' + } + : { + totalCount: 'rowCount', + frozenCount: 'bottomFrozenRowCount', + fitType: 'height', + tableSize: 'tableNoFrameHeight', + getSize: 'getRowHeight' + }; + /** 目标冻结开始位置 */ + const frozenStart = this[keyMap.totalCount] - this[keyMap.frozenCount]; + if (!isFinite(this[keyMap.totalCount]) || this[keyMap.frozenCount] <= 0 || frozenStart < 0) { + // 无效冻结区域跳过 + return totalSize; + } + const noIntersecting = start > frozenStart || end < frozenStart || start === end; + if (noIntersecting || !this.containerFit?.[keyMap.fitType]) { + // 传入范围不包含 body 和冻结区的交叉区域 或 当前未开启 containerFit,无需处理 + return totalSize; + } + const tableSize = this[keyMap.tableSize]; + const first = 0; + const last = this[keyMap.totalCount] - 1; + let size = tableSize; + // 使用表格尺寸减去边缘尺寸 + if (start > first) { + // 减去传入开始位置以前的尺寸 + for (let i = 0; i < start; i++) { + size -= this[keyMap.getSize](i); + if (size <= 0) { + // 已超出表格尺寸,返回原始尺寸 + return totalSize; + } + } + } + if (end !== last) { + // 减去传入结束位置之后的尺寸 + for (let i = end + 1; i <= last; i++) { + size -= this[keyMap.getSize](i); + if (size <= 0) { + // 已超出表格尺寸,返回原始尺寸 + return totalSize; + } + } + } + return size; + } /** * 根据列号获取列宽定义 * @param {number} col column number @@ -2732,7 +2798,9 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { //考虑表格整体边框的问题 // const lineWidths = toBoxArray(this.internalProps.theme.frameStyle?.borderLineWidth ?? [null]); // const shadowWidths = toBoxArray(this.internalProps.theme.frameStyle?.shadowBlur ?? [0]); - const width = Math.min(this.tableNoFrameWidth, this.getAllColsWidth()); + const width = this.containerFit?.width + ? this.tableNoFrameWidth + : Math.min(this.tableNoFrameWidth, this.getAllColsWidth()); const height = this.containerFit?.height ? this.tableNoFrameHeight : Math.min(this.tableNoFrameHeight, this.getAllRowsHeight()); diff --git a/packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts b/packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts index 9716ddb6af..e313877a25 100644 --- a/packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts +++ b/packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts @@ -1084,7 +1084,13 @@ function getCellSizeForDraw(group: any, width: number, height: number, bottomRig } if (!bottomRight) { // 边框剪切方向是左上 - if (col === table.colCount - 1 || (col === table.frozenColCount - 1 && table.scrollLeft)) { + if ( + col === table.colCount - 1 || + (col === table.frozenColCount - 1 && table.scrollLeft) || + (!!table.containerFit?.width && + !!table.rightFrozenColCount && + col === table.colCount - table.rightFrozenColCount - 1) + ) { width -= 1; } if ( diff --git a/packages/vtable/src/ts-types/base-table.ts b/packages/vtable/src/ts-types/base-table.ts index 45ea92dd6b..172f710706 100644 --- a/packages/vtable/src/ts-types/base-table.ts +++ b/packages/vtable/src/ts-types/base-table.ts @@ -790,6 +790,7 @@ export interface BaseTableAPI { getColsWidth: (startCol: number, endCol: number) => number; getColsWidths: () => number[]; getRowsHeight: (startRow: number, endRow: number) => number; + _getRangeSizeForContainerFit: (start: number, end: number, totalSize: number, type: 'col' | 'row') => number; release: () => void; addReleaseObj: (releaseObj: { release: () => void }) => void; From 41b3f8d19542aeba30f3fdfbf1a5b2cb68f9b9cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=9D=A8=E6=9E=9A?= Date: Wed, 18 Jun 2025 14:30:46 +0800 Subject: [PATCH 08/22] fix: display configuration after cell icon loading failure --- packages/vtable/src/scenegraph/graphic/icon.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/vtable/src/scenegraph/graphic/icon.ts b/packages/vtable/src/scenegraph/graphic/icon.ts index 2f38da3235..214fe94f14 100644 --- a/packages/vtable/src/scenegraph/graphic/icon.ts +++ b/packages/vtable/src/scenegraph/graphic/icon.ts @@ -3,6 +3,7 @@ import { Image, ResourceLoader, Text } from '@src/vrender'; import type { IIconBase } from '../../ts-types'; import type { ParsedFrame } from 'gifuct-js'; import { decompressFrames, parseGIF } from 'gifuct-js'; +import * as icons from '../../icons'; export interface IIconGraphicAttribute extends IImageGraphicAttribute { backgroundWidth?: number; @@ -199,6 +200,15 @@ export class Icon extends Image { this.loadGif(); } } + + failCallback() { + const registeredIcons = icons.get(); + const { svg, src } = (registeredIcons.damage_pic as any) || {}; + const image = svg || src; + if (image) { + super.image = image; + } + } } export class TextIcon extends Text { From 0a9e9d9a80c5b0fcbb162663c18ac7c55d4690ff Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Wed, 18 Jun 2025 15:09:00 +0800 Subject: [PATCH 09/22] chore: update vrender 1.0.4 fix animation bug --- common/config/rush/pnpm-lock.yaml | 97 ++++++++++++++------------- packages/vtable/package.json | 10 +-- packages/vtable/src/core/animation.ts | 2 +- 3 files changed, 57 insertions(+), 52 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index be838aca51..2c416d4ac6 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -297,10 +297,10 @@ importers: '@types/react-dom': ^18.0.0 '@visactor/vchart': 2.0.0-alpha.1 '@visactor/vdataset': ~0.18.1 - '@visactor/vrender-animate': 1.0.3 - '@visactor/vrender-components': 1.0.3 - '@visactor/vrender-core': 1.0.3 - '@visactor/vrender-kits': 1.0.3 + '@visactor/vrender-animate': 1.0.4 + '@visactor/vrender-components': 1.0.4 + '@visactor/vrender-core': 1.0.4 + '@visactor/vrender-kits': 1.0.4 '@visactor/vscale': ~0.18.1 '@visactor/vtable-editors': workspace:* '@visactor/vutils': ~0.19.1 @@ -345,10 +345,10 @@ importers: vite-plugin-markdown: ^2.1.0 dependencies: '@visactor/vdataset': 0.18.18 - '@visactor/vrender-animate': 1.0.3 - '@visactor/vrender-components': 1.0.3 - '@visactor/vrender-core': 1.0.3 - '@visactor/vrender-kits': 1.0.3 + '@visactor/vrender-animate': 1.0.4 + '@visactor/vrender-components': 1.0.4 + '@visactor/vrender-core': 1.0.4 + '@visactor/vrender-kits': 1.0.4 '@visactor/vscale': 0.18.18 '@visactor/vtable-editors': link:../vtable-editors '@visactor/vutils': 0.19.6 @@ -3343,7 +3343,7 @@ packages: dependencies: '@babel/core': 7.20.12 '@babel/helper-module-imports': 7.27.1 - '@rollup/pluginutils': 5.1.4_rollup@3.20.5 + '@rollup/pluginutils': 5.2.0_rollup@3.20.5 '@types/babel__core': 7.20.0 rollup: 3.20.5 transitivePeerDependencies: @@ -3359,7 +3359,7 @@ packages: rollup: optional: true dependencies: - '@rollup/pluginutils': 5.1.4_rollup@3.20.5 + '@rollup/pluginutils': 5.2.0_rollup@3.20.5 commondir: 1.0.1 estree-walker: 2.0.2 glob: 8.1.0 @@ -3386,7 +3386,7 @@ packages: rollup: optional: true dependencies: - '@rollup/pluginutils': 5.1.4_rollup@3.20.5 + '@rollup/pluginutils': 5.2.0_rollup@3.20.5 '@types/resolve': 1.20.2 deepmerge: 4.3.1 is-builtin-module: 3.2.1 @@ -3404,7 +3404,7 @@ packages: rollup: optional: true dependencies: - '@rollup/pluginutils': 5.1.4_rollup@3.20.5 + '@rollup/pluginutils': 5.2.0_rollup@3.20.5 magic-string: 0.27.0 rollup: 3.20.5 dev: false @@ -3418,7 +3418,7 @@ packages: rollup: optional: true dependencies: - '@rollup/pluginutils': 5.1.4_rollup@3.20.5 + '@rollup/pluginutils': 5.2.0_rollup@3.20.5 estree-walker: 2.0.2 magic-string: 0.27.0 rollup: 3.20.5 @@ -3452,7 +3452,7 @@ packages: tslib: optional: true dependencies: - '@rollup/pluginutils': 5.1.4_rollup@3.20.5 + '@rollup/pluginutils': 5.2.0_rollup@3.20.5 resolve: 1.22.10 rollup: 3.20.5 typescript: 4.9.5 @@ -3467,7 +3467,7 @@ packages: rollup: optional: true dependencies: - '@rollup/pluginutils': 5.1.4_rollup@3.20.5 + '@rollup/pluginutils': 5.2.0_rollup@3.20.5 make-dir: 3.1.0 mime: 3.0.0 rollup: 3.20.5 @@ -3493,8 +3493,8 @@ packages: picomatch: 2.3.1 dev: false - /@rollup/pluginutils/5.1.4_rollup@3.20.5: - resolution: {integrity: sha512-USm05zrsFxYLPdWWq+K3STlWiT/3ELn3RcV5hJMghpeAIhxfsUIg6mt12CBJBInWMV4VneoV7SfGv8xIwo2qNQ==} + /@rollup/pluginutils/5.2.0_rollup@3.20.5: + resolution: {integrity: sha512-qWJ2ZTbmumwiLFomfzTyt5Kng4hwPi9rwCYN4SHb6eaRU1KNO4ccxINHr/VhH4GgPlt1XfSTLX2LBTme8ne4Zw==} engines: {node: '>=14.0.0'} peerDependencies: rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 @@ -4182,10 +4182,10 @@ packages: '@visactor/vrender-core': 1.0.0-alpha.17 '@visactor/vutils': 1.0.4 - /@visactor/vrender-animate/1.0.3: - resolution: {integrity: sha512-F6E4ngeFfP//MRd2P8uitDsO9q669bFiNnIbbS06+vjca893kfg2S4HHd6X0DaS9Efz66FINNxqUoDXRzl1gYA==} + /@visactor/vrender-animate/1.0.4: + resolution: {integrity: sha512-UVZ7rO1CVTM7GT1ZZvTd0ZnMqK1zTXO7k73c2AYTWpIJfjHS26OLfEtc7WUNUv1YoLt2wkGB1LIftPhVvAxhyA==} dependencies: - '@visactor/vrender-core': 1.0.3 + '@visactor/vrender-core': 1.0.4 '@visactor/vutils': 1.0.6 dev: false @@ -4198,12 +4198,12 @@ packages: '@visactor/vscale': 1.0.4 '@visactor/vutils': 1.0.4 - /@visactor/vrender-components/1.0.3: - resolution: {integrity: sha512-reQgGRW5/LMm2ArM1m8hM1jg+eDOU5dS/bg/uT3rqayl2ylfa/WHJwemileL6rQKLM+uFyH50RpGXVDV8PQv8w==} + /@visactor/vrender-components/1.0.4: + resolution: {integrity: sha512-MAlJp/hnD26JRfPC12tel4X3h0mxD8HsgyGGgCGNdRnfe3K2DELFg6CN0TzugktzyjxoL+pRUTtYcsJRCG46iA==} dependencies: - '@visactor/vrender-animate': 1.0.3 - '@visactor/vrender-core': 1.0.3 - '@visactor/vrender-kits': 1.0.3 + '@visactor/vrender-animate': 1.0.4 + '@visactor/vrender-core': 1.0.4 + '@visactor/vrender-kits': 1.0.4 '@visactor/vscale': 1.0.6 '@visactor/vutils': 1.0.6 dev: false @@ -4214,8 +4214,8 @@ packages: '@visactor/vutils': 1.0.4 color-convert: 2.0.1 - /@visactor/vrender-core/1.0.3: - resolution: {integrity: sha512-g+aPhX7WK/4FrDiAAX8hZRfoHtG2JmB2/73AaU8SMuWMYBFMPwTSBXQD5oI4vqeZ3/4p0yoSjXXaAL6t0d5ZTw==} + /@visactor/vrender-core/1.0.4: + resolution: {integrity: sha512-ghGaVbNvcUY0L/aKNmts0JXTIRdSHZkieyzgeED9Qv25jA08AibHOHrO0VptgAmRkJDSEpXVu+clsXRl+bYytA==} dependencies: '@visactor/vutils': 1.0.6 color-convert: 2.0.1 @@ -4231,11 +4231,11 @@ packages: lottie-web: 5.13.0 roughjs: 4.5.2 - /@visactor/vrender-kits/1.0.3: - resolution: {integrity: sha512-RKO6zsYMU8ZhFgNa97lmwJEsm34MgV9CZLmDmMZ1Af9FkhwDYYaoMvZLHP47mjgQMGm4dnGUBfhPaZEqk31Dvw==} + /@visactor/vrender-kits/1.0.4: + resolution: {integrity: sha512-tOwcFDkMb/Ys2VwwXcyOlrv4V2xH0GN8Itnj42z0Da8g3uSv2plB9Y2/1DZv1dEKfGwn4HUvp1wbfhr4zyj9tg==} dependencies: '@resvg/resvg-js': 2.4.1 - '@visactor/vrender-core': 1.0.3 + '@visactor/vrender-core': 1.0.4 '@visactor/vutils': 1.0.6 gifuct-js: 2.1.2 lottie-web: 5.13.0 @@ -4400,7 +4400,7 @@ packages: '@vue/shared': 3.5.16 estree-walker: 2.0.2 magic-string: 0.30.17 - postcss: 8.5.5 + postcss: 8.5.6 source-map-js: 1.2.1 /@vue/compiler-ssr/3.5.16: @@ -4914,7 +4914,7 @@ packages: resolution: {integrity: sha512-uYkTP8dw2og1tu1nmza1n1CMW0qb8gWWlwqMmLb7MhBVs4BXrFziT6HXUd+/RlRA/i4H9AkofYloUbs1fwMqlw==} engines: {node: '>= 0.10'} dependencies: - end-of-stream: 1.4.4 + end-of-stream: 1.4.5 once: 1.4.0 process-nextick-args: 2.0.1 stream-exhaust: 1.0.2 @@ -5323,7 +5323,7 @@ packages: hasBin: true dependencies: caniuse-lite: 1.0.30001723 - electron-to-chromium: 1.5.167 + electron-to-chromium: 1.5.169 node-releases: 2.0.19 update-browserslist-db: 1.1.3_browserslist@4.25.0 @@ -6529,7 +6529,7 @@ packages: /duplexify/3.7.1: resolution: {integrity: sha512-07z8uv2wMyS51kKhD1KsdXJg5WQ6t93RneqRxUHnskXVtlYYkLqM0gqStQZ3pj073g687jPCHrqNfCzawLYh5g==} dependencies: - end-of-stream: 1.4.4 + end-of-stream: 1.4.5 inherits: 2.0.4 readable-stream: 2.3.8 stream-shift: 1.0.3 @@ -6538,7 +6538,7 @@ packages: /duplexify/4.1.3: resolution: {integrity: sha512-M3BmBhwJRZsSx38lZyhE53Csddgzl5R7xGJNk7CVddZD6CcmwMCH8J+7AprIrQKH7TonKxaCjcv27Qmf+sQ+oA==} dependencies: - end-of-stream: 1.4.4 + end-of-stream: 1.4.5 inherits: 2.0.4 readable-stream: 3.6.2 stream-shift: 1.0.3 @@ -6562,8 +6562,8 @@ packages: safer-buffer: 2.1.2 dev: true - /electron-to-chromium/1.5.167: - resolution: {integrity: sha512-LxcRvnYO5ez2bMOFpbuuVuAI5QNeY1ncVytE/KXaL6ZNfzX1yPlAO0nSOyIHx2fVAuUprMqPs/TdVhUFZy7SIQ==} + /electron-to-chromium/1.5.169: + resolution: {integrity: sha512-q7SQx6mkLy0GTJK9K9OiWeaBMV4XQtBSdf6MJUzDB/H/5tFXfIiX38Lci1Kl6SsgiEhz1SQI1ejEOU5asWEhwQ==} /electron/11.5.0: resolution: {integrity: sha512-WjNDd6lGpxyiNjE3LhnFCAk/D9GIj1rU3GSDealVShhkkkPR3Vh4q8ErXGDl1OAO/faomVa10KoFPUN/pLbNxg==} @@ -6601,8 +6601,8 @@ packages: dev: true optional: true - /end-of-stream/1.4.4: - resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==} + /end-of-stream/1.4.5: + resolution: {integrity: sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==} dependencies: once: 1.4.0 @@ -11882,8 +11882,8 @@ packages: picocolors: 1.1.1 source-map-js: 1.2.1 - /postcss/8.5.5: - resolution: {integrity: sha512-d/jtm+rdNT8tpXuHY5MMtcbJFBkhXE6593XVR9UoGCH8jSFGci7jGvMGH5RYd5PBJW+00NZQt6gf7CbagJCrhg==} + /postcss/8.5.6: + resolution: {integrity: sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==} engines: {node: ^10 || ^12 || >=14} dependencies: nanoid: 3.3.11 @@ -12003,14 +12003,14 @@ packages: /pump/2.0.1: resolution: {integrity: sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==} dependencies: - end-of-stream: 1.4.4 + end-of-stream: 1.4.5 once: 1.4.0 dev: false /pump/3.0.3: resolution: {integrity: sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==} dependencies: - end-of-stream: 1.4.4 + end-of-stream: 1.4.5 once: 1.4.0 dev: true @@ -13517,7 +13517,7 @@ packages: engines: {node: '>=6'} dependencies: bl: 4.1.0 - end-of-stream: 1.4.4 + end-of-stream: 1.4.5 fs-constants: 1.0.0 inherits: 2.0.4 readable-stream: 3.6.2 @@ -13779,7 +13779,7 @@ packages: mkdirp: 1.0.4 semver: 7.3.4 typescript: 4.9.5 - yargs-parser: 20.2.4 + yargs-parser: 20.2.9 dev: true /ts-loader/9.2.6_typescript@4.9.5: @@ -14934,6 +14934,11 @@ packages: engines: {node: '>=10'} dev: true + /yargs-parser/20.2.9: + resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==} + engines: {node: '>=10'} + dev: true + /yargs-parser/21.1.1: resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} engines: {node: '>=12'} @@ -14997,7 +15002,7 @@ packages: require-directory: 2.1.1 string-width: 4.2.3 y18n: 5.0.8 - yargs-parser: 20.2.4 + yargs-parser: 20.2.9 dev: true /yargs/17.7.2: diff --git a/packages/vtable/package.json b/packages/vtable/package.json index c4806eb2a6..c3f8c9a20d 100644 --- a/packages/vtable/package.json +++ b/packages/vtable/package.json @@ -52,10 +52,10 @@ }, "dependencies": { "@visactor/vtable-editors": "workspace:*", - "@visactor/vrender-core": "1.0.3", - "@visactor/vrender-kits": "1.0.3", - "@visactor/vrender-components": "1.0.3", - "@visactor/vrender-animate": "1.0.3", + "@visactor/vrender-core": "1.0.4", + "@visactor/vrender-kits": "1.0.4", + "@visactor/vrender-components": "1.0.4", + "@visactor/vrender-animate": "1.0.4", "@visactor/vutils": "~0.19.1", "@visactor/vscale": "~0.18.1", "@visactor/vdataset": "~0.18.1", @@ -130,4 +130,4 @@ "url": "https://github.com/VisActor/VTable.git", "directory": "packages/vtable" } -} +} \ No newline at end of file diff --git a/packages/vtable/src/core/animation.ts b/packages/vtable/src/core/animation.ts index 31d6621643..7687b816ce 100644 --- a/packages/vtable/src/core/animation.ts +++ b/packages/vtable/src/core/animation.ts @@ -30,7 +30,7 @@ export class TableAnimationManager { this.table = table; this.timeline = new DefaultTimeline(); // this.ticker = new DefaultTicker([this.timeline]); - this.ticker = new DefaultTicker(); + this.ticker = new DefaultTicker(this.table.scenegraph.stage); this.ticker.addTimeline(this.timeline); const TICKER_FPS = 60; this.ticker.setFPS(TICKER_FPS); From 315854663f8aa8262ada7d46b86c03489484006a Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Wed, 18 Jun 2025 15:12:15 +0800 Subject: [PATCH 10/22] docs: update changlog of rush --- .../vtable/fix-animation-error_2025-06-18-07-12.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vtable/fix-animation-error_2025-06-18-07-12.json diff --git a/common/changes/@visactor/vtable/fix-animation-error_2025-06-18-07-12.json b/common/changes/@visactor/vtable/fix-animation-error_2025-06-18-07-12.json new file mode 100644 index 0000000000..90a570a2a4 --- /dev/null +++ b/common/changes/@visactor/vtable/fix-animation-error_2025-06-18-07-12.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "chore: update vrender 1.0.4 fix animation bug\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file From f8947a8c804c208f3a5f3e1799d4b7a057517b36 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Wed, 18 Jun 2025 15:37:27 +0800 Subject: [PATCH 11/22] fix: copy not work when after copy tooltip text #3968 --- .../vtable/src/event/listener/table-group.ts | 3 +- packages/vtable/src/tools/env.ts | 34 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/packages/vtable/src/event/listener/table-group.ts b/packages/vtable/src/event/listener/table-group.ts index f28ba7eb55..5cfecce13d 100644 --- a/packages/vtable/src/event/listener/table-group.ts +++ b/packages/vtable/src/event/listener/table-group.ts @@ -23,6 +23,7 @@ import { getCellMergeInfo } from '../../scenegraph/utils/get-cell-merge'; import type { CheckBox, CheckboxAttributes, Radio } from '@src/vrender'; import { handleWhell } from '../scroll'; import { fireMoveColEventListeners } from '../helper'; +import { clearPageSelection } from '../../tools/env'; export function bindTableGroupListener(eventManager: EventManager) { const table = eventManager.table; const stateManager = table.stateManager; @@ -395,7 +396,7 @@ export function bindTableGroupListener(eventManager: EventManager) { event: e.nativeEvent }); } - table.internalProps.focusControl.focus(); + clearPageSelection(); // table.eventManager.isPointerDownOnTable = true; // setTimeout(() => { // table.eventManager.isPointerDownOnTable = false; diff --git a/packages/vtable/src/tools/env.ts b/packages/vtable/src/tools/env.ts index aa2008db5e..76c2405d16 100644 --- a/packages/vtable/src/tools/env.ts +++ b/packages/vtable/src/tools/env.ts @@ -84,3 +84,37 @@ function defaultMode(): EnvMode { } return mode; } +/** + * 清空页面上的所有文本选择,使用多种兼容性方法 + */ +export function clearPageSelection(): void { + try { + const selection = window.getSelection(); + if (selection) { + // 方法1: removeAllRanges() - 标准方法,最广泛支持 + if (typeof selection.removeAllRanges === 'function') { + selection.removeAllRanges(); + console.log('使用 removeAllRanges() 清空selection'); + return; + } + + // 方法2: empty() - IE 和一些旧浏览器 + if (typeof (selection as any).empty === 'function') { + (selection as any).empty(); + console.log('使用 empty() 清空selection'); + return; + } + + // 方法3: collapse() - 备用方法 + if (typeof selection.collapse === 'function') { + selection.collapse(document.body, 0); + console.log('使用 collapse() 清空selection'); + return; + } + + console.warn('无法清空selection:不支持的浏览器'); + } + } catch (error) { + console.warn('清空selection时出错:', error); + } +} From 123341f4f526d271cd487911a4a043e703d8b212 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Wed, 18 Jun 2025 18:32:17 +0800 Subject: [PATCH 12/22] chore: update vrender verison to fix animation bug --- .vscode/launch.json | 52 +++++++++++-------- common/config/rush/pnpm-lock.yaml | 84 +++++++++---------------------- packages/vtable/package.json | 8 +-- 3 files changed, 58 insertions(+), 86 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 7b0c3d36e0..d68f92af0a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,23 +1,31 @@ { - "version": "0.1.0", - "configurations": [ - { - "name": "generate documents", - "port": 9229, - "program": "${workspaceFolder}/docs/libs/template-parse/build.js", - "args": ["--env", "dev", "--watch"], - "request": "launch", - "skipFiles": ["/**"], - "type": "pwa-node" - }, - { - "name": "unit test", - "type": "pwa-node", - "request": "launch", - "program": "${workspaceFolder}/node_modules/.bin/jest", - "args": ["${file}"], - "console": "integratedTerminal", - "internalConsoleOptions": "neverOpen" - } - ] -} + "version": "0.1.0", + "configurations": [ + { + "name": "generate documents", + "port": 9229, + "program": "${workspaceFolder}/docs/libs/template-parse/build.js", + "args": [ + "--env", + "dev", + "--watch" + ], + "request": "launch", + "skipFiles": [ + "/**" + ], + "type": "pwa-node" + }, + { + "name": "unit test", + "type": "pwa-node", + "request": "launch", + "program": "${workspaceFolder}/node_modules/.bin/jest", + "args": [ + "${file}" + ], + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + } + ] +} \ No newline at end of file diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 2c416d4ac6..b355e8718f 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -297,10 +297,10 @@ importers: '@types/react-dom': ^18.0.0 '@visactor/vchart': 2.0.0-alpha.1 '@visactor/vdataset': ~0.18.1 - '@visactor/vrender-animate': 1.0.4 - '@visactor/vrender-components': 1.0.4 - '@visactor/vrender-core': 1.0.4 - '@visactor/vrender-kits': 1.0.4 + '@visactor/vrender-animate': 1.0.5 + '@visactor/vrender-components': 1.0.5 + '@visactor/vrender-core': 1.0.5 + '@visactor/vrender-kits': 1.0.5 '@visactor/vscale': ~0.18.1 '@visactor/vtable-editors': workspace:* '@visactor/vutils': ~0.19.1 @@ -345,10 +345,10 @@ importers: vite-plugin-markdown: ^2.1.0 dependencies: '@visactor/vdataset': 0.18.18 - '@visactor/vrender-animate': 1.0.4 - '@visactor/vrender-components': 1.0.4 - '@visactor/vrender-core': 1.0.4 - '@visactor/vrender-kits': 1.0.4 + '@visactor/vrender-animate': 1.0.5 + '@visactor/vrender-components': 1.0.5 + '@visactor/vrender-core': 1.0.5 + '@visactor/vrender-kits': 1.0.5 '@visactor/vscale': 0.18.18 '@visactor/vtable-editors': link:../vtable-editors '@visactor/vutils': 0.19.6 @@ -2779,7 +2779,7 @@ packages: jest-resolve: 26.6.2 jest-resolve-dependencies: 26.6.3 jest-runner: 26.6.3_ts-node@10.9.0 - jest-runtime: 26.6.3 + jest-runtime: 26.6.3_ts-node@10.9.0 jest-snapshot: 26.6.2 jest-util: 26.6.2 jest-validate: 26.6.2 @@ -2940,7 +2940,7 @@ packages: graceful-fs: 4.2.11 jest-haste-map: 26.6.2 jest-runner: 26.6.3_ts-node@10.9.0 - jest-runtime: 26.6.3 + jest-runtime: 26.6.3_ts-node@10.9.0 transitivePeerDependencies: - bufferutil - canvas @@ -4182,10 +4182,10 @@ packages: '@visactor/vrender-core': 1.0.0-alpha.17 '@visactor/vutils': 1.0.4 - /@visactor/vrender-animate/1.0.4: - resolution: {integrity: sha512-UVZ7rO1CVTM7GT1ZZvTd0ZnMqK1zTXO7k73c2AYTWpIJfjHS26OLfEtc7WUNUv1YoLt2wkGB1LIftPhVvAxhyA==} + /@visactor/vrender-animate/1.0.5: + resolution: {integrity: sha512-EVK4eTeiZg+WqfDe+QDnQlRLYD9C3viN1FZ+SzCRB5oYs8+su9zezRC/xV/kvnx5kCBPlfwnJEI70bIsXuRMtw==} dependencies: - '@visactor/vrender-core': 1.0.4 + '@visactor/vrender-core': 1.0.5 '@visactor/vutils': 1.0.6 dev: false @@ -4198,12 +4198,12 @@ packages: '@visactor/vscale': 1.0.4 '@visactor/vutils': 1.0.4 - /@visactor/vrender-components/1.0.4: - resolution: {integrity: sha512-MAlJp/hnD26JRfPC12tel4X3h0mxD8HsgyGGgCGNdRnfe3K2DELFg6CN0TzugktzyjxoL+pRUTtYcsJRCG46iA==} + /@visactor/vrender-components/1.0.5: + resolution: {integrity: sha512-A0WQZZlD9DHLgKnJ/mVJEx5xomIWQEjkVFngrR7tZ0lCQ2Utqk4Mqny9Ad5xZ4lxf8521aseNk1N3R+OUhj8wQ==} dependencies: - '@visactor/vrender-animate': 1.0.4 - '@visactor/vrender-core': 1.0.4 - '@visactor/vrender-kits': 1.0.4 + '@visactor/vrender-animate': 1.0.5 + '@visactor/vrender-core': 1.0.5 + '@visactor/vrender-kits': 1.0.5 '@visactor/vscale': 1.0.6 '@visactor/vutils': 1.0.6 dev: false @@ -4214,8 +4214,8 @@ packages: '@visactor/vutils': 1.0.4 color-convert: 2.0.1 - /@visactor/vrender-core/1.0.4: - resolution: {integrity: sha512-ghGaVbNvcUY0L/aKNmts0JXTIRdSHZkieyzgeED9Qv25jA08AibHOHrO0VptgAmRkJDSEpXVu+clsXRl+bYytA==} + /@visactor/vrender-core/1.0.5: + resolution: {integrity: sha512-8vKzA+WkON6ndjlCAX4CQX/jB2JGUehT/jWXrDFUPZ1QrJ/X3Rd99ADsL1UbMCcxPDJFsp7m4gQg3uNeza2mKA==} dependencies: '@visactor/vutils': 1.0.6 color-convert: 2.0.1 @@ -4231,11 +4231,11 @@ packages: lottie-web: 5.13.0 roughjs: 4.5.2 - /@visactor/vrender-kits/1.0.4: - resolution: {integrity: sha512-tOwcFDkMb/Ys2VwwXcyOlrv4V2xH0GN8Itnj42z0Da8g3uSv2plB9Y2/1DZv1dEKfGwn4HUvp1wbfhr4zyj9tg==} + /@visactor/vrender-kits/1.0.5: + resolution: {integrity: sha512-mTsEnYRgIgsJ/KFul6lhRjwpEPVjrVpefr0kUC/qIzvKp8I+ay18HZdCKcWsmQavouYfUnIoODiez3bZhuNp6A==} dependencies: '@resvg/resvg-js': 2.4.1 - '@visactor/vrender-core': 1.0.4 + '@visactor/vrender-core': 1.0.5 '@visactor/vutils': 1.0.6 gifuct-js: 2.1.2 lottie-web: 5.13.0 @@ -9571,7 +9571,7 @@ packages: jest-leak-detector: 26.6.2 jest-message-util: 26.6.2 jest-resolve: 26.6.2 - jest-runtime: 26.6.3 + jest-runtime: 26.6.3_ts-node@10.9.0 jest-util: 26.6.2 jest-worker: 26.6.2 source-map-support: 0.5.21 @@ -9616,42 +9616,6 @@ packages: - supports-color dev: true - /jest-runtime/26.6.3: - resolution: {integrity: sha512-lrzyR3N8sacTAMeonbqpnSka1dHNux2uk0qqDXVkMv2c/A3wYnvQ4EXuI013Y6+gSKSCxdaczvf4HF0mVXHRdw==} - engines: {node: '>= 10.14.2'} - hasBin: true - dependencies: - '@jest/console': 26.6.2 - '@jest/environment': 26.6.2 - '@jest/fake-timers': 26.6.2 - '@jest/globals': 26.6.2 - '@jest/source-map': 26.6.2 - '@jest/test-result': 26.6.2 - '@jest/transform': 26.6.2 - '@jest/types': 26.6.2 - '@types/yargs': 15.0.19 - chalk: 4.1.2 - cjs-module-lexer: 0.6.0 - collect-v8-coverage: 1.0.2 - exit: 0.1.2 - glob: 7.2.3 - graceful-fs: 4.2.11 - jest-config: 26.6.3_ts-node@10.9.0 - jest-haste-map: 26.6.2 - jest-message-util: 26.6.2 - jest-mock: 26.6.2 - jest-regex-util: 26.0.0 - jest-resolve: 26.6.2 - jest-snapshot: 26.6.2 - jest-util: 26.6.2 - jest-validate: 26.6.2 - slash: 3.0.0 - strip-bom: 4.0.0 - yargs: 15.4.1 - transitivePeerDependencies: - - supports-color - dev: true - /jest-runtime/26.6.3_ts-node@10.9.0: resolution: {integrity: sha512-lrzyR3N8sacTAMeonbqpnSka1dHNux2uk0qqDXVkMv2c/A3wYnvQ4EXuI013Y6+gSKSCxdaczvf4HF0mVXHRdw==} engines: {node: '>= 10.14.2'} diff --git a/packages/vtable/package.json b/packages/vtable/package.json index c3f8c9a20d..d83b86f1d7 100644 --- a/packages/vtable/package.json +++ b/packages/vtable/package.json @@ -52,10 +52,10 @@ }, "dependencies": { "@visactor/vtable-editors": "workspace:*", - "@visactor/vrender-core": "1.0.4", - "@visactor/vrender-kits": "1.0.4", - "@visactor/vrender-components": "1.0.4", - "@visactor/vrender-animate": "1.0.4", + "@visactor/vrender-core": "1.0.5", + "@visactor/vrender-kits": "1.0.5", + "@visactor/vrender-components": "1.0.5", + "@visactor/vrender-animate": "1.0.5", "@visactor/vutils": "~0.19.1", "@visactor/vscale": "~0.18.1", "@visactor/vdataset": "~0.18.1", From 26794757f77388243124ca123d208e3fa2ef95af Mon Sep 17 00:00:00 2001 From: along Date: Thu, 19 Jun 2025 14:46:00 +0800 Subject: [PATCH 13/22] fix: fix the issue where the icon configuration is not effective when cellType is progressBar #4047 --- packages/vtable/src/scenegraph/group-creater/cell-helper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vtable/src/scenegraph/group-creater/cell-helper.ts b/packages/vtable/src/scenegraph/group-creater/cell-helper.ts index eb4479923c..fb4e28f05f 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-helper.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-helper.ts @@ -328,7 +328,7 @@ export function createCell( padding, textAlign, textBaseline, - false, + mayHaveIcon, customElementsGroup, renderDefault, cellTheme, From cf1cab9743c0b24dcd5afc9c614a159326db8af3 Mon Sep 17 00:00:00 2001 From: along Date: Thu, 19 Jun 2025 14:52:35 +0800 Subject: [PATCH 14/22] fix: fix the issue where the icon configuration is not effective when cellType is progressBar #4047 --- .../list/list-cellType-progressBar.ts | 204 ++++++++++++++++++ packages/vtable/examples/menu.ts | 4 + 2 files changed, 208 insertions(+) create mode 100644 packages/vtable/examples/list/list-cellType-progressBar.ts diff --git a/packages/vtable/examples/list/list-cellType-progressBar.ts b/packages/vtable/examples/list/list-cellType-progressBar.ts new file mode 100644 index 0000000000..79cfcde55a --- /dev/null +++ b/packages/vtable/examples/list/list-cellType-progressBar.ts @@ -0,0 +1,204 @@ +import * as VTable from '../../src'; +import { bindDebugTool } from '../../src/scenegraph/debug-tool'; +const CONTAINER_ID = 'vTable'; + +// 该文档修复 cellType为 progressbar 不展示icon问题 #4047 +VTable.register.icon('order', { + type: 'svg', + svg: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/order.svg', + width: 22, + height: 22, + name: 'order', + positionType: VTable.TYPES.IconPosition.left, + marginLeft: -7, + marginRight: 10, + hover: { + width: 22, + height: 22, + bgColor: 'rgba(101, 117, 168, 0.1)' + }, + cursor: 'pointer' +}); +export function createTable() { + const records = [ + { + name: '鸽子', + introduction: '鸽子是一种常见的城市鸟类,具有灰色的羽毛和短而粗壮的喙', + image: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/media/pigeon.jpeg', + video: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/media/pigeon.mp4', + YoY: 50, + QoQ: 10, + trend: [ + { x: 1, y: 1500 }, + { x: 2, y: 1480 }, + { x: 3, y: 1520 }, + { x: 4, y: 1550 }, + { x: 5, y: 1600 } + ] + // "trend":[1500,1480,1520,1550,1600], + }, + { + name: '燕子', + introduction: '燕子是一种善于飞行的鸟类,通常栖息在房屋和建筑物的附近。', + image: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/media/swallow.jpeg', + video: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/media/swallow.mp4', + YoY: 10, + QoQ: -10, + trend: [ + { x: 1, y: 800 }, + { x: 2, y: 780 }, + { x: 3, y: 700 }, + { x: 4, y: 800 }, + { x: 5, y: 900 } + ] + }, + { + name: '喜鹊', + introduction: + '喜鹊是一种常见的小型鸟类,主要分布在亚洲地区。它们体型较小,具有黑色的头部和喉咙、灰色的背部和白色的腹部。喜鹊是群居动物,常常在树林中或城市公园中筑巢繁殖,以昆虫、果实和种子为食。它们还具有很高的智商和社交性,被认为是一种聪明、有趣的鸟类。', + image: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/media/Magpie.jpeg', + video: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/media/Magpie.mp4', + YoY: -10, + QoQ: -10, + trend: [ + { x: 1, y: 500 }, + { x: 2, y: 680 }, + { x: 3, y: 400 }, + { x: 4, y: 600 }, + { x: 5, y: 800 } + ] + }, + { + name: '孔雀', + introduction: + '孔雀是一种美丽的大型鸟类,拥有灿烂的蓝绿色羽毛和长长的尾羽。主要生活在南亚地区,以昆虫、水果和种子为食。', + image: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/media/peacock.jpeg', + video: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/media/peacock.mp4', + YoY: 5, + QoQ: -10, + trend: [ + { x: 1, y: 500 }, + { x: 2, y: 680 }, + { x: 3, y: 400 }, + { x: 4, y: 600 }, + { x: 5, y: 800 } + ] + } + ]; + const columns: VTable.ColumnsDefine = [ + { + field: 'YoY', + title: 'count Year-over-Year', + cellType: 'progressbar', + width: 200, + fieldFormat(rec) { + if (typeof rec.YoY === 'number') { + return rec.YoY + '%'; + } + return rec.YoY; + }, + icon: 'order' + }, + { + field: 'YoY', + title: 'count Year-over-Year', + cellType: 'progressbar', + width: 200, + style: { + barHeight: '100%', + // barBgColor: '#aaa', + // barColor: '#444', + barBgColor: data => { + return `rgb(${200 + 50 * (1 - data.percentile)},${255 * (1 - data.percentile)},${ + 255 * (1 - data.percentile) + })`; + }, + barColor: 'transparent' + } + }, + { + field: 'YoY', + title: 'count Year-over-Year', + cellType: 'progressbar', + width: 200, + fieldFormat() { + return ''; + }, + min: -20, + max: 60, + style: { + showBar: true, + barColor: data => { + return `rgb(${200 + 50 * (1 - data.percentile)},${255 * (1 - data.percentile)},${ + 255 * (1 - data.percentile) + })`; + }, + barHeight: 20, + barBottom: '30%' + } + }, + { + field: 'YoY', + title: 'count Year-over-Year', + cellType: 'progressbar', + width: 200, + fieldFormat() { + return ''; + }, + barType: 'negative', + min: -20, + max: 60, + style: { + barHeight: 20, + barBottom: '30%' + } + }, + { + field: 'YoY', + title: 'count Year-over-Year', + cellType: 'progressbar', + width: 200, + barType: 'negative_no_axis', + min: -20, + max: 60, + style: { + textAlign: 'right', + barHeight: 20, + barBottom: '30%', + barBgColor: 'rgba(217,217,217,0.3)' + } + }, + { + field: 'YoY', + title: 'count Year-over-Year', + cellType: 'progressbar', + width: 200, + barType: 'negative_no_axis', + min: -20, + max: 60, + style: { + showBar: false + } + } + ]; + const option: VTable.ListTableConstructorOptions = { + container: document.getElementById(CONTAINER_ID), + records, + columns, + autoWrapText: true + }; + const tableInstance = new VTable.ListTable(option); + window.tableInstance = tableInstance; + + // bindDebugTool(tableInstance.scenegraph.stage, { customGrapicKeys: ['col', 'row'] }); + // tableInstance.on('sort_click', args => { + // tableInstance.updateSortState( + // { + // field: args.field, + // order: Date.now() % 3 === 0 ? 'desc' : Date.now() % 3 === 1 ? 'asc' : 'normal' + // }, + // false + // ); + // return false; //return false代表不执行内部排序逻辑 + // }); +} diff --git a/packages/vtable/examples/menu.ts b/packages/vtable/examples/menu.ts index f0ec529f21..b46775a1bc 100644 --- a/packages/vtable/examples/menu.ts +++ b/packages/vtable/examples/menu.ts @@ -91,6 +91,10 @@ export const menus = [ path: 'list', name: 'list-chart-bar' }, + { + path: 'list', + name: 'list-cellType-progressBar' + }, { path: 'list', name: 'list-updateOption' From a48ec169d56d61941dfcaaf4b700849c47831d29 Mon Sep 17 00:00:00 2001 From: along Date: Thu, 19 Jun 2025 14:54:51 +0800 Subject: [PATCH 15/22] docs: update changlog of rush --- .../@visactor/vtable/processBar_2025-06-19-06-54.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vtable/processBar_2025-06-19-06-54.json diff --git a/common/changes/@visactor/vtable/processBar_2025-06-19-06-54.json b/common/changes/@visactor/vtable/processBar_2025-06-19-06-54.json new file mode 100644 index 0000000000..56c937b64b --- /dev/null +++ b/common/changes/@visactor/vtable/processBar_2025-06-19-06-54.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: fix the issue where the icon configuration is not effective when cellType is progressBar #4047\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "alonemall@163.com" +} \ No newline at end of file From 5e37c234991ea0d58b757436d4eb35712ada1542 Mon Sep 17 00:00:00 2001 From: Violet2314 <3279499388@qq.com> Date: Thu, 19 Jun 2025 21:40:59 +0800 Subject: [PATCH 16/22] fix(gantt): gantt export image --- .../guide/en/plugin/gantt-export-image.md | 108 ++++++++++++++++-- .../guide/zh/plugin/gantt-export-image.md | 82 +++++++++++++ .../gantt-export-image/gantt-export-image.ts | 90 ++++++++++++++- .../vtable-plugins/src/gantt-export-image.ts | 49 +++++--- 4 files changed, 300 insertions(+), 29 deletions(-) diff --git a/docs/assets/guide/en/plugin/gantt-export-image.md b/docs/assets/guide/en/plugin/gantt-export-image.md index 1f063412df..0eafedb3f0 100644 --- a/docs/assets/guide/en/plugin/gantt-export-image.md +++ b/docs/assets/guide/en/plugin/gantt-export-image.md @@ -36,7 +36,7 @@ const option = { ``` ```javascript livedemo template=vtable -// The plugin package needs to be introduced when in use@visactor/vtable-plugins +// 使用时需要引入插件包@visactor/vtable-plugins // import * as VTablePlugins from '@visactor/vtable-plugins'; const EXPORT_PANEL_ID = 'gantt-export-panel'; const exportGanttPlugin = new VTablePlugins.ExportGanttPlugin(); @@ -198,10 +198,15 @@ const option = { }, barStyle: { width: 20, + /** 任务条的颜色 */ barColor: '#ee8800', + /** 已完成部分任务条的颜色 */ completedBarColor: '#91e8e0', + /** 任务条的圆角 */ cornerRadius: 8, + /** 任务条的边框 */ borderLineWidth: 1, + /** 边框颜色 */ borderColor: 'black' } }, @@ -288,34 +293,34 @@ const option = { const container = document.getElementById(CONTAINER_ID); -// Create a packaging container +// 创建一个包装容器 const wrapper = document.createElement('div'); wrapper.style.height = '100%'; wrapper.style.width = '100%'; wrapper.style.position = 'relative'; container.appendChild(wrapper); -// Create the export panel and put it into the packaging container +// 创建导出面板,放入包装容器 const exportPanel = document.createElement('div'); exportPanel.id = EXPORT_PANEL_ID; exportPanel.style.cssText = 'padding: 2px; background-color: #f6f6f6; margin-bottom: 2px; position: absolute; z-index: 1; border: 1px solid black; opacity: 0.5;'; wrapper.appendChild(exportPanel); -// Create a Gantt chart container and place it in the packaging container +// 创建甘特图容器,放入包装容器 const ganttContainer = document.createElement('div'); -ganttContainer.style.height = '100%'; +ganttContainer.style.height = '100%'; ganttContainer.style.width = '100%'; ganttContainer.style.position = 'relative'; wrapper.appendChild(ganttContainer); -// File format selection +// 文件格式选择 const formatSelect = document.createElement('select'); formatSelect.innerHTML = ` `; formatSelect.style.marginRight = '5px'; -// Zoom ratio selection +// 缩放比例选择 const scaleSelect = document.createElement('select'); scaleSelect.innerHTML = ` @@ -324,17 +329,37 @@ scaleSelect.innerHTML = ` `; scaleSelect.style.marginRight = '5px'; -// Background color selection +// 背景色选择 const bgColorInput = document.createElement('input'); bgColorInput.type = 'color'; bgColorInput.value = '#ffffff'; bgColorInput.style.marginRight = '5px'; -// Export button +// 导出按钮 const exportButton = document.createElement('button'); exportButton.textContent = '导出甘特图'; exportButton.style.marginLeft = '5px'; +// 获取 Base64 按钮 +const getBase64Button = document.createElement('button'); +getBase64Button.textContent = '获取 Base64'; +getBase64Button.style.marginLeft = '5px'; +getBase64Button.style.backgroundColor = '#e8f4ff'; + +const base64Result = document.createElement('div'); +base64Result.style.marginTop = '10px'; +base64Result.style.fontSize = '12px'; +base64Result.style.color = '#666'; +base64Result.style.display = 'none'; +base64Result.style.padding = '5px'; +base64Result.style.backgroundColor = '#f8f8f8'; +base64Result.style.borderRadius = '3px'; +base64Result.style.maxWidth = '100%'; +base64Result.style.overflow = 'hidden'; +base64Result.style.textOverflow = 'ellipsis'; +base64Result.style.whiteSpace = 'nowrap'; + +// 说明文本 const infoText = document.createElement('div'); infoText.innerHTML = '导出功能会直接捕获完整的甘特图和任务列表,即使部分内容在滚动区域外。'; infoText.style.marginTop = '10px'; @@ -349,11 +374,14 @@ exportPanel.appendChild(scaleSelect); exportPanel.appendChild(document.createTextNode('背景色: ')); exportPanel.appendChild(bgColorInput); exportPanel.appendChild(exportButton); +exportPanel.appendChild(getBase64Button); exportPanel.appendChild(infoText); +exportPanel.appendChild(base64Result); +// 创建甘特图实例 const gantt = new VTableGantt.Gantt(ganttContainer, option); -// Bind the export event +// 绑定导出事件 exportButton.onclick = async () => { try { exportButton.disabled = true; @@ -380,6 +408,66 @@ exportButton.onclick = async () => { }, 2000); } }; + + +getBase64Button.onclick = async () => { + try { + getBase64Button.disabled = true; + getBase64Button.textContent = '获取中...'; + base64Result.style.display = 'none'; + + // 使用相同的导出逻辑,但设置download为false + const base64Data = await exportGanttPlugin.exportToImage({ + type: 'png', + scale: Number(scaleSelect.value), + backgroundColor: bgColorInput.value, + quality: 1, + download: false // 不触发下载 + }); + + // 显示结果 + if (base64Data) { + const displayText = base64Data.substring(0, 64) + '...'; + base64Result.textContent = displayText; + base64Result.style.display = 'block'; + base64Result.title = base64Data; // 鼠标悬停可以看到完整数据 + + // 尝试复制到剪贴板 + try { + await navigator.clipboard.writeText(base64Data); + getBase64Button.textContent = '已复制到剪贴板'; + } catch (clipboardError) { + getBase64Button.textContent = '获取成功'; + console.warn('无法复制到剪贴板:', clipboardError); + } + + // 添加点击事件以查看完整数据 + base64Result.style.cursor = 'pointer'; + } else { + base64Result.textContent = '获取Base64数据失败'; + base64Result.style.display = 'block'; + getBase64Button.textContent = '获取失败'; + } + + // 恢复按钮状态 + setTimeout(() => { + getBase64Button.disabled = false; + if (getBase64Button.textContent === '获取中...' || getBase64Button.textContent === '获取失败' || getBase64Button.textContent === '已复制到剪贴板') { + getBase64Button.textContent = '获取 Base64'; + } + }, 3000); + } catch (error) { + console.error('获取Base64失败:', error); + base64Result.textContent = `获取失败: ${error instanceof Error ? error.message : '未知错误'}`; + base64Result.style.display = 'block'; + getBase64Button.textContent = '获取失败'; + + setTimeout(() => { + getBase64Button.disabled = false; + getBase64Button.textContent = '获取 Base64'; + }, 2000); + } +}; ``` # This document was contributed by: diff --git a/docs/assets/guide/zh/plugin/gantt-export-image.md b/docs/assets/guide/zh/plugin/gantt-export-image.md index 67e996b19a..484ca5e0e5 100644 --- a/docs/assets/guide/zh/plugin/gantt-export-image.md +++ b/docs/assets/guide/zh/plugin/gantt-export-image.md @@ -22,6 +22,7 @@ scale: Number(scaleSelect.value), backgroundColor: bgColorInput.value, // 导出的图片的质量 quality: 1 +download: false // 是否下载图片 ``` ## 插件示例 @@ -341,6 +342,25 @@ const exportButton = document.createElement('button'); exportButton.textContent = '导出甘特图'; exportButton.style.marginLeft = '5px'; +// 获取 Base64 按钮 +const getBase64Button = document.createElement('button'); +getBase64Button.textContent = '获取 Base64'; +getBase64Button.style.marginLeft = '5px'; +getBase64Button.style.backgroundColor = '#e8f4ff'; + +const base64Result = document.createElement('div'); +base64Result.style.marginTop = '10px'; +base64Result.style.fontSize = '12px'; +base64Result.style.color = '#666'; +base64Result.style.display = 'none'; +base64Result.style.padding = '5px'; +base64Result.style.backgroundColor = '#f8f8f8'; +base64Result.style.borderRadius = '3px'; +base64Result.style.maxWidth = '100%'; +base64Result.style.overflow = 'hidden'; +base64Result.style.textOverflow = 'ellipsis'; +base64Result.style.whiteSpace = 'nowrap'; + // 说明文本 const infoText = document.createElement('div'); infoText.innerHTML = '导出功能会直接捕获完整的甘特图和任务列表,即使部分内容在滚动区域外。'; @@ -356,7 +376,9 @@ exportPanel.appendChild(scaleSelect); exportPanel.appendChild(document.createTextNode('背景色: ')); exportPanel.appendChild(bgColorInput); exportPanel.appendChild(exportButton); +exportPanel.appendChild(getBase64Button); exportPanel.appendChild(infoText); +exportPanel.appendChild(base64Result); // 创建甘特图实例 const gantt = new VTableGantt.Gantt(ganttContainer, option); @@ -388,6 +410,66 @@ exportButton.onclick = async () => { }, 2000); } }; + + +getBase64Button.onclick = async () => { + try { + getBase64Button.disabled = true; + getBase64Button.textContent = '获取中...'; + base64Result.style.display = 'none'; + + // 使用相同的导出逻辑,但设置download为false + const base64Data = await exportGanttPlugin.exportToImage({ + type: 'png', + scale: Number(scaleSelect.value), + backgroundColor: bgColorInput.value, + quality: 1, + download: false // 不触发下载 + }); + + // 显示结果 + if (base64Data) { + const displayText = base64Data.substring(0, 64) + '...'; + base64Result.textContent = displayText; + base64Result.style.display = 'block'; + base64Result.title = base64Data; // 鼠标悬停可以看到完整数据 + + // 尝试复制到剪贴板 + try { + await navigator.clipboard.writeText(base64Data); + getBase64Button.textContent = '已复制到剪贴板'; + } catch (clipboardError) { + getBase64Button.textContent = '获取成功'; + console.warn('无法复制到剪贴板:', clipboardError); + } + + // 添加点击事件以查看完整数据 + base64Result.style.cursor = 'pointer'; + } else { + base64Result.textContent = '获取Base64数据失败'; + base64Result.style.display = 'block'; + getBase64Button.textContent = '获取失败'; + } + + // 恢复按钮状态 + setTimeout(() => { + getBase64Button.disabled = false; + if (getBase64Button.textContent === '获取中...' || getBase64Button.textContent === '获取失败' || getBase64Button.textContent === '已复制到剪贴板') { + getBase64Button.textContent = '获取 Base64'; + } + }, 3000); + } catch (error) { + console.error('获取Base64失败:', error); + base64Result.textContent = `获取失败: ${error instanceof Error ? error.message : '未知错误'}`; + base64Result.style.display = 'block'; + getBase64Button.textContent = '获取失败'; + + setTimeout(() => { + getBase64Button.disabled = false; + getBase64Button.textContent = '获取 Base64'; + }, 2000); + } +}; ``` # 本文档由由以下人员贡献 diff --git a/packages/vtable-plugins/demo/gantt-export-image/gantt-export-image.ts b/packages/vtable-plugins/demo/gantt-export-image/gantt-export-image.ts index b410396e6a..1e06d552e2 100644 --- a/packages/vtable-plugins/demo/gantt-export-image/gantt-export-image.ts +++ b/packages/vtable-plugins/demo/gantt-export-image/gantt-export-image.ts @@ -486,14 +486,32 @@ export function createTable() { // 背景色选择 const bgColorInput = document.createElement('input'); - bgColorInput.type = 'color'; - bgColorInput.value = '#ffffff'; + bgColorInput.type = 'color'; bgColorInput.value = '#ffffff'; bgColorInput.style.marginRight = '5px'; // 导出按钮 const exportButton = document.createElement('button'); exportButton.textContent = '导出甘特图'; exportButton.style.marginLeft = '5px'; + + // 获取 Base64 按钮 + const getBase64Button = document.createElement('button'); + getBase64Button.textContent = '获取 Base64'; + getBase64Button.style.marginLeft = '5px'; + getBase64Button.style.backgroundColor = '#e8f4ff'; + + const base64Result = document.createElement('div'); + base64Result.style.marginTop = '10px'; + base64Result.style.fontSize = '12px'; + base64Result.style.color = '#666'; + base64Result.style.display = 'none'; + base64Result.style.padding = '5px'; + base64Result.style.backgroundColor = '#f8f8f8'; + base64Result.style.borderRadius = '3px'; + base64Result.style.maxWidth = '100%'; + base64Result.style.overflow = 'hidden'; + base64Result.style.textOverflow = 'ellipsis'; + base64Result.style.whiteSpace = 'nowrap'; // 说明文本 const infoText = document.createElement('div'); @@ -501,7 +519,6 @@ export function createTable() { infoText.style.marginTop = '10px'; infoText.style.fontSize = '12px'; infoText.style.color = '#666'; - // 添加控件到面板 exportPanel.appendChild(document.createTextNode('格式: ')); exportPanel.appendChild(formatSelect); @@ -510,16 +527,19 @@ export function createTable() { exportPanel.appendChild(document.createTextNode('背景色: ')); exportPanel.appendChild(bgColorInput); exportPanel.appendChild(exportButton); + exportPanel.appendChild(getBase64Button); exportPanel.appendChild(infoText); + exportPanel.appendChild(base64Result); // 创建甘特图实例 const gantt = new VTableGantt.Gantt(ganttContainer, option); - // 绑定导出事件 exportButton.onclick = async () => { try { exportButton.disabled = true; exportButton.textContent = '导出中...'; + // 隐藏之前的base64结果 + base64Result.style.display = 'none'; await exportGanttPlugin.exportToImage({ fileName: '甘特图导出测试', @@ -543,6 +563,68 @@ export function createTable() { }, 2000); } }; + + // 绑定获取Base64事件 + getBase64Button.onclick = async () => { + try { + getBase64Button.disabled = true; + getBase64Button.textContent = '获取中...'; + // 隐藏之前的base64结果 + base64Result.style.display = 'none'; + + // 使用相同的导出逻辑,但设置download为false + const base64Data = await exportGanttPlugin.exportToImage({ + type: formatSelect.value as 'png' | 'jpeg', + scale: Number(scaleSelect.value), + backgroundColor: bgColorInput.value, + quality: 1, + download: false // 不触发下载 + }); + + // 显示结果 + if (base64Data) { + // 显示base64数据的前缀部分,避免过长 + const displayText = base64Data.substring(0, 64) + '...'; + base64Result.textContent = displayText; + base64Result.style.display = 'block'; + base64Result.title = base64Data; // 鼠标悬停可以看到完整数据 + + // 尝试复制到剪贴板 + try { + await navigator.clipboard.writeText(base64Data); + getBase64Button.textContent = '已复制到剪贴板'; + } catch (clipboardError) { + getBase64Button.textContent = '获取成功'; + console.warn('无法复制到剪贴板:', clipboardError); + } + + // 添加点击事件以查看完整数据 + base64Result.style.cursor = 'pointer'; + } else { + base64Result.textContent = '获取Base64数据失败'; + base64Result.style.display = 'block'; + getBase64Button.textContent = '获取失败'; + } + + // 恢复按钮状态 + setTimeout(() => { + getBase64Button.disabled = false; + if (getBase64Button.textContent === '获取中...' || getBase64Button.textContent === '获取失败' || getBase64Button.textContent === '已复制到剪贴板') { + getBase64Button.textContent = '获取 Base64'; + } + }, 3000); + } catch (error) { + console.error('获取Base64失败:', error); + base64Result.textContent = `获取失败: ${error instanceof Error ? error.message : '未知错误'}`; + base64Result.style.display = 'block'; + getBase64Button.textContent = '获取失败'; + + setTimeout(() => { + getBase64Button.disabled = false; + getBase64Button.textContent = '获取 Base64'; + }, 2000); + } + }; return gantt; } diff --git a/packages/vtable-plugins/src/gantt-export-image.ts b/packages/vtable-plugins/src/gantt-export-image.ts index 24179e8fa0..3132ed6dfc 100644 --- a/packages/vtable-plugins/src/gantt-export-image.ts +++ b/packages/vtable-plugins/src/gantt-export-image.ts @@ -7,6 +7,7 @@ export interface ExportOptions { quality?: number; backgroundColor?: string; scale?: number; + download?: boolean; } @@ -27,8 +28,7 @@ export class ExportGanttPlugin implements VTableGantt.plugins.IGanttPlugin { return; } this._gantt = ganttInstance; - } - + } /** * 执行甘特图导出操作 * @async @@ -48,7 +48,8 @@ export class ExportGanttPlugin implements VTableGantt.plugins.IGanttPlugin { type = 'png', quality = 1, backgroundColor = '#ffffff', - scale = window.devicePixelRatio || 1 + scale = window.devicePixelRatio || 1, + download = true // 默认执行下载 } = options; try { @@ -97,11 +98,10 @@ export class ExportGanttPlugin implements VTableGantt.plugins.IGanttPlugin { sourceWidth, clonedGantt.canvas.height, (clonedGantt.taskListTableInstance.getAllColsWidth() + 1.5) * scale, 0, (clonedGantt.getAllDateColsWidth() - 1.5) * scale, - totalHeight - ); + totalHeight ); } - return this.finalizeExport(exportCanvas, fileName, type, quality); + return this.finalizeExport(exportCanvas, fileName, type, quality, download); } finally { tempContainer.remove(); // 确保克隆的甘特图实例被释放 @@ -113,6 +113,21 @@ export class ExportGanttPlugin implements VTableGantt.plugins.IGanttPlugin { } } + /** + * 获取甘特图的 Base64 图片数据,不触发下载 + * @async + * @param {Omit} [options={}] 导出配置选项(不包含 download 参数) + * @returns {Promise} 返回 Base64 格式的图片数据,或在未初始化时返回 undefined + * @throws {Error} 导出过程中发生错误时抛出异常 + */ + public async exportToBase64(options: Omit = {}): Promise { + // 调用 exportToImage 方法,但设置 download 为 false + return this.exportToImage({ + ...options, + download: false + }); + } + private createFullSizeContainer(scale: number) { if (!this._gantt) { // 保留这个 error @@ -145,6 +160,7 @@ export class ExportGanttPlugin implements VTableGantt.plugins.IGanttPlugin { minTableWidth: undefined as unknown as number, maxTableWidth: undefined as unknown as number, }, + plugins: [] }); clonedGantt.setPixelRatio(scale); @@ -160,16 +176,19 @@ export class ExportGanttPlugin implements VTableGantt.plugins.IGanttPlugin { clonedGantt.scenegraph.stage.render(); return { tempContainer, clonedGantt }; - } - - private finalizeExport(canvas: HTMLCanvasElement, fileName: string, type: string, quality: number): string { + } private finalizeExport(canvas: HTMLCanvasElement, fileName: string, type: string, quality: number, download: boolean = true): string { const base64 = canvas.toDataURL(`image/${type}`, quality); - const link = document.createElement('a'); - link.download = `${fileName}.${type}`; - link.href = base64; - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); + + // 如果需要下载,则创建下载链接 + if (download) { + const link = document.createElement('a'); + link.download = `${fileName}.${type}`; + link.href = base64; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + } + return base64; } From 5eff7376f2b566e6ec72e7de794a702e03162b97 Mon Sep 17 00:00:00 2001 From: Violet2314 <3279499388@qq.com> Date: Thu, 19 Jun 2025 21:45:33 +0800 Subject: [PATCH 17/22] fix(gantt): gantt export image --- docs/assets/guide/en/plugin/gantt-export-image.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/assets/guide/en/plugin/gantt-export-image.md b/docs/assets/guide/en/plugin/gantt-export-image.md index 0eafedb3f0..92ccaec661 100644 --- a/docs/assets/guide/en/plugin/gantt-export-image.md +++ b/docs/assets/guide/en/plugin/gantt-export-image.md @@ -36,7 +36,7 @@ const option = { ``` ```javascript livedemo template=vtable -// 使用时需要引入插件包@visactor/vtable-plugins +// The plugin package needs to be introduced when in use@visactor/vtable-plugins // import * as VTablePlugins from '@visactor/vtable-plugins'; const EXPORT_PANEL_ID = 'gantt-export-panel'; const exportGanttPlugin = new VTablePlugins.ExportGanttPlugin(); From b660d3d4625aaf757ef988820899b2b9c32b79f4 Mon Sep 17 00:00:00 2001 From: Violet2314 <3279499388@qq.com> Date: Thu, 19 Jun 2025 21:48:51 +0800 Subject: [PATCH 18/22] fix(gantt): gantt export image --- .../guide/en/plugin/gantt-export-image.md | 21 ++----------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/docs/assets/guide/en/plugin/gantt-export-image.md b/docs/assets/guide/en/plugin/gantt-export-image.md index 92ccaec661..ad718639df 100644 --- a/docs/assets/guide/en/plugin/gantt-export-image.md +++ b/docs/assets/guide/en/plugin/gantt-export-image.md @@ -293,34 +293,29 @@ const option = { const container = document.getElementById(CONTAINER_ID); -// 创建一个包装容器 const wrapper = document.createElement('div'); wrapper.style.height = '100%'; wrapper.style.width = '100%'; wrapper.style.position = 'relative'; container.appendChild(wrapper); -// 创建导出面板,放入包装容器 const exportPanel = document.createElement('div'); exportPanel.id = EXPORT_PANEL_ID; exportPanel.style.cssText = 'padding: 2px; background-color: #f6f6f6; margin-bottom: 2px; position: absolute; z-index: 1; border: 1px solid black; opacity: 0.5;'; wrapper.appendChild(exportPanel); -// 创建甘特图容器,放入包装容器 const ganttContainer = document.createElement('div'); ganttContainer.style.height = '100%'; ganttContainer.style.width = '100%'; ganttContainer.style.position = 'relative'; wrapper.appendChild(ganttContainer); -// 文件格式选择 const formatSelect = document.createElement('select'); formatSelect.innerHTML = ` `; formatSelect.style.marginRight = '5px'; -// 缩放比例选择 const scaleSelect = document.createElement('select'); scaleSelect.innerHTML = ` @@ -329,18 +324,15 @@ scaleSelect.innerHTML = ` `; scaleSelect.style.marginRight = '5px'; -// 背景色选择 const bgColorInput = document.createElement('input'); bgColorInput.type = 'color'; bgColorInput.value = '#ffffff'; bgColorInput.style.marginRight = '5px'; -// 导出按钮 const exportButton = document.createElement('button'); exportButton.textContent = '导出甘特图'; exportButton.style.marginLeft = '5px'; -// 获取 Base64 按钮 const getBase64Button = document.createElement('button'); getBase64Button.textContent = '获取 Base64'; getBase64Button.style.marginLeft = '5px'; @@ -359,14 +351,12 @@ base64Result.style.overflow = 'hidden'; base64Result.style.textOverflow = 'ellipsis'; base64Result.style.whiteSpace = 'nowrap'; -// 说明文本 const infoText = document.createElement('div'); infoText.innerHTML = '导出功能会直接捕获完整的甘特图和任务列表,即使部分内容在滚动区域外。'; infoText.style.marginTop = '10px'; infoText.style.fontSize = '12px'; infoText.style.color = '#666'; -// 添加控件到面板 exportPanel.appendChild(document.createTextNode('格式: ')); exportPanel.appendChild(formatSelect); exportPanel.appendChild(document.createTextNode('缩放: ')); @@ -378,10 +368,8 @@ exportPanel.appendChild(getBase64Button); exportPanel.appendChild(infoText); exportPanel.appendChild(base64Result); -// 创建甘特图实例 const gantt = new VTableGantt.Gantt(ganttContainer, option); -// 绑定导出事件 exportButton.onclick = async () => { try { exportButton.disabled = true; @@ -416,23 +404,20 @@ getBase64Button.onclick = async () => { getBase64Button.textContent = '获取中...'; base64Result.style.display = 'none'; - // 使用相同的导出逻辑,但设置download为false const base64Data = await exportGanttPlugin.exportToImage({ type: 'png', scale: Number(scaleSelect.value), backgroundColor: bgColorInput.value, quality: 1, - download: false // 不触发下载 + download: false }); - // 显示结果 if (base64Data) { const displayText = base64Data.substring(0, 64) + '...'; base64Result.textContent = displayText; base64Result.style.display = 'block'; - base64Result.title = base64Data; // 鼠标悬停可以看到完整数据 + base64Result.title = base64Data; - // 尝试复制到剪贴板 try { await navigator.clipboard.writeText(base64Data); getBase64Button.textContent = '已复制到剪贴板'; @@ -441,7 +426,6 @@ getBase64Button.onclick = async () => { console.warn('无法复制到剪贴板:', clipboardError); } - // 添加点击事件以查看完整数据 base64Result.style.cursor = 'pointer'; } else { base64Result.textContent = '获取Base64数据失败'; @@ -449,7 +433,6 @@ getBase64Button.onclick = async () => { getBase64Button.textContent = '获取失败'; } - // 恢复按钮状态 setTimeout(() => { getBase64Button.disabled = false; if (getBase64Button.textContent === '获取中...' || getBase64Button.textContent === '获取失败' || getBase64Button.textContent === '已复制到剪贴板') { From e57a293af93fb826f53f489735b2f42b48bd64da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=9D=A8=E6=9E=9A?= Date: Fri, 20 Jun 2025 12:48:30 +0800 Subject: [PATCH 19/22] fix: size exceeds --- packages/vtable/src/core/BaseTable.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/vtable/src/core/BaseTable.ts b/packages/vtable/src/core/BaseTable.ts index 96afd4a34e..54f5434f08 100644 --- a/packages/vtable/src/core/BaseTable.ts +++ b/packages/vtable/src/core/BaseTable.ts @@ -1523,6 +1523,11 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { tableSize: 'tableNoFrameHeight', getSize: 'getRowHeight' }; + const tableSize = this[keyMap.tableSize]; + if (totalSize >= tableSize) { + // 总尺寸已经大于表格尺寸,直接返回 + return totalSize; + } /** 目标冻结开始位置 */ const frozenStart = this[keyMap.totalCount] - this[keyMap.frozenCount]; if (!isFinite(this[keyMap.totalCount]) || this[keyMap.frozenCount] <= 0 || frozenStart < 0) { @@ -1534,7 +1539,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { // 传入范围不包含 body 和冻结区的交叉区域 或 当前未开启 containerFit,无需处理 return totalSize; } - const tableSize = this[keyMap.tableSize]; + const first = 0; const last = this[keyMap.totalCount] - 1; let size = tableSize; From a503a3b460720a17faeaff1c4acee288e6454bf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=9D=A8=E6=9E=9A?= Date: Fri, 20 Jun 2025 15:22:23 +0800 Subject: [PATCH 20/22] fix: compatible with base class definitions --- packages/vtable/src/scenegraph/graphic/icon.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vtable/src/scenegraph/graphic/icon.ts b/packages/vtable/src/scenegraph/graphic/icon.ts index 214fe94f14..aacf2d0797 100644 --- a/packages/vtable/src/scenegraph/graphic/icon.ts +++ b/packages/vtable/src/scenegraph/graphic/icon.ts @@ -201,7 +201,7 @@ export class Icon extends Image { } } - failCallback() { + failCallback = () => { const registeredIcons = icons.get(); const { svg, src } = (registeredIcons.damage_pic as any) || {}; const image = svg || src; From dbe23ee8319d2f50789fafc8e36fb06013816b15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E5=B8=85?= <892739385@qq.com> Date: Fri, 20 Jun 2025 20:09:40 +0800 Subject: [PATCH 21/22] Rename 3337-feat-add-containerFit_2025-06-13-06-29.jseaon to 3337-feat-add-containerFit_2025-06-13-06-29.json --- ....jseaon => 3337-feat-add-containerFit_2025-06-13-06-29.json} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename common/changes/@visactor/vtable/{3337-feat-add-containerFit_2025-06-13-06-29.jseaon => 3337-feat-add-containerFit_2025-06-13-06-29.json} (99%) diff --git a/common/changes/@visactor/vtable/3337-feat-add-containerFit_2025-06-13-06-29.jseaon b/common/changes/@visactor/vtable/3337-feat-add-containerFit_2025-06-13-06-29.json similarity index 99% rename from common/changes/@visactor/vtable/3337-feat-add-containerFit_2025-06-13-06-29.jseaon rename to common/changes/@visactor/vtable/3337-feat-add-containerFit_2025-06-13-06-29.json index 5e08e5b137..75aee59d81 100644 --- a/common/changes/@visactor/vtable/3337-feat-add-containerFit_2025-06-13-06-29.jseaon +++ b/common/changes/@visactor/vtable/3337-feat-add-containerFit_2025-06-13-06-29.json @@ -8,4 +8,4 @@ ], "packageName": "@visactor/vtable", "email": "892739385@qq.com" -} \ No newline at end of file +} From 8e76339faf2835bb64b6463a8ac45155a3eca134 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 20 Jun 2025 12:21:04 +0000 Subject: [PATCH 22/22] build: prelease version 1.19.1 --- ...eat-add-containerFit_2025-06-13-06-29.json | 11 ---------- .../fix-animation-error_2025-06-18-07-12.json | 11 ---------- ...x-copy-not-work-3968_2025-06-18-03-51.json | 11 ---------- .../vtable/processBar_2025-06-19-06-54.json | 11 ---------- common/config/rush/version-policies.json | 2 +- packages/openinula-vtable/package.json | 2 +- packages/react-vtable/package.json | 2 +- packages/vtable-calendar/package.json | 2 +- packages/vtable-editors/package.json | 2 +- packages/vtable-export/package.json | 2 +- packages/vtable-gantt/package.json | 2 +- packages/vtable-plugins/package.json | 2 +- packages/vtable-search/package.json | 2 +- packages/vtable/CHANGELOG.json | 21 +++++++++++++++++++ packages/vtable/CHANGELOG.md | 20 +++++++++++++++++- packages/vtable/package.json | 4 ++-- packages/vue-vtable/package.json | 2 +- 17 files changed, 52 insertions(+), 57 deletions(-) delete mode 100644 common/changes/@visactor/vtable/3337-feat-add-containerFit_2025-06-13-06-29.json delete mode 100644 common/changes/@visactor/vtable/fix-animation-error_2025-06-18-07-12.json delete mode 100644 common/changes/@visactor/vtable/fix-copy-not-work-3968_2025-06-18-03-51.json delete mode 100644 common/changes/@visactor/vtable/processBar_2025-06-19-06-54.json diff --git a/common/changes/@visactor/vtable/3337-feat-add-containerFit_2025-06-13-06-29.json b/common/changes/@visactor/vtable/3337-feat-add-containerFit_2025-06-13-06-29.json deleted file mode 100644 index 75aee59d81..0000000000 --- a/common/changes/@visactor/vtable/3337-feat-add-containerFit_2025-06-13-06-29.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "feat: add containerFit #3337\n\n", - "type": "none", - "packageName": "@visactor/vtable" - } - ], - "packageName": "@visactor/vtable", - "email": "892739385@qq.com" -} diff --git a/common/changes/@visactor/vtable/fix-animation-error_2025-06-18-07-12.json b/common/changes/@visactor/vtable/fix-animation-error_2025-06-18-07-12.json deleted file mode 100644 index 90a570a2a4..0000000000 --- a/common/changes/@visactor/vtable/fix-animation-error_2025-06-18-07-12.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "chore: update vrender 1.0.4 fix animation bug\n\n", - "type": "none", - "packageName": "@visactor/vtable" - } - ], - "packageName": "@visactor/vtable", - "email": "892739385@qq.com" -} \ No newline at end of file diff --git a/common/changes/@visactor/vtable/fix-copy-not-work-3968_2025-06-18-03-51.json b/common/changes/@visactor/vtable/fix-copy-not-work-3968_2025-06-18-03-51.json deleted file mode 100644 index c4429a6597..0000000000 --- a/common/changes/@visactor/vtable/fix-copy-not-work-3968_2025-06-18-03-51.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "fix: copy not work when after copy tooltip text #3968\n\n", - "type": "none", - "packageName": "@visactor/vtable" - } - ], - "packageName": "@visactor/vtable", - "email": "892739385@qq.com" -} \ No newline at end of file diff --git a/common/changes/@visactor/vtable/processBar_2025-06-19-06-54.json b/common/changes/@visactor/vtable/processBar_2025-06-19-06-54.json deleted file mode 100644 index 56c937b64b..0000000000 --- a/common/changes/@visactor/vtable/processBar_2025-06-19-06-54.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "fix: fix the issue where the icon configuration is not effective when cellType is progressBar #4047\n\n", - "type": "none", - "packageName": "@visactor/vtable" - } - ], - "packageName": "@visactor/vtable", - "email": "alonemall@163.com" -} \ No newline at end of file diff --git a/common/config/rush/version-policies.json b/common/config/rush/version-policies.json index 3fd8fb436a..2eeb39641b 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -1 +1 @@ -[{"definitionName":"lockStepVersion","policyName":"vtableMain","version":"1.19.0","mainProject":"@visactor/vtable","nextBump":"minor"}] +[{"definitionName":"lockStepVersion","policyName":"vtableMain","version":"1.19.1","mainProject":"@visactor/vtable","nextBump":"patch"}] diff --git a/packages/openinula-vtable/package.json b/packages/openinula-vtable/package.json index 3fa8f8c1c7..85b947b03c 100644 --- a/packages/openinula-vtable/package.json +++ b/packages/openinula-vtable/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/openinula-vtable", - "version": "1.19.0", + "version": "1.19.1", "description": "The openinula version of VTable", "keywords": [ "openinula", diff --git a/packages/react-vtable/package.json b/packages/react-vtable/package.json index a4884b5b3e..5efbcc445f 100644 --- a/packages/react-vtable/package.json +++ b/packages/react-vtable/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/react-vtable", - "version": "1.19.0", + "version": "1.19.1", "description": "The react version of VTable", "keywords": [ "react", diff --git a/packages/vtable-calendar/package.json b/packages/vtable-calendar/package.json index 031f24c411..4399f75cf1 100644 --- a/packages/vtable-calendar/package.json +++ b/packages/vtable-calendar/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vtable-calendar", - "version": "1.19.0", + "version": "1.19.1", "description": "The calendar component of VTable", "author": { "name": "VisActor", diff --git a/packages/vtable-editors/package.json b/packages/vtable-editors/package.json index b9e253d0c6..1b2f421d72 100644 --- a/packages/vtable-editors/package.json +++ b/packages/vtable-editors/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vtable-editors", - "version": "1.19.0", + "version": "1.19.1", "description": "", "sideEffects": false, "main": "cjs/index.js", diff --git a/packages/vtable-export/package.json b/packages/vtable-export/package.json index fb3ac1f0ad..ce3abfabce 100644 --- a/packages/vtable-export/package.json +++ b/packages/vtable-export/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vtable-export", - "version": "1.19.0", + "version": "1.19.1", "description": "The export util of VTable", "author": { "name": "VisActor", diff --git a/packages/vtable-gantt/package.json b/packages/vtable-gantt/package.json index 403683b046..ec7393129a 100644 --- a/packages/vtable-gantt/package.json +++ b/packages/vtable-gantt/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vtable-gantt", - "version": "1.19.0", + "version": "1.19.1", "description": "canvas table width high performance", "keywords": [ "vtable-gantt", diff --git a/packages/vtable-plugins/package.json b/packages/vtable-plugins/package.json index 1f5f90dbb3..4dfa2ab738 100644 --- a/packages/vtable-plugins/package.json +++ b/packages/vtable-plugins/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vtable-plugins", - "version": "1.19.0", + "version": "1.19.1", "description": "The search util of VTable", "author": { "name": "VisActor", diff --git a/packages/vtable-search/package.json b/packages/vtable-search/package.json index 86d0ce0981..4c7e447539 100644 --- a/packages/vtable-search/package.json +++ b/packages/vtable-search/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vtable-search", - "version": "1.19.0", + "version": "1.19.1", "description": "The search util of VTable", "author": { "name": "VisActor", diff --git a/packages/vtable/CHANGELOG.json b/packages/vtable/CHANGELOG.json index 5a8205bb56..373647e1ff 100644 --- a/packages/vtable/CHANGELOG.json +++ b/packages/vtable/CHANGELOG.json @@ -1,6 +1,27 @@ { "name": "@visactor/vtable", "entries": [ + { + "version": "1.19.1", + "tag": "@visactor/vtable_v1.19.1", + "date": "Fri, 20 Jun 2025 12:11:39 GMT", + "comments": { + "none": [ + { + "comment": "feat: add containerFit #3337\n\n" + }, + { + "comment": "chore: update vrender 1.0.4 fix animation bug\n\n" + }, + { + "comment": "fix: copy not work when after copy tooltip text #3968\n\n" + }, + { + "comment": "fix: fix the issue where the icon configuration is not effective when cellType is progressBar #4047\n\n" + } + ] + } + }, { "version": "1.19.0", "tag": "@visactor/vtable_v1.19.0", diff --git a/packages/vtable/CHANGELOG.md b/packages/vtable/CHANGELOG.md index 71af361b18..a05453e0b8 100644 --- a/packages/vtable/CHANGELOG.md +++ b/packages/vtable/CHANGELOG.md @@ -1,6 +1,24 @@ # Change Log - @visactor/vtable -This log was last generated on Mon, 16 Jun 2025 12:04:55 GMT and should not be manually modified. +This log was last generated on Fri, 20 Jun 2025 12:11:39 GMT and should not be manually modified. + +## 1.19.1 +Fri, 20 Jun 2025 12:11:39 GMT + +### Updates + +- feat: add containerFit #3337 + + +- chore: update vrender 1.0.4 fix animation bug + + +- fix: copy not work when after copy tooltip text #3968 + + +- fix: fix the issue where the icon configuration is not effective when cellType is progressBar #4047 + + ## 1.19.0 Mon, 16 Jun 2025 12:04:55 GMT diff --git a/packages/vtable/package.json b/packages/vtable/package.json index d83b86f1d7..794e2c2fd8 100644 --- a/packages/vtable/package.json +++ b/packages/vtable/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vtable", - "version": "1.19.0", + "version": "1.19.1", "description": "canvas table width high performance", "keywords": [ "grid", @@ -130,4 +130,4 @@ "url": "https://github.com/VisActor/VTable.git", "directory": "packages/vtable" } -} \ No newline at end of file +} diff --git a/packages/vue-vtable/package.json b/packages/vue-vtable/package.json index 5752c83aba..35a764d4bd 100644 --- a/packages/vue-vtable/package.json +++ b/packages/vue-vtable/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vue-vtable", - "version": "1.19.0", + "version": "1.19.1", "description": "The vue version of VTable", "keywords": [ "vue",