sea-chart 2.0.43 → 2.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.js +4 -11
- package/dist/components/cell-factory/FormatterConfig.js +55 -62
- package/dist/components/cell-factory/SimpleCellFormatter.js +4 -11
- package/dist/components/cell-factory/SingleSelectOption.js +11 -18
- package/dist/components/cell-factory/cell-editor-factory.js +5 -12
- package/dist/components/cell-factory/cell-formatter-factory.js +4 -11
- package/dist/components/cell-factory/link-content.js +27 -35
- package/dist/components/chart-color-selector/color-selector.js +11 -18
- package/dist/components/collaborator/index.js +7 -14
- package/dist/components/color-picker/index.js +11 -18
- package/dist/components/color-popover/color-rules/color-rule.js +25 -33
- package/dist/components/color-popover/color-rules/index.js +6 -14
- package/dist/components/color-popover/color-rules/rule-filters/filter.js +27 -34
- package/dist/components/color-popover/color-rules/rule-filters/index.js +17 -25
- package/dist/components/color-popover/color-rules/rule-filters/number-input.js +10 -18
- package/dist/components/color-popover/color-rules-popover.js +26 -34
- package/dist/components/color-popover/color-selector-popover.js +10 -18
- package/dist/components/color-setting/color-group-selector.js +12 -20
- package/dist/components/common-add-tool/index.js +6 -13
- package/dist/components/data-process-setter/data-setting-header.js +7 -14
- package/dist/components/data-process-setter/hide-column-setter.js +12 -19
- package/dist/components/data-process-setter/index.js +4 -27
- package/dist/components/data-process-setter/sort-setter.js +16 -24
- package/dist/components/draggable/Draggable.js +7 -13
- package/dist/components/drill-down-settings/drill-down-fields-popover/index.js +42 -50
- package/dist/components/drill-down-settings/drill-down-fields-settings/index.js +10 -18
- package/dist/components/drill-down-settings/index.js +11 -18
- package/dist/components/dtable-popover/index.js +13 -20
- package/dist/components/dtable-search-input/index.js +13 -21
- package/dist/components/font-settings/index.js +14 -22
- package/dist/components/goal-line-setting/goal-setting-item.js +6 -14
- package/dist/components/goal-line-setting/index.js +12 -19
- package/dist/components/highlighter/highlighter.js +7 -14
- package/dist/components/icon/index.js +4 -11
- package/dist/components/index.js +7 -48
- package/dist/components/loading/index.js +6 -13
- package/dist/components/number-input/index.js +4 -11
- package/dist/components/pixel-editor/index.js +15 -23
- package/dist/components/popover/hide-column-popover/hide-column-popover-widgets/hide-column-item.js +8 -15
- package/dist/components/popover/hide-column-popover/hide-column-popover.js +25 -33
- package/dist/components/popover/sort-popover/sort-popover-widgets/sort-utils.js +9 -18
- package/dist/components/popover/sort-popover/sort-popover.js +54 -64
- package/dist/components/resize-handle/ResizeHandle.js +6 -13
- package/dist/components/row-card/row-card-header-cell.js +15 -22
- package/dist/components/row-card/row-card-header.js +14 -21
- package/dist/components/row-card/row-card-item.js +33 -41
- package/dist/components/row-card/row-card.js +15 -23
- package/dist/components/statistic-record-dialog/index.js +56 -64
- package/dist/components/tooltip/index.js +21 -21
- package/dist/components/types-dialog/index.js +56 -64
- package/dist/components/types-dialog/use-force-update.js +4 -10
- package/dist/constants/color-rules.js +8 -14
- package/dist/constants/common-constants.js +8 -14
- package/dist/constants/error.js +2 -8
- package/dist/constants/geolocation.js +9 -15
- package/dist/constants/index.js +149 -273
- package/dist/constants/key-codes.js +0 -2
- package/dist/constants/model.js +3 -9
- package/dist/constants/regions.js +3 -8
- package/dist/constants/style.js +6 -12
- package/dist/constants/table.js +1 -7
- package/dist/constants/type-image.js +33 -39
- package/dist/constants/type.js +3 -9
- package/dist/context.js +20 -24
- package/dist/editor/index.js +8 -15
- package/dist/index.js +13 -104
- package/dist/intl.js +10 -17
- package/dist/locale/index.js +16 -23
- package/dist/locale/lang/de.js +1 -7
- package/dist/locale/lang/en.js +1 -7
- package/dist/locale/lang/es.js +1 -7
- package/dist/locale/lang/fr.js +1 -7
- package/dist/locale/lang/pt.js +1 -7
- package/dist/locale/lang/ru.js +1 -7
- package/dist/locale/lang/zh_CN.js +1 -7
- package/dist/model/area-group.js +12 -19
- package/dist/model/area.js +12 -19
- package/dist/model/bar-custom.js +11 -18
- package/dist/model/bar-group.js +12 -19
- package/dist/model/bar-stack.js +10 -17
- package/dist/model/bar.js +11 -18
- package/dist/model/base-model.js +8 -11
- package/dist/model/basic-number-card.js +13 -20
- package/dist/model/chart.js +7 -13
- package/dist/model/combination.js +19 -22
- package/dist/model/compare-bar.js +14 -21
- package/dist/model/completeness-group.js +11 -18
- package/dist/model/completeness.js +10 -17
- package/dist/model/dashboard.js +7 -14
- package/dist/model/funnel.js +14 -21
- package/dist/model/generic-model.js +135 -143
- package/dist/model/heat-map.js +9 -16
- package/dist/model/horizontal-bar.js +15 -18
- package/dist/model/horizontal-group-bar.js +14 -17
- package/dist/model/index.js +69 -93
- package/dist/model/line-group.js +13 -20
- package/dist/model/line.js +12 -19
- package/dist/model/map-bubble.js +12 -19
- package/dist/model/map.js +12 -19
- package/dist/model/mirror.js +13 -20
- package/dist/model/pie.js +12 -19
- package/dist/model/ring.js +12 -19
- package/dist/model/scatter.js +10 -17
- package/dist/model/stacked-horizontal-bar.js +15 -18
- package/dist/model/table-element.js +5 -12
- package/dist/model/table.js +7 -14
- package/dist/model/tree-map.js +7 -14
- package/dist/model/trend.js +11 -18
- package/dist/model/user.js +1 -7
- package/dist/model/world-map-bubble.js +12 -19
- package/dist/model/world-map.js +12 -19
- package/dist/services/map-json.js +7 -13
- package/dist/settings/advance-bar-settings/data-settings.js +36 -44
- package/dist/settings/advance-bar-settings/index.js +3 -20
- package/dist/settings/advance-bar-settings/style-settings.js +83 -74
- package/dist/settings/bar-settings/data-settings.js +39 -47
- package/dist/settings/bar-settings/index.js +3 -20
- package/dist/settings/bar-settings/style-settings.js +69 -60
- package/dist/settings/basic-number-card/data-settings.js +49 -57
- package/dist/settings/basic-number-card/index.js +3 -20
- package/dist/settings/basic-number-card/style-settings.js +18 -26
- package/dist/settings/combination-settings/data-settings.js +55 -63
- package/dist/settings/combination-settings/index.js +3 -20
- package/dist/settings/combination-settings/style-settings.js +94 -77
- package/dist/settings/completeness-settings/callbacks/callbacks.js +16 -27
- package/dist/settings/completeness-settings/data-settings/completion-settings.js +21 -28
- package/dist/settings/completeness-settings/data-settings/data-settings.js +25 -32
- package/dist/settings/completeness-settings/index.js +3 -20
- package/dist/settings/completeness-settings/style-settings.js +19 -26
- package/dist/settings/dashboard-settings/data-settings.js +43 -51
- package/dist/settings/dashboard-settings/index.js +2 -13
- package/dist/settings/data-settings.js +72 -79
- package/dist/settings/funnel-settings/components/dnd-item/dnd-item.js +12 -19
- package/dist/settings/funnel-settings/components/dnd-list.js +15 -23
- package/dist/settings/funnel-settings/components/funnel-label-setting.js +32 -40
- package/dist/settings/funnel-settings/components/funnel-layer-setting.js +20 -28
- package/dist/settings/funnel-settings/data-settings.js +23 -31
- package/dist/settings/funnel-settings/index.js +3 -20
- package/dist/settings/funnel-settings/style-settings.js +11 -19
- package/dist/settings/heat-map-settings/data-settings.js +18 -26
- package/dist/settings/heat-map-settings/index.js +3 -20
- package/dist/settings/heat-map-settings/style-settings.js +18 -26
- package/dist/settings/horizontal-bar-settings/data-settings.js +12 -19
- package/dist/settings/horizontal-bar-settings/index.js +3 -20
- package/dist/settings/horizontal-bar-settings/style-settings.js +12 -19
- package/dist/settings/index.js +52 -70
- package/dist/settings/map-settings/components/location-field-selector.js +10 -17
- package/dist/settings/map-settings/components/map-level-selector.js +11 -18
- package/dist/settings/map-settings/components/map-province-city-selector.js +19 -26
- package/dist/settings/map-settings/index.js +3 -20
- package/dist/settings/map-settings/map-data-settings.js +23 -30
- package/dist/settings/map-settings/map-style-settings.js +26 -34
- package/dist/settings/mirror-settings/data-settings.js +26 -34
- package/dist/settings/mirror-settings/index.js +2 -13
- package/dist/settings/pie-settings/data-settings.js +33 -41
- package/dist/settings/pie-settings/index.js +3 -20
- package/dist/settings/pie-settings/style-settings.js +47 -55
- package/dist/settings/scatter/data-settings.js +27 -34
- package/dist/settings/scatter/index.js +3 -12
- package/dist/settings/stacks-settings/index.js +19 -27
- package/dist/settings/stacks-settings/stack-item-settings.js +19 -27
- package/dist/settings/style-settings.js +64 -72
- package/dist/settings/table-element-settings/components/data-filter.js +30 -38
- package/dist/settings/table-element-settings/data-settings.js +21 -29
- package/dist/settings/table-element-settings/index.js +2 -13
- package/dist/settings/table-settings/data-settings.js +111 -119
- package/dist/settings/table-settings/index.js +2 -13
- package/dist/settings/time-comparison-settings/data-settings.js +43 -51
- package/dist/settings/time-comparison-settings/index.js +3 -20
- package/dist/settings/time-comparison-settings/style-settings.js +62 -53
- package/dist/settings/trend-settings/data-settings.js +24 -32
- package/dist/settings/trend-settings/index.js +3 -20
- package/dist/settings/trend-settings/style-setting.js +17 -25
- package/dist/settings/widgets/axis-title-font-settings/index.js +39 -0
- package/dist/settings/widgets/basic-summary/index.js +55 -63
- package/dist/settings/widgets/chart-type/index.js +18 -26
- package/dist/settings/widgets/color-settings/index.js +72 -80
- package/dist/settings/widgets/common-data-settings.js +21 -29
- package/dist/settings/widgets/data-filter/index.js +35 -43
- package/dist/settings/widgets/data-sort.js +16 -24
- package/dist/settings/widgets/date-summary-item.js +24 -32
- package/dist/settings/widgets/display-values-settings/index.js +14 -22
- package/dist/settings/widgets/divider/index.js +8 -16
- package/dist/settings/widgets/font-settings/font-color-settings.js +11 -19
- package/dist/settings/widgets/font-settings/font-size-settings.js +14 -22
- package/dist/settings/widgets/font-settings/font-weight-settings.js +17 -25
- package/dist/settings/widgets/font-settings/index.js +4 -27
- package/dist/settings/widgets/group-by.js +51 -59
- package/dist/settings/widgets/min-max-setting.js +10 -18
- package/dist/settings/widgets/mininum-slice-percent.js +10 -18
- package/dist/settings/widgets/numeric-summary-item.js +23 -31
- package/dist/settings/widgets/select-line-type/index.js +10 -17
- package/dist/settings/widgets/select-table/index.js +9 -16
- package/dist/settings/widgets/select-view/index.js +20 -28
- package/dist/settings/widgets/stack.js +14 -22
- package/dist/settings/widgets/summary-method-setting.js +17 -25
- package/dist/settings/widgets/summary-settings.js +72 -80
- package/dist/settings/widgets/switch/index.js +8 -15
- package/dist/settings/widgets/text-horizontal-settings.js +15 -23
- package/dist/settings/widgets/time-picker.js +29 -37
- package/dist/settings/widgets/title-settings/index.js +29 -37
- package/dist/settings/widgets/title-settings/title-text.js +5 -12
- package/dist/settings/widgets/x-axios.js +0 -1
- package/dist/settings/widgets/y-axis-group-settings.js +63 -71
- package/dist/utils/cell-format-utils.js +18 -28
- package/dist/utils/cell-value-utils.js +5 -12
- package/dist/utils/chart-utils/base-utils.js +362 -334
- package/dist/utils/chart-utils/index.js +28 -41
- package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +80 -86
- package/dist/utils/chart-utils/original-data-utils/card-calculator.js +13 -20
- package/dist/utils/chart-utils/original-data-utils/combination-calculator.js +45 -52
- package/dist/utils/chart-utils/original-data-utils/compare-bar-chart-calculator.js +19 -26
- package/dist/utils/chart-utils/original-data-utils/completeness-calculator.js +32 -39
- package/dist/utils/chart-utils/original-data-utils/dashboard-calculator.js +16 -23
- package/dist/utils/chart-utils/original-data-utils/index.js +50 -57
- package/dist/utils/chart-utils/original-data-utils/mirror-calculator.js +21 -28
- package/dist/utils/chart-utils/original-data-utils/pivot-table-calculator.js +91 -97
- package/dist/utils/chart-utils/original-data-utils/scatter-calculator.js +19 -26
- package/dist/utils/chart-utils/original-data-utils/trend-calculator.js +31 -38
- package/dist/utils/chart-utils/sql-statistics-utils.js +284 -246
- package/dist/utils/chart.js +9 -17
- package/dist/utils/collaborator-manager.js +3 -9
- package/dist/utils/collaborator-utils.js +18 -30
- package/dist/utils/collaborator.js +4 -13
- package/dist/utils/color-utils.js +18 -29
- package/dist/utils/column-utils.js +65 -92
- package/dist/utils/common-utils.js +27 -52
- package/dist/utils/concurrency-manager.js +1 -7
- package/dist/utils/contexts.js +5 -12
- package/dist/utils/date-translate.js +11 -19
- package/dist/utils/digital-sign-utils.js +7 -14
- package/dist/utils/event-bus.js +1 -7
- package/dist/utils/hotkey.js +5 -11
- package/dist/utils/index.js +54 -221
- package/dist/utils/key-generator.js +2 -9
- package/dist/utils/map.js +22 -31
- package/dist/utils/object-utils.js +1 -7
- package/dist/utils/options-utils.js +8 -16
- package/dist/utils/row-record-utils.js +182 -178
- package/dist/utils/row-utils.js +27 -38
- package/dist/utils/search.js +24 -32
- package/dist/utils/sql/chart-data-sql.js +49 -55
- package/dist/utils/sql/column-2-sql-column.js +146 -154
- package/dist/utils/sql/index.js +3 -27
- package/dist/utils/trend-utils.js +39 -47
- package/dist/view/index.css +0 -17
- package/dist/view/index.js +89 -95
- package/dist/view/title/index.js +15 -23
- package/dist/view/wrapper/area-group.js +53 -72
- package/dist/view/wrapper/area.js +51 -72
- package/dist/view/wrapper/bar-compare.js +43 -56
- package/dist/view/wrapper/bar-custom-stack.js +50 -120
- package/dist/view/wrapper/bar-group.js +51 -94
- package/dist/view/wrapper/bar-stack.js +54 -90
- package/dist/view/wrapper/bar.js +45 -66
- package/dist/view/wrapper/basic-number-card.js +25 -26
- package/dist/view/wrapper/chart-component.js +539 -162
- package/dist/view/wrapper/combination.js +63 -83
- package/dist/view/wrapper/completeness-group.js +42 -96
- package/dist/view/wrapper/completeness.js +42 -96
- package/dist/view/wrapper/dashboard.js +33 -47
- package/dist/view/wrapper/funnel.js +36 -56
- package/dist/view/wrapper/heat-map.js +126 -104
- package/dist/view/wrapper/horizontal-bar-group.js +57 -76
- package/dist/view/wrapper/horizontal-bar-stack.js +56 -109
- package/dist/view/wrapper/horizontal-bar.js +45 -68
- package/dist/view/wrapper/index.js +110 -115
- package/dist/view/wrapper/line-group.js +48 -66
- package/dist/view/wrapper/line.js +47 -67
- package/dist/view/wrapper/map-bubble.js +46 -59
- package/dist/view/wrapper/map-world-bubble.js +45 -58
- package/dist/view/wrapper/map-world.js +47 -60
- package/dist/view/wrapper/map.js +48 -60
- package/dist/view/wrapper/mirror.js +40 -61
- package/dist/view/wrapper/pie.js +48 -59
- package/dist/view/wrapper/ring.js +52 -63
- package/dist/view/wrapper/scatter.js +49 -67
- package/dist/view/wrapper/table/index.js +13 -21
- package/dist/view/wrapper/table/one-dimension-table-no-numeric-columns.js +49 -57
- package/dist/view/wrapper/table/one-dimension-table-with-numeric-columns.js +50 -58
- package/dist/view/wrapper/table/pivot-table-display-name.js +83 -91
- package/dist/view/wrapper/table/two-dimension-table.js +76 -84
- package/dist/view/wrapper/table-element/components/dataset-utils.js +23 -36
- package/dist/view/wrapper/table-element/components/formatter.js +96 -105
- package/dist/view/wrapper/table-element/components/formatters/FileFormatter/index.js +22 -31
- package/dist/view/wrapper/table-element/components/formatters/formula-formatter.js +9 -16
- package/dist/view/wrapper/table-element/components/formatters/link-formatter.js +73 -80
- package/dist/view/wrapper/table-element/components/formula-formatter.js +9 -16
- package/dist/view/wrapper/table-element/components/link-formatter.js +73 -80
- package/dist/view/wrapper/table-element/components/record.js +10 -17
- package/dist/view/wrapper/table-element/components/records-body.js +17 -19
- package/dist/view/wrapper/table-element/components/records-header/index.js +7 -15
- package/dist/view/wrapper/table-element/components/records-header/records-header-cell.js +8 -16
- package/dist/view/wrapper/table-element/components/records.js +23 -33
- package/dist/view/wrapper/table-element/components/resize-column-handle/resize-column-handle.js +5 -12
- package/dist/view/wrapper/table-element/components/utils.js +5 -15
- package/dist/view/wrapper/table-element/components/value-display-utils.js +4 -11
- package/dist/view/wrapper/table-element/components/vertical-scrollbar/index.js +6 -13
- package/dist/view/wrapper/table-element/index.js +18 -26
- package/dist/view/wrapper/treemap.js +39 -57
- package/dist/view/wrapper/trend.js +41 -48
- package/package.json +1 -1
|
@@ -1,29 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _lodashEs = require("lodash-es");
|
|
12
|
-
var d3 = _interopRequireWildcard(require("d3"));
|
|
13
|
-
var _constants = require("../../constants");
|
|
14
|
-
var _utils = require("../../utils");
|
|
15
|
-
var _intl = _interopRequireDefault(require("../../intl"));
|
|
16
|
-
var _colorRules = require("../../constants/color-rules");
|
|
17
|
-
var _tooltip = _interopRequireDefault(require("../../components/tooltip"));
|
|
18
|
-
var _chartComponent = _interopRequireDefault(require("./chart-component"));
|
|
19
|
-
class Ring extends _chartComponent.default {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import * as d3 from 'd3';
|
|
4
|
+
import { CHART_LABEL_POSITIONS, CHART_LABEL_FORMATS, CHART_THEME_COLOR, CHART_TYPE } from '../../constants';
|
|
5
|
+
import { BaseUtils, isFunction } from '../../utils';
|
|
6
|
+
import intl from '../../intl';
|
|
7
|
+
import { SUPPORT_SINGLE_SELECT_THEMES_OPTIONS } from '../../constants/color-rules';
|
|
8
|
+
import ToolTip from '../../components/tooltip';
|
|
9
|
+
import ChartComponent from './chart-component';
|
|
10
|
+
class Ring extends ChartComponent {
|
|
20
11
|
constructor(props) {
|
|
21
12
|
super(props);
|
|
22
|
-
this.handleResize = () => {
|
|
23
|
-
this.destroyChart();
|
|
24
|
-
this.createChart();
|
|
25
|
-
this.drawChart();
|
|
26
|
-
};
|
|
27
13
|
this.createChart = () => {
|
|
28
14
|
const {
|
|
29
15
|
chart
|
|
@@ -43,7 +29,7 @@ class Ring extends _chartComponent.default {
|
|
|
43
29
|
customRender
|
|
44
30
|
} = this.props;
|
|
45
31
|
this.draw(data);
|
|
46
|
-
|
|
32
|
+
isFunction(customRender) && customRender(this.chart);
|
|
47
33
|
};
|
|
48
34
|
this.draw = data => {
|
|
49
35
|
const {
|
|
@@ -52,7 +38,7 @@ class Ring extends _chartComponent.default {
|
|
|
52
38
|
globalTheme,
|
|
53
39
|
chartColorTheme
|
|
54
40
|
} = this.props;
|
|
55
|
-
const theme =
|
|
41
|
+
const theme = CHART_THEME_COLOR[globalTheme];
|
|
56
42
|
const {
|
|
57
43
|
show_legend,
|
|
58
44
|
display_label,
|
|
@@ -66,25 +52,25 @@ class Ring extends _chartComponent.default {
|
|
|
66
52
|
insertPadding,
|
|
67
53
|
rightLegendSpace
|
|
68
54
|
} = this.chartBoundingClientRect;
|
|
69
|
-
this.isInnerLabel = !label_position || label_position ===
|
|
70
|
-
const currentTheme =
|
|
71
|
-
const useSingleSelectColumnColor = color_theme ===
|
|
55
|
+
this.isInnerLabel = !label_position || label_position === CHART_LABEL_POSITIONS[0];
|
|
56
|
+
const currentTheme = BaseUtils.getCurrentTheme(chartColorTheme);
|
|
57
|
+
const useSingleSelectColumnColor = color_theme === SUPPORT_SINGLE_SELECT_THEMES_OPTIONS.SINGLE_SELECT_COLUMN_COLORS;
|
|
72
58
|
const {
|
|
73
59
|
data: newData,
|
|
74
60
|
colorMap,
|
|
75
61
|
total
|
|
76
|
-
} =
|
|
62
|
+
} = BaseUtils.formatPieChartData(data, chart, tables, currentTheme, useSingleSelectColumnColor);
|
|
77
63
|
if (!Array.isArray(newData) || newData.length === 0) return;
|
|
78
64
|
|
|
79
65
|
// Color
|
|
80
|
-
const colorDomain = new Set(
|
|
66
|
+
const colorDomain = new Set(newData.map(d => d.name));
|
|
81
67
|
const colorRange = Array.from(colorDomain).map(name => colorMap[name === null || name === void 0 ? void 0 : name.trim()]);
|
|
82
68
|
const color = d3.scaleOrdinal().domain(colorDomain).range(colorRange);
|
|
83
69
|
|
|
84
70
|
// Ring and Arc
|
|
85
71
|
const pie = d3.pie().sort(null).value(d => d.value);
|
|
86
|
-
const arcs = pie(
|
|
87
|
-
const arc = d3.arc().innerRadius(Math.min(chartWidth, chartHeight) / 2 * 0.
|
|
72
|
+
const arcs = pie(newData);
|
|
73
|
+
const arc = d3.arc().innerRadius(Math.min(chartWidth, chartHeight) / 2 * 0.5).outerRadius(Math.min(chartWidth, chartHeight) / 2 * 0.7);
|
|
88
74
|
|
|
89
75
|
// Draw Ring
|
|
90
76
|
this.chart.append('g').attr('class', 'content-wrapper').selectAll().data(arcs).join('path').attr('stroke', 'white').attr('stroke-width', 2).attr('opacity', 1).attr('fill', d => color(d.data.name)).attr('d', arc).attr('data-groupName', d => d.data.name).call(g => {
|
|
@@ -114,13 +100,13 @@ class Ring extends _chartComponent.default {
|
|
|
114
100
|
percent
|
|
115
101
|
} = d.data;
|
|
116
102
|
return this.getLabel(value, percent);
|
|
117
|
-
}).attr('fill', theme.labelColor).attr('font-size',
|
|
103
|
+
}).attr('fill', theme.labelColor).attr('font-size', BaseUtils.getLabelFontSize(label_font_size));
|
|
118
104
|
|
|
119
105
|
// Line
|
|
120
106
|
if (!this.isInnerLabel) {
|
|
121
107
|
const lineRadius = arc.outerRadius()() * 0.7;
|
|
122
108
|
const arcLine = d3.arc().innerRadius(lineRadius).outerRadius(lineRadius);
|
|
123
|
-
this.chart.append('g').attr('transform', `translate(${left + offsetX}, ${top + offsetY})`).selectAll().data(arcs).join('line').attr('transform', d => `translate(${arcLine.centroid(d)})`).attr('x1', d => arcLine.centroid(d)[0]).attr('y1', d => arcLine.centroid(d)[1]).attr('x2', d => arcLine.centroid(d)[0] * 1.2).attr('y2', d => arcLine.centroid(d)[1] * 1.2).attr('stroke', d => color(d.data.name)).attr('font-size',
|
|
109
|
+
this.chart.append('g').attr('transform', `translate(${left + offsetX}, ${top + offsetY})`).selectAll().data(arcs).join('line').attr('transform', d => `translate(${arcLine.centroid(d)})`).attr('x1', d => arcLine.centroid(d)[0]).attr('y1', d => arcLine.centroid(d)[1]).attr('x2', d => arcLine.centroid(d)[0] * 1.2).attr('y2', d => arcLine.centroid(d)[1] * 1.2).attr('stroke', d => color(d.data.name)).attr('font-size', BaseUtils.getLabelFontSize(label_font_size));
|
|
124
110
|
}
|
|
125
111
|
}
|
|
126
112
|
}).on('click', (event, rowData) => {
|
|
@@ -141,13 +127,17 @@ class Ring extends _chartComponent.default {
|
|
|
141
127
|
this.setAnnotationTotal(event.currentTarget.parentNode, {
|
|
142
128
|
value: total
|
|
143
129
|
});
|
|
130
|
+
}).call(g => {
|
|
131
|
+
this.animateArcGrowIn(g, arc);
|
|
132
|
+
this.animateFadeIn(this.chart.selectAll('text'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
133
|
+
this.animateFadeIn(this.chart.selectAll('line'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
144
134
|
});
|
|
145
135
|
if (show_legend) {
|
|
146
136
|
this.setLegend({
|
|
147
137
|
legendName: 'name',
|
|
148
138
|
theme,
|
|
149
139
|
legendPosition: 'center-right',
|
|
150
|
-
data,
|
|
140
|
+
data: newData,
|
|
151
141
|
colorScale: color
|
|
152
142
|
});
|
|
153
143
|
}
|
|
@@ -199,7 +189,7 @@ class Ring extends _chartComponent.default {
|
|
|
199
189
|
this.handleAcitveAndInActiveState = (state, event) => {
|
|
200
190
|
const allGroup = [event.currentTarget.parentNode];
|
|
201
191
|
const curGroupName = event.currentTarget.getAttribute('data-groupName');
|
|
202
|
-
this.setActiveAndInActiveState(state, allGroup, curGroupName,
|
|
192
|
+
this.setActiveAndInActiveState(state, allGroup, curGroupName, CHART_TYPE.RING);
|
|
203
193
|
};
|
|
204
194
|
this.getLabel = (val, percent) => {
|
|
205
195
|
const {
|
|
@@ -211,16 +201,16 @@ class Ring extends _chartComponent.default {
|
|
|
211
201
|
display_label,
|
|
212
202
|
label_format
|
|
213
203
|
} = chart.config;
|
|
214
|
-
const value =
|
|
204
|
+
const value = BaseUtils.getSummaryValueDisplayString(summaryColumn, val, summary_method);
|
|
215
205
|
if (!display_label || !value || !percent) {
|
|
216
206
|
return '';
|
|
217
207
|
}
|
|
218
208
|
switch (label_format) {
|
|
219
|
-
case
|
|
209
|
+
case CHART_LABEL_FORMATS[0]:
|
|
220
210
|
return percent;
|
|
221
|
-
case
|
|
211
|
+
case CHART_LABEL_FORMATS[1]:
|
|
222
212
|
return value;
|
|
223
|
-
case
|
|
213
|
+
case CHART_LABEL_FORMATS[2]:
|
|
224
214
|
return `${value} (${percent})`;
|
|
225
215
|
default:
|
|
226
216
|
return percent;
|
|
@@ -229,9 +219,9 @@ class Ring extends _chartComponent.default {
|
|
|
229
219
|
this.getTooltipName = name => {
|
|
230
220
|
let title = name;
|
|
231
221
|
if (!name || name.trim() === 'undefined' || name.trim() === 'null') {
|
|
232
|
-
title =
|
|
222
|
+
title = intl.get('Empty');
|
|
233
223
|
} else if (name === '_Others') {
|
|
234
|
-
title =
|
|
224
|
+
title = intl.get('Others');
|
|
235
225
|
}
|
|
236
226
|
return title;
|
|
237
227
|
};
|
|
@@ -249,7 +239,7 @@ class Ring extends _chartComponent.default {
|
|
|
249
239
|
const {
|
|
250
240
|
summary_method
|
|
251
241
|
} = chart.config;
|
|
252
|
-
const theme =
|
|
242
|
+
const theme = CHART_THEME_COLOR[globalTheme];
|
|
253
243
|
// Clear old annotation
|
|
254
244
|
const oldTitle = (_d3$select$select = d3.select(wrapper).select('.title')) === null || _d3$select$select === void 0 ? void 0 : _d3$select$select.node();
|
|
255
245
|
const oldText = (_d3$select$select2 = d3.select(wrapper).select('.text')) === null || _d3$select$select2 === void 0 ? void 0 : _d3$select$select2.node();
|
|
@@ -257,7 +247,7 @@ class Ring extends _chartComponent.default {
|
|
|
257
247
|
oldText && oldText.remove();
|
|
258
248
|
|
|
259
249
|
// Title
|
|
260
|
-
d3.select(wrapper).append('text').attr('class', 'title').text(name ? name :
|
|
250
|
+
d3.select(wrapper).append('text').attr('class', 'title').text(name ? name : intl.get('Total')).attr('fill', theme.annotationTitleFontColor).attr('font-size', theme.annotationFontSize).attr('font-weight', 300).attr('pointer-events', 'none').call(g => {
|
|
261
251
|
var _g$node;
|
|
262
252
|
const {
|
|
263
253
|
width
|
|
@@ -266,7 +256,7 @@ class Ring extends _chartComponent.default {
|
|
|
266
256
|
});
|
|
267
257
|
|
|
268
258
|
// Text this.getLabel(value, percent)
|
|
269
|
-
d3.select(wrapper).append('text').attr('class', 'text').text(summaryColumn ?
|
|
259
|
+
d3.select(wrapper).append('text').attr('class', 'text').text(summaryColumn ? BaseUtils.getSummaryValueDisplayString(summaryColumn, value, summary_method) : value).attr('fill', theme.annotationValueFontColor).attr('font-size', theme.annotationFontSize).call(g => {
|
|
270
260
|
var _g$node2;
|
|
271
261
|
const {
|
|
272
262
|
width
|
|
@@ -283,12 +273,11 @@ class Ring extends _chartComponent.default {
|
|
|
283
273
|
componentDidMount() {
|
|
284
274
|
this.createChart();
|
|
285
275
|
this.drawChart();
|
|
286
|
-
|
|
287
|
-
window.addEventListener('resize', this.debouncedHandleResize);
|
|
276
|
+
super.componentDidMount();
|
|
288
277
|
}
|
|
289
278
|
componentDidUpdate(prevProps) {
|
|
290
279
|
super.componentDidUpdate(prevProps);
|
|
291
|
-
if (
|
|
280
|
+
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
292
281
|
this.destroyChart();
|
|
293
282
|
this.createChart();
|
|
294
283
|
this.drawChart();
|
|
@@ -296,17 +285,17 @@ class Ring extends _chartComponent.default {
|
|
|
296
285
|
}
|
|
297
286
|
componentWillUnmount() {
|
|
298
287
|
this.destroyChart();
|
|
299
|
-
|
|
288
|
+
super.componentWillUnmount();
|
|
300
289
|
}
|
|
301
290
|
render() {
|
|
302
291
|
const {
|
|
303
292
|
tooltipData,
|
|
304
293
|
toolTipPosition
|
|
305
294
|
} = this.state;
|
|
306
|
-
return /*#__PURE__*/
|
|
295
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
307
296
|
ref: ref => this.container = ref,
|
|
308
297
|
className: "sea-chart-container"
|
|
309
|
-
}, /*#__PURE__*/
|
|
298
|
+
}, /*#__PURE__*/React.createElement(ToolTip, {
|
|
310
299
|
tooltipData: tooltipData,
|
|
311
300
|
toolTipPosition: toolTipPosition,
|
|
312
301
|
chart: this.chart
|
|
@@ -314,15 +303,15 @@ class Ring extends _chartComponent.default {
|
|
|
314
303
|
}
|
|
315
304
|
}
|
|
316
305
|
Ring.propTypes = {
|
|
317
|
-
canvasStyle:
|
|
318
|
-
chart:
|
|
319
|
-
groupbyColumn:
|
|
320
|
-
summaryColumn:
|
|
321
|
-
result:
|
|
322
|
-
tables:
|
|
323
|
-
globalTheme:
|
|
324
|
-
chartColorTheme:
|
|
325
|
-
toggleRecords:
|
|
326
|
-
customRender:
|
|
306
|
+
canvasStyle: PropTypes.object,
|
|
307
|
+
chart: PropTypes.object,
|
|
308
|
+
groupbyColumn: PropTypes.object,
|
|
309
|
+
summaryColumn: PropTypes.object,
|
|
310
|
+
result: PropTypes.array,
|
|
311
|
+
tables: PropTypes.array,
|
|
312
|
+
globalTheme: PropTypes.string,
|
|
313
|
+
chartColorTheme: PropTypes.string,
|
|
314
|
+
toggleRecords: PropTypes.func,
|
|
315
|
+
customRender: PropTypes.func
|
|
327
316
|
};
|
|
328
|
-
|
|
317
|
+
export default Ring;
|
|
@@ -1,30 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var d3 = _interopRequireWildcard(require("d3"));
|
|
13
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
|
-
var _dtableUtils = require("dtable-utils");
|
|
15
|
-
var _constants = require("../../constants");
|
|
16
|
-
var _utils = require("../../utils");
|
|
17
|
-
var _intl = _interopRequireDefault(require("../../intl"));
|
|
18
|
-
var _tooltip = _interopRequireDefault(require("../../components/tooltip"));
|
|
19
|
-
var _chartComponent = _interopRequireDefault(require("./chart-component"));
|
|
20
|
-
class Scatter extends _chartComponent.default {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { cloneDeep } from 'lodash-es';
|
|
4
|
+
import * as d3 from 'd3';
|
|
5
|
+
import { getTableById, getTableColumnByKey } from 'dtable-utils';
|
|
6
|
+
import { CHART_THEME_COLOR } from '../../constants';
|
|
7
|
+
import { BaseUtils, isFunction } from '../../utils';
|
|
8
|
+
import intl from '../../intl';
|
|
9
|
+
import ToolTip from '../../components/tooltip';
|
|
10
|
+
import ChartComponent from './chart-component';
|
|
11
|
+
class Scatter extends ChartComponent {
|
|
21
12
|
constructor(props) {
|
|
22
13
|
super(props);
|
|
23
|
-
this.handleResize = () => {
|
|
24
|
-
this.destroyChart();
|
|
25
|
-
this.createChart();
|
|
26
|
-
this.drawChart();
|
|
27
|
-
};
|
|
28
14
|
this.createChart = () => {
|
|
29
15
|
const {
|
|
30
16
|
chart
|
|
@@ -36,8 +22,8 @@ class Scatter extends _chartComponent.default {
|
|
|
36
22
|
} = chart.config;
|
|
37
23
|
const initConfig = {
|
|
38
24
|
insertPadding: 30,
|
|
39
|
-
marginLeft: y_axis_show_label ?
|
|
40
|
-
marginBottom: x_axis_show_label ?
|
|
25
|
+
marginLeft: y_axis_show_label ? this.getAxisTitleHeight(chart.config.y_axis_label_font_size) : 0,
|
|
26
|
+
marginBottom: x_axis_show_label ? this.getAxisTitleHeight(chart.config.x_axis_label_font_size) : 0,
|
|
41
27
|
marginTop: y_axis_show_value ? 15 : 0,
|
|
42
28
|
bottomLegendSpace: 0
|
|
43
29
|
};
|
|
@@ -50,15 +36,15 @@ class Scatter extends _chartComponent.default {
|
|
|
50
36
|
let {
|
|
51
37
|
result: data
|
|
52
38
|
} = this.props;
|
|
53
|
-
data =
|
|
39
|
+
data = BaseUtils.formatEmptyName(data, '', intl.get('Empty'));
|
|
54
40
|
if (!Array.isArray(data)) return;
|
|
55
41
|
data = this.transformStringToNumber(data);
|
|
56
42
|
this.draw(data);
|
|
57
43
|
this.renderAxisLabel(this.props.chart, this.props.tables, this.container);
|
|
58
|
-
|
|
44
|
+
isFunction(customRender) && customRender(this.chart);
|
|
59
45
|
};
|
|
60
46
|
this.transformStringToNumber = data => {
|
|
61
|
-
const newData =
|
|
47
|
+
const newData = cloneDeep(data);
|
|
62
48
|
newData.forEach(item => {
|
|
63
49
|
if (item.original_value) {
|
|
64
50
|
var _item$original_value, _item$original_value2;
|
|
@@ -73,7 +59,7 @@ class Scatter extends _chartComponent.default {
|
|
|
73
59
|
chartColorTheme
|
|
74
60
|
} = this.props;
|
|
75
61
|
let currentIdx = 0;
|
|
76
|
-
let colors =
|
|
62
|
+
let colors = BaseUtils.getCurrentTheme(chartColorTheme).colors;
|
|
77
63
|
const colorMap = data.reduce((acc, cur) => {
|
|
78
64
|
if (cur.groupby && !acc[cur.groupby]) {
|
|
79
65
|
acc[cur.groupby] = colors[currentIdx++ % colors.length];
|
|
@@ -94,12 +80,12 @@ class Scatter extends _chartComponent.default {
|
|
|
94
80
|
} = event;
|
|
95
81
|
const newTooltipData = {
|
|
96
82
|
titleMarkColor: event.currentTarget.getAttribute('fill'),
|
|
97
|
-
title: groupby || groupby === 0 ? groupby :
|
|
83
|
+
title: groupby || groupby === 0 ? groupby : intl.get('Empty'),
|
|
98
84
|
items: [{
|
|
99
|
-
name: selectedXAxisColumn.name,
|
|
85
|
+
name: selectedXAxisColumn === null || selectedXAxisColumn === void 0 ? void 0 : selectedXAxisColumn.name,
|
|
100
86
|
value: name
|
|
101
87
|
}, {
|
|
102
|
-
name: selectedYAxisColumn.name,
|
|
88
|
+
name: selectedYAxisColumn === null || selectedYAxisColumn === void 0 ? void 0 : selectedYAxisColumn.name,
|
|
103
89
|
value: value
|
|
104
90
|
}]
|
|
105
91
|
};
|
|
@@ -134,7 +120,7 @@ class Scatter extends _chartComponent.default {
|
|
|
134
120
|
const {
|
|
135
121
|
globalTheme
|
|
136
122
|
} = this.props;
|
|
137
|
-
const theme =
|
|
123
|
+
const theme = CHART_THEME_COLOR[globalTheme];
|
|
138
124
|
const contentWrapper = event.currentTarget.parentNode;
|
|
139
125
|
|
|
140
126
|
// Remove old mark line wrapper
|
|
@@ -142,7 +128,7 @@ class Scatter extends _chartComponent.default {
|
|
|
142
128
|
markLineWrapper.node() && markLineWrapper.node().remove();
|
|
143
129
|
if (state === 'inActive') {
|
|
144
130
|
// Remove stroke
|
|
145
|
-
d3.select(event.currentTarget).attr('stroke', '').attr('
|
|
131
|
+
d3.select(event.currentTarget).attr('stroke', '').attr('stroke-width', '');
|
|
146
132
|
return;
|
|
147
133
|
}
|
|
148
134
|
if (state === 'active') {
|
|
@@ -187,7 +173,7 @@ class Scatter extends _chartComponent.default {
|
|
|
187
173
|
tables,
|
|
188
174
|
chartColorTheme
|
|
189
175
|
} = this.props;
|
|
190
|
-
const theme =
|
|
176
|
+
const theme = CHART_THEME_COLOR[globalTheme];
|
|
191
177
|
const {
|
|
192
178
|
label_font_size,
|
|
193
179
|
x_axis_column_key,
|
|
@@ -206,9 +192,9 @@ class Scatter extends _chartComponent.default {
|
|
|
206
192
|
bottomLegendSpace
|
|
207
193
|
} = this.chartBoundingClientRect;
|
|
208
194
|
const colorMap = this.getFillColor(data);
|
|
209
|
-
const selectedTable =
|
|
210
|
-
const selectedXAxisColumn =
|
|
211
|
-
const selectedYAxisColumn =
|
|
195
|
+
const selectedTable = getTableById(tables, table_id);
|
|
196
|
+
const selectedXAxisColumn = getTableColumnByKey(selectedTable, x_axis_column_key);
|
|
197
|
+
const selectedYAxisColumn = getTableColumnByKey(selectedTable, y_axis_column_key);
|
|
212
198
|
|
|
213
199
|
// Y axis
|
|
214
200
|
const y = d3.scaleLinear().domain(y_axis_auto_range ? [0, d3.max(data, d => d.value)] : [y_axis_min, y_axis_max]).range([chartHeight - insertPadding - bottomLegendSpace, insertPadding + marginTop]);
|
|
@@ -237,8 +223,8 @@ class Scatter extends _chartComponent.default {
|
|
|
237
223
|
const {
|
|
238
224
|
groupby
|
|
239
225
|
} = d;
|
|
240
|
-
if (groupby
|
|
241
|
-
return
|
|
226
|
+
if (!groupby) {
|
|
227
|
+
return BaseUtils.getCurrentTheme(chartColorTheme).colors[0];
|
|
242
228
|
}
|
|
243
229
|
return colorMap[d.groupby];
|
|
244
230
|
}).attr('data-x', d => x(d.name)).attr('data-y', d => y(d.value)).attr('data-value', d => d.value).attr('data-width', 3.5).attr('data-groupName', d => d.name).attr('cx', d => x(d.name)).attr('cy', d => y(d.value)).attr('r', 3.5).attr('opacity', 0.85).call(g => {
|
|
@@ -266,6 +252,9 @@ class Scatter extends _chartComponent.default {
|
|
|
266
252
|
}).on('mouseleave', (event, data) => {
|
|
267
253
|
this.hiddenTooltip();
|
|
268
254
|
this.handleAcitveAndInActiveState('inActive', event);
|
|
255
|
+
}).call(g => {
|
|
256
|
+
this.animateCircleZoomIn(g);
|
|
257
|
+
this.animateFadeIn(contentWrapper.selectAll('text'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
269
258
|
});
|
|
270
259
|
this.setLegend({
|
|
271
260
|
legendName: 'groupby',
|
|
@@ -286,12 +275,11 @@ class Scatter extends _chartComponent.default {
|
|
|
286
275
|
componentDidMount() {
|
|
287
276
|
this.createChart();
|
|
288
277
|
this.drawChart();
|
|
289
|
-
|
|
290
|
-
window.addEventListener('resize', this.debouncedHandleResize);
|
|
278
|
+
super.componentDidMount();
|
|
291
279
|
}
|
|
292
280
|
componentDidUpdate(prevProps) {
|
|
293
281
|
super.componentDidUpdate(prevProps);
|
|
294
|
-
if (
|
|
282
|
+
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
295
283
|
this.destroyChart();
|
|
296
284
|
this.createChart();
|
|
297
285
|
this.drawChart();
|
|
@@ -299,23 +287,17 @@ class Scatter extends _chartComponent.default {
|
|
|
299
287
|
}
|
|
300
288
|
componentWillUnmount() {
|
|
301
289
|
this.destroyChart();
|
|
302
|
-
|
|
290
|
+
super.componentWillUnmount();
|
|
303
291
|
}
|
|
304
292
|
render() {
|
|
305
|
-
const {
|
|
306
|
-
chart
|
|
307
|
-
} = this.props;
|
|
308
293
|
const {
|
|
309
294
|
tooltipData,
|
|
310
295
|
toolTipPosition
|
|
311
296
|
} = this.state;
|
|
312
|
-
return /*#__PURE__*/
|
|
297
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
313
298
|
ref: ref => this.container = ref,
|
|
314
|
-
className:
|
|
315
|
-
|
|
316
|
-
'show-y-axis-label': this.isShowYAxisLabel(chart)
|
|
317
|
-
})
|
|
318
|
-
}, /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
299
|
+
className: "sea-chart-container"
|
|
300
|
+
}, /*#__PURE__*/React.createElement(ToolTip, {
|
|
319
301
|
tooltipData: tooltipData,
|
|
320
302
|
toolTipPosition: toolTipPosition,
|
|
321
303
|
chart: this.chart
|
|
@@ -323,16 +305,16 @@ class Scatter extends _chartComponent.default {
|
|
|
323
305
|
}
|
|
324
306
|
}
|
|
325
307
|
Scatter.propTypes = {
|
|
326
|
-
canvasStyle:
|
|
327
|
-
chart:
|
|
328
|
-
groupbyColumn:
|
|
329
|
-
columnGroupbyColumn:
|
|
330
|
-
summaryColumn:
|
|
331
|
-
result:
|
|
332
|
-
tables:
|
|
333
|
-
globalTheme:
|
|
334
|
-
chartColorTheme:
|
|
335
|
-
toggleRecords:
|
|
336
|
-
customRender:
|
|
308
|
+
canvasStyle: PropTypes.object,
|
|
309
|
+
chart: PropTypes.object,
|
|
310
|
+
groupbyColumn: PropTypes.object,
|
|
311
|
+
columnGroupbyColumn: PropTypes.object,
|
|
312
|
+
summaryColumn: PropTypes.object,
|
|
313
|
+
result: PropTypes.array,
|
|
314
|
+
tables: PropTypes.array,
|
|
315
|
+
globalTheme: PropTypes.string,
|
|
316
|
+
chartColorTheme: PropTypes.string,
|
|
317
|
+
toggleRecords: PropTypes.func,
|
|
318
|
+
customRender: PropTypes.func
|
|
337
319
|
};
|
|
338
|
-
|
|
320
|
+
export default Scatter;
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _intl = _interopRequireDefault(require("../../../intl"));
|
|
11
|
-
var _twoDimensionTable = _interopRequireDefault(require("./two-dimension-table"));
|
|
12
|
-
var _oneDimensionTableNoNumericColumns = _interopRequireDefault(require("./one-dimension-table-no-numeric-columns"));
|
|
13
|
-
var _oneDimensionTableWithNumericColumns = _interopRequireDefault(require("./one-dimension-table-with-numeric-columns"));
|
|
14
|
-
require("./index.css");
|
|
15
|
-
class Table extends _react.PureComponent {
|
|
1
|
+
import React, { PureComponent } from 'react';
|
|
2
|
+
import intl from '../../../intl';
|
|
3
|
+
import TwoDimensionTable from './two-dimension-table';
|
|
4
|
+
import OneDimensionTableNoNumericColumns from './one-dimension-table-no-numeric-columns';
|
|
5
|
+
import OneDimensionTableWithNumericColumns from './one-dimension-table-with-numeric-columns';
|
|
6
|
+
import './index.css';
|
|
7
|
+
class Table extends PureComponent {
|
|
16
8
|
constructor() {
|
|
17
9
|
super(...arguments);
|
|
18
10
|
this.toggleRecords = (cell, selectedCell) => {
|
|
@@ -31,20 +23,20 @@ class Table extends _react.PureComponent {
|
|
|
31
23
|
} = result;
|
|
32
24
|
if (!groupbyColumn) return null;
|
|
33
25
|
if (Array.isArray(pivot_columns) && pivot_columns.length > 100) {
|
|
34
|
-
return /*#__PURE__*/
|
|
26
|
+
return /*#__PURE__*/React.createElement("div", null, intl.get('There_are_too_many_statistics_entries_to_display'));
|
|
35
27
|
}
|
|
36
28
|
if (columnGroupbyColumn) {
|
|
37
|
-
return /*#__PURE__*/
|
|
29
|
+
return /*#__PURE__*/React.createElement(TwoDimensionTable, Object.assign({}, this.props, {
|
|
38
30
|
toggleRecords: this.toggleRecords
|
|
39
31
|
}));
|
|
40
32
|
}
|
|
41
33
|
if (!Array.isArray(pivot_columns)) return null;
|
|
42
34
|
if (pivot_columns.length < 2) {
|
|
43
|
-
return /*#__PURE__*/
|
|
35
|
+
return /*#__PURE__*/React.createElement(OneDimensionTableNoNumericColumns, Object.assign({}, this.props, {
|
|
44
36
|
toggleRecords: this.toggleRecords
|
|
45
37
|
}));
|
|
46
38
|
}
|
|
47
|
-
return /*#__PURE__*/
|
|
39
|
+
return /*#__PURE__*/React.createElement(OneDimensionTableWithNumericColumns, Object.assign({}, this.props, {
|
|
48
40
|
toggleRecords: this.toggleRecords
|
|
49
41
|
}));
|
|
50
42
|
};
|
|
@@ -53,9 +45,9 @@ class Table extends _react.PureComponent {
|
|
|
53
45
|
const {
|
|
54
46
|
result
|
|
55
47
|
} = this.props;
|
|
56
|
-
return /*#__PURE__*/
|
|
48
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
57
49
|
className: `sea-chart-table-wrapper sea-chart-${result.dimensions}-table-wrapper`
|
|
58
50
|
}, this.renderContainer());
|
|
59
51
|
}
|
|
60
52
|
}
|
|
61
|
-
|
|
53
|
+
export default Table;
|