UNPKG

es6-react-admin-lte

Version:

An AdminLTE Template made to use as React components.

228 lines (205 loc) 9.68 kB
"use strict"; function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _react = _interopRequireDefault(require("react")); var _jquery = _interopRequireDefault(require("jquery")); var _propTypes = _interopRequireDefault(require("prop-types")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var MapChart = /*#__PURE__*/function (_React$Component) { _inherits(MapChart, _React$Component); var _super = _createSuper(MapChart); function MapChart() { _classCallCheck(this, MapChart); return _super.apply(this, arguments); } _createClass(MapChart, [{ key: "componentDidMount", value: function componentDidMount() { var mapParams = this.props.mapParams ? this.props.mapParams : { map: this.props.map, backgroundColor: this.props.backgroundColor, zoomOnScroll: this.props.zoomOnScroll, zoomOnScrollSpeed: this.props.zoomOnScrollSpeed, panOnDrag: this.props.panOnDrag, zoomMax: this.props.zoomMax, zoomMin: this.props.zoomMin, zoomStep: this.props.zoomStep, zoomAnimate: this.props.zoomAnimate, regionsSelectable: this.props.regionsSelectable, regionsSelectableOne: this.props.regionsSelectableOne, markersSelectable: this.props.markersSelectable, markersSelectableOne: this.props.markersSelectableOne, regionStyle: this.props.regionStyle, regionLabelStyle: this.props.regionLabelStyle, markerStyle: this.props.markerStyle, markerLabelStyle: this.props.markerLabelStyle, markers: this.props.markers, series: this.props.series, onRegionLabelShow: this.props.onRegionLabelShow, focusOn: this.props.focusOn, labels: this.props.labels, selectedRegions: this.props.selectedRegions, selectedMarkers: this.props.selectedMarkers, onRegionTipShow: this.props.onRegionTipShow, onRegionOver: this.props.onRegionOver, onRegionOut: this.props.onRegionOut, onRegionClick: this.props.onRegionClick, onRegionSelected: this.props.onRegionSelected, onMarkerTipShow: this.props.onMarkerTipShow, onMarkerOver: this.props.onMarkerOver, onMarkerOut: this.props.onMarkerOut, onMarkerClick: this.props.onMarkerClick, onMarkerSelected: this.props.onMarkerSelected, onViewportChange: this.props.onViewportChange }; (0, _jquery["default"])("#".concat(this.props.id)).vectorMap(mapParams); } }, { key: "render", value: function render() { return /*#__PURE__*/_react["default"].createElement("div", { id: this.props.id, style: { width: this.props.width, height: this.props.height } }); } }]); return MapChart; }(_react["default"].Component); ; MapChart.propTypes = { id: _propTypes["default"].string, width: _propTypes["default"].string, height: _propTypes["default"].string, mapParams: _propTypes["default"].object, map: _propTypes["default"].string, backgroundColor: _propTypes["default"].string, zoomOnScroll: _propTypes["default"].bool, zoomOnScrollSpeed: _propTypes["default"].number, panOnDrag: _propTypes["default"].bool, zoomMax: _propTypes["default"].number, zoomMin: _propTypes["default"].number, zoomStep: _propTypes["default"].number, zoomAnimate: _propTypes["default"].bool, regionsSelectable: _propTypes["default"].bool, regionsSelectableOne: _propTypes["default"].bool, markersSelectable: _propTypes["default"].bool, markersSelectableOne: _propTypes["default"].bool, regionStyle: _propTypes["default"].object, regionLabelStyle: _propTypes["default"].object, markerStyle: _propTypes["default"].object, markerLabelStyle: _propTypes["default"].object, markers: _propTypes["default"].oneOfType([_propTypes["default"].object, _propTypes["default"].array]), series: _propTypes["default"].object, focusOn: _propTypes["default"].oneOfType([_propTypes["default"].object, _propTypes["default"].string]), labels: _propTypes["default"].object, selectedRegions: _propTypes["default"].oneOfType([_propTypes["default"].object, _propTypes["default"].array, _propTypes["default"].string]), selectedMarkers: _propTypes["default"].oneOfType([_propTypes["default"].object, _propTypes["default"].array, _propTypes["default"].string]), onRegionTipShow: _propTypes["default"].func, onRegionOver: _propTypes["default"].func, onRegionOut: _propTypes["default"].func, onRegionClick: _propTypes["default"].func, onRegionSelected: _propTypes["default"].func, onMarkerTipShow: _propTypes["default"].func, onMarkerOver: _propTypes["default"].func, onMarkerOut: _propTypes["default"].func, onMarkerClick: _propTypes["default"].func, onMarkerSelected: _propTypes["default"].func, onViewportChange: _propTypes["default"].func }; MapChart.defaultProps = { id: 'world-map-0', width: "100%", height: "300px", map: 'world_mill_en', backgroundColor: "#555555", zoomOnScroll: true, zoomOnScrollSpeed: 3, panOnDrag: true, zoomMax: 8, zoomMin: 1, zoomStep: 1.6, regionsSelectable: false, regionsSelectableOne: false, markersSelectable: false, markersSelectableOne: false, regionStyle: { initial: { fill: '#bbbbbb', "fill-opacity": 1, stroke: 'none', "stroke-width": 0, "stroke-opacity": 1 }, hover: { "fill-opacity": 0.8, cursor: 'pointer' }, selected: { fill: 'yellow' }, selectedHover: {} }, regionLabelStyle: { initial: { 'font-family': 'Verdana', 'font-size': '12', 'font-weight': 'bold', cursor: 'default', fill: 'black' }, hover: { cursor: 'pointer' } }, markerStyle: { initial: { fill: 'grey', stroke: '#505050', "fill-opacity": 1, "stroke-width": 1, "stroke-opacity": 1, r: 5 }, hover: { stroke: 'black', "stroke-width": 2, cursor: 'pointer' }, selected: { fill: 'blue' }, selectedHover: {} }, markerLabelStyle: { initial: { 'font-family': 'Verdana', 'font-size': '12', 'font-weight': 'bold', cursor: 'default', fill: 'black' }, hover: { cursor: 'pointer' } } }; var _default = MapChart; exports["default"] = _default; module.exports = exports.default; //# sourceMappingURL=map-chart.js.map