dtable-statistic 5.0.42-alpha.19 → 5.0.42-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.
@@ -111,16 +111,6 @@ 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
-
124
114
  // total column
125
115
  const totalColumn = {
126
116
  type: _isDateSummaryColumn ? _dtableUtils.CellType.DATE : _dtableUtils.CellType.NUMBER,
@@ -145,9 +135,6 @@ const exportOneDimensionToTable = _ref => {
145
135
  [groupbyColumn.name]: groupName,
146
136
  [_reactIntlUniversal.default.get('Total')]: cellValue
147
137
  };
148
- if (summaryColumn) {
149
- newRow[summaryColumn.name] = cellValue;
150
- }
151
138
  rows.push(newRow);
152
139
  });
153
140
  return {
@@ -155,12 +142,13 @@ const exportOneDimensionToTable = _ref => {
155
142
  rows
156
143
  };
157
144
  }
158
-
145
+ console.log('statisticTableColumns', statisticTableColumns);
159
146
  // one dimension table with number columns
160
147
  Array.isArray(pivot_columns) && pivot_columns.forEach(item => {
161
148
  const {
162
149
  key
163
150
  } = item;
151
+ console.log('item', item);
164
152
  const column = statisticTableColumns.find(column => column.key === key);
165
153
  if (column) {
166
154
  const columnName = column.name;
@@ -218,10 +206,11 @@ const exportOneDimensionToTable = _ref => {
218
206
  };
219
207
  Array.isArray(pivot_columns) && pivot_columns.forEach(item => {
220
208
  const {
221
- key
209
+ key,
210
+ method
222
211
  } = item;
223
212
  const column = columnMap[key];
224
- const cellValueKey = key;
213
+ const cellValueKey = key + method;
225
214
  const {
226
215
  name,
227
216
  type,
@@ -482,8 +471,7 @@ const updatedOneDimensionToTable = _ref5 => {
482
471
  const {
483
472
  pivotResult,
484
473
  groupbyColumn,
485
- statisticTableColumns,
486
- summaryColumn
474
+ statisticTableColumns
487
475
  } = statisticalResult;
488
476
  if (!groupbyColumn) return {};
489
477
  const nameColumn = (0, _dtableUtils.getTableColumnByName)(updateTable, groupbyColumn.name);
@@ -504,9 +492,6 @@ const updatedOneDimensionToTable = _ref5 => {
504
492
  // one dimension table no summary columns
505
493
  if (pivot_columns.length < 2) {
506
494
  columnMap['total'] = (0, _dtableUtils.getTableColumnByName)(updateTable, _reactIntlUniversal.default.get('Total'));
507
- if (summaryColumn) {
508
- columnMap['sumary_column'] = (0, _dtableUtils.getTableColumnByName)(updateTable, summaryColumn.name);
509
- }
510
495
 
511
496
  // updated rows
512
497
  pivot_rows.forEach(item => {
@@ -518,9 +503,6 @@ const updatedOneDimensionToTable = _ref5 => {
518
503
  const groupName = isEmptyName(original_name) ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : name;
519
504
  const row = tableRows.find(row => row[nameColumn.key] === groupName);
520
505
  const totalColumn = columnMap['total'];
521
- const sumary_column = columnMap['sumary_column'];
522
- console.log('totalColumn', totalColumn);
523
- console.log('sumary_column', sumary_column);
524
506
  if (row) {
525
507
  // update old row
526
508
  let updateRow = {};
@@ -530,11 +512,6 @@ const updatedOneDimensionToTable = _ref5 => {
530
512
  updateRow[totalColumn.key] = validTotalCellValue;
531
513
  oldRow[totalColumn.key] = row[totalColumn.key];
532
514
  }
533
- const validSummaryCellValue = getValidValueForColumn(sumary_column, total.total);
534
- if (sumary_column && (0, _cellValue.isCellValueChanged)(row[sumary_column.key], validSummaryCellValue, sumary_column.type)) {
535
- updateRow[sumary_column.key] = validSummaryCellValue;
536
- oldRow[sumary_column.key] = row[sumary_column.key];
537
- }
538
515
  if (Object.keys(updateRow).length > 0) {
539
516
  const rowId = row._id;
540
517
  rowIds.push(rowId);
@@ -543,24 +520,14 @@ const updatedOneDimensionToTable = _ref5 => {
543
520
  }
544
521
  } else {
545
522
  // insert new row
546
- console.log('insertrow');
547
523
  let newRow = {};
548
524
  newRow[nameColumn.key] = groupName;
549
525
  if (totalColumn) {
550
526
  newRow[totalColumn.key] = getValidValueForColumn(totalColumn, total.total);
551
527
  }
552
- if (sumary_column) {
553
- newRow[sumary_column.key] = getValidValueForColumn(sumary_column, total.total);
554
- }
555
528
  newRows.push(newRow);
556
529
  }
557
530
  });
558
- console.log(77, {
559
- newRows,
560
- updatedRows,
561
- rowIds,
562
- oldRows
563
- });
564
531
  return {
565
532
  newRows,
566
533
  updatedRows,
@@ -601,7 +568,7 @@ const updatedOneDimensionToTable = _ref5 => {
601
568
  method
602
569
  } = item;
603
570
  const column = columnMap[key];
604
- const cellValueKey = key;
571
+ const cellValueKey = key + method;
605
572
  const totalCellValue = getValidValueForColumn(column, total[cellValueKey]);
606
573
  if (column && (0, _cellValue.isCellValueChanged)(row[column.key], totalCellValue, column.type)) {
607
574
  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.19",
3
+ "version": "5.0.42-alpha.2",
4
4
  "description": "statistics",
5
5
  "main": "dist/dtable-statistic.js",
6
6
  "author": "seafile",