dtable-statistic 5.0.43-alpha.0 → 5.0.43-alpha.2

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.
@@ -48,6 +48,7 @@ const exportOneDimensionToTable = _ref => {
48
48
  let {
49
49
  statisticalResult
50
50
  } = _ref;
51
+ console.log('exportOneDimensionToTable', statisticalResult);
51
52
  const {
52
53
  pivotResult,
53
54
  groupbyColumn,
@@ -72,11 +73,13 @@ const exportOneDimensionToTable = _ref => {
72
73
 
73
74
  // one dimension table no number columns
74
75
  if (pivot_columns.length < 2) {
76
+ console.log('-2');
75
77
  let columnData = {
76
78
  format: 'number'
77
79
  };
78
80
  let _isDateSummaryColumn = false;
79
81
  let isIncludeHour = false;
82
+ console.log('summaryColumn', summaryColumn);
80
83
  if (summaryColumn) {
81
84
  if (isSummaryDateColumn(summaryColumn)) {
82
85
  const {
@@ -111,15 +114,25 @@ const exportOneDimensionToTable = _ref => {
111
114
  }
112
115
 
113
116
  // count column
114
- if (summaryColumn) {
117
+ if (pivot_columns.length === 0) {
115
118
  const countColumn = {
116
119
  type: _isDateSummaryColumn ? _dtableUtils.CellType.DATE : _dtableUtils.CellType.NUMBER,
117
- name: summaryColumn === null || summaryColumn === void 0 ? void 0 : summaryColumn.name,
120
+ name: _reactIntlUniversal.default.get('Amount'),
118
121
  data: columnData
119
122
  };
120
123
  columns.push(countColumn);
121
124
  }
122
125
 
126
+ // single field
127
+ if (summaryColumn) {
128
+ const singleColumn = {
129
+ type: _isDateSummaryColumn ? _dtableUtils.CellType.DATE : _dtableUtils.CellType.NUMBER,
130
+ name: summaryColumn === null || summaryColumn === void 0 ? void 0 : summaryColumn.name,
131
+ data: columnData
132
+ };
133
+ columns.push(singleColumn);
134
+ }
135
+
123
136
  // total column
124
137
  const totalColumn = {
125
138
  type: _isDateSummaryColumn ? _dtableUtils.CellType.DATE : _dtableUtils.CellType.NUMBER,
@@ -144,9 +157,14 @@ const exportOneDimensionToTable = _ref => {
144
157
  [groupbyColumn.name]: groupName,
145
158
  [_reactIntlUniversal.default.get('Total')]: cellValue
146
159
  };
160
+ // single column
147
161
  if (summaryColumn) {
148
162
  newRow[summaryColumn.name] = cellValue;
149
163
  }
164
+ // count column
165
+ if (pivot_columns.length === 0) {
166
+ newRow[_reactIntlUniversal.default.get('Amount')] = cellValue;
167
+ }
150
168
  rows.push(newRow);
151
169
  });
152
170
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-statistic",
3
- "version": "5.0.43-alpha.0",
3
+ "version": "5.0.43-alpha.2",
4
4
  "description": "statistics",
5
5
  "main": "dist/dtable-statistic.js",
6
6
  "author": "seafile",