UNPKG

@qn-pandora/pandora-visualization

Version:

Pandora 通用可视化库

137 lines (136 loc) 5.9 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, 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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var _a; import { computed } from 'mobx'; import _ from 'lodash'; import languageService, { Locale } from '../../../services/language'; import OneDChartStore from '../stores/one-d'; import { getGeojson, getGeojsonLine } from './transform'; import bind from '../../../utils/bind'; import { MapboxThemeTypes } from '../../Base/Mapbox/mapThemeStyle/constant'; import { EMapboxMode, EMapModeToTheme } from '../../../constants/mapbox-style'; import { MapboxWorldDrillDownService } from '../../../services/chart-drill-down'; import { MapboxWorldActionService } from '../../../services/chart-common-action'; var Locale_Map = (_a = {}, _a[Locale.enUS] = 'en', _a[Locale.zhCN] = 'zh-Hans', _a); var Store = /** @class */ (function (_super) { __extends(Store, _super); function Store() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(Store.prototype, "props", { get: function () { var _a = this.chartStyleService, zoom = _a.zoom, center = _a.center, theme = _a.theme; return { local: this.local, theme: !theme || theme === EMapboxMode.Default ? _.get(this.themeOption, ['mapbox', 'theme']) : MapboxThemeTypes[EMapModeToTheme[theme]], containerStyle: { width: this.chartWidth, height: this.chartHeight }, zoom: zoom, center: center }; }, enumerable: false, configurable: true }); Object.defineProperty(Store.prototype, "local", { get: function () { return Locale_Map[languageService.locale]; }, enumerable: false, configurable: true }); Object.defineProperty(Store.prototype, "chartDataset", { get: function () { return this.dataset; }, enumerable: false, configurable: true }); Object.defineProperty(Store.prototype, "geojson", { get: function () { var _a = this.chartStyleService, longitudeField = _a.longitudeField, latitudeField = _a.latitudeField, coordinateSystem = _a.coordinateSystem; return getGeojson(this.dataset, longitudeField, latitudeField, coordinateSystem); }, enumerable: false, configurable: true }); Object.defineProperty(Store.prototype, "geojsonLine", { get: function () { var _a = this.chartStyleService, longitudeField = _a.longitudeField, latitudeField = _a.latitudeField, coordinateSystem = _a.coordinateSystem; return getGeojsonLine(this.dataset, longitudeField, latitudeField, coordinateSystem); }, enumerable: false, configurable: true }); Store.prototype.handleDrillDown = function (_a) { var row = _a.row; var _b = this.chartStyleService, longitudeField = _b.longitudeField, latitudeField = _b.latitudeField, currentMetrics = _b.currentMetrics; this.onAction({ longitudeField: longitudeField, latitudeField: latitudeField, longitudeValue: row[longitudeField], latitudeValue: row[latitudeField], metricField: _.get(currentMetrics, 0), metricValue: row[_.get(currentMetrics, 0)], row: row, fields: this.fields }, MapboxWorldDrillDownService, MapboxWorldActionService); }; __decorate([ computed, __metadata("design:type", Object), __metadata("design:paramtypes", []) ], Store.prototype, "props", null); __decorate([ computed, __metadata("design:type", Object), __metadata("design:paramtypes", []) ], Store.prototype, "local", null); __decorate([ computed, __metadata("design:type", Object), __metadata("design:paramtypes", []) ], Store.prototype, "chartDataset", null); __decorate([ computed, __metadata("design:type", Object), __metadata("design:paramtypes", []) ], Store.prototype, "geojson", null); __decorate([ computed, __metadata("design:type", Object), __metadata("design:paramtypes", []) ], Store.prototype, "geojsonLine", null); __decorate([ bind, __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0) ], Store.prototype, "handleDrillDown", null); return Store; }(OneDChartStore)); export default Store;