sea-chart 2.0.38 → 2.0.39
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 +15 -8
- package/dist/components/cell-factory/FormatterConfig.js +62 -55
- package/dist/components/cell-factory/SimpleCellFormatter.js +12 -5
- package/dist/components/cell-factory/SingleSelectOption.js +18 -11
- package/dist/components/cell-factory/cell-editor-factory.js +12 -5
- package/dist/components/cell-factory/cell-formatter-factory.js +11 -4
- package/dist/components/cell-factory/link-content.js +38 -30
- package/dist/components/chart-color-selector/color-selector.js +18 -11
- package/dist/components/collaborator/index.js +14 -7
- package/dist/components/color-picker/index.js +19 -12
- package/dist/components/color-popover/color-rules/color-rule.js +34 -26
- package/dist/components/color-popover/color-rules/index.js +15 -7
- package/dist/components/color-popover/color-rules/rule-filters/filter.js +34 -27
- package/dist/components/color-popover/color-rules/rule-filters/index.js +25 -17
- package/dist/components/color-popover/color-rules/rule-filters/number-input.js +17 -9
- package/dist/components/color-popover/color-rules-popover.js +38 -30
- package/dist/components/color-popover/color-selector-popover.js +20 -12
- package/dist/components/color-setting/color-group-selector.js +21 -13
- package/dist/components/common-add-tool/index.js +15 -8
- package/dist/components/data-process-setter/data-setting-header.js +14 -7
- package/dist/components/data-process-setter/hide-column-setter.js +20 -13
- package/dist/components/data-process-setter/index.js +27 -4
- package/dist/components/data-process-setter/sort-setter.js +26 -18
- package/dist/components/draggable/Draggable.js +13 -7
- package/dist/components/drill-down-settings/drill-down-fields-popover/index.js +48 -40
- package/dist/components/drill-down-settings/drill-down-fields-settings/index.js +18 -10
- package/dist/components/drill-down-settings/index.js +18 -11
- package/dist/components/dtable-popover/index.js +20 -13
- package/dist/components/dtable-search-input/index.js +21 -13
- package/dist/components/font-settings/index.js +22 -14
- package/dist/components/goal-line-setting/goal-setting-item.js +14 -6
- package/dist/components/goal-line-setting/index.js +19 -12
- package/dist/components/highlighter/highlighter.js +14 -7
- package/dist/components/icon/index.js +12 -5
- package/dist/components/index.js +48 -7
- package/dist/components/loading/index.js +13 -6
- package/dist/components/number-input/index.js +11 -4
- package/dist/components/pixel-editor/index.js +23 -15
- package/dist/components/popover/hide-column-popover/hide-column-popover-widgets/hide-column-item.js +15 -8
- package/dist/components/popover/hide-column-popover/hide-column-popover.js +34 -26
- package/dist/components/popover/sort-popover/sort-popover-widgets/sort-utils.js +18 -9
- package/dist/components/popover/sort-popover/sort-popover.js +65 -55
- package/dist/components/resize-handle/ResizeHandle.js +13 -6
- package/dist/components/row-card/row-card-header-cell.js +24 -17
- package/dist/components/row-card/row-card-header.js +22 -15
- package/dist/components/row-card/row-card-item.js +43 -35
- package/dist/components/row-card/row-card.js +25 -17
- package/dist/components/statistic-record-dialog/index.js +64 -56
- package/dist/components/tooltip/index.js +21 -14
- package/dist/components/types-dialog/index.js +70 -62
- package/dist/components/types-dialog/use-force-update.js +10 -4
- package/dist/constants/color-rules.js +14 -8
- package/dist/constants/common-constants.js +14 -8
- package/dist/constants/error.js +8 -2
- package/dist/constants/geolocation.js +15 -9
- package/dist/constants/index.js +271 -142
- package/dist/constants/key-codes.js +2 -0
- package/dist/constants/model.js +9 -3
- package/dist/constants/regions.js +8 -3
- package/dist/constants/style.js +12 -6
- package/dist/constants/table.js +7 -1
- package/dist/constants/type-image.js +39 -33
- package/dist/constants/type.js +9 -3
- package/dist/context.js +20 -13
- package/dist/editor/index.js +15 -8
- package/dist/index.js +104 -13
- package/dist/intl.js +17 -10
- package/dist/locale/index.js +23 -16
- package/dist/locale/lang/de.js +7 -1
- package/dist/locale/lang/en.js +7 -1
- package/dist/locale/lang/es.js +7 -1
- package/dist/locale/lang/fr.js +7 -1
- package/dist/locale/lang/pt.js +7 -1
- package/dist/locale/lang/ru.js +7 -1
- package/dist/locale/lang/zh_CN.js +7 -1
- package/dist/model/area-group.js +19 -12
- package/dist/model/area.js +19 -12
- package/dist/model/bar-custom.js +18 -11
- package/dist/model/bar-group.js +19 -12
- package/dist/model/bar-stack.js +17 -10
- package/dist/model/bar.js +18 -11
- package/dist/model/base-model.js +11 -4
- package/dist/model/basic-number-card.js +20 -13
- package/dist/model/chart.js +13 -7
- package/dist/model/combination.js +22 -15
- package/dist/model/compare-bar.js +21 -14
- package/dist/model/completeness-group.js +18 -11
- package/dist/model/completeness.js +17 -10
- package/dist/model/dashboard.js +14 -7
- package/dist/model/funnel.js +21 -14
- package/dist/model/generic-model.js +143 -135
- package/dist/model/heat-map.js +16 -9
- package/dist/model/horizontal-bar.js +18 -11
- package/dist/model/horizontal-group-bar.js +17 -10
- package/dist/model/index.js +93 -69
- package/dist/model/line-group.js +20 -13
- package/dist/model/line.js +19 -12
- package/dist/model/map-bubble.js +19 -12
- package/dist/model/map.js +19 -12
- package/dist/model/mirror.js +20 -13
- package/dist/model/pie.js +19 -12
- package/dist/model/ring.js +19 -12
- package/dist/model/scatter.js +17 -10
- package/dist/model/stacked-horizontal-bar.js +18 -11
- package/dist/model/table-element.js +12 -5
- package/dist/model/table.js +14 -7
- package/dist/model/tree-map.js +14 -7
- package/dist/model/trend.js +18 -11
- package/dist/model/user.js +7 -1
- package/dist/model/world-map-bubble.js +19 -12
- package/dist/model/world-map.js +19 -12
- package/dist/services/map-json.js +17 -11
- package/dist/settings/advance-bar-settings/data-settings.js +44 -36
- package/dist/settings/advance-bar-settings/index.js +20 -3
- package/dist/settings/advance-bar-settings/style-settings.js +71 -63
- package/dist/settings/bar-settings/data-settings.js +47 -39
- package/dist/settings/bar-settings/index.js +20 -3
- package/dist/settings/bar-settings/style-settings.js +57 -49
- package/dist/settings/basic-number-card/data-settings.js +57 -49
- package/dist/settings/basic-number-card/index.js +20 -3
- package/dist/settings/basic-number-card/style-settings.js +27 -19
- package/dist/settings/combination-settings/data-settings.js +63 -55
- package/dist/settings/combination-settings/index.js +20 -3
- package/dist/settings/combination-settings/style-settings.js +73 -65
- package/dist/settings/completeness-settings/callbacks/callbacks.js +27 -16
- package/dist/settings/completeness-settings/data-settings/completion-settings.js +28 -21
- package/dist/settings/completeness-settings/data-settings/data-settings.js +32 -25
- package/dist/settings/completeness-settings/index.js +20 -3
- package/dist/settings/completeness-settings/style-settings.js +26 -19
- package/dist/settings/dashboard-settings/data-settings.js +51 -43
- package/dist/settings/dashboard-settings/index.js +13 -2
- package/dist/settings/data-settings.js +79 -72
- package/dist/settings/funnel-settings/components/dnd-item/dnd-item.js +19 -12
- package/dist/settings/funnel-settings/components/dnd-list.js +23 -15
- package/dist/settings/funnel-settings/components/funnel-label-setting.js +40 -32
- package/dist/settings/funnel-settings/components/funnel-layer-setting.js +28 -20
- package/dist/settings/funnel-settings/data-settings.js +31 -23
- package/dist/settings/funnel-settings/index.js +20 -3
- package/dist/settings/funnel-settings/style-settings.js +19 -11
- package/dist/settings/heat-map-settings/data-settings.js +26 -18
- package/dist/settings/heat-map-settings/index.js +20 -3
- package/dist/settings/heat-map-settings/style-settings.js +26 -18
- package/dist/settings/horizontal-bar-settings/data-settings.js +19 -12
- package/dist/settings/horizontal-bar-settings/index.js +20 -3
- package/dist/settings/horizontal-bar-settings/style-settings.js +19 -12
- package/dist/settings/index.js +70 -52
- package/dist/settings/map-settings/components/location-field-selector.js +17 -10
- package/dist/settings/map-settings/components/map-level-selector.js +18 -11
- package/dist/settings/map-settings/components/map-province-city-selector.js +26 -19
- package/dist/settings/map-settings/index.js +20 -3
- package/dist/settings/map-settings/map-data-settings.js +30 -23
- package/dist/settings/map-settings/map-style-settings.js +35 -27
- package/dist/settings/mirror-settings/data-settings.js +34 -26
- package/dist/settings/mirror-settings/index.js +13 -2
- package/dist/settings/pie-settings/data-settings.js +41 -33
- package/dist/settings/pie-settings/index.js +20 -3
- package/dist/settings/pie-settings/style-settings.js +55 -47
- package/dist/settings/scatter/data-settings.js +34 -27
- package/dist/settings/scatter/index.js +12 -3
- package/dist/settings/stacks-settings/index.js +27 -19
- package/dist/settings/stacks-settings/stack-item-settings.js +27 -19
- package/dist/settings/style-settings.js +73 -65
- package/dist/settings/table-element-settings/components/data-filter.js +38 -30
- package/dist/settings/table-element-settings/data-settings.js +29 -21
- package/dist/settings/table-element-settings/index.js +13 -2
- package/dist/settings/table-settings/data-settings.js +120 -112
- package/dist/settings/table-settings/index.js +13 -2
- package/dist/settings/time-comparison-settings/data-settings.js +51 -43
- package/dist/settings/time-comparison-settings/index.js +20 -3
- package/dist/settings/time-comparison-settings/style-settings.js +50 -42
- package/dist/settings/trend-settings/data-settings.js +32 -24
- package/dist/settings/trend-settings/index.js +20 -3
- package/dist/settings/trend-settings/style-setting.js +27 -19
- package/dist/settings/widgets/basic-summary/index.js +63 -55
- package/dist/settings/widgets/chart-type/index.js +26 -18
- package/dist/settings/widgets/color-settings/index.js +80 -72
- package/dist/settings/widgets/common-data-settings.js +29 -21
- package/dist/settings/widgets/data-filter/index.js +43 -35
- package/dist/settings/widgets/data-sort.js +24 -16
- package/dist/settings/widgets/date-summary-item.js +34 -26
- package/dist/settings/widgets/display-values-settings/index.js +22 -14
- package/dist/settings/widgets/divider/index.js +16 -8
- package/dist/settings/widgets/font-settings/font-color-settings.js +19 -11
- package/dist/settings/widgets/font-settings/font-size-settings.js +22 -14
- package/dist/settings/widgets/font-settings/font-weight-settings.js +25 -17
- package/dist/settings/widgets/font-settings/index.js +27 -4
- package/dist/settings/widgets/group-by.js +59 -51
- package/dist/settings/widgets/min-max-setting.js +18 -10
- package/dist/settings/widgets/mininum-slice-percent.js +18 -10
- package/dist/settings/widgets/numeric-summary-item.js +33 -25
- package/dist/settings/widgets/select-line-type/index.js +17 -10
- package/dist/settings/widgets/select-table/index.js +16 -9
- package/dist/settings/widgets/select-view/index.js +28 -20
- package/dist/settings/widgets/stack.js +22 -14
- package/dist/settings/widgets/summary-method-setting.js +25 -17
- package/dist/settings/widgets/summary-settings.js +82 -74
- package/dist/settings/widgets/switch/index.js +16 -9
- package/dist/settings/widgets/text-horizontal-settings.js +23 -15
- package/dist/settings/widgets/time-picker.js +37 -29
- package/dist/settings/widgets/title-settings/index.js +37 -29
- package/dist/settings/widgets/title-settings/title-text.js +12 -5
- package/dist/settings/widgets/x-axios.js +1 -0
- package/dist/settings/widgets/y-axis-group-settings.js +72 -64
- package/dist/utils/cell-format-utils.js +27 -17
- package/dist/utils/cell-value-utils.js +11 -4
- package/dist/utils/chart-utils/base-utils.js +332 -324
- package/dist/utils/chart-utils/index.js +41 -28
- package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +84 -77
- package/dist/utils/chart-utils/original-data-utils/card-calculator.js +20 -13
- package/dist/utils/chart-utils/original-data-utils/combination-calculator.js +52 -45
- package/dist/utils/chart-utils/original-data-utils/compare-bar-chart-calculator.js +28 -21
- package/dist/utils/chart-utils/original-data-utils/completeness-calculator.js +40 -33
- package/dist/utils/chart-utils/original-data-utils/dashboard-calculator.js +23 -16
- package/dist/utils/chart-utils/original-data-utils/index.js +57 -50
- package/dist/utils/chart-utils/original-data-utils/mirror-calculator.js +26 -19
- package/dist/utils/chart-utils/original-data-utils/pivot-table-calculator.js +96 -90
- package/dist/utils/chart-utils/original-data-utils/scatter-calculator.js +26 -19
- package/dist/utils/chart-utils/original-data-utils/trend-calculator.js +38 -31
- package/dist/utils/chart-utils/sql-statistics-utils.js +237 -229
- package/dist/utils/chart.js +17 -9
- package/dist/utils/collaborator-manager.js +9 -3
- package/dist/utils/collaborator-utils.js +31 -19
- package/dist/utils/collaborator.js +15 -6
- package/dist/utils/color-utils.js +29 -18
- package/dist/utils/column-utils.js +104 -77
- package/dist/utils/common-utils.js +53 -28
- package/dist/utils/concurrency-manager.js +7 -1
- package/dist/utils/contexts.js +12 -5
- package/dist/utils/date-translate.js +20 -12
- package/dist/utils/digital-sign-utils.js +14 -7
- package/dist/utils/event-bus.js +7 -1
- package/dist/utils/hotkey.js +11 -5
- package/dist/utils/index.js +221 -54
- package/dist/utils/key-generator.js +9 -2
- package/dist/utils/map.js +31 -22
- package/dist/utils/object-utils.js +8 -2
- package/dist/utils/options-utils.js +18 -10
- package/dist/utils/row-record-utils.js +178 -166
- package/dist/utils/row-utils.js +38 -27
- package/dist/utils/search.js +32 -24
- package/dist/utils/sql/chart-data-sql.js +112 -106
- package/dist/utils/sql/column-2-sql-column.js +168 -158
- package/dist/utils/sql/index.js +27 -3
- package/dist/utils/trend-utils.js +47 -39
- package/dist/view/index.js +96 -90
- package/dist/view/title/index.js +24 -16
- package/dist/view/wrapper/area-group.js +53 -45
- package/dist/view/wrapper/area.js +51 -43
- package/dist/view/wrapper/bar-compare.js +46 -38
- package/dist/view/wrapper/bar-custom-stack.js +47 -39
- package/dist/view/wrapper/bar-group.js +53 -45
- package/dist/view/wrapper/bar-stack.js +56 -48
- package/dist/view/wrapper/bar.js +48 -40
- package/dist/view/wrapper/basic-number-card.js +34 -26
- package/dist/view/wrapper/chart-component.js +131 -123
- package/dist/view/wrapper/combination.js +63 -55
- package/dist/view/wrapper/completeness-group.js +48 -40
- package/dist/view/wrapper/completeness.js +44 -36
- package/dist/view/wrapper/dashboard.js +44 -39
- package/dist/view/wrapper/funnel.js +43 -40
- package/dist/view/wrapper/heat-map.js +70 -62
- package/dist/view/wrapper/horizontal-bar-group.js +60 -52
- package/dist/view/wrapper/horizontal-bar-stack.js +55 -47
- package/dist/view/wrapper/horizontal-bar.js +49 -41
- package/dist/view/wrapper/index.js +115 -107
- package/dist/view/wrapper/line-group.js +51 -43
- package/dist/view/wrapper/line.js +50 -42
- package/dist/view/wrapper/map-bubble.js +48 -40
- package/dist/view/wrapper/map-world-bubble.js +47 -39
- package/dist/view/wrapper/map-world.js +49 -41
- package/dist/view/wrapper/map.js +50 -42
- package/dist/view/wrapper/mirror.js +49 -41
- package/dist/view/wrapper/pie.js +52 -44
- package/dist/view/wrapper/ring.js +57 -49
- package/dist/view/wrapper/scatter.js +50 -42
- package/dist/view/wrapper/table/index.js +22 -14
- package/dist/view/wrapper/table/one-dimension-table-no-numeric-columns.js +57 -49
- package/dist/view/wrapper/table/one-dimension-table-with-numeric-columns.js +61 -53
- package/dist/view/wrapper/table/pivot-table-display-name.js +90 -82
- package/dist/view/wrapper/table/two-dimension-table.js +93 -85
- package/dist/view/wrapper/table-element/components/dataset-utils.js +36 -23
- package/dist/view/wrapper/table-element/components/formatter.js +99 -90
- package/dist/view/wrapper/table-element/components/formatters/FileFormatter/index.js +32 -23
- package/dist/view/wrapper/table-element/components/formatters/formula-formatter.js +16 -9
- package/dist/view/wrapper/table-element/components/formatters/link-formatter.js +97 -90
- package/dist/view/wrapper/table-element/components/formula-formatter.js +16 -9
- package/dist/view/wrapper/table-element/components/link-formatter.js +97 -90
- package/dist/view/wrapper/table-element/components/record.js +20 -13
- package/dist/view/wrapper/table-element/components/records-body.js +17 -9
- package/dist/view/wrapper/table-element/components/records-header/index.js +15 -7
- package/dist/view/wrapper/table-element/components/records-header/records-header-cell.js +16 -8
- package/dist/view/wrapper/table-element/components/records.js +33 -25
- package/dist/view/wrapper/table-element/components/resize-column-handle/resize-column-handle.js +12 -5
- package/dist/view/wrapper/table-element/components/utils.js +16 -6
- package/dist/view/wrapper/table-element/components/value-display-utils.js +11 -4
- package/dist/view/wrapper/table-element/components/vertical-scrollbar/index.js +13 -6
- package/dist/view/wrapper/table-element/index.js +26 -18
- package/dist/view/wrapper/treemap.js +46 -38
- package/dist/view/wrapper/trend.js +66 -58
- package/package.json +1 -1
package/dist/view/wrapper/bar.js
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
var _lodashEs = require("lodash-es");
|
|
12
|
+
var d3 = _interopRequireWildcard(require("d3"));
|
|
13
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
|
+
var _constants = require("../../constants");
|
|
15
|
+
var _utils = require("../../utils");
|
|
16
|
+
var _colorUtils = require("../../utils/color-utils");
|
|
17
|
+
var _intl = _interopRequireDefault(require("../../intl"));
|
|
18
|
+
var _tooltip = _interopRequireDefault(require("../../components/tooltip"));
|
|
19
|
+
var _chartComponent = _interopRequireDefault(require("./chart-component"));
|
|
20
|
+
class Bar extends _chartComponent.default {
|
|
13
21
|
constructor(props) {
|
|
14
22
|
super(props);
|
|
15
23
|
this.handleResize = () => {
|
|
@@ -42,11 +50,11 @@ class Bar extends ChartComponent {
|
|
|
42
50
|
let {
|
|
43
51
|
result: data
|
|
44
52
|
} = this.props;
|
|
45
|
-
data = BaseUtils.formatEmptyName(data, '',
|
|
53
|
+
data = _utils.BaseUtils.formatEmptyName(data, '', _intl.default.get('Empty'));
|
|
46
54
|
if (!Array.isArray(data)) return;
|
|
47
55
|
this.draw(data);
|
|
48
56
|
this.renderAxisLabel(this.props.chart, this.props.tables, this.container);
|
|
49
|
-
isFunction(customRender) && customRender(this.chart);
|
|
57
|
+
(0, _utils.isFunction)(customRender) && customRender(this.chart);
|
|
50
58
|
};
|
|
51
59
|
this.getFillColor = data => {
|
|
52
60
|
const {
|
|
@@ -58,12 +66,12 @@ class Bar extends ChartComponent {
|
|
|
58
66
|
color_option,
|
|
59
67
|
y_axis_label_color_rules
|
|
60
68
|
} = chart.config;
|
|
61
|
-
let chartBarColor = y_axis_label_color || CHART_STYLE_COLORS[0];
|
|
69
|
+
let chartBarColor = y_axis_label_color || _constants.CHART_STYLE_COLORS[0];
|
|
62
70
|
if (chartColorTheme) {
|
|
63
|
-
chartBarColor = BaseUtils.getCurrentTheme(chartColorTheme).colors[0];
|
|
71
|
+
chartBarColor = _utils.BaseUtils.getCurrentTheme(chartColorTheme).colors[0];
|
|
64
72
|
}
|
|
65
|
-
const colorRules = color_option === TYPE_COLOR_USING.USE_RULES && y_axis_label_color_rules && getConvertedColorRules(y_axis_label_color_rules);
|
|
66
|
-
const color = getLabelColor({
|
|
73
|
+
const colorRules = color_option === _constants.TYPE_COLOR_USING.USE_RULES && y_axis_label_color_rules && (0, _colorUtils.getConvertedColorRules)(y_axis_label_color_rules);
|
|
74
|
+
const color = (0, _colorUtils.getLabelColor)({
|
|
67
75
|
chart: chart.config,
|
|
68
76
|
colorRules,
|
|
69
77
|
value: data.value
|
|
@@ -87,7 +95,7 @@ class Bar extends ChartComponent {
|
|
|
87
95
|
items: [{
|
|
88
96
|
color: this.getFillColor(data),
|
|
89
97
|
name: data.name,
|
|
90
|
-
value: BaseUtils.getSummaryValueDisplayString(summaryColumn, Number(data.value), y_axis_summary_method)
|
|
98
|
+
value: _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, Number(data.value), y_axis_summary_method)
|
|
91
99
|
}]
|
|
92
100
|
};
|
|
93
101
|
this.setState({
|
|
@@ -129,7 +137,7 @@ class Bar extends ChartComponent {
|
|
|
129
137
|
tables,
|
|
130
138
|
summaryColumn
|
|
131
139
|
} = this.props;
|
|
132
|
-
const theme = CHART_THEME_COLOR[globalTheme];
|
|
140
|
+
const theme = _constants.CHART_THEME_COLOR[globalTheme];
|
|
133
141
|
const {
|
|
134
142
|
display_goal_line,
|
|
135
143
|
goal_value,
|
|
@@ -157,11 +165,11 @@ class Bar extends ChartComponent {
|
|
|
157
165
|
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, insertPadding + marginTop]);
|
|
158
166
|
|
|
159
167
|
// Y axis
|
|
160
|
-
this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform',
|
|
168
|
+
this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform', "translate(".concat(insertPadding, ", 0)")).call(d3.axisLeft(y).tickSizeInner(0).ticks(5).tickFormat(d => _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, d, y_axis_summary_method))).call(g => this.drawYaxis(g, theme));
|
|
161
169
|
const x = d3.scaleBand().domain(data.map(item => item.name)).range([insertPadding + this.horizontalOverflowOffset, chartWidth - insertPadding]).paddingInner(0.5).paddingOuter(0.1);
|
|
162
170
|
|
|
163
171
|
// X axis
|
|
164
|
-
this.chart.append('g').attr('class', 'x-axis-wrapper').attr('transform',
|
|
172
|
+
this.chart.append('g').attr('class', 'x-axis-wrapper').attr('transform', "translate(0, ".concat(chartHeight - insertPadding, ")")).call(d3.axisBottom(x).tickSizeOuter(0).tickSizeInner(5)).call(g => {
|
|
165
173
|
g.selectAll('.domain').attr('stroke', theme.XAxisColor);
|
|
166
174
|
g.selectAll('.tick line').attr('stroke', theme.XAxisColor);
|
|
167
175
|
g.selectAll('text').attr('font-size', theme.fontSize);
|
|
@@ -180,7 +188,7 @@ class Bar extends ChartComponent {
|
|
|
180
188
|
y: Number(path.dataset.y),
|
|
181
189
|
theme,
|
|
182
190
|
label_font_size,
|
|
183
|
-
text: BaseUtils.getSummaryValueDisplayString(summaryColumn, Number(path.dataset.value), y_axis_summary_method)
|
|
191
|
+
text: _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, Number(path.dataset.value), y_axis_summary_method)
|
|
184
192
|
});
|
|
185
193
|
}
|
|
186
194
|
// add rect borderRadius
|
|
@@ -214,12 +222,12 @@ class Bar extends ChartComponent {
|
|
|
214
222
|
componentDidMount() {
|
|
215
223
|
this.createChart();
|
|
216
224
|
this.drawChart();
|
|
217
|
-
this.debouncedHandleResize = debounce(this.handleResize, 300);
|
|
225
|
+
this.debouncedHandleResize = (0, _lodashEs.debounce)(this.handleResize, 300);
|
|
218
226
|
window.addEventListener('resize', this.debouncedHandleResize);
|
|
219
227
|
}
|
|
220
228
|
componentDidUpdate(prevProps) {
|
|
221
229
|
super.componentDidUpdate(prevProps);
|
|
222
|
-
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
230
|
+
if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
223
231
|
this.destroyChart();
|
|
224
232
|
this.createChart();
|
|
225
233
|
this.drawChart();
|
|
@@ -237,13 +245,13 @@ class Bar extends ChartComponent {
|
|
|
237
245
|
tooltipData,
|
|
238
246
|
toolTipPosition
|
|
239
247
|
} = this.state;
|
|
240
|
-
return /*#__PURE__*/
|
|
248
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
241
249
|
ref: ref => this.container = ref,
|
|
242
|
-
className:
|
|
250
|
+
className: (0, _classnames.default)('sea-chart-container', {
|
|
243
251
|
'show-x-axis-label': this.isShowXAxisLabel(chart),
|
|
244
252
|
'show-y-axis-label': this.isShowYAxisLabel(chart)
|
|
245
253
|
})
|
|
246
|
-
}, /*#__PURE__*/
|
|
254
|
+
}, /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
247
255
|
tooltipData: tooltipData,
|
|
248
256
|
toolTipPosition: toolTipPosition,
|
|
249
257
|
chart: this.chart
|
|
@@ -251,16 +259,16 @@ class Bar extends ChartComponent {
|
|
|
251
259
|
}
|
|
252
260
|
}
|
|
253
261
|
Bar.propTypes = {
|
|
254
|
-
canvasStyle:
|
|
255
|
-
chart:
|
|
256
|
-
groupbyColumn:
|
|
257
|
-
columnGroupbyColumn:
|
|
258
|
-
summaryColumn:
|
|
259
|
-
result:
|
|
260
|
-
tables:
|
|
261
|
-
globalTheme:
|
|
262
|
-
chartColorTheme:
|
|
263
|
-
toggleRecords:
|
|
264
|
-
customRender:
|
|
262
|
+
canvasStyle: _propTypes.default.object,
|
|
263
|
+
chart: _propTypes.default.object,
|
|
264
|
+
groupbyColumn: _propTypes.default.object,
|
|
265
|
+
columnGroupbyColumn: _propTypes.default.object,
|
|
266
|
+
summaryColumn: _propTypes.default.object,
|
|
267
|
+
result: _propTypes.default.array,
|
|
268
|
+
tables: _propTypes.default.array,
|
|
269
|
+
globalTheme: _propTypes.default.string,
|
|
270
|
+
chartColorTheme: _propTypes.default.string,
|
|
271
|
+
toggleRecords: _propTypes.default.func,
|
|
272
|
+
customRender: _propTypes.default.func
|
|
265
273
|
};
|
|
266
|
-
|
|
274
|
+
var _default = exports.default = Bar;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _dtableUtils = require("dtable-utils");
|
|
11
|
+
var _utils = require("../../utils");
|
|
12
|
+
var _intl = _interopRequireDefault(require("../../intl"));
|
|
13
|
+
var _constants = require("../../constants");
|
|
14
|
+
class BasicNumericCard extends _react.Component {
|
|
7
15
|
constructor(props) {
|
|
8
16
|
super(props);
|
|
9
17
|
this.setCurrentLineHeight = () => {
|
|
@@ -17,7 +25,7 @@ class BasicNumericCard extends Component {
|
|
|
17
25
|
const currentLineHeight = parseFloat(computedStyle.lineHeight);
|
|
18
26
|
const currentLabelHeight = parseFloat(computedStyle.height);
|
|
19
27
|
if (prevLineHeight === currentLineHeight && prevLabelHeight === currentLabelHeight) return;
|
|
20
|
-
if (isNumber(currentLineHeight) && isNumber(currentLabelHeight)) {
|
|
28
|
+
if ((0, _dtableUtils.isNumber)(currentLineHeight) && (0, _dtableUtils.isNumber)(currentLabelHeight)) {
|
|
21
29
|
this.setState({
|
|
22
30
|
currentLineHeight,
|
|
23
31
|
currentLabelHeight
|
|
@@ -43,7 +51,7 @@ class BasicNumericCard extends Component {
|
|
|
43
51
|
}
|
|
44
52
|
};
|
|
45
53
|
this.formatData = data => {
|
|
46
|
-
if (!data && data !== 0) return
|
|
54
|
+
if (!data && data !== 0) return _intl.default.get(_constants.EMPTY_NAME);
|
|
47
55
|
const {
|
|
48
56
|
chart,
|
|
49
57
|
summaryColumn
|
|
@@ -53,8 +61,8 @@ class BasicNumericCard extends Component {
|
|
|
53
61
|
summary_method
|
|
54
62
|
} = chart.config;
|
|
55
63
|
// COUNT / SUMMARIZE_A_FIELD
|
|
56
|
-
if (summary_type !== BASIC_NUMBER_CARD_CALCULATION_METHOD) {
|
|
57
|
-
const formattedContent = BaseUtils.getSummaryValueDisplayString(summaryColumn, data, summary_method);
|
|
64
|
+
if (summary_type !== _constants.BASIC_NUMBER_CARD_CALCULATION_METHOD) {
|
|
65
|
+
const formattedContent = _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, data, summary_method);
|
|
58
66
|
return formattedContent;
|
|
59
67
|
}
|
|
60
68
|
let string = data + '';
|
|
@@ -100,7 +108,7 @@ class BasicNumericCard extends Component {
|
|
|
100
108
|
chart,
|
|
101
109
|
result
|
|
102
110
|
} = this.props;
|
|
103
|
-
const theme = CHART_THEME_COLOR[globalTheme];
|
|
111
|
+
const theme = _constants.CHART_THEME_COLOR[globalTheme];
|
|
104
112
|
const {
|
|
105
113
|
config
|
|
106
114
|
} = chart;
|
|
@@ -119,47 +127,47 @@ class BasicNumericCard extends Component {
|
|
|
119
127
|
const numericValue = typeof result === 'object' && result !== null ? result.value : result;
|
|
120
128
|
let content = null;
|
|
121
129
|
if (summary_method === 'Distinct_values') {
|
|
122
|
-
content = isNumber(numericValue) ? numericValue : 0;
|
|
130
|
+
content = (0, _dtableUtils.isNumber)(numericValue) ? numericValue : 0;
|
|
123
131
|
} else {
|
|
124
132
|
content = this.formatData(numericValue);
|
|
125
133
|
}
|
|
126
|
-
return /*#__PURE__*/
|
|
134
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
127
135
|
className: "sea-chart-container plugin-number-card"
|
|
128
|
-
}, /*#__PURE__*/
|
|
136
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
129
137
|
style: {
|
|
130
138
|
color: theme.cardColor,
|
|
131
139
|
width: '100%',
|
|
132
140
|
height: '100%',
|
|
133
141
|
position: 'relative'
|
|
134
142
|
}
|
|
135
|
-
}, /*#__PURE__*/
|
|
143
|
+
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
136
144
|
style: {
|
|
137
145
|
position: 'absolute',
|
|
138
146
|
width: '100%',
|
|
139
147
|
top: 'calc((100% - 25px)/2)',
|
|
140
148
|
transform: 'translateY(-50%)',
|
|
141
|
-
fontSize:
|
|
149
|
+
fontSize: "".concat(font_size, "px"),
|
|
142
150
|
margin: '-8px 0 2px 0',
|
|
143
|
-
textAlign:
|
|
144
|
-
fontWeight:
|
|
145
|
-
color:
|
|
151
|
+
textAlign: "".concat(text_align),
|
|
152
|
+
fontWeight: "".concat(font_weight),
|
|
153
|
+
color: "".concat(font_color)
|
|
146
154
|
}
|
|
147
|
-
}, /*#__PURE__*/
|
|
155
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
148
156
|
onClick: this.handleClickNumber,
|
|
149
157
|
style: {
|
|
150
158
|
cursor: 'pointer'
|
|
151
159
|
}
|
|
152
|
-
}, content)), /*#__PURE__*/
|
|
160
|
+
}, content)), /*#__PURE__*/_react.default.createElement("p", {
|
|
153
161
|
ref: ref => this.labelRef = ref,
|
|
154
162
|
style: {
|
|
155
163
|
position: 'absolute',
|
|
156
164
|
width: '100%',
|
|
157
165
|
bottom: '0px',
|
|
158
166
|
margin: '0',
|
|
159
|
-
transform: currentLineHeight ?
|
|
160
|
-
fontSize:
|
|
161
|
-
fontWeight:
|
|
162
|
-
textAlign:
|
|
167
|
+
transform: currentLineHeight ? "translateY(".concat(currentLabelHeight - currentLineHeight, "px)") : '',
|
|
168
|
+
fontSize: "".concat(card_label_font_size, "px"),
|
|
169
|
+
fontWeight: "".concat(label_font_weight),
|
|
170
|
+
textAlign: "".concat(label_text_align),
|
|
163
171
|
color: label_font_color,
|
|
164
172
|
overflow: 'hidden',
|
|
165
173
|
textOverflow: 'ellipsis',
|
|
@@ -170,4 +178,4 @@ class BasicNumericCard extends Component {
|
|
|
170
178
|
}, name)));
|
|
171
179
|
}
|
|
172
180
|
}
|
|
173
|
-
|
|
181
|
+
var _default = exports.default = BasicNumericCard;
|