dtable-statistic 4.3.2 → 4.3.3
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 +110 -103
- 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 +22 -15
- 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 +56 -43
- 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 +35 -28
- 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 +42 -35
- 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 +30 -22
- 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 +32 -24
- 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 +48 -40
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +29 -21
- 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 +25 -17
- 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 +59 -51
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +27 -19
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +57 -49
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +20 -12
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +56 -48
- 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 +29 -21
- 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 +56 -47
- package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +20 -12
- 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 +33 -20
- package/es/stat-list/index.js +36 -28
- package/es/stat-view/area-chart.js +51 -44
- package/es/stat-view/bar-chart.js +55 -48
- 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 +57 -50
- package/es/stat-view/compare-chart.js +47 -40
- package/es/stat-view/completeness-chart.js +37 -30
- 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 +59 -52
- package/es/stat-view/index.js +80 -73
- package/es/stat-view/line-chart.js +47 -40
- 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 +46 -39
- package/es/stat-view/scatter-chart.js +37 -30
- package/es/stat-view/treemap-chart.js +45 -38
- 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 +35 -27
- 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 +67 -43
- 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 +34 -24
- package/es/utils/search.js +29 -21
- package/es/utils/sql-utils.js +75 -65
- package/es/utils/stat-utils.js +67 -60
- package/es/utils/trend-utils.js +40 -32
- package/package.json +82 -125
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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 _oneDimensionTableNoNumericColumns = _interopRequireDefault(require("./one-dimension-table-no-numeric-columns"));
|
|
14
|
+
var _twoDimensionTable = _interopRequireDefault(require("./two-dimension-table"));
|
|
15
|
+
var _oneDimensionTableWithNumericColumns = _interopRequireDefault(require("./one-dimension-table-with-numeric-columns"));
|
|
16
|
+
var _constants = require("../../constants");
|
|
17
|
+
var _statisticPivotTableModule = _interopRequireDefault(require("./statistic-pivot-table.module.css"));
|
|
18
|
+
class PivotTable extends _baseChart.default {
|
|
12
19
|
constructor(props) {
|
|
13
20
|
super(props);
|
|
14
21
|
this.isValidValue = value => {
|
|
@@ -33,12 +40,12 @@ class PivotTable extends BaseChart {
|
|
|
33
40
|
} = statItem;
|
|
34
41
|
const themeColors = this.getThemeColors('#212529');
|
|
35
42
|
if (Array.isArray(pivot_columns) && pivot_columns.length > 100) {
|
|
36
|
-
return /*#__PURE__*/
|
|
43
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
37
44
|
className: 'statistic-chart-text'
|
|
38
|
-
},
|
|
45
|
+
}, _reactIntlUniversal.default.get(_constants.TOO_MANY_STATISTIC_ENTRIES));
|
|
39
46
|
}
|
|
40
47
|
if (column_groupby_column_key) {
|
|
41
|
-
return /*#__PURE__*/
|
|
48
|
+
return /*#__PURE__*/_react.default.createElement(_twoDimensionTable.default, {
|
|
42
49
|
pivotResult: this.state.statData,
|
|
43
50
|
statItem: statItem,
|
|
44
51
|
isPreview: isPreview,
|
|
@@ -50,7 +57,7 @@ class PivotTable extends BaseChart {
|
|
|
50
57
|
});
|
|
51
58
|
}
|
|
52
59
|
if (pivot_columns.length < 2) {
|
|
53
|
-
return /*#__PURE__*/
|
|
60
|
+
return /*#__PURE__*/_react.default.createElement(_oneDimensionTableNoNumericColumns.default, {
|
|
54
61
|
pivotResult: this.state.statData,
|
|
55
62
|
statItem: statItem,
|
|
56
63
|
isPreview: isPreview,
|
|
@@ -61,7 +68,7 @@ class PivotTable extends BaseChart {
|
|
|
61
68
|
toggleStatisticRecordsDialog: this.props.toggleStatisticRecordsDialog
|
|
62
69
|
});
|
|
63
70
|
}
|
|
64
|
-
return /*#__PURE__*/
|
|
71
|
+
return /*#__PURE__*/_react.default.createElement(_oneDimensionTableWithNumericColumns.default, {
|
|
65
72
|
getSummaryValueDisplayString: this.getSummaryValueDisplayString,
|
|
66
73
|
pivotResult: this.state.statData,
|
|
67
74
|
statItem: statItem,
|
|
@@ -73,23 +80,23 @@ class PivotTable extends BaseChart {
|
|
|
73
80
|
});
|
|
74
81
|
};
|
|
75
82
|
this.getSummaryValueDisplayString = function (summaryColumn, summaryValue) {
|
|
76
|
-
let summaryMethod = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : SUMMARY_TYPE.COUNT;
|
|
83
|
+
let summaryMethod = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _constants.SUMMARY_TYPE.COUNT;
|
|
77
84
|
if (!summaryColumn || !summaryColumn.type) return summaryValue;
|
|
78
85
|
if (!summaryValue && summaryValue !== 0) return summaryValue;
|
|
79
86
|
if (summaryMethod && summaryMethod.toUpperCase() === 'DISTINCT_VALUES') return summaryValue;
|
|
80
87
|
const {
|
|
81
88
|
data
|
|
82
89
|
} = summaryColumn;
|
|
83
|
-
if (TIME_COLUMN_LIST.includes(summaryColumn.type)) {
|
|
90
|
+
if (_constants.TIME_COLUMN_LIST.includes(summaryColumn.type)) {
|
|
84
91
|
if (typeof summaryValue !== 'string') return '';
|
|
85
92
|
// The date returned by db carries T and Z, so that there is a time difference in data formatting
|
|
86
93
|
const {
|
|
87
94
|
format
|
|
88
95
|
} = data || {};
|
|
89
|
-
return getDateDisplayString(summaryValue.replace(/[T|Z]/g, ' '), format);
|
|
96
|
+
return (0, _dtableStore.getDateDisplayString)(summaryValue.replace(/[T|Z]/g, ' '), format);
|
|
90
97
|
}
|
|
91
98
|
if (typeof summaryValue !== 'number') return summaryValue;
|
|
92
|
-
return getNumberDisplayString(summaryValue, data || DEFAULT_NUMBER_FORMAT_OBJECT);
|
|
99
|
+
return (0, _dtableStore.getNumberDisplayString)(summaryValue, data || _constants.DEFAULT_NUMBER_FORMAT_OBJECT);
|
|
93
100
|
};
|
|
94
101
|
this.getStatData = () => {
|
|
95
102
|
const {
|
|
@@ -103,9 +110,9 @@ class PivotTable extends BaseChart {
|
|
|
103
110
|
summary_column_key
|
|
104
111
|
} = statItem;
|
|
105
112
|
const table = getTableById(table_id);
|
|
106
|
-
const groupbyColumn = groupby_column_key && TableUtils.getTableColumnByKey(table, groupby_column_key);
|
|
107
|
-
const columnGroupbyColumn = column_groupby_column_key && TableUtils.getTableColumnByKey(table, column_groupby_column_key);
|
|
108
|
-
const summaryColumn = TableUtils.getTableColumnByKey(table, summary_column_key) || {};
|
|
113
|
+
const groupbyColumn = groupby_column_key && _dtableStore.TableUtils.getTableColumnByKey(table, groupby_column_key);
|
|
114
|
+
const columnGroupbyColumn = column_groupby_column_key && _dtableStore.TableUtils.getTableColumnByKey(table, column_groupby_column_key);
|
|
115
|
+
const summaryColumn = _dtableStore.TableUtils.getTableColumnByKey(table, summary_column_key) || {};
|
|
109
116
|
return {
|
|
110
117
|
pivotResult: this.state.statData,
|
|
111
118
|
statisticTableColumns: table.columns,
|
|
@@ -169,21 +176,21 @@ class PivotTable extends BaseChart {
|
|
|
169
176
|
isCalculatingData,
|
|
170
177
|
showResultDescription
|
|
171
178
|
} = this.state;
|
|
172
|
-
return /*#__PURE__*/
|
|
179
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isCalculatingData && this.renderLoading(), !isCalculatingData && /*#__PURE__*/_react.default.createElement("div", {
|
|
173
180
|
ref: ref => this.container = ref,
|
|
174
181
|
style: isEdit ? {
|
|
175
182
|
padding: '15px 30px'
|
|
176
183
|
} : null,
|
|
177
|
-
className: "statistic-chart-container ".concat(
|
|
184
|
+
className: "statistic-chart-container ".concat(_statisticPivotTableModule.default['pivot-table-container'])
|
|
178
185
|
}, this.renderPivotTable()), showResultDescription && this.renderEmpty());
|
|
179
186
|
}
|
|
180
187
|
}
|
|
181
188
|
PivotTable.propTypes = {
|
|
182
|
-
isPreview:
|
|
183
|
-
isEdit:
|
|
184
|
-
statItem:
|
|
185
|
-
chartCalculator:
|
|
186
|
-
getTableById:
|
|
187
|
-
toggleStatisticRecordsDialog:
|
|
189
|
+
isPreview: _propTypes.default.bool,
|
|
190
|
+
isEdit: _propTypes.default.bool,
|
|
191
|
+
statItem: _propTypes.default.object,
|
|
192
|
+
chartCalculator: _propTypes.default.object,
|
|
193
|
+
getTableById: _propTypes.default.func,
|
|
194
|
+
toggleStatisticRecordsDialog: _propTypes.default.func
|
|
188
195
|
};
|
|
189
|
-
|
|
196
|
+
var _default = exports.default = PivotTable;
|
|
@@ -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 OneDimensionTableNoNumericColumns extends _react.PureComponent {
|
|
9
17
|
constructor() {
|
|
10
18
|
var _this;
|
|
11
19
|
super(...arguments);
|
|
@@ -15,7 +23,7 @@ class OneDimensionTableNoNumericColumns extends PureComponent {
|
|
|
15
23
|
isColumn = false,
|
|
16
24
|
isRow = 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
|
isRow
|
|
@@ -25,7 +33,7 @@ class OneDimensionTableNoNumericColumns extends PureComponent {
|
|
|
25
33
|
let {
|
|
26
34
|
isCurrentView
|
|
27
35
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
28
|
-
if (isMobile) return;
|
|
36
|
+
if (_utils.isMobile) return;
|
|
29
37
|
const {
|
|
30
38
|
getTableById,
|
|
31
39
|
statItem
|
|
@@ -35,8 +43,8 @@ class OneDimensionTableNoNumericColumns extends PureComponent {
|
|
|
35
43
|
view_id
|
|
36
44
|
} = statItem;
|
|
37
45
|
const table = getTableById(table_id);
|
|
38
|
-
const view = Views.getViewById(table.views, view_id);
|
|
39
|
-
const rows = !Views.isArchiveView(view) ? recordsList.flat() : [];
|
|
46
|
+
const view = _dtableStore.Views.getViewById(table.views, view_id);
|
|
47
|
+
const rows = !_dtableStore.Views.isArchiveView(view) ? recordsList.flat() : [];
|
|
40
48
|
_this.props.toggleStatisticRecordsDialog({
|
|
41
49
|
rows
|
|
42
50
|
}, _this.props.statItem, {
|
|
@@ -56,11 +64,11 @@ class OneDimensionTableNoNumericColumns extends PureComponent {
|
|
|
56
64
|
const {
|
|
57
65
|
name: groupName
|
|
58
66
|
} = groupByColumn || {};
|
|
59
|
-
return /*#__PURE__*/
|
|
67
|
+
return /*#__PURE__*/_react.default.createElement("thead", null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("th", {
|
|
60
68
|
className: "pivot-table-header"
|
|
61
|
-
}, /*#__PURE__*/
|
|
69
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, groupName)), display_total && /*#__PURE__*/_react.default.createElement("th", {
|
|
62
70
|
className: 'pivot-table-header'
|
|
63
|
-
}, /*#__PURE__*/
|
|
71
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, _reactIntlUniversal.default.get(_constants.TITLE_TOTAL)))));
|
|
64
72
|
};
|
|
65
73
|
this.renderRows = _ref2 => {
|
|
66
74
|
let {
|
|
@@ -81,11 +89,11 @@ class OneDimensionTableNoNumericColumns extends PureComponent {
|
|
|
81
89
|
summary_method,
|
|
82
90
|
display_total = true
|
|
83
91
|
} = statItem;
|
|
84
|
-
const summaryColumn = TableUtils.getTableColumnByKey(table, summary_column_key) || {};
|
|
92
|
+
const summaryColumn = _dtableStore.TableUtils.getTableColumnByKey(table, summary_column_key) || {};
|
|
85
93
|
const columnTotal = getSummaryValueDisplayString(summaryColumn, pivot_columns_total['total'], summary_method);
|
|
86
94
|
const isValidTColumnTotal = this.props.isValidValue(columnTotal);
|
|
87
95
|
let pivotColumnCells = [];
|
|
88
|
-
return /*#__PURE__*/
|
|
96
|
+
return /*#__PURE__*/_react.default.createElement("tbody", null, pivot_rows.map((rowItem, rowIdx) => {
|
|
89
97
|
const {
|
|
90
98
|
original_name,
|
|
91
99
|
total,
|
|
@@ -94,29 +102,29 @@ class OneDimensionTableNoNumericColumns extends PureComponent {
|
|
|
94
102
|
const totalDisplayValue = getSummaryValueDisplayString(summaryColumn, total.total, summary_method);
|
|
95
103
|
const isValidTotalDisplayValue = this.props.isValidValue(totalDisplayValue);
|
|
96
104
|
pivotColumnCells[rowIdx] = rows;
|
|
97
|
-
return /*#__PURE__*/
|
|
105
|
+
return /*#__PURE__*/_react.default.createElement("tr", {
|
|
98
106
|
key: 'table-row-' + rowIdx
|
|
99
|
-
}, /*#__PURE__*/
|
|
107
|
+
}, /*#__PURE__*/_react.default.createElement("td", {
|
|
100
108
|
className: 'pivot-row-name'
|
|
101
|
-
}, /*#__PURE__*/
|
|
109
|
+
}, /*#__PURE__*/_react.default.createElement(_pivotTableDisplayName.default, {
|
|
102
110
|
value: original_name,
|
|
103
111
|
column: groupByColumn
|
|
104
|
-
})), display_total && /*#__PURE__*/
|
|
105
|
-
className: "".concat(
|
|
112
|
+
})), display_total && /*#__PURE__*/_react.default.createElement("td", {
|
|
113
|
+
className: "".concat(_statisticPivotTableModule.default['pivot-cell'], " ").concat(isValidTotalDisplayValue ? '' : _statisticPivotTableModule.default['pivot-empty-cell']),
|
|
106
114
|
title: isValidTotalDisplayValue ? totalDisplayValue : '',
|
|
107
115
|
onClick: () => this.toggleRecords(rowItem, {
|
|
108
116
|
isRow: true
|
|
109
117
|
})
|
|
110
|
-
}, isValidTotalDisplayValue ? /*#__PURE__*/
|
|
111
|
-
}), display_total && /*#__PURE__*/
|
|
118
|
+
}, isValidTotalDisplayValue ? /*#__PURE__*/_react.default.createElement("div", null, totalDisplayValue) : /*#__PURE__*/_react.default.createElement("i", null)));
|
|
119
|
+
}), display_total && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", {
|
|
112
120
|
className: 'pivot-column-total'
|
|
113
|
-
}, /*#__PURE__*/
|
|
114
|
-
className: "".concat(
|
|
121
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, _reactIntlUniversal.default.get(_constants.TITLE_TOTAL))), /*#__PURE__*/_react.default.createElement("td", {
|
|
122
|
+
className: "".concat(_statisticPivotTableModule.default['pivot-cell'], " pivot-table-total ").concat(isValidTColumnTotal ? '' : _statisticPivotTableModule.default['pivot-empty-cell']),
|
|
115
123
|
onClick: () => this.onClickTotals(pivotColumnCells, {
|
|
116
124
|
isCurrentView: true
|
|
117
125
|
}),
|
|
118
126
|
title: isValidTColumnTotal ? columnTotal : ''
|
|
119
|
-
}, isValidTColumnTotal ? /*#__PURE__*/
|
|
127
|
+
}, isValidTColumnTotal ? /*#__PURE__*/_react.default.createElement("div", null, columnTotal) : /*#__PURE__*/_react.default.createElement("i", null))));
|
|
120
128
|
};
|
|
121
129
|
}
|
|
122
130
|
render() {
|
|
@@ -131,12 +139,12 @@ class OneDimensionTableNoNumericColumns extends PureComponent {
|
|
|
131
139
|
groupby_column_key
|
|
132
140
|
} = statItem;
|
|
133
141
|
const table = getTableById(table_id);
|
|
134
|
-
const groupByColumn = groupby_column_key && TableUtils.getTableColumnByKey(table, groupby_column_key);
|
|
135
|
-
return /*#__PURE__*/
|
|
142
|
+
const groupByColumn = groupby_column_key && _dtableStore.TableUtils.getTableColumnByKey(table, groupby_column_key);
|
|
143
|
+
return /*#__PURE__*/_react.default.createElement("table", {
|
|
136
144
|
style: {
|
|
137
145
|
color: textColor
|
|
138
146
|
},
|
|
139
|
-
className: "".concat(isPreview ?
|
|
147
|
+
className: "".concat(isPreview ? _statisticPivotTableModule.default['preview-pivot-table'] : _statisticPivotTableModule.default['large-pivot-table'], " ").concat(_statisticPivotTableModule.default['pivot-table'])
|
|
140
148
|
}, this.renderHeader({
|
|
141
149
|
groupByColumn
|
|
142
150
|
}), this.renderRows({
|
|
@@ -145,4 +153,4 @@ class OneDimensionTableNoNumericColumns extends PureComponent {
|
|
|
145
153
|
}));
|
|
146
154
|
}
|
|
147
155
|
}
|
|
148
|
-
|
|
156
|
+
var _default = exports.default = OneDimensionTableNoNumericColumns;
|
|
@@ -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;
|