@visactor/vtable 0.16.4-alpha.2 → 0.17.1
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 +13 -2
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.d.ts +1 -0
- package/cjs/PivotChart.js +20 -2
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.d.ts +1 -0
- package/cjs/PivotTable.js +20 -2
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +1 -0
- package/cjs/core/BaseTable.js +39 -41
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/tableHelper.d.ts +1 -1
- package/cjs/core/tableHelper.js +6 -5
- package/cjs/core/tableHelper.js.map +1 -1
- package/cjs/dataset/dataset.js +3 -8
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/edit/edit-manager.js +0 -3
- package/cjs/edit/edit-manager.js.map +1 -1
- package/cjs/event/EventHandler.d.ts +1 -0
- package/cjs/event/EventHandler.js +1 -1
- package/cjs/event/EventHandler.js.map +1 -1
- package/cjs/event/event.d.ts +10 -0
- package/cjs/event/event.js +2 -1
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/container-dom.js +30 -4
- package/cjs/event/listener/container-dom.js.map +1 -1
- package/cjs/event/listener/scroll-bar.js +19 -5
- package/cjs/event/listener/scroll-bar.js.map +1 -1
- package/cjs/event/listener/table-group.js +45 -34
- package/cjs/event/listener/table-group.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/pivot-header-layout.d.ts +1 -0
- package/cjs/layout/pivot-header-layout.js +35 -18
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/pivot-layout-helper.d.ts +1 -1
- package/cjs/layout/pivot-layout-helper.js +12 -5
- package/cjs/layout/pivot-layout-helper.js.map +1 -1
- package/cjs/layout/simple-header-layout.js +9 -9
- package/cjs/layout/simple-header-layout.js.map +1 -1
- package/cjs/scenegraph/component/cell-content.d.ts +2 -3
- package/cjs/scenegraph/component/cell-content.js +3 -3
- package/cjs/scenegraph/component/cell-content.js.map +1 -1
- package/cjs/scenegraph/component/custom.js +10 -10
- package/cjs/scenegraph/component/custom.js.map +1 -1
- package/cjs/scenegraph/component/table-component.js.map +1 -1
- package/cjs/scenegraph/graphic/text.d.ts +1 -1
- package/cjs/scenegraph/graphic/text.js +1 -1
- package/cjs/scenegraph/graphic/text.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +2 -1
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/checkbox-cell.js +3 -2
- package/cjs/scenegraph/group-creater/cell-type/checkbox-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
- package/cjs/scenegraph/icon/icon-update.d.ts +2 -0
- package/cjs/scenegraph/icon/icon-update.js +16 -2
- package/cjs/scenegraph/icon/icon-update.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.d.ts +1 -0
- package/cjs/scenegraph/layout/compute-col-width.js +12 -8
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js +16 -8
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
- package/cjs/scenegraph/layout/update-col.js +6 -5
- package/cjs/scenegraph/layout/update-col.js.map +1 -1
- package/cjs/scenegraph/layout/update-row.js +7 -6
- package/cjs/scenegraph/layout/update-row.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +2 -0
- package/cjs/scenegraph/scenegraph.js +43 -59
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/select/update-select-border.js +12 -6
- package/cjs/scenegraph/select/update-select-border.js.map +1 -1
- package/cjs/scenegraph/stick-text/index.js.map +1 -1
- package/cjs/scenegraph/utils/text-icon-layout.js +13 -10
- package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
- package/cjs/scenegraph/utils/text-pos.js.map +1 -1
- package/cjs/state/hover/is-cell-hover.d.ts +1 -1
- package/cjs/state/hover/is-cell-hover.js +5 -4
- package/cjs/state/hover/is-cell-hover.js.map +1 -1
- package/cjs/state/select/update-position.js +65 -65
- package/cjs/state/select/update-position.js.map +1 -1
- package/cjs/state/spark-line/index.js +9 -5
- package/cjs/state/spark-line/index.js.map +1 -1
- package/cjs/state/state.js +2 -4
- package/cjs/state/state.js.map +1 -1
- package/cjs/themes/DARK.js +1 -1
- package/cjs/themes/DARK.js.map +1 -1
- package/cjs/themes/component.d.ts +27 -0
- package/cjs/themes/component.js +29 -2
- package/cjs/themes/component.js.map +1 -1
- package/cjs/themes/theme.d.ts +2 -0
- package/cjs/themes/theme.js +9 -1
- package/cjs/themes/theme.js.map +1 -1
- package/cjs/tools/NumberMap.d.ts +4 -0
- package/cjs/tools/NumberMap.js +16 -0
- package/cjs/tools/NumberMap.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +3 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/customElement.d.ts +1 -1
- package/cjs/ts-types/customElement.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +3 -0
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/ts-types/theme.d.ts +2 -0
- package/cjs/ts-types/theme.js.map +1 -1
- package/dist/vtable.js +21833 -23055
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +1 -0
- package/es/ListTable.js +12 -2
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.d.ts +1 -0
- package/es/PivotChart.js +20 -2
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.d.ts +1 -0
- package/es/PivotTable.js +20 -2
- package/es/PivotTable.js.map +1 -1
- package/es/core/BaseTable.d.ts +1 -0
- package/es/core/BaseTable.js +41 -44
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/tableHelper.d.ts +1 -1
- package/es/core/tableHelper.js +6 -5
- package/es/core/tableHelper.js.map +1 -1
- package/es/dataset/dataset.js +3 -8
- package/es/dataset/dataset.js.map +1 -1
- package/es/edit/edit-manager.js +0 -3
- package/es/edit/edit-manager.js.map +1 -1
- package/es/event/EventHandler.d.ts +1 -0
- package/es/event/EventHandler.js +1 -1
- package/es/event/EventHandler.js.map +1 -1
- package/es/event/event.d.ts +10 -0
- package/es/event/event.js +2 -1
- package/es/event/event.js.map +1 -1
- package/es/event/listener/container-dom.js +30 -4
- package/es/event/listener/container-dom.js.map +1 -1
- package/es/event/listener/scroll-bar.js +20 -4
- package/es/event/listener/scroll-bar.js.map +1 -1
- package/es/event/listener/table-group.js +45 -34
- package/es/event/listener/table-group.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/pivot-header-layout.d.ts +1 -0
- package/es/layout/pivot-header-layout.js +35 -18
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/pivot-layout-helper.d.ts +1 -1
- package/es/layout/pivot-layout-helper.js +12 -5
- package/es/layout/pivot-layout-helper.js.map +1 -1
- package/es/layout/simple-header-layout.js +9 -9
- package/es/layout/simple-header-layout.js.map +1 -1
- package/es/scenegraph/component/cell-content.d.ts +2 -3
- package/es/scenegraph/component/cell-content.js +3 -5
- package/es/scenegraph/component/cell-content.js.map +1 -1
- package/es/scenegraph/component/custom.js +10 -12
- package/es/scenegraph/component/custom.js.map +1 -1
- package/es/scenegraph/component/table-component.js.map +1 -1
- package/es/scenegraph/graphic/text.d.ts +1 -1
- package/es/scenegraph/graphic/text.js +1 -1
- package/es/scenegraph/graphic/text.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +2 -1
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/checkbox-cell.js +3 -2
- package/es/scenegraph/group-creater/cell-type/checkbox-cell.js.map +1 -1
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +2 -2
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
- package/es/scenegraph/icon/icon-update.d.ts +2 -0
- package/es/scenegraph/icon/icon-update.js +13 -0
- package/es/scenegraph/icon/icon-update.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.d.ts +1 -0
- package/es/scenegraph/layout/compute-col-width.js +9 -6
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.js +17 -11
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/scenegraph/layout/update-col.js +6 -5
- package/es/scenegraph/layout/update-col.js.map +1 -1
- package/es/scenegraph/layout/update-row.js +7 -6
- package/es/scenegraph/layout/update-row.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +2 -0
- package/es/scenegraph/scenegraph.js +45 -61
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/select/update-select-border.js +12 -6
- package/es/scenegraph/select/update-select-border.js.map +1 -1
- package/es/scenegraph/stick-text/index.js.map +1 -1
- package/es/scenegraph/utils/text-icon-layout.js +13 -12
- package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
- package/es/scenegraph/utils/text-pos.js.map +1 -1
- package/es/state/hover/is-cell-hover.d.ts +1 -1
- package/es/state/hover/is-cell-hover.js +5 -4
- package/es/state/hover/is-cell-hover.js.map +1 -1
- package/es/state/select/update-position.js +65 -65
- package/es/state/select/update-position.js.map +1 -1
- package/es/state/spark-line/index.js +9 -5
- package/es/state/spark-line/index.js.map +1 -1
- package/es/state/state.js +2 -4
- package/es/state/state.js.map +1 -1
- package/es/themes/DARK.js +1 -1
- package/es/themes/DARK.js.map +1 -1
- package/es/themes/component.d.ts +27 -0
- package/es/themes/component.js +28 -0
- package/es/themes/component.js.map +1 -1
- package/es/themes/theme.d.ts +2 -0
- package/es/themes/theme.js +9 -2
- package/es/themes/theme.js.map +1 -1
- package/es/tools/NumberMap.d.ts +4 -0
- package/es/tools/NumberMap.js +16 -0
- package/es/tools/NumberMap.js.map +1 -1
- package/es/ts-types/base-table.d.ts +3 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/customElement.d.ts +1 -1
- package/es/ts-types/customElement.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +3 -0
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/ts-types/theme.d.ts +2 -0
- package/es/ts-types/theme.js.map +1 -1
- package/package.json +7 -7
- package/cjs/scenegraph/component/menu.d.ts +0 -41
- package/es/scenegraph/component/menu.d.ts +0 -41
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { RichText } from "@visactor/vrender";
|
|
1
|
+
import { RichText, Text } from "@visactor/vrender";
|
|
2
2
|
|
|
3
3
|
import { Group } from "../graphic/group";
|
|
4
4
|
|
|
5
5
|
import { Icon } from "../graphic/icon";
|
|
6
6
|
|
|
7
|
-
import { WrapText } from "../graphic/text";
|
|
8
|
-
|
|
9
7
|
export class CellContent extends Group {
|
|
10
8
|
constructor(params) {
|
|
11
9
|
super(params), this._autoWidth = !1, this._autoHeight = !1, this._leftGroup = new Group({
|
|
@@ -41,7 +39,7 @@ export class CellContent extends Group {
|
|
|
41
39
|
const lastChild = this._centerGroup.lastChild;
|
|
42
40
|
lastChild && content.setAttributes({
|
|
43
41
|
x: lastChild.attribute.x + lastChild.AABBBounds.width()
|
|
44
|
-
}), this._centerGroup.appendChild(content), content instanceof
|
|
42
|
+
}), this._centerGroup.appendChild(content), content instanceof Text && (this._centerGroup.setAttribute("pickable", !1),
|
|
45
43
|
content.setAttribute("textAlign", "left"));
|
|
46
44
|
}
|
|
47
45
|
layout() {
|
|
@@ -68,7 +66,7 @@ export class CellContent extends Group {
|
|
|
68
66
|
child instanceof Icon && (textWidth -= child.AABBBounds.width());
|
|
69
67
|
}));
|
|
70
68
|
const text = this._centerGroup.getChildByName("text");
|
|
71
|
-
text instanceof RichText ? text.setAttribute("width", textWidth) : text instanceof
|
|
69
|
+
text instanceof RichText ? text.setAttribute("width", textWidth) : text instanceof Text && text.setAttribute("maxLineWidth", textWidth);
|
|
72
70
|
let x = 0;
|
|
73
71
|
this._centerGroup.forEachChildren((child => {
|
|
74
72
|
child.setAttribute("x", x), x += child.AABBBounds.width();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/component/cell-content.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAgC3C,MAAM,OAAO,WAAY,SAAQ,KAAK;IAYpC,YAAY,MAA8B;QACxC,KAAK,CAAC,MAAM,CAAC,CAAC;QARhB,eAAU,GAAG,KAAK,CAAC;QACnB,gBAAW,GAAG,KAAK,CAAC;QASlB,IAAI,CAAC,UAAU,GAAG,IAAI,KAAK,CAAC;YAC1B,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,KAAK;YACX,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;QACH,IAAI,CAAC,UAAU,CAAC,IAAI,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,WAAW,GAAG,IAAI,KAAK,CAAC;YAC3B,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,KAAK;YACX,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;QACH,IAAI,CAAC,WAAW,CAAC,IAAI,GAAG,eAAe,CAAC;QACxC,IAAI,CAAC,YAAY,GAAG,IAAI,KAAK,CAAC;YAC5B,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,KAAK;YACX,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;QACH,IAAI,CAAC,YA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able no-undef */\nimport type { IGroupGraphicAttribute } from '@visactor/vrender';\nimport { RichText } from '@visactor/vrender';\nimport { Group } from '../graphic/group';\nimport { Icon } from '../graphic/icon';\nimport { WrapText } from '../graphic/text';\n\n/*\n * cell区域规划\n * 左侧占位区 | 中央内容区 | 右侧占位区\n *\n * cell width设置\n * 1. 固定width\n * 2. 自动撑开\n * cell height设置\n * 1. 固定height\n * 2. 无折行,单行自动撑开\n * 2. 折行,多行自动撑开\n *\n * 中央内容区横向对齐方式\n * 纵向对齐方式\n * padding\n */\n\ninterface ICellContentOption {\n autoWidth: boolean;\n autoHeight: boolean;\n cellWidth: number;\n cellHeight: number;\n align: CanvasTextAlign;\n baseline: CanvasTextBaseline;\n}\n\n/**\n * @description: 单元格内容组件,包含content icon & wraptext/richtext\n * @return {*}\n */\nexport class CellContent extends Group {\n _leftGroup: Group;\n _rightGroup: Group;\n _centerGroup: Group;\n\n _autoWidth = false;\n _autoHeight = false;\n _cellWidth: number;\n _cellHeight: number;\n _align: CanvasTextAlign;\n _baseline: CanvasTextBaseline;\n\n constructor(params: IGroupGraphicAttribute) {\n super(params);\n\n this._leftGroup = new Group({\n pickable: false,\n fill: false,\n stroke: false\n });\n this._leftGroup.role = 'content-left';\n this._rightGroup = new Group({\n pickable: false,\n fill: false,\n stroke: false\n });\n this._rightGroup.role = 'content-right';\n this._centerGroup = new Group({\n pickable: false,\n fill: false,\n stroke: false\n });\n this._centerGroup.role = 'content-center';\n\n this.appendChild(this._leftGroup);\n this.appendChild(this._rightGroup);\n this.appendChild(this._centerGroup);\n }\n\n setCellContentOption(option: ICellContentOption) {\n this._autoWidth = option.autoWidth;\n this._autoHeight = option.autoHeight;\n this._cellWidth = option.cellWidth;\n this._cellHeight = option.cellHeight;\n this._align = option.align;\n this._baseline = option.baseline;\n }\n\n addLeftOccupyingIcon(icon: Icon) {\n icon.setAttribute('x', this._leftGroup.width + (icon.attribute.marginLeft ?? 0));\n this._leftGroup.appendChild(icon);\n this._leftGroup.setDeltaWidth(\n (icon.attribute.marginLeft ?? 0) + (icon.attribute.marginRight ?? 0) + icon.attribute.width\n );\n }\n\n addRightOccupyingIcon(icon: Icon) {\n icon.setAttribute('x', this._rightGroup.width + (icon.attribute.marginLeft ?? 0));\n this._rightGroup.appendChild(icon);\n this._rightGroup.setDeltaWidth(\n (icon.attribute.marginLeft ?? 0) + (icon.attribute.marginRight ?? 0) + icon.attribute.width\n );\n }\n\n addContent(content: Icon | WrapText | RichText) {\n const lastChild = this._centerGroup.lastChild as Icon | WrapText | RichText;\n if (lastChild) {\n // 横排content,新加入content更新x坐标\n content.setAttributes({\n x: lastChild.attribute.x + lastChild.AABBBounds.width()\n });\n }\n this._centerGroup.appendChild(content);\n if (content instanceof WrapText) {\n this._centerGroup.setAttribute('pickable', false);\n content.setAttribute('textAlign', 'left');\n }\n }\n\n layout() {\n // 计算左侧占位区域尺寸\n let leftOccupyingWidth = this._leftGroup.width;\n if (leftOccupyingWidth === Infinity) {\n leftOccupyingWidth = 0;\n }\n // 计算右侧占位区域尺寸\n let rightOccupyingWidth = this._rightGroup.width;\n if (rightOccupyingWidth === -Infinity) {\n rightOccupyingWidth = 0;\n }\n\n // 计算中央内容区域尺寸\n if (this._autoWidth) {\n // 计算内容本身宽度\n const centerWidth = this._centerGroup.width;\n // 更新cell宽度\n this._cellWidth = leftOccupyingWidth + rightOccupyingWidth + centerWidth;\n // this.attribute.width = this._cellWidth;\n this.setAttribute('width', this._cellWidth);\n } else {\n // 计算留给内容的宽度\n const contentWidth = this._cellWidth - leftOccupyingWidth - rightOccupyingWidth;\n // 更新内容宽度\n this.updateCenterLayout(contentWidth);\n const centerWidth = this._centerGroup.width;\n this._cellWidth = leftOccupyingWidth + rightOccupyingWidth + centerWidth;\n // this.attribute.width = this._cellWidth;\n this.setAttribute('width', this._cellWidth);\n }\n // 更新水平位置\n this.updateHorizontalPos();\n\n // if (this._autoHeight) {\n const leftOccupyingHeight = this._leftGroup.height;\n const rightOccupyingHeight = this._rightGroup.height;\n const centerHeight = this._centerGroup.height;\n\n this._cellHeight = Math.max(leftOccupyingHeight, rightOccupyingHeight, centerHeight);\n // this.attribute.height = this._cellHeight;\n this.setAttribute('height', this._cellHeight);\n // }\n\n // 更新纵向位置\n this.updateVerticalPos();\n }\n\n updateCenterLayout(contentWidth: number) {\n // 计算留给文字的空间\n let textWidth = contentWidth;\n this._centerGroup.forEachChildren(child => {\n if (child instanceof Icon) {\n textWidth -= child.AABBBounds.width();\n }\n });\n\n // 更新文字宽度\n const text = this._centerGroup.getChildByName('text');\n if (text instanceof RichText) {\n text.setAttribute('width', textWidth);\n } else if (text instanceof WrapText) {\n text.setAttribute('maxLineWidth', textWidth);\n }\n\n // 按顺序更新x\n let x = 0;\n this._centerGroup.forEachChildren((child: Icon | WrapText | RichText) => {\n child.setAttribute('x', x);\n x += child.AABBBounds.width();\n });\n }\n\n updateHorizontalPos() {\n this._leftGroup.setAttribute('x', 0);\n this._rightGroup.setAttribute('x', this._cellWidth - this._rightGroup.width);\n this._centerGroup.setAttribute('x', this._leftGroup.width);\n // 对齐方式由外部处理\n if (this._align === 'left' || this._align === 'start') {\n this.setAttribute('dx', 0);\n } else if (this._align === 'center') {\n this.setAttribute('dx', -this.attribute.width / 2);\n } else if (this._align === 'right' || this._align === 'end') {\n this.setAttribute('dx', -this.attribute.width);\n }\n }\n\n updateVerticalPos() {\n if (this._baseline === 'top') {\n this._leftGroup.setAttribute('y', 0);\n this._rightGroup.setAttribute('y', 0);\n this._centerGroup.setAttribute('y', 0);\n } else if (this._baseline === 'middle') {\n // 处理Group内icon对齐\n this._leftGroup.forEachChildren((icon: Icon) => {\n icon.setAttribute('y', (this._leftGroup.height - icon.AABBBounds.height()) / 2);\n });\n this._rightGroup.forEachChildren((icon: Icon) => {\n icon.setAttribute('y', (this._rightGroup.height - icon.AABBBounds.height()) / 2);\n });\n\n this._leftGroup.setAttribute('y', this._cellHeight / 2 - this._leftGroup.height / 2);\n this._rightGroup.setAttribute('y', this._cellHeight / 2 - this._rightGroup.height / 2);\n this._centerGroup.setAttribute('y', this._cellHeight / 2 - this._centerGroup.height / 2);\n } else if (this._baseline === 'bottom') {\n // 处理Group内icon对齐\n this._leftGroup.forEachChildren((icon: Icon) => {\n icon.setAttribute('y', this._leftGroup.height - icon.AABBBounds.height());\n });\n this._rightGroup.forEachChildren((icon: Icon) => {\n icon.setAttribute('y', this._rightGroup.height - icon.AABBBounds.height());\n });\n\n this._leftGroup.setAttribute('y', this._cellHeight - this._leftGroup.height);\n this._rightGroup.setAttribute('y', this._cellHeight - this._rightGroup.height);\n this._centerGroup.setAttribute('y', this._cellHeight - this._centerGroup.height);\n }\n }\n\n updateWidth(width: number) {\n this._cellWidth = width;\n this.layout();\n }\n\n updateHeight(height: number) {\n this._cellHeight = height;\n this.layout();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/component/cell-content.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAgCvC,MAAM,OAAO,WAAY,SAAQ,KAAK;IAYpC,YAAY,MAA8B;QACxC,KAAK,CAAC,MAAM,CAAC,CAAC;QARhB,eAAU,GAAG,KAAK,CAAC;QACnB,gBAAW,GAAG,KAAK,CAAC;QASlB,IAAI,CAAC,UAAU,GAAG,IAAI,KAAK,CAAC;YAC1B,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,KAAK;YACX,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;QACH,IAAI,CAAC,UAAU,CAAC,IAAI,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,WAAW,GAAG,IAAI,KAAK,CAAC;YAC3B,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,KAAK;YACX,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;QACH,IAAI,CAA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IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAED,YAAY,CAAC,MAAc;QACzB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;QAC1B,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;CACF","file":"cell-content.js","sourcesContent":["/* eslint-disable no-undef */\nimport type { IGroupGraphicAttribute } from '@visactor/vrender';\nimport { RichText, Text } from '@visactor/vrender';\nimport { Group } from '../graphic/group';\nimport { Icon } from '../graphic/icon';\n\n/*\n * cell区域规划\n * 左侧占位区 | 中央内容区 | 右侧占位区\n *\n * cell width设置\n * 1. 固定width\n * 2. 自动撑开\n * cell height设置\n * 1. 固定height\n * 2. 无折行,单行自动撑开\n * 2. 折行,多行自动撑开\n *\n * 中央内容区横向对齐方式\n * 纵向对齐方式\n * padding\n */\n\ninterface ICellContentOption {\n autoWidth: boolean;\n autoHeight: boolean;\n cellWidth: number;\n cellHeight: number;\n align: CanvasTextAlign;\n baseline: CanvasTextBaseline;\n}\n\n/**\n * @description: 单元格内容组件,包含content icon & wraptext/richtext\n * @return {*}\n */\nexport class CellContent extends Group {\n _leftGroup: Group;\n _rightGroup: Group;\n _centerGroup: Group;\n\n _autoWidth = false;\n _autoHeight = false;\n _cellWidth: number;\n _cellHeight: number;\n _align: CanvasTextAlign;\n _baseline: CanvasTextBaseline;\n\n constructor(params: IGroupGraphicAttribute) {\n super(params);\n\n this._leftGroup = new Group({\n pickable: false,\n fill: false,\n stroke: false\n });\n this._leftGroup.role = 'content-left';\n this._rightGroup = new Group({\n pickable: false,\n fill: false,\n stroke: false\n });\n this._rightGroup.role = 'content-right';\n this._centerGroup = new Group({\n pickable: false,\n fill: false,\n stroke: false\n });\n this._centerGroup.role = 'content-center';\n\n this.appendChild(this._leftGroup);\n this.appendChild(this._rightGroup);\n this.appendChild(this._centerGroup);\n }\n\n setCellContentOption(option: ICellContentOption) {\n this._autoWidth = option.autoWidth;\n this._autoHeight = option.autoHeight;\n this._cellWidth = option.cellWidth;\n this._cellHeight = option.cellHeight;\n this._align = option.align;\n this._baseline = option.baseline;\n }\n\n addLeftOccupyingIcon(icon: Icon) {\n icon.setAttribute('x', this._leftGroup.width + (icon.attribute.marginLeft ?? 0));\n this._leftGroup.appendChild(icon);\n this._leftGroup.setDeltaWidth(\n (icon.attribute.marginLeft ?? 0) + (icon.attribute.marginRight ?? 0) + icon.attribute.width\n );\n }\n\n addRightOccupyingIcon(icon: Icon) {\n icon.setAttribute('x', this._rightGroup.width + (icon.attribute.marginLeft ?? 0));\n this._rightGroup.appendChild(icon);\n this._rightGroup.setDeltaWidth(\n (icon.attribute.marginLeft ?? 0) + (icon.attribute.marginRight ?? 0) + icon.attribute.width\n );\n }\n\n addContent(content: Icon | Text | RichText) {\n const lastChild = this._centerGroup.lastChild as Icon | Text | RichText;\n if (lastChild) {\n // 横排content,新加入content更新x坐标\n content.setAttributes({\n x: lastChild.attribute.x + lastChild.AABBBounds.width()\n });\n }\n this._centerGroup.appendChild(content);\n if (content instanceof Text) {\n this._centerGroup.setAttribute('pickable', false);\n content.setAttribute('textAlign', 'left');\n }\n }\n\n layout() {\n // 计算左侧占位区域尺寸\n let leftOccupyingWidth = this._leftGroup.width;\n if (leftOccupyingWidth === Infinity) {\n leftOccupyingWidth = 0;\n }\n // 计算右侧占位区域尺寸\n let rightOccupyingWidth = this._rightGroup.width;\n if (rightOccupyingWidth === -Infinity) {\n rightOccupyingWidth = 0;\n }\n\n // 计算中央内容区域尺寸\n if (this._autoWidth) {\n // 计算内容本身宽度\n const centerWidth = this._centerGroup.width;\n // 更新cell宽度\n this._cellWidth = leftOccupyingWidth + rightOccupyingWidth + centerWidth;\n // this.attribute.width = this._cellWidth;\n this.setAttribute('width', this._cellWidth);\n } else {\n // 计算留给内容的宽度\n const contentWidth = this._cellWidth - leftOccupyingWidth - rightOccupyingWidth;\n // 更新内容宽度\n this.updateCenterLayout(contentWidth);\n const centerWidth = this._centerGroup.width;\n this._cellWidth = leftOccupyingWidth + rightOccupyingWidth + centerWidth;\n // this.attribute.width = this._cellWidth;\n this.setAttribute('width', this._cellWidth);\n }\n // 更新水平位置\n this.updateHorizontalPos();\n\n // if (this._autoHeight) {\n const leftOccupyingHeight = this._leftGroup.height;\n const rightOccupyingHeight = this._rightGroup.height;\n const centerHeight = this._centerGroup.height;\n\n this._cellHeight = Math.max(leftOccupyingHeight, rightOccupyingHeight, centerHeight);\n // this.attribute.height = this._cellHeight;\n this.setAttribute('height', this._cellHeight);\n // }\n\n // 更新纵向位置\n this.updateVerticalPos();\n }\n\n updateCenterLayout(contentWidth: number) {\n // 计算留给文字的空间\n let textWidth = contentWidth;\n this._centerGroup.forEachChildren(child => {\n if (child instanceof Icon) {\n textWidth -= child.AABBBounds.width();\n }\n });\n\n // 更新文字宽度\n const text = this._centerGroup.getChildByName('text');\n if (text instanceof RichText) {\n text.setAttribute('width', textWidth);\n } else if (text instanceof Text) {\n text.setAttribute('maxLineWidth', textWidth);\n }\n\n // 按顺序更新x\n let x = 0;\n this._centerGroup.forEachChildren((child: Icon | Text | RichText) => {\n child.setAttribute('x', x);\n x += child.AABBBounds.width();\n });\n }\n\n updateHorizontalPos() {\n this._leftGroup.setAttribute('x', 0);\n this._rightGroup.setAttribute('x', this._cellWidth - this._rightGroup.width);\n this._centerGroup.setAttribute('x', this._leftGroup.width);\n // 对齐方式由外部处理\n if (this._align === 'left' || this._align === 'start') {\n this.setAttribute('dx', 0);\n } else if (this._align === 'center') {\n this.setAttribute('dx', -this.attribute.width / 2);\n } else if (this._align === 'right' || this._align === 'end') {\n this.setAttribute('dx', -this.attribute.width);\n }\n }\n\n updateVerticalPos() {\n if (this._baseline === 'top') {\n this._leftGroup.setAttribute('y', 0);\n this._rightGroup.setAttribute('y', 0);\n this._centerGroup.setAttribute('y', 0);\n } else if (this._baseline === 'middle') {\n // 处理Group内icon对齐\n this._leftGroup.forEachChildren((icon: Icon) => {\n icon.setAttribute('y', (this._leftGroup.height - icon.AABBBounds.height()) / 2);\n });\n this._rightGroup.forEachChildren((icon: Icon) => {\n icon.setAttribute('y', (this._rightGroup.height - icon.AABBBounds.height()) / 2);\n });\n\n this._leftGroup.setAttribute('y', this._cellHeight / 2 - this._leftGroup.height / 2);\n this._rightGroup.setAttribute('y', this._cellHeight / 2 - this._rightGroup.height / 2);\n this._centerGroup.setAttribute('y', this._cellHeight / 2 - this._centerGroup.height / 2);\n } else if (this._baseline === 'bottom') {\n // 处理Group内icon对齐\n this._leftGroup.forEachChildren((icon: Icon) => {\n icon.setAttribute('y', this._leftGroup.height - icon.AABBBounds.height());\n });\n this._rightGroup.forEachChildren((icon: Icon) => {\n icon.setAttribute('y', this._rightGroup.height - icon.AABBBounds.height());\n });\n\n this._leftGroup.setAttribute('y', this._cellHeight - this._leftGroup.height);\n this._rightGroup.setAttribute('y', this._cellHeight - this._rightGroup.height);\n this._centerGroup.setAttribute('y', this._cellHeight - this._centerGroup.height);\n }\n }\n\n updateWidth(width: number) {\n this._cellWidth = width;\n this.layout();\n }\n\n updateHeight(height: number) {\n this._cellHeight = height;\n this.layout();\n }\n}\n"]}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { createArc, createCircle, createLine, createRect, Group as VGroup } from "@visactor/vrender";
|
|
1
|
+
import { createArc, createCircle, createLine, createRect, Text, Group as VGroup } from "@visactor/vrender";
|
|
2
2
|
|
|
3
3
|
import { isFunction, isObject, isString, isValid } from "@visactor/vutils";
|
|
4
4
|
|
|
5
5
|
import { Icon } from "../graphic/icon";
|
|
6
6
|
|
|
7
|
-
import { WrapText } from "../graphic/text";
|
|
8
|
-
|
|
9
7
|
export function dealWithCustom(customLayout, customRender, col, row, width, height, autoWidth, autoHeight, padding, table) {
|
|
10
8
|
let expectedWidth, expectedHeight, customElements, elementsGroup, renderDefault = !0, enableCellPadding = !1;
|
|
11
9
|
if ("function" == typeof customLayout) {
|
|
@@ -75,7 +73,7 @@ function adjustElementToGroup(elements, width, height, value) {
|
|
|
75
73
|
customGroup.name = "custom-container";
|
|
76
74
|
return adjustElementsPos(elements, width, height, value).forEach((element => {
|
|
77
75
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
|
|
78
|
-
switch (element.type) {
|
|
76
|
+
switch (element.clickable && (element.pickable = element.clickable), element.type) {
|
|
79
77
|
case "arc":
|
|
80
78
|
const arc = createArc({
|
|
81
79
|
x: element.x,
|
|
@@ -87,7 +85,7 @@ function adjustElementToGroup(elements, width, height, value) {
|
|
|
87
85
|
outerRadius: element.radius,
|
|
88
86
|
startAngle: element.startAngle,
|
|
89
87
|
endAngle: element.endAngle,
|
|
90
|
-
pickable: !!element.
|
|
88
|
+
pickable: !!element.pickable,
|
|
91
89
|
cursor: element.cursor
|
|
92
90
|
});
|
|
93
91
|
customGroup.appendChild(arc);
|
|
@@ -107,8 +105,8 @@ function adjustElementToGroup(elements, width, height, value) {
|
|
|
107
105
|
});
|
|
108
106
|
customGroup.appendChild(textBackRect);
|
|
109
107
|
}
|
|
110
|
-
const text = new
|
|
111
|
-
pickable: !!element.
|
|
108
|
+
const text = new Text(Object.assign({
|
|
109
|
+
pickable: !!element.pickable,
|
|
112
110
|
fill: null !== (_o = element.color) && void 0 !== _o ? _o : element.fill
|
|
113
111
|
}, element));
|
|
114
112
|
customGroup.appendChild(text);
|
|
@@ -125,7 +123,7 @@ function adjustElementToGroup(elements, width, height, value) {
|
|
|
125
123
|
cornerRadius: element.radius,
|
|
126
124
|
fill: element.fill,
|
|
127
125
|
stroke: element.stroke,
|
|
128
|
-
pickable: !!element.
|
|
126
|
+
pickable: !!element.pickable,
|
|
129
127
|
cursor: element.cursor
|
|
130
128
|
});
|
|
131
129
|
customGroup.appendChild(rect);
|
|
@@ -140,7 +138,7 @@ function adjustElementToGroup(elements, width, height, value) {
|
|
|
140
138
|
radius: element.radius,
|
|
141
139
|
fill: element.fill,
|
|
142
140
|
stroke: element.stroke,
|
|
143
|
-
pickable: !!element.
|
|
141
|
+
pickable: !!element.pickable,
|
|
144
142
|
cursor: element.cursor
|
|
145
143
|
});
|
|
146
144
|
customGroup.appendChild(circle);
|
|
@@ -158,7 +156,7 @@ function adjustElementToGroup(elements, width, height, value) {
|
|
|
158
156
|
backgroundWidth: element.hover ? null !== (_v = element.hover.width) && void 0 !== _v ? _v : element.width : void 0,
|
|
159
157
|
backgroundHeight: element.hover ? null !== (_w = element.hover.width) && void 0 !== _w ? _w : element.width : void 0,
|
|
160
158
|
backgroundColor: element.hover ? null !== (_x = element.hover.bgColor) && void 0 !== _x ? _x : "rgba(22,44,66,0.2)" : void 0,
|
|
161
|
-
pickable: !!element.
|
|
159
|
+
pickable: !!element.pickable,
|
|
162
160
|
cursor: element.cursor
|
|
163
161
|
});
|
|
164
162
|
icon.role = "icon-custom", customGroup.appendChild(icon);
|
|
@@ -176,7 +174,7 @@ function adjustElementToGroup(elements, width, height, value) {
|
|
|
176
174
|
backgroundWidth: element.hover ? null !== (_0 = element.hover.width) && void 0 !== _0 ? _0 : element.width : void 0,
|
|
177
175
|
backgroundHeight: element.hover ? null !== (_1 = element.hover.width) && void 0 !== _1 ? _1 : element.width : void 0,
|
|
178
176
|
backgroundColor: element.hover ? null !== (_2 = element.hover.bgColor) && void 0 !== _2 ? _2 : "rgba(22,44,66,0.2)" : void 0,
|
|
179
|
-
pickable: !!element.
|
|
177
|
+
pickable: !!element.pickable,
|
|
180
178
|
cursor: element.cursor,
|
|
181
179
|
shape: element.shape
|
|
182
180
|
});
|
|
@@ -187,7 +185,7 @@ function adjustElementToGroup(elements, width, height, value) {
|
|
|
187
185
|
const line = createLine({
|
|
188
186
|
points: element.points,
|
|
189
187
|
stroke: element.stroke,
|
|
190
|
-
pickable: !!element.
|
|
188
|
+
pickable: !!element.pickable,
|
|
191
189
|
cursor: element.cursor
|
|
192
190
|
});
|
|
193
191
|
customGroup.appendChild(line);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/component/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C,CAAC;QACX,CAAC,CAAC,CAAC;IACL,OAAO,CAAC,CAAC;AACX,CAAC","file":"custom.js","sourcesContent":["import type { Cursor } from '@visactor/vrender';\nimport { createArc, createCircle, createLine, createRect, Group as VGroup } from '@visactor/vrender';\nimport { isFunction, isObject, isString, isValid } from '@visactor/vutils';\nimport type {\n ICustomLayout,\n ICustomRender,\n ICustomRenderElement,\n ICustomRenderElements,\n RectElement\n} from '../../ts-types';\nimport { Group } from '../graphic/group';\nimport { Icon } from '../graphic/icon';\nimport { WrapText } from '../graphic/text';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { percentCalcObj, Rect } from '../../render/layout';\n\nexport function dealWithCustom(\n customLayout: ICustomLayout,\n customRender: ICustomRender,\n col: number,\n row: number,\n width: number,\n height: number,\n autoWidth: boolean,\n autoHeight: boolean,\n padding: [number, number, number, number],\n table: BaseTableAPI\n) {\n let renderDefault = true;\n let enableCellPadding = false;\n let expectedWidth: number;\n let expectedHeight: number;\n let customElements;\n let elementsGroup: VGroup;\n\n if (typeof customLayout === 'function') {\n const arg = {\n col,\n row,\n dataValue: table.getCellOriginValue(col, row),\n value: table.getCellValue(col, row) || '',\n rect: {\n left: 0,\n top: 0,\n right: width,\n bottom: height,\n width,\n height\n },\n table\n };\n const customRenderObj = customLayout(arg);\n if (customRenderObj.rootContainer) {\n customRenderObj.rootContainer = decodeReactDom(customRenderObj.rootContainer);\n }\n // expectedWidth = customRenderObj.expectedWidth;\n // expectedHeight = customRenderObj.expectedHeight;\n if (customRenderObj.rootContainer instanceof VGroup) {\n elementsGroup = customRenderObj.rootContainer;\n elementsGroup.name = 'custom-container';\n // } else if (customRenderObj.rootContainer) {\n // customElements = customRenderObj.rootContainer.getElements(undefined, false, false);\n }\n renderDefault = customRenderObj.renderDefault;\n enableCellPadding = customRenderObj.enableCellPadding;\n } else if (typeof customRender === 'function') {\n const arg = {\n col,\n row,\n dataValue: table.getCellOriginValue(col, row),\n value: table.getCellValue(col, row) || '',\n rect: {\n left: 0,\n top: 0,\n right: width,\n bottom: height,\n width,\n height\n },\n table\n };\n const customRenderObj = customRender(arg);\n if (customRenderObj) {\n customElements = customRenderObj.elements;\n renderDefault = customRenderObj.renderDefault;\n expectedWidth = customRenderObj.expectedWidth;\n expectedHeight = customRenderObj.expectedHeight;\n }\n } else if (customRender) {\n expectedWidth = customRender.expectedWidth;\n expectedHeight = customRender.expectedHeight;\n customElements = customRender.elements;\n renderDefault = customRender.renderDefault;\n }\n\n if (customElements) {\n const value = table.getCellValue(col, row);\n elementsGroup = adjustElementToGroup(\n customElements,\n autoWidth ? expectedWidth : width,\n autoHeight ? expectedHeight : height,\n value\n );\n }\n\n if (enableCellPadding) {\n elementsGroup.setAttributes({\n x: padding[3],\n y: padding[0],\n width: width - padding[1] - padding[3],\n height: height - padding[0] - padding[2]\n });\n }\n\n // for percent calc\n dealPercentCalc(elementsGroup, width, height);\n\n return {\n elementsGroup,\n renderDefault\n };\n}\n\nfunction adjustElementToGroup(\n elements: ICustomRenderElements,\n width: number,\n height: number,\n value: any\n): VGroup | undefined {\n const customGroup = new VGroup({\n x: 0,\n y: 0,\n width,\n height,\n fill: false,\n stroke: false,\n pickable: false\n });\n customGroup.name = 'custom-container';\n\n const elementsAdjusted = adjustElementsPos(elements, width, height, value);\n elementsAdjusted.forEach(element => {\n switch (element.type) {\n case 'arc':\n const arc = createArc({\n x: element.x as number,\n y: element.y as number,\n dx: (element.dx ?? 0) as number,\n dy: (element.dy ?? 0) as number,\n fill: element.fill as string,\n stroke: element.stroke as string,\n outerRadius: element.radius as number,\n startAngle: element.startAngle as number,\n endAngle: element.endAngle as number,\n pickable: !!element.clickable,\n cursor: element.cursor as Cursor\n });\n customGroup.appendChild(arc);\n break;\n case 'text':\n if (element.background) {\n const expandX = element.background?.expandX ?? 0;\n const expandY = element.background?.expandY ?? 0;\n const textBackRect = createRect({\n x: (element.x as number) - expandX,\n y: (element.y as number) - expandY,\n dx: (element.dx ?? 0) as number,\n dy: (element.dy ?? 0) as number,\n width: element.width + expandX * 2,\n height: element.height + expandY * 2,\n cornerRadius: element.background?.cornerRadius ?? 0,\n // fill: true,\n fill: element.background?.fill ?? '#888'\n });\n customGroup.appendChild(textBackRect);\n }\n const text = new WrapText(\n Object.assign(\n {\n pickable: !!element.clickable,\n fill: element.color ?? element.fill\n },\n element as any\n )\n );\n customGroup.appendChild(text);\n break;\n case 'rect':\n const rect = createRect({\n x: element.x as number,\n y: element.y as number,\n dx: (element.dx ?? 0) as number,\n dy: (element.dy ?? 0) as number,\n width: element.width as number,\n height: element.height as number,\n cornerRadius: element.radius as number,\n fill: element.fill as string,\n stroke: element.stroke as string,\n pickable: !!element.clickable,\n cursor: element.cursor as Cursor\n });\n customGroup.appendChild(rect);\n break;\n case 'circle':\n const circle = createCircle({\n x: element.x as number,\n y: element.y as number,\n dx: (element.dx ?? 0) as number,\n dy: (element.dy ?? 0) as number,\n radius: element.radius as number,\n fill: element.fill as string,\n stroke: element.stroke as string,\n pickable: !!element.clickable,\n cursor: element.cursor as Cursor\n });\n customGroup.appendChild(circle);\n break;\n case 'icon':\n const icon = new Icon({\n x: element.x as number,\n y: element.y as number,\n dx: (element.dx ?? 0) as number,\n dy: (element.dy ?? 0) as number,\n width: element.width as number,\n height: element.height as number,\n image: element.svg as string,\n backgroundWidth: element.hover ? ((element.hover.width ?? element.width) as number) : undefined,\n backgroundHeight: element.hover ? ((element.hover.width ?? element.width) as number) : undefined,\n backgroundColor: element.hover ? element.hover.bgColor ?? 'rgba(22,44,66,0.2)' : undefined,\n pickable: !!element.clickable,\n cursor: element.cursor as Cursor\n });\n icon.role = 'icon-custom';\n customGroup.appendChild(icon);\n break;\n case 'image':\n const image = new Icon({\n x: element.x as number,\n y: element.y as number,\n dx: (element.dx ?? 0) as number,\n dy: (element.dy ?? 0) as number,\n width: element.width as number,\n height: element.height as number,\n image: element.src as string,\n backgroundWidth: element.hover ? ((element.hover.width ?? element.width) as number) : undefined,\n backgroundHeight: element.hover ? ((element.hover.width ?? element.width) as number) : undefined,\n backgroundColor: element.hover ? element.hover.bgColor ?? 'rgba(22,44,66,0.2)' : undefined,\n pickable: !!element.clickable,\n cursor: element.cursor as Cursor,\n shape: element.shape\n });\n image.role = 'image-custom';\n customGroup.appendChild(image);\n break;\n\n case 'line':\n const line = createLine({\n points: element.points,\n stroke: element.stroke as string,\n pickable: !!element.clickable,\n cursor: element.cursor as Cursor\n });\n customGroup.appendChild(line);\n break;\n }\n });\n\n return customGroup;\n}\n\nfunction adjustElementsPos(\n originalElements: ICustomRenderElements,\n // rect: RectProps,\n width: number,\n height: number,\n // borderLineWidths: number[],\n value: any\n): ICustomRenderElements {\n const result: ICustomRenderElements = [];\n // const { left, top, width, height } = rect;\n const left = 0;\n const top = 0;\n const borderLineWidths = [0, 0, 0, 0];\n\n for (let i = 0; i < originalElements.length; i++) {\n const originalElement = originalElements[i];\n const element = Object.assign({}, originalElement);\n // 执行相关函数\n for (const name in element) {\n if (element.hasOwnProperty(name) && isFunction(element[name])) {\n element[name] = (element[name] as Function)(value);\n }\n }\n\n // 转换字符串值(百分比、px)\n const rect = element as RectElement;\n if (isValid(rect.x)) {\n rect.x = isString(rect.x)\n ? transformString((rect as any).x as string, width - borderLineWidths[1])\n : Number(rect.x);\n }\n if (isValid(rect.y)) {\n rect.y = isString(rect.y)\n ? transformString((rect as any).y as string, height - borderLineWidths[2])\n : Number(rect.y);\n }\n if ('width' in element) {\n element.width = isString(element.width)\n ? transformString(element.width as string, width - borderLineWidths[1])\n : Number(element.width);\n }\n if ('height' in element) {\n element.height = isString(element.height)\n ? transformString(element.height as string, height - borderLineWidths[2])\n : Number(element.height);\n }\n if ('radius' in element) {\n element.radius = isString(element.radius)\n ? transformString(element.radius as string, Math.min(width - borderLineWidths[1], height - borderLineWidths[2]))\n : Number(element.radius);\n }\n if ('hover' in element) {\n // 转换字符串值(百分比、px)\n element.hover.x = isString(element.hover.x)\n ? transformString(element.hover.x as string, width - borderLineWidths[1])\n : Number(element.hover.x);\n element.hover.y = isString(element.hover.y)\n ? transformString(element.hover.y as string, height - borderLineWidths[2])\n : Number(element.hover.y);\n element.hover.width = isString(element.hover.width)\n ? transformString(element.hover.width as string, width - borderLineWidths[1])\n : Number(element.hover.width);\n\n element.hover.height = isString(element.hover.height)\n ? transformString(element.hover.height as string, height - borderLineWidths[2])\n : Number(element.hover.height);\n element.hover.x += left;\n element.hover.y += top;\n }\n // 矫正位置\n rect.x = rect.x + left;\n rect.y = rect.y + top;\n\n result.push(element as unknown as ICustomRenderElement);\n }\n\n return result;\n}\n\nfunction transformString(str: string, size?: number): number {\n if (str.endsWith('px')) {\n return parseInt(str, 10);\n } else if (str.endsWith('%') && size) {\n return (parseInt(str, 10) / 100) * size;\n }\n return parseInt(str, 10);\n}\n\nexport function dealPercentCalc(group: VGroup, parentWidth: number, parentHeight: number) {\n if (!group) {\n return;\n }\n group.forEachChildren((child: VGroup) => {\n if (isObject(child.attribute.width) && (child.attribute.width as percentCalcObj).percent) {\n child.setAttribute(\n 'width',\n ((child.attribute.width as percentCalcObj).percent / 100) * parentWidth +\n ((child.attribute.width as percentCalcObj).delta ?? 0)\n );\n }\n\n if (isObject(child.attribute.height) && (child.attribute.height as percentCalcObj).percent) {\n child.setAttribute(\n 'height',\n ((child.attribute.height as percentCalcObj).percent / 100) * parentHeight +\n ((child.attribute.height as percentCalcObj).delta ?? 0)\n );\n }\n\n if (child.type === 'group') {\n dealPercentCalc(child, child.attribute.width, child.attribute.height);\n }\n });\n}\n\n// temp devode for react jsx customLayout\nexport function decodeReactDom(dom: any) {\n if (!dom.$$typeof) {\n // not react\n return dom;\n }\n const type = dom.type;\n const { attribute, children } = dom.props;\n const g = type({ attribute });\n g.id = attribute.id;\n g.name = attribute.name;\n children &&\n children.length &&\n children.forEach((item: any) => {\n const c = decodeReactDom(item);\n g.add(c);\n });\n return g;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/component/custom.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAA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AAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACX,CAAC,CAAC,CAAC;IACL,OAAO,CAAC,CAAC;AACX,CAAC","file":"custom.js","sourcesContent":["import type { Cursor } from '@visactor/vrender';\nimport { createArc, createCircle, createLine, createRect, Text, Group as VGroup } from '@visactor/vrender';\nimport { isFunction, isObject, isString, isValid } from '@visactor/vutils';\nimport type {\n ICustomLayout,\n ICustomRender,\n ICustomRenderElement,\n ICustomRenderElements,\n RectElement\n} from '../../ts-types';\nimport { Icon } from '../graphic/icon';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { percentCalcObj } from '../../render/layout';\n\nexport function dealWithCustom(\n customLayout: ICustomLayout,\n customRender: ICustomRender,\n col: number,\n row: number,\n width: number,\n height: number,\n autoWidth: boolean,\n autoHeight: boolean,\n padding: [number, number, number, number],\n table: BaseTableAPI\n) {\n let renderDefault = true;\n let enableCellPadding = false;\n let expectedWidth: number;\n let expectedHeight: number;\n let customElements;\n let elementsGroup: VGroup;\n\n if (typeof customLayout === 'function') {\n const arg = {\n col,\n row,\n dataValue: table.getCellOriginValue(col, row),\n value: table.getCellValue(col, row) || '',\n rect: {\n left: 0,\n top: 0,\n right: width,\n bottom: height,\n width,\n height\n },\n table\n };\n const customRenderObj = customLayout(arg);\n if (customRenderObj.rootContainer) {\n customRenderObj.rootContainer = decodeReactDom(customRenderObj.rootContainer);\n }\n // expectedWidth = customRenderObj.expectedWidth;\n // expectedHeight = customRenderObj.expectedHeight;\n if (customRenderObj.rootContainer instanceof VGroup) {\n elementsGroup = customRenderObj.rootContainer;\n elementsGroup.name = 'custom-container';\n // } else if (customRenderObj.rootContainer) {\n // customElements = customRenderObj.rootContainer.getElements(undefined, false, false);\n }\n renderDefault = customRenderObj.renderDefault;\n enableCellPadding = customRenderObj.enableCellPadding;\n } else if (typeof customRender === 'function') {\n const arg = {\n col,\n row,\n dataValue: table.getCellOriginValue(col, row),\n value: table.getCellValue(col, row) || '',\n rect: {\n left: 0,\n top: 0,\n right: width,\n bottom: height,\n width,\n height\n },\n table\n };\n const customRenderObj = customRender(arg);\n if (customRenderObj) {\n customElements = customRenderObj.elements;\n renderDefault = customRenderObj.renderDefault;\n expectedWidth = customRenderObj.expectedWidth;\n expectedHeight = customRenderObj.expectedHeight;\n }\n } else if (customRender) {\n expectedWidth = customRender.expectedWidth;\n expectedHeight = customRender.expectedHeight;\n customElements = customRender.elements;\n renderDefault = customRender.renderDefault;\n }\n\n if (customElements) {\n const value = table.getCellValue(col, row);\n elementsGroup = adjustElementToGroup(\n customElements,\n autoWidth ? expectedWidth : width,\n autoHeight ? expectedHeight : height,\n value\n );\n }\n\n if (enableCellPadding) {\n elementsGroup.setAttributes({\n x: padding[3],\n y: padding[0],\n width: width - padding[1] - padding[3],\n height: height - padding[0] - padding[2]\n });\n }\n\n // for percent calc\n dealPercentCalc(elementsGroup, width, height);\n\n return {\n elementsGroup,\n renderDefault\n };\n}\n\nfunction adjustElementToGroup(\n elements: ICustomRenderElements,\n width: number,\n height: number,\n value: any\n): VGroup | undefined {\n const customGroup = new VGroup({\n x: 0,\n y: 0,\n width,\n height,\n fill: false,\n stroke: false,\n pickable: false\n });\n customGroup.name = 'custom-container';\n\n const elementsAdjusted = adjustElementsPos(elements, width, height, value);\n elementsAdjusted.forEach(element => {\n if ((element as any).clickable) {\n element.pickable = (element as any).clickable;\n }\n switch (element.type) {\n case 'arc':\n const arc = createArc({\n x: element.x as number,\n y: element.y as number,\n dx: (element.dx ?? 0) as number,\n dy: (element.dy ?? 0) as number,\n fill: element.fill as string,\n stroke: element.stroke as string,\n outerRadius: element.radius as number,\n startAngle: element.startAngle as number,\n endAngle: element.endAngle as number,\n pickable: !!element.pickable,\n cursor: element.cursor as Cursor\n });\n customGroup.appendChild(arc);\n break;\n case 'text':\n if (element.background) {\n const expandX = element.background?.expandX ?? 0;\n const expandY = element.background?.expandY ?? 0;\n const textBackRect = createRect({\n x: (element.x as number) - expandX,\n y: (element.y as number) - expandY,\n dx: (element.dx ?? 0) as number,\n dy: (element.dy ?? 0) as number,\n width: element.width + expandX * 2,\n height: element.height + expandY * 2,\n cornerRadius: element.background?.cornerRadius ?? 0,\n // fill: true,\n fill: element.background?.fill ?? '#888'\n });\n customGroup.appendChild(textBackRect);\n }\n const text = new Text(\n Object.assign(\n {\n pickable: !!element.pickable,\n fill: element.color ?? element.fill\n },\n element as any\n )\n );\n customGroup.appendChild(text);\n break;\n case 'rect':\n const rect = createRect({\n x: element.x as number,\n y: element.y as number,\n dx: (element.dx ?? 0) as number,\n dy: (element.dy ?? 0) as number,\n width: element.width as number,\n height: element.height as number,\n cornerRadius: element.radius as number,\n fill: element.fill as string,\n stroke: element.stroke as string,\n pickable: !!element.pickable,\n cursor: element.cursor as Cursor\n });\n customGroup.appendChild(rect);\n break;\n case 'circle':\n const circle = createCircle({\n x: element.x as number,\n y: element.y as number,\n dx: (element.dx ?? 0) as number,\n dy: (element.dy ?? 0) as number,\n radius: element.radius as number,\n fill: element.fill as string,\n stroke: element.stroke as string,\n pickable: !!element.pickable,\n cursor: element.cursor as Cursor\n });\n customGroup.appendChild(circle);\n break;\n case 'icon':\n const icon = new Icon({\n x: element.x as number,\n y: element.y as number,\n dx: (element.dx ?? 0) as number,\n dy: (element.dy ?? 0) as number,\n width: element.width as number,\n height: element.height as number,\n image: element.svg as string,\n backgroundWidth: element.hover ? ((element.hover.width ?? element.width) as number) : undefined,\n backgroundHeight: element.hover ? ((element.hover.width ?? element.width) as number) : undefined,\n backgroundColor: element.hover ? element.hover.bgColor ?? 'rgba(22,44,66,0.2)' : undefined,\n pickable: !!element.pickable,\n cursor: element.cursor as Cursor\n });\n icon.role = 'icon-custom';\n customGroup.appendChild(icon);\n break;\n case 'image':\n const image = new Icon({\n x: element.x as number,\n y: element.y as number,\n dx: (element.dx ?? 0) as number,\n dy: (element.dy ?? 0) as number,\n width: element.width as number,\n height: element.height as number,\n image: element.src as string,\n backgroundWidth: element.hover ? ((element.hover.width ?? element.width) as number) : undefined,\n backgroundHeight: element.hover ? ((element.hover.width ?? element.width) as number) : undefined,\n backgroundColor: element.hover ? element.hover.bgColor ?? 'rgba(22,44,66,0.2)' : undefined,\n pickable: !!element.pickable,\n cursor: element.cursor as Cursor,\n shape: element.shape\n });\n image.role = 'image-custom';\n customGroup.appendChild(image);\n break;\n\n case 'line':\n const line = createLine({\n points: element.points,\n stroke: element.stroke as string,\n pickable: !!element.pickable,\n cursor: element.cursor as Cursor\n });\n customGroup.appendChild(line);\n break;\n }\n });\n\n return customGroup;\n}\n\nfunction adjustElementsPos(\n originalElements: ICustomRenderElements,\n // rect: RectProps,\n width: number,\n height: number,\n // borderLineWidths: number[],\n value: any\n): ICustomRenderElements {\n const result: ICustomRenderElements = [];\n // const { left, top, width, height } = rect;\n const left = 0;\n const top = 0;\n const borderLineWidths = [0, 0, 0, 0];\n\n for (let i = 0; i < originalElements.length; i++) {\n const originalElement = originalElements[i];\n const element = Object.assign({}, originalElement);\n // 执行相关函数\n for (const name in element) {\n if (element.hasOwnProperty(name) && isFunction(element[name])) {\n element[name] = (element[name] as Function)(value);\n }\n }\n\n // 转换字符串值(百分比、px)\n const rect = element as RectElement;\n if (isValid(rect.x)) {\n rect.x = isString(rect.x)\n ? transformString((rect as any).x as string, width - borderLineWidths[1])\n : Number(rect.x);\n }\n if (isValid(rect.y)) {\n rect.y = isString(rect.y)\n ? transformString((rect as any).y as string, height - borderLineWidths[2])\n : Number(rect.y);\n }\n if ('width' in element) {\n element.width = isString(element.width)\n ? transformString(element.width as string, width - borderLineWidths[1])\n : Number(element.width);\n }\n if ('height' in element) {\n element.height = isString(element.height)\n ? transformString(element.height as string, height - borderLineWidths[2])\n : Number(element.height);\n }\n if ('radius' in element) {\n element.radius = isString(element.radius)\n ? transformString(element.radius as string, Math.min(width - borderLineWidths[1], height - borderLineWidths[2]))\n : Number(element.radius);\n }\n if ('hover' in element) {\n // 转换字符串值(百分比、px)\n element.hover.x = isString(element.hover.x)\n ? transformString(element.hover.x as string, width - borderLineWidths[1])\n : Number(element.hover.x);\n element.hover.y = isString(element.hover.y)\n ? transformString(element.hover.y as string, height - borderLineWidths[2])\n : Number(element.hover.y);\n element.hover.width = isString(element.hover.width)\n ? transformString(element.hover.width as string, width - borderLineWidths[1])\n : Number(element.hover.width);\n\n element.hover.height = isString(element.hover.height)\n ? transformString(element.hover.height as string, height - borderLineWidths[2])\n : Number(element.hover.height);\n element.hover.x += left;\n element.hover.y += top;\n }\n // 矫正位置\n rect.x = rect.x + left;\n rect.y = rect.y + top;\n\n result.push(element as unknown as ICustomRenderElement);\n }\n\n return result;\n}\n\nfunction transformString(str: string, size?: number): number {\n if (str.endsWith('px')) {\n return parseInt(str, 10);\n } else if (str.endsWith('%') && size) {\n return (parseInt(str, 10) / 100) * size;\n }\n return parseInt(str, 10);\n}\n\nexport function dealPercentCalc(group: VGroup, parentWidth: number, parentHeight: number) {\n if (!group) {\n return;\n }\n group.forEachChildren((child: VGroup) => {\n if (isObject(child.attribute.width) && (child.attribute.width as percentCalcObj).percent) {\n child.setAttribute(\n 'width',\n ((child.attribute.width as percentCalcObj).percent / 100) * parentWidth +\n ((child.attribute.width as percentCalcObj).delta ?? 0)\n );\n }\n\n if (isObject(child.attribute.height) && (child.attribute.height as percentCalcObj).percent) {\n child.setAttribute(\n 'height',\n ((child.attribute.height as percentCalcObj).percent / 100) * parentHeight +\n ((child.attribute.height as percentCalcObj).delta ?? 0)\n );\n }\n\n if (child.type === 'group') {\n dealPercentCalc(child, child.attribute.width, child.attribute.height);\n }\n });\n}\n\n// temp devode for react jsx customLayout\nexport function decodeReactDom(dom: any) {\n if (!dom.$$typeof) {\n // not react\n return dom;\n }\n const type = dom.type;\n const { attribute, children } = dom.props;\n const g = type({ attribute });\n g.id = attribute.id;\n g.name = attribute.name;\n children &&\n children.length &&\n children.forEach((item: any) => {\n const c = decodeReactDom(item);\n g.add(c);\n });\n return g;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/component/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AAM,CAAC,EAAE;SACb,CAAC;IACJ,CAAC;CACF","file":"table-component.js","sourcesContent":["import type { ILine, IRect, IGroup } from '@visactor/vrender';\nimport { createRect, createLine, createText, createGroup, createSymbol } from '@visactor/vrender';\nimport { ScrollBar } from '@visactor/vrender-components';\nimport type { Group } from '../graphic/group';\nimport type { WrapText } from '../graphic/text';\nimport { MenuHandler } from './menu';\nimport { DrillIcon } from './drill-icon';\nimport { CellMover } from './cell-mover';\nimport { getColX } from './util';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\n\n/**\n * @description: 表格内容外组件\n * @return {*}\n */\nexport class TableComponent {\n table: BaseTableAPI;\n\n border: IRect; // 表格外边框\n // selectBorder: IRect; // 表格选择区域边框\n columnResizeLine: ILine; // 表格列宽调整基准线\n columnResizeBgLine: ILine; // 表格列宽调整基准线背景\n columnResizeLabel: IGroup; // 表格列宽调整标记\n menu: MenuHandler; // 表格菜单\n vScrollBar: ScrollBar; // 表格横向滚动条\n hScrollBar: ScrollBar; // 表格纵向滚动条\n frozenShadowLine: IRect; // 表格冻结列右侧阴影块\n drillIcon: DrillIcon; // drill icon\n cellMover: CellMover; // 表格列顺序调整标记\n\n constructor(table: BaseTableAPI) {\n this.table = table;\n const theme = this.table.theme;\n\n // 滚动条\n this.createScrollBar();\n\n // 列宽调整基准线\n const columnResizeColor = theme.columnResize?.lineColor;\n const columnResizeWidth = theme.columnResize?.lineWidth;\n const columnResizeBgColor = theme.columnResize?.bgColor;\n const columnResizeBgWidth = theme.columnResize?.width;\n this.columnResizeLine = createLine({\n visible: false,\n pickable: false,\n stroke: columnResizeColor as string,\n lineWidth: columnResizeWidth as number,\n x: 0,\n y: 0,\n points: [\n { x: 0, y: 0 },\n { x: 0, y: 0 }\n ]\n });\n this.columnResizeBgLine = createLine({\n visible: false,\n pickable: false,\n stroke: columnResizeBgColor as string,\n lineWidth: columnResizeBgWidth as number,\n x: 0,\n y: 0,\n // dx: -(columnResizeBgWidth - columnResizeWidth) / 2,\n points: [\n { x: 0, y: 0 },\n { x: 0, y: 0 }\n ]\n });\n\n // 列宽调整文字标签\n const columnResizeLabelText = createText({\n visible: false,\n pickable: false,\n x: 0,\n y: 0,\n fontSize: 10,\n fill: '#FFF',\n text: '',\n textBaseline: 'top',\n dx: 12 + 4,\n dy: -8 + 2\n });\n const columnResizeLabelBack = createRect({\n visible: false,\n pickable: false,\n fill: '#3073F2',\n x: 0,\n y: 0,\n width: 38,\n height: 16,\n cornerRadius: 5,\n dx: 12,\n dy: -8\n });\n this.columnResizeLabel = createGroup({\n visible: false,\n pickable: false,\n x: 0,\n y: 0\n });\n this.columnResizeLabel.appendChild(columnResizeLabelBack);\n this.columnResizeLabel.appendChild(columnResizeLabelText);\n\n // 列顺序调整基准线\n this.cellMover = new CellMover(this.table);\n\n // 冻结列阴影\n const shadowWidth = theme.frozenColumnLine?.shadow?.width;\n const shadowStartColor = theme.frozenColumnLine?.shadow?.startColor;\n const shadowEndColor = theme.frozenColumnLine?.shadow?.endColor;\n this.frozenShadowLine = createRect({\n visible: true,\n pickable: false,\n x: 0,\n y: 0,\n width: shadowWidth,\n height: 0,\n fill: {\n gradient: 'linear',\n x0: 0,\n y0: 0,\n x1: 1,\n y1: 0,\n stops: [\n { color: shadowStartColor, offset: 0 },\n { color: shadowEndColor, offset: 1 }\n ]\n }\n });\n\n // TO BE DONE 冻结列border(theme.frozenColumnLine?.border)\n\n // 弹出窗口\n // this.menu = createGroup({\n // visible: false,\n // pickable: false,\n // x: 0,\n // y: 0,\n // });\n this.menu = new MenuHandler(this.table);\n\n this.drillIcon = new DrillIcon();\n }\n\n /**\n * @description: 组件mark加入到容器Group中\n * @param {Group} componentGroup\n * @return {*}\n */\n addToGroup(componentGroup: Group) {\n componentGroup.addChild(this.frozenShadowLine);\n // componentGroup.addChild(this.selectBorder);\n componentGroup.addChild(this.columnResizeBgLine);\n componentGroup.addChild(this.columnResizeLine);\n componentGroup.addChild(this.columnResizeLabel);\n if (this.table.theme.scrollStyle.hoverOn) {\n componentGroup.addChild(this.hScrollBar);\n componentGroup.addChild(this.vScrollBar);\n } else {\n componentGroup.stage.defaultLayer.addChild(this.hScrollBar);\n componentGroup.stage.defaultLayer.addChild(this.vScrollBar);\n }\n this.menu.bindTableComponent(componentGroup);\n this.drillIcon.appand(componentGroup);\n this.cellMover.appand(componentGroup);\n }\n\n /**\n * @description: 创建滚动条组件\n * @return {*}\n */\n createScrollBar() {\n const theme = this.table.theme;\n const scrollRailColor = theme.scrollStyle?.scrollRailColor as string;\n const scrollSliderColor = theme.scrollStyle?.scrollSliderColor as string;\n const width = theme.scrollStyle?.width as number;\n // const visible = theme.scrollStyle?.visible as string;\n // const hoverOn = theme.scrollStyle?.hoverOn as boolean;\n\n this.hScrollBar = new ScrollBar({\n direction: 'horizontal',\n x: -this.table.tableNoFrameWidth * 2,\n y: -this.table.tableNoFrameHeight * 2,\n width: this.table.tableNoFrameWidth,\n height: width,\n padding: 0,\n railStyle: {\n fill: scrollRailColor\n },\n sliderStyle: {\n fill: scrollSliderColor\n },\n range: [0, 0.1],\n // scrollRange: [0.4, 0.8]\n visible: false\n });\n // hack方案实现初始化隐藏滚动条,也可以add到stage之后执行hideAll\n (this.hScrollBar as any).render();\n this.hScrollBar.hideAll();\n\n this.vScrollBar = new ScrollBar({\n direction: 'vertical',\n x: -this.table.tableNoFrameWidth * 2,\n y: -this.table.tableNoFrameHeight * 2,\n width,\n height: this.table.tableNoFrameHeight - this.table.getFrozenRowsHeight(),\n padding: 0,\n railStyle: {\n fill: scrollRailColor\n },\n sliderStyle: {\n fill: scrollSliderColor\n },\n range: [0, 0.1],\n visible: false\n });\n (this.vScrollBar as any).render();\n this.vScrollBar.hideAll();\n }\n\n /**\n * @description: 更新滚动条尺寸\n * @return {*}\n */\n updateScrollBar() {\n const oldHorizontalBarPos = this.table.stateManager.scroll.horizontalBarPos;\n const oldVerticalBarPos = this.table.stateManager.scroll.verticalBarPos;\n\n const theme = this.table.theme;\n const width = theme.scrollStyle?.width as number;\n const visible = theme.scrollStyle?.visible as string;\n // const hoverOn = theme.scrollStyle?.hoverOn as boolean;\n const tableWidth = Math.ceil(this.table.scenegraph.tableGroup.attribute.width);\n const tableHeight = Math.ceil(this.table.scenegraph.tableGroup.attribute.height);\n\n const totalHeight = this.table.getAllRowsHeight();\n const totalWidth = this.table.getAllColsWidth();\n const frozenRowsHeight = this.table.getFrozenRowsHeight();\n const frozenColsWidth = this.table.getFrozenColsWidth();\n const bottomFrozenRowsHeight = this.table.getBottomFrozenRowsHeight();\n const rightFrozenColsWidth = this.table.getRightFrozenColsWidth();\n if (totalWidth > tableWidth) {\n const y = Math.min(tableHeight, totalHeight);\n const rangeEnd = Math.max(0.05, (tableWidth - frozenColsWidth) / (totalWidth - frozenColsWidth));\n this.hScrollBar.setAttributes({\n x: frozenColsWidth + (!this.table.theme.scrollStyle.hoverOn ? this.table.scenegraph.tableGroup.attribute.x : 0),\n y: y - (this.table.theme.scrollStyle.hoverOn ? width : -this.table.scenegraph.tableGroup.attribute.y),\n width: tableWidth - frozenColsWidth - rightFrozenColsWidth,\n range: [0, rangeEnd],\n visible: visible === 'always'\n });\n const bounds = this.hScrollBar.AABBBounds && this.hScrollBar.globalAABBBounds;\n (this.hScrollBar as any)._viewPosition = {\n x: bounds.x1,\n y: bounds.y1\n };\n if (visible === 'always') {\n this.hScrollBar.showAll();\n }\n } else {\n this.hScrollBar.setAttributes({\n x: -this.table.tableNoFrameWidth * 2,\n y: -this.table.tableNoFrameHeight * 2,\n width: 0,\n visible: false\n });\n }\n\n if (totalHeight > tableHeight) {\n const x = Math.min(tableWidth, totalWidth);\n const rangeEnd = Math.max(0.05, (tableHeight - frozenRowsHeight) / (totalHeight - frozenRowsHeight));\n this.vScrollBar.setAttributes({\n x: x - (this.table.theme.scrollStyle.hoverOn ? width : -this.table.scenegraph.tableGroup.attribute.x),\n y:\n frozenRowsHeight + (!this.table.theme.scrollStyle.hoverOn ? this.table.scenegraph.tableGroup.attribute.y : 0),\n height: tableHeight - frozenRowsHeight - bottomFrozenRowsHeight,\n range: [0, rangeEnd],\n visible: visible === 'always'\n });\n const bounds = this.vScrollBar.AABBBounds && this.vScrollBar.globalAABBBounds;\n (this.vScrollBar as any)._viewPosition = {\n x: bounds.x1,\n y: bounds.y1\n };\n\n if (visible === 'always') {\n this.vScrollBar.showAll();\n }\n } else {\n this.vScrollBar.setAttributes({\n x: -this.table.tableNoFrameWidth * 2,\n y: -this.table.tableNoFrameHeight * 2,\n height: 0,\n visible: false\n });\n }\n\n this.table.stateManager.setScrollLeft(oldHorizontalBarPos);\n this.table.stateManager.setScrollTop(oldVerticalBarPos);\n }\n\n /**\n * @description: 隐藏列宽调整组件\n * @return {*}\n */\n hideResizeCol() {\n // this.columnResizeLine.attribute.visible = false;\n this.columnResizeLine.setAttribute('visible', false);\n this.columnResizeBgLine.setAttribute('visible', false);\n this.columnResizeLabel.setAttribute('visible', false);\n this.columnResizeLabel.hideAll();\n }\n\n /**\n * @description: 显示列宽调整组件\n * @param {number} col\n * @param {number} y\n * @return {*}\n */\n showResizeCol(col: number, y: number, isRightFrozen?: boolean) {\n // this.columnResizeLine.attribute.visible = false;\n // 基准线\n const colX = getColX(col, this.table, isRightFrozen);\n this.columnResizeLine.setAttributes({\n visible: true,\n x: colX,\n points: [\n { x: 0, y: 0 },\n { x: 0, y: this.table.getRowsHeight(0, this.table.rowCount - 1) }\n ]\n });\n this.columnResizeBgLine.setAttributes({\n visible: true,\n x: colX,\n points: [\n { x: 0, y: 0 },\n { x: 0, y: this.table.getRowsHeight(0, this.table.rowCount - 1) }\n ]\n });\n\n // 标签\n // this.columnResizeLabel.setAttribute('visible', true);\n this.columnResizeLabel.showAll();\n this.columnResizeLabel.setAttributes({\n visible: true,\n x: colX,\n y\n });\n (this.columnResizeLabel.lastChild as WrapText).setAttribute('text', `${this.table.getColWidth(col)}px`);\n }\n\n /**\n * @description: 更新列宽调整组件\n * @param {number} col\n * @param {number} y 标签显示的y坐标\n * @return {*}\n */\n updateResizeCol(col: number, y: number, isRightFrozen?: boolean) {\n // 基准线\n const colX = getColX(col, this.table, isRightFrozen);\n // this.columnResizeLine.setAttribute('x', x);\n this.columnResizeLine.setAttributes({\n x: colX,\n points: [\n { x: 0, y: 0 },\n { x: 0, y: this.table.getRowsHeight(0, this.table.rowCount - 1) } // todo: 优化points赋值\n ]\n });\n this.columnResizeBgLine.setAttributes({\n x: colX,\n points: [\n { x: 0, y: 0 },\n { x: 0, y: this.table.getRowsHeight(0, this.table.rowCount - 1) } // todo: 优化points赋值\n ]\n });\n\n // 标签\n this.columnResizeLabel.setAttributes({\n x: colX,\n y\n });\n (this.columnResizeLabel.lastChild as WrapText).setAttribute('text', `${Math.floor(this.table.getColWidth(col))}px`);\n }\n\n /**\n * @description: 隐藏列顺序调整组件\n * @return {*}\n */\n hideMoveCol() {\n this.cellMover.hide();\n }\n\n /**\n * @description: 显示列顺序调整组件\n * @param {number} col\n * @param {number} x\n * @return {*}\n */\n showMoveCol(col: number, row: number, delta: number) {\n this.cellMover.show(col, row, delta);\n }\n\n /**\n * @description: 更新列顺序调整组件\n * @param {number} backX\n * @param {number} lineX\n * @return {*}\n */\n updateMoveCol(backX: number, lineX: number, backY: number, lineY: number) {\n this.cellMover.update(backX, lineX, backY, lineY);\n }\n\n /**\n * @description: 显示冻结列shadow\n * @param {number} col\n * @return {*}\n */\n setFrozenColumnShadow(col: number, isRightFrozen?: boolean) {\n if (col < 0) {\n this.frozenShadowLine.setAttributes({\n visible: false\n });\n } else {\n // const colX = this.table.getColsWidth(0, col);\n const colX = getColX(col, this.table, isRightFrozen);\n this.frozenShadowLine.setAttributes({\n visible: true,\n x: colX,\n height: this.table.getRowsHeight(0, this.table.rowCount - 1)\n });\n }\n }\n\n hideVerticalScrollBar() {\n const visable = this.table.theme.scrollStyle.visible;\n if (visable !== 'focus' && visable !== 'scrolling') {\n return;\n }\n this.vScrollBar.setAttribute('visible', false);\n this.vScrollBar.hideAll();\n this.table.scenegraph.updateNextFrame();\n }\n showVerticalScrollBar() {\n const visable = this.table.theme.scrollStyle.visible;\n if (visable !== 'focus' && visable !== 'scrolling') {\n return;\n }\n this.vScrollBar.setAttribute('visible', true);\n this.vScrollBar.showAll();\n this.table.scenegraph.updateNextFrame();\n }\n hideHorizontalScrollBar() {\n const visable = this.table.theme.scrollStyle.visible;\n if (visable !== 'focus' && visable !== 'scrolling') {\n return;\n }\n this.hScrollBar.setAttribute('visible', false);\n this.hScrollBar.hideAll();\n this.table.scenegraph.updateNextFrame();\n }\n showHorizontalScrollBar() {\n const visable = this.table.theme.scrollStyle.visible;\n if (visable !== 'focus' && visable !== 'scrolling') {\n return;\n }\n this.hScrollBar.setAttribute('visible', true);\n this.hScrollBar.showAll();\n this.table.scenegraph.updateNextFrame();\n }\n updateVerticalScrollBarPos(topRatio: number) {\n const range = this.vScrollBar.attribute.range;\n const size = range[1] - range[0];\n const range0 = topRatio * (1 - size);\n this.vScrollBar.setAttribute('range', [range0, range0 + size]);\n const bounds = this.vScrollBar.AABBBounds && this.vScrollBar.globalAABBBounds;\n (this.vScrollBar as any)._viewPosition = {\n x: bounds.x1,\n y: bounds.y1\n };\n }\n updateHorizontalScrollBarPos(leftRatio: number) {\n const range = this.hScrollBar.attribute.range;\n const size = range[1] - range[0];\n const range0 = leftRatio * (1 - size);\n this.hScrollBar.setAttribute('range', [range0, range0 + size]);\n const bounds = this.hScrollBar.AABBBounds && this.hScrollBar.globalAABBBounds;\n (this.hScrollBar as any)._viewPosition = {\n x: bounds.x1,\n y: bounds.y1\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/component/table-component.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAgB,MAAM,mBAAmB,CAAC;AAClG,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,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AC;QACjC,MAAM,MAAM,GAAG,QAAQ,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;QACrC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;QAC/D,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC;QAC7E,IAAI,CAAC,UAAkB,CAAC,aAAa,GAAG;YACvC,CAAC,EAAE,MAAM,CAAC,EAAE;YACZ,CAAC,EAAE,MAAM,CAAC,EAAE;SACb,CAAC;IACJ,CAAC;IACD,4BAA4B,CAAC,SAAiB;QAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC;QAC9C,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,MAAM,GAAG,SAAS,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;QACtC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;QAC/D,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC;QAC7E,IAAI,CAAC,UAAkB,CAAC,aAAa,GAAG;YACvC,CAAC,EAAE,MAAM,CAAC,EAAE;YACZ,CAAC,EAAE,MAAM,CAAC,EAAE;SACb,CAAC;IACJ,CAAC;CACF","file":"table-component.js","sourcesContent":["import type { ILine, IRect, IGroup, FederatedPointerEvent, Text } from '@visactor/vrender';\nimport { createRect, createLine, createText, createGroup, createSymbol } from '@visactor/vrender';\nimport { ScrollBar } from '@visactor/vrender-components';\nimport type { Group } from '../graphic/group';\nimport { MenuHandler } from './menu';\nimport { DrillIcon } from './drill-icon';\nimport { CellMover } from './cell-mover';\nimport { getColX } from './util';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { SceneEvent } from '../../event/util';\nimport { getCellEventArgsSet } from '../../event/util';\nimport type { ListTableAPI } from '../../ts-types';\n\n/**\n * @description: 表格内容外组件\n * @return {*}\n */\nexport class TableComponent {\n table: BaseTableAPI;\n\n border: IRect; // 表格外边框\n // selectBorder: IRect; // 表格选择区域边框\n columnResizeLine: ILine; // 表格列宽调整基准线\n columnResizeBgLine: ILine; // 表格列宽调整基准线背景\n columnResizeLabel: IGroup; // 表格列宽调整标记\n menu: MenuHandler; // 表格菜单\n vScrollBar: ScrollBar; // 表格横向滚动条\n hScrollBar: ScrollBar; // 表格纵向滚动条\n frozenShadowLine: IRect; // 表格冻结列右侧阴影块\n drillIcon: DrillIcon; // drill icon\n cellMover: CellMover; // 表格列顺序调整标记\n\n constructor(table: BaseTableAPI) {\n this.table = table;\n const theme = this.table.theme;\n\n // 滚动条\n this.createScrollBar();\n\n // 列宽调整基准线\n const columnResizeColor = theme.columnResize?.lineColor;\n const columnResizeWidth = theme.columnResize?.lineWidth;\n const columnResizeBgColor = theme.columnResize?.bgColor;\n const columnResizeBgWidth = theme.columnResize?.width;\n this.columnResizeLine = createLine({\n visible: false,\n pickable: false,\n stroke: columnResizeColor as string,\n lineWidth: columnResizeWidth as number,\n x: 0,\n y: 0,\n points: [\n { x: 0, y: 0 },\n { x: 0, y: 0 }\n ]\n });\n this.columnResizeBgLine = createLine({\n visible: false,\n pickable: false,\n stroke: columnResizeBgColor as string,\n lineWidth: columnResizeBgWidth as number,\n x: 0,\n y: 0,\n // dx: -(columnResizeBgWidth - columnResizeWidth) / 2,\n points: [\n { x: 0, y: 0 },\n { x: 0, y: 0 }\n ]\n });\n\n // 列宽调整文字标签\n const columnResizeLabelText = createText({\n visible: false,\n pickable: false,\n x: 0,\n y: 0,\n fontSize: 10,\n fill: '#FFF',\n text: '',\n textBaseline: 'top',\n dx: 12 + 4,\n dy: -8 + 2\n });\n const columnResizeLabelBack = createRect({\n visible: false,\n pickable: false,\n fill: '#3073F2',\n x: 0,\n y: 0,\n width: 38,\n height: 16,\n cornerRadius: 5,\n dx: 12,\n dy: -8\n });\n this.columnResizeLabel = createGroup({\n visible: false,\n pickable: false,\n x: 0,\n y: 0\n });\n this.columnResizeLabel.appendChild(columnResizeLabelBack);\n this.columnResizeLabel.appendChild(columnResizeLabelText);\n\n // 列顺序调整基准线\n this.cellMover = new CellMover(this.table);\n\n // 冻结列阴影\n const shadowWidth = theme.frozenColumnLine?.shadow?.width;\n const shadowStartColor = theme.frozenColumnLine?.shadow?.startColor;\n const shadowEndColor = theme.frozenColumnLine?.shadow?.endColor;\n this.frozenShadowLine = createRect({\n visible: true,\n pickable: false,\n x: 0,\n y: 0,\n width: shadowWidth,\n height: 0,\n fill: {\n gradient: 'linear',\n x0: 0,\n y0: 0,\n x1: 1,\n y1: 0,\n stops: [\n { color: shadowStartColor, offset: 0 },\n { color: shadowEndColor, offset: 1 }\n ]\n }\n });\n\n // TO BE DONE 冻结列border(theme.frozenColumnLine?.border)\n\n // 弹出窗口\n // this.menu = createGroup({\n // visible: false,\n // pickable: false,\n // x: 0,\n // y: 0,\n // });\n this.menu = new MenuHandler(this.table);\n\n this.drillIcon = new DrillIcon();\n }\n\n /**\n * @description: 组件mark加入到容器Group中\n * @param {Group} componentGroup\n * @return {*}\n */\n addToGroup(componentGroup: Group) {\n componentGroup.addChild(this.frozenShadowLine);\n // componentGroup.addChild(this.selectBorder);\n componentGroup.addChild(this.columnResizeBgLine);\n componentGroup.addChild(this.columnResizeLine);\n componentGroup.addChild(this.columnResizeLabel);\n if (this.table.theme.scrollStyle.hoverOn) {\n componentGroup.addChild(this.hScrollBar);\n componentGroup.addChild(this.vScrollBar);\n } else {\n componentGroup.stage.defaultLayer.addChild(this.hScrollBar);\n componentGroup.stage.defaultLayer.addChild(this.vScrollBar);\n }\n this.menu.bindTableComponent(componentGroup);\n this.drillIcon.appand(componentGroup);\n this.cellMover.appand(componentGroup);\n }\n\n /**\n * @description: 创建滚动条组件\n * @return {*}\n */\n createScrollBar() {\n const theme = this.table.theme;\n const scrollRailColor = theme.scrollStyle?.scrollRailColor as string;\n const scrollSliderColor = theme.scrollStyle?.scrollSliderColor as string;\n const width = theme.scrollStyle?.width as number;\n // const visible = theme.scrollStyle?.visible as string;\n // const hoverOn = theme.scrollStyle?.hoverOn as boolean;\n\n this.hScrollBar = new ScrollBar({\n direction: 'horizontal',\n x: -this.table.tableNoFrameWidth * 2,\n y: -this.table.tableNoFrameHeight * 2,\n width: this.table.tableNoFrameWidth,\n height: width,\n padding: 0,\n railStyle: {\n fill: scrollRailColor\n },\n sliderStyle: {\n fill: scrollSliderColor\n },\n range: [0, 0.1],\n // scrollRange: [0.4, 0.8]\n visible: false\n });\n // hack方案实现初始化隐藏滚动条,也可以add到stage之后执行hideAll\n (this.hScrollBar as any).render();\n this.hScrollBar.hideAll();\n\n this.vScrollBar = new ScrollBar({\n direction: 'vertical',\n x: -this.table.tableNoFrameWidth * 2,\n y: -this.table.tableNoFrameHeight * 2,\n width,\n height: this.table.tableNoFrameHeight - this.table.getFrozenRowsHeight(),\n padding: 0,\n railStyle: {\n fill: scrollRailColor\n },\n sliderStyle: {\n fill: scrollSliderColor\n },\n range: [0, 0.1],\n visible: false\n });\n (this.vScrollBar as any).render();\n this.vScrollBar.hideAll();\n }\n\n /**\n * @description: 更新滚动条尺寸\n * @return {*}\n */\n updateScrollBar() {\n const oldHorizontalBarPos = this.table.stateManager.scroll.horizontalBarPos;\n const oldVerticalBarPos = this.table.stateManager.scroll.verticalBarPos;\n\n const theme = this.table.theme;\n const width = theme.scrollStyle?.width as number;\n const visible = theme.scrollStyle?.visible as string;\n // const hoverOn = theme.scrollStyle?.hoverOn as boolean;\n const tableWidth = Math.ceil(this.table.scenegraph.tableGroup.attribute.width);\n const tableHeight = Math.ceil(this.table.scenegraph.tableGroup.attribute.height);\n\n const totalHeight = this.table.getAllRowsHeight();\n const totalWidth = this.table.getAllColsWidth();\n const frozenRowsHeight = this.table.getFrozenRowsHeight();\n const frozenColsWidth = this.table.getFrozenColsWidth();\n const bottomFrozenRowsHeight = this.table.getBottomFrozenRowsHeight();\n const rightFrozenColsWidth = this.table.getRightFrozenColsWidth();\n if (totalWidth > tableWidth) {\n const y = Math.min(tableHeight, totalHeight);\n const rangeEnd = Math.max(0.05, (tableWidth - frozenColsWidth) / (totalWidth - frozenColsWidth));\n this.hScrollBar.setAttributes({\n x: frozenColsWidth + (!this.table.theme.scrollStyle.hoverOn ? this.table.scenegraph.tableGroup.attribute.x : 0),\n y: y - (this.table.theme.scrollStyle.hoverOn ? width : -this.table.scenegraph.tableGroup.attribute.y),\n width: tableWidth - frozenColsWidth - rightFrozenColsWidth,\n range: [0, rangeEnd],\n visible: visible === 'always'\n });\n const bounds = this.hScrollBar.AABBBounds && this.hScrollBar.globalAABBBounds;\n (this.hScrollBar as any)._viewPosition = {\n x: bounds.x1,\n y: bounds.y1\n };\n if (visible === 'always') {\n this.hScrollBar.showAll();\n }\n } else {\n this.hScrollBar.setAttributes({\n x: -this.table.tableNoFrameWidth * 2,\n y: -this.table.tableNoFrameHeight * 2,\n width: 0,\n visible: false\n });\n }\n\n if (totalHeight > tableHeight) {\n const x = Math.min(tableWidth, totalWidth);\n const rangeEnd = Math.max(0.05, (tableHeight - frozenRowsHeight) / (totalHeight - frozenRowsHeight));\n this.vScrollBar.setAttributes({\n x: x - (this.table.theme.scrollStyle.hoverOn ? width : -this.table.scenegraph.tableGroup.attribute.x),\n y:\n frozenRowsHeight + (!this.table.theme.scrollStyle.hoverOn ? this.table.scenegraph.tableGroup.attribute.y : 0),\n height: tableHeight - frozenRowsHeight - bottomFrozenRowsHeight,\n range: [0, rangeEnd],\n visible: visible === 'always'\n });\n const bounds = this.vScrollBar.AABBBounds && this.vScrollBar.globalAABBBounds;\n (this.vScrollBar as any)._viewPosition = {\n x: bounds.x1,\n y: bounds.y1\n };\n\n if (visible === 'always') {\n this.vScrollBar.showAll();\n }\n } else {\n this.vScrollBar.setAttributes({\n x: -this.table.tableNoFrameWidth * 2,\n y: -this.table.tableNoFrameHeight * 2,\n height: 0,\n visible: false\n });\n }\n\n this.table.stateManager.setScrollLeft(oldHorizontalBarPos);\n this.table.stateManager.setScrollTop(oldVerticalBarPos);\n }\n\n /**\n * @description: 隐藏列宽调整组件\n * @return {*}\n */\n hideResizeCol() {\n // this.columnResizeLine.attribute.visible = false;\n this.columnResizeLine.setAttribute('visible', false);\n this.columnResizeBgLine.setAttribute('visible', false);\n this.columnResizeLabel.setAttribute('visible', false);\n this.columnResizeLabel.hideAll();\n }\n\n /**\n * @description: 显示列宽调整组件\n * @param {number} col\n * @param {number} y\n * @return {*}\n */\n showResizeCol(col: number, y: number, isRightFrozen?: boolean) {\n // this.columnResizeLine.attribute.visible = false;\n // 基准线\n const colX = getColX(col, this.table, isRightFrozen);\n this.columnResizeLine.setAttributes({\n visible: true,\n x: colX,\n points: [\n { x: 0, y: 0 },\n { x: 0, y: this.table.getRowsHeight(0, this.table.rowCount - 1) }\n ]\n });\n this.columnResizeBgLine.setAttributes({\n visible: true,\n x: colX,\n points: [\n { x: 0, y: 0 },\n { x: 0, y: this.table.getRowsHeight(0, this.table.rowCount - 1) }\n ]\n });\n\n // 标签\n // this.columnResizeLabel.setAttribute('visible', true);\n this.columnResizeLabel.showAll();\n this.columnResizeLabel.setAttributes({\n visible: true,\n x: colX,\n y\n });\n (this.columnResizeLabel.lastChild as Text).setAttribute('text', `${this.table.getColWidth(col)}px`);\n }\n\n /**\n * @description: 更新列宽调整组件\n * @param {number} col\n * @param {number} y 标签显示的y坐标\n * @return {*}\n */\n updateResizeCol(col: number, y: number, isRightFrozen?: boolean) {\n // 基准线\n const colX = getColX(col, this.table, isRightFrozen);\n // this.columnResizeLine.setAttribute('x', x);\n this.columnResizeLine.setAttributes({\n x: colX,\n points: [\n { x: 0, y: 0 },\n { x: 0, y: this.table.getRowsHeight(0, this.table.rowCount - 1) } // todo: 优化points赋值\n ]\n });\n this.columnResizeBgLine.setAttributes({\n x: colX,\n points: [\n { x: 0, y: 0 },\n { x: 0, y: this.table.getRowsHeight(0, this.table.rowCount - 1) } // todo: 优化points赋值\n ]\n });\n\n // 标签\n this.columnResizeLabel.setAttributes({\n x: colX,\n y\n });\n (this.columnResizeLabel.lastChild as Text).setAttribute('text', `${Math.floor(this.table.getColWidth(col))}px`);\n }\n\n /**\n * @description: 隐藏列顺序调整组件\n * @return {*}\n */\n hideMoveCol() {\n this.cellMover.hide();\n }\n\n /**\n * @description: 显示列顺序调整组件\n * @param {number} col\n * @param {number} x\n * @return {*}\n */\n showMoveCol(col: number, row: number, delta: number) {\n this.cellMover.show(col, row, delta);\n }\n\n /**\n * @description: 更新列顺序调整组件\n * @param {number} backX\n * @param {number} lineX\n * @return {*}\n */\n updateMoveCol(backX: number, lineX: number, backY: number, lineY: number) {\n this.cellMover.update(backX, lineX, backY, lineY);\n }\n\n /**\n * @description: 显示冻结列shadow\n * @param {number} col\n * @return {*}\n */\n setFrozenColumnShadow(col: number, isRightFrozen?: boolean) {\n if (col < 0) {\n this.frozenShadowLine.setAttributes({\n visible: false\n });\n } else {\n // const colX = this.table.getColsWidth(0, col);\n const colX = getColX(col, this.table, isRightFrozen);\n this.frozenShadowLine.setAttributes({\n visible: true,\n x: colX,\n height: this.table.getRowsHeight(0, this.table.rowCount - 1)\n });\n }\n }\n\n hideVerticalScrollBar() {\n const visable = this.table.theme.scrollStyle.visible;\n if (visable !== 'focus' && visable !== 'scrolling') {\n return;\n }\n this.vScrollBar.setAttribute('visible', false);\n this.vScrollBar.hideAll();\n this.table.scenegraph.updateNextFrame();\n }\n showVerticalScrollBar() {\n const visable = this.table.theme.scrollStyle.visible;\n if (visable !== 'focus' && visable !== 'scrolling') {\n return;\n }\n this.vScrollBar.setAttribute('visible', true);\n this.vScrollBar.showAll();\n this.table.scenegraph.updateNextFrame();\n }\n hideHorizontalScrollBar() {\n const visable = this.table.theme.scrollStyle.visible;\n if (visable !== 'focus' && visable !== 'scrolling') {\n return;\n }\n this.hScrollBar.setAttribute('visible', false);\n this.hScrollBar.hideAll();\n this.table.scenegraph.updateNextFrame();\n }\n showHorizontalScrollBar() {\n const visable = this.table.theme.scrollStyle.visible;\n if (visable !== 'focus' && visable !== 'scrolling') {\n return;\n }\n this.hScrollBar.setAttribute('visible', true);\n this.hScrollBar.showAll();\n this.table.scenegraph.updateNextFrame();\n }\n updateVerticalScrollBarPos(topRatio: number) {\n const range = this.vScrollBar.attribute.range;\n const size = range[1] - range[0];\n const range0 = topRatio * (1 - size);\n this.vScrollBar.setAttribute('range', [range0, range0 + size]);\n const bounds = this.vScrollBar.AABBBounds && this.vScrollBar.globalAABBBounds;\n (this.vScrollBar as any)._viewPosition = {\n x: bounds.x1,\n y: bounds.y1\n };\n }\n updateHorizontalScrollBarPos(leftRatio: number) {\n const range = this.hScrollBar.attribute.range;\n const size = range[1] - range[0];\n const range0 = leftRatio * (1 - size);\n this.hScrollBar.setAttribute('range', [range0, range0 + size]);\n const bounds = this.hScrollBar.AABBBounds && this.hScrollBar.globalAABBBounds;\n (this.hScrollBar as any)._viewPosition = {\n x: bounds.x1,\n y: bounds.y1\n };\n }\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export type { ITextGraphicAttribute, IWrapTextGraphicAttribute } from '@visactor/vrender';
|
|
2
|
-
export { WrapText } from '@visactor/vrender';
|
|
2
|
+
export { Text as WrapText } from '@visactor/vrender';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { WrapText } from "@visactor/vrender";
|
|
1
|
+
export { Text as WrapText } from "@visactor/vrender";
|
|
2
2
|
//# sourceMappingURL=text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/graphic/text.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC","file":"text.js","sourcesContent":["export type { ITextGraphicAttribute, IWrapTextGraphicAttribute } from '@visactor/vrender';\nexport { WrapText } from '@visactor/vrender';\n// import { getTheme, graphicUtil, Text, CanvasTextLayout, textDrawOffsetX, textLayoutOffsetY } from '@visactor/vrender';\n// import type { Bounds } from '@visactor/vutils';\n// import { textMeasure } from '../utils/measure-text';\n\n/* WrapText功能/dist/core/contributions/textMeasure/layout\n * 1. 按照宽度限制自动折行或显示省略号\n * 2. 高度限制控制显示内容及省略号\n */\n\n// const WRAP_TEXT_UPDATE_TAG_KEY = ['heightLimit', 'lineClamp', 'autoWrapText'];\n\n// export interface IWrapTextGraphicAttribute extends ITextGraphicAttribute {\n// // widthLimit: number;\n// heightLimit?: number;\n// lineClamp?: number;\n// autoWrapText?: boolean;\n// }\n// export class WrapText extends Text {\n// declare attribute: IWrapTextGraphicAttribute;\n\n// // eslint-disable-next-line no-useless-constructor\n// constructor(params: IWrapTextGraphicAttribute) {\n// super(params);\n// }\n\n// /**\n// * 计算单行文字的bounds,可以缓存长度以及截取的文字\n// * @param text\n// */\n// updateSingallineAABBBounds(text: number | string) {\n// const textTheme = getTheme(this).text;\n// // const textMeasure = graphicUtil.textMeasure;\n// let width: number;\n// let str: string;\n// const attribute = this.attribute;\n// const {\n// maxLineWidth = textTheme.maxLineWidth,\n// ellipsis = textTheme.ellipsis,\n// textAlign = textTheme.textAlign,\n// textBaseline = textTheme.textBaseline,\n// fontSize = textTheme.fontSize,\n// fontFamily = textTheme.fontFamily,\n// fontWeight = textTheme.fontWeight,\n// stroke = textTheme.stroke,\n// lineHeight = attribute.lineHeight ?? attribute.fontSize ?? textTheme.fontSize,\n// lineWidth = textTheme.lineWidth\n// } = attribute;\n\n// if (!this.shouldUpdateShape() && this.cache) {\n// width = this.cache.clipedWidth;\n// const dx = textDrawOffsetX(textAlign, width);\n// const dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);\n// this._AABBBounds.set(dx, dy, dx + width, dy + lineHeight);\n// if (stroke) {\n// this._AABBBounds.expand(lineWidth / 2);\n// }\n// return this._AABBBounds;\n// }\n\n// if (Number.isFinite(maxLineWidth)) {\n// if (ellipsis) {\n// const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis) as string;\n// const data = textMeasure.clipTextWithSuffix(\n// text.toString(),\n// { fontSize, fontFamily },\n// maxLineWidth,\n// strEllipsis\n// );\n// str = data.str;\n// width = data.width;\n// } else {\n// const data = textMeasure.clipText(text.toString(), { fontSize, fontFamily }, maxLineWidth);\n// str = data.str;\n// width = data.width;\n// }\n// this.cache.clipedText = str;\n// this.cache.clipedWidth = width;\n// // todo 计算原本的宽度\n// } else {\n// width = textMeasure.measureTextWidth(text.toString(), { fontSize, fontFamily, fontWeight });\n// this.cache.clipedText = text.toString();\n// this.cache.clipedWidth = width;\n// }\n// this.clearUpdateShapeTag();\n\n// const dx = textDrawOffsetX(textAlign, width);\n// const dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);\n// this._AABBBounds.set(dx, dy, dx + width, dy + lineHeight);\n\n// if (stroke) {\n// this._AABBBounds.expand(lineWidth / 2);\n// }\n\n// return this._AABBBounds;\n// }\n\n// /**\n// * 计算多行文字的bounds,缓存每行文字的布局位置\n// * 自动折行params.text是数组,因此只重新updateMultilineAABBBounds\n// * @param text\n// */\n// updateMultilineAABBBounds(text: (number | string)[]) {\n// const textTheme = getTheme(this).text;\n// const {\n// fontFamily = textTheme.fontFamily,\n// textAlign = textTheme.textAlign,\n// fontWeight = textTheme.fontWeight,\n// textBaseline = textTheme.textBaseline,\n// fontSize = textTheme.fontSize,\n// lineHeight = this.attribute.lineHeight ?? this.attribute.fontSize ?? textTheme.fontSize,\n// ellipsis = textTheme.ellipsis,\n// maxLineWidth,\n// stroke = textTheme.stroke,\n// lineWidth = textTheme.lineWidth,\n// // widthLimit,\n// heightLimit = -1,\n// lineClamp = (textTheme as any).lineClamp,\n// autoWrapText = (textTheme as any).autoWrapText\n// } = this.attribute;\n\n// if (!this.shouldUpdateShape() && this.cache?.layoutData) {\n// const bbox = this.cache.layoutData.bbox;\n// this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);\n// if (stroke) {\n// this._AABBBounds.expand(lineWidth / 2);\n// }\n// return this._AABBBounds;\n// }\n\n// // const textMeasure = graphicUtil.textMeasure;\n// const layoutObj = new CanvasTextLayout(fontFamily, { fontSize, fontFamily }, textMeasure as any) as any;\n\n// // layoutObj内逻辑\n// const lines = text.map(l => l.toString()) as string[];\n// const linesLayout: LayoutItemType[] = [];\n// const bboxWH: [number, number] = [0, 0];\n\n// let lineCountLimit = Infinity;\n// if (heightLimit > 0) {\n// lineCountLimit = Math.max(Math.floor(heightLimit / lineHeight), 1);\n// }\n// if (lineClamp) {\n// // 处理行数限制\n// lineCountLimit = Math.min(lineCountLimit, lineClamp);\n// }\n\n// if (!autoWrapText) {\n// // 使用所有行中最长的作为lineWidth\n// let lineWidth = 0;\n// for (let i = 0, len = lines.length; i < len; i++) {\n// // 判断是否超过高度限制\n// if (i < lineCountLimit) {\n// // 当前行为最后一行\n// const clip = layoutObj.textMeasure.clipTextWithSuffix(\n// lines[i],\n// layoutObj.textOptions,\n// maxLineWidth,\n// ellipsis\n// );\n// linesLayout.push({\n// str: clip.str,\n// width: clip.width\n// });\n// lineWidth = Math.max(lineWidth, clip.width);\n// }\n// }\n// bboxWH[0] = lineWidth;\n// } else if (typeof maxLineWidth === 'number' && maxLineWidth !== Infinity) {\n// // widthLimit > 0\n// if (maxLineWidth > 0) {\n// for (let i = 0; i < lines.length; i++) {\n// const str = lines[i] as string;\n// // // 测量当前行宽度\n// // width = Math.min(\n// // layoutObj.textMeasure.measureTextWidth(str, layoutObj.textOptions),\n// // maxLineWidth\n// // );\n\n// // 判断是否超过高度限制\n// if (i === lineCountLimit - 1) {\n// // 当前行为最后一行\n// const clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis);\n// linesLayout.push({\n// str: clip.str,\n// width: clip.width\n// });\n// break; // 不处理后续行\n// }\n\n// // 测量截断位置\n// const clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth);\n// if (str !== '' && clip.str === '') {\n// // 宽度限制不足一个字符,至少截取一个字符\n// clip.str = str.substring(0, 1);\n// clip.width = textMeasure.measureTextWidth(clip.str, { fontSize, fontFamily, fontWeight });\n// }\n\n// linesLayout.push({\n// str: clip.str,\n// width: clip.width\n// });\n// if (clip.str.length === str.length) {\n// // 不需要截断\n// } else {\n// const newStr = str.substring(clip.str.length);\n// lines.splice(i + 1, 0, newStr);\n// }\n// }\n// }\n// // bboxWH[0] = maxLineWidth;\n// let maxWidth = 0;\n// linesLayout.forEach(layout => {\n// maxWidth = Math.max(maxWidth, layout.width);\n// });\n// bboxWH[0] = maxWidth;\n// } else {\n// // 使用所有行中最长的作为lineWidth\n// let lineWidth = 0;\n// let width: number;\n// let text: string;\n// for (let i = 0, len = lines.length; i < len; i++) {\n// // 判断是否超过高度限制\n// if (i === lineCountLimit - 1) {\n// // 当前行为最后一行\n// const clip = layoutObj.textMeasure.clipTextWithSuffix(\n// lines[i],\n// layoutObj.textOptions,\n// maxLineWidth,\n// ellipsis\n// );\n// linesLayout.push({\n// str: clip.str,\n// width: clip.width\n// });\n// lineWidth = Math.max(lineWidth, clip.width);\n// break; // 不处理后续行\n// }\n\n// text = lines[i] as string;\n// width = layoutObj.textMeasure.measureTextWidth(text, layoutObj.textOptions);\n// lineWidth = Math.max(lineWidth, width);\n// linesLayout.push({ str: text, width });\n// }\n// bboxWH[0] = lineWidth;\n// }\n// bboxWH[1] = linesLayout.length * lineHeight;\n\n// const bbox = {\n// xOffset: 0,\n// yOffset: 0,\n// width: bboxWH[0],\n// height: bboxWH[1]\n// };\n\n// layoutObj.LayoutBBox(bbox, textAlign, textBaseline as any);\n\n// const layoutData = layoutObj.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline as any, lineHeight);\n\n// // const layoutData = layoutObj.GetLayoutByLines(\n// // text,\n// // textAlign,\n// // textBaseline as any,\n// // lineHeight,\n// // ellipsis === true ? (DefaultTextAttribute.ellipsis as string) : ellipsis || undefined,\n// // maxLineWidth\n// // );\n// // const { bbox } = layoutData;\n// this.cache.layoutData = layoutData;\n// this.clearUpdateShapeTag();\n// this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);\n\n// if (stroke) {\n// this._AABBBounds.expand(lineWidth / 2);\n// }\n\n// return this._AABBBounds;\n// }\n\n// needUpdateTags(keys: string[]): boolean {\n// for (let i = 0; i < WRAP_TEXT_UPDATE_TAG_KEY.length; i++) {\n// const attrKey = WRAP_TEXT_UPDATE_TAG_KEY[i];\n// if (keys.indexOf(attrKey) !== -1) {\n// return true;\n// }\n// }\n// return super.needUpdateTags(keys);\n// }\n// needUpdateTag(key: string): boolean {\n// for (let i = 0; i < WRAP_TEXT_UPDATE_TAG_KEY.length; i++) {\n// const attrKey = WRAP_TEXT_UPDATE_TAG_KEY[i];\n// if (key === attrKey) {\n// return true;\n// }\n// }\n// return super.needUpdateTag(key);\n// }\n// }\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/graphic/text.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC","file":"text.js","sourcesContent":["export type { ITextGraphicAttribute, IWrapTextGraphicAttribute } from '@visactor/vrender';\nexport { Text as WrapText } from '@visactor/vrender';\n// import { getTheme, graphicUtil, Text, CanvasTextLayout, textDrawOffsetX, textLayoutOffsetY } from '@visactor/vrender';\n// import type { Bounds } from '@visactor/vutils';\n// import { textMeasure } from '../utils/measure-text';\n\n/* WrapText功能/dist/core/contributions/textMeasure/layout\n * 1. 按照宽度限制自动折行或显示省略号\n * 2. 高度限制控制显示内容及省略号\n */\n\n// const WRAP_TEXT_UPDATE_TAG_KEY = ['heightLimit', 'lineClamp', 'autoWrapText'];\n\n// export interface IWrapTextGraphicAttribute extends ITextGraphicAttribute {\n// // widthLimit: number;\n// heightLimit?: number;\n// lineClamp?: number;\n// autoWrapText?: boolean;\n// }\n// export class WrapText extends Text {\n// declare attribute: IWrapTextGraphicAttribute;\n\n// // eslint-disable-next-line no-useless-constructor\n// constructor(params: IWrapTextGraphicAttribute) {\n// super(params);\n// }\n\n// /**\n// * 计算单行文字的bounds,可以缓存长度以及截取的文字\n// * @param text\n// */\n// updateSingallineAABBBounds(text: number | string) {\n// const textTheme = getTheme(this).text;\n// // const textMeasure = graphicUtil.textMeasure;\n// let width: number;\n// let str: string;\n// const attribute = this.attribute;\n// const {\n// maxLineWidth = textTheme.maxLineWidth,\n// ellipsis = textTheme.ellipsis,\n// textAlign = textTheme.textAlign,\n// textBaseline = textTheme.textBaseline,\n// fontSize = textTheme.fontSize,\n// fontFamily = textTheme.fontFamily,\n// fontWeight = textTheme.fontWeight,\n// stroke = textTheme.stroke,\n// lineHeight = attribute.lineHeight ?? attribute.fontSize ?? textTheme.fontSize,\n// lineWidth = textTheme.lineWidth\n// } = attribute;\n\n// if (!this.shouldUpdateShape() && this.cache) {\n// width = this.cache.clipedWidth;\n// const dx = textDrawOffsetX(textAlign, width);\n// const dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);\n// this._AABBBounds.set(dx, dy, dx + width, dy + lineHeight);\n// if (stroke) {\n// this._AABBBounds.expand(lineWidth / 2);\n// }\n// return this._AABBBounds;\n// }\n\n// if (Number.isFinite(maxLineWidth)) {\n// if (ellipsis) {\n// const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis) as string;\n// const data = textMeasure.clipTextWithSuffix(\n// text.toString(),\n// { fontSize, fontFamily },\n// maxLineWidth,\n// strEllipsis\n// );\n// str = data.str;\n// width = data.width;\n// } else {\n// const data = textMeasure.clipText(text.toString(), { fontSize, fontFamily }, maxLineWidth);\n// str = data.str;\n// width = data.width;\n// }\n// this.cache.clipedText = str;\n// this.cache.clipedWidth = width;\n// // todo 计算原本的宽度\n// } else {\n// width = textMeasure.measureTextWidth(text.toString(), { fontSize, fontFamily, fontWeight });\n// this.cache.clipedText = text.toString();\n// this.cache.clipedWidth = width;\n// }\n// this.clearUpdateShapeTag();\n\n// const dx = textDrawOffsetX(textAlign, width);\n// const dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);\n// this._AABBBounds.set(dx, dy, dx + width, dy + lineHeight);\n\n// if (stroke) {\n// this._AABBBounds.expand(lineWidth / 2);\n// }\n\n// return this._AABBBounds;\n// }\n\n// /**\n// * 计算多行文字的bounds,缓存每行文字的布局位置\n// * 自动折行params.text是数组,因此只重新updateMultilineAABBBounds\n// * @param text\n// */\n// updateMultilineAABBBounds(text: (number | string)[]) {\n// const textTheme = getTheme(this).text;\n// const {\n// fontFamily = textTheme.fontFamily,\n// textAlign = textTheme.textAlign,\n// fontWeight = textTheme.fontWeight,\n// textBaseline = textTheme.textBaseline,\n// fontSize = textTheme.fontSize,\n// lineHeight = this.attribute.lineHeight ?? this.attribute.fontSize ?? textTheme.fontSize,\n// ellipsis = textTheme.ellipsis,\n// maxLineWidth,\n// stroke = textTheme.stroke,\n// lineWidth = textTheme.lineWidth,\n// // widthLimit,\n// heightLimit = -1,\n// lineClamp = (textTheme as any).lineClamp,\n// autoWrapText = (textTheme as any).autoWrapText\n// } = this.attribute;\n\n// if (!this.shouldUpdateShape() && this.cache?.layoutData) {\n// const bbox = this.cache.layoutData.bbox;\n// this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);\n// if (stroke) {\n// this._AABBBounds.expand(lineWidth / 2);\n// }\n// return this._AABBBounds;\n// }\n\n// // const textMeasure = graphicUtil.textMeasure;\n// const layoutObj = new CanvasTextLayout(fontFamily, { fontSize, fontFamily }, textMeasure as any) as any;\n\n// // layoutObj内逻辑\n// const lines = text.map(l => l.toString()) as string[];\n// const linesLayout: LayoutItemType[] = [];\n// const bboxWH: [number, number] = [0, 0];\n\n// let lineCountLimit = Infinity;\n// if (heightLimit > 0) {\n// lineCountLimit = Math.max(Math.floor(heightLimit / lineHeight), 1);\n// }\n// if (lineClamp) {\n// // 处理行数限制\n// lineCountLimit = Math.min(lineCountLimit, lineClamp);\n// }\n\n// if (!autoWrapText) {\n// // 使用所有行中最长的作为lineWidth\n// let lineWidth = 0;\n// for (let i = 0, len = lines.length; i < len; i++) {\n// // 判断是否超过高度限制\n// if (i < lineCountLimit) {\n// // 当前行为最后一行\n// const clip = layoutObj.textMeasure.clipTextWithSuffix(\n// lines[i],\n// layoutObj.textOptions,\n// maxLineWidth,\n// ellipsis\n// );\n// linesLayout.push({\n// str: clip.str,\n// width: clip.width\n// });\n// lineWidth = Math.max(lineWidth, clip.width);\n// }\n// }\n// bboxWH[0] = lineWidth;\n// } else if (typeof maxLineWidth === 'number' && maxLineWidth !== Infinity) {\n// // widthLimit > 0\n// if (maxLineWidth > 0) {\n// for (let i = 0; i < lines.length; i++) {\n// const str = lines[i] as string;\n// // // 测量当前行宽度\n// // width = Math.min(\n// // layoutObj.textMeasure.measureTextWidth(str, layoutObj.textOptions),\n// // maxLineWidth\n// // );\n\n// // 判断是否超过高度限制\n// if (i === lineCountLimit - 1) {\n// // 当前行为最后一行\n// const clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis);\n// linesLayout.push({\n// str: clip.str,\n// width: clip.width\n// });\n// break; // 不处理后续行\n// }\n\n// // 测量截断位置\n// const clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth);\n// if (str !== '' && clip.str === '') {\n// // 宽度限制不足一个字符,至少截取一个字符\n// clip.str = str.substring(0, 1);\n// clip.width = textMeasure.measureTextWidth(clip.str, { fontSize, fontFamily, fontWeight });\n// }\n\n// linesLayout.push({\n// str: clip.str,\n// width: clip.width\n// });\n// if (clip.str.length === str.length) {\n// // 不需要截断\n// } else {\n// const newStr = str.substring(clip.str.length);\n// lines.splice(i + 1, 0, newStr);\n// }\n// }\n// }\n// // bboxWH[0] = maxLineWidth;\n// let maxWidth = 0;\n// linesLayout.forEach(layout => {\n// maxWidth = Math.max(maxWidth, layout.width);\n// });\n// bboxWH[0] = maxWidth;\n// } else {\n// // 使用所有行中最长的作为lineWidth\n// let lineWidth = 0;\n// let width: number;\n// let text: string;\n// for (let i = 0, len = lines.length; i < len; i++) {\n// // 判断是否超过高度限制\n// if (i === lineCountLimit - 1) {\n// // 当前行为最后一行\n// const clip = layoutObj.textMeasure.clipTextWithSuffix(\n// lines[i],\n// layoutObj.textOptions,\n// maxLineWidth,\n// ellipsis\n// );\n// linesLayout.push({\n// str: clip.str,\n// width: clip.width\n// });\n// lineWidth = Math.max(lineWidth, clip.width);\n// break; // 不处理后续行\n// }\n\n// text = lines[i] as string;\n// width = layoutObj.textMeasure.measureTextWidth(text, layoutObj.textOptions);\n// lineWidth = Math.max(lineWidth, width);\n// linesLayout.push({ str: text, width });\n// }\n// bboxWH[0] = lineWidth;\n// }\n// bboxWH[1] = linesLayout.length * lineHeight;\n\n// const bbox = {\n// xOffset: 0,\n// yOffset: 0,\n// width: bboxWH[0],\n// height: bboxWH[1]\n// };\n\n// layoutObj.LayoutBBox(bbox, textAlign, textBaseline as any);\n\n// const layoutData = layoutObj.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline as any, lineHeight);\n\n// // const layoutData = layoutObj.GetLayoutByLines(\n// // text,\n// // textAlign,\n// // textBaseline as any,\n// // lineHeight,\n// // ellipsis === true ? (DefaultTextAttribute.ellipsis as string) : ellipsis || undefined,\n// // maxLineWidth\n// // );\n// // const { bbox } = layoutData;\n// this.cache.layoutData = layoutData;\n// this.clearUpdateShapeTag();\n// this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);\n\n// if (stroke) {\n// this._AABBBounds.expand(lineWidth / 2);\n// }\n\n// return this._AABBBounds;\n// }\n\n// needUpdateTags(keys: string[]): boolean {\n// for (let i = 0; i < WRAP_TEXT_UPDATE_TAG_KEY.length; i++) {\n// const attrKey = WRAP_TEXT_UPDATE_TAG_KEY[i];\n// if (keys.indexOf(attrKey) !== -1) {\n// return true;\n// }\n// }\n// return super.needUpdateTags(keys);\n// }\n// needUpdateTag(key: string): boolean {\n// for (let i = 0; i < WRAP_TEXT_UPDATE_TAG_KEY.length; i++) {\n// const attrKey = WRAP_TEXT_UPDATE_TAG_KEY[i];\n// if (key === attrKey) {\n// return true;\n// }\n// }\n// return super.needUpdateTag(key);\n// }\n// }\n"]}
|
|
@@ -105,7 +105,8 @@ export function updateCell(col, row, table, addNew) {
|
|
|
105
105
|
stroke: null !== (_g = null === (_f = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _f ? void 0 : _f.stroke) && void 0 !== _g ? _g : void 0,
|
|
106
106
|
strokeArrayWidth: null !== (_j = null === (_h = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _h ? void 0 : _h.strokeArrayWidth) && void 0 !== _j ? _j : void 0,
|
|
107
107
|
strokeArrayColor: null !== (_l = null === (_k = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _k ? void 0 : _k.strokeArrayColor) && void 0 !== _l ? _l : void 0,
|
|
108
|
-
cursor: null !== (_o = null === (_m = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _m ? void 0 : _m.cursor) && void 0 !== _o ? _o : void 0
|
|
108
|
+
cursor: null !== (_o = null === (_m = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _m ? void 0 : _m.cursor) && void 0 !== _o ? _o : void 0,
|
|
109
|
+
y: table.scenegraph.getCellGroupY(row)
|
|
109
110
|
});
|
|
110
111
|
const textMark = oldCellGroup.getChildByName("text");
|
|
111
112
|
if (textMark) {
|