dtable-statistic 4.3.4 → 4.3.5
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 +54 -46
- 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 +66 -60
- package/es/utils/trend-utils.js +40 -32
- package/package.json +3 -3
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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 _dtableStore = require("dtable-store");
|
|
12
|
+
var _pivotTableDisplayName = _interopRequireDefault(require("./pivot-table-display-name"));
|
|
13
|
+
var _utils = require("../../utils");
|
|
14
|
+
var _constants = require("../../constants");
|
|
15
|
+
var _statisticPivotTableModule = _interopRequireDefault(require("./statistic-pivot-table.module.css"));
|
|
16
|
+
class OneDimensionTableWithNumericColumns extends _react.PureComponent {
|
|
9
17
|
constructor() {
|
|
10
18
|
var _this;
|
|
11
19
|
super(...arguments);
|
|
@@ -15,7 +23,7 @@ class OneDimensionTableWithNumericColumns extends PureComponent {
|
|
|
15
23
|
isColumn = false,
|
|
16
24
|
isCurrentView = false
|
|
17
25
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
18
|
-
if (isMobile) return;
|
|
26
|
+
if (_utils.isMobile) return;
|
|
19
27
|
_this.props.toggleStatisticRecordsDialog(cell, _this.props.statItem, {
|
|
20
28
|
isColumn,
|
|
21
29
|
isCurrentView
|
|
@@ -34,7 +42,7 @@ class OneDimensionTableWithNumericColumns extends PureComponent {
|
|
|
34
42
|
column_groupby_column_key
|
|
35
43
|
} = statItem;
|
|
36
44
|
const statisticTableColumns = table.columns;
|
|
37
|
-
const columnGroupbyColumn = TableUtils.getTableColumnByKey(table, column_groupby_column_key);
|
|
45
|
+
const columnGroupbyColumn = _dtableStore.TableUtils.getTableColumnByKey(table, column_groupby_column_key);
|
|
38
46
|
const {
|
|
39
47
|
name: groupName
|
|
40
48
|
} = groupbyColumn;
|
|
@@ -44,17 +52,17 @@ class OneDimensionTableWithNumericColumns extends PureComponent {
|
|
|
44
52
|
const {
|
|
45
53
|
pivot_columns
|
|
46
54
|
} = pivotResult;
|
|
47
|
-
return /*#__PURE__*/
|
|
55
|
+
return /*#__PURE__*/_react.default.createElement("thead", null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("th", {
|
|
48
56
|
className: "pivot-table-header"
|
|
49
57
|
}, !rowGroupName && groupName), Array.isArray(pivot_columns) && pivot_columns.map((item, index) => {
|
|
50
58
|
const {
|
|
51
59
|
key
|
|
52
60
|
} = item;
|
|
53
61
|
const column = statisticTableColumns.find(column => column.key === key);
|
|
54
|
-
return /*#__PURE__*/
|
|
62
|
+
return /*#__PURE__*/_react.default.createElement("th", {
|
|
55
63
|
className: 'pivot-table-header',
|
|
56
64
|
key: "pivot-column-".concat(index)
|
|
57
|
-
}, /*#__PURE__*/
|
|
65
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, column.name));
|
|
58
66
|
})));
|
|
59
67
|
};
|
|
60
68
|
this.renderRows = _ref2 => {
|
|
@@ -77,7 +85,7 @@ class OneDimensionTableWithNumericColumns extends PureComponent {
|
|
|
77
85
|
pivot_columns_total
|
|
78
86
|
} = pivotResult;
|
|
79
87
|
let pivotColumnCells = [];
|
|
80
|
-
return /*#__PURE__*/
|
|
88
|
+
return /*#__PURE__*/_react.default.createElement("tbody", null, pivot_rows.map((rowItem, rowIdx) => {
|
|
81
89
|
const {
|
|
82
90
|
original_name,
|
|
83
91
|
total,
|
|
@@ -86,11 +94,11 @@ class OneDimensionTableWithNumericColumns extends PureComponent {
|
|
|
86
94
|
if (!Array.isArray(pivot_columns)) {
|
|
87
95
|
pivotColumnCells[rowIdx] = rowItem.rows || [];
|
|
88
96
|
}
|
|
89
|
-
return /*#__PURE__*/
|
|
97
|
+
return /*#__PURE__*/_react.default.createElement("tr", {
|
|
90
98
|
key: 'table-row' + rowIdx
|
|
91
|
-
}, /*#__PURE__*/
|
|
99
|
+
}, /*#__PURE__*/_react.default.createElement("td", {
|
|
92
100
|
className: 'pivot-row-name'
|
|
93
|
-
}, /*#__PURE__*/
|
|
101
|
+
}, /*#__PURE__*/_react.default.createElement(_pivotTableDisplayName.default, {
|
|
94
102
|
value: original_name,
|
|
95
103
|
column: groupbyColumn
|
|
96
104
|
})), Array.isArray(pivot_columns) && pivot_columns.map((columnMap, cellIdx) => {
|
|
@@ -108,23 +116,23 @@ class OneDimensionTableWithNumericColumns extends PureComponent {
|
|
|
108
116
|
const column = statisticTableColumns.find(item => item.key === key);
|
|
109
117
|
const displayValue = getSummaryValueDisplayString(column, total[key + method], method);
|
|
110
118
|
const isValidDisplayValue = this.props.isValidValue(displayValue);
|
|
111
|
-
return /*#__PURE__*/
|
|
112
|
-
className: "".concat(
|
|
119
|
+
return /*#__PURE__*/_react.default.createElement("td", {
|
|
120
|
+
className: "".concat(_statisticPivotTableModule.default['pivot-cell'], " ").concat(isValidDisplayValue ? '' : _statisticPivotTableModule.default['pivot-empty-cell']),
|
|
113
121
|
key: "table-cell-".concat(cellIdx),
|
|
114
122
|
onClick: () => this.toggleRecords(rowItem),
|
|
115
123
|
title: isValidDisplayValue ? displayValue : ''
|
|
116
|
-
}, isValidDisplayValue ? /*#__PURE__*/
|
|
124
|
+
}, isValidDisplayValue ? /*#__PURE__*/_react.default.createElement("div", null, displayValue) : /*#__PURE__*/_react.default.createElement("i", null));
|
|
117
125
|
}));
|
|
118
|
-
}), display_total && /*#__PURE__*/
|
|
126
|
+
}), display_total && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", {
|
|
119
127
|
className: 'pivot-column-total'
|
|
120
|
-
}, /*#__PURE__*/
|
|
128
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, _reactIntlUniversal.default.get(_constants.TITLE_TOTAL))), Array.isArray(pivot_columns) && pivot_columns.map((c, index) => {
|
|
121
129
|
const pivotColumnCell = pivotColumnCells[index];
|
|
122
130
|
const pivotColumnTotal = pivot_columns_total[c.key + c.method];
|
|
123
131
|
const column = statisticTableColumns.find(column => column.key === c.key);
|
|
124
132
|
const displayValue = getSummaryValueDisplayString(column, pivotColumnTotal, c.method);
|
|
125
133
|
const isValidDisplayValue = this.props.isValidValue(displayValue);
|
|
126
|
-
return /*#__PURE__*/
|
|
127
|
-
className: "".concat(
|
|
134
|
+
return /*#__PURE__*/_react.default.createElement("td", {
|
|
135
|
+
className: "".concat(_statisticPivotTableModule.default['pivot-cell'], " ").concat(isValidDisplayValue ? '' : _statisticPivotTableModule.default['pivot-empty-cell']),
|
|
128
136
|
key: "total-cell-".concat(index),
|
|
129
137
|
title: isValidDisplayValue ? displayValue : '',
|
|
130
138
|
onClick: () => this.toggleRecords({
|
|
@@ -133,7 +141,7 @@ class OneDimensionTableWithNumericColumns extends PureComponent {
|
|
|
133
141
|
}, {
|
|
134
142
|
isCurrentView: true
|
|
135
143
|
})
|
|
136
|
-
}, isValidDisplayValue ? /*#__PURE__*/
|
|
144
|
+
}, isValidDisplayValue ? /*#__PURE__*/_react.default.createElement("div", null, displayValue) : /*#__PURE__*/_react.default.createElement("i", null));
|
|
137
145
|
})));
|
|
138
146
|
};
|
|
139
147
|
}
|
|
@@ -149,13 +157,13 @@ class OneDimensionTableWithNumericColumns extends PureComponent {
|
|
|
149
157
|
groupby_column_key
|
|
150
158
|
} = statItem;
|
|
151
159
|
const table = getTableById(table_id);
|
|
152
|
-
const groupbyColumn = TableUtils.getTableColumnByKey(table, groupby_column_key);
|
|
160
|
+
const groupbyColumn = _dtableStore.TableUtils.getTableColumnByKey(table, groupby_column_key);
|
|
153
161
|
if (!groupbyColumn) return '';
|
|
154
|
-
return /*#__PURE__*/
|
|
162
|
+
return /*#__PURE__*/_react.default.createElement("table", {
|
|
155
163
|
style: {
|
|
156
164
|
color: textColor
|
|
157
165
|
},
|
|
158
|
-
className: "".concat(isPreview ?
|
|
166
|
+
className: "".concat(isPreview ? _statisticPivotTableModule.default['preview-pivot-table'] : _statisticPivotTableModule.default['large-pivot-table'], " ").concat(_statisticPivotTableModule.default['pivot-table'])
|
|
159
167
|
}, this.renderHeader({
|
|
160
168
|
table,
|
|
161
169
|
groupbyColumn
|
|
@@ -165,4 +173,4 @@ class OneDimensionTableWithNumericColumns extends PureComponent {
|
|
|
165
173
|
}));
|
|
166
174
|
}
|
|
167
175
|
}
|
|
168
|
-
|
|
176
|
+
var _default = exports.default = OneDimensionTableWithNumericColumns;
|
|
@@ -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 _dtableStore = require("dtable-store");
|
|
12
|
+
var _utils = require("../../utils");
|
|
13
|
+
var _commonUtils = require("../../utils/common-utils");
|
|
14
|
+
var _constants = require("../../constants");
|
|
15
|
+
class PivotTableDisplayName extends _react.default.Component {
|
|
8
16
|
constructor(props) {
|
|
9
17
|
super(props);
|
|
10
18
|
this.updateCreator = email => {
|
|
@@ -14,7 +22,7 @@ class PivotTableDisplayName extends React.Component {
|
|
|
14
22
|
let {
|
|
15
23
|
collaborators
|
|
16
24
|
} = window.app.state;
|
|
17
|
-
let creator = getKnownCreatorByEmail(collaborators, email);
|
|
25
|
+
let creator = (0, _utils.getKnownCreatorByEmail)(collaborators, email);
|
|
18
26
|
if (creator) {
|
|
19
27
|
this.setState({
|
|
20
28
|
creator
|
|
@@ -33,7 +41,7 @@ class PivotTableDisplayName extends React.Component {
|
|
|
33
41
|
}
|
|
34
42
|
|
|
35
43
|
// error handle
|
|
36
|
-
creator = generateDefaultUser(email);
|
|
44
|
+
creator = (0, _utils.generateDefaultUser)(email);
|
|
37
45
|
dtableCollaborators[email] = creator;
|
|
38
46
|
this.setState({
|
|
39
47
|
creator
|
|
@@ -50,17 +58,17 @@ class PivotTableDisplayName extends React.Component {
|
|
|
50
58
|
} = window.app.state;
|
|
51
59
|
let displayName;
|
|
52
60
|
switch (type) {
|
|
53
|
-
case CellType.SINGLE_SELECT:
|
|
54
|
-
case CellType.MULTIPLE_SELECT:
|
|
61
|
+
case _dtableStore.CellType.SINGLE_SELECT:
|
|
62
|
+
case _dtableStore.CellType.MULTIPLE_SELECT:
|
|
55
63
|
{
|
|
56
|
-
let options = getSelectColumnOptions(column);
|
|
57
|
-
let option = getOption(options, value) || {};
|
|
64
|
+
let options = (0, _utils.getSelectColumnOptions)(column);
|
|
65
|
+
let option = (0, _dtableStore.getOption)(options, value) || {};
|
|
58
66
|
let {
|
|
59
67
|
name: optionName,
|
|
60
68
|
color,
|
|
61
69
|
textColor
|
|
62
70
|
} = option;
|
|
63
|
-
displayName = /*#__PURE__*/
|
|
71
|
+
displayName = /*#__PURE__*/_react.default.createElement("div", {
|
|
64
72
|
style: {
|
|
65
73
|
color: textColor,
|
|
66
74
|
backgroundColor: color
|
|
@@ -71,70 +79,70 @@ class PivotTableDisplayName extends React.Component {
|
|
|
71
79
|
}, optionName);
|
|
72
80
|
break;
|
|
73
81
|
}
|
|
74
|
-
case CellType.COLLABORATOR:
|
|
82
|
+
case _dtableStore.CellType.COLLABORATOR:
|
|
75
83
|
{
|
|
76
|
-
let collaborator = getCollaborator(collaborators, value) || {};
|
|
77
|
-
displayName = /*#__PURE__*/
|
|
84
|
+
let collaborator = (0, _dtableStore.getCollaborator)(collaborators, value) || {};
|
|
85
|
+
displayName = /*#__PURE__*/_react.default.createElement(Collaborator, {
|
|
78
86
|
collaborator: collaborator
|
|
79
87
|
});
|
|
80
88
|
break;
|
|
81
89
|
}
|
|
82
|
-
case CellType.CREATOR:
|
|
83
|
-
case CellType.LAST_MODIFIER:
|
|
90
|
+
case _dtableStore.CellType.CREATOR:
|
|
91
|
+
case _dtableStore.CellType.LAST_MODIFIER:
|
|
84
92
|
{
|
|
85
93
|
let {
|
|
86
94
|
creator
|
|
87
95
|
} = this.state;
|
|
88
|
-
displayName = /*#__PURE__*/
|
|
96
|
+
displayName = /*#__PURE__*/_react.default.createElement(Collaborator, {
|
|
89
97
|
collaborator: creator
|
|
90
98
|
});
|
|
91
99
|
break;
|
|
92
100
|
}
|
|
93
|
-
case CellType.NUMBER:
|
|
101
|
+
case _dtableStore.CellType.NUMBER:
|
|
94
102
|
{
|
|
95
|
-
const displayValue = isNumber(value) ? getNumberDisplayString(value, data) : value;
|
|
96
|
-
displayName = /*#__PURE__*/
|
|
103
|
+
const displayValue = (0, _dtableStore.isNumber)(value) ? (0, _dtableStore.getNumberDisplayString)(value, data) : value;
|
|
104
|
+
displayName = /*#__PURE__*/_react.default.createElement("div", {
|
|
97
105
|
title: displayValue,
|
|
98
106
|
"aria-label": displayValue
|
|
99
107
|
}, displayValue);
|
|
100
108
|
break;
|
|
101
109
|
}
|
|
102
|
-
case CellType.LINK:
|
|
110
|
+
case _dtableStore.CellType.LINK:
|
|
103
111
|
{
|
|
104
|
-
const displayValue = getClientFormulaDisplayString(Array.isArray(value) ? value : [value], data, {
|
|
112
|
+
const displayValue = (0, _utils.getClientFormulaDisplayString)(Array.isArray(value) ? value : [value], data, {
|
|
105
113
|
collaborators
|
|
106
114
|
}) || null;
|
|
107
115
|
if (!displayValue) {
|
|
108
116
|
break;
|
|
109
117
|
}
|
|
110
|
-
displayName = /*#__PURE__*/
|
|
118
|
+
displayName = /*#__PURE__*/_react.default.createElement("div", {
|
|
111
119
|
title: displayValue,
|
|
112
120
|
"aria-label": displayValue
|
|
113
121
|
}, displayValue);
|
|
114
122
|
break;
|
|
115
123
|
}
|
|
116
|
-
case CellType.FORMULA:
|
|
117
|
-
case CellType.LINK_FORMULA:
|
|
124
|
+
case _dtableStore.CellType.FORMULA:
|
|
125
|
+
case _dtableStore.CellType.LINK_FORMULA:
|
|
118
126
|
{
|
|
119
127
|
let displayValue = value;
|
|
120
128
|
let {
|
|
121
129
|
result_type,
|
|
122
130
|
array_type
|
|
123
131
|
} = data || {};
|
|
124
|
-
if (result_type === FORMULA_RESULT_TYPE.NUMBER) {
|
|
132
|
+
if (result_type === _dtableStore.FORMULA_RESULT_TYPE.NUMBER) {
|
|
125
133
|
let valueNumber = parseFloat(value);
|
|
126
|
-
displayValue = isNumber(valueNumber) ? getNumberDisplayString(valueNumber, data) : value;
|
|
127
|
-
} else if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
|
|
128
|
-
if (COLLABORATOR_COLUMN_TYPES.includes(array_type)) {
|
|
134
|
+
displayValue = (0, _dtableStore.isNumber)(valueNumber) ? (0, _dtableStore.getNumberDisplayString)(valueNumber, data) : value;
|
|
135
|
+
} else if (result_type === _dtableStore.FORMULA_RESULT_TYPE.ARRAY) {
|
|
136
|
+
if (_dtableStore.COLLABORATOR_COLUMN_TYPES.includes(array_type)) {
|
|
129
137
|
const currentCollaborators = Array.isArray(value) ? value : [value];
|
|
130
138
|
displayValue = currentCollaborators.map(email => {
|
|
131
|
-
let user = array_type === CellType.COLLABORATOR ? getCollaborator(collaborators, email) : getKnownCreatorByEmail(collaborators, email);
|
|
139
|
+
let user = array_type === _dtableStore.CellType.COLLABORATOR ? (0, _dtableStore.getCollaborator)(collaborators, email) : (0, _utils.getKnownCreatorByEmail)(collaborators, email);
|
|
132
140
|
return (user || {}).name;
|
|
133
141
|
});
|
|
134
142
|
displayValue = displayValue + '';
|
|
135
143
|
}
|
|
136
144
|
}
|
|
137
|
-
displayName = /*#__PURE__*/
|
|
145
|
+
displayName = /*#__PURE__*/_react.default.createElement("div", {
|
|
138
146
|
title: displayValue,
|
|
139
147
|
"aria-label": displayValue
|
|
140
148
|
}, displayValue);
|
|
@@ -143,7 +151,7 @@ class PivotTableDisplayName extends React.Component {
|
|
|
143
151
|
default:
|
|
144
152
|
{
|
|
145
153
|
const displayValue = typeof value !== 'string' ? String(value) : value;
|
|
146
|
-
displayName = /*#__PURE__*/
|
|
154
|
+
displayName = /*#__PURE__*/_react.default.createElement("div", {
|
|
147
155
|
title: displayValue,
|
|
148
156
|
"aria-label": displayValue
|
|
149
157
|
}, displayValue);
|
|
@@ -161,7 +169,7 @@ class PivotTableDisplayName extends React.Component {
|
|
|
161
169
|
column,
|
|
162
170
|
value
|
|
163
171
|
} = this.props;
|
|
164
|
-
if (column.type !== CellType.CREATOR && column.type !== CellType.LAST_MODIFIER) return;
|
|
172
|
+
if (column.type !== _dtableStore.CellType.CREATOR && column.type !== _dtableStore.CellType.LAST_MODIFIER) return;
|
|
165
173
|
this.updateCreator(value);
|
|
166
174
|
}
|
|
167
175
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
@@ -172,8 +180,8 @@ class PivotTableDisplayName extends React.Component {
|
|
|
172
180
|
let {
|
|
173
181
|
type
|
|
174
182
|
} = column;
|
|
175
|
-
if (type !== CellType.CREATOR && type !== CellType.LAST_MODIFIER) return;
|
|
176
|
-
if (value !== this.props.value || shallowEqual(nextProps.column, this.props.column)) {
|
|
183
|
+
if (type !== _dtableStore.CellType.CREATOR && type !== _dtableStore.CellType.LAST_MODIFIER) return;
|
|
184
|
+
if (value !== this.props.value || (0, _commonUtils.shallowEqual)(nextProps.column, this.props.column)) {
|
|
177
185
|
this.updateCreator(value);
|
|
178
186
|
}
|
|
179
187
|
}
|
|
@@ -184,28 +192,28 @@ class PivotTableDisplayName extends React.Component {
|
|
|
184
192
|
} = this.props;
|
|
185
193
|
const displayName = value && this.getDisplayName(value, column);
|
|
186
194
|
if (!displayName) {
|
|
187
|
-
return /*#__PURE__*/
|
|
195
|
+
return /*#__PURE__*/_react.default.createElement("div", null, "(".concat(_reactIntlUniversal.default.get(_constants.EMPTY_NAME), ")"));
|
|
188
196
|
}
|
|
189
|
-
return /*#__PURE__*/
|
|
197
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, displayName);
|
|
190
198
|
}
|
|
191
199
|
}
|
|
192
|
-
|
|
200
|
+
var _default = exports.default = PivotTableDisplayName;
|
|
193
201
|
function Collaborator(props) {
|
|
194
202
|
let {
|
|
195
203
|
avatar_url,
|
|
196
204
|
name
|
|
197
205
|
} = props.collaborator || {};
|
|
198
|
-
return /*#__PURE__*/
|
|
206
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
199
207
|
className: "collaborators-formatter"
|
|
200
|
-
}, /*#__PURE__*/
|
|
208
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
201
209
|
className: "collaborator"
|
|
202
|
-
}, /*#__PURE__*/
|
|
210
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
203
211
|
className: "collaborator-avatar-container"
|
|
204
|
-
}, /*#__PURE__*/
|
|
212
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
205
213
|
src: avatar_url,
|
|
206
214
|
alt: name,
|
|
207
215
|
className: "collaborator-avatar"
|
|
208
|
-
})), /*#__PURE__*/
|
|
216
|
+
})), /*#__PURE__*/_react.default.createElement("span", {
|
|
209
217
|
className: "collaborator-name",
|
|
210
218
|
title: name,
|
|
211
219
|
"aria-label": name
|