dtable-statistic 4.3.3 → 4.3.4
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/es/api/dtable-db-api.js +3 -10
- package/es/calculator/base-calculator.js +12 -20
- package/es/calculator/basic-chart-calculator.js +65 -72
- package/es/calculator/combination-calculator.js +57 -64
- package/es/calculator/compare-bar-calculator.js +26 -33
- package/es/calculator/completeness-calculator.js +30 -37
- package/es/calculator/copy-value.js +1 -7
- package/es/calculator/dashboard-calculator.js +13 -20
- package/es/calculator/heat-map-calculator.js +18 -25
- package/es/calculator/horizontal-bar-calculator.js +8 -15
- package/es/calculator/index.js +35 -42
- package/es/calculator/map-calculator.js +22 -29
- package/es/calculator/mirror-calculator.js +20 -27
- package/es/calculator/number-card-calculator.js +10 -17
- package/es/calculator/pivot-table-calculator.js +58 -65
- package/es/calculator/scatter-calculator.js +14 -21
- package/es/calculator/thread-manager.js +1 -7
- package/es/calculator/trend-calculator.js +22 -29
- package/es/calculator/workers/basic-chart-calculator-worker.js +76 -83
- package/es/calculator/workers/calculator.worker.js +30 -33
- package/es/calculator/workers/card-calculator-worker.js +13 -19
- package/es/calculator/workers/combination-calculator-worker.js +46 -53
- package/es/calculator/workers/compare-bar-chart-calculator-worker.js +22 -29
- package/es/calculator/workers/completeness-calculator-worker.js +34 -41
- package/es/calculator/workers/dashboard-calculator-worker.js +18 -24
- package/es/calculator/workers/mirror-calculator-worker.js +22 -29
- package/es/calculator/workers/pivot-table-calculator-worker.js +77 -84
- package/es/calculator/workers/scatter-calculator-worker.js +20 -27
- package/es/calculator/workers/trend-calculator-worker.js +27 -34
- package/es/calculator/world-map-calculator.js +17 -24
- package/es/components/common-add-tool.js +5 -12
- package/es/components/dialog/chart-addition-edit-dialog.js +12 -20
- package/es/components/dialog/chart-addition-widgets/chart-selector.js +101 -108
- package/es/components/dialog/color-theme-dialog.js +15 -22
- package/es/components/dialog/delete-confirmation-dialog.js +11 -18
- package/es/components/dialog/enlarged-chart-dialog.js +20 -28
- package/es/components/dialog/new-table-dialog.js +16 -23
- package/es/components/dialog/new-view-dialog.js +14 -21
- package/es/components/dialog/rename-view-dialog.js +14 -22
- package/es/components/dialog/statistic-record-dialog/index.js +37 -45
- package/es/components/dialog/statistic-types-dialog/index.js +14 -22
- package/es/components/dialog/table-select-dialog.js +15 -23
- package/es/components/dropdown-menu/statistic-dropdown-menu.js +41 -49
- package/es/components/dtable-popover.js +12 -19
- package/es/components/dtable-search-input.js +13 -21
- package/es/components/dtable-select.js +15 -21
- package/es/components/icon.js +4 -11
- package/es/components/index.js +11 -76
- package/es/components/loading.js +3 -10
- package/es/components/modal-portal.js +5 -12
- package/es/components/popover/color-rules/color-rule.js +25 -33
- package/es/components/popover/color-rules/index.js +6 -14
- package/es/components/popover/color-rules/rule-filters/filter.js +27 -34
- package/es/components/popover/color-rules/rule-filters/index.js +17 -25
- package/es/components/popover/color-rules/rule-filters/number-input.js +9 -17
- package/es/components/popover/color-rules-popover.js +24 -32
- package/es/components/popover/color-selector-popover.js +10 -17
- package/es/components/seatable-radio/index.js +9 -16
- package/es/components/select/index.js +2 -9
- package/es/components/select/option-group.js +19 -27
- package/es/components/select/option.js +6 -14
- package/es/components/select/select.js +17 -25
- package/es/components/toast/alert.js +24 -31
- package/es/components/toast/index.js +3 -10
- package/es/components/toast/toast.js +12 -20
- package/es/components/toast/toastManager.js +9 -17
- package/es/components/toast/toaster.js +6 -14
- package/es/constants/color-rules.js +6 -12
- package/es/constants/dtable-select-style.js +4 -9
- package/es/constants/event-types.js +4 -10
- package/es/constants/index.js +67 -96
- package/es/constants/key-codes.js +0 -2
- package/es/constants/map.js +2 -8
- package/es/constants/model.js +20 -26
- package/es/constants/regions.js +3 -8
- package/es/constants/zIndexes.js +1 -7
- package/es/custom-g2.js +208 -236
- package/es/dashboard.js +50 -58
- package/es/desktop-dashboard.js +47 -55
- package/es/index.js +3 -6
- package/es/locale/index.js +10 -13
- package/es/locale/lang/de.js +1 -7
- package/es/locale/lang/en.js +1 -7
- package/es/locale/lang/fr.js +1 -7
- package/es/locale/lang/zh_CN.js +1 -7
- package/es/mobile-dashboard.js +38 -46
- package/es/model/bar-group.js +11 -19
- package/es/model/bar.js +10 -18
- package/es/model/base-model.js +2 -9
- package/es/model/basic-number-card.js +8 -16
- package/es/model/collaborators.js +2 -9
- package/es/model/combination.js +12 -20
- package/es/model/compare-bar.js +16 -24
- package/es/model/completeness-group.js +8 -16
- package/es/model/completeness.js +5 -13
- package/es/model/custom-bar.js +6 -14
- package/es/model/dashboard.js +6 -14
- package/es/model/generic-model.js +133 -141
- package/es/model/heat-map.js +11 -19
- package/es/model/horizontal-bar-group.js +10 -18
- package/es/model/horizontal-bar.js +10 -18
- package/es/model/index.js +53 -185
- package/es/model/map.js +15 -23
- package/es/model/mirror.js +13 -21
- package/es/model/pie.js +10 -18
- package/es/model/ring.js +11 -19
- package/es/model/scatter.js +6 -14
- package/es/model/statistic-dashboard.js +2 -9
- package/es/model/table.js +10 -18
- package/es/model/trend.js +12 -20
- package/es/model/world-map.js +13 -21
- package/es/service/chart-service.js +7 -14
- package/es/service/dashboard-service.js +34 -41
- package/es/service/map-json.js +8 -14
- package/es/stat-editor/chart-name-editor.js +8 -15
- package/es/stat-editor/index.js +16 -24
- package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +21 -29
- package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +49 -57
- package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +23 -31
- package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +4 -11
- package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +19 -27
- package/es/stat-editor/stat-settings/advance-chart-settings/index.js +43 -51
- package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +23 -31
- package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +23 -31
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +37 -45
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +19 -27
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +26 -34
- package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +47 -55
- package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +22 -30
- package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +18 -26
- package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +27 -35
- package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +24 -32
- package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +33 -41
- package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +22 -30
- package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +27 -26
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +46 -54
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +23 -31
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +26 -34
- package/es/stat-editor/stat-settings/basic-chart-settings/index.js +77 -85
- package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +21 -29
- package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +73 -81
- package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +16 -24
- package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +19 -27
- package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +18 -26
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +49 -57
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +17 -25
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +47 -55
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +11 -19
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +45 -53
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +9 -17
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +20 -28
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +30 -38
- package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +50 -58
- package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +17 -25
- package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +47 -55
- package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +11 -19
- package/es/stat-editor/stat-settings/color-setting/color-picker.js +12 -19
- package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +62 -70
- package/es/stat-editor/stat-settings/map/map-level.js +13 -20
- package/es/stat-editor/stat-settings/map/map-province-city.js +20 -27
- package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +11 -19
- package/es/stat-editor/stat-settings/public-setting/base-settings.js +20 -28
- package/es/stat-editor/stat-settings/public-setting/calender.js +22 -29
- package/es/stat-editor/stat-settings/public-setting/column-settings.js +6 -13
- package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +9 -16
- package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +13 -21
- package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +8 -15
- package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +11 -19
- package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +27 -35
- package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +8 -15
- package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +18 -26
- package/es/stat-list/chart-preview.js +20 -28
- package/es/stat-list/index.js +27 -35
- package/es/stat-view/area-chart.js +43 -50
- package/es/stat-view/bar-chart.js +47 -54
- package/es/stat-view/base-chart.js +24 -32
- package/es/stat-view/basic-number-card.js +19 -26
- package/es/stat-view/combination-chart.js +49 -56
- package/es/stat-view/compare-chart.js +39 -46
- package/es/stat-view/completeness-chart.js +28 -35
- package/es/stat-view/custom-bar.js +31 -38
- package/es/stat-view/dashboard-chart.js +15 -22
- package/es/stat-view/heat-map.js +43 -50
- package/es/stat-view/horizontal-bar-chart.js +51 -58
- package/es/stat-view/index.js +73 -80
- package/es/stat-view/line-chart.js +39 -46
- package/es/stat-view/map.js +33 -40
- package/es/stat-view/mirror.js +21 -28
- package/es/stat-view/pie-chart.js +29 -36
- package/es/stat-view/pivot-table/index.js +32 -39
- package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +31 -39
- package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +29 -37
- package/es/stat-view/pivot-table/pivot-table-display-name.js +46 -54
- package/es/stat-view/pivot-table/two-dimension-table.js +62 -70
- package/es/stat-view/ring-chart.js +38 -45
- package/es/stat-view/scatter-chart.js +30 -37
- package/es/stat-view/treemap-chart.js +37 -44
- package/es/stat-view/trend-chart.js +32 -39
- package/es/stat-view/world-map.js +33 -40
- package/es/tabs/index.js +32 -40
- package/es/tabs/tab.js +26 -34
- package/es/utils/basic-chart-utils.js +2 -9
- package/es/utils/cell-format.js +14 -22
- package/es/utils/cell-value.js +7 -14
- package/es/utils/collaborator.js +4 -13
- package/es/utils/color-utils.js +18 -29
- package/es/utils/column-utils.js +18 -29
- package/es/utils/column.js +4 -11
- package/es/utils/common-utils.js +41 -65
- package/es/utils/date-format.js +2 -8
- package/es/utils/export-table-utils.js +82 -91
- package/es/utils/index.js +11 -100
- package/es/utils/map.js +26 -36
- package/es/utils/model.js +6 -14
- package/es/utils/object.js +6 -15
- package/es/utils/pivot-table.js +16 -23
- package/es/utils/row-utils.js +23 -33
- package/es/utils/search.js +21 -29
- package/es/utils/sql-utils.js +65 -75
- package/es/utils/stat-utils.js +60 -66
- package/es/utils/trend-utils.js +32 -40
- package/package.json +1 -1
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
|
|
11
|
-
var _icon = _interopRequireDefault(require("../../../../components/icon"));
|
|
12
|
-
var _statisticTypesDialog = _interopRequireDefault(require("../../../../components/dialog/statistic-types-dialog"));
|
|
13
|
-
var _constants = require("../../../../constants");
|
|
14
|
-
require("./index.css");
|
|
15
|
-
class TypeSettings extends _react.Component {
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import intl from 'react-intl-universal';
|
|
3
|
+
import Icon from '../../../../components/icon';
|
|
4
|
+
import StatisticTypesDialog from '../../../../components/dialog/statistic-types-dialog';
|
|
5
|
+
import { STATISTIC_TYPE_SHOW, STAT_TYPE } from '../../../../constants';
|
|
6
|
+
import './index.css';
|
|
7
|
+
class TypeSettings extends Component {
|
|
16
8
|
constructor(props) {
|
|
17
9
|
super(props);
|
|
18
10
|
this.openTypesDialog = () => {
|
|
@@ -30,21 +22,21 @@ class TypeSettings extends _react.Component {
|
|
|
30
22
|
type: chartType
|
|
31
23
|
} = this.props.chart;
|
|
32
24
|
switch (chartType) {
|
|
33
|
-
case
|
|
25
|
+
case STAT_TYPE.MAP:
|
|
34
26
|
{
|
|
35
27
|
return '中国地图';
|
|
36
28
|
}
|
|
37
|
-
case
|
|
29
|
+
case STAT_TYPE.MAP_BUBBLE:
|
|
38
30
|
{
|
|
39
31
|
return '中国地图(气泡图)';
|
|
40
32
|
}
|
|
41
|
-
case
|
|
33
|
+
case STAT_TYPE.WORLD_MAP_BUBBLE:
|
|
42
34
|
{
|
|
43
|
-
return "".concat(
|
|
35
|
+
return "".concat(intl.get(STATISTIC_TYPE_SHOW[STAT_TYPE.WORLD_MAP]), "(").concat(intl.get('Bubble'), ")");
|
|
44
36
|
}
|
|
45
37
|
default:
|
|
46
38
|
{
|
|
47
|
-
return
|
|
39
|
+
return intl.get(STATISTIC_TYPE_SHOW[chartType]);
|
|
48
40
|
}
|
|
49
41
|
}
|
|
50
42
|
};
|
|
@@ -62,21 +54,21 @@ class TypeSettings extends _react.Component {
|
|
|
62
54
|
const {
|
|
63
55
|
type: chartType
|
|
64
56
|
} = chart;
|
|
65
|
-
return /*#__PURE__*/
|
|
57
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
66
58
|
className: "statistic-chart-parameter-item"
|
|
67
|
-
}, /*#__PURE__*/
|
|
59
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Chart_type')), /*#__PURE__*/React.createElement("div", {
|
|
68
60
|
className: "statistic-selected-type-container d-flex align-items-center"
|
|
69
|
-
}, /*#__PURE__*/
|
|
61
|
+
}, /*#__PURE__*/React.createElement("span", null, this.getChartTypeName()), /*#__PURE__*/React.createElement("div", {
|
|
70
62
|
className: "statistic-switch-type-container",
|
|
71
63
|
onClick: this.openTypesDialog
|
|
72
|
-
}, /*#__PURE__*/
|
|
64
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
73
65
|
symbol: "switch-icon",
|
|
74
66
|
className: "statistic-type-switch-icon"
|
|
75
|
-
})))), isShowDialog && /*#__PURE__*/
|
|
67
|
+
})))), isShowDialog && /*#__PURE__*/React.createElement(StatisticTypesDialog, {
|
|
76
68
|
type: chartType,
|
|
77
69
|
onChange: this.props.onChange,
|
|
78
70
|
onToggle: this.closeTypesDialog
|
|
79
71
|
}));
|
|
80
72
|
}
|
|
81
73
|
}
|
|
82
|
-
|
|
74
|
+
export default TypeSettings;
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
11
|
-
var _html2canvas = _interopRequireDefault(require("html2canvas"));
|
|
12
|
-
var _statView = _interopRequireDefault(require("../stat-view"));
|
|
13
|
-
var _statisticDropdownMenu = _interopRequireDefault(require("../components/dropdown-menu/statistic-dropdown-menu"));
|
|
14
|
-
var _constants = require("../constants");
|
|
15
|
-
class ChartPreview extends _react.Component {
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import html2canvas from 'html2canvas';
|
|
4
|
+
import StatView from '../stat-view';
|
|
5
|
+
import StatisticDropdownMenu from '../components/dropdown-menu/statistic-dropdown-menu';
|
|
6
|
+
import { STAT_TYPE } from '../constants';
|
|
7
|
+
class ChartPreview extends Component {
|
|
16
8
|
constructor() {
|
|
17
9
|
super(...arguments);
|
|
18
10
|
this.onMouseDown = event => {
|
|
@@ -42,11 +34,11 @@ class ChartPreview extends _react.Component {
|
|
|
42
34
|
exportContainer.setAttribute('style', "width: ".concat(containerWidth, "px; height: ").concat(containerHeight, "px;"));
|
|
43
35
|
}
|
|
44
36
|
document.body.appendChild(exportContainer);
|
|
45
|
-
|
|
37
|
+
ReactDOM.render(this.renderChart(statItem), exportContainer);
|
|
46
38
|
setTimeout(() => {
|
|
47
39
|
const ele = document.querySelector("#".concat(exportContainerID, " .statistic-chart-container"));
|
|
48
40
|
if (!ele) return;
|
|
49
|
-
(
|
|
41
|
+
html2canvas(ele, {
|
|
50
42
|
windowWidth: ele.scrollWidth,
|
|
51
43
|
windowHeight: ele.scrollHeight
|
|
52
44
|
}).then(canvas => {
|
|
@@ -78,7 +70,7 @@ class ChartPreview extends _react.Component {
|
|
|
78
70
|
colorThemeName,
|
|
79
71
|
eventBus
|
|
80
72
|
} = this.props;
|
|
81
|
-
return /*#__PURE__*/
|
|
73
|
+
return /*#__PURE__*/React.createElement(StatView, {
|
|
82
74
|
ref: ref => this.chartView = ref,
|
|
83
75
|
isPreview: true,
|
|
84
76
|
isEnlarge: false,
|
|
@@ -110,20 +102,20 @@ class ChartPreview extends _react.Component {
|
|
|
110
102
|
name: statName,
|
|
111
103
|
type
|
|
112
104
|
} = statItem;
|
|
113
|
-
const showStatName = !(type ===
|
|
114
|
-
return /*#__PURE__*/
|
|
105
|
+
const showStatName = !(type === STAT_TYPE.BASIC_NUMBER_CARD || type === STAT_TYPE.DASHBOARD);
|
|
106
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
115
107
|
className: "statistic-chart-preview-header"
|
|
116
|
-
}, /*#__PURE__*/
|
|
108
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
117
109
|
className: "statistic-chart-preview-name"
|
|
118
|
-
}, showStatName ? statName : ''), /*#__PURE__*/
|
|
110
|
+
}, showStatName ? statName : ''), /*#__PURE__*/React.createElement("span", {
|
|
119
111
|
className: "statistic-chart-preview-operations"
|
|
120
|
-
}, /*#__PURE__*/
|
|
112
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
121
113
|
className: "statistic-chart-preview-microscope",
|
|
122
114
|
onMouseDown: this.onMouseDown,
|
|
123
115
|
onClick: this.onToggleShowEnlarged
|
|
124
|
-
}, /*#__PURE__*/
|
|
116
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
125
117
|
className: "dtable-font dtable-icon-open"
|
|
126
|
-
})), /*#__PURE__*/
|
|
118
|
+
})), /*#__PURE__*/React.createElement(StatisticDropdownMenu, {
|
|
127
119
|
isTableReadOnly: isTableReadOnly,
|
|
128
120
|
chartType: type,
|
|
129
121
|
getOtherStatistics: this.props.getOtherStatistics,
|
|
@@ -134,12 +126,12 @@ class ChartPreview extends _react.Component {
|
|
|
134
126
|
deleteStatItem: this.props.deleteChart.bind(this, statId),
|
|
135
127
|
onNewTableDialogToggle: this.onNewTableDialogToggle,
|
|
136
128
|
onUpdateTableDialogToggle: this.onUpdateTableDialogToggle
|
|
137
|
-
}))), /*#__PURE__*/
|
|
129
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
138
130
|
id: "stat-item-".concat(statItem._id),
|
|
139
131
|
className: "statistic-chart-preview-container"
|
|
140
|
-
}, this.renderChart(statItem)), /*#__PURE__*/
|
|
132
|
+
}, this.renderChart(statItem)), /*#__PURE__*/React.createElement("div", {
|
|
141
133
|
className: "statistic-chart-preview-container-resize"
|
|
142
134
|
}));
|
|
143
135
|
}
|
|
144
136
|
}
|
|
145
|
-
|
|
137
|
+
export default ChartPreview;
|
package/es/stat-list/index.js
CHANGED
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _chartPreview = _interopRequireDefault(require("./chart-preview"));
|
|
13
|
-
var _components = require("../components");
|
|
14
|
-
var _enlargedChartDialog = _interopRequireDefault(require("../components/dialog/enlarged-chart-dialog"));
|
|
15
|
-
var _tableSelectDialog = _interopRequireDefault(require("../components/dialog/table-select-dialog"));
|
|
16
|
-
var _exportTableUtils = require("../utils/export-table-utils");
|
|
17
|
-
var _constants = require("../constants");
|
|
18
|
-
const ReactGridLayout = (0, _reactGridLayout.WidthProvider)(_reactGridLayout.default);
|
|
19
|
-
class StatList extends _react.Component {
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import GridLayout, { WidthProvider } from 'react-grid-layout';
|
|
3
|
+
import intl from 'react-intl-universal';
|
|
4
|
+
import ChartPreview from './chart-preview';
|
|
5
|
+
import { NewTableDialog, toaster } from '../components';
|
|
6
|
+
import EnlargeChartDialog from '../components/dialog/enlarged-chart-dialog';
|
|
7
|
+
import TableSelectDialog from '../components/dialog/table-select-dialog';
|
|
8
|
+
import { exportStatisticToTable, updateStatisticToTable } from '../utils/export-table-utils';
|
|
9
|
+
import { CommonEventTypes, STAT_TYPE } from '../constants';
|
|
10
|
+
const ReactGridLayout = WidthProvider(GridLayout);
|
|
11
|
+
class StatList extends Component {
|
|
20
12
|
constructor(props) {
|
|
21
13
|
super(props);
|
|
22
14
|
this.getStatItemsLayout = statItems => {
|
|
@@ -58,9 +50,9 @@ class StatList extends _react.Component {
|
|
|
58
50
|
});
|
|
59
51
|
};
|
|
60
52
|
this.exportChart2Table = (tableName, chart) => {
|
|
61
|
-
if (chart.type !==
|
|
53
|
+
if (chart.type !== STAT_TYPE.PIVOT_TABLE) {
|
|
62
54
|
this.statisticalResult4Export = null;
|
|
63
|
-
|
|
55
|
+
toaster.danger(intl.get('Failed_export_statistic_to_Table'));
|
|
64
56
|
this.closeNewTableDialog();
|
|
65
57
|
return;
|
|
66
58
|
}
|
|
@@ -71,7 +63,7 @@ class StatList extends _react.Component {
|
|
|
71
63
|
const {
|
|
72
64
|
columns,
|
|
73
65
|
rows
|
|
74
|
-
} =
|
|
66
|
+
} = exportStatisticToTable({
|
|
75
67
|
statisticalResult: this.statisticalResult4Export
|
|
76
68
|
});
|
|
77
69
|
if (window.app && window.app.onExportStatisticToTable) {
|
|
@@ -99,9 +91,9 @@ class StatList extends _react.Component {
|
|
|
99
91
|
const {
|
|
100
92
|
getTableById
|
|
101
93
|
} = this.props;
|
|
102
|
-
if (chartUpdate2Table.type !==
|
|
94
|
+
if (chartUpdate2Table.type !== STAT_TYPE.PIVOT_TABLE) {
|
|
103
95
|
this.statisticalResult4Update = null;
|
|
104
|
-
|
|
96
|
+
toaster.danger(intl.get('Failed_export_statistic_to_Table'));
|
|
105
97
|
this.closeSelectTableDialog();
|
|
106
98
|
return;
|
|
107
99
|
}
|
|
@@ -115,7 +107,7 @@ class StatList extends _react.Component {
|
|
|
115
107
|
updatedRows,
|
|
116
108
|
rowIds,
|
|
117
109
|
oldRows
|
|
118
|
-
} =
|
|
110
|
+
} = updateStatisticToTable({
|
|
119
111
|
updateTable,
|
|
120
112
|
statisticalResult: this.statisticalResult4Update
|
|
121
113
|
});
|
|
@@ -130,7 +122,7 @@ class StatList extends _react.Component {
|
|
|
130
122
|
|
|
131
123
|
// refresh charts if has updates
|
|
132
124
|
if (Array.isArray(rowIds) && rowIds.length > 0 || Array.isArray(newRows) && newRows.length > 0) {
|
|
133
|
-
this.props.eventBus.dispatch(
|
|
125
|
+
this.props.eventBus.dispatch(CommonEventTypes.REFRESH_CHARTS);
|
|
134
126
|
}
|
|
135
127
|
}
|
|
136
128
|
this.statisticalResult4Update = null;
|
|
@@ -178,9 +170,9 @@ class StatList extends _react.Component {
|
|
|
178
170
|
const enlargedChart = enlargedChartIndex > -1 && statItems[enlargedChartIndex];
|
|
179
171
|
const chartExport2Table = chartIndexExport2Table > -1 && statItems[chartIndexExport2Table];
|
|
180
172
|
const chartUpdate2Table = chartIndexUpdate2Table > -1 && statItems[chartIndexUpdate2Table];
|
|
181
|
-
return /*#__PURE__*/
|
|
173
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
182
174
|
className: "statistic-list"
|
|
183
|
-
}, Array.isArray(statItems) && /*#__PURE__*/
|
|
175
|
+
}, Array.isArray(statItems) && /*#__PURE__*/React.createElement(ReactGridLayout, {
|
|
184
176
|
className: "statistic-layout layout",
|
|
185
177
|
isDraggable: true,
|
|
186
178
|
rowHeight: 35,
|
|
@@ -194,11 +186,11 @@ class StatList extends _react.Component {
|
|
|
194
186
|
}, statItems.map((statItem, index) => {
|
|
195
187
|
const statId = statItem._id;
|
|
196
188
|
if (!statId) return null;
|
|
197
|
-
return /*#__PURE__*/
|
|
189
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
198
190
|
id: statId,
|
|
199
191
|
key: statId,
|
|
200
192
|
className: "statistic-chart-preview"
|
|
201
|
-
}, /*#__PURE__*/
|
|
193
|
+
}, /*#__PURE__*/React.createElement(ChartPreview, {
|
|
202
194
|
isTableReadOnly: isTableReadOnly,
|
|
203
195
|
dtableChangedTime: dtableChangedTime,
|
|
204
196
|
theme: theme,
|
|
@@ -230,7 +222,7 @@ class StatList extends _react.Component {
|
|
|
230
222
|
onCloseDashboard: this.props.onCloseDashboard,
|
|
231
223
|
toggleStatisticRecordsDialog: this.props.toggleStatisticRecordsDialog
|
|
232
224
|
}));
|
|
233
|
-
})), enlargedChart && /*#__PURE__*/
|
|
225
|
+
})), enlargedChart && /*#__PURE__*/React.createElement(EnlargeChartDialog, {
|
|
234
226
|
dtableChangedTime: dtableChangedTime,
|
|
235
227
|
colorThemeName: colorThemeName,
|
|
236
228
|
statItem: enlargedChart,
|
|
@@ -241,17 +233,17 @@ class StatList extends _react.Component {
|
|
|
241
233
|
onEnlargeToggle: this.closeEnlargedChart,
|
|
242
234
|
onToggleShowEnlarged: this.closeEnlargedChart,
|
|
243
235
|
toggleStatisticRecordsDialog: this.props.toggleStatisticRecordsDialog
|
|
244
|
-
}), chartExport2Table && /*#__PURE__*/
|
|
236
|
+
}), chartExport2Table && /*#__PURE__*/React.createElement(NewTableDialog, {
|
|
245
237
|
getTables: this.props.getTables,
|
|
246
238
|
tableName: chartExport2Table.name,
|
|
247
239
|
onNewTableConfirm: tableName => this.exportChart2Table(tableName, chartExport2Table),
|
|
248
240
|
onNewTableCancel: this.closeNewTableDialog
|
|
249
|
-
}), chartUpdate2Table && /*#__PURE__*/
|
|
241
|
+
}), chartUpdate2Table && /*#__PURE__*/React.createElement(TableSelectDialog, {
|
|
250
242
|
tables: this.props.getTables(),
|
|
251
|
-
title:
|
|
243
|
+
title: intl.get('Update_to_a_table'),
|
|
252
244
|
toggle: this.closeSelectTableDialog,
|
|
253
245
|
onSelectTable: selectedTableId => this.updateChart2Table(selectedTableId, chartUpdate2Table)
|
|
254
246
|
}));
|
|
255
247
|
}
|
|
256
248
|
}
|
|
257
|
-
|
|
249
|
+
export default StatList;
|
|
@@ -1,30 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
|
|
11
|
-
var _dtableStore = require("dtable-store");
|
|
12
|
-
var _baseChart = _interopRequireDefault(require("./base-chart"));
|
|
13
|
-
var _customG = require("../custom-g2");
|
|
14
|
-
var _commonUtils = require("../utils/common-utils");
|
|
15
|
-
var _basicChartUtils = require("../utils/basic-chart-utils");
|
|
16
|
-
var _constants = require("../constants");
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import intl from 'react-intl-universal';
|
|
4
|
+
import { TableUtils } from 'dtable-store';
|
|
5
|
+
import BaseChart from './base-chart';
|
|
6
|
+
import { Chart } from '../custom-g2';
|
|
7
|
+
import { getCurrentTheme } from '../utils/common-utils';
|
|
8
|
+
import { getChartGroups } from '../utils/basic-chart-utils';
|
|
9
|
+
import { DEFAULT_NUMBER_FORMAT_OBJECT, EMPTY_NAME, LABEL_CONFIG_CHANGED, STATISTICS_COUNT_SHOW, SUMMARY_TYPE, TITLE_AMOUNT, TYPE_COLOR_USING } from '../constants';
|
|
17
10
|
const propTypes = {
|
|
18
|
-
isPreview:
|
|
19
|
-
isEdit:
|
|
20
|
-
colorThemeName:
|
|
21
|
-
statItem:
|
|
22
|
-
chartCalculator:
|
|
23
|
-
eventBus:
|
|
24
|
-
getTableById:
|
|
25
|
-
toggleStatisticRecordsDialog:
|
|
11
|
+
isPreview: PropTypes.bool,
|
|
12
|
+
isEdit: PropTypes.bool,
|
|
13
|
+
colorThemeName: PropTypes.string,
|
|
14
|
+
statItem: PropTypes.object,
|
|
15
|
+
chartCalculator: PropTypes.object,
|
|
16
|
+
eventBus: PropTypes.object,
|
|
17
|
+
getTableById: PropTypes.func,
|
|
18
|
+
toggleStatisticRecordsDialog: PropTypes.func
|
|
26
19
|
};
|
|
27
|
-
class AreaChart extends
|
|
20
|
+
class AreaChart extends BaseChart {
|
|
28
21
|
constructor(props) {
|
|
29
22
|
super(props);
|
|
30
23
|
this.drawChart = data => {
|
|
@@ -41,7 +34,7 @@ class AreaChart extends _baseChart.default {
|
|
|
41
34
|
this.props.toggleStatisticRecordsDialog(data, statItem);
|
|
42
35
|
}
|
|
43
36
|
});
|
|
44
|
-
const currentTheme =
|
|
37
|
+
const currentTheme = getCurrentTheme(colorThemeName);
|
|
45
38
|
let {
|
|
46
39
|
table_id,
|
|
47
40
|
y_axis_summary_type,
|
|
@@ -51,17 +44,17 @@ class AreaChart extends _baseChart.default {
|
|
|
51
44
|
color_option
|
|
52
45
|
} = statItem;
|
|
53
46
|
const isGroup = column_groupby_column_key || column_groupby_multiple_numeric_column;
|
|
54
|
-
let summaryColumnData =
|
|
55
|
-
if (y_axis_summary_type ===
|
|
47
|
+
let summaryColumnData = DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
48
|
+
if (y_axis_summary_type === SUMMARY_TYPE.ADVANCED) {
|
|
56
49
|
const table = getTableById(table_id);
|
|
57
|
-
const summaryColumn =
|
|
58
|
-
summaryColumnData = summaryColumn.data ||
|
|
50
|
+
const summaryColumn = TableUtils.getTableColumnByKey(table, y_axis_column_key) || {};
|
|
51
|
+
summaryColumnData = summaryColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
59
52
|
}
|
|
60
53
|
let groupColorMapping = null;
|
|
61
54
|
let chartBarColor = '#2a67d1';
|
|
62
55
|
if (isGroup) {
|
|
63
56
|
chartBarColor = currentTheme && currentTheme.colors;
|
|
64
|
-
if (color_option ===
|
|
57
|
+
if (color_option === TYPE_COLOR_USING.USE_COLUMN_COLORS) {
|
|
65
58
|
// when the 'Group by' column is a 'single-select' column,
|
|
66
59
|
// and the user chooses to use the colors from the column.
|
|
67
60
|
groupColorMapping = {};
|
|
@@ -86,7 +79,7 @@ class AreaChart extends _baseChart.default {
|
|
|
86
79
|
nice: false
|
|
87
80
|
}
|
|
88
81
|
});
|
|
89
|
-
const chartData = isGroup ?
|
|
82
|
+
const chartData = isGroup ? getChartGroups(data) : data;
|
|
90
83
|
const {
|
|
91
84
|
width
|
|
92
85
|
} = this.chart.coordinateBBox;
|
|
@@ -147,7 +140,7 @@ class AreaChart extends _baseChart.default {
|
|
|
147
140
|
config.height = 400;
|
|
148
141
|
config.width = 700;
|
|
149
142
|
}
|
|
150
|
-
this.chart = new
|
|
143
|
+
this.chart = new Chart(config);
|
|
151
144
|
};
|
|
152
145
|
this.drawLine = _ref => {
|
|
153
146
|
let {
|
|
@@ -162,7 +155,7 @@ class AreaChart extends _baseChart.default {
|
|
|
162
155
|
this.chart.line().position('name*value').color(chartBarColor).tooltip('name*formatted_value', (name, value) => {
|
|
163
156
|
return {
|
|
164
157
|
value,
|
|
165
|
-
name: y_axis_summary_type ===
|
|
158
|
+
name: y_axis_summary_type === SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[y_axis_summary_method])
|
|
166
159
|
};
|
|
167
160
|
});
|
|
168
161
|
this.chart.point().label(display_data ? 'formatted_value' : false, {
|
|
@@ -176,8 +169,8 @@ class AreaChart extends _baseChart.default {
|
|
|
176
169
|
}).tooltip('name*formatted_value', (name, value) => {
|
|
177
170
|
return {
|
|
178
171
|
value,
|
|
179
|
-
name: !name && typeof name !== 'number' ?
|
|
180
|
-
title: y_axis_summary_type ===
|
|
172
|
+
name: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
|
|
173
|
+
title: y_axis_summary_type === SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[y_axis_summary_method])
|
|
181
174
|
};
|
|
182
175
|
});
|
|
183
176
|
};
|
|
@@ -203,8 +196,8 @@ class AreaChart extends _baseChart.default {
|
|
|
203
196
|
}).position('name*value').size(3).color('group_name', chartBarColor).tooltip('name*formatted_value*group_name', (name, value, group_name) => {
|
|
204
197
|
return {
|
|
205
198
|
value,
|
|
206
|
-
title: !name && typeof name !== 'number' ?
|
|
207
|
-
name: !group_name && typeof group_name !== 'number' ?
|
|
199
|
+
title: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
|
|
200
|
+
name: !group_name && typeof group_name !== 'number' ? intl.get(EMPTY_NAME) : group_name
|
|
208
201
|
};
|
|
209
202
|
}).shape('circle').style({
|
|
210
203
|
lineWidth: 1,
|
|
@@ -222,8 +215,8 @@ class AreaChart extends _baseChart.default {
|
|
|
222
215
|
this.chart.area().position('name*value').color(chartBarColor).tooltip('name*formatted_value', (name, value) => {
|
|
223
216
|
return {
|
|
224
217
|
value,
|
|
225
|
-
name: !name && typeof name !== 'number' ?
|
|
226
|
-
title: y_axis_summary_type ===
|
|
218
|
+
name: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
|
|
219
|
+
title: y_axis_summary_type === SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[y_axis_summary_method])
|
|
227
220
|
};
|
|
228
221
|
});
|
|
229
222
|
};
|
|
@@ -238,8 +231,8 @@ class AreaChart extends _baseChart.default {
|
|
|
238
231
|
this.chart.area().position('name*value').color('group_name', chartBarColor).tooltip('name*formatted_value', (name, value) => {
|
|
239
232
|
return {
|
|
240
233
|
value,
|
|
241
|
-
name: !name && typeof name !== 'number' ?
|
|
242
|
-
title: y_axis_summary_type ===
|
|
234
|
+
name: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
|
|
235
|
+
title: y_axis_summary_type === SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[y_axis_summary_method])
|
|
243
236
|
};
|
|
244
237
|
});
|
|
245
238
|
};
|
|
@@ -345,7 +338,7 @@ class AreaChart extends _baseChart.default {
|
|
|
345
338
|
fill: themeColors.textColor
|
|
346
339
|
},
|
|
347
340
|
formatter: name => {
|
|
348
|
-
return !name && typeof name !== 'number' ?
|
|
341
|
+
return !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name;
|
|
349
342
|
}
|
|
350
343
|
},
|
|
351
344
|
pageNavigator: {
|
|
@@ -394,7 +387,7 @@ class AreaChart extends _baseChart.default {
|
|
|
394
387
|
const div = document.createElement('div');
|
|
395
388
|
div.id = xAxisID;
|
|
396
389
|
div.className = 'statistic-chart-axis-label';
|
|
397
|
-
const column =
|
|
390
|
+
const column = TableUtils.getTableColumnByKey(table, x_axis_column_key);
|
|
398
391
|
div.innerHTML = "".concat(column ? column.name : '');
|
|
399
392
|
div.setAttribute('style', "color:".concat(textColor, "; width: 100%; padding-left: ").concat(autoPadding.left, "px; text-align: ").concat(x_axis_label_position, "; bottom: -20px"));
|
|
400
393
|
chartContainer.appendChild(div);
|
|
@@ -412,10 +405,10 @@ class AreaChart extends _baseChart.default {
|
|
|
412
405
|
const div = document.createElement('div');
|
|
413
406
|
div.id = yAxisID;
|
|
414
407
|
div.className = 'statistic-chart-axis-label';
|
|
415
|
-
if (y_axis_summary_type ===
|
|
416
|
-
div.innerHTML =
|
|
408
|
+
if (y_axis_summary_type === SUMMARY_TYPE.COUNT) {
|
|
409
|
+
div.innerHTML = intl.get(TITLE_AMOUNT);
|
|
417
410
|
} else {
|
|
418
|
-
const column =
|
|
411
|
+
const column = TableUtils.getTableColumnByKey(table, y_axis_column_key) || {};
|
|
419
412
|
div.innerHTML = column.name || '';
|
|
420
413
|
}
|
|
421
414
|
const containerHeight = chartContainer.offsetHeight;
|
|
@@ -452,7 +445,7 @@ class AreaChart extends _baseChart.default {
|
|
|
452
445
|
chartCalculator,
|
|
453
446
|
eventBus
|
|
454
447
|
} = this.props;
|
|
455
|
-
this.unsubscribeStyleChange = eventBus.subscribe(
|
|
448
|
+
this.unsubscribeStyleChange = eventBus.subscribe(LABEL_CONFIG_CHANGED, newStatItem => {
|
|
456
449
|
this.renderAxisLabel(newStatItem);
|
|
457
450
|
});
|
|
458
451
|
if (!this.container) return;
|
|
@@ -538,7 +531,7 @@ class AreaChart extends _baseChart.default {
|
|
|
538
531
|
show_y_axis_label,
|
|
539
532
|
show_x_axis_label
|
|
540
533
|
} = statItem;
|
|
541
|
-
return /*#__PURE__*/
|
|
534
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, isCalculatingData && this.renderLoading(), showResultDescription && this.renderEmpty(), /*#__PURE__*/React.createElement("div", {
|
|
542
535
|
ref: ref => this.container = ref,
|
|
543
536
|
style: {
|
|
544
537
|
padding: show_y_axis_label || show_x_axis_label ? 30 : 20
|
|
@@ -548,4 +541,4 @@ class AreaChart extends _baseChart.default {
|
|
|
548
541
|
}
|
|
549
542
|
}
|
|
550
543
|
AreaChart.propTypes = propTypes;
|
|
551
|
-
|
|
544
|
+
export default AreaChart;
|