dtable-statistic 5.0.42-alpha.1 → 5.0.42-alpha.10

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.
@@ -111,6 +111,17 @@ const exportOneDimensionToTable = _ref => {
111
111
  }
112
112
  }
113
113
 
114
+ // count column
115
+ if (summaryColumn) {
116
+ console.log('columnData', columnData);
117
+ const countColumn = {
118
+ type: _isDateSummaryColumn ? _dtableUtils.CellType.DATE : _dtableUtils.CellType.NUMBER,
119
+ name: summaryColumn === null || summaryColumn === void 0 ? void 0 : summaryColumn.name,
120
+ data: columnData
121
+ };
122
+ columns.push(countColumn);
123
+ }
124
+
114
125
  // total column
115
126
  const totalColumn = {
116
127
  type: _isDateSummaryColumn ? _dtableUtils.CellType.DATE : _dtableUtils.CellType.NUMBER,
@@ -135,20 +146,30 @@ const exportOneDimensionToTable = _ref => {
135
146
  [groupbyColumn.name]: groupName,
136
147
  [_reactIntlUniversal.default.get('Total')]: cellValue
137
148
  };
149
+ if (summaryColumn) {
150
+ newRow[summaryColumn.name] = cellValue;
151
+ }
138
152
  rows.push(newRow);
139
153
  });
154
+ console.log(11, {
155
+ columns,
156
+ rows
157
+ });
140
158
  return {
141
159
  columns,
142
160
  rows
143
161
  };
144
162
  }
145
-
163
+ console.log('pivot_columns', pivot_columns);
164
+ console.log('statisticTableColumns', statisticTableColumns);
146
165
  // one dimension table with number columns
147
166
  Array.isArray(pivot_columns) && pivot_columns.forEach(item => {
148
167
  const {
149
168
  key
150
169
  } = item;
170
+ console.log('item', item);
151
171
  const column = statisticTableColumns.find(column => column.key === key);
172
+ console.log('column', column);
152
173
  if (column) {
153
174
  const columnName = column.name;
154
175
  let columnData;
@@ -191,7 +212,7 @@ const exportOneDimensionToTable = _ref => {
191
212
  columns.push(newColumn);
192
213
  }
193
214
  });
194
-
215
+ console.log('pivot_rows', pivot_rows);
195
216
  // generator rows
196
217
  pivot_rows.forEach(item => {
197
218
  const {
@@ -205,11 +226,10 @@ const exportOneDimensionToTable = _ref => {
205
226
  };
206
227
  Array.isArray(pivot_columns) && pivot_columns.forEach(item => {
207
228
  const {
208
- key,
209
- method
229
+ key
210
230
  } = item;
211
231
  const column = columnMap[key];
212
- const cellValueKey = key + method;
232
+ const cellValueKey = key;
213
233
  const {
214
234
  name,
215
235
  type,
@@ -222,8 +242,10 @@ const exportOneDimensionToTable = _ref => {
222
242
  }
223
243
  newRow[name] = cellValue;
224
244
  });
245
+ console.log('newRow', newRow);
225
246
  rows.push(newRow);
226
247
  });
248
+ console.log('rows', rows);
227
249
  return {
228
250
  columns,
229
251
  rows
@@ -567,7 +589,7 @@ const updatedOneDimensionToTable = _ref5 => {
567
589
  method
568
590
  } = item;
569
591
  const column = columnMap[key];
570
- const cellValueKey = key + method;
592
+ const cellValueKey = key;
571
593
  const totalCellValue = getValidValueForColumn(column, total[cellValueKey]);
572
594
  if (column && (0, _cellValue.isCellValueChanged)(row[column.key], totalCellValue, column.type)) {
573
595
  updateRow[column.key] = totalCellValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-statistic",
3
- "version": "5.0.42-alpha.1",
3
+ "version": "5.0.42-alpha.10",
4
4
  "description": "statistics",
5
5
  "main": "dist/dtable-statistic.js",
6
6
  "author": "seafile",