diff --git a/common/changes/@visactor/vtable/4935-bug-dimensionValue-null-indicatorValue_2026-01-22-07-49.json b/common/changes/@visactor/vtable/4935-bug-dimensionValue-null-indicatorValue_2026-01-22-07-49.json new file mode 100644 index 000000000..12b6a9a38 --- /dev/null +++ b/common/changes/@visactor/vtable/4935-bug-dimensionValue-null-indicatorValue_2026-01-22-07-49.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: when dimension value is empty string should different from no dimension value #4935\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/4935-bug-dimensionValue-null-indicatorValue_2026-01-27-11-41.json b/common/changes/@visactor/vtable/4935-bug-dimensionValue-null-indicatorValue_2026-01-27-11-41.json new file mode 100644 index 000000000..c476bdfe1 --- /dev/null +++ b/common/changes/@visactor/vtable/4935-bug-dimensionValue-null-indicatorValue_2026-01-27-11-41.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: when no columnTree to adjust columnWidthConfig #4935\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 69f3a0e0a..44b0749de 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -307,10 +307,10 @@ importers: '@types/react-dom': ^18.0.0 '@visactor/vchart': 2.0.13-alpha.10 '@visactor/vdataset': ~1.0.17 - '@visactor/vrender-animate': ~1.0.39 - '@visactor/vrender-components': ~1.0.39 - '@visactor/vrender-core': ~1.0.39 - '@visactor/vrender-kits': ~1.0.39 + '@visactor/vrender-animate': ~1.0.40 + '@visactor/vrender-components': ~1.0.40 + '@visactor/vrender-core': ~1.0.40 + '@visactor/vrender-kits': ~1.0.40 '@visactor/vscale': ~1.0.17 '@visactor/vtable-editors': workspace:* '@visactor/vutils': ~1.0.17 @@ -357,10 +357,10 @@ importers: vite-plugin-markdown: ^2.1.0 dependencies: '@visactor/vdataset': 1.0.21 - '@visactor/vrender-animate': 1.0.39 - '@visactor/vrender-components': 1.0.39 - '@visactor/vrender-core': 1.0.39 - '@visactor/vrender-kits': 1.0.39 + '@visactor/vrender-animate': 1.0.40 + '@visactor/vrender-components': 1.0.40 + '@visactor/vrender-core': 1.0.40 + '@visactor/vrender-kits': 1.0.40 '@visactor/vscale': 1.0.21 '@visactor/vtable-editors': link:../vtable-editors '@visactor/vutils': 1.0.21 @@ -4329,10 +4329,10 @@ packages: '@visactor/vrender-core': 1.0.37-alpha.1 '@visactor/vutils': 1.0.21 - /@visactor/vrender-animate/1.0.39: - resolution: {integrity: sha512-u8iNccWTlszdVoGFqHjLRXiVjHefZKcnQIGod0xrNx4/vaV/OCJZD/+7EvUUyoFYLZPCqafOcBtZh9jRr8cAYQ==} + /@visactor/vrender-animate/1.0.40: + resolution: {integrity: sha512-/OT+xKwTdRa+bhTF28mQxl+9HsaIncNFGv00G3m2EHQT7Ls8SCDAyD46J36+bU3eYKz/+V+CzL2ApwI/zXP8/A==} dependencies: - '@visactor/vrender-core': 1.0.39 + '@visactor/vrender-core': 1.0.40 '@visactor/vutils': 1.0.21 dev: false @@ -4345,12 +4345,12 @@ packages: '@visactor/vscale': 1.0.21 '@visactor/vutils': 1.0.21 - /@visactor/vrender-components/1.0.39: - resolution: {integrity: sha512-i/j16Rf6/mPiA4LZvvXJi0PvDFBCbcI/gSEV2JX6QTZmMWhXOgRZ2mA4kyqQVD4rNIyyXJEmIeVKsgPM0+3Qlw==} + /@visactor/vrender-components/1.0.40: + resolution: {integrity: sha512-+mooyFfpAaAjhBDN5XHKz1SH0vHe3IjabLJQWYwDZGvpPHieVIlZstkTIRMH63pJek0ViIZLHcxpf/i/qli+sw==} dependencies: - '@visactor/vrender-animate': 1.0.39 - '@visactor/vrender-core': 1.0.39 - '@visactor/vrender-kits': 1.0.39 + '@visactor/vrender-animate': 1.0.40 + '@visactor/vrender-core': 1.0.40 + '@visactor/vrender-kits': 1.0.40 '@visactor/vscale': 1.0.21 '@visactor/vutils': 1.0.21 dev: false @@ -4361,8 +4361,8 @@ packages: '@visactor/vutils': 1.0.21 color-convert: 2.0.1 - /@visactor/vrender-core/1.0.39: - resolution: {integrity: sha512-+TrkiSt14qPzW2k8GlKt5gcNItFwfha+MnJa5TO7i6pu+rnzmjsStku5ZXyLEbEXzRLoUGGg13UoEznFqitawA==} + /@visactor/vrender-core/1.0.40: + resolution: {integrity: sha512-VNfxYGvNS2k1v2/+H0y9jIxjsFjgy3ieFGTDYz+o1rES2RY4wQIr6xJtdEkzXg6Foavp1gJj4fSf/wl2idEuTA==} dependencies: '@visactor/vutils': 1.0.21 color-convert: 2.0.1 @@ -4378,11 +4378,11 @@ packages: lottie-web: 5.13.0 roughjs: 4.6.6 - /@visactor/vrender-kits/1.0.39: - resolution: {integrity: sha512-cF/4sC0xHYQhQklstp5EwH6Td0pd9cy2kpFzPXrTwDJTr2Eqk9sU5sq6gCpqPnL0fWDZfSyJmJ7tM9ffDmcxHQ==} + /@visactor/vrender-kits/1.0.40: + resolution: {integrity: sha512-tMD2C4vQd5kN2WyDIkel4tId1NYGclKM1exIsJY51rgOjfJsjpRzC5WPe6KYqoIcDO5xDarX8TY4dkTR9S0l6w==} dependencies: '@resvg/resvg-js': 2.4.1 - '@visactor/vrender-core': 1.0.39 + '@visactor/vrender-core': 1.0.40 '@visactor/vutils': 1.0.21 gifuct-js: 2.1.2 lottie-web: 5.13.0 @@ -4425,7 +4425,7 @@ packages: '@babel/plugin-transform-react-jsx-source': 7.27.1_@babel+core@7.20.12 magic-string: 0.27.0 react-refresh: 0.14.2 - vite: 3.2.6_wh2vlhhdn57zo4wnvlhe274kvm + vite: 3.2.6 transitivePeerDependencies: - supports-color dev: true diff --git a/docs/assets/option/en/common/pivot-corner.md b/docs/assets/option/en/common/pivot-corner.md index 4f31f140c..ff8629189 100644 --- a/docs/assets/option/en/common/pivot-corner.md +++ b/docs/assets/option/en/common/pivot-corner.md @@ -33,3 +33,6 @@ Header cell style, the configuration items vary slightly depending on the header - For headerType 'text', refer to [headerStyle](../option/PivotTable-columns-text#headerStyle.bgColor) - For headerType 'link', refer to [headerStyle](../option/PivotTable-columns-link#headerStyle.bgColor) - For headerType 'image', refer to [headerStyle](../option/PivotTable-columns-image#headerStyle.bgColor) + + ${prefix} forceShowHeader(boolean) + Force display of corner header. When there are no dimensions in the row or column direction, the corner header will not be displayed by default. However, in some scenarios, it is still necessary to display the dimension name in the corner header, please configure this field. \ No newline at end of file diff --git a/docs/assets/option/zh/common/pivot-corner.md b/docs/assets/option/zh/common/pivot-corner.md index ec7ced6d9..9f07c2533 100644 --- a/docs/assets/option/zh/common/pivot-corner.md +++ b/docs/assets/option/zh/common/pivot-corner.md @@ -33,3 +33,6 @@ ${prefix} headerStyle(TODO) - headerType 为'text',对应[headerStyle](../option/PivotTable-columns-text#headerStyle.bgColor) - headerType 为'link',对应[headerStyle](../option/PivotTable-columns-link#headerStyle.bgColor) - headerType 为'image',对应[headerStyle](../option/PivotTable-columns-image#headerStyle.bgColor) + + ${prefix} forceShowHeader(boolean) + 强制显示角头。当row或者column方向上没有维度的时候 本身是不会显示角表头的 但是某些场景下仍然需显示维度名称在角头,请配置这个字段。 \ No newline at end of file diff --git a/packages/vtable-sheet/src/components/vtable-sheet.ts b/packages/vtable-sheet/src/components/vtable-sheet.ts index 46d951377..04eec7fe3 100644 --- a/packages/vtable-sheet/src/components/vtable-sheet.ts +++ b/packages/vtable-sheet/src/components/vtable-sheet.ts @@ -1117,49 +1117,4 @@ export default class VTableSheet { // this.rootElement.style.height = `${this.getOptions().height || containerHeight}px`; this.getActiveSheet()?.resize(); } - - /** - * 若所选范围包含当前正在编辑的单元格,自动排除该单元格以避免 #CYCLE! - */ - excludeEditCellFromSelection( - range: { startRow: number; startCol: number; endRow: number; endCol: number }, - editRow: number, - editCol: number - ) { - const r = { ...range }; - const withinRow = r.startRow <= editRow && editRow <= r.endRow; - const withinCol = r.startCol <= editCol && editCol <= r.endCol; - if (!withinRow || !withinCol) { - return r; - } - - const rowSpan = r.endRow - r.startRow; - const colSpan = r.endCol - r.startCol; - - // 如果选择范围就是编辑单元格本身,返回空范围(表示无效选择) - if (rowSpan === 0 && colSpan === 0 && r.startRow === editRow && r.startCol === editCol) { - return { startRow: -1, startCol: -1, endRow: -1, endCol: -1 }; - } - - if (rowSpan >= colSpan) { - // 优先在行方向上排除编辑单元格 - if (editRow === r.startRow && r.startRow < r.endRow) { - r.startRow += 1; - } else if (editRow === r.endRow && r.startRow < r.endRow) { - r.endRow -= 1; - } else if (r.startRow < r.endRow) { - r.startRow += 1; - } // 中间,默认从起点缩一格 - } else { - // 优先在列方向上排除编辑单元格 - if (editCol === r.startCol && r.startCol < r.endCol) { - r.startCol += 1; - } else if (editCol === r.endCol && r.startCol < r.endCol) { - r.endCol -= 1; - } else if (r.startCol < r.endCol) { - r.startCol += 1; - } - } - return r; - } } diff --git a/packages/vtable/package.json b/packages/vtable/package.json index a5b1c2159..9344ebce3 100644 --- a/packages/vtable/package.json +++ b/packages/vtable/package.json @@ -53,10 +53,10 @@ }, "dependencies": { "@visactor/vtable-editors": "workspace:*", - "@visactor/vrender-core": "~1.0.39", - "@visactor/vrender-kits": "~1.0.39", - "@visactor/vrender-components": "~1.0.39", - "@visactor/vrender-animate": "~1.0.39", + "@visactor/vrender-core": "~1.0.40", + "@visactor/vrender-kits": "~1.0.40", + "@visactor/vrender-components": "~1.0.40", + "@visactor/vrender-animate": "~1.0.40", "@visactor/vutils": "~1.0.17", "@visactor/vscale": "~1.0.17", "@visactor/vdataset": "~1.0.17", @@ -133,4 +133,4 @@ "url": "https://github.com/VisActor/VTable.git", "directory": "packages/vtable" } -} +} \ No newline at end of file diff --git a/packages/vtable/src/layout/pivot-header-layout.ts b/packages/vtable/src/layout/pivot-header-layout.ts index d147b5c9d..c05a9dacb 100644 --- a/packages/vtable/src/layout/pivot-header-layout.ts +++ b/packages/vtable/src/layout/pivot-header-layout.ts @@ -3518,8 +3518,8 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { (this.rowDimensionKeys.indexOf(this.indicatorDimensionKey) >= 0 && path.indicatorKey) ); } else { - colHeaderPaths = dimensionPaths.colHeaderPaths; - rowHeaderPaths = dimensionPaths.rowHeaderPaths; + colHeaderPaths = dimensionPaths?.colHeaderPaths; + rowHeaderPaths = dimensionPaths?.rowHeaderPaths; if (dimensionPaths?.cellLocation === 'body' && this._table.isPivotTable()) { forceBody = true; } diff --git a/packages/vtable/src/scenegraph/layout/compute-col-width.ts b/packages/vtable/src/scenegraph/layout/compute-col-width.ts index e8d869f40..9dcca9a9a 100644 --- a/packages/vtable/src/scenegraph/layout/compute-col-width.ts +++ b/packages/vtable/src/scenegraph/layout/compute-col-width.ts @@ -872,6 +872,14 @@ function _parseColumnWidthConfigForPivotTable( table._setColWidth(cell.col, width); table.internalProps._widthResizedColMap.add(cell.col); // add resize tag } + } else if ( + (!dimensions || dimensions.length === 0) && + (table.internalProps.layoutMap.columnTree?.length ?? 0) === 0 + ) { + if (!table.internalProps._widthResizedColMap.has(table.rowHeaderLevelCount)) { + table._setColWidth(table.rowHeaderLevelCount, width); + table.internalProps._widthResizedColMap.add(table.rowHeaderLevelCount); // add resize tag + } } } } diff --git a/packages/vtable/src/tools/join.ts b/packages/vtable/src/tools/join.ts index a72ebbeb6..26c7084e9 100644 --- a/packages/vtable/src/tools/join.ts +++ b/packages/vtable/src/tools/join.ts @@ -1,5 +1,8 @@ export function join(strArr: string[], joinChar: string) { // return strArr.join(joinChar); + if (strArr.length === 0) { + return undefined; + } let str = ''; for (let i = 0; i < strArr.length; i++) { str += strArr[i];