@antv/f2
Version:
Charts for mobile visualization.
56 lines • 2.09 kB
JavaScript
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _get from "@babel/runtime/helpers/esm/get";
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import { jsx } from '../../jsx';
import Zoom from '../zoom';
export default (function (View) {
return /*#__PURE__*/function (_Zoom) {
_inherits(ScrollBar, _Zoom);
var _super = _createSuper(ScrollBar);
function ScrollBar() {
_classCallCheck(this, ScrollBar);
return _super.apply(this, arguments);
}
_createClass(ScrollBar, [{
key: "willMount",
value: function willMount() {
_get(_getPrototypeOf(ScrollBar.prototype), "willMount", this).call(this);
var context = this.context,
props = this.props;
var visible = props.visible,
_props$position = props.position,
position = _props$position === void 0 ? 'bottom' : _props$position,
_props$margin = props.margin,
margin = _props$margin === void 0 ? '16px' : _props$margin,
chart = props.chart;
var marginNumber = context.px2hd(margin);
if (visible === false) {
return null;
}
chart.updateCoordFor(this, {
position: position,
width: position === 'left' || position === 'right' ? marginNumber : 0,
height: position === 'bottom' || position === 'top' ? marginNumber : 0
});
}
}, {
key: "render",
value: function render() {
var props = this.props,
state = this.state;
var visible = props.visible;
if (visible === false) {
return null;
}
return jsx(View, _objectSpread(_objectSpread({
position: "bottom"
}, props), state));
}
}]);
return ScrollBar;
}(Zoom);
});