sea-chart 1.1.64 → 2.0.0
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 +13 -6
- package/dist/assets/css/sea-chart-d3-tooltip.css +64 -0
- package/dist/components/cell-factory/FormatterConfig.js +62 -55
- package/dist/components/cell-factory/SimpleCellFormatter.js +11 -4
- 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 +35 -27
- 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 +18 -11
- package/dist/components/color-popover/color-rules/color-rule.js +33 -25
- package/dist/components/color-popover/color-rules/index.js +14 -6
- 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 +33 -25
- package/dist/components/color-popover/color-selector-popover.js +18 -10
- package/dist/components/color-setting/color-group-selector.js +20 -12
- package/dist/components/common-add-tool/index.js +13 -6
- package/dist/components/data-process-setter/data-setting-header.js +14 -7
- package/dist/components/data-process-setter/hide-column-setter.js +19 -12
- package/dist/components/data-process-setter/index.js +27 -4
- package/dist/components/data-process-setter/sort-setter.js +24 -16
- 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 +14 -7
- package/dist/components/popover/hide-column-popover/hide-column-popover.js +35 -27
- 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 +22 -15
- package/dist/components/row-card/row-card-header.js +21 -14
- package/dist/components/row-card/row-card-item.js +41 -33
- package/dist/components/row-card/row-card.js +23 -15
- package/dist/components/statistic-record-dialog/index.js +63 -55
- package/dist/components/types-dialog/index.js +63 -55
- 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 +19 -12
- package/dist/editor/index.js +15 -12
- 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 +17 -10
- 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 +13 -7
- package/dist/settings/advance-bar-settings/data-settings.js +46 -42
- package/dist/settings/advance-bar-settings/index.js +20 -3
- package/dist/settings/advance-bar-settings/style-settings.js +73 -69
- package/dist/settings/bar-settings/data-settings.js +49 -45
- package/dist/settings/bar-settings/index.js +20 -3
- package/dist/settings/bar-settings/style-settings.js +59 -55
- 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 +26 -18
- package/dist/settings/combination-settings/data-settings.js +65 -60
- package/dist/settings/combination-settings/index.js +20 -3
- package/dist/settings/combination-settings/style-settings.js +74 -69
- 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 +30 -22
- 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 +75 -58
- 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 +34 -26
- 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 +72 -64
- package/dist/settings/table-element-settings/components/data-filter.js +37 -29
- 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 +119 -111
- 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 +25 -17
- package/dist/settings/widgets/basic-summary/index.js +66 -66
- package/dist/settings/widgets/chart-type/index.js +34 -19
- package/dist/settings/widgets/color-settings/index.js +80 -72
- package/dist/settings/widgets/common-data-settings.js +30 -25
- package/dist/settings/widgets/data-filter/index.js +40 -32
- package/dist/settings/widgets/data-sort.js +24 -16
- package/dist/settings/widgets/date-summary-item.js +32 -24
- 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 +31 -23
- 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 +80 -72
- package/dist/settings/widgets/switch/index.js +15 -8
- 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 +71 -63
- package/dist/utils/cell-format-utils.js +29 -19
- package/dist/utils/cell-value-utils.js +11 -4
- package/dist/utils/chart-utils/base-utils.js +290 -279
- package/dist/utils/chart-utils/index.js +39 -26
- 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 +26 -19
- package/dist/utils/chart-utils/original-data-utils/completeness-calculator.js +39 -32
- 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 +25 -18
- package/dist/utils/chart-utils/original-data-utils/trend-calculator.js +34 -27
- 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 +30 -18
- package/dist/utils/collaborator.js +13 -4
- package/dist/utils/color-utils.js +29 -18
- package/dist/utils/column-utils.js +88 -63
- package/dist/utils/common-utils.js +52 -27
- package/dist/utils/concurrency-manager.js +7 -1
- package/dist/utils/contexts.js +11 -4
- package/dist/utils/custom-g2.js +241 -212
- package/dist/utils/date-translate.js +19 -11
- 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 +219 -53
- package/dist/utils/key-generator.js +9 -2
- package/dist/utils/map.js +31 -22
- package/dist/utils/object-utils.js +7 -1
- package/dist/utils/options-utils.js +16 -8
- package/dist/utils/row-record-utils.js +164 -152
- package/dist/utils/row-utils.js +38 -27
- package/dist/utils/search.js +32 -24
- package/dist/utils/sql/chart-data-sql.js +55 -49
- package/dist/utils/sql/column-2-sql-column.js +153 -143
- package/dist/utils/sql/index.js +27 -3
- package/dist/utils/trend-utils.js +45 -37
- package/dist/view/index.js +96 -87
- package/dist/view/title/index.js +23 -15
- package/dist/view/wrapper/area.js +46 -39
- package/dist/view/wrapper/bar-custom.js +40 -33
- package/dist/view/wrapper/bar-group.js +58 -51
- package/dist/view/wrapper/bar.js +42 -35
- package/dist/view/wrapper/basic-number-card.js +25 -17
- package/dist/view/wrapper/chart-component.js +116 -54
- package/dist/view/wrapper/combination.js +82 -75
- package/dist/view/wrapper/compare.js +57 -50
- package/dist/view/wrapper/completeness.js +32 -24
- package/dist/view/wrapper/dashboard.js +21 -14
- package/dist/view/wrapper/funnel.js +26 -19
- package/dist/view/wrapper/heat-map.js +60 -53
- package/dist/view/wrapper/horizontal-bar-group.js +48 -41
- package/dist/view/wrapper/horizontal-bar.js +39 -32
- package/dist/view/wrapper/horizontal-component.js +23 -15
- package/dist/view/wrapper/index.js +148 -96
- package/dist/view/wrapper/line-group.js +41 -34
- package/dist/view/wrapper/line.js +39 -32
- package/dist/view/wrapper/map.js +54 -46
- package/dist/view/wrapper/mirror.js +38 -31
- package/dist/view/wrapper/pie.js +50 -43
- package/dist/view/wrapper/ring.js +59 -52
- package/dist/view/wrapper/scatter.js +30 -22
- package/dist/view/wrapper/table/index.js +21 -13
- 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 +58 -50
- package/dist/view/wrapper/table/pivot-table-display-name.js +90 -82
- package/dist/view/wrapper/table/two-dimension-table.js +84 -76
- package/dist/view/wrapper/table-element/components/dataset-utils.js +36 -23
- package/dist/view/wrapper/table-element/components/formatter.js +98 -89
- package/dist/view/wrapper/table-element/components/formatters/FileFormatter/index.js +31 -22
- package/dist/view/wrapper/table-element/components/formatters/formula-formatter.js +16 -9
- package/dist/view/wrapper/table-element/components/formatters/link-formatter.js +80 -73
- package/dist/view/wrapper/table-element/components/formula-formatter.js +16 -9
- package/dist/view/wrapper/table-element/components/link-formatter.js +80 -73
- package/dist/view/wrapper/table-element/components/record.js +17 -10
- package/dist/view/wrapper/table-element/components/records-body.js +17 -9
- package/dist/view/wrapper/table-element/components/records-header/index.js +16 -8
- package/dist/view/wrapper/table-element/components/records-header/records-header-cell.js +16 -8
- package/dist/view/wrapper/table-element/components/records.js +29 -21
- package/dist/view/wrapper/table-element/components/resize-column-handle/resize-column-handle.js +13 -6
- package/dist/view/wrapper/table-element/components/utils.js +15 -5
- 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 +24 -16
- package/dist/view/wrapper/treemap.js +43 -36
- package/dist/view/wrapper/trend.js +47 -39
- package/dist/view/wrapper/world-map.js +60 -52
- package/dist/view/wrapper/wrappers-d3/bar.js +262 -0
- package/package.json +15 -17
|
@@ -1,13 +1,21 @@
|
|
|
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 _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _utils = require("../../utils");
|
|
12
|
+
var _intl = _interopRequireDefault(require("../../intl"));
|
|
13
|
+
var _constants = require("../../constants");
|
|
14
|
+
class Trend extends _react.Component {
|
|
7
15
|
constructor() {
|
|
8
16
|
super(...arguments);
|
|
9
17
|
this.formatData = data => {
|
|
10
|
-
if (!data && data !== 0) return
|
|
18
|
+
if (!data && data !== 0) return _intl.default.get(_constants.EMPTY_NAME);
|
|
11
19
|
const {
|
|
12
20
|
chart,
|
|
13
21
|
summaryColumn
|
|
@@ -15,8 +23,8 @@ class Trend extends Component {
|
|
|
15
23
|
const {
|
|
16
24
|
summary_method
|
|
17
25
|
} = chart.config;
|
|
18
|
-
if (summary_method !== BASIC_NUMBER_CARD_CALCULATION_METHOD) {
|
|
19
|
-
const formattedContent = BaseUtils.getSummaryValueDisplayString(summaryColumn, data, summary_method);
|
|
26
|
+
if (summary_method !== _constants.BASIC_NUMBER_CARD_CALCULATION_METHOD) {
|
|
27
|
+
const formattedContent = _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, data, summary_method);
|
|
20
28
|
return formattedContent;
|
|
21
29
|
}
|
|
22
30
|
let string = data + '';
|
|
@@ -55,20 +63,20 @@ class Trend extends Component {
|
|
|
55
63
|
date_granularity
|
|
56
64
|
} = config;
|
|
57
65
|
let conjunctions = '';
|
|
58
|
-
if (date_granularity === CHART_SUMMARY_TYPE.YEAR) {
|
|
59
|
-
conjunctions =
|
|
60
|
-
} else if (date_granularity === CHART_SUMMARY_TYPE.QUARTER) {
|
|
61
|
-
conjunctions =
|
|
62
|
-
} else if (date_granularity === CHART_SUMMARY_TYPE.MONTH) {
|
|
63
|
-
conjunctions =
|
|
64
|
-
} else if (date_granularity === CHART_SUMMARY_TYPE.WEEK) {
|
|
65
|
-
conjunctions =
|
|
66
|
+
if (date_granularity === _constants.CHART_SUMMARY_TYPE.YEAR) {
|
|
67
|
+
conjunctions = _intl.default.get('The_year_before_last');
|
|
68
|
+
} else if (date_granularity === _constants.CHART_SUMMARY_TYPE.QUARTER) {
|
|
69
|
+
conjunctions = _intl.default.get('The_quarter_before_last');
|
|
70
|
+
} else if (date_granularity === _constants.CHART_SUMMARY_TYPE.MONTH) {
|
|
71
|
+
conjunctions = _intl.default.get('The_month_before_last');
|
|
72
|
+
} else if (date_granularity === _constants.CHART_SUMMARY_TYPE.WEEK) {
|
|
73
|
+
conjunctions = _intl.default.get('The_week_before_last');
|
|
66
74
|
} else if (date_granularity === 'days_7') {
|
|
67
|
-
conjunctions =
|
|
75
|
+
conjunctions = _intl.default.get('Previous_7_days');
|
|
68
76
|
} else if (date_granularity === 'days_30') {
|
|
69
|
-
conjunctions =
|
|
77
|
+
conjunctions = _intl.default.get('Previous_30_days');
|
|
70
78
|
} else {
|
|
71
|
-
conjunctions =
|
|
79
|
+
conjunctions = _intl.default.get('The_day_before_yesterday');
|
|
72
80
|
}
|
|
73
81
|
const {
|
|
74
82
|
result,
|
|
@@ -76,25 +84,25 @@ class Trend extends Component {
|
|
|
76
84
|
previous
|
|
77
85
|
} = data || {};
|
|
78
86
|
let color, icon;
|
|
79
|
-
if (type === TREND_TYPES.UP) {
|
|
87
|
+
if (type === _constants.TREND_TYPES.UP) {
|
|
80
88
|
color = '#34aa95';
|
|
81
89
|
icon = 'dtable-icon-up1';
|
|
82
90
|
}
|
|
83
|
-
if (type === TREND_TYPES.DOWN) {
|
|
91
|
+
if (type === _constants.TREND_TYPES.DOWN) {
|
|
84
92
|
color = '#fa5757';
|
|
85
93
|
icon = 'dtable-icon-down1';
|
|
86
94
|
}
|
|
87
|
-
if (type === TREND_TYPES.EQUAL) {
|
|
95
|
+
if (type === _constants.TREND_TYPES.EQUAL) {
|
|
88
96
|
color = '#666666';
|
|
89
97
|
icon = 'dtable-icon-narrow';
|
|
90
98
|
}
|
|
91
99
|
if (labelFontSize <= 12) {
|
|
92
|
-
return /*#__PURE__*/
|
|
100
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
93
101
|
style: {
|
|
94
102
|
fontSize: "".concat(labelFontSize, "px"),
|
|
95
103
|
width: '100%'
|
|
96
104
|
}
|
|
97
|
-
}, /*#__PURE__*/
|
|
105
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
98
106
|
style: {
|
|
99
107
|
color: "".concat(color),
|
|
100
108
|
display: 'inline-block',
|
|
@@ -109,13 +117,13 @@ class Trend extends Component {
|
|
|
109
117
|
fontSize: '10px'
|
|
110
118
|
},
|
|
111
119
|
className: "dtable-font ".concat(icon)
|
|
112
|
-
}), /*#__PURE__*/
|
|
120
|
+
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
113
121
|
style: {
|
|
114
122
|
color: "".concat(color)
|
|
115
123
|
}
|
|
116
124
|
}, result));
|
|
117
125
|
}
|
|
118
|
-
const resultContent = /*#__PURE__*/
|
|
126
|
+
const resultContent = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
119
127
|
style: {
|
|
120
128
|
display: 'flex',
|
|
121
129
|
flexWrap: 'wrap',
|
|
@@ -123,12 +131,12 @@ class Trend extends Component {
|
|
|
123
131
|
fontSize: "".concat(labelFontSize, "px"),
|
|
124
132
|
width: '100%'
|
|
125
133
|
}
|
|
126
|
-
}, /*#__PURE__*/
|
|
134
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
127
135
|
style: {
|
|
128
136
|
whiteSpace: 'nowrap',
|
|
129
137
|
marginRight: '16px'
|
|
130
138
|
}
|
|
131
|
-
}, /*#__PURE__*/
|
|
139
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
132
140
|
style: {
|
|
133
141
|
flexShrink: '0',
|
|
134
142
|
flexBasis: 'auto',
|
|
@@ -145,12 +153,12 @@ class Trend extends Component {
|
|
|
145
153
|
fontSize: '11px'
|
|
146
154
|
},
|
|
147
155
|
className: "dtable-font ".concat(icon)
|
|
148
|
-
}), /*#__PURE__*/
|
|
156
|
+
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
149
157
|
style: {
|
|
150
158
|
color: color,
|
|
151
159
|
marginRight: '0px'
|
|
152
160
|
}
|
|
153
|
-
}, result)), /*#__PURE__*/
|
|
161
|
+
}, result)), /*#__PURE__*/_react.default.createElement("span", {
|
|
154
162
|
style: {
|
|
155
163
|
color: labelFontColor,
|
|
156
164
|
fontWeight: labelFontWeight,
|
|
@@ -166,7 +174,7 @@ class Trend extends Component {
|
|
|
166
174
|
chart,
|
|
167
175
|
result
|
|
168
176
|
} = this.props;
|
|
169
|
-
const theme = CHART_THEME_COLOR[globalTheme];
|
|
177
|
+
const theme = _constants.CHART_THEME_COLOR[globalTheme];
|
|
170
178
|
const {
|
|
171
179
|
config
|
|
172
180
|
} = chart;
|
|
@@ -182,18 +190,18 @@ class Trend extends Component {
|
|
|
182
190
|
label_font_weight
|
|
183
191
|
} = config;
|
|
184
192
|
const latest = result && result.latest;
|
|
185
|
-
const content = summary_method === CHART_SUMMARY_TYPE.Distinct_values ? latest : this.formatData(latest);
|
|
193
|
+
const content = summary_method === _constants.CHART_SUMMARY_TYPE.Distinct_values ? latest : this.formatData(latest);
|
|
186
194
|
const labelContent = this.createLabelContent(result, label_text_align, label_font_size, label_font_color, label_font_weight);
|
|
187
|
-
return /*#__PURE__*/
|
|
188
|
-
className:
|
|
189
|
-
}, /*#__PURE__*/
|
|
195
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
196
|
+
className: (0, _classnames.default)('sea-chart-container', 'plugin-number-card-trend')
|
|
197
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
190
198
|
style: {
|
|
191
199
|
color: theme.cardColor,
|
|
192
200
|
width: '100%',
|
|
193
201
|
height: '100%',
|
|
194
202
|
position: 'relative'
|
|
195
203
|
}
|
|
196
|
-
}, /*#__PURE__*/
|
|
204
|
+
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
197
205
|
style: {
|
|
198
206
|
position: 'absolute',
|
|
199
207
|
width: '100%',
|
|
@@ -205,7 +213,7 @@ class Trend extends Component {
|
|
|
205
213
|
fontWeight: "".concat(num_font_weight),
|
|
206
214
|
color: "".concat(num_font_color)
|
|
207
215
|
}
|
|
208
|
-
}, content), /*#__PURE__*/
|
|
216
|
+
}, content), /*#__PURE__*/_react.default.createElement("p", {
|
|
209
217
|
className: "label-content",
|
|
210
218
|
style: {
|
|
211
219
|
position: 'absolute',
|
|
@@ -216,4 +224,4 @@ class Trend extends Component {
|
|
|
216
224
|
}, labelContent)));
|
|
217
225
|
}
|
|
218
226
|
}
|
|
219
|
-
|
|
227
|
+
var _default = exports.default = Trend;
|
|
@@ -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 _Loading2 = _interopRequireDefault(require("dtable-ui-component/lib/Loading"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _index = _interopRequireDefault(require("@antv/data-set/lib/index"));
|
|
12
|
+
var _dtableUtils = require("dtable-utils");
|
|
13
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
|
+
var _customG = require("../../utils/custom-g2");
|
|
15
|
+
var _intl = _interopRequireDefault(require("../../intl"));
|
|
16
|
+
var _mapJson = _interopRequireDefault(require("../../services/map-json"));
|
|
17
|
+
var _utils = require("../../utils");
|
|
18
|
+
var _colorRules = require("../../constants/color-rules");
|
|
19
|
+
var _constants = require("../../constants");
|
|
20
|
+
var _context = _interopRequireDefault(require("../../context"));
|
|
13
21
|
const reg = /^([A-Za-z])/;
|
|
14
22
|
const fixData = (statisticData, countryMap, chartType) => {
|
|
15
23
|
if (!statisticData) return [];
|
|
@@ -42,13 +50,13 @@ const fixData = (statisticData, countryMap, chartType) => {
|
|
|
42
50
|
formatted_value: item.formatted_value + ''
|
|
43
51
|
});
|
|
44
52
|
}
|
|
45
|
-
if (chartType === CHART_TYPE.WORLD_MAP_BUBBLE) {
|
|
53
|
+
if (chartType === _constants.CHART_TYPE.WORLD_MAP_BUBBLE) {
|
|
46
54
|
sum += item.value;
|
|
47
55
|
}
|
|
48
56
|
}
|
|
49
57
|
}
|
|
50
58
|
});
|
|
51
|
-
if (chartType === CHART_TYPE.WORLD_MAP_BUBBLE) {
|
|
59
|
+
if (chartType === _constants.CHART_TYPE.WORLD_MAP_BUBBLE) {
|
|
52
60
|
statisticNewData.sum = sum;
|
|
53
61
|
}
|
|
54
62
|
return statisticNewData;
|
|
@@ -71,13 +79,13 @@ function createChart(container) {
|
|
|
71
79
|
const {
|
|
72
80
|
width,
|
|
73
81
|
height
|
|
74
|
-
} = getMapCanvasStyle(container, 2.1);
|
|
82
|
+
} = (0, _utils.getMapCanvasStyle)(container, 2.1);
|
|
75
83
|
let config = {
|
|
76
84
|
container: container,
|
|
77
85
|
width,
|
|
78
86
|
height
|
|
79
87
|
};
|
|
80
|
-
return new Chart(config);
|
|
88
|
+
return new _customG.Chart(config);
|
|
81
89
|
}
|
|
82
90
|
function initChart(currentChart, props) {
|
|
83
91
|
const {
|
|
@@ -87,7 +95,7 @@ function initChart(currentChart, props) {
|
|
|
87
95
|
} = props;
|
|
88
96
|
if (isCalculateByView) {
|
|
89
97
|
currentChart.on('element:click', e => {
|
|
90
|
-
const lang =
|
|
98
|
+
const lang = _intl.default.lang;
|
|
91
99
|
const data = e.data.data;
|
|
92
100
|
const countryName = lang === 'zh-cn' ? data.name_cn : data.name;
|
|
93
101
|
const clickData = result.find(i => i.name === countryName);
|
|
@@ -118,19 +126,19 @@ function initChart(currentChart, props) {
|
|
|
118
126
|
currentChart.axis(false);
|
|
119
127
|
}
|
|
120
128
|
function mapGetNumberDisplayString(value, columnData, summaryMethod) {
|
|
121
|
-
if (summaryMethod === CHART_SUMMARY_TYPE.Distinct_values) {
|
|
129
|
+
if (summaryMethod === _constants.CHART_SUMMARY_TYPE.Distinct_values) {
|
|
122
130
|
return value;
|
|
123
131
|
}
|
|
124
|
-
return getNumberDisplayString(value, columnData);
|
|
132
|
+
return (0, _dtableUtils.getNumberDisplayString)(value, columnData);
|
|
125
133
|
}
|
|
126
134
|
function getThemeColors() {
|
|
127
135
|
let themeColors = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
128
136
|
let theme = arguments.length > 1 ? arguments[1] : undefined;
|
|
129
137
|
// dark->custom->light
|
|
130
|
-
if (theme === THEME_NAME_MAP.DARK) {
|
|
131
|
-
themeColors = CHART_THEME_COLOR.dark;
|
|
138
|
+
if (theme === _constants.THEME_NAME_MAP.DARK) {
|
|
139
|
+
themeColors = _constants.CHART_THEME_COLOR.dark;
|
|
132
140
|
}
|
|
133
|
-
return themeColors || CHART_THEME_COLOR[THEME_NAME_MAP.LIGHT];
|
|
141
|
+
return themeColors || _constants.CHART_THEME_COLOR[_constants.THEME_NAME_MAP.LIGHT];
|
|
134
142
|
}
|
|
135
143
|
function WorldMap(props) {
|
|
136
144
|
let {
|
|
@@ -160,12 +168,12 @@ function WorldMap(props) {
|
|
|
160
168
|
summary_method,
|
|
161
169
|
table_id
|
|
162
170
|
} = chart.config;
|
|
163
|
-
const chartRef = useRef(null);
|
|
164
|
-
const chartContainerRef = useRef(null);
|
|
165
|
-
const dataSetRef = useRef(null);
|
|
166
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
167
|
-
const [mapData, setMapData] = useState(null);
|
|
168
|
-
const renderCommonChart = useCallback(function (statisticNewData) {
|
|
171
|
+
const chartRef = (0, _react.useRef)(null);
|
|
172
|
+
const chartContainerRef = (0, _react.useRef)(null);
|
|
173
|
+
const dataSetRef = (0, _react.useRef)(null);
|
|
174
|
+
const [isLoading, setIsLoading] = (0, _react.useState)(true);
|
|
175
|
+
const [mapData, setMapData] = (0, _react.useState)(null);
|
|
176
|
+
const renderCommonChart = (0, _react.useCallback)(function (statisticNewData) {
|
|
169
177
|
const currentDataSet = dataSetRef.current;
|
|
170
178
|
const currentChart = chartRef.current;
|
|
171
179
|
const userDataView = currentDataSet.getView('statisticViewModel').source(statisticNewData).transform({
|
|
@@ -174,16 +182,16 @@ function WorldMap(props) {
|
|
|
174
182
|
type: 'geo.region',
|
|
175
183
|
as: ['longitude', 'latitude']
|
|
176
184
|
});
|
|
177
|
-
const currentColorOption = COLOR_OPTIONS.filter(item => item.name === data_color)[0] || COLOR_OPTIONS[0];
|
|
185
|
+
const currentColorOption = _colorRules.COLOR_OPTIONS.filter(item => item.name === data_color)[0] || _colorRules.COLOR_OPTIONS[0];
|
|
178
186
|
const {
|
|
179
187
|
exampleColors,
|
|
180
188
|
highlightedBorderColor
|
|
181
189
|
} = currentColorOption;
|
|
182
|
-
let columnData = DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
183
|
-
if (summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
184
|
-
const table = getTableById(table_id);
|
|
185
|
-
const summaryColumn = getTableColumnByKey(table, summary_column_key) || {};
|
|
186
|
-
columnData = summaryColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
190
|
+
let columnData = _constants.DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
191
|
+
if (summary_type === _constants.CHART_SUMMARY_TYPE.ADVANCED) {
|
|
192
|
+
const table = (0, _dtableUtils.getTableById)(table_id);
|
|
193
|
+
const summaryColumn = (0, _dtableUtils.getTableColumnByKey)(table, summary_column_key) || {};
|
|
194
|
+
columnData = summaryColumn.data || _constants.DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
187
195
|
}
|
|
188
196
|
const statisticView = currentChart.createView();
|
|
189
197
|
statisticView.data(userDataView.rows);
|
|
@@ -232,7 +240,7 @@ function WorldMap(props) {
|
|
|
232
240
|
statisticView.render();
|
|
233
241
|
return statisticView;
|
|
234
242
|
}, [data_color, legend_direction, legend_size, summary_column_key, summary_method, summary_type, table_id]);
|
|
235
|
-
const renderBubbleChart = useCallback(function (statisticNewData) {
|
|
243
|
+
const renderBubbleChart = (0, _react.useCallback)(function (statisticNewData) {
|
|
236
244
|
const currentDataSet = dataSetRef.current;
|
|
237
245
|
const currentChart = chartRef.current;
|
|
238
246
|
const userDv = currentDataSet.createView().source(statisticNewData).transform({
|
|
@@ -241,11 +249,11 @@ function WorldMap(props) {
|
|
|
241
249
|
type: 'geo.centroid',
|
|
242
250
|
as: ['longitude', 'latitude']
|
|
243
251
|
});
|
|
244
|
-
let columnData = DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
245
|
-
if (summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
246
|
-
const table = getTableById(table_id);
|
|
247
|
-
const summaryColumn = getTableColumnByKey(table, summary_column_key) || {};
|
|
248
|
-
columnData = summaryColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
252
|
+
let columnData = _constants.DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
253
|
+
if (summary_type === _constants.CHART_SUMMARY_TYPE.ADVANCED) {
|
|
254
|
+
const table = (0, _dtableUtils.getTableById)(table_id);
|
|
255
|
+
const summaryColumn = (0, _dtableUtils.getTableColumnByKey)(table, summary_column_key) || {};
|
|
256
|
+
columnData = summaryColumn.data || _constants.DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
249
257
|
}
|
|
250
258
|
const statisticView = currentChart.createView();
|
|
251
259
|
statisticView.data(userDv.rows);
|
|
@@ -300,13 +308,13 @@ function WorldMap(props) {
|
|
|
300
308
|
statisticView.render();
|
|
301
309
|
return statisticView;
|
|
302
310
|
}, [bubble_color, legend_direction, legend_size, summary_column_key, summary_method, summary_type, table_id]);
|
|
303
|
-
useEffect(() => {
|
|
311
|
+
(0, _react.useEffect)(() => {
|
|
304
312
|
const handleResize = () => {
|
|
305
313
|
const container = chartContainerRef.current;
|
|
306
314
|
const {
|
|
307
315
|
width,
|
|
308
316
|
height
|
|
309
|
-
} = getMapCanvasStyle(container, 2.1);
|
|
317
|
+
} = (0, _utils.getMapCanvasStyle)(container, 2.1);
|
|
310
318
|
chartRef.current.changeSize(width, height);
|
|
311
319
|
};
|
|
312
320
|
window.addEventListener('resize', handleResize);
|
|
@@ -317,11 +325,11 @@ function WorldMap(props) {
|
|
|
317
325
|
|
|
318
326
|
// used to fetch mapJson data
|
|
319
327
|
// only triggered once
|
|
320
|
-
useEffect(() => {
|
|
328
|
+
(0, _react.useEffect)(() => {
|
|
321
329
|
(async () => {
|
|
322
330
|
try {
|
|
323
|
-
const mediaUrl =
|
|
324
|
-
const mapJson = await
|
|
331
|
+
const mediaUrl = _context.default.getSetting('mediaUrl');
|
|
332
|
+
const mapJson = await (0, _mapJson.default)(_constants.MAP_LEVEL.WORLD, '', mediaUrl);
|
|
325
333
|
setMapData(mapJson);
|
|
326
334
|
setIsLoading(false);
|
|
327
335
|
} catch (error) {
|
|
@@ -333,7 +341,7 @@ function WorldMap(props) {
|
|
|
333
341
|
|
|
334
342
|
// used to init map background
|
|
335
343
|
// if no statistics data, then render empty map
|
|
336
|
-
useEffect(() => {
|
|
344
|
+
(0, _react.useEffect)(() => {
|
|
337
345
|
if (!chartRef.current) {
|
|
338
346
|
chartRef.current = createChart(chartContainerRef.current);
|
|
339
347
|
}
|
|
@@ -341,7 +349,7 @@ function WorldMap(props) {
|
|
|
341
349
|
if (!mapData) return;
|
|
342
350
|
const currentChart = chartRef.current;
|
|
343
351
|
initChart(currentChart, props);
|
|
344
|
-
const dataSet = new
|
|
352
|
+
const dataSet = new _index.default();
|
|
345
353
|
dataSetRef.current = dataSet;
|
|
346
354
|
// transform map data
|
|
347
355
|
const data = dataSet.createView('mapDataModel').source(mapData, {
|
|
@@ -364,7 +372,7 @@ function WorldMap(props) {
|
|
|
364
372
|
},
|
|
365
373
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
366
374
|
[mapData]);
|
|
367
|
-
useEffect(() => {
|
|
375
|
+
(0, _react.useEffect)(() => {
|
|
368
376
|
const currentChart = chartRef.current;
|
|
369
377
|
// need mapData and statisticData to render
|
|
370
378
|
if (!Array.isArray(statisticData) || !mapData) return;
|
|
@@ -390,10 +398,10 @@ function WorldMap(props) {
|
|
|
390
398
|
currentView && currentView.destroy();
|
|
391
399
|
};
|
|
392
400
|
}, [statisticData, mapData, type, renderCommonChart, renderBubbleChart]);
|
|
393
|
-
return /*#__PURE__*/
|
|
401
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isLoading && /*#__PURE__*/_react.default.createElement("div", {
|
|
394
402
|
className: 'statistic-chart-loading-container'
|
|
395
|
-
}, /*#__PURE__*/
|
|
396
|
-
className:
|
|
403
|
+
}, /*#__PURE__*/_react.default.createElement(_Loading2.default, null)), /*#__PURE__*/_react.default.createElement("div", {
|
|
404
|
+
className: (0, _classnames.default)('sea-chart-container '),
|
|
397
405
|
style: {
|
|
398
406
|
display: 'flex',
|
|
399
407
|
justifyContent: 'center',
|
|
@@ -402,4 +410,4 @@ function WorldMap(props) {
|
|
|
402
410
|
ref: chartContainerRef
|
|
403
411
|
}));
|
|
404
412
|
}
|
|
405
|
-
|
|
413
|
+
var _default = exports.default = WorldMap;
|