dtable-statistic 4.3.4 → 4.3.6
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 +10 -3
- package/es/calculator/base-calculator.js +20 -12
- package/es/calculator/basic-chart-calculator.js +72 -65
- package/es/calculator/combination-calculator.js +64 -57
- package/es/calculator/compare-bar-calculator.js +33 -26
- package/es/calculator/completeness-calculator.js +37 -30
- package/es/calculator/copy-value.js +7 -1
- package/es/calculator/dashboard-calculator.js +20 -13
- package/es/calculator/heat-map-calculator.js +25 -18
- package/es/calculator/horizontal-bar-calculator.js +15 -8
- package/es/calculator/index.js +42 -35
- package/es/calculator/map-calculator.js +29 -22
- package/es/calculator/mirror-calculator.js +27 -20
- package/es/calculator/number-card-calculator.js +17 -10
- package/es/calculator/pivot-table-calculator.js +65 -58
- package/es/calculator/scatter-calculator.js +21 -14
- package/es/calculator/thread-manager.js +7 -1
- package/es/calculator/trend-calculator.js +29 -22
- package/es/calculator/workers/basic-chart-calculator-worker.js +83 -76
- package/es/calculator/workers/calculator.worker.js +33 -30
- package/es/calculator/workers/card-calculator-worker.js +19 -13
- package/es/calculator/workers/combination-calculator-worker.js +53 -46
- package/es/calculator/workers/compare-bar-chart-calculator-worker.js +29 -22
- package/es/calculator/workers/completeness-calculator-worker.js +41 -34
- package/es/calculator/workers/dashboard-calculator-worker.js +24 -18
- package/es/calculator/workers/mirror-calculator-worker.js +29 -22
- package/es/calculator/workers/pivot-table-calculator-worker.js +84 -77
- package/es/calculator/workers/scatter-calculator-worker.js +27 -20
- package/es/calculator/workers/trend-calculator-worker.js +34 -27
- package/es/calculator/world-map-calculator.js +24 -17
- package/es/components/common-add-tool.js +12 -5
- package/es/components/dialog/chart-addition-edit-dialog.js +20 -12
- package/es/components/dialog/chart-addition-widgets/chart-selector.js +108 -101
- package/es/components/dialog/color-theme-dialog.js +22 -15
- package/es/components/dialog/delete-confirmation-dialog.js +18 -11
- package/es/components/dialog/enlarged-chart-dialog.js +28 -20
- package/es/components/dialog/new-table-dialog.js +23 -16
- package/es/components/dialog/new-view-dialog.js +21 -14
- package/es/components/dialog/rename-view-dialog.js +22 -14
- package/es/components/dialog/statistic-record-dialog/index.js +45 -37
- package/es/components/dialog/statistic-types-dialog/index.js +22 -14
- package/es/components/dialog/table-select-dialog.js +23 -15
- package/es/components/dropdown-menu/statistic-dropdown-menu.js +49 -41
- package/es/components/dtable-popover.js +19 -12
- package/es/components/dtable-search-input.js +21 -13
- package/es/components/dtable-select.js +20 -12
- package/es/components/icon.js +11 -4
- package/es/components/index.js +76 -11
- package/es/components/loading.js +10 -3
- package/es/components/modal-portal.js +12 -5
- package/es/components/popover/color-rules/color-rule.js +33 -25
- package/es/components/popover/color-rules/index.js +14 -6
- package/es/components/popover/color-rules/rule-filters/filter.js +34 -27
- package/es/components/popover/color-rules/rule-filters/index.js +25 -17
- package/es/components/popover/color-rules/rule-filters/number-input.js +17 -9
- package/es/components/popover/color-rules-popover.js +32 -24
- package/es/components/popover/color-selector-popover.js +17 -10
- package/es/components/seatable-radio/index.js +16 -9
- package/es/components/select/index.js +9 -2
- package/es/components/select/option-group.js +27 -19
- package/es/components/select/option.js +14 -6
- package/es/components/select/select.js +25 -17
- package/es/components/toast/alert.js +31 -24
- package/es/components/toast/index.js +10 -3
- package/es/components/toast/toast.js +20 -12
- package/es/components/toast/toastManager.js +17 -9
- package/es/components/toast/toaster.js +14 -6
- package/es/constants/color-rules.js +12 -6
- package/es/constants/dtable-select-style.js +9 -4
- package/es/constants/event-types.js +10 -4
- package/es/constants/index.js +96 -67
- package/es/constants/key-codes.js +2 -0
- package/es/constants/map.js +8 -2
- package/es/constants/model.js +26 -20
- package/es/constants/regions.js +8 -3
- package/es/constants/zIndexes.js +7 -1
- package/es/custom-g2.js +236 -208
- package/es/dashboard.js +58 -50
- package/es/desktop-dashboard.js +55 -47
- package/es/index.js +6 -3
- package/es/locale/index.js +13 -10
- package/es/locale/lang/de.js +7 -1
- package/es/locale/lang/en.js +7 -1
- package/es/locale/lang/fr.js +7 -1
- package/es/locale/lang/zh_CN.js +7 -1
- package/es/mobile-dashboard.js +46 -38
- package/es/model/bar-group.js +19 -11
- package/es/model/bar.js +18 -10
- package/es/model/base-model.js +9 -2
- package/es/model/basic-number-card.js +16 -8
- package/es/model/collaborators.js +9 -2
- package/es/model/combination.js +20 -12
- package/es/model/compare-bar.js +24 -16
- package/es/model/completeness-group.js +16 -8
- package/es/model/completeness.js +13 -5
- package/es/model/custom-bar.js +14 -6
- package/es/model/dashboard.js +14 -6
- package/es/model/generic-model.js +141 -133
- package/es/model/heat-map.js +19 -11
- package/es/model/horizontal-bar-group.js +18 -10
- package/es/model/horizontal-bar.js +18 -10
- package/es/model/index.js +185 -53
- package/es/model/map.js +23 -15
- package/es/model/mirror.js +21 -13
- package/es/model/pie.js +18 -10
- package/es/model/ring.js +19 -11
- package/es/model/scatter.js +14 -6
- package/es/model/statistic-dashboard.js +9 -2
- package/es/model/table.js +18 -10
- package/es/model/trend.js +20 -12
- package/es/model/world-map.js +21 -13
- package/es/service/chart-service.js +14 -7
- package/es/service/dashboard-service.js +41 -34
- package/es/service/map-json.js +14 -8
- package/es/stat-editor/chart-name-editor.js +15 -8
- package/es/stat-editor/index.js +24 -16
- package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +29 -21
- package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +57 -49
- package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +31 -23
- package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +11 -4
- package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +27 -19
- package/es/stat-editor/stat-settings/advance-chart-settings/index.js +51 -43
- package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +31 -23
- package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +31 -23
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +45 -37
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +27 -19
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +34 -26
- package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +55 -47
- package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +30 -22
- package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +26 -18
- package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +35 -27
- package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +32 -24
- package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +41 -33
- package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +30 -22
- package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +26 -18
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +54 -46
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +31 -23
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +34 -26
- package/es/stat-editor/stat-settings/basic-chart-settings/index.js +85 -77
- package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +29 -21
- package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +81 -73
- package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +24 -16
- package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +27 -19
- package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +26 -18
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +57 -49
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +25 -17
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +55 -47
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +19 -11
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +53 -45
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +17 -9
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +28 -20
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +38 -30
- package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +58 -50
- package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +25 -17
- package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +55 -47
- package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +19 -11
- package/es/stat-editor/stat-settings/color-setting/color-picker.js +19 -12
- package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +70 -62
- package/es/stat-editor/stat-settings/map/map-level.js +20 -13
- package/es/stat-editor/stat-settings/map/map-province-city.js +27 -20
- package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +19 -11
- package/es/stat-editor/stat-settings/public-setting/base-settings.js +28 -20
- package/es/stat-editor/stat-settings/public-setting/calender.js +29 -22
- package/es/stat-editor/stat-settings/public-setting/column-settings.js +13 -6
- package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +16 -9
- package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +21 -13
- package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +15 -8
- package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +19 -11
- package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +35 -27
- package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +15 -8
- package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +26 -18
- package/es/stat-list/chart-preview.js +28 -20
- package/es/stat-list/index.js +35 -27
- package/es/stat-view/area-chart.js +50 -43
- package/es/stat-view/bar-chart.js +54 -47
- package/es/stat-view/base-chart.js +32 -24
- package/es/stat-view/basic-number-card.js +26 -19
- package/es/stat-view/combination-chart.js +56 -49
- package/es/stat-view/compare-chart.js +46 -39
- package/es/stat-view/completeness-chart.js +35 -28
- package/es/stat-view/custom-bar.js +38 -31
- package/es/stat-view/dashboard-chart.js +22 -15
- package/es/stat-view/heat-map.js +50 -43
- package/es/stat-view/horizontal-bar-chart.js +58 -51
- package/es/stat-view/index.js +80 -73
- package/es/stat-view/line-chart.js +46 -39
- package/es/stat-view/map.js +40 -33
- package/es/stat-view/mirror.js +28 -21
- package/es/stat-view/pie-chart.js +36 -29
- package/es/stat-view/pivot-table/index.js +39 -32
- package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +39 -31
- package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +37 -29
- package/es/stat-view/pivot-table/pivot-table-display-name.js +72 -70
- package/es/stat-view/pivot-table/two-dimension-table.js +70 -62
- package/es/stat-view/ring-chart.js +45 -38
- package/es/stat-view/scatter-chart.js +37 -30
- package/es/stat-view/treemap-chart.js +44 -37
- package/es/stat-view/trend-chart.js +39 -32
- package/es/stat-view/world-map.js +40 -33
- package/es/tabs/index.js +40 -32
- package/es/tabs/tab.js +34 -26
- package/es/utils/basic-chart-utils.js +9 -2
- package/es/utils/cell-format.js +22 -14
- package/es/utils/cell-value.js +14 -7
- package/es/utils/collaborator.js +13 -4
- package/es/utils/color-utils.js +29 -18
- package/es/utils/column-utils.js +29 -18
- package/es/utils/column.js +11 -4
- package/es/utils/common-utils.js +65 -41
- package/es/utils/date-format.js +8 -2
- package/es/utils/export-table-utils.js +91 -82
- package/es/utils/index.js +100 -11
- package/es/utils/map.js +36 -26
- package/es/utils/model.js +14 -6
- package/es/utils/object.js +15 -6
- package/es/utils/pivot-table.js +23 -16
- package/es/utils/row-utils.js +33 -23
- package/es/utils/search.js +29 -21
- package/es/utils/sql-utils.js +75 -65
- package/es/utils/stat-utils.js +69 -67
- package/es/utils/trend-utils.js +40 -32
- package/package.json +3 -3
|
@@ -1,26 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _dataSet = _interopRequireDefault(require("@antv/data-set"));
|
|
11
|
+
var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
|
|
12
|
+
var _util = require("@antv/util");
|
|
13
|
+
var _text = require("@antv/g2/esm/util/text");
|
|
14
|
+
var _dtableStore = require("dtable-store");
|
|
15
|
+
var _baseChart = _interopRequireDefault(require("./base-chart"));
|
|
16
|
+
var _customG = require("../custom-g2");
|
|
17
|
+
var _commonUtils = require("../utils/common-utils");
|
|
18
|
+
var _constants = require("../constants");
|
|
19
|
+
var _statisticChartModule = _interopRequireDefault(require("../assets/css/statistic-chart.module.css"));
|
|
13
20
|
const propTypes = {
|
|
14
|
-
isPreview:
|
|
15
|
-
isEnlarge:
|
|
16
|
-
theme:
|
|
17
|
-
colorThemeName:
|
|
18
|
-
statItem:
|
|
19
|
-
chartCalculator:
|
|
20
|
-
getTableById:
|
|
21
|
-
toggleStatisticRecordsDialog:
|
|
21
|
+
isPreview: _propTypes.default.bool,
|
|
22
|
+
isEnlarge: _propTypes.default.bool,
|
|
23
|
+
theme: _propTypes.default.string,
|
|
24
|
+
colorThemeName: _propTypes.default.string,
|
|
25
|
+
statItem: _propTypes.default.object,
|
|
26
|
+
chartCalculator: _propTypes.default.object,
|
|
27
|
+
getTableById: _propTypes.default.func,
|
|
28
|
+
toggleStatisticRecordsDialog: _propTypes.default.func
|
|
22
29
|
};
|
|
23
|
-
class TreemapChart extends
|
|
30
|
+
class TreemapChart extends _baseChart.default {
|
|
24
31
|
constructor(props) {
|
|
25
32
|
super(props);
|
|
26
33
|
this.componentDidMount = async () => {
|
|
@@ -83,14 +90,14 @@ class TreemapChart extends BaseChart {
|
|
|
83
90
|
summary_column_key
|
|
84
91
|
} = statItem;
|
|
85
92
|
const table = getTableById(table_id);
|
|
86
|
-
const selectedNumericColumn = TableUtils.getTableColumnByKey(table, summary_column_key);
|
|
93
|
+
const selectedNumericColumn = _dtableStore.TableUtils.getTableColumnByKey(table, summary_column_key);
|
|
87
94
|
if (isPreview) {
|
|
88
|
-
this.chart = new Chart({
|
|
95
|
+
this.chart = new _customG.Chart({
|
|
89
96
|
container: this.container,
|
|
90
97
|
autoFit: true
|
|
91
98
|
});
|
|
92
99
|
} else {
|
|
93
|
-
this.chart = new Chart({
|
|
100
|
+
this.chart = new _customG.Chart({
|
|
94
101
|
container: this.container,
|
|
95
102
|
height: 400,
|
|
96
103
|
width: 700
|
|
@@ -99,20 +106,20 @@ class TreemapChart extends BaseChart {
|
|
|
99
106
|
this.chart.on('element:click', e => {
|
|
100
107
|
this.props.toggleStatisticRecordsDialog(e.data.data, statItem);
|
|
101
108
|
});
|
|
102
|
-
const currentTheme = getCurrentTheme(colorThemeName);
|
|
103
|
-
const newData = formatPieChartData(data, statItem, table, currentTheme);
|
|
109
|
+
const currentTheme = (0, _commonUtils.getCurrentTheme)(colorThemeName);
|
|
110
|
+
const newData = (0, _commonUtils.formatPieChartData)(data, statItem, table, currentTheme);
|
|
104
111
|
const colorSet = newData.colorSet;
|
|
105
112
|
const {
|
|
106
113
|
DataView
|
|
107
|
-
} =
|
|
114
|
+
} = _dataSet.default;
|
|
108
115
|
const dv = new DataView();
|
|
109
116
|
const fullData = {
|
|
110
117
|
name: 'root',
|
|
111
118
|
children: newData.map(item => {
|
|
112
119
|
let name = item.name;
|
|
113
|
-
item.name = name || name === 0 ? name :
|
|
120
|
+
item.name = name || name === 0 ? name : _reactIntlUniversal.default.get(_constants.EMPTY_NAME);
|
|
114
121
|
if (name === 'Others') {
|
|
115
|
-
item.name =
|
|
122
|
+
item.name = _reactIntlUniversal.default.get('Others');
|
|
116
123
|
}
|
|
117
124
|
return item;
|
|
118
125
|
})
|
|
@@ -167,7 +174,7 @@ class TreemapChart extends BaseChart {
|
|
|
167
174
|
chart.polygon().position('x*y').color('name', colorSet).tooltip('name*formatted_value*percent', (name, value, percent) => {
|
|
168
175
|
return {
|
|
169
176
|
name,
|
|
170
|
-
info: summary_type === STATISTICS_COUNT_TYPE.COUNT ? "".concat(value) : "".concat(selectedNumericColumn.name, ": ").concat(value, " (").concat(percent, ")")
|
|
177
|
+
info: summary_type === _constants.STATISTICS_COUNT_TYPE.COUNT ? "".concat(value) : "".concat(selectedNumericColumn.name, ": ").concat(value, " (").concat(percent, ")")
|
|
171
178
|
};
|
|
172
179
|
}).style({
|
|
173
180
|
lineWidth: 1,
|
|
@@ -196,22 +203,22 @@ class TreemapChart extends BaseChart {
|
|
|
196
203
|
|
|
197
204
|
// customize label layout: show ellipsis for long labels
|
|
198
205
|
function limitInShape(items, labels, shapes, region) {
|
|
199
|
-
each(labels, (label, index) => {
|
|
206
|
+
(0, _util.each)(labels, (label, index) => {
|
|
200
207
|
const labelBBox = label.getCanvasBBox();
|
|
201
208
|
const shapeBBox = shapes[index].getBBox();
|
|
202
209
|
if (labelBBox.minX < shapeBBox.minX || labelBBox.minY < shapeBBox.minY || labelBBox.maxX > shapeBBox.maxX || labelBBox.maxY > shapeBBox.maxY) {
|
|
203
210
|
const translateX = labelBBox.width - shapeBBox.width + 20;
|
|
204
211
|
const textShapes = label.findAll(shape => shape.get('type') === 'text');
|
|
205
212
|
textShapes.forEach(textShape => {
|
|
206
|
-
const style = pick(textShape.attr(), ['fontSize', 'fontFamily', 'fontWeight', 'fontStyle', 'fontVariant']);
|
|
213
|
+
const style = (0, _util.pick)(textShape.attr(), ['fontSize', 'fontFamily', 'fontWeight', 'fontStyle', 'fontVariant']);
|
|
207
214
|
const textBox = textShape.getCanvasBBox();
|
|
208
|
-
const text = getEllipsisText(textShape.attr('text'), textBox.width - Math.abs(translateX), style);
|
|
215
|
+
const text = (0, _text.getEllipsisText)(textShape.attr('text'), textBox.width - Math.abs(translateX), style);
|
|
209
216
|
textShape.attr('text', text);
|
|
210
217
|
});
|
|
211
218
|
}
|
|
212
219
|
});
|
|
213
220
|
}
|
|
214
|
-
registerGeometryLabelLayout('custom-limit-in-shape', limitInShape);
|
|
221
|
+
(0, _customG.registerGeometryLabelLayout)('custom-limit-in-shape', limitInShape);
|
|
215
222
|
}
|
|
216
223
|
shouldComponentUpdate(nextProps, nextState) {
|
|
217
224
|
const {
|
|
@@ -235,11 +242,11 @@ class TreemapChart extends BaseChart {
|
|
|
235
242
|
const {
|
|
236
243
|
isCalculatingData
|
|
237
244
|
} = this.state;
|
|
238
|
-
return /*#__PURE__*/
|
|
245
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isCalculatingData && this.renderLoading(), /*#__PURE__*/_react.default.createElement("div", {
|
|
239
246
|
ref: ref => this.container = ref,
|
|
240
|
-
className: "statistic-chart-container ".concat(
|
|
247
|
+
className: "statistic-chart-container ".concat(_statisticChartModule.default['statistic-treemap-chart-container'])
|
|
241
248
|
}));
|
|
242
249
|
}
|
|
243
250
|
}
|
|
244
251
|
TreemapChart.propTypes = propTypes;
|
|
245
|
-
|
|
252
|
+
var _default = exports.default = TreemapChart;
|
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
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 _constants = require("../constants");
|
|
8
15
|
const propTypes = {
|
|
9
|
-
isPreview:
|
|
10
|
-
statItem:
|
|
11
|
-
chartCalculator:
|
|
12
|
-
getTableById:
|
|
16
|
+
isPreview: _propTypes.default.bool,
|
|
17
|
+
statItem: _propTypes.default.object,
|
|
18
|
+
chartCalculator: _propTypes.default.object,
|
|
19
|
+
getTableById: _propTypes.default.func
|
|
13
20
|
};
|
|
14
|
-
class BasicNumericCard extends
|
|
21
|
+
class BasicNumericCard extends _baseChart.default {
|
|
15
22
|
constructor(props) {
|
|
16
23
|
super(props);
|
|
17
24
|
this.componentDidMount = async () => {
|
|
@@ -67,12 +74,12 @@ class BasicNumericCard extends BaseChart {
|
|
|
67
74
|
statItem
|
|
68
75
|
} = this.props;
|
|
69
76
|
if (isPreview) {
|
|
70
|
-
this.chart = new Chart({
|
|
77
|
+
this.chart = new _customG.Chart({
|
|
71
78
|
container: this.container,
|
|
72
79
|
autoFit: true
|
|
73
80
|
});
|
|
74
81
|
} else {
|
|
75
|
-
this.chart = new Chart({
|
|
82
|
+
this.chart = new _customG.Chart({
|
|
76
83
|
container: this.container,
|
|
77
84
|
autoFit: true,
|
|
78
85
|
height: 400,
|
|
@@ -83,7 +90,7 @@ class BasicNumericCard extends BaseChart {
|
|
|
83
90
|
summary_method
|
|
84
91
|
} = statItem;
|
|
85
92
|
const latest = data && data.latest;
|
|
86
|
-
const content = summary_method === SUMMARY_METHOD_MAP.Distinct_values ? latest : this.formatData(latest);
|
|
93
|
+
const content = summary_method === _constants.SUMMARY_METHOD_MAP.Distinct_values ? latest : this.formatData(latest);
|
|
87
94
|
const fontSize = this.getFontSize(content);
|
|
88
95
|
let labelFontSize = fontSize - 32;
|
|
89
96
|
const themeColors = this.getThemeColors();
|
|
@@ -99,15 +106,15 @@ class BasicNumericCard extends BaseChart {
|
|
|
99
106
|
getTableById,
|
|
100
107
|
statItem
|
|
101
108
|
} = this.props;
|
|
102
|
-
if (typeof data !== 'number') return
|
|
109
|
+
if (typeof data !== 'number') return _reactIntlUniversal.default.get(_constants.EMPTY_NAME);
|
|
103
110
|
const {
|
|
104
111
|
table_id,
|
|
105
112
|
summary_type,
|
|
106
113
|
summary_column
|
|
107
114
|
} = statItem;
|
|
108
|
-
if (summary_type !== STATISTICS_COUNT_TYPE.COUNT) {
|
|
115
|
+
if (summary_type !== _constants.STATISTICS_COUNT_TYPE.COUNT) {
|
|
109
116
|
const table = getTableById(table_id);
|
|
110
|
-
const selectedColumn = TableUtils.getTableColumnByKey(table, summary_column);
|
|
117
|
+
const selectedColumn = _dtableStore.TableUtils.getTableColumnByKey(table, summary_column);
|
|
111
118
|
return this.getNumberDisplayString(data, selectedColumn.data || {});
|
|
112
119
|
}
|
|
113
120
|
let string = data + '';
|
|
@@ -167,20 +174,20 @@ class BasicNumericCard extends BaseChart {
|
|
|
167
174
|
date_granularity
|
|
168
175
|
} = statItem;
|
|
169
176
|
let conjunctions = '';
|
|
170
|
-
if (date_granularity === DATE_GRANULARITY.YEAR) {
|
|
171
|
-
conjunctions =
|
|
172
|
-
} else if (date_granularity === DATE_GRANULARITY.QUARTER) {
|
|
173
|
-
conjunctions =
|
|
174
|
-
} else if (date_granularity === DATE_GRANULARITY.MONTH) {
|
|
175
|
-
conjunctions =
|
|
176
|
-
} else if (date_granularity === DATE_GRANULARITY.WEEK) {
|
|
177
|
-
conjunctions =
|
|
177
|
+
if (date_granularity === _constants.DATE_GRANULARITY.YEAR) {
|
|
178
|
+
conjunctions = _reactIntlUniversal.default.get('The_year_before_last');
|
|
179
|
+
} else if (date_granularity === _constants.DATE_GRANULARITY.QUARTER) {
|
|
180
|
+
conjunctions = _reactIntlUniversal.default.get('The_quarter_before_last');
|
|
181
|
+
} else if (date_granularity === _constants.DATE_GRANULARITY.MONTH) {
|
|
182
|
+
conjunctions = _reactIntlUniversal.default.get('The_month_before_last');
|
|
183
|
+
} else if (date_granularity === _constants.DATE_GRANULARITY.WEEK) {
|
|
184
|
+
conjunctions = _reactIntlUniversal.default.get('The_week_before_last');
|
|
178
185
|
} else if (date_granularity === 'days_7') {
|
|
179
|
-
conjunctions =
|
|
186
|
+
conjunctions = _reactIntlUniversal.default.get('Previous_7_days');
|
|
180
187
|
} else if (date_granularity === 'days_30') {
|
|
181
|
-
conjunctions =
|
|
188
|
+
conjunctions = _reactIntlUniversal.default.get('Previous_30_days');
|
|
182
189
|
} else {
|
|
183
|
-
conjunctions =
|
|
190
|
+
conjunctions = _reactIntlUniversal.default.get('The_day_before_yesterday');
|
|
184
191
|
}
|
|
185
192
|
const {
|
|
186
193
|
result,
|
|
@@ -195,7 +202,7 @@ class BasicNumericCard extends BaseChart {
|
|
|
195
202
|
}
|
|
196
203
|
let resultText = "".concat(Number.parseFloat(result * 100).toFixed(2), "%•").concat(conjunctions).concat(previous);
|
|
197
204
|
if (!previous) {
|
|
198
|
-
resultText =
|
|
205
|
+
resultText = _reactIntlUniversal.default.get('Can_not_compare_with_var', {
|
|
199
206
|
var: conjunctions.toLowerCase()
|
|
200
207
|
});
|
|
201
208
|
}
|
|
@@ -232,11 +239,11 @@ class BasicNumericCard extends BaseChart {
|
|
|
232
239
|
const {
|
|
233
240
|
isCalculatingData
|
|
234
241
|
} = this.state;
|
|
235
|
-
return /*#__PURE__*/
|
|
242
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isCalculatingData && this.renderLoading(), /*#__PURE__*/_react.default.createElement("div", {
|
|
236
243
|
ref: ref => this.container = ref,
|
|
237
244
|
className: "statistic-chart-container statistic-number-card"
|
|
238
245
|
}));
|
|
239
246
|
}
|
|
240
247
|
}
|
|
241
248
|
BasicNumericCard.propTypes = propTypes;
|
|
242
|
-
|
|
249
|
+
var _default = exports.default = BasicNumericCard;
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _index = _interopRequireDefault(require("@antv/data-set/lib/index"));
|
|
11
|
+
var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
|
|
12
|
+
var _dtableStore = require("dtable-store");
|
|
13
|
+
var _baseChart = _interopRequireDefault(require("./base-chart"));
|
|
14
|
+
var _customG = require("../custom-g2");
|
|
15
|
+
var _constants = require("../constants");
|
|
16
|
+
var _map = require("../constants/map");
|
|
10
17
|
const WIDTH = 798;
|
|
11
18
|
const HEIGHT = 394;
|
|
12
|
-
class WorldMap extends
|
|
19
|
+
class WorldMap extends _baseChart.default {
|
|
13
20
|
constructor(props) {
|
|
14
21
|
super(props);
|
|
15
22
|
this.rerenderChart = () => {
|
|
@@ -46,13 +53,13 @@ class WorldMap extends BaseChart {
|
|
|
46
53
|
value: value || 0,
|
|
47
54
|
formatted_value: item.formatted_value
|
|
48
55
|
});
|
|
49
|
-
if (type === STAT_TYPE.WORLD_MAP_BUBBLE) {
|
|
56
|
+
if (type === _constants.STAT_TYPE.WORLD_MAP_BUBBLE) {
|
|
50
57
|
sum += item.value;
|
|
51
58
|
}
|
|
52
59
|
}
|
|
53
60
|
}
|
|
54
61
|
});
|
|
55
|
-
if (type === STAT_TYPE.WORLD_MAP_BUBBLE) {
|
|
62
|
+
if (type === _constants.STAT_TYPE.WORLD_MAP_BUBBLE) {
|
|
56
63
|
statisticNewData.sum = sum;
|
|
57
64
|
}
|
|
58
65
|
return statisticNewData;
|
|
@@ -75,16 +82,16 @@ class WorldMap extends BaseChart {
|
|
|
75
82
|
summary_method,
|
|
76
83
|
summary_column
|
|
77
84
|
} = this.props.statItem;
|
|
78
|
-
const currentColorOption = COLOR_OPTIONS.filter(item => item.name === data_color)[0] || COLOR_OPTIONS[0];
|
|
85
|
+
const currentColorOption = _constants.COLOR_OPTIONS.filter(item => item.name === data_color)[0] || _constants.COLOR_OPTIONS[0];
|
|
79
86
|
const {
|
|
80
87
|
exampleColors,
|
|
81
88
|
highlightedBorderColor
|
|
82
89
|
} = currentColorOption;
|
|
83
|
-
let summaryColumnData = DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
84
|
-
if (summary_type === SUMMARY_TYPE.ADVANCED) {
|
|
90
|
+
let summaryColumnData = _constants.DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
91
|
+
if (summary_type === _constants.SUMMARY_TYPE.ADVANCED) {
|
|
85
92
|
const table = getTableById(table_id);
|
|
86
|
-
const summaryColumn = TableUtils.getTableColumnByKey(table, summary_column) || {};
|
|
87
|
-
summaryColumnData = summaryColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
93
|
+
const summaryColumn = _dtableStore.TableUtils.getTableColumnByKey(table, summary_column) || {};
|
|
94
|
+
summaryColumnData = summaryColumn.data || _constants.DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
88
95
|
}
|
|
89
96
|
this.statisticView = this.chart.createView();
|
|
90
97
|
this.statisticView.data(userDataView.rows);
|
|
@@ -149,11 +156,11 @@ class WorldMap extends BaseChart {
|
|
|
149
156
|
summary_method,
|
|
150
157
|
summary_column
|
|
151
158
|
} = this.props.statItem;
|
|
152
|
-
let summaryColumnData = DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
153
|
-
if (summary_type === SUMMARY_TYPE.ADVANCED) {
|
|
159
|
+
let summaryColumnData = _constants.DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
160
|
+
if (summary_type === _constants.SUMMARY_TYPE.ADVANCED) {
|
|
154
161
|
const table = getTableById(table_id);
|
|
155
|
-
const summaryColumn = TableUtils.getTableColumnByKey(table, summary_column) || {};
|
|
156
|
-
summaryColumnData = summaryColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
162
|
+
const summaryColumn = _dtableStore.TableUtils.getTableColumnByKey(table, summary_column) || {};
|
|
163
|
+
summaryColumnData = summaryColumn.data || _constants.DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
157
164
|
}
|
|
158
165
|
this.statisticView = this.chart.createView();
|
|
159
166
|
this.statisticView.data(userDv.rows);
|
|
@@ -262,7 +269,7 @@ class WorldMap extends BaseChart {
|
|
|
262
269
|
} = this.getSize();
|
|
263
270
|
const horizontalPadding = (containerWidth - mapWidth) / 4;
|
|
264
271
|
const leftPadding = horizontalPadding < 20 ? 20 : horizontalPadding;
|
|
265
|
-
this.chart = new Chart({
|
|
272
|
+
this.chart = new _customG.Chart({
|
|
266
273
|
container: this.container,
|
|
267
274
|
width: containerWidth,
|
|
268
275
|
height: containerHeight,
|
|
@@ -285,7 +292,7 @@ class WorldMap extends BaseChart {
|
|
|
285
292
|
showMarkers: false,
|
|
286
293
|
shared: true,
|
|
287
294
|
containerTpl: '<div class="g2-tooltip"><div class="g2-tooltip-list"></div></div>',
|
|
288
|
-
itemTpl: "<div class=\"g2-tooltip-content\"><div class=\"tooltip-name\">{name}<div><div class=\"tooltip-item\">".concat(
|
|
295
|
+
itemTpl: "<div class=\"g2-tooltip-content\"><div class=\"tooltip-name\">{name}<div><div class=\"tooltip-item\">".concat(_reactIntlUniversal.default.get(_constants.TITLE_AMOUNT), " : {value}<div></div>"),
|
|
289
296
|
domStyles: {
|
|
290
297
|
'g2-tooltip': this.getDefaultChartStyleByKey('g2-tooltip'),
|
|
291
298
|
'tooltip-item': this.getDefaultChartStyleByKey('tooltip-item')
|
|
@@ -300,7 +307,7 @@ class WorldMap extends BaseChart {
|
|
|
300
307
|
}
|
|
301
308
|
});
|
|
302
309
|
this.chart.axis(false);
|
|
303
|
-
this.dataSet = new
|
|
310
|
+
this.dataSet = new _index.default();
|
|
304
311
|
|
|
305
312
|
// transform map data
|
|
306
313
|
const mapData = this.dataSet.createView('mapDataModel').source(geolocation, {
|
|
@@ -339,7 +346,7 @@ class WorldMap extends BaseChart {
|
|
|
339
346
|
chartCalculator
|
|
340
347
|
} = this.props;
|
|
341
348
|
this.props.queryMapJson({
|
|
342
|
-
map_level: MAP_LEVEL.WORLD
|
|
349
|
+
map_level: _map.MAP_LEVEL.WORLD
|
|
343
350
|
}, mapJson => {
|
|
344
351
|
this.setState({
|
|
345
352
|
isDataLoaded: true
|
|
@@ -407,18 +414,18 @@ class WorldMap extends BaseChart {
|
|
|
407
414
|
isDataLoaded,
|
|
408
415
|
isCalculatingData
|
|
409
416
|
} = this.state;
|
|
410
|
-
return /*#__PURE__*/
|
|
417
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (!isDataLoaded || isCalculatingData) && this.renderLoading(), /*#__PURE__*/_react.default.createElement("div", {
|
|
411
418
|
ref: ref => this.container = ref,
|
|
412
419
|
className: "statistic-chart-container map d-flex justify-content-around align-items-center w-100 h-100"
|
|
413
420
|
}));
|
|
414
421
|
}
|
|
415
422
|
}
|
|
416
423
|
WorldMap.propTypes = {
|
|
417
|
-
isPreview:
|
|
418
|
-
statItem:
|
|
419
|
-
chartCalculator:
|
|
420
|
-
getTableById:
|
|
421
|
-
queryMapJson:
|
|
422
|
-
toggleStatisticRecordsDialog:
|
|
424
|
+
isPreview: _propTypes.default.bool,
|
|
425
|
+
statItem: _propTypes.default.object,
|
|
426
|
+
chartCalculator: _propTypes.default.object,
|
|
427
|
+
getTableById: _propTypes.default.func,
|
|
428
|
+
queryMapJson: _propTypes.default.func.isRequired,
|
|
429
|
+
toggleStatisticRecordsDialog: _propTypes.default.func
|
|
423
430
|
};
|
|
424
|
-
|
|
431
|
+
var _default = exports.default = WorldMap;
|
package/es/tabs/index.js
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
|
|
11
|
+
var _newViewDialog = _interopRequireDefault(require("../components/dialog/new-view-dialog"));
|
|
12
|
+
var _renameViewDialog = _interopRequireDefault(require("../components/dialog/rename-view-dialog"));
|
|
13
|
+
var _deleteConfirmationDialog = _interopRequireDefault(require("../components/dialog/delete-confirmation-dialog"));
|
|
14
|
+
var _tab = _interopRequireDefault(require("./tab"));
|
|
15
|
+
var _statisticTabsModule = _interopRequireDefault(require("./statistic-tabs.module.css"));
|
|
8
16
|
const SCROLL_TYPE = {
|
|
9
17
|
PREV: 'prev',
|
|
10
18
|
NEXT: 'next'
|
|
11
19
|
};
|
|
12
|
-
class DashboardTabs extends Component {
|
|
20
|
+
class DashboardTabs extends _react.Component {
|
|
13
21
|
constructor(_props) {
|
|
14
22
|
super(_props);
|
|
15
23
|
this.initSelectedViewScroll = props => {
|
|
@@ -175,7 +183,7 @@ class DashboardTabs extends Component {
|
|
|
175
183
|
}
|
|
176
184
|
const canDelete = statistics.length > 1;
|
|
177
185
|
return statistics.map((item, index) => {
|
|
178
|
-
return /*#__PURE__*/
|
|
186
|
+
return /*#__PURE__*/_react.default.createElement(_tab.default, {
|
|
179
187
|
key: "statistic-view-".concat(index),
|
|
180
188
|
item: item,
|
|
181
189
|
theme: theme,
|
|
@@ -224,39 +232,39 @@ class DashboardTabs extends Component {
|
|
|
224
232
|
statistics,
|
|
225
233
|
selectedDashboardIdx
|
|
226
234
|
} = this.props;
|
|
227
|
-
return /*#__PURE__*/
|
|
228
|
-
className:
|
|
229
|
-
}, /*#__PURE__*/
|
|
230
|
-
className: "".concat(
|
|
235
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
236
|
+
className: _statisticTabsModule.default['tabs-container']
|
|
237
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
238
|
+
className: "".concat(_statisticTabsModule.default['views-tabs-scroll'], " d-flex pr-1"),
|
|
231
239
|
ref: ref => this.viewsTabsScroll = ref,
|
|
232
240
|
onScroll: this.onViewsScroll
|
|
233
|
-
}, this.renderTabs()), (canScrollPrev || canScrollNext) && !isMobile && /*#__PURE__*/
|
|
234
|
-
className:
|
|
235
|
-
}, /*#__PURE__*/
|
|
236
|
-
className: "".concat(
|
|
241
|
+
}, this.renderTabs()), (canScrollPrev || canScrollNext) && !isMobile && /*#__PURE__*/_react.default.createElement("div", {
|
|
242
|
+
className: _statisticTabsModule.default['views-scroll-control']
|
|
243
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
244
|
+
className: "".concat(_statisticTabsModule.default['scroll-control-btn'], " ").concat(_statisticTabsModule.default['scroll-prev'], " ").concat(canScrollPrev && _statisticTabsModule.default['scroll-active']),
|
|
237
245
|
onClick: this.onScrollWithControl.bind(this, SCROLL_TYPE.PREV)
|
|
238
|
-
}, /*#__PURE__*/
|
|
239
|
-
className: "dtable-font dtable-icon-left-slide ".concat(
|
|
240
|
-
})), /*#__PURE__*/
|
|
241
|
-
className: "".concat(
|
|
246
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
247
|
+
className: "dtable-font dtable-icon-left-slide ".concat(_statisticTabsModule.default['btn-scroll-icon'])
|
|
248
|
+
})), /*#__PURE__*/_react.default.createElement("span", {
|
|
249
|
+
className: "".concat(_statisticTabsModule.default['scroll-control-btn'], " ").concat(_statisticTabsModule.default['scroll-next'], " ").concat(canScrollNext && _statisticTabsModule.default['scroll-active']),
|
|
242
250
|
onClick: this.onScrollWithControl.bind(this, SCROLL_TYPE.NEXT)
|
|
243
|
-
}, /*#__PURE__*/
|
|
244
|
-
className: "dtable-font dtable-icon-right-slide ".concat(
|
|
245
|
-
}))), !isMobile && /*#__PURE__*/
|
|
246
|
-
className:
|
|
251
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
252
|
+
className: "dtable-font dtable-icon-right-slide ".concat(_statisticTabsModule.default['btn-scroll-icon'])
|
|
253
|
+
}))), !isMobile && /*#__PURE__*/_react.default.createElement("div", {
|
|
254
|
+
className: _statisticTabsModule.default['btn-add-view'],
|
|
247
255
|
key: 'btn-add-view',
|
|
248
256
|
onClick: this.onNewViewToggle
|
|
249
|
-
}, /*#__PURE__*/
|
|
250
|
-
className: "".concat(
|
|
251
|
-
})), isShowNewViewDialog && /*#__PURE__*/
|
|
257
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
258
|
+
className: "".concat(_statisticTabsModule.default['add-map-view-icon'], " dtable-font dtable-icon-add-table")
|
|
259
|
+
})), isShowNewViewDialog && /*#__PURE__*/_react.default.createElement(_newViewDialog.default, {
|
|
252
260
|
onNewViewConfirm: this.onAddDashboard,
|
|
253
261
|
onNewViewCancel: this.onNewViewCancel
|
|
254
|
-
}), isShowRenameViewDialog && /*#__PURE__*/
|
|
262
|
+
}), isShowRenameViewDialog && /*#__PURE__*/_react.default.createElement(_renameViewDialog.default, {
|
|
255
263
|
viewName: statistics[selectedDashboardIdx].name,
|
|
256
264
|
onRenameDashboard: this.props.renameDashboard,
|
|
257
265
|
hideRenameViewDialog: this.hideRenameViewDialog
|
|
258
|
-
}), isShowDeleteViewDialog && /*#__PURE__*/
|
|
259
|
-
header:
|
|
266
|
+
}), isShowDeleteViewDialog && /*#__PURE__*/_react.default.createElement(_deleteConfirmationDialog.default, {
|
|
267
|
+
header: _reactIntlUniversal.default.get('Delete_dashboard'),
|
|
260
268
|
name: statistics[selectedDashboardIdx].name,
|
|
261
269
|
onToggle: this.onToggleDeleteView,
|
|
262
270
|
onDelete: this.onDeleteDashBoard
|
|
@@ -266,4 +274,4 @@ class DashboardTabs extends Component {
|
|
|
266
274
|
DashboardTabs.defaultProps = {
|
|
267
275
|
isMobile: false
|
|
268
276
|
};
|
|
269
|
-
|
|
277
|
+
var _default = exports.default = DashboardTabs;
|
package/es/tabs/tab.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
|
|
11
|
+
var _components = require("../components");
|
|
12
|
+
var _utils = require("../utils");
|
|
13
|
+
var _constants = require("../constants");
|
|
14
|
+
var _statisticTabsModule = _interopRequireDefault(require("./statistic-tabs.module.css"));
|
|
15
|
+
class DashBoardTab extends _react.Component {
|
|
8
16
|
constructor(props) {
|
|
9
17
|
super(props);
|
|
10
18
|
this.onHideViewDropdown = () => {
|
|
@@ -106,7 +114,7 @@ class DashBoardTab extends Component {
|
|
|
106
114
|
dropdownMenuPosition,
|
|
107
115
|
dropRelativePosition
|
|
108
116
|
} = this.state;
|
|
109
|
-
return /*#__PURE__*/
|
|
117
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
110
118
|
ref: ref => this.itemRef = ref,
|
|
111
119
|
draggable: "true",
|
|
112
120
|
onDragStart: this.onDragStart,
|
|
@@ -114,40 +122,40 @@ class DashBoardTab extends Component {
|
|
|
114
122
|
onDragOver: this.onDragOver,
|
|
115
123
|
onDragLeave: this.onDragLeave,
|
|
116
124
|
onDrop: this.onDrop,
|
|
117
|
-
className: "\n ".concat(
|
|
118
|
-
}, /*#__PURE__*/
|
|
125
|
+
className: "\n ".concat(_statisticTabsModule.default['dashboard-tab'], "\n ").concat(dropRelativePosition === 'before' ? _statisticTabsModule.default['dashboard-tab-can-drop-before'] : '', "\n ").concat(dropRelativePosition === 'after' ? _statisticTabsModule.default['dashboard-tab-can-drop-after'] : '', "\n ")
|
|
126
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
119
127
|
ref: this.props.setViewItem,
|
|
120
128
|
onClick: this.props.onSelectDashboard,
|
|
121
|
-
className: "".concat(
|
|
122
|
-
}, /*#__PURE__*/
|
|
129
|
+
className: "".concat(_statisticTabsModule.default['dashboard-tab-content'], " ").concat(selected ? _utils.isMobile ? _statisticTabsModule.default['tab-item-active-mobile'] : _statisticTabsModule.default['tab-item-active'] : '')
|
|
130
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
123
131
|
className: "view-name"
|
|
124
|
-
}, item.name), selected && !isMobile && /*#__PURE__*/
|
|
132
|
+
}, item.name), selected && !_utils.isMobile && /*#__PURE__*/_react.default.createElement("div", {
|
|
125
133
|
onClick: this.onDropdownToggle,
|
|
126
134
|
ref: ref => this.btnViewDropdown = ref,
|
|
127
|
-
className: "".concat(
|
|
128
|
-
}, /*#__PURE__*/
|
|
129
|
-
className: "".concat(
|
|
130
|
-
}), isShowViewDropdown && /*#__PURE__*/
|
|
131
|
-
className: "".concat(theme === THEME_NAME_MAP.DARK ? 'statistic-tabs-dropdown-dark' : 'statistic-tabs-dropdown-light', " statistic-dropdown-menu dropdown-menu large show"),
|
|
135
|
+
className: "".concat(_statisticTabsModule.default['btn-view-dropdown'])
|
|
136
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
137
|
+
className: "".concat(_statisticTabsModule.default['icon'], " dtable-font dtable-icon-drop-down")
|
|
138
|
+
}), isShowViewDropdown && /*#__PURE__*/_react.default.createElement(_components.ModalPortal, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
139
|
+
className: "".concat(theme === _constants.THEME_NAME_MAP.DARK ? 'statistic-tabs-dropdown-dark' : 'statistic-tabs-dropdown-light', " statistic-dropdown-menu dropdown-menu large show"),
|
|
132
140
|
style: {
|
|
133
141
|
...dropdownMenuPosition,
|
|
134
142
|
zIndex: 1500
|
|
135
143
|
}
|
|
136
|
-
}, /*#__PURE__*/
|
|
144
|
+
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
137
145
|
className: "dropdown-item",
|
|
138
146
|
onClick: this.props.onToggleRenameView
|
|
139
|
-
}, /*#__PURE__*/
|
|
147
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
140
148
|
className: "item-icon dtable-font dtable-icon-rename"
|
|
141
|
-
}), /*#__PURE__*/
|
|
149
|
+
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
142
150
|
className: "item-text"
|
|
143
|
-
},
|
|
151
|
+
}, _reactIntlUniversal.default.get('Rename'))), canDelete && /*#__PURE__*/_react.default.createElement("button", {
|
|
144
152
|
className: "dropdown-item",
|
|
145
153
|
onClick: this.props.onDeleteDashboard
|
|
146
|
-
}, /*#__PURE__*/
|
|
154
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
147
155
|
className: "item-icon dtable-font dtable-icon-delete"
|
|
148
|
-
}), /*#__PURE__*/
|
|
156
|
+
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
149
157
|
className: "item-text"
|
|
150
|
-
},
|
|
158
|
+
}, _reactIntlUniversal.default.get('Delete'))))))));
|
|
151
159
|
}
|
|
152
160
|
}
|
|
153
|
-
|
|
161
|
+
var _default = exports.default = DashBoardTab;
|