@visactor/vtable 0.18.0-alpha.2 → 0.18.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/ListTable.d.ts +1 -0
- package/cjs/ListTable.js +50 -2
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.js +102 -83
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/core/BaseTable.js +4 -4
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/data/DataSource.d.ts +3 -1
- package/cjs/data/DataSource.js +27 -7
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/event/pivot-chart/axis-click.js +2 -2
- package/cjs/event/pivot-chart/axis-click.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.js +5 -5
- package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
- package/cjs/layout/chart-helper/get-chart-spec.d.ts +3 -0
- package/cjs/layout/chart-helper/get-chart-spec.js +43 -7
- package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/cjs/layout/pivot-header-layout.d.ts +4 -3
- package/cjs/layout/pivot-header-layout.js +43 -23
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/scenegraph/component/custom.d.ts +5 -0
- package/cjs/scenegraph/component/custom.js +20 -3
- package/cjs/scenegraph/component/custom.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.d.ts +6 -3
- package/cjs/scenegraph/group-creater/cell-helper.js +38 -36
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/text-cell.d.ts +2 -1
- package/cjs/scenegraph/group-creater/cell-type/text-cell.js +6 -2
- package/cjs/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/column-helper.js +11 -7
- package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/sort-horizontal.js +12 -5
- package/cjs/scenegraph/group-creater/progress/update-position/sort-horizontal.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/sort-vertical.js +19 -14
- package/cjs/scenegraph/group-creater/progress/update-position/sort-vertical.js.map +1 -1
- package/cjs/scenegraph/layout/move-cell.d.ts +2 -1
- package/cjs/scenegraph/layout/move-cell.js +15 -27
- package/cjs/scenegraph/layout/move-cell.js.map +1 -1
- package/cjs/scenegraph/layout/update-height.js +21 -17
- package/cjs/scenegraph/layout/update-height.js.map +1 -1
- package/cjs/scenegraph/layout/update-width.js +40 -17
- package/cjs/scenegraph/layout/update-width.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +2 -2
- package/cjs/scenegraph/scenegraph.js +10 -7
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/utils/get-cell-merge.js +4 -0
- package/cjs/scenegraph/utils/get-cell-merge.js.map +1 -1
- package/cjs/scenegraph/utils/text-icon-layout.d.ts +3 -3
- package/cjs/scenegraph/utils/text-icon-layout.js +12 -10
- package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
- package/cjs/state/cell-move/index.js +4 -2
- package/cjs/state/cell-move/index.js.map +1 -1
- package/cjs/state/state.js +1 -1
- package/cjs/state/state.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +5 -1
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +1565 -1207
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +1 -0
- package/es/ListTable.js +49 -2
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.js +102 -83
- package/es/PivotChart.js.map +1 -1
- package/es/core/BaseTable.js +4 -4
- package/es/core/BaseTable.js.map +1 -1
- package/es/data/DataSource.d.ts +3 -1
- package/es/data/DataSource.js +27 -7
- package/es/data/DataSource.js.map +1 -1
- package/es/event/pivot-chart/axis-click.js +2 -2
- package/es/event/pivot-chart/axis-click.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.js +5 -5
- package/es/layout/chart-helper/get-axis-config.js.map +1 -1
- package/es/layout/chart-helper/get-chart-spec.d.ts +3 -0
- package/es/layout/chart-helper/get-chart-spec.js +38 -4
- package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/es/layout/pivot-header-layout.d.ts +4 -3
- package/es/layout/pivot-header-layout.js +38 -23
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/scenegraph/component/custom.d.ts +5 -0
- package/es/scenegraph/component/custom.js +18 -0
- package/es/scenegraph/component/custom.js.map +1 -1
- package/es/scenegraph/graphic/contributions/chart-render-helper.js +1 -1
- package/es/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.d.ts +6 -3
- package/es/scenegraph/group-creater/cell-helper.js +36 -35
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/text-cell.d.ts +2 -1
- package/es/scenegraph/group-creater/cell-type/text-cell.js +6 -2
- package/es/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
- package/es/scenegraph/group-creater/column-helper.js +11 -6
- package/es/scenegraph/group-creater/column-helper.js.map +1 -1
- package/es/scenegraph/group-creater/progress/update-position/sort-horizontal.js +12 -5
- package/es/scenegraph/group-creater/progress/update-position/sort-horizontal.js.map +1 -1
- package/es/scenegraph/group-creater/progress/update-position/sort-vertical.js +19 -14
- package/es/scenegraph/group-creater/progress/update-position/sort-vertical.js.map +1 -1
- package/es/scenegraph/layout/move-cell.d.ts +2 -1
- package/es/scenegraph/layout/move-cell.js +12 -20
- package/es/scenegraph/layout/move-cell.js.map +1 -1
- package/es/scenegraph/layout/update-height.js +20 -16
- package/es/scenegraph/layout/update-height.js.map +1 -1
- package/es/scenegraph/layout/update-width.js +39 -16
- package/es/scenegraph/layout/update-width.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +2 -2
- package/es/scenegraph/scenegraph.js +9 -6
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/utils/get-cell-merge.js +4 -0
- package/es/scenegraph/utils/get-cell-merge.js.map +1 -1
- package/es/scenegraph/utils/text-icon-layout.d.ts +3 -3
- package/es/scenegraph/utils/text-icon-layout.js +10 -10
- package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
- package/es/state/cell-move/index.js +4 -1
- package/es/state/cell-move/index.js.map +1 -1
- package/es/state/state.js +1 -1
- package/es/state/state.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +5 -1
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IThemeSpec, Group as VGroup } from './../../../vrender';
|
|
2
2
|
import { Group } from '../../graphic/group';
|
|
3
3
|
import type { BaseTableAPI } from '../../../ts-types/base-table';
|
|
4
|
-
|
|
4
|
+
import type { CellRange } from '../../../ts-types';
|
|
5
|
+
export declare function createCellGroup(table: BaseTableAPI, value: string, columnGroup: Group, xOrigin: number, yOrigin: number, col: number, row: number, colWidth: number | 'auto', cellWidth: number, cellHeight: number, padding: number[], textAlign: CanvasTextAlign, textBaseline: CanvasTextBaseline, mayHaveIcon: boolean, customElementsGroup: VGroup, renderDefault: boolean, cellTheme: IThemeSpec, range: CellRange | undefined): Group;
|
|
@@ -8,7 +8,7 @@ import { getFunctionalProp } from "../../utils/get-prop";
|
|
|
8
8
|
|
|
9
9
|
import { createCellContent } from "../../utils/text-icon-layout";
|
|
10
10
|
|
|
11
|
-
export function createCellGroup(table, value, columnGroup, xOrigin, yOrigin, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme) {
|
|
11
|
+
export function createCellGroup(table, value, columnGroup, xOrigin, yOrigin, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range) {
|
|
12
12
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
13
13
|
const headerStyle = table._getCellStyle(col, row), functionalPadding = getFunctionalProp("padding", headerStyle, col, row, table);
|
|
14
14
|
isValid(functionalPadding) && (padding = functionalPadding), (null === (_a = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _a ? void 0 : _a.textAlign) && (textAlign = null === (_b = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _b ? void 0 : _b.textAlign),
|
|
@@ -32,7 +32,11 @@ export function createCellGroup(table, value, columnGroup, xOrigin, yOrigin, col
|
|
|
32
32
|
customElementsGroup && cellGroup.appendChild(customElementsGroup), renderDefault) {
|
|
33
33
|
const textStr = value;
|
|
34
34
|
let icons;
|
|
35
|
-
if (mayHaveIcon
|
|
35
|
+
if (mayHaveIcon) {
|
|
36
|
+
let iconCol = col, iconRow = row;
|
|
37
|
+
range && (iconCol = range.start.col, iconRow = range.start.row), icons = table.getCellIcons(iconCol, iconRow);
|
|
38
|
+
}
|
|
39
|
+
if (createCellContent(cellGroup, icons, textStr, padding, autoColWidth, autoRowHeight, autoWrapText, "number" == typeof lineClamp ? lineClamp : void 0, cellWidth, cellHeight, textAlign, textBaseline, table, cellTheme, range),
|
|
36
40
|
null === (_t = null == cellTheme ? void 0 : cellTheme._vtable) || void 0 === _t ? void 0 : _t.marked) {
|
|
37
41
|
const mark = createArc({
|
|
38
42
|
x: cellGroup.attribute.width,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/group-creater/cell-type/text-cell.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;A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AAI,CAAC,EAAE,GAAG,CAAC;gBACvB,QAAQ,EAAE,IAAI,CAAC,EAAE;gBACjB,WAAW,EAAE,CAAC;gBACd,IAAI,EAAE,SAAS;gBACf,QAAQ,EAAE,KAAK;aAChB,CAAC,CAAC;YACH,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC;YAEnB,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;SAC7B;KACF;IACD,IAAI,mBAAmB,EAAE;QACvB,SAAS,CAAC,aAAa,CAAC;YACtB,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,MAAA,mBAAmB,CAAC,SAAS,CAAC,KAAK,mCAAI,CAAC,CAAC;YACpF,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,MAAA,mBAAmB,CAAC,SAAS,CAAC,MAAM,mCAAI,CAAC,CAAC;SACxF,CAAC,CAAC;KACJ;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","file":"text-cell.js","sourcesContent":["/* eslint-disable no-undef */\nimport type { IThemeSpec, Group as VGroup } from './../../../vrender';\nimport { createArc } from './../../../vrender';\nimport { isValid } from '@visactor/vutils';\nimport { Group } from '../../graphic/group';\n// import { parseFont } from '../../utils/font';\nimport { getFunctionalProp } from '../../utils/get-prop';\nimport { createCellContent } from '../../utils/text-icon-layout';\nimport type { BaseTableAPI } from '../../../ts-types/base-table';\nimport { getStyleTheme } from '../../../core/tableHelper';\nimport type { CellRange } from '../../../ts-types';\n\n/**\n * @description: 创建单元格场景节点\n * @param {Group} columnGroup 列Group\n * @param {number} xOrigin 起始x坐标\n * @param {number} yOrigin 起始y坐标\n * @param {number} col\n * @param {number} row\n * @param {BaseTableAPI} table\n * @param {number | 'auto'} colWidth 配置列宽\n * @param {number} padding 单元格padding\n * @param {CanvasTextAlign} textAlign\n * @param {CanvasTextBaseline} textBaseline\n * @param {boolean} noWrap 不进行折行(default column type)\n * @param {IThemeSpec} cellTheme 单元格主题\n * @return {Group}\n */\nexport function createCellGroup(\n table: BaseTableAPI,\n value: string,\n columnGroup: Group,\n xOrigin: number,\n yOrigin: number,\n col: number,\n row: number,\n // rowHeight: number,\n colWidth: number | 'auto',\n cellWidth: number,\n cellHeight: number,\n padding: number[],\n textAlign: CanvasTextAlign,\n textBaseline: CanvasTextBaseline,\n mayHaveIcon: boolean,\n customElementsGroup: VGroup,\n renderDefault: boolean,\n cellTheme: IThemeSpec,\n range: CellRange | undefined\n): Group {\n const headerStyle = table._getCellStyle(col, row); // to be fixed\n const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);\n if (isValid(functionalPadding)) {\n padding = functionalPadding;\n }\n if (cellTheme?.text?.textAlign) {\n textAlign = cellTheme?.text?.textAlign;\n }\n if (cellTheme?.text?.textBaseline) {\n textBaseline = cellTheme?.text?.textBaseline;\n }\n const autoRowHeight = table.heightMode === 'autoHeight';\n const autoColWidth = colWidth === 'auto';\n const autoWrapText = headerStyle.autoWrapText ?? table.internalProps.autoWrapText;\n const lineClamp = headerStyle.lineClamp;\n\n // cell\n const cellGroup = new Group({\n x: xOrigin,\n y: yOrigin,\n width: cellWidth,\n height: cellHeight,\n // 背景相关,cell背景由cellGroup绘制\n lineWidth: cellTheme?.group?.lineWidth ?? undefined,\n fill: cellTheme?.group?.fill ?? undefined,\n stroke: cellTheme?.group?.stroke ?? undefined,\n strokeArrayWidth: (cellTheme?.group as any)?.strokeArrayWidth ?? undefined,\n strokeArrayColor: (cellTheme?.group as any)?.strokeArrayColor ?? undefined,\n cursor: (cellTheme?.group as any)?.cursor ?? undefined,\n\n lineCap: 'square',\n\n clip: true,\n\n cornerRadius: cellTheme.group.cornerRadius\n } as any);\n cellGroup.role = 'cell';\n cellGroup.col = col;\n cellGroup.row = row;\n columnGroup?.addChild(cellGroup);\n if (customElementsGroup) {\n cellGroup.appendChild(customElementsGroup);\n }\n if (renderDefault) {\n const textStr: string = value;\n let icons;\n if (mayHaveIcon) {\n let iconCol = col;\n let iconRow = row;\n if (range) {\n iconCol = range.start.col;\n iconRow = range.start.row;\n }\n icons = table.getCellIcons(iconCol, iconRow);\n }\n\n createCellContent(\n cellGroup,\n icons,\n textStr,\n padding as any,\n autoColWidth,\n autoRowHeight,\n autoWrapText,\n typeof lineClamp === 'number' ? lineClamp : undefined,\n // autoColWidth ? 0 : colWidth,\n // table.getRowHeight(row),\n cellWidth,\n cellHeight,\n textAlign,\n textBaseline,\n table,\n cellTheme,\n range\n );\n\n if ((cellTheme as any)?._vtable?.marked) {\n const mark = createArc({\n x: cellGroup.attribute.width,\n y: 0,\n startAngle: Math.PI / 2,\n endAngle: Math.PI,\n outerRadius: 6,\n fill: '#3073F2',\n pickable: false\n });\n mark.name = 'mark';\n\n cellGroup.appendChild(mark);\n }\n }\n if (customElementsGroup) {\n cellGroup.setAttributes({\n width: Math.max(cellGroup.attribute.width, customElementsGroup.attribute.width ?? 0),\n height: Math.max(cellGroup.attribute.height, customElementsGroup.attribute.height ?? 0)\n });\n }\n return cellGroup;\n}\n\n// /**\n// * @description: 获取函数式赋值的样式,记录在cellTheme中\n// * @param {BaseTableAPI} table\n// * @param {number} col\n// * @param {number} row\n// * @param {IThemeSpec} cellTheme\n// * @return {IThemeSpec | undefined}\n// */\n// export function getCellTheme(\n// table: BaseTableAPI,\n// col: number,\n// row: number,\n// cellTheme?: IThemeSpec\n// ): IThemeSpec | undefined {\n// // get column header style\n// const headerStyle = table._getCellStyle(col, row);\n\n// const theme = getStyleTheme(headerStyle, table, col, row, getFunctionalProp).theme;\n\n// for (const prop in theme.group) {\n// if (isValid(theme.group[prop])) {\n// if (!cellTheme) {\n// cellTheme = {};\n// }\n\n// if (!cellTheme.group) {\n// cellTheme.group = {};\n// }\n\n// cellTheme.group[prop] = theme.group[prop];\n// }\n// }\n\n// for (const prop in theme.text) {\n// if (isValid(theme.text[prop])) {\n// if (!cellTheme) {\n// cellTheme = {};\n// }\n\n// if (!cellTheme.text) {\n// cellTheme.text = {};\n// }\n\n// cellTheme.text[prop] = theme.text[prop];\n// }\n// }\n\n// for (const prop in theme._vtable) {\n// if (isValid(theme._vtable[prop])) {\n// if (!cellTheme) {\n// cellTheme = {};\n// }\n\n// if (!(cellTheme as any)._vtable) {\n// (cellTheme as any)._vtable = {};\n// }\n\n// (cellTheme as any)._vtable[prop] = theme._vtable[prop];\n// }\n// }\n// return cellTheme;\n// }\n"]}
|
|
@@ -10,24 +10,29 @@ import { dealPromiseData } from "../utils/deal-promise-data";
|
|
|
10
10
|
|
|
11
11
|
import { isArray } from "@visactor/vutils";
|
|
12
12
|
|
|
13
|
+
import { dealWithCustom } from "../component/custom";
|
|
14
|
+
|
|
13
15
|
export function createComplexColumn(columnGroup, col, colWidth, rowStart, rowEnd, mergeMap, defaultRowHeight, table, cellLocation, rowLimit) {
|
|
14
16
|
let padding, textAlign, textBaseline, y = 0;
|
|
15
17
|
columnGroup.lastChild && columnGroup.lastChild.row === rowStart - 1 ? y = columnGroup.lastChild.attribute.y + columnGroup.lastChild.attribute.height : columnGroup.colHeight && (y = columnGroup.colHeight);
|
|
16
18
|
for (let j = rowStart; j <= rowEnd; j++) {
|
|
17
|
-
const row = j
|
|
18
|
-
let range, isMerge, customStyle, value = table.getCellValue(col, row), cellWidth = colWidth, cellHeight = table.getRowHeight(row);
|
|
19
|
+
const row = j;
|
|
20
|
+
let range, isMerge, customStyle, customResult, value = table.getCellValue(col, row), cellWidth = colWidth, cellHeight = table.getRowHeight(row);
|
|
19
21
|
if (table.internalProps.customMergeCell) {
|
|
20
22
|
const customMerge = table.getCustomMerge(col, row);
|
|
21
23
|
if (customMerge) {
|
|
22
|
-
const {range: customMergeRange, text: customMergeText, style: customMergeStyle} = customMerge;
|
|
24
|
+
const {range: customMergeRange, text: customMergeText, style: customMergeStyle, customLayout: customLayout, customRender: customRender} = customMerge;
|
|
23
25
|
if (range = customMergeRange, isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row,
|
|
24
26
|
isMerge) {
|
|
25
27
|
const mergeSize = dealMerge(range, mergeMap, table);
|
|
26
28
|
cellWidth = mergeSize.cellWidth, cellHeight = mergeSize.cellHeight;
|
|
27
29
|
}
|
|
28
|
-
value = customMergeText, customStyle = customMergeStyle;
|
|
30
|
+
value = customMergeText, customStyle = customMergeStyle, (customLayout || customRender) && (customResult = dealWithCustom(customLayout, customRender, customMergeRange.start.col, customMergeRange.start.row, table.getColsWidth(customMergeRange.start.col, customMergeRange.end.col), table.getRowsHeight(customMergeRange.start.row, customMergeRange.end.row), !1, "autoHeight" === table.heightMode, [ 0, 0, 0, 0 ], table));
|
|
29
31
|
}
|
|
30
32
|
}
|
|
33
|
+
let colForDefine = col, rowForDefine = row;
|
|
34
|
+
range && (colForDefine = range.start.col, rowForDefine = range.start.row);
|
|
35
|
+
const define = "body" !== cellLocation ? table.getHeaderDefine(colForDefine, rowForDefine) : table.getBodyColumnDefine(colForDefine, rowForDefine), mayHaveIcon = "body" !== cellLocation || (!!(null == define ? void 0 : define.icon) || !!(null == define ? void 0 : define.tree));
|
|
31
36
|
if (!range && ("body" !== cellLocation || (null == define ? void 0 : define.mergeCell)) && (range = table.getCellRange(col, row),
|
|
32
37
|
isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row,
|
|
33
38
|
isMerge)) {
|
|
@@ -41,12 +46,12 @@ export function createComplexColumn(columnGroup, col, colWidth, rowStart, rowEnd
|
|
|
41
46
|
cellTheme.text.textBaseline && (textBaseline = cellTheme.text.textBaseline), "body" === cellLocation || cellTheme.group.fill || (cellTheme.group.fill = "#fff");
|
|
42
47
|
const type = (table.isHeader(col, row) ? table._getHeaderLayoutMap(col, row).headerType : table.getBodyColumnType(col, row)) || "text";
|
|
43
48
|
if (isPromise(value)) {
|
|
44
|
-
dealPromiseData(value, table, createCell.bind(null, type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme)),
|
|
49
|
+
dealPromiseData(value, table, createCell.bind(null, type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult)),
|
|
45
50
|
columnGroup.updateColumnRowNumber(row);
|
|
46
51
|
const height = table.getRowHeight(row);
|
|
47
52
|
columnGroup.updateColumnHeight(height), y += height;
|
|
48
53
|
} else {
|
|
49
|
-
const cellGroup = createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme);
|
|
54
|
+
const cellGroup = createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult);
|
|
50
55
|
if (columnGroup.updateColumnRowNumber(row), isMerge) {
|
|
51
56
|
const rangeHeight = table.getRowHeight(row), rangeWidth = table.getColWidth(col), {width: contentWidth} = cellGroup.attribute, {height: contentHeight} = cellGroup.attribute;
|
|
52
57
|
cellGroup.contentWidth = contentWidth, cellGroup.contentHeight = contentHeight,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/group-creater/column-helper.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAiB3C,MAAM,UAAU,mBAAmB,CACjC,WAAkB,EAClB,GAAW,EACX,QAAgB,EAChB,QAAgB,EAChB,MAAc,EACd,QAAkB,EAClB,gBAAmC,EACnC,KAAmB,EACnB,YAA0B,EAC1B,QAAiB;IAEjB,IAA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AAG,EAAE,CAAC,CAAC;IAC5G,IAAI,CAAC,WAAW,EAAE;QAChB,KAAK,IAAI,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YAC3D,SAAS,IAAI,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;SACrC;QAGD,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;YACrD,UAAU,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;SACrC;QAED,QAAQ,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE;YACtF,SAAS;YACT,UAAU;SACX,CAAC,CAAC;KACJ;SAAM;QACL,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC;QAClC,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC;KACrC;IACD,OAAO;QACL,SAAS;QACT,UAAU;KACX,CAAC;AACJ,CAAC","file":"column-helper.js","sourcesContent":["/* eslint-disable no-undef */\nimport type { IGraphic, IThemeSpec } from './../../vrender';\nimport type { CellLocation, CellRange, TextColumnDefine } from '../../ts-types';\nimport type { Group } from '../graphic/group';\nimport { getProp, getRawProp } from '../utils/get-prop';\nimport type { MergeMap } from '../scenegraph';\nimport { createCell } from './cell-helper';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport { getCellCornerRadius, getStyleTheme } from '../../core/tableHelper';\nimport { isPromise } from '../../tools/helper';\nimport { dealPromiseData } from '../utils/deal-promise-data';\nimport { isArray } from '@visactor/vutils';\n/**\n * 创建复合列 同一列支持创建不同类型单元格\n * @param columnGroup 列Group\n * @param col\n * @param colWidth 配置列宽\n * @param rowStart\n * @param rowEnd\n * @param mergeMap merge单元格信息\n * @param defaultRowHeight\n * @param table\n * @param cellLocation\n * @param rowLimit\n * @param customRender\n * @param customLayout\n * @returns\n */\nexport function createComplexColumn(\n columnGroup: Group,\n col: number,\n colWidth: number,\n rowStart: number,\n rowEnd: number,\n mergeMap: MergeMap,\n defaultRowHeight: number | number[],\n table: BaseTableAPI,\n cellLocation: CellLocation,\n rowLimit?: number\n) {\n let padding;\n let textAlign;\n let textBaseline;\n /** useColumnTheme 判断是否可以使用columnTheme */\n // insert cell into column group top\n let y = 0;\n // if (columnGroup.colHeight) {\n // // insert cell into column group bottom\n // y = columnGroup.colHeight;\n // }\n if (columnGroup.lastChild && (columnGroup.lastChild as Group).row === rowStart - 1) {\n y = (columnGroup.lastChild as Group).attribute.y + (columnGroup.lastChild as Group).attribute.height;\n } else if (columnGroup.colHeight) {\n y = columnGroup.colHeight;\n }\n\n for (let j = rowStart; j <= rowEnd; j++) {\n const row = j;\n const define = cellLocation !== 'body' ? table.getHeaderDefine(col, row) : table.getBodyColumnDefine(col, row);\n const mayHaveIcon = cellLocation !== 'body' ? true : !!define?.icon || !!define?.tree;\n let value = table.getCellValue(col, row);\n\n // 处理单元格合并\n let cellWidth = colWidth;\n // let cellHeight = table.internalProps.autoRowHeight ? 0 : table.getRowHeight(row);\n let cellHeight = table.getRowHeight(row);\n let range;\n let isMerge;\n let customStyle;\n if (table.internalProps.customMergeCell) {\n const customMerge = table.getCustomMerge(col, row);\n if (customMerge) {\n const { range: customMergeRange, text: customMergeText, style: customMergeStyle } = customMerge;\n range = customMergeRange;\n isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;\n if (isMerge) {\n const mergeSize = dealMerge(range, mergeMap, table);\n cellWidth = mergeSize.cellWidth;\n cellHeight = mergeSize.cellHeight;\n }\n value = customMergeText;\n customStyle = customMergeStyle;\n }\n }\n if (!range && (cellLocation !== 'body' || (define as TextColumnDefine)?.mergeCell)) {\n // 只有表头或者column配置合并单元格后再进行信息获取\n range = table.getCellRange(col, row);\n isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;\n // 所有Merge单元格,只保留左上角一个真实的单元格,其他使用空Group占位\n if (isMerge) {\n const mergeSize = dealMerge(range, mergeMap, table);\n cellWidth = mergeSize.cellWidth;\n cellHeight = mergeSize.cellHeight;\n }\n }\n\n const cellStyle = customStyle || table._getCellStyle(col, row);\n const cellTheme = getStyleTheme(\n cellStyle,\n table,\n range ? range.start.col : col,\n range ? range.start.row : row,\n getProp\n ).theme;\n cellTheme.group.cornerRadius = getCellCornerRadius(col, row, table);\n cellTheme.group.width = colWidth;\n cellTheme.group.height = Array.isArray(defaultRowHeight) ? defaultRowHeight[row] : defaultRowHeight;\n if (cellTheme._vtable.padding) {\n padding = cellTheme._vtable.padding;\n }\n if (cellTheme.text.textAlign) {\n textAlign = cellTheme.text.textAlign;\n }\n if (cellTheme.text.textBaseline) {\n textBaseline = cellTheme.text.textBaseline;\n }\n\n // enable clip body\n if (cellLocation !== 'body' && !cellTheme.group.fill) {\n cellTheme.group.fill = '#fff';\n }\n // margin = getProp('margin', headerStyle, col, 0, table)\n\n const type =\n (table.isHeader(col, row) ? table._getHeaderLayoutMap(col, row).headerType : table.getBodyColumnType(col, row)) ||\n 'text';\n\n // deal with promise data\n if (isPromise(value)) {\n dealPromiseData(\n value,\n table,\n createCell.bind(\n null,\n type,\n value,\n define,\n table,\n col,\n row,\n colWidth,\n cellWidth,\n cellHeight,\n columnGroup,\n y,\n padding,\n textAlign,\n textBaseline,\n mayHaveIcon,\n cellTheme\n )\n );\n columnGroup.updateColumnRowNumber(row);\n const height = table.getRowHeight(row);\n columnGroup.updateColumnHeight(height);\n y += height;\n } else {\n const cellGroup = createCell(\n type,\n value,\n define,\n table,\n col,\n row,\n colWidth,\n cellWidth,\n cellHeight,\n columnGroup,\n y,\n padding,\n textAlign,\n textBaseline,\n mayHaveIcon,\n cellTheme\n );\n columnGroup.updateColumnRowNumber(row);\n if (isMerge) {\n const rangeHeight = table.getRowHeight(row);\n const rangeWidth = table.getColWidth(col);\n\n const { width: contentWidth } = cellGroup.attribute;\n const { height: contentHeight } = cellGroup.attribute;\n cellGroup.contentWidth = contentWidth;\n cellGroup.contentHeight = contentHeight;\n\n resizeCellGroup(cellGroup, rangeWidth, rangeHeight, range, table);\n columnGroup.updateColumnHeight(rangeHeight);\n y += rangeHeight;\n } else {\n columnGroup.updateColumnHeight(cellGroup.attribute.height);\n y += cellGroup.attribute.height;\n }\n }\n if (rowLimit && row > rowLimit) {\n break;\n }\n }\n\n columnGroup.setAttribute('width', colWidth);\n return {\n width: colWidth,\n height: y\n };\n}\n\n/**\n * 获取列分组主题\n * @param col 列索引\n * @param colWidth 列宽\n * @param table 表格实例\n * @returns 列分组主题\n */\nexport function getColumnGroupTheme(\n col: number,\n colWidth: number,\n table: BaseTableAPI\n): { theme: IThemeSpec & { _vtable: any }; hasFunctionPros: boolean } {\n const style = table._getCellStyle(col, table.columnHeaderLevelCount); // to be fixed\n const { theme: columnTheme, hasFunctionPros } = getStyleTheme(\n style,\n table,\n col,\n table.columnHeaderLevelCount,\n getRawProp\n );\n\n // get column header style\n columnTheme.group.width = colWidth;\n columnTheme.group.height = 0;\n return { theme: columnTheme, hasFunctionPros };\n}\n\nexport function resizeCellGroup(\n cellGroup: Group,\n rangeWidth: number,\n rangeHeight: number,\n range: CellRange,\n table: BaseTableAPI\n) {\n const { col, row } = cellGroup;\n const dx = -table.getColsWidth(range.start.col, col - 1);\n const dy = -table.getRowsHeight(range.start.row, row - 1);\n\n cellGroup.forEachChildren((child: IGraphic) => {\n child.setAttributes({\n dx: (child.attribute.dx ?? 0) + dx,\n dy: (child.attribute.dy ?? 0) + dy\n });\n });\n\n const lineWidth = cellGroup.attribute.lineWidth;\n const isLineWidthArray = isArray(lineWidth);\n const newLineWidth = [0, 0, 0, 0];\n\n if (col === range.start.col) {\n newLineWidth[3] = isLineWidthArray ? lineWidth[3] : lineWidth;\n }\n if (row === range.start.row) {\n newLineWidth[0] = isLineWidthArray ? lineWidth[0] : lineWidth;\n }\n if (col === range.end.col) {\n newLineWidth[1] = isLineWidthArray ? lineWidth[1] : lineWidth;\n }\n if (row === range.end.row) {\n newLineWidth[2] = isLineWidthArray ? lineWidth[2] : lineWidth;\n }\n\n const widthChange = rangeWidth !== cellGroup.attribute.width;\n const heightChange = rangeHeight !== cellGroup.attribute.height;\n\n cellGroup.setAttributes({\n width: rangeWidth,\n height: rangeHeight,\n strokeArrayWidth: newLineWidth\n } as any);\n\n cellGroup.mergeStartCol = range.start.col;\n cellGroup.mergeStartRow = range.start.row;\n cellGroup.mergeEndCol = range.end.col;\n cellGroup.mergeEndRow = range.end.row;\n\n return {\n widthChange,\n heightChange\n };\n}\n\nfunction dealMerge(range: CellRange, mergeMap: MergeMap, table: BaseTableAPI) {\n let cellWidth = 0;\n let cellHeight = 0;\n const mergeResult = mergeMap.get(`${range.start.col},${range.start.row};${range.end.col},${range.end.row}`);\n if (!mergeResult) {\n for (let col = range.start.col; col <= range.end.col; col++) {\n cellWidth += table.getColWidth(col);\n }\n\n // let cellHeight = 0;\n for (let i = range.start.row; i <= range.end.row; i++) {\n cellHeight += table.getRowHeight(i);\n }\n\n mergeMap.set(`${range.start.col},${range.start.row};${range.end.col},${range.end.row}`, {\n cellWidth,\n cellHeight\n });\n } else {\n cellWidth = mergeResult.cellWidth;\n cellHeight = mergeResult.cellHeight;\n }\n return {\n cellWidth,\n cellHeight\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/group-creater/column-helper.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAA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AAI,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YAC3D,SAAS,IAAI,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;SACrC;QAGD,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;YACrD,UAAU,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;SACrC;QAED,QAAQ,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE;YACtF,SAAS;YACT,UAAU;SACX,CAAC,CAAC;KACJ;SAAM;QACL,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC;QAClC,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC;KACrC;IACD,OAAO;QACL,SAAS;QACT,UAAU;KACX,CAAC;AACJ,CAAC","file":"column-helper.js","sourcesContent":["/* eslint-disable no-undef */\nimport type { IGraphic, IThemeSpec } from './../../vrender';\nimport type { CellLocation, CellRange, TextColumnDefine } from '../../ts-types';\nimport type { Group } from '../graphic/group';\nimport { getProp, getRawProp } from '../utils/get-prop';\nimport type { MergeMap } from '../scenegraph';\nimport { createCell } from './cell-helper';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport { getCellCornerRadius, getStyleTheme } from '../../core/tableHelper';\nimport { isPromise } from '../../tools/helper';\nimport { dealPromiseData } from '../utils/deal-promise-data';\nimport { isArray } from '@visactor/vutils';\nimport { dealWithCustom } from '../component/custom';\n/**\n * 创建复合列 同一列支持创建不同类型单元格\n * @param columnGroup 列Group\n * @param col\n * @param colWidth 配置列宽\n * @param rowStart\n * @param rowEnd\n * @param mergeMap merge单元格信息\n * @param defaultRowHeight\n * @param table\n * @param cellLocation\n * @param rowLimit\n * @param customRender\n * @param customLayout\n * @returns\n */\nexport function createComplexColumn(\n columnGroup: Group,\n col: number,\n colWidth: number,\n rowStart: number,\n rowEnd: number,\n mergeMap: MergeMap,\n defaultRowHeight: number | number[],\n table: BaseTableAPI,\n cellLocation: CellLocation,\n rowLimit?: number\n) {\n let padding;\n let textAlign;\n let textBaseline;\n /** useColumnTheme 判断是否可以使用columnTheme */\n // insert cell into column group top\n let y = 0;\n // if (columnGroup.colHeight) {\n // // insert cell into column group bottom\n // y = columnGroup.colHeight;\n // }\n if (columnGroup.lastChild && (columnGroup.lastChild as Group).row === rowStart - 1) {\n y = (columnGroup.lastChild as Group).attribute.y + (columnGroup.lastChild as Group).attribute.height;\n } else if (columnGroup.colHeight) {\n y = columnGroup.colHeight;\n }\n\n for (let j = rowStart; j <= rowEnd; j++) {\n const row = j;\n let value = table.getCellValue(col, row);\n\n // 处理单元格合并\n let cellWidth = colWidth;\n // let cellHeight = table.internalProps.autoRowHeight ? 0 : table.getRowHeight(row);\n let cellHeight = table.getRowHeight(row);\n let range;\n let isMerge;\n let customStyle;\n let customResult;\n if (table.internalProps.customMergeCell) {\n const customMerge = table.getCustomMerge(col, row);\n if (customMerge) {\n const {\n range: customMergeRange,\n text: customMergeText,\n style: customMergeStyle,\n customLayout,\n customRender\n } = customMerge;\n range = customMergeRange;\n isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;\n if (isMerge) {\n const mergeSize = dealMerge(range, mergeMap, table);\n cellWidth = mergeSize.cellWidth;\n cellHeight = mergeSize.cellHeight;\n }\n value = customMergeText;\n customStyle = customMergeStyle;\n\n if (customLayout || customRender) {\n customResult = dealWithCustom(\n customLayout,\n customRender,\n customMergeRange.start.col,\n customMergeRange.start.row,\n table.getColsWidth(customMergeRange.start.col, customMergeRange.end.col),\n table.getRowsHeight(customMergeRange.start.row, customMergeRange.end.row),\n false,\n table.heightMode === 'autoHeight',\n [0, 0, 0, 0],\n table\n );\n }\n }\n }\n\n let colForDefine = col;\n let rowForDefine = row;\n if (range) {\n colForDefine = range.start.col;\n rowForDefine = range.start.row;\n }\n const define =\n cellLocation !== 'body'\n ? table.getHeaderDefine(colForDefine, rowForDefine)\n : table.getBodyColumnDefine(colForDefine, rowForDefine);\n const mayHaveIcon = cellLocation !== 'body' ? true : !!define?.icon || !!define?.tree;\n\n if (!range && (cellLocation !== 'body' || (define as TextColumnDefine)?.mergeCell)) {\n // 只有表头或者column配置合并单元格后再进行信息获取\n range = table.getCellRange(col, row);\n isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;\n // 所有Merge单元格,只保留左上角一个真实的单元格,其他使用空Group占位\n if (isMerge) {\n const mergeSize = dealMerge(range, mergeMap, table);\n cellWidth = mergeSize.cellWidth;\n cellHeight = mergeSize.cellHeight;\n }\n }\n\n const cellStyle = customStyle || table._getCellStyle(col, row);\n const cellTheme = getStyleTheme(\n cellStyle,\n table,\n range ? range.start.col : col,\n range ? range.start.row : row,\n getProp\n ).theme;\n cellTheme.group.cornerRadius = getCellCornerRadius(col, row, table);\n cellTheme.group.width = colWidth;\n cellTheme.group.height = Array.isArray(defaultRowHeight) ? defaultRowHeight[row] : defaultRowHeight;\n if (cellTheme._vtable.padding) {\n padding = cellTheme._vtable.padding;\n }\n if (cellTheme.text.textAlign) {\n textAlign = cellTheme.text.textAlign;\n }\n if (cellTheme.text.textBaseline) {\n textBaseline = cellTheme.text.textBaseline;\n }\n\n // enable clip body\n if (cellLocation !== 'body' && !cellTheme.group.fill) {\n cellTheme.group.fill = '#fff';\n }\n // margin = getProp('margin', headerStyle, col, 0, table)\n\n const type =\n (table.isHeader(col, row) ? table._getHeaderLayoutMap(col, row).headerType : table.getBodyColumnType(col, row)) ||\n 'text';\n\n // deal with promise data\n if (isPromise(value)) {\n dealPromiseData(\n value,\n table,\n createCell.bind(\n null,\n type,\n value,\n define,\n table,\n col,\n row,\n colWidth,\n cellWidth,\n cellHeight,\n columnGroup,\n y,\n padding,\n textAlign,\n textBaseline,\n mayHaveIcon,\n cellTheme,\n range,\n customResult\n )\n );\n columnGroup.updateColumnRowNumber(row);\n const height = table.getRowHeight(row);\n columnGroup.updateColumnHeight(height);\n y += height;\n } else {\n const cellGroup = createCell(\n type,\n value,\n define,\n table,\n col,\n row,\n colWidth,\n cellWidth,\n cellHeight,\n columnGroup,\n y,\n padding,\n textAlign,\n textBaseline,\n mayHaveIcon,\n cellTheme,\n range,\n customResult\n );\n columnGroup.updateColumnRowNumber(row);\n if (isMerge) {\n const rangeHeight = table.getRowHeight(row);\n const rangeWidth = table.getColWidth(col);\n\n const { width: contentWidth } = cellGroup.attribute;\n const { height: contentHeight } = cellGroup.attribute;\n cellGroup.contentWidth = contentWidth;\n cellGroup.contentHeight = contentHeight;\n\n resizeCellGroup(cellGroup, rangeWidth, rangeHeight, range, table);\n columnGroup.updateColumnHeight(rangeHeight);\n y += rangeHeight;\n } else {\n columnGroup.updateColumnHeight(cellGroup.attribute.height);\n y += cellGroup.attribute.height;\n }\n }\n if (rowLimit && row > rowLimit) {\n break;\n }\n }\n\n columnGroup.setAttribute('width', colWidth);\n return {\n width: colWidth,\n height: y\n };\n}\n\n/**\n * 获取列分组主题\n * @param col 列索引\n * @param colWidth 列宽\n * @param table 表格实例\n * @returns 列分组主题\n */\nexport function getColumnGroupTheme(\n col: number,\n colWidth: number,\n table: BaseTableAPI\n): { theme: IThemeSpec & { _vtable: any }; hasFunctionPros: boolean } {\n const style = table._getCellStyle(col, table.columnHeaderLevelCount); // to be fixed\n const { theme: columnTheme, hasFunctionPros } = getStyleTheme(\n style,\n table,\n col,\n table.columnHeaderLevelCount,\n getRawProp\n );\n\n // get column header style\n columnTheme.group.width = colWidth;\n columnTheme.group.height = 0;\n return { theme: columnTheme, hasFunctionPros };\n}\n\nexport function resizeCellGroup(\n cellGroup: Group,\n rangeWidth: number,\n rangeHeight: number,\n range: CellRange,\n table: BaseTableAPI\n) {\n const { col, row } = cellGroup;\n const dx = -table.getColsWidth(range.start.col, col - 1);\n const dy = -table.getRowsHeight(range.start.row, row - 1);\n\n cellGroup.forEachChildren((child: IGraphic) => {\n child.setAttributes({\n dx: (child.attribute.dx ?? 0) + dx,\n dy: (child.attribute.dy ?? 0) + dy\n });\n });\n\n const lineWidth = cellGroup.attribute.lineWidth;\n const isLineWidthArray = isArray(lineWidth);\n const newLineWidth = [0, 0, 0, 0];\n\n if (col === range.start.col) {\n newLineWidth[3] = isLineWidthArray ? lineWidth[3] : lineWidth;\n }\n if (row === range.start.row) {\n newLineWidth[0] = isLineWidthArray ? lineWidth[0] : lineWidth;\n }\n if (col === range.end.col) {\n newLineWidth[1] = isLineWidthArray ? lineWidth[1] : lineWidth;\n }\n if (row === range.end.row) {\n newLineWidth[2] = isLineWidthArray ? lineWidth[2] : lineWidth;\n }\n\n const widthChange = rangeWidth !== cellGroup.attribute.width;\n const heightChange = rangeHeight !== cellGroup.attribute.height;\n\n cellGroup.setAttributes({\n width: rangeWidth,\n height: rangeHeight,\n strokeArrayWidth: newLineWidth\n } as any);\n\n cellGroup.mergeStartCol = range.start.col;\n cellGroup.mergeStartRow = range.start.row;\n cellGroup.mergeEndCol = range.end.col;\n cellGroup.mergeEndRow = range.end.row;\n\n return {\n widthChange,\n heightChange\n };\n}\n\nfunction dealMerge(range: CellRange, mergeMap: MergeMap, table: BaseTableAPI) {\n let cellWidth = 0;\n let cellHeight = 0;\n const mergeResult = mergeMap.get(`${range.start.col},${range.start.row};${range.end.col},${range.end.row}`);\n if (!mergeResult) {\n for (let col = range.start.col; col <= range.end.col; col++) {\n cellWidth += table.getColWidth(col);\n }\n\n // let cellHeight = 0;\n for (let i = range.start.row; i <= range.end.row; i++) {\n cellHeight += table.getRowHeight(i);\n }\n\n mergeMap.set(`${range.start.col},${range.start.row};${range.end.col},${range.end.row}`, {\n cellWidth,\n cellHeight\n });\n } else {\n cellWidth = mergeResult.cellWidth;\n cellHeight = mergeResult.cellHeight;\n }\n return {\n cellWidth,\n cellHeight\n };\n}\n"]}
|
|
@@ -30,15 +30,22 @@ import { updateColContent } from "./dynamic-set-x";
|
|
|
30
30
|
|
|
31
31
|
export function sortHorizontal(proxy) {
|
|
32
32
|
return __awaiter(this, void 0, void 0, (function*() {
|
|
33
|
-
proxy.table.scenegraph.
|
|
34
|
-
"group" === colGroup.type && (colGroup.needUpdate = !0, null == colGroup || colGroup.forEachChildren((cellGroup => {
|
|
35
|
-
cellGroup.needUpdate = !0;
|
|
36
|
-
})));
|
|
37
|
-
})), proxy.table.scenegraph.bodyGroup.forEachChildren(((colGroup, index) => {
|
|
33
|
+
proxy.table.scenegraph.bodyGroup.forEachChildren(((colGroup, index) => {
|
|
38
34
|
"group" === colGroup.type && (colGroup.needUpdate = !0, null == colGroup || colGroup.forEachChildren((cellGroup => {
|
|
39
35
|
cellGroup.needUpdate = !0;
|
|
40
36
|
})));
|
|
41
37
|
}));
|
|
38
|
+
for (let col = proxy.colStart; col <= proxy.colEnd; col++) {
|
|
39
|
+
const columnGroup = proxy.table.scenegraph.getColGroup(col);
|
|
40
|
+
null == columnGroup || columnGroup.setAttribute("chartInstance", void 0);
|
|
41
|
+
for (let row = proxy.table.rowCount - proxy.table.bottomFrozenRowCount; row < proxy.table.rowCount; row++) proxy.table.scenegraph.updateCellContent(col, row);
|
|
42
|
+
}
|
|
43
|
+
for (let col = proxy.table.colCount - proxy.table.rightFrozenColCount; col < proxy.table.colCount; col++) {
|
|
44
|
+
const columnGroup = proxy.table.scenegraph.getColGroup(col);
|
|
45
|
+
null == columnGroup || columnGroup.setAttribute("chartInstance", void 0);
|
|
46
|
+
for (let row = proxy.rowStart; row <= proxy.rowEnd; row++) proxy.table.scenegraph.updateCellContent(col, row);
|
|
47
|
+
for (let row = proxy.table.rowCount - proxy.table.bottomFrozenRowCount; row < proxy.table.rowCount; row++) proxy.table.scenegraph.updateCellContent(col, row);
|
|
48
|
+
}
|
|
42
49
|
const syncLeftCol = Math.max(proxy.bodyLeftCol, proxy.screenLeftCol - 1 * proxy.screenColCount), syncRightCol = Math.min(proxy.bodyRightCol, proxy.screenLeftCol + 2 * proxy.screenColCount);
|
|
43
50
|
computeColsWidth(proxy.table, syncLeftCol, syncRightCol), updateColContent(syncLeftCol, syncRightCol, proxy),
|
|
44
51
|
proxy.colUpdatePos = proxy.colStart, proxy.colUpdateDirection = proxy.colEnd > proxy.bodyRightCol - (proxy.colEnd - proxy.colStart + 1) ? "right" : "left",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/group-creater/progress/update-position/sort-horizontal.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGnD,MAAM,UAAgB,cAAc,CAAC,KAAiB;;
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/group-creater/progress/update-position/sort-horizontal.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGnD,MAAM,UAAgB,cAAc,CAAC,KAAiB;;QAEpD,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,QAAe,EAAE,KAAa,EAAE,EAAE;YAClF,IAAI,QAAQ,CAAC,IAAI,KAAK,OAAO,EAAE;gBAC7B,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAC;gBAC3B,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,eAAe,CAAC,CAAC,SAAgB,EAAE,EAAE;oBAC5C,SAAiB,CAAC,UAAU,GAAG,IAAI,CAAC;gBACvC,CAAC,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;QACH,KAAK,IAAI,GAAG,GAAG,KAAK,C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G,EAAE,EAAE;gBACzG,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;aACpD;SACF;QAED,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC;QAChG,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC;QAElG,gBAAgB,CAAC,KAAK,CAAC,KAAK,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;QAEzD,gBAAgB,CAAC,WAAW,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;QASnD,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC,QAAQ,CAAC;QACpC,KAAK,CAAC,kBAAkB,GAAG,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,YAAY,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;QAiBtH,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC;QACzC,MAAM,KAAK,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;CAAA","file":"sort-horizontal.js","sourcesContent":["import type { Group } from '../../../graphic/group';\nimport { computeColsWidth } from '../../../layout/compute-col-width';\nimport type { SceneProxy } from '../proxy';\nimport { updateColContent } from './dynamic-set-x';\nimport { updateAutoColumn } from './update-auto-column';\n\nexport async function sortHorizontal(proxy: SceneProxy) {\n // 更新左 中 右 左下 底部 右下 部分的单元格需更新标记\n proxy.table.scenegraph.bodyGroup.forEachChildren((colGroup: Group, index: number) => {\n if (colGroup.type === 'group') {\n colGroup.needUpdate = true;\n colGroup?.forEachChildren((cellGroup: Group) => {\n (cellGroup as any).needUpdate = true;\n });\n }\n });\n for (let col = proxy.colStart; col <= proxy.colEnd; col++) {\n // 将该列的chartInstance清除掉\n const columnGroup = proxy.table.scenegraph.getColGroup(col);\n columnGroup?.setAttribute('chartInstance', undefined);\n for (let row = proxy.table.rowCount - proxy.table.bottomFrozenRowCount; row < proxy.table.rowCount; row++) {\n proxy.table.scenegraph.updateCellContent(col, row);\n }\n }\n for (let col = proxy.table.colCount - proxy.table.rightFrozenColCount; col < proxy.table.colCount; col++) {\n // 将该列的chartInstance清除掉\n const columnGroup = proxy.table.scenegraph.getColGroup(col);\n columnGroup?.setAttribute('chartInstance', undefined);\n for (let row = proxy.rowStart; row <= proxy.rowEnd; row++) {\n proxy.table.scenegraph.updateCellContent(col, row);\n }\n for (let row = proxy.table.rowCount - proxy.table.bottomFrozenRowCount; row < proxy.table.rowCount; row++) {\n proxy.table.scenegraph.updateCellContent(col, row);\n }\n }\n // 更新同步范围\n const syncLeftCol = Math.max(proxy.bodyLeftCol, proxy.screenLeftCol - proxy.screenColCount * 1);\n const syncRightCol = Math.min(proxy.bodyRightCol, proxy.screenLeftCol + proxy.screenColCount * 2);\n\n computeColsWidth(proxy.table, syncLeftCol, syncRightCol);\n\n updateColContent(syncLeftCol, syncRightCol, proxy);\n\n // updateAutoColumn(\n // syncLeftCol, // colStart\n // syncRightCol, // colEnd\n // proxy.table,\n // proxy.colEnd > proxy.bodyRightCol - (proxy.colEnd - proxy.colStart + 1) ? 'right' : 'left' // 跳转到右侧时,从右向左对齐\n // );\n\n proxy.colUpdatePos = proxy.colStart;\n proxy.colUpdateDirection = proxy.colEnd > proxy.bodyRightCol - (proxy.colEnd - proxy.colStart + 1) ? 'right' : 'left';\n\n // if (\n // proxy.colEnd === proxy.table.scenegraph.proxy.bodyRightCol &&\n // proxy.colStart === proxy.table.scenegraph.proxy.bodyLeftCol\n // ) {\n // // 全量更新,do nothing\n // } else if (proxy.colEnd === proxy.table.scenegraph.proxy.bodyRightCol) {\n // const totalWidth = proxy.table.getAllColsWidth();\n // const left = totalWidth - proxy.table.scenegraph.width;\n // // proxy.updateBody(top);\n // proxy.table.scenegraph.setBodyAndColHeaderX(-left);\n // } else if (proxy.colStart === proxy.table.scenegraph.proxy.bodyLeftCol) {\n // // proxy.updateBody(0);\n // proxy.table.scenegraph.setBodyAndColHeaderX(0);\n // }\n\n proxy.table.scenegraph.updateNextFrame();\n await proxy.progress();\n}\n"]}
|
|
@@ -31,24 +31,29 @@ import { updateRowContent } from "./dynamic-set-y";
|
|
|
31
31
|
import { updateAutoRow } from "./update-auto-row";
|
|
32
32
|
|
|
33
33
|
export function sortVertical(proxy) {
|
|
34
|
+
var _a;
|
|
34
35
|
return __awaiter(this, void 0, void 0, (function*() {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
null == colGroup || colGroup.forEachChildren(((cellGroup, index) => {
|
|
36
|
+
proxy.table.scenegraph.bodyGroup.forEachChildren(((colGroup, index) => {
|
|
37
|
+
"group" === colGroup.type && (colGroup.needUpdate = !0, null == colGroup || colGroup.forEachChildren((cellGroup => {
|
|
38
38
|
cellGroup.needUpdate = !0;
|
|
39
|
-
}));
|
|
39
|
+
})));
|
|
40
|
+
}));
|
|
41
|
+
for (let col = 0; null !== (_a = col < proxy.table.frozenColCount) && void 0 !== _a && _a; col++) {
|
|
42
|
+
const columnGroup = proxy.table.scenegraph.getColGroup(col);
|
|
43
|
+
null == columnGroup || columnGroup.setAttribute("chartInstance", void 0);
|
|
44
|
+
for (let row = proxy.rowStart; row <= proxy.rowEnd; row++) proxy.table.scenegraph.updateCellContent(col, row);
|
|
45
|
+
for (let row = proxy.table.rowCount - proxy.table.bottomFrozenRowCount; row < proxy.table.rowCount; row++) proxy.table.scenegraph.updateCellContent(col, row);
|
|
40
46
|
}
|
|
41
|
-
for (let col = proxy.
|
|
42
|
-
const
|
|
43
|
-
null ==
|
|
44
|
-
|
|
45
|
-
}));
|
|
47
|
+
for (let col = proxy.colStart; col <= proxy.colEnd; col++) {
|
|
48
|
+
const columnGroup = proxy.table.scenegraph.getColGroup(col);
|
|
49
|
+
null == columnGroup || columnGroup.setAttribute("chartInstance", void 0);
|
|
50
|
+
for (let row = proxy.table.rowCount - proxy.table.bottomFrozenRowCount; row < proxy.table.rowCount; row++) proxy.table.scenegraph.updateCellContent(col, row);
|
|
46
51
|
}
|
|
47
|
-
for (let col = proxy.
|
|
48
|
-
const
|
|
49
|
-
null ==
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
for (let col = proxy.table.colCount - proxy.table.rightFrozenColCount; col < proxy.table.colCount; col++) {
|
|
53
|
+
const columnGroup = proxy.table.scenegraph.getColGroup(col);
|
|
54
|
+
null == columnGroup || columnGroup.setAttribute("chartInstance", void 0);
|
|
55
|
+
for (let row = proxy.rowStart; row <= proxy.rowEnd; row++) proxy.table.scenegraph.updateCellContent(col, row);
|
|
56
|
+
for (let row = proxy.table.rowCount - proxy.table.bottomFrozenRowCount; row < proxy.table.rowCount; row++) proxy.table.scenegraph.updateCellContent(col, row);
|
|
52
57
|
}
|
|
53
58
|
let syncTopRow, syncBottomRow;
|
|
54
59
|
"autoHeight" === proxy.table.heightMode ? (syncTopRow = proxy.rowStart, syncBottomRow = proxy.rowEnd) : (syncTopRow = Math.max(proxy.bodyTopRow, proxy.screenTopRow - 1 * proxy.screenRowCount),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/group-creater/progress/update-position/sort-vertical.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAEvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,UAAgB,YAAY,CAAC,KAAiB
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/group-creater/progress/update-position/sort-vertical.ts"],"names":[],"mappings":";;;;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AAI,CACzF,CAAC;SACH;QACD,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC,QAAQ,CAAC;QACpC,KAAK,CAAC,kBAAkB,GAAG,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,aAAa,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;QAepH,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC;QACzC,IAAI,KAAK,CAAC,KAAK,CAAC,UAAU,KAAK,YAAY,EAAE;YAC3C,MAAM,KAAK,CAAC,QAAQ,EAAE,CAAC;SACxB;;CACF","file":"sort-vertical.js","sourcesContent":["import type { Group } from '../../../graphic/group';\nimport { computeRowsHeight } from '../../../layout/compute-row-height';\nimport type { SceneProxy } from '../proxy';\nimport { updateRowContent } from './dynamic-set-y';\nimport { updateAutoRow } from './update-auto-row';\n\nexport async function sortVertical(proxy: SceneProxy) {\n // 更新左 中 右 左下 底部 右下 部分的单元格需更新标记\n proxy.table.scenegraph.bodyGroup.forEachChildren((colGroup: Group, index: number) => {\n if (colGroup.type === 'group') {\n colGroup.needUpdate = true;\n colGroup?.forEachChildren((cellGroup: Group) => {\n (cellGroup as any).needUpdate = true;\n });\n }\n });\n\n for (let col = 0; col < proxy.table.frozenColCount ?? 0; col++) {\n // 将该列的chartInstance清除掉\n const columnGroup = proxy.table.scenegraph.getColGroup(col);\n columnGroup?.setAttribute('chartInstance', undefined);\n for (let row = proxy.rowStart; row <= proxy.rowEnd; row++) {\n proxy.table.scenegraph.updateCellContent(col, row);\n }\n for (let row = proxy.table.rowCount - proxy.table.bottomFrozenRowCount; row < proxy.table.rowCount; row++) {\n proxy.table.scenegraph.updateCellContent(col, row);\n }\n }\n for (let col = proxy.colStart; col <= proxy.colEnd; col++) {\n // 将该列的chartInstance清除掉\n const columnGroup = proxy.table.scenegraph.getColGroup(col);\n columnGroup?.setAttribute('chartInstance', undefined);\n for (let row = proxy.table.rowCount - proxy.table.bottomFrozenRowCount; row < proxy.table.rowCount; row++) {\n proxy.table.scenegraph.updateCellContent(col, row);\n }\n }\n for (let col = proxy.table.colCount - proxy.table.rightFrozenColCount; col < proxy.table.colCount; col++) {\n // 将该列的chartInstance清除掉\n const columnGroup = proxy.table.scenegraph.getColGroup(col);\n columnGroup?.setAttribute('chartInstance', undefined);\n for (let row = proxy.rowStart; row <= proxy.rowEnd; row++) {\n proxy.table.scenegraph.updateCellContent(col, row);\n }\n for (let row = proxy.table.rowCount - proxy.table.bottomFrozenRowCount; row < proxy.table.rowCount; row++) {\n proxy.table.scenegraph.updateCellContent(col, row);\n }\n }\n\n // 更新同步范围\n let syncTopRow;\n let syncBottomRow;\n if (proxy.table.heightMode === 'autoHeight') {\n syncTopRow = proxy.rowStart;\n syncBottomRow = proxy.rowEnd;\n } else {\n syncTopRow = Math.max(proxy.bodyTopRow, proxy.screenTopRow - proxy.screenRowCount * 1);\n syncBottomRow = Math.min(proxy.bodyBottomRow, proxy.screenTopRow + proxy.screenRowCount * 2);\n }\n // console.log('sort更新同步范围', syncTopRow, syncBottomRow);\n\n computeRowsHeight(proxy.table, syncTopRow, syncBottomRow);\n\n updateRowContent(syncTopRow, syncBottomRow, proxy);\n\n if (proxy.table.heightMode === 'autoHeight') {\n updateAutoRow(\n proxy.bodyLeftCol, // colStart\n proxy.bodyRightCol, // colEnd\n syncTopRow, // rowStart\n syncBottomRow, // rowEnd\n proxy.table,\n proxy.rowEnd > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up' // 跳转到底部时,从下向上对齐\n );\n }\n proxy.rowUpdatePos = proxy.rowStart;\n proxy.rowUpdateDirection = proxy.rowEnd > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up';\n\n // if (\n // proxy.rowEnd === proxy.table.scenegraph.proxy.bodyBottomRow &&\n // proxy.rowStart === proxy.table.scenegraph.proxy.bodyTopRow\n // ) {\n // // 全量更新,do nothing\n // } else if (proxy.rowEnd === proxy.table.scenegraph.proxy.bodyBottomRow) {\n // const totalHeight = proxy.table.getAllRowsHeight();\n // const top = totalHeight - proxy.table.scenegraph.height;\n // proxy.updateBody(top);\n // } else if (proxy.rowStart === proxy.table.scenegraph.proxy.bodyTopRow) {\n // proxy.updateBody(0);\n // }\n\n proxy.table.scenegraph.updateNextFrame();\n if (proxy.table.heightMode !== 'autoHeight') {\n await proxy.progress();\n }\n}\n"]}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type { BaseTableAPI } from '../../ts-types/base-table';
|
|
2
|
-
|
|
2
|
+
import type { CellRange } from '../../ts-types';
|
|
3
|
+
export declare function moveHeaderPosition(colSource: number, rowSource: number, colTarget: number, rowTarget: number, sourceMergeInfo: false | CellRange, targetMergeInfo: false | CellRange, table: BaseTableAPI): void;
|
|
@@ -1,25 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export function moveHeaderPosition(colSource, rowSource, colTarget, rowTarget, table) {
|
|
1
|
+
export function moveHeaderPosition(colSource, rowSource, colTarget, rowTarget, sourceMergeInfo, targetMergeInfo, table) {
|
|
4
2
|
const scene = table.scenegraph, cellLocation = table.getCellLocation(colTarget, rowTarget), direction = "columnHeader" === cellLocation ? "column" : "rowHeader" === cellLocation ? "row" : void 0;
|
|
5
3
|
let sourceColStart = 0, sourceRowStart = 0, sourceColEnd = 0, sourceRowEnd = 0, targetColStart = 0, targetRowStart = 0, targetColEnd = 0, targetRowEnd = 0;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
sourceRowEnd = sourceMergeInfo.end.row, targetRowStart = targetMergeInfo.start.row,
|
|
18
|
-
targetRowEnd = targetMergeInfo.end.row, sourceColStart = sourceMergeInfo.start.col,
|
|
19
|
-
targetColStart = targetMergeInfo.start.col) : (sourceRowStart = rowSource, sourceRowEnd = rowSource,
|
|
20
|
-
targetRowStart = rowTarget, targetRowEnd = rowTarget, sourceColStart = colSource,
|
|
21
|
-
targetColStart = colTarget), sourceColEnd = table.colCount - 1, targetColEnd = table.colCount - 1;
|
|
22
|
-
}
|
|
4
|
+
"column" === direction ? (sourceMergeInfo && targetMergeInfo ? (sourceColStart = sourceMergeInfo.start.col,
|
|
5
|
+
sourceColEnd = sourceMergeInfo.end.col, targetColStart = targetMergeInfo.start.col,
|
|
6
|
+
targetColEnd = targetMergeInfo.end.col, sourceRowStart = sourceMergeInfo.start.row,
|
|
7
|
+
targetRowStart = targetMergeInfo.start.row) : (sourceColStart = colSource, sourceColEnd = colSource,
|
|
8
|
+
targetColStart = colTarget, targetColEnd = colTarget, sourceRowStart = rowSource,
|
|
9
|
+
targetRowStart = rowTarget), sourceRowEnd = table.rowCount - 1, targetRowEnd = table.rowCount - 1) : "row" === direction && (sourceMergeInfo && targetMergeInfo ? (sourceRowStart = sourceMergeInfo.start.row,
|
|
10
|
+
sourceRowEnd = sourceMergeInfo.end.row, targetRowStart = targetMergeInfo.start.row,
|
|
11
|
+
targetRowEnd = targetMergeInfo.end.row, sourceColStart = sourceMergeInfo.start.col,
|
|
12
|
+
targetColStart = targetMergeInfo.start.col) : (sourceRowStart = rowSource, sourceRowEnd = rowSource,
|
|
13
|
+
targetRowStart = rowTarget, targetRowEnd = rowTarget, sourceColStart = colSource,
|
|
14
|
+
targetColStart = colTarget), sourceColEnd = table.colCount - 1, targetColEnd = table.colCount - 1);
|
|
23
15
|
const updateColStart = Math.min(sourceColStart, targetColStart), updateColEnd = Math.max(sourceColEnd, targetColEnd), updateRowStart = Math.min(sourceRowStart, targetRowStart), updateRowEnd = Math.max(sourceRowEnd, targetRowEnd);
|
|
24
16
|
for (let col = updateColStart; col <= updateColEnd; col++) {
|
|
25
17
|
const columnWidth = table.getColWidth(col), columnHeaderGroup = table.scenegraph.getColGroup(col, !0), columnGroup = table.scenegraph.getColGroup(col), columnBottomGroup = table.scenegraph.getColGroupInBottom(col);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/layout/move-cell.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,UAAU,kBAAkB,CAChC,SAAiB,EACjB,SAAiB,EACjB,SAAiB,EACjB,SAAiB,EACjB,KAAmB;IAEnB,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC;IAG/B,MAAM,YAAY,GAAG,KAAK,CAAC,eAAe,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACjE,MAAM,SAAS,GAAG,YAAY,KAAK,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAEhH,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,IAAI,SAAS,KAAK,QAAQ,EAAE;QAC1B,MAAM,eAAe,GAAG,gBAAgB,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;QACtE,MAAM,eAAe,GAAG,gBAAgB,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;QACtE,IAAI,eAAe,IAAI,eAAe,EAAE;YACtC,cAAc,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC;YAC3C,YAAY,GAAG,eAAe,CAAC,GAAG,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C,eAAe,EAAE,SAAS,CAAC,CAAC;YACtD,KAAK,IAAI,GAAG,GAAG,cAAc,EAAE,GAAG,IAAI,YAAY,EAAE,GAAG,EAAE,EAAE;gBACzD,KAAK,CAAC,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;aACnC;SACF;KACF;AACH,CAAC","file":"move-cell.js","sourcesContent":["import type { Group } from './../../vrender';\nimport { getCellMergeInfo } from '../utils/get-cell-merge';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nexport function moveHeaderPosition(\n colSource: number,\n rowSource: number,\n colTarget: number,\n rowTarget: number,\n table: BaseTableAPI\n) {\n const scene = table.scenegraph;\n\n // 判断方向\n const cellLocation = table.getCellLocation(colTarget, rowTarget);\n const direction = cellLocation === 'columnHeader' ? 'column' : cellLocation === 'rowHeader' ? 'row' : undefined;\n\n let sourceColStart = 0;\n let sourceRowStart = 0;\n let sourceColEnd = 0;\n let sourceRowEnd = 0;\n let targetColStart = 0;\n let targetRowStart = 0;\n let targetColEnd = 0;\n let targetRowEnd = 0;\n if (direction === 'column') {\n const sourceMergeInfo = getCellMergeInfo(table, colSource, rowSource);\n const targetMergeInfo = getCellMergeInfo(table, colTarget, rowTarget);\n if (sourceMergeInfo && targetMergeInfo) {\n sourceColStart = sourceMergeInfo.start.col;\n sourceColEnd = sourceMergeInfo.end.col;\n targetColStart = targetMergeInfo.start.col;\n targetColEnd = targetMergeInfo.end.col;\n\n sourceRowStart = sourceMergeInfo.start.row;\n targetRowStart = targetMergeInfo.start.row;\n } else {\n sourceColStart = colSource;\n sourceColEnd = colSource;\n targetColStart = colTarget;\n targetColEnd = colTarget;\n\n sourceRowStart = rowSource;\n targetRowStart = rowTarget;\n }\n // sourceRowStart = rowSource;\n sourceRowEnd = table.rowCount - 1;\n // targetRowStart = rowTarget;\n targetRowEnd = table.rowCount - 1;\n } else if (direction === 'row') {\n const sourceMergeInfo = getCellMergeInfo(table, colSource, rowSource);\n const targetMergeInfo = getCellMergeInfo(table, colTarget, rowTarget);\n if (sourceMergeInfo && targetMergeInfo) {\n sourceRowStart = sourceMergeInfo.start.row;\n sourceRowEnd = sourceMergeInfo.end.row;\n targetRowStart = targetMergeInfo.start.row;\n targetRowEnd = targetMergeInfo.end.row;\n\n sourceColStart = sourceMergeInfo.start.col;\n targetColStart = targetMergeInfo.start.col;\n } else {\n sourceRowStart = rowSource;\n sourceRowEnd = rowSource;\n targetRowStart = rowTarget;\n targetRowEnd = rowTarget;\n\n sourceColStart = colSource;\n targetColStart = colTarget;\n }\n // sourceColStart = colSource;\n sourceColEnd = table.colCount - 1;\n // targetColStart = colTarget;\n targetColEnd = table.colCount - 1;\n }\n\n const updateColStart = Math.min(sourceColStart, targetColStart);\n const updateColEnd = Math.max(sourceColEnd, targetColEnd);\n const updateRowStart = Math.min(sourceRowStart, targetRowStart);\n const updateRowEnd = Math.max(sourceRowEnd, targetRowEnd);\n\n // 更新columnGroup列宽\n for (let col = updateColStart; col <= updateColEnd; col++) {\n const columnWidth = table.getColWidth(col);\n const columnHeaderGroup = table.scenegraph.getColGroup(col, true);\n const columnGroup = table.scenegraph.getColGroup(col);\n const columnBottomGroup = table.scenegraph.getColGroupInBottom(col);\n if (columnHeaderGroup) {\n columnHeaderGroup.setAttribute('width', columnWidth);\n columnHeaderGroup.forEachChildren((child: Group) => {\n child.setAttribute('width', columnWidth);\n });\n }\n if (columnGroup) {\n columnGroup.setAttribute('width', columnWidth);\n columnGroup.forEachChildren((child: Group) => {\n child.setAttribute('width', columnWidth);\n });\n }\n if (columnBottomGroup) {\n columnBottomGroup.setAttribute('width', columnWidth);\n columnBottomGroup.forEachChildren((child: Group) => {\n child.setAttribute('width', columnWidth);\n });\n }\n }\n\n // 更新容器尺寸\n // scene.updateContainerAttrWidthAndX();\n scene.updateContainer();\n\n if (direction === 'column') {\n for (let col = updateColStart; col <= updateColEnd; col++) {\n // 将该列的chartInstance清除掉\n const columnGroup = table.scenegraph.getColGroup(col);\n columnGroup?.setAttribute('chartInstance', undefined);\n\n // 将上下表头 和中间body部分分别更新\n for (let row = 0; row <= table.frozenRowCount - 1; row++) {\n scene.updateCellContent(col, row);\n }\n for (let row = scene.bodyRowStart; row <= scene.bodyRowEnd; row++) {\n scene.updateCellContent(col, row);\n }\n for (let row = table.rowCount - table.bottomFrozenRowCount; row <= table.rowCount - 1; row++) {\n scene.updateCellContent(col, row);\n }\n }\n } else {\n // 将左侧冻结列or行表头的单元格更新\n for (let col = 0; col <= table.frozenColCount - 1; col++) {\n // 将该列的chartInstance清除掉\n const columnGroup = table.scenegraph.getColGroup(col);\n columnGroup?.setAttribute('chartInstance', undefined);\n for (let row = updateRowStart; row <= updateRowEnd; row++) {\n scene.updateCellContent(col, row);\n }\n }\n // 将中间body的单元格更新\n for (let col = scene.bodyColStart; col <= scene.bodyColEnd; col++) {\n // 将该列的chartInstance清除掉\n const columnGroup = table.scenegraph.getColGroup(col);\n columnGroup?.setAttribute('chartInstance', undefined);\n for (let row = updateRowStart; row <= updateRowEnd; row++) {\n scene.updateCellContent(col, row);\n }\n }\n // 将右侧冻结列的单元格更新\n for (let col = table.colCount - table.rightFrozenColCount; col <= table.colCount - 1; col++) {\n // 将该列的chartInstance清除掉\n const columnGroup = table.scenegraph.getColGroup(col);\n columnGroup?.setAttribute('chartInstance', undefined);\n for (let row = updateRowStart; row <= updateRowEnd; row++) {\n scene.updateCellContent(col, row);\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/layout/move-cell.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,kBAAkB,CAChC,SAAiB,EACjB,SAAiB,EACjB,SAAiB,EACjB,SAAiB,EACjB,eAAkC,EAClC,eAAkC,EAClC,KAAmB;IAEnB,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC;IAG/B,MAAM,YAAY,GAAG,KAAK,CAAC,eAAe,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACjE,MAAM,SAAS,GAAG,YAAY,KAAK,cAAc,C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cAAc,EAAE,GAAG,IAAI,YAAY,EAAE,GAAG,EAAE,EAAE;gBACzD,KAAK,CAAC,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;aACnC;SACF;QAED,KAAK,IAAI,GAAG,GAAG,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,mBAAmB,EAAE,GAAG,IAAI,KAAK,CAAC,QAAQ,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE;YAE3F,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;YACtD,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,YAAY,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;YACtD,KAAK,IAAI,GAAG,GAAG,cAAc,EAAE,GAAG,IAAI,YAAY,EAAE,GAAG,EAAE,EAAE;gBACzD,KAAK,CAAC,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;aACnC;SACF;KACF;AACH,CAAC","file":"move-cell.js","sourcesContent":["import type { Group } from './../../vrender';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { CellRange } from '../../ts-types';\nexport function moveHeaderPosition(\n colSource: number,\n rowSource: number,\n colTarget: number,\n rowTarget: number,\n sourceMergeInfo: false | CellRange,\n targetMergeInfo: false | CellRange,\n table: BaseTableAPI\n) {\n const scene = table.scenegraph;\n\n // 判断方向\n const cellLocation = table.getCellLocation(colTarget, rowTarget);\n const direction = cellLocation === 'columnHeader' ? 'column' : cellLocation === 'rowHeader' ? 'row' : undefined;\n\n let sourceColStart = 0;\n let sourceRowStart = 0;\n let sourceColEnd = 0;\n let sourceRowEnd = 0;\n let targetColStart = 0;\n let targetRowStart = 0;\n let targetColEnd = 0;\n let targetRowEnd = 0;\n if (direction === 'column') {\n if (sourceMergeInfo && targetMergeInfo) {\n sourceColStart = sourceMergeInfo.start.col;\n sourceColEnd = sourceMergeInfo.end.col;\n targetColStart = targetMergeInfo.start.col;\n targetColEnd = targetMergeInfo.end.col;\n\n sourceRowStart = sourceMergeInfo.start.row;\n targetRowStart = targetMergeInfo.start.row;\n } else {\n sourceColStart = colSource;\n sourceColEnd = colSource;\n targetColStart = colTarget;\n targetColEnd = colTarget;\n\n sourceRowStart = rowSource;\n targetRowStart = rowTarget;\n }\n // sourceRowStart = rowSource;\n sourceRowEnd = table.rowCount - 1;\n // targetRowStart = rowTarget;\n targetRowEnd = table.rowCount - 1;\n } else if (direction === 'row') {\n if (sourceMergeInfo && targetMergeInfo) {\n sourceRowStart = sourceMergeInfo.start.row;\n sourceRowEnd = sourceMergeInfo.end.row;\n targetRowStart = targetMergeInfo.start.row;\n targetRowEnd = targetMergeInfo.end.row;\n\n sourceColStart = sourceMergeInfo.start.col;\n targetColStart = targetMergeInfo.start.col;\n } else {\n sourceRowStart = rowSource;\n sourceRowEnd = rowSource;\n targetRowStart = rowTarget;\n targetRowEnd = rowTarget;\n\n sourceColStart = colSource;\n targetColStart = colTarget;\n }\n // sourceColStart = colSource;\n sourceColEnd = table.colCount - 1;\n // targetColStart = colTarget;\n targetColEnd = table.colCount - 1;\n }\n\n const updateColStart = Math.min(sourceColStart, targetColStart);\n const updateColEnd = Math.max(sourceColEnd, targetColEnd);\n const updateRowStart = Math.min(sourceRowStart, targetRowStart);\n const updateRowEnd = Math.max(sourceRowEnd, targetRowEnd);\n\n // 更新columnGroup列宽\n for (let col = updateColStart; col <= updateColEnd; col++) {\n const columnWidth = table.getColWidth(col);\n const columnHeaderGroup = table.scenegraph.getColGroup(col, true);\n const columnGroup = table.scenegraph.getColGroup(col);\n const columnBottomGroup = table.scenegraph.getColGroupInBottom(col);\n if (columnHeaderGroup) {\n columnHeaderGroup.setAttribute('width', columnWidth);\n columnHeaderGroup.forEachChildren((child: Group) => {\n child.setAttribute('width', columnWidth);\n });\n }\n if (columnGroup) {\n columnGroup.setAttribute('width', columnWidth);\n columnGroup.forEachChildren((child: Group) => {\n child.setAttribute('width', columnWidth);\n });\n }\n if (columnBottomGroup) {\n columnBottomGroup.setAttribute('width', columnWidth);\n columnBottomGroup.forEachChildren((child: Group) => {\n child.setAttribute('width', columnWidth);\n });\n }\n }\n\n // 更新容器尺寸\n // scene.updateContainerAttrWidthAndX();\n scene.updateContainer();\n\n if (direction === 'column') {\n for (let col = updateColStart; col <= updateColEnd; col++) {\n // 将该列的chartInstance清除掉\n const columnGroup = table.scenegraph.getColGroup(col);\n columnGroup?.setAttribute('chartInstance', undefined);\n\n // 将上下表头 和中间body部分分别更新\n for (let row = 0; row <= table.frozenRowCount - 1; row++) {\n scene.updateCellContent(col, row);\n }\n for (let row = scene.bodyRowStart; row <= scene.bodyRowEnd; row++) {\n scene.updateCellContent(col, row);\n }\n for (let row = table.rowCount - table.bottomFrozenRowCount; row <= table.rowCount - 1; row++) {\n scene.updateCellContent(col, row);\n }\n }\n } else {\n // 将左侧冻结列or行表头的单元格更新\n for (let col = 0; col <= table.frozenColCount - 1; col++) {\n // 将该列的chartInstance清除掉\n const columnGroup = table.scenegraph.getColGroup(col);\n columnGroup?.setAttribute('chartInstance', undefined);\n for (let row = updateRowStart; row <= updateRowEnd; row++) {\n scene.updateCellContent(col, row);\n }\n }\n // 将中间body的单元格更新\n for (let col = scene.bodyColStart; col <= scene.bodyColEnd; col++) {\n // 将该列的chartInstance清除掉\n const columnGroup = table.scenegraph.getColGroup(col);\n columnGroup?.setAttribute('chartInstance', undefined);\n for (let row = updateRowStart; row <= updateRowEnd; row++) {\n scene.updateCellContent(col, row);\n }\n }\n // 将右侧冻结列的单元格更新\n for (let col = table.colCount - table.rightFrozenColCount; col <= table.colCount - 1; col++) {\n // 将该列的chartInstance清除掉\n const columnGroup = table.scenegraph.getColGroup(col);\n columnGroup?.setAttribute('chartInstance', undefined);\n for (let row = updateRowStart; row <= updateRowEnd; row++) {\n scene.updateCellContent(col, row);\n }\n }\n }\n}\n"]}
|
|
@@ -10,7 +10,7 @@ import { getQuadProps } from "../utils/padding";
|
|
|
10
10
|
|
|
11
11
|
import { updateCellContentHeight } from "../utils/text-icon-layout";
|
|
12
12
|
|
|
13
|
-
import { dealWithCustom } from "../component/custom";
|
|
13
|
+
import { dealWithCustom, getCustomCellMergeCustom } from "../component/custom";
|
|
14
14
|
|
|
15
15
|
import { updateImageCellContentWhileResize } from "../group-creater/cell-type/image-cell";
|
|
16
16
|
|
|
@@ -23,7 +23,9 @@ import { resizeCellGroup } from "../group-creater/column-helper";
|
|
|
23
23
|
export function updateRowHeight(scene, row, detaY, skipTableHeightMap) {
|
|
24
24
|
skipTableHeightMap || scene.table._setRowHeight(row, scene.table.getRowHeight(row) + detaY, !0);
|
|
25
25
|
for (let col = 0; col < scene.table.colCount; col++) {
|
|
26
|
-
const cell = scene.getCell(col, row)
|
|
26
|
+
const cell = scene.getCell(col, row);
|
|
27
|
+
if ("empty" === cell.role) continue;
|
|
28
|
+
const mergeInfo = getCellMergeInfo(scene.table, col, row);
|
|
27
29
|
if (mergeInfo && mergeInfo.start.col !== col) continue;
|
|
28
30
|
updateCellHeightForRow(scene, cell, col, row, cell.attribute.height + detaY, detaY, scene.table.isHeader(col, row)),
|
|
29
31
|
scene.updateCellContentWhileResize(col, row);
|
|
@@ -62,21 +64,23 @@ export function updateCellHeight(scene, cell, col, row, distHeight, detaY, isHea
|
|
|
62
64
|
let renderDefault = !0;
|
|
63
65
|
const customContainer = cell.getChildByName("custom-container");
|
|
64
66
|
if (customContainer) {
|
|
65
|
-
let customElementsGroup
|
|
66
|
-
customContainer.removeAllChild(), cell.removeChild(customContainer)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
let customElementsGroup;
|
|
68
|
+
if (customContainer.removeAllChild(), cell.removeChild(customContainer), !getCustomCellMergeCustom(col, row, cell, scene.table)) {
|
|
69
|
+
let customRender, customLayout;
|
|
70
|
+
if ("body" !== scene.table.getCellLocation(col, row)) {
|
|
71
|
+
const define = scene.table.getHeaderDefine(col, row);
|
|
72
|
+
customRender = null == define ? void 0 : define.headerCustomRender, customLayout = null == define ? void 0 : define.headerCustomLayout;
|
|
73
|
+
} else {
|
|
74
|
+
const define = scene.table.getBodyColumnDefine(col, row);
|
|
75
|
+
customRender = (null == define ? void 0 : define.customRender) || scene.table.customRender,
|
|
76
|
+
customLayout = null == define ? void 0 : define.customLayout;
|
|
77
|
+
}
|
|
78
|
+
if (customLayout || customRender) {
|
|
79
|
+
const style = scene.table._getCellStyle(col, row), padding = getQuadProps(getProp("padding", style, col, row, scene.table)), customResult = dealWithCustom(customLayout, customRender, col, row, cell.attribute.width, cell.attribute.height, !1, "autoHeight" === scene.table.heightMode, padding, scene.table);
|
|
80
|
+
customElementsGroup = customResult.elementsGroup, renderDefault = customResult.renderDefault;
|
|
81
|
+
}
|
|
82
|
+
cell.childrenCount > 0 && customElementsGroup ? cell.insertBefore(customElementsGroup, cell.firstChild) : customElementsGroup && cell.appendChild(customElementsGroup);
|
|
78
83
|
}
|
|
79
|
-
cell.childrenCount > 0 ? cell.insertBefore(customElementsGroup, cell.firstChild) : cell.appendChild(customElementsGroup);
|
|
80
84
|
}
|
|
81
85
|
if (renderDefault) {
|
|
82
86
|
const style = scene.table._getCellStyle(col, row);
|