UNPKG

iep-ui

Version:

An enterprise-class UI design language and Vue-based implementation

172 lines (156 loc) 5.07 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = require('babel-runtime/helpers/extends'); var _extends3 = _interopRequireDefault(_extends2); var _vueTypes = require('../_util/vue-types'); var _vueTypes2 = _interopRequireDefault(_vueTypes); var _chartTemplate = require('../chart-template'); var _chartTemplate2 = _interopRequireDefault(_chartTemplate); var _propsUtil = require('../_util/props-util'); var _lodash = require('lodash'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } exports['default'] = { name: 'IepBubbleChart', props: (0, _propsUtil.mergeProps)({ data: _vueTypes2['default'].object.def(function () {}), axis: _vueTypes2['default'].array.def(function () { return []; }), unit: _vueTypes2['default'].array.def(function () { return []; }), theme: _vueTypes2['default'].oneOf(['dark', 'light']).def('dark'), mixinOptions: _vueTypes2['default'].object.def(function () {}) }, _chartTemplate2['default'].props), data: function data() { return { chartOptions: {}, themeColor: ['#0F6EFF', '#34D59B', '#FF9540', '#A36AFF', '#FFD240', '#80D8FF', '#FB4848', '#B8C32C', '#FF7BB8', '#82A8FF'] }; }, computed: { factor: function factor() { var _$props = this.$props, data = _$props.data, axis = _$props.axis, loading = _$props.loading, theme = _$props.theme; return { data: data, axis: axis, loading: loading, theme: theme }; } }, watch: { factor: { handler: function handler(e) { var _$props2 = this.$props, theme = _$props2.theme, mixinOptions = _$props2.mixinOptions; this.chartOptions = (0, _extends3['default'])({}, (0, _lodash.omit)(this.$props, ['data', 'axis', 'mixinOptions', 'theme']), { theme: theme, loading: e.loading, options: (0, _extends3['default'])({ // color: this.themeColor, tooltip: { show: false }, title: (0, _extends3['default'])({ text: e.data.name, subtext: e.data.value, left: 'center', align: 'center', top: 'middle', itemGap: 0, textStyle: { fontSize: 14, fontWeight: 400, color: theme === 'light' ? '#333' : '#fff', lineHeight: 30 }, subtextStyle: { color: theme === 'light' ? '#333' : '#fff', fontSize: 32, fontWeight: 'bold' } }, e.data.title), visualMap: { show: false, top: 'middle', right: 10, color: ['red', 'yellow'], calculable: true }, grid: { left: 0, right: 0, top: 0, bottom: 0 }, series: [{ type: 'liquidFill', color: ['rgba(255, 128, 0, 0.85)', 'rgba(255, 128, 0, 0.45)', 'rgba(255, 128, 0, 0.2)'], data: [0.4, 0.4, 0.4], itemStyle: { // opacity: 0.6, shadowBlur: 0, shadowColor: '#000' }, center: e.data.center, radius: e.data.radius, amplitude: '6%', waveLength: '80%', phase: 'auto', period: 'auto', direction: 'right', shape: 'circle', label: { show: false // fontSize: 20, // fontWeight: 'bold', // color: theme === 'light' ? '#212121' : '#fff', // lineHeight: 30, // formatter: val => { // return e.data.name ? `${e.data.name}\n${e.data.value}` : ''; // }, }, backgroundStyle: { color: theme === 'light' ? '#fff' : '#212121' }, outline: { show: true, borderDistance: 8, itemStyle: { color: 'rgba(255, 128, 0, 1)', borderColor: 'rgba(255, 128, 0, 1)', borderWidth: 0, shadowBlur: 0 } }, emphasis: { itemStyle: { // opacity: 0.9, } } }] }, mixinOptions) }); }, immediate: true, deep: true } }, render: function render() { var h = arguments[0]; var chartOptions = this.chartOptions; if (!(0, _lodash.isEmpty)(chartOptions)) { return h(_chartTemplate2['default'], { props: (0, _extends3['default'])({}, chartOptions) }); } else { return h(_chartTemplate2['default']); } } };