dtable-statistic 5.0.42-alpha.18 → 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,7 +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
506
|
if (row) {
|
|
523
507
|
// update old row
|
|
524
508
|
let updateRow = {};
|
|
@@ -528,11 +512,6 @@ const updatedOneDimensionToTable = _ref5 => {
|
|
|
528
512
|
updateRow[totalColumn.key] = validTotalCellValue;
|
|
529
513
|
oldRow[totalColumn.key] = row[totalColumn.key];
|
|
530
514
|
}
|
|
531
|
-
const validSummaryCellValue = getValidValueForColumn(sumary_column, total.total);
|
|
532
|
-
if (sumary_column && (0, _cellValue.isCellValueChanged)(row[sumary_column.key], validSummaryCellValue, sumary_column.type)) {
|
|
533
|
-
updateRow[sumary_column.key] = validSummaryCellValue;
|
|
534
|
-
oldRow[sumary_column.key] = row[sumary_column.key];
|
|
535
|
-
}
|
|
536
515
|
if (Object.keys(updateRow).length > 0) {
|
|
537
516
|
const rowId = row._id;
|
|
538
517
|
rowIds.push(rowId);
|
|
@@ -541,24 +520,14 @@ const updatedOneDimensionToTable = _ref5 => {
|
|
|
541
520
|
}
|
|
542
521
|
} else {
|
|
543
522
|
// insert new row
|
|
544
|
-
console.log('insertrow');
|
|
545
523
|
let newRow = {};
|
|
546
524
|
newRow[nameColumn.key] = groupName;
|
|
547
525
|
if (totalColumn) {
|
|
548
526
|
newRow[totalColumn.key] = getValidValueForColumn(totalColumn, total.total);
|
|
549
527
|
}
|
|
550
|
-
if (sumary_column) {
|
|
551
|
-
newRow[sumary_column.key] = getValidValueForColumn(sumary_column, total.total);
|
|
552
|
-
}
|
|
553
528
|
newRows.push(newRow);
|
|
554
529
|
}
|
|
555
530
|
});
|
|
556
|
-
console.log(77, {
|
|
557
|
-
newRows,
|
|
558
|
-
updatedRows,
|
|
559
|
-
rowIds,
|
|
560
|
-
oldRows
|
|
561
|
-
});
|
|
562
531
|
return {
|
|
563
532
|
newRows,
|
|
564
533
|
updatedRows,
|
|
@@ -599,7 +568,7 @@ const updatedOneDimensionToTable = _ref5 => {
|
|
|
599
568
|
method
|
|
600
569
|
} = item;
|
|
601
570
|
const column = columnMap[key];
|
|
602
|
-
const cellValueKey = key;
|
|
571
|
+
const cellValueKey = key + method;
|
|
603
572
|
const totalCellValue = getValidValueForColumn(column, total[cellValueKey]);
|
|
604
573
|
if (column && (0, _cellValue.isCellValueChanged)(row[column.key], totalCellValue, column.type)) {
|
|
605
574
|
updateRow[column.key] = totalCellValue;
|