UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

95 lines (94 loc) 3.21 kB
/** * DevExtreme (esm/renovation/viz/common/renderers/svg_path.js) * Version: 21.1.4 * Build date: Mon Jun 21 2021 * * Copyright (c) 2012 - 2021 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; import _extends from "@babel/runtime/helpers/esm/extends"; var _excluded = ["className", "d", "dashStyle", "fill", "opacity", "pointerEvents", "points", "rotate", "rotateX", "rotateY", "scaleX", "scaleY", "sharp", "sharpDirection", "stroke", "strokeLineCap", "strokeOpacity", "strokeWidth", "translateX", "translateY", "type"]; import { createVNode, normalizeProps } from "inferno"; import { BaseInfernoComponent } from "@devextreme/vdom"; import SvgGraphicsProps from "./base_graphics_props"; import { combinePathParam, buildPathSegments, getGraphicExtraProps } from "./utils"; export var viewFunction = _ref => { var { computedProps: computedProps, d: d, pathRef: pathRef } = _ref; var { className: className, fill: fill, opacity: opacity, pointerEvents: pointerEvents, stroke: stroke, strokeLineCap: strokeLineCap, strokeOpacity: strokeOpacity, strokeWidth: strokeWidth } = computedProps; return normalizeProps(createVNode(32, "path", className, null, 1, _extends({ d: d, fill: fill, stroke: stroke, "stroke-width": strokeWidth, "stroke-opacity": strokeOpacity, "stroke-linecap": strokeLineCap, opacity: opacity, "pointer-events": pointerEvents }, getGraphicExtraProps(computedProps)), null, pathRef)) }; export var PathSvgElementProps = _extends({}, SvgGraphicsProps, { type: "line", d: "" }); import { createRef as infernoCreateRef } from "inferno"; export class PathSvgElement extends BaseInfernoComponent { constructor(props) { super(props); this.state = {}; this.pathRef = infernoCreateRef() } get d() { var _this$props$points; var path = this.props.d; var segments = []; if (null !== (_this$props$points = this.props.points) && void 0 !== _this$props$points && _this$props$points.length) { segments = buildPathSegments(this.props.points, this.props.type); segments && (path = combinePathParam(segments)) } return path } get computedProps() { return this.props } get restAttributes() { var _this$props = this.props, restProps = _objectWithoutPropertiesLoose(_this$props, _excluded); return restProps } render() { var props = this.props; return viewFunction({ props: _extends({}, props), pathRef: this.pathRef, d: this.d, computedProps: this.computedProps, restAttributes: this.restAttributes }) } } PathSvgElement.defaultProps = _extends({}, PathSvgElementProps);