From c18bb760546dad407f82c759070ae157de686940 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Mon, 8 Jan 2024 18:19:39 +0800 Subject: [PATCH 001/115] feat: add NumberRangeMap --- .../vtable/__tests__/listTable-1W.test.ts | 2 +- packages/vtable/examples/list/list-100w.ts | 1 + packages/vtable/src/core/BaseTable.ts | 71 +++++----- packages/vtable/src/layout/row-height-map.ts | 124 ++++++++++++++++++ .../group-creater/progress/proxy.ts | 9 +- .../progress/update-position/dynamic-set-y.ts | 9 +- .../update-position/update-auto-row.ts | 15 ++- 7 files changed, 191 insertions(+), 40 deletions(-) create mode 100644 packages/vtable/src/layout/row-height-map.ts diff --git a/packages/vtable/__tests__/listTable-1W.test.ts b/packages/vtable/__tests__/listTable-1W.test.ts index aa5219851..5a6504ffc 100644 --- a/packages/vtable/__tests__/listTable-1W.test.ts +++ b/packages/vtable/__tests__/listTable-1W.test.ts @@ -235,6 +235,6 @@ describe('listTable-1W init test', () => { test('listTable-1W update heightMode', () => { listTable.heightMode = 'autoHeight'; listTable.renderWithRecreateCells(); - expect(listTable.getAllRowsHeight()).toBe(340072); + expect(listTable.getAllRowsHeight()).toBe(340076); // 340072 }); }); diff --git a/packages/vtable/examples/list/list-100w.ts b/packages/vtable/examples/list/list-100w.ts index ed850d3f1..7102a0dfb 100644 --- a/packages/vtable/examples/list/list-100w.ts +++ b/packages/vtable/examples/list/list-100w.ts @@ -180,4 +180,5 @@ export function createTable() { console.log('initialized'); }); window.tableInstance = tableInstance; + bindDebugTool(tableInstance.scenegraph.stage, { customGrapicKeys: ['col', 'row'] }); } diff --git a/packages/vtable/src/core/BaseTable.ts b/packages/vtable/src/core/BaseTable.ts index f241b1647..07baa4e38 100644 --- a/packages/vtable/src/core/BaseTable.ts +++ b/packages/vtable/src/core/BaseTable.ts @@ -91,6 +91,7 @@ import { Title } from '../components/title/title'; import type { Chart } from '../scenegraph/graphic/chart'; import { setBatchRenderChartCount } from '../scenegraph/graphic/contributions/chart-render-helper'; import { isLeftOrRightAxis, isTopOrBottomAxis } from '../layout/chart-helper/get-axis-config'; +import { NumberRangeMap } from '../layout/row-height-map'; const { toBoxArray } = utilStyle; const { isTouchEvent } = event; const rangeReg = /^\$(\d+)\$(\d+)$/; @@ -153,6 +154,8 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { container: HTMLElement; isReleased: boolean = false; _chartEventMap: Record = {}; + + _newRowHeightsMap: NumberRangeMap; constructor(container: HTMLElement, options: BaseTableConstructorOptions = {}) { super(); if (!container && options.mode !== 'node') { @@ -264,6 +267,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { setBatchRenderChartCount(renderChartAsyncBatchCount); internalProps.overscrollBehavior = overscrollBehavior ?? 'auto'; internalProps._rowHeightsMap = new NumberMap(); + this._newRowHeightsMap = new NumberRangeMap(this); internalProps._rowRangeHeightsMap = new Map(); internalProps._colRangeWidthsMap = new Map(); internalProps._widthResizedColMap = new Set(); @@ -901,8 +905,8 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { // : this.defaultHeaderRowHeight // : this.internalProps.defaultRowHeight) // ); - if (this.rowHeightsMap.get(row)) { - return this.rowHeightsMap.get(row); + if (this._newRowHeightsMap.get(row)) { + return this._newRowHeightsMap.get(row); } const defaultHeight = this.getDefaultRowHeight(row); if (isNumber(defaultHeight)) { @@ -932,7 +936,8 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { * @returns */ _setRowHeight(row: number, height: number, clearCache?: boolean): void { - this.rowHeightsMap.put(row, Math.round(height)); + // this.rowHeightsMap.put(row, Math.round(height)); + this._newRowHeightsMap.put(row, Math.round(height)); // 清楚影响缓存 if (clearCache) { this._clearRowRangeHeightsMap(row); @@ -946,29 +951,29 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { */ getRowsHeight(startRow: number, endRow: number): number { //通过缓存获取指定范围行高 - const cachedRowHeight = this._rowRangeHeightsMap.get(`$${startRow}$${endRow}`); - if (cachedRowHeight !== null && cachedRowHeight !== undefined) { - return cachedRowHeight; - } - //特殊处理 先尝试获取startRow->endRow-1的行高 - const cachedLowerRowHeight = this._rowRangeHeightsMap.get(`$${startRow}$${endRow - 1}`); - if (cachedLowerRowHeight !== null && cachedLowerRowHeight !== undefined) { - const height = Math.round( - cachedLowerRowHeight + - (this.rowHeightsMap.get(endRow) ?? - (this.isColumnHeader(0, endRow) || this.isCornerHeader(0, endRow) - ? Array.isArray(this.defaultHeaderRowHeight) && isNumber(this.defaultHeaderRowHeight[endRow]) - ? (this.defaultHeaderRowHeight[endRow] as number) - : isNumber(this.defaultHeaderRowHeight) - ? (this.defaultHeaderRowHeight as number) - : this.internalProps.defaultRowHeight - : this.internalProps.defaultRowHeight)) - ); - if (startRow >= 0 && endRow >= 0) { - this._rowRangeHeightsMap.set(`$${startRow}$${endRow}`, Math.round(height)); - } - return height; - } + // const cachedRowHeight = this._rowRangeHeightsMap.get(`$${startRow}$${endRow}`); + // if (cachedRowHeight !== null && cachedRowHeight !== undefined) { + // return cachedRowHeight; + // } + // //特殊处理 先尝试获取startRow->endRow-1的行高 + // const cachedLowerRowHeight = this._rowRangeHeightsMap.get(`$${startRow}$${endRow - 1}`); + // if (cachedLowerRowHeight !== null && cachedLowerRowHeight !== undefined) { + // const height = Math.round( + // cachedLowerRowHeight + + // (this.rowHeightsMap.get(endRow) ?? + // (this.isColumnHeader(0, endRow) || this.isCornerHeader(0, endRow) + // ? Array.isArray(this.defaultHeaderRowHeight) && isNumber(this.defaultHeaderRowHeight[endRow]) + // ? (this.defaultHeaderRowHeight[endRow] as number) + // : isNumber(this.defaultHeaderRowHeight) + // ? (this.defaultHeaderRowHeight as number) + // : this.internalProps.defaultRowHeight + // : this.internalProps.defaultRowHeight)) + // ); + // if (startRow >= 0 && endRow >= 0) { + // this._rowRangeHeightsMap.set(`$${startRow}$${endRow}`, Math.round(height)); + // } + // return height; + // } let h = 0; // for (let i = startRow; i <= endRow; i++) { @@ -996,13 +1001,14 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { // part in body h += this.defaultRowHeight * (endRow - Math.max(this.columnHeaderLevelCount, startRow) + 1); } else { - for (let i = startRow; i <= endRow; i++) { - h += this.getRowHeight(i); - } - } - if (startRow >= 0 && endRow >= 0 && h > 0) { - this._rowRangeHeightsMap.set(`$${startRow}$${endRow}`, Math.round(h)); + // for (let i = startRow; i <= endRow; i++) { + // h += this.getRowHeight(i); + // } + h = this._newRowHeightsMap.getSumInRange(startRow, endRow); } + // if (startRow >= 0 && endRow >= 0 && h > 0) { + // this._rowRangeHeightsMap.set(`$${startRow}$${endRow}`, Math.round(h)); + // } // } return Math.round(h); } @@ -1925,6 +1931,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { internalProps.overscrollBehavior = overscrollBehavior ?? 'auto'; internalProps.cellTextOverflows = {}; internalProps._rowHeightsMap = new NumberMap(); + this._newRowHeightsMap = new NumberRangeMap(this); internalProps._rowRangeHeightsMap = new Map(); internalProps._colRangeWidthsMap = new Map(); diff --git a/packages/vtable/src/layout/row-height-map.ts b/packages/vtable/src/layout/row-height-map.ts new file mode 100644 index 000000000..ed85ca65c --- /dev/null +++ b/packages/vtable/src/layout/row-height-map.ts @@ -0,0 +1,124 @@ +import type { BaseTableAPI } from '../ts-types/base-table'; + +export class NumberRangeMap { + data: Map; + cumulativeSum: Map; + difference: Map; + totalSum: number; + table: BaseTableAPI; + isUpdate = false; + + constructor(table: BaseTableAPI) { + this.data = new Map(); + this.cumulativeSum = new Map(); + this.difference = new Map(); + this.totalSum = 0; + this.table = table; + } + + add(position: number, value: number) { + const defaultValue = this.table.getRowHeight(position); + this.data.set(position, value); + this.totalSum += value; + // this.updateCumulativeSum(position, value); + this.updateDifference(position, value - defaultValue); + } + + remove(position: number) { + if (this.data.has(position)) { + const value = this.data.get(position); + this.data.delete(position); + this.totalSum -= value; + const defaultValue = this.table.getRowHeight(position); + // this.updateCumulativeSum(position, -value); + this.updateDifference(position, defaultValue - value); + } + } + + put(position: number, newValue: number) { + if (this.data.has(position)) { + const oldValue = this.data.get(position); + this.data.set(position, newValue); + const difference = newValue - oldValue; + this.totalSum += difference; + // this.updateCumulativeSum(position, difference); + this.updateDifference(position, difference); + } else { + this.add(position, newValue); + } + } + + get(position: number) { + return this.data.get(position); + } + + updateDifference(position: number, difference: number) { + this.difference.set(position, difference); + this.update(); + } + + getSumInRange(start: number, end: number) { + return this.calculatePrefixSum(end) - this.calculatePrefixSum(start - 1); + } + + updateCumulativeSum(position: number, difference: number) { + // 更新累加和 + for (const [pos, sum] of this.cumulativeSum) { + if (pos >= position) { + this.cumulativeSum.set(pos, sum + difference); + } + } + } + + calculatePrefixSum(position: number) { + if (this.cumulativeSum.has(position)) { + let cache = this.cumulativeSum.get(position); + for (const [pos, difference] of this.difference) { + if (pos <= position) { + cache += difference; + } + } + return cache; + } + + this.dealDiffenence(); + return this.getCumulativeSum(position); + } + + getCumulativeSum(position: number) { + let sum = 0; + 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); + } + } + this.cumulativeSum.set(position, sum); + return sum; + } + + update() { + if (this.isUpdate) { + return; + } + this.isUpdate = true; + setTimeout(() => { + this.dealDiffenence(); + this.isUpdate = false; + }, 0); + } + + dealDiffenence() { + for (const [sumPos, sum] of this.cumulativeSum) { + for (const [difPos, difference] of this.difference) { + if (sumPos >= difPos) { + this.cumulativeSum.set(sumPos, sum + difference); + } + } + } + + this.difference.clear(); + } +} diff --git a/packages/vtable/src/scenegraph/group-creater/progress/proxy.ts b/packages/vtable/src/scenegraph/group-creater/progress/proxy.ts index 2824a27f8..1de85c89b 100644 --- a/packages/vtable/src/scenegraph/group-creater/progress/proxy.ts +++ b/packages/vtable/src/scenegraph/group-creater/progress/proxy.ts @@ -509,7 +509,8 @@ export class SceneProxy { this.rowUpdatePos, // rowStart distRow, // rowEnd this.table, - this.rowUpdateDirection + this.rowUpdateDirection, + true ); // row header group updateAutoRow( @@ -518,7 +519,8 @@ export class SceneProxy { this.rowUpdatePos, // rowStart distRow, // rowEnd this.table, - this.rowUpdateDirection + this.rowUpdateDirection, + true ); // right frozen group updateAutoRow( @@ -527,7 +529,8 @@ export class SceneProxy { this.rowUpdatePos, // rowStart distRow, // rowEnd this.table, - this.rowUpdateDirection + this.rowUpdateDirection, + true ); } diff --git a/packages/vtable/src/scenegraph/group-creater/progress/update-position/dynamic-set-y.ts b/packages/vtable/src/scenegraph/group-creater/progress/update-position/dynamic-set-y.ts index d24f7ebb3..93bfd29ee 100644 --- a/packages/vtable/src/scenegraph/group-creater/progress/update-position/dynamic-set-y.ts +++ b/packages/vtable/src/scenegraph/group-creater/progress/update-position/dynamic-set-y.ts @@ -101,7 +101,8 @@ async function moveCell( syncTopRow, // rowStart syncBottomRow, // rowEnd proxy.table, - distEndRow > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up' // 跳转到底部时,从下向上对齐 + distEndRow > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up', // 跳转到底部时,从下向上对齐 + true ); // row header group @@ -111,7 +112,8 @@ async function moveCell( syncTopRow, // rowStart syncBottomRow, // rowEnd proxy.table, - distEndRow > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up' // 跳转到底部时,从下向上对齐 + distEndRow > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up', // 跳转到底部时,从下向上对齐 + true ); // right frozen group @@ -121,7 +123,8 @@ async function moveCell( syncTopRow, // rowStart syncBottomRow, // rowEnd proxy.table, - distEndRow > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up' // 跳转到底部时,从下向上对齐 + distEndRow > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up', // 跳转到底部时,从下向上对齐 + true ); const cellGroup = proxy.table.scenegraph.highPerformanceGetCell(proxy.bodyLeftCol, screenTopRow, true); diff --git a/packages/vtable/src/scenegraph/group-creater/progress/update-position/update-auto-row.ts b/packages/vtable/src/scenegraph/group-creater/progress/update-position/update-auto-row.ts index 21fa63c3c..ddf94fe8d 100644 --- a/packages/vtable/src/scenegraph/group-creater/progress/update-position/update-auto-row.ts +++ b/packages/vtable/src/scenegraph/group-creater/progress/update-position/update-auto-row.ts @@ -7,7 +7,8 @@ export function updateAutoRow( rowStart: number, rowEnd: number, table: BaseTableAPI, - direction: 'up' | 'down' = 'up' + direction: 'up' | 'down' = 'up', + part?: boolean ) { // 更新y位置 if (direction === 'up') { @@ -21,6 +22,12 @@ export function updateAutoRow( if (cellGroup._prev) { // y = ((cellGroup._prev as Group)?.attribute.y ?? 0) + ((cellGroup._prev as Group)?.attribute.height ?? 0); y = (cellGroup._prev as Group)?.attribute.y + table.getRowHeight((cellGroup._prev as Group).row); + } else if (part) { + const baseCellGroup = table.scenegraph.highPerformanceGetCell(col, rowEnd + 1, true); + y = baseCellGroup.attribute.y; + for (let r = rowStart; r <= rowEnd; r++) { + y -= table.getRowHeight(r); + } } else { // 估计位置 y = table.getRowsHeight(table.columnHeaderLevelCount, cellGroup.row - 1); @@ -39,6 +46,12 @@ export function updateAutoRow( if (cellGroup._next) { // y = ((cellGroup._next as Group)?.attribute.y ?? 0) - (cellGroup.attribute.height ?? 0); y = (cellGroup._next as Group)?.attribute.y - table.getRowHeight(cellGroup.row); + } else if (part) { + const baseCellGroup = table.scenegraph.highPerformanceGetCell(col, rowStart - 1, true); + y = baseCellGroup.attribute.y; + for (let r = rowStart; r <= rowEnd; r++) { + y += table.getRowHeight(r); + } } else { // 估计位置 y = table.getRowsHeight(table.columnHeaderLevelCount, cellGroup.row - 1); From b2a17ce85818c00d9163490d0c8f106279c66d5a Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Wed, 10 Jan 2024 16:51:52 +0800 Subject: [PATCH 002/115] fix: add clear in NumberRangeMap --- packages/vtable/src/core/BaseTable.ts | 1 + packages/vtable/src/layout/row-height-map.ts | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/packages/vtable/src/core/BaseTable.ts b/packages/vtable/src/core/BaseTable.ts index cb5584971..b405f09f3 100644 --- a/packages/vtable/src/core/BaseTable.ts +++ b/packages/vtable/src/core/BaseTable.ts @@ -2996,6 +2996,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { */ clearRowHeightCache() { this.internalProps._rowHeightsMap.clear(); + this._newRowHeightsMap.clear(); this._clearRowRangeHeightsMap(); } /** diff --git a/packages/vtable/src/layout/row-height-map.ts b/packages/vtable/src/layout/row-height-map.ts index ed85ca65c..82a5aaf6c 100644 --- a/packages/vtable/src/layout/row-height-map.ts +++ b/packages/vtable/src/layout/row-height-map.ts @@ -16,6 +16,13 @@ export class NumberRangeMap { this.table = table; } + clear() { + this.data.clear(); + this.cumulativeSum.clear(); + this.difference.clear(); + this.totalSum = 0; + } + add(position: number, value: number) { const defaultValue = this.table.getRowHeight(position); this.data.set(position, value); From 22e4534283d92be7ea034da13365a9f0ea74e36f Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Wed, 10 Jan 2024 17:25:43 +0800 Subject: [PATCH 003/115] fix: add NumberRangeMap clear in clearCellStyleCache() --- packages/vtable/__tests__/listTable-1W.test.ts | 2 +- packages/vtable/src/core/BaseTable.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/vtable/__tests__/listTable-1W.test.ts b/packages/vtable/__tests__/listTable-1W.test.ts index 5a6504ffc..aa5219851 100644 --- a/packages/vtable/__tests__/listTable-1W.test.ts +++ b/packages/vtable/__tests__/listTable-1W.test.ts @@ -235,6 +235,6 @@ describe('listTable-1W init test', () => { test('listTable-1W update heightMode', () => { listTable.heightMode = 'autoHeight'; listTable.renderWithRecreateCells(); - expect(listTable.getAllRowsHeight()).toBe(340076); // 340072 + expect(listTable.getAllRowsHeight()).toBe(340072); }); }); diff --git a/packages/vtable/src/core/BaseTable.ts b/packages/vtable/src/core/BaseTable.ts index b405f09f3..a866e1625 100644 --- a/packages/vtable/src/core/BaseTable.ts +++ b/packages/vtable/src/core/BaseTable.ts @@ -2990,6 +2990,8 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { this.headerStyleCache.clear(); this.bodyStyleCache.clear(); this.bodyBottomStyleCache.clear(); + + this._newRowHeightsMap.clear(); } /** * 清除行高度缓存对象 From d98cb8ef3e4c006665f87685f5515cf050bc0a9a Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Wed, 10 Jan 2024 21:08:15 +0800 Subject: [PATCH 004/115] fix: fix updateDifference in NumberRangeMap --- packages/vtable/src/layout/row-height-map.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/vtable/src/layout/row-height-map.ts b/packages/vtable/src/layout/row-height-map.ts index 82a5aaf6c..cc47a1003 100644 --- a/packages/vtable/src/layout/row-height-map.ts +++ b/packages/vtable/src/layout/row-height-map.ts @@ -60,7 +60,8 @@ export class NumberRangeMap { } updateDifference(position: number, difference: number) { - this.difference.set(position, difference); + const oldDifference = this.difference.get(position) ?? 0; + this.difference.set(position, oldDifference + difference); this.update(); } From 839c9e3441e85d85fc295ccab4a795e14e81e15b Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Thu, 11 Jan 2024 15:27:02 +0800 Subject: [PATCH 005/115] fix: add insert&delete in NumberRangeMap --- packages/vtable/src/core/BaseTable.ts | 33 ++++++------ packages/vtable/src/layout/row-height-map.ts | 53 +++++++++++++++++++ .../scenegraph/layout/compute-row-height.ts | 3 +- .../src/scenegraph/layout/update-row.ts | 6 ++- 4 files changed, 76 insertions(+), 19 deletions(-) diff --git a/packages/vtable/src/core/BaseTable.ts b/packages/vtable/src/core/BaseTable.ts index a866e1625..c57d839fa 100644 --- a/packages/vtable/src/core/BaseTable.ts +++ b/packages/vtable/src/core/BaseTable.ts @@ -1149,21 +1149,22 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { * @param row */ _clearRowRangeHeightsMap(row?: number): void { - if (typeof row !== 'number') { - this._rowRangeHeightsMap.clear(); - } else { - const keys = this._rowRangeHeightsMap.keys(); - for (const key of keys) { - const reg = rangeReg.exec(key); - if (reg) { - const start = Number(reg[1]); - const end = Number(reg[2]); - if (row >= start && row <= end) { - this._rowRangeHeightsMap.delete(key); - } - } - } - } + this._newRowHeightsMap.clearRange(); + // if (typeof row !== 'number') { + // this._rowRangeHeightsMap.clear(); + // } else { + // const keys = this._rowRangeHeightsMap.keys(); + // for (const key of keys) { + // const reg = rangeReg.exec(key); + // if (reg) { + // const start = Number(reg[1]); + // const end = Number(reg[2]); + // if (row >= start && row <= end) { + // this._rowRangeHeightsMap.delete(key); + // } + // } + // } + // } } /** * 获取某一列内容的宽度 不关乎该列列宽值有多少 @@ -2991,7 +2992,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { this.bodyStyleCache.clear(); this.bodyBottomStyleCache.clear(); - this._newRowHeightsMap.clear(); + // this._newRowHeightsMap.clear(); } /** * 清除行高度缓存对象 diff --git a/packages/vtable/src/layout/row-height-map.ts b/packages/vtable/src/layout/row-height-map.ts index cc47a1003..a7a7b473d 100644 --- a/packages/vtable/src/layout/row-height-map.ts +++ b/packages/vtable/src/layout/row-height-map.ts @@ -23,6 +23,11 @@ export class NumberRangeMap { this.totalSum = 0; } + clearRange() { + this.cumulativeSum.clear(); + this.difference.clear(); + } + add(position: number, value: number) { const defaultValue = this.table.getRowHeight(position); this.data.set(position, value); @@ -129,4 +134,52 @@ export class NumberRangeMap { this.difference.clear(); } + + insert(position: number, value?: number) { + this.clearRange(); + + const indices = []; + const values = []; + + for (const [pos, value] of this.data) { + if (pos >= position) { + indices.push(pos + 1); + values.push(value); + } + } + + for (let i = 0; i < indices.length; i++) { + this.data.set(indices[i], values[i]); + } + + if (value) { + this.put(position, value); + } + } + + delete(position: number) { + this.clearRange(); + + const indices = []; + const values = []; + let lastIndex = -Infinity; + + for (const [pos, value] of this.data) { + if (pos > position) { + indices.push(pos - 1); + values.push(value); + if (pos > lastIndex) { + lastIndex = pos; + } + } + } + + for (let i = 0; i < indices.length; i++) { + this.data.set(indices[i], values[i]); + } + + if (lastIndex !== -Infinity) { + this.data.delete(lastIndex); + } + } } diff --git a/packages/vtable/src/scenegraph/layout/compute-row-height.ts b/packages/vtable/src/scenegraph/layout/compute-row-height.ts index 0933f502f..b963e29fd 100644 --- a/packages/vtable/src/scenegraph/layout/compute-row-height.ts +++ b/packages/vtable/src/scenegraph/layout/compute-row-height.ts @@ -168,7 +168,8 @@ export function computeRowsHeight( } } } else { - table.rowHeightsMap.clear(); + // table.rowHeightsMap.clear(); + table.clearRowHeightCache(); for (let row = 0; row < table.rowCount; row++) { newHeights[row] = table.getRowHeight(row); } diff --git a/packages/vtable/src/scenegraph/layout/update-row.ts b/packages/vtable/src/scenegraph/layout/update-row.ts index ae93f40b2..adcb84ba2 100644 --- a/packages/vtable/src/scenegraph/layout/update-row.ts +++ b/packages/vtable/src/scenegraph/layout/update-row.ts @@ -28,7 +28,8 @@ export function updateRow( const rowHeightsMap = table.rowHeightsMap; removeRows.forEach(row => { - rowHeightsMap.delAndReorder(row); + // rowHeightsMap.delAndReorder(row); + (scene.table as any)._newRowHeightsMap.delete(row); }); if (removeRows.length) { @@ -42,7 +43,8 @@ export function updateRow( addRows.forEach(row => { const needUpdateAfter = addRow(row, scene); updateAfter = updateAfter ?? needUpdateAfter; - rowHeightsMap.addAndReorder(row); + // rowHeightsMap.addAndReorder(row); + (scene.table as any)._newRowHeightsMap.insert(row); }); // reset attribute y and row number in CellGroup From 1bc3ef8c9be8ca67b04eb56b69934e04a6199fdf Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Thu, 11 Jan 2024 20:51:59 +0800 Subject: [PATCH 006/115] fix: fix order change in NumberRangeMap --- packages/vtable/src/core/BaseTable.ts | 22 ++- packages/vtable/src/layout/row-height-map.ts | 136 ++++++++++++++---- .../src/scenegraph/layout/update-row.ts | 6 +- packages/vtable/src/ts-types/base-table.ts | 6 +- 4 files changed, 121 insertions(+), 49 deletions(-) diff --git a/packages/vtable/src/core/BaseTable.ts b/packages/vtable/src/core/BaseTable.ts index c57d839fa..f344f2b9e 100644 --- a/packages/vtable/src/core/BaseTable.ts +++ b/packages/vtable/src/core/BaseTable.ts @@ -155,7 +155,6 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { isReleased: boolean = false; _chartEventMap: Record = {}; - _newRowHeightsMap: NumberRangeMap; constructor(container: HTMLElement, options: BaseTableConstructorOptions = {}) { super(); if (!container && options.mode !== 'node') { @@ -266,8 +265,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { internalProps.renderChartAsync = renderChartAsync; setBatchRenderChartCount(renderChartAsyncBatchCount); internalProps.overscrollBehavior = overscrollBehavior ?? 'auto'; - internalProps._rowHeightsMap = new NumberMap(); - this._newRowHeightsMap = new NumberRangeMap(this); + internalProps._rowHeightsMap = new NumberRangeMap(this); internalProps._rowRangeHeightsMap = new Map(); internalProps._colRangeWidthsMap = new Map(); internalProps._widthResizedColMap = new Set(); @@ -623,13 +621,13 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { /** * Get the columns width. */ - get rowHeightsMap(): NumberMap { + get rowHeightsMap(): NumberRangeMap { return this.internalProps._rowHeightsMap; } /** * Set the columns width. */ - set rowHeightsMap(rowHeightsMap: NumberMap) { + set rowHeightsMap(rowHeightsMap: NumberRangeMap) { this.internalProps._rowHeightsMap = rowHeightsMap; } /** @@ -905,8 +903,8 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { // : this.defaultHeaderRowHeight // : this.internalProps.defaultRowHeight) // ); - if (this._newRowHeightsMap.get(row)) { - return this._newRowHeightsMap.get(row); + if (this.rowHeightsMap.get(row)) { + return this.rowHeightsMap.get(row); } const defaultHeight = this.getDefaultRowHeight(row); if (isNumber(defaultHeight)) { @@ -937,7 +935,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { */ _setRowHeight(row: number, height: number, clearCache?: boolean): void { // this.rowHeightsMap.put(row, Math.round(height)); - this._newRowHeightsMap.put(row, Math.round(height)); + this.rowHeightsMap.put(row, Math.round(height)); // 清楚影响缓存 if (clearCache) { this._clearRowRangeHeightsMap(row); @@ -1004,7 +1002,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { // for (let i = startRow; i <= endRow; i++) { // h += this.getRowHeight(i); // } - h = this._newRowHeightsMap.getSumInRange(startRow, endRow); + h = this.rowHeightsMap.getSumInRange(startRow, endRow); } // if (startRow >= 0 && endRow >= 0 && h > 0) { // this._rowRangeHeightsMap.set(`$${startRow}$${endRow}`, Math.round(h)); @@ -1149,7 +1147,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { * @param row */ _clearRowRangeHeightsMap(row?: number): void { - this._newRowHeightsMap.clearRange(); + this.rowHeightsMap.clearRange(); // if (typeof row !== 'number') { // this._rowRangeHeightsMap.clear(); // } else { @@ -1931,8 +1929,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { setBatchRenderChartCount(renderChartAsyncBatchCount); internalProps.overscrollBehavior = overscrollBehavior ?? 'auto'; internalProps.cellTextOverflows = {}; - internalProps._rowHeightsMap = new NumberMap(); - this._newRowHeightsMap = new NumberRangeMap(this); + internalProps._rowHeightsMap = new NumberRangeMap(this); internalProps._rowRangeHeightsMap = new Map(); internalProps._colRangeWidthsMap = new Map(); @@ -2999,7 +2996,6 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { */ clearRowHeightCache() { this.internalProps._rowHeightsMap.clear(); - this._newRowHeightsMap.clear(); this._clearRowRangeHeightsMap(); } /** diff --git a/packages/vtable/src/layout/row-height-map.ts b/packages/vtable/src/layout/row-height-map.ts index a7a7b473d..a05606c50 100644 --- a/packages/vtable/src/layout/row-height-map.ts +++ b/packages/vtable/src/layout/row-height-map.ts @@ -1,3 +1,4 @@ +import { isValid } from '@visactor/vutils'; import type { BaseTableAPI } from '../ts-types/base-table'; export class NumberRangeMap { @@ -7,9 +8,12 @@ export class NumberRangeMap { totalSum: number; table: BaseTableAPI; isUpdate = false; + private _keys: number[] = []; + private _sorted = false; constructor(table: BaseTableAPI) { this.data = new Map(); + this._keys.length = 0; this.cumulativeSum = new Map(); this.difference = new Map(); this.totalSum = 0; @@ -30,6 +34,10 @@ export class NumberRangeMap { add(position: number, value: number) { const defaultValue = this.table.getRowHeight(position); + if (!this.data.has(position)) { + this._keys.push(position); + this._sorted = false; + } this.data.set(position, value); this.totalSum += value; // this.updateCumulativeSum(position, value); @@ -40,6 +48,10 @@ export class NumberRangeMap { if (this.data.has(position)) { const value = this.data.get(position); this.data.delete(position); + const index = this._keys.indexOf(position); + if (index !== -1) { + this._keys.splice(index, 1); // 使用 splice() 方法删除指定索引位置的元素 + } this.totalSum -= value; const defaultValue = this.table.getRowHeight(position); // this.updateCumulativeSum(position, -value); @@ -64,6 +76,26 @@ export class NumberRangeMap { return this.data.get(position); } + has(position: number) { + return this.data.has(position); + } + + private _sort() { + const { _keys: keys } = this; + if (!this._sorted) { + keys.sort((a, b) => { + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + return 0; + }); + this._sorted = true; + } + } + updateDifference(position: number, difference: number) { const oldDifference = this.difference.get(position) ?? 0; this.difference.set(position, oldDifference + difference); @@ -135,51 +167,95 @@ export class NumberRangeMap { this.difference.clear(); } + // add and reorder insert(position: number, value?: number) { - this.clearRange(); + const lastIndex = this.getLastIndex(); + this.adjustOrder(position, position + 1, lastIndex - position); + if (isValid(value)) { + this.put(position, value); + } + } - const indices = []; - const values = []; + getLastIndex() { + this._sort(); + return this._keys[this._keys.length - 1]; + } - for (const [pos, value] of this.data) { - if (pos >= position) { - indices.push(pos + 1); - values.push(value); - } - } + delLast() { + const lastIndex = this.getLastIndex(); + this.remove(lastIndex); + } - for (let i = 0; i < indices.length; i++) { - this.data.set(indices[i], values[i]); + // del and reorder + delete(position: number) { + if (!this.has(position)) { + return; } + const lastIndex = this.getLastIndex(); - if (value) { - this.put(position, value); - } + this.adjustOrder(position + 1, position, lastIndex - position); + this.delLast(); } - delete(position: number) { + /** + * 将sourceIndex位置开始 往后moveCount个值 调整到targetIndex位置处 + * @param sourceIndex + * @param targetIndex + * @param moveCount + */ + adjustOrder(sourceIndex: number, targetIndex: number, moveCount: number) { this.clearRange(); + this._sort(); + const { _keys: keys } = this; - const indices = []; - const values = []; - let lastIndex = -Infinity; - - for (const [pos, value] of this.data) { - if (pos > position) { - indices.push(pos - 1); - values.push(value); - if (pos > lastIndex) { - lastIndex = pos; + if (sourceIndex > targetIndex) { + const sourceVals = []; + for (let i = indexFirst(keys, sourceIndex + moveCount - 1); i >= 0; i--) { + const key = keys[i]; + if (key >= sourceIndex) { + sourceVals.push(this.get(key)); + } else if (targetIndex <= key && key < sourceIndex) { + this.put(key + moveCount, this.get(key)); + } else if (key < targetIndex) { + break; } } + for (let i = 0; i < moveCount; i++) { + this.put(targetIndex + i, sourceVals[moveCount - 1 - i]); + } } - - for (let i = 0; i < indices.length; i++) { - this.data.set(indices[i], values[i]); + const { length } = keys; + if (sourceIndex < targetIndex) { + const sourceVals = []; + for (let i = indexFirst(keys, sourceIndex); i < length; i++) { + const key = keys[i]; + if (key >= sourceIndex && key < sourceIndex + moveCount) { + sourceVals.push(this.get(key)); + } else if (sourceIndex + moveCount <= key && key <= targetIndex) { + this.put(key - moveCount, this.get(key)); + } else if (key > targetIndex) { + break; + } + } + for (let i = 0; i < moveCount; i++) { + this.put(targetIndex + i, sourceVals[i]); + } } + } +} - if (lastIndex !== -Infinity) { - this.data.delete(lastIndex); +function indexFirst(arr: number[], elm: number): number { + let low = 0; + let high = arr.length - 1; + while (low <= high) { + const i = Math.floor((low + high) / 2); + if (arr[i] === elm) { + return i; + } else if (arr[i] > elm) { + high = i - 1; + } else { + low = i + 1; } } + return high < 0 ? 0 : high; } diff --git a/packages/vtable/src/scenegraph/layout/update-row.ts b/packages/vtable/src/scenegraph/layout/update-row.ts index adcb84ba2..826b39d4e 100644 --- a/packages/vtable/src/scenegraph/layout/update-row.ts +++ b/packages/vtable/src/scenegraph/layout/update-row.ts @@ -28,8 +28,7 @@ export function updateRow( const rowHeightsMap = table.rowHeightsMap; removeRows.forEach(row => { - // rowHeightsMap.delAndReorder(row); - (scene.table as any)._newRowHeightsMap.delete(row); + rowHeightsMap.delete(row); }); if (removeRows.length) { @@ -43,8 +42,7 @@ export function updateRow( addRows.forEach(row => { const needUpdateAfter = addRow(row, scene); updateAfter = updateAfter ?? needUpdateAfter; - // rowHeightsMap.addAndReorder(row); - (scene.table as any)._newRowHeightsMap.insert(row); + rowHeightsMap.insert(row); }); // reset attribute y and row number in CellGroup diff --git a/packages/vtable/src/ts-types/base-table.ts b/packages/vtable/src/ts-types/base-table.ts index 726cfa08f..94e2a0b01 100644 --- a/packages/vtable/src/ts-types/base-table.ts +++ b/packages/vtable/src/ts-types/base-table.ts @@ -66,6 +66,7 @@ import type { Title } from '../components/title/title'; import type { ITitle } from './component/title'; import type { DiscreteTableLegend } from '../components/legend/discrete-legend/discrete-legend'; import type { ContinueTableLegend } from '../components/legend/continue-legend/continue-legend'; +import type { NumberRangeMap } from '../layout/row-height-map'; export interface IBaseTableProtected { element: HTMLElement; @@ -100,7 +101,7 @@ export interface IBaseTableProtected { cachedRecordsRowHeightMap: NumberMap; //存储每一条记录对应行的行高,只有当设置为自动换行随内容撑开才会起作用 // headerRowHeightsMap: NumberMap; //目前是用来存储了表头各行的高度,从headerRowHeight计算而来,headerRowHeight可以设置为数组的形式 - _rowHeightsMap: NumberMap; //存储数据条目每行高度 + _rowHeightsMap: NumberRangeMap; //存储数据条目每行高度 _colWidthsMap: NumberMap; //存储各列的宽度 _colContentWidthsMap: NumberMap; //存储各列的内容宽度 _colWidthsLimit: { @@ -437,7 +438,8 @@ export interface BaseTableAPI { isReleased: boolean; - rowHeightsMap: NumberMap; + // rowHeightsMap: NumberMap; + rowHeightsMap: NumberRangeMap; colWidthsMap: NumberMap; on: ( From 95a9b364790874a579278cad4f27e629059b8f6f Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Thu, 18 Jan 2024 18:37:40 +0800 Subject: [PATCH 007/115] fix: fix text stick update problem --- packages/vtable/src/core/BaseTable.ts | 4 +- .../group-creater/cell-type/image-cell.ts | 172 ++++++++++++------ .../vtable/src/scenegraph/stick-text/index.ts | 69 ++++--- packages/vtable/src/ts-types/base-table.ts | 2 +- 4 files changed, 162 insertions(+), 85 deletions(-) diff --git a/packages/vtable/src/core/BaseTable.ts b/packages/vtable/src/core/BaseTable.ts index 0750884b0..0fccd0597 100644 --- a/packages/vtable/src/core/BaseTable.ts +++ b/packages/vtable/src/core/BaseTable.ts @@ -362,7 +362,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { this.bodyStyleCache = new Map(); this.bodyBottomStyleCache = new Map(); - internalProps.stick = { changedCells: [] }; + internalProps.stick = { changedCells: new Map() }; internalProps.customMergeCell = options.customMergeCell; } @@ -1934,6 +1934,8 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { this.colContentWidthsMap = new NumberMap(); this.colWidthsLimit = {}; + internalProps.stick.changedCells.clear(); + internalProps.theme = themes.of(options.theme ?? themes.DEFAULT); this.scenegraph.updateStageBackground(); // this._updateSize(); diff --git a/packages/vtable/src/scenegraph/group-creater/cell-type/image-cell.ts b/packages/vtable/src/scenegraph/group-creater/cell-type/image-cell.ts index d86997d87..5231548e8 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-type/image-cell.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-type/image-cell.ts @@ -83,64 +83,40 @@ export function createImageCellGroup( image.name = 'image'; image.keepAspectRatio = keepAspectRatio; if (keepAspectRatio || imageAutoSizing) { - image.successCallback = () => { - const originImage = image.resources.get(image.attribute.image).data; - - if (imageAutoSizing) { - _adjustWidthHeight( - col, - row, - (originImage as HTMLImageElement).width, - (originImage as HTMLImageElement).height, - table.scenegraph, - padding - ); - } - - if (keepAspectRatio) { - const { width: cellWidth, height: cellHeight, isMerge } = getCellRange(cellGroup, table); - - const { width: imageWidth, height: imageHeight } = calcKeepAspectRatioSize( - originImage.width, - originImage.height, - // cellGroup.attribute.width - padding[1] - padding[3], - // cellGroup.attribute.height - padding[0] - padding[2] - cellWidth - padding[1] - padding[3], - cellHeight - padding[0] - padding[2] - ); - - // const left = 0; - // const top = 0; - const pos = calcStartPosition( - 0, - 0, - // cellGroup.attribute.width, - // cellGroup.attribute.height, - cellWidth, - cellHeight, - imageWidth, - imageHeight, + if (image.resources.has(image.attribute.image) && image.resources.get(image.attribute.image).state === 'success') { + updateAutoSizingAndKeepAspectRatio( + imageAutoSizing, + keepAspectRatio, + padding, + textAlign, + textBaseline, + image, + cellGroup, + table + ); + } else { + image.successCallback = () => { + updateAutoSizingAndKeepAspectRatio( + imageAutoSizing, + keepAspectRatio, + padding, textAlign, textBaseline, - padding + image, + cellGroup, + table ); - - image.setAttributes({ - x: pos.x, - y: pos.y, - width: imageWidth, - height: imageHeight, - dx: isMerge ? -table.getColsWidth(cellGroup.mergeStartCol, col - 1) : 0, - dy: isMerge ? -table.getRowsHeight(cellGroup.mergeStartRow, row - 1) : 0 - }); - } - - table.scenegraph.updateNextFrame(); - }; + table.scenegraph.updateNextFrame(); + }; + } } else { - image.successCallback = () => { + if (image.resources.has(image.attribute.image) && image.resources.get(image.attribute.image).state === 'success') { updateImageCellContentWhileResize(cellGroup, col, row, table); - }; + } else { + image.successCallback = () => { + updateImageCellContentWhileResize(cellGroup, col, row, table); + }; + } } (image as any).failCallback = () => { const regedIcons = icons.get(); @@ -320,3 +296,93 @@ function getCellRange(cellGroup: Group, table: BaseTableAPI) { isMerge: false }; } + +function updateImageDxDy(startCol, endCol, startRow, endRow, table) { + for (let col = startCol; col <= endCol; col++) { + for (let row = startRow; row <= endRow; row++) { + const cellGroup = table.scenegraph.getCell(col, row); + if (cellGroup) { + const image = cellGroup.getChildByName('image'); + if (image) { + image.setAttributes({ + dx: -table.getColsWidth(cellGroup.mergeStartCol, col - 1), + dy: -table.getRowsHeight(cellGroup.mergeStartRow, row - 1) + }); + } + } + } + } +} + +function updateAutoSizingAndKeepAspectRatio( + imageAutoSizing: boolean, + keepAspectRatio: boolean, + padding: [number, number, number, number], + textAlign: CanvasTextAlign, + textBaseline: CanvasTextBaseline, + image: Image, + cellGroup: Group, + table: BaseTableAPI +) { + const originImage = image.resources.get(image.attribute.image).data; + const { col, row } = cellGroup; + + if (imageAutoSizing) { + _adjustWidthHeight( + col, + row, + (originImage as HTMLImageElement).width, + (originImage as HTMLImageElement).height, + table.scenegraph, + padding + ); + } + + if (keepAspectRatio) { + const { width: cellWidth, height: cellHeight, isMerge } = getCellRange(cellGroup, table); + + const { width: imageWidth, height: imageHeight } = calcKeepAspectRatioSize( + originImage.width, + originImage.height, + // cellGroup.attribute.width - padding[1] - padding[3], + // cellGroup.attribute.height - padding[0] - padding[2] + cellWidth - padding[1] - padding[3], + cellHeight - padding[0] - padding[2] + ); + + // const left = 0; + // const top = 0; + const pos = calcStartPosition( + 0, + 0, + // cellGroup.attribute.width, + // cellGroup.attribute.height, + cellWidth, + cellHeight, + imageWidth, + imageHeight, + textAlign, + textBaseline, + padding + ); + + image.setAttributes({ + x: pos.x, + y: pos.y, + width: imageWidth, + height: imageHeight + // dx: isMerge ? -table.getColsWidth(cellGroup.mergeStartCol, col - 1) : 0, + // dy: isMerge ? -table.getRowsHeight(cellGroup.mergeStartRow, row - 1) : 0 + }); + + if (isMerge) { + updateImageDxDy( + cellGroup.mergeStartCol, + cellGroup.mergeEndCol, + cellGroup.mergeStartRow, + cellGroup.mergeEndRow, + table + ); + } + } +} diff --git a/packages/vtable/src/scenegraph/stick-text/index.ts b/packages/vtable/src/scenegraph/stick-text/index.ts index 781c93e48..a000caf5b 100644 --- a/packages/vtable/src/scenegraph/stick-text/index.ts +++ b/packages/vtable/src/scenegraph/stick-text/index.ts @@ -7,7 +7,7 @@ import { isNumber } from '@visactor/vutils'; export function handleTextStick(table: BaseTableAPI) { // reset - const { changedCells } = table.internalProps.stick; + const { changedCells } = table.internalProps.stick; // changedCells only cache one time changedCells.forEach((cellPos: StickCell) => { const cellGroup = table.scenegraph.getCell(cellPos.col, cellPos.row); cellGroup.forEachChildren((child: IGraphic) => { @@ -17,7 +17,7 @@ export function handleTextStick(table: BaseTableAPI) { }); }); }); - changedCells.length = 0; + changedCells.clear(); const { scrollTop, scrollLeft, frozenRowCount, frozenColCount } = table; const frozenRowsHeight = table.getFrozenRowsHeight(); @@ -130,7 +130,7 @@ function adjustCellContentVerticalLayout( cellGroup: Group, minTop: number, maxTop: number, - changedCells: StickCell[], + changedCells: Map, table: BaseTableAPI ) { if ( @@ -150,7 +150,7 @@ function adjustCellContentVerticalLayout( } } -function dealVertical(cellGroup: Group, minTop: number, maxTop: number, changedCells: StickCell[]) { +function dealVertical(cellGroup: Group, minTop: number, maxTop: number, changedCells: Map) { // get text element const graphic = (cellGroup.getChildByName('text', true) as Text) || (cellGroup.getChildByName('image', true) as Image); @@ -171,28 +171,35 @@ function dealVertical(cellGroup: Group, minTop: number, maxTop: number, changedC graphic.AABBBounds.width(); const textTop = graphic.globalAABBBounds.y1; const textBottom = graphic.globalAABBBounds.y2; + // const textCellTop = graphic.AABBBounds.y1; + // const textCellBottom = graphic.AABBBounds.y2; + // if (textCellTop < cellGroup.attribute.height || textCellBottom < 0) { + // return; + // } if (textTop < minTop) { const deltaHeight = textTop - minTop; // text is out of view, move all elements down - changedCells.push({ - col: cellGroup.col, - row: cellGroup.row, - dx: (cellGroup.firstChild as IGraphic)?.attribute.dx ?? 0, - dy: (cellGroup.firstChild as IGraphic)?.attribute.dy ?? 0 - }); + !changedCells.has(`${cellGroup.col}-${cellGroup.row}`) && + changedCells.set(`${cellGroup.col}-${cellGroup.row}`, { + col: cellGroup.col, + row: cellGroup.row, + dx: (cellGroup.firstChild as IGraphic)?.attribute.dx ?? 0, + dy: (cellGroup.firstChild as IGraphic)?.attribute.dy ?? 0 + }); cellGroup.forEachChildren((child: IGraphic) => { child.setAttribute('dy', (child.attribute.dy ?? 0) - deltaHeight + 2); // 2 is the buffer }); } else if (textBottom > maxTop) { const deltaHeight = textBottom - maxTop; // text is out of view, move all elements down - changedCells.push({ - col: cellGroup.col, - row: cellGroup.row, - dx: (cellGroup.firstChild as IGraphic)?.attribute.dx ?? 0, - dy: (cellGroup.firstChild as IGraphic)?.attribute.dy ?? 0 - }); + !changedCells.has(`${cellGroup.col}-${cellGroup.row}`) && + changedCells.set(`${cellGroup.col}-${cellGroup.row}`, { + col: cellGroup.col, + row: cellGroup.row, + dx: (cellGroup.firstChild as IGraphic)?.attribute.dx ?? 0, + dy: (cellGroup.firstChild as IGraphic)?.attribute.dy ?? 0 + }); cellGroup.forEachChildren((child: IGraphic) => { child.setAttribute('dy', (child.attribute.dy ?? 0) - deltaHeight); // 2 is the buffer }); @@ -208,7 +215,7 @@ function adjustCellContentHorizontalLayout( cellGroup: Group, minLeft: number, maxLeft: number, - changedCells: StickCell[], + changedCells: Map, table: BaseTableAPI ) { if ( @@ -228,7 +235,7 @@ function adjustCellContentHorizontalLayout( } } -function dealHorizontal(cellGroup: Group, minLeft: number, maxLeft: number, changedCells: StickCell[]) { +function dealHorizontal(cellGroup: Group, minLeft: number, maxLeft: number, changedCells: Map) { // get text element const text = cellGroup.getChildByName('text', true) as Text; if (!text) { @@ -240,24 +247,26 @@ function dealHorizontal(cellGroup: Group, minLeft: number, maxLeft: number, chan if (textLeft < minLeft) { const deltaWidth = textLeft - minLeft; // text is out of view, move all elements right - changedCells.push({ - col: cellGroup.col, - row: cellGroup.row, - dx: (cellGroup.firstChild as IGraphic)?.attribute.dx ?? 0, - dy: (cellGroup.firstChild as IGraphic)?.attribute.dy ?? 0 - }); + !changedCells.has(`${cellGroup.col}-${cellGroup.row}`) && + changedCells.set(`${cellGroup.col}-${cellGroup.row}`, { + col: cellGroup.col, + row: cellGroup.row, + dx: (cellGroup.firstChild as IGraphic)?.attribute.dx ?? 0, + dy: (cellGroup.firstChild as IGraphic)?.attribute.dy ?? 0 + }); cellGroup.forEachChildren((child: IGraphic) => { child.setAttribute('dx', (child.attribute.dx ?? 0) - deltaWidth + 2); // 2 is the buffer }); } else if (textRight > maxLeft) { const deltaWidth = textRight - maxLeft; // text is out of view, move all elements down - changedCells.push({ - col: cellGroup.col, - row: cellGroup.row, - dx: (cellGroup.firstChild as IGraphic)?.attribute.dx ?? 0, - dy: (cellGroup.firstChild as IGraphic)?.attribute.dy ?? 0 - }); + !changedCells.has(`${cellGroup.col}-${cellGroup.row}`) && + changedCells.set(`${cellGroup.col}-${cellGroup.row}`, { + col: cellGroup.col, + row: cellGroup.row, + dx: (cellGroup.firstChild as IGraphic)?.attribute.dx ?? 0, + dy: (cellGroup.firstChild as IGraphic)?.attribute.dy ?? 0 + }); cellGroup.forEachChildren((child: IGraphic) => { child.setAttribute('dx', (child.attribute.dx ?? 0) - deltaWidth); // 2 is the buffer }); diff --git a/packages/vtable/src/ts-types/base-table.ts b/packages/vtable/src/ts-types/base-table.ts index 85b494b48..0e18f81be 100644 --- a/packages/vtable/src/ts-types/base-table.ts +++ b/packages/vtable/src/ts-types/base-table.ts @@ -198,7 +198,7 @@ export interface IBaseTableProtected { // // 开启图表异步渲染 每批次渐进渲染图表个数 // renderChartAsyncBatchCount?: number; - stick: { changedCells: StickCell[] }; + stick: { changedCells: Map }; customMergeCell?: CustomMergeCell; /** From 91f63656c136f54a88b9e3473e35419b3c10aea9 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Fri, 19 Jan 2024 15:50:33 +0800 Subject: [PATCH 008/115] fix: fix image.resources undefined problem in createImageCellGroup() --- .../scenegraph/group-creater/cell-type/image-cell.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/vtable/src/scenegraph/group-creater/cell-type/image-cell.ts b/packages/vtable/src/scenegraph/group-creater/cell-type/image-cell.ts index 5231548e8..140a6cef3 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-type/image-cell.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-type/image-cell.ts @@ -83,7 +83,11 @@ export function createImageCellGroup( image.name = 'image'; image.keepAspectRatio = keepAspectRatio; if (keepAspectRatio || imageAutoSizing) { - if (image.resources.has(image.attribute.image) && image.resources.get(image.attribute.image).state === 'success') { + if ( + image.resources && + image.resources.has(image.attribute.image) && + image.resources.get(image.attribute.image).state === 'success' + ) { updateAutoSizingAndKeepAspectRatio( imageAutoSizing, keepAspectRatio, @@ -110,7 +114,11 @@ export function createImageCellGroup( }; } } else { - if (image.resources.has(image.attribute.image) && image.resources.get(image.attribute.image).state === 'success') { + if ( + image.resources && + image.resources.has(image.attribute.image) && + image.resources.get(image.attribute.image).state === 'success' + ) { updateImageCellContentWhileResize(cellGroup, col, row, table); } else { image.successCallback = () => { From 8d60f24bfc5025e01b53ceddf680a52682ed99f0 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Fri, 19 Jan 2024 19:26:23 +0800 Subject: [PATCH 009/115] feat: add option frozenColDragHeaderMode --- packages/vtable/src/ts-types/base-table.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/vtable/src/ts-types/base-table.ts b/packages/vtable/src/ts-types/base-table.ts index 85b494b48..f83946467 100644 --- a/packages/vtable/src/ts-types/base-table.ts +++ b/packages/vtable/src/ts-types/base-table.ts @@ -97,7 +97,12 @@ export interface IBaseTableProtected { columnResizeType?: 'column' | 'indicator' | 'all' | 'indicatorGroup'; /** 控制拖拽表头移动位置顺序开关 */ dragHeaderMode?: 'all' | 'none' | 'column' | 'row'; - + /** 拖拽表头移动位置 针对冻结部分的规则 + * "disabled"(禁用):不允许其他列的表头拖拽操作涉及到冻结列部分,冻结列保持不变。 + * "adjustCount"(调整数量):允许其他列的表头拖拽操作涉及到冻结列部分,并根据拖拽的动作调整冻结列的数量。当其他列的表头被拖拽进入冻结列位置时,冻结列数量增加;当其他列的表头被拖拽移出冻结列位置时,冻结列数量减少。 + * "freeAdjust"(自由调整):允许自由拖拽其他列的表头进入或移出冻结列位置,同时保持冻结列的数量不变。 + */ + frozenColDragHeaderMode?: 'disabled' | 'adjustCount' | 'freeAdjust'; cachedRecordsRowHeightMap: NumberMap; //存储每一条记录对应行的行高,只有当设置为自动换行随内容撑开才会起作用 // headerRowHeightsMap: NumberMap; //目前是用来存储了表头各行的高度,从headerRowHeight计算而来,headerRowHeight可以设置为数组的形式 _rowHeightsMap: NumberMap; //存储数据条目每行高度 From 589e69cd6635ca8278c9e97e89f515242f1dab85 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Fri, 19 Jan 2024 19:26:59 +0800 Subject: [PATCH 010/115] docs: update changlog of rush --- .../feat-dragHeaderInteraction_2024-01-19-11-26.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vtable/feat-dragHeaderInteraction_2024-01-19-11-26.json diff --git a/common/changes/@visactor/vtable/feat-dragHeaderInteraction_2024-01-19-11-26.json b/common/changes/@visactor/vtable/feat-dragHeaderInteraction_2024-01-19-11-26.json new file mode 100644 index 000000000..5fa6e9528 --- /dev/null +++ b/common/changes/@visactor/vtable/feat-dragHeaderInteraction_2024-01-19-11-26.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "feat: add option frozenColDragHeaderMode\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file From d1aa862eabb9878e2e0bf7b43547a2eef57bb3fb Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Sun, 21 Jan 2024 22:16:16 +0800 Subject: [PATCH 011/115] feat: support frozenColDragHeaderMode --- packages/vtable/src/core/BaseTable.ts | 10 +++++++ .../vtable/src/event/listener/table-group.ts | 19 ++++++------ .../vtable/src/layout/simple-header-layout.ts | 6 ++++ .../vtable/src/scenegraph/layout/move-cell.ts | 7 +++++ packages/vtable/src/state/cell-move/index.ts | 30 +++++++++++++++++++ packages/vtable/src/ts-types/base-table.ts | 10 +++++-- 6 files changed, 70 insertions(+), 12 deletions(-) diff --git a/packages/vtable/src/core/BaseTable.ts b/packages/vtable/src/core/BaseTable.ts index 2f105a108..161b4105c 100644 --- a/packages/vtable/src/core/BaseTable.ts +++ b/packages/vtable/src/core/BaseTable.ts @@ -176,6 +176,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { // disableRowHeaderColumnResize, columnResizeMode, dragHeaderMode, + frozenColDragHeaderMode, // showHeader, // scrollBar, showFrozenIcon, @@ -262,6 +263,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { internalProps.columnResizeMode = columnResizeMode; internalProps.dragHeaderMode = dragHeaderMode; + internalProps.frozenColDragHeaderMode = frozenColDragHeaderMode; internalProps.renderChartAsync = renderChartAsync; setBatchRenderChartCount(renderChartAsyncBatchCount); internalProps.overscrollBehavior = overscrollBehavior ?? 'auto'; @@ -1857,6 +1859,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { // disableRowHeaderColumnResize, columnResizeMode, dragHeaderMode, + frozenColDragHeaderMode, // scrollBar, showFrozenIcon, allowFrozenColCount, @@ -1930,6 +1933,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { internalProps.columnResizeMode = columnResizeMode; internalProps.dragHeaderMode = dragHeaderMode; + internalProps.frozenColDragHeaderMode = frozenColDragHeaderMode; internalProps.renderChartAsync = renderChartAsync; setBatchRenderChartCount(renderChartAsyncBatchCount); internalProps.overscrollBehavior = overscrollBehavior ?? 'auto'; @@ -3061,6 +3065,12 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { */ _canDragHeaderPosition(col: number, row: number): boolean { if (this.isHeader(col, row) && this.stateManager.isSelected(col, row)) { + if ( + this.internalProps.frozenColDragHeaderMode === 'disabled' && + (this.isFrozenColumn(col) || this.isRightFrozenColumn(col)) + ) { + return false; + } const selectRange = this.stateManager.select.ranges[0]; //判断是否整行或者整列选中 if (this.isColumnHeader(col, row)) { diff --git a/packages/vtable/src/event/listener/table-group.ts b/packages/vtable/src/event/listener/table-group.ts index 694e98082..c475354b8 100644 --- a/packages/vtable/src/event/listener/table-group.ts +++ b/packages/vtable/src/event/listener/table-group.ts @@ -83,16 +83,15 @@ export function bindTableGroupListener(eventManager: EventManager) { if (stateManager.interactionState === InteractionState.scrolling) { return; } - if ( - stateManager.interactionState === InteractionState.grabing && - Math.abs(lastX - e.x) + Math.abs(lastY - e.y) >= 1 - ) { - if (stateManager.isResizeCol()) { - /* do nothing */ - } else if (stateManager.isMoveCol()) { - eventManager.dealColumnMover(eventArgsSet); - } else { - eventManager.dealTableSelect(eventArgsSet, true); + if (stateManager.interactionState === InteractionState.grabing) { + if (Math.abs(lastX - e.x) + Math.abs(lastY - e.y) >= 1) { + if (stateManager.isResizeCol()) { + /* do nothing */ + } else if (stateManager.isMoveCol()) { + eventManager.dealColumnMover(eventArgsSet); + } else { + eventManager.dealTableSelect(eventArgsSet, true); + } } return; } diff --git a/packages/vtable/src/layout/simple-header-layout.ts b/packages/vtable/src/layout/simple-header-layout.ts index b9336bf0d..8591a745c 100644 --- a/packages/vtable/src/layout/simple-header-layout.ts +++ b/packages/vtable/src/layout/simple-header-layout.ts @@ -775,6 +775,12 @@ export class SimpleHeaderLayoutMap implements LayoutMapAPI { if (source.col < 0 || source.row < 0 || target.col < 0 || target.row < 0) { return false; } + if (this._table.internalProps.frozenColDragHeaderMode === 'disabled') { + if (this._table.isFrozenColumn(target.col) || this._table.isRightFrozenColumn(target.col)) { + return false; + } + } + // 获取操作单元格的range范围 const sourceCellRange = this.getCellRange(source.col, source.row); // 获取source和target对应sourceCellRange.start.row的headerId diff --git a/packages/vtable/src/scenegraph/layout/move-cell.ts b/packages/vtable/src/scenegraph/layout/move-cell.ts index e758e0874..1e290f242 100644 --- a/packages/vtable/src/scenegraph/layout/move-cell.ts +++ b/packages/vtable/src/scenegraph/layout/move-cell.ts @@ -81,6 +81,7 @@ export function moveHeaderPosition( const columnHeaderGroup = table.scenegraph.getColGroup(col, true); const columnGroup = table.scenegraph.getColGroup(col); const columnBottomGroup = table.scenegraph.getColGroupInBottom(col); + const columnRightBottomGroup = table.scenegraph.getColGroupInRightBottomCorner(col); if (columnHeaderGroup) { columnHeaderGroup.setAttribute('width', columnWidth); columnHeaderGroup.forEachChildren((child: Group) => { @@ -99,6 +100,12 @@ export function moveHeaderPosition( child.setAttribute('width', columnWidth); }); } + if (columnRightBottomGroup) { + columnRightBottomGroup.setAttribute('width', columnWidth); + columnRightBottomGroup.forEachChildren((child: Group) => { + child.setAttribute('width', columnWidth); + }); + } } // 更新容器尺寸 diff --git a/packages/vtable/src/state/cell-move/index.ts b/packages/vtable/src/state/cell-move/index.ts index b3c89b608..150c1cd5b 100644 --- a/packages/vtable/src/state/cell-move/index.ts +++ b/packages/vtable/src/state/cell-move/index.ts @@ -1,5 +1,6 @@ import type { ListTable } from '../../ListTable'; import { getCellMergeInfo } from '../../scenegraph/utils/get-cell-merge'; +import type { CellRange } from '../../ts-types'; import type { BaseTableAPI } from '../../ts-types/base-table'; import type { StateManager } from '../state'; import { adjustMoveHeaderTarget } from './adjust-header'; @@ -116,6 +117,35 @@ export function endMoveCol(state: StateManager) { sourceMergeInfo, targetMergeInfo ); + //调整冻结列数量 + if (state.table.internalProps.frozenColDragHeaderMode === 'adjustFrozenCount' && state.table.isListTable()) { + if ( + state.table.isFrozenColumn(state.columnMove.colTarget) && + !state.table.isFrozenColumn(state.columnMove.colSource) + ) { + state.table.frozenColCount += + (sourceMergeInfo as CellRange).end.col - (sourceMergeInfo as CellRange).start.col + 1; + } else if ( + state.table.isFrozenColumn(state.columnMove.colSource) && + !state.table.isFrozenColumn(state.columnMove.colTarget) + ) { + state.table.frozenColCount -= + (sourceMergeInfo as CellRange).end.col - (sourceMergeInfo as CellRange).start.col + 1; + } + if ( + state.table.isRightFrozenColumn(state.columnMove.colTarget) && + !state.table.isRightFrozenColumn(state.columnMove.colSource) + ) { + state.table.rightFrozenColCount += + (sourceMergeInfo as CellRange).end.col - (sourceMergeInfo as CellRange).start.col + 1; + } else if ( + state.table.isRightFrozenColumn(state.columnMove.colSource) && + !state.table.isRightFrozenColumn(state.columnMove.colTarget) + ) { + state.table.rightFrozenColCount -= + (sourceMergeInfo as CellRange).end.col - (sourceMergeInfo as CellRange).start.col + 1; + } + } } state.updateCursor(); diff --git a/packages/vtable/src/ts-types/base-table.ts b/packages/vtable/src/ts-types/base-table.ts index d2e1f2cfe..a9f3114a8 100644 --- a/packages/vtable/src/ts-types/base-table.ts +++ b/packages/vtable/src/ts-types/base-table.ts @@ -100,10 +100,10 @@ export interface IBaseTableProtected { dragHeaderMode?: 'all' | 'none' | 'column' | 'row'; /** 拖拽表头移动位置 针对冻结部分的规则 * "disabled"(禁用):不允许其他列的表头拖拽操作涉及到冻结列部分,冻结列保持不变。 - * "adjustCount"(调整数量):允许其他列的表头拖拽操作涉及到冻结列部分,并根据拖拽的动作调整冻结列的数量。当其他列的表头被拖拽进入冻结列位置时,冻结列数量增加;当其他列的表头被拖拽移出冻结列位置时,冻结列数量减少。 + * "adjustFrozenCount"(调整数量):允许其他列的表头拖拽操作涉及到冻结列部分,并根据拖拽的动作调整冻结列的数量。当其他列的表头被拖拽进入冻结列位置时,冻结列数量增加;当其他列的表头被拖拽移出冻结列位置时,冻结列数量减少。 * "freeAdjust"(自由调整):允许自由拖拽其他列的表头进入或移出冻结列位置,同时保持冻结列的数量不变。 */ - frozenColDragHeaderMode?: 'disabled' | 'adjustCount' | 'freeAdjust'; + frozenColDragHeaderMode?: 'disabled' | 'adjustFrozenCount' | 'freeAdjust'; cachedRecordsRowHeightMap: NumberMap; //存储每一条记录对应行的行高,只有当设置为自动换行随内容撑开才会起作用 // headerRowHeightsMap: NumberMap; //目前是用来存储了表头各行的高度,从headerRowHeight计算而来,headerRowHeight可以设置为数组的形式 _rowHeightsMap: NumberMap; //存储数据条目每行高度 @@ -257,6 +257,12 @@ export interface BaseTableConstructorOptions { columnResizeMode?: 'all' | 'none' | 'header' | 'body'; /** 控制拖拽表头移动位置顺序开关 */ dragHeaderMode?: 'all' | 'none' | 'column' | 'row'; + /** 拖拽表头移动位置 针对冻结部分的规则 + * "disabled"(禁用):不允许其他列的表头拖拽操作涉及到冻结列部分,冻结列保持不变。 + * "adjustFrozenCount"(调整数量):允许其他列的表头拖拽操作涉及到冻结列部分,并根据拖拽的动作调整冻结列的数量。当其他列的表头被拖拽进入冻结列位置时,冻结列数量增加;当其他列的表头被拖拽移出冻结列位置时,冻结列数量减少。 + * "freeAdjust"(自由调整):允许自由拖拽其他列的表头进入或移出冻结列位置,同时保持冻结列的数量不变。 + */ + frozenColDragHeaderMode?: 'disabled' | 'adjustFrozenCount' | 'freeAdjust'; /** * 是否显示固定列图钉 基本表格生效 */ From 916979943924608e28cda8b81981696734de56cc Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Mon, 22 Jan 2024 12:13:00 +0800 Subject: [PATCH 012/115] chore: add rush change --- .../vtable/fix-image-stick_2024-01-22-04-12.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 common/changes/@visactor/vtable/fix-image-stick_2024-01-22-04-12.json diff --git a/common/changes/@visactor/vtable/fix-image-stick_2024-01-22-04-12.json b/common/changes/@visactor/vtable/fix-image-stick_2024-01-22-04-12.json new file mode 100644 index 000000000..1d3c17f5a --- /dev/null +++ b/common/changes/@visactor/vtable/fix-image-stick_2024-01-22-04-12.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "fix: fix merge image cell update problem", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file From 09ef8c5e983cb5bc35a2d6442e7185c6cea6a8a8 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Mon, 22 Jan 2024 14:57:37 +0800 Subject: [PATCH 013/115] feat: add enlarge in calcKeepAspectRatioSize --- .../src/scenegraph/utils/keep-aspect-ratio.ts | 56 ++++++++++++++----- 1 file changed, 43 insertions(+), 13 deletions(-) diff --git a/packages/vtable/src/scenegraph/utils/keep-aspect-ratio.ts b/packages/vtable/src/scenegraph/utils/keep-aspect-ratio.ts index 76ce96a7f..0430e40ba 100644 --- a/packages/vtable/src/scenegraph/utils/keep-aspect-ratio.ts +++ b/packages/vtable/src/scenegraph/utils/keep-aspect-ratio.ts @@ -1,22 +1,52 @@ export function calcKeepAspectRatioSize( - width: number, - height: number, - maxWidth: number, - maxHeight: number + width: number, // image width + height: number, // image height + maxWidth: number, // cell width + maxHeight: number // cell height ): { width: number; height: number; } { - let newWidth = width; - let newHeight = height; - if (newWidth > maxWidth) { - newWidth = maxWidth; - newHeight = (newWidth * height) / width; - } - if (newHeight > maxHeight) { - newHeight = maxHeight; - newWidth = (newHeight * width) / height; + // let newWidth = width; + // let newHeight = height; + // if (newWidth > maxWidth) { + // newWidth = maxWidth; + // newHeight = (newWidth * height) / width; + // } + // if (newHeight > maxHeight) { + // newHeight = maxHeight; + // newWidth = (newHeight * width) / height; + // } + // return { + // width: newWidth, + // height: newHeight + // }; + + const rectWidth = width; + const rectHeight = height; + const containerWidth = maxWidth; + const containerHeight = maxHeight; + const containerRatio = containerWidth / containerHeight; + const rectRatio = rectWidth / rectHeight; + let newWidth; + let newHeight; + let offsetX; + let offsetY; + + if (rectRatio > containerRatio) { + // 矩形的宽高比较大,以容器的宽度为基准进行缩放 + newWidth = containerWidth; + newHeight = newWidth / rectRatio; + offsetX = 0; + offsetY = (containerHeight - newHeight) / 2; + } else { + // 矩形的高宽比较大,以容器的高度为基准进行缩放 + newHeight = containerHeight; + newWidth = newHeight * rectRatio; + offsetY = 0; + offsetX = (containerWidth - newWidth) / 2; } + return { width: newWidth, height: newHeight From eaea53a954d1d567551872af6eff96b9ac0e9146 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Mon, 22 Jan 2024 16:43:31 +0800 Subject: [PATCH 014/115] refactor: when drag header move to frozen region then markLine show positon --- packages/vtable/src/event/event.ts | 15 ++++---- .../vtable/src/layout/pivot-header-layout.ts | 2 +- .../vtable/src/layout/simple-header-layout.ts | 2 +- .../src/scenegraph/component/cell-mover.ts | 8 ++--- packages/vtable/src/state/cell-move/index.ts | 34 +++++++++++++++---- 5 files changed, 42 insertions(+), 19 deletions(-) diff --git a/packages/vtable/src/event/event.ts b/packages/vtable/src/event/event.ts index d7ed34299..a708da566 100644 --- a/packages/vtable/src/event/event.ts +++ b/packages/vtable/src/event/event.ts @@ -23,6 +23,7 @@ import { bindAxisHoverEvent } from './pivot-chart/axis-hover'; import type { PivotTable } from '../PivotTable'; import { Env } from '../tools/env'; import type { ListTable } from '../ListTable'; +import { isValid } from '@visactor/vutils'; export class EventManager { table: BaseTableAPI; @@ -323,12 +324,14 @@ export class EventManager { dealColumnMover(eventArgsSet: SceneEvent) { const { eventArgs } = eventArgsSet; - this.table.stateManager.updateMoveCol( - eventArgs.col, - eventArgs.row, - eventArgsSet.abstractPos.x, - eventArgsSet.abstractPos.y - ); + if (isValid(eventArgs.col) && isValid(eventArgs.row)) { + this.table.stateManager.updateMoveCol( + eventArgs.col, + eventArgs.row, + eventArgsSet.abstractPos.x, + eventArgsSet.abstractPos.y + ); + } } startColumnResize(eventArgsSet: SceneEvent) { diff --git a/packages/vtable/src/layout/pivot-header-layout.ts b/packages/vtable/src/layout/pivot-header-layout.ts index d0ae0697b..ac5d1d387 100644 --- a/packages/vtable/src/layout/pivot-header-layout.ts +++ b/packages/vtable/src/layout/pivot-header-layout.ts @@ -941,7 +941,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { } } else { row = col; - if (this.frozenRowCount > 0 && row >= this.rowCount - this.bottomFrozenRowCount) { + if (this.bottomFrozenRowCount > 0 && row >= this.rowCount - this.bottomFrozenRowCount) { return true; } } diff --git a/packages/vtable/src/layout/simple-header-layout.ts b/packages/vtable/src/layout/simple-header-layout.ts index 8591a745c..a302b3bea 100644 --- a/packages/vtable/src/layout/simple-header-layout.ts +++ b/packages/vtable/src/layout/simple-header-layout.ts @@ -181,7 +181,7 @@ export class SimpleHeaderLayoutMap implements LayoutMapAPI { } } else { row = col; - if (this.frozenRowCount > 0 && row >= this.rowCount - this.bottomFrozenRowCount) { + if (this.bottomFrozenRowCount > 0 && row >= this.rowCount - this.bottomFrozenRowCount) { return true; } } diff --git a/packages/vtable/src/scenegraph/component/cell-mover.ts b/packages/vtable/src/scenegraph/component/cell-mover.ts index 2a8fb8cd9..c2f4ea928 100644 --- a/packages/vtable/src/scenegraph/component/cell-mover.ts +++ b/packages/vtable/src/scenegraph/component/cell-mover.ts @@ -141,12 +141,12 @@ export class CellMover { update(backX: number | undefined, lineX: number | undefined, backY: number | undefined, lineY: number | undefined) { if (typeof backX === 'number' && typeof lineX === 'number') { - this.columnMoverLabel.setAttribute('x', lineX - this.table.stateManager.scroll.horizontalBarPos); - this.columnMoverLine.setAttribute('x', lineX - this.table.stateManager.scroll.horizontalBarPos); + this.columnMoverLabel.setAttribute('x', lineX); + this.columnMoverLine.setAttribute('x', lineX); this.columnMoverBack.setAttribute('x', backX); } else if (typeof backY === 'number' && typeof lineY === 'number') { - this.columnMoverLabel.setAttribute('y', lineY - this.table.stateManager.scroll.verticalBarPos); - this.columnMoverLine.setAttribute('y', lineY - this.table.stateManager.scroll.verticalBarPos); + this.columnMoverLabel.setAttribute('y', lineY); + this.columnMoverLine.setAttribute('y', lineY); this.columnMoverBack.setAttribute('y', backY); } } diff --git a/packages/vtable/src/state/cell-move/index.ts b/packages/vtable/src/state/cell-move/index.ts index 150c1cd5b..4daaf8f69 100644 --- a/packages/vtable/src/state/cell-move/index.ts +++ b/packages/vtable/src/state/cell-move/index.ts @@ -58,19 +58,39 @@ export function updateMoveCol(col: number, row: number, x: number, y: number, st let backX; let lineY; let backY; - const cellLocation = state.table.getCellLocation(col, row); + const cellLocation = state.table.getCellLocation(state.columnMove.colSource, state.columnMove.rowSource); if (cellLocation === 'columnHeader') { - (backX = state.columnMove.x), - (lineX = + backX = state.columnMove.x; + if (state.table.isFrozenColumn(col)) { + lineX = state.columnMove.colTarget >= state.columnMove.colSource ? state.table.getColsWidth(0, state.columnMove.colTarget) - : state.table.getColsWidth(0, state.columnMove.colTarget - 1)); + : state.table.getColsWidth(0, state.columnMove.colTarget - 1); + } else if (state.table.isRightFrozenColumn(col)) { + lineX = state.table.tableNoFrameWidth - state.table.getColsWidth(targetCell.col + 1, state.table.colCount - 1); + } else { + lineX = + (state.columnMove.colTarget >= state.columnMove.colSource + ? state.table.getColsWidth(0, state.columnMove.colTarget) + : state.table.getColsWidth(0, state.columnMove.colTarget - 1)) - + state.table.stateManager.scroll.horizontalBarPos; + } } else if (cellLocation === 'rowHeader') { - (backY = state.columnMove.y), - (lineY = + backY = state.columnMove.y; + if (state.table.isFrozenRow(row)) { + lineY = state.columnMove.rowTarget >= state.columnMove.rowSource ? state.table.getRowsHeight(0, state.columnMove.rowTarget) - : state.table.getRowsHeight(0, state.columnMove.rowTarget - 1)); + : state.table.getRowsHeight(0, state.columnMove.rowTarget - 1); + } else if (state.table.isBottomFrozenRow(row)) { + lineY = state.table.tableNoFrameHeight - state.table.getRowsHeight(targetCell.row + 1, state.table.rowCount - 1); + } else { + lineY = + (state.columnMove.rowTarget >= state.columnMove.rowSource + ? state.table.getRowsHeight(0, state.columnMove.rowTarget) + : state.table.getRowsHeight(0, state.columnMove.rowTarget - 1)) - + state.table.stateManager.scroll.verticalBarPos; + } } state.table.scenegraph.component.updateMoveCol(backX, lineX, backY, lineY); From b6a175af745653e9c00b06188b0fe69d572bda46 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Mon, 22 Jan 2024 16:43:57 +0800 Subject: [PATCH 015/115] docs: update changlog of rush --- .../feat-dragHeaderInteraction_2024-01-22-08-43.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vtable/feat-dragHeaderInteraction_2024-01-22-08-43.json diff --git a/common/changes/@visactor/vtable/feat-dragHeaderInteraction_2024-01-22-08-43.json b/common/changes/@visactor/vtable/feat-dragHeaderInteraction_2024-01-22-08-43.json new file mode 100644 index 000000000..9ffb21330 --- /dev/null +++ b/common/changes/@visactor/vtable/feat-dragHeaderInteraction_2024-01-22-08-43.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "refactor: when drag header move to frozen region then markLine show positon\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file From 1dd001b2ad215778cd47a1a6ad32e1d43b30d55f Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Mon, 22 Jan 2024 19:07:36 +0800 Subject: [PATCH 016/115] docs: add frozenColDragHeaderMode --- docs/assets/option/en/table/listTable.md | 10 +++++++++- docs/assets/option/zh/table/listTable.md | 9 +++++++++ packages/vtable/src/ListTable.ts | 2 ++ packages/vtable/src/core/BaseTable.ts | 5 +---- packages/vtable/src/ts-types/base-table.ts | 15 +++++---------- packages/vtable/src/ts-types/table-engine.ts | 6 ++++++ 6 files changed, 32 insertions(+), 15 deletions(-) diff --git a/docs/assets/option/en/table/listTable.md b/docs/assets/option/en/table/listTable.md index 81bd053ec..7aa39eb3f 100644 --- a/docs/assets/option/en/table/listTable.md +++ b/docs/assets/option/en/table/listTable.md @@ -97,4 +97,12 @@ When displayed as a tree structure, the indentation value of each layer of conte ## hierarchyExpandLevel(number) -When displayed as a tree structure, the number of levels is expanded by default. The default value is 1, which only displays the root node. If configured to `Infinity`, all nodes will be expanded. \ No newline at end of file +When displayed as a tree structure, the number of levels is expanded by default. The default value is 1, which only displays the root node. If configured to `Infinity`, all nodes will be expanded. + +## frozenColDragHeaderMode(string) = 'fixedFrozenCount' + +Drag the table header to move the position. Rules for frozen parts. The default is fixedFrozenCount. + +- "disabled" (disables adjusting the position of frozen columns): Do not allow other column header drag operations to involve frozen columns, and frozen columns remain unchanged. +- "adjustFrozenCount" (adjust the number of frozen columns based on the interaction results): Allow the header drag operation of other columns to involve the frozen column part, and adjust the number of frozen columns based on the dragging action. When the headers of other columns are dragged into the frozen column position, the number of frozen columns increases; when the headers of other columns are dragged out of the frozen column position, the number of frozen columns decreases. +- "fixedFrozenCount" (can adjust frozen columns and keep the number of frozen columns unchanged): Allows you to freely drag the headers of other columns into or out of the frozen column position while keeping the number of frozen columns unchanged. \ No newline at end of file diff --git a/docs/assets/option/zh/table/listTable.md b/docs/assets/option/zh/table/listTable.md index 5d7f95f17..80106edee 100644 --- a/docs/assets/option/zh/table/listTable.md +++ b/docs/assets/option/zh/table/listTable.md @@ -96,3 +96,12 @@ headerEditor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI } ## hierarchyExpandLevel(number) 展示为树形结构时,默认展开层数。默认为1只显示根节点,配置为`Infinity`则全部展开。 + + +## frozenColDragHeaderMode(string) = 'fixedFrozenCount' + +拖拽表头移动位置 针对冻结部分的规则 默认为fixedFrozenCount + +- "disabled"(禁止调整冻结列位置):不允许其他列的表头拖拽操作涉及到冻结列部分,冻结列保持不变。 +- "adjustFrozenCount"(根据交互结果调整冻结数量):允许其他列的表头拖拽操作涉及到冻结列部分,并根据拖拽的动作调整冻结列的数量。当其他列的表头被拖拽进入冻结列位置时,冻结列数量增加;当其他列的表头被拖拽移出冻结列位置时,冻结列数量减少。 +- "fixedFrozenCount"(可调整冻结列,并维持冻结数量不变):允许自由拖拽其他列的表头移入或移出冻结列位置,同时保持冻结列的数量不变。 \ No newline at end of file diff --git a/packages/vtable/src/ListTable.ts b/packages/vtable/src/ListTable.ts index ad910a26c..32b0c513e 100644 --- a/packages/vtable/src/ListTable.ts +++ b/packages/vtable/src/ListTable.ts @@ -58,6 +58,7 @@ export class ListTable extends BaseTable implements ListTableAPI { super(container as HTMLElement, options); const internalProps = this.internalProps; + internalProps.frozenColDragHeaderMode = options.frozenColDragHeaderMode; //分页配置 this.pagination = options.pagination; internalProps.sortState = options.sortState; @@ -315,6 +316,7 @@ export class ListTable extends BaseTable implements ListTableAPI { updateOption(options: ListTableConstructorOptions, accelerateFirstScreen = false) { const internalProps = this.internalProps; super.updateOption(options); + internalProps.frozenColDragHeaderMode = options.frozenColDragHeaderMode; //分页配置 this.pagination = options.pagination; //更新protectedSpace diff --git a/packages/vtable/src/core/BaseTable.ts b/packages/vtable/src/core/BaseTable.ts index 161b4105c..e253e7f6e 100644 --- a/packages/vtable/src/core/BaseTable.ts +++ b/packages/vtable/src/core/BaseTable.ts @@ -176,7 +176,6 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { // disableRowHeaderColumnResize, columnResizeMode, dragHeaderMode, - frozenColDragHeaderMode, // showHeader, // scrollBar, showFrozenIcon, @@ -263,7 +262,6 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { internalProps.columnResizeMode = columnResizeMode; internalProps.dragHeaderMode = dragHeaderMode; - internalProps.frozenColDragHeaderMode = frozenColDragHeaderMode; internalProps.renderChartAsync = renderChartAsync; setBatchRenderChartCount(renderChartAsyncBatchCount); internalProps.overscrollBehavior = overscrollBehavior ?? 'auto'; @@ -1859,7 +1857,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { // disableRowHeaderColumnResize, columnResizeMode, dragHeaderMode, - frozenColDragHeaderMode, + // scrollBar, showFrozenIcon, allowFrozenColCount, @@ -1933,7 +1931,6 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { internalProps.columnResizeMode = columnResizeMode; internalProps.dragHeaderMode = dragHeaderMode; - internalProps.frozenColDragHeaderMode = frozenColDragHeaderMode; internalProps.renderChartAsync = renderChartAsync; setBatchRenderChartCount(renderChartAsyncBatchCount); internalProps.overscrollBehavior = overscrollBehavior ?? 'auto'; diff --git a/packages/vtable/src/ts-types/base-table.ts b/packages/vtable/src/ts-types/base-table.ts index a9f3114a8..99ec21ad5 100644 --- a/packages/vtable/src/ts-types/base-table.ts +++ b/packages/vtable/src/ts-types/base-table.ts @@ -99,11 +99,11 @@ export interface IBaseTableProtected { /** 控制拖拽表头移动位置顺序开关 */ dragHeaderMode?: 'all' | 'none' | 'column' | 'row'; /** 拖拽表头移动位置 针对冻结部分的规则 - * "disabled"(禁用):不允许其他列的表头拖拽操作涉及到冻结列部分,冻结列保持不变。 - * "adjustFrozenCount"(调整数量):允许其他列的表头拖拽操作涉及到冻结列部分,并根据拖拽的动作调整冻结列的数量。当其他列的表头被拖拽进入冻结列位置时,冻结列数量增加;当其他列的表头被拖拽移出冻结列位置时,冻结列数量减少。 - * "freeAdjust"(自由调整):允许自由拖拽其他列的表头进入或移出冻结列位置,同时保持冻结列的数量不变。 + * "disabled"(禁止调整冻结列位置):不允许其他列的表头拖拽操作涉及到冻结列部分,冻结列保持不变。 + * "adjustFrozenCount"(根据交互结果调整冻结数量):允许其他列的表头拖拽操作涉及到冻结列部分,并根据拖拽的动作调整冻结列的数量。当其他列的表头被拖拽进入冻结列位置时,冻结列数量增加;当其他列的表头被拖拽移出冻结列位置时,冻结列数量减少。 + * "fixedFrozenCount"(可调整冻结列,并维持冻结数量不变):允许自由拖拽其他列的表头移入或移出冻结列位置,同时保持冻结列的数量不变。 */ - frozenColDragHeaderMode?: 'disabled' | 'adjustFrozenCount' | 'freeAdjust'; + frozenColDragHeaderMode?: 'disabled' | 'adjustFrozenCount' | 'fixedFrozenCount'; cachedRecordsRowHeightMap: NumberMap; //存储每一条记录对应行的行高,只有当设置为自动换行随内容撑开才会起作用 // headerRowHeightsMap: NumberMap; //目前是用来存储了表头各行的高度,从headerRowHeight计算而来,headerRowHeight可以设置为数组的形式 _rowHeightsMap: NumberMap; //存储数据条目每行高度 @@ -257,12 +257,7 @@ export interface BaseTableConstructorOptions { columnResizeMode?: 'all' | 'none' | 'header' | 'body'; /** 控制拖拽表头移动位置顺序开关 */ dragHeaderMode?: 'all' | 'none' | 'column' | 'row'; - /** 拖拽表头移动位置 针对冻结部分的规则 - * "disabled"(禁用):不允许其他列的表头拖拽操作涉及到冻结列部分,冻结列保持不变。 - * "adjustFrozenCount"(调整数量):允许其他列的表头拖拽操作涉及到冻结列部分,并根据拖拽的动作调整冻结列的数量。当其他列的表头被拖拽进入冻结列位置时,冻结列数量增加;当其他列的表头被拖拽移出冻结列位置时,冻结列数量减少。 - * "freeAdjust"(自由调整):允许自由拖拽其他列的表头进入或移出冻结列位置,同时保持冻结列的数量不变。 - */ - frozenColDragHeaderMode?: 'disabled' | 'adjustFrozenCount' | 'freeAdjust'; + /** * 是否显示固定列图钉 基本表格生效 */ diff --git a/packages/vtable/src/ts-types/table-engine.ts b/packages/vtable/src/ts-types/table-engine.ts index 270995db3..9fb63978c 100644 --- a/packages/vtable/src/ts-types/table-engine.ts +++ b/packages/vtable/src/ts-types/table-engine.ts @@ -170,6 +170,12 @@ export interface ListTableConstructorOptions extends BaseTableConstructorOptions editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor); /** 编辑触发时机 双击事件 单击事件 api手动开启编辑。默认为双击'doubleclick' */ editCellTrigger?: 'doubleclick' | 'click' | 'api'; + /** 拖拽表头移动位置 针对冻结部分的规则 默认为fixedFrozenCount + * "disabled"(禁止调整冻结列位置):不允许其他列的表头拖拽操作涉及到冻结列部分,冻结列保持不变。 + * "adjustFrozenCount"(根据交互结果调整冻结数量):允许其他列的表头拖拽操作涉及到冻结列部分,并根据拖拽的动作调整冻结列的数量。当其他列的表头被拖拽进入冻结列位置时,冻结列数量增加;当其他列的表头被拖拽移出冻结列位置时,冻结列数量减少。 + * "fixedFrozenCount"(可调整冻结列,并维持冻结数量不变):允许自由拖拽其他列的表头移入或移出冻结列位置,同时保持冻结列的数量不变。 + */ + frozenColDragHeaderMode?: 'disabled' | 'adjustFrozenCount' | 'fixedFrozenCount'; } export interface ListTableAPI extends BaseTableAPI { From 3a719c36999e14669af3a7187e29dd4231951c74 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Mon, 22 Jan 2024 19:31:35 +0800 Subject: [PATCH 017/115] feat: update vrender version --- common/config/rush/pnpm-lock.yaml | 66 +++++++++++++++---------------- packages/vtable/package.json | 8 ++-- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index dd19d9e84..68f37d6b6 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -181,9 +181,9 @@ importers: '@types/react-dom': ^18.0.0 '@visactor/vchart': 1.8.7 '@visactor/vdataset': ~0.17.1 - '@visactor/vrender-components': 0.17.17-alpha.1 - '@visactor/vrender-core': 0.17.17-alpha.1 - '@visactor/vrender-kits': 0.17.17-alpha.1 + '@visactor/vrender-components': 0.17.18-alpha.0 + '@visactor/vrender-core': 0.17.18-alpha.0 + '@visactor/vrender-kits': 0.17.18-alpha.0 '@visactor/vscale': ~0.17.1 '@visactor/vtable-editors': workspace:* '@visactor/vutils': ~0.17.1 @@ -226,9 +226,9 @@ importers: vite-plugin-markdown: ^2.1.0 dependencies: '@visactor/vdataset': 0.17.3 - '@visactor/vrender-components': 0.17.17-alpha.1 - '@visactor/vrender-core': 0.17.17-alpha.1 - '@visactor/vrender-kits': 0.17.17-alpha.1 + '@visactor/vrender-components': 0.17.18-alpha.0 + '@visactor/vrender-core': 0.17.18-alpha.0 + '@visactor/vrender-kits': 0.17.18-alpha.0 '@visactor/vscale': 0.17.3 '@visactor/vtable-editors': link:../vtable-editors '@visactor/vutils': 0.17.3 @@ -3365,9 +3365,9 @@ packages: '@visactor/vgrammar-util': 0.10.8 '@visactor/vgrammar-wordcloud': 0.10.8 '@visactor/vgrammar-wordcloud-shape': 0.10.8 - '@visactor/vrender-components': 0.17.17-alpha.1 - '@visactor/vrender-core': 0.17.17-alpha.1 - '@visactor/vrender-kits': 0.17.17-alpha.1 + '@visactor/vrender-components': 0.17.18-alpha.0 + '@visactor/vrender-core': 0.17.18-alpha.0 + '@visactor/vrender-kits': 0.17.18-alpha.0 '@visactor/vscale': 0.17.3 '@visactor/vutils': 0.17.3 '@visactor/vutils-extension': 1.8.7 @@ -3405,9 +3405,9 @@ packages: '@visactor/vdataset': 0.17.3 '@visactor/vgrammar-coordinate': 0.10.8 '@visactor/vgrammar-util': 0.10.8 - '@visactor/vrender-components': 0.17.17-alpha.1 - '@visactor/vrender-core': 0.17.17-alpha.1 - '@visactor/vrender-kits': 0.17.17-alpha.1 + '@visactor/vrender-components': 0.17.18-alpha.0 + '@visactor/vrender-core': 0.17.18-alpha.0 + '@visactor/vrender-kits': 0.17.18-alpha.0 '@visactor/vscale': 0.17.3 '@visactor/vutils': 0.17.3 @@ -3416,8 +3416,8 @@ packages: dependencies: '@visactor/vgrammar-core': 0.10.8 '@visactor/vgrammar-util': 0.10.8 - '@visactor/vrender-core': 0.17.17-alpha.1 - '@visactor/vrender-kits': 0.17.17-alpha.1 + '@visactor/vrender-core': 0.17.18-alpha.0 + '@visactor/vrender-kits': 0.17.18-alpha.0 '@visactor/vutils': 0.17.3 /@visactor/vgrammar-projection/0.10.8: @@ -3433,8 +3433,8 @@ packages: dependencies: '@visactor/vgrammar-core': 0.10.8 '@visactor/vgrammar-util': 0.10.8 - '@visactor/vrender-core': 0.17.17-alpha.1 - '@visactor/vrender-kits': 0.17.17-alpha.1 + '@visactor/vrender-core': 0.17.18-alpha.0 + '@visactor/vrender-kits': 0.17.18-alpha.0 '@visactor/vutils': 0.17.3 /@visactor/vgrammar-util/0.10.8: @@ -3447,8 +3447,8 @@ packages: dependencies: '@visactor/vgrammar-core': 0.10.8 '@visactor/vgrammar-util': 0.10.8 - '@visactor/vrender-core': 0.17.17-alpha.1 - '@visactor/vrender-kits': 0.17.17-alpha.1 + '@visactor/vrender-core': 0.17.18-alpha.0 + '@visactor/vrender-kits': 0.17.18-alpha.0 '@visactor/vscale': 0.17.3 '@visactor/vutils': 0.17.3 @@ -3457,29 +3457,29 @@ packages: dependencies: '@visactor/vgrammar-core': 0.10.8 '@visactor/vgrammar-util': 0.10.8 - '@visactor/vrender-core': 0.17.17-alpha.1 - '@visactor/vrender-kits': 0.17.17-alpha.1 + '@visactor/vrender-core': 0.17.18-alpha.0 + '@visactor/vrender-kits': 0.17.18-alpha.0 '@visactor/vutils': 0.17.3 - /@visactor/vrender-components/0.17.17-alpha.1: - resolution: {integrity: sha512-WpNnndbG8i/Q2qD00ktZ3yTWqf4FKnlaKceJvUTGD6vRW+uqtWVpQ8hMNa/VgIxA1sjF2RVHkJYi5sqadHGncg==} + /@visactor/vrender-components/0.17.18-alpha.0: + resolution: {integrity: sha512-5YNPpKVmGhCR6aWcFHHgInMVNB8/oocNAUVR1LbxefrzCYcaohlutOll808K7twhKSEblpb0dynEQR+mVkGboQ==} dependencies: - '@visactor/vrender-core': 0.17.17-alpha.1 - '@visactor/vrender-kits': 0.17.17-alpha.1 + '@visactor/vrender-core': 0.17.18-alpha.0 + '@visactor/vrender-kits': 0.17.18-alpha.0 '@visactor/vscale': 0.17.3 '@visactor/vutils': 0.17.3 - /@visactor/vrender-core/0.17.17-alpha.1: - resolution: {integrity: sha512-FceY91PpI5rZRsoFwKegMrvnFEYA/B9DR1X00guq/Mqb81cySac3ks8c/VNZ0K3SMIz/lyc7tTo87r31is7p2w==} + /@visactor/vrender-core/0.17.18-alpha.0: + resolution: {integrity: sha512-LBkfgp5/zmcaoJQRnk967Z4OaYfIfU8X71SPcmmksKm4nfS1rzb+tSodESoXofkdCOa5W1FF6hIFNMP31X+FsQ==} dependencies: '@visactor/vutils': 0.17.3 color-convert: 2.0.1 - /@visactor/vrender-kits/0.17.17-alpha.1: - resolution: {integrity: sha512-cW8yTvEQQHUDp6YOJyb2d6PuQiP8dC0fKJUJzoVRsBLw21+JeZVKkq59OIv7A1dP5MS2vOSd49UI/tgL82GDoA==} + /@visactor/vrender-kits/0.17.18-alpha.0: + resolution: {integrity: sha512-aGp+fdXGeLuhbqkok9xzXlM4N2evdEubFyG+0vedV/ctfmqkZRAqWwzkoKsSVJ7dFM1jUrq0VPNWcqt3Wll1ag==} dependencies: '@resvg/resvg-js': 2.4.1 - '@visactor/vrender-core': 0.17.17-alpha.1 + '@visactor/vrender-core': 0.17.18-alpha.0 '@visactor/vutils': 0.17.3 roughjs: 4.5.2 @@ -3491,8 +3491,8 @@ packages: /@visactor/vutils-extension/1.8.5: resolution: {integrity: sha512-3DJMhGLmQ5Mk6VSxuLFKCzM9XIFkwGauU4el6skUY5qmmAbyZjOyneycAUiGCcbxZHvHpg1jyRk27Eipf4+bgQ==} dependencies: - '@visactor/vrender-core': 0.17.17-alpha.1 - '@visactor/vrender-kits': 0.17.17-alpha.1 + '@visactor/vrender-core': 0.17.18-alpha.0 + '@visactor/vrender-kits': 0.17.18-alpha.0 '@visactor/vscale': 0.17.3 '@visactor/vutils': 0.17.3 dev: false @@ -3500,8 +3500,8 @@ packages: /@visactor/vutils-extension/1.8.7: resolution: {integrity: sha512-o6Hw5+jqj9IzPS6babV0fyQ8RC9r2DHfvSx5fC/cEuHdvCVYjtzdHJHGmjJ42EAp4PGGUUn2MtGyaxFtzxSD5A==} dependencies: - '@visactor/vrender-core': 0.17.17-alpha.1 - '@visactor/vrender-kits': 0.17.17-alpha.1 + '@visactor/vrender-core': 0.17.18-alpha.0 + '@visactor/vrender-kits': 0.17.18-alpha.0 '@visactor/vscale': 0.17.3 '@visactor/vutils': 0.17.3 diff --git a/packages/vtable/package.json b/packages/vtable/package.json index fcce5d93c..14f8385b2 100644 --- a/packages/vtable/package.json +++ b/packages/vtable/package.json @@ -50,9 +50,9 @@ }, "dependencies": { "@visactor/vtable-editors": "workspace:*", - "@visactor/vrender-core": "0.17.17-alpha.1", - "@visactor/vrender-kits": "0.17.17-alpha.1", - "@visactor/vrender-components": "0.17.17-alpha.1", + "@visactor/vrender-core": "0.17.18-alpha.0", + "@visactor/vrender-kits": "0.17.18-alpha.0", + "@visactor/vrender-components": "0.17.18-alpha.0", "@visactor/vutils-extension": "~1.8.5", "@visactor/vutils": "~0.17.1", "@visactor/vscale": "~0.17.1", @@ -124,4 +124,4 @@ "url": "https://github.com/VisActor/VTable.git", "directory": "packages/vtable" } -} +} \ No newline at end of file From 8805384962b41f65fd91753d9e2c1774e462d745 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Mon, 22 Jan 2024 19:37:47 +0800 Subject: [PATCH 018/115] docs: add frozenColDragHeaderMode --- docs/assets/guide/en/interaction/drag_header.md | 14 ++++++++++++++ docs/assets/guide/zh/interaction/drag_header.md | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/docs/assets/guide/en/interaction/drag_header.md b/docs/assets/guide/en/interaction/drag_header.md index 0c8905131..cfe39c7ec 100644 --- a/docs/assets/guide/en/interaction/drag_header.md +++ b/docs/assets/guide/en/interaction/drag_header.md @@ -60,4 +60,18 @@ Sometimes, we don't want certain columns to participate in drag-and-drop transpo As with the above code, the "Sales" column cannot be dragged and transposed. +## Restrict dragging of frozen columns +Drag and drop the table header to move the position. Select different effects according to the business scenario for the rules of the frozen part. For example, you can prohibit dragging of frozen columns, or adjust the number of frozen columns. + +Constraints can be made through the following configuration (only valid for ListTable): +``` +Drag the table header to move the position. Rules for frozen parts. The default is fixedFrozenCount. +frozenColDragHeaderMode?: 'disabled' | 'adjustFrozenCount' | 'fixedFrozenCount'; +``` +The different rules are described below: + +- "disabled" (disables adjusting the position of frozen columns): Do not allow other column header drag operations to involve frozen columns, and frozen columns remain unchanged. +- "adjustFrozenCount" (adjust the number of frozen columns based on the interaction results): Allow the header drag operation of other columns to involve the frozen column part, and adjust the number of frozen columns based on the dragging action. When the headers of other columns are dragged into the frozen column position, the number of frozen columns increases; when the headers of other columns are dragged out of the frozen column position, the number of frozen columns decreases. +- "fixedFrozenCount" (can adjust frozen columns and keep the number of frozen columns unchanged): Allows you to freely drag the headers of other columns into or out of the frozen column position while keeping the number of frozen columns unchanged. + So far, we have introduced the drag-and-drop header transposition function of VTable, including the activation of the drag-and-drop header transposition function, the style configuration of the drag-and-drop header transposition mark line, and whether a certain column can be dragged. By mastering these functions, you can more easily perform data analytics and processing in VTable. diff --git a/docs/assets/guide/zh/interaction/drag_header.md b/docs/assets/guide/zh/interaction/drag_header.md index f624c61a9..ef61d3255 100644 --- a/docs/assets/guide/zh/interaction/drag_header.md +++ b/docs/assets/guide/zh/interaction/drag_header.md @@ -60,4 +60,18 @@ const table = new VTable.ListTable({ 如上述代码,“销量”列不可拖拽换位。 +## 限制冻结列的拖拽 +拖拽表头移动位置 针对冻结部分的规则根据业务场景选择不同的效果,如可以禁止拖拽冻结列,或者调整冻结列的数量。 + +可以通过下面的配置进行约束(仅针对ListTable生效): +``` +拖拽表头移动位置 针对冻结部分的规则 默认为fixedFrozenCount +frozenColDragHeaderMode?: 'disabled' | 'adjustFrozenCount' | 'fixedFrozenCount'; +``` +不同规则描述如下: + +- "disabled"(禁止调整冻结列位置):不允许其他列的表头拖拽操作涉及到冻结列部分,冻结列保持不变。 +- "adjustFrozenCount"(根据交互结果调整冻结数量):允许其他列的表头拖拽操作涉及到冻结列部分,并根据拖拽的动作调整冻结列的数量。当其他列的表头被拖拽进入冻结列位置时,冻结列数量增加;当其他列的表头被拖拽移出冻结列位置时,冻结列数量减少。 +- "fixedFrozenCount"(可调整冻结列,并维持冻结数量不变):允许自由拖拽其他列的表头移入或移出冻结列位置,同时保持冻结列的数量不变。 + 至此,我们已经介绍了 VTable 的拖拽表头换位功能,括拖拽表头换位功能的开启、拖拽表头换位标记线的样式配置以及某一列是否可以拖拽。通过掌握这些功能,您可以更便捷地在 VTable 中进行数据分析与处理。 From 1653c06a4a0bb85a86a0374d009df66168aa1744 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Mon, 22 Jan 2024 20:08:29 +0800 Subject: [PATCH 019/115] fix: frozenColDragHeaderMode set adjustFrozenCount leftBottomCell position --- packages/vtable/src/scenegraph/layout/move-cell.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/vtable/src/scenegraph/layout/move-cell.ts b/packages/vtable/src/scenegraph/layout/move-cell.ts index 1e290f242..29e22ab0f 100644 --- a/packages/vtable/src/scenegraph/layout/move-cell.ts +++ b/packages/vtable/src/scenegraph/layout/move-cell.ts @@ -81,6 +81,7 @@ export function moveHeaderPosition( const columnHeaderGroup = table.scenegraph.getColGroup(col, true); const columnGroup = table.scenegraph.getColGroup(col); const columnBottomGroup = table.scenegraph.getColGroupInBottom(col); + const columnLeftBottomGroup = table.scenegraph.getColGroupInLeftBottomCorner(col); const columnRightBottomGroup = table.scenegraph.getColGroupInRightBottomCorner(col); if (columnHeaderGroup) { columnHeaderGroup.setAttribute('width', columnWidth); @@ -106,6 +107,12 @@ export function moveHeaderPosition( child.setAttribute('width', columnWidth); }); } + if (columnLeftBottomGroup) { + columnLeftBottomGroup.setAttribute('width', columnWidth); + columnLeftBottomGroup.forEachChildren((child: Group) => { + child.setAttribute('width', columnWidth); + }); + } } // 更新容器尺寸 From c35d4c41270c2d12b226ee4fbc411d14227bf454 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Tue, 23 Jan 2024 10:33:09 +0800 Subject: [PATCH 020/115] docs: add frozenColDragHeaderMode --- docs/assets/guide/en/interaction/drag_header.md | 4 ++-- docs/assets/guide/zh/interaction/drag_header.md | 4 ++-- docs/assets/option/en/table/listTable.md | 4 ++-- docs/assets/option/zh/table/listTable.md | 4 ++-- packages/vtable/src/ts-types/base-table.ts | 4 ++-- packages/vtable/src/ts-types/table-engine.ts | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/assets/guide/en/interaction/drag_header.md b/docs/assets/guide/en/interaction/drag_header.md index cfe39c7ec..bbf169605 100644 --- a/docs/assets/guide/en/interaction/drag_header.md +++ b/docs/assets/guide/en/interaction/drag_header.md @@ -70,8 +70,8 @@ frozenColDragHeaderMode?: 'disabled' | 'adjustFrozenCount' | 'fixedFrozenCount'; ``` The different rules are described below: -- "disabled" (disables adjusting the position of frozen columns): Do not allow other column header drag operations to involve frozen columns, and frozen columns remain unchanged. -- "adjustFrozenCount" (adjust the number of frozen columns based on the interaction results): Allow the header drag operation of other columns to involve the frozen column part, and adjust the number of frozen columns based on the dragging action. When the headers of other columns are dragged into the frozen column position, the number of frozen columns increases; when the headers of other columns are dragged out of the frozen column position, the number of frozen columns decreases. +- "disabled" (disables adjusting the position of frozen columns): The headers of other columns are not allowed to be moved into the frozen column, nor are the frozen columns allowed to be moved out. The frozen column remains unchanged. +- "adjustFrozenCount" (adjust the number of frozen columns based on the interaction results): allows the headers of other columns to move into the frozen column, and the frozen column to move out, and adjusts the number of frozen columns based on the dragging action. When the headers of other columns are dragged into the frozen column position, the number of frozen columns increases; when the headers of other columns are dragged out of the frozen column position, the number of frozen columns decreases. - "fixedFrozenCount" (can adjust frozen columns and keep the number of frozen columns unchanged): Allows you to freely drag the headers of other columns into or out of the frozen column position while keeping the number of frozen columns unchanged. So far, we have introduced the drag-and-drop header transposition function of VTable, including the activation of the drag-and-drop header transposition function, the style configuration of the drag-and-drop header transposition mark line, and whether a certain column can be dragged. By mastering these functions, you can more easily perform data analytics and processing in VTable. diff --git a/docs/assets/guide/zh/interaction/drag_header.md b/docs/assets/guide/zh/interaction/drag_header.md index ef61d3255..cd39e2eb6 100644 --- a/docs/assets/guide/zh/interaction/drag_header.md +++ b/docs/assets/guide/zh/interaction/drag_header.md @@ -70,8 +70,8 @@ frozenColDragHeaderMode?: 'disabled' | 'adjustFrozenCount' | 'fixedFrozenCount'; ``` 不同规则描述如下: -- "disabled"(禁止调整冻结列位置):不允许其他列的表头拖拽操作涉及到冻结列部分,冻结列保持不变。 -- "adjustFrozenCount"(根据交互结果调整冻结数量):允许其他列的表头拖拽操作涉及到冻结列部分,并根据拖拽的动作调整冻结列的数量。当其他列的表头被拖拽进入冻结列位置时,冻结列数量增加;当其他列的表头被拖拽移出冻结列位置时,冻结列数量减少。 +- "disabled"(禁止调整冻结列位置):不允许其他列的表头移入冻结列,也不允许冻结列移出,冻结列保持不变。 +- "adjustFrozenCount"(根据交互结果调整冻结数量):允许其他列的表头移入冻结列,及冻结列移出,并根据拖拽的动作调整冻结列的数量。当其他列的表头被拖拽进入冻结列位置时,冻结列数量增加;当其他列的表头被拖拽移出冻结列位置时,冻结列数量减少。 - "fixedFrozenCount"(可调整冻结列,并维持冻结数量不变):允许自由拖拽其他列的表头移入或移出冻结列位置,同时保持冻结列的数量不变。 至此,我们已经介绍了 VTable 的拖拽表头换位功能,括拖拽表头换位功能的开启、拖拽表头换位标记线的样式配置以及某一列是否可以拖拽。通过掌握这些功能,您可以更便捷地在 VTable 中进行数据分析与处理。 diff --git a/docs/assets/option/en/table/listTable.md b/docs/assets/option/en/table/listTable.md index 7aa39eb3f..9610150b7 100644 --- a/docs/assets/option/en/table/listTable.md +++ b/docs/assets/option/en/table/listTable.md @@ -103,6 +103,6 @@ When displayed as a tree structure, the number of levels is expanded by default. Drag the table header to move the position. Rules for frozen parts. The default is fixedFrozenCount. -- "disabled" (disables adjusting the position of frozen columns): Do not allow other column header drag operations to involve frozen columns, and frozen columns remain unchanged. -- "adjustFrozenCount" (adjust the number of frozen columns based on the interaction results): Allow the header drag operation of other columns to involve the frozen column part, and adjust the number of frozen columns based on the dragging action. When the headers of other columns are dragged into the frozen column position, the number of frozen columns increases; when the headers of other columns are dragged out of the frozen column position, the number of frozen columns decreases. +- "disabled" (disables adjusting the position of frozen columns): The headers of other columns are not allowed to be moved into the frozen column, nor are the frozen columns allowed to be moved out. The frozen column remains unchanged. +- "adjustFrozenCount" (adjust the number of frozen columns based on the interaction results): allows the headers of other columns to move into the frozen column, and the frozen column to move out, and adjusts the number of frozen columns based on the dragging action. When the headers of other columns are dragged into the frozen column position, the number of frozen columns increases; when the headers of other columns are dragged out of the frozen column position, the number of frozen columns decreases. - "fixedFrozenCount" (can adjust frozen columns and keep the number of frozen columns unchanged): Allows you to freely drag the headers of other columns into or out of the frozen column position while keeping the number of frozen columns unchanged. \ No newline at end of file diff --git a/docs/assets/option/zh/table/listTable.md b/docs/assets/option/zh/table/listTable.md index 80106edee..3b869cf3f 100644 --- a/docs/assets/option/zh/table/listTable.md +++ b/docs/assets/option/zh/table/listTable.md @@ -102,6 +102,6 @@ headerEditor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI } 拖拽表头移动位置 针对冻结部分的规则 默认为fixedFrozenCount -- "disabled"(禁止调整冻结列位置):不允许其他列的表头拖拽操作涉及到冻结列部分,冻结列保持不变。 -- "adjustFrozenCount"(根据交互结果调整冻结数量):允许其他列的表头拖拽操作涉及到冻结列部分,并根据拖拽的动作调整冻结列的数量。当其他列的表头被拖拽进入冻结列位置时,冻结列数量增加;当其他列的表头被拖拽移出冻结列位置时,冻结列数量减少。 +- "disabled"(禁止调整冻结列位置):不允许其他列的表头移入冻结列,也不允许冻结列移出,冻结列保持不变。 +- "adjustFrozenCount"(根据交互结果调整冻结数量):允许其他列的表头移入冻结列,及冻结列移出,并根据拖拽的动作调整冻结列的数量。当其他列的表头被拖拽进入冻结列位置时,冻结列数量增加;当其他列的表头被拖拽移出冻结列位置时,冻结列数量减少。 - "fixedFrozenCount"(可调整冻结列,并维持冻结数量不变):允许自由拖拽其他列的表头移入或移出冻结列位置,同时保持冻结列的数量不变。 \ No newline at end of file diff --git a/packages/vtable/src/ts-types/base-table.ts b/packages/vtable/src/ts-types/base-table.ts index 99ec21ad5..c6d2db30e 100644 --- a/packages/vtable/src/ts-types/base-table.ts +++ b/packages/vtable/src/ts-types/base-table.ts @@ -99,8 +99,8 @@ export interface IBaseTableProtected { /** 控制拖拽表头移动位置顺序开关 */ dragHeaderMode?: 'all' | 'none' | 'column' | 'row'; /** 拖拽表头移动位置 针对冻结部分的规则 - * "disabled"(禁止调整冻结列位置):不允许其他列的表头拖拽操作涉及到冻结列部分,冻结列保持不变。 - * "adjustFrozenCount"(根据交互结果调整冻结数量):允许其他列的表头拖拽操作涉及到冻结列部分,并根据拖拽的动作调整冻结列的数量。当其他列的表头被拖拽进入冻结列位置时,冻结列数量增加;当其他列的表头被拖拽移出冻结列位置时,冻结列数量减少。 + * "disabled"(禁止调整冻结列位置):不允许其他列的表头移入冻结列,也不允许冻结列移出,冻结列保持不变。 + * "adjustFrozenCount"(根据交互结果调整冻结数量):允许其他列的表头移入冻结列,及冻结列移出,并根据拖拽的动作调整冻结列的数量。当其他列的表头被拖拽进入冻结列位置时,冻结列数量增加;当其他列的表头被拖拽移出冻结列位置时,冻结列数量减少。 * "fixedFrozenCount"(可调整冻结列,并维持冻结数量不变):允许自由拖拽其他列的表头移入或移出冻结列位置,同时保持冻结列的数量不变。 */ frozenColDragHeaderMode?: 'disabled' | 'adjustFrozenCount' | 'fixedFrozenCount'; diff --git a/packages/vtable/src/ts-types/table-engine.ts b/packages/vtable/src/ts-types/table-engine.ts index 9fb63978c..6c2aa5a80 100644 --- a/packages/vtable/src/ts-types/table-engine.ts +++ b/packages/vtable/src/ts-types/table-engine.ts @@ -171,8 +171,8 @@ export interface ListTableConstructorOptions extends BaseTableConstructorOptions /** 编辑触发时机 双击事件 单击事件 api手动开启编辑。默认为双击'doubleclick' */ editCellTrigger?: 'doubleclick' | 'click' | 'api'; /** 拖拽表头移动位置 针对冻结部分的规则 默认为fixedFrozenCount - * "disabled"(禁止调整冻结列位置):不允许其他列的表头拖拽操作涉及到冻结列部分,冻结列保持不变。 - * "adjustFrozenCount"(根据交互结果调整冻结数量):允许其他列的表头拖拽操作涉及到冻结列部分,并根据拖拽的动作调整冻结列的数量。当其他列的表头被拖拽进入冻结列位置时,冻结列数量增加;当其他列的表头被拖拽移出冻结列位置时,冻结列数量减少。 + * "disabled"(禁止调整冻结列位置):不允许其他列的表头移入冻结列,也不允许冻结列移出,冻结列保持不变。 + * "adjustFrozenCount"(根据交互结果调整冻结数量):允许其他列的表头移入冻结列,及冻结列移出,并根据拖拽的动作调整冻结列的数量。当其他列的表头被拖拽进入冻结列位置时,冻结列数量增加;当其他列的表头被拖拽移出冻结列位置时,冻结列数量减少。 * "fixedFrozenCount"(可调整冻结列,并维持冻结数量不变):允许自由拖拽其他列的表头移入或移出冻结列位置,同时保持冻结列的数量不变。 */ frozenColDragHeaderMode?: 'disabled' | 'adjustFrozenCount' | 'fixedFrozenCount'; From 9321c1942928ffde49f59fafc2ae5b52810681f8 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Tue, 23 Jan 2024 16:41:35 +0800 Subject: [PATCH 021/115] feat: add image load task --- common/config/rush/pnpm-lock.yaml | 189 ++++++++++-------- docs/package.json | 2 +- packages/react-vtable/package.json | 4 +- packages/vtable-export/package.json | 4 +- packages/vtable/package.json | 8 +- packages/vtable/src/icons.ts | 10 + .../graphic/contributions/draw-interceptor.ts | 143 +++++++++++++ .../scenegraph/graphic/contributions/index.ts | 8 +- .../group-creater/cell-type/image-cell.ts | 12 +- 9 files changed, 283 insertions(+), 97 deletions(-) create mode 100644 packages/vtable/src/scenegraph/graphic/contributions/draw-interceptor.ts diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 68f37d6b6..9b25279e4 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -14,7 +14,7 @@ importers: '@types/markdown-it': ^13.0.0 '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 - '@visactor/vchart': 1.8.7 + '@visactor/vchart': 1.9.0-alpha.1 '@visactor/vtable': workspace:* '@visactor/vtable-editors': workspace:* '@visactor/vtable-export': workspace:* @@ -37,7 +37,7 @@ importers: yargs: ^17.1.1 dependencies: '@arco-design/web-react': 2.46.1_yok4whjnfjlfyjmdmcaku5uzjq - '@visactor/vchart': 1.8.7 + '@visactor/vchart': 1.9.0-alpha.1 '@visactor/vtable': link:../packages/vtable '@visactor/vtable-editors': link:../packages/vtable-editors '@visactor/vtable-export': link:../packages/vtable-export @@ -82,7 +82,7 @@ importers: '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 '@types/react-is': ^17.0.3 - '@visactor/vchart': 1.8.7 + '@visactor/vchart': 1.9.0-alpha.1 '@visactor/vtable': workspace:* '@visactor/vutils': ~0.17.1 '@vitejs/plugin-react': 3.1.0 @@ -133,7 +133,7 @@ importers: '@types/react': 18.2.46 '@types/react-dom': 18.2.18 '@types/react-is': 17.0.7 - '@visactor/vchart': 1.8.7 + '@visactor/vchart': 1.9.0-alpha.1 '@vitejs/plugin-react': 3.1.0_vite@3.2.6 axios: 1.6.3 chai: 4.3.4 @@ -179,11 +179,11 @@ importers: '@types/offscreencanvas': 2019.6.4 '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 - '@visactor/vchart': 1.8.7 + '@visactor/vchart': 1.9.0-alpha.1 '@visactor/vdataset': ~0.17.1 - '@visactor/vrender-components': 0.17.18-alpha.0 - '@visactor/vrender-core': 0.17.18-alpha.0 - '@visactor/vrender-kits': 0.17.18-alpha.0 + '@visactor/vrender-components': 0.17.18-alpha.1 + '@visactor/vrender-core': 0.17.18-alpha.1 + '@visactor/vrender-kits': 0.17.18-alpha.1 '@visactor/vscale': ~0.17.1 '@visactor/vtable-editors': workspace:* '@visactor/vutils': ~0.17.1 @@ -226,9 +226,9 @@ importers: vite-plugin-markdown: ^2.1.0 dependencies: '@visactor/vdataset': 0.17.3 - '@visactor/vrender-components': 0.17.18-alpha.0 - '@visactor/vrender-core': 0.17.18-alpha.0 - '@visactor/vrender-kits': 0.17.18-alpha.0 + '@visactor/vrender-components': 0.17.18-alpha.1 + '@visactor/vrender-core': 0.17.18-alpha.1 + '@visactor/vrender-kits': 0.17.18-alpha.1 '@visactor/vscale': 0.17.3 '@visactor/vtable-editors': link:../vtable-editors '@visactor/vutils': 0.17.3 @@ -249,7 +249,7 @@ importers: '@types/offscreencanvas': 2019.6.4 '@types/react': 18.2.46 '@types/react-dom': 18.2.18 - '@visactor/vchart': 1.8.7 + '@visactor/vchart': 1.9.0-alpha.1 '@vitejs/plugin-react': 3.1.0_vite@3.2.6 axios: 1.6.3 chai: 4.3.4 @@ -348,7 +348,7 @@ importers: '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 '@types/react-is': ^17.0.3 - '@visactor/vchart': 1.8.7 + '@visactor/vchart': 1.9.0-alpha.1 '@visactor/vtable': workspace:* '@visactor/vutils': ~0.17.1 '@vitejs/plugin-react': 3.1.0 @@ -402,7 +402,7 @@ importers: '@types/react': 18.2.46 '@types/react-dom': 18.2.18 '@types/react-is': 17.0.7 - '@visactor/vchart': 1.8.7 + '@visactor/vchart': 1.9.0-alpha.1 '@vitejs/plugin-react': 3.1.0_vite@3.2.6 axios: 1.6.3 chai: 4.3.4 @@ -3354,23 +3354,23 @@ packages: resolution: {integrity: sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==} dev: true - /@visactor/vchart/1.8.7: - resolution: {integrity: sha512-M0kFlZ17TcamZSRrO/8X45mjBxBPrPAQyJK2amKb4LR6yu2tJNMQJMVSUzC3TPeoyZBC6Qhthj0h6PLB88qTRA==} + /@visactor/vchart/1.9.0-alpha.1: + resolution: {integrity: sha512-SedXr+tAN+8V9X5S2StFThRFKLCDMA9qF9XMYESbwiimng8iYeF7wxlpBmeCLCrJSYqDs1lZTdogYKdmkJFMeQ==} dependencies: '@visactor/vdataset': 0.17.3 - '@visactor/vgrammar-core': 0.10.8 - '@visactor/vgrammar-hierarchy': 0.10.8 - '@visactor/vgrammar-projection': 0.10.8 - '@visactor/vgrammar-sankey': 0.10.8 - '@visactor/vgrammar-util': 0.10.8 - '@visactor/vgrammar-wordcloud': 0.10.8 - '@visactor/vgrammar-wordcloud-shape': 0.10.8 - '@visactor/vrender-components': 0.17.18-alpha.0 - '@visactor/vrender-core': 0.17.18-alpha.0 - '@visactor/vrender-kits': 0.17.18-alpha.0 + '@visactor/vgrammar-core': 0.11.3 + '@visactor/vgrammar-hierarchy': 0.11.3 + '@visactor/vgrammar-projection': 0.11.3 + '@visactor/vgrammar-sankey': 0.11.3 + '@visactor/vgrammar-util': 0.11.3 + '@visactor/vgrammar-wordcloud': 0.11.3 + '@visactor/vgrammar-wordcloud-shape': 0.11.3 + '@visactor/vrender-components': 0.17.16 + '@visactor/vrender-core': 0.17.16 + '@visactor/vrender-kits': 0.17.16 '@visactor/vscale': 0.17.3 '@visactor/vutils': 0.17.3 - '@visactor/vutils-extension': 1.8.7 + '@visactor/vutils-extension': 1.9.0-alpha.1 /@visactor/vdataset/0.17.3: resolution: {integrity: sha512-uckfCq1gLvqUlbyi3p9GiY8qcv2uNZ2KzLxO0/CVfDUXZ1IsERT8363ue7vejctEpqEa112vgqYrw73qlumH9Q==} @@ -3393,95 +3393,120 @@ packages: simplify-geojson: 1.0.5 topojson-client: 3.1.0 - /@visactor/vgrammar-coordinate/0.10.8: - resolution: {integrity: sha512-AfewiepfTElin5G2pUuINXoDGHb1xVenIzGDDY4AfJsVRAaRqXLJv4tqBo1Qas9RqS5W3m77697J+b6ExvDLgQ==} + /@visactor/vgrammar-coordinate/0.11.3: + resolution: {integrity: sha512-m9CRwnBBirE20OL3ua73J655c+S7waOYz+bjHScQ+3PTaiXs6iCLfK90GMRWUQSAoDClNQQ/EDK60ry7XUgufw==} dependencies: - '@visactor/vgrammar-util': 0.10.8 + '@visactor/vgrammar-util': 0.11.3 '@visactor/vutils': 0.17.3 - /@visactor/vgrammar-core/0.10.8: - resolution: {integrity: sha512-lQIQBZhARyCOObYwXF8Miwnh8L6AsnGqZJ45P+1X/Pk3ZqUPBXjonW2fWcrgKVGaZ59G3P9OEp1rwErmIsrhBg==} + /@visactor/vgrammar-core/0.11.3: + resolution: {integrity: sha512-6AlPN/DARyf892mL2ixT5n/1tfQMVK4mVKQrjY5s4uP9XWHXNtwyZW1t1ABt6+j9/psAMErFepXcYWSdRkr9bA==} dependencies: '@visactor/vdataset': 0.17.3 - '@visactor/vgrammar-coordinate': 0.10.8 - '@visactor/vgrammar-util': 0.10.8 - '@visactor/vrender-components': 0.17.18-alpha.0 - '@visactor/vrender-core': 0.17.18-alpha.0 - '@visactor/vrender-kits': 0.17.18-alpha.0 + '@visactor/vgrammar-coordinate': 0.11.3 + '@visactor/vgrammar-util': 0.11.3 + '@visactor/vrender-components': 0.17.16 + '@visactor/vrender-core': 0.17.16 + '@visactor/vrender-kits': 0.17.16 '@visactor/vscale': 0.17.3 '@visactor/vutils': 0.17.3 - /@visactor/vgrammar-hierarchy/0.10.8: - resolution: {integrity: sha512-eXZgzCDbj+8YqgLgAKdS3ad3ZcpxsnLFeZibSkNKvgi8Wc5zHTZ2kf/IQ525t/0I/CtZlfccVfUkhA6O/QJXBg==} + /@visactor/vgrammar-hierarchy/0.11.3: + resolution: {integrity: sha512-gU3rXrtASTG02GanmqKAzJPEfBcJaAQ0F5rBkWBkYzT3nr4/x+WxDVv77xbJ//BsJRS7VXnDZ9TxddOCf4LT5A==} dependencies: - '@visactor/vgrammar-core': 0.10.8 - '@visactor/vgrammar-util': 0.10.8 - '@visactor/vrender-core': 0.17.18-alpha.0 - '@visactor/vrender-kits': 0.17.18-alpha.0 + '@visactor/vgrammar-core': 0.11.3 + '@visactor/vgrammar-util': 0.11.3 + '@visactor/vrender-core': 0.17.16 + '@visactor/vrender-kits': 0.17.16 '@visactor/vutils': 0.17.3 - /@visactor/vgrammar-projection/0.10.8: - resolution: {integrity: sha512-u6LLGcedly1ZlgcaAWakFJUBm5WcctrfYwQqi5vJ9iiCnKu9Yhw3y5wjlTcxFcTYpnPKyfucF7Sk0Px+w/Q6Xw==} + /@visactor/vgrammar-projection/0.11.3: + resolution: {integrity: sha512-XY+FsRp6rHVv5BumGsXgFmwfrDM+p13a9or4ltJckfdM9B1yzRgdBZXElk4rc5VuOlv0hVOUuwu3hu1nktUoCA==} dependencies: - '@visactor/vgrammar-core': 0.10.8 - '@visactor/vgrammar-util': 0.10.8 + '@visactor/vgrammar-core': 0.11.3 + '@visactor/vgrammar-util': 0.11.3 '@visactor/vutils': 0.17.3 d3-geo: 1.12.1 - /@visactor/vgrammar-sankey/0.10.8: - resolution: {integrity: sha512-cH1lcNU+N/wTtGYTh2ny21kQUaA0/zFFL2j4gUGh1dWx4jT1/jL+/ANDYTW7hAbMcQFrv+2pBrU4G4gQXfSMQg==} + /@visactor/vgrammar-sankey/0.11.3: + resolution: {integrity: sha512-ZJRwdlT0g6woxFtnW5TanXU9ybppV9KsQ2ISQKAC5ktgnE+KrhoMaUE/xcC7S0lQUbiEOtAgeLS8iBNXHukmYw==} dependencies: - '@visactor/vgrammar-core': 0.10.8 - '@visactor/vgrammar-util': 0.10.8 - '@visactor/vrender-core': 0.17.18-alpha.0 - '@visactor/vrender-kits': 0.17.18-alpha.0 + '@visactor/vgrammar-core': 0.11.3 + '@visactor/vgrammar-util': 0.11.3 + '@visactor/vrender-core': 0.17.16 + '@visactor/vrender-kits': 0.17.16 '@visactor/vutils': 0.17.3 - /@visactor/vgrammar-util/0.10.8: - resolution: {integrity: sha512-VgdeoX1yWYiJv/KXVRA2maMhiqTXfducGEwMq4HAJ6PWJDklQv2HovENZUpqynXRh/1VbgSN4O/dHryujMucNw==} + /@visactor/vgrammar-util/0.11.3: + resolution: {integrity: sha512-tNe7wPHk5PCoqYVyz6CSh9onmfcK/idKSG7KyC3owqjou8BaI+ThzedewiwPWB96gWwHjoLo5uG9kwcCGOni2Q==} dependencies: '@visactor/vutils': 0.17.3 - /@visactor/vgrammar-wordcloud-shape/0.10.8: - resolution: {integrity: sha512-YTcMpnWSGcQo8SXQcPzjXkd8e3UuCKgyYcfpn4G5L+yvpYEza6DM+hGwKG0gL73qs2YTvFnO3nkdnmxmZwAoKw==} + /@visactor/vgrammar-wordcloud-shape/0.11.3: + resolution: {integrity: sha512-aMLS+sUO2S8k57Bfm/vypTokL4pzlYNCJX1tbUHh3bcoUyWqGveBwOkB1P6IzOD4TMMEDSLAA0bORoNfYI3aOw==} dependencies: - '@visactor/vgrammar-core': 0.10.8 - '@visactor/vgrammar-util': 0.10.8 - '@visactor/vrender-core': 0.17.18-alpha.0 - '@visactor/vrender-kits': 0.17.18-alpha.0 + '@visactor/vgrammar-core': 0.11.3 + '@visactor/vgrammar-util': 0.11.3 + '@visactor/vrender-core': 0.17.16 + '@visactor/vrender-kits': 0.17.16 '@visactor/vscale': 0.17.3 '@visactor/vutils': 0.17.3 - /@visactor/vgrammar-wordcloud/0.10.8: - resolution: {integrity: sha512-HXdXcG/pkFkQsKN+T2O6FLStl/ePjVTKOUZK5Kk+vQcK0+/v1R8eldv3b0aqoIuZLoMqc0ku4bPNHc7vmLQh5Q==} + /@visactor/vgrammar-wordcloud/0.11.3: + resolution: {integrity: sha512-z8hq+2P2pc1t5DGPEdgEAMoAffXayCye+W+Z8FRiIZflHdDlYOQrBL1gTMkh2EXXjZIYuf4qjslK4evdvrLKuQ==} dependencies: - '@visactor/vgrammar-core': 0.10.8 - '@visactor/vgrammar-util': 0.10.8 - '@visactor/vrender-core': 0.17.18-alpha.0 - '@visactor/vrender-kits': 0.17.18-alpha.0 + '@visactor/vgrammar-core': 0.11.3 + '@visactor/vgrammar-util': 0.11.3 + '@visactor/vrender-core': 0.17.16 + '@visactor/vrender-kits': 0.17.16 '@visactor/vutils': 0.17.3 - /@visactor/vrender-components/0.17.18-alpha.0: - resolution: {integrity: sha512-5YNPpKVmGhCR6aWcFHHgInMVNB8/oocNAUVR1LbxefrzCYcaohlutOll808K7twhKSEblpb0dynEQR+mVkGboQ==} + /@visactor/vrender-components/0.17.16: + resolution: {integrity: sha512-4aS6BklJUXK94n/hHA1785Cnt4nn8zt/bSaYWmmNQCEnHasy8g/W9ppWV9M4jPlaql/0edEzDruZZef004av/Q==} dependencies: - '@visactor/vrender-core': 0.17.18-alpha.0 - '@visactor/vrender-kits': 0.17.18-alpha.0 + '@visactor/vrender-core': 0.17.16 + '@visactor/vrender-kits': 0.17.16 '@visactor/vscale': 0.17.3 '@visactor/vutils': 0.17.3 - /@visactor/vrender-core/0.17.18-alpha.0: - resolution: {integrity: sha512-LBkfgp5/zmcaoJQRnk967Z4OaYfIfU8X71SPcmmksKm4nfS1rzb+tSodESoXofkdCOa5W1FF6hIFNMP31X+FsQ==} + /@visactor/vrender-components/0.17.18-alpha.1: + resolution: {integrity: sha512-LsEhO7xs6hnCSqvlKQqOZDvr8fUCfoeFrRT835flw+3OLsP+DpI7bEBegqFzNTZUxLM+GmMue7TVlQDZg+IclQ==} + dependencies: + '@visactor/vrender-core': 0.17.18-alpha.1 + '@visactor/vrender-kits': 0.17.18-alpha.1 + '@visactor/vscale': 0.17.3 + '@visactor/vutils': 0.17.3 + dev: false + + /@visactor/vrender-core/0.17.16: + resolution: {integrity: sha512-BKdGUuw6dlSGpTF3gApAxdW4Hzdld2WuDhhj2hY8RyVYcH0BaSZM1v25jPtTnOepBdT8t+DTGiHVKWKaairWOA==} + dependencies: + '@visactor/vutils': 0.17.3 + color-convert: 2.0.1 + + /@visactor/vrender-core/0.17.18-alpha.1: + resolution: {integrity: sha512-DbdBDjcF7m0CFKacKQfCgAmt8eoBxwZ6vUyWKqyIBLK5PFIFAbnxvZAxA5iw9/ORoaIrWbGkquYkN4HAGjKKnw==} dependencies: '@visactor/vutils': 0.17.3 color-convert: 2.0.1 + dev: false + + /@visactor/vrender-kits/0.17.16: + resolution: {integrity: sha512-meitvZwbcU2a5DKpUhYZ5yYeqnKXF1VJL4uCDc2t6LM2SQ45jLWqDmrilwoEJ1suj1a1hPlfJ1L/Y8CP6I3dLg==} + dependencies: + '@resvg/resvg-js': 2.4.1 + '@visactor/vrender-core': 0.17.16 + '@visactor/vutils': 0.17.3 + roughjs: 4.5.2 - /@visactor/vrender-kits/0.17.18-alpha.0: - resolution: {integrity: sha512-aGp+fdXGeLuhbqkok9xzXlM4N2evdEubFyG+0vedV/ctfmqkZRAqWwzkoKsSVJ7dFM1jUrq0VPNWcqt3Wll1ag==} + /@visactor/vrender-kits/0.17.18-alpha.1: + resolution: {integrity: sha512-pmx/jMv1N9VO74BapbvB2lhtO8Fe/rpH/naFXjSZqmPmPUu35eGwY7dsEvcNVC+n6l289zmplB2tIQ04TqkAKQ==} dependencies: '@resvg/resvg-js': 2.4.1 - '@visactor/vrender-core': 0.17.18-alpha.0 + '@visactor/vrender-core': 0.17.18-alpha.1 '@visactor/vutils': 0.17.3 roughjs: 4.5.2 + dev: false /@visactor/vscale/0.17.3: resolution: {integrity: sha512-05ESzGvJU4lS5Ndv8+rins05RaOr1eIRBnXwIdzAxv/77MTJ9X8GxRGl1y/nR14XPpPVd9vgdzYRTCbpL6hPHg==} @@ -3491,17 +3516,17 @@ packages: /@visactor/vutils-extension/1.8.5: resolution: {integrity: sha512-3DJMhGLmQ5Mk6VSxuLFKCzM9XIFkwGauU4el6skUY5qmmAbyZjOyneycAUiGCcbxZHvHpg1jyRk27Eipf4+bgQ==} dependencies: - '@visactor/vrender-core': 0.17.18-alpha.0 - '@visactor/vrender-kits': 0.17.18-alpha.0 + '@visactor/vrender-core': 0.17.18-alpha.1 + '@visactor/vrender-kits': 0.17.18-alpha.1 '@visactor/vscale': 0.17.3 '@visactor/vutils': 0.17.3 dev: false - /@visactor/vutils-extension/1.8.7: - resolution: {integrity: sha512-o6Hw5+jqj9IzPS6babV0fyQ8RC9r2DHfvSx5fC/cEuHdvCVYjtzdHJHGmjJ42EAp4PGGUUn2MtGyaxFtzxSD5A==} + /@visactor/vutils-extension/1.9.0-alpha.1: + resolution: {integrity: sha512-4XCb57MyriONzSFUDYiluy2zBncyAgHTLQre5mWWKUT4il8C3hRQuKgNgmMSXCZ8T6ywUGClxDMXn/r6HMGKSQ==} dependencies: - '@visactor/vrender-core': 0.17.18-alpha.0 - '@visactor/vrender-kits': 0.17.18-alpha.0 + '@visactor/vrender-core': 0.17.16 + '@visactor/vrender-kits': 0.17.16 '@visactor/vscale': 0.17.3 '@visactor/vutils': 0.17.3 diff --git a/docs/package.json b/docs/package.json index e137e19ab..5e2ecb06f 100644 --- a/docs/package.json +++ b/docs/package.json @@ -13,7 +13,7 @@ "@visactor/vtable": "workspace:*", "@visactor/vtable-editors": "workspace:*", "@visactor/vtable-export": "workspace:*", - "@visactor/vchart": "1.8.7", + "@visactor/vchart": "1.9.0-alpha.1", "markdown-it": "^13.0.0", "highlight.js": "^11.8.0", "axios": "^1.4.0", diff --git a/packages/react-vtable/package.json b/packages/react-vtable/package.json index 419282ef2..994b2a2fd 100644 --- a/packages/react-vtable/package.json +++ b/packages/react-vtable/package.json @@ -52,7 +52,7 @@ "react-is": "^18.2.0" }, "devDependencies": { - "@visactor/vchart": "1.8.7", + "@visactor/vchart": "1.9.0-alpha.1", "@internal/bundler": "workspace:*", "@internal/eslint-config": "workspace:*", "@internal/ts-config": "workspace:*", @@ -96,4 +96,4 @@ "axios": "^1.4.0", "@types/react-is": "^17.0.3" } -} +} \ No newline at end of file diff --git a/packages/vtable-export/package.json b/packages/vtable-export/package.json index 3263e7a3c..12d98f41f 100644 --- a/packages/vtable-export/package.json +++ b/packages/vtable-export/package.json @@ -40,7 +40,7 @@ "exceljs": "4.4.0" }, "devDependencies": { - "@visactor/vchart": "1.8.7", + "@visactor/vchart": "1.9.0-alpha.1", "@internal/bundler": "workspace:*", "@internal/eslint-config": "workspace:*", "@internal/ts-config": "workspace:*", @@ -85,4 +85,4 @@ "@types/react-is": "^17.0.3", "rollup-plugin-node-resolve": "5.2.0" } -} +} \ No newline at end of file diff --git a/packages/vtable/package.json b/packages/vtable/package.json index 14f8385b2..8c62da3ef 100644 --- a/packages/vtable/package.json +++ b/packages/vtable/package.json @@ -50,9 +50,9 @@ }, "dependencies": { "@visactor/vtable-editors": "workspace:*", - "@visactor/vrender-core": "0.17.18-alpha.0", - "@visactor/vrender-kits": "0.17.18-alpha.0", - "@visactor/vrender-components": "0.17.18-alpha.0", + "@visactor/vrender-core": "0.17.18-alpha.1", + "@visactor/vrender-kits": "0.17.18-alpha.1", + "@visactor/vrender-components": "0.17.18-alpha.1", "@visactor/vutils-extension": "~1.8.5", "@visactor/vutils": "~0.17.1", "@visactor/vscale": "~0.17.1", @@ -61,7 +61,7 @@ }, "devDependencies": { "luxon": "*", - "@visactor/vchart": "1.8.7", + "@visactor/vchart": "1.9.0-alpha.1", "@internal/bundler": "workspace:*", "@internal/eslint-config": "workspace:*", "@internal/ts-config": "workspace:*", diff --git a/packages/vtable/src/icons.ts b/packages/vtable/src/icons.ts index c82a6bcae..4c35247c5 100644 --- a/packages/vtable/src/icons.ts +++ b/packages/vtable/src/icons.ts @@ -228,6 +228,16 @@ const builtins = { cursor: 'pointer' }; }, + get loading_pic(): SvgIcon { + return { + type: 'svg', + svg: '', + width: 400, + height: 300, + name: 'loading_pic', + positionType: IconPosition.left + }; + }, //展开状态的按钮 向下三角 get expand(): SvgIcon { return { diff --git a/packages/vtable/src/scenegraph/graphic/contributions/draw-interceptor.ts b/packages/vtable/src/scenegraph/graphic/contributions/draw-interceptor.ts new file mode 100644 index 000000000..bc7a3ea8f --- /dev/null +++ b/packages/vtable/src/scenegraph/graphic/contributions/draw-interceptor.ts @@ -0,0 +1,143 @@ +import type { + IDrawItemInterceptorContribution, + IGraphic, + IRenderService, + IDrawContext, + IDrawContribution, + IGraphicRenderDrawParams, + IImage +} from '@src/vrender'; +import { injectable, createImage } from '@src/vrender'; +import * as icons from '../../../icons'; +import { calcKeepAspectRatioSize } from '../../utils/keep-aspect-ratio'; +let loadingImage: IImage; + +@injectable() +export class VTableDrawItemInterceptorContribution implements IDrawItemInterceptorContribution { + order: number = 1; + interceptors: IDrawItemInterceptorContribution[]; + constructor() { + this.interceptors = [new ImageDrawItemInterceptorContribution()]; + } + afterDrawItem( + graphic: IGraphic, + renderService: IRenderService, + drawContext: IDrawContext, + drawContribution: IDrawContribution, + params?: IGraphicRenderDrawParams + ): boolean { + for (let i = 0; i < this.interceptors.length; i++) { + if ( + this.interceptors[i].afterDrawItem && + this.interceptors[i].afterDrawItem(graphic, renderService, drawContext, drawContribution, params) + ) { + return true; + } + } + return false; + } + + beforeDrawItem( + graphic: IGraphic, + renderService: IRenderService, + drawContext: IDrawContext, + drawContribution: IDrawContribution, + params?: IGraphicRenderDrawParams + ): boolean { + // 【性能方案】判定写在外层,减少遍历判断耗时,10000条数据减少1ms + if ( + (!graphic.in3dMode || drawContext.in3dInterceptor) && + !graphic.shadowRoot && + !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic) + ) { + return false; + } + + for (let i = 0; i < this.interceptors.length; i++) { + if ( + this.interceptors[i].beforeDrawItem && + this.interceptors[i].beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) + ) { + return true; + } + } + return false; + } +} + +export class ImageDrawItemInterceptorContribution implements IDrawItemInterceptorContribution { + order: number = 1; + + afterDrawItem( + graphic: IGraphic, + renderService: IRenderService, + drawContext: IDrawContext, + drawContribution: IDrawContribution, + params?: IGraphicRenderDrawParams + ): boolean { + if (graphic.type === 'image') { + this.drawItem(graphic, renderService, drawContext, drawContribution, params); + } + return false; + } + + protected drawItem( + graphic: IImage, + renderService: IRenderService, + drawContext: IDrawContext, + drawContribution: IDrawContribution, + params?: IGraphicRenderDrawParams + ): boolean { + const { image: url } = graphic.attribute; + if (!url || !graphic.resources) { + return false; + } + const res = graphic.resources.get(url); + if (res.state !== 'loading') { + return false; + } + + if (!loadingImage) { + const regedIcons = icons.get(); + const svg = (regedIcons.loading_pic as any).svg; + const width = (regedIcons.loading_pic as any).width; + const height = (regedIcons.loading_pic as any).height; + loadingImage = createImage({ + width, + height, + image: svg + }); + } + const { image: loadingUrl } = loadingImage.attribute; + if (!url || !loadingImage.resources) { + return false; + } + const loadingRes = loadingImage.resources.get(loadingUrl); + if (loadingRes.state !== 'success') { + return false; + } + + const { context } = drawContext; + context.highPerformanceSave(); + // 直接transform + graphic.parent && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, true); + graphic.glyphHost && + graphic.glyphHost.parent && + context.setTransformFromMatrix(graphic.glyphHost.parent.globalTransMatrix, true); + + const b = graphic.AABBBounds; + + const { width, height } = calcKeepAspectRatioSize( + loadingRes.data.width, + loadingRes.data.height, + b.width(), + b.height() + ); + + context.drawImage(loadingRes.data, b.x1 + (b.width() - width) / 2, b.y1 + (b.height() - height) / 2, width, height); + + context.highPerformanceRestore(); + + return true; + } +} diff --git a/packages/vtable/src/scenegraph/graphic/contributions/index.ts b/packages/vtable/src/scenegraph/graphic/contributions/index.ts index d74d060ec..65648d490 100644 --- a/packages/vtable/src/scenegraph/graphic/contributions/index.ts +++ b/packages/vtable/src/scenegraph/graphic/contributions/index.ts @@ -5,7 +5,8 @@ import { RectRenderContribution, SplitRectBeforeRenderContribution, SplitRectAfterRenderContribution, - ContainerModule + ContainerModule, + DrawItemInterceptor } from '@src/vrender'; import { ChartRender, DefaultCanvasChartRender } from './chart-render'; import { AfterImageRenderContribution, BeforeImageRenderContribution } from './image-contribution-render'; @@ -25,6 +26,7 @@ import { ClipBodyGroupBeforeRenderContribution, ClipBodyGroupAfterRenderContribution } from './group-contribution-render'; +import { VTableDrawItemInterceptorContribution } from './draw-interceptor'; export default new ContainerModule((bind, unbind, isBound, rebind) => { // rect 渲染器注入contributions @@ -77,4 +79,8 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => { bind(GroupRenderContribution).toService(ClipBodyGroupBeforeRenderContribution); bind(ClipBodyGroupAfterRenderContribution).toSelf().inSingletonScope(); bind(GroupRenderContribution).toService(ClipBodyGroupAfterRenderContribution); + + // interceptor + bind(VTableDrawItemInterceptorContribution).toSelf().inSingletonScope(); + bind(DrawItemInterceptor).toService(VTableDrawItemInterceptorContribution); }); diff --git a/packages/vtable/src/scenegraph/group-creater/cell-type/image-cell.ts b/packages/vtable/src/scenegraph/group-creater/cell-type/image-cell.ts index 140a6cef3..2effcf8ae 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-type/image-cell.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-type/image-cell.ts @@ -12,8 +12,6 @@ import { getProp, getFunctionalProp } from '../../utils/get-prop'; import { isValid } from '@visactor/vutils'; import { getQuadProps } from '../../utils/padding'; -const regedIcons = icons.get(); - export function createImageCellGroup( columnGroup: Group, xOrigin: number, @@ -335,7 +333,7 @@ function updateAutoSizingAndKeepAspectRatio( const originImage = image.resources.get(image.attribute.image).data; const { col, row } = cellGroup; - if (imageAutoSizing) { + if (imageAutoSizing && !isDamagePic(image)) { _adjustWidthHeight( col, row, @@ -345,8 +343,7 @@ function updateAutoSizingAndKeepAspectRatio( padding ); } - - if (keepAspectRatio) { + if (keepAspectRatio || isDamagePic(image)) { const { width: cellWidth, height: cellHeight, isMerge } = getCellRange(cellGroup, table); const { width: imageWidth, height: imageHeight } = calcKeepAspectRatioSize( @@ -394,3 +391,8 @@ function updateAutoSizingAndKeepAspectRatio( } } } + +function isDamagePic(image: IImage) { + const regedIcons = icons.get(); + return image.attribute.image === (regedIcons.damage_pic as any).svg; +} From a791495c3f5fe3621ffbfd92149072fd04b0a01d Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Wed, 24 Jan 2024 18:00:07 +0800 Subject: [PATCH 022/115] refactor: optimize updateRow api performance & resize bottom frozen row not right --- packages/vtable/examples/list/list.ts | 161 +----------------- packages/vtable/src/layout/row-height-map.ts | 2 +- .../vtable/src/layout/simple-header-layout.ts | 2 +- .../scenegraph/layout/compute-row-height.ts | 11 +- .../src/scenegraph/layout/update-height.ts | 5 +- .../src/scenegraph/layout/update-row.ts | 13 +- packages/vtable/src/scenegraph/scenegraph.ts | 41 ++++- packages/vtable/src/tools/util.ts | 10 ++ 8 files changed, 66 insertions(+), 179 deletions(-) diff --git a/packages/vtable/examples/list/list.ts b/packages/vtable/examples/list/list.ts index 6bb38aec5..0ffe2a9bf 100644 --- a/packages/vtable/examples/list/list.ts +++ b/packages/vtable/examples/list/list.ts @@ -16,7 +16,7 @@ const generatePersons = count => { }; export function createTable() { - const records = generatePersons(1000000); + const records = generatePersons(10); const columns: VTable.ColumnsDefine = [ { field: '', @@ -29,8 +29,8 @@ export function createTable() { { field: 'id', title: 'ID', - width: '1%', - minWidth: 200, + width: 'auto', + minWidth: 50, sort: true }, { @@ -149,156 +149,6 @@ export function createTable() { title: 'job', width: 200 }, - { - field: 'city', - title: 'city', - width: 150 - }, - { - field: 'date1', - title: 'birthday', - width: 200 - }, - { - field: 'sex', - title: 'sex', - width: 100 - }, - { - field: 'tel', - title: 'telephone', - width: 150 - }, - { - field: 'work', - title: 'job', - width: 200 - }, - { - field: 'city', - title: 'city', - width: 150 - }, - { - field: 'date1', - title: 'birthday', - width: 200 - }, - { - field: 'sex', - title: 'sex', - width: 100 - }, - { - field: 'tel', - title: 'telephone', - width: 150 - }, - { - field: 'work', - title: 'job', - width: 200 - }, - { - field: 'city', - title: 'city', - width: 150 - }, - { - field: 'date1', - title: 'birthday', - width: 200 - }, - { - field: 'sex', - title: 'sex', - width: 100 - }, - { - field: 'tel', - title: 'telephone', - width: 150 - }, - { - field: 'work', - title: 'job', - width: 200 - }, - { - field: 'city', - title: 'city', - width: 150 - }, - { - field: 'date1', - title: 'birthday', - width: 200 - }, - { - field: 'sex', - title: 'sex', - width: 100 - }, - { - field: 'tel', - title: 'telephone', - width: 150 - }, - { - field: 'work', - title: 'job', - width: 200 - }, - { - field: 'city', - title: 'city', - width: 150 - }, - { - field: 'date1', - title: 'birthday', - width: 200 - }, - { - field: 'sex', - title: 'sex', - width: 100 - }, - { - field: 'tel', - title: 'telephone', - width: 150 - }, - { - field: 'work', - title: 'job', - width: 200 - }, - { - field: 'city', - title: 'city', - width: 150 - }, - { - field: 'date1', - title: 'birthday', - width: 200 - }, - { - field: 'sex', - title: 'sex', - width: 100 - }, - { - field: 'tel', - title: 'telephone', - width: 150 - }, - { - field: 'work', - title: 'job', - width: 200 - }, { field: 'city', title: 'city', @@ -317,7 +167,8 @@ export function createTable() { rightFrozenColCount: 2, overscrollBehavior: 'none', autoWrapText: true, - heightMode: 'autoHeight', + heightMode: 'adaptive', + widthMode: 'adaptive', dragHeaderMode: 'all', keyboardOptions: { pasteValueToCell: true @@ -333,7 +184,7 @@ export function createTable() { console.log(arg); }); setTimeout(() => { - tableInstance.addRecord({ id: 333 }, 6); + tableInstance.addRecord({ id: 339993 }, 6); }, 3000); // tableInstance.on('sort_click', args => { // tableInstance.updateSortState( diff --git a/packages/vtable/src/layout/row-height-map.ts b/packages/vtable/src/layout/row-height-map.ts index a05606c50..a856bfd2f 100644 --- a/packages/vtable/src/layout/row-height-map.ts +++ b/packages/vtable/src/layout/row-height-map.ts @@ -169,7 +169,7 @@ export class NumberRangeMap { // add and reorder insert(position: number, value?: number) { - const lastIndex = this.getLastIndex(); + const lastIndex = this.getLastIndex() + 1; this.adjustOrder(position, position + 1, lastIndex - position); if (isValid(value)) { this.put(position, value); diff --git a/packages/vtable/src/layout/simple-header-layout.ts b/packages/vtable/src/layout/simple-header-layout.ts index b9336bf0d..863f7b23d 100644 --- a/packages/vtable/src/layout/simple-header-layout.ts +++ b/packages/vtable/src/layout/simple-header-layout.ts @@ -181,7 +181,7 @@ export class SimpleHeaderLayoutMap implements LayoutMapAPI { } } else { row = col; - if (this.frozenRowCount > 0 && row >= this.rowCount - this.bottomFrozenRowCount) { + if (this.bottomFrozenRowCount > 0 && row >= this.rowCount - this.bottomFrozenRowCount) { return true; } } diff --git a/packages/vtable/src/scenegraph/layout/compute-row-height.ts b/packages/vtable/src/scenegraph/layout/compute-row-height.ts index c5f6452ee..149e7d82a 100644 --- a/packages/vtable/src/scenegraph/layout/compute-row-height.ts +++ b/packages/vtable/src/scenegraph/layout/compute-row-height.ts @@ -277,7 +277,16 @@ export function computeRowsHeight( // table.scenegraph.updateRowHeight(row, newRowHeight - oldRowHeights[row], true); } } - for (let row = 0; row < table.rowCount; row++) { + + const updateRowStart = table.scenegraph.proxy.rowStart; + let updateRowEnd = table.scenegraph.proxy.rowEnd; + if ( + table.heightMode === 'adaptive' || + (table.autoFillHeight && table.getAllRowsHeight() <= table.tableNoFrameHeight) + ) { + updateRowEnd = table.rowCount - 1; + } + for (let row = updateRowStart; row <= updateRowEnd; row++) { const newRowHeight = table.getRowHeight(row); if (newRowHeight !== oldRowHeights[row]) { // update the row height in scenegraph diff --git a/packages/vtable/src/scenegraph/layout/update-height.ts b/packages/vtable/src/scenegraph/layout/update-height.ts index 40458263c..338cd5ea2 100644 --- a/packages/vtable/src/scenegraph/layout/update-height.ts +++ b/packages/vtable/src/scenegraph/layout/update-height.ts @@ -49,10 +49,13 @@ export function updateRowHeight(scene: Scenegraph, row: number, detaY: number, s rowStart = row + 1; rowEnd = scene.table.columnHeaderLevelCount - 1; + } else if (row >= scene.table.rowCount - scene.table.bottomFrozenRowCount) { + rowStart = row + 1; + rowEnd = scene.table.rowCount - 1; } else { rowStart = row + 1; // rowEnd = scene.table.rowCount - 1; - rowEnd = scene.bodyRowEnd; //- scene.table.bottomFrozenRowCount; + rowEnd = Math.min(scene.proxy.rowEnd, scene.table.rowCount - scene.table.bottomFrozenRowCount - 1); //- scene.table.bottomFrozenRowCount; } // 更新以下行位置 diff --git a/packages/vtable/src/scenegraph/layout/update-row.ts b/packages/vtable/src/scenegraph/layout/update-row.ts index 1c6316ec3..4dc2250e8 100644 --- a/packages/vtable/src/scenegraph/layout/update-row.ts +++ b/packages/vtable/src/scenegraph/layout/update-row.ts @@ -5,6 +5,7 @@ import { Group } from '../graphic/group'; import { updateCell } from '../group-creater/cell-helper'; import type { Scenegraph } from '../scenegraph'; import { getCellMergeInfo } from '../utils/get-cell-merge'; +import { deduplication } from '../../tools/util'; /** * add and remove rows in scenegraph @@ -201,18 +202,6 @@ function addRow(row: number, scene: Scenegraph) { // scene.proxy.rowEnd++; // scene.proxy.currentRow++; } - -// array deduplication -function deduplication(array: number[]) { - const result = []; - for (let i = 0; i < array.length; i++) { - if (result.indexOf(array[i]) === -1) { - result.push(array[i]); - } - } - return result; -} - function resetRowNumber(scene: Scenegraph) { scene.bodyGroup.forEachChildren((colGroup: Group) => { let rowIndex = scene.bodyRowStart; diff --git a/packages/vtable/src/scenegraph/scenegraph.ts b/packages/vtable/src/scenegraph/scenegraph.ts index b7a872df8..f556a35f7 100644 --- a/packages/vtable/src/scenegraph/scenegraph.ts +++ b/packages/vtable/src/scenegraph/scenegraph.ts @@ -34,7 +34,7 @@ import { moveSelectingRangeComponentsToSelectedRangeComponents } from './select/ import { deleteAllSelectBorder, deleteLastSelectedRangeComponents } from './select/delete-select-border'; import { updateRow } from './layout/update-row'; import { handleTextStick } from './stick-text'; -import { computeRowsHeight } from './layout/compute-row-height'; +import { computeRowHeight, computeRowsHeight } from './layout/compute-row-height'; import { emptyGroup } from './utils/empty-group'; import { dealBottomFrozen, dealFrozen, dealRightFrozen, resetFrozen } from './layout/frozen'; import { updateChartSize, updateChartState } from './refresh-node/update-chart'; @@ -60,6 +60,7 @@ import { import { Env } from '../tools/env'; import { createCornerCell } from './style/corner-cell'; import { updateCol } from './layout/update-col'; +import { deduplication } from '../tools/util'; // import { contextModule } from './context/module'; registerForVrender(); @@ -937,11 +938,9 @@ export class Scenegraph { } updateRowHeight(row: number, detaY: number, skipTableHeightMap?: boolean) { - if (row >= this.proxy.rowStart && row <= this.proxy.rowEnd) { - detaY = Math.round(detaY); - updateRowHeight(this, row, detaY, skipTableHeightMap); - this.updateContainerHeight(row, detaY); - } + detaY = Math.round(detaY); + updateRowHeight(this, row, detaY, skipTableHeightMap); + this.updateContainerHeight(row, detaY); } updateRowsHeight(rows: number[], detaYs: number[], skipTableHeightMap?: boolean) { for (let i = 0; i < rows.length; i++) { @@ -1022,7 +1021,12 @@ export class Scenegraph { if (oldHeight === height) { return; } - this.updateRowHeight(row, height - oldHeight); + if ( + (row >= this.proxy.rowStart && row <= this.proxy.rowEnd) || + (row >= this.table.rowCount - this.table.bottomFrozenRowCount && row <= this.table.rowCount - 1) + ) { + this.updateRowHeight(row, height - oldHeight); + } this.table._clearRowRangeHeightsMap(row); } @@ -1648,14 +1652,35 @@ export class Scenegraph { } updateRow(removeCells: CellAddress[], addCells: CellAddress[], updateCells: CellAddress[] = []) { + const addRows = deduplication(addCells.map(cell => cell.row)).sort((a, b) => a - b); + const updateRows = deduplication(updateCells.map(cell => cell.row)).sort((a, b) => a - b); + console.log('updateRow', addRows, updateRows); // add or move rows updateRow(removeCells, addCells, updateCells, this.table); // update column width and row height this.recalculateColWidths(); - this.recalculateRowHeights(); + // this.recalculateRowHeights(); + if ( + this.table.heightMode === 'adaptive' || + (this.table.autoFillHeight && this.table.getAllRowsHeight() <= this.table.tableNoFrameHeight) + ) { + this.table.scenegraph.recalculateRowHeights(); + } else if (this.table.heightMode === 'autoHeight') { + for (let i = 0; i < updateRows.length; i++) { + const row = updateRows[i]; + const oldHeight = this.table.getRowHeight(row); + const newHeight = computeRowHeight(row, 0, this.table.colCount - 1, this.table); + if ( + (row >= this.proxy.rowStart && row <= this.proxy.rowEnd) || + (row >= this.table.rowCount - this.table.bottomFrozenRowCount && row <= this.table.rowCount - 1) + ) { + this.table.scenegraph.updateRowHeight(row, newHeight - oldHeight); + } + } + } // check frozen status this.table.stateManager.checkFrozen(); diff --git a/packages/vtable/src/tools/util.ts b/packages/vtable/src/tools/util.ts index 8d6eebb95..c16df72bb 100644 --- a/packages/vtable/src/tools/util.ts +++ b/packages/vtable/src/tools/util.ts @@ -435,3 +435,13 @@ export function isAllDigits(str: string) { const pattern = /^-?\d+(\.\d+)?$/; return pattern.test(str); } +// array deduplication +export function deduplication(array: number[]) { + const result = []; + for (let i = 0; i < array.length; i++) { + if (result.indexOf(array[i]) === -1) { + result.push(array[i]); + } + } + return result; +} From 794db9d22f4588031b2fc2db87c26ac9db99dfa5 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Wed, 24 Jan 2024 18:00:37 +0800 Subject: [PATCH 023/115] docs: update changlog of rush --- ...at-refactor-row-height-range_2024-01-24-10-00.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vtable/feat-refactor-row-height-range_2024-01-24-10-00.json diff --git a/common/changes/@visactor/vtable/feat-refactor-row-height-range_2024-01-24-10-00.json b/common/changes/@visactor/vtable/feat-refactor-row-height-range_2024-01-24-10-00.json new file mode 100644 index 000000000..2db425ed7 --- /dev/null +++ b/common/changes/@visactor/vtable/feat-refactor-row-height-range_2024-01-24-10-00.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "refactor: optimize updateRow api performance & resize bottom frozen row not right\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file From 61d42c6510076ed2c4cd5ece51e322098c6c1320 Mon Sep 17 00:00:00 2001 From: fangsmile Date: Thu, 25 Jan 2024 02:43:33 +0000 Subject: [PATCH 024/115] docs: generate changelog of release v0.18.2 --- docs/assets/changelog/en/release.md | 23 +++++++++++++++++++++++ docs/assets/changelog/zh/release.md | 23 +++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/docs/assets/changelog/en/release.md b/docs/assets/changelog/en/release.md index 37416e5c2..04cce541e 100644 --- a/docs/assets/changelog/en/release.md +++ b/docs/assets/changelog/en/release.md @@ -1,3 +1,26 @@ +# v0.18.2 + +2024-01-25 + + +**🆕 New feature** + +- **@visactor/vtable**: add component update + +**🐛 Bug fix** + +- **@visactor/vtable**: fix rowHeaderGroup attribute y when has no colHeaderGroup [#971](https://github.com/VisActor/VTable/issues/971) +- **@visactor/vtable**: transpose bottomFrozenRow cell layout error [#978](https://github.com/VisActor/VTable/issues/978) +- **@visactor/vtable**: passte value to last row occur error [#979](https://github.com/VisActor/VTable/issues/979) +- **@visactor/vtable**: use updateColumns api click state not right [#975](https://github.com/VisActor/VTable/issues/975) +- **@visactor/vtable**: record has nan string value pivotchart cell value parse handle this case [#993](https://github.com/VisActor/VTable/issues/993) +- **@visactor/vtable**: row Height compute for axis +- **@visactor/vtable**: fix deltaY col number in moveCell() + + + +[more detail about v0.18.2](https://github.com/VisActor/VTable/releases/tag/v0.18.2) + # v0.18.0 2024-01-19 diff --git a/docs/assets/changelog/zh/release.md b/docs/assets/changelog/zh/release.md index 87d0f6364..3d1535b8b 100644 --- a/docs/assets/changelog/zh/release.md +++ b/docs/assets/changelog/zh/release.md @@ -1,3 +1,26 @@ +# v0.18.2 + +2024-01-25 + + +**🆕 新增功能** + +- **@visactor/vtable**: add component update + +**🐛 功能修复** + +- **@visactor/vtable**: fix rowHeaderGroup attribute y when has no colHeaderGroup [#971](https://github.com/VisActor/VTable/issues/971) +- **@visactor/vtable**: transpose bottomFrozenRow cell layout error [#978](https://github.com/VisActor/VTable/issues/978) +- **@visactor/vtable**: passte value to last row occur error [#979](https://github.com/VisActor/VTable/issues/979) +- **@visactor/vtable**: use updateColumns api click state not right [#975](https://github.com/VisActor/VTable/issues/975) +- **@visactor/vtable**: record has nan string value pivotchart cell value parse handle this case [#993](https://github.com/VisActor/VTable/issues/993) +- **@visactor/vtable**: row Height compute for axis +- **@visactor/vtable**: fix deltaY col number in moveCell() + + + +[更多详情请查看 v0.18.2](https://github.com/VisActor/VTable/releases/tag/v0.18.2) + # v0.18.0 2024-01-19 From 8b988cb5d50c1c69188e92ae8cd196fe50fb41dd Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Thu, 25 Jan 2024 12:16:50 +0800 Subject: [PATCH 025/115] fix: widthmode and heightMode set adaptive and set autoWrapText resize window layout error #1003 --- .../scenegraph/layout/compute-row-height.ts | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/packages/vtable/src/scenegraph/layout/compute-row-height.ts b/packages/vtable/src/scenegraph/layout/compute-row-height.ts index 149e7d82a..a0dcddc70 100644 --- a/packages/vtable/src/scenegraph/layout/compute-row-height.ts +++ b/packages/vtable/src/scenegraph/layout/compute-row-height.ts @@ -79,11 +79,9 @@ export function computeRowsHeight( } if (isAllRowsAuto || table.getDefaultRowHeight(row) === 'auto') { const height = computeRowHeight(row, startCol, endCol, table); - if (update) { - newHeights[row] = Math.round(height); - } else { - table._setRowHeight(row, height); - } + newHeights[row] = Math.round(height); + //表头部分需要马上设置到缓存中 因为adaptive不会调整表头的高度 另外后面adaptive处理过程中有取值 table.getRowsHeight(0, table.columnHeaderLevelCount - 1); + table._setRowHeight(row, height); } } @@ -272,25 +270,33 @@ export function computeRowsHeight( for (let row = 0; row < table.rowCount; row++) { const newRowHeight = newHeights[row] ?? table.getRowHeight(row); if (newRowHeight !== oldRowHeights[row]) { - // update the row height in scenegraph table._setRowHeight(row, newRowHeight); - // table.scenegraph.updateRowHeight(row, newRowHeight - oldRowHeights[row], true); } } - const updateRowStart = table.scenegraph.proxy.rowStart; - let updateRowEnd = table.scenegraph.proxy.rowEnd; if ( table.heightMode === 'adaptive' || (table.autoFillHeight && table.getAllRowsHeight() <= table.tableNoFrameHeight) ) { - updateRowEnd = table.rowCount - 1; + for (let row = 0; row <= table.columnHeaderLevelCount - 1; row++) { + const newRowHeight = table.getRowHeight(row); + if (newRowHeight !== oldRowHeights[row]) { + // update the row height in scenegraph + table.scenegraph.updateRowHeight(row, newRowHeight - oldRowHeights[row], true); + } + } + for (let row = table.rowCount - table.bottomFrozenRowCount; row <= table.rowCount - 1; row++) { + const newRowHeight = table.getRowHeight(row); + if (newRowHeight !== oldRowHeights[row]) { + // update the row height in scenegraph + table.scenegraph.updateRowHeight(row, newRowHeight - oldRowHeights[row], true); + } + } } - for (let row = updateRowStart; row <= updateRowEnd; row++) { + for (let row = table.scenegraph.proxy.rowStart; row <= table.scenegraph.proxy.rowEnd; row++) { const newRowHeight = table.getRowHeight(row); if (newRowHeight !== oldRowHeights[row]) { // update the row height in scenegraph - // table._setRowHeight(row, newRowHeight); table.scenegraph.updateRowHeight(row, newRowHeight - oldRowHeights[row], true); } } From 581bdd6ad9f1177b8a0296bfd4a74c4279aa5a6a Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Thu, 25 Jan 2024 14:52:40 +0800 Subject: [PATCH 026/115] fix: list tree hierarchy state change problems --- packages/vtable/src/scenegraph/scenegraph.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/vtable/src/scenegraph/scenegraph.ts b/packages/vtable/src/scenegraph/scenegraph.ts index 91bad429f..0dd06a363 100644 --- a/packages/vtable/src/scenegraph/scenegraph.ts +++ b/packages/vtable/src/scenegraph/scenegraph.ts @@ -1658,7 +1658,14 @@ export class Scenegraph { updateRow(removeCells: CellAddress[], addCells: CellAddress[], updateCells: CellAddress[] = []) { const addRows = deduplication(addCells.map(cell => cell.row)).sort((a, b) => a - b); const updateRows = deduplication(updateCells.map(cell => cell.row)).sort((a, b) => a - b); - console.log('updateRow', addRows, updateRows); + //这个值是后续为了autoFillHeight判断逻辑中用到的 判断是否更新前是未填满的情况 + const isNotFillHeight = + this.table.getAllRowsHeight() - + [...addRows, ...updateRows].reduce((tolHeight, rowNumber) => { + return tolHeight + this.table.getRowHeight(rowNumber); + }, 0) <= + this.table.tableNoFrameHeight; + // add or move rows updateRow(removeCells, addCells, updateCells, this.table); @@ -1669,7 +1676,7 @@ export class Scenegraph { if ( this.table.heightMode === 'adaptive' || - (this.table.autoFillHeight && this.table.getAllRowsHeight() <= this.table.tableNoFrameHeight) + (this.table.autoFillHeight && (this.table.getAllRowsHeight() <= this.table.tableNoFrameHeight || isNotFillHeight)) ) { this.table.scenegraph.recalculateRowHeights(); } else if (this.table.heightMode === 'autoHeight') { From f4113e267b1253a6ca5c74a67cfcd094ad890419 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Thu, 25 Jan 2024 17:04:35 +0800 Subject: [PATCH 027/115] fix: click outside of cells click cancel select state --- docs/assets/guide/menu.json | 12 ++++++------ packages/vtable/src/event/listener/table-group.ts | 4 ++-- packages/vtable/src/ts-types/base-table.ts | 5 +++++ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/docs/assets/guide/menu.json b/docs/assets/guide/menu.json index 95f6b88f1..afd95c6a0 100644 --- a/docs/assets/guide/menu.json +++ b/docs/assets/guide/menu.json @@ -338,35 +338,35 @@ "path": "custom_icon", "title": { "zh": "自定义icon", - "en": "custom_icon" + "en": "custom icon" } }, { "path": "custom_layout", "title": { - "zh": "单元格自定义布局", - "en": "custom_layout" + "zh": "单元格自定义渲染(JSX)", + "en": "custom render(JSX)" } }, { "path": "custom_render", "title": { "zh": "单元格自定义渲染", - "en": "custom_render" + "en": "custom render" } }, { "path": "custom_component", "title": { "zh": "自定义交互组件", - "en": "custom_interactive_component" + "en": "custom interactive component" } }, { "path": "custom_merge", "title": { "zh": "自定义单元格合并", - "en": "custom_merge" + "en": "custom merge" } } ] diff --git a/packages/vtable/src/event/listener/table-group.ts b/packages/vtable/src/event/listener/table-group.ts index 1bbe7cfae..c6945d174 100644 --- a/packages/vtable/src/event/listener/table-group.ts +++ b/packages/vtable/src/event/listener/table-group.ts @@ -1,4 +1,4 @@ -import type { IEventTarget, INode } from '@src/vrender'; +import type { IEventTarget } from '@src/vrender'; import { Gesture, type FederatedPointerEvent } from '@src/vrender'; import type { ListTableAPI, @@ -625,7 +625,7 @@ export function bindTableGroupListener(eventManager: EventManager) { // 如果是鼠标点击到canvas空白区域 则取消选中状态 !table.eventManager.isDraging && target && - target.isDescendantsOf(table.scenegraph.stage) && //防止已经被删除掉了 + (target.isDescendantsOf(table.scenegraph.stage) || (target as any).stage === target) && //判断节点未被删除 后面这个是为了判断是stage本身 !target.isDescendantsOf(table.scenegraph.tableGroup) // && // (target as any) !== table.scenegraph.tableGroup && diff --git a/packages/vtable/src/ts-types/base-table.ts b/packages/vtable/src/ts-types/base-table.ts index 5966d3726..e8afc5e23 100644 --- a/packages/vtable/src/ts-types/base-table.ts +++ b/packages/vtable/src/ts-types/base-table.ts @@ -682,6 +682,11 @@ export interface BaseTableAPI { getBodyIndexByTableIndex: (col: number, row: number) => CellAddress; /** 根据body部分的列索引及行索引,获取单元格的行列号 */ getTableIndexByBodyIndex: (col: number, row: number) => CellAddress; + /** + * 滚动到具体某个单元格位置 + * @param cellAddr 要滚动到的单元格位置 + */ + scrollToCell: (cellAddr: { col?: number; row?: number }) => void; } export interface ListTableProtected extends IBaseTableProtected { /** 表格数据 */ From c7a2db3e7ce4067b0b9d6b893ac33532a86f82cf Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Thu, 25 Jan 2024 17:04:55 +0800 Subject: [PATCH 028/115] docs: update changlog of rush --- ...fix-clickoutsideCancelSelect_2024-01-25-09-04.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vtable/fix-clickoutsideCancelSelect_2024-01-25-09-04.json diff --git a/common/changes/@visactor/vtable/fix-clickoutsideCancelSelect_2024-01-25-09-04.json b/common/changes/@visactor/vtable/fix-clickoutsideCancelSelect_2024-01-25-09-04.json new file mode 100644 index 000000000..8ac6020a3 --- /dev/null +++ b/common/changes/@visactor/vtable/fix-clickoutsideCancelSelect_2024-01-25-09-04.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: click outside of cells click cancel select state\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file From 7ff8ac7bc7bf7d86682c37d8f3abbfea57397c65 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Thu, 25 Jan 2024 18:10:47 +0800 Subject: [PATCH 029/115] refactor: add function cancelEdit to editorManager --- packages/vtable/src/edit/edit-manager.ts | 7 +++++++ packages/vtable/src/event/listener/container-dom.ts | 5 +---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/vtable/src/edit/edit-manager.ts b/packages/vtable/src/edit/edit-manager.ts index 21ccb3acd..a8d070688 100644 --- a/packages/vtable/src/edit/edit-manager.ts +++ b/packages/vtable/src/edit/edit-manager.ts @@ -92,4 +92,11 @@ export class EditManeger { this.editingEditor = null; } } + + cancelEdit() { + if (this.editingEditor) { + this.editingEditor.exit(); + this.editingEditor = null; + } + } } diff --git a/packages/vtable/src/event/listener/container-dom.ts b/packages/vtable/src/event/listener/container-dom.ts index 631ea240f..769f7573b 100644 --- a/packages/vtable/src/event/listener/container-dom.ts +++ b/packages/vtable/src/event/listener/container-dom.ts @@ -84,10 +84,7 @@ export function bindContainerDomListener(eventManager: EventManager) { } } } else if (e.key === 'Escape') { - if ((table as ListTableAPI).editorManager.editingEditor) { - (table as ListTableAPI).editorManager.editingEditor.exit(); - (table as ListTableAPI).editorManager.editingEditor = null; - } + (table as ListTableAPI).editorManager.cancelEdit(); } else if (e.key === 'Enter') { // 如果按enter键 可以结束当前的编辑 或开启编辑选中的单元格(仅限单选) if ((table as ListTableAPI).editorManager.editingEditor) { From cc13ea0cf1f51f9f748bd8544031f8cb16798940 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 25 Jan 2024 10:30:43 +0000 Subject: [PATCH 030/115] build: prelease version 0.18.3 --- ...ix-clickoutsideCancelSelect_2024-01-25-09-04.json | 11 ----------- common/config/rush/version-policies.json | 2 +- packages/react-vtable/package.json | 2 +- packages/vtable-editors/package.json | 2 +- packages/vtable-export/package.json | 2 +- packages/vtable/CHANGELOG.json | 12 ++++++++++++ packages/vtable/CHANGELOG.md | 11 ++++++++++- packages/vtable/package.json | 2 +- 8 files changed, 27 insertions(+), 17 deletions(-) delete mode 100644 common/changes/@visactor/vtable/fix-clickoutsideCancelSelect_2024-01-25-09-04.json diff --git a/common/changes/@visactor/vtable/fix-clickoutsideCancelSelect_2024-01-25-09-04.json b/common/changes/@visactor/vtable/fix-clickoutsideCancelSelect_2024-01-25-09-04.json deleted file mode 100644 index 8ac6020a3..000000000 --- a/common/changes/@visactor/vtable/fix-clickoutsideCancelSelect_2024-01-25-09-04.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "fix: click outside of cells click cancel select state\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/version-policies.json b/common/config/rush/version-policies.json index 1900078a3..4112c74ff 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -1 +1 @@ -[{"definitionName":"lockStepVersion","policyName":"vtableMain","version":"0.18.2","mainProject":"@visactor/vtable","nextBump":"patch"}] +[{"definitionName":"lockStepVersion","policyName":"vtableMain","version":"0.18.3","mainProject":"@visactor/vtable","nextBump":"patch"}] diff --git a/packages/react-vtable/package.json b/packages/react-vtable/package.json index f9c97a0e1..47364caa2 100644 --- a/packages/react-vtable/package.json +++ b/packages/react-vtable/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/react-vtable", - "version": "0.18.2", + "version": "0.18.3", "description": "The react version of VTable", "keywords": [ "react", diff --git a/packages/vtable-editors/package.json b/packages/vtable-editors/package.json index b256e0b70..c02a26f1d 100644 --- a/packages/vtable-editors/package.json +++ b/packages/vtable-editors/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vtable-editors", - "version": "0.18.2", + "version": "0.18.3", "description": "", "sideEffects": false, "main": "cjs/index.js", diff --git a/packages/vtable-export/package.json b/packages/vtable-export/package.json index f7b33fcf7..9d70d7d98 100644 --- a/packages/vtable-export/package.json +++ b/packages/vtable-export/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vtable-export", - "version": "0.18.2", + "version": "0.18.3", "description": "The export util of VTable", "author": { "name": "VisActor", diff --git a/packages/vtable/CHANGELOG.json b/packages/vtable/CHANGELOG.json index 4c7ad4c4a..5775a6b25 100644 --- a/packages/vtable/CHANGELOG.json +++ b/packages/vtable/CHANGELOG.json @@ -1,6 +1,18 @@ { "name": "@visactor/vtable", "entries": [ + { + "version": "0.18.3", + "tag": "@visactor/vtable_v0.18.3", + "date": "Thu, 25 Jan 2024 10:27:02 GMT", + "comments": { + "none": [ + { + "comment": "fix: click outside of cells click cancel select state\n\n" + } + ] + } + }, { "version": "0.18.2", "tag": "@visactor/vtable_v0.18.2", diff --git a/packages/vtable/CHANGELOG.md b/packages/vtable/CHANGELOG.md index b37792bb1..f5ed45110 100644 --- a/packages/vtable/CHANGELOG.md +++ b/packages/vtable/CHANGELOG.md @@ -1,6 +1,15 @@ # Change Log - @visactor/vtable -This log was last generated on Wed, 24 Jan 2024 12:12:36 GMT and should not be manually modified. +This log was last generated on Thu, 25 Jan 2024 10:27:02 GMT and should not be manually modified. + +## 0.18.3 +Thu, 25 Jan 2024 10:27:02 GMT + +### Updates + +- fix: click outside of cells click cancel select state + + ## 0.18.2 Wed, 24 Jan 2024 12:12:36 GMT diff --git a/packages/vtable/package.json b/packages/vtable/package.json index 4c134faa6..4661d94a9 100644 --- a/packages/vtable/package.json +++ b/packages/vtable/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vtable", - "version": "0.18.2", + "version": "0.18.3", "description": "canvas table width high performance", "keywords": [ "grid", From 4f186ecfdbe4a3073911b7601257777cfaee1c0b Mon Sep 17 00:00:00 2001 From: fangsmile Date: Thu, 25 Jan 2024 10:46:00 +0000 Subject: [PATCH 031/115] docs: generate changelog of release v0.18.3 --- docs/assets/changelog/en/release.md | 13 +++++++++++++ docs/assets/changelog/zh/release.md | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/docs/assets/changelog/en/release.md b/docs/assets/changelog/en/release.md index 37416e5c2..264356bfa 100644 --- a/docs/assets/changelog/en/release.md +++ b/docs/assets/changelog/en/release.md @@ -1,3 +1,16 @@ +# v0.18.3 + +2024-01-25 + + +**🐛 Bug fix** + +- **@visactor/vtable**: click outside of cells click cancel select state + + + +[more detail about v0.18.3](https://github.com/VisActor/VTable/releases/tag/v0.18.3) + # v0.18.0 2024-01-19 diff --git a/docs/assets/changelog/zh/release.md b/docs/assets/changelog/zh/release.md index 87d0f6364..d2f2f1115 100644 --- a/docs/assets/changelog/zh/release.md +++ b/docs/assets/changelog/zh/release.md @@ -1,3 +1,16 @@ +# v0.18.3 + +2024-01-25 + + +**🐛 功能修复** + +- **@visactor/vtable**: click outside of cells click cancel select state + + + +[更多详情请查看 v0.18.3](https://github.com/VisActor/VTable/releases/tag/v0.18.3) + # v0.18.0 2024-01-19 From 11dfd2e0935f7482636ebc46d990d9db87d0ab1a Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Fri, 26 Jan 2024 14:53:18 +0800 Subject: [PATCH 032/115] chore: update vchart version --- common/config/rush/pnpm-lock.yaml | 809 ++++++++++++++------------ docs/package.json | 2 +- packages/react-vtable/package.json | 4 +- packages/vtable-export/package.json | 4 +- packages/vtable/examples/list/list.ts | 6 +- packages/vtable/package.json | 4 +- 6 files changed, 436 insertions(+), 393 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 2d0315b14..b331198a8 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -14,7 +14,7 @@ importers: '@types/markdown-it': ^13.0.0 '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 - '@visactor/vchart': 1.8.7 + '@visactor/vchart': 1.9.0 '@visactor/vtable': workspace:* '@visactor/vtable-editors': workspace:* '@visactor/vtable-export': workspace:* @@ -36,12 +36,12 @@ importers: vite: 3.2.6 yargs: ^17.1.1 dependencies: - '@arco-design/web-react': 2.46.1_yok4whjnfjlfyjmdmcaku5uzjq - '@visactor/vchart': 1.8.7 + '@arco-design/web-react': 2.46.1_p2jlmv6k7k3po6tueteg46f2ku + '@visactor/vchart': 1.9.0 '@visactor/vtable': link:../packages/vtable '@visactor/vtable-editors': link:../packages/vtable-editors '@visactor/vtable-export': link:../packages/vtable-export - axios: 1.6.3 + axios: 1.6.7 highlight.js: 11.9.0 lodash: 4.17.21 markdown-it: 13.0.2 @@ -53,7 +53,7 @@ importers: '@internal/ts-config': link:../share/ts-config '@types/highlightjs': 9.12.6 '@types/markdown-it': 13.0.7 - '@types/react': 18.2.46 + '@types/react': 18.2.48 '@types/react-dom': 18.2.18 '@vitejs/plugin-react': 3.1.0_vite@3.2.6 chalk: 3.0.0 @@ -82,7 +82,7 @@ importers: '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 '@types/react-is': ^17.0.3 - '@visactor/vchart': 1.8.7 + '@visactor/vchart': 1.9.0 '@visactor/vtable': workspace:* '@visactor/vutils': ~0.17.1 '@vitejs/plugin-react': 3.1.0 @@ -116,7 +116,7 @@ importers: vite-plugin-markdown: ^2.1.0 dependencies: '@visactor/vtable': link:../vtable - '@visactor/vutils': 0.17.3 + '@visactor/vutils': 0.17.4 react-is: 18.2.0 devDependencies: '@babel/core': 7.20.12 @@ -128,14 +128,14 @@ importers: '@types/chai': 4.2.22 '@types/jest': 26.0.24 '@types/mocha': 9.0.0 - '@types/node': 20.10.5 + '@types/node': 20.11.7 '@types/offscreencanvas': 2019.6.4 - '@types/react': 18.2.46 + '@types/react': 18.2.48 '@types/react-dom': 18.2.18 '@types/react-is': 17.0.7 - '@visactor/vchart': 1.8.7 + '@visactor/vchart': 1.9.0 '@vitejs/plugin-react': 3.1.0_vite@3.2.6 - axios: 1.6.3 + axios: 1.6.7 chai: 4.3.4 eslint: 8.18.0 form-data: 4.0.0 @@ -155,13 +155,13 @@ importers: sass: 1.43.5 ts-jest: 26.5.6_xuote2qreek47x2di7kesslrai ts-loader: 9.2.6_typescript@4.9.5 - ts-node: 10.9.0_f3xuzkf73irh6k3dig4vinkuoy + ts-node: 10.9.0_7ft46uf3tz44iffs2xfvqbt3oe tslib: 2.3.1 ttypescript: 1.5.13_fxi2xlggroal5l3a4znftvxz2m typescript: 4.9.5 typescript-transform-paths: 3.3.1_typescript@4.9.5 - vite: 3.2.6_ut5he7gwva27cnmyxmfrlluelu - vite-plugin-markdown: 2.1.0_vite@3.2.6 + vite: 3.2.6_3zttstnme6gr6ngghipmg6bkxq + vite-plugin-markdown: 2.2.0_vite@3.2.6 ../../packages/vtable: specifiers: @@ -179,7 +179,7 @@ importers: '@types/offscreencanvas': 2019.6.4 '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 - '@visactor/vchart': 1.8.7 + '@visactor/vchart': 1.9.0 '@visactor/vdataset': ~0.17.1 '@visactor/vrender-components': 0.17.19-alpha.1 '@visactor/vrender-core': 0.17.19-alpha.1 @@ -225,14 +225,14 @@ importers: vite: 3.2.6 vite-plugin-markdown: ^2.1.0 dependencies: - '@visactor/vdataset': 0.17.3 + '@visactor/vdataset': 0.17.4 '@visactor/vrender-components': 0.17.19-alpha.1 '@visactor/vrender-core': 0.17.19-alpha.1 '@visactor/vrender-kits': 0.17.19-alpha.1 - '@visactor/vscale': 0.17.3 + '@visactor/vscale': 0.17.4 '@visactor/vtable-editors': link:../vtable-editors - '@visactor/vutils': 0.17.3 - '@visactor/vutils-extension': 1.8.5 + '@visactor/vutils': 0.17.4 + '@visactor/vutils-extension': 1.8.10 cssfontparser: 1.2.1 devDependencies: '@babel/core': 7.20.12 @@ -245,13 +245,13 @@ importers: '@types/chai': 4.2.22 '@types/jest': 26.0.24 '@types/mocha': 9.0.0 - '@types/node': 20.10.5 + '@types/node': 20.11.7 '@types/offscreencanvas': 2019.6.4 - '@types/react': 18.2.46 + '@types/react': 18.2.48 '@types/react-dom': 18.2.18 - '@visactor/vchart': 1.8.7 + '@visactor/vchart': 1.9.0 '@vitejs/plugin-react': 3.1.0_vite@3.2.6 - axios: 1.6.3 + axios: 1.6.7 chai: 4.3.4 d3-array: 3.2.3 d3-dsv: 3.0.1 @@ -278,13 +278,13 @@ importers: sass: 1.43.5 ts-jest: 26.5.6_xuote2qreek47x2di7kesslrai ts-loader: 9.2.6_typescript@4.9.5 - ts-node: 10.9.0_f3xuzkf73irh6k3dig4vinkuoy + ts-node: 10.9.0_7ft46uf3tz44iffs2xfvqbt3oe tslib: 2.3.1 ttypescript: 1.5.13_fxi2xlggroal5l3a4znftvxz2m typescript: 4.9.5 typescript-transform-paths: 3.3.1_typescript@4.9.5 - vite: 3.2.6_ut5he7gwva27cnmyxmfrlluelu - vite-plugin-markdown: 2.1.0_vite@3.2.6 + vite: 3.2.6_3zttstnme6gr6ngghipmg6bkxq + vite-plugin-markdown: 2.2.0_vite@3.2.6 ../../packages/vtable-editors: specifiers: @@ -315,7 +315,7 @@ importers: '@internal/ts-config': link:../../share/ts-config '@rushstack/eslint-patch': 1.1.4 '@types/jest': 26.0.24 - '@types/node': 20.10.5 + '@types/node': 20.11.7 '@types/offscreencanvas': 2019.6.4 eslint: 8.18.0 husky: 7.0.4 @@ -326,11 +326,11 @@ importers: react-device-detect: 2.2.3 ts-jest: 26.5.6_xuote2qreek47x2di7kesslrai ts-loader: 9.2.6_typescript@4.9.5 - ts-node: 10.9.0_f3xuzkf73irh6k3dig4vinkuoy + ts-node: 10.9.0_7ft46uf3tz44iffs2xfvqbt3oe tslib: 2.3.1 tslint: 5.12.1_typescript@4.9.5 typescript: 4.9.5 - vite: 3.2.6_@types+node@20.10.5 + vite: 3.2.6_@types+node@20.11.7 ../../packages/vtable-export: specifiers: @@ -348,7 +348,7 @@ importers: '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 '@types/react-is': ^17.0.3 - '@visactor/vchart': 1.8.7 + '@visactor/vchart': 1.9.0 '@visactor/vtable': workspace:* '@visactor/vutils': ~0.17.1 '@vitejs/plugin-react': 3.1.0 @@ -384,7 +384,7 @@ importers: vite-plugin-markdown: ^2.1.0 dependencies: '@visactor/vtable': link:../vtable - '@visactor/vutils': 0.17.3 + '@visactor/vutils': 0.17.4 exceljs: 4.4.0 file-saver: 2.0.5 devDependencies: @@ -397,14 +397,14 @@ importers: '@types/chai': 4.2.22 '@types/jest': 26.0.24 '@types/mocha': 9.0.0 - '@types/node': 20.10.5 + '@types/node': 20.11.7 '@types/offscreencanvas': 2019.6.4 - '@types/react': 18.2.46 + '@types/react': 18.2.48 '@types/react-dom': 18.2.18 '@types/react-is': 17.0.7 - '@visactor/vchart': 1.8.7 + '@visactor/vchart': 1.9.0 '@vitejs/plugin-react': 3.1.0_vite@3.2.6 - axios: 1.6.3 + axios: 1.6.7 chai: 4.3.4 eslint: 8.18.0 form-data: 4.0.0 @@ -425,13 +425,13 @@ importers: sass: 1.43.5 ts-jest: 26.5.6_xuote2qreek47x2di7kesslrai ts-loader: 9.2.6_typescript@4.9.5 - ts-node: 10.9.0_f3xuzkf73irh6k3dig4vinkuoy + ts-node: 10.9.0_7ft46uf3tz44iffs2xfvqbt3oe tslib: 2.3.1 ttypescript: 1.5.13_fxi2xlggroal5l3a4znftvxz2m typescript: 4.9.5 typescript-transform-paths: 3.3.1_typescript@4.9.5 - vite: 3.2.6_ut5he7gwva27cnmyxmfrlluelu - vite-plugin-markdown: 2.1.0_vite@3.2.6 + vite: 3.2.6_3zttstnme6gr6ngghipmg6bkxq + vite-plugin-markdown: 2.2.0_vite@3.2.6 ../../share/eslint-config: specifiers: @@ -602,7 +602,7 @@ importers: '@types/merge2': 1.4.0 '@types/minimist': 1.2.2 '@types/ms': 0.7.31 - '@types/node': 20.10.5 + '@types/node': 20.11.7 '@types/semver': 7.3.12 '@types/terser': 3.12.0 '@types/through2': 2.0.38 @@ -610,7 +610,7 @@ importers: '@types/vinyl': 2.0.7 '@types/yargs-parser': 21.0.0 eslint: 8.18.0 - ts-node: 10.9.0_f3xuzkf73irh6k3dig4vinkuoy + ts-node: 10.9.0_7ft46uf3tz44iffs2xfvqbt3oe typescript: 4.9.5 vitest: 0.30.1_less@4.1.3+terser@5.17.1 @@ -625,7 +625,7 @@ packages: engines: {node: '>=6.0.0'} dependencies: '@jridgewell/gen-mapping': 0.3.3 - '@jridgewell/trace-mapping': 0.3.20 + '@jridgewell/trace-mapping': 0.3.22 /@arco-design/color/0.4.0: resolution: {integrity: sha512-s7p9MSwJgHeL8DwcATaXvWT3m2SigKpxx4JA1BGPHL4gfvaQsmQfrLBDpjOJFJuJ2jG2dMt3R3P8Pm9E65q18g==} @@ -633,14 +633,14 @@ packages: color: 3.2.1 dev: false - /@arco-design/web-react/2.46.1_yok4whjnfjlfyjmdmcaku5uzjq: + /@arco-design/web-react/2.46.1_p2jlmv6k7k3po6tueteg46f2ku: resolution: {integrity: sha512-XjG44rODJklDu++OApvxjt/TbRrgkNqVq6grt/H+9skysm46jFn2SwhuSljBHmjo11LtIeB1m/OMPMaFtafeYg==} peerDependencies: react: '>=16' react-dom: '>=16' dependencies: '@arco-design/color': 0.4.0 - '@babel/runtime': 7.23.6 + '@babel/runtime': 7.23.9 b-tween: 0.3.3 b-validate: 1.5.3 compute-scroll-into-view: 1.0.20 @@ -649,7 +649,7 @@ packages: number-precision: 1.6.0 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 - react-focus-lock: 2.9.6_sowt5japhjbdixo6tryvx3gigm + react-focus-lock: 2.9.7_7kh72gklg5qjlh5zc6s6v3p6v4 react-transition-group: 4.4.5_biqbaboplfbrettd7655fr4n2y resize-observer-polyfill: 1.5.1 scroll-into-view-if-needed: 2.2.20 @@ -678,11 +678,11 @@ packages: '@babel/generator': 7.21.1 '@babel/helper-compilation-targets': 7.23.6 '@babel/helper-module-transforms': 7.23.3_@babel+core@7.20.12 - '@babel/helpers': 7.23.6 - '@babel/parser': 7.23.6 - '@babel/template': 7.22.15 - '@babel/traverse': 7.23.6 - '@babel/types': 7.23.6 + '@babel/helpers': 7.23.9 + '@babel/parser': 7.23.9 + '@babel/template': 7.23.9 + '@babel/traverse': 7.23.9 + '@babel/types': 7.23.9 convert-source-map: 1.9.0 debug: 4.3.4 gensync: 1.0.0-beta.2 @@ -695,31 +695,31 @@ packages: resolution: {integrity: sha512-1lT45bAYlQhFn/BHivJs43AiW2rg3/UbLyShGfF3C0KmHvO5fSghWd5kBJy30kpRRucGzXStvnnCFniCR2kXAA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.6 + '@babel/types': 7.23.9 '@jridgewell/gen-mapping': 0.3.3 - '@jridgewell/trace-mapping': 0.3.20 + '@jridgewell/trace-mapping': 0.3.22 jsesc: 2.5.2 /@babel/generator/7.23.6: resolution: {integrity: sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.6 + '@babel/types': 7.23.9 '@jridgewell/gen-mapping': 0.3.3 - '@jridgewell/trace-mapping': 0.3.20 + '@jridgewell/trace-mapping': 0.3.22 jsesc: 2.5.2 /@babel/helper-annotate-as-pure/7.22.5: resolution: {integrity: sha512-LvBTxu8bQSQkcyKOU+a1btnNFQ1dMAd0R6PyW3arXes06F6QLWLIrd681bxRPIXlrMGR3XYnW9JyML7dP3qgxg==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.6 + '@babel/types': 7.23.9 /@babel/helper-builder-binary-assignment-operator-visitor/7.22.15: resolution: {integrity: sha512-QkBXwGgaoC2GtGZRoma6kv7Szfv06khvhFav67ZExau2RaXzy8MpHSMO2PNoP2XtmQphJQRHFfg77Bq731Yizw==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.6 + '@babel/types': 7.23.9 /@babel/helper-compilation-targets/7.23.6: resolution: {integrity: sha512-9JB548GZoQVmzrFgp8o7KxdgkTGm6xs9DW0o/Pim72UDjzr5ObUQ6ZzYPqA+g9OTS2bBQoctLJrky0RDCAWRgQ==} @@ -731,8 +731,8 @@ packages: lru-cache: 5.1.1 semver: 6.3.1 - /@babel/helper-create-class-features-plugin/7.23.6_@babel+core@7.20.12: - resolution: {integrity: sha512-cBXU1vZni/CpGF29iTu4YRbOZt3Wat6zCoMDxRF1MayiEc4URxOj31tT65HUM0CRpMowA3HCJaAOVOUnMf96cw==} + /@babel/helper-create-class-features-plugin/7.23.9_@babel+core@7.20.12: + resolution: {integrity: sha512-B2L9neXTIyPQoXDm+NtovPvG6VOLWnaXu3BIeVDWwdKFgG30oNa6CqVGiJPDWQwIAK49t9gnQI9c6K6RzabiKw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 @@ -782,26 +782,26 @@ packages: resolution: {integrity: sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==} engines: {node: '>=6.9.0'} dependencies: - '@babel/template': 7.22.15 - '@babel/types': 7.23.6 + '@babel/template': 7.23.9 + '@babel/types': 7.23.9 /@babel/helper-hoist-variables/7.22.5: resolution: {integrity: sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.6 + '@babel/types': 7.23.9 /@babel/helper-member-expression-to-functions/7.23.0: resolution: {integrity: sha512-6gfrPwh7OuT6gZyJZvd6WbTfrqAo7vm4xCzAXOusKqq/vWdKXphTpj5klHKNmRUU6/QRGlBsyU9mAIPaWHlqJA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.6 + '@babel/types': 7.23.9 /@babel/helper-module-imports/7.22.15: resolution: {integrity: sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.6 + '@babel/types': 7.23.9 /@babel/helper-module-transforms/7.23.3_@babel+core@7.20.12: resolution: {integrity: sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ==} @@ -820,7 +820,7 @@ packages: resolution: {integrity: sha512-HBwaojN0xFRx4yIvpwGqxiV2tUfl7401jlok564NgB9EHS1y6QT17FmKWm4ztqjeVdXLuC4fSvHc5ePpQjoTbw==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.6 + '@babel/types': 7.23.9 /@babel/helper-plugin-utils/7.22.5: resolution: {integrity: sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==} @@ -852,19 +852,19 @@ packages: resolution: {integrity: sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.6 + '@babel/types': 7.23.9 /@babel/helper-skip-transparent-expression-wrappers/7.22.5: resolution: {integrity: sha512-tK14r66JZKiC43p8Ki33yLBVJKlQDFoA8GYN67lWCDCqoL6EMMSuM9b+Iff2jHaM/RRFYl7K+iiru7hbRqNx8Q==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.6 + '@babel/types': 7.23.9 /@babel/helper-split-export-declaration/7.22.6: resolution: {integrity: sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.6 + '@babel/types': 7.23.9 /@babel/helper-string-parser/7.23.4: resolution: {integrity: sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==} @@ -883,16 +883,16 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/helper-function-name': 7.23.0 - '@babel/template': 7.22.15 - '@babel/types': 7.23.6 + '@babel/template': 7.23.9 + '@babel/types': 7.23.9 - /@babel/helpers/7.23.6: - resolution: {integrity: sha512-wCfsbN4nBidDRhpDhvcKlzHWCTlgJYUUdSJfzXb2NuBssDSIjc3xcb+znA7l+zYsFljAcGM0aFkN40cR3lXiGA==} + /@babel/helpers/7.23.9: + resolution: {integrity: sha512-87ICKgU5t5SzOT7sBMfCOZQ2rHjRU+Pcb9BoILMYz600W6DkVRLFBPwQ18gwUVvggqXivaUakpnxWQGbpywbBQ==} engines: {node: '>=6.9.0'} dependencies: - '@babel/template': 7.22.15 - '@babel/traverse': 7.23.6 - '@babel/types': 7.23.6 + '@babel/template': 7.23.9 + '@babel/traverse': 7.23.9 + '@babel/types': 7.23.9 transitivePeerDependencies: - supports-color @@ -904,8 +904,8 @@ packages: chalk: 2.4.2 js-tokens: 4.0.0 - /@babel/parser/7.23.6: - resolution: {integrity: sha512-Z2uID7YJ7oNvAI20O9X0bblw7Qqs8Q2hFy0R9tAfnfLkp5MW0UH9eUvnDSnFwKZ0AvgS1ucqR4KzvVHgnke1VQ==} + /@babel/parser/7.23.9: + resolution: {integrity: sha512-9tcKgqKbs3xGJ+NtKF2ndOBBLVwPjl1SHxPQkd36r3Dlirw3xWUeGaTbqr7uGZcTaxkVNwc+03SVP7aCdWrTlA==} engines: {node: '>=6.0.0'} hasBin: true @@ -950,7 +950,7 @@ packages: '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.20.12 - '@babel/helper-create-class-features-plugin': 7.23.6_@babel+core@7.20.12 + '@babel/helper-create-class-features-plugin': 7.23.9_@babel+core@7.20.12 '@babel/helper-plugin-utils': 7.22.5 /@babel/plugin-proposal-class-static-block/7.21.0_@babel+core@7.20.12: @@ -961,7 +961,7 @@ packages: '@babel/core': ^7.12.0 dependencies: '@babel/core': 7.20.12 - '@babel/helper-create-class-features-plugin': 7.23.6_@babel+core@7.20.12 + '@babel/helper-create-class-features-plugin': 7.23.9_@babel+core@7.20.12 '@babel/helper-plugin-utils': 7.22.5 '@babel/plugin-syntax-class-static-block': 7.14.5_@babel+core@7.20.12 @@ -1087,7 +1087,7 @@ packages: '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.20.12 - '@babel/helper-create-class-features-plugin': 7.23.6_@babel+core@7.20.12 + '@babel/helper-create-class-features-plugin': 7.23.9_@babel+core@7.20.12 '@babel/helper-plugin-utils': 7.22.5 /@babel/plugin-proposal-private-property-in-object/7.21.11_@babel+core@7.20.12: @@ -1099,7 +1099,7 @@ packages: dependencies: '@babel/core': 7.20.12 '@babel/helper-annotate-as-pure': 7.22.5 - '@babel/helper-create-class-features-plugin': 7.23.6_@babel+core@7.20.12 + '@babel/helper-create-class-features-plugin': 7.23.9_@babel+core@7.20.12 '@babel/helper-plugin-utils': 7.22.5 '@babel/plugin-syntax-private-property-in-object': 7.14.5_@babel+core@7.20.12 @@ -1324,8 +1324,8 @@ packages: '@babel/core': 7.20.12 '@babel/helper-plugin-utils': 7.22.5 - /@babel/plugin-transform-classes/7.23.5_@babel+core@7.20.12: - resolution: {integrity: sha512-jvOTR4nicqYC9yzOHIhXG5emiFEOpappSJAl73SDSEDcybD+Puuze8Tnpb9p9qEyYup24tq891gkaygIFvWDqg==} + /@babel/plugin-transform-classes/7.23.8_@babel+core@7.20.12: + resolution: {integrity: sha512-yAYslGsY1bX6Knmg46RjiCiNSwJKv2IUC8qOdYKqMMr0491SXFhcHqOdRDeCRohOOIzwN/90C6mQ9qAKgrP7dg==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 @@ -1335,7 +1335,6 @@ packages: '@babel/helper-compilation-targets': 7.23.6 '@babel/helper-environment-visitor': 7.22.20 '@babel/helper-function-name': 7.23.0 - '@babel/helper-optimise-call-expression': 7.22.5 '@babel/helper-plugin-utils': 7.22.5 '@babel/helper-replace-supers': 7.22.20_@babel+core@7.20.12 '@babel/helper-split-export-declaration': 7.22.6 @@ -1349,7 +1348,7 @@ packages: dependencies: '@babel/core': 7.20.12 '@babel/helper-plugin-utils': 7.22.5 - '@babel/template': 7.22.15 + '@babel/template': 7.23.9 /@babel/plugin-transform-destructuring/7.23.3_@babel+core@7.20.12: resolution: {integrity: sha512-n225npDqjDIr967cMScVKHXJs7rout1q+tt50inyBCPkyZ8KxeI6d+GIbSBTT/w/9WdlWDOej3V9HE5Lgk57gw==} @@ -1449,8 +1448,8 @@ packages: '@babel/helper-plugin-utils': 7.22.5 '@babel/helper-simple-access': 7.22.5 - /@babel/plugin-transform-modules-systemjs/7.23.3_@babel+core@7.20.12: - resolution: {integrity: sha512-ZxyKGTkF9xT9YJuKQRo19ewf3pXpopuYQd8cDXqNzc3mUNbOME0RKMoZxviQk74hwzfQsEe66dE92MaZbdHKNQ==} + /@babel/plugin-transform-modules-systemjs/7.23.9_@babel+core@7.20.12: + resolution: {integrity: sha512-KDlPRM6sLo4o1FkiSlXoAa8edLXFsKKIda779fbLrvmeuc3itnjCtaO6RrtoaANsIJANj+Vk1zqbZIMhkCAHVw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 @@ -1580,7 +1579,7 @@ packages: '@babel/helper-module-imports': 7.22.15 '@babel/helper-plugin-utils': 7.22.5 '@babel/plugin-syntax-jsx': 7.23.3_@babel+core@7.20.12 - '@babel/types': 7.23.6 + '@babel/types': 7.23.9 dev: false /@babel/plugin-transform-react-pure-annotations/7.23.3_@babel+core@7.20.12: @@ -1684,7 +1683,7 @@ packages: dependencies: '@babel/core': 7.20.12 '@babel/helper-annotate-as-pure': 7.22.5 - '@babel/helper-create-class-features-plugin': 7.23.6_@babel+core@7.20.12 + '@babel/helper-create-class-features-plugin': 7.23.9_@babel+core@7.20.12 '@babel/helper-plugin-utils': 7.22.5 '@babel/plugin-syntax-typescript': 7.23.3_@babel+core@7.20.12 dev: false @@ -1755,7 +1754,7 @@ packages: '@babel/plugin-transform-async-to-generator': 7.23.3_@babel+core@7.20.12 '@babel/plugin-transform-block-scoped-functions': 7.23.3_@babel+core@7.20.12 '@babel/plugin-transform-block-scoping': 7.23.4_@babel+core@7.20.12 - '@babel/plugin-transform-classes': 7.23.5_@babel+core@7.20.12 + '@babel/plugin-transform-classes': 7.23.8_@babel+core@7.20.12 '@babel/plugin-transform-computed-properties': 7.23.3_@babel+core@7.20.12 '@babel/plugin-transform-destructuring': 7.23.3_@babel+core@7.20.12 '@babel/plugin-transform-dotall-regex': 7.23.3_@babel+core@7.20.12 @@ -1767,7 +1766,7 @@ packages: '@babel/plugin-transform-member-expression-literals': 7.23.3_@babel+core@7.20.12 '@babel/plugin-transform-modules-amd': 7.23.3_@babel+core@7.20.12 '@babel/plugin-transform-modules-commonjs': 7.23.3_@babel+core@7.20.12 - '@babel/plugin-transform-modules-systemjs': 7.23.3_@babel+core@7.20.12 + '@babel/plugin-transform-modules-systemjs': 7.23.9_@babel+core@7.20.12 '@babel/plugin-transform-modules-umd': 7.23.3_@babel+core@7.20.12 '@babel/plugin-transform-named-capturing-groups-regex': 7.22.5_@babel+core@7.20.12 '@babel/plugin-transform-new-target': 7.23.3_@babel+core@7.20.12 @@ -1784,11 +1783,11 @@ packages: '@babel/plugin-transform-unicode-escapes': 7.23.3_@babel+core@7.20.12 '@babel/plugin-transform-unicode-regex': 7.23.3_@babel+core@7.20.12 '@babel/preset-modules': 0.1.6_@babel+core@7.20.12 - '@babel/types': 7.23.6 + '@babel/types': 7.23.9 babel-plugin-polyfill-corejs2: 0.3.3_@babel+core@7.20.12 babel-plugin-polyfill-corejs3: 0.6.0_@babel+core@7.20.12 babel-plugin-polyfill-regenerator: 0.4.1_@babel+core@7.20.12 - core-js-compat: 3.35.0 + core-js-compat: 3.35.1 semver: 6.3.1 transitivePeerDependencies: - supports-color @@ -1802,7 +1801,7 @@ packages: '@babel/helper-plugin-utils': 7.22.5 '@babel/plugin-proposal-unicode-property-regex': 7.18.6_@babel+core@7.20.12 '@babel/plugin-transform-dotall-regex': 7.23.3_@babel+core@7.20.12 - '@babel/types': 7.23.6 + '@babel/types': 7.23.9 esutils: 2.0.3 /@babel/preset-react/7.18.6_@babel+core@7.20.12: @@ -1835,22 +1834,22 @@ packages: /@babel/regjsgen/0.8.0: resolution: {integrity: sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==} - /@babel/runtime/7.23.6: - resolution: {integrity: sha512-zHd0eUrf5GZoOWVCXp6koAKQTfZV07eit6bGPmJgnZdnSAvvZee6zniW2XMF7Cmc4ISOOnPy3QaSiIJGJkVEDQ==} + /@babel/runtime/7.23.9: + resolution: {integrity: sha512-0CX6F+BI2s9dkUqr08KFrAIZgNFj75rdBU/DjCyYLIaV/quFjkk6T+EJ2LkZHyZTbEV4L5p97mNkUsHl2wLFAw==} engines: {node: '>=6.9.0'} dependencies: regenerator-runtime: 0.14.1 - /@babel/template/7.22.15: - resolution: {integrity: sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==} + /@babel/template/7.23.9: + resolution: {integrity: sha512-+xrD2BWLpvHKNmX2QbpdpsBaWnRxahMwJjO+KZk2JOElj5nSmKezyS1B4u+QbHMTX69t4ukm6hh9lsYQ7GHCKA==} engines: {node: '>=6.9.0'} dependencies: '@babel/code-frame': 7.23.5 - '@babel/parser': 7.23.6 - '@babel/types': 7.23.6 + '@babel/parser': 7.23.9 + '@babel/types': 7.23.9 - /@babel/traverse/7.23.6: - resolution: {integrity: sha512-czastdK1e8YByZqezMPFiZ8ahwVMh/ESl9vPgvgdB9AmFMGP5jfpFax74AQgl5zj4XHzqeYAg2l8PuUeRS1MgQ==} + /@babel/traverse/7.23.9: + resolution: {integrity: sha512-I/4UJ9vs90OkBtY6iiiTORVMyIhJ4kAVmsKo9KFc8UOxMeUfi2hvtIBsET5u9GizXE6/GFSuKCTNfgCswuEjRg==} engines: {node: '>=6.9.0'} dependencies: '@babel/code-frame': 7.23.5 @@ -1859,15 +1858,15 @@ packages: '@babel/helper-function-name': 7.23.0 '@babel/helper-hoist-variables': 7.22.5 '@babel/helper-split-export-declaration': 7.22.6 - '@babel/parser': 7.23.6 - '@babel/types': 7.23.6 + '@babel/parser': 7.23.9 + '@babel/types': 7.23.9 debug: 4.3.4 globals: 11.12.0 transitivePeerDependencies: - supports-color - /@babel/types/7.23.6: - resolution: {integrity: sha512-+uarb83brBzPKN38NX1MkB6vb6+mwvR6amUulqAE7ccQw1pEl+bCia9TbdG1lsnFP7lZySvUn37CHyXQdfTwzg==} + /@babel/types/7.23.9: + resolution: {integrity: sha512-dQjSq/7HaSjRM43FFGnv5keM2HsxpmyV1PfaSVm0nzzjwwTmjOe6J4bC8e3+pTEIgHaHj+1ZlLThRJ2auc/w1Q==} engines: {node: '>=6.9.0'} dependencies: '@babel/helper-string-parser': 7.23.4 @@ -2030,7 +2029,7 @@ packages: engines: {node: '>= 10.14.2'} dependencies: '@jest/types': 26.6.2 - '@types/node': 20.10.5 + '@types/node': 20.11.7 chalk: 4.1.2 jest-message-util: 26.6.2 jest-util: 26.6.2 @@ -2046,7 +2045,7 @@ packages: '@jest/test-result': 26.6.2 '@jest/transform': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.10.5 + '@types/node': 20.11.7 ansi-escapes: 4.3.2 chalk: 4.1.2 exit: 0.1.2 @@ -2095,7 +2094,7 @@ packages: dependencies: '@jest/fake-timers': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.10.5 + '@types/node': 20.11.7 jest-mock: 26.6.2 dev: true @@ -2114,7 +2113,7 @@ packages: dependencies: '@jest/types': 26.6.2 '@sinonjs/fake-timers': 6.0.1 - '@types/node': 20.10.5 + '@types/node': 20.11.7 jest-message-util: 26.6.2 jest-mock: 26.6.2 jest-util: 26.6.2 @@ -2291,7 +2290,7 @@ packages: dependencies: '@types/istanbul-lib-coverage': 2.0.6 '@types/istanbul-reports': 3.0.4 - '@types/node': 20.10.5 + '@types/node': 20.11.7 '@types/yargs': 15.0.19 chalk: 4.1.2 dev: true @@ -2302,7 +2301,7 @@ packages: dependencies: '@jridgewell/set-array': 1.1.2 '@jridgewell/sourcemap-codec': 1.4.15 - '@jridgewell/trace-mapping': 0.3.20 + '@jridgewell/trace-mapping': 0.3.22 /@jridgewell/resolve-uri/3.1.1: resolution: {integrity: sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==} @@ -2316,13 +2315,13 @@ packages: resolution: {integrity: sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==} dependencies: '@jridgewell/gen-mapping': 0.3.3 - '@jridgewell/trace-mapping': 0.3.20 + '@jridgewell/trace-mapping': 0.3.22 /@jridgewell/sourcemap-codec/1.4.15: resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} - /@jridgewell/trace-mapping/0.3.20: - resolution: {integrity: sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==} + /@jridgewell/trace-mapping/0.3.22: + resolution: {integrity: sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw==} dependencies: '@jridgewell/resolve-uri': 3.1.1 '@jridgewell/sourcemap-codec': 1.4.15 @@ -2712,7 +2711,7 @@ packages: optional: true dependencies: rollup: 3.20.5 - serialize-javascript: 6.0.1 + serialize-javascript: 6.0.2 smob: 0.0.6 terser: 5.17.1 dev: false @@ -2881,27 +2880,27 @@ packages: /@types/babel__core/7.20.0: resolution: {integrity: sha512-+n8dL/9GWblDO0iU6eZAwEIJVr5DWigtle+Q6HLOrh/pdbXOhOtqzq8VPPE2zvNJzSKY4vH/z3iT3tn0A3ypiQ==} dependencies: - '@babel/parser': 7.23.6 - '@babel/types': 7.23.6 + '@babel/parser': 7.23.9 + '@babel/types': 7.23.9 '@types/babel__generator': 7.6.8 '@types/babel__template': 7.4.4 - '@types/babel__traverse': 7.20.4 + '@types/babel__traverse': 7.20.5 /@types/babel__generator/7.6.8: resolution: {integrity: sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==} dependencies: - '@babel/types': 7.23.6 + '@babel/types': 7.23.9 /@types/babel__template/7.4.4: resolution: {integrity: sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==} dependencies: - '@babel/parser': 7.23.6 - '@babel/types': 7.23.6 + '@babel/parser': 7.23.9 + '@babel/types': 7.23.9 - /@types/babel__traverse/7.20.4: - resolution: {integrity: sha512-mSM/iKUk5fDDrEV/e83qY+Cr3I1+Q3qqTuEn++HAWYjEa1+NxZr6CNrcJGf2ZTnq4HoFGC3zaTPZTobCzCFukA==} + /@types/babel__traverse/7.20.5: + resolution: {integrity: sha512-WXCyOcRtH37HAUkpXhUduaxdm82b4GSlyTqajXviN4EfiuPgNYR109xMCKvpl6zPIpua0DGlMEDCq+g8EdoheQ==} dependencies: - '@babel/types': 7.23.6 + '@babel/types': 7.23.9 /@types/chai-subset/1.3.5: resolution: {integrity: sha512-c2mPnw+xHtXDoHmdtcCXGwyLMiauiAyxWMzhGpqHC4nqI/Y5G2XhTampslK2rb59kpcuHon03UH8W6iYUzw88A==} @@ -2920,7 +2919,7 @@ packages: /@types/clean-css/4.2.6: resolution: {integrity: sha512-Ze1tf+LnGPmG6hBFMi0B4TEB0mhF7EiMM5oyjLDNPE9hxrPU0W+5+bHvO+eFPA+bt0iC1zkQMoU/iGdRVjcRbw==} dependencies: - '@types/node': 20.10.5 + '@types/node': 20.11.7 source-map: 0.6.1 dev: true @@ -2944,13 +2943,13 @@ packages: /@types/fs-extra/9.0.13: resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==} dependencies: - '@types/node': 20.10.5 + '@types/node': 20.11.7 dev: true /@types/glob-stream/8.0.2: resolution: {integrity: sha512-kyuRfGE+yiSJWzSO3t74rXxdZNdYfLcllO0IUha4eX1fl40pm9L02Q/TEc3mykTLjoWz4STBNwYnUWdFu3I0DA==} dependencies: - '@types/node': 20.10.5 + '@types/node': 20.11.7 '@types/picomatch': 2.3.3 '@types/streamx': 2.9.5 dev: true @@ -2958,19 +2957,19 @@ packages: /@types/glob-watcher/5.0.2: resolution: {integrity: sha512-MZeh2nIzibl/euv5UV0femkGzcKTSE4G2+zv48d6ymeitWwCx52+4X+FqzML9oH2mQnPs+N/JHp3CsBPj1x1Ug==} dependencies: - '@types/node': 20.10.5 + '@types/node': 20.11.7 dev: true /@types/graceful-fs/4.1.9: resolution: {integrity: sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==} dependencies: - '@types/node': 20.10.5 + '@types/node': 20.11.7 dev: true /@types/gulp-if/0.0.34: resolution: {integrity: sha512-r2A04hHDC+ZWMRAm+3q6/UeC3ggvl+TZm9P1+2umnp4q9bOlBmUQnR178Io3c0DkZPQAwup8VNtOvmvaWCpP5w==} dependencies: - '@types/node': 20.10.5 + '@types/node': 20.11.7 '@types/vinyl': 2.0.7 dev: true @@ -2984,7 +2983,7 @@ packages: /@types/gulp-sourcemaps/0.0.35: resolution: {integrity: sha512-vUBuizwA4CAV3Mke0DJYHQxyN4YOB1aAql284qAO7Et7fe0hmnPi/R9Fhu2UhxMuSxAwFktsJUOQk5dJHOU1eA==} dependencies: - '@types/node': 20.10.5 + '@types/node': 20.11.7 '@types/vinyl': 2.0.7 dev: true @@ -3060,7 +3059,7 @@ packages: /@types/merge2/1.4.0: resolution: {integrity: sha512-MRHDvln2ldZELrUC8n1PGaQzZ33aNh8uDcsGehREW0zR1Fr818a4/JTZjO9eloHPPxnpUp8fz/YFTRc5CWm7Xw==} dependencies: - '@types/node': 20.10.5 + '@types/node': 20.11.7 dev: true /@types/minimatch/5.1.2: @@ -3087,8 +3086,8 @@ packages: resolution: {integrity: sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ==} dev: false - /@types/node/20.10.5: - resolution: {integrity: sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==} + /@types/node/20.11.7: + resolution: {integrity: sha512-GPmeN1C3XAyV5uybAf4cMLWT9fDWcmQhZVtMFu7OR32WjrqGG+Wnk2V1d0bmtUyE/Zy1QJ9BxyiTih9z8Oks8A==} dependencies: undici-types: 5.26.5 @@ -3114,25 +3113,25 @@ packages: /@types/react-dom/18.2.18: resolution: {integrity: sha512-TJxDm6OfAX2KJWJdMEVTwWke5Sc/E/RlnPGvGfS0W7+6ocy2xhDVQVh/KvC2Uf7kACs+gDytdusDSdWfWkaNzw==} dependencies: - '@types/react': 18.2.46 + '@types/react': 18.2.48 dev: true /@types/react-is/17.0.7: resolution: {integrity: sha512-WrTEiT+c6rgq36QApoy0063uAOdltCrhF0QMXLIgYPaTvIdQhAB8hPb5oGGqX18xToElNILS9UprwU6GyINcJg==} dependencies: - '@types/react': 17.0.74 + '@types/react': 17.0.75 dev: true - /@types/react/17.0.74: - resolution: {integrity: sha512-nBtFGaeTMzpiL/p73xbmCi00SiCQZDTJUk9ZuHOLtil3nI+y7l269LHkHIAYpav99ZwGnPJzuJsJpfLXjiQ52g==} + /@types/react/17.0.75: + resolution: {integrity: sha512-MSA+NzEzXnQKrqpO63CYqNstFjsESgvJAdAyyJ1n6ZQq/GLgf6nOfIKwk+Twuz0L1N6xPe+qz5xRCJrbhMaLsw==} dependencies: '@types/prop-types': 15.7.11 '@types/scheduler': 0.16.8 csstype: 3.1.3 dev: true - /@types/react/18.2.46: - resolution: {integrity: sha512-nNCvVBcZlvX4NU1nRRNV/mFl1nNRuTuslAJglQsq+8ldXe5Xv0Wd2f7WTE3jOxhLH2BFfiZGC6GCp+kHQbgG+w==} + /@types/react/18.2.48: + resolution: {integrity: sha512-qboRCl6Ie70DQQG9hhNREz81jqC1cs9EVNcjQ1AU+jH6NFfSAhVVbrrY/+nSF+Bsk4AOwm9Qa61InvMCyV+H3w==} dependencies: '@types/prop-types': 15.7.11 '@types/scheduler': 0.16.8 @@ -3141,7 +3140,7 @@ packages: /@types/resolve/0.0.8: resolution: {integrity: sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ==} dependencies: - '@types/node': 20.10.5 + '@types/node': 20.11.7 dev: true /@types/resolve/1.20.2: @@ -3166,7 +3165,7 @@ packages: /@types/streamx/2.9.5: resolution: {integrity: sha512-IHYsa6jYrck8VEdSwpY141FTTf6D7boPeMq9jy4qazNrFMA4VbRz/sw5LSsfR7jwdDcx0QKWkUexZvsWBC2eIQ==} dependencies: - '@types/node': 20.10.5 + '@types/node': 20.11.7 dev: true /@types/terser/3.12.0: @@ -3179,7 +3178,7 @@ packages: /@types/through2/2.0.38: resolution: {integrity: sha512-YFu+nHmjxMurkH1BSzA0Z1WrKDAY8jUKPZctNQn7mc+/KKtp2XxnclHFXxdB1m7Iqnzb5aywgP8TMK283LezGQ==} dependencies: - '@types/node': 20.10.5 + '@types/node': 20.11.7 dev: true /@types/undertaker-registry/1.0.4: @@ -3189,7 +3188,7 @@ packages: /@types/undertaker/1.2.8: resolution: {integrity: sha512-gW3PRqCHYpo45XFQHJBhch7L6hytPsIe0QeLujlnFsjHPnXLhJcPdN6a9368d7aIQgH2I/dUTPFBlGeSNA3qOg==} dependencies: - '@types/node': 20.10.5 + '@types/node': 20.11.7 '@types/undertaker-registry': 1.0.4 async-done: 1.3.2 dev: true @@ -3198,7 +3197,7 @@ packages: resolution: {integrity: sha512-ckYz9giHgV6U10RFuf9WsDQ3X86EFougapxHmmoxLK7e6ICQqO8CE+4V/3lBN148V5N1pb4nQMmMjyScleVsig==} dependencies: '@types/glob-stream': 8.0.2 - '@types/node': 20.10.5 + '@types/node': 20.11.7 '@types/vinyl': 2.0.7 dev: true @@ -3206,7 +3205,7 @@ packages: resolution: {integrity: sha512-4UqPv+2567NhMQuMLdKAyK4yzrfCqwaTt6bLhHEs8PFcxbHILsrxaY63n4wgE/BRLDWDQeI+WcTmkXKExh9hQg==} dependencies: '@types/expect': 1.20.4 - '@types/node': 20.10.5 + '@types/node': 20.11.7 /@types/yargs-parser/21.0.0: resolution: {integrity: sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==} @@ -3354,31 +3353,31 @@ packages: resolution: {integrity: sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==} dev: true - /@visactor/vchart/1.8.7: - resolution: {integrity: sha512-M0kFlZ17TcamZSRrO/8X45mjBxBPrPAQyJK2amKb4LR6yu2tJNMQJMVSUzC3TPeoyZBC6Qhthj0h6PLB88qTRA==} + /@visactor/vchart/1.9.0: + resolution: {integrity: sha512-2iZg1TjBQ068De6IHjQl3zdoYlwcZ+yZmHr1R/+MGVevSOHKkpqq4O5fIQPzHDqDnk4PW7amfl6g9+B+JQ5GsA==} dependencies: - '@visactor/vdataset': 0.17.3 - '@visactor/vgrammar-core': 0.10.8 - '@visactor/vgrammar-hierarchy': 0.10.8 - '@visactor/vgrammar-projection': 0.10.8 - '@visactor/vgrammar-sankey': 0.10.8 - '@visactor/vgrammar-util': 0.10.8 - '@visactor/vgrammar-wordcloud': 0.10.8 - '@visactor/vgrammar-wordcloud-shape': 0.10.8 - '@visactor/vrender-components': 0.17.19-alpha.1 - '@visactor/vrender-core': 0.17.19-alpha.1 - '@visactor/vrender-kits': 0.17.19-alpha.1 - '@visactor/vscale': 0.17.3 - '@visactor/vutils': 0.17.3 - '@visactor/vutils-extension': 1.8.7 + '@visactor/vdataset': 0.17.4 + '@visactor/vgrammar-core': 0.11.5 + '@visactor/vgrammar-hierarchy': 0.11.5 + '@visactor/vgrammar-projection': 0.11.5 + '@visactor/vgrammar-sankey': 0.11.5 + '@visactor/vgrammar-util': 0.11.5 + '@visactor/vgrammar-wordcloud': 0.11.5 + '@visactor/vgrammar-wordcloud-shape': 0.11.5 + '@visactor/vrender-components': 0.17.19 + '@visactor/vrender-core': 0.17.19 + '@visactor/vrender-kits': 0.17.19 + '@visactor/vscale': 0.17.4 + '@visactor/vutils': 0.17.4 + '@visactor/vutils-extension': 1.9.0 - /@visactor/vdataset/0.17.3: - resolution: {integrity: sha512-uckfCq1gLvqUlbyi3p9GiY8qcv2uNZ2KzLxO0/CVfDUXZ1IsERT8363ue7vejctEpqEa112vgqYrw73qlumH9Q==} + /@visactor/vdataset/0.17.4: + resolution: {integrity: sha512-o43a4/z9J3Wr/u+5BI8G+XwtWAJSHl+Pg0+UZDYoS+lXQLJV64THokAfhWUEWrMqxnrUbdBqaPgZAozYzaZJdg==} dependencies: '@turf/flatten': 6.5.0 '@turf/helpers': 6.5.0 '@turf/rewind': 6.5.0 - '@visactor/vutils': 0.17.3 + '@visactor/vutils': 0.17.4 d3-dsv: 2.0.0 d3-geo: 1.12.1 d3-hexbin: 0.2.2 @@ -3393,120 +3392,161 @@ packages: simplify-geojson: 1.0.5 topojson-client: 3.1.0 - /@visactor/vgrammar-coordinate/0.10.8: - resolution: {integrity: sha512-AfewiepfTElin5G2pUuINXoDGHb1xVenIzGDDY4AfJsVRAaRqXLJv4tqBo1Qas9RqS5W3m77697J+b6ExvDLgQ==} + /@visactor/vgrammar-coordinate/0.11.5: + resolution: {integrity: sha512-j3oIOQOI229s5g3FlJGqUmPd9kFMqdNDXK2lim1g+SLxLKxIvf5lP7w6IrJL18dL5r5bfw0OO7qfWQrHMxm5eA==} dependencies: - '@visactor/vgrammar-util': 0.10.8 - '@visactor/vutils': 0.17.3 + '@visactor/vgrammar-util': 0.11.5 + '@visactor/vutils': 0.17.4 - /@visactor/vgrammar-core/0.10.8: - resolution: {integrity: sha512-lQIQBZhARyCOObYwXF8Miwnh8L6AsnGqZJ45P+1X/Pk3ZqUPBXjonW2fWcrgKVGaZ59G3P9OEp1rwErmIsrhBg==} + /@visactor/vgrammar-core/0.11.5: + resolution: {integrity: sha512-mjhps1xC9sYvWmgVp1lV3UVl8dUT+waHhPC3hL2XDRZ+YV0e694U2HPiWlh0JsVHXerYFdjm63t1UVfy48LqRg==} dependencies: - '@visactor/vdataset': 0.17.3 - '@visactor/vgrammar-coordinate': 0.10.8 - '@visactor/vgrammar-util': 0.10.8 - '@visactor/vrender-components': 0.17.19-alpha.1 - '@visactor/vrender-core': 0.17.19-alpha.1 - '@visactor/vrender-kits': 0.17.19-alpha.1 - '@visactor/vscale': 0.17.3 - '@visactor/vutils': 0.17.3 + '@visactor/vdataset': 0.17.4 + '@visactor/vgrammar-coordinate': 0.11.5 + '@visactor/vgrammar-util': 0.11.5 + '@visactor/vrender-components': 0.17.19 + '@visactor/vrender-core': 0.17.19 + '@visactor/vrender-kits': 0.17.19 + '@visactor/vscale': 0.17.4 + '@visactor/vutils': 0.17.4 - /@visactor/vgrammar-hierarchy/0.10.8: - resolution: {integrity: sha512-eXZgzCDbj+8YqgLgAKdS3ad3ZcpxsnLFeZibSkNKvgi8Wc5zHTZ2kf/IQ525t/0I/CtZlfccVfUkhA6O/QJXBg==} + /@visactor/vgrammar-hierarchy/0.11.5: + resolution: {integrity: sha512-HVsKusLuL1VwcuNXXqQA0uZ9XIQc25uLa0D3xBBwzkTxyMAvRWSmfh/sLFxnd+HiCZsV8iTXXzvyPUY9V/uOpQ==} dependencies: - '@visactor/vgrammar-core': 0.10.8 - '@visactor/vgrammar-util': 0.10.8 - '@visactor/vrender-core': 0.17.19-alpha.1 - '@visactor/vrender-kits': 0.17.19-alpha.1 - '@visactor/vutils': 0.17.3 + '@visactor/vgrammar-core': 0.11.5 + '@visactor/vgrammar-util': 0.11.5 + '@visactor/vrender-core': 0.17.19 + '@visactor/vrender-kits': 0.17.19 + '@visactor/vutils': 0.17.4 - /@visactor/vgrammar-projection/0.10.8: - resolution: {integrity: sha512-u6LLGcedly1ZlgcaAWakFJUBm5WcctrfYwQqi5vJ9iiCnKu9Yhw3y5wjlTcxFcTYpnPKyfucF7Sk0Px+w/Q6Xw==} + /@visactor/vgrammar-projection/0.11.5: + resolution: {integrity: sha512-ZzzP0UMn4iD8wIFGG/R59kJbTsN0hruyx6vxju7tYQTNCwO/n7T+JDAbjVFpVSfMmu8/xYO0NKRdJX0PqQ8iZA==} dependencies: - '@visactor/vgrammar-core': 0.10.8 - '@visactor/vgrammar-util': 0.10.8 - '@visactor/vutils': 0.17.3 + '@visactor/vgrammar-core': 0.11.5 + '@visactor/vgrammar-util': 0.11.5 + '@visactor/vutils': 0.17.4 d3-geo: 1.12.1 - /@visactor/vgrammar-sankey/0.10.8: - resolution: {integrity: sha512-cH1lcNU+N/wTtGYTh2ny21kQUaA0/zFFL2j4gUGh1dWx4jT1/jL+/ANDYTW7hAbMcQFrv+2pBrU4G4gQXfSMQg==} + /@visactor/vgrammar-sankey/0.11.5: + resolution: {integrity: sha512-SOsMj0tj9Zu13NBErdQkKoQcyUNu3Er3BnZP85fyv0lGzdQW6m3o/T2ziVP7sZJwWm8vXwiUOI2dYEaN9zJNwQ==} dependencies: - '@visactor/vgrammar-core': 0.10.8 - '@visactor/vgrammar-util': 0.10.8 - '@visactor/vrender-core': 0.17.19-alpha.1 - '@visactor/vrender-kits': 0.17.19-alpha.1 - '@visactor/vutils': 0.17.3 + '@visactor/vgrammar-core': 0.11.5 + '@visactor/vgrammar-util': 0.11.5 + '@visactor/vrender-core': 0.17.19 + '@visactor/vrender-kits': 0.17.19 + '@visactor/vutils': 0.17.4 - /@visactor/vgrammar-util/0.10.8: - resolution: {integrity: sha512-VgdeoX1yWYiJv/KXVRA2maMhiqTXfducGEwMq4HAJ6PWJDklQv2HovENZUpqynXRh/1VbgSN4O/dHryujMucNw==} + /@visactor/vgrammar-util/0.11.5: + resolution: {integrity: sha512-trbgNsbj+TBa+202Iw+ews79w0iiZSeLgoWcq80pS+2U+xiuCjjdyDe6U1sbJV/6HKtRR1mSk4dwdR0NRVs0hQ==} dependencies: - '@visactor/vutils': 0.17.3 + '@visactor/vutils': 0.17.4 - /@visactor/vgrammar-wordcloud-shape/0.10.8: - resolution: {integrity: sha512-YTcMpnWSGcQo8SXQcPzjXkd8e3UuCKgyYcfpn4G5L+yvpYEza6DM+hGwKG0gL73qs2YTvFnO3nkdnmxmZwAoKw==} + /@visactor/vgrammar-wordcloud-shape/0.11.5: + resolution: {integrity: sha512-+6hKAXZ3OaNiw3PfNcPc5K0BLz8Z6tC5F3eYdzrlLBVvzQGyea+o7LjHPMfcPH6jHhatOXsPOrXb6QAVoL9A0A==} dependencies: - '@visactor/vgrammar-core': 0.10.8 - '@visactor/vgrammar-util': 0.10.8 - '@visactor/vrender-core': 0.17.19-alpha.1 - '@visactor/vrender-kits': 0.17.19-alpha.1 - '@visactor/vscale': 0.17.3 - '@visactor/vutils': 0.17.3 + '@visactor/vgrammar-core': 0.11.5 + '@visactor/vgrammar-util': 0.11.5 + '@visactor/vrender-core': 0.17.19 + '@visactor/vrender-kits': 0.17.19 + '@visactor/vscale': 0.17.4 + '@visactor/vutils': 0.17.4 - /@visactor/vgrammar-wordcloud/0.10.8: - resolution: {integrity: sha512-HXdXcG/pkFkQsKN+T2O6FLStl/ePjVTKOUZK5Kk+vQcK0+/v1R8eldv3b0aqoIuZLoMqc0ku4bPNHc7vmLQh5Q==} + /@visactor/vgrammar-wordcloud/0.11.5: + resolution: {integrity: sha512-zWzfs1nQyQJv/pgJHilC/DnDhe+M3u/d51bBPlaAmSNijPVY85sNSIwbGVJVuGi2zSJLmB5YbbFuZCWp23TuwA==} dependencies: - '@visactor/vgrammar-core': 0.10.8 - '@visactor/vgrammar-util': 0.10.8 - '@visactor/vrender-core': 0.17.19-alpha.1 - '@visactor/vrender-kits': 0.17.19-alpha.1 - '@visactor/vutils': 0.17.3 + '@visactor/vgrammar-core': 0.11.5 + '@visactor/vgrammar-util': 0.11.5 + '@visactor/vrender-core': 0.17.19 + '@visactor/vrender-kits': 0.17.19 + '@visactor/vutils': 0.17.4 + + /@visactor/vrender-components/0.17.19: + resolution: {integrity: sha512-B5Hj9n71OuWBMPo16G0HUUgHJFFiQDklwojtJvUgWmdp0gjGkbGJN4//+C1tEN1ONSAJc+uJvo2fZZMxcnpi7w==} + dependencies: + '@visactor/vrender-core': 0.17.19 + '@visactor/vrender-kits': 0.17.19 + '@visactor/vscale': 0.17.4 + '@visactor/vutils': 0.17.4 /@visactor/vrender-components/0.17.19-alpha.1: resolution: {integrity: sha512-86oJ8Jg4nKLHsAwNzAmk/54SdC6gx2d5Y7Cn0x6Q7hpsjb3eWrcjS8g8rHPp8HOn3Bl/mphGK5DHrpk3ZSjA0Q==} dependencies: '@visactor/vrender-core': 0.17.19-alpha.1 '@visactor/vrender-kits': 0.17.19-alpha.1 - '@visactor/vscale': 0.17.3 - '@visactor/vutils': 0.17.3 + '@visactor/vscale': 0.17.4 + '@visactor/vutils': 0.17.4 + dev: false + + /@visactor/vrender-core/0.17.17: + resolution: {integrity: sha512-pAZGaimunDAWOBdFhzPh0auH5ryxAHr+MVoz+QdASG+6RZXy8D02l8v2QYu4+e4uorxe/s2ZkdNDm81SlNkoHQ==} + dependencies: + '@visactor/vutils': 0.17.4 + color-convert: 2.0.1 + dev: false + + /@visactor/vrender-core/0.17.19: + resolution: {integrity: sha512-ylqm0QDZb2vk7HbFjJrp7JES6A0LneaeFK/EYcV/A32x7U60wi8WOIwuVhHWv0rxBeQ6YzgiDbGCPnjwHux5jA==} + dependencies: + '@visactor/vutils': 0.17.4 + color-convert: 2.0.1 /@visactor/vrender-core/0.17.19-alpha.1: resolution: {integrity: sha512-9io+5xdvxWF4i9sr1P4W9i2PjaAqfTCnMUKC1rDl3CLzreqVCl9NA0UKqItv4OFhTCmcH7zwJzgUSjamJvbJPQ==} dependencies: - '@visactor/vutils': 0.17.3 + '@visactor/vutils': 0.17.4 color-convert: 2.0.1 + dev: false + + /@visactor/vrender-kits/0.17.17: + resolution: {integrity: sha512-noRP1hAHvPCv36nf2P6sZ930Tk+dJ8jpPWIUm1cFYmUNdcumgIS8Cug0RyeZ+saSqVt5FDTwIwifhOqupw5Zaw==} + dependencies: + '@resvg/resvg-js': 2.4.1 + '@visactor/vrender-core': 0.17.17 + '@visactor/vutils': 0.17.4 + roughjs: 4.5.2 + dev: false + + /@visactor/vrender-kits/0.17.19: + resolution: {integrity: sha512-qnlJkgJj+dVy6jpscv5fG02f/cUeInO/v9VSfxIgS2w1ZTEAiV09U6FVvGCIPlrX+UylihzVexTMI4L44GkX7Q==} + dependencies: + '@resvg/resvg-js': 2.4.1 + '@visactor/vrender-core': 0.17.19 + '@visactor/vutils': 0.17.4 + roughjs: 4.5.2 /@visactor/vrender-kits/0.17.19-alpha.1: resolution: {integrity: sha512-O0lrvTIBZgPULCEtWqBxXZ47cQqjLtYs4MhqoFiLjrQr9VTBxomOyGAZDq08YLAfNFgQFRjiaWBeTi3JIyfxfQ==} dependencies: '@resvg/resvg-js': 2.4.1 '@visactor/vrender-core': 0.17.19-alpha.1 - '@visactor/vutils': 0.17.3 + '@visactor/vutils': 0.17.4 roughjs: 4.5.2 + dev: false - /@visactor/vscale/0.17.3: - resolution: {integrity: sha512-05ESzGvJU4lS5Ndv8+rins05RaOr1eIRBnXwIdzAxv/77MTJ9X8GxRGl1y/nR14XPpPVd9vgdzYRTCbpL6hPHg==} + /@visactor/vscale/0.17.4: + resolution: {integrity: sha512-gF9SWmduQxat8ct8BkDwT3C/E7aWxsqKctJ6zI+XZzL/wLD4NELnA7zUSiuRmyAunjaH87B9jNtiPcBRMviVEw==} dependencies: - '@visactor/vutils': 0.17.3 + '@visactor/vutils': 0.17.4 - /@visactor/vutils-extension/1.8.5: - resolution: {integrity: sha512-3DJMhGLmQ5Mk6VSxuLFKCzM9XIFkwGauU4el6skUY5qmmAbyZjOyneycAUiGCcbxZHvHpg1jyRk27Eipf4+bgQ==} + /@visactor/vutils-extension/1.8.10: + resolution: {integrity: sha512-CS5UR8l8ckHtSQC70PrqrHL6BvYIPgoKgzROE1JxZKwkPpVUPR+9UBrPr0hY8tjsFCpLioTVrhnW6sXTVnnuzA==} dependencies: - '@visactor/vrender-core': 0.17.19-alpha.1 - '@visactor/vrender-kits': 0.17.19-alpha.1 - '@visactor/vscale': 0.17.3 - '@visactor/vutils': 0.17.3 + '@visactor/vrender-core': 0.17.17 + '@visactor/vrender-kits': 0.17.17 + '@visactor/vscale': 0.17.4 + '@visactor/vutils': 0.17.4 dev: false - /@visactor/vutils-extension/1.8.7: - resolution: {integrity: sha512-o6Hw5+jqj9IzPS6babV0fyQ8RC9r2DHfvSx5fC/cEuHdvCVYjtzdHJHGmjJ42EAp4PGGUUn2MtGyaxFtzxSD5A==} + /@visactor/vutils-extension/1.9.0: + resolution: {integrity: sha512-yZpk+E8tyil/Iz/0riIXQRB40H2ExfKfv0fm6UFrzGit3kigIk5vKKGe2rO2OO30FGC+V1DpG4H2U/5QKmNOIA==} dependencies: - '@visactor/vrender-core': 0.17.19-alpha.1 - '@visactor/vrender-kits': 0.17.19-alpha.1 - '@visactor/vscale': 0.17.3 - '@visactor/vutils': 0.17.3 + '@visactor/vrender-core': 0.17.19 + '@visactor/vrender-kits': 0.17.19 + '@visactor/vscale': 0.17.4 + '@visactor/vutils': 0.17.4 - /@visactor/vutils/0.17.3: - resolution: {integrity: sha512-o3iq+NnvXujwXdXiyWt0t2mTzOfIxQl0M9++DtstOWy21LApqCZfj1hzZZ4424Ie3/mwPQsgtUDILvoWKhGWXA==} + /@visactor/vutils/0.17.4: + resolution: {integrity: sha512-tii2RpNEhXsvU+DRgadFcfo0UM/xOIZz7bxhycA624TUQdPnH/tOpdjAtSdvnjusrMmqsx8yAJa8j1imXkZLsg==} dependencies: '@turf/helpers': 6.5.0 '@turf/invariant': 6.5.0 @@ -3533,7 +3573,7 @@ packages: dependencies: '@vitest/spy': 0.30.1 '@vitest/utils': 0.30.1 - chai: 4.3.10 + chai: 4.4.1 dev: true /@vitest/runner/0.30.1: @@ -3542,14 +3582,14 @@ packages: '@vitest/utils': 0.30.1 concordance: 5.0.4 p-limit: 4.0.0 - pathe: 1.1.1 + pathe: 1.1.2 dev: true /@vitest/snapshot/0.30.1: resolution: {integrity: sha512-fJZqKrE99zo27uoZA/azgWyWbFvM1rw2APS05yB0JaLwUIg9aUtvvnBf4q7JWhEcAHmSwbrxKFgyBUga6tq9Tw==} dependencies: magic-string: 0.30.5 - pathe: 1.1.1 + pathe: 1.1.2 pretty-format: 27.5.1 dev: true @@ -3606,8 +3646,8 @@ packages: engines: {node: '>=0.4.0'} dev: true - /acorn-walk/8.3.1: - resolution: {integrity: sha512-TgUZgYvqZprrl7YldZNoa9OciCAyZR+Ejm9eXzKCmjsF5IKp/wgQ7Z/ZpjpGTIUPwrHQIcYeI8qDh4PsEwxMbw==} + /acorn-walk/8.3.2: + resolution: {integrity: sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==} engines: {node: '>=0.4.0'} /acorn/5.7.4: @@ -4055,7 +4095,7 @@ packages: postcss: ^8.1.0 dependencies: browserslist: 4.22.2 - caniuse-lite: 1.0.30001572 + caniuse-lite: 1.0.30001580 fraction.js: 4.3.7 normalize-range: 0.1.2 picocolors: 1.0.0 @@ -4075,10 +4115,10 @@ packages: resolution: {integrity: sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==} dev: true - /axios/1.6.3: - resolution: {integrity: sha512-fWyNdeawGam70jXSVlKl+SUNVcL6j6W79CuSIPfi6HnDUmSCH6gyUys/HrqHeA/wU0Az41rRgean494d0Jb+ww==} + /axios/1.6.7: + resolution: {integrity: sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA==} dependencies: - follow-redirects: 1.15.3 + follow-redirects: 1.15.5 form-data: 4.0.0 proxy-from-env: 1.1.0 transitivePeerDependencies: @@ -4172,17 +4212,17 @@ packages: resolution: {integrity: sha512-2EMA2P8Vp7lG0RAzr4HXqtYwacfMErOuv1U3wrvxHX6rD1sV6xS3WXG3r8TRQ2r6w8OhvSdWt+z41hQNwNm3Xw==} engines: {node: '>= 6'} dependencies: - '@types/babel__traverse': 7.20.4 + '@types/babel__traverse': 7.20.5 dev: true /babel-plugin-jest-hoist/26.6.2: resolution: {integrity: sha512-PO9t0697lNTmcEHH69mdtYiOIkkOlj9fySqfO3K1eCcdISevLAE0xY59VLLUj0SoiPiTX/JU2CYFpILydUa5Lw==} engines: {node: '>= 10.14.2'} dependencies: - '@babel/template': 7.22.15 - '@babel/types': 7.23.6 + '@babel/template': 7.23.9 + '@babel/types': 7.23.9 '@types/babel__core': 7.20.0 - '@types/babel__traverse': 7.20.4 + '@types/babel__traverse': 7.20.5 dev: true /babel-plugin-polyfill-corejs2/0.3.3_@babel+core@7.20.12: @@ -4204,7 +4244,7 @@ packages: dependencies: '@babel/core': 7.20.12 '@babel/helper-define-polyfill-provider': 0.3.3_@babel+core@7.20.12 - core-js-compat: 3.35.0 + core-js-compat: 3.35.1 transitivePeerDependencies: - supports-color @@ -4410,8 +4450,8 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001572 - electron-to-chromium: 1.4.616 + caniuse-lite: 1.0.30001580 + electron-to-chromium: 1.4.646 node-releases: 2.0.14 update-browserslist-db: 1.0.13_browserslist@4.22.2 @@ -4502,7 +4542,7 @@ packages: dependencies: function-bind: 1.1.2 get-intrinsic: 1.2.2 - set-function-length: 1.1.1 + set-function-length: 1.2.0 /callsites/3.1.0: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} @@ -4527,13 +4567,13 @@ packages: resolution: {integrity: sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==} dependencies: browserslist: 4.22.2 - caniuse-lite: 1.0.30001572 + caniuse-lite: 1.0.30001580 lodash.memoize: 4.1.2 lodash.uniq: 4.5.0 dev: false - /caniuse-lite/1.0.30001572: - resolution: {integrity: sha512-1Pbh5FLmn5y4+QhNyJE9j3/7dK44dGB83/ZMjv/qJk86TvDbjk0LosiZo0i0WB0Vx607qMX9jYrn1VLHCkN4rw==} + /caniuse-lite/1.0.30001580: + resolution: {integrity: sha512-mtj5ur2FFPZcCEpXFy8ADXbDACuNFXg6mxVDqp7tqooX6l3zwm+d8EPoeOSIFRDvHs8qu7/SLFOGniULkcH2iA==} /capture-exit/2.0.0: resolution: {integrity: sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g==} @@ -4546,27 +4586,27 @@ packages: resolution: {integrity: sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==} dev: true - /chai/4.3.10: - resolution: {integrity: sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g==} + /chai/4.3.4: + resolution: {integrity: sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==} engines: {node: '>=4'} dependencies: assertion-error: 1.1.0 check-error: 1.0.3 - deep-eql: 4.1.3 + deep-eql: 3.0.1 get-func-name: 2.0.2 - loupe: 2.3.7 pathval: 1.1.1 type-detect: 4.0.8 dev: true - /chai/4.3.4: - resolution: {integrity: sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==} + /chai/4.4.1: + resolution: {integrity: sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==} engines: {node: '>=4'} dependencies: assertion-error: 1.1.0 check-error: 1.0.3 - deep-eql: 3.0.1 + deep-eql: 4.1.3 get-func-name: 2.0.2 + loupe: 2.3.7 pathval: 1.1.1 type-detect: 4.0.8 dev: true @@ -4984,8 +5024,8 @@ packages: is-plain-object: 5.0.0 dev: false - /core-js-compat/3.35.0: - resolution: {integrity: sha512-5blwFAddknKeNgsjBzilkdQ0+YK8L1PfqPYq40NOYMYFSS38qj+hpTcLLWwpIwA2A5bje/x5jmVn2tzUMg9IVw==} + /core-js-compat/3.35.1: + resolution: {integrity: sha512-sftHa5qUJY3rs9Zht1WEnmkvXputCyDBczPnr7QDgL8n3qrF3CMXY4VPSYtOLLiOUJcah2WNXREd48iOl6mQIw==} dependencies: browserslist: 4.22.2 @@ -5486,7 +5526,7 @@ packages: /dom-helpers/5.2.1: resolution: {integrity: sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==} dependencies: - '@babel/runtime': 7.23.6 + '@babel/runtime': 7.23.9 csstype: 3.1.3 dev: false @@ -5551,7 +5591,7 @@ packages: end-of-stream: 1.4.4 inherits: 2.0.4 readable-stream: 2.3.8 - stream-shift: 1.0.1 + stream-shift: 1.0.3 dev: false /duplexify/4.1.2: @@ -5560,7 +5600,7 @@ packages: end-of-stream: 1.4.4 inherits: 2.0.4 readable-stream: 3.6.2 - stream-shift: 1.0.1 + stream-shift: 1.0.3 dev: false /each-props/1.3.2: @@ -5581,8 +5621,8 @@ packages: safer-buffer: 2.1.2 dev: true - /electron-to-chromium/1.4.616: - resolution: {integrity: sha512-1n7zWYh8eS0L9Uy+GskE0lkBUNK83cXTVJI0pU3mGprFsbfSdAc15VTFbo+A+Bq4pwstmL30AVcEU3Fo463lNg==} + /electron-to-chromium/1.4.646: + resolution: {integrity: sha512-vThkQ0JuF45qT/20KbRgM56lV7IuGt7SjhawQ719PDHzhP84KAO1WJoaxgCoAffKHK47FmVKP1Fqizx7CwK1SA==} /electron/11.5.0: resolution: {integrity: sha512-WjNDd6lGpxyiNjE3LhnFCAk/D9GIj1rU3GSDealVShhkkkPR3Vh4q8ErXGDl1OAO/faomVa10KoFPUN/pLbNxg==} @@ -5694,8 +5734,8 @@ packages: object-keys: 1.1.1 object.assign: 4.1.5 regexp.prototype.flags: 1.5.1 - safe-array-concat: 1.0.1 - safe-regex-test: 1.0.0 + safe-array-concat: 1.1.0 + safe-regex-test: 1.0.2 string.prototype.trim: 1.2.8 string.prototype.trimend: 1.0.7 string.prototype.trimstart: 1.0.7 @@ -6583,8 +6623,8 @@ packages: tslib: 2.3.1 dev: false - /follow-redirects/1.15.3: - resolution: {integrity: sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==} + /follow-redirects/1.15.5: + resolution: {integrity: sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==} engines: {node: '>=4.0'} peerDependencies: debug: '*' @@ -7088,7 +7128,7 @@ packages: resolution: {integrity: sha512-SVSF7ikuWKhpAW4l4wapAqPPSToJoiNKsbDoUnRrSgwZHH7lH8pbPeQj1aOVYQrbZKhfSVBxVW+Py7vtulRktw==} engines: {node: '>=10'} dependencies: - '@types/node': 20.10.5 + '@types/node': 20.11.7 '@types/vinyl': 2.0.7 istextorbinary: 3.3.0 replacestream: 4.0.3 @@ -7824,10 +7864,10 @@ packages: engines: {node: '>=6'} dependencies: '@babel/generator': 7.21.1 - '@babel/parser': 7.23.6 - '@babel/template': 7.22.15 - '@babel/traverse': 7.23.6 - '@babel/types': 7.23.6 + '@babel/parser': 7.23.9 + '@babel/template': 7.23.9 + '@babel/traverse': 7.23.9 + '@babel/types': 7.23.9 istanbul-lib-coverage: 2.0.5 semver: 6.3.1 transitivePeerDependencies: @@ -7851,7 +7891,7 @@ packages: engines: {node: '>=8'} dependencies: '@babel/core': 7.20.12 - '@babel/parser': 7.23.6 + '@babel/parser': 7.23.9 '@istanbuljs/schema': 0.1.3 istanbul-lib-coverage: 3.2.2 semver: 6.3.1 @@ -7982,7 +8022,7 @@ packages: jest-validate: 26.6.2 micromatch: 4.0.5 pretty-format: 26.6.2 - ts-node: 10.9.0_f3xuzkf73irh6k3dig4vinkuoy + ts-node: 10.9.0_7ft46uf3tz44iffs2xfvqbt3oe transitivePeerDependencies: - bufferutil - canvas @@ -8087,7 +8127,7 @@ packages: '@jest/environment': 26.6.2 '@jest/fake-timers': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.10.5 + '@types/node': 20.11.7 jest-mock: 26.6.2 jest-util: 26.6.2 jsdom: 16.7.0 @@ -8118,7 +8158,7 @@ packages: '@jest/environment': 26.6.2 '@jest/fake-timers': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.10.5 + '@types/node': 20.11.7 jest-mock: 26.6.2 jest-util: 26.6.2 dev: true @@ -8158,7 +8198,7 @@ packages: dependencies: '@jest/types': 26.6.2 '@types/graceful-fs': 4.1.9 - '@types/node': 20.10.5 + '@types/node': 20.11.7 anymatch: 3.1.3 fb-watchman: 2.0.2 graceful-fs: 4.2.11 @@ -8177,7 +8217,7 @@ packages: resolution: {integrity: sha512-Cq7vkAgaYKp+PsX+2/JbTarrk0DmNhsEtqBXNwUHkdlbrTBLtMJINADf2mf5FkowNsq8evbPc07/qFO0AdKTzw==} engines: {node: '>= 6'} dependencies: - '@babel/traverse': 7.23.6 + '@babel/traverse': 7.23.9 '@jest/environment': 24.9.0 '@jest/test-result': 24.9.0 '@jest/types': 24.9.0 @@ -8201,12 +8241,12 @@ packages: resolution: {integrity: sha512-kPKUrQtc8aYwBV7CqBg5pu+tmYXlvFlSFYn18ev4gPFtrRzB15N2gW/Roew3187q2w2eHuu0MU9TJz6w0/nPEg==} engines: {node: '>= 10.14.2'} dependencies: - '@babel/traverse': 7.23.6 + '@babel/traverse': 7.23.9 '@jest/environment': 26.6.2 '@jest/source-map': 26.6.2 '@jest/test-result': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.10.5 + '@types/node': 20.11.7 chalk: 4.1.2 co: 4.6.0 expect: 26.6.2 @@ -8304,7 +8344,7 @@ packages: engines: {node: '>= 10.14.2'} dependencies: '@jest/types': 26.6.2 - '@types/node': 20.10.5 + '@types/node': 20.11.7 dev: true /jest-pnp-resolver/1.2.3_jest-resolve@24.9.0: @@ -8410,7 +8450,7 @@ packages: '@jest/environment': 26.6.2 '@jest/test-result': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.10.5 + '@types/node': 20.11.7 chalk: 4.1.2 emittery: 0.7.2 exit: 0.1.2 @@ -8515,7 +8555,7 @@ packages: resolution: {integrity: sha512-S5wqyz0DXnNJPd/xfIzZ5Xnp1HrJWBczg8mMfMpN78OJ5eDxXyf+Ygld9wX1DnUWbIbhM1YDY95NjR4CBXkb2g==} engines: {node: '>= 10.14.2'} dependencies: - '@types/node': 20.10.5 + '@types/node': 20.11.7 graceful-fs: 4.2.11 dev: true @@ -8523,7 +8563,7 @@ packages: resolution: {integrity: sha512-uI/rszGSs73xCM0l+up7O7a40o90cnrk429LOiK3aeTvfC0HHmldbd81/B7Ix81KSFe1lwkbl7GnBGG4UfuDew==} engines: {node: '>= 6'} dependencies: - '@babel/types': 7.23.6 + '@babel/types': 7.23.9 '@jest/types': 24.9.0 chalk: 2.4.2 expect: 24.9.0 @@ -8542,9 +8582,9 @@ packages: resolution: {integrity: sha512-OLhxz05EzUtsAmOMzuupt1lHYXCNib0ECyuZ/PZOx9TrZcC8vL0x+DUG3TL+GLX3yHG45e6YGjIm0XwDc3q3og==} engines: {node: '>= 10.14.2'} dependencies: - '@babel/types': 7.23.6 + '@babel/types': 7.23.9 '@jest/types': 26.6.2 - '@types/babel__traverse': 7.20.4 + '@types/babel__traverse': 7.20.5 '@types/prettier': 2.7.3 chalk: 4.1.2 expect: 26.6.2 @@ -8587,7 +8627,7 @@ packages: engines: {node: '>= 10.14.2'} dependencies: '@jest/types': 26.6.2 - '@types/node': 20.10.5 + '@types/node': 20.11.7 chalk: 4.1.2 graceful-fs: 4.2.11 is-ci: 2.0.0 @@ -8624,7 +8664,7 @@ packages: dependencies: '@jest/test-result': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.10.5 + '@types/node': 20.11.7 ansi-escapes: 4.3.2 chalk: 4.1.2 jest-util: 26.6.2 @@ -8643,7 +8683,7 @@ packages: resolution: {integrity: sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==} engines: {node: '>= 10.13.0'} dependencies: - '@types/node': 20.10.5 + '@types/node': 20.11.7 merge-stream: 2.0.0 supports-color: 7.2.0 dev: true @@ -8814,8 +8854,8 @@ packages: engines: {node: '>=6'} hasBin: true - /jsonc-parser/3.2.0: - resolution: {integrity: sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==} + /jsonc-parser/3.2.1: + resolution: {integrity: sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==} dev: true /jsonfile/4.0.0: @@ -9062,7 +9102,7 @@ packages: colorette: 2.0.20 log-update: 4.0.0 p-map: 4.0.0 - rfdc: 1.3.0 + rfdc: 1.3.1 rxjs: 7.8.1 through: 2.3.8 wrap-ansi: 7.0.0 @@ -9506,11 +9546,11 @@ packages: hasBin: true dev: true - /mlly/1.4.2: - resolution: {integrity: sha512-i/Ykufi2t1EZ6NaPLdfnZk2AX8cs0d+mTzVKuPfqPKPatxLApaBoxJQ9x1/uckXtrS/U5oisPMDkNs0yQTaBRg==} + /mlly/1.5.0: + resolution: {integrity: sha512-NPVQvAY1xr1QoVeG0cy8yUYC7FQcOx6evl/RjT1wL5FvzPnzOysoqB/jmx/DhssT2dYa8nxECLAaFI/+gVLhDQ==} dependencies: acorn: 8.11.3 - pathe: 1.1.1 + pathe: 1.1.2 pkg-types: 1.0.3 ufo: 1.3.2 dev: true @@ -9801,7 +9841,7 @@ packages: call-bind: 1.0.5 define-properties: 1.2.1 es-abstract: 1.22.3 - safe-array-concat: 1.0.1 + safe-array-concat: 1.1.0 dev: true /object.hasown/1.1.3: @@ -10121,8 +10161,8 @@ packages: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} engines: {node: '>=8'} - /pathe/1.1.1: - resolution: {integrity: sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==} + /pathe/1.1.2: + resolution: {integrity: sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==} dev: true /pathval/1.1.1: @@ -10212,9 +10252,9 @@ packages: /pkg-types/1.0.3: resolution: {integrity: sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==} dependencies: - jsonc-parser: 3.2.0 - mlly: 1.4.2 - pathe: 1.1.1 + jsonc-parser: 3.2.1 + mlly: 1.5.0 + pathe: 1.1.2 dev: true /plugin-error/0.1.2: @@ -10268,7 +10308,7 @@ packages: postcss: ^8.2.2 dependencies: postcss: 8.4.21 - postcss-selector-parser: 6.0.14 + postcss-selector-parser: 6.0.15 postcss-value-parser: 4.2.0 dev: false @@ -10346,7 +10386,7 @@ packages: dependencies: lilconfig: 2.1.0 postcss: 8.4.21 - ts-node: 10.9.0_f3xuzkf73irh6k3dig4vinkuoy + ts-node: 10.9.0_7ft46uf3tz44iffs2xfvqbt3oe yaml: 1.10.2 dev: false @@ -10371,7 +10411,7 @@ packages: caniuse-api: 3.0.0 cssnano-utils: 3.1.0_postcss@8.4.21 postcss: 8.4.21 - postcss-selector-parser: 6.0.14 + postcss-selector-parser: 6.0.15 dev: false /postcss-minify-font-values/5.1.0_postcss@8.4.21: @@ -10415,7 +10455,7 @@ packages: postcss: ^8.2.15 dependencies: postcss: 8.4.21 - postcss-selector-parser: 6.0.14 + postcss-selector-parser: 6.0.15 dev: false /postcss-modules-extract-imports/3.0.0_postcss@8.4.21: @@ -10427,26 +10467,26 @@ packages: postcss: 8.4.21 dev: false - /postcss-modules-local-by-default/4.0.3_postcss@8.4.21: - resolution: {integrity: sha512-2/u2zraspoACtrbFRnTijMiQtb4GW4BvatjaG/bCjYQo8kLTdevCUlwuBHx2sCnSyrI3x3qj4ZK1j5LQBgzmwA==} + /postcss-modules-local-by-default/4.0.4_postcss@8.4.21: + resolution: {integrity: sha512-L4QzMnOdVwRm1Qb8m4x8jsZzKAaPAgrUF1r/hjDR2Xj7R+8Zsf97jAlSQzWtKx5YNiNGN8QxmPFIc/sh+RQl+Q==} engines: {node: ^10 || ^12 || >= 14} peerDependencies: postcss: ^8.1.0 dependencies: icss-utils: 5.1.0_postcss@8.4.21 postcss: 8.4.21 - postcss-selector-parser: 6.0.14 + postcss-selector-parser: 6.0.15 postcss-value-parser: 4.2.0 dev: false - /postcss-modules-scope/3.1.0_postcss@8.4.21: - resolution: {integrity: sha512-SaIbK8XW+MZbd0xHPf7kdfA/3eOt7vxJ72IRecn3EzuZVLr1r0orzf0MX/pN8m+NMDoo6X/SQd8oeKqGZd8PXg==} + /postcss-modules-scope/3.1.1_postcss@8.4.21: + resolution: {integrity: sha512-uZgqzdTleelWjzJY+Fhti6F3C9iF1JR/dODLs/JDefozYcKTBCdD8BIl6nNPbTbcLnGrk56hzwZC2DaGNvYjzA==} engines: {node: ^10 || ^12 || >= 14} peerDependencies: postcss: ^8.1.0 dependencies: postcss: 8.4.21 - postcss-selector-parser: 6.0.14 + postcss-selector-parser: 6.0.15 dev: false /postcss-modules-values/4.0.0_postcss@8.4.21: @@ -10469,8 +10509,8 @@ packages: lodash.camelcase: 4.3.0 postcss: 8.4.21 postcss-modules-extract-imports: 3.0.0_postcss@8.4.21 - postcss-modules-local-by-default: 4.0.3_postcss@8.4.21 - postcss-modules-scope: 3.1.0_postcss@8.4.21 + postcss-modules-local-by-default: 4.0.4_postcss@8.4.21 + postcss-modules-scope: 3.1.1_postcss@8.4.21 postcss-modules-values: 4.0.0_postcss@8.4.21 string-hash: 1.1.3 dev: false @@ -10598,8 +10638,8 @@ packages: postcss-value-parser: 4.2.0 dev: false - /postcss-selector-parser/6.0.14: - resolution: {integrity: sha512-65xXYsT40i9GyWzlHQ5ShZoK7JZdySeOozi/tz2EezDo6c04q6+ckYMeoY7idaie1qp2dT5KoYQ2yky6JuoHnA==} + /postcss-selector-parser/6.0.15: + resolution: {integrity: sha512-rEYkQOMUCEMhsKbK66tbEU9QVIxbhN18YiniAwA7XQYTVBqrBy+P2p5JcdqsHgKM2zWylp8d7J6eszocfds5Sw==} engines: {node: '>=4'} dependencies: cssesc: 3.0.0 @@ -10624,7 +10664,7 @@ packages: postcss: ^8.2.15 dependencies: postcss: 8.4.21 - postcss-selector-parser: 6.0.14 + postcss-selector-parser: 6.0.15 dev: false /postcss-value-parser/4.2.0: @@ -10804,7 +10844,7 @@ packages: peerDependencies: react: ^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 dependencies: - '@babel/runtime': 7.23.6 + '@babel/runtime': 7.23.9 react: 18.2.0 dev: false @@ -10826,8 +10866,8 @@ packages: react: 18.2.0 scheduler: 0.23.0 - /react-focus-lock/2.9.6_sowt5japhjbdixo6tryvx3gigm: - resolution: {integrity: sha512-B7gYnCjHNrNYwY2juS71dHbf0+UpXXojt02svxybj8N5bxceAkzPChKEncHuratjUHkIFNCn06k2qj1DRlzTug==} + /react-focus-lock/2.9.7_7kh72gklg5qjlh5zc6s6v3p6v4: + resolution: {integrity: sha512-EfhX040SELLqnQ9JftqsmQCG49iByg8F5X5m19Er+n371OaETZ35dlNPZrLOOTlnnwD4c2Zv0KDgabDTc7dPHw==} peerDependencies: '@types/react': ^16.8.0 || ^17.0.0 || ^18.0.0 react: ^16.8.0 || ^17.0.0 || ^18.0.0 @@ -10835,14 +10875,14 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.23.6 - '@types/react': 18.2.46 + '@babel/runtime': 7.23.9 + '@types/react': 18.2.48 focus-lock: 1.0.0 prop-types: 15.8.1 react: 18.2.0 react-clientside-effect: 1.2.6_react@18.2.0 - use-callback-ref: 1.3.1_sowt5japhjbdixo6tryvx3gigm - use-sidecar: 1.1.2_sowt5japhjbdixo6tryvx3gigm + use-callback-ref: 1.3.1_7kh72gklg5qjlh5zc6s6v3p6v4 + use-sidecar: 1.1.2_7kh72gklg5qjlh5zc6s6v3p6v4 dev: false /react-is/16.13.1: @@ -10890,7 +10930,7 @@ packages: react: '>=16.6.0' react-dom: '>=16.6.0' dependencies: - '@babel/runtime': 7.23.6 + '@babel/runtime': 7.23.9 dom-helpers: 5.2.1 loose-envify: 1.4.0 prop-types: 15.8.1 @@ -11035,7 +11075,7 @@ packages: /regenerator-transform/0.15.2: resolution: {integrity: sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg==} dependencies: - '@babel/runtime': 7.23.6 + '@babel/runtime': 7.23.9 /regex-not/1.0.2: resolution: {integrity: sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==} @@ -11274,8 +11314,8 @@ packages: resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} - /rfdc/1.3.0: - resolution: {integrity: sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==} + /rfdc/1.3.1: + resolution: {integrity: sha512-r5a3l5HzYlIC68TpmYKlxWjmOP6wiPJ1vWv2HeLhNsRZMrCkxeqxiHlQ21oXmQ4F3SiryXBHhAD7JZqvOJjFmg==} dev: true /rimraf/2.7.1: @@ -11388,8 +11428,8 @@ packages: tslib: 2.3.1 dev: true - /safe-array-concat/1.0.1: - resolution: {integrity: sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==} + /safe-array-concat/1.1.0: + resolution: {integrity: sha512-ZdQ0Jeb9Ofti4hbt5lX3T2JcAamT9hfzYU1MNB+z/jaEbB6wfFfPIR/zEORmZqobkCCJhSjodobH6WHNmJ97dg==} engines: {node: '>=0.4'} dependencies: call-bind: 1.0.5 @@ -11407,8 +11447,9 @@ packages: resolution: {integrity: sha512-6pNbSMW6OhAi9j+N8V+U715yBQsaWJ7eyEUaOrawX+isg5ZxhUlV1NipNtgaKHmFGiABwt+ZF04Ii+3Xjkg+8w==} dev: false - /safe-regex-test/1.0.0: - resolution: {integrity: sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==} + /safe-regex-test/1.0.2: + resolution: {integrity: sha512-83S9w6eFq12BBIJYvjMux6/dkirb8+4zJRA9cxNBVb7Wq5fJBW+Xze48WqR8pxua7bDuAaaAxtVVd4Idjp1dBQ==} + engines: {node: '>= 0.4'} dependencies: call-bind: 1.0.5 get-intrinsic: 1.2.2 @@ -11515,8 +11556,8 @@ packages: randombytes: 2.1.0 dev: true - /serialize-javascript/6.0.1: - resolution: {integrity: sha512-owoXEFjWRllis8/M1Q+Cw5k8ZH40e3zhp/ovX+Xr/vi1qj6QesbyXXViFbpNvWvPNAD62SutwEXavefrLJWj7w==} + /serialize-javascript/6.0.2: + resolution: {integrity: sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==} dependencies: randombytes: 2.1.0 dev: false @@ -11524,11 +11565,12 @@ packages: /set-blocking/2.0.0: resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==} - /set-function-length/1.1.1: - resolution: {integrity: sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==} + /set-function-length/1.2.0: + resolution: {integrity: sha512-4DBHDoyHlM1IRPGYcoxexgh67y4ueR53FKV1yyxwFMY7aCqcN/38M1+SwZ/qJQ8iLv7+ck385ot4CcisOAPT9w==} engines: {node: '>= 0.4'} dependencies: define-data-property: 1.1.1 + function-bind: 1.1.2 get-intrinsic: 1.2.2 gopd: 1.0.1 has-property-descriptors: 1.0.1 @@ -11768,13 +11810,13 @@ packages: spdx-expression-parse: 3.0.1 spdx-license-ids: 3.0.16 - /spdx-exceptions/2.3.0: - resolution: {integrity: sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==} + /spdx-exceptions/2.4.0: + resolution: {integrity: sha512-hcjppoJ68fhxA/cjbN4T8N6uCUejN8yFw69ttpqtBeCbF3u13n7mb31NB9jKwGTTWWnt9IbRA/mf1FprYS8wfw==} /spdx-expression-parse/3.0.1: resolution: {integrity: sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==} dependencies: - spdx-exceptions: 2.3.0 + spdx-exceptions: 2.4.0 spdx-license-ids: 3.0.16 /spdx-license-ids/3.0.16: @@ -11857,8 +11899,8 @@ packages: /stream-exhaust/1.0.2: resolution: {integrity: sha512-b/qaq/GlBK5xaq1yrK9/zFcyRSTNxmcZwFLGSTG0mXgZl/4Z6GgiyYOXOvY7N3eEvFRAG1bkDRz5EPGSvPYQlw==} - /stream-shift/1.0.1: - resolution: {integrity: sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==} + /stream-shift/1.0.3: + resolution: {integrity: sha512-76ORR0DO1o1hlKwTbi/DM3EXWGf3ZJYO8cXX5RJwnul2DEg2oyoZyjLNoQM8WsvZiFKCRfC1O0J7iCvie3RZmQ==} dev: false /stream-source/0.3.5: @@ -12046,7 +12088,7 @@ packages: dependencies: browserslist: 4.22.2 postcss: 8.4.21 - postcss-selector-parser: 6.0.14 + postcss-selector-parser: 6.0.15 dev: false /sumchecker/3.0.1: @@ -12261,8 +12303,8 @@ packages: next-tick: 1.1.0 dev: false - /tinybench/2.5.1: - resolution: {integrity: sha512-65NKvSuAVDP/n4CqH+a9w2kTlLReS9vhsAP06MWx+/89nMinJyB2icyl58RIcqCmIggpojIGeuJGhjU1aGMBSg==} + /tinybench/2.6.0: + resolution: {integrity: sha512-N8hW3PG/3aOoZAN5V/NSAEDz0ZixDSSt5b/a05iqtpgfLWMSVuCo7w0k2vVvEjdrIoeGqZzweX2WlyioNIHchA==} dev: true /tinypool/0.4.0: @@ -12425,7 +12467,7 @@ packages: typescript: 4.9.5 dev: true - /ts-node/10.9.0_f3xuzkf73irh6k3dig4vinkuoy: + /ts-node/10.9.0_7ft46uf3tz44iffs2xfvqbt3oe: resolution: {integrity: sha512-bunW18GUyaCSYRev4DPf4SQpom3pWH29wKl0sDk5zE7ze19RImEVhCW7K4v3hHKkUyfWotU08ToE2RS+Y49aug==} hasBin: true peerDependencies: @@ -12444,9 +12486,9 @@ packages: '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.4 - '@types/node': 20.10.5 + '@types/node': 20.11.7 acorn: 8.11.3 - acorn-walk: 8.3.1 + acorn-walk: 8.3.2 arg: 4.1.3 create-require: 1.1.1 diff: 4.0.2 @@ -12510,7 +12552,7 @@ packages: typescript: '>=3.2.2' dependencies: resolve: 1.22.8 - ts-node: 10.9.0_f3xuzkf73irh6k3dig4vinkuoy + ts-node: 10.9.0_7ft46uf3tz44iffs2xfvqbt3oe typescript: 4.9.5 dev: true @@ -12798,7 +12840,7 @@ packages: requires-port: 1.0.0 dev: true - /use-callback-ref/1.3.1_sowt5japhjbdixo6tryvx3gigm: + /use-callback-ref/1.3.1_7kh72gklg5qjlh5zc6s6v3p6v4: resolution: {integrity: sha512-Lg4Vx1XZQauB42Hw3kK7JM6yjVjgFmFC5/Ab797s79aARomD2nEErc4mCgM8EZrARLmmbWpi5DGCadmK50DcAQ==} engines: {node: '>=10'} peerDependencies: @@ -12808,12 +12850,12 @@ packages: '@types/react': optional: true dependencies: - '@types/react': 18.2.46 + '@types/react': 18.2.48 react: 18.2.0 tslib: 2.3.1 dev: false - /use-sidecar/1.1.2_sowt5japhjbdixo6tryvx3gigm: + /use-sidecar/1.1.2_7kh72gklg5qjlh5zc6s6v3p6v4: resolution: {integrity: sha512-epTbsLuzZ7lPClpz2TyryBfztm7m+28DlEv2ZCQ3MDr5ssiwyOwGH/e5F9CkfWjJ1t4clvI58yF822/GUkjjhw==} engines: {node: '>=10'} peerDependencies: @@ -12823,7 +12865,7 @@ packages: '@types/react': optional: true dependencies: - '@types/react': 18.2.46 + '@types/react': 18.2.48 detect-node-es: 1.1.0 react: 18.2.0 tslib: 2.3.1 @@ -12845,7 +12887,7 @@ packages: has-proto: 1.0.1 has-symbols: 1.0.3 object.getownpropertydescriptors: 2.1.7 - safe-array-concat: 1.0.1 + safe-array-concat: 1.1.0 dev: true /uuid/3.4.0: @@ -12948,17 +12990,17 @@ packages: replace-ext: 1.0.1 dev: false - /vite-node/0.30.1_kfmxqc2juke6fxag2dftxeinaq: + /vite-node/0.30.1_qnoyf3tyffvml5a4tu7p6b4a3y: resolution: {integrity: sha512-vTikpU/J7e6LU/8iM3dzBo8ZhEiKZEKRznEMm+mJh95XhWaPrJQraT/QsT2NWmuEf+zgAoMe64PKT7hfZ1Njmg==} engines: {node: '>=v14.18.0'} hasBin: true dependencies: cac: 6.7.14 debug: 4.3.4 - mlly: 1.4.2 - pathe: 1.1.1 + mlly: 1.5.0 + pathe: 1.1.2 picocolors: 1.0.0 - vite: 3.2.6_kfmxqc2juke6fxag2dftxeinaq + vite: 3.2.6_qnoyf3tyffvml5a4tu7p6b4a3y transitivePeerDependencies: - '@types/node' - less @@ -12969,15 +13011,16 @@ packages: - terser dev: true - /vite-plugin-markdown/2.1.0_vite@3.2.6: - resolution: {integrity: sha512-eWLlrWzYZXEX3/HaXZo/KLjRpO72IUhbgaoFrbwB07ueXi6QfwqrgdZQfUcXTSofJCkN7GhErMC1K1RTAE0gGQ==} + /vite-plugin-markdown/2.2.0_vite@3.2.6: + resolution: {integrity: sha512-eH2tXMZcx3EHb5okd+/0VIyoR8Gp9pGe24UXitOOcGkzObbJ1vl48aGOAbakoT88FBdzC8MXNkMfBIB9VK0Ndg==} peerDependencies: - vite: ^2.0.0 || ^3.0.0 + vite: '>= 2.0.0' dependencies: + domhandler: 4.3.1 front-matter: 4.0.2 htmlparser2: 6.1.0 markdown-it: 12.3.2 - vite: 3.2.6_ut5he7gwva27cnmyxmfrlluelu + vite: 3.2.6_3zttstnme6gr6ngghipmg6bkxq dev: true /vite/3.2.6: @@ -13013,7 +13056,7 @@ packages: fsevents: 2.3.3 dev: true - /vite/3.2.6_@types+node@20.10.5: + /vite/3.2.6_3zttstnme6gr6ngghipmg6bkxq: resolution: {integrity: sha512-nTXTxYVvaQNLoW5BQ8PNNQ3lPia57gzsQU/Khv+JvzKPku8kNZL6NMUR/qwXhMG6E+g1idqEPanomJ+VZgixEg==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true @@ -13038,16 +13081,17 @@ packages: terser: optional: true dependencies: - '@types/node': 20.10.5 + '@types/node': 20.11.7 esbuild: 0.15.18 postcss: 8.4.21 resolve: 1.22.8 rollup: 2.79.1 + sass: 1.43.5 optionalDependencies: fsevents: 2.3.3 dev: true - /vite/3.2.6_kfmxqc2juke6fxag2dftxeinaq: + /vite/3.2.6_@types+node@20.11.7: resolution: {integrity: sha512-nTXTxYVvaQNLoW5BQ8PNNQ3lPia57gzsQU/Khv+JvzKPku8kNZL6NMUR/qwXhMG6E+g1idqEPanomJ+VZgixEg==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true @@ -13072,18 +13116,16 @@ packages: terser: optional: true dependencies: - '@types/node': 20.10.5 + '@types/node': 20.11.7 esbuild: 0.15.18 - less: 4.1.3 postcss: 8.4.21 resolve: 1.22.8 rollup: 2.79.1 - terser: 5.17.1 optionalDependencies: fsevents: 2.3.3 dev: true - /vite/3.2.6_ut5he7gwva27cnmyxmfrlluelu: + /vite/3.2.6_qnoyf3tyffvml5a4tu7p6b4a3y: resolution: {integrity: sha512-nTXTxYVvaQNLoW5BQ8PNNQ3lPia57gzsQU/Khv+JvzKPku8kNZL6NMUR/qwXhMG6E+g1idqEPanomJ+VZgixEg==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true @@ -13108,12 +13150,13 @@ packages: terser: optional: true dependencies: - '@types/node': 20.10.5 + '@types/node': 20.11.7 esbuild: 0.15.18 + less: 4.1.3 postcss: 8.4.21 resolve: 1.22.8 rollup: 2.79.1 - sass: 1.43.5 + terser: 5.17.1 optionalDependencies: fsevents: 2.3.3 dev: true @@ -13151,29 +13194,29 @@ packages: dependencies: '@types/chai': 4.3.11 '@types/chai-subset': 1.3.5 - '@types/node': 20.10.5 + '@types/node': 20.11.7 '@vitest/expect': 0.30.1 '@vitest/runner': 0.30.1 '@vitest/snapshot': 0.30.1 '@vitest/spy': 0.30.1 '@vitest/utils': 0.30.1 acorn: 8.11.3 - acorn-walk: 8.3.1 + acorn-walk: 8.3.2 cac: 6.7.14 - chai: 4.3.10 + chai: 4.4.1 concordance: 5.0.4 debug: 4.3.4 local-pkg: 0.4.3 magic-string: 0.30.5 - pathe: 1.1.1 + pathe: 1.1.2 picocolors: 1.0.0 source-map: 0.6.1 std-env: 3.7.0 strip-literal: 1.3.0 - tinybench: 2.5.1 + tinybench: 2.6.0 tinypool: 0.4.0 - vite: 3.2.6_kfmxqc2juke6fxag2dftxeinaq - vite-node: 0.30.1_kfmxqc2juke6fxag2dftxeinaq + vite: 3.2.6_qnoyf3tyffvml5a4tu7p6b4a3y + vite-node: 0.30.1_qnoyf3tyffvml5a4tu7p6b4a3y why-is-node-running: 2.2.2 transitivePeerDependencies: - less diff --git a/docs/package.json b/docs/package.json index e137e19ab..af30a660a 100644 --- a/docs/package.json +++ b/docs/package.json @@ -13,7 +13,7 @@ "@visactor/vtable": "workspace:*", "@visactor/vtable-editors": "workspace:*", "@visactor/vtable-export": "workspace:*", - "@visactor/vchart": "1.8.7", + "@visactor/vchart": "1.9.0", "markdown-it": "^13.0.0", "highlight.js": "^11.8.0", "axios": "^1.4.0", diff --git a/packages/react-vtable/package.json b/packages/react-vtable/package.json index 47364caa2..9c8ab58c4 100644 --- a/packages/react-vtable/package.json +++ b/packages/react-vtable/package.json @@ -52,7 +52,7 @@ "react-is": "^18.2.0" }, "devDependencies": { - "@visactor/vchart": "1.8.7", + "@visactor/vchart": "1.9.0", "@internal/bundler": "workspace:*", "@internal/eslint-config": "workspace:*", "@internal/ts-config": "workspace:*", @@ -96,4 +96,4 @@ "axios": "^1.4.0", "@types/react-is": "^17.0.3" } -} +} \ No newline at end of file diff --git a/packages/vtable-export/package.json b/packages/vtable-export/package.json index 9d70d7d98..4b957dfdf 100644 --- a/packages/vtable-export/package.json +++ b/packages/vtable-export/package.json @@ -40,7 +40,7 @@ "exceljs": "4.4.0" }, "devDependencies": { - "@visactor/vchart": "1.8.7", + "@visactor/vchart": "1.9.0", "@internal/bundler": "workspace:*", "@internal/eslint-config": "workspace:*", "@internal/ts-config": "workspace:*", @@ -85,4 +85,4 @@ "@types/react-is": "^17.0.3", "rollup-plugin-node-resolve": "5.2.0" } -} +} \ No newline at end of file diff --git a/packages/vtable/examples/list/list.ts b/packages/vtable/examples/list/list.ts index 6bb38aec5..65b063a78 100644 --- a/packages/vtable/examples/list/list.ts +++ b/packages/vtable/examples/list/list.ts @@ -332,9 +332,9 @@ export function createTable() { tableInstance.on('change_cell_value', arg => { console.log(arg); }); - setTimeout(() => { - tableInstance.addRecord({ id: 333 }, 6); - }, 3000); + // setTimeout(() => { + // tableInstance.addRecord({ id: 333 }, 6); + // }, 3000); // tableInstance.on('sort_click', args => { // tableInstance.updateSortState( // { diff --git a/packages/vtable/package.json b/packages/vtable/package.json index 4661d94a9..897e6c6ca 100644 --- a/packages/vtable/package.json +++ b/packages/vtable/package.json @@ -61,7 +61,7 @@ }, "devDependencies": { "luxon": "*", - "@visactor/vchart": "1.8.7", + "@visactor/vchart": "1.9.0", "@internal/bundler": "workspace:*", "@internal/eslint-config": "workspace:*", "@internal/ts-config": "workspace:*", @@ -124,4 +124,4 @@ "url": "https://github.com/VisActor/VTable.git", "directory": "packages/vtable" } -} +} \ No newline at end of file From 3df3996fbca087a1d016c19c52bd8b79b6df7380 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Fri, 26 Jan 2024 16:23:05 +0800 Subject: [PATCH 033/115] fix: when click bottomFrozenRow table scroll sometimes #1011 --- docs/assets/api/en/methods.md | 24 +++++++++ docs/assets/api/zh/methods.md | 24 +++++++++ docs/assets/demo/en/cell-type/chart.md | 2 +- .../demo/en/cell-type/list-table-chart.md | 2 +- .../assets/demo/en/edit/add-delete-records.md | 2 +- docs/assets/demo/zh/cell-type/chart.md | 2 +- .../demo/zh/cell-type/list-table-chart.md | 2 +- .../assets/demo/zh/edit/add-delete-records.md | 2 +- packages/vtable/src/core/BaseTable.ts | 52 ++++++++++++++++--- 9 files changed, 99 insertions(+), 13 deletions(-) diff --git a/docs/assets/api/en/methods.md b/docs/assets/api/en/methods.md index 2c678f918..a77f04639 100644 --- a/docs/assets/api/en/methods.md +++ b/docs/assets/api/en/methods.md @@ -404,6 +404,30 @@ Get the text of the cell with omitted text. getCellOverflowText(col: number, row: number) => string | null ``` +## getCellRect(Function) +Get the specific position of the cell in the entire table. +``` + /** + * Get the range of cells. The return value is Rect type. Regardless of whether it is a merged cell, the coordinates start from 0 + * @param {number} col column index + * @param {number} row row index + * @returns {Rect} + */ + getCellRect(col: number, row: number): Rect +``` + +## getCellRelativeRect(Function) +Get the specific position of the cell in the entire table. Relative position is based on the upper left corner of the table (scroll condition minus scroll value) +``` + /** + * The obtained position is relative to the upper left corner of the table display interface. In case of scrolling, if the cell has rolled out of the top of the table, the y of this cell will be a negative value. + * @param {number} col index of column, of the cell + * @param {number} row index of row, of the cell + * @returns {Rect} the rect of the cell. + */ + getCellRelativeRect(col: number, row: number): Rect +``` + ## getCellHeaderPaths(Function) Get the path to the row list header diff --git a/docs/assets/api/zh/methods.md b/docs/assets/api/zh/methods.md index 2f05de9fd..7e0ad899c 100644 --- a/docs/assets/api/zh/methods.md +++ b/docs/assets/api/zh/methods.md @@ -399,6 +399,30 @@ setRecords(records: Array, sort?: SortState | SortState[]) //** 基本表 getCellOverflowText(col: number, row: number) => string | null ``` +## getCellRect(Function) +获取单元格在整张表格中的具体位置。 +``` + /** + * 获取单元格的范围 返回值为Rect类型。不考虑是否为合并单元格的情况,坐标从0开始 + * @param {number} col column index + * @param {number} row row index + * @returns {Rect} + */ + getCellRect(col: number, row: number): Rect +``` + +## getCellRelativeRect(Function) +获取单元格在整张表格中的具体位置。相对位置是基于表格左上角(滚动情况减去滚动值) +``` + /** + * 获取的位置是相对表格显示界面的左上角 情况滚动情况 如单元格已经滚出表格上方 则这个单元格的y将为负值 + * @param {number} col index of column, of the cell + * @param {number} row index of row, of the cell + * @returns {Rect} the rect of the cell. + */ + getCellRelativeRect(col: number, row: number): Rect +``` + ## getCellHeaderPaths(Function) 获取行列表头的路径 diff --git a/docs/assets/demo/en/cell-type/chart.md b/docs/assets/demo/en/cell-type/chart.md index fbca22627..3039d4cb2 100644 --- a/docs/assets/demo/en/cell-type/chart.md +++ b/docs/assets/demo/en/cell-type/chart.md @@ -1,6 +1,6 @@ --- category: examples -group: Cell Type In PivotTable +group: Cell Type title: Chart Type Use in PivotTable cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/chart.png link: '../guide/cell_type/chart' diff --git a/docs/assets/demo/en/cell-type/list-table-chart.md b/docs/assets/demo/en/cell-type/list-table-chart.md index 1eeff33e0..15d8a5b3b 100644 --- a/docs/assets/demo/en/cell-type/list-table-chart.md +++ b/docs/assets/demo/en/cell-type/list-table-chart.md @@ -1,6 +1,6 @@ --- category: examples -group: Cell Type In ListTable +group: Cell Type title: List table integrated chart cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/list-chart.png link: '../guide/cell_type/chart' diff --git a/docs/assets/demo/en/edit/add-delete-records.md b/docs/assets/demo/en/edit/add-delete-records.md index 9a0d88458..fad2fd13a 100644 --- a/docs/assets/demo/en/edit/add-delete-records.md +++ b/docs/assets/demo/en/edit/add-delete-records.md @@ -2,7 +2,7 @@ category: examples group: edit title: add or delete records -cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/performance.gif +cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/add-delete-records.png --- # Add and delete data dynamically diff --git a/docs/assets/demo/zh/cell-type/chart.md b/docs/assets/demo/zh/cell-type/chart.md index 86cd1b477..ebcbde25b 100644 --- a/docs/assets/demo/zh/cell-type/chart.md +++ b/docs/assets/demo/zh/cell-type/chart.md @@ -1,6 +1,6 @@ --- category: examples -group: Cell Type In PivotTable +group: Cell Type title: 透视表集成图表 cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/chart.png link: '../guide/cell_type/chart' diff --git a/docs/assets/demo/zh/cell-type/list-table-chart.md b/docs/assets/demo/zh/cell-type/list-table-chart.md index c6fdaa8fa..d8da3789f 100644 --- a/docs/assets/demo/zh/cell-type/list-table-chart.md +++ b/docs/assets/demo/zh/cell-type/list-table-chart.md @@ -1,6 +1,6 @@ --- category: examples -group: Cell Type In ListTable +group: Cell Type title: 基本表格集成图表 cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/list-chart.png link: '../guide/cell_type/chart' diff --git a/docs/assets/demo/zh/edit/add-delete-records.md b/docs/assets/demo/zh/edit/add-delete-records.md index 4ee315a86..71dce19da 100644 --- a/docs/assets/demo/zh/edit/add-delete-records.md +++ b/docs/assets/demo/zh/edit/add-delete-records.md @@ -2,7 +2,7 @@ category: examples group: edit title: 动态添加删除数据 -cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/performance.gif +cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/add-delete-records.png --- # 动态添加删除数据 diff --git a/packages/vtable/src/core/BaseTable.ts b/packages/vtable/src/core/BaseTable.ts index 2ee787211..29d219cff 100644 --- a/packages/vtable/src/core/BaseTable.ts +++ b/packages/vtable/src/core/BaseTable.ts @@ -1273,7 +1273,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { const height = this.getRowHeight(row); if (isFrozenCell && isFrozenCell.row) { if (this.isBottomFrozenRow(col, row)) { - absoluteLeft = this.tableNoFrameHeight - (this.getRowsHeight(row, this.rowCount - 1) ?? 0); + absoluteTop = this.tableNoFrameHeight - (this.getRowsHeight(row, this.rowCount - 1) ?? 0); } else { absoluteTop = this.getRowsHeight(0, row - 1); absoluteTop += this.scrollTop; @@ -1304,7 +1304,19 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { * @returns {Rect} the rect of the cell. */ getCellRelativeRect(col: number, row: number): Rect { - return this._toRelativeRect(this.getCellRect(col, row)); + const isFrozenCell = this.isFrozenCell(col, row); + let relativeX = true; + let relativeY = true; + if (isFrozenCell?.col && isFrozenCell?.row) { + relativeX = false; + relativeY = false; + } else if (isFrozenCell?.col) { + relativeX = false; + } else if (isFrozenCell?.row) { + relativeY = false; + } + const cellRect = this.getCellRect(col, row); + return this._toRelativeRect(cellRect, relativeX, relativeY); } /** * 获取的位置是相对表格显示界面的左上角 @@ -1313,18 +1325,44 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { */ getCellRangeRelativeRect(range: CellRange | CellAddress): Rect { if ((range).start) { + const isFrozenCell = this.isFrozenCell((range).start.col, (range).start.row); + let relativeX = true; + let relativeY = true; + if (isFrozenCell?.col && isFrozenCell?.row) { + relativeX = false; + relativeY = false; + } else if (isFrozenCell?.col) { + relativeX = false; + } else if (isFrozenCell?.row) { + relativeY = false; + } return this._toRelativeRect( this.getCellsRect( (range).start.col, (range).start.row, (range).end.col, (range).end.row - ) + ), + relativeX, + relativeY ); } const cellRange = this.getCellRange((range).col, (range).row); + const isFrozenCell = this.isFrozenCell((range).col, (range).row); + let relativeX = true; + let relativeY = true; + if (isFrozenCell?.col && isFrozenCell?.row) { + relativeX = false; + relativeY = false; + } else if (isFrozenCell?.col) { + relativeX = false; + } else if (isFrozenCell?.row) { + relativeY = false; + } return this._toRelativeRect( - this.getCellsRect(cellRange.start.col, cellRange.start.row, cellRange.end.col, cellRange.end.row) + this.getCellsRect(cellRange.start.col, cellRange.start.row, cellRange.end.col, cellRange.end.row), + relativeX, + relativeY ); } /** @@ -1612,11 +1650,11 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { * @param absoluteRect * @returns */ - _toRelativeRect(absoluteRect: Rect): Rect { + _toRelativeRect(absoluteRect: Rect, relativeX: boolean = true, relativeY: boolean = true): Rect { const rect = absoluteRect.copy(); const visibleRect = this.getVisibleRect(); - rect.offsetLeft(this.tableX - visibleRect.left); - rect.offsetTop(this.tableY - visibleRect.top); + rect.offsetLeft(this.tableX - (relativeX ? visibleRect.left : 0)); + rect.offsetTop(this.tableY - (relativeY ? visibleRect.top : 0)); return rect; } From 1b5062b88da5ed2ae9b41d2bc60ed8213d993fd0 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Fri, 26 Jan 2024 16:23:38 +0800 Subject: [PATCH 034/115] docs: update changlog of rush --- ...bottomFrozenRow-click-scroll_2024-01-26-08-23.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vtable/1011-bug-bottomFrozenRow-click-scroll_2024-01-26-08-23.json diff --git a/common/changes/@visactor/vtable/1011-bug-bottomFrozenRow-click-scroll_2024-01-26-08-23.json b/common/changes/@visactor/vtable/1011-bug-bottomFrozenRow-click-scroll_2024-01-26-08-23.json new file mode 100644 index 000000000..ce5504447 --- /dev/null +++ b/common/changes/@visactor/vtable/1011-bug-bottomFrozenRow-click-scroll_2024-01-26-08-23.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: when click bottomFrozenRow table scroll sometimes #1011\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file From 3188e246a43195a208d36adccc5c130548d12a83 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 26 Jan 2024 09:20:13 +0000 Subject: [PATCH 035/115] build: prelease version 0.18.4 --- ...ottomFrozenRow-click-scroll_2024-01-26-08-23.json | 11 ----------- common/config/rush/version-policies.json | 2 +- packages/react-vtable/package.json | 4 ++-- packages/vtable-editors/package.json | 2 +- packages/vtable-export/package.json | 4 ++-- packages/vtable/CHANGELOG.json | 12 ++++++++++++ packages/vtable/CHANGELOG.md | 11 ++++++++++- packages/vtable/package.json | 4 ++-- 8 files changed, 30 insertions(+), 20 deletions(-) delete mode 100644 common/changes/@visactor/vtable/1011-bug-bottomFrozenRow-click-scroll_2024-01-26-08-23.json diff --git a/common/changes/@visactor/vtable/1011-bug-bottomFrozenRow-click-scroll_2024-01-26-08-23.json b/common/changes/@visactor/vtable/1011-bug-bottomFrozenRow-click-scroll_2024-01-26-08-23.json deleted file mode 100644 index ce5504447..000000000 --- a/common/changes/@visactor/vtable/1011-bug-bottomFrozenRow-click-scroll_2024-01-26-08-23.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "fix: when click bottomFrozenRow table scroll sometimes #1011\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/version-policies.json b/common/config/rush/version-policies.json index 4112c74ff..102065e98 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -1 +1 @@ -[{"definitionName":"lockStepVersion","policyName":"vtableMain","version":"0.18.3","mainProject":"@visactor/vtable","nextBump":"patch"}] +[{"definitionName":"lockStepVersion","policyName":"vtableMain","version":"0.18.4","mainProject":"@visactor/vtable","nextBump":"patch"}] diff --git a/packages/react-vtable/package.json b/packages/react-vtable/package.json index 9c8ab58c4..b2c27ad93 100644 --- a/packages/react-vtable/package.json +++ b/packages/react-vtable/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/react-vtable", - "version": "0.18.3", + "version": "0.18.4", "description": "The react version of VTable", "keywords": [ "react", @@ -96,4 +96,4 @@ "axios": "^1.4.0", "@types/react-is": "^17.0.3" } -} \ No newline at end of file +} diff --git a/packages/vtable-editors/package.json b/packages/vtable-editors/package.json index c02a26f1d..9438ed8c2 100644 --- a/packages/vtable-editors/package.json +++ b/packages/vtable-editors/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vtable-editors", - "version": "0.18.3", + "version": "0.18.4", "description": "", "sideEffects": false, "main": "cjs/index.js", diff --git a/packages/vtable-export/package.json b/packages/vtable-export/package.json index 4b957dfdf..d7b58f41d 100644 --- a/packages/vtable-export/package.json +++ b/packages/vtable-export/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vtable-export", - "version": "0.18.3", + "version": "0.18.4", "description": "The export util of VTable", "author": { "name": "VisActor", @@ -85,4 +85,4 @@ "@types/react-is": "^17.0.3", "rollup-plugin-node-resolve": "5.2.0" } -} \ No newline at end of file +} diff --git a/packages/vtable/CHANGELOG.json b/packages/vtable/CHANGELOG.json index 5775a6b25..173852352 100644 --- a/packages/vtable/CHANGELOG.json +++ b/packages/vtable/CHANGELOG.json @@ -1,6 +1,18 @@ { "name": "@visactor/vtable", "entries": [ + { + "version": "0.18.4", + "tag": "@visactor/vtable_v0.18.4", + "date": "Fri, 26 Jan 2024 09:15:07 GMT", + "comments": { + "none": [ + { + "comment": "fix: when click bottomFrozenRow table scroll sometimes #1011\n\n" + } + ] + } + }, { "version": "0.18.3", "tag": "@visactor/vtable_v0.18.3", diff --git a/packages/vtable/CHANGELOG.md b/packages/vtable/CHANGELOG.md index f5ed45110..6053b777e 100644 --- a/packages/vtable/CHANGELOG.md +++ b/packages/vtable/CHANGELOG.md @@ -1,6 +1,15 @@ # Change Log - @visactor/vtable -This log was last generated on Thu, 25 Jan 2024 10:27:02 GMT and should not be manually modified. +This log was last generated on Fri, 26 Jan 2024 09:15:07 GMT and should not be manually modified. + +## 0.18.4 +Fri, 26 Jan 2024 09:15:07 GMT + +### Updates + +- fix: when click bottomFrozenRow table scroll sometimes #1011 + + ## 0.18.3 Thu, 25 Jan 2024 10:27:02 GMT diff --git a/packages/vtable/package.json b/packages/vtable/package.json index 897e6c6ca..e5cbb945e 100644 --- a/packages/vtable/package.json +++ b/packages/vtable/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vtable", - "version": "0.18.3", + "version": "0.18.4", "description": "canvas table width high performance", "keywords": [ "grid", @@ -124,4 +124,4 @@ "url": "https://github.com/VisActor/VTable.git", "directory": "packages/vtable" } -} \ No newline at end of file +} From fb71f7d1b67f189e2803ceb3691fefed66e418f5 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Fri, 26 Jan 2024 18:38:13 +0800 Subject: [PATCH 036/115] fix: rightFrozenColCount drag header move more time the column width is error #1019 --- packages/vtable/src/scenegraph/scenegraph.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vtable/src/scenegraph/scenegraph.ts b/packages/vtable/src/scenegraph/scenegraph.ts index bbd7a96ca..08ab0fc90 100644 --- a/packages/vtable/src/scenegraph/scenegraph.ts +++ b/packages/vtable/src/scenegraph/scenegraph.ts @@ -1407,7 +1407,7 @@ export class Scenegraph { // this.rightFrozenGroup.setDeltaWidth(colHeaderX - this.table.getRightFrozenColsWidth()); this.rowHeaderGroup.setDeltaWidth(rowHeaderX - this.rowHeaderGroup.attribute.width); this.bottomFrozenGroup.setDeltaWidth(colHeaderX - this.bottomFrozenGroup.attribute.width); - this.rightFrozenGroup.setDeltaWidth(rightX - this.table.getRightFrozenColsWidth()); + this.rightFrozenGroup.setDeltaWidth(rightX - this.rightFrozenGroup.attribute.width); this.rightTopCornerGroup.setDeltaWidth(rightX - this.rightTopCornerGroup.attribute.width); this.rightBottomCornerGroup.setDeltaWidth(rightX - this.rightBottomCornerGroup.attribute.width); this.bodyGroup.setDeltaWidth(bodyX - this.bodyGroup.attribute.width); From 11bd45d8235f81728d72e73a622fa2da7996c928 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Fri, 26 Jan 2024 18:38:42 +0800 Subject: [PATCH 037/115] docs: update changlog of rush --- ...-dragheader-olumnwidth-error_2024-01-26-10-38.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vtable/1019-bug-rightfrozencolcount-dragheader-olumnwidth-error_2024-01-26-10-38.json diff --git a/common/changes/@visactor/vtable/1019-bug-rightfrozencolcount-dragheader-olumnwidth-error_2024-01-26-10-38.json b/common/changes/@visactor/vtable/1019-bug-rightfrozencolcount-dragheader-olumnwidth-error_2024-01-26-10-38.json new file mode 100644 index 000000000..56f04bd49 --- /dev/null +++ b/common/changes/@visactor/vtable/1019-bug-rightfrozencolcount-dragheader-olumnwidth-error_2024-01-26-10-38.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: rightFrozenColCount drag header move more time the column width is error #1019\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file From c8a86ed398b322f30b2f131aa91805bbaede817c Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Fri, 26 Jan 2024 19:21:19 +0800 Subject: [PATCH 038/115] feat: support get sorted columns #986 --- packages/vtable/src/ListTable.ts | 3 +- .../vtable/src/layout/pivot-layout-helper.ts | 64 +++++++++++++------ .../vtable/src/layout/simple-header-layout.ts | 11 +++- 3 files changed, 55 insertions(+), 23 deletions(-) diff --git a/packages/vtable/src/ListTable.ts b/packages/vtable/src/ListTable.ts index 689f506fe..f6a1d0267 100644 --- a/packages/vtable/src/ListTable.ts +++ b/packages/vtable/src/ListTable.ts @@ -149,7 +149,8 @@ export class ListTable extends BaseTable implements ListTableAPI { this.eventManager.updateEventBinder(); } get columns(): ColumnsDefine { - return this.internalProps.columns; + // return this.internalProps.columns; + return this.internalProps.layoutMap.columnTree.getCopiedTree(); //调整顺序后的columns } /** *@deprecated 请使用columns diff --git a/packages/vtable/src/layout/pivot-layout-helper.ts b/packages/vtable/src/layout/pivot-layout-helper.ts index 040860533..1c686926d 100644 --- a/packages/vtable/src/layout/pivot-layout-helper.ts +++ b/packages/vtable/src/layout/pivot-layout-helper.ts @@ -1,4 +1,4 @@ -import { isValid } from '@visactor/vutils'; +import { cloneDeep, isValid } from '@visactor/vutils'; import { NumberMap } from '../tools/NumberMap'; import { IndicatorDimensionKeyPlaceholder } from '../tools/global'; import type { Either } from '../tools/helper'; @@ -26,6 +26,7 @@ interface IPivotLayoutBaseHeadNode { // indicatorKey?: string; value: string; children: IPivotLayoutHeadNode[] | undefined; + columns?: any; //兼容ListTable情况 simple-header-layout中增加了columnTree level: number; /** 节点跨占层数 如汇总节点跨几层维度 */ levelSpan: number; @@ -123,10 +124,11 @@ export class DimensionTree { } } let size = node.dimensionKey ? (this.sizeIncludeParent ? 1 : 0) : 0; + const children = node.children || node.columns; //平铺展示 分析所有层级 if (this.hierarchyType === 'grid') { - if (node.children?.length >= 1) { - node.children.forEach(n => { + if (children?.length >= 1) { + children.forEach((n: any) => { n.level = (node.level ?? 0) + 1; size += this.setTreeNode(n, size, node); }); @@ -134,29 +136,29 @@ export class DimensionTree { size = 1; // re.totalLevel = Math.max(re.totalLevel, (node.level ?? -1) + 1); } - } else if (node.hierarchyState === HierarchyState.expand && node.children?.length >= 1) { + } else if (node.hierarchyState === HierarchyState.expand && children?.length >= 1) { //树形展示 有子节点 且下一层需要展开 - node.children.forEach(n => { + children.forEach((n: any) => { n.level = (node.level ?? 0) + 1; size += this.setTreeNode(n, size, node); }); - } else if (node.hierarchyState === HierarchyState.collapse && node.children?.length >= 1) { + } else if (node.hierarchyState === HierarchyState.collapse && children?.length >= 1) { //树形展示 有子节点 且下一层不需要展开 - node.children.forEach(n => { + children.forEach((n: any) => { n.level = (node.level ?? 0) + 1; this.setTreeNode(n, size, node); }); - } else if (!node.hierarchyState && node.level + 1 < this.rowExpandLevel && node.children?.length >= 1) { + } else if (!node.hierarchyState && node.level + 1 < this.rowExpandLevel && children?.length >= 1) { //树形展示 有子节点 且下一层需要展开 node.hierarchyState = HierarchyState.expand; - node.children.forEach(n => { + children.forEach((n: any) => { n.level = (node.level ?? 0) + 1; size += this.setTreeNode(n, size, node); }); - } else if (node.children?.length >= 1) { + } else if (children?.length >= 1) { //树形展示 有子节点 且下一层不需要展开 node.hierarchyState = HierarchyState.collapse; - node.children.forEach(n => { + children.forEach((n: any) => { n.level = (node.level ?? 0) + 1; this.setTreeNode(n, size, node); }); @@ -292,17 +294,15 @@ export class DimensionTree { targetSubIndex = subIndex; } } - - if (node.children && node.level < level) { + const children = node.children || node.columns; + if (children && node.level < level) { parNode = node; - for (let i = 0; i < node.children.length; i++) { + for (let i = 0; i < children.length; i++) { if ( - (sourceIndex >= node.children[i].startInTotal && - sourceIndex <= node.children[i].startInTotal + node.children[i].size) || - (targetIndex >= node.children[i].startInTotal && - targetIndex <= node.children[i].startInTotal + node.children[i].size) + (sourceIndex >= children[i].startInTotal && sourceIndex <= children[i].startInTotal + children[i].size) || + (targetIndex >= children[i].startInTotal && targetIndex <= children[i].startInTotal + children[i].size) ) { - findTargetNode(node.children[i], i); + findTargetNode(children[i], i); } } } @@ -310,9 +310,31 @@ export class DimensionTree { findTargetNode(this.tree, 0); //对parNode子节点位置进行移位【根据sourceSubIndex和targetSubIndex】 - const sourceColumns = parNode.children.splice(sourceSubIndex, 1); + const children = parNode.children || parNode.columns; + const sourceColumns = children.splice(sourceSubIndex, 1); sourceColumns.unshift(targetSubIndex as any, 0 as any); - Array.prototype.splice.apply(parNode.children, sourceColumns); + Array.prototype.splice.apply(children, sourceColumns); + } + /** 获取纯净树结构 没有level size index这些属性 */ + getCopiedTree() { + const children = cloneDeep(this.tree.children); + clearNode(children); + function clearNode(children: any) { + for (let i = 0; i < children.length; i++) { + const node = children[i]; + delete node.level; + delete node.startIndex; + delete node.id; + delete node.levelSpan; + delete node.size; + delete node.startInTotal; + const childrenNew = node.children || node.columns; + if (childrenNew) { + clearNode(childrenNew); + } + } + } + return children; } } diff --git a/packages/vtable/src/layout/simple-header-layout.ts b/packages/vtable/src/layout/simple-header-layout.ts index a302b3bea..047314bb1 100644 --- a/packages/vtable/src/layout/simple-header-layout.ts +++ b/packages/vtable/src/layout/simple-header-layout.ts @@ -12,6 +12,7 @@ import type { WidthData } from '../ts-types/list-table/layout-map/api'; import { checkHasChart, getChartDataId } from './chart-helper/get-chart-spec'; +import { DimensionTree } from './pivot-layout-helper'; // import { EmptyDataCache } from './utils'; // let seqId = 0; @@ -22,6 +23,8 @@ export class SimpleHeaderLayoutMap implements LayoutMapAPI { // private _headerObjectFieldKey: { [key in string]: HeaderData }; private _headerCellIds: number[][]; private _columns: ColumnData[]; + /** 后期加的 对应pivot-header-layout 中的columnDimensionTree 为了排序后获取到排序后的columns */ + columnTree: DimensionTree; readonly bodyRowSpanCount: number = 1; //透视表中树形结构使用 这里为了table逻辑不报错 // rowHierarchyIndent?: number = 0; @@ -40,6 +43,7 @@ export class SimpleHeaderLayoutMap implements LayoutMapAPI { this._columns = []; this._headerCellIds = []; this.hierarchyIndent = hierarchyIndent ?? 20; + this.columnTree = new DimensionTree(columns as any, { seqId: 0 }); //seqId这里没有利用上 所有顺便传了0 this._headerObjects = this._addHeaders(0, columns, []); this._headerObjectMap = this._headerObjects.reduce((o, e) => { o[e.id as number] = e; @@ -833,7 +837,9 @@ export class SimpleHeaderLayoutMap implements LayoutMapAPI { //将_columns的列定义调整位置 同调整_headerCellIds逻辑 const sourceColumns = this._columns.splice(sourceCellRange.start.col, moveSize); sourceColumns.unshift(targetIndex as any, 0 as any); - Array.prototype.splice.apply(this._columns, sourceColumns); + + // 对表头columnTree调整节点位置 + this.columnTree.movePosition(source.row, sourceCellRange.start.col, targetIndex); this._cellRangeMap = new Map(); return { @@ -871,6 +877,9 @@ export class SimpleHeaderLayoutMap implements LayoutMapAPI { sourceColumns.unshift(targetIndex as any, 0 as any); Array.prototype.splice.apply(this._columns, sourceColumns); + // 对表头columnTree调整节点位置 + this.columnTree.movePosition(source.col, sourceCellRange.start.row, targetIndex); + this._cellRangeMap = new Map(); return { sourceIndex: sourceCellRange.start.row, From e96fa9c51383ad1b0f6a2f4443307a3348c96bfa Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Fri, 26 Jan 2024 19:21:36 +0800 Subject: [PATCH 039/115] docs: update changlog of rush --- ...refactor-dragedOrder-columns_2024-01-26-11-21.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vtable/986-refactor-dragedOrder-columns_2024-01-26-11-21.json diff --git a/common/changes/@visactor/vtable/986-refactor-dragedOrder-columns_2024-01-26-11-21.json b/common/changes/@visactor/vtable/986-refactor-dragedOrder-columns_2024-01-26-11-21.json new file mode 100644 index 000000000..f531082ae --- /dev/null +++ b/common/changes/@visactor/vtable/986-refactor-dragedOrder-columns_2024-01-26-11-21.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "feat: support get sorted columns #986\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file From 2a6736b4040587669b0fdee93d723106d9e3bee1 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Fri, 26 Jan 2024 19:49:03 +0800 Subject: [PATCH 040/115] feat: support get sorted columns #986 --- packages/vtable/src/layout/simple-header-layout.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/vtable/src/layout/simple-header-layout.ts b/packages/vtable/src/layout/simple-header-layout.ts index 047314bb1..03ab08f11 100644 --- a/packages/vtable/src/layout/simple-header-layout.ts +++ b/packages/vtable/src/layout/simple-header-layout.ts @@ -837,6 +837,7 @@ export class SimpleHeaderLayoutMap implements LayoutMapAPI { //将_columns的列定义调整位置 同调整_headerCellIds逻辑 const sourceColumns = this._columns.splice(sourceCellRange.start.col, moveSize); sourceColumns.unshift(targetIndex as any, 0 as any); + Array.prototype.splice.apply(this._columns, sourceColumns); // 对表头columnTree调整节点位置 this.columnTree.movePosition(source.row, sourceCellRange.start.col, targetIndex); From 6b1a1688fb5db61e1a1e0d6b59ae2767c60f1743 Mon Sep 17 00:00:00 2001 From: martes Date: Fri, 26 Jan 2024 10:31:16 +0800 Subject: [PATCH 041/115] feat: update interface IEditor --- packages/vtable-editors/src/types.ts | 101 +++++++++++++++++++++------ 1 file changed, 79 insertions(+), 22 deletions(-) diff --git a/packages/vtable-editors/src/types.ts b/packages/vtable-editors/src/types.ts index 865a4f7c4..db5708e67 100644 --- a/packages/vtable-editors/src/types.ts +++ b/packages/vtable-editors/src/types.ts @@ -1,36 +1,93 @@ -export interface IEditor { - /** 编辑器类型 */ - editorType?: string; - /** 编辑配置 */ - editorConfig: any; - /* 编辑器挂载的容器 由vtable传入 */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export interface IEditor { + /** + * 当单元格进入编辑状态时调用 + */ + onStart?: (context: EditContext) => void; + /** + * 当单元格退出编辑状态时调用 + */ + onEnd?: () => void; + /** + * 当单元格处于编辑状态时鼠标点击其他位置时调用。 + * + * 如果返回值为虚值,则 VTable 将退出编辑状态。 + * + * 如果不提供此函数,VTable 将不会在点击其他位置时自动退出编辑状态。 + * 你需要使用 `onStart` 提供的 `endEdit` 函数来手动退出编辑状态。 + */ + onClickElsewhere?: (target: HTMLElement) => boolean; + /** + * 当单元格退出编辑状态后,VTable 将调用此函数来获取编辑后的值 + */ + getValue: () => V; + /** + * 编辑器进入编辑状态 + * @deprecated 请改用 `onStart` 代替。 + */ + beginEditing?: (container: HTMLElement, referencePosition: ReferencePosition, value: V) => void; + /** + * @see onEnd + * @deprecated 请改用 `onEnd` 代替。 + */ + exit?: () => void; + /** + * @see onClickElsewhere + * @deprecated 请改用 `onClickElsewhere` 代替。 + */ + targetIsOnEditor?: (target: HTMLElement) => boolean; + /** + * beginEditing 调用时调用,提供一个回调函数,用于结束编辑器编辑状态。 + * @see EditContext#endEdit + * @deprecated 请改用 `onStart` 代替。 + */ + bindSuccessCallback?: (callback: () => void) => void; +} + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export interface EditContext { + /** + * VTable 所在容器 + */ container: HTMLElement; - /** 编辑完成后调用。注意如果是(enter键,鼠标点击其他位置)这类编辑完成已有VTable实现,编辑器内部有完成按钮等类似的完成操作需要调用这个方法 */ - successCallback?: Function; - /** 获取编辑器当前值 */ - getValue: () => string | number | null; - /** 编辑器进入编辑状态 */ - beginEditing: ( - container: HTMLElement, - referencePosition: { rect: RectProps; placement?: Placement }, - value?: string - ) => void; - /** 编辑器退出编辑状态 */ - exit: () => void; - /** 判断鼠标点击的target是否属于编辑器内部元素 */ - targetIsOnEditor: (target: HTMLElement) => boolean; - /** 由VTable调用来传入编辑成功的回调 请将callback赋值到successCallback */ - bindSuccessCallback?: (callback: Function) => void; + /** + * 单元格所在位置 + */ + referencePosition: ReferencePosition; + /** + * 单元格当前值 + */ + value: V; + /** + * 立即结束编辑器编辑状态。 + * + * 大多数情况下你并不需要调用这个函数,因为 + * VTable 已经自动对 Enter 键以及 + * 鼠标点击其他位置(`onClickElsewhere`)进行了处理。 + * + * 但如果你的编辑器内部有自己的完成按钮,或是 + * 像 Tooltip 有外部悬浮元素,不太好或者没有办法 + * 使用 `onClickElsewhere` 进行判断时,你 + * 可以使用这个回调来帮助你处理编辑器的退出逻辑。 + */ + endEdit: () => void; } + export interface RectProps { left: number; top: number; width: number; height: number; } + export enum Placement { top = 'top', bottom = 'bottom', left = 'left', right = 'right' } + +export interface ReferencePosition { + rect: RectProps; + placement?: Placement; +} From 04d22b633676eb8960e230f323c4536c2c84ca8b Mon Sep 17 00:00:00 2001 From: martes Date: Fri, 26 Jan 2024 10:51:31 +0800 Subject: [PATCH 042/115] feat: implement new IEditor behaviours in VTable --- packages/vtable/src/edit/edit-manager.ts | 63 ++++++++++++++++++------ 1 file changed, 47 insertions(+), 16 deletions(-) diff --git a/packages/vtable/src/edit/edit-manager.ts b/packages/vtable/src/edit/edit-manager.ts index a8d070688..391b8adc6 100644 --- a/packages/vtable/src/edit/edit-manager.ts +++ b/packages/vtable/src/edit/edit-manager.ts @@ -8,10 +8,12 @@ export class EditManeger { table: BaseTableAPI; editingEditor: IEditor; editCell: { col: number; row: number }; + constructor(table: BaseTableAPI) { this.table = table; this.bindEvent(); } + bindEvent() { const handler = this.table.internalProps.handler; this.table.on(TABLE_EVENT_TYPE.DBLCLICK_CELL, e => { @@ -48,6 +50,7 @@ export class EditManeger { this.completeEdit(); }); } + startEditCell(col: number, row: number) { //透视表的表头不允许编辑 if (this.table.isPivotTable() && this.table.isHeader(col, row)) { @@ -68,34 +71,62 @@ export class EditManeger { return; } } - editor.bindSuccessCallback?.(() => { - this.completeEdit(); - }); this.editingEditor = editor; this.editCell = { col, row }; const dataValue = this.table.getCellOriginValue(col, row); const rect = this.table.getCellRangeRelativeRect(this.table.getCellRange(col, row)); - editor.beginEditing( - this.table.getElement(), - { rect: { left: rect.left, top: rect.top, width: rect.width, height: rect.height } }, - dataValue - ); + const referencePosition = { rect: { left: rect.left, top: rect.top, width: rect.width, height: rect.height } }; + + // TODO: 添加开发时弃用警告 + editor.beginEditing?.(this.table.getElement(), referencePosition, dataValue); + + // TODO: 添加开发时弃用警告 + editor.bindSuccessCallback?.(() => { + this.completeEdit(); + }); + editor.onStart?.({ + value: dataValue, + endEdit: () => { + this.completeEdit(); + }, + referencePosition, + container: this.table.getElement() + }); } } + /** 如果是事件触发调用该接口 请传入原始事件对象 将判断事件对象是否在编辑器本身上面 来处理是否结束编辑 */ - completeEdit(e?: any) { - const target = e?.target; - if (this.editingEditor && (!target || (target && !this.editingEditor.targetIsOnEditor(target as HTMLElement)))) { - const changedValue = this.editingEditor.getValue(); - (this.table as ListTableAPI).changeCellValue(this.editCell.col, this.editCell.row, changedValue); - this.editingEditor.exit(); - this.editingEditor = null; + completeEdit(e?: Event) { + if (!this.editingEditor) { + return; + } + + const target = e?.target as HTMLElement | undefined; + + if (target && this.editingEditor.targetIsOnEditor?.(target)) { + // TODO: 添加开发时弃用警告 + return; + } + + if (target && this.editingEditor.onClickElsewhere?.(target)) { + return; } + + // TODO: 开发时检查 getValue 是否为方法,如不是则提供警告 + const changedValue = this.editingEditor.getValue?.(); + (this.table as ListTableAPI).changeCellValue(this.editCell.col, this.editCell.row, changedValue); + + // TODO: 添加开发时弃用警告 + this.editingEditor.exit?.(); + this.editingEditor.onEnd?.(); + this.editingEditor = null; } cancelEdit() { if (this.editingEditor) { - this.editingEditor.exit(); + // TODO: 添加开发时弃用警告 + this.editingEditor.exit?.(); + this.editingEditor.onEnd?.(); this.editingEditor = null; } } From 0fd387007b4f28be1318822dca256e1ec1f5a48a Mon Sep 17 00:00:00 2001 From: martes Date: Fri, 26 Jan 2024 11:01:04 +0800 Subject: [PATCH 043/115] refactor: migrate existing editors to new IEditor --- .../vtable-editors/src/date-input-editor.ts | 5 ---- packages/vtable-editors/src/input-editor.ts | 26 +++++++++++------ packages/vtable-editors/src/list-editor.ts | 28 ++++++++----------- 3 files changed, 28 insertions(+), 31 deletions(-) diff --git a/packages/vtable-editors/src/date-input-editor.ts b/packages/vtable-editors/src/date-input-editor.ts index 28ec4616a..b16ff997b 100644 --- a/packages/vtable-editors/src/date-input-editor.ts +++ b/packages/vtable-editors/src/date-input-editor.ts @@ -7,8 +7,6 @@ export interface DateInputEditorConfig { export class DateInputEditor extends InputEditor implements IEditor { editorType: string = 'DateInput'; - declare element: HTMLInputElement; - successCallback: Function; constructor(editorConfig?: DateInputEditorConfig) { super(editorConfig); this.editorConfig = editorConfig; @@ -30,7 +28,4 @@ export class DateInputEditor extends InputEditor implements IEditor { // this.successCallback(); // }; } - bindSuccessCallback(success: Function) { - this.successCallback = success; - } } diff --git a/packages/vtable-editors/src/input-editor.ts b/packages/vtable-editors/src/input-editor.ts index 4b83598d6..d00911ce1 100644 --- a/packages/vtable-editors/src/input-editor.ts +++ b/packages/vtable-editors/src/input-editor.ts @@ -1,4 +1,5 @@ -import type { IEditor, Placement, RectProps } from './types'; +import type { EditContext, IEditor, Placement, RectProps } from './types'; + export interface InputEditorConfig { max?: number; min?: number; @@ -8,10 +9,13 @@ export class InputEditor implements IEditor { editorType: string = 'Input'; editorConfig: InputEditorConfig; container: HTMLElement; - declare element: HTMLInputElement; + successCallback?: () => void; + element?: HTMLInputElement; + constructor(editorConfig?: InputEditorConfig) { this.editorConfig = editorConfig; } + createElement() { const input = document.createElement('input'); input.setAttribute('type', 'text'); @@ -23,15 +27,19 @@ export class InputEditor implements IEditor { this.container.appendChild(input); } + setValue(value: string) { this.element.value = typeof value !== 'undefined' ? value : ''; } + getValue() { return this.element.value; } - beginEditing(container: HTMLElement, referencePosition: { rect: RectProps; placement?: Placement }, value?: string) { + + onStart({ value, referencePosition, container, endEdit }: EditContext) { console.log('input', 'beginEditing---- '); this.container = container; + this.successCallback = endEdit; this.createElement(); if (value) { @@ -43,24 +51,24 @@ export class InputEditor implements IEditor { this.element.focus(); // do nothing } + adjustPosition(rect: RectProps) { this.element.style.top = rect.top + 'px'; this.element.style.left = rect.left + 'px'; this.element.style.width = rect.width + 'px'; this.element.style.height = rect.height + 'px'; } + endEditing() { // do nothing } - exit() { + onEnd() { // do nothing this.container.removeChild(this.element); } - targetIsOnEditor(target: HTMLElement) { - if (target === this.element) { - return true; - } - return false; + + onClickElsewhere(target: HTMLElement) { + return target === this.element; } } diff --git a/packages/vtable-editors/src/list-editor.ts b/packages/vtable-editors/src/list-editor.ts index 5f6180bf6..66a0ce70f 100644 --- a/packages/vtable-editors/src/list-editor.ts +++ b/packages/vtable-editors/src/list-editor.ts @@ -1,15 +1,15 @@ -import type { IEditor, Placement, RectProps } from './types'; +import type { EditContext, IEditor, Placement, RectProps } from './types'; export interface ListEditorConfig { values: string[]; } export class ListEditor implements IEditor { editorType: string = 'Input'; - input: HTMLInputElement; - editorConfig: ListEditorConfig; - container: HTMLElement; - element: HTMLSelectElement; - successCallback: Function; + input?: HTMLInputElement; + editorConfig?: ListEditorConfig; + container?: HTMLElement; + element?: HTMLSelectElement; + successCallback?: () => void; constructor(editorConfig: ListEditorConfig) { console.log('listEditor constructor'); @@ -54,8 +54,9 @@ export class ListEditor implements IEditor { return this.element.value; } - beginEditing(container: HTMLElement, referencePosition: { rect: RectProps; placement?: Placement }, value?: string) { + onStart({ container, value, referencePosition, endEdit }: EditContext) { this.container = container; + this.successCallback = endEdit; this.createElement(value); @@ -79,18 +80,11 @@ export class ListEditor implements IEditor { // do nothing } - exit() { + onEnd() { this.container.removeChild(this.element); } - targetIsOnEditor(target: HTMLElement) { - if (target === this.element) { - return true; - } - return false; - } - - bindSuccessCallback(success: Function) { - this.successCallback = success; + onClickElsewhere(target: HTMLElement) { + return target === this.element; } } From 5f9a776a57654387651bb4f02efd8eabde0ef027 Mon Sep 17 00:00:00 2001 From: martes Date: Fri, 26 Jan 2024 11:22:50 +0800 Subject: [PATCH 044/115] fix: new targetIsOnEditor behaviour --- packages/vtable/src/edit/edit-manager.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/vtable/src/edit/edit-manager.ts b/packages/vtable/src/edit/edit-manager.ts index 391b8adc6..74f3765d4 100644 --- a/packages/vtable/src/edit/edit-manager.ts +++ b/packages/vtable/src/edit/edit-manager.ts @@ -103,12 +103,14 @@ export class EditManeger { const target = e?.target as HTMLElement | undefined; - if (target && this.editingEditor.targetIsOnEditor?.(target)) { - // TODO: 添加开发时弃用警告 - return; + if (this.editingEditor.targetIsOnEditor) { + if (target && this.editingEditor.targetIsOnEditor(target)) { + // TODO: 添加开发时弃用警告 + return; + } } - if (target && this.editingEditor.onClickElsewhere?.(target)) { + if (!this.editingEditor.onClickElsewhere || (target && this.editingEditor.onClickElsewhere?.(target))) { return; } From 73274603996fd66c1c0fc646ad8f17743e371a68 Mon Sep 17 00:00:00 2001 From: martes Date: Fri, 26 Jan 2024 14:06:48 +0800 Subject: [PATCH 045/115] feat: update usage in demo and guide --- docs/assets/guide/zh/edit/edit_cell.md | 16 +++++++--------- .../vtable/examples/editor/custom-date-editor.ts | 12 +++++------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/docs/assets/guide/zh/edit/edit_cell.md b/docs/assets/guide/zh/edit/edit_cell.md index 4126814c9..aee9860ee 100644 --- a/docs/assets/guide/zh/edit/edit_cell.md +++ b/docs/assets/guide/zh/edit/edit_cell.md @@ -77,7 +77,7 @@ editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => s 以下是一个自定义编辑器的示例代码: -```javascript +```ts class DateEditor implements IEditor { editorConfig: any; element: HTMLInputElement; @@ -87,9 +87,10 @@ class DateEditor implements IEditor { constructor(editorConfig: any) { this.editorConfig = editorConfig; } - beginEditing(container: HTMLElement, referencePosition: { rect: RectProps; placement?: Placement }, value?: string) { + onStart({ container, value, referencePosition, endEdit }: EditContext) { const that = this; this.container = container; + this.successCallback = endEdit // const cellValue = luxon.DateTime.fromFormat(value, 'yyyy年MM月dd日').toFormat('yyyy-MM-dd'); const input = document.createElement('input'); @@ -143,19 +144,16 @@ class DateEditor implements IEditor { getValue() { return this.element.value; } - exit() { + onEnd() { this.picker.destroy(); this.container.removeChild(this.element); } - targetIsOnEditor(target: HTMLElement) { + onClickElsewhere(target: HTMLElement) { if (target === this.element || this.picker.el.contains(target)) { return true; } return false; } - bindSuccessCallback(successCallback: Function) { - this.successCallback = successCallback; - } } const custom_date_editor = new DateEditor({}); VTable.register.editor('custom-date', custom_date_editor); @@ -231,7 +229,7 @@ tableInstance.records; * @param row 粘贴数据的起始行号 * @param values 多个单元格的数据数组 */ - changeCellValues(startCol: number, startRow: number, values: string[][]) + changeCellValues(startCol: number, startRow: number, values: string[][]) /** 获取单元格配置的编辑器 */ getEditor: (col: number, row: number) => IEditor; @@ -246,4 +244,4 @@ tableInstance.records; 基本表格可支持编辑表头显示标题title,在全局或者在column中配置`headerEditor`来开启,具体用法同`editor`。 -通过以上步骤,你可以创建一个具有编辑功能的表格,并根据业务需求选择合适的编辑器类型、自定义编辑器、监听编辑事件以及获取编辑后的数据。这样,用户就可以方便地编辑表格中的数据,并且你可以对编辑后的数据进行相应的处理。 \ No newline at end of file +通过以上步骤,你可以创建一个具有编辑功能的表格,并根据业务需求选择合适的编辑器类型、自定义编辑器、监听编辑事件以及获取编辑后的数据。这样,用户就可以方便地编辑表格中的数据,并且你可以对编辑后的数据进行相应的处理。 diff --git a/packages/vtable/examples/editor/custom-date-editor.ts b/packages/vtable/examples/editor/custom-date-editor.ts index c5064a226..a6395309a 100644 --- a/packages/vtable/examples/editor/custom-date-editor.ts +++ b/packages/vtable/examples/editor/custom-date-editor.ts @@ -1,5 +1,5 @@ import * as VTable from '../../src'; -import type { IEditor, RectProps, Placement } from '@visactor/vtable-editors'; +import type { IEditor, RectProps, Placement, EditContext } from '@visactor/vtable-editors'; import { DateInputEditor, InputEditor, ListEditor } from '@visactor/vtable-editors'; import * as luxon from 'luxon'; import * as Pikaday from 'pikaday'; @@ -21,9 +21,10 @@ class DateEditor implements IEditor { constructor(editorConfig: any) { this.editorConfig = editorConfig; } - beginEditing(container: HTMLElement, referencePosition: { rect: RectProps; placement?: Placement }, value?: string) { + onStart({ container, value, referencePosition, endEdit }: EditContext) { const that = this; this.container = container; + this.successCallback = endEdit; // const cellValue = luxon.DateTime.fromFormat(value, 'yyyy年MM月dd日').toFormat('yyyy-MM-dd'); const input = document.createElement('input'); @@ -79,19 +80,16 @@ class DateEditor implements IEditor { // const cellValue = luxon.DateTime.fromFormat(this.element.value, 'yyyy-MM-dd').toFormat('yyyy年MM月dd日'); return this.element.value; } - exit() { + onEnd() { this.picker.destroy(); this.container.removeChild(this.element); } - targetIsOnEditor(target: HTMLElement) { + onClickElsewhere(target: HTMLElement) { if (target === this.element || this.picker.el.contains(target)) { return true; } return false; } - bindSuccessCallback(successCallback: Function) { - this.successCallback = successCallback; - } } const custom_date_editor = new DateEditor({}); VTable.register.editor('custom-date', custom_date_editor); From 82635f8c09e8b86de620f4b16c554be42c03da0d Mon Sep 17 00:00:00 2001 From: martes Date: Sat, 27 Jan 2024 13:49:31 +0800 Subject: [PATCH 046/115] docs: update description of IEditor --- packages/vtable-editors/src/types.ts | 63 +++++++++++++++------------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/packages/vtable-editors/src/types.ts b/packages/vtable-editors/src/types.ts index db5708e67..83f3dd3b9 100644 --- a/packages/vtable-editors/src/types.ts +++ b/packages/vtable-editors/src/types.ts @@ -1,74 +1,77 @@ // eslint-disable-next-line @typescript-eslint/no-explicit-any export interface IEditor { /** - * 当单元格进入编辑状态时调用 + * Called when cell enters edit mode. + * + * Warning will be thrown if you don't provide this function + * after removal of `beginEditing`. */ onStart?: (context: EditContext) => void; /** - * 当单元格退出编辑状态时调用 + * called when cell exits edit mode. + * + * Warning will be thrown if you don't provide this function + * after removal of `exit`. */ onEnd?: () => void; /** - * 当单元格处于编辑状态时鼠标点击其他位置时调用。 + * Called when user click somewhere while editor is in edit mode. * - * 如果返回值为虚值,则 VTable 将退出编辑状态。 + * If returns falsy, VTable will exit edit mode. * - * 如果不提供此函数,VTable 将不会在点击其他位置时自动退出编辑状态。 - * 你需要使用 `onStart` 提供的 `endEdit` 函数来手动退出编辑状态。 + * If returns truthy or not defined, nothing will happen. + * Which means, in this scenario, you need to call `endEdit` manually + * to end edit mode. */ onClickElsewhere?: (target: HTMLElement) => boolean; /** - * 当单元格退出编辑状态后,VTable 将调用此函数来获取编辑后的值 + * Called when editor mode is exited by any means. + * Expected to return the current value of the cell. */ getValue: () => V; /** - * 编辑器进入编辑状态 - * @deprecated 请改用 `onStart` 代替。 + * Called when cell enter edit mode. + * @deprecated use `onStart` instead. */ beginEditing?: (container: HTMLElement, referencePosition: ReferencePosition, value: V) => void; /** * @see onEnd - * @deprecated 请改用 `onEnd` 代替。 + * @deprecated use `onEnd` instead. */ exit?: () => void; /** * @see onClickElsewhere - * @deprecated 请改用 `onClickElsewhere` 代替。 + * @deprecated use `onClickElsewhere` instead. */ targetIsOnEditor?: (target: HTMLElement) => boolean; /** - * beginEditing 调用时调用,提供一个回调函数,用于结束编辑器编辑状态。 + * Called when cell enters edit mode with a callback function + * that can be used to end edit mode. * @see EditContext#endEdit - * @deprecated 请改用 `onStart` 代替。 + * @deprecated callback is provided as `endEdit` in `EditContext`, use `onStart` instead. */ bindSuccessCallback?: (callback: () => void) => void; } // eslint-disable-next-line @typescript-eslint/no-explicit-any export interface EditContext { - /** - * VTable 所在容器 - */ + /** Container element of the VTable instance. */ container: HTMLElement; - /** - * 单元格所在位置 - */ + /** Position info of the cell that is being edited. */ referencePosition: ReferencePosition; - /** - * 单元格当前值 - */ + /** Cell value before editing. */ value: V; /** - * 立即结束编辑器编辑状态。 + * Callback function that can be used to end edit mode. * - * 大多数情况下你并不需要调用这个函数,因为 - * VTable 已经自动对 Enter 键以及 - * 鼠标点击其他位置(`onClickElsewhere`)进行了处理。 + * In most cases you don't need to call this function, + * since Enter key click is handled by VTable automatically, + * and mouse click can be handled by `onClickElsewhere`. * - * 但如果你的编辑器内部有自己的完成按钮,或是 - * 像 Tooltip 有外部悬浮元素,不太好或者没有办法 - * 使用 `onClickElsewhere` 进行判断时,你 - * 可以使用这个回调来帮助你处理编辑器的退出逻辑。 + * However, if your editor has its own complete button, + * or you have external elements like Tooltip, + * you may want to use this callback to help you + * end edit mode. */ endEdit: () => void; } From d7ba406ea75880e1f81460f2ed0f027b75be5099 Mon Sep 17 00:00:00 2001 From: martes Date: Sat, 27 Jan 2024 14:08:00 +0800 Subject: [PATCH 047/115] docs: update edit section in guide --- docs/assets/guide/en/edit/edit_cell.md | 84 ++++++++++++++++---------- docs/assets/guide/zh/edit/edit_cell.md | 80 ++++++++++++++---------- 2 files changed, 101 insertions(+), 63 deletions(-) diff --git a/docs/assets/guide/en/edit/edit_cell.md b/docs/assets/guide/en/edit/edit_cell.md index 2d04e6a29..138a37607 100644 --- a/docs/assets/guide/en/edit/edit_cell.md +++ b/docs/assets/guide/en/edit/edit_cell.md @@ -157,31 +157,51 @@ VTable.register.editor('custom-date', custom_date_editor); ``` In the above example, we created a custom editor named `DateEditor` and implemented the methods required by the `IEditor` interface. Then, we register the custom editor into the VTable through the `VTable.register.editor` method for use in the table. -`IEditor` interface's definition(github:https://github.com/VisActor/VTable/blob/feat/editCell/packages/vtable-editors/src/types.ts): -``` -export interface IEditor { - /** 编辑器类型 */ - editorType?: string; - /** 编辑配置 */ - editorConfig: any; - /* 编辑器挂载的容器 由vtable传入 */ +`IEditor` [definition](https://github.com/VisActor/VTable/blob/develop/packages/vtable-editors/src/types.ts): +```ts +export interface IEditor { + /** Called when cell enters edit mode. */ + onStart?: (context: EditContext) => void; + /** called when cell exits edit mode. */ + onEnd?: () => void; + /** + * Called when user click somewhere while editor is in edit mode. + * + * If returns falsy, VTable will exit edit mode. + * + * If returns truthy or not defined, nothing will happen. + * Which means, in this scenario, you need to call `endEdit` manually + * to end edit mode. + */ + onClickElsewhere?: (target: HTMLElement) => boolean; + /** + * Called when editor mode is exited by any means. + * Expected to return the current value of the cell. + */ + getValue: () => V; +} + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export interface EditContext { + /** Container element of the VTable instance. */ container: HTMLElement; - /** 编辑完成后调用。注意如果是(enter键,鼠标点击其他位置)这类编辑完成已有VTable实现,编辑器内部有完成按钮等类似的完成操作需要调用这个方法 */ - successCallback?: Function; - /** 获取编辑器当前值 */ - getValue: () => string | number | null; - /** 编辑器进入编辑状态 */ - beginEditing: ( - container: HTMLElement, - referencePosition: { rect: RectProps; placement?: Placement }, - value?: string - ) => void; - /** 编辑器退出编辑状态 */ - exit: () => void; - /** 判断鼠标点击的target是否属于编辑器内部元素 */ - targetIsOnEditor: (target: HTMLElement) => boolean; - /** 由VTable调用来传入编辑成功的回调 请将callback赋值到successCallback */ - bindSuccessCallback?: (callback: Function) => void; + /** Position info of the cell that is being edited. */ + referencePosition: ReferencePosition; + /** Cell value before editing. */ + value: V; + /** + * Callback function that can be used to end edit mode. + * + * In most cases you don't need to call this function, + * since Enter key click is handled by VTable automatically, + * and mouse click can be handled by `onClickElsewhere`. + * + * However, if your editor has its own complete button, + * or you have external elements like Tooltip, + * you may want to use this callback to help you + * end edit mode. + */ + endEdit: () => void; } ``` @@ -207,17 +227,20 @@ tableInstance.records; ## 7. Edit trigger timing Editing trigger timing support: double-click a cell to enter editing, click a cell to enter editing, and call the API to manually start editing. -``` +```ts +interface ListTableConstructorOptions { /** Editing trigger timing Double-click event Click event API manually starts editing. The default is double-click 'doubleclick' */ editCellTrigger?: 'doubleclick' | 'click' | 'api'; + // ... +} ``` ## 8. Related APIs -``` +```ts +interface ListTableAPI { /** Set the value of the cell. Note that it corresponds to the original value of the source data, and the vtable instance records will be modified accordingly */ changeCellValue: (col: number, row: number, value: string | number | null) => void; - /** * Batch update data of multiple cells * @param col The starting column number of pasted data @@ -225,19 +248,18 @@ Editing trigger timing support: double-click a cell to enter editing, click a ce * @param values Data array of multiple cells */ changeCellValues(startCol: number, startRow: number, values: string[][]) - /** Get the editor of cell configuration */ getEditor: (col: number, row: number) => IEditor; - /** Enable cell editing */ startEditCell: (col?: number, row?: number) => void; - /** End editing */ completeEditCell: () => void; + // ... +} ``` ## Header Editing The basic table supports editing the display title in the header. You can enable this by configuring `headerEditor` globally or within a column. The usage is the same as `editor`. -Through the above steps, you can create a table with editing functions, select the appropriate editor type according to business needs, customize the editor, listen to editing events, and obtain edited data. In this way, users can easily edit the data in the table, and you can process the edited data accordingly. \ No newline at end of file +Through the above steps, you can create a table with editing functions, select the appropriate editor type according to business needs, customize the editor, listen to editing events, and obtain edited data. In this way, users can easily edit the data in the table, and you can process the edited data accordingly. diff --git a/docs/assets/guide/zh/edit/edit_cell.md b/docs/assets/guide/zh/edit/edit_cell.md index aee9860ee..559bdbbc0 100644 --- a/docs/assets/guide/zh/edit/edit_cell.md +++ b/docs/assets/guide/zh/edit/edit_cell.md @@ -65,8 +65,11 @@ columns: [ editor配置可以在columns中,也可以在全局options中定义,同时可以支持自定义函数写法: -``` -editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor); +```ts +interface ColumnDefine { + // ... + editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor); +} ``` ## 4. 自定义实现一个编辑器: 如果VTable-ediotrs库提供的几种编辑器无法满足你的需求,你可以自定义实现一个编辑器。为此,你需要创建一个类,实现编辑器接口(`IEditor`)的要求,并提供必要的方法和逻辑。 @@ -162,31 +165,42 @@ VTable.register.editor('custom-date', custom_date_editor); 在上面的示例中,我们创建了一个名为`DateEditor`的自定义编辑器,并实现了`IEditor`接口所要求的方法。然后,我们通过`VTable.register.editor`方法将自定义编辑器注册到VTable中,以便在表格中使用。 -`IEditor`接口具体定义的源码(github:https://github.com/VisActor/VTable/blob/feat/editCell/packages/vtable-editors/src/types.ts): -``` -export interface IEditor { - /** 编辑器类型 */ - editorType?: string; - /** 编辑配置 */ - editorConfig: any; - /* 编辑器挂载的容器 由vtable传入 */ +`IEditor` 接口[定义](https://github.com/VisActor/VTable/blob/develop/packages/vtable-editors/src/types.ts): +```ts +export interface IEditor { + /** * 单元格进入编辑状态时调用 */ + onStart?: (context: EditContext) => void; + /** * 单元格退出编辑状态时调用 */ + onEnd?: () => void; + /** + * 如果提供了此函数,VTable 将会在用户点击其他地方时调用此函数。 + * 如果此函数返回了一个假值,VTable 将会调用 `onEnd` 并退出编辑状态。 + */ + onClickElsewhere?: (target: HTMLElement) => boolean; + /** * 获取编辑器当前值。将在 `onEnd` 调用后调用。 */ + getValue: () => V; + // ... +} + +export interface EditContext { + /** VTable 实例所处的容器元素 */ container: HTMLElement; - /** 编辑完成后调用。注意如果是(enter键,鼠标点击其他位置)这类编辑完成已有VTable实现,编辑器内部有完成按钮等类似的完成操作需要调用这个方法 */ - successCallback?: Function; - /** 获取编辑器当前值 */ - getValue: () => string | number | null; - /** 编辑器进入编辑状态 */ - beginEditing: ( - container: HTMLElement, - referencePosition: { rect: RectProps; placement?: Placement }, - value?: string - ) => void; - /** 编辑器退出编辑状态 */ - exit: () => void; - /** 判断鼠标点击的target是否属于编辑器内部元素 */ - targetIsOnEditor: (target: HTMLElement) => boolean; - /** 由VTable调用来传入编辑成功的回调 请将callback赋值到successCallback */ - bindSuccessCallback?: (callback: Function) => void; + /** 正在编辑的单元格位置信息 */ + referencePosition: ReferencePosition; + /** 正在进入编辑状态的单元格当前值 */ + value: V; + /** + * 用于结束编辑状态的回调。 + * + * 大多数情况下你不需要使用此回调,因为 VTable 已经自带了 Enter 键按下 + * 来结束编辑状态的行为;而鼠标点击其他位置来结束编辑状态的行为你也 + * 可以通过 `onClickElsewhere` 函数来获得。 + * + * 然而,如果你有特殊的需求,比如你想在编辑器内部提供一个“完成”按钮, + * 或者你有像 Tooltip 这样无法获取到的外部元素, + * 这时你可以保存这个回调并在你需要的时候来手动结束编辑状态。 + */ + endEdit: () => void; } ``` @@ -212,17 +226,20 @@ tableInstance.records; ## 7. 编辑触发时机 编辑触发时机支持:双击单元格进入编辑,单击单元格进入编辑,调用api手动开启编辑. -``` +```ts +interface ListTableConstructorOptions { /** 编辑触发时机 双击事件 单击事件 api手动开启编辑。默认为双击'doubleclick' */ editCellTrigger?: 'doubleclick' | 'click' | 'api'; + // ... +} ``` ## 8. 相关api -``` +```ts +interface ListTableAPI { /** 设置单元格的value值,注意对应的是源数据的原始值,vtable实例records会做对应修改 */ changeCellValue: (col: number, row: number, value: string | number | null) => void; - /** * 批量更新多个单元格的数据 * @param col 粘贴数据的起始列号 @@ -230,15 +247,14 @@ tableInstance.records; * @param values 多个单元格的数据数组 */ changeCellValues(startCol: number, startRow: number, values: string[][]) - /** 获取单元格配置的编辑器 */ getEditor: (col: number, row: number) => IEditor; - /** 开启单元格编辑 */ startEditCell: (col?: number, row?: number) => void; - /** 结束编辑 */ completeEditCell: () => void; + // ... +} ``` ## 表头编辑 From b73d0ef682dce4fd6d09bd7755a129662a9d4de1 Mon Sep 17 00:00:00 2001 From: martes Date: Sat, 27 Jan 2024 14:12:45 +0800 Subject: [PATCH 048/115] docs: update edit section in demo --- docs/assets/demo/en/edit/custom-editor.md | 13 +++++-------- docs/assets/demo/zh/edit/custom-editor.md | 15 ++++++--------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/docs/assets/demo/en/edit/custom-editor.md b/docs/assets/demo/en/edit/custom-editor.md index 2daf60e5d..8e5ff41da 100644 --- a/docs/assets/demo/en/edit/custom-editor.md +++ b/docs/assets/demo/en/edit/custom-editor.md @@ -59,9 +59,10 @@ Promise.all([loadCSS(cssUrl), loadJS(jsUrl)]) this.editorConfig = editorConfig; } - beginEditing(container, referencePosition, value) { + onStart({ container, referencePosition, value, endEdit }) { const that = this; this.container = container; + this.successCallback = endEdit; const input = document.createElement('input'); input.setAttribute('type', 'text'); @@ -112,21 +113,17 @@ Promise.all([loadCSS(cssUrl), loadJS(jsUrl)]) return this.element.value; } - exit() { + onEnd() { this.picker.destroy(); this.container.removeChild(this.element); } - targetIsOnEditor(target) { + onClickElsewhere(target) { if (target === this.element || this.picker.el.contains(target)) { return true; } return false; } - - bindSuccessCallback(successCallback) { - this.successCallback = successCallback; - } } const custom_date_editor = new DateEditor(); VTable.register.editor('custom-date', custom_date_editor); @@ -308,5 +305,5 @@ Promise.all([loadCSS(cssUrl), loadJS(jsUrl)]) }) .catch((error) => { // 处理加载错误 -}); +}); ``` diff --git a/docs/assets/demo/zh/edit/custom-editor.md b/docs/assets/demo/zh/edit/custom-editor.md index d77dbfcf8..0ec754849 100644 --- a/docs/assets/demo/zh/edit/custom-editor.md +++ b/docs/assets/demo/zh/edit/custom-editor.md @@ -23,7 +23,7 @@ let tableInstance; // 使用时需要引入插件包@visactor/vtable-editors // import * as VTable_editors from '@visactor/vtable-editors'; // 正常使用方式 const input_editor = new VTable.editors.InputEditor(); -// 官网编辑器中将 VTable.editors重命名成了VTable_editors +// 官网编辑器中将 VTable.editors重命名成了VTable_editors const input_editor = new VTable_editors.InputEditor(); VTable.register.editor('input-editor', input_editor); const timestamp = new Date().getTime(); @@ -59,9 +59,10 @@ Promise.all([loadCSS(cssUrl), loadJS(jsUrl)]) this.editorConfig = editorConfig; } - beginEditing(container, referencePosition, value) { + onStart({ container, referencePosition, value, endEdit }) { const that = this; this.container = container; + this.successCallback = endEdit; const input = document.createElement('input'); input.setAttribute('type', 'text'); @@ -112,21 +113,17 @@ Promise.all([loadCSS(cssUrl), loadJS(jsUrl)]) return this.element.value; } - exit() { + onEnd() { this.picker.destroy(); this.container.removeChild(this.element); } - targetIsOnEditor(target) { + onClickElsewhere(target) { if (target === this.element || this.picker.el.contains(target)) { return true; } return false; } - - bindSuccessCallback(successCallback) { - this.successCallback = successCallback; - } } const custom_date_editor = new DateEditor(); VTable.register.editor('custom-date', custom_date_editor); @@ -311,5 +308,5 @@ Promise.all([loadCSS(cssUrl), loadJS(jsUrl)]) }) .catch((error) => { // 处理加载错误 -}); +}); ``` From b498cb9819a6d0d9253c6b655e69afc9c896afbb Mon Sep 17 00:00:00 2001 From: martes Date: Sat, 27 Jan 2024 14:44:16 +0800 Subject: [PATCH 049/115] feat: add warnings --- packages/vtable/src/edit/edit-manager.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/vtable/src/edit/edit-manager.ts b/packages/vtable/src/edit/edit-manager.ts index 74f3765d4..f5afc86d4 100644 --- a/packages/vtable/src/edit/edit-manager.ts +++ b/packages/vtable/src/edit/edit-manager.ts @@ -77,10 +77,12 @@ export class EditManeger { const rect = this.table.getCellRangeRelativeRect(this.table.getCellRange(col, row)); const referencePosition = { rect: { left: rect.left, top: rect.top, width: rect.width, height: rect.height } }; - // TODO: 添加开发时弃用警告 + editor.beginEditing && console.warn('VTable Warn: `beginEditing` is deprecated, please use `onStart` instead.'); editor.beginEditing?.(this.table.getElement(), referencePosition, dataValue); - // TODO: 添加开发时弃用警告 + if (editor.bindSuccessCallback) { + console.warn('VTable Warn: `bindSuccessCallback` is deprecated, please use `onStart` instead.'); + } editor.bindSuccessCallback?.(() => { this.completeEdit(); }); @@ -104,8 +106,8 @@ export class EditManeger { const target = e?.target as HTMLElement | undefined; if (this.editingEditor.targetIsOnEditor) { + console.warn('VTable Warn: `targetIsOnEditor` is deprecated, please use `onClickElsewhere` instead.'); if (target && this.editingEditor.targetIsOnEditor(target)) { - // TODO: 添加开发时弃用警告 return; } } @@ -114,11 +116,13 @@ export class EditManeger { return; } - // TODO: 开发时检查 getValue 是否为方法,如不是则提供警告 + if (!this.editingEditor.getValue) { + console.warn('VTable Warn: `getValue` is not provided, did you forget to implement it?'); + } const changedValue = this.editingEditor.getValue?.(); (this.table as ListTableAPI).changeCellValue(this.editCell.col, this.editCell.row, changedValue); - // TODO: 添加开发时弃用警告 + this.editingEditor.exit && console.warn('VTable Warn: `exit` is deprecated, please use `onEnd` instead.'); this.editingEditor.exit?.(); this.editingEditor.onEnd?.(); this.editingEditor = null; From 4e7040e0a6f7550d2fb47306a30eb9fa80d6a571 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Mon, 29 Jan 2024 10:47:20 +0800 Subject: [PATCH 050/115] fix: columns get order problems --- .../examples/cell-move/{column.ts => column-move.ts} | 0 .../examples/cell-move/{pivot.ts => pivot-move.ts} | 10 +++++++--- .../vtable/examples/cell-move/{row.ts => row-move.ts} | 0 packages/vtable/examples/menu.ts | 6 +++--- packages/vtable/src/layout/pivot-header-layout.ts | 2 +- packages/vtable/src/layout/simple-header-layout.ts | 4 ++-- 6 files changed, 13 insertions(+), 9 deletions(-) rename packages/vtable/examples/cell-move/{column.ts => column-move.ts} (100%) rename packages/vtable/examples/cell-move/{pivot.ts => pivot-move.ts} (99%) rename packages/vtable/examples/cell-move/{row.ts => row-move.ts} (100%) diff --git a/packages/vtable/examples/cell-move/column.ts b/packages/vtable/examples/cell-move/column-move.ts similarity index 100% rename from packages/vtable/examples/cell-move/column.ts rename to packages/vtable/examples/cell-move/column-move.ts diff --git a/packages/vtable/examples/cell-move/pivot.ts b/packages/vtable/examples/cell-move/pivot-move.ts similarity index 99% rename from packages/vtable/examples/cell-move/pivot.ts rename to packages/vtable/examples/cell-move/pivot-move.ts index d05afd55e..4f385bb3a 100644 --- a/packages/vtable/examples/cell-move/pivot.ts +++ b/packages/vtable/examples/cell-move/pivot-move.ts @@ -8,6 +8,11 @@ export function createTable() { enableDataAnalysis: false, allowRangePaste: true, columnTree: [ + { + dimensionKey: '地区', + //title: '地区', + value: '东北22' + }, { dimensionKey: '地区', //title: '地区', @@ -452,6 +457,8 @@ export function createTable() { }; option.container = document.getElementById(CONTAINER_ID); const instance = new PivotTable(option); + // 只为了方便控制太调试用,不要拷贝 + window.tableInstance = instance; instance.on('copy_data', e => { console.log('copy_data', e); }); @@ -459,7 +466,4 @@ export function createTable() { VTable.bindDebugTool(instance.scenegraph.stage as any, { customGrapicKeys: ['role', '_updateTag'] }); - - // 只为了方便控制太调试用,不要拷贝 - window.tableInstance = instance; } diff --git a/packages/vtable/examples/cell-move/row.ts b/packages/vtable/examples/cell-move/row-move.ts similarity index 100% rename from packages/vtable/examples/cell-move/row.ts rename to packages/vtable/examples/cell-move/row-move.ts diff --git a/packages/vtable/examples/menu.ts b/packages/vtable/examples/menu.ts index f3a635512..331115cbd 100644 --- a/packages/vtable/examples/menu.ts +++ b/packages/vtable/examples/menu.ts @@ -546,15 +546,15 @@ export const menus = [ children: [ { path: 'cell-move', - name: 'column' + name: 'column-move' }, { path: 'cell-move', - name: 'row' + name: 'row-move' }, { path: 'cell-move', - name: 'pivot' + name: 'pivot-move' } ] }, diff --git a/packages/vtable/src/layout/pivot-header-layout.ts b/packages/vtable/src/layout/pivot-header-layout.ts index ac5d1d387..a883a4098 100644 --- a/packages/vtable/src/layout/pivot-header-layout.ts +++ b/packages/vtable/src/layout/pivot-header-layout.ts @@ -2013,7 +2013,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { // 对维度树结构调整节点位置 this.columnDimensionTree.movePosition( - source.row, + this.getCellHeaderPathsWidthTreeNode(source.col, source.row).colHeaderPaths.length - 1, sourceCellRange.start.col - this.rowHeaderLevelCount, targetIndex - this.rowHeaderLevelCount ); diff --git a/packages/vtable/src/layout/simple-header-layout.ts b/packages/vtable/src/layout/simple-header-layout.ts index 03ab08f11..a841e3734 100644 --- a/packages/vtable/src/layout/simple-header-layout.ts +++ b/packages/vtable/src/layout/simple-header-layout.ts @@ -840,7 +840,7 @@ export class SimpleHeaderLayoutMap implements LayoutMapAPI { Array.prototype.splice.apply(this._columns, sourceColumns); // 对表头columnTree调整节点位置 - this.columnTree.movePosition(source.row, sourceCellRange.start.col, targetIndex); + this.columnTree.movePosition(sourceCellRange.start.row, sourceCellRange.start.col, targetIndex); this._cellRangeMap = new Map(); return { @@ -879,7 +879,7 @@ export class SimpleHeaderLayoutMap implements LayoutMapAPI { Array.prototype.splice.apply(this._columns, sourceColumns); // 对表头columnTree调整节点位置 - this.columnTree.movePosition(source.col, sourceCellRange.start.row, targetIndex); + this.columnTree.movePosition(sourceCellRange.start.col, sourceCellRange.start.row, targetIndex); this._cellRangeMap = new Map(); return { From 55f1af31fdc59c04c71a2790f4c6b8c5e5b33928 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Mon, 29 Jan 2024 19:20:16 +0800 Subject: [PATCH 051/115] test: add dragHeader unit test --- .../columns/listTable-dragHeader.test.ts | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 packages/vtable/__tests__/columns/listTable-dragHeader.test.ts diff --git a/packages/vtable/__tests__/columns/listTable-dragHeader.test.ts b/packages/vtable/__tests__/columns/listTable-dragHeader.test.ts new file mode 100644 index 000000000..05a0db9f8 --- /dev/null +++ b/packages/vtable/__tests__/columns/listTable-dragHeader.test.ts @@ -0,0 +1,126 @@ +// @ts-nocheck +// 有问题可对照demo unitTestListTable +import { ListTable } from '../../src/ListTable'; +import { createDiv } from '../dom'; +global.__VERSION__ = 'none'; +const generatePersons = count => { + return Array.from(new Array(count)).map((_, i) => ({ + id: i + 1, + email1: `${i + 1}@xxx.com`, + name: `小明${i + 1}`, + lastName: '王', + date1: '2022年9月1日', + tel: '000-0000-0000', + sex: i % 2 === 0 ? 'boy' : 'girl', + work: i % 2 === 0 ? 'back-end engineer' : 'front-end engineer', + city: 'beijing' + })); +}; +describe('listTable-cellType-function init test', () => { + const containerDom: HTMLElement = createDiv(); + containerDom.style.position = 'relative'; + containerDom.style.width = '1000px'; + containerDom.style.height = '800px'; + const records = generatePersons(10); + const columns = [ + { + field: 'id', + title: 'ID', + sort: true, + width: 'auto' + }, + { + field: 'email1', + title: 'email', + sort: true + }, + { + title: 'full name', + columns: [ + { + field: 'name', + title: 'First Name' + }, + { + field: 'name', + title: 'Last Name' + } + ] + }, + { + field: 'date1', + title: 'birthday' + // width: 200 + }, + { + field: 'sex', + title: 'sex' + }, + { + field: 'tel', + title: 'telephone' + }, + { + field: 'work', + title: 'job' + }, + { + field: 'city', + title: 'city' + } + ]; + const option = { + records, + columns, + dragHeaderMode: 'all', + autoWrapText: true + }; + const listTable = new ListTable(containerDom, option); + test('listTable dragHeader interaction', () => { + listTable.selectCell(4, 1); + listTable.stateManager.startMoveCol(4, 1, 342, 60); + listTable.stateManager.updateMoveCol(1, 1, 100, 60); + listTable.stateManager.endMoveCol(); + expect(listTable.columns).toEqual([ + { field: 'id', sort: true, title: 'ID', width: 'auto' }, + { field: 'date1', title: 'birthday' }, + { field: 'email1', sort: true, title: 'email' }, + { + columns: [ + { field: 'name', title: 'First Name' }, + { field: 'name', title: 'Last Name' } + ], + title: 'full name' + }, + { field: 'sex', title: 'sex' }, + { field: 'tel', title: 'telephone' }, + { field: 'work', title: 'job' }, + { field: 'city', title: 'city' } + ]); + }); + test('listTable dragHeader interaction', () => { + option.transpose = true; + listTable.updateOption(option); + listTable.selectCell(1, 4); + listTable.stateManager.startMoveCol(1, 4, 120, 60); + listTable.stateManager.updateMoveCol(1, 1, 120, 177); + listTable.stateManager.endMoveCol(); + expect(listTable.columns).toEqual([ + { field: 'id', sort: true, title: 'ID', width: 'auto' }, + { field: 'date1', title: 'birthday' }, + { field: 'email1', sort: true, title: 'email' }, + { + columns: [ + { field: 'name', title: 'First Name' }, + { field: 'name', title: 'Last Name' } + ], + title: 'full name' + }, + { field: 'sex', title: 'sex' }, + { field: 'tel', title: 'telephone' }, + { field: 'work', title: 'job' }, + { field: 'city', title: 'city' } + ]); + }); + listTable.release(); +}); From 161b5556455629afe6183650c533e918c89e898d Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Tue, 30 Jan 2024 11:26:45 +0800 Subject: [PATCH 052/115] refactor: move function clearNode position --- .../vtable/src/layout/pivot-layout-helper.ts | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/packages/vtable/src/layout/pivot-layout-helper.ts b/packages/vtable/src/layout/pivot-layout-helper.ts index 1c686926d..6f76cf71d 100644 --- a/packages/vtable/src/layout/pivot-layout-helper.ts +++ b/packages/vtable/src/layout/pivot-layout-helper.ts @@ -319,21 +319,6 @@ export class DimensionTree { getCopiedTree() { const children = cloneDeep(this.tree.children); clearNode(children); - function clearNode(children: any) { - for (let i = 0; i < children.length; i++) { - const node = children[i]; - delete node.level; - delete node.startIndex; - delete node.id; - delete node.levelSpan; - delete node.size; - delete node.startInTotal; - const childrenNew = node.children || node.columns; - if (childrenNew) { - clearNode(childrenNew); - } - } - } return children; } } @@ -625,3 +610,19 @@ export function dealHeaderForTreeMode( } } } + +function clearNode(children: any) { + for (let i = 0; i < children.length; i++) { + const node = children[i]; + delete node.level; + delete node.startIndex; + delete node.id; + delete node.levelSpan; + delete node.size; + delete node.startInTotal; + const childrenNew = node.children || node.columns; + if (childrenNew) { + clearNode(childrenNew); + } + } +} From 05461fc716c7944e333cd9b8f68cca1012696113 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Tue, 30 Jan 2024 11:33:44 +0800 Subject: [PATCH 053/115] refactor: rename layout helper file --- packages/vtable/src/PivotTable.ts | 2 +- ...ivot-layout-helper.ts => layout-helper.ts} | 50 +++++++++---------- .../vtable/src/layout/pivot-header-layout.ts | 30 +++++------ .../vtable/src/layout/simple-header-layout.ts | 2 +- 4 files changed, 39 insertions(+), 45 deletions(-) rename packages/vtable/src/layout/{pivot-layout-helper.ts => layout-helper.ts} (93%) diff --git a/packages/vtable/src/PivotTable.ts b/packages/vtable/src/PivotTable.ts index 5b850af56..79bca6277 100644 --- a/packages/vtable/src/PivotTable.ts +++ b/packages/vtable/src/PivotTable.ts @@ -28,7 +28,7 @@ import type { BaseTableAPI, PivotTableProtected } from './ts-types/base-table'; import { Title } from './components/title/title'; import { cloneDeep } from '@visactor/vutils'; import { Env } from './tools/env'; -import type { LayouTreeNode } from './layout/pivot-layout-helper'; +import type { LayouTreeNode } from './layout/layout-helper'; import { TABLE_EVENT_TYPE } from './core/TABLE_EVENT_TYPE'; import { EditManeger } from './edit/edit-manager'; import * as editors from './edit/editors'; diff --git a/packages/vtable/src/layout/pivot-layout-helper.ts b/packages/vtable/src/layout/layout-helper.ts similarity index 93% rename from packages/vtable/src/layout/pivot-layout-helper.ts rename to packages/vtable/src/layout/layout-helper.ts index 6f76cf71d..c4cb04c5a 100644 --- a/packages/vtable/src/layout/pivot-layout-helper.ts +++ b/packages/vtable/src/layout/layout-helper.ts @@ -19,13 +19,13 @@ import type { ILinkDimension } from '../ts-types/pivot-table/dimension/link-dime import type { IImageDimension } from '../ts-types/pivot-table/dimension/image-dimension'; // import { sharedVar } from './pivot-header-layout'; -interface IPivotLayoutBaseHeadNode { +interface ITreeLayoutBaseHeadNode { id: number; // dimensionKey: string; // // title: string; // indicatorKey?: string; value: string; - children: IPivotLayoutHeadNode[] | undefined; + children: ITreeLayoutHeadNode[] | undefined; columns?: any; //兼容ListTable情况 simple-header-layout中增加了columnTree level: number; /** 节点跨占层数 如汇总节点跨几层维度 */ @@ -41,13 +41,13 @@ interface IPivotLayoutBaseHeadNode { headerIcon?: (string | ColumnIconOption)[] | ((args: CellInfo) => (string | ColumnIconOption)[]); } -interface IPivotLayoutDimensionHeadNode extends IPivotLayoutBaseHeadNode { +interface ITreeLayoutDimensionHeadNode extends ITreeLayoutBaseHeadNode { dimensionKey: string; } -interface IPivotLayoutIndicatorHeadNode extends IPivotLayoutBaseHeadNode { +interface ITreeLayoutIndicatorHeadNode extends ITreeLayoutBaseHeadNode { indicatorKey: string; } -export type IPivotLayoutHeadNode = Either; +export type ITreeLayoutHeadNode = Either; export class DimensionTree { sharedVar: { seqId: number }; // 每一个值对应的序号 结果缓存 @@ -58,7 +58,7 @@ export class DimensionTree { sizeIncludeParent = false; rowExpandLevel: number; hierarchyType: 'grid' | 'tree'; - tree: IPivotLayoutHeadNode = { + tree: ITreeLayoutHeadNode = { id: 0, dimensionKey: '', // title: '', @@ -83,7 +83,7 @@ export class DimensionTree { cache: Map = new Map(); constructor( - tree: IPivotLayoutHeadNode[], + tree: ITreeLayoutHeadNode[], sharedVar: { seqId: number }, hierarchyType: 'grid' | 'tree' = 'grid', rowExpandLevel: number = undefined @@ -95,20 +95,20 @@ export class DimensionTree { this.reset(tree); } - reset(tree: IPivotLayoutHeadNode[], updateTreeNode = false) { + reset(tree: ITreeLayoutHeadNode[], updateTreeNode = false) { // 清空缓存的计算 // this.cache = {}; // this.dimensions = dimensions; this.cache.clear(); this.dimensionKeys = new NumberMap(); - this.tree.children = tree as IPivotLayoutHeadNode[]; + this.tree.children = tree as ITreeLayoutHeadNode[]; // const re = { totalLevel: 0 }; // if (updateTreeNode) this.updateTreeNode(this.tree, 0, re, this.tree); // else this.setTreeNode(this.tree, 0, this.tree); this.totalLevel = this.dimensionKeys.count(); } - setTreeNode(node: IPivotLayoutHeadNode, startIndex: number, parent: IPivotLayoutHeadNode): number { + setTreeNode(node: ITreeLayoutHeadNode, startIndex: number, parent: ITreeLayoutHeadNode): number { node.startIndex = startIndex; node.startInTotal = (parent.startInTotal ?? 0) + node.startIndex; // if (node.dimensionKey) { @@ -173,14 +173,14 @@ export class DimensionTree { // startInTotal = parent.startIndex + prevStartIndex return size; } - getTreePath(index: number, maxDeep = 30): Array { + getTreePath(index: number, maxDeep = 30): Array { const path: any[] = []; this.searchPath(index, this.tree, path, maxDeep); path.shift(); return path; } - getTreePathByCellIds(ids: LayoutObjectId[]): Array { + getTreePathByCellIds(ids: LayoutObjectId[]): Array { const path: any[] = []; let nodes = this.tree.children; for (let i = 0; i < ids.length; i++) { @@ -196,12 +196,12 @@ export class DimensionTree { // path.shift(); return path; } - findNodeById(nodes: IPivotLayoutHeadNode[], id: LayoutObjectId) { + findNodeById(nodes: ITreeLayoutHeadNode[], id: LayoutObjectId) { return nodes.find(node => { return node.id === id; }); } - searchPath(index: number, node: IPivotLayoutHeadNode, path: Array, maxDeep: number) { + searchPath(index: number, node: ITreeLayoutHeadNode, path: Array, maxDeep: number) { if (!node) { return; } @@ -269,7 +269,7 @@ export class DimensionTree { */ movePosition(level: number, sourceIndex: number, targetIndex: number) { // let sourceNode: IPivotLayoutHeadNode; - let parNode: IPivotLayoutHeadNode; + let parNode: ITreeLayoutHeadNode; let sourceSubIndex: number; let targetSubIndex: number; /** @@ -279,7 +279,7 @@ export class DimensionTree { * @param subIndex * @returns */ - const findTargetNode = (node: IPivotLayoutHeadNode, subIndex: number) => { + const findTargetNode = (node: ITreeLayoutHeadNode, subIndex: number) => { if (sourceSubIndex !== undefined && targetSubIndex !== undefined) { return; } @@ -332,8 +332,8 @@ export type LayouTreeNode = { children?: LayouTreeNode[]; }; -export function generateLayoutTree(tree: LayouTreeNode[], children: IPivotLayoutHeadNode[]) { - children?.forEach((node: IPivotLayoutHeadNode) => { +export function generateLayoutTree(tree: LayouTreeNode[], children: ITreeLayoutHeadNode[]) { + children?.forEach((node: ITreeLayoutHeadNode) => { const diemnsonNode: { dimensionKey?: string; indicatorKey?: string; @@ -359,7 +359,7 @@ export function generateLayoutTree(tree: LayouTreeNode[], children: IPivotLayout //#region 为方法getLayoutRowTreeCount提的工具方法 export function countLayoutTree(children: { children?: any }[], countParentNode: boolean) { let count = 0; - children?.forEach((node: IPivotLayoutHeadNode) => { + children?.forEach((node: ITreeLayoutHeadNode) => { if (countParentNode) { count++; } else { @@ -376,7 +376,7 @@ export function countLayoutTree(children: { children?: any }[], countParentNode: //#endregion export function dealHeader( - hd: IPivotLayoutHeadNode, + hd: ITreeLayoutHeadNode, _headerCellIds: number[][], results: HeaderData[], roots: number[], @@ -489,9 +489,9 @@ export function dealHeader( } } - if ((hd as IPivotLayoutHeadNode).children?.length >= 1) { + if ((hd as ITreeLayoutHeadNode).children?.length >= 1) { layoutMap - ._addHeaders(_headerCellIds, row + ((hd as any).levelSpan ?? 1), (hd as IPivotLayoutHeadNode).children ?? [], [ + ._addHeaders(_headerCellIds, row + ((hd as any).levelSpan ?? 1), (hd as ITreeLayoutHeadNode).children ?? [], [ ...roots, ...Array((hd as any).levelSpan ?? 1).fill(id) ]) @@ -512,7 +512,7 @@ export function dealHeader( } export function dealHeaderForTreeMode( - hd: IPivotLayoutHeadNode, + hd: ITreeLayoutHeadNode, _headerCellIds: number[][], results: HeaderData[], roots: number[], @@ -588,14 +588,14 @@ export function dealHeaderForTreeMode( for (let r = row - 1; r >= 0; r--) { _headerCellIds[r][layoutMap.colIndex] = roots[r]; } - if (hd.hierarchyState === HierarchyState.expand && (hd as IPivotLayoutHeadNode).children?.length >= 1) { + if (hd.hierarchyState === HierarchyState.expand && (hd as ITreeLayoutHeadNode).children?.length >= 1) { //row传值 colIndex++和_addHeaders有区别 show && layoutMap.colIndex++; layoutMap ._addHeadersForTreeMode( _headerCellIds, row, - (hd as IPivotLayoutHeadNode).children ?? [], + (hd as ITreeLayoutHeadNode).children ?? [], [...roots, id], totalLevel, show && hd.hierarchyState === HierarchyState.expand, //当前节点show 且当前节点状态为展开 则传给子节点为show:true diff --git a/packages/vtable/src/layout/pivot-header-layout.ts b/packages/vtable/src/layout/pivot-header-layout.ts index a883a4098..41aa9b6cb 100644 --- a/packages/vtable/src/layout/pivot-header-layout.ts +++ b/packages/vtable/src/layout/pivot-header-layout.ts @@ -45,14 +45,8 @@ import { isCartesianChart, isHasCartesianChartInline } from './chart-helper/get-chart-spec'; -import type { LayouTreeNode, IPivotLayoutHeadNode } from './pivot-layout-helper'; -import { - DimensionTree, - countLayoutTree, - dealHeader, - dealHeaderForTreeMode, - generateLayoutTree -} from './pivot-layout-helper'; +import type { LayouTreeNode, ITreeLayoutHeadNode } from './layout-helper'; +import { DimensionTree, countLayoutTree, dealHeader, dealHeaderForTreeMode, generateLayoutTree } from './layout-helper'; import type { Dataset } from '../dataset/dataset'; import { cloneDeep, isArray, isValid } from '@visactor/vutils'; import type { TextStyle } from '../body-helper/style'; @@ -217,9 +211,9 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { this.indicatorKeys.push(indicator.indicatorKey); } }); - this.columnDimensionTree = new DimensionTree((this.columnTree as IPivotLayoutHeadNode[]) ?? [], this.sharedVar); + this.columnDimensionTree = new DimensionTree((this.columnTree as ITreeLayoutHeadNode[]) ?? [], this.sharedVar); this.rowDimensionTree = new DimensionTree( - (this.rowTree as IPivotLayoutHeadNode[]) ?? [], + (this.rowTree as ITreeLayoutHeadNode[]) ?? [], this.sharedVar, this.rowHierarchyType, this.rowHierarchyType === 'tree' ? this.rowExpandLevel : undefined @@ -471,7 +465,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { this.setColumnWidths(); } - _addHeaders(_headerCellIds: number[][], row: number, header: IPivotLayoutHeadNode[], roots: number[]): HeaderData[] { + _addHeaders(_headerCellIds: number[][], row: number, header: ITreeLayoutHeadNode[], roots: number[]): HeaderData[] { const _this = this; function _newRow(row: number): number[] { const newRow: number[] = (_headerCellIds[row] = []); @@ -498,7 +492,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { _addHeadersForTreeMode( _headerCellIds: number[][], row: number, - header: IPivotLayoutHeadNode[], + header: ITreeLayoutHeadNode[], roots: number[], totalLevel: number, show: boolean, @@ -1459,8 +1453,8 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { // console.log(`${col}-${row}`); const recordCol = this.getBodyIndexByCol(col); const recordRow = this.getBodyIndexByRow(row) + this.currentPageStartIndex; - let colPath: IPivotLayoutHeadNode[] = []; - let rowPath: IPivotLayoutHeadNode[] = []; + let colPath: ITreeLayoutHeadNode[] = []; + let rowPath: ITreeLayoutHeadNode[] = []; if (row >= 0 && recordCol >= 0) { colPath = this.columnDimensionTree.getTreePath( recordCol, @@ -1808,7 +1802,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { let row = 0; if (rowDimension) { row = this.columnHeaderLevelCount; - const { startInTotal, level } = rowDimension as IPivotLayoutHeadNode; + const { startInTotal, level } = rowDimension as ITreeLayoutHeadNode; row += startInTotal; if (this.rowHierarchyType === 'grid') { col = this.rowHeaderTitle ? level + 1 : level; @@ -1818,7 +1812,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { return { col, row }; } else if (colDimension) { col = this.rowHeaderLevelCount; - const { startInTotal, level } = colDimension as IPivotLayoutHeadNode; + const { startInTotal, level } = colDimension as ITreeLayoutHeadNode; col += startInTotal; row = this.columnHeaderTitle ? level + 1 : level; return { col, row }; @@ -2247,7 +2241,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { // 通过dimension获取col和row if (rowDimensionFinded || forceBody) { row = this.columnHeaderLevelCount; - const { startInTotal, level } = (rowDimensionFinded as IPivotLayoutHeadNode) ?? defaultDimension; + const { startInTotal, level } = (rowDimensionFinded as ITreeLayoutHeadNode) ?? defaultDimension; row += startInTotal ?? 0; if (this.rowHierarchyType === 'grid') { defaultCol = this.rowHeaderTitle ? level + 1 : level; @@ -2257,7 +2251,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { } if (colDimensionFinded || forceBody) { col = this.rowHeaderLevelCount; - const { startInTotal, level } = (colDimensionFinded as IPivotLayoutHeadNode) ?? defaultDimension; + const { startInTotal, level } = (colDimensionFinded as ITreeLayoutHeadNode) ?? defaultDimension; col += startInTotal ?? 0; defaultRow = this.columnHeaderTitle ? level + 1 : level; } diff --git a/packages/vtable/src/layout/simple-header-layout.ts b/packages/vtable/src/layout/simple-header-layout.ts index a841e3734..ffecfe47c 100644 --- a/packages/vtable/src/layout/simple-header-layout.ts +++ b/packages/vtable/src/layout/simple-header-layout.ts @@ -12,7 +12,7 @@ import type { WidthData } from '../ts-types/list-table/layout-map/api'; import { checkHasChart, getChartDataId } from './chart-helper/get-chart-spec'; -import { DimensionTree } from './pivot-layout-helper'; +import { DimensionTree } from './layout-helper'; // import { EmptyDataCache } from './utils'; // let seqId = 0; From cc74a2e4b0808e904997288772720c612e902700 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Tue, 30 Jan 2024 12:07:41 +0800 Subject: [PATCH 054/115] fix: select region saved problem #1018 --- packages/vtable/src/state/select/update-position.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/vtable/src/state/select/update-position.ts b/packages/vtable/src/state/select/update-position.ts index 05fd34936..aa6006157 100644 --- a/packages/vtable/src/state/select/update-position.ts +++ b/packages/vtable/src/state/select/update-position.ts @@ -136,7 +136,10 @@ export function updateSelectPosition( }); } else if (col >= 0 && row >= 0) { const cellRange = table.getCellRange(col, row); - state.select.ranges.push(cellRange); + state.select.ranges.push({ + start: { col: cellRange.start.col, row: cellRange.start.row }, + end: { col: cellRange.end.col, row: cellRange.end.row } + }); } cellPos.col = col; cellPos.row = row; From 5af5f9733d7442b059fcbab509946d82497938cc Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Tue, 30 Jan 2024 12:08:06 +0800 Subject: [PATCH 055/115] docs: update changlog of rush --- .../1018-bug-selectRegion_2024-01-30-04-08.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vtable/1018-bug-selectRegion_2024-01-30-04-08.json diff --git a/common/changes/@visactor/vtable/1018-bug-selectRegion_2024-01-30-04-08.json b/common/changes/@visactor/vtable/1018-bug-selectRegion_2024-01-30-04-08.json new file mode 100644 index 000000000..b2b57cd4b --- /dev/null +++ b/common/changes/@visactor/vtable/1018-bug-selectRegion_2024-01-30-04-08.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: select region saved problem #1018\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file From 65bc3d51880b88fd52ae0e8bc925494ac02b7962 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Tue, 30 Jan 2024 14:54:49 +0800 Subject: [PATCH 056/115] fix: when call updateColumns and discount col occor error #1015 --- .../progress/update-position/dynamic-set-x.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/vtable/src/scenegraph/group-creater/progress/update-position/dynamic-set-x.ts b/packages/vtable/src/scenegraph/group-creater/progress/update-position/dynamic-set-x.ts index ab2413a39..f0f15a779 100644 --- a/packages/vtable/src/scenegraph/group-creater/progress/update-position/dynamic-set-x.ts +++ b/packages/vtable/src/scenegraph/group-creater/progress/update-position/dynamic-set-x.ts @@ -92,7 +92,11 @@ async function moveColumn( proxy.table.scenegraph.proxy.deltaX += deltaX; proxy.currentCol = direction === 'left' ? proxy.currentCol + count : proxy.currentCol - count; - proxy.totalCol = direction === 'left' ? proxy.totalCol + count : proxy.totalCol - count; + proxy.totalCol = Math.max( + 0, + Math.min(proxy.table.colCount - 1, direction === 'left' ? proxy.totalCol + count : proxy.totalCol - count) + ); + proxy.referenceCol = proxy.colStart + Math.floor((proxy.colEnd - proxy.colStart) / 2); proxy.colUpdatePos = distStartCol; proxy.colUpdateDirection = direction; @@ -147,7 +151,10 @@ async function moveColumn( } proxy.currentCol = direction === 'left' ? proxy.currentCol + count : proxy.currentCol - count; - proxy.totalCol = direction === 'left' ? proxy.totalCol + count : proxy.totalCol - count; + proxy.totalCol = Math.max( + 0, + Math.min(proxy.table.colCount - 1, direction === 'left' ? proxy.totalCol + count : proxy.totalCol - count) + ); proxy.referenceCol = proxy.colStart + Math.floor((proxy.colEnd - proxy.colStart) / 2); proxy.colUpdatePos = proxy.colStart; proxy.colUpdateDirection = distEndCol > proxy.bodyRightCol - (proxy.colEnd - proxy.colStart + 1) ? 'right' : 'left'; From bbc639a125a405a5cc96bbf4c8138b9ed801c99e Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Tue, 30 Jan 2024 14:55:09 +0800 Subject: [PATCH 057/115] docs: update changlog of rush --- .../1018-bug-selectRegion_2024-01-30-06-55.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vtable/1018-bug-selectRegion_2024-01-30-06-55.json diff --git a/common/changes/@visactor/vtable/1018-bug-selectRegion_2024-01-30-06-55.json b/common/changes/@visactor/vtable/1018-bug-selectRegion_2024-01-30-06-55.json new file mode 100644 index 000000000..95f9b5624 --- /dev/null +++ b/common/changes/@visactor/vtable/1018-bug-selectRegion_2024-01-30-06-55.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: when call updateColumns and discount col occor error #1015\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file From d100409520abad06e16cdddbec33fec52970bc63 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Tue, 30 Jan 2024 17:07:36 +0800 Subject: [PATCH 058/115] fix: empty string compute row height error #1031 --- packages/vtable/src/core/BaseTable.ts | 2 +- packages/vtable/src/scenegraph/layout/compute-row-height.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vtable/src/core/BaseTable.ts b/packages/vtable/src/core/BaseTable.ts index 29d219cff..f72189d6f 100644 --- a/packages/vtable/src/core/BaseTable.ts +++ b/packages/vtable/src/core/BaseTable.ts @@ -909,7 +909,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { // : this.defaultHeaderRowHeight // : this.internalProps.defaultRowHeight) // ); - if (this.rowHeightsMap.get(row)) { + if (isValid(this.rowHeightsMap.get(row))) { return this.rowHeightsMap.get(row); } const defaultHeight = this.getDefaultRowHeight(row); diff --git a/packages/vtable/src/scenegraph/layout/compute-row-height.ts b/packages/vtable/src/scenegraph/layout/compute-row-height.ts index 9473e3523..c964033a0 100644 --- a/packages/vtable/src/scenegraph/layout/compute-row-height.ts +++ b/packages/vtable/src/scenegraph/layout/compute-row-height.ts @@ -695,7 +695,7 @@ function computeTextHeight(col: number, row: number, cellType: ColumnTypeOption, wordBreak: 'break-word', whiteSpace: lines.length === 1 && !autoWrapText ? 'no-wrap' : 'normal' }); - maxHeight = utilTextMark.AABBBounds.height(); + maxHeight = utilTextMark.AABBBounds.height() || (typeof lineHeight === 'number' ? lineHeight : fontSize); } else { // autoWrapText = false maxHeight = lines.length * lineHeight; From 0f54295cd4c63c9bf7c3140cf6ff546ab80deb18 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Tue, 30 Jan 2024 17:08:01 +0800 Subject: [PATCH 059/115] docs: update changlog of rush --- ...mpty-string-computeRowHeight_2024-01-30-09-08.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vtable/1031-bug-empty-string-computeRowHeight_2024-01-30-09-08.json diff --git a/common/changes/@visactor/vtable/1031-bug-empty-string-computeRowHeight_2024-01-30-09-08.json b/common/changes/@visactor/vtable/1031-bug-empty-string-computeRowHeight_2024-01-30-09-08.json new file mode 100644 index 000000000..5ba015073 --- /dev/null +++ b/common/changes/@visactor/vtable/1031-bug-empty-string-computeRowHeight_2024-01-30-09-08.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: empty string compute row height error #1031\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file From b894f929fa3f664b8b9f8c3a7acfae80e4da21c0 Mon Sep 17 00:00:00 2001 From: martes Date: Wed, 31 Jan 2024 10:31:42 +0800 Subject: [PATCH 060/115] docs: update process pic --- docs/assets/guide/en/edit/edit_cell.md | 2 +- docs/assets/guide/zh/edit/edit_cell.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/assets/guide/en/edit/edit_cell.md b/docs/assets/guide/en/edit/edit_cell.md index 138a37607..1d1c663a3 100644 --- a/docs/assets/guide/en/edit/edit_cell.md +++ b/docs/assets/guide/en/edit/edit_cell.md @@ -67,7 +67,7 @@ If the several editors provided by the VTable-ediotrs library cannot meet your n You can use the following flow chart to understand the relationship between the editor and VTable: -![image](https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/guide/editCellProcess.png) +![image](https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/guide/editCellProcess1.png) The following is sample code for a custom editor: diff --git a/docs/assets/guide/zh/edit/edit_cell.md b/docs/assets/guide/zh/edit/edit_cell.md index 559bdbbc0..7e86a5c39 100644 --- a/docs/assets/guide/zh/edit/edit_cell.md +++ b/docs/assets/guide/zh/edit/edit_cell.md @@ -76,7 +76,7 @@ interface ColumnDefine { 可以结合下面这个流程图来理解编辑器和VTable之间的关系: -![image](https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/guide/editCellProcess.png) +![image](https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/guide/editCellProcess1.png) 以下是一个自定义编辑器的示例代码: From cf62c277a7af6b4d574610fa9178c69683ce72a5 Mon Sep 17 00:00:00 2001 From: martes Date: Wed, 31 Jan 2024 15:46:51 +0800 Subject: [PATCH 061/115] fix: replace reference of source code --- packages/react-vtable/src/eventsUtils.ts | 96 ++++++++++++------------ 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/packages/react-vtable/src/eventsUtils.ts b/packages/react-vtable/src/eventsUtils.ts index 85ab9629d..487eaaad4 100644 --- a/packages/react-vtable/src/eventsUtils.ts +++ b/packages/react-vtable/src/eventsUtils.ts @@ -1,6 +1,6 @@ import { ListTable, PivotTable, PivotChart } from '@visactor/vtable'; import type { IVTable } from './tables/base-table'; -import type { TableEventHandlersEventArgumentMap } from '@visactor/vtable/src/ts-types'; +import type { TYPES } from '@visactor/vtable'; export type EventCallback = (params: Params) => void; @@ -11,56 +11,56 @@ const EVENT_TYPE = { }; export interface EventsProps { - onClickCell?: EventCallback; - onDblClickCell?: EventCallback; - onMouseDownCell?: EventCallback; - onMouseUpCell?: EventCallback; - onSelectedCell?: EventCallback; - onKeyDown?: EventCallback; - onMouseEnterTable?: EventCallback; - onMouseLeaveTable?: EventCallback; - onMouseMoveCell?: EventCallback; - onMouseEnterCell?: EventCallback; - onMouseLeaveCell?: EventCallback; - onContextMenuCell?: EventCallback; - onResizeColumn?: EventCallback; - onResizeColumnEnd?: EventCallback; - onChangeHeaderPosition?: EventCallback; - onSortClick?: EventCallback; - onFreezeClick?: EventCallback; - onScroll?: EventCallback; - onDropdownMenuClick?: EventCallback; - onMouseOverChartSymbol?: EventCallback; - onDragSelectEnd?: EventCallback; - - onDropdownIconClick?: EventCallback; - onDropdownMenuClear?: EventCallback; - - onTreeHierarchyStateChange?: EventCallback; - - onShowMenu?: EventCallback; - onHideMenu?: EventCallback; - - onIconClick?: EventCallback; - - onLegendItemClick?: EventCallback; - onLegendItemHover?: EventCallback; - onLegendItemUnHover?: EventCallback; - onLegendChange?: EventCallback; - - onMouseEnterAxis?: EventCallback; - onMouseLeaveAxis?: EventCallback; - - onCheckboxStateChange?: EventCallback; - onAfterRender?: EventCallback; - onInitialized?: EventCallback; + onClickCell?: EventCallback; + onDblClickCell?: EventCallback; + onMouseDownCell?: EventCallback; + onMouseUpCell?: EventCallback; + onSelectedCell?: EventCallback; + onKeyDown?: EventCallback; + onMouseEnterTable?: EventCallback; + onMouseLeaveTable?: EventCallback; + onMouseMoveCell?: EventCallback; + onMouseEnterCell?: EventCallback; + onMouseLeaveCell?: EventCallback; + onContextMenuCell?: EventCallback; + onResizeColumn?: EventCallback; + onResizeColumnEnd?: EventCallback; + onChangeHeaderPosition?: EventCallback; + onSortClick?: EventCallback; + onFreezeClick?: EventCallback; + onScroll?: EventCallback; + onDropdownMenuClick?: EventCallback; + onMouseOverChartSymbol?: EventCallback; + onDragSelectEnd?: EventCallback; + + onDropdownIconClick?: EventCallback; + onDropdownMenuClear?: EventCallback; + + onTreeHierarchyStateChange?: EventCallback; + + onShowMenu?: EventCallback; + onHideMenu?: EventCallback; + + onIconClick?: EventCallback; + + onLegendItemClick?: EventCallback; + onLegendItemHover?: EventCallback; + onLegendItemUnHover?: EventCallback; + onLegendChange?: EventCallback; + + onMouseEnterAxis?: EventCallback; + onMouseLeaveAxis?: EventCallback; + + onCheckboxStateChange?: EventCallback; + onAfterRender?: EventCallback; + onInitialized?: EventCallback; // pivot table only - onPivotSortClick?: EventCallback; - onDrillMenuClick?: EventCallback; + onPivotSortClick?: EventCallback; + onDrillMenuClick?: EventCallback; // pivot chart only - onVChartEventType?: EventCallback; + onVChartEventType?: EventCallback; } export const TABLE_EVENTS = { @@ -157,7 +157,7 @@ export const bindEventsToTable = ( if (newEventProps) { Object.keys(newEventProps).forEach(eventKey => { if (!prevEventProps || !prevEventProps[eventKey] || prevEventProps[eventKey] !== newEventProps[eventKey]) { - table.on(supportedEvents[eventKey] as keyof TableEventHandlersEventArgumentMap, newEventProps[eventKey]); + table.on(supportedEvents[eventKey] as keyof TYPES.TableEventHandlersEventArgumentMap, newEventProps[eventKey]); } }); } From f09409378b8ef7e74a32b899719ba3c06b164ded Mon Sep 17 00:00:00 2001 From: martes Date: Wed, 31 Jan 2024 15:53:17 +0800 Subject: [PATCH 062/115] docs: update definition in docs. --- .../guide/en/Developer_Ecology/react.md | 94 +++++++++---------- .../guide/zh/Developer_Ecology/react.md | 94 +++++++++---------- 2 files changed, 94 insertions(+), 94 deletions(-) diff --git a/docs/assets/guide/en/Developer_Ecology/react.md b/docs/assets/guide/en/Developer_Ecology/react.md index c5375a68a..a1e08adb0 100644 --- a/docs/assets/guide/en/Developer_Ecology/react.md +++ b/docs/assets/guide/en/Developer_Ecology/react.md @@ -143,7 +143,7 @@ The props attributes accepted by PivotTable&PivotChart are the same as options. - PivotColumnHeaderTitle: column header title configuration, consistent with the definition of columnHeaderTitle in option [api](../../option/PivotTable#rowHeaderTitle) - PivotRowHeaderTitle: row header title configuration, consistent with the definition of rowHeaderTitle in option [api](../../option/PivotTable#columnHeaderTitle) - PivotCorner: Corner configuration, consistent with the definition of corner in option [api](../../option/PivotTable#corner) - + ```jsx return ( ; - onDblClickCell?: EventCallback; - onMouseDownCell?: EventCallback; - onMouseUpCell?: EventCallback; - onSelectedCell?: EventCallback; - onKeyDown?: EventCallback; - onMouseEnterTable?: EventCallback; - onMouseLeaveTable?: EventCallback; - onMouseMoveCell?: EventCallback; - onMouseEnterCell?: EventCallback; - onMouseLeaveCell?: EventCallback; - onContextMenuCell?: EventCallback; - onResizeColumn?: EventCallback; - onResizeColumnEnd?: EventCallback; - onChangeHeaderPosition?: EventCallback; - onSortClick?: EventCallback; - onFreezeClick?: EventCallback; - onScroll?: EventCallback; - onDropdownMenuClick?: EventCallback; - onMouseOverChartSymbol?: EventCallback; - onDragSelectEnd?: EventCallback; - - onDropdownIconClick?: EventCallback; - onDropdownMenuClear?: EventCallback; - - onTreeHierarchyStateChange?: EventCallback; - - onShowMenu?: EventCallback; - onHideMenu?: EventCallback; - - onIconClick?: EventCallback; - - onLegendItemClick?: EventCallback; - onLegendItemHover?: EventCallback; - onLegendItemUnHover?: EventCallback; - onLegendChange?: EventCallback; - - onMouseEnterAxis?: EventCallback; - onMouseLeaveAxis?: EventCallback; - - onCheckboxStateChange?: EventCallback; - onAfterRender?: EventCallback; - onInitialized?: EventCallback; + onClickCell?: EventCallback; + onDblClickCell?: EventCallback; + onMouseDownCell?: EventCallback; + onMouseUpCell?: EventCallback; + onSelectedCell?: EventCallback; + onKeyDown?: EventCallback; + onMouseEnterTable?: EventCallback; + onMouseLeaveTable?: EventCallback; + onMouseMoveCell?: EventCallback; + onMouseEnterCell?: EventCallback; + onMouseLeaveCell?: EventCallback; + onContextMenuCell?: EventCallback; + onResizeColumn?: EventCallback; + onResizeColumnEnd?: EventCallback; + onChangeHeaderPosition?: EventCallback; + onSortClick?: EventCallback; + onFreezeClick?: EventCallback; + onScroll?: EventCallback; + onDropdownMenuClick?: EventCallback; + onMouseOverChartSymbol?: EventCallback; + onDragSelectEnd?: EventCallback; + + onDropdownIconClick?: EventCallback; + onDropdownMenuClear?: EventCallback; + + onTreeHierarchyStateChange?: EventCallback; + + onShowMenu?: EventCallback; + onHideMenu?: EventCallback; + + onIconClick?: EventCallback; + + onLegendItemClick?: EventCallback; + onLegendItemHover?: EventCallback; + onLegendItemUnHover?: EventCallback; + onLegendChange?: EventCallback; + + onMouseEnterAxis?: EventCallback; + onMouseLeaveAxis?: EventCallback; + + onCheckboxStateChange?: EventCallback; + onAfterRender?: EventCallback; + onInitialized?: EventCallback; // pivot table only - onPivotSortClick?: EventCallback; - onDrillMenuClick?: EventCallback; + onPivotSortClick?: EventCallback; + onDrillMenuClick?: EventCallback; // pivot chart only - onVChartEventType?: EventCallback; + onVChartEventType?: EventCallback; } ``` diff --git a/docs/assets/guide/zh/Developer_Ecology/react.md b/docs/assets/guide/zh/Developer_Ecology/react.md index 9907858ff..18343bf79 100644 --- a/docs/assets/guide/zh/Developer_Ecology/react.md +++ b/docs/assets/guide/zh/Developer_Ecology/react.md @@ -143,7 +143,7 @@ PivotTable&PivotChart接受的props属性与option一致,子组件如下: - PivotColumnHeaderTitle: 列表头标题配置,同option中的columnHeaderTitle的定义一致 [api](../../option/PivotTable#rowHeaderTitle) - PivotRowHeaderTitle: 行头标题配置,同option中的rowHeaderTitle的定义一致 [api](../../option/PivotTable#columnHeaderTitle) - PivotCorner: 角头配置,同option中的corner的定义一致 [api](../../option/PivotTable#corner) - + ```jsx return ( ; - onDblClickCell?: EventCallback; - onMouseDownCell?: EventCallback; - onMouseUpCell?: EventCallback; - onSelectedCell?: EventCallback; - onKeyDown?: EventCallback; - onMouseEnterTable?: EventCallback; - onMouseLeaveTable?: EventCallback; - onMouseMoveCell?: EventCallback; - onMouseEnterCell?: EventCallback; - onMouseLeaveCell?: EventCallback; - onContextMenuCell?: EventCallback; - onResizeColumn?: EventCallback; - onResizeColumnEnd?: EventCallback; - onChangeHeaderPosition?: EventCallback; - onSortClick?: EventCallback; - onFreezeClick?: EventCallback; - onScroll?: EventCallback; - onDropdownMenuClick?: EventCallback; - onMouseOverChartSymbol?: EventCallback; - onDragSelectEnd?: EventCallback; - - onDropdownIconClick?: EventCallback; - onDropdownMenuClear?: EventCallback; - - onTreeHierarchyStateChange?: EventCallback; - - onShowMenu?: EventCallback; - onHideMenu?: EventCallback; - - onIconClick?: EventCallback; - - onLegendItemClick?: EventCallback; - onLegendItemHover?: EventCallback; - onLegendItemUnHover?: EventCallback; - onLegendChange?: EventCallback; - - onMouseEnterAxis?: EventCallback; - onMouseLeaveAxis?: EventCallback; - - onCheckboxStateChange?: EventCallback; - onAfterRender?: EventCallback; - onInitialized?: EventCallback; + onClickCell?: EventCallback; + onDblClickCell?: EventCallback; + onMouseDownCell?: EventCallback; + onMouseUpCell?: EventCallback; + onSelectedCell?: EventCallback; + onKeyDown?: EventCallback; + onMouseEnterTable?: EventCallback; + onMouseLeaveTable?: EventCallback; + onMouseMoveCell?: EventCallback; + onMouseEnterCell?: EventCallback; + onMouseLeaveCell?: EventCallback; + onContextMenuCell?: EventCallback; + onResizeColumn?: EventCallback; + onResizeColumnEnd?: EventCallback; + onChangeHeaderPosition?: EventCallback; + onSortClick?: EventCallback; + onFreezeClick?: EventCallback; + onScroll?: EventCallback; + onDropdownMenuClick?: EventCallback; + onMouseOverChartSymbol?: EventCallback; + onDragSelectEnd?: EventCallback; + + onDropdownIconClick?: EventCallback; + onDropdownMenuClear?: EventCallback; + + onTreeHierarchyStateChange?: EventCallback; + + onShowMenu?: EventCallback; + onHideMenu?: EventCallback; + + onIconClick?: EventCallback; + + onLegendItemClick?: EventCallback; + onLegendItemHover?: EventCallback; + onLegendItemUnHover?: EventCallback; + onLegendChange?: EventCallback; + + onMouseEnterAxis?: EventCallback; + onMouseLeaveAxis?: EventCallback; + + onCheckboxStateChange?: EventCallback; + onAfterRender?: EventCallback; + onInitialized?: EventCallback; // pivot table only - onPivotSortClick?: EventCallback; - onDrillMenuClick?: EventCallback; + onPivotSortClick?: EventCallback; + onDrillMenuClick?: EventCallback; // pivot chart only - onVChartEventType?: EventCallback; + onVChartEventType?: EventCallback; } ``` From 3a3a779d855497e5a8e26d4a5b8e8375c6d975b1 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Wed, 31 Jan 2024 18:02:58 +0800 Subject: [PATCH 063/115] fix: fix height range index --- packages/vtable/src/core/BaseTable.ts | 5 ++++- packages/vtable/src/layout/row-height-map.ts | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/vtable/src/core/BaseTable.ts b/packages/vtable/src/core/BaseTable.ts index 5360fb319..0c98bb4be 100644 --- a/packages/vtable/src/core/BaseTable.ts +++ b/packages/vtable/src/core/BaseTable.ts @@ -840,7 +840,8 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { * @returns */ getColsWidth(startCol: number, endCol: number): number { - endCol = Math.min(endCol, this.colCount - 1); // endCol最大为this.colCount - 1,超过会导致width计算为NaN + startCol = Math.max(startCol, 0); + endCol = Math.min(endCol, (this.colCount ?? Infinity) - 1); // endCol最大为this.colCount - 1,超过会导致width计算为NaN //通过缓存获取指定范围列宽 const cachedColWidth = this._colRangeWidthsMap.get(`$${startCol}$${endCol}`); if (cachedColWidth !== null && cachedColWidth !== undefined) { @@ -956,6 +957,8 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { * @returns */ getRowsHeight(startRow: number, endRow: number): number { + startRow = Math.max(startRow, 0); + endRow = Math.min(endRow, (this.rowCount ?? Infinity) - 1); //通过缓存获取指定范围行高 // const cachedRowHeight = this._rowRangeHeightsMap.get(`$${startRow}$${endRow}`); // if (cachedRowHeight !== null && cachedRowHeight !== undefined) { diff --git a/packages/vtable/src/layout/row-height-map.ts b/packages/vtable/src/layout/row-height-map.ts index a856bfd2f..35fd4e599 100644 --- a/packages/vtable/src/layout/row-height-map.ts +++ b/packages/vtable/src/layout/row-height-map.ts @@ -116,6 +116,9 @@ export class NumberRangeMap { } calculatePrefixSum(position: number) { + if (position < 0) { + return 0; + } if (this.cumulativeSum.has(position)) { let cache = this.cumulativeSum.get(position); for (const [pos, difference] of this.difference) { From 6d33cfe7d627922c4b2496e9d57e566472962dc5 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Wed, 31 Jan 2024 17:33:30 +0800 Subject: [PATCH 064/115] feat: update vrender version --- common/config/rush/pnpm-lock.yaml | 30 +++++++++++++++--------------- packages/vtable/package.json | 6 +++--- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index b331198a8..c968ef65a 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -181,9 +181,9 @@ importers: '@types/react-dom': ^18.0.0 '@visactor/vchart': 1.9.0 '@visactor/vdataset': ~0.17.1 - '@visactor/vrender-components': 0.17.19-alpha.1 - '@visactor/vrender-core': 0.17.19-alpha.1 - '@visactor/vrender-kits': 0.17.19-alpha.1 + '@visactor/vrender-components': 0.17.20-alpha.1 + '@visactor/vrender-core': 0.17.20-alpha.1 + '@visactor/vrender-kits': 0.17.20-alpha.1 '@visactor/vscale': ~0.17.1 '@visactor/vtable-editors': workspace:* '@visactor/vutils': ~0.17.1 @@ -226,9 +226,9 @@ importers: vite-plugin-markdown: ^2.1.0 dependencies: '@visactor/vdataset': 0.17.4 - '@visactor/vrender-components': 0.17.19-alpha.1 - '@visactor/vrender-core': 0.17.19-alpha.1 - '@visactor/vrender-kits': 0.17.19-alpha.1 + '@visactor/vrender-components': 0.17.20-alpha.1 + '@visactor/vrender-core': 0.17.20-alpha.1 + '@visactor/vrender-kits': 0.17.20-alpha.1 '@visactor/vscale': 0.17.4 '@visactor/vtable-editors': link:../vtable-editors '@visactor/vutils': 0.17.4 @@ -3468,11 +3468,11 @@ packages: '@visactor/vscale': 0.17.4 '@visactor/vutils': 0.17.4 - /@visactor/vrender-components/0.17.19-alpha.1: - resolution: {integrity: sha512-86oJ8Jg4nKLHsAwNzAmk/54SdC6gx2d5Y7Cn0x6Q7hpsjb3eWrcjS8g8rHPp8HOn3Bl/mphGK5DHrpk3ZSjA0Q==} + /@visactor/vrender-components/0.17.20-alpha.1: + resolution: {integrity: sha512-VkT5RFYYbS6YmYnFAgoRlEoeKtvoryFG2vwPM5X0wrYOpZvTbXuvOAgNKHawxV1UtkeHfVHe1ZY9I5+qvwZQtA==} dependencies: - '@visactor/vrender-core': 0.17.19-alpha.1 - '@visactor/vrender-kits': 0.17.19-alpha.1 + '@visactor/vrender-core': 0.17.20-alpha.1 + '@visactor/vrender-kits': 0.17.20-alpha.1 '@visactor/vscale': 0.17.4 '@visactor/vutils': 0.17.4 dev: false @@ -3490,8 +3490,8 @@ packages: '@visactor/vutils': 0.17.4 color-convert: 2.0.1 - /@visactor/vrender-core/0.17.19-alpha.1: - resolution: {integrity: sha512-9io+5xdvxWF4i9sr1P4W9i2PjaAqfTCnMUKC1rDl3CLzreqVCl9NA0UKqItv4OFhTCmcH7zwJzgUSjamJvbJPQ==} + /@visactor/vrender-core/0.17.20-alpha.1: + resolution: {integrity: sha512-GdmRx2PeV52sW6YB5LL6u2jwj3s/INfHXAY6WVM7mouQE9lDt0EObQJJxIbf55ztPwyJBXaaD1AZ8qIZwle87w==} dependencies: '@visactor/vutils': 0.17.4 color-convert: 2.0.1 @@ -3514,11 +3514,11 @@ packages: '@visactor/vutils': 0.17.4 roughjs: 4.5.2 - /@visactor/vrender-kits/0.17.19-alpha.1: - resolution: {integrity: sha512-O0lrvTIBZgPULCEtWqBxXZ47cQqjLtYs4MhqoFiLjrQr9VTBxomOyGAZDq08YLAfNFgQFRjiaWBeTi3JIyfxfQ==} + /@visactor/vrender-kits/0.17.20-alpha.1: + resolution: {integrity: sha512-0jRe6ayjlR7vZWDQ4dYYICsnzzG7IK9UnqIasGnmjW7D8ZpMaSM1PcodiAOBLy8ELnF4gYbF1Uady/OpDdD6TQ==} dependencies: '@resvg/resvg-js': 2.4.1 - '@visactor/vrender-core': 0.17.19-alpha.1 + '@visactor/vrender-core': 0.17.20-alpha.1 '@visactor/vutils': 0.17.4 roughjs: 4.5.2 dev: false diff --git a/packages/vtable/package.json b/packages/vtable/package.json index cc59075b6..ad258d4a5 100644 --- a/packages/vtable/package.json +++ b/packages/vtable/package.json @@ -50,9 +50,9 @@ }, "dependencies": { "@visactor/vtable-editors": "workspace:*", - "@visactor/vrender-core": "0.17.19-alpha.1", - "@visactor/vrender-kits": "0.17.19-alpha.1", - "@visactor/vrender-components": "0.17.19-alpha.1", + "@visactor/vrender-core": "0.17.20-alpha.1", + "@visactor/vrender-kits": "0.17.20-alpha.1", + "@visactor/vrender-components": "0.17.20-alpha.1", "@visactor/vutils-extension": "~1.8.5", "@visactor/vutils": "~0.17.1", "@visactor/vscale": "~0.17.1", From bdb341268a285fdc23e30f1eccf315e4a4428577 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Tue, 30 Jan 2024 18:52:34 +0800 Subject: [PATCH 065/115] docs: update vue guide --- docs/assets/guide/en/Developer_Ecology/vue.md | 12 +++++++++++- docs/assets/guide/zh/Developer_Ecology/vue.md | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/docs/assets/guide/en/Developer_Ecology/vue.md b/docs/assets/guide/en/Developer_Ecology/vue.md index a2eba0c42..ddb2ee243 100644 --- a/docs/assets/guide/en/Developer_Ecology/vue.md +++ b/docs/assets/guide/en/Developer_Ecology/vue.md @@ -2,7 +2,7 @@ In Vue 3.x, using VTable -Composition API, you can refer to[ the online demo ](https://codesandbox.io/p/devbox/vchart-demo-vue-73h8wl)for details. +Composition API, you can refer to[ the online demo ](https://codesandbox.io/p/devbox/magical-nash-t6t33f)for details. ## Code Example @@ -136,4 +136,14 @@ onMounted(() => { }); +``` + +## Notice + +If you need to use ref to save table instances, please use `shallowRef`. Using `ref` will affect internal attribute updates and cause rendering exceptions. + + +``` +const tableInstance = shallowRef(); +tableInstance.value = new ListTable(listTableRef.value, option); ``` \ No newline at end of file diff --git a/docs/assets/guide/zh/Developer_Ecology/vue.md b/docs/assets/guide/zh/Developer_Ecology/vue.md index 72607f95c..957ff6bb6 100644 --- a/docs/assets/guide/zh/Developer_Ecology/vue.md +++ b/docs/assets/guide/zh/Developer_Ecology/vue.md @@ -2,7 +2,7 @@ 在 Vue 3.x 中使用 Vtable -组合式 API,具体可以[参考在线 demo](https://codesandbox.io/p/devbox/vchart-demo-vue-73h8wl) +组合式 API,具体可以[参考在线 demo](https://codesandbox.io/p/devbox/magical-nash-t6t33f) ## 代码示例 @@ -136,3 +136,13 @@ onMounted(() => { ``` + +## 注意 + +如果需要使用ref保存table实例,请使用`shallowRef`,使用`ref`会影响内部属性更新,导致渲染异常。 + + +``` +const tableInstance = shallowRef(); +tableInstance.value = new ListTable(listTableRef.value, option); +``` \ No newline at end of file From 174ca0e290e56fa6a8aff4899dbf572fd81bae13 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Wed, 31 Jan 2024 18:12:00 +0800 Subject: [PATCH 066/115] docs: update faq about vue --- docs/assets/faq/en/20-How to use VTable in Vue.md | 2 +- docs/assets/faq/zh/20-How to use VTable in Vue.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/assets/faq/en/20-How to use VTable in Vue.md b/docs/assets/faq/en/20-How to use VTable in Vue.md index fbb8e0845..e22fa1a96 100644 --- a/docs/assets/faq/en/20-How to use VTable in Vue.md +++ b/docs/assets/faq/en/20-How to use VTable in Vue.md @@ -8,7 +8,7 @@ VTable does not encapsulate the Vue component, so how do you VTable in Vue? In Vue 3.x, using VTable -Composition API, you can refer to[ the online demo ](https://codesandbox.io/p/sandbox/mystifying-hamilton-3wl76r?file=%2Fsrc%2Fcomponents%2FPivotChart.vue%3A9339%2C1)for details. +Composition API, you can refer to[ the online demo ](https://codesandbox.io/p/devbox/magical-nash-t6t33f)for details. ## Code Example diff --git a/docs/assets/faq/zh/20-How to use VTable in Vue.md b/docs/assets/faq/zh/20-How to use VTable in Vue.md index b0b274411..4695a7e62 100644 --- a/docs/assets/faq/zh/20-How to use VTable in Vue.md +++ b/docs/assets/faq/zh/20-How to use VTable in Vue.md @@ -8,7 +8,7 @@ VTable没有封装Vue组件,那么如何在 Vue 中VTable呢? 在 Vue 3.x 中使用 Vtable -组合式 API,具体可以[参考在线 demo](https://codesandbox.io/p/sandbox/mystifying-hamilton-3wl76r?file=%2Fsrc%2Fcomponents%2FPivotChart.vue%3A9339%2C1) +组合式 API,具体可以[参考在线 demo](https://codesandbox.io/p/devbox/magical-nash-t6t33f) 不同的表格,封装方式都是类似的 From 2de5af35abefd176a24cdc9ff34311fab44f6272 Mon Sep 17 00:00:00 2001 From: martes Date: Wed, 31 Jan 2024 18:48:19 +0800 Subject: [PATCH 067/115] fix: only apply `onClickElsewhere` while `targetIsOnEditor` is not provided. --- packages/vtable/src/edit/edit-manager.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/vtable/src/edit/edit-manager.ts b/packages/vtable/src/edit/edit-manager.ts index f5afc86d4..4267c6a69 100644 --- a/packages/vtable/src/edit/edit-manager.ts +++ b/packages/vtable/src/edit/edit-manager.ts @@ -110,9 +110,7 @@ export class EditManeger { if (target && this.editingEditor.targetIsOnEditor(target)) { return; } - } - - if (!this.editingEditor.onClickElsewhere || (target && this.editingEditor.onClickElsewhere?.(target))) { + } else if (!this.editingEditor.onClickElsewhere || (target && this.editingEditor.onClickElsewhere?.(target))) { return; } From 5248186da786a64b707b807173320bafa23704c0 Mon Sep 17 00:00:00 2001 From: martes Date: Thu, 1 Feb 2024 09:38:04 +0800 Subject: [PATCH 068/115] docs: update source code links --- docs/assets/guide/en/edit/edit_cell.md | 2 +- docs/assets/guide/zh/edit/edit_cell.md | 2 +- docs/assets/option/en/column/base-column-type.md | 4 ++-- docs/assets/option/en/indicator/base-indicator-type.md | 2 +- docs/assets/option/en/table/listTable.md | 4 ++-- docs/assets/option/en/table/pivotTable.md | 4 ++-- docs/assets/option/zh/column/base-column-type.md | 4 ++-- docs/assets/option/zh/indicator/base-indicator-type.md | 2 +- docs/assets/option/zh/table/listTable.md | 2 +- docs/assets/option/zh/table/pivotTable.md | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/assets/guide/en/edit/edit_cell.md b/docs/assets/guide/en/edit/edit_cell.md index 1d1c663a3..d8b13fd1a 100644 --- a/docs/assets/guide/en/edit/edit_cell.md +++ b/docs/assets/guide/en/edit/edit_cell.md @@ -157,7 +157,7 @@ VTable.register.editor('custom-date', custom_date_editor); ``` In the above example, we created a custom editor named `DateEditor` and implemented the methods required by the `IEditor` interface. Then, we register the custom editor into the VTable through the `VTable.register.editor` method for use in the table. -`IEditor` [definition](https://github.com/VisActor/VTable/blob/develop/packages/vtable-editors/src/types.ts): +`IEditor` [definition](https://github.com/VisActor/VTable/blob/main/packages/vtable-editors/src/types.ts): ```ts export interface IEditor { /** Called when cell enters edit mode. */ diff --git a/docs/assets/guide/zh/edit/edit_cell.md b/docs/assets/guide/zh/edit/edit_cell.md index 7e86a5c39..ea988e8ab 100644 --- a/docs/assets/guide/zh/edit/edit_cell.md +++ b/docs/assets/guide/zh/edit/edit_cell.md @@ -165,7 +165,7 @@ VTable.register.editor('custom-date', custom_date_editor); 在上面的示例中,我们创建了一个名为`DateEditor`的自定义编辑器,并实现了`IEditor`接口所要求的方法。然后,我们通过`VTable.register.editor`方法将自定义编辑器注册到VTable中,以便在表格中使用。 -`IEditor` 接口[定义](https://github.com/VisActor/VTable/blob/develop/packages/vtable-editors/src/types.ts): +`IEditor` 接口[定义](https://github.com/VisActor/VTable/blob/main/packages/vtable-editors/src/types.ts): ```ts export interface IEditor { /** * 单元格进入编辑状态时调用 */ diff --git a/docs/assets/option/en/column/base-column-type.md b/docs/assets/option/en/column/base-column-type.md index 8b48d959a..182c31b2e 100644 --- a/docs/assets/option/en/column/base-column-type.md +++ b/docs/assets/option/en/column/base-column-type.md @@ -207,7 +207,7 @@ Configure the column cell editor ``` editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor); ``` -Among them, IEditor is the editor interface defined in @visactor/vtable-editors. For details, please refer to the source code: https://github.com/VisActor/VTable/blob/feat/editCell/packages/vtable-editors/src/types.ts . +Among them, IEditor is the editor interface defined in @visactor/vtable-editors. For details, please refer to the source code: https://github.com/VisActor/VTable/blob/main/editCell/packages/vtable-editors/src/types.ts . ${prefix} headerEditor (string|Object|Function) @@ -218,4 +218,4 @@ headerEditor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI } ``` ${prefix} columns (Array) -Configure arrays with upper columns, nesting structures to describe column grouping relationships. \ No newline at end of file +Configure arrays with upper columns, nesting structures to describe column grouping relationships. diff --git a/docs/assets/option/en/indicator/base-indicator-type.md b/docs/assets/option/en/indicator/base-indicator-type.md index 8fe6ed226..8169463d1 100644 --- a/docs/assets/option/en/indicator/base-indicator-type.md +++ b/docs/assets/option/en/indicator/base-indicator-type.md @@ -160,4 +160,4 @@ Configure the indicator cell editor ``` editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor); ``` -Among them, IEditor is the editor interface defined in @visactor/vtable-editors. For details, please refer to the source code: https://github.com/VisActor/VTable/blob/feat/editCell/packages/vtable-editors/src/types.ts . \ No newline at end of file +Among them, IEditor is the editor interface defined in @visactor/vtable-editors. For details, please refer to the source code: https://github.com/VisActor/VTable/blob/main/editCell/packages/vtable-editors/src/types.ts . diff --git a/docs/assets/option/en/table/listTable.md b/docs/assets/option/en/table/listTable.md index 81bd053ec..c31f32361 100644 --- a/docs/assets/option/en/table/listTable.md +++ b/docs/assets/option/en/table/listTable.md @@ -76,7 +76,7 @@ Global configuration cell editor ``` editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor); ``` -Among them, IEditor is the editor interface defined in @visactor/vtable-editors. For details, please refer to the source code: https://github.com/VisActor/VTable/blob/feat/editCell/packages/vtable-editors/src/types.ts . +Among them, IEditor is the editor interface defined in @visactor/vtable-editors. For details, please refer to the source code: https://github.com/VisActor/VTable/blob/main/editCell/packages/vtable-editors/src/types.ts . ${prefix} headerEditor (string|Object|Function) @@ -97,4 +97,4 @@ When displayed as a tree structure, the indentation value of each layer of conte ## hierarchyExpandLevel(number) -When displayed as a tree structure, the number of levels is expanded by default. The default value is 1, which only displays the root node. If configured to `Infinity`, all nodes will be expanded. \ No newline at end of file +When displayed as a tree structure, the number of levels is expanded by default. The default value is 1, which only displays the root node. If configured to `Infinity`, all nodes will be expanded. diff --git a/docs/assets/option/en/table/pivotTable.md b/docs/assets/option/en/table/pivotTable.md index 22e43eed4..120fc9c36 100644 --- a/docs/assets/option/en/table/pivotTable.md +++ b/docs/assets/option/en/table/pivotTable.md @@ -339,10 +339,10 @@ Global configuration cell editor ``` editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor); ``` -Among them, IEditor is the editor interface defined in @visactor/vtable-editors. For details, please refer to the source code: https://github.com/VisActor/VTable/blob/feat/editCell/packages/vtable-editors/src/types.ts . +Among them, IEditor is the editor interface defined in @visactor/vtable-editors. For details, please refer to the source code: https://github.com/VisActor/VTable/blob/main/editCell/packages/vtable-editors/src/types.ts . {{ use: common-option-secondary( prefix = '#', tableType = 'listTable' ) }} -``` \ No newline at end of file +``` diff --git a/docs/assets/option/zh/column/base-column-type.md b/docs/assets/option/zh/column/base-column-type.md index c3e9e5f91..d86f26d79 100644 --- a/docs/assets/option/zh/column/base-column-type.md +++ b/docs/assets/option/zh/column/base-column-type.md @@ -217,7 +217,7 @@ ${prefix} editor (string|Object|Function) ``` editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor); ``` -其中IEditor是@visactor/vtable-editors中定义的编辑器接口,具体可以参看源码:https://github.com/VisActor/VTable/blob/feat/editCell/packages/vtable-editors/src/types.ts。 +其中IEditor是@visactor/vtable-editors中定义的编辑器接口,具体可以参看源码:https://github.com/VisActor/VTable/blob/main/editCell/packages/vtable-editors/src/types.ts。 ${prefix} headerEditor (string|Object|Function) @@ -227,4 +227,4 @@ headerEditor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI } ``` ${prefix} columns (Array) -同上层的列配置数组,嵌套结构来描述列分组关系。 \ No newline at end of file +同上层的列配置数组,嵌套结构来描述列分组关系。 diff --git a/docs/assets/option/zh/indicator/base-indicator-type.md b/docs/assets/option/zh/indicator/base-indicator-type.md index 9896cd763..6f0454100 100644 --- a/docs/assets/option/zh/indicator/base-indicator-type.md +++ b/docs/assets/option/zh/indicator/base-indicator-type.md @@ -160,4 +160,4 @@ ${prefix} editor (string|Object|Function) ``` editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor); ``` -其中IEditor是@visactor/vtable-editors中定义的编辑器接口,具体可以参看源码:https://github.com/VisActor/VTable/blob/feat/editCell/packages/vtable-editors/src/types.ts。 \ No newline at end of file +其中IEditor是@visactor/vtable-editors中定义的编辑器接口,具体可以参看源码:https://github.com/VisActor/VTable/blob/main/editCell/packages/vtable-editors/src/types.ts。 diff --git a/docs/assets/option/zh/table/listTable.md b/docs/assets/option/zh/table/listTable.md index 5d7f95f17..97e9b4b6f 100644 --- a/docs/assets/option/zh/table/listTable.md +++ b/docs/assets/option/zh/table/listTable.md @@ -75,7 +75,7 @@ SortState { ``` editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor); ``` -其中IEditor是@visactor/vtable-editors中定义的编辑器接口,具体可以参看源码:https://github.com/VisActor/VTable/blob/feat/editCell/packages/vtable-editors/src/types.ts。 +其中IEditor是@visactor/vtable-editors中定义的编辑器接口,具体可以参看源码:https://github.com/VisActor/VTable/blob/main/editCell/packages/vtable-editors/src/types.ts。 ${prefix} headerEditor (string|Object|Function) diff --git a/docs/assets/option/zh/table/pivotTable.md b/docs/assets/option/zh/table/pivotTable.md index dc47befe2..135517786 100644 --- a/docs/assets/option/zh/table/pivotTable.md +++ b/docs/assets/option/zh/table/pivotTable.md @@ -343,7 +343,7 @@ export interface IIndicatorHeaderNode { ``` editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor); ``` -其中IEditor是@visactor/vtable-editors中定义的编辑器接口,具体可以参看源码:https://github.com/VisActor/VTable/blob/feat/editCell/packages/vtable-editors/src/types.ts。 +其中IEditor是@visactor/vtable-editors中定义的编辑器接口,具体可以参看源码:https://github.com/VisActor/VTable/blob/main/editCell/packages/vtable-editors/src/types.ts。 {{ use: common-option-secondary( prefix = '#', From eeeee2a99820279cf7b7a8b0599ea305b7fcac91 Mon Sep 17 00:00:00 2001 From: martes Date: Thu, 1 Feb 2024 09:41:06 +0800 Subject: [PATCH 069/115] docs: update source code links --- docs/assets/option/en/column/base-column-type.md | 2 +- docs/assets/option/en/indicator/base-indicator-type.md | 2 +- docs/assets/option/en/table/listTable.md | 2 +- docs/assets/option/en/table/pivotTable.md | 2 +- docs/assets/option/zh/column/base-column-type.md | 2 +- docs/assets/option/zh/indicator/base-indicator-type.md | 2 +- docs/assets/option/zh/table/listTable.md | 2 +- docs/assets/option/zh/table/pivotTable.md | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/assets/option/en/column/base-column-type.md b/docs/assets/option/en/column/base-column-type.md index 182c31b2e..ceeacb5e1 100644 --- a/docs/assets/option/en/column/base-column-type.md +++ b/docs/assets/option/en/column/base-column-type.md @@ -207,7 +207,7 @@ Configure the column cell editor ``` editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor); ``` -Among them, IEditor is the editor interface defined in @visactor/vtable-editors. For details, please refer to the source code: https://github.com/VisActor/VTable/blob/main/editCell/packages/vtable-editors/src/types.ts . +Among them, IEditor is the editor interface defined in @visactor/vtable-editors. For details, please refer to the source code: https://github.com/VisActor/VTable/blob/main/packages/vtable-editors/src/types.ts . ${prefix} headerEditor (string|Object|Function) diff --git a/docs/assets/option/en/indicator/base-indicator-type.md b/docs/assets/option/en/indicator/base-indicator-type.md index 8169463d1..f098c3ddc 100644 --- a/docs/assets/option/en/indicator/base-indicator-type.md +++ b/docs/assets/option/en/indicator/base-indicator-type.md @@ -160,4 +160,4 @@ Configure the indicator cell editor ``` editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor); ``` -Among them, IEditor is the editor interface defined in @visactor/vtable-editors. For details, please refer to the source code: https://github.com/VisActor/VTable/blob/main/editCell/packages/vtable-editors/src/types.ts . +Among them, IEditor is the editor interface defined in @visactor/vtable-editors. For details, please refer to the source code: https://github.com/VisActor/VTable/blob/main/packages/vtable-editors/src/types.ts . diff --git a/docs/assets/option/en/table/listTable.md b/docs/assets/option/en/table/listTable.md index c31f32361..4b39d2f6b 100644 --- a/docs/assets/option/en/table/listTable.md +++ b/docs/assets/option/en/table/listTable.md @@ -76,7 +76,7 @@ Global configuration cell editor ``` editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor); ``` -Among them, IEditor is the editor interface defined in @visactor/vtable-editors. For details, please refer to the source code: https://github.com/VisActor/VTable/blob/main/editCell/packages/vtable-editors/src/types.ts . +Among them, IEditor is the editor interface defined in @visactor/vtable-editors. For details, please refer to the source code: https://github.com/VisActor/VTable/blob/main/packages/vtable-editors/src/types.ts . ${prefix} headerEditor (string|Object|Function) diff --git a/docs/assets/option/en/table/pivotTable.md b/docs/assets/option/en/table/pivotTable.md index 120fc9c36..2bf13d14e 100644 --- a/docs/assets/option/en/table/pivotTable.md +++ b/docs/assets/option/en/table/pivotTable.md @@ -339,7 +339,7 @@ Global configuration cell editor ``` editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor); ``` -Among them, IEditor is the editor interface defined in @visactor/vtable-editors. For details, please refer to the source code: https://github.com/VisActor/VTable/blob/main/editCell/packages/vtable-editors/src/types.ts . +Among them, IEditor is the editor interface defined in @visactor/vtable-editors. For details, please refer to the source code: https://github.com/VisActor/VTable/blob/main/packages/vtable-editors/src/types.ts . {{ use: common-option-secondary( prefix = '#', diff --git a/docs/assets/option/zh/column/base-column-type.md b/docs/assets/option/zh/column/base-column-type.md index d86f26d79..5aaeac17d 100644 --- a/docs/assets/option/zh/column/base-column-type.md +++ b/docs/assets/option/zh/column/base-column-type.md @@ -217,7 +217,7 @@ ${prefix} editor (string|Object|Function) ``` editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor); ``` -其中IEditor是@visactor/vtable-editors中定义的编辑器接口,具体可以参看源码:https://github.com/VisActor/VTable/blob/main/editCell/packages/vtable-editors/src/types.ts。 +其中IEditor是@visactor/vtable-editors中定义的编辑器接口,具体可以参看源码:https://github.com/VisActor/VTable/blob/main/packages/vtable-editors/src/types.ts。 ${prefix} headerEditor (string|Object|Function) diff --git a/docs/assets/option/zh/indicator/base-indicator-type.md b/docs/assets/option/zh/indicator/base-indicator-type.md index 6f0454100..0756b2746 100644 --- a/docs/assets/option/zh/indicator/base-indicator-type.md +++ b/docs/assets/option/zh/indicator/base-indicator-type.md @@ -160,4 +160,4 @@ ${prefix} editor (string|Object|Function) ``` editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor); ``` -其中IEditor是@visactor/vtable-editors中定义的编辑器接口,具体可以参看源码:https://github.com/VisActor/VTable/blob/main/editCell/packages/vtable-editors/src/types.ts。 +其中IEditor是@visactor/vtable-editors中定义的编辑器接口,具体可以参看源码:https://github.com/VisActor/VTable/blob/main/packages/vtable-editors/src/types.ts。 diff --git a/docs/assets/option/zh/table/listTable.md b/docs/assets/option/zh/table/listTable.md index 97e9b4b6f..ea210f8d3 100644 --- a/docs/assets/option/zh/table/listTable.md +++ b/docs/assets/option/zh/table/listTable.md @@ -75,7 +75,7 @@ SortState { ``` editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor); ``` -其中IEditor是@visactor/vtable-editors中定义的编辑器接口,具体可以参看源码:https://github.com/VisActor/VTable/blob/main/editCell/packages/vtable-editors/src/types.ts。 +其中IEditor是@visactor/vtable-editors中定义的编辑器接口,具体可以参看源码:https://github.com/VisActor/VTable/blob/main/packages/vtable-editors/src/types.ts。 ${prefix} headerEditor (string|Object|Function) diff --git a/docs/assets/option/zh/table/pivotTable.md b/docs/assets/option/zh/table/pivotTable.md index 135517786..22e7323c6 100644 --- a/docs/assets/option/zh/table/pivotTable.md +++ b/docs/assets/option/zh/table/pivotTable.md @@ -343,7 +343,7 @@ export interface IIndicatorHeaderNode { ``` editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor); ``` -其中IEditor是@visactor/vtable-editors中定义的编辑器接口,具体可以参看源码:https://github.com/VisActor/VTable/blob/main/editCell/packages/vtable-editors/src/types.ts。 +其中IEditor是@visactor/vtable-editors中定义的编辑器接口,具体可以参看源码:https://github.com/VisActor/VTable/blob/main/packages/vtable-editors/src/types.ts。 {{ use: common-option-secondary( prefix = '#', From 3bf28e8e04b068c807373d75ee75d5f264bae646 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Thu, 1 Feb 2024 11:10:26 +0800 Subject: [PATCH 070/115] refactor: rename onclickelsewhere to iseditorelement --- docs/assets/demo/en/edit/custom-editor.md | 2 +- docs/assets/demo/zh/edit/custom-editor.md | 2 +- docs/assets/guide/en/edit/edit_cell.md | 4 ++-- docs/assets/guide/zh/edit/edit_cell.md | 6 +++--- packages/vtable-editors/src/input-editor.ts | 2 +- packages/vtable-editors/src/list-editor.ts | 2 +- packages/vtable-editors/src/types.ts | 8 ++++---- packages/vtable/examples/editor/custom-date-editor.ts | 2 +- packages/vtable/src/edit/edit-manager.ts | 4 ++-- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/assets/demo/en/edit/custom-editor.md b/docs/assets/demo/en/edit/custom-editor.md index 8e5ff41da..f780b8eec 100644 --- a/docs/assets/demo/en/edit/custom-editor.md +++ b/docs/assets/demo/en/edit/custom-editor.md @@ -118,7 +118,7 @@ Promise.all([loadCSS(cssUrl), loadJS(jsUrl)]) this.container.removeChild(this.element); } - onClickElsewhere(target) { + isEditorElement(target) { if (target === this.element || this.picker.el.contains(target)) { return true; } diff --git a/docs/assets/demo/zh/edit/custom-editor.md b/docs/assets/demo/zh/edit/custom-editor.md index 0ec754849..ddec07583 100644 --- a/docs/assets/demo/zh/edit/custom-editor.md +++ b/docs/assets/demo/zh/edit/custom-editor.md @@ -118,7 +118,7 @@ Promise.all([loadCSS(cssUrl), loadJS(jsUrl)]) this.container.removeChild(this.element); } - onClickElsewhere(target) { + isEditorElement(target) { if (target === this.element || this.picker.el.contains(target)) { return true; } diff --git a/docs/assets/guide/en/edit/edit_cell.md b/docs/assets/guide/en/edit/edit_cell.md index d8b13fd1a..b5a9cf951 100644 --- a/docs/assets/guide/en/edit/edit_cell.md +++ b/docs/assets/guide/en/edit/edit_cell.md @@ -173,7 +173,7 @@ export interface IEditor { * Which means, in this scenario, you need to call `endEdit` manually * to end edit mode. */ - onClickElsewhere?: (target: HTMLElement) => boolean; + isEditorElement?: (target: HTMLElement) => boolean; /** * Called when editor mode is exited by any means. * Expected to return the current value of the cell. @@ -194,7 +194,7 @@ export interface EditContext { * * In most cases you don't need to call this function, * since Enter key click is handled by VTable automatically, - * and mouse click can be handled by `onClickElsewhere`. + * and mouse click can be handled by `isEditorElement`. * * However, if your editor has its own complete button, * or you have external elements like Tooltip, diff --git a/docs/assets/guide/zh/edit/edit_cell.md b/docs/assets/guide/zh/edit/edit_cell.md index ea988e8ab..89db3eff2 100644 --- a/docs/assets/guide/zh/edit/edit_cell.md +++ b/docs/assets/guide/zh/edit/edit_cell.md @@ -151,7 +151,7 @@ class DateEditor implements IEditor { this.picker.destroy(); this.container.removeChild(this.element); } - onClickElsewhere(target: HTMLElement) { + isEditorElement(target: HTMLElement) { if (target === this.element || this.picker.el.contains(target)) { return true; } @@ -176,7 +176,7 @@ export interface IEditor { * 如果提供了此函数,VTable 将会在用户点击其他地方时调用此函数。 * 如果此函数返回了一个假值,VTable 将会调用 `onEnd` 并退出编辑状态。 */ - onClickElsewhere?: (target: HTMLElement) => boolean; + isEditorElement?: (target: HTMLElement) => boolean; /** * 获取编辑器当前值。将在 `onEnd` 调用后调用。 */ getValue: () => V; // ... @@ -194,7 +194,7 @@ export interface EditContext { * * 大多数情况下你不需要使用此回调,因为 VTable 已经自带了 Enter 键按下 * 来结束编辑状态的行为;而鼠标点击其他位置来结束编辑状态的行为你也 - * 可以通过 `onClickElsewhere` 函数来获得。 + * 可以通过 `isEditorElement` 函数来获得。 * * 然而,如果你有特殊的需求,比如你想在编辑器内部提供一个“完成”按钮, * 或者你有像 Tooltip 这样无法获取到的外部元素, diff --git a/packages/vtable-editors/src/input-editor.ts b/packages/vtable-editors/src/input-editor.ts index d00911ce1..0a161f924 100644 --- a/packages/vtable-editors/src/input-editor.ts +++ b/packages/vtable-editors/src/input-editor.ts @@ -68,7 +68,7 @@ export class InputEditor implements IEditor { this.container.removeChild(this.element); } - onClickElsewhere(target: HTMLElement) { + isEditorElement(target: HTMLElement) { return target === this.element; } } diff --git a/packages/vtable-editors/src/list-editor.ts b/packages/vtable-editors/src/list-editor.ts index 66a0ce70f..d0ec1d7c3 100644 --- a/packages/vtable-editors/src/list-editor.ts +++ b/packages/vtable-editors/src/list-editor.ts @@ -84,7 +84,7 @@ export class ListEditor implements IEditor { this.container.removeChild(this.element); } - onClickElsewhere(target: HTMLElement) { + isEditorElement(target: HTMLElement) { return target === this.element; } } diff --git a/packages/vtable-editors/src/types.ts b/packages/vtable-editors/src/types.ts index 83f3dd3b9..399f3984b 100644 --- a/packages/vtable-editors/src/types.ts +++ b/packages/vtable-editors/src/types.ts @@ -23,7 +23,7 @@ export interface IEditor { * Which means, in this scenario, you need to call `endEdit` manually * to end edit mode. */ - onClickElsewhere?: (target: HTMLElement) => boolean; + isEditorElement?: (target: HTMLElement) => boolean; /** * Called when editor mode is exited by any means. * Expected to return the current value of the cell. @@ -40,8 +40,8 @@ export interface IEditor { */ exit?: () => void; /** - * @see onClickElsewhere - * @deprecated use `onClickElsewhere` instead. + * @see isEditorElement + * @deprecated use `isEditorElement` instead. */ targetIsOnEditor?: (target: HTMLElement) => boolean; /** @@ -66,7 +66,7 @@ export interface EditContext { * * In most cases you don't need to call this function, * since Enter key click is handled by VTable automatically, - * and mouse click can be handled by `onClickElsewhere`. + * and mouse click can be handled by `isEditorElement`. * * However, if your editor has its own complete button, * or you have external elements like Tooltip, diff --git a/packages/vtable/examples/editor/custom-date-editor.ts b/packages/vtable/examples/editor/custom-date-editor.ts index a6395309a..58f98e062 100644 --- a/packages/vtable/examples/editor/custom-date-editor.ts +++ b/packages/vtable/examples/editor/custom-date-editor.ts @@ -84,7 +84,7 @@ class DateEditor implements IEditor { this.picker.destroy(); this.container.removeChild(this.element); } - onClickElsewhere(target: HTMLElement) { + isEditorElement(target: HTMLElement) { if (target === this.element || this.picker.el.contains(target)) { return true; } diff --git a/packages/vtable/src/edit/edit-manager.ts b/packages/vtable/src/edit/edit-manager.ts index 4267c6a69..c66e5ef5c 100644 --- a/packages/vtable/src/edit/edit-manager.ts +++ b/packages/vtable/src/edit/edit-manager.ts @@ -106,11 +106,11 @@ export class EditManeger { const target = e?.target as HTMLElement | undefined; if (this.editingEditor.targetIsOnEditor) { - console.warn('VTable Warn: `targetIsOnEditor` is deprecated, please use `onClickElsewhere` instead.'); + console.warn('VTable Warn: `targetIsOnEditor` is deprecated, please use `isEditorElement` instead.'); if (target && this.editingEditor.targetIsOnEditor(target)) { return; } - } else if (!this.editingEditor.onClickElsewhere || (target && this.editingEditor.onClickElsewhere?.(target))) { + } else if (!this.editingEditor.isEditorElement || (target && this.editingEditor.isEditorElement?.(target))) { return; } From 9479deefa0edbb7cc9cd13e452f2c77a3fec28f5 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Thu, 1 Feb 2024 15:53:02 +0800 Subject: [PATCH 071/115] feat: update vrender version --- common/config/rush/pnpm-lock.yaml | 30 +++++++++++++++--------------- packages/vtable/package.json | 6 +++--- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index c968ef65a..1e735ceda 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -181,9 +181,9 @@ importers: '@types/react-dom': ^18.0.0 '@visactor/vchart': 1.9.0 '@visactor/vdataset': ~0.17.1 - '@visactor/vrender-components': 0.17.20-alpha.1 - '@visactor/vrender-core': 0.17.20-alpha.1 - '@visactor/vrender-kits': 0.17.20-alpha.1 + '@visactor/vrender-components': 0.17.20-alpha.3 + '@visactor/vrender-core': 0.17.20-alpha.3 + '@visactor/vrender-kits': 0.17.20-alpha.3 '@visactor/vscale': ~0.17.1 '@visactor/vtable-editors': workspace:* '@visactor/vutils': ~0.17.1 @@ -226,9 +226,9 @@ importers: vite-plugin-markdown: ^2.1.0 dependencies: '@visactor/vdataset': 0.17.4 - '@visactor/vrender-components': 0.17.20-alpha.1 - '@visactor/vrender-core': 0.17.20-alpha.1 - '@visactor/vrender-kits': 0.17.20-alpha.1 + '@visactor/vrender-components': 0.17.20-alpha.3 + '@visactor/vrender-core': 0.17.20-alpha.3 + '@visactor/vrender-kits': 0.17.20-alpha.3 '@visactor/vscale': 0.17.4 '@visactor/vtable-editors': link:../vtable-editors '@visactor/vutils': 0.17.4 @@ -3468,11 +3468,11 @@ packages: '@visactor/vscale': 0.17.4 '@visactor/vutils': 0.17.4 - /@visactor/vrender-components/0.17.20-alpha.1: - resolution: {integrity: sha512-VkT5RFYYbS6YmYnFAgoRlEoeKtvoryFG2vwPM5X0wrYOpZvTbXuvOAgNKHawxV1UtkeHfVHe1ZY9I5+qvwZQtA==} + /@visactor/vrender-components/0.17.20-alpha.3: + resolution: {integrity: sha512-85aqV302wGvwSaACuMAcv2lmqUQi0f91zMliXifuK5f2+3LOnEonLpbT5OhTxge8MLXsBlYEPnNW9BFhLmT+fQ==} dependencies: - '@visactor/vrender-core': 0.17.20-alpha.1 - '@visactor/vrender-kits': 0.17.20-alpha.1 + '@visactor/vrender-core': 0.17.20-alpha.3 + '@visactor/vrender-kits': 0.17.20-alpha.3 '@visactor/vscale': 0.17.4 '@visactor/vutils': 0.17.4 dev: false @@ -3490,8 +3490,8 @@ packages: '@visactor/vutils': 0.17.4 color-convert: 2.0.1 - /@visactor/vrender-core/0.17.20-alpha.1: - resolution: {integrity: sha512-GdmRx2PeV52sW6YB5LL6u2jwj3s/INfHXAY6WVM7mouQE9lDt0EObQJJxIbf55ztPwyJBXaaD1AZ8qIZwle87w==} + /@visactor/vrender-core/0.17.20-alpha.3: + resolution: {integrity: sha512-9LodZqDMSEfTHfqpaBEUSiy+PtkT6yKfGM/kxGoqzV3XDul3M2UoskUqbkw9rzSKUr8Y9XVuC/CXG1VBCMWUcA==} dependencies: '@visactor/vutils': 0.17.4 color-convert: 2.0.1 @@ -3514,11 +3514,11 @@ packages: '@visactor/vutils': 0.17.4 roughjs: 4.5.2 - /@visactor/vrender-kits/0.17.20-alpha.1: - resolution: {integrity: sha512-0jRe6ayjlR7vZWDQ4dYYICsnzzG7IK9UnqIasGnmjW7D8ZpMaSM1PcodiAOBLy8ELnF4gYbF1Uady/OpDdD6TQ==} + /@visactor/vrender-kits/0.17.20-alpha.3: + resolution: {integrity: sha512-II9fXUtMZADuk5ZH1CNzLIY8F37oosGWTFDEWogWzmVY6SAUgqavsdjJaPD3lgy3ecyepiCICHIbX+0VY4ZIrg==} dependencies: '@resvg/resvg-js': 2.4.1 - '@visactor/vrender-core': 0.17.20-alpha.1 + '@visactor/vrender-core': 0.17.20-alpha.3 '@visactor/vutils': 0.17.4 roughjs: 4.5.2 dev: false diff --git a/packages/vtable/package.json b/packages/vtable/package.json index ad258d4a5..a1423d0e4 100644 --- a/packages/vtable/package.json +++ b/packages/vtable/package.json @@ -50,9 +50,9 @@ }, "dependencies": { "@visactor/vtable-editors": "workspace:*", - "@visactor/vrender-core": "0.17.20-alpha.1", - "@visactor/vrender-kits": "0.17.20-alpha.1", - "@visactor/vrender-components": "0.17.20-alpha.1", + "@visactor/vrender-core": "0.17.20-alpha.3", + "@visactor/vrender-kits": "0.17.20-alpha.3", + "@visactor/vrender-components": "0.17.20-alpha.3", "@visactor/vutils-extension": "~1.8.5", "@visactor/vutils": "~0.17.1", "@visactor/vscale": "~0.17.1", From 84448f7b5238074020fbf6ef106b2a62c4ffe936 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Thu, 1 Feb 2024 20:06:50 +0800 Subject: [PATCH 072/115] fix: fix getCellRange in pivot chart --- .../vtable/src/layout/pivot-header-layout.ts | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/packages/vtable/src/layout/pivot-header-layout.ts b/packages/vtable/src/layout/pivot-header-layout.ts index 41aa9b6cb..ff18c7814 100644 --- a/packages/vtable/src/layout/pivot-header-layout.ts +++ b/packages/vtable/src/layout/pivot-header-layout.ts @@ -1323,6 +1323,44 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { if (this.isRightFrozenColumn(col, row) || this.isBottomFrozenRow(col, row)) { return result; } + + if (this._table.isPivotChart()) { + if (this.isLeftBottomCorner(col, row)) { + return { + start: { + col: 0, + row: this.rowCount - this.bottomFrozenRowCount + }, + end: { + col: this.frozenColCount - 1, + row: this.rowCount - 1 + } + }; + } else if (this.isRightTopCorner(col, row)) { + return { + start: { + col: this.colCount - this.rightFrozenColCount, + row: 0 + }, + end: { + col: this.colCount - 1, + row: this.frozenRowCount - 1 + } + }; + } else if (this.isRightBottomCorner(col, row)) { + return { + start: { + col: this.colCount - this.rightFrozenColCount, + row: this.rowCount - this.bottomFrozenRowCount + }, + end: { + col: this.colCount - 1, + row: this.rowCount - 1 + } + }; + } + } + // if (this._cellRangeMap.has(`$${col}$${row}`)) { // return this._cellRangeMap.get(`$${col}$${row}`); // } From fe2b3adaa793573f131d9b105b05148eb45ee1ad Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Fri, 2 Feb 2024 11:06:13 +0800 Subject: [PATCH 073/115] fix: fix axis title text type error --- packages/vtable/src/components/axis/axis.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vtable/src/components/axis/axis.ts b/packages/vtable/src/components/axis/axis.ts index 216a68b91..ecd0d54b9 100644 --- a/packages/vtable/src/components/axis/axis.ts +++ b/packages/vtable/src/components/axis/axis.ts @@ -217,7 +217,7 @@ export class CartesianAxis { // visible: this.option.grid.visible // }, title: { - text: this.option.title.text, + text: this.option.title.text as string, maxWidth: this._getTitleLimit(isX) }, items: this.getLabelItems(axisLength), From 4e9d4cb299b57a45b83485c43001095c95965801 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Fri, 2 Feb 2024 12:05:15 +0800 Subject: [PATCH 074/115] feat: remove ICartesianAxisSpec from @visactor/vchart --- .../vtable/src/ts-types/component/axis.ts | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/packages/vtable/src/ts-types/component/axis.ts b/packages/vtable/src/ts-types/component/axis.ts index 350ac5acb..c9c87e6a3 100644 --- a/packages/vtable/src/ts-types/component/axis.ts +++ b/packages/vtable/src/ts-types/component/axis.ts @@ -1,21 +1,21 @@ -import type { ICartesianAxisSpec } from '@visactor/vchart'; +// import type { ICartesianAxisSpec } from '@visactor/vchart'; -export type ICellAxisOption = Omit & - ( - | { - type: 'band'; - domain: (number | string)[]; - __vtableChartTheme?: any; - } - | { - type: 'linear' | 'time'; - range: { - min: number; - max: number; - }; - __ticksForVTable?: number[]; - __vtableChartTheme?: any; - } - ); - -export type ITableAxisOption = ICartesianAxisSpec; +// export type ICellAxisOption = Omit & +// ( +// | { +// type: 'band'; +// domain: (number | string)[]; +// __vtableChartTheme?: any; +// } +// | { +// type: 'linear' | 'time'; +// range: { +// min: number; +// max: number; +// }; +// __ticksForVTable?: number[]; +// __vtableChartTheme?: any; +// } +// ); +export type ICellAxisOption = any; +export type ITableAxisOption = ICellAxisOption; From f7bb3ed136e0ea4a2207b18165b920e4d7dd29d0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 2 Feb 2024 04:18:44 +0000 Subject: [PATCH 075/115] build: prelease version 0.19.0 --- ...018-bug-selectRegion_2024-01-30-04-08.json | 11 ------ ...018-bug-selectRegion_2024-01-30-06-55.json | 11 ------ ...der-olumnwidth-error_2024-01-26-10-38.json | 11 ------ ...ing-computeRowHeight_2024-01-30-09-08.json | 11 ------ ...-dragedOrder-columns_2024-01-26-11-21.json | 11 ------ ...ragHeaderInteraction_2024-01-19-11-26.json | 11 ------ ...ragHeaderInteraction_2024-01-22-08-43.json | 11 ------ ...tor-row-height-range_2024-01-24-10-00.json | 11 ------ .../fix-image-stick_2024-01-22-04-12.json | 10 ------ common/config/rush/version-policies.json | 2 +- packages/react-vtable/package.json | 4 +-- packages/vtable-editors/package.json | 2 +- packages/vtable-export/package.json | 4 +-- packages/vtable/CHANGELOG.json | 36 +++++++++++++++++++ packages/vtable/CHANGELOG.md | 33 ++++++++++++++++- packages/vtable/package.json | 4 +-- 16 files changed, 76 insertions(+), 107 deletions(-) delete mode 100644 common/changes/@visactor/vtable/1018-bug-selectRegion_2024-01-30-04-08.json delete mode 100644 common/changes/@visactor/vtable/1018-bug-selectRegion_2024-01-30-06-55.json delete mode 100644 common/changes/@visactor/vtable/1019-bug-rightfrozencolcount-dragheader-olumnwidth-error_2024-01-26-10-38.json delete mode 100644 common/changes/@visactor/vtable/1031-bug-empty-string-computeRowHeight_2024-01-30-09-08.json delete mode 100644 common/changes/@visactor/vtable/986-refactor-dragedOrder-columns_2024-01-26-11-21.json delete mode 100644 common/changes/@visactor/vtable/feat-dragHeaderInteraction_2024-01-19-11-26.json delete mode 100644 common/changes/@visactor/vtable/feat-dragHeaderInteraction_2024-01-22-08-43.json delete mode 100644 common/changes/@visactor/vtable/feat-refactor-row-height-range_2024-01-24-10-00.json delete mode 100644 common/changes/@visactor/vtable/fix-image-stick_2024-01-22-04-12.json diff --git a/common/changes/@visactor/vtable/1018-bug-selectRegion_2024-01-30-04-08.json b/common/changes/@visactor/vtable/1018-bug-selectRegion_2024-01-30-04-08.json deleted file mode 100644 index b2b57cd4b..000000000 --- a/common/changes/@visactor/vtable/1018-bug-selectRegion_2024-01-30-04-08.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "fix: select region saved problem #1018\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/1018-bug-selectRegion_2024-01-30-06-55.json b/common/changes/@visactor/vtable/1018-bug-selectRegion_2024-01-30-06-55.json deleted file mode 100644 index 95f9b5624..000000000 --- a/common/changes/@visactor/vtable/1018-bug-selectRegion_2024-01-30-06-55.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "fix: when call updateColumns and discount col occor error #1015\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/1019-bug-rightfrozencolcount-dragheader-olumnwidth-error_2024-01-26-10-38.json b/common/changes/@visactor/vtable/1019-bug-rightfrozencolcount-dragheader-olumnwidth-error_2024-01-26-10-38.json deleted file mode 100644 index 56f04bd49..000000000 --- a/common/changes/@visactor/vtable/1019-bug-rightfrozencolcount-dragheader-olumnwidth-error_2024-01-26-10-38.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "fix: rightFrozenColCount drag header move more time the column width is error #1019\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/1031-bug-empty-string-computeRowHeight_2024-01-30-09-08.json b/common/changes/@visactor/vtable/1031-bug-empty-string-computeRowHeight_2024-01-30-09-08.json deleted file mode 100644 index 5ba015073..000000000 --- a/common/changes/@visactor/vtable/1031-bug-empty-string-computeRowHeight_2024-01-30-09-08.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "fix: empty string compute row height error #1031\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/986-refactor-dragedOrder-columns_2024-01-26-11-21.json b/common/changes/@visactor/vtable/986-refactor-dragedOrder-columns_2024-01-26-11-21.json deleted file mode 100644 index f531082ae..000000000 --- a/common/changes/@visactor/vtable/986-refactor-dragedOrder-columns_2024-01-26-11-21.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "feat: support get sorted columns #986\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/feat-dragHeaderInteraction_2024-01-19-11-26.json b/common/changes/@visactor/vtable/feat-dragHeaderInteraction_2024-01-19-11-26.json deleted file mode 100644 index 5fa6e9528..000000000 --- a/common/changes/@visactor/vtable/feat-dragHeaderInteraction_2024-01-19-11-26.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "feat: add option frozenColDragHeaderMode\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/feat-dragHeaderInteraction_2024-01-22-08-43.json b/common/changes/@visactor/vtable/feat-dragHeaderInteraction_2024-01-22-08-43.json deleted file mode 100644 index 9ffb21330..000000000 --- a/common/changes/@visactor/vtable/feat-dragHeaderInteraction_2024-01-22-08-43.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "refactor: when drag header move to frozen region then markLine show positon\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/feat-refactor-row-height-range_2024-01-24-10-00.json b/common/changes/@visactor/vtable/feat-refactor-row-height-range_2024-01-24-10-00.json deleted file mode 100644 index 2db425ed7..000000000 --- a/common/changes/@visactor/vtable/feat-refactor-row-height-range_2024-01-24-10-00.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "refactor: optimize updateRow api performance & resize bottom frozen row not right\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-image-stick_2024-01-22-04-12.json b/common/changes/@visactor/vtable/fix-image-stick_2024-01-22-04-12.json deleted file mode 100644 index 1d3c17f5a..000000000 --- a/common/changes/@visactor/vtable/fix-image-stick_2024-01-22-04-12.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vtable", - "comment": "fix: fix merge image cell update problem", - "type": "none" - } - ], - "packageName": "@visactor/vtable" -} \ No newline at end of file diff --git a/common/config/rush/version-policies.json b/common/config/rush/version-policies.json index 102065e98..4783e57e3 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -1 +1 @@ -[{"definitionName":"lockStepVersion","policyName":"vtableMain","version":"0.18.4","mainProject":"@visactor/vtable","nextBump":"patch"}] +[{"definitionName":"lockStepVersion","policyName":"vtableMain","version":"0.19.0","mainProject":"@visactor/vtable","nextBump":"minor"}] diff --git a/packages/react-vtable/package.json b/packages/react-vtable/package.json index 5ed55e446..34a42b702 100644 --- a/packages/react-vtable/package.json +++ b/packages/react-vtable/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/react-vtable", - "version": "0.18.4", + "version": "0.19.0", "description": "The react version of VTable", "keywords": [ "react", @@ -96,4 +96,4 @@ "axios": "^1.4.0", "@types/react-is": "^17.0.3" } -} \ No newline at end of file +} diff --git a/packages/vtable-editors/package.json b/packages/vtable-editors/package.json index 9438ed8c2..ed277b994 100644 --- a/packages/vtable-editors/package.json +++ b/packages/vtable-editors/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vtable-editors", - "version": "0.18.4", + "version": "0.19.0", "description": "", "sideEffects": false, "main": "cjs/index.js", diff --git a/packages/vtable-export/package.json b/packages/vtable-export/package.json index 4578c6cc1..a341d3b01 100644 --- a/packages/vtable-export/package.json +++ b/packages/vtable-export/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vtable-export", - "version": "0.18.4", + "version": "0.19.0", "description": "The export util of VTable", "author": { "name": "VisActor", @@ -85,4 +85,4 @@ "@types/react-is": "^17.0.3", "rollup-plugin-node-resolve": "5.2.0" } -} \ No newline at end of file +} diff --git a/packages/vtable/CHANGELOG.json b/packages/vtable/CHANGELOG.json index 173852352..692045a9d 100644 --- a/packages/vtable/CHANGELOG.json +++ b/packages/vtable/CHANGELOG.json @@ -1,6 +1,42 @@ { "name": "@visactor/vtable", "entries": [ + { + "version": "0.19.0", + "tag": "@visactor/vtable_v0.19.0", + "date": "Fri, 02 Feb 2024 04:13:16 GMT", + "comments": { + "none": [ + { + "comment": "fix: select region saved problem #1018\n\n" + }, + { + "comment": "fix: when call updateColumns and discount col occor error #1015\n\n" + }, + { + "comment": "fix: rightFrozenColCount drag header move more time the column width is error #1019\n\n" + }, + { + "comment": "fix: empty string compute row height error #1031\n\n" + }, + { + "comment": "feat: support get sorted columns #986\n\n" + }, + { + "comment": "feat: add option frozenColDragHeaderMode\n\n" + }, + { + "comment": "refactor: when drag header move to frozen region then markLine show positon\n\n" + }, + { + "comment": "refactor: optimize updateRow api performance & resize bottom frozen row not right\n\n" + }, + { + "comment": "fix: fix merge image cell update problem" + } + ] + } + }, { "version": "0.18.4", "tag": "@visactor/vtable_v0.18.4", diff --git a/packages/vtable/CHANGELOG.md b/packages/vtable/CHANGELOG.md index 6053b777e..0d18c4186 100644 --- a/packages/vtable/CHANGELOG.md +++ b/packages/vtable/CHANGELOG.md @@ -1,6 +1,37 @@ # Change Log - @visactor/vtable -This log was last generated on Fri, 26 Jan 2024 09:15:07 GMT and should not be manually modified. +This log was last generated on Fri, 02 Feb 2024 04:13:16 GMT and should not be manually modified. + +## 0.19.0 +Fri, 02 Feb 2024 04:13:16 GMT + +### Updates + +- fix: select region saved problem #1018 + + +- fix: when call updateColumns and discount col occor error #1015 + + +- fix: rightFrozenColCount drag header move more time the column width is error #1019 + + +- fix: empty string compute row height error #1031 + + +- feat: support get sorted columns #986 + + +- feat: add option frozenColDragHeaderMode + + +- refactor: when drag header move to frozen region then markLine show positon + + +- refactor: optimize updateRow api performance & resize bottom frozen row not right + + +- fix: fix merge image cell update problem ## 0.18.4 Fri, 26 Jan 2024 09:15:07 GMT diff --git a/packages/vtable/package.json b/packages/vtable/package.json index a1423d0e4..3174fbe4b 100644 --- a/packages/vtable/package.json +++ b/packages/vtable/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vtable", - "version": "0.18.4", + "version": "0.19.0", "description": "canvas table width high performance", "keywords": [ "grid", @@ -124,4 +124,4 @@ "url": "https://github.com/VisActor/VTable.git", "directory": "packages/vtable" } -} \ No newline at end of file +} From 354b7e16c70ca937c8dc79ef65fddc8153cdb738 Mon Sep 17 00:00:00 2001 From: fangsmile Date: Fri, 2 Feb 2024 04:44:27 +0000 Subject: [PATCH 076/115] docs: generate changelog of release v0.19.0 --- docs/assets/changelog/en/release.md | 27 +++++++++++++++++++++++++++ docs/assets/changelog/zh/release.md | 27 +++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/docs/assets/changelog/en/release.md b/docs/assets/changelog/en/release.md index e71641b1e..fc7edb62e 100644 --- a/docs/assets/changelog/en/release.md +++ b/docs/assets/changelog/en/release.md @@ -1,3 +1,30 @@ +# v0.19.0 + +2024-02-02 + + +**🆕 New feature** + +- **@visactor/vtable**: support get sorted columns [#986](https://github.com/VisActor/VTable/issues/986) +- **@visactor/vtable**: add option frozenColDragHeaderMode + +**🐛 Bug fix** + +- **@visactor/vtable**: select region saved problem [#1018](https://github.com/VisActor/VTable/issues/1018) +- **@visactor/vtable**: when call updateColumns and discount col occor error [#1015](https://github.com/VisActor/VTable/issues/1015) +- **@visactor/vtable**: rightFrozenColCount drag header move more time the column width is error [#1019](https://github.com/VisActor/VTable/issues/1019) +- **@visactor/vtable**: empty string compute row height error [#1031](https://github.com/VisActor/VTable/issues/1031) +- **@visactor/vtable**: fix merge image cell update problem + +**🔨 Refactor** + +- **@visactor/vtable**: when drag header move to frozen region then markLine show positon +- **@visactor/vtable**: optimize updateRow api performance & resize bottom frozen row not right + + + +[more detail about v0.19.0](https://github.com/VisActor/VTable/releases/tag/v0.19.0) + # v0.18.3 2024-01-25 diff --git a/docs/assets/changelog/zh/release.md b/docs/assets/changelog/zh/release.md index ced631b94..a667955ab 100644 --- a/docs/assets/changelog/zh/release.md +++ b/docs/assets/changelog/zh/release.md @@ -1,3 +1,30 @@ +# v0.19.0 + +2024-02-02 + + +**🆕 新增功能** + +- **@visactor/vtable**: support get sorted columns [#986](https://github.com/VisActor/VTable/issues/986) +- **@visactor/vtable**: add option frozenColDragHeaderMode + +**🐛 功能修复** + +- **@visactor/vtable**: select region saved problem [#1018](https://github.com/VisActor/VTable/issues/1018) +- **@visactor/vtable**: when call updateColumns and discount col occor error [#1015](https://github.com/VisActor/VTable/issues/1015) +- **@visactor/vtable**: rightFrozenColCount drag header move more time the column width is error [#1019](https://github.com/VisActor/VTable/issues/1019) +- **@visactor/vtable**: empty string compute row height error [#1031](https://github.com/VisActor/VTable/issues/1031) +- **@visactor/vtable**: fix merge image cell update problem + +**🔨 功能重构** + +- **@visactor/vtable**: when drag header move to frozen region then markLine show positon +- **@visactor/vtable**: optimize updateRow api performance & resize bottom frozen row not right + + + +[更多详情请查看 v0.19.0](https://github.com/VisActor/VTable/releases/tag/v0.19.0) + # v0.18.3 2024-01-25 From a3f3de7cdba976c30eae96751f43f03220eca9dc Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Fri, 2 Feb 2024 14:29:11 +0800 Subject: [PATCH 077/115] docs: shortcut docs --- .../demo/en/custom-render/custom-icon.md | 26 +++++++++++++++++-- .../demo/zh/custom-render/custom-icon.md | 26 +++++++++++++++++-- .../{interaction/keyboard.md => shortcut.md} | 0 docs/assets/guide/menu.json | 14 +++++----- .../{interaction/keyboard.md => shortcut.md} | 0 5 files changed, 55 insertions(+), 11 deletions(-) rename docs/assets/guide/en/{interaction/keyboard.md => shortcut.md} (100%) rename docs/assets/guide/zh/{interaction/keyboard.md => shortcut.md} (100%) diff --git a/docs/assets/demo/en/custom-render/custom-icon.md b/docs/assets/demo/en/custom-render/custom-icon.md index 3433aa0c2..415e6eb8c 100644 --- a/docs/assets/demo/en/custom-render/custom-icon.md +++ b/docs/assets/demo/en/custom-render/custom-icon.md @@ -8,7 +8,9 @@ link: '../guide/custom_define/custom_icon' # Custom Icon -Display icon content in cells +Display icon content in cells. + +Register the icon information globally through `VTable.register.icon`, and then directly configure the registration name in the icon or headerIcon in the column, or configure the complete icon information in the icon or headerIcon ## Key Configurations @@ -190,7 +192,24 @@ const columns =[ { "field": "Product Name", "title": "Product Name", - "width": "auto" + "width": "auto", + headerIcon: [ + { + name: 'question', + type: 'svg', + marginLeft: 10, + positionType: VTable.TYPES.IconPosition.contentRight, + width:20, + height:20, + svg:``, + tooltip: { + style: { arrowMark: true }, + // 气泡框,按钮的的解释信息 + title: 'this is product name', + placement: VTable.TYPES.Placement.right, + }, + }, + ] }, { "field": "Category", @@ -281,6 +300,9 @@ tableInstance.on('click_cell', args => { }else if(targetIcon.name === 'order'){ const value=tableInstance.getCellValue(col,row); window?.alert?.('已复制订单号: '+value); + }else if(targetIcon.name === 'question'){ + const value=tableInstance.getCellValue(col,row); + window?.alert?.('question: '+value); } } }) diff --git a/docs/assets/demo/zh/custom-render/custom-icon.md b/docs/assets/demo/zh/custom-render/custom-icon.md index 580abd79b..61cecb83c 100644 --- a/docs/assets/demo/zh/custom-render/custom-icon.md +++ b/docs/assets/demo/zh/custom-render/custom-icon.md @@ -9,7 +9,9 @@ link: '../guide/custom_define/custom_icon' # 自定义图标 -在单元格中显示图标内容 +在单元格中显示图标内容。 + +通过`VTable.register.icon`全局注册图标信息,然后直接在column中的icon或者headerIcon配置注册名称,或者在icon或者headerIcon配置完整的图标信息 ## 关键配置 @@ -192,7 +194,24 @@ const columns =[ { "field": "Product Name", "title": "Product Name", - "width": "auto" + "width": "auto", + headerIcon: [ + { + name: 'question', + type: 'svg', + marginLeft: 10, + positionType: VTable.TYPES.IconPosition.contentRight, + width:20, + height:20, + svg:``, + tooltip: { + style: { arrowMark: true }, + // 气泡框,按钮的的解释信息 + title: 'this is product name', + placement: VTable.TYPES.Placement.right, + }, + }, + ] }, { "field": "Category", @@ -283,6 +302,9 @@ tableInstance.on('click_cell', args => { }else if(targetIcon.name === 'order'){ const value=tableInstance.getCellValue(col,row); window?.alert?.('已复制订单号: '+value); + }else if(targetIcon.name === 'question'){ + const value=tableInstance.getCellValue(col,row); + window?.alert?.('question: '+value); } } }) diff --git a/docs/assets/guide/en/interaction/keyboard.md b/docs/assets/guide/en/shortcut.md similarity index 100% rename from docs/assets/guide/en/interaction/keyboard.md rename to docs/assets/guide/en/shortcut.md diff --git a/docs/assets/guide/menu.json b/docs/assets/guide/menu.json index afd95c6a0..b323ed93e 100644 --- a/docs/assets/guide/menu.json +++ b/docs/assets/guide/menu.json @@ -301,13 +301,6 @@ "zh": "滚动", "en": "scroll" } - }, - { - "path": "keyboard", - "title": { - "zh": "快捷键", - "en": "keyboard" - } } ] }, @@ -327,6 +320,13 @@ } ] }, + { + "path": "shortcut", + "title": { + "zh": "快捷键", + "en": "Shortcut" + } + }, { "path": "custom_define", "title": { diff --git a/docs/assets/guide/zh/interaction/keyboard.md b/docs/assets/guide/zh/shortcut.md similarity index 100% rename from docs/assets/guide/zh/interaction/keyboard.md rename to docs/assets/guide/zh/shortcut.md From 3c6865f0f216504023c7bf548219cd3e3d0dc644 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Fri, 2 Feb 2024 14:34:50 +0800 Subject: [PATCH 078/115] =?UTF-8?q?docs:=200.19.0=20=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/assets/changelog/zh/release.md | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/docs/assets/changelog/zh/release.md b/docs/assets/changelog/zh/release.md index a667955ab..f47a49c3f 100644 --- a/docs/assets/changelog/zh/release.md +++ b/docs/assets/changelog/zh/release.md @@ -4,24 +4,23 @@ **🆕 新增功能** - -- **@visactor/vtable**: support get sorted columns [#986](https://github.com/VisActor/VTable/issues/986) -- **@visactor/vtable**: add option frozenColDragHeaderMode + +- **@visactor/vtable**: 支持获取排序后的列 [#986](https://github.com/VisActor/VTable/issues/986) +- **@visactor/vtable**: 添加配置项:frozenColDragHeaderMode,设置冻结列拖动表头的限制规则 **🐛 功能修复** - -- **@visactor/vtable**: select region saved problem [#1018](https://github.com/VisActor/VTable/issues/1018) -- **@visactor/vtable**: when call updateColumns and discount col occor error [#1015](https://github.com/VisActor/VTable/issues/1015) -- **@visactor/vtable**: rightFrozenColCount drag header move more time the column width is error [#1019](https://github.com/VisActor/VTable/issues/1019) -- **@visactor/vtable**: empty string compute row height error [#1031](https://github.com/VisActor/VTable/issues/1031) -- **@visactor/vtable**: fix merge image cell update problem + +- **@visactor/vtable**: 修复选择区域错误问题 [#1018](https://github.com/VisActor/VTable/issues/1018) +- **@visactor/vtable**: 修复调用updateColumns和折扣列发生错误 [#1015](https://github.com/VisActor/VTable/issues/1015) +- **@visactor/vtable**: 修复右侧冻结列计数拖动表头多次后列宽错误 [#1019](https://github.com/VisActor/VTable/issues/1019) +- **@visactor/vtable**: 修复空字符串计算行高错误 [#1031](https://github.com/VisActor/VTable/issues/1031) +- **@visactor/vtable**: 修复合并图像单元格更新问题 +- **@visactor/vtable**: 修正底部冻结行大小不正确的问题 **🔨 功能重构** - -- **@visactor/vtable**: when drag header move to frozen region then markLine show positon -- **@visactor/vtable**: optimize updateRow api performance & resize bottom frozen row not right - +- **@visactor/vtable**: 当拖动表头移动到冻结区域时标记线显示位置 +- **@visactor/vtable**: 优化updateRow api性能 [更多详情请查看 v0.19.0](https://github.com/VisActor/VTable/releases/tag/v0.19.0) From dcec5d89e02b2c0ed93ecf818bb55f9c05ce8f0e Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Fri, 2 Feb 2024 17:26:38 +0800 Subject: [PATCH 079/115] docs: modify event guide --- docs/assets/guide/en/Event/event_list.md | 2 ++ docs/assets/guide/zh/Event/event_list.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/docs/assets/guide/en/Event/event_list.md b/docs/assets/guide/en/Event/event_list.md index 8ed7ff037..68d1cba36 100644 --- a/docs/assets/guide/en/Event/event_list.md +++ b/docs/assets/guide/en/Event/event_list.md @@ -6,6 +6,8 @@ Table event list, you can listen to the required events according to actual need The specific return data of the event can be actually tested to observe whether it meets the business needs, or communicate with us. +For a more comprehensive list of events, please refer to: https://visactor.io/vtable/api/events + | Name | Event Name | Description | |:----|:----|:----| |Life cycle event: initialization completed|INITIALIZED|Life cycle event: triggered after successful initialization is completed| diff --git a/docs/assets/guide/zh/Event/event_list.md b/docs/assets/guide/zh/Event/event_list.md index 483035007..980701147 100644 --- a/docs/assets/guide/zh/Event/event_list.md +++ b/docs/assets/guide/zh/Event/event_list.md @@ -6,6 +6,8 @@ 事件具体的回传数据可进行实际测试来观察是否满足业务需求,或者跟我们沟通对接。 +比较全面的事件列表请参考:https://visactor.io/vtable/api/events + |名称|事件名|描述| |:----|:----|:----| |生命周期事件:完成初始化|INITIALIZED|生命周期事件:成功初始化完成后触发| From 9b8662723c23b251f7e1701075c91d3a0223b1cb Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Sat, 3 Feb 2024 11:39:22 +0800 Subject: [PATCH 080/115] fix: when use tab the cell enter edit mode problem #1049 --- docs/assets/guide/zh/shortcut.md | 2 +- docs/assets/option/zh/common/option-secondary.md | 2 +- packages/vtable/examples/editor/custom-date-editor.ts | 2 +- packages/vtable/src/event/listener/container-dom.ts | 6 +++--- packages/vtable/src/ts-types/table-engine.ts | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/assets/guide/zh/shortcut.md b/docs/assets/guide/zh/shortcut.md index fea17148a..b44e446bb 100644 --- a/docs/assets/guide/zh/shortcut.md +++ b/docs/assets/guide/zh/shortcut.md @@ -27,7 +27,7 @@ keyboardOptions: { moveFocusCellOnTab?: boolean; /** enter键 默认true 如果选中单元格可编辑则进入单元格编辑*/ editCellOnEnter?: boolean; - /** 上下左右方向键,默认不开启即false。开启这个配置的话,如果当前是在编辑单元格方向键可以移动到下个单元格并进入编辑状态,而不是编辑文本内字符串的光标移动 */ + /** 上下左右方向键,默认不开启即false。开启这个配置的话,如果当前是在编辑中的单元格,方向键可以移动到下个单元格并进入编辑状态,而不是编辑文本内字符串的光标移动 */ moveEditCellOnArrowKeys?: boolean; /** 开启快捷键全选 默认:false */ selectAllOnCtrlA?: boolean; diff --git a/docs/assets/option/zh/common/option-secondary.md b/docs/assets/option/zh/common/option-secondary.md index 84247bd59..fd6b42706 100644 --- a/docs/assets/option/zh/common/option-secondary.md +++ b/docs/assets/option/zh/common/option-secondary.md @@ -113,7 +113,7 @@ 默认不开启即false。 -开启这个配置的话,如果当前是在编辑单元格方向键可以移动到下个单元格并进入编辑状态,而不是编辑文本内字符串的光标移动 。 +开启这个配置的话,如果当前是在编辑中的单元格,方向键可以移动到下个单元格并进入编辑状态,而不是编辑文本内字符串的光标移动 。 上下左右方向键切换选中单元格不受该配置影响, diff --git a/packages/vtable/examples/editor/custom-date-editor.ts b/packages/vtable/examples/editor/custom-date-editor.ts index 58f98e062..94ce71ec3 100644 --- a/packages/vtable/examples/editor/custom-date-editor.ts +++ b/packages/vtable/examples/editor/custom-date-editor.ts @@ -288,7 +288,7 @@ export function createTable() { records, columns, keyboardOptions: { - moveFocusCellOnTab: false, + moveFocusCellOnTab: true, // editCellOnEnter: false, moveEditCellOnArrowKeys: true }, diff --git a/packages/vtable/src/event/listener/container-dom.ts b/packages/vtable/src/event/listener/container-dom.ts index 769f7573b..3cbcd075f 100644 --- a/packages/vtable/src/event/listener/container-dom.ts +++ b/packages/vtable/src/event/listener/container-dom.ts @@ -127,9 +127,9 @@ export function bindContainerDomListener(eventManager: EventManager) { if ((table as ListTableAPI).editorManager.editingEditor) { (table as ListTableAPI).editorManager.completeEdit(); table.getElement().focus(); - } - if ((table as ListTableAPI).getEditor(targetCol, targetRow)) { - (table as ListTableAPI).editorManager.startEditCell(targetCol, targetRow); + if ((table as ListTableAPI).getEditor(targetCol, targetRow)) { + (table as ListTableAPI).editorManager.startEditCell(targetCol, targetRow); + } } } } diff --git a/packages/vtable/src/ts-types/table-engine.ts b/packages/vtable/src/ts-types/table-engine.ts index 6c2aa5a80..6e9934fa6 100644 --- a/packages/vtable/src/ts-types/table-engine.ts +++ b/packages/vtable/src/ts-types/table-engine.ts @@ -74,7 +74,7 @@ export interface TableKeyboardOptions { moveFocusCellOnTab?: boolean; /** enter键 默认true 如果选中单元格可编辑则进入单元格编辑*/ editCellOnEnter?: boolean; - /** 默认不开启即false。开启这个配置的话,如果当前是在编辑单元格方向键可以移动到下个单元格并进入编辑状态,而不是编辑文本内字符串的光标移动。上下左右方向键切换选中单元格不受该配置影响,*/ + /** 默认不开启即false。开启这个配置的话,如果当前是在编辑中的单元格,方向键可以移动到下个单元格并进入编辑状态,而不是编辑文本内字符串的光标移动。上下左右方向键切换选中单元格不受该配置影响,*/ moveEditCellOnArrowKeys?: boolean; /** 开启快捷键全选 默认:false */ selectAllOnCtrlA?: boolean; From ca3a5306e3eee85da6653f7d9985b329ecea65e2 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Sat, 3 Feb 2024 13:20:11 +0800 Subject: [PATCH 081/115] refactor: pivot table sort logic #1033 --- packages/vtable/src/dataset/dataset.ts | 20 ++++++++++---------- packages/vtable/src/ts-types/new-data-set.ts | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/vtable/src/dataset/dataset.ts b/packages/vtable/src/dataset/dataset.ts index 2882bcc91..5e67de92a 100644 --- a/packages/vtable/src/dataset/dataset.ts +++ b/packages/vtable/src/dataset/dataset.ts @@ -165,14 +165,14 @@ export class Dataset { this.rowsIsTotal = new Array(this.rows?.length ?? 0).fill(false); this.colsIsTotal = new Array(this.columns?.length ?? 0).fill(false); - if (this.totals?.row?.showSubTotals) { + if (this.totals?.row && this.totals.row.showSubTotals !== false) { for (let i = 0, len = this.totals?.row?.subTotalsDimensions?.length; i < len; i++) { const dimension = this.totals.row.subTotalsDimensions[i]; const dimensionIndex = this.rows.indexOf(dimension); this.rowsIsTotal[dimensionIndex] = true; } } - if (this.totals?.column?.showSubTotals) { + if (this.totals?.column && this.totals.column.showSubTotals !== false) { for (let i = 0, len = this.totals?.column?.subTotalsDimensions?.length; i < len; i++) { const dimension = this.totals.column.subTotalsDimensions[i]; const dimensionIndex = this.columns.indexOf(dimension); @@ -530,7 +530,7 @@ export class Dataset { isToTalRecord = true; break; } else if ( - this.dataConfig?.totals?.row?.showSubTotals && + // this.dataConfig?.totals?.row?.showSubTotals && this.dataConfig?.totals?.row?.subTotalsDimensions.indexOf(this.rows[l - 1]) >= 0 ) { if (this.rowHierarchyType === 'grid') { @@ -560,7 +560,7 @@ export class Dataset { isToTalRecord = true; break; } else if ( - this.dataConfig?.totals?.column?.showSubTotals && + // this.dataConfig?.totals?.column?.showSubTotals && this.dataConfig?.totals?.column?.subTotalsDimensions.indexOf(this.columns[n - 1]) >= 0 ) { colKey.push(this.colSubTotalLabel); @@ -968,9 +968,9 @@ export class Dataset { let bChanged = b; if (sorter.fieldIndex < fieldArr.length - 1) { aChanged = a.slice(0, sorter.fieldIndex + 1); - aChanged.push(isRow ? that.totals?.row?.subTotalLabel : that.totals?.column?.subTotalLabel); + aChanged.push(isRow ? that.rowSubTotalLabel : that.colSubTotalLabel); bChanged = b.slice(0, sorter.fieldIndex + 1); - bChanged.push(isRow ? that.totals?.row?.subTotalLabel : that.totals?.column?.subTotalLabel); + bChanged.push(isRow ? that.rowSubTotalLabel : that.colSubTotalLabel); } comparison = sorter.func(aChanged, bChanged); } else { @@ -1045,8 +1045,8 @@ export class Dataset { totalStatistics() { const that = this; if ( - (that?.totals?.column?.showSubTotals && that?.totals?.column?.subTotalsDimensions?.length >= 1) || - (that?.totals?.row?.showSubTotals && that?.totals?.row?.subTotalsDimensions?.length >= 1) || + that?.totals?.column?.subTotalsDimensions?.length >= 1 || + that?.totals?.row?.subTotalsDimensions?.length >= 1 || that?.totals?.column?.showGrandTotals || that?.totals?.row?.showGrandTotals // || @@ -1073,7 +1073,7 @@ export class Dataset { if (dimensionIndex >= 0) { const colTotalKey = colKey.slice(0, dimensionIndex + 1); // if (this.rowHierarchyType === 'grid') { - colTotalKey.push(that.totals?.column?.subTotalLabel ?? '小计'); + colTotalKey.push(that.colSubTotalLabel); // } const flatColTotalKey = colTotalKey.join(this.stringJoinChar); if (this.totalRecordsTree?.[flatRowKey]?.[flatColTotalKey]) { @@ -1148,7 +1148,7 @@ export class Dataset { const rowTotalKey = rowKey.slice(0, dimensionIndex + 1); if (this.rowHierarchyType === 'grid') { // 如果是tree的情况则不追加小计单元格值 - rowTotalKey.push(that.totals?.row?.subTotalLabel ?? '小计'); + rowTotalKey.push(that.rowSubTotalLabel); } const flatRowTotalKey = rowTotalKey.join(this.stringJoinChar); if (!this.tree[flatRowTotalKey]) { diff --git a/packages/vtable/src/ts-types/new-data-set.ts b/packages/vtable/src/ts-types/new-data-set.ts index 3ee6833c6..e782943aa 100644 --- a/packages/vtable/src/ts-types/new-data-set.ts +++ b/packages/vtable/src/ts-types/new-data-set.ts @@ -27,9 +27,9 @@ export interface CalcTotals { } export interface Total { - /** 是否显示总计; */ + /** 是否显示总计; 如果配置了total对象,showGrandTotals默认false */ showGrandTotals: boolean; - /** 是否显示小计; */ + /** 是否显示小计; 如果配置了total对象,showSubTotals默认为true */ showSubTotals: boolean; // // 计算总计方法 From 60a25d134b040186bd132f311f9768147123b5f8 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Sat, 3 Feb 2024 13:25:00 +0800 Subject: [PATCH 082/115] docs: update changlog of rush --- .../vtable/1033-bug-pivotSort_2024-02-03-05-25.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vtable/1033-bug-pivotSort_2024-02-03-05-25.json diff --git a/common/changes/@visactor/vtable/1033-bug-pivotSort_2024-02-03-05-25.json b/common/changes/@visactor/vtable/1033-bug-pivotSort_2024-02-03-05-25.json new file mode 100644 index 000000000..a37c7cb71 --- /dev/null +++ b/common/changes/@visactor/vtable/1033-bug-pivotSort_2024-02-03-05-25.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "refactor: pivot table sort logic #1033\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file From d30631615816897e227f8e16c43b0fddf7de618e Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Sat, 3 Feb 2024 18:09:46 +0800 Subject: [PATCH 083/115] feat: add update sort rule api --- packages/vtable/src/PivotTable.ts | 4 +- packages/vtable/src/dataset/dataset.ts | 40 +++ .../vtable/src/layout/pivot-header-layout.ts | 235 +++++++++--------- 3 files changed, 157 insertions(+), 122 deletions(-) diff --git a/packages/vtable/src/PivotTable.ts b/packages/vtable/src/PivotTable.ts index 79bca6277..f6806ddc4 100644 --- a/packages/vtable/src/PivotTable.ts +++ b/packages/vtable/src/PivotTable.ts @@ -721,13 +721,13 @@ export class PivotTable extends BaseTable implements PivotTableAPI { return this.getCellOriginRecord(col, row); } /** - * 全量更新排序规则 TODO 待完善 + * 全量更新排序规则 * @param sortRules */ updateSortRules(sortRules: SortRules) { this.internalProps.dataConfig.sortRules = sortRules; this.dataset.updateSortRules(sortRules); - // (this.internalProps.layoutMap as PivotLayoutMap).updateDataset(this.dataset); + this.internalProps.layoutMap.resetHeaderTree(); // 清空单元格内容 this.scenegraph.clearCells(); this.refreshHeader(); diff --git a/packages/vtable/src/dataset/dataset.ts b/packages/vtable/src/dataset/dataset.ts index 5e67de92a..9afaeb07f 100644 --- a/packages/vtable/src/dataset/dataset.ts +++ b/packages/vtable/src/dataset/dataset.ts @@ -712,6 +712,46 @@ export class Dataset { this.sorted = false; this.sortRules = sortRules; this.sortKeys(); + //和初始化代码逻辑一致 但未考虑透视图类型 + if (!this.customRowTree) { + if (this.rowHierarchyType === 'tree') { + this.rowHeaderTree = this.ArrToTree1( + this.rowKeys, + this.rows, + this.indicatorsAsCol ? undefined : this.indicators, + this.totals?.row?.showGrandTotals || + (!this.indicatorsAsCol && this.columns.length === 0) || + (this.indicatorsAsCol && this.rows.length === 0), + this.rowGrandTotalLabel + ); + } else { + this.rowHeaderTree = this.ArrToTree( + this.rowKeys, + this.rows, + this.indicatorsAsCol ? undefined : this.indicators, + this.rowsIsTotal, + this.totals?.row?.showGrandTotals || (this.indicatorsAsCol && this.rows.length === 0), + this.rowGrandTotalLabel, + this.rowSubTotalLabel, + this.totals?.row?.showGrandTotalsOnTop ?? false, + this.totals?.row?.showSubTotalsOnTop ?? false + ); + } + } + + if (!this.customColTree) { + this.colHeaderTree = this.ArrToTree( + this.colKeys, + this.columns, + this.indicatorsAsCol ? this.indicators : undefined, + this.colsIsTotal, + this.totals?.column?.showGrandTotals || (!this.indicatorsAsCol && this.columns.length === 0), // || this.rows.length === 0,//todo 这里原有逻辑暂时注释掉 + this.colGrandTotalLabel, + this.colSubTotalLabel, + this.totals?.column?.showGrandTotalsOnLeft ?? false, + this.totals?.column?.showSubTotalsOnLeft ?? false + ); + } // this.rowKeysPath_FULL = this.TreeToArr( // this.ArrToTree( // this.rowKeys, diff --git a/packages/vtable/src/layout/pivot-header-layout.ts b/packages/vtable/src/layout/pivot-header-layout.ts index ff18c7814..030437ce4 100644 --- a/packages/vtable/src/layout/pivot-header-layout.ts +++ b/packages/vtable/src/layout/pivot-header-layout.ts @@ -225,91 +225,11 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { this.resetRowHeaderLevelCount(); //生成列表头单元格 - if (this.columnDimensionTree.tree.children?.length >= 1) { - this.columnHeaderObjs = this._addHeaders( - this._columnHeaderCellIds, - 0, - this.columnDimensionTree.tree.children, - [] - ); - } - // if (typeof this.showColumnHeader !== 'boolean') { - if (this.columnHeaderTitle) { - this.sharedVar.seqId = Math.max(this.sharedVar.seqId, this._headerObjects.length); - const id = ++this.sharedVar.seqId; - const firstRowIds = Array(this.colCount - this.rowHeaderLevelCount).fill(id); - this._columnHeaderCellIds.unshift(firstRowIds); - const cell: HeaderData = { - id, - title: - typeof this.columnHeaderTitle.title === 'string' - ? this.columnHeaderTitle.title - : (this.columnsDefine.reduce((title: string, value) => { - if (typeof value === 'string') { - return title; - } - return title + (title ? `/${value.title}` : `${value.title}`); - }, '') as string), - field: undefined, - headerType: this.columnHeaderTitle.headerType ?? 'text', - style: this.columnHeaderTitle.headerStyle, - define: { - id, - disableHeaderHover: !!this.columnHeaderTitle.disableHeaderHover, - disableHeaderSelect: !!this.columnHeaderTitle.disableHeaderSelect - } - }; - this.columnHeaderObjs.push(cell); - this._headerObjects[id] = cell; - } - // } + this._generateColHeaderIds(); this.colIndex = 0; //生成行表头单元格 - if (this.rowDimensionTree.tree.children?.length >= 1) { - this.rowHeaderObjs = - this.rowHierarchyType === 'tree' - ? this._addHeadersForTreeMode( - this._rowHeaderCellIds_FULL, - 0, - this.rowDimensionTree.tree.children, - [], - this.rowDimensionTree.totalLevel, - true, - this.rowsDefine - ) - : this._addHeaders(this._rowHeaderCellIds_FULL, 0, this.rowDimensionTree.tree.children, []); - } - // if (typeof this.showRowHeader !== 'boolean') { - if (this.rowHeaderTitle) { - this.sharedVar.seqId = Math.max(this.sharedVar.seqId, this._headerObjects.length); - const id = ++this.sharedVar.seqId; - const firstColIds = Array(this._rowHeaderCellIds_FULL[0]?.length ?? this.rowDimensionTree.tree.size).fill(id); - this._rowHeaderCellIds_FULL.unshift(firstColIds); - const cell: HeaderData = { - id, - title: - typeof this.rowHeaderTitle.title === 'string' - ? this.rowHeaderTitle.title - : (this.rowsDefine.reduce((title: string, value) => { - if (typeof value === 'string') { - return title; - } - return title + (title ? `/${value.title}` : `${value.title}`); - }, '') as string), - field: undefined, - headerType: this.rowHeaderTitle.headerType ?? 'text', - style: this.rowHeaderTitle.headerStyle, - define: { - id, - disableHeaderHover: !!this.columnHeaderTitle.disableHeaderHover, - disableHeaderSelect: !!this.columnHeaderTitle.disableHeaderSelect - } - }; - this.rowHeaderObjs.push(cell); - this._headerObjects[id] = cell; - } - // } + this._generateRowHeaderIds(); if (this._table.isPivotChart()) { this.hasTwoIndicatorAxes = this._indicators.some(indicatorObject => { @@ -464,7 +384,90 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { this.setColumnWidths(); } - + _generateColHeaderIds() { + if (this.columnDimensionTree.tree.children?.length >= 1) { + this.columnHeaderObjs = this._addHeaders( + this._columnHeaderCellIds, + 0, + this.columnDimensionTree.tree.children, + [] + ); + } + // if (typeof this.showColumnHeader !== 'boolean') { + if (this.columnHeaderTitle) { + this.sharedVar.seqId = Math.max(this.sharedVar.seqId, this._headerObjects.length); + const id = ++this.sharedVar.seqId; + const firstRowIds = Array(this.colCount - this.rowHeaderLevelCount).fill(id); + this._columnHeaderCellIds.unshift(firstRowIds); + const cell: HeaderData = { + id, + title: + typeof this.columnHeaderTitle.title === 'string' + ? this.columnHeaderTitle.title + : (this.columnsDefine.reduce((title: string, value) => { + if (typeof value === 'string') { + return title; + } + return title + (title ? `/${value.title}` : `${value.title}`); + }, '') as string), + field: undefined, + headerType: this.columnHeaderTitle.headerType ?? 'text', + style: this.columnHeaderTitle.headerStyle, + define: { + id, + disableHeaderHover: !!this.columnHeaderTitle.disableHeaderHover, + disableHeaderSelect: !!this.columnHeaderTitle.disableHeaderSelect + } + }; + this.columnHeaderObjs.push(cell); + this._headerObjects[id] = cell; + } + } + _generateRowHeaderIds() { + if (this.rowDimensionTree.tree.children?.length >= 1) { + this.rowHeaderObjs = + this.rowHierarchyType === 'tree' + ? this._addHeadersForTreeMode( + this._rowHeaderCellIds_FULL, + 0, + this.rowDimensionTree.tree.children, + [], + this.rowDimensionTree.totalLevel, + true, + this.rowsDefine + ) + : this._addHeaders(this._rowHeaderCellIds_FULL, 0, this.rowDimensionTree.tree.children, []); + } + // if (typeof this.showRowHeader !== 'boolean') { + if (this.rowHeaderTitle) { + this.sharedVar.seqId = Math.max(this.sharedVar.seqId, this._headerObjects.length); + const id = ++this.sharedVar.seqId; + const firstColIds = Array(this._rowHeaderCellIds_FULL[0]?.length ?? this.rowDimensionTree.tree.size).fill(id); + this._rowHeaderCellIds_FULL.unshift(firstColIds); + const cell: HeaderData = { + id, + title: + typeof this.rowHeaderTitle.title === 'string' + ? this.rowHeaderTitle.title + : (this.rowsDefine.reduce((title: string, value) => { + if (typeof value === 'string') { + return title; + } + return title + (title ? `/${value.title}` : `${value.title}`); + }, '') as string), + field: undefined, + headerType: this.rowHeaderTitle.headerType ?? 'text', + style: this.rowHeaderTitle.headerStyle, + define: { + id, + disableHeaderHover: !!this.columnHeaderTitle.disableHeaderHover, + disableHeaderSelect: !!this.columnHeaderTitle.disableHeaderSelect + } + }; + this.rowHeaderObjs.push(cell); + this._headerObjects[id] = cell; + } + } _addHeaders(_headerCellIds: number[][], row: number, header: ITreeLayoutHeadNode[], roots: number[]): HeaderData[] { const _this = this; function _newRow(row: number): number[] { @@ -2836,44 +2839,36 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { }); return totalCount; } - updateDataset(dataset: Dataset) { - // this.dataset = dataset; + resetHeaderTree() { + //和初始化代码逻辑一致 但未考虑透视图类型 + this._rowHeaderCellIds_FULL = []; + this._columnHeaderCellIds = []; + const dataset = this.dataset; // if (dataset) { - // this.rowTree = dataset.rowHeaderTree; - // this.columnTree = dataset.colHeaderTree; - // if (this.indicatorsAsCol) { - // const supplyAxisNode = (nodes: IHeaderTreeDefine[]) => { - // nodes.forEach((node: IHeaderTreeDefine) => { - // if (node.children?.length) { - // supplyAxisNode(node.children); - // } else { - // node.children = [ - // { - // dimensionKey: 'axis', - // value: '' - // } - // ]; - // } - // }); - // }; - // supplyAxisNode(this.rowTree); - // } - // } - // // 收集指标所有key - // this.indicatorsDefine?.forEach(indicator => { - // // this.indicatorKeys[indicator.indicatorKey] = indicator.value; - // if (typeof indicator === 'string') { - // this.indicatorKeys.push(indicator); - // } else { - // this.indicatorKeys.push(indicator.indicatorKey); - // } - // }); - // this.columnDimensionTree = new DimensionTree((this.columnTree as IPivotLayoutHeadNode[]) ?? []); - // this.rowDimensionTree = new DimensionTree( - // (this.rowTree as IPivotLayoutHeadNode[]) ?? [], - // this.rowHierarchyType, - // this.rowHierarchyType === 'tree' ? this.rowExpandLevel : undefined - // ); + this.rowTree = dataset.rowHeaderTree; + + this.columnDimensionTree = new DimensionTree((this.columnTree as ITreeLayoutHeadNode[]) ?? [], this.sharedVar); + this.rowDimensionTree = new DimensionTree( + (this.rowTree as ITreeLayoutHeadNode[]) ?? [], + this.sharedVar, + this.rowHierarchyType, + this.rowHierarchyType === 'tree' ? this.rowExpandLevel : undefined + ); + //生成列表头单元格 + this._generateColHeaderIds(); + + this.colIndex = 0; + //生成行表头单元格 + this._generateRowHeaderIds(); + + this.resetColumnHeaderLevelCount(); + this._rowHeaderCellIds_FULL = transpose(this._rowHeaderCellIds_FULL); + + this._headerObjectMap = this._headerObjects.reduce((o, e) => { + o[e.id as number] = e; + return o; + }, {} as { [key: LayoutObjectId]: HeaderData }); + this.setPagination(this.pagination); } } /** 计算 scale 的实际 range 长度 */ From cbb08cf46ff48f8ca651c7836eaf45e14fb38008 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Sat, 3 Feb 2024 18:10:21 +0800 Subject: [PATCH 084/115] docs: update changlog of rush --- .../vtable/1033-bug-pivotSort_2024-02-03-10-10.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vtable/1033-bug-pivotSort_2024-02-03-10-10.json diff --git a/common/changes/@visactor/vtable/1033-bug-pivotSort_2024-02-03-10-10.json b/common/changes/@visactor/vtable/1033-bug-pivotSort_2024-02-03-10-10.json new file mode 100644 index 000000000..d9850a690 --- /dev/null +++ b/common/changes/@visactor/vtable/1033-bug-pivotSort_2024-02-03-10-10.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "feat: add update sort rule api\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file From e1a4ad3000b551c841728208345f24d176fa1b50 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Mon, 5 Feb 2024 11:03:05 +0800 Subject: [PATCH 085/115] fix: when table has scroll then click header to edit position error #1069 --- packages/vtable/src/core/BaseTable.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/vtable/src/core/BaseTable.ts b/packages/vtable/src/core/BaseTable.ts index 0130723c5..7aba93f74 100644 --- a/packages/vtable/src/core/BaseTable.ts +++ b/packages/vtable/src/core/BaseTable.ts @@ -1271,7 +1271,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { absoluteLeft = this.tableNoFrameWidth - (this.getColsWidth(col, this.colCount - 1) ?? 0); } else { absoluteLeft = this.getColsWidth(0, col - 1) || 0; - absoluteLeft += this.scrollLeft; + // absoluteLeft += this.scrollLeft; } } else { absoluteLeft = this.getColsWidth(0, col - 1) || 0; @@ -1284,7 +1284,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { absoluteTop = this.tableNoFrameHeight - (this.getRowsHeight(row, this.rowCount - 1) ?? 0); } else { absoluteTop = this.getRowsHeight(0, row - 1); - absoluteTop += this.scrollTop; + // absoluteTop += this.scrollTop; } } else { absoluteTop = this.getRowsHeight(0, row - 1); @@ -1425,20 +1425,20 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { let absoluteLeft = this.getColsWidth(0, startCol - 1) || 0; // startCol为0时,absoluteLeft计算为Nan let width = this.getColsWidth(startCol, endCol); - if (isFrozenStartCell && isFrozenStartCell.col) { + if (isFrozenStartCell?.col) { const scrollLeft = this.scrollLeft; absoluteLeft += scrollLeft; - if (!isFrozenEndCell || !isFrozenEndCell.col) { + if (!isFrozenEndCell?.col) { width -= scrollLeft; width = Math.max(width, this.getColsWidth(startCol, this.frozenColCount - 1)); } } - let absoluteTop = this.getRowsHeight(0, startRow - 1); + const absoluteTop = this.getRowsHeight(0, startRow - 1); let height = this.getRowsHeight(startRow, endRow); - if (isFrozenStartCell && isFrozenStartCell.row) { + if (isFrozenStartCell?.row) { const scrollTop = this.scrollTop; - absoluteTop += scrollTop; - if (!isFrozenEndCell || !isFrozenEndCell.row) { + // absoluteTop += scrollTop; + if (!isFrozenEndCell?.row) { height -= scrollTop; height = Math.max(height, this.getRowsHeight(startRow, this.frozenRowCount - 1)); } From 40b4c5c02db5b8c503b7dafbd9fff2803e75cf98 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Mon, 5 Feb 2024 11:03:35 +0800 Subject: [PATCH 086/115] docs: update changlog of rush --- ...erEditor-position-withScroll_2024-02-05-03-03.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vtable/1069-bug-headerEditor-position-withScroll_2024-02-05-03-03.json diff --git a/common/changes/@visactor/vtable/1069-bug-headerEditor-position-withScroll_2024-02-05-03-03.json b/common/changes/@visactor/vtable/1069-bug-headerEditor-position-withScroll_2024-02-05-03-03.json new file mode 100644 index 000000000..15d7269fe --- /dev/null +++ b/common/changes/@visactor/vtable/1069-bug-headerEditor-position-withScroll_2024-02-05-03-03.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: when table has scroll then click header to edit position error #1069\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file From 516f20fbd17156a105b865d764a846a1bd65783e Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Mon, 5 Feb 2024 12:53:37 +0800 Subject: [PATCH 087/115] fix: columnTree reset when udpate sort rule #1030 --- packages/vtable/src/layout/pivot-header-layout.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/vtable/src/layout/pivot-header-layout.ts b/packages/vtable/src/layout/pivot-header-layout.ts index 030437ce4..2c96f8cb3 100644 --- a/packages/vtable/src/layout/pivot-header-layout.ts +++ b/packages/vtable/src/layout/pivot-header-layout.ts @@ -2846,6 +2846,7 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { const dataset = this.dataset; // if (dataset) { this.rowTree = dataset.rowHeaderTree; + this.columnTree = dataset.colHeaderTree; this.columnDimensionTree = new DimensionTree((this.columnTree as ITreeLayoutHeadNode[]) ?? [], this.sharedVar); this.rowDimensionTree = new DimensionTree( From d7dff82f5ac5f4f57cc9c83731b753b3265764f0 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Mon, 5 Feb 2024 15:13:05 +0800 Subject: [PATCH 088/115] refactor: showsort option work well #1077 --- packages/vtable/src/ListTable.ts | 12 ++++++------ packages/vtable/src/core/BaseTable.ts | 11 ----------- packages/vtable/src/header-helper/header-helper.ts | 8 +++++++- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/packages/vtable/src/ListTable.ts b/packages/vtable/src/ListTable.ts index f6a1d0267..413c25a69 100644 --- a/packages/vtable/src/ListTable.ts +++ b/packages/vtable/src/ListTable.ts @@ -774,13 +774,13 @@ export class ListTable extends BaseTable implements ListTableAPI { } else { hd = this.internalProps.layoutMap.headerObjects.find((col: any) => col && col.field === field); } - if (hd?.define?.sort) { - this.dataSource.sort(hd.field, order, sortFunc); + // if (hd?.define?.sort) { + this.dataSource.sort(hd.field, order, sortFunc); - // clear cell range cache - this.internalProps.layoutMap.clearCellRangeMap(); - this.scenegraph.sortCell(); - } + // clear cell range cache + this.internalProps.layoutMap.clearCellRangeMap(); + this.scenegraph.sortCell(); + // } } this.stateManager.updateSortState(sortState as SortState); } diff --git a/packages/vtable/src/core/BaseTable.ts b/packages/vtable/src/core/BaseTable.ts index 0130723c5..474fcf8ef 100644 --- a/packages/vtable/src/core/BaseTable.ts +++ b/packages/vtable/src/core/BaseTable.ts @@ -101,7 +101,6 @@ const EMPTY_STYLE = {}; export abstract class BaseTable extends EventTarget implements BaseTableAPI { internalProps: IBaseTableProtected; showFrozenIcon = true; - showSort = true; padding: { top: number; left: number; right: number; bottom: number }; globalDropDownMenu?: MenuListItem[]; //画布绘制单元格的区域 不包括整体边框frame,所以比canvas的width和height要小一点(canvas的width包括了frame) @@ -1939,16 +1938,6 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { padding.right && (this.padding.right = padding.right); } } - - // 更新hover/click状态 - - // 更新基础组件显示状态 - // (showHeader!=undefined) &&(this.showHeader = showHeader); - // (showFrozenIcon!=undefined) &&(this.showFrozenIcon = showFrozenIcon); - // (showSort!=undefined) &&(this.showSort = showSort); - // style.initDocument(scrollBar); - // this.showHeader = typeof showHeader === 'boolean' ? showHeader : true; - // this.scrollBar = typeof scrollBar === 'boolean' ? scrollBar : true; this.showFrozenIcon = typeof showFrozenIcon === 'boolean' ? showFrozenIcon : true; if (typeof allowFrozenColCount === 'number' && allowFrozenColCount <= 0) { this.showFrozenIcon = false; diff --git a/packages/vtable/src/header-helper/header-helper.ts b/packages/vtable/src/header-helper/header-helper.ts index 9ff5e88f9..876775ef5 100644 --- a/packages/vtable/src/header-helper/header-helper.ts +++ b/packages/vtable/src/header-helper/header-helper.ts @@ -9,6 +9,7 @@ import { TextHeaderStyle } from './style'; import type { ListTable } from '../ListTable'; import type { BaseTableAPI } from '../ts-types/base-table'; import { CheckboxStyle } from './style/CheckboxStyle'; +import { isValid } from '@visactor/vutils'; export class HeaderHelper { normalIcon: SvgIcon; upIcon: SvgIcon; @@ -182,7 +183,12 @@ export class HeaderHelper { const icon = order === 'asc' ? this.downIcon : order === 'desc' ? this.upIcon : this.normalIcon; const headerC = _table.getHeaderDefine(col, row) as any; - if (!headerC || !(headerC.showSort || headerC.sort) || (headerC.columns && headerC.columns.length > 0)) { + if ( + !headerC || + headerC.showSort === false || + (!isValid(headerC.showSort) && !isValid(headerC.sort)) || + (headerC.columns && headerC.columns.length > 0) + ) { return null; } return icon; From ce1d214f9686846243edd3964952b2732cc5f5bd Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Mon, 5 Feb 2024 15:13:24 +0800 Subject: [PATCH 089/115] docs: update changlog of rush --- ...actor-sort-showsort-function_2024-02-05-07-13.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vtable/1077-refactor-sort-showsort-function_2024-02-05-07-13.json diff --git a/common/changes/@visactor/vtable/1077-refactor-sort-showsort-function_2024-02-05-07-13.json b/common/changes/@visactor/vtable/1077-refactor-sort-showsort-function_2024-02-05-07-13.json new file mode 100644 index 000000000..8e849ee94 --- /dev/null +++ b/common/changes/@visactor/vtable/1077-refactor-sort-showsort-function_2024-02-05-07-13.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "refactor: showsort option work well #1077\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file From 420c20772f95138330824155bb62f1314633cea9 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Mon, 5 Feb 2024 15:50:03 +0800 Subject: [PATCH 090/115] fix: sort set false bug --- packages/vtable/src/ListTable.ts | 16 +++++++++------- packages/vtable/src/PivotChart.ts | 7 ++++++- .../vtable/src/header-helper/header-helper.ts | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/packages/vtable/src/ListTable.ts b/packages/vtable/src/ListTable.ts index 413c25a69..0d46dee5f 100644 --- a/packages/vtable/src/ListTable.ts +++ b/packages/vtable/src/ListTable.ts @@ -774,13 +774,13 @@ export class ListTable extends BaseTable implements ListTableAPI { } else { hd = this.internalProps.layoutMap.headerObjects.find((col: any) => col && col.field === field); } - // if (hd?.define?.sort) { - this.dataSource.sort(hd.field, order, sortFunc); + if (hd.define.sort !== false) { + this.dataSource.sort(hd.field, order, sortFunc); - // clear cell range cache - this.internalProps.layoutMap.clearCellRangeMap(); - this.scenegraph.sortCell(); - // } + // clear cell range cache + this.internalProps.layoutMap.clearCellRangeMap(); + this.scenegraph.sortCell(); + } } this.stateManager.updateSortState(sortState as SortState); } @@ -847,7 +847,9 @@ export class ListTable extends BaseTable implements ListTableAPI { hd = this.internalProps.layoutMap.headerObjects.find((col: any) => col && col.field === field); } // hd?.define?.sort && //如果这里也判断 那想要利用sortState来排序 但不显示排序图标就实现不了 - this.dataSource.sort(hd.field, order, sortFunc ?? defaultOrderFn); + if (hd.define.sort !== false) { + this.dataSource.sort(hd.field, order, sortFunc ?? defaultOrderFn); + } } } this.refreshRowColCount(); diff --git a/packages/vtable/src/PivotChart.ts b/packages/vtable/src/PivotChart.ts index 994c89169..d4ec76945 100644 --- a/packages/vtable/src/PivotChart.ts +++ b/packages/vtable/src/PivotChart.ts @@ -518,7 +518,12 @@ export class PivotChart extends BaseTable implements PivotChartAPI { updateSortRules(sortRules: SortRules) { this.internalProps.dataConfig.sortRules = sortRules; this.dataset.updateSortRules(sortRules); - (this.internalProps.layoutMap as PivotHeaderLayoutMap).updateDataset(this.dataset); + this.internalProps.layoutMap.resetHeaderTree(); + // 清空单元格内容 + this.scenegraph.clearCells(); + this.refreshHeader(); + // 生成单元格场景树 + this.scenegraph.createSceneGraph(); this.render(); } updatePivotSortState( diff --git a/packages/vtable/src/header-helper/header-helper.ts b/packages/vtable/src/header-helper/header-helper.ts index 876775ef5..2415ea9b2 100644 --- a/packages/vtable/src/header-helper/header-helper.ts +++ b/packages/vtable/src/header-helper/header-helper.ts @@ -186,7 +186,7 @@ export class HeaderHelper { if ( !headerC || headerC.showSort === false || - (!isValid(headerC.showSort) && !isValid(headerC.sort)) || + (!isValid(headerC.showSort) && !headerC.sort) || (headerC.columns && headerC.columns.length > 0) ) { return null; From 903bb6b76c1695507f5f2d422ac20540b94ff2f5 Mon Sep 17 00:00:00 2001 From: martes Date: Mon, 5 Feb 2024 16:31:39 +0800 Subject: [PATCH 091/115] fix: isEditorElement check timing --- packages/vtable/src/edit/edit-manager.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/vtable/src/edit/edit-manager.ts b/packages/vtable/src/edit/edit-manager.ts index c66e5ef5c..81ba891b8 100644 --- a/packages/vtable/src/edit/edit-manager.ts +++ b/packages/vtable/src/edit/edit-manager.ts @@ -104,14 +104,18 @@ export class EditManeger { } const target = e?.target as HTMLElement | undefined; + const { editingEditor: editor } = this; - if (this.editingEditor.targetIsOnEditor) { - console.warn('VTable Warn: `targetIsOnEditor` is deprecated, please use `isEditorElement` instead.'); - if (target && this.editingEditor.targetIsOnEditor(target)) { + if (target) { + if (editor.targetIsOnEditor) { + console.warn('VTable Warn: `targetIsOnEditor` is deprecated, please use `isEditorElement` instead.'); + + if (editor.targetIsOnEditor(target)) { + return; + } + } else if (!editor.isEditorElement || editor.isEditorElement(target)) { return; } - } else if (!this.editingEditor.isEditorElement || (target && this.editingEditor.isEditorElement?.(target))) { - return; } if (!this.editingEditor.getValue) { From 53f8b1d6660efd9452ced53eb5f40c841a3d0bb7 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Mon, 5 Feb 2024 16:32:07 +0800 Subject: [PATCH 092/115] docs: update sort tutorial --- docs/assets/api/en/methods.md | 10 ++++++++++ docs/assets/api/zh/methods.md | 10 ++++++++++ docs/assets/guide/en/basic_function/sort.md | 9 ++++++--- .../table_type/Pivot_table/pivot_table_dataAnalysis.md | 3 +++ docs/assets/guide/zh/basic_function/sort.md | 9 +++++---- .../table_type/Pivot_table/pivot_table_dataAnalysis.md | 3 +++ 6 files changed, 37 insertions(+), 7 deletions(-) diff --git a/docs/assets/api/en/methods.md b/docs/assets/api/en/methods.md index a77f04639..9e1b07ee2 100644 --- a/docs/assets/api/en/methods.md +++ b/docs/assets/api/en/methods.md @@ -592,6 +592,16 @@ Update the sort status, ListTable exclusive */ updateSortState(sortState: SortState[] | SortState | null, executeSort: boolean = true) ``` +## updateSortRules(Function) + +Pivot table update sorting rules, exclusive to PivotTable +``` + /** + * Full update of sorting rules + * @param sortRules + */ + updateSortRules(sortRules: SortRules) +``` ## updatePivotSortState(Function) diff --git a/docs/assets/api/zh/methods.md b/docs/assets/api/zh/methods.md index 7e0ad899c..3fdfb03fd 100644 --- a/docs/assets/api/zh/methods.md +++ b/docs/assets/api/zh/methods.md @@ -588,6 +588,16 @@ enum HierarchyState { */ updateSortState(sortState: SortState[] | SortState | null, executeSort: boolean = true) ``` +## updateSortRules(Function) + +透视表更新排序规则,PivotTable 专有 +``` + /** + * 全量更新排序规则 + * @param sortRules + */ + updateSortRules(sortRules: SortRules) +``` ## updatePivotSortState(Function) diff --git a/docs/assets/guide/en/basic_function/sort.md b/docs/assets/guide/en/basic_function/sort.md index 1edb54b8d..6fcc8c623 100644 --- a/docs/assets/guide/en/basic_function/sort.md +++ b/docs/assets/guide/en/basic_function/sort.md @@ -4,6 +4,8 @@ In the process of data analytics, the sorting (sorting) function is very importa VTable provides rich sorting functions, users can easily open on demand, customize sorting rules, set initial sorting status, etc. +**Note**: This tutorial is only for the basic table ListTable. The pivot table sorting tutorial can be asynchronously accessed: https://visactor.io/vtable/guide/table_type/Pivot_table/pivot_table_dataAnalysis + ## Enable sorting To use the sorting function of VTable, you need to configure the table columns first. exist `columns` The configuration items for each column need to be set according to cellType (column type). In this tutorial, we mainly focus on sorting-related configurations. @@ -313,13 +315,13 @@ const columns =[ "field": "230517143221027", "title": "Order ID", "width": "auto", - "sort":true + "showSort":true }, { "field": "230517143221030", "title": "Customer ID", "width": "auto", - "sort":true + "showSort":true }, { "field": "230517143221032", @@ -377,8 +379,9 @@ const option = { // 创建 VTable 实例 const tableInstance = new VTable.ListTable(document.getElementById(CONTAINER_ID), option); window.tableInstance=tableInstance; +const clickCount=0; tableInstance.on('sort_click', args => { - const sortState = Date.now() % 3 === 0 ? 'desc' : Date.now() % 3 === 1 ? 'asc' : 'normal'; + const sortState = clickCount % 3 === 0 ? 'desc' : clickCount % 3 === 1 ? 'asc' : 'normal'; sortRecords(args.field, sortState) .then(records => { tableInstance.setRecords(records, null); diff --git a/docs/assets/guide/en/table_type/Pivot_table/pivot_table_dataAnalysis.md b/docs/assets/guide/en/table_type/Pivot_table/pivot_table_dataAnalysis.md index e44179739..28f28ae36 100644 --- a/docs/assets/guide/en/table_type/Pivot_table/pivot_table_dataAnalysis.md +++ b/docs/assets/guide/en/table_type/Pivot_table/pivot_table_dataAnalysis.md @@ -96,6 +96,9 @@ Configuration example: ] ``` + +If you need to modify the sorting rules of the pivot table, you can use the interface `updateSortRules`. + Online demo:https://visactor.io/vtable/demo/data-analysis/pivot-analysis-sort-dimension ### 3. Filter rules [option description](../../../option/PivotTable#dataConfig.filterRules) diff --git a/docs/assets/guide/zh/basic_function/sort.md b/docs/assets/guide/zh/basic_function/sort.md index 3c8b7b4a9..76b350cce 100644 --- a/docs/assets/guide/zh/basic_function/sort.md +++ b/docs/assets/guide/zh/basic_function/sort.md @@ -4,7 +4,7 @@ VTable 提供了丰富的排序功能,用户可以轻松地按需开启、自定义排序规则、设定初始排序状态等。 -**注**:该教程进针对基本表格ListTable,透视表的排序教程后续再补充! +**注**:该教程进针对基本表格ListTable,透视表的排序教程可异步至:https://visactor.io/vtable/guide/table_type/Pivot_table/pivot_table_dataAnalysis ## 开启排序 @@ -319,13 +319,13 @@ const columns =[ "field": "230517143221027", "title": "Order ID", "width": "auto", - "sort":true + "showSort":true }, { "field": "230517143221030", "title": "Customer ID", "width": "auto", - "sort":true + "showSort":true }, { "field": "230517143221032", @@ -383,8 +383,9 @@ const option = { // 创建 VTable 实例 const tableInstance = new VTable.ListTable(document.getElementById(CONTAINER_ID), option); window.tableInstance=tableInstance; +const clickCount=0; tableInstance.on('sort_click', args => { - const sortState = Date.now() % 3 === 0 ? 'desc' : Date.now() % 3 === 1 ? 'asc' : 'normal'; + const sortState = clickCount % 3 === 0 ? 'desc' : clickCount % 3 === 1 ? 'asc' : 'normal'; sortRecords(args.field, sortState) .then(records => { debugger; diff --git a/docs/assets/guide/zh/table_type/Pivot_table/pivot_table_dataAnalysis.md b/docs/assets/guide/zh/table_type/Pivot_table/pivot_table_dataAnalysis.md index 311d4e640..f2955e934 100644 --- a/docs/assets/guide/zh/table_type/Pivot_table/pivot_table_dataAnalysis.md +++ b/docs/assets/guide/zh/table_type/Pivot_table/pivot_table_dataAnalysis.md @@ -97,6 +97,9 @@ dataConfig: { ] ``` + +如果需要修改排序规则 透视表可以使用接口 `updateSortRules`。 + 具体示例:https://visactor.io/vtable/demo/data-analysis/pivot-analysis-sort-dimension ### 3. 过滤规则 [option说明](../../../option/PivotTable#dataConfig.filterRules) From 6a2960d2e0b6195de70b29b7aef9982196a70bf1 Mon Sep 17 00:00:00 2001 From: martes Date: Mon, 5 Feb 2024 17:10:59 +0800 Subject: [PATCH 093/115] doc: update zh doc about `isEditorElement` --- docs/assets/guide/zh/edit/edit_cell.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/assets/guide/zh/edit/edit_cell.md b/docs/assets/guide/zh/edit/edit_cell.md index 89db3eff2..0090ed10b 100644 --- a/docs/assets/guide/zh/edit/edit_cell.md +++ b/docs/assets/guide/zh/edit/edit_cell.md @@ -175,6 +175,8 @@ export interface IEditor { /** * 如果提供了此函数,VTable 将会在用户点击其他地方时调用此函数。 * 如果此函数返回了一个假值,VTable 将会调用 `onEnd` 并退出编辑状态。 + * 如果未定义此函数或此函数返回了一个真值, VTable 将不会做任何事。 + * 这意味着,你需要手动调用 `onStart` 中提供的 `endEdit` 来结束编辑模式。 */ isEditorElement?: (target: HTMLElement) => boolean; /** * 获取编辑器当前值。将在 `onEnd` 调用后调用。 */ From 75004c3c01e95e618df25008937cc4f08ad3108e Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Fri, 2 Feb 2024 14:53:12 +0800 Subject: [PATCH 094/115] fix: fix column cell order problem in sync mode --- .../fix-cell-order-sync_2024-02-02-06-53.json | 10 ++++++++++ packages/vtable/src/scenegraph/graphic/group.ts | 17 +++++++++++++++++ .../group-creater/cell-type/chart-cell.ts | 3 ++- .../group-creater/cell-type/checkbox-cell.ts | 3 ++- .../group-creater/cell-type/image-cell.ts | 3 ++- .../group-creater/cell-type/spark-line-cell.ts | 3 ++- .../group-creater/cell-type/text-cell.ts | 3 ++- .../group-creater/cell-type/video-cell.ts | 3 ++- .../scenegraph/group-creater/progress/proxy.ts | 13 ++++++++++--- 9 files changed, 49 insertions(+), 9 deletions(-) create mode 100644 common/changes/@visactor/vtable/fix-cell-order-sync_2024-02-02-06-53.json diff --git a/common/changes/@visactor/vtable/fix-cell-order-sync_2024-02-02-06-53.json b/common/changes/@visactor/vtable/fix-cell-order-sync_2024-02-02-06-53.json new file mode 100644 index 000000000..c61bc403b --- /dev/null +++ b/common/changes/@visactor/vtable/fix-cell-order-sync_2024-02-02-06-53.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "fix: fix column cell order problem in sync mode", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/packages/vtable/src/scenegraph/graphic/group.ts b/packages/vtable/src/scenegraph/graphic/group.ts index a081e9efa..90cd0aa66 100644 --- a/packages/vtable/src/scenegraph/graphic/group.ts +++ b/packages/vtable/src/scenegraph/graphic/group.ts @@ -201,6 +201,23 @@ export class Group extends VRenderGroup { return null; } + addCellGroup(cellGroup: Group) { + if (this.childrenCount === 0 || (this.lastChild as Group).row === cellGroup.row - 1) { + this.addChild(cellGroup); + } else { + // for promise cell row order in column + let c = this._firstChild as Group; + for (let i = 0; i < this.childrenCount; i++) { + if (c.row === cellGroup.row - 1) { + this.insertAfter(cellGroup, c); + return; + } + c = c._next as Group; + } + this.addChild(cellGroup); + } + } + getChildAt(index: number) { const child = super.getChildAt(index); if (child && child.name === 'border-rect') { diff --git a/packages/vtable/src/scenegraph/group-creater/cell-type/chart-cell.ts b/packages/vtable/src/scenegraph/group-creater/cell-type/chart-cell.ts index eaaa89e3c..9187c3d8d 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-type/chart-cell.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-type/chart-cell.ts @@ -56,7 +56,8 @@ export function createChartCellGroup( cellGroup.role = 'cell'; cellGroup.col = col; cellGroup.row = row; - columnGroup?.addChild(cellGroup); + // columnGroup?.addChild(cellGroup); + columnGroup?.addCellGroup(cellGroup); } cellGroup.AABBBounds.width(); // TODO 需要底层VRender修改 // chart diff --git a/packages/vtable/src/scenegraph/group-creater/cell-type/checkbox-cell.ts b/packages/vtable/src/scenegraph/group-creater/cell-type/checkbox-cell.ts index fe3f45837..63d0a21de 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-type/checkbox-cell.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-type/checkbox-cell.ts @@ -54,7 +54,8 @@ export function createCheckboxCellGroup( cellGroup.role = 'cell'; cellGroup.col = col; cellGroup.row = row; - columnGroup?.addChild(cellGroup); + // columnGroup?.addChild(cellGroup); + columnGroup?.addCellGroup(cellGroup); } // checkbox diff --git a/packages/vtable/src/scenegraph/group-creater/cell-type/image-cell.ts b/packages/vtable/src/scenegraph/group-creater/cell-type/image-cell.ts index 2effcf8ae..b4e775d7c 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-type/image-cell.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-type/image-cell.ts @@ -66,7 +66,8 @@ export function createImageCellGroup( cellGroup.role = 'cell'; cellGroup.col = col; cellGroup.row = row; - columnGroup?.addChild(cellGroup); + // columnGroup?.addChild(cellGroup); + columnGroup?.addCellGroup(cellGroup); // image const value = table.getCellValue(col, row); diff --git a/packages/vtable/src/scenegraph/group-creater/cell-type/spark-line-cell.ts b/packages/vtable/src/scenegraph/group-creater/cell-type/spark-line-cell.ts index 655db3e40..826c4877b 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-type/spark-line-cell.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-type/spark-line-cell.ts @@ -48,7 +48,8 @@ export function createSparkLineCellGroup( cellGroup.role = 'cell'; cellGroup.col = col; cellGroup.row = row; - columnGroup?.addChild(cellGroup); + // columnGroup?.addChild(cellGroup); + columnGroup?.addCellGroup(cellGroup); } // chart diff --git a/packages/vtable/src/scenegraph/group-creater/cell-type/text-cell.ts b/packages/vtable/src/scenegraph/group-creater/cell-type/text-cell.ts index 66a41a287..be085c07a 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-type/text-cell.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-type/text-cell.ts @@ -86,7 +86,8 @@ export function createCellGroup( cellGroup.role = 'cell'; cellGroup.col = col; cellGroup.row = row; - columnGroup?.addChild(cellGroup); + // columnGroup?.addChild(cellGroup); // fix promise cell row order in column + columnGroup?.addCellGroup(cellGroup); if (customElementsGroup) { cellGroup.appendChild(customElementsGroup); } diff --git a/packages/vtable/src/scenegraph/group-creater/cell-type/video-cell.ts b/packages/vtable/src/scenegraph/group-creater/cell-type/video-cell.ts index 21f2f186d..2362c3033 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-type/video-cell.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-type/video-cell.ts @@ -67,7 +67,8 @@ export function createVideoCellGroup( cellGroup.role = 'cell'; cellGroup.col = col; cellGroup.row = row; - columnGroup?.addChild(cellGroup); + // columnGroup?.addChild(cellGroup); + columnGroup?.addCellGroup(cellGroup); // video const value = table.getCellValue(col, row); diff --git a/packages/vtable/src/scenegraph/group-creater/progress/proxy.ts b/packages/vtable/src/scenegraph/group-creater/progress/proxy.ts index d9c3694f0..14195ed4f 100644 --- a/packages/vtable/src/scenegraph/group-creater/progress/proxy.ts +++ b/packages/vtable/src/scenegraph/group-creater/progress/proxy.ts @@ -729,8 +729,15 @@ function getCellByCache(cacheCellGroup: Group, row: number): Group | null { } if (cacheCellGroup.row === row) { return cacheCellGroup; - } else if (cacheCellGroup.row > row) { - return getCellByCache(cacheCellGroup._prev as Group, row); } - return getCellByCache(cacheCellGroup._next as Group, row); + const prev = cacheCellGroup._prev as Group; + const next = cacheCellGroup._next as Group; + // cacheCellGroup may have wrong order + if (cacheCellGroup.row > row && prev && prev.row === row - 1) { + return getCellByCache(prev, row); + } + if (cacheCellGroup.row < row && next && next.row === row + 1) { + return getCellByCache(next, row); + } + return null; } From 149385126b588e645d51692dd19e0e93dc7868aa Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Fri, 2 Feb 2024 18:36:37 +0800 Subject: [PATCH 095/115] feat: add axis innerOffset config --- ...eat-axis-innerOffset_2024-02-02-10-36.json | 10 ++ common/config/rush/pnpm-lock.yaml | 98 +++++++++---------- docs/package.json | 2 +- packages/react-vtable/package.json | 4 +- packages/vtable-export/package.json | 4 +- .../vtable/examples/pivot-chart/pivotChart.ts | 40 +++++++- packages/vtable/package.json | 4 +- packages/vtable/src/components/axis/axis.ts | 12 ++- 8 files changed, 110 insertions(+), 64 deletions(-) create mode 100644 common/changes/@visactor/vtable/feat-axis-innerOffset_2024-02-02-10-36.json diff --git a/common/changes/@visactor/vtable/feat-axis-innerOffset_2024-02-02-10-36.json b/common/changes/@visactor/vtable/feat-axis-innerOffset_2024-02-02-10-36.json new file mode 100644 index 000000000..b5071b3be --- /dev/null +++ b/common/changes/@visactor/vtable/feat-axis-innerOffset_2024-02-02-10-36.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "feat: add axis innerOffset config", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 1e735ceda..eba6beb9c 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -14,7 +14,7 @@ importers: '@types/markdown-it': ^13.0.0 '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 - '@visactor/vchart': 1.9.0 + '@visactor/vchart': 1.9.1 '@visactor/vtable': workspace:* '@visactor/vtable-editors': workspace:* '@visactor/vtable-export': workspace:* @@ -37,7 +37,7 @@ importers: yargs: ^17.1.1 dependencies: '@arco-design/web-react': 2.46.1_p2jlmv6k7k3po6tueteg46f2ku - '@visactor/vchart': 1.9.0 + '@visactor/vchart': 1.9.1 '@visactor/vtable': link:../packages/vtable '@visactor/vtable-editors': link:../packages/vtable-editors '@visactor/vtable-export': link:../packages/vtable-export @@ -82,7 +82,7 @@ importers: '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 '@types/react-is': ^17.0.3 - '@visactor/vchart': 1.9.0 + '@visactor/vchart': 1.9.1 '@visactor/vtable': workspace:* '@visactor/vutils': ~0.17.1 '@vitejs/plugin-react': 3.1.0 @@ -133,7 +133,7 @@ importers: '@types/react': 18.2.48 '@types/react-dom': 18.2.18 '@types/react-is': 17.0.7 - '@visactor/vchart': 1.9.0 + '@visactor/vchart': 1.9.1 '@vitejs/plugin-react': 3.1.0_vite@3.2.6 axios: 1.6.7 chai: 4.3.4 @@ -179,7 +179,7 @@ importers: '@types/offscreencanvas': 2019.6.4 '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 - '@visactor/vchart': 1.9.0 + '@visactor/vchart': 1.9.1 '@visactor/vdataset': ~0.17.1 '@visactor/vrender-components': 0.17.20-alpha.3 '@visactor/vrender-core': 0.17.20-alpha.3 @@ -249,7 +249,7 @@ importers: '@types/offscreencanvas': 2019.6.4 '@types/react': 18.2.48 '@types/react-dom': 18.2.18 - '@visactor/vchart': 1.9.0 + '@visactor/vchart': 1.9.1 '@vitejs/plugin-react': 3.1.0_vite@3.2.6 axios: 1.6.7 chai: 4.3.4 @@ -348,7 +348,7 @@ importers: '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 '@types/react-is': ^17.0.3 - '@visactor/vchart': 1.9.0 + '@visactor/vchart': 1.9.1 '@visactor/vtable': workspace:* '@visactor/vutils': ~0.17.1 '@vitejs/plugin-react': 3.1.0 @@ -402,7 +402,7 @@ importers: '@types/react': 18.2.48 '@types/react-dom': 18.2.18 '@types/react-is': 17.0.7 - '@visactor/vchart': 1.9.0 + '@visactor/vchart': 1.9.1 '@vitejs/plugin-react': 3.1.0_vite@3.2.6 axios: 1.6.7 chai: 4.3.4 @@ -3353,23 +3353,23 @@ packages: resolution: {integrity: sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==} dev: true - /@visactor/vchart/1.9.0: - resolution: {integrity: sha512-2iZg1TjBQ068De6IHjQl3zdoYlwcZ+yZmHr1R/+MGVevSOHKkpqq4O5fIQPzHDqDnk4PW7amfl6g9+B+JQ5GsA==} + /@visactor/vchart/1.9.1: + resolution: {integrity: sha512-mtI/z0gA4tSN01uwjZzz3DPLrDlsrVBQlffAmXNaCMz3HDPVipqvgasASOaKJEJSDsqSwLN85Ogs77eEg/la5A==} dependencies: '@visactor/vdataset': 0.17.4 - '@visactor/vgrammar-core': 0.11.5 - '@visactor/vgrammar-hierarchy': 0.11.5 - '@visactor/vgrammar-projection': 0.11.5 - '@visactor/vgrammar-sankey': 0.11.5 - '@visactor/vgrammar-util': 0.11.5 - '@visactor/vgrammar-wordcloud': 0.11.5 - '@visactor/vgrammar-wordcloud-shape': 0.11.5 + '@visactor/vgrammar-core': 0.11.6 + '@visactor/vgrammar-hierarchy': 0.11.6 + '@visactor/vgrammar-projection': 0.11.6 + '@visactor/vgrammar-sankey': 0.11.6 + '@visactor/vgrammar-util': 0.11.6 + '@visactor/vgrammar-wordcloud': 0.11.6 + '@visactor/vgrammar-wordcloud-shape': 0.11.6 '@visactor/vrender-components': 0.17.19 '@visactor/vrender-core': 0.17.19 '@visactor/vrender-kits': 0.17.19 '@visactor/vscale': 0.17.4 '@visactor/vutils': 0.17.4 - '@visactor/vutils-extension': 1.9.0 + '@visactor/vutils-extension': 1.9.1 /@visactor/vdataset/0.17.4: resolution: {integrity: sha512-o43a4/z9J3Wr/u+5BI8G+XwtWAJSHl+Pg0+UZDYoS+lXQLJV64THokAfhWUEWrMqxnrUbdBqaPgZAozYzaZJdg==} @@ -3392,70 +3392,70 @@ packages: simplify-geojson: 1.0.5 topojson-client: 3.1.0 - /@visactor/vgrammar-coordinate/0.11.5: - resolution: {integrity: sha512-j3oIOQOI229s5g3FlJGqUmPd9kFMqdNDXK2lim1g+SLxLKxIvf5lP7w6IrJL18dL5r5bfw0OO7qfWQrHMxm5eA==} + /@visactor/vgrammar-coordinate/0.11.6: + resolution: {integrity: sha512-mln1WQjpIiddXVWdky+twPphOFkrASMNY5ni1c5FOA+n8u/N00NKVKYBTV/vwh/FDU62t6PDiCzfEsK+OoMDaQ==} dependencies: - '@visactor/vgrammar-util': 0.11.5 + '@visactor/vgrammar-util': 0.11.6 '@visactor/vutils': 0.17.4 - /@visactor/vgrammar-core/0.11.5: - resolution: {integrity: sha512-mjhps1xC9sYvWmgVp1lV3UVl8dUT+waHhPC3hL2XDRZ+YV0e694U2HPiWlh0JsVHXerYFdjm63t1UVfy48LqRg==} + /@visactor/vgrammar-core/0.11.6: + resolution: {integrity: sha512-Cl6fxVLUvFNN9t6xgYcwF2H6KjGR+TU0Eqx9wGi84pMrTdmBiWW9R1ItEMmSZUUnzP1qIf2it7qdeo2ZndKgXQ==} dependencies: '@visactor/vdataset': 0.17.4 - '@visactor/vgrammar-coordinate': 0.11.5 - '@visactor/vgrammar-util': 0.11.5 + '@visactor/vgrammar-coordinate': 0.11.6 + '@visactor/vgrammar-util': 0.11.6 '@visactor/vrender-components': 0.17.19 '@visactor/vrender-core': 0.17.19 '@visactor/vrender-kits': 0.17.19 '@visactor/vscale': 0.17.4 '@visactor/vutils': 0.17.4 - /@visactor/vgrammar-hierarchy/0.11.5: - resolution: {integrity: sha512-HVsKusLuL1VwcuNXXqQA0uZ9XIQc25uLa0D3xBBwzkTxyMAvRWSmfh/sLFxnd+HiCZsV8iTXXzvyPUY9V/uOpQ==} + /@visactor/vgrammar-hierarchy/0.11.6: + resolution: {integrity: sha512-OGbVgIkpz59s8crpWJEoJxlwBYutL0dnMHJfcj0Ti/t6S1C1PPxG5vVwVShb+w+Vee+2j6wraEmbmrJePwaoAg==} dependencies: - '@visactor/vgrammar-core': 0.11.5 - '@visactor/vgrammar-util': 0.11.5 + '@visactor/vgrammar-core': 0.11.6 + '@visactor/vgrammar-util': 0.11.6 '@visactor/vrender-core': 0.17.19 '@visactor/vrender-kits': 0.17.19 '@visactor/vutils': 0.17.4 - /@visactor/vgrammar-projection/0.11.5: - resolution: {integrity: sha512-ZzzP0UMn4iD8wIFGG/R59kJbTsN0hruyx6vxju7tYQTNCwO/n7T+JDAbjVFpVSfMmu8/xYO0NKRdJX0PqQ8iZA==} + /@visactor/vgrammar-projection/0.11.6: + resolution: {integrity: sha512-lXNNynQKtDCiya6uQZWFsWSFSb3JcWroUftXDN/bwMEfRZ6xqf78FD/aCLKeo+d4bMhDHatUObC2X9JnsNCJpQ==} dependencies: - '@visactor/vgrammar-core': 0.11.5 - '@visactor/vgrammar-util': 0.11.5 + '@visactor/vgrammar-core': 0.11.6 + '@visactor/vgrammar-util': 0.11.6 '@visactor/vutils': 0.17.4 d3-geo: 1.12.1 - /@visactor/vgrammar-sankey/0.11.5: - resolution: {integrity: sha512-SOsMj0tj9Zu13NBErdQkKoQcyUNu3Er3BnZP85fyv0lGzdQW6m3o/T2ziVP7sZJwWm8vXwiUOI2dYEaN9zJNwQ==} + /@visactor/vgrammar-sankey/0.11.6: + resolution: {integrity: sha512-RFTaKjrSJRiz6fYLj7zNfiZL7WfmE9o5zwHy0NAFefQVo4WYyjWD1KH7pYIxWRbdCU9oQIx/hPbhmFO7ivYWSw==} dependencies: - '@visactor/vgrammar-core': 0.11.5 - '@visactor/vgrammar-util': 0.11.5 + '@visactor/vgrammar-core': 0.11.6 + '@visactor/vgrammar-util': 0.11.6 '@visactor/vrender-core': 0.17.19 '@visactor/vrender-kits': 0.17.19 '@visactor/vutils': 0.17.4 - /@visactor/vgrammar-util/0.11.5: - resolution: {integrity: sha512-trbgNsbj+TBa+202Iw+ews79w0iiZSeLgoWcq80pS+2U+xiuCjjdyDe6U1sbJV/6HKtRR1mSk4dwdR0NRVs0hQ==} + /@visactor/vgrammar-util/0.11.6: + resolution: {integrity: sha512-e1bsJeNfale7GqhxdLlqsvIXaRFoEN3OILDiQaOq/+7fwA/hqIf2Oso+f3HSDbigbyeolBK09T8Gt7vfPYLATg==} dependencies: '@visactor/vutils': 0.17.4 - /@visactor/vgrammar-wordcloud-shape/0.11.5: - resolution: {integrity: sha512-+6hKAXZ3OaNiw3PfNcPc5K0BLz8Z6tC5F3eYdzrlLBVvzQGyea+o7LjHPMfcPH6jHhatOXsPOrXb6QAVoL9A0A==} + /@visactor/vgrammar-wordcloud-shape/0.11.6: + resolution: {integrity: sha512-tzhzGzlKH+UNx993SQKEKJa6aHnJqRo3lzY9u2oe3OcsYUVHS9PnDeohsh66AzQKIdWn3Zq9dOeDiotwAKHQDw==} dependencies: - '@visactor/vgrammar-core': 0.11.5 - '@visactor/vgrammar-util': 0.11.5 + '@visactor/vgrammar-core': 0.11.6 + '@visactor/vgrammar-util': 0.11.6 '@visactor/vrender-core': 0.17.19 '@visactor/vrender-kits': 0.17.19 '@visactor/vscale': 0.17.4 '@visactor/vutils': 0.17.4 - /@visactor/vgrammar-wordcloud/0.11.5: - resolution: {integrity: sha512-zWzfs1nQyQJv/pgJHilC/DnDhe+M3u/d51bBPlaAmSNijPVY85sNSIwbGVJVuGi2zSJLmB5YbbFuZCWp23TuwA==} + /@visactor/vgrammar-wordcloud/0.11.6: + resolution: {integrity: sha512-cxDLS1DRG5CZDVpp8BjonSmWcBUfBCXMBOpaog6Iy0CZFFua1uCovA647Z9YuPc5qrlvuZ+tAMMrv3eJx9yeNA==} dependencies: - '@visactor/vgrammar-core': 0.11.5 - '@visactor/vgrammar-util': 0.11.5 + '@visactor/vgrammar-core': 0.11.6 + '@visactor/vgrammar-util': 0.11.6 '@visactor/vrender-core': 0.17.19 '@visactor/vrender-kits': 0.17.19 '@visactor/vutils': 0.17.4 @@ -3537,8 +3537,8 @@ packages: '@visactor/vutils': 0.17.4 dev: false - /@visactor/vutils-extension/1.9.0: - resolution: {integrity: sha512-yZpk+E8tyil/Iz/0riIXQRB40H2ExfKfv0fm6UFrzGit3kigIk5vKKGe2rO2OO30FGC+V1DpG4H2U/5QKmNOIA==} + /@visactor/vutils-extension/1.9.1: + resolution: {integrity: sha512-CX1wgVlNNSxY3z1pk/oeVBruELj8jy0EGsrH9IL+R8+gU/v0XlWAe6fS96dS4poftMngMtTYIaEEPgvGk0tBfQ==} dependencies: '@visactor/vrender-core': 0.17.19 '@visactor/vrender-kits': 0.17.19 diff --git a/docs/package.json b/docs/package.json index af30a660a..1b6f8224b 100644 --- a/docs/package.json +++ b/docs/package.json @@ -13,7 +13,7 @@ "@visactor/vtable": "workspace:*", "@visactor/vtable-editors": "workspace:*", "@visactor/vtable-export": "workspace:*", - "@visactor/vchart": "1.9.0", + "@visactor/vchart": "1.9.1", "markdown-it": "^13.0.0", "highlight.js": "^11.8.0", "axios": "^1.4.0", diff --git a/packages/react-vtable/package.json b/packages/react-vtable/package.json index 34a42b702..ab92fab65 100644 --- a/packages/react-vtable/package.json +++ b/packages/react-vtable/package.json @@ -52,7 +52,7 @@ "react-is": "^18.2.0" }, "devDependencies": { - "@visactor/vchart": "1.9.0", + "@visactor/vchart": "1.9.1", "@internal/bundler": "workspace:*", "@internal/eslint-config": "workspace:*", "@internal/ts-config": "workspace:*", @@ -96,4 +96,4 @@ "axios": "^1.4.0", "@types/react-is": "^17.0.3" } -} +} \ No newline at end of file diff --git a/packages/vtable-export/package.json b/packages/vtable-export/package.json index a341d3b01..594eca167 100644 --- a/packages/vtable-export/package.json +++ b/packages/vtable-export/package.json @@ -40,7 +40,7 @@ "exceljs": "4.4.0" }, "devDependencies": { - "@visactor/vchart": "1.9.0", + "@visactor/vchart": "1.9.1", "@internal/bundler": "workspace:*", "@internal/eslint-config": "workspace:*", "@internal/ts-config": "workspace:*", @@ -85,4 +85,4 @@ "@types/react-is": "^17.0.3", "rollup-plugin-node-resolve": "5.2.0" } -} +} \ No newline at end of file diff --git a/packages/vtable/examples/pivot-chart/pivotChart.ts b/packages/vtable/examples/pivot-chart/pivotChart.ts index cfa63157a..558b29d1f 100644 --- a/packages/vtable/examples/pivot-chart/pivotChart.ts +++ b/packages/vtable/examples/pivot-chart/pivotChart.ts @@ -124,8 +124,25 @@ export function createTable() { yField: '230417171050011', seriesField: '230417171050030', axes: [ - { orient: 'left', visible: true, label: { visible: true } }, - { orient: 'bottom', visible: true } + { + orient: 'left', + visible: true, + label: { + visible: true + }, + innerOffset: { + top: 20, + bottom: 20 + } + }, + { + orient: 'bottom', + visible: true, + innerOffset: { + left: 20, + right: 20 + } + } ], bar: { state: { @@ -226,7 +243,15 @@ export function createTable() { ], axes: [ { orient: 'left', visible: true, label: { visible: true } }, - { orient: 'bottom', visible: true } + + { + orient: 'bottom', + visible: true, + innerOffset: { + left: 20, + right: 20 + } + } ], theme: { // axis: { @@ -272,7 +297,14 @@ export function createTable() { seriesField: '230417171050030', axes: [ { orient: 'left', visible: true, label: { visible: true } }, - { orient: 'bottom', visible: true } + { + orient: 'bottom', + visible: true, + innerOffset: { + left: 20, + right: 20 + } + } ], line: { state: { diff --git a/packages/vtable/package.json b/packages/vtable/package.json index 3174fbe4b..989c5b396 100644 --- a/packages/vtable/package.json +++ b/packages/vtable/package.json @@ -61,7 +61,7 @@ }, "devDependencies": { "luxon": "*", - "@visactor/vchart": "1.9.0", + "@visactor/vchart": "1.9.1", "@internal/bundler": "workspace:*", "@internal/eslint-config": "workspace:*", "@internal/ts-config": "workspace:*", @@ -124,4 +124,4 @@ "url": "https://github.com/VisActor/VTable.git", "directory": "packages/vtable" } -} +} \ No newline at end of file diff --git a/packages/vtable/src/components/axis/axis.ts b/packages/vtable/src/components/axis/axis.ts index ecd0d54b9..064e7098e 100644 --- a/packages/vtable/src/components/axis/axis.ts +++ b/packages/vtable/src/components/axis/axis.ts @@ -57,13 +57,17 @@ export class CartesianAxis { ); if (this.orient === 'left' || this.orient === 'right') { + const innerOffsetTop = this.option.innerOffset?.top ?? 0; + const innerOffsetBottom = this.option.innerOffset?.bottom ?? 0; this.width = width; - this.height = height - padding[2]; - this.y = padding[0]; + this.height = height - padding[2] - innerOffsetBottom; + this.y = padding[0] + innerOffsetTop; } else if (this.orient === 'top' || this.orient === 'bottom') { - this.width = width - padding[1]; + const innerOffsetLeft = this.option.innerOffset?.left ?? 0; + const innerOffsetRight = this.option.innerOffset?.right ?? 0; + this.width = width - padding[1] - innerOffsetRight; this.height = height; - this.x = padding[3]; + this.x = padding[3] + innerOffsetLeft; } this.visible = option.visible ?? true; From ab816ffe24c2a53b0599de1bba0d3cc3f3d97c45 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Sun, 4 Feb 2024 16:32:57 +0800 Subject: [PATCH 096/115] fix: fix merge cell content position --- .../vtable/fix-merge-cell-update_2024-02-04-08-32.json | 10 ++++++++++ .../vtable/src/scenegraph/group-creater/cell-helper.ts | 9 ++++++++- .../src/scenegraph/group-creater/progress/proxy.ts | 4 ++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 common/changes/@visactor/vtable/fix-merge-cell-update_2024-02-04-08-32.json diff --git a/common/changes/@visactor/vtable/fix-merge-cell-update_2024-02-04-08-32.json b/common/changes/@visactor/vtable/fix-merge-cell-update_2024-02-04-08-32.json new file mode 100644 index 000000000..02aea5c04 --- /dev/null +++ b/common/changes/@visactor/vtable/fix-merge-cell-update_2024-02-04-08-32.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "fix: fix merge cell content position", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/packages/vtable/src/scenegraph/group-creater/cell-helper.ts b/packages/vtable/src/scenegraph/group-creater/cell-helper.ts index 276395829..2ff3d5208 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-helper.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-helper.ts @@ -1,4 +1,4 @@ -import type { Cursor, IThemeSpec, Group as VGroup } from '@src/vrender'; +import type { Cursor, IGraphic, IThemeSpec, Group as VGroup } from '@src/vrender'; import type { ProgressBarStyle } from '../../body-helper/style/ProgressBarStyle'; import { regUrl } from '../../tools/global'; import type { @@ -429,6 +429,13 @@ export function updateCell(col: number, row: number, table: BaseTableAPI, addNew y: table.scenegraph.getCellGroupY(row) } as any); + oldCellGroup.forEachChildren((child: IGraphic) => { + child.setAttributes({ + dx: 0, + dy: 0 + }); + }); + // update text const textMark = oldCellGroup.getChildByName('text'); if (textMark) { diff --git a/packages/vtable/src/scenegraph/group-creater/progress/proxy.ts b/packages/vtable/src/scenegraph/group-creater/progress/proxy.ts index 14195ed4f..bfe7e8226 100644 --- a/packages/vtable/src/scenegraph/group-creater/progress/proxy.ts +++ b/packages/vtable/src/scenegraph/group-creater/progress/proxy.ts @@ -626,6 +626,10 @@ export class SceneProxy { updateCellGroupPosition(cellGroup: Group, newRow: number, y: number) { // 更新位置&row cellGroup.row = newRow; + cellGroup.mergeStartCol = undefined; + cellGroup.mergeStartRow = undefined; + cellGroup.mergeEndCol = undefined; + cellGroup.mergeEndRow = undefined; cellGroup.setAttribute('y', y); (cellGroup as any).needUpdate = true; (cellGroup as any).needUpdateForAutoRowHeight = true; From 5d660980bf38c7746a00aa7327b0391be5aa1700 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Sun, 4 Feb 2024 17:43:13 +0800 Subject: [PATCH 097/115] fix: fix height clear in computeRowsHeight() --- packages/vtable/src/layout/row-height-map.ts | 4 ++++ .../scenegraph/layout/compute-row-height.ts | 19 ++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/packages/vtable/src/layout/row-height-map.ts b/packages/vtable/src/layout/row-height-map.ts index 35fd4e599..130c80a71 100644 --- a/packages/vtable/src/layout/row-height-map.ts +++ b/packages/vtable/src/layout/row-height-map.ts @@ -20,6 +20,10 @@ export class NumberRangeMap { this.table = table; } + get length() { + return this.data.size; + } + clear() { this.data.clear(); this.cumulativeSum.clear(); diff --git a/packages/vtable/src/scenegraph/layout/compute-row-height.ts b/packages/vtable/src/scenegraph/layout/compute-row-height.ts index ebd041049..6d91eacfd 100644 --- a/packages/vtable/src/scenegraph/layout/compute-row-height.ts +++ b/packages/vtable/src/scenegraph/layout/compute-row-height.ts @@ -37,7 +37,7 @@ export function computeRowsHeight( const oldRowHeights: number[] = []; const newHeights: number[] = []; if (update) { - for (let row = 0; row < table.rowCount; row++) { + for (let row = rowStart; row <= rowEnd; row++) { // oldRowHeights.push(table.getRowHeight(row)); oldRowHeights[row] = table.getRowHeight(row); } @@ -166,10 +166,15 @@ export function computeRowsHeight( } } } else { - // table.rowHeightsMap.clear(); - table.clearRowHeightCache(); - for (let row = 0; row < table.rowCount; row++) { - newHeights[row] = table.getRowHeight(row); + if (table.rowCount !== table.rowHeightsMap.length) { + // for tree mode + // table.rowHeightsMap.clear(); + table.clearRowHeightCache(); + } + if (update) { + for (let row = rowStart; row <= rowEnd; row++) { + newHeights[row] = table.getRowHeight(row); + } } } @@ -219,7 +224,7 @@ export function computeRowsHeight( let actualHeight = 0; let actualHeaderHeight = 0; for (let row = 0; row < table.rowCount; row++) { - const rowHeight = update ? newHeights[row] : table.getRowHeight(row); + const rowHeight = update ? newHeights[row] ?? table.getRowHeight(row) : table.getRowHeight(row); if ( row < table.columnHeaderLevelCount || (table.isPivotChart() && row >= table.rowCount - table.bottomFrozenRowCount) @@ -267,7 +272,7 @@ export function computeRowsHeight( } if (update) { - for (let row = 0; row < table.rowCount; row++) { + for (let row = rowStart; row <= rowEnd; row++) { const newRowHeight = newHeights[row] ?? table.getRowHeight(row); if (newRowHeight !== oldRowHeights[row]) { table._setRowHeight(row, newRowHeight); From 53e5c6525c33162c9606534a9ec2361e027d05d2 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Sun, 4 Feb 2024 18:00:49 +0800 Subject: [PATCH 098/115] feat: add limit in merge cell ergodicity --- .../fix-merge-cell-update_2024-02-04-10-00.json | 10 ++++++++++ .../vtable/src/scenegraph/icon/icon-update.ts | 10 +++++++--- .../src/scenegraph/layout/update-height.ts | 8 ++++++-- .../vtable/src/scenegraph/layout/update-width.ts | 8 ++++++-- .../vtable/src/scenegraph/stick-text/index.ts | 16 ++++++++++++---- packages/vtable/src/state/hover/is-cell-hover.ts | 8 ++++++-- packages/vtable/src/state/hover/update-cell.ts | 12 ++++++++---- 7 files changed, 55 insertions(+), 17 deletions(-) create mode 100644 common/changes/@visactor/vtable/fix-merge-cell-update_2024-02-04-10-00.json diff --git a/common/changes/@visactor/vtable/fix-merge-cell-update_2024-02-04-10-00.json b/common/changes/@visactor/vtable/fix-merge-cell-update_2024-02-04-10-00.json new file mode 100644 index 000000000..95567dfb9 --- /dev/null +++ b/common/changes/@visactor/vtable/fix-merge-cell-update_2024-02-04-10-00.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "fix: fix merge cell update problem", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/packages/vtable/src/scenegraph/icon/icon-update.ts b/packages/vtable/src/scenegraph/icon/icon-update.ts index b13c0363d..04fe64e18 100644 --- a/packages/vtable/src/scenegraph/icon/icon-update.ts +++ b/packages/vtable/src/scenegraph/icon/icon-update.ts @@ -398,9 +398,13 @@ export function updateCellRangeIcon( isValid(cellGroup.mergeEndCol) && isValid(cellGroup.mergeEndRow) ) { - for (let col = cellGroup.mergeStartCol; col <= cellGroup.mergeEndCol; col++) { - for (let row = cellGroup.mergeStartRow; row <= cellGroup.mergeEndRow; row++) { - updateCellGroupIcon(scene.getCell(col, row), filter, dealer); + const colStart = Math.max(cellGroup.mergeStartCol, scene.proxy.colStart); + const colEnd = Math.min(cellGroup.mergeEndCol, scene.proxy.colEnd); + const rowStart = Math.max(cellGroup.mergeStartRow, scene.proxy.rowStart); + const rowEnd = Math.min(cellGroup.mergeEndRow, scene.proxy.rowEnd); + for (let col = colStart; col <= colEnd; col++) { + for (let row = rowStart; row <= rowEnd; row++) { + updateCellGroupIcon(scene.highPerformanceGetCell(col, row), filter, dealer); } } } else { diff --git a/packages/vtable/src/scenegraph/layout/update-height.ts b/packages/vtable/src/scenegraph/layout/update-height.ts index 338cd5ea2..a292d2bc6 100644 --- a/packages/vtable/src/scenegraph/layout/update-height.ts +++ b/packages/vtable/src/scenegraph/layout/update-height.ts @@ -260,8 +260,12 @@ function updateMergeCellContentHeight( for (let row = cellGroup.mergeStartRow; row <= cellGroup.mergeEndRow; row++) { distHeight += table.getRowHeight(row); } - for (let col = cellGroup.mergeStartCol; col <= cellGroup.mergeEndCol; col++) { - for (let row = cellGroup.mergeStartRow; row <= cellGroup.mergeEndRow; row++) { + const colStart = Math.max(cellGroup.mergeStartCol, table.scenegraph.proxy.colStart); + const colEnd = Math.min(cellGroup.mergeEndCol, table.scenegraph.proxy.colEnd); + const rowStart = Math.max(cellGroup.mergeStartRow, table.scenegraph.proxy.rowStart); + const rowEnd = Math.min(cellGroup.mergeEndRow, table.scenegraph.proxy.rowEnd); + for (let col = colStart; col <= colEnd; col++) { + for (let row = rowStart; row <= rowEnd; row++) { const singleCellGroup = table.scenegraph.getCell(col, row); singleCellGroup.forEachChildren((child: IGraphic) => { child.setAttributes({ diff --git a/packages/vtable/src/scenegraph/layout/update-width.ts b/packages/vtable/src/scenegraph/layout/update-width.ts index b6281fb46..96378db8e 100644 --- a/packages/vtable/src/scenegraph/layout/update-width.ts +++ b/packages/vtable/src/scenegraph/layout/update-width.ts @@ -430,8 +430,12 @@ function updateMergeCellContentWidth( cellHeight += table.getRowHeight(row); } - for (let col = cellGroup.mergeStartCol; col <= cellGroup.mergeEndCol; col++) { - for (let row = cellGroup.mergeStartRow; row <= cellGroup.mergeEndRow; row++) { + const colStart = Math.max(cellGroup.mergeStartCol, table.scenegraph.proxy.colStart); + const colEnd = Math.min(cellGroup.mergeEndCol, table.scenegraph.proxy.colEnd); + const rowStart = Math.max(cellGroup.mergeStartRow, table.scenegraph.proxy.rowStart); + const rowEnd = Math.min(cellGroup.mergeEndRow, table.scenegraph.proxy.rowEnd); + for (let col = colStart; col <= colEnd; col++) { + for (let row = rowStart; row <= rowEnd; row++) { const singleCellGroup = table.scenegraph.getCell(col, row); singleCellGroup.forEachChildren((child: IGraphic) => { child.setAttributes({ diff --git a/packages/vtable/src/scenegraph/stick-text/index.ts b/packages/vtable/src/scenegraph/stick-text/index.ts index a000caf5b..241a6a881 100644 --- a/packages/vtable/src/scenegraph/stick-text/index.ts +++ b/packages/vtable/src/scenegraph/stick-text/index.ts @@ -139,8 +139,12 @@ function adjustCellContentVerticalLayout( isNumber(cellGroup.mergeEndCol) && isNumber(cellGroup.mergeEndRow) ) { - for (let col = cellGroup.mergeStartCol; col <= cellGroup.mergeEndCol; col++) { - for (let row = cellGroup.mergeStartRow; row <= cellGroup.mergeEndRow; row++) { + const colStart = Math.max(cellGroup.mergeStartCol, table.scenegraph.proxy.colStart); + const colEnd = Math.min(cellGroup.mergeEndCol, table.scenegraph.proxy.colEnd); + const rowStart = Math.max(cellGroup.mergeStartRow, table.scenegraph.proxy.rowStart); + const rowEnd = Math.min(cellGroup.mergeEndRow, table.scenegraph.proxy.rowEnd); + for (let col = colStart; col <= colEnd; col++) { + for (let row = rowStart; row <= rowEnd; row++) { const singleCellGroup = table.scenegraph.getCell(col, row); dealVertical(singleCellGroup, minTop, maxTop, changedCells); } @@ -224,8 +228,12 @@ function adjustCellContentHorizontalLayout( isNumber(cellGroup.mergeEndCol) && isNumber(cellGroup.mergeEndRow) ) { - for (let col = cellGroup.mergeStartCol; col <= cellGroup.mergeEndCol; col++) { - for (let row = cellGroup.mergeStartRow; row <= cellGroup.mergeEndRow; row++) { + const colStart = Math.max(cellGroup.mergeStartCol, table.scenegraph.proxy.colStart); + const colEnd = Math.min(cellGroup.mergeEndCol, table.scenegraph.proxy.colEnd); + const rowStart = Math.max(cellGroup.mergeStartRow, table.scenegraph.proxy.rowStart); + const rowEnd = Math.min(cellGroup.mergeEndRow, table.scenegraph.proxy.rowEnd); + for (let col = colStart; col <= colEnd; col++) { + for (let row = rowStart; row <= rowEnd; row++) { const singleCellGroup = table.scenegraph.getCell(col, row); dealHorizontal(singleCellGroup, minLeft, maxLeft, changedCells); } diff --git a/packages/vtable/src/state/hover/is-cell-hover.ts b/packages/vtable/src/state/hover/is-cell-hover.ts index cdbffd589..1e53af298 100644 --- a/packages/vtable/src/state/hover/is-cell-hover.ts +++ b/packages/vtable/src/state/hover/is-cell-hover.ts @@ -14,8 +14,12 @@ export function getCellHoverColor(cellGroup: Group, table: BaseTableAPI): string isValid(cellGroup.mergeEndCol) && isValid(cellGroup.mergeEndRow) ) { - for (let col = cellGroup.mergeStartCol; col <= cellGroup.mergeEndCol; col++) { - for (let row = cellGroup.mergeStartRow; row <= cellGroup.mergeEndRow; row++) { + const colStart = Math.max(cellGroup.mergeStartCol, table.scenegraph.proxy.colStart); + const colEnd = Math.min(cellGroup.mergeEndCol, table.scenegraph.proxy.colEnd); + const rowStart = Math.max(cellGroup.mergeStartRow, table.scenegraph.proxy.rowStart); + const rowEnd = Math.min(cellGroup.mergeEndRow, table.scenegraph.proxy.rowEnd); + for (let col = colStart; col <= colEnd; col++) { + for (let row = rowStart; row <= rowEnd; row++) { const key = isCellHover(table.stateManager, col, row, cellGroup); if (key && (!colorKey || key === 'cellBgColor')) { colorKey = key; diff --git a/packages/vtable/src/state/hover/update-cell.ts b/packages/vtable/src/state/hover/update-cell.ts index 3c5d40538..41d596ee4 100644 --- a/packages/vtable/src/state/hover/update-cell.ts +++ b/packages/vtable/src/state/hover/update-cell.ts @@ -2,16 +2,20 @@ import { isValid } from '@visactor/vutils'; import type { Scenegraph } from '../../scenegraph/scenegraph'; export function updateCell(scenegraph: Scenegraph, col: number, row: number) { - const cellGroup = scenegraph.getCell(col, row); + const cellGroup = scenegraph.highPerformanceGetCell(col, row); if ( isValid(cellGroup.mergeStartCol) && isValid(cellGroup.mergeStartRow) && isValid(cellGroup.mergeEndCol) && isValid(cellGroup.mergeEndRow) ) { - for (let col = cellGroup.mergeStartCol; col <= cellGroup.mergeEndCol; col++) { - for (let row = cellGroup.mergeStartRow; row <= cellGroup.mergeEndRow; row++) { - const mergeCell = scenegraph.getCell(col, row); + const colStart = Math.max(cellGroup.mergeStartCol, scenegraph.proxy.colStart); + const colEnd = Math.min(cellGroup.mergeEndCol, scenegraph.proxy.colEnd); + const rowStart = Math.max(cellGroup.mergeStartRow, scenegraph.proxy.rowStart); + const rowEnd = Math.min(cellGroup.mergeEndRow, scenegraph.proxy.rowEnd); + for (let col = colStart; col <= colEnd; col++) { + for (let row = rowStart; row <= rowEnd; row++) { + const mergeCell = scenegraph.highPerformanceGetCell(col, row); mergeCell.addUpdateBoundTag(); } } From 4edad64a90df47ef80bb04182871620435ee8df3 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Sun, 4 Feb 2024 19:58:39 +0800 Subject: [PATCH 099/115] fix: fix merge cell range --- .../vtable/src/scenegraph/icon/icon-update.ts | 6 ++-- .../src/scenegraph/layout/update-height.ts | 6 ++-- .../src/scenegraph/layout/update-width.ts | 6 ++-- .../vtable/src/scenegraph/stick-text/index.ts | 11 ++----- .../vtable/src/state/hover/is-cell-hover.ts | 6 ++-- .../vtable/src/state/hover/update-cell.ts | 6 ++-- packages/vtable/src/tools/merge-range.ts | 29 +++++++++++++++++++ 7 files changed, 42 insertions(+), 28 deletions(-) create mode 100644 packages/vtable/src/tools/merge-range.ts diff --git a/packages/vtable/src/scenegraph/icon/icon-update.ts b/packages/vtable/src/scenegraph/icon/icon-update.ts index 04fe64e18..c1d863d10 100644 --- a/packages/vtable/src/scenegraph/icon/icon-update.ts +++ b/packages/vtable/src/scenegraph/icon/icon-update.ts @@ -9,6 +9,7 @@ import type { IRect } from '@src/vrender'; import { IContainPointMode, createRect } from '@src/vrender'; import { dealWithIcon } from '../utils/text-icon-layout'; import type { BaseTableAPI } from '../../ts-types/base-table'; +import { getCellMergeRange } from '../../tools/merge-range'; export function hideHoverIcon(col: number, row: number, scene: Scenegraph) { if (col === -1 || row === -1) { @@ -398,10 +399,7 @@ export function updateCellRangeIcon( isValid(cellGroup.mergeEndCol) && isValid(cellGroup.mergeEndRow) ) { - const colStart = Math.max(cellGroup.mergeStartCol, scene.proxy.colStart); - const colEnd = Math.min(cellGroup.mergeEndCol, scene.proxy.colEnd); - const rowStart = Math.max(cellGroup.mergeStartRow, scene.proxy.rowStart); - const rowEnd = Math.min(cellGroup.mergeEndRow, scene.proxy.rowEnd); + const { colStart, colEnd, rowStart, rowEnd } = getCellMergeRange(cellGroup, scene); for (let col = colStart; col <= colEnd; col++) { for (let row = rowStart; row <= rowEnd; row++) { updateCellGroupIcon(scene.highPerformanceGetCell(col, row), filter, dealer); diff --git a/packages/vtable/src/scenegraph/layout/update-height.ts b/packages/vtable/src/scenegraph/layout/update-height.ts index a292d2bc6..5326ed59a 100644 --- a/packages/vtable/src/scenegraph/layout/update-height.ts +++ b/packages/vtable/src/scenegraph/layout/update-height.ts @@ -15,6 +15,7 @@ import { isMergeCellGroup } from '../utils/is-merge-cell-group'; import type { BaseTableAPI } from '../../ts-types/base-table'; import { resizeCellGroup } from '../group-creater/column-helper'; import type { IGraphic } from '@src/vrender'; +import { getCellMergeRange } from '../../tools/merge-range'; export function updateRowHeight(scene: Scenegraph, row: number, detaY: number, skipTableHeightMap?: boolean) { // 更新table行高存储 @@ -260,10 +261,7 @@ function updateMergeCellContentHeight( for (let row = cellGroup.mergeStartRow; row <= cellGroup.mergeEndRow; row++) { distHeight += table.getRowHeight(row); } - const colStart = Math.max(cellGroup.mergeStartCol, table.scenegraph.proxy.colStart); - const colEnd = Math.min(cellGroup.mergeEndCol, table.scenegraph.proxy.colEnd); - const rowStart = Math.max(cellGroup.mergeStartRow, table.scenegraph.proxy.rowStart); - const rowEnd = Math.min(cellGroup.mergeEndRow, table.scenegraph.proxy.rowEnd); + const { colStart, colEnd, rowStart, rowEnd } = getCellMergeRange(cellGroup, table.scenegraph); for (let col = colStart; col <= colEnd; col++) { for (let row = rowStart; row <= rowEnd; row++) { const singleCellGroup = table.scenegraph.getCell(col, row); diff --git a/packages/vtable/src/scenegraph/layout/update-width.ts b/packages/vtable/src/scenegraph/layout/update-width.ts index 96378db8e..c0c34d06b 100644 --- a/packages/vtable/src/scenegraph/layout/update-width.ts +++ b/packages/vtable/src/scenegraph/layout/update-width.ts @@ -20,6 +20,7 @@ import { updateCellContentWidth } from '../utils/text-icon-layout'; import { computeRowHeight, computeRowsHeight } from './compute-row-height'; import { updateCellHeightForRow } from './update-height'; import { getHierarchyOffset } from '../utils/get-hierarchy-offset'; +import { getCellMergeRange } from '../../tools/merge-range'; // import { updateAutoRowHeight } from './auto-height'; /** @@ -430,10 +431,7 @@ function updateMergeCellContentWidth( cellHeight += table.getRowHeight(row); } - const colStart = Math.max(cellGroup.mergeStartCol, table.scenegraph.proxy.colStart); - const colEnd = Math.min(cellGroup.mergeEndCol, table.scenegraph.proxy.colEnd); - const rowStart = Math.max(cellGroup.mergeStartRow, table.scenegraph.proxy.rowStart); - const rowEnd = Math.min(cellGroup.mergeEndRow, table.scenegraph.proxy.rowEnd); + const { colStart, colEnd, rowStart, rowEnd } = getCellMergeRange(cellGroup, table.scenegraph); for (let col = colStart; col <= colEnd; col++) { for (let row = rowStart; row <= rowEnd; row++) { const singleCellGroup = table.scenegraph.getCell(col, row); diff --git a/packages/vtable/src/scenegraph/stick-text/index.ts b/packages/vtable/src/scenegraph/stick-text/index.ts index 241a6a881..1e4f16ac0 100644 --- a/packages/vtable/src/scenegraph/stick-text/index.ts +++ b/packages/vtable/src/scenegraph/stick-text/index.ts @@ -4,6 +4,7 @@ import type { Group } from '../graphic/group'; import type { PivotHeaderLayoutMap } from '../../layout/pivot-header-layout'; import type { ITextStyleOption, StickCell } from '../../ts-types'; import { isNumber } from '@visactor/vutils'; +import { getCellMergeRange } from '../../tools/merge-range'; export function handleTextStick(table: BaseTableAPI) { // reset @@ -139,10 +140,7 @@ function adjustCellContentVerticalLayout( isNumber(cellGroup.mergeEndCol) && isNumber(cellGroup.mergeEndRow) ) { - const colStart = Math.max(cellGroup.mergeStartCol, table.scenegraph.proxy.colStart); - const colEnd = Math.min(cellGroup.mergeEndCol, table.scenegraph.proxy.colEnd); - const rowStart = Math.max(cellGroup.mergeStartRow, table.scenegraph.proxy.rowStart); - const rowEnd = Math.min(cellGroup.mergeEndRow, table.scenegraph.proxy.rowEnd); + const { colStart, colEnd, rowStart, rowEnd } = getCellMergeRange(cellGroup, table.scenegraph); for (let col = colStart; col <= colEnd; col++) { for (let row = rowStart; row <= rowEnd; row++) { const singleCellGroup = table.scenegraph.getCell(col, row); @@ -228,10 +226,7 @@ function adjustCellContentHorizontalLayout( isNumber(cellGroup.mergeEndCol) && isNumber(cellGroup.mergeEndRow) ) { - const colStart = Math.max(cellGroup.mergeStartCol, table.scenegraph.proxy.colStart); - const colEnd = Math.min(cellGroup.mergeEndCol, table.scenegraph.proxy.colEnd); - const rowStart = Math.max(cellGroup.mergeStartRow, table.scenegraph.proxy.rowStart); - const rowEnd = Math.min(cellGroup.mergeEndRow, table.scenegraph.proxy.rowEnd); + const { colStart, colEnd, rowStart, rowEnd } = getCellMergeRange(cellGroup, table.scenegraph); for (let col = colStart; col <= colEnd; col++) { for (let row = rowStart; row <= rowEnd; row++) { const singleCellGroup = table.scenegraph.getCell(col, row); diff --git a/packages/vtable/src/state/hover/is-cell-hover.ts b/packages/vtable/src/state/hover/is-cell-hover.ts index 1e53af298..b4d76ab75 100644 --- a/packages/vtable/src/state/hover/is-cell-hover.ts +++ b/packages/vtable/src/state/hover/is-cell-hover.ts @@ -4,6 +4,7 @@ import { getProp } from '../../scenegraph/utils/get-prop'; import type { BaseTableAPI } from '../../ts-types/base-table'; import { HighlightScope } from '../../ts-types'; import { isValid } from '@visactor/vutils'; +import { getCellMergeRange } from '../../tools/merge-range'; export function getCellHoverColor(cellGroup: Group, table: BaseTableAPI): string | undefined { let colorKey; @@ -14,10 +15,7 @@ export function getCellHoverColor(cellGroup: Group, table: BaseTableAPI): string isValid(cellGroup.mergeEndCol) && isValid(cellGroup.mergeEndRow) ) { - const colStart = Math.max(cellGroup.mergeStartCol, table.scenegraph.proxy.colStart); - const colEnd = Math.min(cellGroup.mergeEndCol, table.scenegraph.proxy.colEnd); - const rowStart = Math.max(cellGroup.mergeStartRow, table.scenegraph.proxy.rowStart); - const rowEnd = Math.min(cellGroup.mergeEndRow, table.scenegraph.proxy.rowEnd); + const { colStart, colEnd, rowStart, rowEnd } = getCellMergeRange(cellGroup, table.scenegraph); for (let col = colStart; col <= colEnd; col++) { for (let row = rowStart; row <= rowEnd; row++) { const key = isCellHover(table.stateManager, col, row, cellGroup); diff --git a/packages/vtable/src/state/hover/update-cell.ts b/packages/vtable/src/state/hover/update-cell.ts index 41d596ee4..e64f6f8bb 100644 --- a/packages/vtable/src/state/hover/update-cell.ts +++ b/packages/vtable/src/state/hover/update-cell.ts @@ -1,5 +1,6 @@ import { isValid } from '@visactor/vutils'; import type { Scenegraph } from '../../scenegraph/scenegraph'; +import { getCellMergeRange } from '../../tools/merge-range'; export function updateCell(scenegraph: Scenegraph, col: number, row: number) { const cellGroup = scenegraph.highPerformanceGetCell(col, row); @@ -9,10 +10,7 @@ export function updateCell(scenegraph: Scenegraph, col: number, row: number) { isValid(cellGroup.mergeEndCol) && isValid(cellGroup.mergeEndRow) ) { - const colStart = Math.max(cellGroup.mergeStartCol, scenegraph.proxy.colStart); - const colEnd = Math.min(cellGroup.mergeEndCol, scenegraph.proxy.colEnd); - const rowStart = Math.max(cellGroup.mergeStartRow, scenegraph.proxy.rowStart); - const rowEnd = Math.min(cellGroup.mergeEndRow, scenegraph.proxy.rowEnd); + const { colStart, colEnd, rowStart, rowEnd } = getCellMergeRange(cellGroup, scenegraph); for (let col = colStart; col <= colEnd; col++) { for (let row = rowStart; row <= rowEnd; row++) { const mergeCell = scenegraph.highPerformanceGetCell(col, row); diff --git a/packages/vtable/src/tools/merge-range.ts b/packages/vtable/src/tools/merge-range.ts new file mode 100644 index 000000000..0dcf9981a --- /dev/null +++ b/packages/vtable/src/tools/merge-range.ts @@ -0,0 +1,29 @@ +import type { Group } from '../scenegraph/graphic/group'; +import type { Scenegraph } from '../scenegraph/scenegraph'; + +export function getCellMergeRange(cellGroup: Group, scene: Scenegraph) { + const { mergeStartCol, mergeEndCol, mergeStartRow, mergeEndRow, col, row } = cellGroup; + const { colStart, colEnd, rowStart, rowEnd, bodyLeftCol, bodyRightCol, bodyTopRow, bodyBottomRow } = scene.proxy; + + let cellRangeColStart = mergeStartCol; + let cellRangeColEnd = mergeEndCol; + let cellRangeRowStart = mergeStartRow; + let cellRangeRowEnd = mergeEndRow; + + if (col >= bodyLeftCol && col <= bodyRightCol) { + cellRangeColStart = Math.max(cellGroup.mergeStartCol, colStart); + cellRangeColEnd = Math.min(cellGroup.mergeEndCol, colEnd); + } + + if (row >= bodyTopRow && row <= bodyBottomRow) { + cellRangeRowStart = Math.max(cellGroup.mergeStartRow, rowStart); + cellRangeRowEnd = Math.min(cellGroup.mergeEndRow, rowEnd); + } + + return { + colStart: cellRangeColStart, + colEnd: cellRangeColEnd, + rowStart: cellRangeRowStart, + rowEnd: cellRangeRowEnd + }; +} From fbba52cd45ac9478b11fb4471b0f617524612bdc Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Sun, 4 Feb 2024 16:22:40 +0800 Subject: [PATCH 100/115] feat: add name config in customRender --- .../vtable/fix-icon-name_2024-02-04-08-22.json | 10 ++++++++++ packages/vtable/src/scenegraph/component/custom.ts | 7 +++++++ packages/vtable/src/ts-types/customElement.ts | 1 + 3 files changed, 18 insertions(+) create mode 100644 common/changes/@visactor/vtable/fix-icon-name_2024-02-04-08-22.json diff --git a/common/changes/@visactor/vtable/fix-icon-name_2024-02-04-08-22.json b/common/changes/@visactor/vtable/fix-icon-name_2024-02-04-08-22.json new file mode 100644 index 000000000..a5b672ba4 --- /dev/null +++ b/common/changes/@visactor/vtable/fix-icon-name_2024-02-04-08-22.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "feat: add name config in customRender", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/packages/vtable/src/scenegraph/component/custom.ts b/packages/vtable/src/scenegraph/component/custom.ts index 0109ff640..f27d3d4cf 100644 --- a/packages/vtable/src/scenegraph/component/custom.ts +++ b/packages/vtable/src/scenegraph/component/custom.ts @@ -169,6 +169,7 @@ function adjustElementToGroup( pickable: !!element.pickable, cursor: element.cursor as Cursor }); + arc.name = element.name; customGroup.appendChild(arc); break; case 'text': @@ -197,6 +198,7 @@ function adjustElementToGroup( element as any ) ); + text.name = element.name; customGroup.appendChild(text); break; case 'rect': @@ -213,6 +215,7 @@ function adjustElementToGroup( pickable: !!element.pickable, cursor: element.cursor as Cursor }); + rect.name = element.name; customGroup.appendChild(rect); break; case 'circle': @@ -227,6 +230,7 @@ function adjustElementToGroup( pickable: !!element.pickable, cursor: element.cursor as Cursor }); + circle.name = element.name; customGroup.appendChild(circle); break; case 'icon': @@ -244,6 +248,7 @@ function adjustElementToGroup( pickable: !!element.pickable, cursor: element.cursor as Cursor }); + icon.name = element.name; icon.role = 'icon-custom'; customGroup.appendChild(icon); break; @@ -263,6 +268,7 @@ function adjustElementToGroup( cursor: element.cursor as Cursor, shape: element.shape }); + image.name = element.name; image.role = 'image-custom'; customGroup.appendChild(image); break; @@ -274,6 +280,7 @@ function adjustElementToGroup( pickable: !!element.pickable, cursor: element.cursor as Cursor }); + line.name = element.name; customGroup.appendChild(line); break; } diff --git a/packages/vtable/src/ts-types/customElement.ts b/packages/vtable/src/ts-types/customElement.ts index 457529ac3..09e19e8f9 100644 --- a/packages/vtable/src/ts-types/customElement.ts +++ b/packages/vtable/src/ts-types/customElement.ts @@ -21,6 +21,7 @@ interface baseElement { // clickable?: boolean; // @dispose pickable?: boolean; cursor?: string; + name?: string; } export interface TextElement extends baseElement { type: 'text'; From b9cdd520a1f3e5e6bf73d02a835566c4b3660a5d Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Mon, 5 Feb 2024 20:19:39 +0800 Subject: [PATCH 101/115] fix: fix border lineDash in cell group #1051 --- .../vtable/fix-cell-style_2024-02-05-12-19.json | 10 ++++++++++ .../scenegraph/group-creater/cell-type/chart-cell.ts | 1 + .../group-creater/cell-type/checkbox-cell.ts | 1 + .../scenegraph/group-creater/cell-type/image-cell.ts | 1 + .../group-creater/cell-type/spark-line-cell.ts | 1 + .../scenegraph/group-creater/cell-type/text-cell.ts | 1 + .../scenegraph/group-creater/cell-type/video-cell.ts | 1 + 7 files changed, 16 insertions(+) create mode 100644 common/changes/@visactor/vtable/fix-cell-style_2024-02-05-12-19.json diff --git a/common/changes/@visactor/vtable/fix-cell-style_2024-02-05-12-19.json b/common/changes/@visactor/vtable/fix-cell-style_2024-02-05-12-19.json new file mode 100644 index 000000000..c3e3a520a --- /dev/null +++ b/common/changes/@visactor/vtable/fix-cell-style_2024-02-05-12-19.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "fix: fix border lineDash in cell group #1051", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/packages/vtable/src/scenegraph/group-creater/cell-type/chart-cell.ts b/packages/vtable/src/scenegraph/group-creater/cell-type/chart-cell.ts index 9187c3d8d..5c141bbe2 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-type/chart-cell.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-type/chart-cell.ts @@ -46,6 +46,7 @@ export function createChartCellGroup( strokeArrayWidth: (cellTheme?.group as any)?.strokeArrayWidth ?? undefined, strokeArrayColor: (cellTheme?.group as any)?.strokeArrayColor ?? undefined, cursor: (cellTheme?.group as any)?.cursor ?? undefined, + lineDash: cellTheme?.group?.lineDash ?? undefined, lineCap: 'square', diff --git a/packages/vtable/src/scenegraph/group-creater/cell-type/checkbox-cell.ts b/packages/vtable/src/scenegraph/group-creater/cell-type/checkbox-cell.ts index 63d0a21de..6044d2910 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-type/checkbox-cell.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-type/checkbox-cell.ts @@ -44,6 +44,7 @@ export function createCheckboxCellGroup( strokeArrayWidth: (cellTheme?.group as any)?.strokeArrayWidth ?? undefined, strokeArrayColor: (cellTheme?.group as any)?.strokeArrayColor ?? undefined, cursor: (cellTheme?.group as any)?.cursor ?? undefined, + lineDash: cellTheme?.group?.lineDash ?? undefined, lineCap: 'square', diff --git a/packages/vtable/src/scenegraph/group-creater/cell-type/image-cell.ts b/packages/vtable/src/scenegraph/group-creater/cell-type/image-cell.ts index b4e775d7c..418db001a 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-type/image-cell.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-type/image-cell.ts @@ -56,6 +56,7 @@ export function createImageCellGroup( strokeArrayWidth: (cellTheme?.group as any)?.strokeArrayWidth ?? undefined, strokeArrayColor: (cellTheme?.group as any)?.strokeArrayColor ?? undefined, cursor: (cellTheme?.group as any)?.cursor ?? undefined, + lineDash: cellTheme?.group?.lineDash ?? undefined, lineCap: 'square', diff --git a/packages/vtable/src/scenegraph/group-creater/cell-type/spark-line-cell.ts b/packages/vtable/src/scenegraph/group-creater/cell-type/spark-line-cell.ts index 826c4877b..fda8440ad 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-type/spark-line-cell.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-type/spark-line-cell.ts @@ -38,6 +38,7 @@ export function createSparkLineCellGroup( strokeArrayWidth: (cellTheme?.group as any)?.strokeArrayWidth ?? undefined, strokeArrayColor: (cellTheme?.group as any)?.strokeArrayColor ?? undefined, cursor: (cellTheme?.group as any)?.cursor ?? undefined, + lineDash: cellTheme?.group?.lineDash ?? undefined, lineCap: 'square', diff --git a/packages/vtable/src/scenegraph/group-creater/cell-type/text-cell.ts b/packages/vtable/src/scenegraph/group-creater/cell-type/text-cell.ts index be085c07a..e4e92315b 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-type/text-cell.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-type/text-cell.ts @@ -76,6 +76,7 @@ export function createCellGroup( strokeArrayWidth: (cellTheme?.group as any)?.strokeArrayWidth ?? undefined, strokeArrayColor: (cellTheme?.group as any)?.strokeArrayColor ?? undefined, cursor: (cellTheme?.group as any)?.cursor ?? undefined, + lineDash: cellTheme?.group?.lineDash ?? undefined, lineCap: 'square', diff --git a/packages/vtable/src/scenegraph/group-creater/cell-type/video-cell.ts b/packages/vtable/src/scenegraph/group-creater/cell-type/video-cell.ts index 2362c3033..f0095b946 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-type/video-cell.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-type/video-cell.ts @@ -57,6 +57,7 @@ export function createVideoCellGroup( strokeArrayWidth: (cellTheme?.group as any)?.strokeArrayWidth ?? undefined, strokeArrayColor: (cellTheme?.group as any)?.strokeArrayColor ?? undefined, cursor: (cellTheme?.group as any)?.cursor ?? undefined, + lineDash: cellTheme?.group?.lineDash ?? undefined, lineCap: 'square', From 11d7320f0f664114d3f75df4ede55e1e37cad669 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Mon, 5 Feb 2024 20:21:07 +0800 Subject: [PATCH 102/115] fix: fix textAlign value in width update#1065 --- .../vtable/fix-cell-style_2024-02-05-12-20.json | 10 ++++++++++ .../vtable/src/scenegraph/utils/text-icon-layout.ts | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 common/changes/@visactor/vtable/fix-cell-style_2024-02-05-12-20.json diff --git a/common/changes/@visactor/vtable/fix-cell-style_2024-02-05-12-20.json b/common/changes/@visactor/vtable/fix-cell-style_2024-02-05-12-20.json new file mode 100644 index 000000000..f31f85fb6 --- /dev/null +++ b/common/changes/@visactor/vtable/fix-cell-style_2024-02-05-12-20.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "fix: fix textAlign value in width update#1065", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/packages/vtable/src/scenegraph/utils/text-icon-layout.ts b/packages/vtable/src/scenegraph/utils/text-icon-layout.ts index b0250981b..9bf07d2f2 100644 --- a/packages/vtable/src/scenegraph/utils/text-icon-layout.ts +++ b/packages/vtable/src/scenegraph/utils/text-icon-layout.ts @@ -532,13 +532,13 @@ export function updateCellContentWidth( } else if (child.role === 'icon-absolute-right') { child.setAttribute('x', child.attribute.x + detaX); } else if (child.name === 'content' || child.name === 'text') { - const contentWidth = child.AABBBounds.width(); - if (textAlign === 'center') { + const childTextAlign = child.attribute.textAlign ?? textAlign; + if (childTextAlign === 'center') { child.setAttribute( 'x', padding[3] + leftIconWidth + (distWidth - (padding[1] + padding[3]) - leftIconWidth - rightIconWidth) / 2 ); - } else if (textAlign === 'right') { + } else if (childTextAlign === 'right') { child.setAttribute('x', padding[3] + distWidth - (padding[1] + padding[3]) - rightIconWidth); } else { // left: do nothing From 7a74e1e7da1ea054cca4d98dd0f3be1a214b9aaa Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 5 Feb 2024 12:40:13 +0000 Subject: [PATCH 103/115] build: prelease version 0.19.1 --- .../1033-bug-pivotSort_2024-02-03-05-25.json | 11 ----- .../1033-bug-pivotSort_2024-02-03-10-10.json | 11 ----- ...-position-withScroll_2024-02-05-03-03.json | 11 ----- ...rt-showsort-function_2024-02-05-07-13.json | 11 ----- ...eat-axis-innerOffset_2024-02-02-10-36.json | 10 ----- .../fix-cell-order-sync_2024-02-02-06-53.json | 10 ----- .../fix-cell-style_2024-02-05-12-19.json | 10 ----- .../fix-cell-style_2024-02-05-12-20.json | 10 ----- .../fix-icon-name_2024-02-04-08-22.json | 10 ----- ...ix-merge-cell-update_2024-02-04-08-32.json | 10 ----- ...ix-merge-cell-update_2024-02-04-10-00.json | 10 ----- common/config/rush/version-policies.json | 2 +- packages/react-vtable/package.json | 4 +- packages/vtable-editors/package.json | 2 +- packages/vtable-export/package.json | 4 +- packages/vtable/CHANGELOG.json | 42 +++++++++++++++++++ packages/vtable/CHANGELOG.md | 27 +++++++++++- packages/vtable/package.json | 4 +- 18 files changed, 76 insertions(+), 123 deletions(-) delete mode 100644 common/changes/@visactor/vtable/1033-bug-pivotSort_2024-02-03-05-25.json delete mode 100644 common/changes/@visactor/vtable/1033-bug-pivotSort_2024-02-03-10-10.json delete mode 100644 common/changes/@visactor/vtable/1069-bug-headerEditor-position-withScroll_2024-02-05-03-03.json delete mode 100644 common/changes/@visactor/vtable/1077-refactor-sort-showsort-function_2024-02-05-07-13.json delete mode 100644 common/changes/@visactor/vtable/feat-axis-innerOffset_2024-02-02-10-36.json delete mode 100644 common/changes/@visactor/vtable/fix-cell-order-sync_2024-02-02-06-53.json delete mode 100644 common/changes/@visactor/vtable/fix-cell-style_2024-02-05-12-19.json delete mode 100644 common/changes/@visactor/vtable/fix-cell-style_2024-02-05-12-20.json delete mode 100644 common/changes/@visactor/vtable/fix-icon-name_2024-02-04-08-22.json delete mode 100644 common/changes/@visactor/vtable/fix-merge-cell-update_2024-02-04-08-32.json delete mode 100644 common/changes/@visactor/vtable/fix-merge-cell-update_2024-02-04-10-00.json diff --git a/common/changes/@visactor/vtable/1033-bug-pivotSort_2024-02-03-05-25.json b/common/changes/@visactor/vtable/1033-bug-pivotSort_2024-02-03-05-25.json deleted file mode 100644 index a37c7cb71..000000000 --- a/common/changes/@visactor/vtable/1033-bug-pivotSort_2024-02-03-05-25.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "refactor: pivot table sort logic #1033\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/1033-bug-pivotSort_2024-02-03-10-10.json b/common/changes/@visactor/vtable/1033-bug-pivotSort_2024-02-03-10-10.json deleted file mode 100644 index d9850a690..000000000 --- a/common/changes/@visactor/vtable/1033-bug-pivotSort_2024-02-03-10-10.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "feat: add update sort rule api\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/1069-bug-headerEditor-position-withScroll_2024-02-05-03-03.json b/common/changes/@visactor/vtable/1069-bug-headerEditor-position-withScroll_2024-02-05-03-03.json deleted file mode 100644 index 15d7269fe..000000000 --- a/common/changes/@visactor/vtable/1069-bug-headerEditor-position-withScroll_2024-02-05-03-03.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "fix: when table has scroll then click header to edit position error #1069\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/1077-refactor-sort-showsort-function_2024-02-05-07-13.json b/common/changes/@visactor/vtable/1077-refactor-sort-showsort-function_2024-02-05-07-13.json deleted file mode 100644 index 8e849ee94..000000000 --- a/common/changes/@visactor/vtable/1077-refactor-sort-showsort-function_2024-02-05-07-13.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "refactor: showsort option work well #1077\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/feat-axis-innerOffset_2024-02-02-10-36.json b/common/changes/@visactor/vtable/feat-axis-innerOffset_2024-02-02-10-36.json deleted file mode 100644 index b5071b3be..000000000 --- a/common/changes/@visactor/vtable/feat-axis-innerOffset_2024-02-02-10-36.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vtable", - "comment": "feat: add axis innerOffset config", - "type": "none" - } - ], - "packageName": "@visactor/vtable" -} \ No newline at end of file diff --git a/common/changes/@visactor/vtable/fix-cell-order-sync_2024-02-02-06-53.json b/common/changes/@visactor/vtable/fix-cell-order-sync_2024-02-02-06-53.json deleted file mode 100644 index c61bc403b..000000000 --- a/common/changes/@visactor/vtable/fix-cell-order-sync_2024-02-02-06-53.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vtable", - "comment": "fix: fix column cell order problem in sync mode", - "type": "none" - } - ], - "packageName": "@visactor/vtable" -} \ No newline at end of file diff --git a/common/changes/@visactor/vtable/fix-cell-style_2024-02-05-12-19.json b/common/changes/@visactor/vtable/fix-cell-style_2024-02-05-12-19.json deleted file mode 100644 index c3e3a520a..000000000 --- a/common/changes/@visactor/vtable/fix-cell-style_2024-02-05-12-19.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vtable", - "comment": "fix: fix border lineDash in cell group #1051", - "type": "none" - } - ], - "packageName": "@visactor/vtable" -} \ No newline at end of file diff --git a/common/changes/@visactor/vtable/fix-cell-style_2024-02-05-12-20.json b/common/changes/@visactor/vtable/fix-cell-style_2024-02-05-12-20.json deleted file mode 100644 index f31f85fb6..000000000 --- a/common/changes/@visactor/vtable/fix-cell-style_2024-02-05-12-20.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vtable", - "comment": "fix: fix textAlign value in width update#1065", - "type": "none" - } - ], - "packageName": "@visactor/vtable" -} \ No newline at end of file diff --git a/common/changes/@visactor/vtable/fix-icon-name_2024-02-04-08-22.json b/common/changes/@visactor/vtable/fix-icon-name_2024-02-04-08-22.json deleted file mode 100644 index a5b672ba4..000000000 --- a/common/changes/@visactor/vtable/fix-icon-name_2024-02-04-08-22.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vtable", - "comment": "feat: add name config in customRender", - "type": "none" - } - ], - "packageName": "@visactor/vtable" -} \ No newline at end of file diff --git a/common/changes/@visactor/vtable/fix-merge-cell-update_2024-02-04-08-32.json b/common/changes/@visactor/vtable/fix-merge-cell-update_2024-02-04-08-32.json deleted file mode 100644 index 02aea5c04..000000000 --- a/common/changes/@visactor/vtable/fix-merge-cell-update_2024-02-04-08-32.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vtable", - "comment": "fix: fix merge cell content position", - "type": "none" - } - ], - "packageName": "@visactor/vtable" -} \ No newline at end of file diff --git a/common/changes/@visactor/vtable/fix-merge-cell-update_2024-02-04-10-00.json b/common/changes/@visactor/vtable/fix-merge-cell-update_2024-02-04-10-00.json deleted file mode 100644 index 95567dfb9..000000000 --- a/common/changes/@visactor/vtable/fix-merge-cell-update_2024-02-04-10-00.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vtable", - "comment": "fix: fix merge cell update problem", - "type": "none" - } - ], - "packageName": "@visactor/vtable" -} \ No newline at end of file diff --git a/common/config/rush/version-policies.json b/common/config/rush/version-policies.json index 4783e57e3..ae5a028b3 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -1 +1 @@ -[{"definitionName":"lockStepVersion","policyName":"vtableMain","version":"0.19.0","mainProject":"@visactor/vtable","nextBump":"minor"}] +[{"definitionName":"lockStepVersion","policyName":"vtableMain","version":"0.19.1","mainProject":"@visactor/vtable","nextBump":"patch"}] diff --git a/packages/react-vtable/package.json b/packages/react-vtable/package.json index ab92fab65..12ea3bd6d 100644 --- a/packages/react-vtable/package.json +++ b/packages/react-vtable/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/react-vtable", - "version": "0.19.0", + "version": "0.19.1", "description": "The react version of VTable", "keywords": [ "react", @@ -96,4 +96,4 @@ "axios": "^1.4.0", "@types/react-is": "^17.0.3" } -} \ No newline at end of file +} diff --git a/packages/vtable-editors/package.json b/packages/vtable-editors/package.json index ed277b994..a09624fef 100644 --- a/packages/vtable-editors/package.json +++ b/packages/vtable-editors/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vtable-editors", - "version": "0.19.0", + "version": "0.19.1", "description": "", "sideEffects": false, "main": "cjs/index.js", diff --git a/packages/vtable-export/package.json b/packages/vtable-export/package.json index 594eca167..99c224180 100644 --- a/packages/vtable-export/package.json +++ b/packages/vtable-export/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vtable-export", - "version": "0.19.0", + "version": "0.19.1", "description": "The export util of VTable", "author": { "name": "VisActor", @@ -85,4 +85,4 @@ "@types/react-is": "^17.0.3", "rollup-plugin-node-resolve": "5.2.0" } -} \ No newline at end of file +} diff --git a/packages/vtable/CHANGELOG.json b/packages/vtable/CHANGELOG.json index 692045a9d..42899acb0 100644 --- a/packages/vtable/CHANGELOG.json +++ b/packages/vtable/CHANGELOG.json @@ -1,6 +1,48 @@ { "name": "@visactor/vtable", "entries": [ + { + "version": "0.19.1", + "tag": "@visactor/vtable_v0.19.1", + "date": "Mon, 05 Feb 2024 12:36:17 GMT", + "comments": { + "none": [ + { + "comment": "refactor: pivot table sort logic #1033\n\n" + }, + { + "comment": "feat: add update sort rule api\n\n" + }, + { + "comment": "fix: when table has scroll then click header to edit position error #1069\n\n" + }, + { + "comment": "refactor: showsort option work well #1077\n\n" + }, + { + "comment": "feat: add axis innerOffset config" + }, + { + "comment": "fix: fix column cell order problem in sync mode" + }, + { + "comment": "fix: fix border lineDash in cell group #1051" + }, + { + "comment": "fix: fix textAlign value in width update#1065" + }, + { + "comment": "feat: add name config in customRender" + }, + { + "comment": "fix: fix merge cell content position" + }, + { + "comment": "fix: fix merge cell update problem" + } + ] + } + }, { "version": "0.19.0", "tag": "@visactor/vtable_v0.19.0", diff --git a/packages/vtable/CHANGELOG.md b/packages/vtable/CHANGELOG.md index 0d18c4186..dbad8447a 100644 --- a/packages/vtable/CHANGELOG.md +++ b/packages/vtable/CHANGELOG.md @@ -1,6 +1,31 @@ # Change Log - @visactor/vtable -This log was last generated on Fri, 02 Feb 2024 04:13:16 GMT and should not be manually modified. +This log was last generated on Mon, 05 Feb 2024 12:36:17 GMT and should not be manually modified. + +## 0.19.1 +Mon, 05 Feb 2024 12:36:17 GMT + +### Updates + +- refactor: pivot table sort logic #1033 + + +- feat: add update sort rule api + + +- fix: when table has scroll then click header to edit position error #1069 + + +- refactor: showsort option work well #1077 + + +- feat: add axis innerOffset config +- fix: fix column cell order problem in sync mode +- fix: fix border lineDash in cell group #1051 +- fix: fix textAlign value in width update#1065 +- feat: add name config in customRender +- fix: fix merge cell content position +- fix: fix merge cell update problem ## 0.19.0 Fri, 02 Feb 2024 04:13:16 GMT diff --git a/packages/vtable/package.json b/packages/vtable/package.json index 989c5b396..13febc158 100644 --- a/packages/vtable/package.json +++ b/packages/vtable/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vtable", - "version": "0.19.0", + "version": "0.19.1", "description": "canvas table width high performance", "keywords": [ "grid", @@ -124,4 +124,4 @@ "url": "https://github.com/VisActor/VTable.git", "directory": "packages/vtable" } -} \ No newline at end of file +} From b8faef2c29a1fe40c165aa15a9f3ab5207048bae Mon Sep 17 00:00:00 2001 From: fangsmile Date: Tue, 6 Feb 2024 02:55:21 +0000 Subject: [PATCH 104/115] docs: generate changelog of release v0.19.1 --- docs/assets/changelog/en/release.md | 29 +++++++++++++++++++++++++++++ docs/assets/changelog/zh/release.md | 29 +++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/docs/assets/changelog/en/release.md b/docs/assets/changelog/en/release.md index fc7edb62e..c2000a7d9 100644 --- a/docs/assets/changelog/en/release.md +++ b/docs/assets/changelog/en/release.md @@ -1,3 +1,32 @@ +# v0.19.1 + +2024-02-06 + + +**🆕 New feature** + +- **@visactor/vtable**: add update sort rule api +- **@visactor/vtable**: add axis innerOffset config +- **@visactor/vtable**: add name config in customRender + +**🐛 Bug fix** + +- **@visactor/vtable**: when table has scroll then click header to edit position error [#1069](https://github.com/VisActor/VTable/issues/1069) +- **@visactor/vtable**: fix column cell order problem in sync mode +- **@visactor/vtable**: fix border lineDash in cell group [#1051](https://github.com/VisActor/VTable/issues/1051) +- **@visactor/vtable**: fix textAlign value in width update[#1065](https://github.com/VisActor/VTable/issues/1065) +- **@visactor/vtable**: fix merge cell content position +- **@visactor/vtable**: fix merge cell update problem + +**🔨 Refactor** + +- **@visactor/vtable**: pivot table sort logic [#1033](https://github.com/VisActor/VTable/issues/1033) +- **@visactor/vtable**: showsort option work well [#1077](https://github.com/VisActor/VTable/issues/1077) + + + +[more detail about v0.19.1](https://github.com/VisActor/VTable/releases/tag/v0.19.1) + # v0.19.0 2024-02-02 diff --git a/docs/assets/changelog/zh/release.md b/docs/assets/changelog/zh/release.md index f47a49c3f..12e6c2fbc 100644 --- a/docs/assets/changelog/zh/release.md +++ b/docs/assets/changelog/zh/release.md @@ -1,3 +1,32 @@ +# v0.19.1 + +2024-02-06 + + +**🆕 新增功能** + +- **@visactor/vtable**: add update sort rule api +- **@visactor/vtable**: add axis innerOffset config +- **@visactor/vtable**: add name config in customRender + +**🐛 功能修复** + +- **@visactor/vtable**: when table has scroll then click header to edit position error [#1069](https://github.com/VisActor/VTable/issues/1069) +- **@visactor/vtable**: fix column cell order problem in sync mode +- **@visactor/vtable**: fix border lineDash in cell group [#1051](https://github.com/VisActor/VTable/issues/1051) +- **@visactor/vtable**: fix textAlign value in width update[#1065](https://github.com/VisActor/VTable/issues/1065) +- **@visactor/vtable**: fix merge cell content position +- **@visactor/vtable**: fix merge cell update problem + +**🔨 功能重构** + +- **@visactor/vtable**: pivot table sort logic [#1033](https://github.com/VisActor/VTable/issues/1033) +- **@visactor/vtable**: showsort option work well [#1077](https://github.com/VisActor/VTable/issues/1077) + + + +[更多详情请查看 v0.19.1](https://github.com/VisActor/VTable/releases/tag/v0.19.1) + # v0.19.0 2024-02-02 From 55fdbc928bc50a824ee78b0f92345f87e002d6bc Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Tue, 6 Feb 2024 11:56:34 +0800 Subject: [PATCH 105/115] docs: sort tutorial update --- docs/assets/guide/en/basic_function/sort.md | 89 ++++++++++++++++--- docs/assets/guide/zh/basic_function/sort.md | 65 +++++++++++++- .../list-table/define/basic-define.ts | 2 +- 3 files changed, 138 insertions(+), 18 deletions(-) diff --git a/docs/assets/guide/en/basic_function/sort.md b/docs/assets/guide/en/basic_function/sort.md index 6fcc8c623..516dcaf1b 100644 --- a/docs/assets/guide/en/basic_function/sort.md +++ b/docs/assets/guide/en/basic_function/sort.md @@ -99,26 +99,30 @@ const listTable = new ListTable({ In the above code, the initial sorting state of the table is in descending order by age. -## Sort state setting interface +## Sort state setting interface(update sort rule) -VTable provides `sortState` Properties are used to set the sorting state. This interface can be called directly when the sorting state needs to be modified. E.g: +VTable provides the `updateSortState` property for setting the sorting state. +Interface Description: +``` + /** + * Update sort status + * @param sortState The sorting state to be set + * @param executeSort Whether to execute internal sorting logic, setting false will only update the icon status and not perform data sorting + */ + updateSortState(sortState: SortState[] | SortState | null, executeSort: boolean = true) +``` +When you need to modify the sorting status, you can call this interface directly. For example: ```js -listTable.sortState = [ +tableInstance.updateSortState( { field: 'name', order: 'asc', }, -]; -``` - -If you need to reset the sorting state, you can `sortState` Set to `null`For example: - -```js -listTable.sortState = null; +); ``` -By using `sortState` Interface, users can dynamically adjust the sorting state of the table at any time to meet the needs of real-time analysis. +By using the `updateSortState` interface, users can dynamically adjust the sorting state of the table at any time to meet real-time analysis needs. ## Disable internal sorting @@ -133,8 +137,7 @@ tableInstance.on('sort_click', args => { ``` After the sorting is completed, setRecords is required to update the data to the table. If you need to switch the sorting icon, you need to cooperate with the interface `updateSortState` and use the second parameter of the interface to be set to false to switch only the sorting icon. -Notice: -- When calling setRecords, you need to clear the internal sorting state first (otherwise, when calling setRecords, the data will be sorted according to the previous sorting state), that is, set the second parameter to null. +- When calling the setRecords interface, you need to set the second parameter to null to clear the internal sorting state (otherwise, when setRecords is called, the data will be sorted according to the last set sorting state) Example: ```javascript livedemo template=vtable @@ -409,4 +412,62 @@ tableInstance.on('sort_click', args => { } ``` -If you do not want to use the internal icon, you can use the icon customization function to replace it. Follow the reference tutorial: https://www.visactor.io/vtable/guide/custom_define/custom_icon \ No newline at end of file +## Replace the default sort icon + +If you do not want to use the internal icon, you can use the icon customization function to replace it. Follow the reference tutorial: https://www.visactor.io/vtable/guide/custom_define/custom_icon + +Here is an example of replacing the sort icon: + +Note: Configuration of `name` and `funcType` + +``` +VTable.register.icon("frozenCurrent", { + type: "svg", + svg: "/sort.svg", + width: 22, + height: 22, + name: "sort_normal", + positionType: VTable.TYPES.IconPosition.left, + marginRight: 0, + funcType: VTable.TYPES.IconFuncTypeEnum.sort, + hover: { + width: 22, + height: 22, + bgColor: "rgba(101, 117, 168, 0.1)", + }, + cursor: "pointer", +}); +``` + +## Hide sort icon + +We provide `showSort` configuration to hide the sorting icon, but the sorting logic can be executed normally + +Here is an example of hiding the sort icon: + +```js +const listTable = new ListTable({ + // ...Other configuration items + columns: [ + { + title: 'name', + field: 'name', + cellType: 'text', + showSort: false, + sort: true, // Use built-in default sorting logic + }, + { + title: 'Age', + field: 'age', + cellType: 'text', + showSort: false, + sort: (v1, v2, order) => { // Use custom sorting logic + if (order === 'desc') { + return v1 === v2 ? 0 : v1 > v2 ? -1 : 1; + } + return v1 === v2 ? 0 : v1 > v2 ? 1 : -1; + }, + }, + ], +}); +``` \ No newline at end of file diff --git a/docs/assets/guide/zh/basic_function/sort.md b/docs/assets/guide/zh/basic_function/sort.md index 76b350cce..baf363546 100644 --- a/docs/assets/guide/zh/basic_function/sort.md +++ b/docs/assets/guide/zh/basic_function/sort.md @@ -99,7 +99,7 @@ const tableInstance = new ListTable({ 在上述代码中,表格的初始排序状态为按照年龄降序排列。 -## 排序状态设置接口 +## 排序状态设置接口(更改排序) VTable 提供 `updateSortState` 属性用于设置排序状态。 接口说明: @@ -107,7 +107,7 @@ VTable 提供 `updateSortState` 属性用于设置排序状态。 /** * 更新排序状态 * @param sortState 要设置的排序状态 - * @param executeSort 是否执行内部排序逻辑,设置false将只更新图标状态 + * @param executeSort 是否执行内部排序逻辑,设置false将只更新图标状态不执行数据排序 */ updateSortState(sortState: SortState[] | SortState | null, executeSort: boolean = true) ``` @@ -138,7 +138,7 @@ tableInstance.on('sort_click', args => { 排序完成后需要setRecords将数据更新到表格,如果需要排序图标的切换则需要配合接口`updateSortState`,利用接口的第二个参数设置为false,只切换排序图标. 注意: -- setRecords 调用时需先清除内部排序状态(否则setRecords调用时会按上个排序状态对数据进行排序),即将第二个参数设置为null +- setRecords 接口调用时需将第二个参数设置为null 这样就清除了内部排序状态(否则setRecords调用时会按上次设置过的排序状态对数据进行排序) 示例: ```javascript livedemo template=vtable @@ -414,4 +414,63 @@ tableInstance.on('sort_click', args => { } ``` + +## 替换默认的排序图标 + 如果不希望使用内部的图标,可以使用图标自定义功能来替换,接参考教程:https://www.visactor.io/vtable/guide/custom_define/custom_icon + +以下是一个替换排序图标的例子: + +注意: `name`和`funcType`的配置 + +``` +VTable.register.icon("frozenCurrent", { + type: "svg", + svg: "/sort.svg", + width: 22, + height: 22, + name: "sort_normal", + positionType: VTable.TYPES.IconPosition.left, + marginRight: 0, + funcType: VTable.TYPES.IconFuncTypeEnum.sort, + hover: { + width: 22, + height: 22, + bgColor: "rgba(101, 117, 168, 0.1)", + }, + cursor: "pointer", +}); +``` + +## 隐藏排序图标 + +我们提供了`showSort`配置来隐藏排序图标,但可以正常执行排序逻辑 + +以下是一个隐藏排序图标的例子: + +```js +const listTable = new ListTable({ + // ...其它配置项 + columns: [ + { + title: '姓名', + field: 'name', + cellType: 'text', + showSort: false, + sort: true, // 使用内置默认排序逻辑 + }, + { + title: '年龄', + field: 'age', + cellType: 'text', + showSort: false, + sort: (v1, v2, order) => { // 使用自定义排序逻辑 + if (order === 'desc') { + return v1 === v2 ? 0 : v1 > v2 ? -1 : 1; + } + return v1 === v2 ? 0 : v1 > v2 ? 1 : -1; + }, + }, + ], +}); +``` \ No newline at end of file diff --git a/packages/vtable/src/ts-types/list-table/define/basic-define.ts b/packages/vtable/src/ts-types/list-table/define/basic-define.ts index 45fe793fd..182c75b10 100644 --- a/packages/vtable/src/ts-types/list-table/define/basic-define.ts +++ b/packages/vtable/src/ts-types/list-table/define/basic-define.ts @@ -24,7 +24,7 @@ export interface IBasicHeaderDefine { // headerType?: HeaderTypeOption | headerType.BaseHeader | null; /** sort排序规则 */ sort?: SortOption; - /** 显示sort排序icon。为了仅仅显示图标,无排序逻辑。如果设置了sort字段 肯定会显示图标,会省略这个配置 */ + /** 显示sort排序icon。为了仅仅显示图标,无排序逻辑 */ showSort?: boolean; /** 该列不支持hover交互行为 */ disableHover?: boolean; From 1bd837377ebc0a1ffa0985ee649fecec1ec6213d Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Tue, 6 Feb 2024 12:03:21 +0800 Subject: [PATCH 106/115] docs: update release log --- docs/assets/changelog/zh/release.md | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/docs/assets/changelog/zh/release.md b/docs/assets/changelog/zh/release.md index 12e6c2fbc..724d438c7 100644 --- a/docs/assets/changelog/zh/release.md +++ b/docs/assets/changelog/zh/release.md @@ -4,25 +4,24 @@ **🆕 新增功能** - -- **@visactor/vtable**: add update sort rule api -- **@visactor/vtable**: add axis innerOffset config -- **@visactor/vtable**: add name config in customRender +- **@visactor/vtable**: 添加透视表更新排序规则的API updateSortRules +- **@visactor/vtable**: 添加轴内偏移配置 +- **@visactor/vtable**: 在customRender中添加name配置 **🐛 功能修复** - -- **@visactor/vtable**: when table has scroll then click header to edit position error [#1069](https://github.com/VisActor/VTable/issues/1069) -- **@visactor/vtable**: fix column cell order problem in sync mode -- **@visactor/vtable**: fix border lineDash in cell group [#1051](https://github.com/VisActor/VTable/issues/1051) -- **@visactor/vtable**: fix textAlign value in width update[#1065](https://github.com/VisActor/VTable/issues/1065) -- **@visactor/vtable**: fix merge cell content position -- **@visactor/vtable**: fix merge cell update problem + +- **@visactor/vtable**: 修复当表格有滚动时,点击表头编辑位置错误 [#1069](https://github.com/VisActor/VTable/issues/1069) +- **@visactor/vtable**: 修复同步模式下列单元格顺序问题 +- **@visactor/vtable**: 修复单元格组中边框lineDash的问题 [#1051](https://github.com/VisActor/VTable/issues/1051) +- **@visactor/vtable**: 修复宽度更新中textAlign值的问题[#1065](https://github.com/VisActor/VTable/issues/1065) +- **@visactor/vtable**: 修复合并单元格内容位置 +- **@visactor/vtable**: 修复合并单元格更新问题 **🔨 功能重构** - -- **@visactor/vtable**: pivot table sort logic [#1033](https://github.com/VisActor/VTable/issues/1033) -- **@visactor/vtable**: showsort option work well [#1077](https://github.com/VisActor/VTable/issues/1077) - + +- **@visactor/vtable**: 透视表排序逻辑 [#1033](https://github.com/VisActor/VTable/issues/1033) +- **@visactor/vtable**: 显示排序选项工作正常 [#1077](https://github.com/VisActor/VTable/issues/1077) + [更多详情请查看 v0.19.1](https://github.com/VisActor/VTable/releases/tag/v0.19.1) From f082e3db6105ea392cb206b4adb3589bd6b3cb87 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Tue, 6 Feb 2024 16:19:11 +0800 Subject: [PATCH 107/115] fix: fix custom merge cell computed height --- ...-custom-merge-height_2024-02-06-08-19.json | 10 + .../vtable/examples/list/list-merge-cell.ts | 249 +++++++++--------- packages/vtable/src/core/BaseTable.ts | 4 + .../scenegraph/layout/compute-row-height.ts | 12 +- packages/vtable/src/ts-types/base-table.ts | 1 + 5 files changed, 150 insertions(+), 126 deletions(-) create mode 100644 common/changes/@visactor/vtable/fix-custom-merge-height_2024-02-06-08-19.json diff --git a/common/changes/@visactor/vtable/fix-custom-merge-height_2024-02-06-08-19.json b/common/changes/@visactor/vtable/fix-custom-merge-height_2024-02-06-08-19.json new file mode 100644 index 000000000..2f24cced3 --- /dev/null +++ b/common/changes/@visactor/vtable/fix-custom-merge-height_2024-02-06-08-19.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "fix: fix custom merge cell computed height", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/packages/vtable/examples/list/list-merge-cell.ts b/packages/vtable/examples/list/list-merge-cell.ts index 1dd87e73b..73d2d70a9 100644 --- a/packages/vtable/examples/list/list-merge-cell.ts +++ b/packages/vtable/examples/list/list-merge-cell.ts @@ -46,7 +46,7 @@ const dataSource = new VTable.data.CachedDataSource({ }); export function createTable() { - // const records = generatePersons(1000); + const records = new Array(1000).fill(generatePersons(1000)); const columns: VTable.ColumnsDefine = [ { field: 'id', @@ -104,15 +104,15 @@ export function createTable() { ]; const option = { container: document.getElementById(CONTAINER_ID), - // records, + records, columns, tooltip: { isShowOverflowTextTooltip: true }, allowFrozenColCount: 3, // frozenColCount: 2, - // autoWrapText: true, - // heightMode: 'autoHeight', + autoWrapText: true, + heightMode: 'autoHeight', // widthMode: 'adaptive', customMergeCell: (col, row, table) => { if (col > 0 && col < 8 && row > 7 && row < 11) { @@ -132,141 +132,142 @@ export function createTable() { bgColor: '#fff' } }; - } else if (col > 0 && col < 3 && row > 1 && row < 4) { - return { - range: { - start: { - col: 1, - row: 2 - }, - end: { - col: 2, - row: 3 - } - }, - customLayout: args => { - const { table, row, col, rect } = args; - const record = { - bloggerId: 1, - bloggerName: 'Virtual Anchor Xiaohua', - bloggerAvatar: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/flower.jpg', - fansCount: 400, - worksCount: 10, - viewCount: 5, - city: 'Dream City', - tags: ['game', 'anime', 'food'] - }; - const { height, width } = rect ?? table.getCellRect(col, row); - const percentCalc = VTable.CustomLayout.percentCalc; + } + // else if (col > 0 && col < 3 && row > 1 && row < 4) { + // return { + // range: { + // start: { + // col: 1, + // row: 2 + // }, + // end: { + // col: 2, + // row: 3 + // } + // }, + // customLayout: args => { + // const { table, row, col, rect } = args; + // const record = { + // bloggerId: 1, + // bloggerName: 'Virtual Anchor Xiaohua', + // bloggerAvatar: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/custom-render/flower.jpg', + // fansCount: 400, + // worksCount: 10, + // viewCount: 5, + // city: 'Dream City', + // tags: ['game', 'anime', 'food'] + // }; + // const { height, width } = rect ?? table.getCellRect(col, row); + // const percentCalc = VTable.CustomLayout.percentCalc; - const container = new VTable.CustomLayout.Group({ - height, - width, - display: 'flex', - flexDirection: 'row', - flexWrap: 'nowrap' - }); - const containerLeft = new VTable.CustomLayout.Group({ - height: percentCalc(100), - width: 60, - display: 'flex', - flexDirection: 'column', - alignItems: 'center', - justifyContent: 'space-around' - }); - container.add(containerLeft); + // const container = new VTable.CustomLayout.Group({ + // height, + // width, + // display: 'flex', + // flexDirection: 'row', + // flexWrap: 'nowrap' + // }); + // const containerLeft = new VTable.CustomLayout.Group({ + // height: percentCalc(100), + // width: 60, + // display: 'flex', + // flexDirection: 'column', + // alignItems: 'center', + // justifyContent: 'space-around' + // }); + // container.add(containerLeft); - const icon0 = new VTable.CustomLayout.Image({ - id: 'icon0', - width: 50, - height: 50, - image: record.bloggerAvatar, - cornerRadius: 25 - }); - containerLeft.add(icon0); + // const icon0 = new VTable.CustomLayout.Image({ + // id: 'icon0', + // width: 50, + // height: 50, + // image: record.bloggerAvatar, + // cornerRadius: 25 + // }); + // containerLeft.add(icon0); - const containerRight = new VTable.CustomLayout.Group({ - height: percentCalc(100), - width: percentCalc(100, -60), - display: 'flex', - flexDirection: 'column', - flexWrap: 'nowrap' - }); - container.add(containerRight); + // const containerRight = new VTable.CustomLayout.Group({ + // height: percentCalc(100), + // width: percentCalc(100, -60), + // display: 'flex', + // flexDirection: 'column', + // flexWrap: 'nowrap' + // }); + // container.add(containerRight); - const containerRightTop = new VTable.CustomLayout.Group({ - height: percentCalc(50), - width: percentCalc(100), - display: 'flex', - alignItems: 'flex-end' - }); + // const containerRightTop = new VTable.CustomLayout.Group({ + // height: percentCalc(50), + // width: percentCalc(100), + // display: 'flex', + // alignItems: 'flex-end' + // }); - const containerRightBottom = new VTable.CustomLayout.Group({ - height: percentCalc(50), - width: percentCalc(100), - display: 'flex', - alignItems: 'center' - }); + // const containerRightBottom = new VTable.CustomLayout.Group({ + // height: percentCalc(50), + // width: percentCalc(100), + // display: 'flex', + // alignItems: 'center' + // }); - containerRight.add(containerRightTop); - containerRight.add(containerRightBottom); + // containerRight.add(containerRightTop); + // containerRight.add(containerRightBottom); - const bloggerName = new VTable.CustomLayout.Text({ - text: record.bloggerName, - fontSize: 13, - fontFamily: 'sans-serif', - fill: 'black' - }); - containerRightTop.add(bloggerName); + // const bloggerName = new VTable.CustomLayout.Text({ + // text: record.bloggerName, + // fontSize: 13, + // fontFamily: 'sans-serif', + // fill: 'black' + // }); + // containerRightTop.add(bloggerName); - const location = new VTable.CustomLayout.Image({ - id: 'location', - image: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/location.svg', - width: 15, - height: 15, - boundsPadding: [0, 0, 0, 10] - }); - containerRightTop.add(location); + // const location = new VTable.CustomLayout.Image({ + // id: 'location', + // image: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/location.svg', + // width: 15, + // height: 15, + // boundsPadding: [0, 0, 0, 10] + // }); + // containerRightTop.add(location); - const locationName = new VTable.CustomLayout.Text({ - text: record.city, - fontSize: 11, - fontFamily: 'sans-serif', - fill: '#6f7070' - }); - containerRightTop.add(locationName); + // const locationName = new VTable.CustomLayout.Text({ + // text: record.city, + // fontSize: 11, + // fontFamily: 'sans-serif', + // fill: '#6f7070' + // }); + // containerRightTop.add(locationName); - for (let i = 0; i < record?.tags?.length ?? 0; i++) { - const tag = new VTable.CustomLayout.Tag({ - text: record.tags[i], - textStyle: { - fontSize: 10, - fontFamily: 'sans-serif', - fill: 'rgb(51, 101, 238)' - }, - panel: { - visible: true, - fill: '#f4f4f2', - cornerRadius: 5 - }, - space: 5, - boundsPadding: [0, 0, 0, 5] - }); - containerRightBottom.add(tag); - } - return { - rootContainer: container, - renderDefault: false - }; - } - }; - } + // for (let i = 0; i < record?.tags?.length ?? 0; i++) { + // const tag = new VTable.CustomLayout.Tag({ + // text: record.tags[i], + // textStyle: { + // fontSize: 10, + // fontFamily: 'sans-serif', + // fill: 'rgb(51, 101, 238)' + // }, + // panel: { + // visible: true, + // fill: '#f4f4f2', + // cornerRadius: 5 + // }, + // space: 5, + // boundsPadding: [0, 0, 0, 5] + // }); + // containerRightBottom.add(tag); + // } + // return { + // rootContainer: container, + // renderDefault: false + // }; + // } + // }; + // } } }; const tableInstance = new VTable.ListTable(option); window.tableInstance = tableInstance; - tableInstance.dataSource = dataSource; + // tableInstance.dataSource = dataSource; bindDebugTool(tableInstance.scenegraph.stage, { customGrapicKeys: ['col', 'row'] }); // tableInstance.on('sort_click', args => { diff --git a/packages/vtable/src/core/BaseTable.ts b/packages/vtable/src/core/BaseTable.ts index bdd2a39be..3efda905d 100644 --- a/packages/vtable/src/core/BaseTable.ts +++ b/packages/vtable/src/core/BaseTable.ts @@ -2685,6 +2685,10 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { return this.internalProps.layoutMap.getCellRange(col, row); } + hasCustomMerge() { + return !!this.internalProps.customMergeCell; + } + getCustomMerge(col: number, row: number) { if (this.internalProps.customMergeCell) { const customMerge = this.internalProps.customMergeCell(col, row, this); diff --git a/packages/vtable/src/scenegraph/layout/compute-row-height.ts b/packages/vtable/src/scenegraph/layout/compute-row-height.ts index 6d91eacfd..d03996877 100644 --- a/packages/vtable/src/scenegraph/layout/compute-row-height.ts +++ b/packages/vtable/src/scenegraph/layout/compute-row-height.ts @@ -511,7 +511,11 @@ function computeCustomRenderHeight(col: number, row: number, table: BaseTableAPI let height = 0; let renderDefault = false; let enableCellPadding = false; - if (table.isHeader(col, row) || (table.getBodyColumnDefine(col, row) as TextColumnDefine)?.mergeCell) { + if ( + table.isHeader(col, row) || + (table.getBodyColumnDefine(col, row) as TextColumnDefine)?.mergeCell || + table.hasCustomMerge() + ) { const cellRange = table.getCellRange(col, row); spanRow = cellRange.end.row - cellRange.start.row + 1; } @@ -614,7 +618,11 @@ function computeTextHeight(col: number, row: number, cellType: ColumnTypeOption, } let spanRow = 1; let endCol = col; - if (table.isHeader(col, row) || (table.getBodyColumnDefine(col, row) as TextColumnDefine)?.mergeCell) { + if ( + table.isHeader(col, row) || + (table.getBodyColumnDefine(col, row) as TextColumnDefine)?.mergeCell || + table.hasCustomMerge() + ) { const cellRange = table.getCellRange(col, row); spanRow = cellRange.end.row - cellRange.start.row + 1; col = cellRange.start.col; diff --git a/packages/vtable/src/ts-types/base-table.ts b/packages/vtable/src/ts-types/base-table.ts index e38f83cf9..2e617a205 100644 --- a/packages/vtable/src/ts-types/base-table.ts +++ b/packages/vtable/src/ts-types/base-table.ts @@ -677,6 +677,7 @@ export interface BaseTableAPI { isTopFrozenRow: (col: number, row?: number) => boolean; isBottomFrozenRow: (col: number, row?: number) => boolean; + hasCustomMerge: () => boolean; getCustomMerge: (col: number, row: number) => undefined | (Omit & { style?: FullExtendStyle }); /** 获取表格body部分的显示单元格范围 */ getBodyVisibleCellRange: () => { rowStart: number; colStart: number; rowEnd: number; colEnd: number }; From 2e45fec8c266a5e82b42a4e2689318f6414dfb4f Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Tue, 6 Feb 2024 18:07:59 +0800 Subject: [PATCH 108/115] fix: fix custom merge cell computed width --- .../fix-custom-merge-height_2024-02-06-08-19.json | 2 +- packages/vtable/examples/list/list-merge-cell.ts | 2 +- .../src/scenegraph/layout/compute-col-width.ts | 12 ++++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/common/changes/@visactor/vtable/fix-custom-merge-height_2024-02-06-08-19.json b/common/changes/@visactor/vtable/fix-custom-merge-height_2024-02-06-08-19.json index 2f24cced3..8d5109f06 100644 --- a/common/changes/@visactor/vtable/fix-custom-merge-height_2024-02-06-08-19.json +++ b/common/changes/@visactor/vtable/fix-custom-merge-height_2024-02-06-08-19.json @@ -2,7 +2,7 @@ "changes": [ { "packageName": "@visactor/vtable", - "comment": "fix: fix custom merge cell computed height", + "comment": "fix: fix custom merge cell computed height&width", "type": "none" } ], diff --git a/packages/vtable/examples/list/list-merge-cell.ts b/packages/vtable/examples/list/list-merge-cell.ts index 73d2d70a9..c851e8687 100644 --- a/packages/vtable/examples/list/list-merge-cell.ts +++ b/packages/vtable/examples/list/list-merge-cell.ts @@ -58,7 +58,7 @@ export function createTable() { { field: 'email1', title: 'email', - width: 200, + width: 'auto', sort: true }, { diff --git a/packages/vtable/src/scenegraph/layout/compute-col-width.ts b/packages/vtable/src/scenegraph/layout/compute-col-width.ts index ce82111bc..ef06f55e8 100644 --- a/packages/vtable/src/scenegraph/layout/compute-col-width.ts +++ b/packages/vtable/src/scenegraph/layout/compute-col-width.ts @@ -449,7 +449,11 @@ function computeCustomRenderWidth(col: number, row: number, table: BaseTableAPI) let width = 0; let renderDefault = false; let enableCellPadding = false; - if (table.isHeader(col, row) || (table.getBodyColumnDefine(col, row) as TextColumnDefine)?.mergeCell) { + if ( + table.isHeader(col, row) || + (table.getBodyColumnDefine(col, row) as TextColumnDefine)?.mergeCell || + table.hasCustomMerge() + ) { const cellRange = table.getCellRange(col, row); spanCol = cellRange.end.col - cellRange.start.col + 1; } @@ -556,7 +560,11 @@ function computeTextWidth(col: number, row: number, cellType: ColumnTypeOption, } let spanCol = 1; - if (table.isHeader(col, row) || (table.getBodyColumnDefine(col, row) as TextColumnDefine)?.mergeCell) { + if ( + table.isHeader(col, row) || + (table.getBodyColumnDefine(col, row) as TextColumnDefine)?.mergeCell || + table.hasCustomMerge() + ) { const cellRange = table.getCellRange(col, row); spanCol = cellRange.end.col - cellRange.start.col + 1; } From 84b220a39d7f4dbf31849d833dc17374f9add5a3 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Tue, 30 Jan 2024 14:27:37 +0800 Subject: [PATCH 109/115] fix: fix strict error in react-vtable --- .../react-vtable/src/tables/base-table.tsx | 47 ++++++------------- 1 file changed, 15 insertions(+), 32 deletions(-) diff --git a/packages/react-vtable/src/tables/base-table.tsx b/packages/react-vtable/src/tables/base-table.tsx index be5f8df0a..ea67636aa 100644 --- a/packages/react-vtable/src/tables/base-table.tsx +++ b/packages/react-vtable/src/tables/base-table.tsx @@ -62,7 +62,7 @@ const BaseTable: React.FC = React.forwardRef((props, ref) => { const tableContext = useRef({ optionFromChildren: {} }); - useImperativeHandle(ref, () => tableContext.current.table); + useImperativeHandle(ref, () => tableContext.current?.table); const hasOption = !!props.option; const hasRecords = !!props.records; const isUnmount = useRef(false); @@ -82,11 +82,10 @@ const BaseTable: React.FC = React.forwardRef((props, ref) => { } return props.option; } - return { records: props.records, ...prevOption.current, - ...tableContext.current.optionFromChildren + ...tableContext.current?.optionFromChildren }; }, [hasOption, hasRecords] @@ -108,10 +107,13 @@ const BaseTable: React.FC = React.forwardRef((props, ref) => { ); const handleTableRender = useCallback(() => { - // rebind events after render - bindEventsToTable(tableContext.current.table, props, eventsBinded.current, TABLE_EVENTS); - if (!isUnmount.current) { + if (!tableContext.current || !tableContext.current.table) { + return; + } + // rebind events after render + bindEventsToTable(tableContext.current.table, props, eventsBinded.current, TABLE_EVENTS); + // to be fixed // will cause another useEffect setUpdateId(updateId + 1); @@ -124,13 +126,10 @@ const BaseTable: React.FC = React.forwardRef((props, ref) => { const renderTable = useCallback(() => { if (tableContext.current.table) { // eslint-disable-next-line promise/catch-or-return - const renderPromise = tableContext.current.table.renderAsync().then(handleTableRender); - - if (props.onError) { - renderPromise.catch(props.onError); - } + tableContext.current.table.render(); + handleTableRender(); } - }, [handleTableRender, props]); + }, [handleTableRender]); useEffect(() => { if (!tableContext.current?.table) { @@ -150,22 +149,14 @@ const BaseTable: React.FC = React.forwardRef((props, ref) => { eventsBinded.current = props; // eslint-disable-next-line promise/catch-or-return tableContext.current.table.updateOption(parseOption(props)); - const updatePromise = tableContext.current.table.renderAsync().then(handleTableRender); - - if (props.onError) { - updatePromise.catch(props.onError); - } + handleTableRender(); } else if ( hasRecords && !isEqual(eventsBinded.current.records, props.records, { skipFunction: skipFunctionDiff }) ) { eventsBinded.current = props; tableContext.current.table.setRecords(props.records); - const updatePromise = tableContext.current.table.renderAsync().then(handleTableRender); - - if (props.onError) { - updatePromise.catch(props.onError); - } + handleTableRender(); } return; } @@ -179,19 +170,11 @@ const BaseTable: React.FC = React.forwardRef((props, ref) => { prevOption.current = newOption; // eslint-disable-next-line promise/catch-or-return tableContext.current.table.updateOption(parseOption(props)); - const updatePromise = tableContext.current.table.renderAsync().then(handleTableRender); - - if (props.onError) { - updatePromise.catch(props.onError); - } + handleTableRender(); } else if (hasRecords && !isEqual(props.records, prevRecords.current, { skipFunction: skipFunctionDiff })) { prevRecords.current = props.records; tableContext.current.table.setRecords(props.records); - const updatePromise = tableContext.current.table.renderAsync().then(handleTableRender); - - if (props.onError) { - updatePromise.catch(props.onError); - } + handleTableRender(); } tableContext.current = { ...tableContext.current, From 33f75c904d98c3c620d5419c7cd41abb35ace7b0 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Tue, 6 Feb 2024 17:21:41 +0800 Subject: [PATCH 110/115] fix: fix react-vtable display error in react strict mode #990 --- .../fix-react-strict_2024-02-06-09-17.json | 10 ++ packages/react-vtable/demo/src/main.tsx | 5 +- .../src/components/base-component.tsx | 139 ++++++++++-------- packages/react-vtable/src/context/table.tsx | 2 +- .../react-vtable/src/tables/base-table.tsx | 87 ++++++++--- 5 files changed, 159 insertions(+), 84 deletions(-) create mode 100644 common/changes/@visactor/vtable/fix-react-strict_2024-02-06-09-17.json diff --git a/common/changes/@visactor/vtable/fix-react-strict_2024-02-06-09-17.json b/common/changes/@visactor/vtable/fix-react-strict_2024-02-06-09-17.json new file mode 100644 index 000000000..6f30fc4d6 --- /dev/null +++ b/common/changes/@visactor/vtable/fix-react-strict_2024-02-06-09-17.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "fix: fix react-vtable display error in react strict mode #990", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/packages/react-vtable/demo/src/main.tsx b/packages/react-vtable/demo/src/main.tsx index 40991e2cf..a941429b9 100644 --- a/packages/react-vtable/demo/src/main.tsx +++ b/packages/react-vtable/demo/src/main.tsx @@ -1,9 +1,10 @@ import ReactDOM from 'react-dom/client'; +import React from 'react'; import App from './App'; import './index.css'; /*global document*/ ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render( - <> + - + ); diff --git a/packages/react-vtable/src/components/base-component.tsx b/packages/react-vtable/src/components/base-component.tsx index e4fa4da6c..7d8f365d9 100644 --- a/packages/react-vtable/src/components/base-component.tsx +++ b/packages/react-vtable/src/components/base-component.tsx @@ -10,7 +10,7 @@ export interface BaseComponentProps { id?: string | number; } -type ComponentProps = BaseComponentProps & { updateId?: number }; +type ComponentProps = BaseComponentProps & { updateId?: number; componentId?: number }; export const createComponent = ( componentName: string, @@ -18,16 +18,16 @@ export const createComponent = ( supportedEvents?: Record | null, isSingle?: boolean ) => { - const ignoreKeys = ['id', 'updateId']; + const ignoreKeys = ['id', 'updateId', 'componentId']; const notOptionKeys = supportedEvents ? Object.keys(supportedEvents).concat(ignoreKeys) : ignoreKeys; const Comp: React.FC = (props: T) => { const context = useContext(RootTableContext); - const id = React.useRef(isNil(props.id) ? uid(optionName) : props.id); + // const id = React.useRef(isNil(props.id) ? uid(optionName) : props.id); const eventsBinded = React.useRef(null); const updateId = React.useRef(props.updateId); - const componentOption = React.useRef>(); + // const componentOption = React.useRef>(); if (props.updateId !== updateId.current) { // update triggered by table when table is rendered @@ -40,13 +40,13 @@ export const createComponent = ( if (hasPrevEventsBinded) { eventsBinded.current = props; } - } else { - const newComponentOption: Partial = pickWithout(props, notOptionKeys); + // } else { + // const newComponentOption: Partial = pickWithout(props, notOptionKeys); - if (!isEqual(newComponentOption, componentOption.current)) { - componentOption.current = newComponentOption; - updateToContext(context, id.current, optionName, isSingle, newComponentOption); - } + // if (!isEqual(newComponentOption, componentOption.current)) { + // componentOption.current = newComponentOption; + // updateToContext(context, id.current, optionName, isSingle, newComponentOption); + // } } useEffect(() => { @@ -54,7 +54,7 @@ export const createComponent = ( if (supportedEvents) { bindEventsToTable(context.table, null, eventsBinded.current, supportedEvents); } - deleteToContext(context, id.current, optionName, isSingle); + // deleteToContext(context, id.current, optionName, isSingle); }; }, []); @@ -62,61 +62,72 @@ export const createComponent = ( }; Comp.displayName = componentName; - return Comp; -}; -const updateToContext = ( - context: TableContextType, - id: string | number, - optionName: string, - isSingle: boolean, - props: Partial -) => { - if (!context.optionFromChildren) { - return; - } - - if (isSingle) { - context.optionFromChildren[optionName] = { ...props }; - } else { - if (!context.optionFromChildren[optionName]) { - context.optionFromChildren[optionName] = []; - } + (Comp as any).parseOption = (props: T & { updateId?: number; componentId?: string }) => { + const newComponentOption: Partial = pickWithout(props, notOptionKeys); - const comps = context.optionFromChildren[optionName]; - const index = comps.findIndex((entry: any) => entry.id === id); + return { + option: newComponentOption, + optionName, + isSingle + }; + }; - if (index >= 0) { - comps[index] = { - id, - ...props - }; - } else { - context.optionFromChildren[optionName].push({ - id, - ...props - }); - } - } - context.isChildrenUpdated = true; + return Comp; }; -const deleteToContext = (context: TableContextType, id: string | number, optionName: string, isSingle: boolean) => { - if (!context.optionFromChildren) { - return; - } - - if (isSingle) { - context.optionFromChildren[optionName] = null; - } else { - const comps = context.optionFromChildren[optionName] ?? []; - const index = comps.findIndex((entry: any) => entry.id === id); - - if (index >= 0) { - const newComps = comps.slice(0, index - 1).concat(comps.slice(index + 1)); - - context.optionFromChildren[optionName] = newComps; - context.isChildrenUpdated = true; - } - } -}; +// const updateToContext = ( +// context: TableContextType, +// id: string | number, +// optionName: string, +// isSingle: boolean, +// props: Partial +// ) => { +// if (!context.optionFromChildren) { +// return; +// } + +// if (isSingle) { +// context.optionFromChildren[optionName] = { ...props }; +// } else { +// if (!context.optionFromChildren[optionName]) { +// context.optionFromChildren[optionName] = []; +// } + +// const comps = context.optionFromChildren[optionName]; +// const index = comps.findIndex((entry: any) => entry.id === id); + +// if (index >= 0) { +// comps[index] = { +// id, +// ...props +// }; +// } else { +// context.optionFromChildren[optionName].push({ +// id, +// ...props +// }); +// } +// } +// context.isChildrenUpdated = true; +// }; + +// const deleteToContext = (context: TableContextType, id: string | number, optionName: string, isSingle: boolean) => { +// if (!context.optionFromChildren) { +// return; +// } + +// if (isSingle) { +// context.optionFromChildren[optionName] = null; +// } else { +// const comps = context.optionFromChildren[optionName] ?? []; +// const index = comps.findIndex((entry: any) => entry.id === id); + +// if (index >= 0) { +// const newComps = comps.slice(0, index - 1).concat(comps.slice(index + 1)); + +// context.optionFromChildren[optionName] = newComps; +// context.isChildrenUpdated = true; +// } +// } +// }; diff --git a/packages/react-vtable/src/context/table.tsx b/packages/react-vtable/src/context/table.tsx index 4c8ab071d..ca335ee4a 100644 --- a/packages/react-vtable/src/context/table.tsx +++ b/packages/react-vtable/src/context/table.tsx @@ -3,7 +3,7 @@ import type { ListTable, PivotTable, PivotChart } from '@visactor/vtable'; export interface TableContextType { table?: ListTable | PivotTable | PivotChart; - optionFromChildren: any; + // optionFromChildren: any; isChildrenUpdated?: boolean; } diff --git a/packages/react-vtable/src/tables/base-table.tsx b/packages/react-vtable/src/tables/base-table.tsx index ea67636aa..a626a4bd5 100644 --- a/packages/react-vtable/src/tables/base-table.tsx +++ b/packages/react-vtable/src/tables/base-table.tsx @@ -23,6 +23,10 @@ import type { import { bindEventsToTable, TABLE_EVENTS_KEYS, TABLE_EVENTS } from '../eventsUtils'; export type IVTable = VTable.ListTable | VTable.PivotTable | VTable.PivotChart; +export type IOption = + | VTable.ListTableConstructorOptions + | VTable.PivotTableConstructorOptions + | VTable.PivotChartConstructorOptions; export interface BaseTableProps extends EventsProps { type?: string; @@ -57,16 +61,41 @@ const notOptionKeys = [ 'container' ]; +const parseOptionFromChildren = (props: Props) => { + const optionFromChildren: Omit = {}; + + toArray(props.children).map(child => { + const parseOption = child && (child as any).type && (child as any).type.parseOption; + + if (parseOption && (child as any).props) { + const optionResult = parseOption((child as any).props); + + if (optionResult.isSingle) { + optionFromChildren[optionResult.optionName] = optionResult.option; + } else { + if (!optionFromChildren[optionResult.optionName]) { + optionFromChildren[optionResult.optionName] = []; + } + + optionFromChildren[optionResult.optionName].push(optionResult.option); + } + } + }); + + return optionFromChildren; +}; + const BaseTable: React.FC = React.forwardRef((props, ref) => { const [updateId, setUpdateId] = useState(0); const tableContext = useRef({ - optionFromChildren: {} + // optionFromChildren: {} }); useImperativeHandle(ref, () => tableContext.current?.table); const hasOption = !!props.option; const hasRecords = !!props.records; const isUnmount = useRef(false); const prevOption = useRef(pickWithout(props, notOptionKeys)); + const optionFromChildren = useRef>(null); const prevRecords = useRef(props.records); const eventsBinded = React.useRef(null); const skipFunctionDiff = !!props.skipFunctionDiff; @@ -85,8 +114,9 @@ const BaseTable: React.FC = React.forwardRef((props, ref) => { return { records: props.records, ...prevOption.current, - ...tableContext.current?.optionFromChildren - }; + ...optionFromChildren.current + // ...tableContext.current?.optionFromChildren + } as IOption; }, [hasOption, hasRecords] ); @@ -132,14 +162,20 @@ const BaseTable: React.FC = React.forwardRef((props, ref) => { }, [handleTableRender]); useEffect(() => { + const newOptionFromChildren = hasOption ? null : parseOptionFromChildren(props); + if (!tableContext.current?.table) { + if (!hasOption) { + optionFromChildren.current = newOptionFromChildren; + } + createTable(props); renderTable(); bindEventsToTable(tableContext.current.table, props, null, TABLE_EVENTS); - tableContext.current = { - ...tableContext.current, - isChildrenUpdated: false - }; + // tableContext.current = { + // ...tableContext.current, + // isChildrenUpdated: false + // }; eventsBinded.current = props; return; } @@ -165,9 +201,12 @@ const BaseTable: React.FC = React.forwardRef((props, ref) => { if ( !isEqual(newOption, prevOption.current, { skipFunction: skipFunctionDiff }) || - tableContext.current.isChildrenUpdated + // tableContext.current.isChildrenUpdated + !isEqual(newOptionFromChildren, optionFromChildren.current) ) { prevOption.current = newOption; + optionFromChildren.current = newOptionFromChildren; + // eslint-disable-next-line promise/catch-or-return tableContext.current.table.updateOption(parseOption(props)); handleTableRender(); @@ -176,19 +215,19 @@ const BaseTable: React.FC = React.forwardRef((props, ref) => { tableContext.current.table.setRecords(props.records); handleTableRender(); } - tableContext.current = { - ...tableContext.current, - isChildrenUpdated: false - }; + // tableContext.current = { + // ...tableContext.current, + // isChildrenUpdated: false + // }; }, [createTable, hasOption, hasRecords, parseOption, handleTableRender, renderTable, skipFunctionDiff, props]); useEffect(() => { return () => { if (tableContext) { - if (tableContext.current.table) { + if (tableContext.current && tableContext.current.table) { tableContext.current.table.release(); + tableContext.current = null; } - tableContext.current = null; } isUnmount.current = true; }; @@ -197,10 +236,24 @@ const BaseTable: React.FC = React.forwardRef((props, ref) => { return ( {toArray(props.children).map((child: React.ReactNode, index: number) => { + if (typeof child === 'string') { + return; + } + + const componentName = + child && (child as any).type && ((child as any).type.displayName || (child as any).type.name); + const childId = `${componentName}-${index}`; + return ( - - {React.cloneElement(child as IMarkElement, { - updateId: updateId + // + // {React.cloneElement(child as IMarkElement, { + // updateId: updateId + // })} + // + + {React.cloneElement(child as React.ReactElement>, { + updateId: updateId, + componentId: childId })} ); From 99fbf246322b312d15bc990f1ce2bcd85c4e9540 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Wed, 7 Feb 2024 10:47:27 +0800 Subject: [PATCH 111/115] fix: select border render error when scroll quickly #1091 --- .../option/en/common/option-secondary.md | 39 +++++++------- .../option/zh/common/option-secondary.md | 52 ++++++++++--------- packages/vtable/examples/list/list.ts | 5 +- packages/vtable/src/core/BaseTable.ts | 3 ++ 4 files changed, 52 insertions(+), 47 deletions(-) diff --git a/docs/assets/option/en/common/option-secondary.md b/docs/assets/option/en/common/option-secondary.md index 4a90c170d..715e2e819 100644 --- a/docs/assets/option/en/common/option-secondary.md +++ b/docs/assets/option/en/common/option-secondary.md @@ -1,17 +1,5 @@ {{ target: common-option-secondary }} -#${prefix} theme(Object) - -{{ use: common-theme( - prefix = '#' + ${prefix}, -) }} - -#${prefix} title(Object) - -{{ use: common-title( - prefix = '#' + ${prefix}, -) }} - #${prefix} widthMode('standard' | 'adaptive' | 'autoWidth') = 'standard' Table column width calculation mode, can be 'standard' (standard mode), 'adaptive' (container width adaptive mode) or 'autoWidth' (automatic width mode), default is 'standard'. @@ -107,7 +95,7 @@ Enable shortcut key to copy, consistent with the browser's shortcut key. Enable shortcut key to paste, consistent with the browser's shortcut key. ##${prefix} moveFocusCellOnTab(boolean) = true - Enable tab key interaction. The default is true. Turn on the tab key to move the selected cell. If you are currently editing a cell, moving to the next cell is also in the editing state. +Enable tab key interaction. The default is true. Turn on the tab key to move the selected cell. If you are currently editing a cell, moving to the next cell is also in the editing state. ##${prefix} editCellOnEnter(boolean) = true Enable enter key interaction. Default is true. If the selected cell is editable, enter cell editing. @@ -223,6 +211,18 @@ Set the selected state of the menu. Declaration type is `DropDownMenuHighlightIn {{ use: common-IDimensionInfo()}} +#${prefix} theme(Object) + +{{ use: common-theme( + prefix = '#' + ${prefix}, +) }} + +#${prefix} title(Object) + +{{ use: common-title( + prefix = '#' + ${prefix}, +) }} + #${prefix} tooltip(Object) Tooltip related configuration. Specific configuration items are as follows: @@ -302,7 +302,9 @@ Where ICustomRenderFuc is defined as: ) }} ## overscrollBehavior(string) = 'auto' + Table scrolling behavior, can be set: 'auto'|'none', the default value is 'auto'. + ``` 'auto': Trigger the browser's default behavior when the table scrolls to the top or bottom; 'none': triggers the browser's default behavior when the table scrolls to the top or bottom; @@ -310,10 +312,11 @@ Table scrolling behavior, can be set: 'auto'|'none', the default value is 'auto' #${prefix} customMergeCell(Function) Customize cell merging rules. When the incoming row and column numbers are within the target area, the merging rules are returned: -* text: Merge text in cells -* range: merged range -* style: style of merged cells -Example: + +- text: Merge text in cells +- range: merged range +- style: style of merged cells + Example: ``` customMergeCell: (col, row, table) => { @@ -337,4 +340,4 @@ Example: } } -``` \ No newline at end of file +``` diff --git a/docs/assets/option/zh/common/option-secondary.md b/docs/assets/option/zh/common/option-secondary.md index fd6b42706..c0a0a2321 100644 --- a/docs/assets/option/zh/common/option-secondary.md +++ b/docs/assets/option/zh/common/option-secondary.md @@ -1,17 +1,5 @@ {{ target: common-option-secondary }} -#${prefix} theme(Object) - -{{ use: common-theme( - prefix = '#' + ${prefix}, -) }} - -#${prefix} title(Object) - -{{ use: common-title( - prefix = '#' + ${prefix}, -) }} - #${prefix} widthMode('standard' | 'adaptive' | 'autoWidth') = 'standard' 表格列宽度的计算模式,可以是 'standard'(标准模式)、'adaptive'(自适应容器宽度模式)或 'autoWidth'(自动宽度模式),默认为 'standard'。 @@ -26,7 +14,7 @@ - 'standard':采用 `defaultRowHeight` 及 `defaultHeaderRowHeight` 作为行高。 - 'adaptive':使用容器的高度分配每行高度。 -- 'autoHeight':根据内容自动计算行高,计算依据 fontSize 和 lineHeight(文字行高),以及padding。相关搭配设置项`autoWrapText`自动换行,可以根据换行后的多行文本内容来计算行高。 +- 'autoHeight':根据内容自动计算行高,计算依据 fontSize 和 lineHeight(文字行高),以及 padding。相关搭配设置项`autoWrapText`自动换行,可以根据换行后的多行文本内容来计算行高。 #${prefix} autoWrapText(boolean) = false @@ -52,7 +40,7 @@ #${prefix} limitMinWidth(boolean|number) = 10 -最小列宽限制。如设置为true 则拖拽改变列宽时限制列宽最小为10px,设置为false则不进行限制。或者直接将其设置为某个数字值。默认为10px。 +最小列宽限制。如设置为 true 则拖拽改变列宽时限制列宽最小为 10px,设置为 false 则不进行限制。或者直接将其设置为某个数字值。默认为 10px。 #${prefix} frozenColCount(number) = 0 @@ -104,14 +92,14 @@ 开启快捷键粘贴,与浏览器的快捷键一致。 ##${prefix} moveFocusCellOnTab(boolean) = true - 开启tab键交互 默认为true。开启tab键移动选中单元格,如果当前是在编辑单元格 则移动到下一个单元格也是编辑状态 +开启 tab 键交互 默认为 true。开启 tab 键移动选中单元格,如果当前是在编辑单元格 则移动到下一个单元格也是编辑状态 ##${prefix} editCellOnEnter(boolean) = true - 开启enter键交互 默认true 如果选中单元格可编辑则进入单元格编辑。 +开启 enter 键交互 默认 true 如果选中单元格可编辑则进入单元格编辑。 - ##${prefix} moveEditCellOnArrowKeys(boolean) = false +##${prefix} moveEditCellOnArrowKeys(boolean) = false - 默认不开启即false。 +默认不开启即 false。 开启这个配置的话,如果当前是在编辑中的单元格,方向键可以移动到下个单元格并进入编辑状态,而不是编辑文本内字符串的光标移动 。 @@ -161,7 +149,7 @@ hover 交互响应模式:十字交叉、整列、整行或者单个单元格 ##${prefix} headerSelectMode ('inline' | 'cell') = 'inline' -点击表头单元格时连带body整行或整列选中 或仅选中当前单元格,默认或整行或整列选中。 +点击表头单元格时连带 body 整行或整列选中 或仅选中当前单元格,默认或整行或整列选中。 可选值:'inline' | 'cell'。 @@ -216,6 +204,18 @@ DropDownMenuHighlightInfo 的定义如下: {{ use: common-IDimensionInfo()}} +#${prefix} theme(Object) + +{{ use: common-theme( + prefix = '#' + ${prefix}, +) }} + +#${prefix} title(Object) + +{{ use: common-title( + prefix = '#' + ${prefix}, +) }} + #${prefix} tooltip(Object) tooltip 相关配置。具体配置如下: @@ -294,9 +294,10 @@ html 目前实现较完整,先默认使用 html 渲染方式。目前暂不支 prefix = '##' + ${prefix}, ) }} - ## overscrollBehavior(string) = 'auto' + 表格滚动行为,可设置:'auto'|'none',默认值为'auto'。 + ``` 'auto': 表格滚动到顶部或者底部时,触发浏览器默认行为; 'none': 表格滚动到顶部或者底部时, 触发浏览器默认行为; @@ -304,10 +305,11 @@ html 目前实现较完整,先默认使用 html 渲染方式。目前暂不支 #${prefix} customMergeCell(Function) 自定义单元格合并规则,传入的行列号在目标区域内时,返回合并规则: -* text: 合并单元格内的文字 -* range: 合并的范围 -* style: 合并单元格的样式 -示例: + +- text: 合并单元格内的文字 +- range: 合并的范围 +- style: 合并单元格的样式 + 示例: ``` customMergeCell: (col, row, table) => { @@ -331,4 +333,4 @@ html 目前实现较完整,先默认使用 html 渲染方式。目前暂不支 } } -``` \ No newline at end of file +``` diff --git a/packages/vtable/examples/list/list.ts b/packages/vtable/examples/list/list.ts index 4af73c6e9..9dcb0763f 100644 --- a/packages/vtable/examples/list/list.ts +++ b/packages/vtable/examples/list/list.ts @@ -16,7 +16,7 @@ const generatePersons = count => { }; export function createTable() { - const records = generatePersons(10); + const records = generatePersons(10000); const columns: VTable.ColumnsDefine = [ { field: '', @@ -166,9 +166,6 @@ export function createTable() { bottomFrozenRowCount: 2, rightFrozenColCount: 2, overscrollBehavior: 'none', - autoWrapText: true, - heightMode: 'adaptive', - widthMode: 'adaptive', dragHeaderMode: 'all', keyboardOptions: { pasteValueToCell: true diff --git a/packages/vtable/src/core/BaseTable.ts b/packages/vtable/src/core/BaseTable.ts index 3efda905d..1f220aacd 100644 --- a/packages/vtable/src/core/BaseTable.ts +++ b/packages/vtable/src/core/BaseTable.ts @@ -956,6 +956,9 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { * @returns */ getRowsHeight(startRow: number, endRow: number): number { + if (startRow > endRow) { + return 0; + } startRow = Math.max(startRow, 0); endRow = Math.min(endRow, (this.rowCount ?? Infinity) - 1); //通过缓存获取指定范围行高 From 20dd8654517c53c5a1f20eb7341c73f36810c589 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Wed, 7 Feb 2024 10:51:27 +0800 Subject: [PATCH 112/115] docs: update menu and theme order --- docs/assets/option/en/common/option-secondary.md | 12 ++++++------ docs/assets/option/zh/common/option-secondary.md | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/assets/option/en/common/option-secondary.md b/docs/assets/option/en/common/option-secondary.md index 715e2e819..1055cff13 100644 --- a/docs/assets/option/en/common/option-secondary.md +++ b/docs/assets/option/en/common/option-secondary.md @@ -167,6 +167,12 @@ Do not respond to mouse select interaction. Separately set the header not to respond to mouse select interaction. +#${prefix} theme(Object) + +{{ use: common-theme( + prefix = '#' + ${prefix}, +) }} + #${prefix} menu(Object) Configuration related to the drop-down menu. Disappearance timing: automatically disappears after clicking the area outside the menu. Specific configuration items as follows: @@ -211,12 +217,6 @@ Set the selected state of the menu. Declaration type is `DropDownMenuHighlightIn {{ use: common-IDimensionInfo()}} -#${prefix} theme(Object) - -{{ use: common-theme( - prefix = '#' + ${prefix}, -) }} - #${prefix} title(Object) {{ use: common-title( diff --git a/docs/assets/option/zh/common/option-secondary.md b/docs/assets/option/zh/common/option-secondary.md index c0a0a2321..3e6f5e8b9 100644 --- a/docs/assets/option/zh/common/option-secondary.md +++ b/docs/assets/option/zh/common/option-secondary.md @@ -161,6 +161,12 @@ hover 交互响应模式:十字交叉、整列、整行或者单个单元格 单独设置表头不响应鼠标 select 交互。 +#${prefix} theme(Object) + +{{ use: common-theme( + prefix = '#' + ${prefix}, +) }} + #${prefix} menu(Object) 下拉菜单的相关配置。消失时机:显示后点击菜单区域外自动消失。具体配置项如下: @@ -204,12 +210,6 @@ DropDownMenuHighlightInfo 的定义如下: {{ use: common-IDimensionInfo()}} -#${prefix} theme(Object) - -{{ use: common-theme( - prefix = '#' + ${prefix}, -) }} - #${prefix} title(Object) {{ use: common-title( From 58b7c97b99d120de0c4ab50f4981a1fc3f691186 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Wed, 7 Feb 2024 15:37:08 +0800 Subject: [PATCH 113/115] fix: edit right frozen cell input position error --- packages/vtable/src/core/BaseTable.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vtable/src/core/BaseTable.ts b/packages/vtable/src/core/BaseTable.ts index 1f220aacd..0691ed6b1 100644 --- a/packages/vtable/src/core/BaseTable.ts +++ b/packages/vtable/src/core/BaseTable.ts @@ -1425,11 +1425,11 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { const isFrozenStartCell = this.isFrozenCell(startCol, startRow); const isFrozenEndCell = this.isFrozenCell(endCol, endRow); - let absoluteLeft = this.getColsWidth(0, startCol - 1) || 0; // startCol为0时,absoluteLeft计算为Nan + const absoluteLeft = this.getColsWidth(0, startCol - 1) || 0; // startCol为0时,absoluteLeft计算为Nan let width = this.getColsWidth(startCol, endCol); if (isFrozenStartCell?.col) { const scrollLeft = this.scrollLeft; - absoluteLeft += scrollLeft; + // absoluteLeft += scrollLeft; if (!isFrozenEndCell?.col) { width -= scrollLeft; width = Math.max(width, this.getColsWidth(startCol, this.frozenColCount - 1)); From 0843f182f137fa58e17d6f34603fdf22f9fe66cb Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Wed, 7 Feb 2024 17:29:10 +0800 Subject: [PATCH 114/115] fix: edit right frozen cell input position error --- packages/vtable/src/core/BaseTable.ts | 51 +++++++++++++++++---------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/packages/vtable/src/core/BaseTable.ts b/packages/vtable/src/core/BaseTable.ts index 0691ed6b1..6c641ff10 100644 --- a/packages/vtable/src/core/BaseTable.ts +++ b/packages/vtable/src/core/BaseTable.ts @@ -839,6 +839,9 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { * @returns */ getColsWidth(startCol: number, endCol: number): number { + if (startCol > endCol) { + return 0; + } startCol = Math.max(startCol, 0); endCol = Math.min(endCol, (this.colCount ?? Infinity) - 1); // endCol最大为this.colCount - 1,超过会导致width计算为NaN //通过缓存获取指定范围列宽 @@ -1422,28 +1425,38 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI { * @returns {Rect} */ getCellsRect(startCol: number, startRow: number, endCol: number, endRow: number): Rect { - const isFrozenStartCell = this.isFrozenCell(startCol, startRow); - const isFrozenEndCell = this.isFrozenCell(endCol, endRow); - - const absoluteLeft = this.getColsWidth(0, startCol - 1) || 0; // startCol为0时,absoluteLeft计算为Nan + let absoluteLeft = this.getColsWidth(0, startCol - 1) || 0; // startCol为0时,absoluteLeft计算为Nan let width = this.getColsWidth(startCol, endCol); - if (isFrozenStartCell?.col) { - const scrollLeft = this.scrollLeft; - // absoluteLeft += scrollLeft; - if (!isFrozenEndCell?.col) { - width -= scrollLeft; - width = Math.max(width, this.getColsWidth(startCol, this.frozenColCount - 1)); - } + const scrollLeft = this.scrollLeft; + if (this.isLeftFrozenColumn(startCol) && this.isRightFrozenColumn(endCol)) { + width = this.tableNoFrameWidth - (this.getColsWidth(startCol + 1, this.colCount - 1) ?? 0) - absoluteLeft; + } else if (this.isLeftFrozenColumn(startCol) && !this.isLeftFrozenColumn(endCol)) { + width = Math.max(width - scrollLeft, this.getColsWidth(startCol, this.frozenColCount - 1)); + } else if (!this.isRightFrozenColumn(startCol) && this.isRightFrozenColumn(endCol)) { + absoluteLeft = Math.min(absoluteLeft - scrollLeft, this.tableNoFrameWidth - this.getRightFrozenColsWidth()); + width = this.tableNoFrameWidth - (this.getColsWidth(startCol + 1, this.colCount - 1) ?? 0) - absoluteLeft; + } else if (this.isRightFrozenColumn(startCol)) { + absoluteLeft = this.tableNoFrameWidth - (this.getColsWidth(startCol, this.colCount - 1) ?? 0); + } else { + // 范围全部在整体一块区域 如都在右侧冻结区域 都可以走这块逻辑 + // do nothing } - const absoluteTop = this.getRowsHeight(0, startRow - 1); + + let absoluteTop = this.getRowsHeight(0, startRow - 1); let height = this.getRowsHeight(startRow, endRow); - if (isFrozenStartCell?.row) { - const scrollTop = this.scrollTop; - // absoluteTop += scrollTop; - if (!isFrozenEndCell?.row) { - height -= scrollTop; - height = Math.max(height, this.getRowsHeight(startRow, this.frozenRowCount - 1)); - } + const scrollTop = this.scrollTop; + if (this.isTopFrozenRow(startRow) && this.isBottomFrozenRow(endRow)) { + height = this.tableNoFrameHeight - (this.getRowsHeight(startRow + 1, this.rowCount - 1) ?? 0) - absoluteTop; + } else if (this.isTopFrozenRow(startRow) && !this.isTopFrozenRow(endRow)) { + height = Math.max(height - scrollTop, this.getRowsHeight(startRow, this.frozenRowCount - 1)); + } else if (!this.isBottomFrozenRow(startRow) && this.isBottomFrozenRow(endRow)) { + absoluteTop = Math.min(absoluteTop - scrollTop, this.tableNoFrameHeight - this.getBottomFrozenRowsHeight()); + height = this.tableNoFrameHeight - (this.getRowsHeight(startRow + 1, this.rowCount - 1) ?? 0) - absoluteTop; + } else if (this.isBottomFrozenRow(startRow)) { + absoluteTop = this.tableNoFrameHeight - (this.getRowsHeight(startRow, this.rowCount - 1) ?? 0); + } else { + // 范围全部在整体一块区域 如都在右侧冻结区域 都可以走这块逻辑 + // do nothing } return new Rect(Math.round(absoluteLeft), Math.round(absoluteTop), Math.round(width), Math.round(height)); } From df0eef7034e39766c10028d4a000c96b5c224642 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Wed, 7 Feb 2024 17:29:38 +0800 Subject: [PATCH 115/115] docs: update changlog of rush --- .../1091-bug-selectBoderExtend_2024-02-07-09-29.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vtable/1091-bug-selectBoderExtend_2024-02-07-09-29.json diff --git a/common/changes/@visactor/vtable/1091-bug-selectBoderExtend_2024-02-07-09-29.json b/common/changes/@visactor/vtable/1091-bug-selectBoderExtend_2024-02-07-09-29.json new file mode 100644 index 000000000..a20dd8c11 --- /dev/null +++ b/common/changes/@visactor/vtable/1091-bug-selectBoderExtend_2024-02-07-09-29.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: edit right frozen cell input position error\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file