@antv/f2
Version:
Charts for mobile visualization.
45 lines • 1.42 kB
JavaScript
import { __assign, __extends } from "tslib";
import { jsx } from '@antv/f-engine';
import withZoom from '../zoom';
export default (function (View) {
return /** @class */function (_super) {
__extends(ScrollBar, _super);
function ScrollBar() {
return _super !== null && _super.apply(this, arguments) || this;
}
ScrollBar.prototype.willMount = function () {
_super.prototype.willMount.call(this);
var _a = this,
context = _a.context,
props = _a.props;
var visible = props.visible,
_b = props.position,
position = _b === void 0 ? 'bottom' : _b,
_c = props.margin,
margin = _c === void 0 ? '16px' : _c,
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
});
};
ScrollBar.prototype.render = function () {
var _a = this,
props = _a.props,
state = _a.state;
var visible = props.visible;
if (visible === false) {
return null;
}
return jsx(View, __assign({
position: "bottom"
}, props, state));
};
return ScrollBar;
}(withZoom(View));
});