@visactor/vtable 0.16.1 → 0.16.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/axis/axis.d.ts +1 -1
- package/cjs/components/axis/axis.js +2 -2
- package/cjs/components/axis/axis.js.map +1 -1
- package/cjs/core/BaseTable.js +1 -1
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/chart-helper/get-axis-config.d.ts +2 -0
- package/cjs/layout/chart-helper/get-axis-config.js +25 -16
- package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/layout/update-width.js +1 -1
- package/cjs/scenegraph/layout/update-width.js.map +1 -1
- package/cjs/scenegraph/refresh-node/update-chart.js +1 -1
- package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/cjs/ts-types/component/axis.d.ts +2 -0
- package/cjs/ts-types/component/axis.js.map +1 -1
- package/dist/vtable.js +32 -26
- package/dist/vtable.min.js +2 -2
- package/es/components/axis/axis.d.ts +1 -1
- package/es/components/axis/axis.js +2 -2
- package/es/components/axis/axis.js.map +1 -1
- package/es/core/BaseTable.js +1 -1
- package/es/core/BaseTable.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/chart-helper/get-axis-config.d.ts +2 -0
- package/es/layout/chart-helper/get-axis-config.js +25 -16
- package/es/layout/chart-helper/get-axis-config.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +1 -1
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/layout/update-width.js +1 -1
- package/es/scenegraph/layout/update-width.js.map +1 -1
- package/es/scenegraph/refresh-node/update-chart.js +1 -1
- package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/es/ts-types/component/axis.d.ts +2 -0
- package/es/ts-types/component/axis.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/layout/update-width.ts"],"names":[],"mappings":";;;AAEA,qDAA2D;AAC3D,wDAAuD;AAGvD,gDAAqD;AAGrD,sEAA0F;AAC1F,oFAAqF;AACrF,gFAAsF;AACtF,kEAAiE;AAEjE,4DAA2D;AAC3D,gDAA4C;AAC5C,sEAAgE;AAChE,8CAAgD;AAChD,gEAAmE;AACnE,6DAA2E;AAC3E,mDAAyD;AACzD,wEAAmE;AAUnE,SAAgB,cAAc,CAAC,KAAiB,EAAE,GAAW,EAAE,KAAa;IAC1E,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,KAAK,EAAE,IAAI,CAAC,CAAC;IAE1E,MAAM,aAAa,GAAG,KAAK,CAAC,KAAK,CAAC,UAAU,KAAK,YAAY,CAAC;IAE9D,MAAM,uBAAuB,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,CAAU,CAAC;IACtE,IAAI,uBAAuB,EAAE;QAC3B,iBAAiB,CAAC,uBAAuB,EAAE,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;KACvF;IAED,MAAM,qBAAqB,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,CAAU,CAAC;IAC9D,IAAI,qBAAqB,EAAE;QACzB,iBAAiB,CAAC,qBAAqB,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;KACnF;IAED,MAAM,gBAAgB,GAAG,KAAK,CAAC,6BAA6B,CAAC,GAAG,CAAC,CAAC;IAElE,IAAI,gBAAgB,EAAE;QACpB,iBAAiB,CAAC,gBAAgB,EAAE,KAAK,EAAE,aAAa,E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SAAS,CAAC;QAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,sBAAsB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACpD,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE;YACzB,OAAO;SACR;QAED,IAAA,sCAAsB,EACpB,KAAK,EACL,IAAI,EACJ,GAAG,EACH,GAAG,EACH,UAAU,EACV,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAClC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAC/B,CAAC;KACH;AACH,CAAC","file":"update-width.js","sourcesContent":["import type { IGraphic } from '@visactor/vrender';\nimport type { ProgressBarStyle } from '../../body-helper/style/ProgressBarStyle';\nimport { CartesianAxis } from '../../components/axis/axis';\nimport { getStyleTheme } from '../../core/tableHelper';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { IProgressbarColumnBodyDefine } from '../../ts-types/list-table/define/progressbar-define';\nimport { dealWithCustom } from '../component/custom';\nimport type { Group } from '../graphic/group';\nimport type { Icon } from '../graphic/icon';\nimport { updateImageCellContentWhileResize } from '../group-creater/cell-type/image-cell';\nimport { createProgressBarCell } from '../group-creater/cell-type/progress-bar-cell';\nimport { createSparkLineCellGroup } from '../group-creater/cell-type/spark-line-cell';\nimport { resizeCellGroup } from '../group-creater/column-helper';\nimport type { Scenegraph } from '../scenegraph';\nimport { getCellMergeInfo } from '../utils/get-cell-merge';\nimport { getProp } from '../utils/get-prop';\nimport { isMergeCellGroup } from '../utils/is-merge-cell-group';\nimport { getQuadProps } from '../utils/padding';\nimport { updateCellContentWidth } from '../utils/text-icon-layout';\nimport { computeRowHeight, computeRowsHeight } from './compute-row-height';\nimport { updateCellHeightForRow } from './update-height';\nimport { getHierarchyOffset } from '../utils/get-hierarchy-offset';\n// import { updateAutoRowHeight } from './auto-height';\n\n/**\n * @description: 更新指定列列宽,在拖拽调整列宽中使用\n * @param {Scenegraph} scene\n * @param {number} col\n * @param {number} detaX\n * @return {*}\n */\nexport function updateColWidth(scene: Scenegraph, col: number, detaX: number) {\n scene.table._setColWidth(col, scene.table.getColWidth(col) + detaX, true);\n\n const autoRowHeight = scene.table.heightMode === 'autoHeight';\n // deal with corner header or column header\n const colOrCornerHeaderColumn = scene.getColGroup(col, true) as Group;\n if (colOrCornerHeaderColumn) {\n updateColunmWidth(colOrCornerHeaderColumn, detaX, autoRowHeight, 'col-corner', scene);\n }\n // deal with row header or body or right frozen cells\n const rowHeaderOrBodyColumn = scene.getColGroup(col) as Group;\n if (rowHeaderOrBodyColumn) {\n updateColunmWidth(rowHeaderOrBodyColumn, detaX, autoRowHeight, 'row-body', scene);\n }\n\n const leftBottomColumn = scene.getColGroupInLeftBottomCorner(col);\n // deal with left bottom frozen cells\n if (leftBottomColumn) {\n updateColunmWidth(leftBottomColumn, detaX, autoRowHeight, 'left-bottom', scene);\n }\n // deal with bottom frozen cells\n const bottomColumn = scene.getColGroupInBottom(col);\n if (bottomColumn) {\n updateColunmWidth(bottomColumn, detaX, autoRowHeight, 'bottom', scene);\n }\n // deal with right bottom frozen cells\n const rightTopColumn = scene.getColGroupInRightTopCorner(col);\n if (rightTopColumn) {\n updateColunmWidth(rightTopColumn, detaX, autoRowHeight, 'right-top', scene);\n }\n // deal with right bottom frozen cells\n const rightBottomColumn = scene.getColGroupInRightBottomCorner(col);\n if (rightBottomColumn) {\n updateColunmWidth(rightBottomColumn, detaX, autoRowHeight, 'right-bottom', scene);\n }\n\n // 更新剩余列位置\n if (col < scene.frozenColCount) {\n scene.cornerHeaderGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n scene.rowHeaderGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n } else {\n scene.colHeaderGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n scene.bodyGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n }\n\n if (leftBottomColumn) {\n scene.leftBottomCornerGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n }\n if (bottomColumn) {\n scene.bottomFrozenGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n }\n if (rightBottomColumn) {\n scene.rightBottomCornerGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n }\n\n // scene.table.setColWidth(col, rowHeaderOrBodyColumn.attribute.width, true);\n}\n\nfunction updateColunmWidth(\n columnGroup: Group,\n detaX: number,\n autoRowHeight: boolean,\n mode: 'col-corner' | 'row-body' | 'bottom' | 'left-bottom' | 'right-top' | 'right-bottom',\n scene: Scenegraph\n) {\n let needRerangeRow = false;\n // const colOrCornerHeaderColumn = scene.getColGroup(col, true) as Group;\n const oldColumnWidth = columnGroup?.attribute.width ?? 0;\n columnGroup?.setAttribute('width', oldColumnWidth + detaX);\n // 更新单元格宽度\n columnGroup?.forEachChildren((cell: Group, index: number) => {\n const isHeightChange = updateCellWidth(\n scene,\n cell,\n cell.col,\n cell.row,\n oldColumnWidth,\n oldColumnWidth + detaX,\n detaX,\n mode === 'row-body' ? cell.col < scene.table.rowHeaderLevelCount : true,\n autoRowHeight\n );\n if (isHeightChange) {\n const mergeInfo = getCellMergeInfo(scene.table, cell.col, cell.row);\n if (mergeInfo && mergeInfo.end.row - mergeInfo.start.row) {\n for (let row = mergeInfo.start.row; row <= mergeInfo.end.row; row++) {\n resetRowHeight(scene, row);\n }\n } else {\n resetRowHeight(scene, cell.row);\n }\n needRerangeRow = true;\n }\n });\n\n if (needRerangeRow) {\n let newTotalHeight = 0;\n let colGroup;\n let oldContainerHeight;\n let row;\n for (let col = 0; col < scene.table.colCount; col++) {\n // const colGroup = scene.getColGroup(col, true);\n if (mode === 'col-corner') {\n row = 0;\n colGroup = scene.getColGroup(col, true);\n oldContainerHeight = scene.colHeaderGroup.attribute.height ?? 0;\n } else if (mode === 'row-body') {\n row = scene.table.frozenRowCount;\n colGroup = scene.getColGroup(col, false);\n oldContainerHeight = scene.bodyGroup.attribute.height ?? 0;\n } else if (mode === 'bottom') {\n row = scene.table.rowCount - scene.table.bottomFrozenRowCount;\n colGroup = scene.getColGroupInBottom(col);\n oldContainerHeight = scene.bottomFrozenGroup.attribute.height ?? 0;\n } else if (mode === 'left-bottom') {\n row = scene.table.rowCount - scene.table.bottomFrozenRowCount;\n colGroup = scene.getColGroupInLeftBottomCorner(col);\n oldContainerHeight = scene.leftBottomCornerGroup.attribute.height ?? 0;\n } else if (mode === 'right-top') {\n row = 0;\n colGroup = scene.getColGroupInRightTopCorner(col);\n oldContainerHeight = scene.rightTopCornerGroup.attribute.height ?? 0;\n } else if (mode === 'right-bottom') {\n row = scene.table.rowCount - scene.table.bottomFrozenRowCount;\n colGroup = scene.getColGroupInRightBottomCorner(col);\n oldContainerHeight = scene.rightBottomCornerGroup.attribute.height ?? 0;\n }\n if (!colGroup) {\n continue;\n }\n let y = 0;\n colGroup.forEachChildren((cellGroup: Group) => {\n // if (cellGroup.role !== 'cell') {\n // cellGroup.setAttribute('y', y);\n // y += scene.table.getRowHeight(cellGroup.row) ?? 0;\n // return;\n // }\n // y += cellGroup.attribute.height ?? 0;\n cellGroup.setAttribute('y', y);\n y += scene.table.getRowHeight(cellGroup.row) ?? 0;\n });\n newTotalHeight = y;\n }\n scene.updateContainerHeight(row, newTotalHeight - oldContainerHeight);\n }\n}\n\n/**\n * @description: 更新单个单元格宽度\n * @return {*}\n */\nfunction updateCellWidth(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n oldWidth: number, // old width, not dist\n distWidth: number, // old width, not dist\n detaX: number,\n isHeader: boolean,\n // autoColWidth: boolean,\n autoRowHeight: boolean\n): boolean {\n if (cell.attribute.width === distWidth) {\n return false;\n }\n\n cell.setAttribute('width', distWidth);\n // const mergeInfo = getCellMergeInfo(scene.table, col, row);\n // if (mergeInfo && mergeInfo.start.row !== row) {\n // return false;\n // }\n const cellGroup = cell;\n // const distWidth = width + detaX;\n\n if (!cellGroup) {\n // 合并单元格非主单元格,不处理\n return false;\n }\n\n // 更新单元格布局\n const type = scene.table.isHeader(col, row)\n ? scene.table._getHeaderLayoutMap(col, row).headerType\n : scene.table.getBodyColumnType(col, row);\n let isHeightChange = false;\n if (type === 'progressbar') {\n // 目前先采用重新生成节点的方案\n const columnDefine = scene.table.getBodyColumnDefine(col, row) as IProgressbarColumnBodyDefine;\n const style = scene.table._getCellStyle(col, row) as ProgressBarStyle;\n const value = scene.table.getCellValue(col, row);\n const dataValue = scene.table.getCellOriginValue(col, row);\n const padding = getQuadProps(getProp('padding', style, col, row, scene.table));\n\n const newBarCell = createProgressBarCell(\n columnDefine,\n style,\n cellGroup.attribute.width,\n // cellGroup.attribute.height,\n value,\n dataValue,\n col,\n row,\n padding,\n scene.table\n );\n\n const oldBarCell = cellGroup.getChildByName('progress-bar') as Group;\n // cell.replaceChild(newBarCell, oldBarCell);\n cellGroup.insertBefore(newBarCell, oldBarCell);\n cellGroup.removeChild(oldBarCell);\n oldBarCell.removeAllChild();\n oldBarCell.release();\n } else if (type === 'sparkline') {\n // 目前先采用重新生成节点的方案\n cellGroup.removeAllChild();\n const headerStyle = scene.table._getCellStyle(col, row);\n const padding = getQuadProps(getProp('padding', headerStyle, col, row, scene.table));\n createSparkLineCellGroup(\n cellGroup,\n cellGroup.parent,\n cellGroup.attribute.x,\n cellGroup.attribute.y,\n col,\n row,\n cellGroup.attribute.width,\n cellGroup.attribute.height,\n padding,\n scene.table,\n getStyleTheme(headerStyle, scene.table, col, row, getProp).theme\n );\n } else if (type === 'image' || type === 'video') {\n // // 只更新背景边框\n // const rect = cell.firstChild as Rect;\n // rect.setAttribute('width', cell.attribute.width);\n updateImageCellContentWhileResize(cellGroup, col, row, scene.table);\n } else if (cellGroup.firstChild?.name === 'axis') {\n // recreate axis component\n const axisConfig = scene.table.internalProps.layoutMap.getAxisConfigInPivotChart(col, row);\n const cellStyle = scene.table._getCellStyle(col, row);\n const padding = getQuadProps(getProp('padding', cellStyle, col, row, scene.table));\n if (axisConfig) {\n const spec = scene.table.internalProps.layoutMap.getRawChartSpec(col, row);\n const axis = new CartesianAxis(\n axisConfig,\n cellGroup.attribute.width,\n cellGroup.attribute.height,\n padding,\n spec?.theme,\n scene.table\n );\n cellGroup.clear();\n cellGroup.appendChild(axis.component);\n axis.overlap();\n }\n } else if (cell.firstChild?.name === 'axis') {\n (cell.firstChild as any)?.originAxis.resize(cell.attribute.width, cell.attribute.height);\n } else {\n let renderDefault = true;\n const customContainer = cell.getChildByName('custom-container') as Group;\n if (customContainer) {\n let customElementsGroup;\n customContainer.removeAllChild();\n cell.removeChild(customContainer);\n\n let customRender;\n let customLayout;\n const cellType = scene.table.getCellLocation(col, row);\n if (cellType !== 'body') {\n const define = scene.table.getHeaderDefine(col, row);\n customRender = define?.headerCustomRender;\n customLayout = define?.headerCustomLayout;\n } else {\n const define = scene.table.getBodyColumnDefine(col, row);\n customRender = define?.customRender || scene.table.customRender;\n customLayout = define?.customLayout;\n }\n\n if (customLayout || customRender) {\n // const { autoRowHeight } = table.internalProps;\n const customResult = dealWithCustom(\n customLayout,\n customRender,\n col,\n row,\n cellGroup.attribute.width,\n cellGroup.attribute.height,\n false,\n scene.table.heightMode === 'autoHeight',\n scene.table\n );\n customElementsGroup = customResult.elementsGroup;\n renderDefault = customResult.renderDefault;\n isHeightChange = true;\n }\n\n if (cell.childrenCount > 0) {\n cell.insertBefore(customElementsGroup, cell.firstChild);\n } else {\n cell.appendChild(customElementsGroup);\n }\n }\n\n if (renderDefault) {\n // 处理文字\n const style = scene.table._getCellStyle(col, row);\n isHeightChange = updateMergeCellContentWidth(\n cellGroup,\n distWidth,\n detaX,\n autoRowHeight,\n getQuadProps(style.padding as number),\n style.textAlign,\n style.textBaseline,\n scene.table\n );\n }\n }\n\n return autoRowHeight ? isHeightChange : false;\n}\n\nfunction updateMergeCellContentWidth(\n cellGroup: Group,\n distWidth: number,\n detaX: number,\n autoRowHeight: boolean,\n padding: [number, number, number, number],\n textAlign: CanvasTextAlign,\n textBaseline: CanvasTextBaseline,\n table: BaseTableAPI\n) {\n if (isMergeCellGroup(cellGroup)) {\n distWidth = 0;\n let isHeightChange = false;\n for (let col = cellGroup.mergeStartCol; col <= cellGroup.mergeEndCol; col++) {\n distWidth += table.getColWidth(col);\n }\n let cellHeight = 0;\n for (let row = cellGroup.mergeStartRow; row <= cellGroup.mergeEndRow; row++) {\n cellHeight += table.getRowHeight(row);\n }\n\n for (let col = cellGroup.mergeStartCol; col <= cellGroup.mergeEndCol; col++) {\n for (let row = cellGroup.mergeStartRow; row <= cellGroup.mergeEndRow; row++) {\n const singleCellGroup = table.scenegraph.getCell(col, row);\n singleCellGroup.forEachChildren((child: IGraphic) => {\n child.setAttributes({\n dx: 0,\n dy: 0\n });\n });\n const changed = updateCellContentWidth(\n singleCellGroup,\n distWidth,\n cellHeight,\n detaX,\n autoRowHeight,\n padding,\n textAlign,\n textBaseline,\n table.scenegraph\n );\n\n // reset hierarchy offset\n const hierarchyOffset = getHierarchyOffset(singleCellGroup.col, singleCellGroup.row, table);\n if (hierarchyOffset) {\n const text = singleCellGroup.getChildByName('text');\n const icon = singleCellGroup.getChildByName('expand') || singleCellGroup.getChildByName('collapse');\n // icon-left deal with hierarchy offset, no need add to text dx\n if (icon?.role !== 'icon-left' && text) {\n text.setAttribute('dx', hierarchyOffset);\n }\n }\n\n const rangeHeight = table.getRowHeight(row);\n const rangeWidth = table.getColWidth(col);\n\n // const { width: contentWidth } = cellGroup.attribute;\n singleCellGroup.contentWidth = distWidth;\n\n resizeCellGroup(\n singleCellGroup,\n rangeWidth,\n rangeHeight,\n {\n start: {\n col: cellGroup.mergeStartCol,\n row: cellGroup.mergeStartRow\n },\n end: {\n col: cellGroup.mergeEndCol,\n row: cellGroup.mergeEndRow\n }\n },\n table\n );\n isHeightChange = isHeightChange || changed;\n }\n }\n return isHeightChange;\n }\n return updateCellContentWidth(\n cellGroup,\n distWidth,\n table.getRowHeight(cellGroup.row),\n detaX,\n autoRowHeight,\n padding,\n textAlign,\n textBaseline,\n table.scenegraph\n );\n}\n\n/**\n * @description: 重置指定行行高\n * @param {Scenegraph} scene\n * @param {number} row\n * @return {*}\n */\nfunction resetRowHeight(scene: Scenegraph, row: number) {\n // 获取高度\n const maxHeight = computeRowHeight(row, 0, scene.table.colCount - 1, scene.table);\n // 更新table行高存储\n scene.table._setRowHeight(row, maxHeight, true);\n\n // 更新高度\n for (let col = 0; col < scene.table.colCount; col++) {\n const distHeight = maxHeight;\n const cell = scene.highPerformanceGetCell(col, row);\n if (cell.role === 'empty') {\n return;\n }\n\n updateCellHeightForRow(\n scene,\n cell,\n col,\n row,\n distHeight,\n distHeight - cell.attribute.height,\n scene.table.isHeader(col, row)\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/layout/update-width.ts"],"names":[],"mappings":";;;AAEA,qDAA2D;AAC3D,wDAAuD;AAGvD,gDAAqD;AAGrD,sEAA0F;AAC1F,oFAAqF;AACrF,gFAAsF;AACtF,kEAAiE;AAEjE,4DAA2D;AAC3D,gDAA4C;AAC5C,sEAAgE;AAChE,8CAAgD;AAChD,gEAAmE;AACnE,6DAA2E;AAC3E,mDAAyD;AACzD,wEAAmE;AAUnE,SAAgB,cAAc,CAAC,KAAiB,EAAE,GAAW,EAAE,KAAa;IAC1E,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,KAAK,EAAE,IAAI,CAAC,CAAC;IAE1E,MAAM,aAAa,GAAG,KAAK,CAAC,KA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;AAQD,SAAS,cAAc,CAAC,KAAiB,EAAE,GAAW;IAEpD,MAAM,SAAS,GAAG,IAAA,qCAAgB,EAAC,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IAElF,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAGhD,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE;QACnD,MAAM,UAAU,GAAG,SAAS,CAAC;QAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,sBAAsB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACpD,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE;YACzB,OAAO;SACR;QAED,IAAA,sCAAsB,EACpB,KAAK,EACL,IAAI,EACJ,GAAG,EACH,GAAG,EACH,UAAU,EACV,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAClC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAC/B,CAAC;KACH;AACH,CAAC","file":"update-width.js","sourcesContent":["import type { IGraphic } from '@visactor/vrender';\nimport type { ProgressBarStyle } from '../../body-helper/style/ProgressBarStyle';\nimport { CartesianAxis } from '../../components/axis/axis';\nimport { getStyleTheme } from '../../core/tableHelper';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { IProgressbarColumnBodyDefine } from '../../ts-types/list-table/define/progressbar-define';\nimport { dealWithCustom } from '../component/custom';\nimport type { Group } from '../graphic/group';\nimport type { Icon } from '../graphic/icon';\nimport { updateImageCellContentWhileResize } from '../group-creater/cell-type/image-cell';\nimport { createProgressBarCell } from '../group-creater/cell-type/progress-bar-cell';\nimport { createSparkLineCellGroup } from '../group-creater/cell-type/spark-line-cell';\nimport { resizeCellGroup } from '../group-creater/column-helper';\nimport type { Scenegraph } from '../scenegraph';\nimport { getCellMergeInfo } from '../utils/get-cell-merge';\nimport { getProp } from '../utils/get-prop';\nimport { isMergeCellGroup } from '../utils/is-merge-cell-group';\nimport { getQuadProps } from '../utils/padding';\nimport { updateCellContentWidth } from '../utils/text-icon-layout';\nimport { computeRowHeight, computeRowsHeight } from './compute-row-height';\nimport { updateCellHeightForRow } from './update-height';\nimport { getHierarchyOffset } from '../utils/get-hierarchy-offset';\n// import { updateAutoRowHeight } from './auto-height';\n\n/**\n * @description: 更新指定列列宽,在拖拽调整列宽中使用\n * @param {Scenegraph} scene\n * @param {number} col\n * @param {number} detaX\n * @return {*}\n */\nexport function updateColWidth(scene: Scenegraph, col: number, detaX: number) {\n scene.table._setColWidth(col, scene.table.getColWidth(col) + detaX, true);\n\n const autoRowHeight = scene.table.heightMode === 'autoHeight';\n // deal with corner header or column header\n const colOrCornerHeaderColumn = scene.getColGroup(col, true) as Group;\n if (colOrCornerHeaderColumn) {\n updateColunmWidth(colOrCornerHeaderColumn, detaX, autoRowHeight, 'col-corner', scene);\n }\n // deal with row header or body or right frozen cells\n const rowHeaderOrBodyColumn = scene.getColGroup(col) as Group;\n if (rowHeaderOrBodyColumn) {\n updateColunmWidth(rowHeaderOrBodyColumn, detaX, autoRowHeight, 'row-body', scene);\n }\n\n const leftBottomColumn = scene.getColGroupInLeftBottomCorner(col);\n // deal with left bottom frozen cells\n if (leftBottomColumn) {\n updateColunmWidth(leftBottomColumn, detaX, autoRowHeight, 'left-bottom', scene);\n }\n // deal with bottom frozen cells\n const bottomColumn = scene.getColGroupInBottom(col);\n if (bottomColumn) {\n updateColunmWidth(bottomColumn, detaX, autoRowHeight, 'bottom', scene);\n }\n // deal with right bottom frozen cells\n const rightTopColumn = scene.getColGroupInRightTopCorner(col);\n if (rightTopColumn) {\n updateColunmWidth(rightTopColumn, detaX, autoRowHeight, 'right-top', scene);\n }\n // deal with right bottom frozen cells\n const rightBottomColumn = scene.getColGroupInRightBottomCorner(col);\n if (rightBottomColumn) {\n updateColunmWidth(rightBottomColumn, detaX, autoRowHeight, 'right-bottom', scene);\n }\n\n // 更新剩余列位置\n if (col < scene.frozenColCount) {\n scene.cornerHeaderGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n scene.rowHeaderGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n } else {\n scene.colHeaderGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n scene.bodyGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n }\n\n if (leftBottomColumn) {\n scene.leftBottomCornerGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n }\n if (bottomColumn) {\n scene.bottomFrozenGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n }\n if (rightBottomColumn) {\n scene.rightBottomCornerGroup.forEachChildrenSkipChild((column: Group, index) => {\n if (column.col > col) {\n column.setAttribute('x', column.attribute.x + detaX);\n }\n });\n }\n\n // scene.table.setColWidth(col, rowHeaderOrBodyColumn.attribute.width, true);\n}\n\nfunction updateColunmWidth(\n columnGroup: Group,\n detaX: number,\n autoRowHeight: boolean,\n mode: 'col-corner' | 'row-body' | 'bottom' | 'left-bottom' | 'right-top' | 'right-bottom',\n scene: Scenegraph\n) {\n let needRerangeRow = false;\n // const colOrCornerHeaderColumn = scene.getColGroup(col, true) as Group;\n const oldColumnWidth = columnGroup?.attribute.width ?? 0;\n columnGroup?.setAttribute('width', oldColumnWidth + detaX);\n // 更新单元格宽度\n columnGroup?.forEachChildren((cell: Group, index: number) => {\n const isHeightChange = updateCellWidth(\n scene,\n cell,\n cell.col,\n cell.row,\n oldColumnWidth,\n oldColumnWidth + detaX,\n detaX,\n mode === 'row-body' ? cell.col < scene.table.rowHeaderLevelCount : true,\n autoRowHeight\n );\n if (isHeightChange) {\n const mergeInfo = getCellMergeInfo(scene.table, cell.col, cell.row);\n if (mergeInfo && mergeInfo.end.row - mergeInfo.start.row) {\n for (let row = mergeInfo.start.row; row <= mergeInfo.end.row; row++) {\n resetRowHeight(scene, row);\n }\n } else {\n resetRowHeight(scene, cell.row);\n }\n needRerangeRow = true;\n }\n });\n\n if (needRerangeRow) {\n let newTotalHeight = 0;\n let colGroup;\n let oldContainerHeight;\n let row;\n for (let col = 0; col < scene.table.colCount; col++) {\n // const colGroup = scene.getColGroup(col, true);\n if (mode === 'col-corner') {\n row = 0;\n colGroup = scene.getColGroup(col, true);\n oldContainerHeight = scene.colHeaderGroup.attribute.height ?? 0;\n } else if (mode === 'row-body') {\n row = scene.table.frozenRowCount;\n colGroup = scene.getColGroup(col, false);\n oldContainerHeight = scene.bodyGroup.attribute.height ?? 0;\n } else if (mode === 'bottom') {\n row = scene.table.rowCount - scene.table.bottomFrozenRowCount;\n colGroup = scene.getColGroupInBottom(col);\n oldContainerHeight = scene.bottomFrozenGroup.attribute.height ?? 0;\n } else if (mode === 'left-bottom') {\n row = scene.table.rowCount - scene.table.bottomFrozenRowCount;\n colGroup = scene.getColGroupInLeftBottomCorner(col);\n oldContainerHeight = scene.leftBottomCornerGroup.attribute.height ?? 0;\n } else if (mode === 'right-top') {\n row = 0;\n colGroup = scene.getColGroupInRightTopCorner(col);\n oldContainerHeight = scene.rightTopCornerGroup.attribute.height ?? 0;\n } else if (mode === 'right-bottom') {\n row = scene.table.rowCount - scene.table.bottomFrozenRowCount;\n colGroup = scene.getColGroupInRightBottomCorner(col);\n oldContainerHeight = scene.rightBottomCornerGroup.attribute.height ?? 0;\n }\n if (!colGroup) {\n continue;\n }\n let y = 0;\n colGroup.forEachChildren((cellGroup: Group) => {\n // if (cellGroup.role !== 'cell') {\n // cellGroup.setAttribute('y', y);\n // y += scene.table.getRowHeight(cellGroup.row) ?? 0;\n // return;\n // }\n // y += cellGroup.attribute.height ?? 0;\n cellGroup.setAttribute('y', y);\n y += scene.table.getRowHeight(cellGroup.row) ?? 0;\n });\n newTotalHeight = y;\n }\n scene.updateContainerHeight(row, newTotalHeight - oldContainerHeight);\n }\n}\n\n/**\n * @description: 更新单个单元格宽度\n * @return {*}\n */\nfunction updateCellWidth(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n oldWidth: number, // old width, not dist\n distWidth: number, // old width, not dist\n detaX: number,\n isHeader: boolean,\n // autoColWidth: boolean,\n autoRowHeight: boolean\n): boolean {\n if (cell.attribute.width === distWidth) {\n return false;\n }\n\n cell.setAttribute('width', distWidth);\n // const mergeInfo = getCellMergeInfo(scene.table, col, row);\n // if (mergeInfo && mergeInfo.start.row !== row) {\n // return false;\n // }\n const cellGroup = cell;\n // const distWidth = width + detaX;\n\n if (!cellGroup) {\n // 合并单元格非主单元格,不处理\n return false;\n }\n\n // 更新单元格布局\n const type = scene.table.isHeader(col, row)\n ? scene.table._getHeaderLayoutMap(col, row).headerType\n : scene.table.getBodyColumnType(col, row);\n let isHeightChange = false;\n if (type === 'progressbar') {\n // 目前先采用重新生成节点的方案\n const columnDefine = scene.table.getBodyColumnDefine(col, row) as IProgressbarColumnBodyDefine;\n const style = scene.table._getCellStyle(col, row) as ProgressBarStyle;\n const value = scene.table.getCellValue(col, row);\n const dataValue = scene.table.getCellOriginValue(col, row);\n const padding = getQuadProps(getProp('padding', style, col, row, scene.table));\n\n const newBarCell = createProgressBarCell(\n columnDefine,\n style,\n cellGroup.attribute.width,\n // cellGroup.attribute.height,\n value,\n dataValue,\n col,\n row,\n padding,\n scene.table\n );\n\n const oldBarCell = cellGroup.getChildByName('progress-bar') as Group;\n // cell.replaceChild(newBarCell, oldBarCell);\n cellGroup.insertBefore(newBarCell, oldBarCell);\n cellGroup.removeChild(oldBarCell);\n oldBarCell.removeAllChild();\n oldBarCell.release();\n } else if (type === 'sparkline') {\n // 目前先采用重新生成节点的方案\n cellGroup.removeAllChild();\n const headerStyle = scene.table._getCellStyle(col, row);\n const padding = getQuadProps(getProp('padding', headerStyle, col, row, scene.table));\n createSparkLineCellGroup(\n cellGroup,\n cellGroup.parent,\n cellGroup.attribute.x,\n cellGroup.attribute.y,\n col,\n row,\n cellGroup.attribute.width,\n cellGroup.attribute.height,\n padding,\n scene.table,\n getStyleTheme(headerStyle, scene.table, col, row, getProp).theme\n );\n } else if (type === 'image' || type === 'video') {\n // // 只更新背景边框\n // const rect = cell.firstChild as Rect;\n // rect.setAttribute('width', cell.attribute.width);\n updateImageCellContentWhileResize(cellGroup, col, row, scene.table);\n } else if (cellGroup.firstChild?.name === 'axis') {\n // recreate axis component\n const axisConfig = scene.table.internalProps.layoutMap.getAxisConfigInPivotChart(col, row);\n const cellStyle = scene.table._getCellStyle(col, row);\n const padding = getQuadProps(getProp('padding', cellStyle, col, row, scene.table));\n if (axisConfig) {\n const axis = new CartesianAxis(\n axisConfig,\n cellGroup.attribute.width,\n cellGroup.attribute.height,\n padding,\n scene.table\n );\n cellGroup.clear();\n cellGroup.appendChild(axis.component);\n axis.overlap();\n }\n } else if (cell.firstChild?.name === 'axis') {\n (cell.firstChild as any)?.originAxis.resize(cell.attribute.width, cell.attribute.height);\n } else {\n let renderDefault = true;\n const customContainer = cell.getChildByName('custom-container') as Group;\n if (customContainer) {\n let customElementsGroup;\n customContainer.removeAllChild();\n cell.removeChild(customContainer);\n\n let customRender;\n let customLayout;\n const cellType = scene.table.getCellLocation(col, row);\n if (cellType !== 'body') {\n const define = scene.table.getHeaderDefine(col, row);\n customRender = define?.headerCustomRender;\n customLayout = define?.headerCustomLayout;\n } else {\n const define = scene.table.getBodyColumnDefine(col, row);\n customRender = define?.customRender || scene.table.customRender;\n customLayout = define?.customLayout;\n }\n\n if (customLayout || customRender) {\n // const { autoRowHeight } = table.internalProps;\n const customResult = dealWithCustom(\n customLayout,\n customRender,\n col,\n row,\n cellGroup.attribute.width,\n cellGroup.attribute.height,\n false,\n scene.table.heightMode === 'autoHeight',\n scene.table\n );\n customElementsGroup = customResult.elementsGroup;\n renderDefault = customResult.renderDefault;\n isHeightChange = true;\n }\n\n if (cell.childrenCount > 0) {\n cell.insertBefore(customElementsGroup, cell.firstChild);\n } else {\n cell.appendChild(customElementsGroup);\n }\n }\n\n if (renderDefault) {\n // 处理文字\n const style = scene.table._getCellStyle(col, row);\n isHeightChange = updateMergeCellContentWidth(\n cellGroup,\n distWidth,\n detaX,\n autoRowHeight,\n getQuadProps(style.padding as number),\n style.textAlign,\n style.textBaseline,\n scene.table\n );\n }\n }\n\n return autoRowHeight ? isHeightChange : false;\n}\n\nfunction updateMergeCellContentWidth(\n cellGroup: Group,\n distWidth: number,\n detaX: number,\n autoRowHeight: boolean,\n padding: [number, number, number, number],\n textAlign: CanvasTextAlign,\n textBaseline: CanvasTextBaseline,\n table: BaseTableAPI\n) {\n if (isMergeCellGroup(cellGroup)) {\n distWidth = 0;\n let isHeightChange = false;\n for (let col = cellGroup.mergeStartCol; col <= cellGroup.mergeEndCol; col++) {\n distWidth += table.getColWidth(col);\n }\n let cellHeight = 0;\n for (let row = cellGroup.mergeStartRow; row <= cellGroup.mergeEndRow; row++) {\n cellHeight += table.getRowHeight(row);\n }\n\n for (let col = cellGroup.mergeStartCol; col <= cellGroup.mergeEndCol; col++) {\n for (let row = cellGroup.mergeStartRow; row <= cellGroup.mergeEndRow; row++) {\n const singleCellGroup = table.scenegraph.getCell(col, row);\n singleCellGroup.forEachChildren((child: IGraphic) => {\n child.setAttributes({\n dx: 0,\n dy: 0\n });\n });\n const changed = updateCellContentWidth(\n singleCellGroup,\n distWidth,\n cellHeight,\n detaX,\n autoRowHeight,\n padding,\n textAlign,\n textBaseline,\n table.scenegraph\n );\n\n // reset hierarchy offset\n const hierarchyOffset = getHierarchyOffset(singleCellGroup.col, singleCellGroup.row, table);\n if (hierarchyOffset) {\n const text = singleCellGroup.getChildByName('text');\n const icon = singleCellGroup.getChildByName('expand') || singleCellGroup.getChildByName('collapse');\n // icon-left deal with hierarchy offset, no need add to text dx\n if (icon?.role !== 'icon-left' && text) {\n text.setAttribute('dx', hierarchyOffset);\n }\n }\n\n const rangeHeight = table.getRowHeight(row);\n const rangeWidth = table.getColWidth(col);\n\n // const { width: contentWidth } = cellGroup.attribute;\n singleCellGroup.contentWidth = distWidth;\n\n resizeCellGroup(\n singleCellGroup,\n rangeWidth,\n rangeHeight,\n {\n start: {\n col: cellGroup.mergeStartCol,\n row: cellGroup.mergeStartRow\n },\n end: {\n col: cellGroup.mergeEndCol,\n row: cellGroup.mergeEndRow\n }\n },\n table\n );\n isHeightChange = isHeightChange || changed;\n }\n }\n return isHeightChange;\n }\n return updateCellContentWidth(\n cellGroup,\n distWidth,\n table.getRowHeight(cellGroup.row),\n detaX,\n autoRowHeight,\n padding,\n textAlign,\n textBaseline,\n table.scenegraph\n );\n}\n\n/**\n * @description: 重置指定行行高\n * @param {Scenegraph} scene\n * @param {number} row\n * @return {*}\n */\nfunction resetRowHeight(scene: Scenegraph, row: number) {\n // 获取高度\n const maxHeight = computeRowHeight(row, 0, scene.table.colCount - 1, scene.table);\n // 更新table行高存储\n scene.table._setRowHeight(row, maxHeight, true);\n\n // 更新高度\n for (let col = 0; col < scene.table.colCount; col++) {\n const distHeight = maxHeight;\n const cell = scene.highPerformanceGetCell(col, row);\n if (cell.role === 'empty') {\n return;\n }\n\n updateCellHeightForRow(\n scene,\n cell,\n col,\n row,\n distHeight,\n distHeight - cell.attribute.height,\n scene.table.isHeader(col, row)\n );\n }\n}\n"]}
|
|
@@ -85,7 +85,7 @@ function updateTableAxes(containerGroup, table) {
|
|
|
85
85
|
if (cell.forEachChildren((mark => "axis" === mark.name && (isAxisComponent = !0,
|
|
86
86
|
!0))), isAxisComponent) {
|
|
87
87
|
const axisConfig = table.internalProps.layoutMap.getAxisConfigInPivotChart(cell.col, cell.row), cellStyle = table._getCellStyle(cell.col, cell.row), padding = (0,
|
|
88
|
-
padding_1.getQuadProps)((0, get_prop_1.getProp)("padding", cellStyle, cell.col, cell.row, table)),
|
|
88
|
+
padding_1.getQuadProps)((0, get_prop_1.getProp)("padding", cellStyle, cell.col, cell.row, table)), axis = new axis_1.CartesianAxis(axisConfig, cell.attribute.width, cell.attribute.height, padding, table);
|
|
89
89
|
cell.clear(), cell.appendChild(axis.component), axis.overlap();
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/refresh-node/update-chart.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAE3C,qDAA2D;AAM3D,8CAAgD;AAChD,gDAA4C;AAG5C,SAAgB,eAAe,CAAC,UAAsB,EAAE,GAAW;;IAEjE,KAAK,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnD,MAAM,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAG9C,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,WAAW,EAAE,0CAAE,OAAO,CAAC,CAAC,QAAe,EAAE,EAAE;YACtD,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YACzD,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YAE3D,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAW,EAAE,EAAE;gBACxC,IAAK,IAAY,CAAC,IAAI,KAAK,OAAO,EAAE;oBAoBlC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;oBACxB,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,IAA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AC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;wBAC/F,MAAM,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;wBAC1D,MAAM,OAAO,GAAG,IAAA,sBAAY,EAAC,IAAA,kBAAO,EAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;wBACvF,MAAM,IAAI,GAAG,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;wBAC/E,MAAM,IAAI,GAAG,IAAI,oBAAa,CAC5B,UAAU,EACV,IAAI,CAAC,SAAS,CAAC,KAAK,EACpB,IAAI,CAAC,SAAS,CAAC,MAAM,EACrB,OAAO,EACP,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,EACX,KAAK,CACN,CAAC;wBACF,IAAI,CAAC,KAAK,EAAE,CAAC;wBACb,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;wBACjC,IAAI,CAAC,OAAO,EAAE,CAAC;qBAChB;iBACF;YACH,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC","file":"update-chart.js","sourcesContent":["import { isEqual } from '@visactor/vutils';\nimport type { PivotChart } from '../../PivotChart';\nimport { CartesianAxis } from '../../components/axis/axis';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { Chart } from '../graphic/chart';\nimport type { Group } from '../graphic/group';\nimport type { Scenegraph } from '../scenegraph';\nimport type { PivotHeaderLayoutMap } from '../../layout/pivot-header-layout';\nimport { getQuadProps } from '../utils/padding';\nimport { getProp } from '../utils/get-prop';\n\n/** 供调整列宽后更新chart使用 */\nexport function updateChartSize(scenegraph: Scenegraph, col: number) {\n // 将调整列宽的后面的面也都一起需要调整viewbox。 TODO:columnResizeType支持后需要根据变化的列去调整,范围可能变多或者变少\n for (let c = col; c <= scenegraph.proxy.colEnd; c++) {\n const columnGroup = scenegraph.getColGroup(c);\n // const chartInstance = (columnGroup.attribute as any)?.chartInstance;\n // if (chartInstance) {\n columnGroup?.getChildren()?.forEach((cellNode: Group) => {\n const width = scenegraph.table.getColWidth(cellNode.col);\n const height = scenegraph.table.getRowHeight(cellNode.row);\n\n cellNode.children.forEach((node: Chart) => {\n if ((node as any).type === 'chart') {\n // 调试问题使用\n // if (columnGroup.col === 2) {\n // columnGroup.AABBBounds.width();\n // node.AABBBounds.width();\n // console.log(\n // 'set viewbox y1',\n // Math.ceil(cellNode.globalAABBBounds.y1 + node.attribute.cellPadding[0] + scenegraph.table.scrollTop),\n // node.globalAABBBounds.height()\n // );\n\n // console.log(\n // 'updateChartSize',\n // columnGroup,\n // columnGroup.globalAABBBounds.y1,\n // cellNode.globalAABBBounds.y1,\n // node.globalAABBBounds.y1\n // );\n // }\n\n node.cacheCanvas = null;\n node.setAttribute('width', Math.ceil(width - node.attribute.cellPadding[3] - node.attribute.cellPadding[1]));\n node.setAttribute(\n 'height',\n Math.ceil(height - node.attribute.cellPadding[0] - node.attribute.cellPadding[2])\n );\n\n // node.setAttribute('viewBox', {\n // x1: Math.ceil(cellNode.globalAABBBounds.x1 + node.attribute.cellPadding[3] + scenegraph.table.scrollLeft),\n // x2: Math.ceil(\n // cellNode.globalAABBBounds.x1 + width - node.attribute.cellPadding[1] + scenegraph.table.scrollLeft\n // ),\n // y1: Math.ceil(cellNode.globalAABBBounds.y1 + node.attribute.cellPadding[0] + scenegraph.table.scrollTop),\n // y2: Math.ceil(\n // cellNode.globalAABBBounds.y1 + height - node.attribute.cellPadding[2] + scenegraph.table.scrollTop\n // )\n // });\n }\n });\n });\n // }\n }\n}\n\n/** 清理所有chart节点的 图表缓存图片 */\nexport function clearChartCacheImage(scenegraph: Scenegraph) {\n // 将调整列宽的后面的面也都一起需要调整viewbox。 TODO:columnResizeType支持后需要根据变化的列去调整,范围可能变多或者变少\n for (let c = scenegraph.proxy.colStart; c <= scenegraph.proxy.colEnd; c++) {\n const columnGroup = scenegraph.getColGroup(c);\n columnGroup?.getChildren()?.forEach((cellNode: Group) => {\n cellNode.children.forEach((node: Chart) => {\n if ((node as any).type === 'chart') {\n node.cacheCanvas = null;\n node.addUpdateBoundTag();\n }\n });\n });\n }\n}\n\n/** 更新所有的图表chart节点上缓存attribute中的data数据 */\nexport function updateChartData(scenegraph: Scenegraph) {\n const table = scenegraph.table;\n // 将调整列宽的后面的面也都一起需要调整viewbox。 TODO:columnResizeType支持后需要根据变化的列去调整,范围可能变多或者变少\n for (let c = scenegraph.proxy.colStart; c <= scenegraph.proxy.colEnd; c++) {\n const columnGroup = scenegraph.getColGroup(c);\n columnGroup?.getChildren()?.forEach((cellNode: Group) => {\n const col = cellNode.col;\n const row = cellNode.row;\n cellNode.children.forEach((node: Chart) => {\n if ((node as any).type === 'chart') {\n node.updateData(table.getCellValue(col, row));\n const newAxes = table.internalProps.layoutMap.getChartAxes(col, row);\n node.setAttribute('axes', newAxes);\n const chartSpec = node.attribute.spec;\n chartSpec.axes = newAxes;\n node.setAttribute('spec', chartSpec);\n // node.addUpdateBoundTag();\n }\n });\n });\n }\n\n // update left axes\n updateTableAxes(scenegraph.rowHeaderGroup, scenegraph.table);\n // update top axes\n updateTableAxes(scenegraph.colHeaderGroup, scenegraph.table);\n // update right axes\n updateTableAxes(scenegraph.rightFrozenGroup, scenegraph.table);\n // update bottom axes\n updateTableAxes(scenegraph.bottomFrozenGroup, scenegraph.table);\n}\n/** 组织图表数据状态_selectedDataItemsInChart 更新选中的图表图元状态 */\nexport function updateChartState(scenegraph: Scenegraph, datum: any) {\n const table = scenegraph.table;\n if (table.isPivotChart()) {\n const preSelectItemsCount = (table as PivotChart)._selectedDataItemsInChart.length;\n if ((datum === null || datum?.length === 0 || Object.keys(datum).length === 0) && preSelectItemsCount === 0) {\n //避免无效的更新\n return;\n }\n // (table as PivotChart)._selectedDataItemsInChart = [];\n const newSelectedDataItemsInChart = [];\n if (Array.isArray(datum)) {\n datum.forEach((dataItem: any) => {\n if (dataItem && dataItem.key !== 0 && Object.keys(dataItem).length > 0) {\n //本以为没有点击到图元上 datum为空 发现是{key:0}或者{}\n const selectedState = {};\n for (const itemKey in dataItem) {\n if (!itemKey.startsWith('VGRAMMAR_') && !itemKey.startsWith('__VCHART')) {\n selectedState[itemKey] = dataItem[itemKey];\n }\n }\n newSelectedDataItemsInChart.push(selectedState);\n }\n });\n } else if (datum && datum.key !== 0 && Object.keys(datum).length > 0) {\n //本以为没有点击到图元上 datum为空 发现是{key:0}或者{}\n const selectedState = {};\n for (const itemKey in datum) {\n if (!itemKey.startsWith('VGRAMMAR_') && !itemKey.startsWith('__VCHART')) {\n selectedState[itemKey] = datum[itemKey];\n }\n }\n newSelectedDataItemsInChart.push(selectedState);\n }\n //避免无效的更新\n if (!isEqual((table as PivotChart)._selectedDataItemsInChart, newSelectedDataItemsInChart)) {\n (table as PivotChart)._selectedDataItemsInChart = newSelectedDataItemsInChart;\n (table.internalProps.layoutMap as PivotHeaderLayoutMap).updateDataStateToChartInstance();\n // 清楚chart缓存图片\n clearChartCacheImage(scenegraph);\n table.scenegraph.updateNextFrame();\n }\n }\n}\n\n/**\n * @description: update table axis component\n * @param {Group} containerGroup\n * @param {BaseTableAPI} table\n * @return {*}\n */\nfunction updateTableAxes(containerGroup: Group, table: BaseTableAPI) {\n containerGroup.forEachChildren((column: Group) => {\n if (column.role === 'column') {\n column.forEachChildren((cell: Group) => {\n if (cell.role === 'cell') {\n let isAxisComponent = false;\n cell.forEachChildren((mark: Group) => {\n if (mark.name === 'axis') {\n isAxisComponent = true;\n return true;\n }\n return false;\n });\n if (isAxisComponent) {\n const axisConfig = table.internalProps.layoutMap.getAxisConfigInPivotChart(cell.col, cell.row);\n const cellStyle = table._getCellStyle(cell.col, cell.row);\n const padding = getQuadProps(getProp('padding', cellStyle, cell.col, cell.row, table));\n const spec = table.internalProps.layoutMap.getRawChartSpec(cell.col, cell.row);\n const axis = new CartesianAxis(\n axisConfig,\n cell.attribute.width,\n cell.attribute.height,\n padding,\n spec?.theme,\n table\n );\n cell.clear();\n cell.appendChild(axis.component);\n axis.overlap();\n }\n }\n });\n }\n });\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/refresh-node/update-chart.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAE3C,qDAA2D;AAM3D,8CAAgD;AAChD,gDAA4C;AAG5C,SAAgB,eAAe,CAAC,UAAsB,EAAE,GAAW;;IAEjE,KAAK,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnD,MAAM,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAG9C,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,WAAW,EAAE,0CAAE,OAAO,CAAC,CAAC,QAAe,EAAE,EAAE;YACtD,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YACzD,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YAE3D,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAW,EAAE,EAAE;gBACxC,IAAK,IAAY,CAAC,IAAI,KAAK,OAAO,EAAE;oBAoBlC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;oBACxB,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC7G,IAAI,CA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,MAAM,OAAO,GAAG,IAAA,sBAAY,EAAC,IAAA,kBAAO,EAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;wBACvF,MAAM,IAAI,GAAG,IAAI,oBAAa,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;wBACxG,IAAI,CAAC,KAAK,EAAE,CAAC;wBACb,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;wBACjC,IAAI,CAAC,OAAO,EAAE,CAAC;qBAChB;iBACF;YACH,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC","file":"update-chart.js","sourcesContent":["import { isEqual } from '@visactor/vutils';\nimport type { PivotChart } from '../../PivotChart';\nimport { CartesianAxis } from '../../components/axis/axis';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { Chart } from '../graphic/chart';\nimport type { Group } from '../graphic/group';\nimport type { Scenegraph } from '../scenegraph';\nimport type { PivotHeaderLayoutMap } from '../../layout/pivot-header-layout';\nimport { getQuadProps } from '../utils/padding';\nimport { getProp } from '../utils/get-prop';\n\n/** 供调整列宽后更新chart使用 */\nexport function updateChartSize(scenegraph: Scenegraph, col: number) {\n // 将调整列宽的后面的面也都一起需要调整viewbox。 TODO:columnResizeType支持后需要根据变化的列去调整,范围可能变多或者变少\n for (let c = col; c <= scenegraph.proxy.colEnd; c++) {\n const columnGroup = scenegraph.getColGroup(c);\n // const chartInstance = (columnGroup.attribute as any)?.chartInstance;\n // if (chartInstance) {\n columnGroup?.getChildren()?.forEach((cellNode: Group) => {\n const width = scenegraph.table.getColWidth(cellNode.col);\n const height = scenegraph.table.getRowHeight(cellNode.row);\n\n cellNode.children.forEach((node: Chart) => {\n if ((node as any).type === 'chart') {\n // 调试问题使用\n // if (columnGroup.col === 2) {\n // columnGroup.AABBBounds.width();\n // node.AABBBounds.width();\n // console.log(\n // 'set viewbox y1',\n // Math.ceil(cellNode.globalAABBBounds.y1 + node.attribute.cellPadding[0] + scenegraph.table.scrollTop),\n // node.globalAABBBounds.height()\n // );\n\n // console.log(\n // 'updateChartSize',\n // columnGroup,\n // columnGroup.globalAABBBounds.y1,\n // cellNode.globalAABBBounds.y1,\n // node.globalAABBBounds.y1\n // );\n // }\n\n node.cacheCanvas = null;\n node.setAttribute('width', Math.ceil(width - node.attribute.cellPadding[3] - node.attribute.cellPadding[1]));\n node.setAttribute(\n 'height',\n Math.ceil(height - node.attribute.cellPadding[0] - node.attribute.cellPadding[2])\n );\n\n // node.setAttribute('viewBox', {\n // x1: Math.ceil(cellNode.globalAABBBounds.x1 + node.attribute.cellPadding[3] + scenegraph.table.scrollLeft),\n // x2: Math.ceil(\n // cellNode.globalAABBBounds.x1 + width - node.attribute.cellPadding[1] + scenegraph.table.scrollLeft\n // ),\n // y1: Math.ceil(cellNode.globalAABBBounds.y1 + node.attribute.cellPadding[0] + scenegraph.table.scrollTop),\n // y2: Math.ceil(\n // cellNode.globalAABBBounds.y1 + height - node.attribute.cellPadding[2] + scenegraph.table.scrollTop\n // )\n // });\n }\n });\n });\n // }\n }\n}\n\n/** 清理所有chart节点的 图表缓存图片 */\nexport function clearChartCacheImage(scenegraph: Scenegraph) {\n // 将调整列宽的后面的面也都一起需要调整viewbox。 TODO:columnResizeType支持后需要根据变化的列去调整,范围可能变多或者变少\n for (let c = scenegraph.proxy.colStart; c <= scenegraph.proxy.colEnd; c++) {\n const columnGroup = scenegraph.getColGroup(c);\n columnGroup?.getChildren()?.forEach((cellNode: Group) => {\n cellNode.children.forEach((node: Chart) => {\n if ((node as any).type === 'chart') {\n node.cacheCanvas = null;\n node.addUpdateBoundTag();\n }\n });\n });\n }\n}\n\n/** 更新所有的图表chart节点上缓存attribute中的data数据 */\nexport function updateChartData(scenegraph: Scenegraph) {\n const table = scenegraph.table;\n // 将调整列宽的后面的面也都一起需要调整viewbox。 TODO:columnResizeType支持后需要根据变化的列去调整,范围可能变多或者变少\n for (let c = scenegraph.proxy.colStart; c <= scenegraph.proxy.colEnd; c++) {\n const columnGroup = scenegraph.getColGroup(c);\n columnGroup?.getChildren()?.forEach((cellNode: Group) => {\n const col = cellNode.col;\n const row = cellNode.row;\n cellNode.children.forEach((node: Chart) => {\n if ((node as any).type === 'chart') {\n node.updateData(table.getCellValue(col, row));\n const newAxes = table.internalProps.layoutMap.getChartAxes(col, row);\n node.setAttribute('axes', newAxes);\n const chartSpec = node.attribute.spec;\n chartSpec.axes = newAxes;\n node.setAttribute('spec', chartSpec);\n // node.addUpdateBoundTag();\n }\n });\n });\n }\n\n // update left axes\n updateTableAxes(scenegraph.rowHeaderGroup, scenegraph.table);\n // update top axes\n updateTableAxes(scenegraph.colHeaderGroup, scenegraph.table);\n // update right axes\n updateTableAxes(scenegraph.rightFrozenGroup, scenegraph.table);\n // update bottom axes\n updateTableAxes(scenegraph.bottomFrozenGroup, scenegraph.table);\n}\n/** 组织图表数据状态_selectedDataItemsInChart 更新选中的图表图元状态 */\nexport function updateChartState(scenegraph: Scenegraph, datum: any) {\n const table = scenegraph.table;\n if (table.isPivotChart()) {\n const preSelectItemsCount = (table as PivotChart)._selectedDataItemsInChart.length;\n if ((datum === null || datum?.length === 0 || Object.keys(datum).length === 0) && preSelectItemsCount === 0) {\n //避免无效的更新\n return;\n }\n // (table as PivotChart)._selectedDataItemsInChart = [];\n const newSelectedDataItemsInChart = [];\n if (Array.isArray(datum)) {\n datum.forEach((dataItem: any) => {\n if (dataItem && dataItem.key !== 0 && Object.keys(dataItem).length > 0) {\n //本以为没有点击到图元上 datum为空 发现是{key:0}或者{}\n const selectedState = {};\n for (const itemKey in dataItem) {\n if (!itemKey.startsWith('VGRAMMAR_') && !itemKey.startsWith('__VCHART')) {\n selectedState[itemKey] = dataItem[itemKey];\n }\n }\n newSelectedDataItemsInChart.push(selectedState);\n }\n });\n } else if (datum && datum.key !== 0 && Object.keys(datum).length > 0) {\n //本以为没有点击到图元上 datum为空 发现是{key:0}或者{}\n const selectedState = {};\n for (const itemKey in datum) {\n if (!itemKey.startsWith('VGRAMMAR_') && !itemKey.startsWith('__VCHART')) {\n selectedState[itemKey] = datum[itemKey];\n }\n }\n newSelectedDataItemsInChart.push(selectedState);\n }\n //避免无效的更新\n if (!isEqual((table as PivotChart)._selectedDataItemsInChart, newSelectedDataItemsInChart)) {\n (table as PivotChart)._selectedDataItemsInChart = newSelectedDataItemsInChart;\n (table.internalProps.layoutMap as PivotHeaderLayoutMap).updateDataStateToChartInstance();\n // 清楚chart缓存图片\n clearChartCacheImage(scenegraph);\n table.scenegraph.updateNextFrame();\n }\n }\n}\n\n/**\n * @description: update table axis component\n * @param {Group} containerGroup\n * @param {BaseTableAPI} table\n * @return {*}\n */\nfunction updateTableAxes(containerGroup: Group, table: BaseTableAPI) {\n containerGroup.forEachChildren((column: Group) => {\n if (column.role === 'column') {\n column.forEachChildren((cell: Group) => {\n if (cell.role === 'cell') {\n let isAxisComponent = false;\n cell.forEachChildren((mark: Group) => {\n if (mark.name === 'axis') {\n isAxisComponent = true;\n return true;\n }\n return false;\n });\n if (isAxisComponent) {\n const axisConfig = table.internalProps.layoutMap.getAxisConfigInPivotChart(cell.col, cell.row);\n const cellStyle = table._getCellStyle(cell.col, cell.row);\n const padding = getQuadProps(getProp('padding', cellStyle, cell.col, cell.row, table));\n const axis = new CartesianAxis(axisConfig, cell.attribute.width, cell.attribute.height, padding, table);\n cell.clear();\n cell.appendChild(axis.component);\n axis.overlap();\n }\n }\n });\n }\n });\n}\n"]}
|
|
@@ -2,6 +2,7 @@ import type { ICartesianAxisSpec } from '@visactor/vchart';
|
|
|
2
2
|
export type ICellAxisOption = Omit<ICartesianAxisSpec, 'type'> & ({
|
|
3
3
|
type: 'band';
|
|
4
4
|
domain: (number | string)[];
|
|
5
|
+
__vtableChartTheme?: any;
|
|
5
6
|
} | {
|
|
6
7
|
type: 'linear' | 'time';
|
|
7
8
|
range: {
|
|
@@ -9,5 +10,6 @@ export type ICellAxisOption = Omit<ICartesianAxisSpec, 'type'> & ({
|
|
|
9
10
|
max: number;
|
|
10
11
|
};
|
|
11
12
|
__ticksForVTable?: number[];
|
|
13
|
+
__vtableChartTheme?: any;
|
|
12
14
|
});
|
|
13
15
|
export type ITableAxisOption = ICartesianAxisSpec;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ts-types/component/axis.ts"],"names":[],"mappings":"","file":"axis.js","sourcesContent":["import type { ICartesianAxisSpec } from '@visactor/vchart';\n\nexport type ICellAxisOption = Omit<ICartesianAxisSpec, 'type'> &\n (\n | {\n type: 'band';\n domain: (number | string)[];\n }\n | {\n type: 'linear' | 'time';\n range: {\n min: number;\n max: number;\n };\n __ticksForVTable?: number[];\n }\n );\n\nexport type ITableAxisOption = ICartesianAxisSpec;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/ts-types/component/axis.ts"],"names":[],"mappings":"","file":"axis.js","sourcesContent":["import type { ICartesianAxisSpec } from '@visactor/vchart';\n\nexport type ICellAxisOption = Omit<ICartesianAxisSpec, 'type'> &\n (\n | {\n type: 'band';\n domain: (number | string)[];\n __vtableChartTheme?: any;\n }\n | {\n type: 'linear' | 'time';\n range: {\n min: number;\n max: number;\n };\n __ticksForVTable?: number[];\n __vtableChartTheme?: any;\n }\n );\n\nexport type ITableAxisOption = ICartesianAxisSpec;\n"]}
|
package/dist/vtable.js
CHANGED
|
@@ -48997,11 +48997,11 @@
|
|
|
48997
48997
|
tickData;
|
|
48998
48998
|
scale;
|
|
48999
48999
|
component;
|
|
49000
|
-
constructor(option, width, height, padding,
|
|
49000
|
+
constructor(option, width, height, padding, table) {
|
|
49001
49001
|
this.table = table;
|
|
49002
49002
|
this.orient = option.orient ?? 'left';
|
|
49003
49003
|
this.type = option.type ?? 'band';
|
|
49004
|
-
this.option = merge$1({}, getCommonAxis(
|
|
49004
|
+
this.option = merge$1({}, getCommonAxis(option.__vtableChartTheme), getTableAxisTheme(this.orient, table.theme), getChartSpecAxisTheme(this.orient, this.type, option.__vtableChartTheme), option);
|
|
49005
49005
|
if (this.orient === 'left' || this.orient === 'right') {
|
|
49006
49006
|
this.width = width;
|
|
49007
49007
|
this.height = height - padding[2];
|
|
@@ -53552,8 +53552,7 @@
|
|
|
53552
53552
|
cellGroup = createCellGroup(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme);
|
|
53553
53553
|
const axisConfig = table.internalProps.layoutMap.getAxisConfigInPivotChart(col, row);
|
|
53554
53554
|
if (axisConfig) {
|
|
53555
|
-
const
|
|
53556
|
-
const axis = new CartesianAxis(axisConfig, cellGroup.attribute.width, cellGroup.attribute.height, padding, spec?.theme, table);
|
|
53555
|
+
const axis = new CartesianAxis(axisConfig, cellGroup.attribute.width, cellGroup.attribute.height, padding, table);
|
|
53557
53556
|
cellGroup.clear();
|
|
53558
53557
|
cellGroup.appendChild(axis.component);
|
|
53559
53558
|
axis.overlap();
|
|
@@ -54222,7 +54221,7 @@
|
|
|
54222
54221
|
if (!axisRange) {
|
|
54223
54222
|
return;
|
|
54224
54223
|
}
|
|
54225
|
-
const { range, ticks, axisOption, isZeroAlign } = axisRange;
|
|
54224
|
+
const { range, ticks, axisOption, isZeroAlign, theme } = axisRange;
|
|
54226
54225
|
if (isZeroAlign) {
|
|
54227
54226
|
const subAxisRange = getRange$1('bottom', col, row + 1, col, layout.columnHeaderLevelCount - 1, col, row, 0, layout);
|
|
54228
54227
|
if (subAxisRange) {
|
|
@@ -54254,7 +54253,8 @@
|
|
|
54254
54253
|
label: {
|
|
54255
54254
|
flush: true
|
|
54256
54255
|
},
|
|
54257
|
-
__ticksForVTable: ticks
|
|
54256
|
+
__ticksForVTable: ticks,
|
|
54257
|
+
__vtableChartTheme: theme
|
|
54258
54258
|
});
|
|
54259
54259
|
}
|
|
54260
54260
|
else if (row === layout.rowCount - layout.bottomFrozenRowCount &&
|
|
@@ -54272,7 +54272,7 @@
|
|
|
54272
54272
|
if (!axisRange) {
|
|
54273
54273
|
return;
|
|
54274
54274
|
}
|
|
54275
|
-
const { range, ticks, axisOption, isZeroAlign } = axisRange;
|
|
54275
|
+
const { range, ticks, axisOption, isZeroAlign, theme } = axisRange;
|
|
54276
54276
|
if (isZeroAlign) {
|
|
54277
54277
|
const subAxisRange = getRange$1('top', col, row - 1, col, row, col, row, 1, layout);
|
|
54278
54278
|
if (subAxisRange) {
|
|
@@ -54308,7 +54308,8 @@
|
|
|
54308
54308
|
label: {
|
|
54309
54309
|
flush: true
|
|
54310
54310
|
},
|
|
54311
|
-
__ticksForVTable: ticks
|
|
54311
|
+
__ticksForVTable: ticks,
|
|
54312
|
+
__vtableChartTheme: theme
|
|
54312
54313
|
});
|
|
54313
54314
|
}
|
|
54314
54315
|
else if (col === layout.rowHeaderLevelCount - 1 &&
|
|
@@ -54321,7 +54322,7 @@
|
|
|
54321
54322
|
const data = layout.dataset.collectedValues[rowDimensionKey] ?? [];
|
|
54322
54323
|
const rowPath = layout.getRowKeysPath(col, row);
|
|
54323
54324
|
const domain = data[rowPath ?? ''] ?? [];
|
|
54324
|
-
const { axisOption, isPercent } = getAxisOption(col + 1, row, 'left', layout);
|
|
54325
|
+
const { axisOption, isPercent, theme } = getAxisOption(col + 1, row, 'left', layout);
|
|
54325
54326
|
if (axisOption?.visible === false) {
|
|
54326
54327
|
return;
|
|
54327
54328
|
}
|
|
@@ -54332,7 +54333,8 @@
|
|
|
54332
54333
|
}
|
|
54333
54334
|
}, axisOption, {
|
|
54334
54335
|
orient: 'left',
|
|
54335
|
-
type: 'band'
|
|
54336
|
+
type: 'band',
|
|
54337
|
+
__vtableChartTheme: theme
|
|
54336
54338
|
});
|
|
54337
54339
|
}
|
|
54338
54340
|
}
|
|
@@ -54352,7 +54354,7 @@
|
|
|
54352
54354
|
if (!axisRange) {
|
|
54353
54355
|
return;
|
|
54354
54356
|
}
|
|
54355
|
-
const { range, ticks, axisOption, isZeroAlign } = axisRange;
|
|
54357
|
+
const { range, ticks, axisOption, isZeroAlign, theme } = axisRange;
|
|
54356
54358
|
if (isZeroAlign) {
|
|
54357
54359
|
const subAxisRange = getRange$1('right', col + 1, row, col, row, col, row, 1, layout);
|
|
54358
54360
|
if (subAxisRange) {
|
|
@@ -54389,7 +54391,8 @@
|
|
|
54389
54391
|
label: {
|
|
54390
54392
|
flush: true
|
|
54391
54393
|
},
|
|
54392
|
-
__ticksForVTable: ticks
|
|
54394
|
+
__ticksForVTable: ticks,
|
|
54395
|
+
__vtableChartTheme: theme
|
|
54393
54396
|
});
|
|
54394
54397
|
}
|
|
54395
54398
|
else if (col === layout.colCount - layout.rightFrozenColCount &&
|
|
@@ -54399,7 +54402,7 @@
|
|
|
54399
54402
|
if (!axisRange) {
|
|
54400
54403
|
return;
|
|
54401
54404
|
}
|
|
54402
|
-
const { range, ticks, axisOption, isZeroAlign } = axisRange;
|
|
54405
|
+
const { range, ticks, axisOption, isZeroAlign, theme } = axisRange;
|
|
54403
54406
|
if (isZeroAlign) {
|
|
54404
54407
|
const subAxisRange = getRange$1('left', col - 1, row, layout.rowHeaderLevelCount - 1, row, col, row, 0, layout);
|
|
54405
54408
|
if (subAxisRange) {
|
|
@@ -54434,7 +54437,8 @@
|
|
|
54434
54437
|
label: {
|
|
54435
54438
|
flush: true
|
|
54436
54439
|
},
|
|
54437
|
-
__ticksForVTable: ticks
|
|
54440
|
+
__ticksForVTable: ticks,
|
|
54441
|
+
__vtableChartTheme: theme
|
|
54438
54442
|
});
|
|
54439
54443
|
}
|
|
54440
54444
|
else if (row === layout.rowCount - layout.bottomFrozenRowCount &&
|
|
@@ -54447,7 +54451,7 @@
|
|
|
54447
54451
|
const data = layout.dataset.collectedValues[columnDimensionKey] ?? [];
|
|
54448
54452
|
const colPath = layout.getColKeysPath(col, row);
|
|
54449
54453
|
const domain = data?.[colPath ?? ''] ?? [];
|
|
54450
|
-
const { axisOption, isPercent } = getAxisOption(col, row - 1, 'bottom', layout);
|
|
54454
|
+
const { axisOption, isPercent, theme } = getAxisOption(col, row - 1, 'bottom', layout);
|
|
54451
54455
|
if (axisOption?.visible === false) {
|
|
54452
54456
|
return;
|
|
54453
54457
|
}
|
|
@@ -54455,7 +54459,8 @@
|
|
|
54455
54459
|
domain: Array.from(domain)
|
|
54456
54460
|
}, axisOption, {
|
|
54457
54461
|
orient: 'bottom',
|
|
54458
|
-
type: 'band'
|
|
54462
|
+
type: 'band',
|
|
54463
|
+
__vtableChartTheme: theme
|
|
54459
54464
|
});
|
|
54460
54465
|
}
|
|
54461
54466
|
}
|
|
@@ -54480,7 +54485,8 @@
|
|
|
54480
54485
|
axisOption,
|
|
54481
54486
|
isPercent: spec.percent,
|
|
54482
54487
|
isZeroAlign: checkZeroAlign(spec, orient, layout),
|
|
54483
|
-
seriesIndice
|
|
54488
|
+
seriesIndice,
|
|
54489
|
+
theme: spec.theme
|
|
54484
54490
|
};
|
|
54485
54491
|
}
|
|
54486
54492
|
}
|
|
@@ -54490,7 +54496,8 @@
|
|
|
54490
54496
|
return {
|
|
54491
54497
|
axisOption,
|
|
54492
54498
|
isPercent: false,
|
|
54493
|
-
isZeroAlign: checkZeroAlign(spec, orient, layout)
|
|
54499
|
+
isZeroAlign: checkZeroAlign(spec, orient, layout),
|
|
54500
|
+
theme: spec.theme
|
|
54494
54501
|
};
|
|
54495
54502
|
}
|
|
54496
54503
|
function checkZeroAlign(spec, orient, layout) {
|
|
@@ -54570,7 +54577,7 @@
|
|
|
54570
54577
|
return range;
|
|
54571
54578
|
}
|
|
54572
54579
|
function getRange$1(position, colForAxisOption, rowForAxisOption, colForIndicatorKey, rowForIndicatorKey, col, row, defaultSeriesIndice, layout) {
|
|
54573
|
-
const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(colForAxisOption, rowForAxisOption, position, layout);
|
|
54580
|
+
const { axisOption, isPercent, isZeroAlign, seriesIndice, theme } = getAxisOption(colForAxisOption, rowForAxisOption, position, layout);
|
|
54574
54581
|
if (axisOption?.visible === false) {
|
|
54575
54582
|
return undefined;
|
|
54576
54583
|
}
|
|
@@ -54609,7 +54616,8 @@
|
|
|
54609
54616
|
axisOption,
|
|
54610
54617
|
isZeroAlign,
|
|
54611
54618
|
range,
|
|
54612
|
-
ticks
|
|
54619
|
+
ticks,
|
|
54620
|
+
theme
|
|
54613
54621
|
};
|
|
54614
54622
|
}
|
|
54615
54623
|
function isTopOrBottomAxis(col, row, layout) {
|
|
@@ -55688,8 +55696,7 @@
|
|
|
55688
55696
|
const cellStyle = scene.table._getCellStyle(col, row);
|
|
55689
55697
|
const padding = getQuadProps(getProp('padding', cellStyle, col, row, scene.table));
|
|
55690
55698
|
if (axisConfig) {
|
|
55691
|
-
const
|
|
55692
|
-
const axis = new CartesianAxis(axisConfig, cellGroup.attribute.width, cellGroup.attribute.height, padding, spec?.theme, scene.table);
|
|
55699
|
+
const axis = new CartesianAxis(axisConfig, cellGroup.attribute.width, cellGroup.attribute.height, padding, scene.table);
|
|
55693
55700
|
cellGroup.clear();
|
|
55694
55701
|
cellGroup.appendChild(axis.component);
|
|
55695
55702
|
axis.overlap();
|
|
@@ -60522,8 +60529,7 @@
|
|
|
60522
60529
|
const axisConfig = table.internalProps.layoutMap.getAxisConfigInPivotChart(cell.col, cell.row);
|
|
60523
60530
|
const cellStyle = table._getCellStyle(cell.col, cell.row);
|
|
60524
60531
|
const padding = getQuadProps(getProp('padding', cellStyle, cell.col, cell.row, table));
|
|
60525
|
-
const
|
|
60526
|
-
const axis = new CartesianAxis(axisConfig, cell.attribute.width, cell.attribute.height, padding, spec?.theme, table);
|
|
60532
|
+
const axis = new CartesianAxis(axisConfig, cell.attribute.width, cell.attribute.height, padding, table);
|
|
60527
60533
|
cell.clear();
|
|
60528
60534
|
cell.appendChild(axis.component);
|
|
60529
60535
|
axis.overlap();
|
|
@@ -68420,7 +68426,7 @@
|
|
|
68420
68426
|
return TABLE_EVENT_TYPE;
|
|
68421
68427
|
}
|
|
68422
68428
|
options;
|
|
68423
|
-
version = "0.16.
|
|
68429
|
+
version = "0.16.2-alpha.0";
|
|
68424
68430
|
pagination;
|
|
68425
68431
|
id = `VTable${Date.now()}`;
|
|
68426
68432
|
headerStyleCache;
|
|
@@ -78841,7 +78847,7 @@
|
|
|
78841
78847
|
return new Tag$1(params ? params.attribute : {});
|
|
78842
78848
|
}
|
|
78843
78849
|
|
|
78844
|
-
const version = "0.16.
|
|
78850
|
+
const version = "0.16.2-alpha.0";
|
|
78845
78851
|
function getIcons() {
|
|
78846
78852
|
return get$2();
|
|
78847
78853
|
}
|