UNPKG

viser-react

Version:
104 lines (79 loc) 3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Slider = void 0; var PropTypes = _interopRequireWildcard(require("prop-types")); var React = _interopRequireWildcard(require("react")); function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } var __extends = void 0 && (void 0).__extends || function () { var _extendStatics = function extendStatics(d, b) { _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; } || function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); var Props = function () { function Props() {} return Props; }(); var SubPlugin = function (_super) { __extends(SubPlugin, _super); function SubPlugin(props) { var _this = _super.call(this, props) || this; _this.displayName = 'SubPlugin'; _this.state = { container: props.container }; return _this; } SubPlugin.prototype.getChildContext = function () { return { container: this.state.container }; }; SubPlugin.prototype.componentDidUpdate = function () { this.context.centralizedUpdates(this); }; SubPlugin.prototype.componentDidMount = function () { this.context.centralizedUpdates(this); }; SubPlugin.prototype.render = function () { var container = this.state.container; return React.createElement("div", { id: container }); }; SubPlugin.childContextTypes = { container: PropTypes.string }; SubPlugin.contextTypes = { centralizedUpdates: PropTypes.func }; return SubPlugin; }(React.Component); var Slider = function (_super) { __extends(Slider, _super); function Slider() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.displayName = 'Slider'; return _this; } return Slider; }(SubPlugin); exports.Slider = Slider;