UNPKG

1.42 kBJavaScriptView Raw
1import { __assign, __extends } from "tslib";
2import { jsx } from '@antv/f-engine';
3import withZoom from '../zoom';
4export default (function (View) {
5 return /** @class */function (_super) {
6 __extends(ScrollBar, _super);
7 function ScrollBar() {
8 return _super !== null && _super.apply(this, arguments) || this;
9 }
10 ScrollBar.prototype.willMount = function () {
11 _super.prototype.willMount.call(this);
12 var _a = this,
13 context = _a.context,
14 props = _a.props;
15 var visible = props.visible,
16 _b = props.position,
17 position = _b === void 0 ? 'bottom' : _b,
18 _c = props.margin,
19 margin = _c === void 0 ? '16px' : _c,
20 chart = props.chart;
21 var marginNumber = context.px2hd(margin);
22 if (visible === false) {
23 return null;
24 }
25 chart.updateCoordFor(this, {
26 position: position,
27 width: position === 'left' || position === 'right' ? marginNumber : 0,
28 height: position === 'bottom' || position === 'top' ? marginNumber : 0
29 });
30 };
31 ScrollBar.prototype.render = function () {
32 var _a = this,
33 props = _a.props,
34 state = _a.state;
35 var visible = props.visible;
36 if (visible === false) {
37 return null;
38 }
39 return jsx(View, __assign({
40 position: "bottom"
41 }, props, state));
42 };
43 return ScrollBar;
44 }(withZoom(View));
45});
\No newline at end of file