Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync from develop to pivot_chart branch #139

Merged
merged 6 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/vtable/examples/style/function.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as VTable from '../../src';
const PivotTable = VTable.PivotTable;
const Table_CONTAINER_DOM_ID = 'vTable';
import { bindDebugTool } from '../../src/scenegraph/debug-tool';

function generatePivotDataSource(num, colCount) {
const array = new Array(num);
Expand Down Expand Up @@ -478,7 +479,7 @@ export function createTable() {
instance.updatePivotSortState([{ dimensions: e.dimensionInfo, order }]);
});

VTable.bindDebugTool(instance.scenegraph.stage as any, {
bindDebugTool(instance.scenegraph.stage as any, {
customGrapicKeys: ['role', '_updateTag']
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Basic Features
title: 自动换行
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/auto-wrap-text.gif
order: 3-1
link: '/guide/basic_function/auto_wrap_text'
---

# 自动换行
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Basic Features
title: 冻结列
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/frozen-col.gif
order: 3-3
link: '/guide/basic_function/frozen_column'
---

# 冻结列
Expand Down
1 change: 1 addition & 0 deletions packages/vtable/site-demo/basic-functionality/sort.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Basic Features
title: 排序
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/sort.gif
order: 3-2
link: '/guide/basic_function/sort'
---

# 排序
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Basic Features
title: 适应容器宽度
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/width-mode-adaptive.png
order: 3-5
link: '/guide/basic_function/row_height_column_width'
---

# 列宽模式-适应容器宽度
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Basic Features
title: 列宽适应内容
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/width-mode-autoWidth.png
order: 3-6
link: '/guide/basic_function/row_height_column_width'
---

# 列宽模式-适应内容
Expand Down
1 change: 1 addition & 0 deletions packages/vtable/site-demo/cell-type/multi-type.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Cell Type
title: 单元格内容类型
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/multi-type.png
order: 2-1
link: '/guide/column_type/columnType'
---

# 单元格内容类型
Expand Down
1 change: 1 addition & 0 deletions packages/vtable/site-demo/cell-type/progressbar.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Cell Type
title: 数据条类型
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/progressbar.png
order: 2-2
link: '/guide/column_type/progressbar'
---

# 数据条类型
Expand Down
1 change: 1 addition & 0 deletions packages/vtable/site-demo/component/scrollbar.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Component
title: 滚动条
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/scrollbar.png
order: 8-3
link: '/guide/interaction_and_event/scroll'
---

# 滚动条
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Custom
title: 单元格自定义布局
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/custom-cell-layout.png
order: 7-1
link: '/guide/custom_define/custom_layout'
---

# 单元格自定义布局
Expand Down
1 change: 1 addition & 0 deletions packages/vtable/site-demo/custom-render/custom-icon.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Custom
title: 自定义图标
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/custom-icon.png
order: 7-2
link: '/guide/custom_define/custom_icon'
---

# 自定义图标
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Custom
title: 单元格自定义内容
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/custom-render-global.png
order: 7-3
link: '/guide/custom_define/custom_render'
---

# 单元格自定义内容
Expand Down
1 change: 1 addition & 0 deletions packages/vtable/site-demo/custom-render/custom-render.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Custom
title: 单元格自定义内容
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/custom-render.png
order: 7-4
link: '/guide/custom_define/custom_render'
---

# 单元格自定义内容
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Interaction
title: hover行列十字高亮
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/hover-cross.png
order: 4-3
link: '/guide/interaction_and_event/hover_cell'
---

# hover行列十字高亮
Expand Down
1 change: 1 addition & 0 deletions packages/vtable/site-demo/interaction/hover-inline-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Interaction
title: hover高亮整行
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/hover-row.png
order: 4-2
link: '/guide/interaction_and_event/hover_cell'
---

# hover高亮整行
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Interaction
title: 移动表头位置
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/move-header-position.gif
order: 4-5
link: '/guide/interaction_and_event/drag_header'
---

# 移动表头位置
Expand Down
1 change: 1 addition & 0 deletions packages/vtable/site-demo/interaction/resize-col-width.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Interaction
title: 调整列宽
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/resize-col-width.gif
order: 4-4
link: '/guide/interaction_and_event/resize_column_width'
---

# 调整列宽
Expand Down
1 change: 1 addition & 0 deletions packages/vtable/site-demo/interaction/select.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Interaction
title: 选择单元格
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/select.png
order: 4-1
link: '/guide/interaction_and_event/select'
---

# 选择单元格
Expand Down
3 changes: 2 additions & 1 deletion packages/vtable/site-demo/style/style.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
category: examples
group: table-type pivot-table
group: Style
title: 样式
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/style.png
order: 5-1
link: '/guide/theme_and_style/style'
---

# 样式
Expand Down
1 change: 1 addition & 0 deletions packages/vtable/site-demo/table-type/list-table-tree.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: table-type
title: 基本表格树形展示
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/list-tree.png
order: 1-2
link: '/guide/table_type/List_table/tree_list'
---

# 基本表格树形展示
Expand Down
1 change: 1 addition & 0 deletions packages/vtable/site-demo/table-type/list-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: table-type
title: 基本表格
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/list-table.png
order: 1-1
link: '/guide/table_type/List_table/list_table_define_and_generate'
---

# 基本表格
Expand Down
1 change: 1 addition & 0 deletions packages/vtable/site-demo/table-type/pivot-table-tree.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: table-type
title: 透视表格树形展示
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/pivot-tree.png
order: 1-5
link: '/guide/table_type/Pivot_table/pivot_table_tree'
---

# 透视表格
Expand Down
1 change: 1 addition & 0 deletions packages/vtable/site-demo/table-type/pivot-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: table-type
title: 透视表格
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/pivot-table.png
order: 1-4
link: '/guide/table_type/Pivot_table/pivot_table_useage'
---

# 透视表格
Expand Down
1 change: 1 addition & 0 deletions packages/vtable/site-demo/table-type/transpose-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: table-type
title: 转置表格
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/transpose.png
order: 1-3
link: '/guide/table_type/List_table/list_table_transpose'
---

# 转置表格
Expand Down
1 change: 1 addition & 0 deletions packages/vtable/site-demo/theme/arco.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Theme
title: 表格主题-ARCO
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/arco.png
order: 6-1
link: '/guide/theme_and_style/theme'
---

# 表格主题-ARCO
Expand Down
1 change: 1 addition & 0 deletions packages/vtable/site-demo/theme/bright.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Theme
title: 表格主题-BIGTHT
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/bright.png
order: 6-2
link: '/guide/theme_and_style/theme'
---

# 表格主题-BIGTHT
Expand Down
1 change: 1 addition & 0 deletions packages/vtable/site-demo/theme/custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Theme
title: 表格主题-custom
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/custom.png
order: 6-6
link: '/guide/theme_and_style/theme'
---

# 表格主题-custom
Expand Down
1 change: 1 addition & 0 deletions packages/vtable/site-demo/theme/dark.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Theme
title: 表格主题-DARK
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/dark.png
order: 6-3
link: '/guide/theme_and_style/theme'
---

# 表格主题-DARK
Expand Down
1 change: 1 addition & 0 deletions packages/vtable/site-demo/theme/default.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Theme
title: 表格主题-DEFAULT
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/default.png
order: 6-0
link: '/guide/theme_and_style/theme'
---

# 表格主题-DEFAULT
Expand Down
1 change: 1 addition & 0 deletions packages/vtable/site-demo/theme/extend.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Theme
title: 表格主题-extends
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/extend.png
order: 6-5
link: '/guide/theme_and_style/theme'
---

# 表格主题-extends
Expand Down
1 change: 1 addition & 0 deletions packages/vtable/site-demo/theme/register.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Theme
title: 表格主题-register
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/register.png
order: 6-7
link: '/guide/theme_and_style/theme'
---

# 表格主题-register
Expand Down
1 change: 1 addition & 0 deletions packages/vtable/site-demo/theme/simplify.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group: Theme
title: 表格主题-SIMPLIFY
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/simplify.png
order: 6-4
link: '/guide/theme_and_style/theme'
---

# 表格主题-SIMPLIFY
Expand Down
2 changes: 0 additions & 2 deletions packages/vtable/src/scenegraph/group-creater/cell-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,6 @@ export function updateCell(col: number, row: number, table: BaseTableAPI, addNew
col,
row,
bgColorFunc,
customRender,
customLayout,
cellWidth,
cellHeight,
oldCellGroup,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export function createComplexColumn(
for (let j = rowStart; j <= rowEnd; j++) {
const row = j;
const define = cellType !== 'body' ? table.getHeaderDefine(col, row) : table.getBodyColumnDefine(col, row);
const mayHaveIcon = cellType !== 'body' ? true : !!define?.icon;
const mayHaveIcon = cellType !== 'body' ? true : !!define?.icon || !!define?.tree;
const headerStyle = table._getCellStyle(col, row);
const cellTheme = getStyleTheme(headerStyle, table, col, row, getProp).theme;
cellTheme.group.width = colWidth;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,9 @@ export class SceneProxy {
if (row < rowStart || row > rowEnd) {
return emptyGroup;
}
if (row < this.rowStart || row > this.rowEnd || col < this.colStart || col > this.colEnd) {
return emptyGroup;
}
if (this.cellCache.get(col)) {
const cacheCellGoup = this.cellCache.get(col);
if ((cacheCellGoup._next || cacheCellGoup._prev) && Math.abs(cacheCellGoup.row - row) < row) {
Expand Down
3 changes: 2 additions & 1 deletion packages/vtable/src/scenegraph/layout/compute-row-height.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ function computeTextHeight(col: number, row: number, table: BaseTableAPI): numbe
let iconInlineFrontHeight = 0;
const iconInlineEnd: ColumnIconOption[] = [];
let iconInlineEndHeight = 0;
const mayHaveIcon = table.getCellType(col, row) !== 'body' ? true : !!table.getBodyColumnDefine(col, row)?.icon;
const define = table.getBodyColumnDefine(col, row);
const mayHaveIcon = table.getCellType(col, row) !== 'body' ? true : !!define?.icon || !!define?.tree;
if (mayHaveIcon) {
const icons = table.getCellIcons(col, row);
icons?.forEach(icon => {
Expand Down
8 changes: 6 additions & 2 deletions packages/vtable/src/scenegraph/scenegraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -670,10 +670,14 @@ export class Scenegraph {
computeColsWidth(this.table, 0, this.table.colCount - 1, true);
}

recalculateRowHeights() {
computeRowsHeight(this.table, 0, this.table.rowCount - 1);
}

resize() {
this.recalculateColWidths();
if (this.table.internalProps.autoRowHeight) {
updateAutoRowHeight(this, true);
this.recalculateRowHeights();
}
this.dealWidthMode();
this.dealFrozen();
Expand Down Expand Up @@ -1349,7 +1353,7 @@ export class Scenegraph {
// update column width and row height
this.recalculateColWidths();
if (this.table.internalProps.autoRowHeight) {
updateAutoRowHeight(this, true);
this.recalculateRowHeights();
}

// check frozen status
Expand Down
Loading