@visactor/vtable 0.9.1 → 0.9.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/core/BaseTable.d.ts +1 -1
- package/cjs/core/BaseTable.js +10 -8
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/event/event.js +1 -1
- package/cjs/event/event.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 +2 -0
- package/cjs/layout/pivot-header-layout.js +26 -0
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/pivot-layout.d.ts +2 -0
- package/cjs/layout/pivot-layout.js +26 -0
- package/cjs/layout/pivot-layout.js.map +1 -1
- package/cjs/layout/simple-header-layout.d.ts +2 -0
- package/cjs/layout/simple-header-layout.js +6 -0
- package/cjs/layout/simple-header-layout.js.map +1 -1
- package/cjs/render/layout/container.js +13 -0
- package/cjs/render/layout/container.js.map +1 -1
- package/cjs/scenegraph/graphic/text.js +5 -5
- package/cjs/scenegraph/graphic/text.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.d.ts +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +14 -10
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.d.ts +2 -1
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +4 -4
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/image-cell.d.ts +1 -1
- package/cjs/scenegraph/group-creater/cell-type/image-cell.js +1 -2
- package/cjs/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.d.ts +2 -1
- package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.js +2 -3
- package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/text-cell.d.ts +1 -2
- package/cjs/scenegraph/group-creater/cell-type/text-cell.js +6 -18
- package/cjs/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/video-cell.d.ts +1 -1
- package/cjs/scenegraph/group-creater/cell-type/video-cell.js +1 -2
- package/cjs/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/column-helper.js +9 -30
- package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.d.ts +31 -12
- package/cjs/scenegraph/group-creater/progress/proxy.js +118 -123
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.d.ts +2 -0
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +112 -0
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -0
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.d.ts +2 -0
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +109 -0
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -0
- package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.d.ts +2 -0
- package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.js +24 -0
- package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.js.map +1 -0
- package/cjs/scenegraph/layout/compute-col-width.d.ts +9 -1
- package/cjs/scenegraph/layout/compute-col-width.js +11 -9
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.d.ts +3 -0
- package/cjs/scenegraph/layout/compute-row-height.js +162 -0
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -0
- package/cjs/scenegraph/layout/update-height.js +3 -2
- package/cjs/scenegraph/layout/update-height.js.map +1 -1
- package/cjs/scenegraph/layout/update-width.js +3 -2
- package/cjs/scenegraph/layout/update-width.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +4 -5
- package/cjs/scenegraph/scenegraph.js +23 -42
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/stick-text/index.d.ts +1 -0
- package/cjs/scenegraph/stick-text/index.js +16 -2
- package/cjs/scenegraph/stick-text/index.js.map +1 -1
- package/cjs/scenegraph/utils/text-icon-layout.d.ts +2 -1
- package/cjs/scenegraph/utils/text-icon-layout.js +6 -5
- package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
- package/cjs/state/hover/col.js +4 -4
- package/cjs/state/hover/col.js.map +1 -1
- package/cjs/tools/NumberMap.d.ts +1 -0
- package/cjs/tools/NumberMap.js +3 -0
- package/cjs/tools/NumberMap.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +12 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/list-table/layout-map/api.d.ts +2 -0
- package/cjs/ts-types/list-table/layout-map/api.js.map +1 -1
- package/dist/vtable.js +7621 -7036
- package/dist/vtable.min.js +2 -2
- package/es/core/BaseTable.d.ts +1 -1
- package/es/core/BaseTable.js +10 -8
- package/es/core/BaseTable.js.map +1 -1
- package/es/event/event.js +2 -2
- package/es/event/event.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 +2 -0
- package/es/layout/pivot-header-layout.js +26 -0
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/pivot-layout.d.ts +2 -0
- package/es/layout/pivot-layout.js +26 -0
- package/es/layout/pivot-layout.js.map +1 -1
- package/es/layout/simple-header-layout.d.ts +2 -0
- package/es/layout/simple-header-layout.js +6 -0
- package/es/layout/simple-header-layout.js.map +1 -1
- package/es/render/layout/container.js +13 -0
- package/es/render/layout/container.js.map +1 -1
- package/es/scenegraph/graphic/text.js +5 -5
- package/es/scenegraph/graphic/text.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.d.ts +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +14 -9
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/chart-cell.d.ts +2 -1
- package/es/scenegraph/group-creater/cell-type/chart-cell.js +3 -5
- package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/image-cell.d.ts +1 -1
- package/es/scenegraph/group-creater/cell-type/image-cell.js +0 -3
- package/es/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/spark-line-cell.d.ts +2 -1
- package/es/scenegraph/group-creater/cell-type/spark-line-cell.js +1 -4
- package/es/scenegraph/group-creater/cell-type/spark-line-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/text-cell.d.ts +1 -2
- package/es/scenegraph/group-creater/cell-type/text-cell.js +3 -17
- package/es/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/video-cell.d.ts +1 -1
- package/es/scenegraph/group-creater/cell-type/video-cell.js +0 -3
- package/es/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
- package/es/scenegraph/group-creater/column-helper.js +8 -29
- package/es/scenegraph/group-creater/column-helper.js.map +1 -1
- package/es/scenegraph/group-creater/progress/proxy.d.ts +31 -12
- package/es/scenegraph/group-creater/progress/proxy.js +124 -123
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.d.ts +2 -0
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +104 -0
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -0
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.d.ts +2 -0
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +102 -0
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -0
- package/es/scenegraph/group-creater/progress/update-position/update-auto-row.d.ts +2 -0
- package/es/scenegraph/group-creater/progress/update-position/update-auto-row.js +18 -0
- package/es/scenegraph/group-creater/progress/update-position/update-auto-row.js.map +1 -0
- package/es/scenegraph/layout/compute-col-width.d.ts +9 -1
- package/es/scenegraph/layout/compute-col-width.js +9 -8
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.d.ts +3 -0
- package/es/scenegraph/layout/compute-row-height.js +164 -0
- package/es/scenegraph/layout/compute-row-height.js.map +1 -0
- package/es/scenegraph/layout/update-height.js +3 -1
- package/es/scenegraph/layout/update-height.js.map +1 -1
- package/es/scenegraph/layout/update-width.js +3 -1
- package/es/scenegraph/layout/update-width.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +4 -5
- package/es/scenegraph/scenegraph.js +24 -44
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/stick-text/index.d.ts +1 -0
- package/es/scenegraph/stick-text/index.js +14 -0
- package/es/scenegraph/stick-text/index.js.map +1 -1
- package/es/scenegraph/utils/text-icon-layout.d.ts +2 -1
- package/es/scenegraph/utils/text-icon-layout.js +4 -4
- package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
- package/es/state/hover/col.js +4 -4
- package/es/state/hover/col.js.map +1 -1
- package/es/tools/NumberMap.d.ts +1 -0
- package/es/tools/NumberMap.js +3 -0
- package/es/tools/NumberMap.js.map +1 -1
- package/es/ts-types/base-table.d.ts +12 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/list-table/layout-map/api.d.ts +2 -0
- package/es/ts-types/list-table/layout-map/api.js.map +1 -1
- package/package.json +4 -4
- package/dist/vtable.es5.js +0 -53155
- package/dist/vtable.es5.min.js +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["render/layout/container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA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AAI,CAAC,KAAK;gBACjB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,YAAY,EAAE,CAAC;gBACf,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,sBAAsB;gBAC5B,SAAS,EAAE,CAAC;aACb,CAAC,CAAC;YACH,UAAU,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC;YAC3C,UAAU,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC;YAC3C,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SAC3B;QAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC3B,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC;YAE1C,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,CACpC;gBACE,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC,OAAO;gBACvD,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC,OAAO;aACjD,EACR,OAAO,EACP,QAAQ,CACT,CAAC;YACF,QAAQ,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;SACjC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF","file":"container.js","sourcesContent":["import { isNumber } from '../../tools/util';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { DirectionKey } from './direction';\nimport { DIRECTION_KEY } from './direction';\nimport type { ElementOptions } from './element';\nimport { BaseElement } from './element';\nimport { Line } from './line';\nimport type { percentCalcObj } from './percent-calc';\nimport { Rect } from './rect';\n\ntype containerOptions = {\n width?: number | percentCalcObj;\n height?: number | percentCalcObj;\n direction?: 'row' | 'column'; // 布局主方向\n justifyContent?: 'start' | 'end' | 'center'; // 布局方向上的对齐方式\n alignItems?: 'start' | 'end' | 'center'; // 布局交叉方向上的对齐方式\n alignContent?: 'start' | 'end' | 'center'; // 布局交叉方向上多根轴线的对齐方式\n showBounds?: boolean; // 是否显示bounds\n} & ElementOptions;\n\nexport class Container extends BaseElement {\n type: 'container' = 'container';\n declare width: number;\n _widthObj: percentCalcObj;\n declare height: number;\n _heightObj: percentCalcObj;\n needCalcSize = false;\n direction: 'row' | 'column'; // 布局主方向\n justifyContent: 'start' | 'end' | 'center'; // 布局方向上的对齐方式\n alignItems: 'start' | 'end' | 'center'; // 布局交叉方向上的对齐方式\n alignContent: 'start' | 'end' | 'center'; // 布局交叉方向上多根轴线的对齐方式\n lines: Line[] = [];\n currentLine?: Line;\n currentLineY = 0;\n table: BaseTableAPI;\n directionKey: DirectionKey;\n showBounds: boolean;\n offsetY = 0;\n isRoot?: boolean;\n\n constructor(options: containerOptions) {\n super(options);\n this.direction = options.direction || 'row';\n this.justifyContent = options.justifyContent || 'start';\n this.alignItems = options.alignItems || 'start';\n this.alignContent = options.alignContent || 'start';\n\n if (isNumber(options.width)) {\n this.width = options.width as number;\n } else {\n this._widthObj = options.width as percentCalcObj;\n this.needCalcSize = true;\n }\n if (isNumber(options.height)) {\n this.height = options.height as number;\n } else {\n this._heightObj = options.height as percentCalcObj;\n this.needCalcSize = true;\n }\n\n this.directionKey = DIRECTION_KEY[this.direction];\n\n this.showBounds = options.showBounds || false;\n\n this.initLayoutSize();\n }\n\n add(element: BaseElement) {\n if (this.needCalcSize) {\n throw new Error('Need to specify a parent element before adding a child element when use percent size!');\n }\n\n if (element.type === 'container') {\n (element as Container).calcSize(this.width, this.height);\n }\n\n if (this.currentLine && this.currentLine.canAdd(element)) {\n this.currentLine.add(element);\n } else {\n if (this.currentLine) {\n this.currentLine.addAble = false; // 关闭当前行\n this.currentLineY += this.currentLine[this.directionKey.height]; // 更新目前line y位置\n this.currentLine.lineFinish();\n }\n // this.currentLine = new Line(this.width);\n this.currentLine = new Line(this[this.directionKey.width], this.direction, this.justifyContent, this.alignItems);\n this.currentLine[this.directionKey.y] = this.currentLineY;\n this.currentLine.add(element);\n this.lines.push(this.currentLine);\n }\n }\n\n // 交叉方向上多根轴线的对齐方式\n updateYAlign() {\n const offsetY = this[this.directionKey.height] - this.currentLineY;\n if (this.alignContent === 'center') {\n this.offsetY = offsetY / 2;\n } else if (this.alignContent === 'start') {\n this.offsetY = 0;\n } else {\n this.offsetY = offsetY;\n }\n }\n\n getSize() {\n const result = {\n width: 0,\n height: 0\n };\n if (this.currentLine && this.currentLine.addAble) {\n result[this.directionKey.height] = this.currentLineY + this.currentLine[this.directionKey.height];\n } else {\n result[this.directionKey.height] = this.currentLineY;\n }\n\n for (let i = 0; i < this.lines.length; i++) {\n const line = this.lines[i];\n if (result[this.directionKey.width] < line[this.directionKey.width]) {\n result[this.directionKey.width] = line[this.directionKey.width];\n }\n }\n return result;\n }\n\n getContentSize() {\n const result = {\n width: 0,\n height: 0\n };\n\n const calcFlag = {\n width: true,\n height: true\n };\n\n if (!this.isRoot && !this._heightObj) {\n calcFlag.height = false;\n result.height = this.height;\n }\n if (!this.isRoot && !this._widthObj) {\n calcFlag.width = false;\n result.width = this.width;\n }\n\n for (let i = 0; i < this.lines.length; i++) {\n const line = this.lines[i];\n const size = line.getContentSize();\n if (calcFlag[this.directionKey.width] && result[this.directionKey.width] < size[this.directionKey.width]) {\n result[this.directionKey.width] = size[this.directionKey.width];\n }\n\n if (calcFlag[this.directionKey.height]) {\n result[this.directionKey.height] += size[this.directionKey.height];\n }\n }\n\n return result;\n }\n\n calcSize(parentWidth: number, parentHeight: number) {\n if (this._heightObj) {\n this.height = (parentHeight * this._heightObj.percent) / 100 + this._heightObj.delta;\n this.needCalcSize = false;\n this.initLayoutSize();\n }\n if (this._widthObj) {\n this.width = (parentWidth * this._widthObj.percent) / 100 + this._widthObj.delta;\n this.needCalcSize = false;\n this.initLayoutSize();\n }\n }\n\n // 获取平坦后的全部子图元,更新子图元xy位置信息\n getElements(\n parentPos: { parentX: number; parentY: number } = { parentX: 0, parentY: 0 },\n isHover = false,\n isSelect = false\n ) {\n // 关闭最后一行\n if (this.currentLine && this.currentLine.addAble) {\n this.currentLine.addAble = false; // 关闭当前行\n this.currentLineY += this.currentLine[this.directionKey.height]; // 更新目前line y位置\n this.currentLine.lineFinish();\n }\n\n // 处理alignContent\n this.updateYAlign();\n\n const elements = [];\n if (this.showBounds) {\n const boundsRect = new Rect({\n width: this.width,\n height: this.height,\n cornerRadius: 0,\n stroke: 'red',\n fill: 'rgba(255, 0, 0, 0.2)',\n lineWidth: 4\n });\n boundsRect.x += this.x + parentPos.parentX;\n boundsRect.y += this.y + parentPos.parentY;\n elements.push(boundsRect);\n }\n // const parentPos = { parentX, parentY };\n for (let i = 0; i < this.lines.length; i++) {\n const line = this.lines[i];\n line[this.directionKey.y] += this.offsetY;\n // const linesElements = line.getElements(table, this.x + parentX, this.y + parentY);\n const linesElements = line.getElements(\n {\n [this.directionKey.parentX]: this.x + parentPos.parentX,\n [this.directionKey.parentY]: this.y + parentPos.parentY\n } as any,\n isHover,\n isSelect\n );\n elements.push(...linesElements);\n }\n\n return elements;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["render/layout/container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAY9B,MAAM,OAAO,SAAU,SAAQ,WAAW;IAoBxC,YAAY,OAAyB;QACnC,KAAK,CAA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,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC,OAAO;aACjD,EACR,OAAO,EACP,QAAQ,CACT,CAAC;YACF,QAAQ,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;SACjC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF","file":"container.js","sourcesContent":["import { isNumber } from '../../tools/util';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { DirectionKey } from './direction';\nimport { DIRECTION_KEY } from './direction';\nimport type { ElementOptions } from './element';\nimport { BaseElement } from './element';\nimport { Line } from './line';\nimport type { percentCalcObj } from './percent-calc';\nimport { Rect } from './rect';\n\ntype containerOptions = {\n width?: number | percentCalcObj;\n height?: number | percentCalcObj;\n direction?: 'row' | 'column'; // 布局主方向\n justifyContent?: 'start' | 'end' | 'center'; // 布局方向上的对齐方式\n alignItems?: 'start' | 'end' | 'center'; // 布局交叉方向上的对齐方式\n alignContent?: 'start' | 'end' | 'center'; // 布局交叉方向上多根轴线的对齐方式\n showBounds?: boolean; // 是否显示bounds\n} & ElementOptions;\n\nexport class Container extends BaseElement {\n type: 'container' = 'container';\n declare width: number;\n _widthObj: percentCalcObj;\n declare height: number;\n _heightObj: percentCalcObj;\n needCalcSize = false;\n direction: 'row' | 'column'; // 布局主方向\n justifyContent: 'start' | 'end' | 'center'; // 布局方向上的对齐方式\n alignItems: 'start' | 'end' | 'center'; // 布局交叉方向上的对齐方式\n alignContent: 'start' | 'end' | 'center'; // 布局交叉方向上多根轴线的对齐方式\n lines: Line[] = [];\n currentLine?: Line;\n currentLineY = 0;\n table: BaseTableAPI;\n directionKey: DirectionKey;\n showBounds: boolean;\n offsetY = 0;\n isRoot?: boolean;\n\n constructor(options: containerOptions) {\n super(options);\n this.direction = options.direction || 'row';\n this.justifyContent = options.justifyContent || 'start';\n this.alignItems = options.alignItems || 'start';\n this.alignContent = options.alignContent || 'start';\n\n if (isNumber(options.width)) {\n this.width = options.width as number;\n } else {\n this._widthObj = options.width as percentCalcObj;\n this.needCalcSize = true;\n }\n if (isNumber(options.height)) {\n this.height = options.height as number;\n } else {\n this._heightObj = options.height as percentCalcObj;\n this.needCalcSize = true;\n }\n\n this.directionKey = DIRECTION_KEY[this.direction];\n\n this.showBounds = options.showBounds || false;\n\n this.initLayoutSize();\n }\n\n add(element: BaseElement) {\n if (this.needCalcSize) {\n throw new Error('Need to specify a parent element before adding a child element when use percent size!');\n }\n\n if (element.type === 'container') {\n (element as Container).calcSize(this.width, this.height);\n }\n\n if (this.currentLine && this.currentLine.canAdd(element)) {\n this.currentLine.add(element);\n } else {\n if (this.currentLine) {\n this.currentLine.addAble = false; // 关闭当前行\n this.currentLineY += this.currentLine[this.directionKey.height]; // 更新目前line y位置\n this.currentLine.lineFinish();\n }\n // this.currentLine = new Line(this.width);\n this.currentLine = new Line(this[this.directionKey.width], this.direction, this.justifyContent, this.alignItems);\n this.currentLine[this.directionKey.y] = this.currentLineY;\n this.currentLine.add(element);\n this.lines.push(this.currentLine);\n }\n }\n\n // 交叉方向上多根轴线的对齐方式\n updateYAlign() {\n const offsetY = this[this.directionKey.height] - this.currentLineY;\n if (this.alignContent === 'center') {\n this.offsetY = offsetY / 2;\n } else if (this.alignContent === 'start') {\n this.offsetY = 0;\n } else {\n this.offsetY = offsetY;\n }\n }\n\n getSize() {\n const result = {\n width: 0,\n height: 0\n };\n if (this.currentLine && this.currentLine.addAble) {\n result[this.directionKey.height] = this.currentLineY + this.currentLine[this.directionKey.height];\n } else {\n result[this.directionKey.height] = this.currentLineY;\n }\n\n for (let i = 0; i < this.lines.length; i++) {\n const line = this.lines[i];\n if (result[this.directionKey.width] < line[this.directionKey.width]) {\n result[this.directionKey.width] = line[this.directionKey.width];\n }\n }\n return result;\n }\n\n getContentSize() {\n const result = {\n width: 0,\n height: 0\n };\n\n const calcFlag = {\n width: true,\n height: true\n };\n\n if (!this.isRoot && !this._heightObj) {\n calcFlag.height = false;\n result.height = this.height;\n }\n if (!this.isRoot && !this._widthObj) {\n calcFlag.width = false;\n result.width = this.width;\n }\n\n for (let i = 0; i < this.lines.length; i++) {\n const line = this.lines[i];\n const size = line.getContentSize();\n if (calcFlag[this.directionKey.width] && result[this.directionKey.width] < size[this.directionKey.width]) {\n result[this.directionKey.width] = size[this.directionKey.width];\n }\n\n if (calcFlag[this.directionKey.height]) {\n result[this.directionKey.height] += size[this.directionKey.height];\n }\n }\n\n return result;\n }\n\n calcSize(parentWidth: number, parentHeight: number) {\n if (this._heightObj) {\n this.height = (parentHeight * this._heightObj.percent) / 100 + this._heightObj.delta;\n this.needCalcSize = false;\n this.initLayoutSize();\n }\n if (this._widthObj) {\n this.width = (parentWidth * this._widthObj.percent) / 100 + this._widthObj.delta;\n this.needCalcSize = false;\n this.initLayoutSize();\n }\n }\n\n // 获取平坦后的全部子图元,更新子图元xy位置信息\n getElements(\n parentPos: { parentX: number; parentY: number } = { parentX: 0, parentY: 0 },\n isHover = false,\n isSelect = false\n ) {\n // 关闭最后一行\n if (this.currentLine && this.currentLine.addAble) {\n this.currentLine.addAble = false; // 关闭当前行\n this.currentLineY += this.currentLine[this.directionKey.height]; // 更新目前line y位置\n this.currentLine.lineFinish();\n }\n\n // 处理alignContent\n this.updateYAlign();\n\n const elements = [];\n if (this.background && this.background.fill) {\n const backgroundRect = new Rect({\n width: this.width,\n height: this.height,\n stroke: this.background.stroke ?? false,\n fill: this.background.fill,\n cornerRadius: this.background.cornerRadius ?? 0,\n lineWidth: this.background.lineWidth ?? 1\n });\n backgroundRect.x += this.x + parentPos.parentX;\n backgroundRect.y += this.y + parentPos.parentY;\n elements.push(backgroundRect);\n }\n if (this.showBounds) {\n const boundsRect = new Rect({\n width: this.width,\n height: this.height,\n cornerRadius: 0,\n stroke: 'red',\n fill: 'rgba(255, 0, 0, 0.2)',\n lineWidth: 4\n });\n boundsRect.x += this.x + parentPos.parentX;\n boundsRect.y += this.y + parentPos.parentY;\n elements.push(boundsRect);\n }\n // const parentPos = { parentX, parentY };\n for (let i = 0; i < this.lines.length; i++) {\n const line = this.lines[i];\n line[this.directionKey.y] += this.offsetY;\n // const linesElements = line.getElements(table, this.x + parentX, this.y + parentY);\n const linesElements = line.getElements(\n {\n [this.directionKey.parentX]: this.x + parentPos.parentX,\n [this.directionKey.parentY]: this.y + parentPos.parentY\n } as any,\n isHover,\n isSelect\n );\n elements.push(...linesElements);\n }\n\n return elements;\n }\n}\n"]}
|
|
@@ -9,10 +9,10 @@ export class WrapText extends Text {
|
|
|
9
9
|
super(params);
|
|
10
10
|
}
|
|
11
11
|
updateSingallineAABBBounds(text) {
|
|
12
|
-
var _a, _b
|
|
12
|
+
var _a, _b;
|
|
13
13
|
const textTheme = getTheme(this).text;
|
|
14
14
|
let width, str;
|
|
15
|
-
const
|
|
15
|
+
const attribute = this.attribute, {maxLineWidth: maxLineWidth = textTheme.maxLineWidth, ellipsis: ellipsis = textTheme.ellipsis, textAlign: textAlign = textTheme.textAlign, textBaseline: textBaseline = textTheme.textBaseline, fontSize: fontSize = textTheme.fontSize, fontFamily: fontFamily = textTheme.fontFamily, stroke: stroke = textTheme.stroke, lineHeight: lineHeight = (null !== (_b = null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : attribute.fontSize) && void 0 !== _b ? _b : textTheme.fontSize), lineWidth: lineWidth = textTheme.lineWidth} = attribute;
|
|
16
16
|
if (!this.shouldUpdateShape() && this.cache) {
|
|
17
17
|
width = this.cache.clipedWidth;
|
|
18
18
|
const dx = textDrawOffsetX(textAlign, width), dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
|
|
@@ -44,9 +44,9 @@ export class WrapText extends Text {
|
|
|
44
44
|
this._AABBBounds;
|
|
45
45
|
}
|
|
46
46
|
updateMultilineAABBBounds(text) {
|
|
47
|
-
var _a, _b, _c
|
|
48
|
-
const textTheme = getTheme(this).text, {fontFamily: fontFamily = textTheme.fontFamily, textAlign: textAlign = textTheme.textAlign, textBaseline: textBaseline = textTheme.textBaseline, fontSize: fontSize = textTheme.fontSize, lineHeight: lineHeight = (null !== (
|
|
49
|
-
if (!this.shouldUpdateShape() && (null === (
|
|
47
|
+
var _a, _b, _c;
|
|
48
|
+
const textTheme = getTheme(this).text, {fontFamily: fontFamily = textTheme.fontFamily, textAlign: textAlign = textTheme.textAlign, textBaseline: textBaseline = textTheme.textBaseline, fontSize: fontSize = textTheme.fontSize, lineHeight: lineHeight = (null !== (_b = null !== (_a = this.attribute.lineHeight) && void 0 !== _a ? _a : this.attribute.fontSize) && void 0 !== _b ? _b : textTheme.fontSize), ellipsis: ellipsis = textTheme.ellipsis, maxLineWidth: maxLineWidth, stroke: stroke = textTheme.stroke, lineWidth: lineWidth = textTheme.lineWidth, heightLimit: heightLimit = -1, lineClamp: lineClamp = textTheme.lineClamp, autoWrapText: autoWrapText = textTheme.autoWrapText} = this.attribute;
|
|
49
|
+
if (!this.shouldUpdateShape() && (null === (_c = this.cache) || void 0 === _c ? void 0 : _c.layoutData)) {
|
|
50
50
|
const bbox = this.cache.layoutData.bbox;
|
|
51
51
|
return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height),
|
|
52
52
|
stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["scenegraph/graphic/text.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAe,IAAI,EAAE,gBAAgB,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtH,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAOpD,MAAM,wBAAwB,GAAG,CAAC,aAAa,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;AAS9E,MAAM,OAAO,QAAS,SAAQ,IAAI;IAIhC,YAAY,MAAiC;QAC3C,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAMD,0BAA0B,CAAC,IAAqB;;QAC9C,MAAM,SAAS,GAAG,QAAQ,CAAC,IA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AC;SACxC;QAED,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,cAAc,CAAC,IAAc;QAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,wBAAwB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACxD,MAAM,OAAO,GAAG,wBAAwB,CAAC,CAAC,CAAC,CAAC;YAC5C,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE;gBAChC,OAAO,IAAI,CAAC;aACb;SACF;QACD,OAAO,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IACD,aAAa,CAAC,GAAW;QACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,wBAAwB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACxD,MAAM,OAAO,GAAG,wBAAwB,CAAC,CAAC,CAAC,CAAC;YAC5C,IAAI,GAAG,KAAK,OAAO,EAAE;gBACnB,OAAO,IAAI,CAAC;aACb;SACF;QACD,OAAO,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;CACF","file":"text.js","sourcesContent":["import type { ITextGraphicAttribute, LayoutItemType } from '@visactor/vrender';\nimport { getTheme, graphicUtil, Text, CanvasTextLayout, textDrawOffsetX, textLayoutOffsetY } from '@visactor/vrender';\nimport type { Bounds } from '@visactor/vutils';\nimport { textMeasure } from '../utils/measure-text';\n\n/* WrapText功能/dist/core/contributions/textMeasure/layout\n * 1. 按照宽度限制自动折行或显示省略号\n * 2. 高度限制控制显示内容及省略号\n */\n\nconst WRAP_TEXT_UPDATE_TAG_KEY = ['heightLimit', 'lineClamp', 'autoWrapText'];\n\nexport interface IWrapTextGraphicAttribute extends ITextGraphicAttribute {\n // widthLimit: number;\n heightLimit?: number;\n lineClamp?: number;\n autoWrapText?: boolean;\n}\n\nexport 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 buf = 2;\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 stroke = textTheme.stroke,\n lineHeight = attribute.lineHeight ?? (attribute.fontSize ?? textTheme.lineHeight ?? textTheme.fontSize) + buf,\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 });\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 textBaseline = textTheme.textBaseline,\n fontSize = textTheme.fontSize,\n lineHeight = this.attribute.lineHeight ?? this.attribute.fontSize ?? textTheme.lineHeight ?? 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 });\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":["scenegraph/graphic/text.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAe,IAAI,EAAE,gBAAgB,EAAE,eAAe,EAAE,iBAAiB,EA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,OAAO,EAAE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;QAExG,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;SACxC;QAED,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,cAAc,CAAC,IAAc;QAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,wBAAwB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACxD,MAAM,OAAO,GAAG,wBAAwB,CAAC,CAAC,CAAC,CAAC;YAC5C,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE;gBAChC,OAAO,IAAI,CAAC;aACb;SACF;QACD,OAAO,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IACD,aAAa,CAAC,GAAW;QACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,wBAAwB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACxD,MAAM,OAAO,GAAG,wBAAwB,CAAC,CAAC,CAAC,CAAC;YAC5C,IAAI,GAAG,KAAK,OAAO,EAAE;gBACnB,OAAO,IAAI,CAAC;aACb;SACF;QACD,OAAO,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;CACF","file":"text.js","sourcesContent":["import type { ITextGraphicAttribute, LayoutItemType } from '@visactor/vrender';\nimport { getTheme, graphicUtil, Text, CanvasTextLayout, textDrawOffsetX, textLayoutOffsetY } from '@visactor/vrender';\nimport type { Bounds } from '@visactor/vutils';\nimport { textMeasure } from '../utils/measure-text';\n\n/* WrapText功能/dist/core/contributions/textMeasure/layout\n * 1. 按照宽度限制自动折行或显示省略号\n * 2. 高度限制控制显示内容及省略号\n */\n\nconst WRAP_TEXT_UPDATE_TAG_KEY = ['heightLimit', 'lineClamp', 'autoWrapText'];\n\nexport interface IWrapTextGraphicAttribute extends ITextGraphicAttribute {\n // widthLimit: number;\n heightLimit?: number;\n lineClamp?: number;\n autoWrapText?: boolean;\n}\n\nexport 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 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 });\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 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 });\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"]}
|
|
@@ -2,5 +2,5 @@ import type { IThemeSpec } from '@visactor/vrender';
|
|
|
2
2
|
import type { CellRange, ColumnDefine, ColumnTypeOption } from '../../ts-types';
|
|
3
3
|
import { Group } from '../graphic/group';
|
|
4
4
|
import type { BaseTableAPI } from '../../ts-types/base-table';
|
|
5
|
-
export declare function createCell(type: ColumnTypeOption, define: ColumnDefine, table: BaseTableAPI, col: number, row: number, colWidth: number, bgColorFunc: Function, cellWidth: number, cellHeight: number, columnGroup: Group, y: number, padding: [number, number, number, number], textAlign: CanvasTextAlign, textBaseline: CanvasTextBaseline, mayHaveIcon: boolean,
|
|
5
|
+
export declare function createCell(type: ColumnTypeOption, define: ColumnDefine, table: BaseTableAPI, col: number, row: number, colWidth: number, bgColorFunc: Function, cellWidth: number, cellHeight: number, columnGroup: Group, y: number, padding: [number, number, number, number], textAlign: CanvasTextAlign, textBaseline: CanvasTextBaseline, mayHaveIcon: boolean, isMerge: boolean, range: CellRange, cellTheme: IThemeSpec): Group;
|
|
6
6
|
export declare function updateCell(col: number, row: number, table: BaseTableAPI, addNew?: boolean): Group;
|
|
@@ -24,7 +24,7 @@ import { isPromise } from "../../tools/helper";
|
|
|
24
24
|
|
|
25
25
|
import { dealPromiseData } from "../utils/deal-promise-data";
|
|
26
26
|
|
|
27
|
-
export function createCell(type, define, table, col, row, colWidth, bgColorFunc, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon,
|
|
27
|
+
export function createCell(type, define, table, col, row, colWidth, bgColorFunc, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, isMerge, range, cellTheme) {
|
|
28
28
|
let cellGroup;
|
|
29
29
|
if ("text" === type || "link" === type) {
|
|
30
30
|
if ("link" === type) {
|
|
@@ -54,20 +54,23 @@ export function createCell(type, define, table, col, row, colWidth, bgColorFunc,
|
|
|
54
54
|
const {autoRowHeight: autoRowHeight} = table.internalProps, customResult = dealWithCustom(customLayout, customRender, col, row, table.getColWidth(col), table.getRowHeight(row), !1, autoRowHeight, table);
|
|
55
55
|
customElementsGroup = customResult.elementsGroup, renderDefault = customResult.renderDefault;
|
|
56
56
|
}
|
|
57
|
-
cellGroup = createCellGroup(table, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon,
|
|
57
|
+
cellGroup = createCellGroup(table, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme),
|
|
58
58
|
isMerge && (cellGroup.mergeCol = range.end.col, cellGroup.mergeRow = range.end.row);
|
|
59
|
-
} else if ("image" === type) cellGroup = createImageCellGroup(columnGroup, 0, y, col, row, table.getColWidth(col), table.getRowHeight(row), define.keepAspectRatio, define.imageAutoSizing, padding, textAlign, textBaseline, table, cellTheme); else if ("video" === type) cellGroup = createVideoCellGroup(columnGroup, 0, y, col, row, table.getColWidth(col), table.getRowHeight(row), define.keepAspectRatio, define.imageAutoSizing, padding, textAlign, textBaseline, table, cellTheme); else if ("chart" === type)
|
|
59
|
+
} else if ("image" === type) cellGroup = createImageCellGroup(columnGroup, 0, y, col, row, table.getColWidth(col), table.getRowHeight(row), define.keepAspectRatio, define.imageAutoSizing, padding, textAlign, textBaseline, table, cellTheme); else if ("video" === type) cellGroup = createVideoCellGroup(columnGroup, 0, y, col, row, table.getColWidth(col), table.getRowHeight(row), define.keepAspectRatio, define.imageAutoSizing, padding, textAlign, textBaseline, table, cellTheme); else if ("chart" === type) {
|
|
60
|
+
const chartInstance = table.internalProps.layoutMap.getChartInstance(col, row);
|
|
61
|
+
cellGroup = createChartCellGroup(null, columnGroup, 0, y, col, row, table.getColWidth(col), table.getRowHeight(row), padding, table.getCellValue(col, row), define.chartType, define.chartSpec, chartInstance, table, cellTheme);
|
|
62
|
+
} else if ("progressbar" === type) {
|
|
60
63
|
const style = table._getCellStyle(col, row), value = table.getCellValue(col, row), dataValue = table.getCellOriginValue(col, row);
|
|
61
|
-
cellGroup = createCellGroup(table, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, !1,
|
|
64
|
+
cellGroup = createCellGroup(table, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, !1, null, !0, cellTheme);
|
|
62
65
|
const progressBarGroup = createProgressBarCell(define, style, colWidth, value, dataValue, col, row, padding, table);
|
|
63
66
|
cellGroup.insertBefore(progressBarGroup, cellGroup.firstChild);
|
|
64
|
-
} else "sparkline" === type && (cellGroup = createSparkLineCellGroup(null, columnGroup, 0, y, col, row, cellWidth, cellHeight, padding, table));
|
|
67
|
+
} else "sparkline" === type && (cellGroup = createSparkLineCellGroup(null, columnGroup, 0, y, col, row, cellWidth, cellHeight, padding, table, cellTheme));
|
|
65
68
|
return cellGroup;
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
export function updateCell(col, row, table, addNew) {
|
|
69
72
|
var _a, _b, _c, _d, _e;
|
|
70
|
-
const oldCellGroup = table.scenegraph.
|
|
73
|
+
const oldCellGroup = table.scenegraph.highPerformanceGetCell(col, row, !0), type = table.isHeader(col, row) ? table._getHeaderLayoutMap(col, row).headerType : table.getBodyColumnType(col, row), cellType = table.getCellType(col, row), define = "body" !== cellType ? table.getHeaderDefine(col, row) : table.getBodyColumnDefine(col, row);
|
|
71
74
|
let isMerge, range, newCellGroup;
|
|
72
75
|
if (("body" !== cellType || (null == define ? void 0 : define.mergeCell)) && (range = table.getCellRange(col, row),
|
|
73
76
|
isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row),
|
|
@@ -82,7 +85,7 @@ export function updateCell(col, row, table, addNew) {
|
|
|
82
85
|
cellHeight = table.getRowsHeight(range.start.row, range.end.row)) : (cellWidth = table.getColWidth(col),
|
|
83
86
|
cellHeight = table.getRowHeight(row));
|
|
84
87
|
const value = table.getCellValue(col, row);
|
|
85
|
-
isPromise(value) ? (oldCellGroup.removeAllChild(), dealPromiseData(value, table, updateCellContent.bind(null, type, define, table, col, row, bgColorFunc,
|
|
88
|
+
isPromise(value) ? (oldCellGroup.removeAllChild(), dealPromiseData(value, table, updateCellContent.bind(null, type, define, table, col, row, bgColorFunc, cellWidth, cellHeight, oldCellGroup, padding, textAlign, textBaseline, mayHaveIcon, isMerge, range, addNew, cellTheme))) : newCellGroup = updateCellContent(type, define, table, col, row, bgColorFunc, cellWidth, cellHeight, oldCellGroup, padding, textAlign, textBaseline, mayHaveIcon, isMerge, range, addNew, cellTheme);
|
|
86
89
|
} else newCellGroup = new Group({
|
|
87
90
|
x: 0,
|
|
88
91
|
y: addNew ? 0 : oldCellGroup.attribute.y,
|
|
@@ -97,8 +100,10 @@ export function updateCell(col, row, table, addNew) {
|
|
|
97
100
|
}
|
|
98
101
|
|
|
99
102
|
function updateCellContent(type, define, table, col, row, bgColorFunc, cellWidth, cellHeight, oldCellGroup, padding, textAlign, textBaseline, mayHaveIcon, isMerge, range, addNew, cellTheme) {
|
|
100
|
-
|
|
101
|
-
|
|
103
|
+
var _a, _b;
|
|
104
|
+
const newCellGroup = createCell(type, define, table, col, row, table.getColWidth(col), bgColorFunc, cellWidth, cellHeight, addNew ? table.scenegraph.getColGroup(col) : oldCellGroup.parent, addNew ? 0 : oldCellGroup.attribute.y, padding, textAlign, textBaseline, mayHaveIcon, isMerge, range, cellTheme);
|
|
105
|
+
return addNew || (oldCellGroup.parent.insertAfter(newCellGroup, oldCellGroup), oldCellGroup.parent.removeChild(oldCellGroup),
|
|
106
|
+
(null === (_a = table.scenegraph) || void 0 === _a ? void 0 : _a.proxy.cellCache.get(col)) && (null === (_b = table.scenegraph) || void 0 === _b || _b.proxy.cellCache.set(col, newCellGroup))),
|
|
102
107
|
newCellGroup;
|
|
103
108
|
}
|
|
104
109
|
//# sourceMappingURL=cell-helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["scenegraph/group-creater/cell-helper.ts"],"names":[],"mappings":"AAEA,OAA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AAM;YACL,YAAY,GAAG,iBAAiB,CAC9B,IAAI,EACJ,MAAM,EACN,KAAK,EACL,GAAG,EACH,GAAG,EACH,WAAW,EACX,SAAS,EACT,UAAU,EACV,YAAY,EACZ,OAAO,EACP,SAAS,EACT,YAAY,EACZ,WAAW,EACX,OAAO,EACP,KAAK,EACL,MAAM,EACN,SAAS,CACV,CAAC;SACH;KACF;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,iBAAiB,CACxB,IAAsB,EACtB,MAAoB,EACpB,KAAmB,EACnB,GAAW,EACX,GAAW,EACX,WAAqB,EACrB,SAAiB,EACjB,UAAkB,EAClB,YAAmB,EACnB,OAAyC,EACzC,SAA0B,EAC1B,YAAgC,EAChC,WAAoB,EACpB,OAAgB,EAChB,KAAgB,EAChB,MAAe,EACf,SAAsB;IAEtB,MAAM,YAAY,GAAG,UAAU,CAC7B,IAAI,EACJ,MAAM,EACN,KAAK,EACL,GAAG,EACH,GAAG,EACH,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,EACtB,WAAW,EACX,SAAS,EACT,UAAU,EAEV,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,EAEhE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,EACrC,OAAO,EACP,SAAS,EACT,YAAY,EACZ,WAAW,EACX,KAAK,EACL,OAAO,EACP,KAAK,EACL,SAAS,CACV,CAAC;IACF,IAAI,CAAC,MAAM,EAAE;QACX,YAAY,CAAC,MAAM,CAAC,WAAW,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QAC5D,YAAY,CAAC,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;KAC/C;IACD,OAAO,YAAY,CAAC;AACtB,CAAC","file":"cell-helper.js","sourcesContent":["import type { Cursor, IThemeSpec } from '@visactor/vrender';\nimport type { ProgressBarStyle } from '../../body-helper/style/ProgressBarStyle';\nimport { regUrl } from '../../tools/global';\nimport type {\n CellRange,\n ChartColumnDefine,\n ColumnDefine,\n ColumnTypeOption,\n ICustomRender,\n ImageColumnDefine,\n MappingRule,\n ProgressbarColumnDefine,\n TextColumnDefine\n} from '../../ts-types';\nimport { dealWithCustom } from '../component/custom';\nimport { Group } from '../graphic/group';\nimport { getProp } from '../utils/get-prop';\nimport { createChartCellGroup } from './cell-type/chart-cell';\nimport { createImageCellGroup } from './cell-type/image-cell';\nimport { createProgressBarCell } from './cell-type/progress-bar-cell';\nimport { createSparkLineCellGroup } from './cell-type/spark-line-cell';\nimport { createCellGroup } from './cell-type/text-cell';\nimport { createVideoCellGroup } from './cell-type/video-cell';\nimport type { ICustomLayoutFuc } from '../../ts-types/customLayout';\nimport type { BaseTableAPI, PivotTableProtected } from '../../ts-types/base-table';\nimport { getStyleTheme } from '../../core/tableHelper';\nimport { isPromise } from '../../tools/helper';\nimport { dealPromiseData } from '../utils/deal-promise-data';\n\nexport function createCell(\n type: ColumnTypeOption,\n define: ColumnDefine,\n table: BaseTableAPI,\n col: number,\n row: number,\n colWidth: number,\n bgColorFunc: Function,\n cellWidth: number,\n cellHeight: number,\n columnGroup: Group,\n y: number,\n padding: [number, number, number, number],\n textAlign: CanvasTextAlign,\n textBaseline: CanvasTextBaseline,\n mayHaveIcon: boolean,\n isfunctionalProps: boolean,\n isMerge: boolean,\n range: CellRange,\n cellTheme?: IThemeSpec\n): Group {\n let cellGroup: Group;\n if (type === 'text' || type === 'link') {\n if (type === 'link') {\n //如果是超链接 颜色按照linkColor绘制 TODO:放到方法_getCellStyle中\n // const columnDefine = table.getHeaderDefine(col, row);\n const cellValue = table.getCellValue(col, row);\n const headerStyle = table._getCellStyle(col, row);\n\n if (\n type === 'link' &&\n (('templateLink' in define && define.templateLink) ||\n !('linkDetect' in define && define.linkDetect) ||\n regUrl.test(cellValue))\n ) {\n if (cellTheme) {\n cellTheme.text.fill = getProp('linkColor', headerStyle, col, row, table);\n (cellTheme as any).group.cursor = 'pointer';\n } else {\n cellTheme = {\n text: {\n fill: getProp('linkColor', headerStyle, col, row, table)\n },\n group: {\n cursor: 'pointer' as Cursor\n }\n };\n }\n }\n }\n // 判断是否有mapping 遍历dataset中mappingRules 但这里还需要根据fieldName来判断\n if (bgColorFunc) {\n const cellValue = table.getCellOriginValue(col, row);\n const bgColor = bgColorFunc(table, cellValue);\n if (bgColor) {\n if (cellTheme) {\n cellTheme.group.fill = bgColor;\n } else {\n cellTheme = {\n group: {\n fill: bgColor\n }\n };\n }\n }\n }\n\n let customElementsGroup;\n let renderDefault = true;\n let customRender;\n let customLayout;\n const cellType = table.getCellType(col, row);\n if (cellType !== 'body') {\n customRender = define?.headerCustomRender;\n customLayout = define?.headerCustomLayout;\n } else {\n customRender = define?.customRender || table.customRender;\n customLayout = define?.customLayout;\n }\n\n if (customLayout || customRender) {\n const { autoRowHeight } = table.internalProps;\n const customResult = dealWithCustom(\n customLayout,\n customRender,\n col,\n row,\n table.getColWidth(col),\n table.getRowHeight(row),\n false,\n autoRowHeight,\n table\n );\n customElementsGroup = customResult.elementsGroup;\n renderDefault = customResult.renderDefault;\n }\n cellGroup = createCellGroup(\n table,\n columnGroup,\n 0,\n y,\n col,\n row,\n colWidth,\n cellWidth,\n cellHeight,\n padding,\n textAlign,\n textBaseline,\n mayHaveIcon,\n isfunctionalProps,\n customElementsGroup,\n renderDefault,\n cellTheme\n );\n if (isMerge) {\n cellGroup.mergeCol = range.end.col;\n cellGroup.mergeRow = range.end.row;\n }\n } else if (type === 'image') {\n // 创建图片单元格\n cellGroup = createImageCellGroup(\n columnGroup,\n 0,\n y,\n col,\n row,\n table.getColWidth(col),\n table.getRowHeight(row),\n (define as ImageColumnDefine).keepAspectRatio,\n (define as ImageColumnDefine).imageAutoSizing,\n padding,\n textAlign,\n textBaseline,\n table,\n cellTheme\n );\n } else if (type === 'video') {\n // 创建视频单元格\n cellGroup = createVideoCellGroup(\n columnGroup,\n 0,\n y,\n col,\n row,\n table.getColWidth(col),\n table.getRowHeight(row),\n (define as ImageColumnDefine).keepAspectRatio,\n (define as ImageColumnDefine).imageAutoSizing,\n padding,\n textAlign,\n textBaseline,\n table,\n cellTheme\n );\n } else if (type === 'chart') {\n cellGroup = createChartCellGroup(\n null,\n columnGroup,\n 0,\n y,\n col,\n row,\n table.getColWidth(col),\n table.getRowHeight(row),\n padding,\n table.getCellValue(col, row),\n (define as ChartColumnDefine).chartType,\n (define as ChartColumnDefine).chartSpec,\n (columnGroup.attribute as any).chartInstance,\n table\n );\n } else if (type === 'progressbar') {\n const style = table._getCellStyle(col, row) as ProgressBarStyle;\n const value = table.getCellValue(col, row);\n const dataValue = table.getCellOriginValue(col, row);\n // 创建基础文字单元格\n cellGroup = createCellGroup(\n table,\n columnGroup,\n 0,\n y,\n col,\n row,\n colWidth,\n cellWidth,\n cellHeight,\n padding,\n textAlign,\n textBaseline,\n false,\n true,\n null,\n true,\n cellTheme\n );\n\n // 创建bar group\n const progressBarGroup = createProgressBarCell(\n define as ProgressbarColumnDefine,\n style,\n colWidth,\n value,\n dataValue,\n col,\n row,\n padding,\n table\n );\n // 进度图插入到文字前,绘制在文字下\n cellGroup.insertBefore(progressBarGroup, cellGroup.firstChild);\n } else if (type === 'sparkline') {\n cellGroup = createSparkLineCellGroup(null, columnGroup, 0, y, col, row, cellWidth, cellHeight, padding, table);\n }\n\n return cellGroup;\n}\n\nexport function updateCell(col: number, row: number, table: BaseTableAPI, addNew?: boolean) {\n const oldCellGroup = table.scenegraph.getCell(col, row, true);\n\n const type = table.isHeader(col, row)\n ? table._getHeaderLayoutMap(col, row).headerType\n : table.getBodyColumnType(col, row);\n const cellType = table.getCellType(col, row);\n const define = cellType !== 'body' ? table.getHeaderDefine(col, row) : table.getBodyColumnDefine(col, row);\n\n let isMerge;\n let range;\n if (cellType !== 'body' || (define as TextColumnDefine)?.mergeCell) {\n // 只有表头或者column配置合并单元格后再进行信息获取\n range = table.getCellRange(col, row);\n isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;\n }\n\n let newCellGroup;\n if (isMerge && (col !== range.start.col || row !== range.start.row)) {\n // 合并单元格的非起始单元格不需要绘制\n newCellGroup = new Group({\n x: 0,\n y: addNew ? 0 : oldCellGroup.attribute.y,\n width: 0,\n height: 0,\n visible: false,\n pickable: false\n });\n newCellGroup.role = 'shadow-cell';\n newCellGroup.col = col;\n newCellGroup.row = row;\n newCellGroup.mergeCol = range.start.col;\n newCellGroup.mergeRow = range.start.row;\n\n if (!addNew) {\n oldCellGroup.parent.insertAfter(newCellGroup, oldCellGroup);\n oldCellGroup.parent.removeChild(oldCellGroup);\n }\n } else {\n const mayHaveIcon = cellType !== 'body' ? true : !!define?.icon || !!define?.tree;\n const headerStyle = table._getCellStyle(col, row);\n const cellTheme = getStyleTheme(headerStyle, table, col, row, getProp).theme;\n const padding = cellTheme._vtable.padding;\n const textAlign = cellTheme._vtable.textAlign;\n const textBaseline = cellTheme._vtable.textBaseline;\n\n let bgColorFunc: Function;\n // 判断是否有mapping 遍历dataset中mappingRules\n if ((table.internalProps as PivotTableProtected)?.dataConfig?.mappingRules && cellType === 'body') {\n (table.internalProps as PivotTableProtected)?.dataConfig?.mappingRules?.forEach(\n (mappingRule: MappingRule, i: number) => {\n if (mappingRule.bgColor) {\n bgColorFunc = mappingRule.bgColor.mapping;\n }\n }\n );\n }\n\n let customRender;\n let customLayout;\n if (cellType !== 'body') {\n customRender = define?.headerCustomRender;\n customLayout = define?.headerCustomLayout;\n } else {\n customRender = define?.customRender || table.customRender;\n customLayout = define?.customLayout;\n }\n\n let cellWidth;\n let cellHeight;\n if (range) {\n cellWidth = table.getColsWidth(range.start.col, range.end.col);\n cellHeight = table.getRowsHeight(range.start.row, range.end.row);\n } else {\n cellWidth = table.getColWidth(col);\n cellHeight = table.getRowHeight(row);\n }\n\n // deal with promise data\n const value = table.getCellValue(col, row);\n if (isPromise(value)) {\n // clear cell content sync\n oldCellGroup.removeAllChild();\n\n // update cell content async\n dealPromiseData(\n value,\n table,\n updateCellContent.bind(\n null,\n type,\n define,\n table,\n col,\n row,\n bgColorFunc,\n customRender,\n customLayout,\n cellWidth,\n cellHeight,\n oldCellGroup,\n padding,\n textAlign,\n textBaseline,\n mayHaveIcon,\n isMerge,\n range,\n addNew,\n cellTheme\n )\n );\n } else {\n newCellGroup = updateCellContent(\n type,\n define,\n table,\n col,\n row,\n bgColorFunc,\n cellWidth,\n cellHeight,\n oldCellGroup,\n padding,\n textAlign,\n textBaseline,\n mayHaveIcon,\n isMerge,\n range,\n addNew,\n cellTheme\n );\n }\n }\n\n return newCellGroup;\n}\n\nfunction updateCellContent(\n type: ColumnTypeOption,\n define: ColumnDefine,\n table: BaseTableAPI,\n col: number,\n row: number,\n bgColorFunc: Function,\n cellWidth: number,\n cellHeight: number,\n oldCellGroup: Group,\n padding: [number, number, number, number],\n textAlign: CanvasTextAlign,\n textBaseline: CanvasTextBaseline,\n mayHaveIcon: boolean,\n isMerge: boolean,\n range: CellRange,\n addNew: boolean,\n cellTheme?: IThemeSpec\n) {\n const newCellGroup = createCell(\n type,\n define,\n table,\n col,\n row,\n table.getColWidth(col),\n bgColorFunc,\n cellWidth,\n cellHeight,\n // oldCellGroup.parent,\n addNew ? table.scenegraph.getColGroup(col) : oldCellGroup.parent,\n // oldCellGroup.attribute.y,\n addNew ? 0 : oldCellGroup.attribute.y,\n padding,\n textAlign,\n textBaseline,\n mayHaveIcon,\n false,\n isMerge,\n range,\n cellTheme\n );\n if (!addNew) {\n oldCellGroup.parent.insertAfter(newCellGroup, oldCellGroup);\n oldCellGroup.parent.removeChild(oldCellGroup);\n }\n return newCellGroup;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["scenegraph/group-creater/cell-helper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAY5C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAA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E,YAAY,CAAC,CAAC;SAC1D;KACF;IACD,OAAO,YAAY,CAAC;AACtB,CAAC","file":"cell-helper.js","sourcesContent":["import type { Cursor, IThemeSpec } from '@visactor/vrender';\nimport type { ProgressBarStyle } from '../../body-helper/style/ProgressBarStyle';\nimport { regUrl } from '../../tools/global';\nimport type {\n CellRange,\n ChartColumnDefine,\n ColumnDefine,\n ColumnTypeOption,\n ICustomRender,\n ImageColumnDefine,\n MappingRule,\n ProgressbarColumnDefine,\n TextColumnDefine\n} from '../../ts-types';\nimport { dealWithCustom } from '../component/custom';\nimport { Group } from '../graphic/group';\nimport { getProp } from '../utils/get-prop';\nimport { createChartCellGroup } from './cell-type/chart-cell';\nimport { createImageCellGroup } from './cell-type/image-cell';\nimport { createProgressBarCell } from './cell-type/progress-bar-cell';\nimport { createSparkLineCellGroup } from './cell-type/spark-line-cell';\nimport { createCellGroup } from './cell-type/text-cell';\nimport { createVideoCellGroup } from './cell-type/video-cell';\nimport type { ICustomLayoutFuc } from '../../ts-types/customLayout';\nimport type { BaseTableAPI, PivotTableProtected } from '../../ts-types/base-table';\nimport { getStyleTheme } from '../../core/tableHelper';\nimport { isPromise } from '../../tools/helper';\nimport { dealPromiseData } from '../utils/deal-promise-data';\n\nexport function createCell(\n type: ColumnTypeOption,\n define: ColumnDefine,\n table: BaseTableAPI,\n col: number,\n row: number,\n colWidth: number,\n bgColorFunc: Function,\n cellWidth: number,\n cellHeight: number,\n columnGroup: Group,\n y: number,\n padding: [number, number, number, number],\n textAlign: CanvasTextAlign,\n textBaseline: CanvasTextBaseline,\n mayHaveIcon: boolean,\n isMerge: boolean,\n range: CellRange,\n cellTheme: IThemeSpec\n): Group {\n let cellGroup: Group;\n if (type === 'text' || type === 'link') {\n if (type === 'link') {\n //如果是超链接 颜色按照linkColor绘制 TODO:放到方法_getCellStyle中\n // const columnDefine = table.getHeaderDefine(col, row);\n const cellValue = table.getCellValue(col, row);\n const headerStyle = table._getCellStyle(col, row);\n\n if (\n type === 'link' &&\n (('templateLink' in define && define.templateLink) ||\n !('linkDetect' in define && define.linkDetect) ||\n regUrl.test(cellValue))\n ) {\n if (cellTheme) {\n cellTheme.text.fill = getProp('linkColor', headerStyle, col, row, table);\n (cellTheme as any).group.cursor = 'pointer';\n } else {\n cellTheme = {\n text: {\n fill: getProp('linkColor', headerStyle, col, row, table)\n },\n group: {\n cursor: 'pointer' as Cursor\n }\n };\n }\n }\n }\n // 判断是否有mapping 遍历dataset中mappingRules 但这里还需要根据fieldName来判断\n if (bgColorFunc) {\n const cellValue = table.getCellOriginValue(col, row);\n const bgColor = bgColorFunc(table, cellValue);\n if (bgColor) {\n if (cellTheme) {\n cellTheme.group.fill = bgColor;\n } else {\n cellTheme = {\n group: {\n fill: bgColor\n }\n };\n }\n }\n }\n\n let customElementsGroup;\n let renderDefault = true;\n let customRender;\n let customLayout;\n const cellType = table.getCellType(col, row);\n if (cellType !== 'body') {\n customRender = define?.headerCustomRender;\n customLayout = define?.headerCustomLayout;\n } else {\n customRender = define?.customRender || table.customRender;\n customLayout = define?.customLayout;\n }\n\n if (customLayout || customRender) {\n const { autoRowHeight } = table.internalProps;\n const customResult = dealWithCustom(\n customLayout,\n customRender,\n col,\n row,\n table.getColWidth(col),\n table.getRowHeight(row),\n false,\n autoRowHeight,\n table\n );\n customElementsGroup = customResult.elementsGroup;\n renderDefault = customResult.renderDefault;\n }\n cellGroup = createCellGroup(\n table,\n columnGroup,\n 0,\n y,\n col,\n row,\n colWidth,\n cellWidth,\n cellHeight,\n padding,\n textAlign,\n textBaseline,\n mayHaveIcon,\n customElementsGroup,\n renderDefault,\n cellTheme\n );\n if (isMerge) {\n cellGroup.mergeCol = range.end.col;\n cellGroup.mergeRow = range.end.row;\n }\n } else if (type === 'image') {\n // 创建图片单元格\n cellGroup = createImageCellGroup(\n columnGroup,\n 0,\n y,\n col,\n row,\n table.getColWidth(col),\n table.getRowHeight(row),\n (define as ImageColumnDefine).keepAspectRatio,\n (define as ImageColumnDefine).imageAutoSizing,\n padding,\n textAlign,\n textBaseline,\n table,\n cellTheme\n );\n } else if (type === 'video') {\n // 创建视频单元格\n cellGroup = createVideoCellGroup(\n columnGroup,\n 0,\n y,\n col,\n row,\n table.getColWidth(col),\n table.getRowHeight(row),\n (define as ImageColumnDefine).keepAspectRatio,\n (define as ImageColumnDefine).imageAutoSizing,\n padding,\n textAlign,\n textBaseline,\n table,\n cellTheme\n );\n } else if (type === 'chart') {\n const chartInstance = table.internalProps.layoutMap.getChartInstance(col, row);\n cellGroup = createChartCellGroup(\n null,\n columnGroup,\n 0,\n y,\n col,\n row,\n table.getColWidth(col),\n table.getRowHeight(row),\n padding,\n table.getCellValue(col, row),\n (define as ChartColumnDefine).chartType,\n (define as ChartColumnDefine).chartSpec,\n chartInstance,\n table,\n cellTheme\n );\n } else if (type === 'progressbar') {\n const style = table._getCellStyle(col, row) as ProgressBarStyle;\n const value = table.getCellValue(col, row);\n const dataValue = table.getCellOriginValue(col, row);\n // 创建基础文字单元格\n cellGroup = createCellGroup(\n table,\n columnGroup,\n 0,\n y,\n col,\n row,\n colWidth,\n cellWidth,\n cellHeight,\n padding,\n textAlign,\n textBaseline,\n false,\n null,\n true,\n cellTheme\n );\n\n // 创建bar group\n const progressBarGroup = createProgressBarCell(\n define as ProgressbarColumnDefine,\n style,\n colWidth,\n value,\n dataValue,\n col,\n row,\n padding,\n table\n );\n // 进度图插入到文字前,绘制在文字下\n cellGroup.insertBefore(progressBarGroup, cellGroup.firstChild);\n } else if (type === 'sparkline') {\n cellGroup = createSparkLineCellGroup(\n null,\n columnGroup,\n 0,\n y,\n col,\n row,\n cellWidth,\n cellHeight,\n padding,\n table,\n cellTheme\n );\n }\n\n return cellGroup;\n}\n\nexport function updateCell(col: number, row: number, table: BaseTableAPI, addNew?: boolean) {\n // const oldCellGroup = table.scenegraph.getCell(col, row, true);\n const oldCellGroup = table.scenegraph.highPerformanceGetCell(col, row, true);\n\n const type = table.isHeader(col, row)\n ? table._getHeaderLayoutMap(col, row).headerType\n : table.getBodyColumnType(col, row);\n const cellType = table.getCellType(col, row);\n const define = cellType !== 'body' ? table.getHeaderDefine(col, row) : table.getBodyColumnDefine(col, row);\n\n let isMerge;\n let range;\n if (cellType !== 'body' || (define as TextColumnDefine)?.mergeCell) {\n // 只有表头或者column配置合并单元格后再进行信息获取\n range = table.getCellRange(col, row);\n isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;\n }\n\n let newCellGroup;\n if (isMerge && (col !== range.start.col || row !== range.start.row)) {\n // 合并单元格的非起始单元格不需要绘制\n newCellGroup = new Group({\n x: 0,\n y: addNew ? 0 : oldCellGroup.attribute.y,\n width: 0,\n height: 0,\n visible: false,\n pickable: false\n });\n newCellGroup.role = 'shadow-cell';\n newCellGroup.col = col;\n newCellGroup.row = row;\n newCellGroup.mergeCol = range.start.col;\n newCellGroup.mergeRow = range.start.row;\n\n if (!addNew) {\n oldCellGroup.parent.insertAfter(newCellGroup, oldCellGroup);\n oldCellGroup.parent.removeChild(oldCellGroup);\n }\n } else {\n const mayHaveIcon = cellType !== 'body' ? true : !!define?.icon || !!define?.tree;\n const headerStyle = table._getCellStyle(col, row);\n const cellTheme = getStyleTheme(headerStyle, table, col, row, getProp).theme;\n const padding = cellTheme._vtable.padding;\n const textAlign = cellTheme._vtable.textAlign;\n const textBaseline = cellTheme._vtable.textBaseline;\n\n let bgColorFunc: Function;\n // 判断是否有mapping 遍历dataset中mappingRules\n if ((table.internalProps as PivotTableProtected)?.dataConfig?.mappingRules && cellType === 'body') {\n (table.internalProps as PivotTableProtected)?.dataConfig?.mappingRules?.forEach(\n (mappingRule: MappingRule, i: number) => {\n if (mappingRule.bgColor) {\n bgColorFunc = mappingRule.bgColor.mapping;\n }\n }\n );\n }\n\n let customRender;\n let customLayout;\n if (cellType !== 'body') {\n customRender = define?.headerCustomRender;\n customLayout = define?.headerCustomLayout;\n } else {\n customRender = define?.customRender || table.customRender;\n customLayout = define?.customLayout;\n }\n\n let cellWidth;\n let cellHeight;\n if (range) {\n cellWidth = table.getColsWidth(range.start.col, range.end.col);\n cellHeight = table.getRowsHeight(range.start.row, range.end.row);\n } else {\n cellWidth = table.getColWidth(col);\n cellHeight = table.getRowHeight(row);\n }\n\n // deal with promise data\n const value = table.getCellValue(col, row);\n if (isPromise(value)) {\n // clear cell content sync\n oldCellGroup.removeAllChild();\n\n // update cell content async\n dealPromiseData(\n value,\n table,\n updateCellContent.bind(\n null,\n type,\n define,\n table,\n col,\n row,\n bgColorFunc,\n cellWidth,\n cellHeight,\n oldCellGroup,\n padding,\n textAlign,\n textBaseline,\n mayHaveIcon,\n isMerge,\n range,\n addNew,\n cellTheme\n )\n );\n } else {\n newCellGroup = updateCellContent(\n type,\n define,\n table,\n col,\n row,\n bgColorFunc,\n cellWidth,\n cellHeight,\n oldCellGroup,\n padding,\n textAlign,\n textBaseline,\n mayHaveIcon,\n isMerge,\n range,\n addNew,\n cellTheme\n );\n }\n }\n\n return newCellGroup;\n}\n\nfunction updateCellContent(\n type: ColumnTypeOption,\n define: ColumnDefine,\n table: BaseTableAPI,\n col: number,\n row: number,\n bgColorFunc: Function,\n cellWidth: number,\n cellHeight: number,\n oldCellGroup: Group,\n padding: [number, number, number, number],\n textAlign: CanvasTextAlign,\n textBaseline: CanvasTextBaseline,\n mayHaveIcon: boolean,\n isMerge: boolean,\n range: CellRange,\n addNew: boolean,\n cellTheme?: IThemeSpec\n) {\n const newCellGroup = createCell(\n type,\n define,\n table,\n col,\n row,\n table.getColWidth(col),\n bgColorFunc,\n cellWidth,\n cellHeight,\n // oldCellGroup.parent,\n addNew ? table.scenegraph.getColGroup(col) : oldCellGroup.parent,\n // oldCellGroup.attribute.y,\n addNew ? 0 : oldCellGroup.attribute.y,\n padding,\n textAlign,\n textBaseline,\n mayHaveIcon,\n isMerge,\n range,\n cellTheme\n );\n if (!addNew) {\n oldCellGroup.parent.insertAfter(newCellGroup, oldCellGroup);\n oldCellGroup.parent.removeChild(oldCellGroup);\n\n // update cache\n if (table.scenegraph?.proxy.cellCache.get(col)) {\n table.scenegraph?.proxy.cellCache.set(col, newCellGroup);\n }\n }\n return newCellGroup;\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { Group } from '../../graphic/group';
|
|
2
2
|
import type { BaseTableAPI } from '../../../ts-types/base-table';
|
|
3
|
-
|
|
3
|
+
import type { IThemeSpec } from '@visactor/vrender';
|
|
4
|
+
export declare function createChartCellGroup(cellGroup: Group | null, columnGroup: Group, xOrigin: number, yOrigin: number, col: number, row: number, width: number, height: number, padding: number[], dataValue: string, chartType: any, chartSpec: any, chartInstance: any, table: BaseTableAPI, cellTheme: IThemeSpec): Group;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { Group } from "../../graphic/group";
|
|
2
2
|
|
|
3
|
-
import { getCellTheme } from "./text-cell";
|
|
4
|
-
|
|
5
3
|
import { Chart } from "../../graphic/chart";
|
|
6
4
|
|
|
7
5
|
import * as registerChartTypes from "../../../chartType";
|
|
@@ -10,9 +8,9 @@ import { getFunctionalProp } from "../../utils/get-prop";
|
|
|
10
8
|
|
|
11
9
|
import { isValid } from "../../../tools/util";
|
|
12
10
|
|
|
13
|
-
export function createChartCellGroup(cellGroup, columnGroup, xOrigin, yOrigin, col, row, width, height, padding, dataValue, chartType, chartSpec, chartInstance, table) {
|
|
11
|
+
export function createChartCellGroup(cellGroup, columnGroup, xOrigin, yOrigin, col, row, width, height, padding, dataValue, chartType, chartSpec, chartInstance, table, cellTheme) {
|
|
14
12
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
15
|
-
const ClassType = registerChartTypes.get()[chartType],
|
|
13
|
+
const ClassType = registerChartTypes.get()[chartType], headerStyle = table._getCellStyle(col, row), functionalPadding = getFunctionalProp("padding", headerStyle, col, row, table);
|
|
16
14
|
isValid(functionalPadding) && (padding = functionalPadding), cellGroup || ((cellGroup = new Group({
|
|
17
15
|
x: xOrigin,
|
|
18
16
|
y: yOrigin,
|
|
@@ -48,7 +46,7 @@ export function createChartCellGroup(cellGroup, columnGroup, xOrigin, yOrigin, c
|
|
|
48
46
|
y2: Math.ceil(cellGroup.globalAABBBounds.y1 + height - padding[2] + table.scrollTop)
|
|
49
47
|
}
|
|
50
48
|
});
|
|
51
|
-
return cellGroup.appendChild(chartGroup),
|
|
49
|
+
return cellGroup.appendChild(chartGroup), table.internalProps.layoutMap.setChartInstance(col, row, chartGroup.chartInstance),
|
|
52
50
|
cellGroup;
|
|
53
51
|
}
|
|
54
52
|
//# sourceMappingURL=chart-cell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["scenegraph/group-creater/cell-type/chart-cell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"sources":["scenegraph/group-creater/cell-type/chart-cell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,KAAK,kBAAkB,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG9C,MAAM,UAAU,oBAAoB,CAClC,SAAuB,EACvB,WAAkB,EAClB,OAAe,EACf,OAAe,EACf,GAAW,EACX,GAAW,EACX,KAAa,EACb,MAAc,EACd,OAAiB,EACjB,SAAiB,EACjB,SAAc,EACd,SAAc,EACd,aAAkB,EAClB,KAAmB,EACnB,SAAqB;;IAGrB,MAAM,cAAc,GAAG,kBAAkB,CAAC,GAAG,EAAE,CAAC;IAChD,MAAM,SAAS,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;IAC5C,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAClD,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AG,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC;IAEnF,OAAO,SAAS,CAAC;AACnB,CAAC","file":"chart-cell.js","sourcesContent":["import { Group } from '../../graphic/group';\nimport { Chart } from '../../graphic/chart';\nimport * as registerChartTypes from '../../../chartType';\nimport { getFunctionalProp } from '../../utils/get-prop';\nimport { isValid } from '../../../tools/util';\nimport type { BaseTableAPI } from '../../../ts-types/base-table';\nimport type { IThemeSpec } from '@visactor/vrender';\nexport function createChartCellGroup(\n cellGroup: Group | null,\n columnGroup: Group,\n xOrigin: number,\n yOrigin: number,\n col: number,\n row: number,\n width: number,\n height: number,\n padding: number[],\n dataValue: string,\n chartType: any,\n chartSpec: any,\n chartInstance: any,\n table: BaseTableAPI,\n cellTheme: IThemeSpec\n) {\n // 获取注册的chart图表类型\n const registerCharts = registerChartTypes.get();\n const ClassType = registerCharts[chartType];\n const headerStyle = table._getCellStyle(col, row); // to be fixed\n const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);\n if (isValid(functionalPadding)) {\n padding = functionalPadding;\n }\n // cell\n if (!cellGroup) {\n cellGroup = new Group({\n x: xOrigin,\n y: yOrigin,\n width,\n height,\n\n // 背景相关,cell背景由cellGroup绘制\n lineWidth: cellTheme?.group?.lineWidth ?? undefined,\n fill: cellTheme?.group?.fill ?? undefined,\n stroke: cellTheme?.group?.stroke ?? undefined,\n strokeArrayWidth: (cellTheme?.group as any)?.strokeArrayWidth ?? undefined,\n strokeArrayColor: (cellTheme?.group as any)?.strokeArrayColor ?? undefined,\n cursor: (cellTheme?.group as any)?.cursor ?? undefined,\n\n lineCap: 'square',\n\n clip: true\n } as any);\n cellGroup.role = 'cell';\n cellGroup.col = col;\n cellGroup.row = row;\n columnGroup.addChild(cellGroup);\n }\n cellGroup.AABBBounds.width(); // TODO 需要底层VRender修改\n // chart\n const chartGroup = new Chart({\n stroke: false,\n x: padding[3],\n y: padding[0],\n canvas: table.canvas,\n spec: chartSpec,\n ClassType,\n width: width - padding[3] - padding[1],\n height: height - padding[2] - padding[0],\n chartInstance,\n dataId: 'data',\n data: table.getCellValue(col, row),\n cellPadding: padding,\n viewBox: {\n x1: Math.ceil(cellGroup.globalAABBBounds.x1 + padding[3] + table.scrollLeft),\n x2: Math.ceil(cellGroup.globalAABBBounds.x1 + width - padding[1] + table.scrollLeft),\n y1: Math.ceil(cellGroup.globalAABBBounds.y1 + padding[0] + table.scrollTop),\n y2: Math.ceil(cellGroup.globalAABBBounds.y1 + height - padding[2] + table.scrollTop)\n }\n // clipRect: {\n // left: cellGroup.globalAABBBounds.x1 + (table as any).tableX + padding[3],\n // top: cellGroup.globalAABBBounds.y1 + (table as any).tableY + padding[0],\n // width: width - padding[1] - padding[3], //cellGroup.globalAABBBounds.width() - padding[1] - padding[3],\n // height: height - padding[0] - padding[2],\n // },\n });\n cellGroup.appendChild(chartGroup);\n // 将生成的实例存到layoutMap中 共享\n table.internalProps.layoutMap.setChartInstance(col, row, chartGroup.chartInstance);\n\n return cellGroup;\n}\n"]}
|
|
@@ -2,6 +2,6 @@ import type { IThemeSpec } from '@visactor/vrender';
|
|
|
2
2
|
import type { BaseTableAPI } from '../../../ts-types';
|
|
3
3
|
import { Group } from '../../graphic/group';
|
|
4
4
|
import type { Scenegraph } from '../../scenegraph';
|
|
5
|
-
export declare function createImageCellGroup(columnGroup: Group, xOrigin: number, yOrigin: number, col: number, row: number, width: number, height: number, keepAspectRatio: boolean, imageAutoSizing: boolean, padding: [number, number, number, number], textAlign: CanvasTextAlign, textBaseline: CanvasTextBaseline, table: BaseTableAPI, cellTheme
|
|
5
|
+
export declare function createImageCellGroup(columnGroup: Group, xOrigin: number, yOrigin: number, col: number, row: number, width: number, height: number, keepAspectRatio: boolean, imageAutoSizing: boolean, padding: [number, number, number, number], textAlign: CanvasTextAlign, textBaseline: CanvasTextBaseline, table: BaseTableAPI, cellTheme: IThemeSpec): Group;
|
|
6
6
|
export declare function _adjustWidthHeight(col: number, row: number, width: number, height: number, scene: Scenegraph, padding: [number, number, number, number]): boolean;
|
|
7
7
|
export declare function updateImageCellContentWhileResize(cellGroup: Group, col: number, row: number, table: BaseTableAPI): void;
|
|
@@ -10,8 +10,6 @@ import { calcStartPosition } from "../../utils/cell-pos";
|
|
|
10
10
|
|
|
11
11
|
import { getProp, getFunctionalProp } from "../../utils/get-prop";
|
|
12
12
|
|
|
13
|
-
import { getCellTheme } from "./text-cell";
|
|
14
|
-
|
|
15
13
|
import { isValid } from "../../../tools/util";
|
|
16
14
|
|
|
17
15
|
import { getQuadProps } from "../../utils/padding";
|
|
@@ -20,7 +18,6 @@ const regedIcons = icons.get();
|
|
|
20
18
|
|
|
21
19
|
export function createImageCellGroup(columnGroup, xOrigin, yOrigin, col, row, width, height, keepAspectRatio, imageAutoSizing, padding, textAlign, textBaseline, table, cellTheme) {
|
|
22
20
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
23
|
-
cellTheme = getCellTheme(table, col, row, cellTheme);
|
|
24
21
|
const headerStyle = table._getCellStyle(col, row), functionalPadding = getFunctionalProp("padding", headerStyle, col, row, table);
|
|
25
22
|
isValid(functionalPadding) && (padding = functionalPadding), (null === (_a = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _a ? void 0 : _a.textAlign) && (textAlign = null === (_b = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _b ? void 0 : _b.textAlign),
|
|
26
23
|
(null === (_c = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _c ? void 0 : _c.textBaseline) && (textBaseline = null === (_d = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _d ? void 0 : _d.textBaseline);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["scenegraph/group-creater/cell-type/image-cell.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAA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Q,CAAC,aAAa,CAAC;YACrB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,CAAC;YACzB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,CAAC;YACzB,KAAK,EAAE,QAAQ;YACf,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAC;KACJ;AACH,CAAC","file":"image-cell.js","sourcesContent":["// @ts-nocheck\n/* eslint-disable no-undef */\nimport type { IImage, Image, IThemeSpec } from '@visactor/vrender';\nimport { createImage } from '@visactor/vrender';\nimport type { BaseTableAPI } from '../../../ts-types';\nimport * as icons from '../../../icons';\nimport { Group } from '../../graphic/group';\nimport { calcKeepAspectRatioSize } from '../../utils/keep-aspect-ratio';\nimport { calcStartPosition } from '../../utils/cell-pos';\nimport type { Scenegraph } from '../../scenegraph';\nimport { getProp, getFunctionalProp } from '../../utils/get-prop';\nimport { getCellTheme } from './text-cell';\nimport { isValid } from '../../../tools/util';\nimport { getQuadProps } from '../../utils/padding';\n\nconst regedIcons = icons.get();\n\nexport function createImageCellGroup(\n columnGroup: Group,\n xOrigin: number,\n yOrigin: number,\n col: number,\n row: number,\n width: number,\n height: number,\n keepAspectRatio: boolean,\n imageAutoSizing: boolean,\n padding: [number, number, number, number],\n textAlign: CanvasTextAlign,\n textBaseline: CanvasTextBaseline,\n table: BaseTableAPI,\n cellTheme?: IThemeSpec\n) {\n cellTheme = getCellTheme(table, col, row, cellTheme);\n const headerStyle = table._getCellStyle(col, row); // to be fixed\n const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);\n // const margin = getProp('padding', headerStyle, col, row, table);\n if (isValid(functionalPadding)) {\n padding = functionalPadding;\n }\n if (cellTheme?.text?.textAlign) {\n textAlign = cellTheme?.text?.textAlign;\n }\n if (cellTheme?.text?.textBaseline) {\n textBaseline = cellTheme?.text?.textBaseline;\n }\n\n // cell\n const cellGroup = new Group({\n x: xOrigin,\n y: yOrigin,\n width,\n height,\n // childrenPickable: false,\n\n // 背景相关,cell背景由cellGroup绘制\n lineWidth: cellTheme?.group?.lineWidth ?? undefined,\n fill: cellTheme?.group?.fill ?? undefined,\n stroke: cellTheme?.group?.stroke ?? undefined,\n strokeArrayWidth: (cellTheme?.group as any)?.strokeArrayWidth ?? undefined,\n strokeArrayColor: (cellTheme?.group as any)?.strokeArrayColor ?? undefined,\n cursor: (cellTheme?.group as any)?.cursor ?? undefined,\n\n lineCap: 'square',\n\n clip: true\n });\n cellGroup.role = 'cell';\n cellGroup.col = col;\n cellGroup.row = row;\n columnGroup.addChild(cellGroup);\n\n // image\n const value = table.getCellValue(col, row);\n const image: IImage = createImage({\n x: padding[3],\n y: padding[0],\n width: width - padding[1] - padding[3],\n height: height - padding[0] - padding[2],\n image: value ?? (regedIcons.damage_pic as any).svg,\n cursor: 'pointer' as Cursor\n });\n image.name = 'image';\n image.keepAspectRatio = keepAspectRatio;\n if (keepAspectRatio || imageAutoSizing) {\n image.successCallback = () => {\n const originImage = image.resources.get(image.attribute.image).data;\n\n if (imageAutoSizing) {\n _adjustWidthHeight(\n col,\n row,\n (originImage as HTMLImageElement).width,\n (originImage as HTMLImageElement).height,\n table.scenegraph,\n padding\n );\n }\n\n if (keepAspectRatio) {\n const { width: imageWidth, height: imageHeight } = calcKeepAspectRatioSize(\n originImage.width,\n originImage.height,\n cellGroup.attribute.width - padding[1] - padding[3],\n cellGroup.attribute.height - padding[0] - padding[2]\n );\n\n // const left = 0;\n // const top = 0;\n const pos = calcStartPosition(\n 0,\n 0,\n cellGroup.attribute.width,\n cellGroup.attribute.height,\n imageWidth,\n imageHeight,\n textAlign,\n textBaseline,\n padding\n );\n\n image.setAttributes({\n x: pos.x,\n y: pos.y,\n width: imageWidth,\n height: imageHeight\n });\n }\n\n table.scenegraph.updateNextFrame();\n };\n } else {\n image.successCallback = () => {\n updateImageCellContentWhileResize(cellGroup, col, row, table);\n };\n }\n (image as any).failCallback = () => {\n const regedIcons = icons.get();\n // image.setAttribute('image', (regedIcons.damage_pic as any).svg);\n (image as any).image = (regedIcons.damage_pic as any).svg;\n };\n cellGroup.appendChild(image);\n\n return cellGroup;\n}\n\n/**\n * 调整某个图片资源所在行列的行高列宽 之后重绘\n * @param col\n * @param row\n * @param img\n * @param table\n * @returns 行高或者列宽是否进行了调整\n */\nexport function _adjustWidthHeight(\n col: number,\n row: number,\n // img: HTMLImageElement,\n width: number,\n height: number,\n scene: Scenegraph,\n padding: [number, number, number, number]\n): boolean {\n // const { width, height } = img as any;\n // const currentContext = context.toCurrentContext();\n\n let needInvalidate = false;\n let targetWidth: number = null;\n let targetHeight: number = null;\n if (scene.table.getColWidth(col) < width + padding[1] + padding[3]) {\n targetWidth = width + padding[1] + padding[3];\n needInvalidate = true;\n }\n if (scene.table.getRowHeight(row) < height + padding[2] + padding[0]) {\n targetHeight = height + padding[2] + padding[0];\n needInvalidate = true;\n }\n if (needInvalidate) {\n if (typeof targetWidth === 'number') {\n // table.setColWidth(col, targetWidth, true);\n scene.setColWidth(col, targetWidth);\n }\n if (typeof targetHeight === 'number') {\n // table.setRowHeight(row, targetHeight, true);\n scene.setRowHeight(row, targetHeight);\n }\n // table.updateCanvasScroll();\n // // table.throttleInvalidate(); // 这里会造成每一张图加载后就重绘 造成多次绘制问题!节流绘制\n // table.invalidate(); //节流绘制改回及时绘制 节流绘制在图片加载过程中的效果不太好\n\n scene.component.updateScrollBar();\n // scene.updateNextFrame();\n return true;\n }\n return false;\n}\n\nexport function updateImageCellContentWhileResize(cellGroup: Group, col: number, row: number, table: BaseTableAPI) {\n const image = cellGroup.getChildByName('image') as Image;\n const originImage =\n (typeof image.attribute.image !== 'string' && image.attribute.image) ||\n image.resources.get(image.attribute.image).data;\n\n if (!originImage) {\n return;\n }\n\n const headerStyle = table._getCellStyle(col, row); // to be fixed\n const textAlign = getProp('textAlign', headerStyle, col, row, table) ?? 'left';\n const textBaseline = getProp('textBaseline', headerStyle, col, row, table) ?? 'middle';\n const padding = getQuadProps(getProp('padding', headerStyle, col, row, table)) ?? [0, 0, 0, 0];\n\n if (image.keepAspectRatio) {\n const { width: imageWidth, height: imageHeight } = calcKeepAspectRatioSize(\n originImage.width || originImage.videoWidth,\n originImage.height || originImage.videoHeight,\n cellGroup.attribute.width - (padding[1] + padding[3]),\n cellGroup.attribute.height - (padding[0] + padding[2])\n );\n\n const pos = calcStartPosition(\n 0,\n 0,\n cellGroup.attribute.width,\n cellGroup.attribute.height,\n imageWidth,\n imageHeight,\n textAlign,\n textBaseline,\n padding\n );\n\n image.setAttributes({\n x: pos.x,\n y: pos.y,\n width: imageWidth,\n height: imageHeight\n });\n } else {\n image.setAttributes({\n x: padding[3],\n y: padding[0],\n width: cellGroup.attribute.width - padding[1] - padding[3],\n height: cellGroup.attribute.height - padding[0] - padding[2]\n });\n }\n\n // update video play icon\n const playIcon = cellGroup.getChildByName('play-icon');\n if (playIcon) {\n const left = 0;\n const top = 0;\n const width = cellGroup.attribute.width;\n const height = cellGroup.attribute.height;\n const iconSize = Math.floor(Math.min(width - padding[1] - padding[3], height - padding[2] - padding[0]) / 2);\n const anchorX =\n left + (width > image.attribute.width ? image.attribute.x - left + image.attribute.width / 2 : width / 2);\n const anchorY =\n top + (height > image.attribute.height ? image.attribute.y - top + image.attribute.height / 2 : height / 2);\n\n playIcon.setAttributes({\n x: anchorX - iconSize / 2,\n y: anchorY - iconSize / 2,\n width: iconSize,\n height: iconSize\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["scenegraph/group-creater/cell-type/image-cell.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAA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I,GAAG,CAAC,CAAC;QACf,MAAM,GAAG,GAAG,CAAC,CAAC;QACd,MAAM,KAAK,GAAG,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC;QACxC,MAAM,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC;QAC1C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC7G,MAAM,OAAO,GACX,IAAI,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAC5G,MAAM,OAAO,GACX,GAAG,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAE9G,QAAQ,CAAC,aAAa,CAAC;YACrB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,CAAC;YACzB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,CAAC;YACzB,KAAK,EAAE,QAAQ;YACf,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAC;KACJ;AACH,CAAC","file":"image-cell.js","sourcesContent":["// @ts-nocheck\n/* eslint-disable no-undef */\nimport type { IImage, Image, IThemeSpec } from '@visactor/vrender';\nimport { createImage } from '@visactor/vrender';\nimport type { BaseTableAPI } from '../../../ts-types';\nimport * as icons from '../../../icons';\nimport { Group } from '../../graphic/group';\nimport { calcKeepAspectRatioSize } from '../../utils/keep-aspect-ratio';\nimport { calcStartPosition } from '../../utils/cell-pos';\nimport type { Scenegraph } from '../../scenegraph';\nimport { getProp, getFunctionalProp } from '../../utils/get-prop';\nimport { isValid } from '../../../tools/util';\nimport { getQuadProps } from '../../utils/padding';\n\nconst regedIcons = icons.get();\n\nexport function createImageCellGroup(\n columnGroup: Group,\n xOrigin: number,\n yOrigin: number,\n col: number,\n row: number,\n width: number,\n height: number,\n keepAspectRatio: boolean,\n imageAutoSizing: boolean,\n padding: [number, number, number, number],\n textAlign: CanvasTextAlign,\n textBaseline: CanvasTextBaseline,\n table: BaseTableAPI,\n cellTheme: IThemeSpec\n) {\n const headerStyle = table._getCellStyle(col, row); // to be fixed\n const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);\n // const margin = getProp('padding', headerStyle, col, row, table);\n if (isValid(functionalPadding)) {\n padding = functionalPadding;\n }\n if (cellTheme?.text?.textAlign) {\n textAlign = cellTheme?.text?.textAlign;\n }\n if (cellTheme?.text?.textBaseline) {\n textBaseline = cellTheme?.text?.textBaseline;\n }\n\n // cell\n const cellGroup = new Group({\n x: xOrigin,\n y: yOrigin,\n width,\n height,\n // childrenPickable: false,\n\n // 背景相关,cell背景由cellGroup绘制\n lineWidth: cellTheme?.group?.lineWidth ?? undefined,\n fill: cellTheme?.group?.fill ?? undefined,\n stroke: cellTheme?.group?.stroke ?? undefined,\n strokeArrayWidth: (cellTheme?.group as any)?.strokeArrayWidth ?? undefined,\n strokeArrayColor: (cellTheme?.group as any)?.strokeArrayColor ?? undefined,\n cursor: (cellTheme?.group as any)?.cursor ?? undefined,\n\n lineCap: 'square',\n\n clip: true\n });\n cellGroup.role = 'cell';\n cellGroup.col = col;\n cellGroup.row = row;\n columnGroup.addChild(cellGroup);\n\n // image\n const value = table.getCellValue(col, row);\n const image: IImage = createImage({\n x: padding[3],\n y: padding[0],\n width: width - padding[1] - padding[3],\n height: height - padding[0] - padding[2],\n image: value ?? (regedIcons.damage_pic as any).svg,\n cursor: 'pointer' as Cursor\n });\n image.name = 'image';\n image.keepAspectRatio = keepAspectRatio;\n if (keepAspectRatio || imageAutoSizing) {\n image.successCallback = () => {\n const originImage = image.resources.get(image.attribute.image).data;\n\n if (imageAutoSizing) {\n _adjustWidthHeight(\n col,\n row,\n (originImage as HTMLImageElement).width,\n (originImage as HTMLImageElement).height,\n table.scenegraph,\n padding\n );\n }\n\n if (keepAspectRatio) {\n const { width: imageWidth, height: imageHeight } = calcKeepAspectRatioSize(\n originImage.width,\n originImage.height,\n cellGroup.attribute.width - padding[1] - padding[3],\n cellGroup.attribute.height - padding[0] - padding[2]\n );\n\n // const left = 0;\n // const top = 0;\n const pos = calcStartPosition(\n 0,\n 0,\n cellGroup.attribute.width,\n cellGroup.attribute.height,\n imageWidth,\n imageHeight,\n textAlign,\n textBaseline,\n padding\n );\n\n image.setAttributes({\n x: pos.x,\n y: pos.y,\n width: imageWidth,\n height: imageHeight\n });\n }\n\n table.scenegraph.updateNextFrame();\n };\n } else {\n image.successCallback = () => {\n updateImageCellContentWhileResize(cellGroup, col, row, table);\n };\n }\n (image as any).failCallback = () => {\n const regedIcons = icons.get();\n // image.setAttribute('image', (regedIcons.damage_pic as any).svg);\n (image as any).image = (regedIcons.damage_pic as any).svg;\n };\n cellGroup.appendChild(image);\n\n return cellGroup;\n}\n\n/**\n * 调整某个图片资源所在行列的行高列宽 之后重绘\n * @param col\n * @param row\n * @param img\n * @param table\n * @returns 行高或者列宽是否进行了调整\n */\nexport function _adjustWidthHeight(\n col: number,\n row: number,\n // img: HTMLImageElement,\n width: number,\n height: number,\n scene: Scenegraph,\n padding: [number, number, number, number]\n): boolean {\n // const { width, height } = img as any;\n // const currentContext = context.toCurrentContext();\n\n let needInvalidate = false;\n let targetWidth: number = null;\n let targetHeight: number = null;\n if (scene.table.getColWidth(col) < width + padding[1] + padding[3]) {\n targetWidth = width + padding[1] + padding[3];\n needInvalidate = true;\n }\n if (scene.table.getRowHeight(row) < height + padding[2] + padding[0]) {\n targetHeight = height + padding[2] + padding[0];\n needInvalidate = true;\n }\n if (needInvalidate) {\n if (typeof targetWidth === 'number') {\n // table.setColWidth(col, targetWidth, true);\n scene.setColWidth(col, targetWidth);\n }\n if (typeof targetHeight === 'number') {\n // table.setRowHeight(row, targetHeight, true);\n scene.setRowHeight(row, targetHeight);\n }\n // table.updateCanvasScroll();\n // // table.throttleInvalidate(); // 这里会造成每一张图加载后就重绘 造成多次绘制问题!节流绘制\n // table.invalidate(); //节流绘制改回及时绘制 节流绘制在图片加载过程中的效果不太好\n\n scene.component.updateScrollBar();\n // scene.updateNextFrame();\n return true;\n }\n return false;\n}\n\nexport function updateImageCellContentWhileResize(cellGroup: Group, col: number, row: number, table: BaseTableAPI) {\n const image = cellGroup.getChildByName('image') as Image;\n const originImage =\n (typeof image.attribute.image !== 'string' && image.attribute.image) ||\n image.resources.get(image.attribute.image).data;\n\n if (!originImage) {\n return;\n }\n\n const headerStyle = table._getCellStyle(col, row); // to be fixed\n const textAlign = getProp('textAlign', headerStyle, col, row, table) ?? 'left';\n const textBaseline = getProp('textBaseline', headerStyle, col, row, table) ?? 'middle';\n const padding = getQuadProps(getProp('padding', headerStyle, col, row, table)) ?? [0, 0, 0, 0];\n\n if (image.keepAspectRatio) {\n const { width: imageWidth, height: imageHeight } = calcKeepAspectRatioSize(\n originImage.width || originImage.videoWidth,\n originImage.height || originImage.videoHeight,\n cellGroup.attribute.width - (padding[1] + padding[3]),\n cellGroup.attribute.height - (padding[0] + padding[2])\n );\n\n const pos = calcStartPosition(\n 0,\n 0,\n cellGroup.attribute.width,\n cellGroup.attribute.height,\n imageWidth,\n imageHeight,\n textAlign,\n textBaseline,\n padding\n );\n\n image.setAttributes({\n x: pos.x,\n y: pos.y,\n width: imageWidth,\n height: imageHeight\n });\n } else {\n image.setAttributes({\n x: padding[3],\n y: padding[0],\n width: cellGroup.attribute.width - padding[1] - padding[3],\n height: cellGroup.attribute.height - padding[0] - padding[2]\n });\n }\n\n // update video play icon\n const playIcon = cellGroup.getChildByName('play-icon');\n if (playIcon) {\n const left = 0;\n const top = 0;\n const width = cellGroup.attribute.width;\n const height = cellGroup.attribute.height;\n const iconSize = Math.floor(Math.min(width - padding[1] - padding[3], height - padding[2] - padding[0]) / 2);\n const anchorX =\n left + (width > image.attribute.width ? image.attribute.x - left + image.attribute.width / 2 : width / 2);\n const anchorY =\n top + (height > image.attribute.height ? image.attribute.y - top + image.attribute.height / 2 : height / 2);\n\n playIcon.setAttributes({\n x: anchorX - iconSize / 2,\n y: anchorY - iconSize / 2,\n width: iconSize,\n height: iconSize\n });\n }\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IThemeSpec } from '@visactor/vrender';
|
|
1
2
|
import { Group } from '../../graphic/group';
|
|
2
3
|
import type { BaseTableAPI } from '../../../ts-types/base-table';
|
|
3
|
-
export declare function createSparkLineCellGroup(cellGroup: Group | null, columnGroup: Group, xOrigin: number, yOrigin: number, col: number, row: number, width: number, height: number, padding: number[], table: BaseTableAPI): Group;
|
|
4
|
+
export declare function createSparkLineCellGroup(cellGroup: Group | null, columnGroup: Group, xOrigin: number, yOrigin: number, col: number, row: number, width: number, height: number, padding: number[], table: BaseTableAPI, cellTheme: IThemeSpec): Group;
|
|
@@ -6,13 +6,10 @@ import { isValid } from "../../../tools/util";
|
|
|
6
6
|
|
|
7
7
|
import { Group } from "../../graphic/group";
|
|
8
8
|
|
|
9
|
-
import { getCellTheme } from "./text-cell";
|
|
10
|
-
|
|
11
9
|
const xScale = new PointScale, yScale = new LinearScale;
|
|
12
10
|
|
|
13
|
-
export function createSparkLineCellGroup(cellGroup, columnGroup, xOrigin, yOrigin, col, row, width, height, padding, table) {
|
|
11
|
+
export function createSparkLineCellGroup(cellGroup, columnGroup, xOrigin, yOrigin, col, row, width, height, padding, table, cellTheme) {
|
|
14
12
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
15
|
-
const cellTheme = getCellTheme(table, col, row);
|
|
16
13
|
cellGroup || ((cellGroup = new Group({
|
|
17
14
|
x: xOrigin,
|
|
18
15
|
y: yOrigin,
|