UNPKG

@qn-pandora/pandora-visualization

Version:

Pandora 通用可视化库

136 lines (135 loc) 6.91 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 __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; 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); }; import React from 'react'; import { Collapse } from 'antd'; import { observer } from 'mobx-react'; import { computed } from 'mobx'; import { get, isNil } from 'lodash'; import { TableColFilter } from '@qn-pandora/pandora-app-component'; import BasicComponent from '../../../components/Base/BasicComponent'; import TableChartStyleService from '../../../base-pandora-visualization/services/chart-style/charts/table/base'; import Item from '../../../components/Common/Form/Item'; import { Form } from '../../Common'; import errorBoundary from '../../../hocs/errorBoundary'; import { formatString } from '../../../services/language'; import { BaseLocale } from '../../../constants/language/base/type'; import { DataLocale } from '../../../constants/language/data/type'; import SparkLinePanel from '../../../components/Base/SparklinePanel'; import StyleElement from './StyleElement'; var Panel = Collapse.Panel; var TableStyleConfigForm = /** @class */ (function (_super) { __extends(TableStyleConfigForm, _super); function TableStyleConfigForm() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(TableStyleConfigForm.prototype, "chartStyleService", { get: function () { return this.props.chartStyleService; }, enumerable: false, configurable: true }); Object.defineProperty(TableStyleConfigForm.prototype, "showBorder", { get: function () { var themeOption = this.props.themeService.themeOption; var bordered = this.chartStyleService.bordered; var borderOpts = get(themeOption, ['table', 'border']); return bordered === undefined ? borderOpts.show : bordered; }, enumerable: false, configurable: true }); Object.defineProperty(TableStyleConfigForm.prototype, "thresholdColors", { get: function () { var themeOption = this.props.themeService.themeOption; return get(themeOption, 'thresholdColors'); }, enumerable: false, configurable: true }); Object.defineProperty(TableStyleConfigForm.prototype, "renderColumn", { get: function () { var _a = this .chartStyleService, filterColumns = _a.filterColumns, hasColumnsConfig = _a.hasColumnsConfig; // 下钻后,新的数据需要全部checked // 非下钻数据变更的时候,如果有配置项,按照配置项的,无配置项则为全部选中 var checked = this.props.isInDrillDown ? true : !hasColumnsConfig; return filterColumns.map(function (item) { return __assign(__assign({}, item), { checked: isNil(item.checked) ? checked : item.checked }); }); }, enumerable: false, configurable: true }); TableStyleConfigForm.prototype.render = function () { var _a = this .chartStyleService, setFilterColumns = _a.setFilterColumns, sparkline = _a.sparkline, hasSparkline = _a.hasSparkline, chartType = _a.chartType; var themeOption = this.props.themeService.themeOption; return (React.createElement(Form, null, React.createElement(Collapse, { defaultActiveKey: ['1'], bordered: false, accordion: true }, React.createElement(Panel, { header: formatString(DataLocale.column), key: "1" }, React.createElement(Item, { wrapperCol: { span: 24 } }, React.createElement(TableColFilter, { value: this.renderColumn, onChange: setFilterColumns, getPopupContainer: this.getRootDOM, thresholdColors: this.thresholdColors, chartType: chartType }))), React.createElement(Panel, { header: formatString(BaseLocale.chart_style), key: "2" }, React.createElement(StyleElement, { chartStyleService: this.chartStyleService, themeOption: themeOption })), hasSparkline && (React.createElement(Panel, { header: formatString(DataLocale.sparkline.title), key: "sparkline" }, React.createElement(SparkLinePanel, { sparkline: sparkline, themeOption: themeOption })))))); }; __decorate([ computed, __metadata("design:type", TableChartStyleService), __metadata("design:paramtypes", []) ], TableStyleConfigForm.prototype, "chartStyleService", null); __decorate([ computed, __metadata("design:type", Object), __metadata("design:paramtypes", []) ], TableStyleConfigForm.prototype, "showBorder", null); __decorate([ computed, __metadata("design:type", Object), __metadata("design:paramtypes", []) ], TableStyleConfigForm.prototype, "thresholdColors", null); __decorate([ computed, __metadata("design:type", Object), __metadata("design:paramtypes", []) ], TableStyleConfigForm.prototype, "renderColumn", null); TableStyleConfigForm = __decorate([ observer ], TableStyleConfigForm); return TableStyleConfigForm; }(BasicComponent)); export { TableStyleConfigForm }; export default errorBoundary(TableStyleConfigForm);