@visactor/vrender-components 0.17.19 → 0.17.20-alpha.10
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/axis/base.js +6 -10
- package/cjs/axis/base.js.map +1 -1
- package/cjs/axis/grid/base.js +1 -1
- package/cjs/axis/grid/base.js.map +1 -1
- package/cjs/checkbox/checkbox.js +2 -1
- package/cjs/checkbox/checkbox.js.map +1 -1
- package/cjs/core/type.d.ts +10 -8
- package/cjs/core/type.js.map +1 -1
- package/cjs/data-zoom/data-zoom.d.ts +1 -0
- package/cjs/data-zoom/data-zoom.js +49 -49
- package/cjs/data-zoom/data-zoom.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/indicator/indicator.js +7 -32
- package/cjs/indicator/indicator.js.map +1 -1
- package/cjs/label/base.js +7 -16
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/type.d.ts +1 -1
- package/cjs/label/type.js.map +1 -1
- package/cjs/legend/base.js +1 -1
- package/cjs/legend/base.js.map +1 -1
- package/cjs/legend/discrete/discrete.js +14 -9
- package/cjs/legend/discrete/discrete.js.map +1 -1
- package/cjs/legend/type.d.ts +2 -2
- package/cjs/legend/type.js.map +1 -1
- package/cjs/marker/base.js +1 -1
- package/cjs/marker/base.js.map +1 -1
- package/cjs/pager/pager.js +2 -1
- package/cjs/pager/pager.js.map +1 -1
- package/cjs/segment/segment.js +1 -1
- package/cjs/segment/segment.js.map +1 -1
- package/cjs/slider/slider.js +1 -1
- package/cjs/slider/slider.js.map +1 -1
- package/cjs/tag/tag.js +28 -42
- package/cjs/tag/tag.js.map +1 -1
- package/cjs/tooltip/tooltip.js +1 -1
- package/cjs/tooltip/tooltip.js.map +1 -1
- package/cjs/util/text.d.ts +4 -1
- package/cjs/util/text.js +15 -2
- package/cjs/util/text.js.map +1 -1
- package/es/axis/base.js +5 -12
- package/es/axis/base.js.map +1 -1
- package/es/axis/grid/base.js +1 -1
- package/es/axis/grid/base.js.map +1 -1
- package/es/checkbox/checkbox.js +2 -1
- package/es/checkbox/checkbox.js.map +1 -1
- package/es/core/type.d.ts +10 -8
- package/es/core/type.js.map +1 -1
- package/es/data-zoom/data-zoom.d.ts +1 -0
- package/es/data-zoom/data-zoom.js +48 -50
- package/es/data-zoom/data-zoom.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/indicator/indicator.js +5 -34
- package/es/indicator/indicator.js.map +1 -1
- package/es/label/base.js +6 -18
- package/es/label/base.js.map +1 -1
- package/es/label/type.d.ts +1 -1
- package/es/label/type.js.map +1 -1
- package/es/legend/base.js +1 -1
- package/es/legend/base.js.map +1 -1
- package/es/legend/discrete/discrete.js +13 -8
- package/es/legend/discrete/discrete.js.map +1 -1
- package/es/legend/type.d.ts +2 -2
- package/es/legend/type.js.map +1 -1
- package/es/marker/base.js +1 -1
- package/es/marker/base.js.map +1 -1
- package/es/pager/pager.js +2 -1
- package/es/pager/pager.js.map +1 -1
- package/es/segment/segment.js +1 -1
- package/es/segment/segment.js.map +1 -1
- package/es/slider/slider.js +1 -1
- package/es/slider/slider.js.map +1 -1
- package/es/tag/tag.js +29 -45
- package/es/tag/tag.js.map +1 -1
- package/es/tooltip/tooltip.js +1 -1
- package/es/tooltip/tooltip.js.map +1 -1
- package/es/util/text.d.ts +4 -1
- package/es/util/text.js +13 -1
- package/es/util/text.js.map +1 -1
- package/package.json +5 -5
package/es/axis/grid/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/axis/grid/base.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAErF,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,iBAA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AAC;gBACpE,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;gBAClD,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC;oBAChC,IAAI;oBACJ,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC;iBACtB,CAAS,CAAC;gBACX,KAAK,CAAC,IAAI,GAAG,GAAG,IAAI,SAAS,CAAC;gBAC9B,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI,WAAW,KAAK,EAAE,CAAC,CAAC;gBACtD,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;aACtB;SACF;IACH,CAAC;IAOS,UAAU,CAAC,EAAU;QAC7B,OAAO,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC;IAC5B,CAAC;;AAzKM,0BAAiB,GAAgC;IACtD,KAAK,EAAE;QACL,SAAS,EAAE,CAAC;QACZ,MAAM,EAAE,MAAM;QACd,aAAa,EAAE,CAAC;QAChB,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KACjB;IACD,OAAO,EAAE;QACP,OAAO,EAAE,KAAK;QACd,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,MAAM;YACd,aAAa,EAAE,CAAC;YAChB,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;SACjB;KACF;CACF,CAAC","file":"base.js","sourcesContent":["/**\n * @description 网格线\n */\nimport { isFunction, isArray, merge, PointService, abs, pi } from '@visactor/vutils';\nimport type { IGroup, Path } from '@visactor/vrender-core';\nimport { graphicCreator } from '@visactor/vrender-core';\nimport { AbstractComponent } from '../../core/base';\nimport type { Point } from '../../core/type';\nimport type { GridItem, CircleGridAttributes, GridBaseAttributes, GridAttributes, LineGridAttributes } from './type';\nimport type { AxisItem, TransformedAxisItem } from '../type';\nimport { AXIS_ELEMENT_NAME } from '../constant';\n\nfunction getLinePath(points: Point[], closed: boolean) {\n let path = '';\n if (points.length === 0) {\n return path;\n }\n points.forEach((point, index) => {\n if (index === 0) {\n path = `M${point.x},${point.y}`;\n } else {\n path += `L${point.x},${point.y}`;\n }\n });\n if (closed) {\n path += 'Z';\n }\n\n return path;\n}\n\nfunction getArcPath(center: Point, points: Point[], reverse: boolean, closed: boolean) {\n let path = '';\n if (!center || points.length === 0) {\n return path;\n }\n const firstPoint = points[0];\n const radius = PointService.distancePP(center, firstPoint);\n const sweepFlag = reverse ? 0 : 1; // 顺时针还是逆时针\n if (closed) {\n // 封闭时,绘制整个圆\n path += `M${center.x},${center.y - radius}A${radius},${radius},0,0,${sweepFlag},${center.x},${\n center.y + radius\n }A${radius},${radius},0,0,${sweepFlag},${center.x},${center.y - radius}Z`;\n } else {\n points.forEach((point, index) => {\n if (index === 0) {\n path = `M${point.x},${point.y}`;\n } else {\n path += `A${radius},${radius},0,0,${sweepFlag},${point.x},${point.y}`;\n }\n });\n }\n\n return path;\n}\n\nfunction getRegionPath(from: Point[], to: Point[], attribute: GridAttributes) {\n const { type, closed } = attribute;\n const reversePoints = to.slice(0).reverse();\n\n let regionPath = '';\n let nextPath = '';\n\n if (type === 'line' && (attribute as LineGridAttributes).smoothLink && (attribute as LineGridAttributes).center) {\n const fromStart = from[0];\n const toEnd = reversePoints[0];\n const center = (attribute as LineGridAttributes).center as Point;\n\n regionPath = getLinePath(from, !!closed);\n nextPath = getLinePath(reversePoints, !!closed);\n const toEndRadius = PointService.distancePP(toEnd, center);\n const fromStartRadius = PointService.distancePP(fromStart, center);\n regionPath += `A${toEndRadius},${toEndRadius},0,0,1,${toEnd.x},${toEnd.y}L${toEnd.x},${toEnd.y}`;\n nextPath += `A${fromStartRadius},${fromStartRadius},0,0,0,${fromStart.x},${fromStart.y}`;\n } else if (type === 'circle') {\n const { center } = attribute as CircleGridAttributes;\n regionPath = getArcPath(center, from, false, !!closed);\n nextPath = getArcPath(center, reversePoints, true, !!closed);\n } else if (type === 'line' || type === 'polygon') {\n regionPath = getLinePath(from, !!closed);\n nextPath = getLinePath(reversePoints, !!closed);\n }\n\n if (closed) {\n regionPath += nextPath;\n } else {\n nextPath = 'L' + nextPath.substring(1); // 更新第一个节点\n regionPath += nextPath;\n regionPath += 'Z';\n }\n return regionPath;\n}\n\nexport abstract class BaseGrid<T extends GridBaseAttributes> extends AbstractComponent<Required<T>> {\n name = 'axis-grid';\n\n static defaultAttributes: Partial<GridBaseAttributes> = {\n style: {\n lineWidth: 1,\n stroke: '#999',\n strokeOpacity: 1,\n lineDash: [4, 4]\n },\n subGrid: {\n visible: false,\n style: {\n lineWidth: 1,\n stroke: '#999',\n strokeOpacity: 1,\n lineDash: [4, 4]\n }\n }\n };\n\n protected _innerView: IGroup;\n getInnerView() {\n return this._innerView;\n }\n\n protected _prevInnerView: IGroup; // 缓存旧场景树,用于自定义动画\n /**\n * 获取更新前的旧场景树\n * @returns 返回更新前的旧场景树\n */\n getPrevInnerView() {\n return this._prevInnerView;\n }\n\n // 经过处理后的坐标轴点数据\n protected data: TransformedAxisItem[] = [];\n abstract getTickCoord(value: number): Point;\n abstract isInValidValue(value: number): boolean;\n abstract getVerticalVector(offset: number, inside: boolean, point: Point): [number, number];\n protected abstract getGridAttribute(isSubGrid: boolean): T;\n\n protected render(): void {\n this.removeAllChild();\n this._prevInnerView = this._innerView;\n this._innerView = graphicCreator.group({ x: 0, y: 0, pickable: false });\n this.add(this._innerView);\n\n const { items, visible } = this.attribute;\n if (items && items.length && visible !== false) {\n this.data = this._transformItems(items);\n this._renderGrid(this._innerView);\n }\n }\n\n protected getVerticalCoord(point: Point, offset: number, inside: boolean): Point {\n const vector = this.getVerticalVector(offset, inside, point);\n return {\n x: point.x + vector[0],\n y: point.y + vector[1]\n };\n }\n\n private _transformItems(items: AxisItem[]) {\n const data: TransformedAxisItem[] = [];\n items.forEach((item: AxisItem) => {\n data.push({\n ...item,\n point: this.getTickCoord(item.value),\n id: item.id ?? item.label\n });\n });\n return data;\n }\n private _renderGrid(container: any) {\n // 渲染 subGrid\n const { visible } = this.attribute.subGrid || {};\n if (visible) {\n this._renderGridByType(true, container);\n }\n\n // 渲染 Grid,Grid 需要在 subGrid 上层渲染\n this._renderGridByType(false, container);\n }\n\n private _renderGridByType(isSubGrid: boolean, container: IGroup) {\n const gridAttrs = merge({}, this.attribute, this.getGridAttribute(isSubGrid));\n\n const { type, items, style, closed, alternateColor, depth = 0 } = gridAttrs;\n const name = isSubGrid ? `${AXIS_ELEMENT_NAME.grid}-sub` : `${AXIS_ELEMENT_NAME.grid}`;\n\n // 绘制网格线\n items.forEach((item: GridItem, index: number) => {\n const { id, points } = item;\n let path = '';\n if (type === 'line' || type === 'polygon') {\n path = getLinePath(points, !!closed);\n } else if (type === 'circle') {\n const { center } = this.attribute as unknown as CircleGridAttributes;\n path = getArcPath(center, points, false, !!closed);\n }\n const shape = graphicCreator.path({\n path,\n z: depth,\n ...(isFunction(style)\n ? merge({}, this.skipDefault ? null : BaseGrid.defaultAttributes.style, style(item, index))\n : style)\n }) as Path;\n shape.name = `${name}-line`;\n shape.id = this._getNodeId(`${name}-path-${id}`);\n container.add(shape);\n });\n\n // 添加额外的3d线段\n if (depth && type === 'line') {\n items.forEach((item: GridItem, index: number) => {\n const { id, points } = item;\n // 重新计算points,使其长度为depth\n const nextPoints = [];\n nextPoints.push(points[0]);\n const dir = { x: points[1].x - points[0].x, y: points[1].y - points[0].y };\n const dirLen = Math.sqrt(dir.x * dir.x + dir.y * dir.y);\n const ratio = depth / dirLen;\n nextPoints.push({ x: points[0].x + dir.x * ratio, y: points[0].y + dir.y * ratio });\n const path = getLinePath(nextPoints, !!closed);\n const deltaX = abs(nextPoints[0].x - nextPoints[1].x);\n const deltaY = abs(nextPoints[0].y - nextPoints[1].y);\n const shape = graphicCreator.path({\n path,\n z: 0,\n alpha: deltaX > deltaY ? ((points[1].x - points[0].x > 0 ? -1 : 1) * pi) / 2 : 0,\n beta: deltaX < deltaY ? -pi / 2 : 0,\n anchor3d: deltaX > deltaY ? [nextPoints[0].x, 0] : [0, nextPoints[0].y],\n ...(isFunction(style)\n ? merge({}, this.skipDefault ? null : BaseGrid.defaultAttributes.style, style(item, index))\n : style)\n }) as Path;\n shape.name = `${name}-line`;\n shape.id = this._getNodeId(`${name}-path-${id}`);\n container.add(shape);\n });\n }\n\n // 绘制填充区域\n if (items.length > 1 && alternateColor) {\n const colors: string[] = isArray(alternateColor)\n ? (alternateColor as string[])\n : [alternateColor as string, 'transparent'];\n const getColor = (index: number) => colors[index % colors.length];\n\n // const regions: any[] = [];\n for (let index = 0; index < items.length - 1; index++) {\n const [prev, curr] = [items[index].points, items[index + 1].points];\n const path = getRegionPath(prev, curr, gridAttrs);\n const shape = graphicCreator.path({\n path,\n fill: getColor(index)\n }) as Path;\n shape.name = `${name}-region`;\n shape.id = this._getNodeId(`${name}-region-${index}`);\n container.add(shape);\n }\n }\n }\n\n /**\n * @override 覆写\n * @param id\n * @returns\n */\n protected _getNodeId(id: string) {\n return `${this.id}-${id}`;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/axis/grid/base.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAErF,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,SAAS,WAAW,CAAC,MAAe,EAAE,MAAe;IACnD,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;QACvB,OAAO,IAAI,CAAC;KACb;IACD,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QAC9B,IAAI,KAAK,KAAK,CAAC,EAAE;YACf,IAAI,GAAG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AK,EAAE,CAAC,CAAC;gBACtD,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;aACtB;SACF;IACH,CAAC;IAOS,UAAU,CAAC,EAAU;QAC7B,OAAO,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC;IAC5B,CAAC;;AAzKM,0BAAiB,GAAgC;IACtD,KAAK,EAAE;QACL,SAAS,EAAE,CAAC;QACZ,MAAM,EAAE,MAAM;QACd,aAAa,EAAE,CAAC;QAChB,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KACjB;IACD,OAAO,EAAE;QACP,OAAO,EAAE,KAAK;QACd,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,MAAM;YACd,aAAa,EAAE,CAAC;YAChB,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;SACjB;KACF;CACF,CAAC","file":"base.js","sourcesContent":["/**\n * @description 网格线\n */\nimport { isFunction, isArray, merge, PointService, abs, pi } from '@visactor/vutils';\nimport type { IGroup, Path } from '@visactor/vrender-core';\nimport { graphicCreator } from '@visactor/vrender-core';\nimport { AbstractComponent } from '../../core/base';\nimport type { Point } from '../../core/type';\nimport type { GridItem, CircleGridAttributes, GridBaseAttributes, GridAttributes, LineGridAttributes } from './type';\nimport type { AxisItem, TransformedAxisItem } from '../type';\nimport { AXIS_ELEMENT_NAME } from '../constant';\n\nfunction getLinePath(points: Point[], closed: boolean) {\n let path = '';\n if (points.length === 0) {\n return path;\n }\n points.forEach((point, index) => {\n if (index === 0) {\n path = `M${point.x},${point.y}`;\n } else {\n path += `L${point.x},${point.y}`;\n }\n });\n if (closed) {\n path += 'Z';\n }\n\n return path;\n}\n\nfunction getArcPath(center: Point, points: Point[], reverse: boolean, closed: boolean) {\n let path = '';\n if (!center || points.length === 0) {\n return path;\n }\n const firstPoint = points[0];\n const radius = PointService.distancePP(center, firstPoint);\n const sweepFlag = reverse ? 0 : 1; // 顺时针还是逆时针\n if (closed) {\n // 封闭时,绘制整个圆\n path += `M${center.x},${center.y - radius}A${radius},${radius},0,0,${sweepFlag},${center.x},${\n center.y + radius\n }A${radius},${radius},0,0,${sweepFlag},${center.x},${center.y - radius}Z`;\n } else {\n points.forEach((point, index) => {\n if (index === 0) {\n path = `M${point.x},${point.y}`;\n } else {\n path += `A${radius},${radius},0,0,${sweepFlag},${point.x},${point.y}`;\n }\n });\n }\n\n return path;\n}\n\nfunction getRegionPath(from: Point[], to: Point[], attribute: GridAttributes) {\n const { type, closed } = attribute;\n const reversePoints = to.slice(0).reverse();\n\n let regionPath = '';\n let nextPath = '';\n\n if (type === 'line' && (attribute as LineGridAttributes).smoothLink && (attribute as LineGridAttributes).center) {\n const fromStart = from[0];\n const toEnd = reversePoints[0];\n const center = (attribute as LineGridAttributes).center as Point;\n\n regionPath = getLinePath(from, !!closed);\n nextPath = getLinePath(reversePoints, !!closed);\n const toEndRadius = PointService.distancePP(toEnd, center);\n const fromStartRadius = PointService.distancePP(fromStart, center);\n regionPath += `A${toEndRadius},${toEndRadius},0,0,1,${toEnd.x},${toEnd.y}L${toEnd.x},${toEnd.y}`;\n nextPath += `A${fromStartRadius},${fromStartRadius},0,0,0,${fromStart.x},${fromStart.y}`;\n } else if (type === 'circle') {\n const { center } = attribute as CircleGridAttributes;\n regionPath = getArcPath(center, from, false, !!closed);\n nextPath = getArcPath(center, reversePoints, true, !!closed);\n } else if (type === 'line' || type === 'polygon') {\n regionPath = getLinePath(from, !!closed);\n nextPath = getLinePath(reversePoints, !!closed);\n }\n\n if (closed) {\n regionPath += nextPath;\n } else {\n nextPath = 'L' + nextPath.substring(1); // 更新第一个节点\n regionPath += nextPath;\n regionPath += 'Z';\n }\n return regionPath;\n}\n\nexport abstract class BaseGrid<T extends GridBaseAttributes> extends AbstractComponent<Required<T>> {\n name = 'axis-grid';\n\n static defaultAttributes: Partial<GridBaseAttributes> = {\n style: {\n lineWidth: 1,\n stroke: '#999',\n strokeOpacity: 1,\n lineDash: [4, 4]\n },\n subGrid: {\n visible: false,\n style: {\n lineWidth: 1,\n stroke: '#999',\n strokeOpacity: 1,\n lineDash: [4, 4]\n }\n }\n };\n\n protected _innerView: IGroup;\n getInnerView() {\n return this._innerView;\n }\n\n protected _prevInnerView: IGroup; // 缓存旧场景树,用于自定义动画\n /**\n * 获取更新前的旧场景树\n * @returns 返回更新前的旧场景树\n */\n getPrevInnerView() {\n return this._prevInnerView;\n }\n\n // 经过处理后的坐标轴点数据\n protected data: TransformedAxisItem[] = [];\n abstract getTickCoord(value: number): Point;\n abstract isInValidValue(value: number): boolean;\n abstract getVerticalVector(offset: number, inside: boolean, point: Point): [number, number];\n protected abstract getGridAttribute(isSubGrid: boolean): T;\n\n protected render(): void {\n this.removeAllChild(true);\n this._prevInnerView = this._innerView;\n this._innerView = graphicCreator.group({ x: 0, y: 0, pickable: false });\n this.add(this._innerView);\n\n const { items, visible } = this.attribute;\n if (items && items.length && visible !== false) {\n this.data = this._transformItems(items);\n this._renderGrid(this._innerView);\n }\n }\n\n protected getVerticalCoord(point: Point, offset: number, inside: boolean): Point {\n const vector = this.getVerticalVector(offset, inside, point);\n return {\n x: point.x + vector[0],\n y: point.y + vector[1]\n };\n }\n\n private _transformItems(items: AxisItem[]) {\n const data: TransformedAxisItem[] = [];\n items.forEach((item: AxisItem) => {\n data.push({\n ...item,\n point: this.getTickCoord(item.value),\n id: item.id ?? item.label\n });\n });\n return data;\n }\n private _renderGrid(container: any) {\n // 渲染 subGrid\n const { visible } = this.attribute.subGrid || {};\n if (visible) {\n this._renderGridByType(true, container);\n }\n\n // 渲染 Grid,Grid 需要在 subGrid 上层渲染\n this._renderGridByType(false, container);\n }\n\n private _renderGridByType(isSubGrid: boolean, container: IGroup) {\n const gridAttrs = merge({}, this.attribute, this.getGridAttribute(isSubGrid));\n\n const { type, items, style, closed, alternateColor, depth = 0 } = gridAttrs;\n const name = isSubGrid ? `${AXIS_ELEMENT_NAME.grid}-sub` : `${AXIS_ELEMENT_NAME.grid}`;\n\n // 绘制网格线\n items.forEach((item: GridItem, index: number) => {\n const { id, points } = item;\n let path = '';\n if (type === 'line' || type === 'polygon') {\n path = getLinePath(points, !!closed);\n } else if (type === 'circle') {\n const { center } = this.attribute as unknown as CircleGridAttributes;\n path = getArcPath(center, points, false, !!closed);\n }\n const shape = graphicCreator.path({\n path,\n z: depth,\n ...(isFunction(style)\n ? merge({}, this.skipDefault ? null : BaseGrid.defaultAttributes.style, style(item, index))\n : style)\n }) as Path;\n shape.name = `${name}-line`;\n shape.id = this._getNodeId(`${name}-path-${id}`);\n container.add(shape);\n });\n\n // 添加额外的3d线段\n if (depth && type === 'line') {\n items.forEach((item: GridItem, index: number) => {\n const { id, points } = item;\n // 重新计算points,使其长度为depth\n const nextPoints = [];\n nextPoints.push(points[0]);\n const dir = { x: points[1].x - points[0].x, y: points[1].y - points[0].y };\n const dirLen = Math.sqrt(dir.x * dir.x + dir.y * dir.y);\n const ratio = depth / dirLen;\n nextPoints.push({ x: points[0].x + dir.x * ratio, y: points[0].y + dir.y * ratio });\n const path = getLinePath(nextPoints, !!closed);\n const deltaX = abs(nextPoints[0].x - nextPoints[1].x);\n const deltaY = abs(nextPoints[0].y - nextPoints[1].y);\n const shape = graphicCreator.path({\n path,\n z: 0,\n alpha: deltaX > deltaY ? ((points[1].x - points[0].x > 0 ? -1 : 1) * pi) / 2 : 0,\n beta: deltaX < deltaY ? -pi / 2 : 0,\n anchor3d: deltaX > deltaY ? [nextPoints[0].x, 0] : [0, nextPoints[0].y],\n ...(isFunction(style)\n ? merge({}, this.skipDefault ? null : BaseGrid.defaultAttributes.style, style(item, index))\n : style)\n }) as Path;\n shape.name = `${name}-line`;\n shape.id = this._getNodeId(`${name}-path-${id}`);\n container.add(shape);\n });\n }\n\n // 绘制填充区域\n if (items.length > 1 && alternateColor) {\n const colors: string[] = isArray(alternateColor)\n ? (alternateColor as string[])\n : [alternateColor as string, 'transparent'];\n const getColor = (index: number) => colors[index % colors.length];\n\n // const regions: any[] = [];\n for (let index = 0; index < items.length - 1; index++) {\n const [prev, curr] = [items[index].points, items[index + 1].points];\n const path = getRegionPath(prev, curr, gridAttrs);\n const shape = graphicCreator.path({\n path,\n fill: getColor(index)\n }) as Path;\n shape.name = `${name}-region`;\n shape.id = this._getNodeId(`${name}-region-${index}`);\n container.add(shape);\n }\n }\n }\n\n /**\n * @override 覆写\n * @param id\n * @returns\n */\n protected _getNodeId(id: string) {\n return `${this.id}-${id}`;\n }\n}\n"]}
|
package/es/checkbox/checkbox.js
CHANGED
|
@@ -18,7 +18,8 @@ export class CheckBox extends AbstractComponent {
|
|
|
18
18
|
}, this.addEventListener("click", this.handleClick);
|
|
19
19
|
}
|
|
20
20
|
render() {
|
|
21
|
-
this.removeAllChild(), this.renderBox(), this.renderIcon(), this.renderText(),
|
|
21
|
+
this.removeAllChild(!0), this.renderBox(), this.renderIcon(), this.renderText(),
|
|
22
|
+
this.layout();
|
|
22
23
|
}
|
|
23
24
|
renderBox() {
|
|
24
25
|
this._box = new Rect(merge({}, this.attribute.box));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/checkbox/checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAE/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,QAAQ,GACZ,wrBAAwrB,CAAC;AAE3rB,MAAM,gBAAgB,GACpB,2MAA2M,CAAC;AAE9M,qBAAqB,EAAE,CAAC;AACxB,MAAM,OAAO,QAAS,SAAQ,iBAA+C;IA2C3E,YAAY,UAA8B,EAAE,OAA0B;QACpE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAA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KAAK;KAChB;CACF,CAAC","file":"checkbox.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { CheckboxAttributes } from './type';\nimport { Image, Rect, WrapText } from '@visactor/vrender-core';\nimport type { ComponentOptions } from '../interface';\nimport { loadCheckBoxComponent } from './register';\n\nconst checkSvg =\n '<svg width=\"200\" height=\"200\" viewBox=\"0 0 1024 1024\" fill=\"#fff\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M877.44815445 206.10060629a64.72691371 64.72691371 0 0 0-95.14856334 4.01306852L380.73381888 685.46812814 235.22771741 533.48933518a64.72691371 64.72691371 0 0 0-92.43003222-1.03563036l-45.82665557 45.82665443a64.72691371 64.72691371 0 0 0-0.90617629 90.61767965l239.61903446 250.10479331a64.72691371 64.72691371 0 0 0 71.19960405 15.14609778 64.33855261 64.33855261 0 0 0 35.08198741-21.23042702l36.24707186-42.71976334 40.5190474-40.77795556-3.36579926-3.49525333 411.40426297-486.74638962a64.72691371 64.72691371 0 0 0-3.88361443-87.64024149l-45.3088404-45.43829334z\"></path></svg>';\n\nconst indeterminateSvg =\n '<svg width=\"200\" height=\"200\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\"><path stroke=\"#fff\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"5\" d=\"M5 12h14\"/></svg>';\n\nloadCheckBoxComponent();\nexport class CheckBox extends AbstractComponent<Required<CheckboxAttributes>> {\n static defaultAttributes: Partial<CheckboxAttributes> = {\n interactive: true,\n disabled: false,\n checked: false,\n indeterminate: false,\n cursor: 'pointer',\n disableCursor: 'not-allowed',\n spaceBetweenTextAndIcon: 8,\n text: {\n text: 'text',\n fontSize: 14,\n fill: '#000',\n disableFill: 'rgb(201,205,212)',\n textBaseline: 'top',\n pickable: false\n },\n icon: {\n checkIconImage: checkSvg,\n indeterminateIconImage: indeterminateSvg,\n width: 10,\n height: 10,\n pickable: false\n },\n box: {\n width: 14,\n height: 14,\n cornerRadius: 2,\n fill: '#fff',\n stroke: 'rgb(229,230,235)',\n disableFill: 'rgb(242,243,245)',\n checkedFill: 'rgb(22, 93, 255)',\n checkedStroke: 'rgb(22, 93, 255)',\n disableCheckedFill: 'rgb(148, 191, 255)',\n disableCheckedStroke: 'rgb(148, 191, 255)',\n pickable: false\n }\n };\n _box: Rect;\n _checkIcon: Image;\n _indeterminateIcon: Image;\n _text: WrapText;\n\n constructor(attributes: CheckboxAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, CheckBox.defaultAttributes, attributes));\n this.renderGroup();\n\n this.onBeforeAttributeUpdate = (val: any, attributes: any, key: null | string | string[]) => {\n if ('interactive' in val) {\n this.setAttribute('pickable', val.interactive);\n }\n if ('disabled' in val) {\n this.setAttribute('cursor', val.disable ? this.attribute.disableCursor : this.attribute.cursor);\n }\n return undefined;\n };\n\n this.addEventListener('click', this.handleClick);\n }\n\n render() {\n this.removeAllChild();\n\n this.renderBox();\n this.renderIcon();\n this.renderText();\n this.layout();\n }\n\n renderBox() {\n this._box = new Rect(merge({}, this.attribute.box));\n const isCheckedOrIndeterminate = this.attribute.checked || this.attribute.indeterminate;\n if (isCheckedOrIndeterminate && this.attribute.disabled) {\n this._box.setAttributes({\n fill: this.attribute.box.disableCheckedFill,\n stroke: this.attribute.box.disableCheckedStroke\n });\n } else if (isCheckedOrIndeterminate) {\n this._box.setAttributes({\n fill: this.attribute.box.checkedFill,\n stroke: this.attribute.box.checkedStroke\n });\n }\n this.appendChild(this._box);\n }\n\n renderIcon() {\n this._checkIcon = new Image(merge({ image: this.attribute.icon.checkIconImage }, this.attribute.icon));\n this.appendChild(this._checkIcon);\n this._indeterminateIcon = new Image(\n merge(\n {\n image: this.attribute.icon.indeterminateIconImage\n },\n this.attribute.icon\n )\n );\n this.appendChild(this._indeterminateIcon);\n\n if (this.attribute.checked) {\n this._checkIcon.setAttribute('visible', true);\n this._indeterminateIcon.setAttribute('visible', false);\n } else if (this.attribute.indeterminate) {\n this._checkIcon.setAttribute('visible', false);\n this._indeterminateIcon.setAttribute('visible', true);\n } else {\n this._checkIcon.setAttribute('visible', false);\n this._indeterminateIcon.setAttribute('visible', false);\n }\n }\n\n renderText() {\n this._text = new WrapText(merge({}, this.attribute.text));\n if (this.attribute.disabled) {\n this._text.setAttribute('fill', this.attribute.text.disableFill);\n }\n this.appendChild(this._text);\n }\n\n renderGroup() {\n if (!this.attribute.interactive) {\n this.setAttribute('pickable', false);\n }\n if (this.attribute.disabled) {\n this.setAttribute('cursor', this.attribute.disableCursor);\n }\n }\n\n layout() {\n const boxHeight = this.attribute.box.height;\n const iconHeight = this.attribute.icon.height;\n const textHeight = this._text.AABBBounds.height();\n const maxHeight = Math.max(boxHeight, iconHeight, textHeight);\n const boxY = maxHeight / 2 - boxHeight / 2;\n const iconY = maxHeight / 2 - iconHeight / 2;\n const textY = maxHeight / 2 - textHeight / 2;\n\n const boxWidth = this.attribute.box.width;\n const iconWidth = this.attribute.icon.width;\n const maxWidth = Math.max(boxWidth, iconWidth);\n const boxX = maxWidth / 2 - boxWidth / 2;\n const iconX = maxWidth / 2 - iconWidth / 2;\n const textX = maxWidth + this.attribute.spaceBetweenTextAndIcon;\n\n this._box.setAttributes({\n x: boxX,\n y: boxY\n });\n this._checkIcon.setAttributes({\n x: iconX,\n y: iconY\n });\n this._indeterminateIcon.setAttributes({\n x: iconX,\n y: iconY\n });\n this._text.setAttributes({\n x: textX,\n y: textY\n });\n }\n\n handleClick() {\n if (this.attribute.disabled) {\n return;\n } else if (this.attribute.checked) {\n this.setAttribute('checked', false);\n this.setAttribute('indeterminate', false);\n } else {\n this.setAttribute('checked', true);\n this.setAttribute('indeterminate', false);\n }\n\n this._dispatchEvent('checkbox_state_change', {\n eventType: 'checkbox_state_change',\n checked: this.attribute.checked\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/checkbox/checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EA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YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,KAAK;KAChB;IACD,IAAI,EAAE;QACJ,cAAc,EAAE,QAAQ;QACxB,sBAAsB,EAAE,gBAAgB;QACxC,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE,KAAK;KAChB;IACD,GAAG,EAAE;QACH,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,CAAC;QACf,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,kBAAkB;QAC1B,WAAW,EAAE,kBAAkB;QAC/B,WAAW,EAAE,kBAAkB;QAC/B,aAAa,EAAE,kBAAkB;QACjC,kBAAkB,EAAE,oBAAoB;QACxC,oBAAoB,EAAE,oBAAoB;QAC1C,QAAQ,EAAE,KAAK;KAChB;CACF,CAAC","file":"checkbox.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { CheckboxAttributes } from './type';\nimport { Image, Rect, WrapText } from '@visactor/vrender-core';\nimport type { ComponentOptions } from '../interface';\nimport { loadCheckBoxComponent } from './register';\n\nconst checkSvg =\n '<svg width=\"200\" height=\"200\" viewBox=\"0 0 1024 1024\" fill=\"#fff\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M877.44815445 206.10060629a64.72691371 64.72691371 0 0 0-95.14856334 4.01306852L380.73381888 685.46812814 235.22771741 533.48933518a64.72691371 64.72691371 0 0 0-92.43003222-1.03563036l-45.82665557 45.82665443a64.72691371 64.72691371 0 0 0-0.90617629 90.61767965l239.61903446 250.10479331a64.72691371 64.72691371 0 0 0 71.19960405 15.14609778 64.33855261 64.33855261 0 0 0 35.08198741-21.23042702l36.24707186-42.71976334 40.5190474-40.77795556-3.36579926-3.49525333 411.40426297-486.74638962a64.72691371 64.72691371 0 0 0-3.88361443-87.64024149l-45.3088404-45.43829334z\"></path></svg>';\n\nconst indeterminateSvg =\n '<svg width=\"200\" height=\"200\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\"><path stroke=\"#fff\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"5\" d=\"M5 12h14\"/></svg>';\n\nloadCheckBoxComponent();\nexport class CheckBox extends AbstractComponent<Required<CheckboxAttributes>> {\n static defaultAttributes: Partial<CheckboxAttributes> = {\n interactive: true,\n disabled: false,\n checked: false,\n indeterminate: false,\n cursor: 'pointer',\n disableCursor: 'not-allowed',\n spaceBetweenTextAndIcon: 8,\n text: {\n text: 'text',\n fontSize: 14,\n fill: '#000',\n disableFill: 'rgb(201,205,212)',\n textBaseline: 'top',\n pickable: false\n },\n icon: {\n checkIconImage: checkSvg,\n indeterminateIconImage: indeterminateSvg,\n width: 10,\n height: 10,\n pickable: false\n },\n box: {\n width: 14,\n height: 14,\n cornerRadius: 2,\n fill: '#fff',\n stroke: 'rgb(229,230,235)',\n disableFill: 'rgb(242,243,245)',\n checkedFill: 'rgb(22, 93, 255)',\n checkedStroke: 'rgb(22, 93, 255)',\n disableCheckedFill: 'rgb(148, 191, 255)',\n disableCheckedStroke: 'rgb(148, 191, 255)',\n pickable: false\n }\n };\n _box: Rect;\n _checkIcon: Image;\n _indeterminateIcon: Image;\n _text: WrapText;\n\n constructor(attributes: CheckboxAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, CheckBox.defaultAttributes, attributes));\n this.renderGroup();\n\n this.onBeforeAttributeUpdate = (val: any, attributes: any, key: null | string | string[]) => {\n if ('interactive' in val) {\n this.setAttribute('pickable', val.interactive);\n }\n if ('disabled' in val) {\n this.setAttribute('cursor', val.disable ? this.attribute.disableCursor : this.attribute.cursor);\n }\n return undefined;\n };\n\n this.addEventListener('click', this.handleClick);\n }\n\n render() {\n this.removeAllChild(true);\n\n this.renderBox();\n this.renderIcon();\n this.renderText();\n this.layout();\n }\n\n renderBox() {\n this._box = new Rect(merge({}, this.attribute.box));\n const isCheckedOrIndeterminate = this.attribute.checked || this.attribute.indeterminate;\n if (isCheckedOrIndeterminate && this.attribute.disabled) {\n this._box.setAttributes({\n fill: this.attribute.box.disableCheckedFill,\n stroke: this.attribute.box.disableCheckedStroke\n });\n } else if (isCheckedOrIndeterminate) {\n this._box.setAttributes({\n fill: this.attribute.box.checkedFill,\n stroke: this.attribute.box.checkedStroke\n });\n }\n this.appendChild(this._box);\n }\n\n renderIcon() {\n this._checkIcon = new Image(merge({ image: this.attribute.icon.checkIconImage }, this.attribute.icon));\n this.appendChild(this._checkIcon);\n this._indeterminateIcon = new Image(\n merge(\n {\n image: this.attribute.icon.indeterminateIconImage\n },\n this.attribute.icon\n )\n );\n this.appendChild(this._indeterminateIcon);\n\n if (this.attribute.checked) {\n this._checkIcon.setAttribute('visible', true);\n this._indeterminateIcon.setAttribute('visible', false);\n } else if (this.attribute.indeterminate) {\n this._checkIcon.setAttribute('visible', false);\n this._indeterminateIcon.setAttribute('visible', true);\n } else {\n this._checkIcon.setAttribute('visible', false);\n this._indeterminateIcon.setAttribute('visible', false);\n }\n }\n\n renderText() {\n this._text = new WrapText(merge({}, this.attribute.text));\n if (this.attribute.disabled) {\n this._text.setAttribute('fill', this.attribute.text.disableFill);\n }\n this.appendChild(this._text);\n }\n\n renderGroup() {\n if (!this.attribute.interactive) {\n this.setAttribute('pickable', false);\n }\n if (this.attribute.disabled) {\n this.setAttribute('cursor', this.attribute.disableCursor);\n }\n }\n\n layout() {\n const boxHeight = this.attribute.box.height;\n const iconHeight = this.attribute.icon.height;\n const textHeight = this._text.AABBBounds.height();\n const maxHeight = Math.max(boxHeight, iconHeight, textHeight);\n const boxY = maxHeight / 2 - boxHeight / 2;\n const iconY = maxHeight / 2 - iconHeight / 2;\n const textY = maxHeight / 2 - textHeight / 2;\n\n const boxWidth = this.attribute.box.width;\n const iconWidth = this.attribute.icon.width;\n const maxWidth = Math.max(boxWidth, iconWidth);\n const boxX = maxWidth / 2 - boxWidth / 2;\n const iconX = maxWidth / 2 - iconWidth / 2;\n const textX = maxWidth + this.attribute.spaceBetweenTextAndIcon;\n\n this._box.setAttributes({\n x: boxX,\n y: boxY\n });\n this._checkIcon.setAttributes({\n x: iconX,\n y: iconY\n });\n this._indeterminateIcon.setAttributes({\n x: iconX,\n y: iconY\n });\n this._text.setAttributes({\n x: textX,\n y: textY\n });\n }\n\n handleClick() {\n if (this.attribute.disabled) {\n return;\n } else if (this.attribute.checked) {\n this.setAttribute('checked', false);\n this.setAttribute('indeterminate', false);\n } else {\n this.setAttribute('checked', true);\n this.setAttribute('indeterminate', false);\n }\n\n this._dispatchEvent('checkbox_state_change', {\n eventType: 'checkbox_state_change',\n checked: this.attribute.checked\n });\n }\n}\n"]}
|
package/es/core/type.d.ts
CHANGED
|
@@ -28,16 +28,18 @@ export type Padding = number | number[] | {
|
|
|
28
28
|
right?: number;
|
|
29
29
|
};
|
|
30
30
|
type CommonTextContent = {
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
text?: string | string[] | number | number[] | {
|
|
32
|
+
type?: 'text';
|
|
33
|
+
text: string | string[] | number | number[];
|
|
34
|
+
};
|
|
33
35
|
};
|
|
34
36
|
type RichTextContent = {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
text?: {
|
|
38
|
+
type: 'rich';
|
|
39
|
+
text: IRichTextCharacter[];
|
|
40
|
+
};
|
|
37
41
|
};
|
|
38
|
-
type
|
|
39
|
-
type?: '
|
|
40
|
-
text?: string | HTMLElement;
|
|
42
|
+
export type TextContent = (CommonTextContent | RichTextContent) & {
|
|
43
|
+
type?: 'text' | 'rich';
|
|
41
44
|
};
|
|
42
|
-
export type TextContent = CommonTextContent | RichTextContent | HtmlTextContent;
|
|
43
45
|
export {};
|
package/es/core/type.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type { IRichTextCharacter } from '@visactor/vrender-core';\n\nexport type Point = {\n x: number;\n y: number;\n};\n\nexport interface LocationCfg {\n [key: string]: any;\n}\n\nexport interface PointLocationCfg extends LocationCfg {\n /**\n * 位置 x\n * @type {number}\n */\n x: number;\n /**\n * 位置 y\n * @type {number}\n */\n y: number;\n}\n\nexport interface RegionLocationCfg extends LocationCfg {\n /**\n * 起始点\n */\n start: Point;\n /**\n * 结束点\n */\n end: Point;\n}\n\nexport type State<T> = {\n [key: string]: T;\n};\n\nexport type BaseGraphicAttributes<T> = {\n /**\n * 基础样式设置\n */\n style?: T;\n /**\n * 状态样式设置\n */\n state?: State<T>;\n};\n\nexport type Padding =\n | number\n | number[]\n | {\n top?: number;\n bottom?: number;\n left?: number;\n right?: number;\n };\n\ntype CommonTextContent = {\n type?: 'text';\n
|
|
1
|
+
{"version":3,"sources":["../src/core/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type { IRichTextCharacter } from '@visactor/vrender-core';\n\nexport type Point = {\n x: number;\n y: number;\n};\n\nexport interface LocationCfg {\n [key: string]: any;\n}\n\nexport interface PointLocationCfg extends LocationCfg {\n /**\n * 位置 x\n * @type {number}\n */\n x: number;\n /**\n * 位置 y\n * @type {number}\n */\n y: number;\n}\n\nexport interface RegionLocationCfg extends LocationCfg {\n /**\n * 起始点\n */\n start: Point;\n /**\n * 结束点\n */\n end: Point;\n}\n\nexport type State<T> = {\n [key: string]: T;\n};\n\nexport type BaseGraphicAttributes<T> = {\n /**\n * 基础样式设置\n */\n style?: T;\n /**\n * 状态样式设置\n */\n state?: State<T>;\n};\n\nexport type Padding =\n | number\n | number[]\n | {\n top?: number;\n bottom?: number;\n left?: number;\n right?: number;\n };\n\ntype CommonTextContent = {\n text?:\n | string\n | string[]\n | number\n | number[]\n | {\n type?: 'text';\n text: string | string[] | number | number[];\n };\n};\n\ntype RichTextContent = {\n text?: {\n type: 'rich';\n text: IRichTextCharacter[];\n };\n};\n\nexport type TextContent = (CommonTextContent | RichTextContent) & {\n /** @deprecated */\n type?: 'text' | 'rich';\n};\n"]}
|
|
@@ -165,6 +165,7 @@ export declare class DataZoom extends AbstractComponent<Required<DataZoomAttribu
|
|
|
165
165
|
y: number;
|
|
166
166
|
};
|
|
167
167
|
private _onHandlerPointerDown;
|
|
168
|
+
private _pointerMove;
|
|
168
169
|
private _onHandlerPointerMove;
|
|
169
170
|
private _onHandlerPointerUp;
|
|
170
171
|
private _onHandlerPointerEnter;
|
|
@@ -67,11 +67,10 @@ export class DataZoom extends AbstractComponent {
|
|
|
67
67
|
this._activeItem = this._background), this._activeState = !0, this._activeCache.startPos = this.eventPosToStagePos(e),
|
|
68
68
|
this._activeCache.lastPos = this.eventPosToStagePos(e), "browser" === vglobal.env && (vglobal.addEventListener("pointermove", this._onHandlerPointerMove, {
|
|
69
69
|
capture: !0
|
|
70
|
-
}), vglobal.addEventListener("pointerup", this._onHandlerPointerUp.
|
|
71
|
-
this.addEventListener("pointermove", this._onHandlerPointerMove, {
|
|
70
|
+
}), vglobal.addEventListener("pointerup", this._onHandlerPointerUp)), this.addEventListener("pointermove", this._onHandlerPointerMove, {
|
|
72
71
|
capture: !0
|
|
73
72
|
});
|
|
74
|
-
}, this.
|
|
73
|
+
}, this._pointerMove = e => {
|
|
75
74
|
e.stopPropagation();
|
|
76
75
|
const {start: startAttr, end: endAttr, brushSelect: brushSelect, realTime: realTime = !0} = this.attribute, pos = this.eventPosToStagePos(e), {attPos: attPos, max: max} = this._layoutCache, dis = (pos[attPos] - this._activeCache.lastPos[attPos]) / max;
|
|
77
76
|
let {start: start, end: end} = this.state;
|
|
@@ -79,13 +78,31 @@ export class DataZoom extends AbstractComponent {
|
|
|
79
78
|
end = start + dis, this._activeTag = DataZoomActiveTag.endHandler) : start += dis : this._activeTag === DataZoomActiveTag.endHandler && (end + dis < start ? (end = start,
|
|
80
79
|
start = end + dis, this._activeTag = DataZoomActiveTag.startHandler) : end += dis),
|
|
81
80
|
this._activeCache.lastPos = pos, brushSelect && this.renderDragMask()), start = Math.min(Math.max(start, 0), 1),
|
|
82
|
-
end = Math.min(Math.max(end, 0), 1), startAttr === start && endAttr === end || (this.setStateAttr(start, end, !0),
|
|
81
|
+
end = Math.min(Math.max(end, 0), 1), !realTime || startAttr === start && endAttr === end || (this.setStateAttr(start, end, !0),
|
|
83
82
|
this._dispatchEvent("change", {
|
|
84
83
|
start: start,
|
|
85
84
|
end: end,
|
|
86
85
|
tag: this._activeTag
|
|
87
86
|
}));
|
|
88
|
-
}
|
|
87
|
+
}, this._onHandlerPointerMove = 0 === this.attribute.delayTime ? this._pointerMove : delayMap[this.attribute.delayType](this._pointerMove, this.attribute.delayTime),
|
|
88
|
+
this._onHandlerPointerUp = e => {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
const {start: start, end: end, brushSelect: brushSelect, realTime: realTime = !0} = this.attribute;
|
|
91
|
+
if (this._activeState && this._activeTag === DataZoomActiveTag.background) {
|
|
92
|
+
const pos = this.eventPosToStagePos(e);
|
|
93
|
+
this.backgroundDragZoom(this._activeCache.startPos, pos);
|
|
94
|
+
}
|
|
95
|
+
this._activeState = !1, brushSelect && this.renderDragMask(), realTime && start === this.state.start && end === this.state.end || (this.setStateAttr(this.state.start, this.state.end, !0),
|
|
96
|
+
this._dispatchEvent("change", {
|
|
97
|
+
start: this.state.start,
|
|
98
|
+
end: this.state.end,
|
|
99
|
+
tag: this._activeTag
|
|
100
|
+
})), "browser" === vglobal.env && (vglobal.removeEventListener("pointermove", this._onHandlerPointerMove, {
|
|
101
|
+
capture: !0
|
|
102
|
+
}), vglobal.removeEventListener("pointerup", this._onHandlerPointerUp)), this.removeEventListener("pointermove", this._onHandlerPointerMove, {
|
|
103
|
+
capture: !0
|
|
104
|
+
}), this.removeEventListener("pointerup", this._onHandlerPointerUp);
|
|
105
|
+
};
|
|
89
106
|
const {position: position, showDetail: showDetail} = attributes;
|
|
90
107
|
this._activeCache.startPos = position, this._activeCache.lastPos = position, this._showText = "auto" !== showDetail && showDetail,
|
|
91
108
|
this.setPropsFromAttrs();
|
|
@@ -129,25 +146,6 @@ export class DataZoom extends AbstractComponent {
|
|
|
129
146
|
y: y - ((null === (_b = this.stage) || void 0 === _b ? void 0 : _b.y) || 0)
|
|
130
147
|
};
|
|
131
148
|
}
|
|
132
|
-
_onHandlerPointerUp(e) {
|
|
133
|
-
e.preventDefault();
|
|
134
|
-
const {start: start, end: end, brushSelect: brushSelect, realTime: realTime = !0} = this.attribute;
|
|
135
|
-
if (this._activeState && this._activeTag === DataZoomActiveTag.background) {
|
|
136
|
-
const pos = this.eventPosToStagePos(e);
|
|
137
|
-
this.backgroundDragZoom(this._activeCache.startPos, pos);
|
|
138
|
-
}
|
|
139
|
-
this._activeState = !1, brushSelect && this.renderDragMask(), realTime && start === this.state.start && end === this.state.end || (this.setStateAttr(this.state.start, this.state.end, !0),
|
|
140
|
-
this._dispatchEvent("change", {
|
|
141
|
-
start: this.state.start,
|
|
142
|
-
end: this.state.end,
|
|
143
|
-
tag: this._activeTag
|
|
144
|
-
})), "browser" === vglobal.env && (vglobal.removeEventListener("pointermove", this._onHandlerPointerMove, {
|
|
145
|
-
capture: !0
|
|
146
|
-
}), vglobal.removeEventListener("pointerup", this._onHandlerPointerUp.bind(this))),
|
|
147
|
-
this.removeEventListener("pointermove", this._onHandlerPointerMove, {
|
|
148
|
-
capture: !0
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
149
|
_onHandlerPointerEnter(e) {
|
|
152
150
|
e.stopPropagation(), this._showText = !0, this.renderText();
|
|
153
151
|
}
|
|
@@ -279,7 +277,7 @@ export class DataZoom extends AbstractComponent {
|
|
|
279
277
|
}, this._layoutAttrFromConfig;
|
|
280
278
|
}
|
|
281
279
|
render() {
|
|
282
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
280
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9;
|
|
283
281
|
this._layoutAttrFromConfig = null;
|
|
284
282
|
const {orient: orient, backgroundStyle: backgroundStyle, backgroundChartStyle: backgroundChartStyle = {}, selectedBackgroundStyle: selectedBackgroundStyle = {}, selectedBackgroundChartStyle: selectedBackgroundChartStyle = {}, middleHandlerStyle: middleHandlerStyle = {}, startHandlerStyle: startHandlerStyle = {}, endHandlerStyle: endHandlerStyle = {}, brushSelect: brushSelect, zoomLock: zoomLock} = this.attribute, {start: start, end: end} = this.state, {position: position, width: width, height: height} = this.getLayoutAttrFromConfig(), startHandlerMinSize = null !== (_a = startHandlerStyle.triggerMinSize) && void 0 !== _a ? _a : 40, endHandlerMinSize = null !== (_b = endHandlerStyle.triggerMinSize) && void 0 !== _b ? _b : 40, group = this.createOrUpdateChild("dataZoom-container", {}, "group");
|
|
285
283
|
if (this._container = group, this._background = group.createOrUpdateChild("background", Object.assign(Object.assign({
|
|
@@ -289,9 +287,9 @@ export class DataZoom extends AbstractComponent {
|
|
|
289
287
|
height: height,
|
|
290
288
|
cursor: brushSelect ? "crosshair" : "auto"
|
|
291
289
|
}, backgroundStyle), {
|
|
292
|
-
pickable: !zoomLock
|
|
293
|
-
}), "rect"), (null === (
|
|
294
|
-
(null === (
|
|
290
|
+
pickable: !zoomLock && (null === (_c = backgroundStyle.pickable) || void 0 === _c || _c)
|
|
291
|
+
}), "rect"), (null === (_d = backgroundChartStyle.line) || void 0 === _d ? void 0 : _d.visible) && this.setPreviewAttributes("line", group),
|
|
292
|
+
(null === (_e = backgroundChartStyle.area) || void 0 === _e ? void 0 : _e.visible) && this.setPreviewAttributes("area", group),
|
|
295
293
|
brushSelect && this.renderDragMask(), this._isHorizontal ? this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign(Object.assign({
|
|
296
294
|
x: position.x + start * width,
|
|
297
295
|
y: position.y,
|
|
@@ -299,7 +297,7 @@ export class DataZoom extends AbstractComponent {
|
|
|
299
297
|
height: height,
|
|
300
298
|
cursor: brushSelect ? "crosshair" : "move"
|
|
301
299
|
}, selectedBackgroundStyle), {
|
|
302
|
-
pickable: !zoomLock
|
|
300
|
+
pickable: !zoomLock && (null === (_f = selectedBackgroundChartStyle.pickable) || void 0 === _f || _f)
|
|
303
301
|
}), "rect") : this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign(Object.assign({
|
|
304
302
|
x: position.x,
|
|
305
303
|
y: position.y + start * height,
|
|
@@ -307,43 +305,43 @@ export class DataZoom extends AbstractComponent {
|
|
|
307
305
|
height: (end - start) * height,
|
|
308
306
|
cursor: brushSelect ? "crosshair" : "move"
|
|
309
307
|
}, selectedBackgroundStyle), {
|
|
310
|
-
pickable: !zoomLock
|
|
311
|
-
}), "rect"), (null === (
|
|
312
|
-
(null === (
|
|
308
|
+
pickable: !zoomLock && (null === (_g = selectedBackgroundStyle.pickable) || void 0 === _g || _g)
|
|
309
|
+
}), "rect"), (null === (_h = selectedBackgroundChartStyle.line) || void 0 === _h ? void 0 : _h.visible) && this.setSelectedPreviewAttributes("line", group),
|
|
310
|
+
(null === (_j = selectedBackgroundChartStyle.area) || void 0 === _j ? void 0 : _j.visible) && this.setSelectedPreviewAttributes("area", group),
|
|
313
311
|
this._isHorizontal) {
|
|
314
312
|
if (middleHandlerStyle.visible) {
|
|
315
|
-
const middleHandlerBackgroundSize = (null === (
|
|
313
|
+
const middleHandlerBackgroundSize = (null === (_k = middleHandlerStyle.background) || void 0 === _k ? void 0 : _k.size) || 10;
|
|
316
314
|
this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign(Object.assign({
|
|
317
315
|
x: position.x + start * width,
|
|
318
316
|
y: position.y - middleHandlerBackgroundSize,
|
|
319
317
|
width: (end - start) * width,
|
|
320
318
|
height: middleHandlerBackgroundSize
|
|
321
|
-
}, null === (
|
|
322
|
-
pickable: !zoomLock
|
|
319
|
+
}, null === (_l = middleHandlerStyle.background) || void 0 === _l ? void 0 : _l.style), {
|
|
320
|
+
pickable: !zoomLock && (null === (_p = null === (_o = null === (_m = middleHandlerStyle.background) || void 0 === _m ? void 0 : _m.style) || void 0 === _o ? void 0 : _o.pickable) || void 0 === _p || _p)
|
|
323
321
|
}), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
|
|
324
322
|
x: position.x + (start + end) / 2 * width,
|
|
325
323
|
y: position.y - middleHandlerBackgroundSize / 2,
|
|
326
324
|
strokeBoundsBuffer: 0,
|
|
327
325
|
angle: 0,
|
|
328
|
-
symbolType: null !== (
|
|
326
|
+
symbolType: null !== (_r = null === (_q = middleHandlerStyle.icon) || void 0 === _q ? void 0 : _q.symbolType) && void 0 !== _r ? _r : "square"
|
|
329
327
|
}, middleHandlerStyle.icon), {
|
|
330
|
-
pickable: !zoomLock
|
|
328
|
+
pickable: !zoomLock && (null === (_s = middleHandlerStyle.icon.pickable) || void 0 === _s || _s)
|
|
331
329
|
}), "symbol");
|
|
332
330
|
}
|
|
333
331
|
this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign({
|
|
334
332
|
x: position.x + start * width,
|
|
335
333
|
y: position.y + height / 2,
|
|
336
334
|
size: height,
|
|
337
|
-
symbolType: null !== (
|
|
335
|
+
symbolType: null !== (_t = startHandlerStyle.symbolType) && void 0 !== _t ? _t : "square"
|
|
338
336
|
}, DEFAULT_HANDLER_ATTR_MAP.horizontal), startHandlerStyle), {
|
|
339
|
-
pickable: !zoomLock
|
|
337
|
+
pickable: !zoomLock && (null === (_u = startHandlerStyle.pickable) || void 0 === _u || _u)
|
|
340
338
|
}), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
|
|
341
339
|
x: position.x + end * width,
|
|
342
340
|
y: position.y + height / 2,
|
|
343
341
|
size: height,
|
|
344
|
-
symbolType: null !== (
|
|
342
|
+
symbolType: null !== (_v = endHandlerStyle.symbolType) && void 0 !== _v ? _v : "square"
|
|
345
343
|
}, DEFAULT_HANDLER_ATTR_MAP.horizontal), endHandlerStyle), {
|
|
346
|
-
pickable: !zoomLock
|
|
344
|
+
pickable: !zoomLock && (null === (_w = endHandlerStyle.pickable) || void 0 === _w || _w)
|
|
347
345
|
}), "symbol");
|
|
348
346
|
const startHandlerWidth = Math.max(this._startHandler.AABBBounds.width(), startHandlerMinSize), startHandlerHeight = Math.max(this._startHandler.AABBBounds.height(), startHandlerMinSize), endHandlerWidth = Math.max(this._endHandler.AABBBounds.width(), endHandlerMinSize), endHandlerHeight = Math.max(this._endHandler.AABBBounds.height(), endHandlerMinSize);
|
|
349
347
|
this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign(Object.assign({
|
|
@@ -369,38 +367,38 @@ export class DataZoom extends AbstractComponent {
|
|
|
369
367
|
}), "rect");
|
|
370
368
|
} else {
|
|
371
369
|
if (middleHandlerStyle.visible) {
|
|
372
|
-
const middleHandlerBackgroundSize = (null === (
|
|
370
|
+
const middleHandlerBackgroundSize = (null === (_x = middleHandlerStyle.background) || void 0 === _x ? void 0 : _x.size) || 10;
|
|
373
371
|
this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign(Object.assign({
|
|
374
372
|
x: "left" === orient ? position.x - middleHandlerBackgroundSize : position.x + width,
|
|
375
373
|
y: position.y + start * height,
|
|
376
374
|
width: middleHandlerBackgroundSize,
|
|
377
375
|
height: (end - start) * height
|
|
378
|
-
}, null === (
|
|
379
|
-
pickable: !zoomLock
|
|
376
|
+
}, null === (_y = middleHandlerStyle.background) || void 0 === _y ? void 0 : _y.style), {
|
|
377
|
+
pickable: !zoomLock && (null === (_1 = null === (_0 = null === (_z = middleHandlerStyle.background) || void 0 === _z ? void 0 : _z.style) || void 0 === _0 ? void 0 : _0.pickable) || void 0 === _1 || _1)
|
|
380
378
|
}), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
|
|
381
379
|
x: "left" === orient ? position.x - middleHandlerBackgroundSize / 2 : position.x + width + middleHandlerBackgroundSize / 2,
|
|
382
380
|
y: position.y + (start + end) / 2 * height,
|
|
383
381
|
angle: Math.PI / 180 * 90,
|
|
384
|
-
symbolType: null !== (
|
|
382
|
+
symbolType: null !== (_3 = null === (_2 = middleHandlerStyle.icon) || void 0 === _2 ? void 0 : _2.symbolType) && void 0 !== _3 ? _3 : "square",
|
|
385
383
|
strokeBoundsBuffer: 0
|
|
386
384
|
}, middleHandlerStyle.icon), {
|
|
387
|
-
pickable: !zoomLock
|
|
385
|
+
pickable: !zoomLock && (null === (_5 = null === (_4 = middleHandlerStyle.icon) || void 0 === _4 ? void 0 : _4.pickable) || void 0 === _5 || _5)
|
|
388
386
|
}), "symbol");
|
|
389
387
|
}
|
|
390
388
|
this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign({
|
|
391
389
|
x: position.x + width / 2,
|
|
392
390
|
y: position.y + start * height,
|
|
393
391
|
size: width,
|
|
394
|
-
symbolType: null !== (
|
|
392
|
+
symbolType: null !== (_6 = startHandlerStyle.symbolType) && void 0 !== _6 ? _6 : "square"
|
|
395
393
|
}, DEFAULT_HANDLER_ATTR_MAP.vertical), startHandlerStyle), {
|
|
396
|
-
pickable: !zoomLock
|
|
394
|
+
pickable: !zoomLock && (null === (_7 = startHandlerStyle.pickable) || void 0 === _7 || _7)
|
|
397
395
|
}), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
|
|
398
396
|
x: position.x + width / 2,
|
|
399
397
|
y: position.y + end * height,
|
|
400
398
|
size: width,
|
|
401
|
-
symbolType: null !== (
|
|
399
|
+
symbolType: null !== (_8 = endHandlerStyle.symbolType) && void 0 !== _8 ? _8 : "square"
|
|
402
400
|
}, DEFAULT_HANDLER_ATTR_MAP.vertical), endHandlerStyle), {
|
|
403
|
-
pickable: !zoomLock
|
|
401
|
+
pickable: !zoomLock && (null === (_9 = endHandlerStyle.pickable) || void 0 === _9 || _9)
|
|
404
402
|
}), "symbol");
|
|
405
403
|
const startHandlerWidth = Math.max(this._startHandler.AABBBounds.width(), startHandlerMinSize), startHandlerHeight = Math.max(this._startHandler.AABBBounds.height(), startHandlerMinSize), endHandlerWidth = Math.max(this._endHandler.AABBBounds.width(), endHandlerMinSize), endHandlerHeight = Math.max(this._endHandler.AABBBounds.height(), endHandlerMinSize);
|
|
406
404
|
this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign(Object.assign({
|