1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | import { __assign, __extends, __rest } from "tslib";
|
17 | import * as React from "react";
|
18 | import { AbstractPureComponent, DISPLAYNAME_PREFIX, Intent } from "../../common";
|
19 | import * as Errors from "../../common/errors";
|
20 | import { MultiSlider } from "./multiSlider";
|
21 | var RangeIndex;
|
22 | (function (RangeIndex) {
|
23 | RangeIndex[RangeIndex["START"] = 0] = "START";
|
24 | RangeIndex[RangeIndex["END"] = 1] = "END";
|
25 | })(RangeIndex || (RangeIndex = {}));
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | var RangeSlider = (function (_super) {
|
32 | __extends(RangeSlider, _super);
|
33 | function RangeSlider() {
|
34 | return _super !== null && _super.apply(this, arguments) || this;
|
35 | }
|
36 | RangeSlider.prototype.render = function () {
|
37 | var _a = this.props, value = _a.value, handleHtmlProps = _a.handleHtmlProps, props = __rest(_a, ["value", "handleHtmlProps"]);
|
38 | return (React.createElement(MultiSlider, __assign({}, props),
|
39 | React.createElement(MultiSlider.Handle, { value: value[RangeIndex.START], type: "start", intentAfter: props.intent, htmlProps: handleHtmlProps === null || handleHtmlProps === void 0 ? void 0 : handleHtmlProps.start }),
|
40 | React.createElement(MultiSlider.Handle, { value: value[RangeIndex.END], type: "end", htmlProps: handleHtmlProps === null || handleHtmlProps === void 0 ? void 0 : handleHtmlProps.end })));
|
41 | };
|
42 | RangeSlider.prototype.validateProps = function (props) {
|
43 | var value = props.value;
|
44 | if (value == null || value[RangeIndex.START] == null || value[RangeIndex.END] == null) {
|
45 | throw new Error(Errors.RANGESLIDER_NULL_VALUE);
|
46 | }
|
47 | };
|
48 | RangeSlider.defaultProps = __assign(__assign({}, MultiSlider.defaultSliderProps), { intent: Intent.PRIMARY, value: [0, 10] });
|
49 | RangeSlider.displayName = "".concat(DISPLAYNAME_PREFIX, ".RangeSlider");
|
50 | return RangeSlider;
|
51 | }(AbstractPureComponent));
|
52 | export { RangeSlider };
|
53 |
|
\ | No newline at end of file |