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

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,16 @@ const exportOneDimensionToTable = _ref => {
111
111
  }
112
112
  }
113
113
 
114
+ // count column
115
+ if (summaryColumn) {
116
+ const countColumn = {
117
+ type: _isDateSummaryColumn ? _dtableUtils.CellType.DATE : _dtableUtils.CellType.NUMBER,
118
+ name: summaryColumn === null || summaryColumn === void 0 ? void 0 : summaryColumn.name,
119
+ data: columnData
120
+ };
121
+ columns.push(countColumn);
122
+ }
123
+
114
124
  // total column
115
125
  const totalColumn = {
116
126
  type: _isDateSummaryColumn ? _dtableUtils.CellType.DATE : _dtableUtils.CellType.NUMBER,
@@ -135,6 +145,9 @@ const exportOneDimensionToTable = _ref => {
135
145
  [groupbyColumn.name]: groupName,
136
146
  [_reactIntlUniversal.default.get('Total')]: cellValue
137
147
  };
148
+ if (summaryColumn) {
149
+ newRow[summaryColumn.name] = cellValue;
150
+ }
138
151
  rows.push(newRow);
139
152
  });
140
153
  return {
@@ -205,11 +218,10 @@ const exportOneDimensionToTable = _ref => {
205
218
  };
206
219
  Array.isArray(pivot_columns) && pivot_columns.forEach(item => {
207
220
  const {
208
- key,
209
- method
221
+ key
210
222
  } = item;
211
223
  const column = columnMap[key];
212
- const cellValueKey = key + method;
224
+ const cellValueKey = key;
213
225
  const {
214
226
  name,
215
227
  type,
@@ -502,6 +514,8 @@ const updatedOneDimensionToTable = _ref5 => {
502
514
  const groupName = isEmptyName(original_name) ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : name;
503
515
  const row = tableRows.find(row => row[nameColumn.key] === groupName);
504
516
  const totalColumn = columnMap['total'];
517
+ console.log('updateTable', updateTable);
518
+ console.log('row', row);
505
519
  if (row) {
506
520
  // update old row
507
521
  let updateRow = {};
@@ -511,6 +525,10 @@ const updatedOneDimensionToTable = _ref5 => {
511
525
  updateRow[totalColumn.key] = validTotalCellValue;
512
526
  oldRow[totalColumn.key] = row[totalColumn.key];
513
527
  }
528
+ if (totalColumn && (0, _cellValue.isCellValueChanged)(row[totalColumn.key], validTotalCellValue, totalColumn.type)) {
529
+ updateRow[totalColumn.key] = validTotalCellValue;
530
+ oldRow[totalColumn.key] = row[totalColumn.key];
531
+ }
514
532
  if (Object.keys(updateRow).length > 0) {
515
533
  const rowId = row._id;
516
534
  rowIds.push(rowId);
@@ -567,7 +585,7 @@ const updatedOneDimensionToTable = _ref5 => {
567
585
  method
568
586
  } = item;
569
587
  const column = columnMap[key];
570
- const cellValueKey = key + method;
588
+ const cellValueKey = key;
571
589
  const totalCellValue = getValidValueForColumn(column, total[cellValueKey]);
572
590
  if (column && (0, _cellValue.isCellValueChanged)(row[column.key], totalCellValue, column.type)) {
573
591
  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.11",
4
4
  "description": "statistics",
5
5
  "main": "dist/dtable-statistic.js",
6
6
  "author": "seafile",