dtable-statistic 4.0.5 → 4.0.7
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.
- package/es/assets/css/dashboard.css +22 -0
- package/es/calculator/pivot-table-calculator.js +54 -25
- package/es/calculator/workers/pivot-table-calculator-worker.js +10 -3
- package/es/components/dialog/statistic-record-dialog/index.css +2 -0
- package/es/components/dialog/statistic-record-dialog/index.js +23 -25
- package/es/desktop-dashboard.js +5 -5
- package/es/locale/lang/de.js +5 -3
- package/es/locale/lang/en.js +3 -1
- package/es/locale/lang/fr.js +5 -3
- package/es/locale/lang/zh_CN.js +3 -1
- package/es/service/dashboard-service.js +4 -4
- package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +17 -11
- package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +11 -5
- package/es/stat-view/pivot-table/pivot-table-display-name.js +206 -0
- package/es/stat-view/pivot-table/two-dimension-table.js +104 -60
- package/es/utils/collaborator.js +9 -0
- package/es/utils/index.js +1 -1
- package/package.json +1 -1
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
|
|
44
44
|
.statistic-header .add-stat {
|
|
45
45
|
height: 26px;
|
|
46
|
+
margin-right: 8px;
|
|
46
47
|
padding: 0 10px;
|
|
47
48
|
font-weight: 400;
|
|
48
49
|
border-radius: 3px;
|
|
@@ -76,11 +77,18 @@
|
|
|
76
77
|
.statistic-header .op-item-icon-wrapper {
|
|
77
78
|
display: flex;
|
|
78
79
|
align-items: center;
|
|
80
|
+
justify-content: center;
|
|
79
81
|
cursor: pointer;
|
|
82
|
+
width: 24px;
|
|
80
83
|
line-height: 24px;
|
|
84
|
+
margin-right: 4px;
|
|
81
85
|
color: var(--dashboard-header-icon-color);
|
|
82
86
|
}
|
|
83
87
|
|
|
88
|
+
.statistic-header .op-item-icon-wrapper:last-child {
|
|
89
|
+
margin-right: 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
84
92
|
.statistic-header .op-item-icon-wrapper:hover,
|
|
85
93
|
.statistic-header .add-stat:hover {
|
|
86
94
|
color: var(--dashboard-header-icon-hover-color);
|
|
@@ -90,6 +98,10 @@
|
|
|
90
98
|
color: var(--op-item-icon-hover-color);
|
|
91
99
|
}
|
|
92
100
|
|
|
101
|
+
.statistic-header .op-item-icon.btn-close {
|
|
102
|
+
font-weight: 700;
|
|
103
|
+
}
|
|
104
|
+
|
|
93
105
|
.statistic-main {
|
|
94
106
|
flex: 1 1;
|
|
95
107
|
display: flex;
|
|
@@ -559,3 +571,13 @@
|
|
|
559
571
|
.statistic-panel .seatable-radio .seatable-radio-description {
|
|
560
572
|
line-height: 16px;
|
|
561
573
|
}
|
|
574
|
+
|
|
575
|
+
/* column-formatter */
|
|
576
|
+
.statistic-chart-container .single-select-option,
|
|
577
|
+
.statistic-chart-container .multiple-select-option {
|
|
578
|
+
margin: 0 !important;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.statistic-chart-container .collaborators-formatter .collaborator {
|
|
582
|
+
margin-right: 0 !important;
|
|
583
|
+
}
|
|
@@ -356,13 +356,16 @@ var PivotTableCalculator = /*#__PURE__*/function (_BaseCalculator) {
|
|
|
356
356
|
sqlRows.forEach(function (row) {
|
|
357
357
|
var total = row[sqlSummaryColumnKey] || 0;
|
|
358
358
|
_allTotal += total;
|
|
359
|
+
var originalLabel = _this3.getOriginalLabel(groupbyColumn, _sqlGroupbyColumnKey, row, groupby_geolocation_granularity, groupby_date_granularity);
|
|
360
|
+
var name = _this3.getLabel(groupbyColumn, originalLabel);
|
|
361
|
+
var original_name = _this3.getOriginalName(groupbyColumn, originalLabel);
|
|
359
362
|
pivot_rows.push({
|
|
360
|
-
name:
|
|
363
|
+
name: name,
|
|
364
|
+
original_name: original_name,
|
|
361
365
|
rows: [],
|
|
362
366
|
total: {
|
|
363
367
|
total: total
|
|
364
|
-
}
|
|
365
|
-
original_name: row[groupbyColumn.key]
|
|
368
|
+
}
|
|
366
369
|
});
|
|
367
370
|
});
|
|
368
371
|
return {
|
|
@@ -406,11 +409,14 @@ var PivotTableCalculator = /*#__PURE__*/function (_BaseCalculator) {
|
|
|
406
409
|
rowTotal[columnKey + summaryMethod] = rowTotal[columnKey + summaryMethod] + value;
|
|
407
410
|
}
|
|
408
411
|
});
|
|
412
|
+
var originalLabel = _this3.getOriginalLabel(groupbyColumn, sqlGroupbyColumnKey, row, groupby_geolocation_granularity, groupby_date_granularity);
|
|
413
|
+
var name = _this3.getLabel(groupbyColumn, originalLabel);
|
|
414
|
+
var original_name = _this3.getOriginalName(groupbyColumn, originalLabel);
|
|
409
415
|
pivot_rows.push({
|
|
410
|
-
name:
|
|
416
|
+
name: name,
|
|
417
|
+
original_name: original_name,
|
|
411
418
|
rows: [row],
|
|
412
|
-
total: rowTotal
|
|
413
|
-
original_name: row[groupbyColumn.key]
|
|
419
|
+
total: rowTotal
|
|
414
420
|
});
|
|
415
421
|
});
|
|
416
422
|
if (pivot_columns.length < 2) {
|
|
@@ -459,12 +465,16 @@ var PivotTableCalculator = /*#__PURE__*/function (_BaseCalculator) {
|
|
|
459
465
|
var isRowGroupbyColumnDataAsAnArray = !!MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP[columnGroupbyColumn.type];
|
|
460
466
|
sqlRows.forEach(function (row) {
|
|
461
467
|
var groupbyColumnCellValue = row[sqlGroupbyColumnKey];
|
|
462
|
-
var
|
|
468
|
+
var groupbyColumnOriginalLabel = _this4.getOriginalLabel(groupbyColumn, sqlGroupbyColumnKey, row, groupby_geolocation_granularity, groupby_date_granularity);
|
|
469
|
+
var groupbyColumnCellValueKey = _this4.getLabel(groupbyColumn, groupbyColumnOriginalLabel);
|
|
470
|
+
var groupbyColumnOriginalCellValueKey = _this4.getOriginalName(groupbyColumn, groupbyColumnOriginalLabel);
|
|
463
471
|
var columnGroupbyColumnCellValue = row[sqlColumnGroupbyColumnKey];
|
|
464
|
-
var
|
|
472
|
+
var columnGroupbyColumnOriginalLabel = _this4.getOriginalLabel(columnGroupbyColumn, sqlColumnGroupbyColumnKey, row, column_groupby_geolocation_granularity, column_groupby_date_granularity);
|
|
473
|
+
var columnGroupbyColumnCellValueKey = _this4.getLabel(columnGroupbyColumn, columnGroupbyColumnOriginalLabel);
|
|
474
|
+
var columnGroupbyColumnOriginalCellValueKey = _this4.getOriginalName(columnGroupbyColumn, columnGroupbyColumnOriginalLabel);
|
|
465
475
|
var count = row[sqlSummaryColumnKey];
|
|
466
476
|
if (_this4.isValidCellValue(columnGroupbyColumnCellValue, groupby_include_empty_cells)) {
|
|
467
|
-
_this4.updateTwoDimensionColumns(pivot_columns, columnGroupbyColumnCellValueKey,
|
|
477
|
+
_this4.updateTwoDimensionColumns(pivot_columns, columnGroupbyColumnCellValueKey, columnGroupbyColumnOriginalCellValueKey, {
|
|
468
478
|
isIncludeEmpty: groupby_include_empty_cells,
|
|
469
479
|
isCellValueAsAnArray: isRowGroupbyColumnDataAsAnArray
|
|
470
480
|
});
|
|
@@ -474,7 +484,7 @@ var PivotTableCalculator = /*#__PURE__*/function (_BaseCalculator) {
|
|
|
474
484
|
var resName = r.name;
|
|
475
485
|
return resName === null && groupbyColumnCellValueKey === null || resName === undefined && groupbyColumnCellValueKey === undefined || resName === 0 && groupbyColumnCellValueKey === 0 || resName === groupbyColumnCellValueKey;
|
|
476
486
|
});
|
|
477
|
-
_this4.updateTwoDimensionRows(pivot_rows, pivot_columns, pivotRowIndex, groupbyColumnCellValueKey, count, row, isRowGroupbyColumnDataAsAnArray, columnGroupbyColumnCellValueKey,
|
|
487
|
+
_this4.updateTwoDimensionRows(pivot_rows, pivot_columns, pivotRowIndex, groupbyColumnCellValueKey, groupbyColumnOriginalCellValueKey, count, row, isRowGroupbyColumnDataAsAnArray, columnGroupbyColumnCellValueKey, {
|
|
478
488
|
summaryMethod: summaryMethod,
|
|
479
489
|
summaryColumn: summaryColumn
|
|
480
490
|
});
|
|
@@ -611,19 +621,37 @@ var PivotTableCalculator = /*#__PURE__*/function (_BaseCalculator) {
|
|
|
611
621
|
key: getSummaryColumnMethod(DTABLE_DB_SUMMARY_METHOD[summaryMethod], columnName)
|
|
612
622
|
};
|
|
613
623
|
}
|
|
624
|
+
}, {
|
|
625
|
+
key: "getOriginalLabel",
|
|
626
|
+
value: function getOriginalLabel(groupColumn, groupName, statRow, groupby_date_granularity, groupby_geolocation_granularity) {
|
|
627
|
+
var isTimeColumn = TIME_COLUMN_LIST.includes(groupColumn.type);
|
|
628
|
+
if (isTimeColumn || groupColumn.type === CellType.GEOLOCATION) {
|
|
629
|
+
return statRow[groupName];
|
|
630
|
+
}
|
|
631
|
+
var currentGroupLabel = statRow[groupColumn.key];
|
|
632
|
+
return StatUtils.getGroupLabel(currentGroupLabel, {}, groupColumn, groupby_date_granularity, groupby_geolocation_granularity, this.value);
|
|
633
|
+
}
|
|
634
|
+
}, {
|
|
635
|
+
key: "getOriginalName",
|
|
636
|
+
value: function getOriginalName(groupColumn, originalLabel) {
|
|
637
|
+
var isTimeColumn = TIME_COLUMN_LIST.includes(groupColumn.type);
|
|
638
|
+
if (isTimeColumn || groupColumn.type === CellType.GEOLOCATION) {
|
|
639
|
+
return originalLabel;
|
|
640
|
+
}
|
|
641
|
+
var columnType = groupColumn.type;
|
|
642
|
+
if (columnType === CellType.MULTIPLE_SELECT || columnType === CellType.COLLABORATOR || columnType === CellType.LINK) {
|
|
643
|
+
return Array.isArray(originalLabel) ? originalLabel[0] : null;
|
|
644
|
+
}
|
|
645
|
+
return originalLabel;
|
|
646
|
+
}
|
|
614
647
|
}, {
|
|
615
648
|
key: "getLabel",
|
|
616
|
-
value: function getLabel(groupColumn,
|
|
649
|
+
value: function getLabel(groupColumn, originalLabel) {
|
|
617
650
|
var isTimeColumn = TIME_COLUMN_LIST.includes(groupColumn.type);
|
|
618
|
-
var label;
|
|
619
651
|
if (isTimeColumn || groupColumn.type === CellType.GEOLOCATION) {
|
|
620
|
-
|
|
621
|
-
} else {
|
|
622
|
-
var currentGroupLabel = statRow[groupColumn.key];
|
|
623
|
-
label = StatUtils.getGroupLabel(currentGroupLabel, {}, groupColumn, groupby_date_granularity, groupby_geolocation_granularity, this.value);
|
|
624
|
-
label = getFormattedLabel(groupColumn, label, this.value.collaborators);
|
|
652
|
+
return originalLabel;
|
|
625
653
|
}
|
|
626
|
-
return
|
|
654
|
+
return getFormattedLabel(groupColumn, originalLabel, this.value.collaborators);
|
|
627
655
|
}
|
|
628
656
|
}, {
|
|
629
657
|
key: "initTotal",
|
|
@@ -672,17 +700,18 @@ var PivotTableCalculator = /*#__PURE__*/function (_BaseCalculator) {
|
|
|
672
700
|
}
|
|
673
701
|
}, {
|
|
674
702
|
key: "updateTwoDimensionColumns",
|
|
675
|
-
value: function updateTwoDimensionColumns(pivot_columns, key,
|
|
703
|
+
value: function updateTwoDimensionColumns(pivot_columns, key, original_key, _ref5) {
|
|
676
704
|
var isIncludeEmpty = _ref5.isIncludeEmpty,
|
|
677
705
|
isCellValueAsAnArray = _ref5.isCellValueAsAnArray;
|
|
678
|
-
if (isCellValueAsAnArray) {
|
|
706
|
+
if (isCellValueAsAnArray && Array.isArray(key)) {
|
|
679
707
|
if (key.length === 0 && isIncludeEmpty) {
|
|
680
708
|
var _pivotColumnIndex = pivot_columns.findIndex(function (r) {
|
|
681
709
|
return !r.key;
|
|
682
710
|
});
|
|
683
711
|
if (_pivotColumnIndex < 0) {
|
|
684
712
|
pivot_columns.unshift({
|
|
685
|
-
key: null
|
|
713
|
+
key: null,
|
|
714
|
+
original_key: null
|
|
686
715
|
});
|
|
687
716
|
}
|
|
688
717
|
return;
|
|
@@ -694,7 +723,7 @@ var PivotTableCalculator = /*#__PURE__*/function (_BaseCalculator) {
|
|
|
694
723
|
if (pivotColumnIndex < 0) {
|
|
695
724
|
pivot_columns.push({
|
|
696
725
|
key: k,
|
|
697
|
-
|
|
726
|
+
original_key: k
|
|
698
727
|
});
|
|
699
728
|
}
|
|
700
729
|
});
|
|
@@ -707,13 +736,13 @@ var PivotTableCalculator = /*#__PURE__*/function (_BaseCalculator) {
|
|
|
707
736
|
if (pivotColumnIndex < 0) {
|
|
708
737
|
pivot_columns.push({
|
|
709
738
|
key: key,
|
|
710
|
-
|
|
739
|
+
original_key: original_key
|
|
711
740
|
});
|
|
712
741
|
}
|
|
713
742
|
}
|
|
714
743
|
}, {
|
|
715
744
|
key: "updateTwoDimensionRows",
|
|
716
|
-
value: function updateTwoDimensionRows(pivot_rows, pivot_columns, index, name, count, row, isColumnDataAsAnArray, cellValue,
|
|
745
|
+
value: function updateTwoDimensionRows(pivot_rows, pivot_columns, index, name, original_name, count, row, isColumnDataAsAnArray, cellValue, _ref6) {
|
|
717
746
|
var _this5 = this;
|
|
718
747
|
var summaryMethod = _ref6.summaryMethod,
|
|
719
748
|
summaryColumn = _ref6.summaryColumn;
|
|
@@ -764,7 +793,7 @@ var PivotTableCalculator = /*#__PURE__*/function (_BaseCalculator) {
|
|
|
764
793
|
name: name,
|
|
765
794
|
cells: _cells,
|
|
766
795
|
total: _total,
|
|
767
|
-
original_name:
|
|
796
|
+
original_name: original_name
|
|
768
797
|
});
|
|
769
798
|
}
|
|
770
799
|
}
|
|
@@ -93,6 +93,7 @@ function calculateOneDimensionTable(chart, value, username, userId) {
|
|
|
93
93
|
return TableUtils.getTableColumnByKey(table, item.key);
|
|
94
94
|
});
|
|
95
95
|
pivot_rows.forEach(function (row) {
|
|
96
|
+
row.original_name = row.name;
|
|
96
97
|
row.name = getFormattedLabel(column, row.name, value.collaborators);
|
|
97
98
|
});
|
|
98
99
|
return {
|
|
@@ -109,6 +110,7 @@ function updateOneDimensionRows(pivot_rows, index, name, row) {
|
|
|
109
110
|
} else {
|
|
110
111
|
var _updatedPivotRow = {
|
|
111
112
|
name: name,
|
|
113
|
+
original_name: name,
|
|
112
114
|
rows: [row]
|
|
113
115
|
};
|
|
114
116
|
pivot_rows.push(_updatedPivotRow);
|
|
@@ -221,6 +223,7 @@ function calculateTwoDimensionTable(chart, value, username, userId) {
|
|
|
221
223
|
pivot_summary_multiple_columns.push({
|
|
222
224
|
key: item.key,
|
|
223
225
|
type: column.type,
|
|
226
|
+
data: column.data,
|
|
224
227
|
method: item.method,
|
|
225
228
|
column_name: column.name
|
|
226
229
|
});
|
|
@@ -319,7 +322,8 @@ function updateTwoDimensionColumns(value, pivot_columns, column, row, formulaRow
|
|
|
319
322
|
});
|
|
320
323
|
if (pivotColumnIndex < 0) {
|
|
321
324
|
pivot_columns.unshift({
|
|
322
|
-
key: null
|
|
325
|
+
key: null,
|
|
326
|
+
original_key: null
|
|
323
327
|
});
|
|
324
328
|
}
|
|
325
329
|
} else {
|
|
@@ -329,7 +333,8 @@ function updateTwoDimensionColumns(value, pivot_columns, column, row, formulaRow
|
|
|
329
333
|
});
|
|
330
334
|
if (pivotColumnIndex < 0) {
|
|
331
335
|
pivot_columns.push({
|
|
332
|
-
key: k
|
|
336
|
+
key: k,
|
|
337
|
+
original_key: k
|
|
333
338
|
});
|
|
334
339
|
}
|
|
335
340
|
});
|
|
@@ -341,7 +346,8 @@ function updateTwoDimensionColumns(value, pivot_columns, column, row, formulaRow
|
|
|
341
346
|
});
|
|
342
347
|
if (pivotColumnIndex < 0) {
|
|
343
348
|
pivot_columns.push({
|
|
344
|
-
key: key
|
|
349
|
+
key: key,
|
|
350
|
+
original_key: key
|
|
345
351
|
});
|
|
346
352
|
}
|
|
347
353
|
}
|
|
@@ -376,6 +382,7 @@ function updateTwoDimensionRows(pivot_rows, pivot_columns, index, name, row, isC
|
|
|
376
382
|
});
|
|
377
383
|
pivot_rows.push({
|
|
378
384
|
name: name,
|
|
385
|
+
original_name: name,
|
|
379
386
|
cells: _cells
|
|
380
387
|
});
|
|
381
388
|
}
|
|
@@ -66,11 +66,13 @@ var StatisticRecordDialog = /*#__PURE__*/function (_React$Component) {
|
|
|
66
66
|
_this.toggle = function () {
|
|
67
67
|
_this.props.toggleStatisticRecordsDialog();
|
|
68
68
|
};
|
|
69
|
-
_this.renderRowsCards = function (
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
_this.renderRowsCards = function () {
|
|
70
|
+
var searchRows = _this.state.searchRows;
|
|
71
|
+
var unShowColumnKeyList = ['0000'];
|
|
72
|
+
var table = _this.getStatisticTable();
|
|
73
|
+
var renderedColumns = table.columns.filter(function (column) {
|
|
74
|
+
return !unShowColumnKeyList.includes(column.key) && !UNSHOWN_COLUMN_TYPES.includes(column.type);
|
|
75
|
+
});
|
|
74
76
|
if (!window.app || !window.app.renderRowsCards) return;
|
|
75
77
|
return window.app.renderRowsCards({
|
|
76
78
|
table: table,
|
|
@@ -109,25 +111,24 @@ var StatisticRecordDialog = /*#__PURE__*/function (_React$Component) {
|
|
|
109
111
|
var _this$props3 = this.props,
|
|
110
112
|
isLoading = _this$props3.isLoading,
|
|
111
113
|
currentDate = _this$props3.currentDate;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if (!isLoading) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
114
|
+
// const { searchRows } = this.state;
|
|
115
|
+
// const unShowColumnKeyList = ['0000'];
|
|
116
|
+
// let table;
|
|
117
|
+
// let renderedColumns = [];
|
|
118
|
+
// if (!isLoading) {
|
|
119
|
+
// table = this.getStatisticTable();
|
|
120
|
+
// renderedColumns = table.columns.filter(column => {
|
|
121
|
+
// return !unShowColumnKeyList.includes(column.key) && !UNSHOWN_COLUMN_TYPES.includes(column.type);
|
|
122
|
+
// });
|
|
123
|
+
// }
|
|
124
|
+
|
|
122
125
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
126
|
+
isOpen: true,
|
|
123
127
|
autoFocus: false,
|
|
124
128
|
toggle: this.toggle,
|
|
125
|
-
isOpen: true,
|
|
126
129
|
className: "statistic-records-dialog",
|
|
127
130
|
zIndex: 1048
|
|
128
|
-
},
|
|
129
|
-
className: "py-8"
|
|
130
|
-
}, /*#__PURE__*/React.createElement(Loading, null)), !isLoading && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
131
|
+
}, /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
131
132
|
className: "search-header"
|
|
132
133
|
}, /*#__PURE__*/React.createElement("span", null, currentDate), /*#__PURE__*/React.createElement("button", {
|
|
133
134
|
type: "button",
|
|
@@ -161,12 +162,9 @@ var StatisticRecordDialog = /*#__PURE__*/function (_React$Component) {
|
|
|
161
162
|
}
|
|
162
163
|
})), /*#__PURE__*/React.createElement(ModalBody, {
|
|
163
164
|
className: "statistic-records-container"
|
|
164
|
-
},
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
searchRows: searchRows,
|
|
168
|
-
unShowColumnKeyList: unShowColumnKeyList
|
|
169
|
-
}))));
|
|
165
|
+
}, isLoading ? /*#__PURE__*/React.createElement("div", {
|
|
166
|
+
className: "py-8"
|
|
167
|
+
}, /*#__PURE__*/React.createElement(Loading, null)) : this.renderRowsCards())));
|
|
170
168
|
}
|
|
171
169
|
}]);
|
|
172
170
|
return StatisticRecordDialog;
|
package/es/desktop-dashboard.js
CHANGED
|
@@ -213,19 +213,19 @@ var DesktopDashboard = /*#__PURE__*/function (_Component) {
|
|
|
213
213
|
}), /*#__PURE__*/React.createElement("div", {
|
|
214
214
|
className: "statistic-header-operators d-flex align-items-center"
|
|
215
215
|
}, !isTableReadOnly && /*#__PURE__*/React.createElement("button", {
|
|
216
|
-
className: "btn btn-secondary op-item add-stat
|
|
216
|
+
className: "btn btn-secondary op-item add-stat",
|
|
217
217
|
onClick: this.onToggleChartAddition
|
|
218
218
|
}, /*#__PURE__*/React.createElement("i", {
|
|
219
219
|
className: "op-item-icon add-chart-icon dtable-font dtable-icon-add-table"
|
|
220
220
|
}), /*#__PURE__*/React.createElement("span", {
|
|
221
221
|
className: "add-new-option"
|
|
222
222
|
}, intl.get('New_chart'))), /*#__PURE__*/React.createElement("div", {
|
|
223
|
-
className: "op-item op-item-icon-wrapper
|
|
223
|
+
className: "op-item op-item-icon-wrapper",
|
|
224
224
|
onClick: this.onToggleColorThemeDialog
|
|
225
225
|
}, /*#__PURE__*/React.createElement("span", {
|
|
226
226
|
className: "op-item-icon dtable-font dtable-icon-set-up"
|
|
227
227
|
})), /*#__PURE__*/React.createElement("div", {
|
|
228
|
-
className: "op-item op-item-icon-wrapper
|
|
228
|
+
className: "op-item op-item-icon-wrapper",
|
|
229
229
|
id: "btn-statistic-full-screen",
|
|
230
230
|
onClick: this.onToggleFullScreen
|
|
231
231
|
}, /*#__PURE__*/React.createElement("span", {
|
|
@@ -234,7 +234,7 @@ var DesktopDashboard = /*#__PURE__*/function (_Component) {
|
|
|
234
234
|
placement: "bottom",
|
|
235
235
|
target: "btn-statistic-full-screen"
|
|
236
236
|
}, isFullScreen ? intl.get('Cancel_full_screen') : intl.get('Full_screen'))), /*#__PURE__*/React.createElement("div", {
|
|
237
|
-
className: "op-item op-item-icon-wrapper
|
|
237
|
+
className: "op-item op-item-icon-wrapper",
|
|
238
238
|
id: "btn-statistic-theme-setting"
|
|
239
239
|
}, /*#__PURE__*/React.createElement("span", {
|
|
240
240
|
className: "op-item-icon dtable-font ".concat(theme === 'dark' ? 'dtable-icon-day-mode' : 'dtable-icon-night-mode'),
|
|
@@ -247,7 +247,7 @@ var DesktopDashboard = /*#__PURE__*/function (_Component) {
|
|
|
247
247
|
className: "op-item op-item-icon-wrapper"
|
|
248
248
|
}, /*#__PURE__*/React.createElement("span", {
|
|
249
249
|
title: intl.get('Close'),
|
|
250
|
-
className: "op-item-icon dtable-font dtable-icon-
|
|
250
|
+
className: "op-item-icon btn-close dtable-font dtable-icon-x"
|
|
251
251
|
})))), /*#__PURE__*/React.createElement("main", {
|
|
252
252
|
className: "statistic-main"
|
|
253
253
|
}, /*#__PURE__*/React.createElement(StatList, {
|
package/es/locale/lang/de.js
CHANGED
|
@@ -51,7 +51,7 @@ var de = {
|
|
|
51
51
|
'Untitled': 'Ohne Titel',
|
|
52
52
|
'Settings': 'Einstellungen',
|
|
53
53
|
'Table': 'Tabelle',
|
|
54
|
-
'Views': '
|
|
54
|
+
'Views': 'Ansichten',
|
|
55
55
|
'Display_title': 'Anzeigetitel',
|
|
56
56
|
'X-axis': 'X-Achse',
|
|
57
57
|
'Y-axis': 'Y-Achse',
|
|
@@ -233,7 +233,9 @@ var de = {
|
|
|
233
233
|
'Line_color': 'Linienfarbe',
|
|
234
234
|
'Stack': 'Stapel',
|
|
235
235
|
'Add_new_stack': 'Neuen Stapel hinzufügen',
|
|
236
|
-
'Chart_type': '
|
|
237
|
-
'Edit_type': '
|
|
236
|
+
'Chart_type': 'Diagrammtyp',
|
|
237
|
+
'Edit_type': 'Typ ändern',
|
|
238
|
+
'Update_to_a_table': 'Update to a table',
|
|
239
|
+
'Export_to_a_new_table': 'In neue Tabelle exportieren'
|
|
238
240
|
};
|
|
239
241
|
export default de;
|
package/es/locale/lang/en.js
CHANGED
|
@@ -234,6 +234,8 @@ var en = {
|
|
|
234
234
|
'Stack': 'Stack',
|
|
235
235
|
'Add_new_stack': 'Add new stack',
|
|
236
236
|
'Chart_type': 'Chart type',
|
|
237
|
-
'Edit_type': 'Edit type'
|
|
237
|
+
'Edit_type': 'Edit type',
|
|
238
|
+
'Update_to_a_table': 'Update to a table',
|
|
239
|
+
'Export_to_a_new_table': 'Export to a new table'
|
|
238
240
|
};
|
|
239
241
|
export default en;
|
package/es/locale/lang/fr.js
CHANGED
|
@@ -51,7 +51,7 @@ var fr = {
|
|
|
51
51
|
'Untitled': 'Sans titre',
|
|
52
52
|
'Settings': 'Paramètres',
|
|
53
53
|
'Table': 'Tableau',
|
|
54
|
-
'Views': '
|
|
54
|
+
'Views': 'Vues',
|
|
55
55
|
'Display_title': 'Titre à afficher',
|
|
56
56
|
'X-axis': 'Axe des x',
|
|
57
57
|
'Y-axis': 'Axe des y',
|
|
@@ -233,7 +233,9 @@ var fr = {
|
|
|
233
233
|
'Line_color': 'Couleur de courbe',
|
|
234
234
|
'Stack': 'Pile',
|
|
235
235
|
'Add_new_stack': 'Ajouter une nouvelle pile',
|
|
236
|
-
'Chart_type': '
|
|
237
|
-
'Edit_type': '
|
|
236
|
+
'Chart_type': 'Type de diagramme',
|
|
237
|
+
'Edit_type': 'Modifier le type',
|
|
238
|
+
'Update_to_a_table': 'Update to a table',
|
|
239
|
+
'Export_to_a_new_table': 'Exporter dans un nouveau tableau'
|
|
238
240
|
};
|
|
239
241
|
export default fr;
|
package/es/locale/lang/zh_CN.js
CHANGED
|
@@ -68,7 +68,7 @@ var DashBoardService = /*#__PURE__*/function () {
|
|
|
68
68
|
}
|
|
69
69
|
case STAT_TYPE.PIE:
|
|
70
70
|
{
|
|
71
|
-
return _this.chartService.
|
|
71
|
+
return _this.chartService.generatorChart(_objectSpread(_objectSpread({}, chart), {}, {
|
|
72
72
|
type: STAT_TYPE.RING
|
|
73
73
|
}));
|
|
74
74
|
}
|
|
@@ -93,7 +93,7 @@ var DashBoardService = /*#__PURE__*/function () {
|
|
|
93
93
|
if (summary_type === SUMMARY_TYPE.ADVANCED && summary_columns_option && summary_columns_option.length > 0) {
|
|
94
94
|
convertedChart.column_groupby_multiple_numeric_column = true;
|
|
95
95
|
}
|
|
96
|
-
return this.chartService.
|
|
96
|
+
return this.chartService.generatorChart(convertedChart);
|
|
97
97
|
}
|
|
98
98
|
}, {
|
|
99
99
|
key: "convertChartBar",
|
|
@@ -121,7 +121,7 @@ var DashBoardService = /*#__PURE__*/function () {
|
|
|
121
121
|
}).filter(Boolean);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
return this.chartService.
|
|
124
|
+
return this.chartService.generatorChart(convertedChart);
|
|
125
125
|
}
|
|
126
126
|
}, {
|
|
127
127
|
key: "convertChartLine",
|
|
@@ -145,7 +145,7 @@ var DashBoardService = /*#__PURE__*/function () {
|
|
|
145
145
|
}).filter(Boolean);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
return this.chartService.
|
|
148
|
+
return this.chartService.generatorChart(convertedChart);
|
|
149
149
|
}
|
|
150
150
|
}, {
|
|
151
151
|
key: "mergeAdvancedStatistics",
|
|
@@ -5,8 +5,9 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
5
5
|
import React, { PureComponent } from 'react';
|
|
6
6
|
import intl from 'react-intl-universal';
|
|
7
7
|
import { TableUtils, Views } from 'dtable-store';
|
|
8
|
+
import PivotTableDisplayName from './pivot-table-display-name';
|
|
8
9
|
import { isMobile } from '../../utils';
|
|
9
|
-
import {
|
|
10
|
+
import { TITLE_TOTAL } from '../../constants';
|
|
10
11
|
import styles from './statistic-pivot-table.module.css';
|
|
11
12
|
var OneDimensionTableNoNumericColumns = /*#__PURE__*/function (_PureComponent) {
|
|
12
13
|
_inherits(OneDimensionTableNoNumericColumns, _PureComponent);
|
|
@@ -44,12 +45,10 @@ var OneDimensionTableNoNumericColumns = /*#__PURE__*/function (_PureComponent) {
|
|
|
44
45
|
});
|
|
45
46
|
};
|
|
46
47
|
_this.renderHeader = function (_ref2) {
|
|
47
|
-
var
|
|
48
|
+
var groupByColumn = _ref2.groupByColumn;
|
|
48
49
|
var statItem = _this.props.statItem;
|
|
49
|
-
var
|
|
50
|
-
_statItem$display_tot = statItem.display_total,
|
|
50
|
+
var _statItem$display_tot = statItem.display_total,
|
|
51
51
|
display_total = _statItem$display_tot === void 0 ? true : _statItem$display_tot;
|
|
52
|
-
var groupByColumn = TableUtils.getTableColumnByKey(table, groupby_column_key);
|
|
53
52
|
var _ref3 = groupByColumn || {},
|
|
54
53
|
groupName = _ref3.name;
|
|
55
54
|
return /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
|
|
@@ -59,7 +58,8 @@ var OneDimensionTableNoNumericColumns = /*#__PURE__*/function (_PureComponent) {
|
|
|
59
58
|
}, /*#__PURE__*/React.createElement("div", null, intl.get(TITLE_TOTAL)))));
|
|
60
59
|
};
|
|
61
60
|
_this.renderRows = function (_ref4) {
|
|
62
|
-
var table = _ref4.table
|
|
61
|
+
var table = _ref4.table,
|
|
62
|
+
groupByColumn = _ref4.groupByColumn;
|
|
63
63
|
var _this$props2 = _this.props,
|
|
64
64
|
pivotResult = _this$props2.pivotResult,
|
|
65
65
|
statItem = _this$props2.statItem,
|
|
@@ -75,7 +75,7 @@ var OneDimensionTableNoNumericColumns = /*#__PURE__*/function (_PureComponent) {
|
|
|
75
75
|
var isValidTColumnTotal = _this.props.isValidValue(columnTotal);
|
|
76
76
|
var pivotColumnCells = [];
|
|
77
77
|
return /*#__PURE__*/React.createElement("tbody", null, pivot_rows.map(function (rowItem, rowIdx) {
|
|
78
|
-
var
|
|
78
|
+
var original_name = rowItem.original_name,
|
|
79
79
|
total = rowItem.total,
|
|
80
80
|
rows = rowItem.rows;
|
|
81
81
|
var totalDisplayValue = getSummaryValueDisplayString(summaryColumn, total.total, summary_method);
|
|
@@ -85,7 +85,10 @@ var OneDimensionTableNoNumericColumns = /*#__PURE__*/function (_PureComponent) {
|
|
|
85
85
|
key: 'table-row-' + rowIdx
|
|
86
86
|
}, /*#__PURE__*/React.createElement("td", {
|
|
87
87
|
className: 'pivot-row-name'
|
|
88
|
-
}, /*#__PURE__*/React.createElement(
|
|
88
|
+
}, /*#__PURE__*/React.createElement(PivotTableDisplayName, {
|
|
89
|
+
value: original_name,
|
|
90
|
+
column: groupByColumn
|
|
91
|
+
})), display_total && /*#__PURE__*/React.createElement("td", {
|
|
89
92
|
className: "".concat(styles['pivot-cell'], " ").concat(isValidTotalDisplayValue ? '' : styles['pivot-empty-cell']),
|
|
90
93
|
title: isValidTotalDisplayValue ? totalDisplayValue : '',
|
|
91
94
|
onClick: function onClick() {
|
|
@@ -114,17 +117,20 @@ var OneDimensionTableNoNumericColumns = /*#__PURE__*/function (_PureComponent) {
|
|
|
114
117
|
textColor = _this$props3.textColor,
|
|
115
118
|
statItem = _this$props3.statItem,
|
|
116
119
|
getTableById = _this$props3.getTableById;
|
|
117
|
-
var table_id = statItem.table_id
|
|
120
|
+
var table_id = statItem.table_id,
|
|
121
|
+
groupby_column_key = statItem.groupby_column_key;
|
|
118
122
|
var table = getTableById(table_id);
|
|
123
|
+
var groupByColumn = groupby_column_key && TableUtils.getTableColumnByKey(table, groupby_column_key);
|
|
119
124
|
return /*#__PURE__*/React.createElement("table", {
|
|
120
125
|
style: {
|
|
121
126
|
color: textColor
|
|
122
127
|
},
|
|
123
128
|
className: "".concat(isPreview ? styles['preview-pivot-table'] : styles['large-pivot-table'], " ").concat(styles['pivot-table'])
|
|
124
129
|
}, this.renderHeader({
|
|
125
|
-
|
|
130
|
+
groupByColumn: groupByColumn
|
|
126
131
|
}), this.renderRows({
|
|
127
|
-
table: table
|
|
132
|
+
table: table,
|
|
133
|
+
groupByColumn: groupByColumn
|
|
128
134
|
}));
|
|
129
135
|
}
|
|
130
136
|
}]);
|
|
@@ -6,8 +6,9 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
6
6
|
import React, { PureComponent } from 'react';
|
|
7
7
|
import intl from 'react-intl-universal';
|
|
8
8
|
import { TableUtils } from 'dtable-store';
|
|
9
|
+
import PivotTableDisplayName from './pivot-table-display-name';
|
|
9
10
|
import { isMobile } from '../../utils';
|
|
10
|
-
import {
|
|
11
|
+
import { TITLE_TOTAL } from '../../constants';
|
|
11
12
|
import styles from './statistic-pivot-table.module.css';
|
|
12
13
|
var OneDimensionTableWithNumericColumns = /*#__PURE__*/function (_PureComponent) {
|
|
13
14
|
_inherits(OneDimensionTableWithNumericColumns, _PureComponent);
|
|
@@ -58,7 +59,8 @@ var OneDimensionTableWithNumericColumns = /*#__PURE__*/function (_PureComponent)
|
|
|
58
59
|
})));
|
|
59
60
|
};
|
|
60
61
|
_this.renderRows = function (_ref4) {
|
|
61
|
-
var table = _ref4.table
|
|
62
|
+
var table = _ref4.table,
|
|
63
|
+
groupbyColumn = _ref4.groupbyColumn;
|
|
62
64
|
var _this$props2 = _this.props,
|
|
63
65
|
pivotResult = _this$props2.pivotResult,
|
|
64
66
|
statItem = _this$props2.statItem,
|
|
@@ -71,7 +73,7 @@ var OneDimensionTableWithNumericColumns = /*#__PURE__*/function (_PureComponent)
|
|
|
71
73
|
pivot_columns_total = pivotResult.pivot_columns_total;
|
|
72
74
|
var pivotColumnCells = [];
|
|
73
75
|
return /*#__PURE__*/React.createElement("tbody", null, pivot_rows.map(function (rowItem, rowIdx) {
|
|
74
|
-
var
|
|
76
|
+
var original_name = rowItem.original_name,
|
|
75
77
|
total = rowItem.total,
|
|
76
78
|
rows = rowItem.rows;
|
|
77
79
|
if (!Array.isArray(pivot_columns)) {
|
|
@@ -81,7 +83,10 @@ var OneDimensionTableWithNumericColumns = /*#__PURE__*/function (_PureComponent)
|
|
|
81
83
|
key: 'table-row' + rowIdx
|
|
82
84
|
}, /*#__PURE__*/React.createElement("td", {
|
|
83
85
|
className: 'pivot-row-name'
|
|
84
|
-
}, /*#__PURE__*/React.createElement(
|
|
86
|
+
}, /*#__PURE__*/React.createElement(PivotTableDisplayName, {
|
|
87
|
+
value: original_name,
|
|
88
|
+
column: groupbyColumn
|
|
89
|
+
})), Array.isArray(pivot_columns) && pivot_columns.map(function (columnMap, cellIdx) {
|
|
85
90
|
var key = columnMap.key,
|
|
86
91
|
method = columnMap.method;
|
|
87
92
|
if (Array.isArray(rows) && rows.length > 0) {
|
|
@@ -155,7 +160,8 @@ var OneDimensionTableWithNumericColumns = /*#__PURE__*/function (_PureComponent)
|
|
|
155
160
|
table: table,
|
|
156
161
|
groupbyColumn: groupbyColumn
|
|
157
162
|
}), this.renderRows({
|
|
158
|
-
table: table
|
|
163
|
+
table: table,
|
|
164
|
+
groupbyColumn: groupbyColumn
|
|
159
165
|
}));
|
|
160
166
|
}
|
|
161
167
|
}]);
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React, { Fragment } from 'react';
|
|
6
|
+
import intl from 'react-intl-universal';
|
|
7
|
+
import { getOption, getCollaborator, CellType, getNumberDisplayString, isNumber, COLLABORATOR_COLUMN_TYPES, FORMULA_RESULT_TYPE } from 'dtable-store';
|
|
8
|
+
import { getClientFormulaDisplayString, getKnownCreatorByEmail, generateDefaultUser, getSelectColumnOptions } from '../../utils';
|
|
9
|
+
import { shallowEqual } from '../../utils/common-utils';
|
|
10
|
+
import { EMPTY_NAME } from '../../constants';
|
|
11
|
+
var PivotTableDisplayName = /*#__PURE__*/function (_React$Component) {
|
|
12
|
+
_inherits(PivotTableDisplayName, _React$Component);
|
|
13
|
+
var _super = _createSuper(PivotTableDisplayName);
|
|
14
|
+
function PivotTableDisplayName(props) {
|
|
15
|
+
var _this;
|
|
16
|
+
_classCallCheck(this, PivotTableDisplayName);
|
|
17
|
+
_this = _super.call(this, props);
|
|
18
|
+
_this.updateCreator = function (email) {
|
|
19
|
+
if (!window || !window.app) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
var collaborators = window.app.state.collaborators;
|
|
23
|
+
var creator = getKnownCreatorByEmail(collaborators, email);
|
|
24
|
+
if (creator) {
|
|
25
|
+
_this.setState({
|
|
26
|
+
creator: creator
|
|
27
|
+
});
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
var dtableCollaborators = window.app.collaboratorsCache;
|
|
31
|
+
window.app.queryUsers([email], function (emailUserMap) {
|
|
32
|
+
creator = emailUserMap && emailUserMap[email];
|
|
33
|
+
if (creator) {
|
|
34
|
+
dtableCollaborators[email] = creator;
|
|
35
|
+
_this.setState({
|
|
36
|
+
creator: creator
|
|
37
|
+
});
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// error handle
|
|
42
|
+
creator = generateDefaultUser(email);
|
|
43
|
+
dtableCollaborators[email] = creator;
|
|
44
|
+
_this.setState({
|
|
45
|
+
creator: creator
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
_this.getDisplayName = function (value, column) {
|
|
50
|
+
var type = column.type,
|
|
51
|
+
data = column.data;
|
|
52
|
+
var collaborators = window.app.state.collaborators;
|
|
53
|
+
var displayName;
|
|
54
|
+
switch (type) {
|
|
55
|
+
case CellType.SINGLE_SELECT:
|
|
56
|
+
case CellType.MULTIPLE_SELECT:
|
|
57
|
+
{
|
|
58
|
+
var options = getSelectColumnOptions(column);
|
|
59
|
+
var option = getOption(options, value) || {};
|
|
60
|
+
var optionName = option.name,
|
|
61
|
+
color = option.color,
|
|
62
|
+
textColor = option.textColor;
|
|
63
|
+
displayName = /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
style: {
|
|
65
|
+
color: textColor,
|
|
66
|
+
backgroundColor: color
|
|
67
|
+
},
|
|
68
|
+
className: "multiple-select-option d-inline-block align-middle mw-100",
|
|
69
|
+
title: optionName,
|
|
70
|
+
"aria-label": optionName
|
|
71
|
+
}, optionName);
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
case CellType.COLLABORATOR:
|
|
75
|
+
{
|
|
76
|
+
var collaborator = getCollaborator(collaborators, value) || {};
|
|
77
|
+
displayName = /*#__PURE__*/React.createElement(Collaborator, {
|
|
78
|
+
collaborator: collaborator
|
|
79
|
+
});
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
case CellType.CREATOR:
|
|
83
|
+
case CellType.LAST_MODIFIER:
|
|
84
|
+
{
|
|
85
|
+
var creator = _this.state.creator;
|
|
86
|
+
displayName = /*#__PURE__*/React.createElement(Collaborator, {
|
|
87
|
+
collaborator: creator
|
|
88
|
+
});
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
case CellType.NUMBER:
|
|
92
|
+
{
|
|
93
|
+
var displayValue = isNumber(value) ? getNumberDisplayString(value, data) : value;
|
|
94
|
+
displayName = /*#__PURE__*/React.createElement("div", {
|
|
95
|
+
title: displayValue,
|
|
96
|
+
"aria-label": displayValue
|
|
97
|
+
}, displayValue);
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
case CellType.LINK:
|
|
101
|
+
{
|
|
102
|
+
var _displayValue = getClientFormulaDisplayString([value], data, {
|
|
103
|
+
collaborators: collaborators
|
|
104
|
+
}) || null;
|
|
105
|
+
displayName = /*#__PURE__*/React.createElement("div", {
|
|
106
|
+
title: _displayValue,
|
|
107
|
+
"aria-label": _displayValue
|
|
108
|
+
}, _displayValue);
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
case CellType.FORMULA:
|
|
112
|
+
case CellType.LINK_FORMULA:
|
|
113
|
+
{
|
|
114
|
+
var _displayValue2 = value;
|
|
115
|
+
var _ref = data || {},
|
|
116
|
+
result_type = _ref.result_type,
|
|
117
|
+
array_type = _ref.array_type;
|
|
118
|
+
if (result_type === FORMULA_RESULT_TYPE.NUMBER) {
|
|
119
|
+
var valueNumber = parseFloat(value);
|
|
120
|
+
_displayValue2 = isNumber(valueNumber) ? getNumberDisplayString(valueNumber, data) : value;
|
|
121
|
+
} else if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
|
|
122
|
+
if (COLLABORATOR_COLUMN_TYPES.includes(array_type)) {
|
|
123
|
+
var currentCollaborators = Array.isArray(value) ? value : [value];
|
|
124
|
+
_displayValue2 = currentCollaborators.map(function (email) {
|
|
125
|
+
var user = array_type === CellType.COLLABORATOR ? getCollaborator(collaborators, email) : getKnownCreatorByEmail(collaborators, email);
|
|
126
|
+
return (user || {}).name;
|
|
127
|
+
});
|
|
128
|
+
_displayValue2 = _displayValue2 + '';
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
displayName = /*#__PURE__*/React.createElement("div", {
|
|
132
|
+
title: _displayValue2,
|
|
133
|
+
"aria-label": _displayValue2
|
|
134
|
+
}, _displayValue2);
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
default:
|
|
138
|
+
{
|
|
139
|
+
var _displayValue3 = typeof value !== 'string' ? String(value) : value;
|
|
140
|
+
displayName = /*#__PURE__*/React.createElement("div", {
|
|
141
|
+
title: _displayValue3,
|
|
142
|
+
"aria-label": _displayValue3
|
|
143
|
+
}, _displayValue3);
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return displayName;
|
|
148
|
+
};
|
|
149
|
+
_this.state = {
|
|
150
|
+
creator: {}
|
|
151
|
+
};
|
|
152
|
+
return _this;
|
|
153
|
+
}
|
|
154
|
+
_createClass(PivotTableDisplayName, [{
|
|
155
|
+
key: "componentDidMount",
|
|
156
|
+
value: function componentDidMount() {
|
|
157
|
+
var _this$props = this.props,
|
|
158
|
+
column = _this$props.column,
|
|
159
|
+
value = _this$props.value;
|
|
160
|
+
if (column.type !== CellType.CREATOR && column.type !== CellType.LAST_MODIFIER) return;
|
|
161
|
+
this.updateCreator(value);
|
|
162
|
+
}
|
|
163
|
+
}, {
|
|
164
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
165
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
166
|
+
var column = nextProps.column,
|
|
167
|
+
value = nextProps.value;
|
|
168
|
+
var type = column.type;
|
|
169
|
+
if (type !== CellType.CREATOR && type !== CellType.LAST_MODIFIER) return;
|
|
170
|
+
if (value !== this.props.value || shallowEqual(nextProps.column, this.props.column)) {
|
|
171
|
+
this.updateCreator(value);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}, {
|
|
175
|
+
key: "render",
|
|
176
|
+
value: function render() {
|
|
177
|
+
var _this$props2 = this.props,
|
|
178
|
+
value = _this$props2.value,
|
|
179
|
+
column = _this$props2.column;
|
|
180
|
+
var displayName = value ? this.getDisplayName(value, column) : /*#__PURE__*/React.createElement("div", null, "(".concat(intl.get(EMPTY_NAME), ")"));
|
|
181
|
+
return /*#__PURE__*/React.createElement(Fragment, null, displayName);
|
|
182
|
+
}
|
|
183
|
+
}]);
|
|
184
|
+
return PivotTableDisplayName;
|
|
185
|
+
}(React.Component);
|
|
186
|
+
export default PivotTableDisplayName;
|
|
187
|
+
function Collaborator(props) {
|
|
188
|
+
var _ref2 = props.collaborator || {},
|
|
189
|
+
avatar_url = _ref2.avatar_url,
|
|
190
|
+
name = _ref2.name;
|
|
191
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
192
|
+
className: "collaborators-formatter"
|
|
193
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
194
|
+
className: "collaborator"
|
|
195
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
196
|
+
className: "collaborator-avatar-container"
|
|
197
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
198
|
+
src: avatar_url,
|
|
199
|
+
alt: name,
|
|
200
|
+
className: "collaborator-avatar"
|
|
201
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
202
|
+
className: "collaborator-name",
|
|
203
|
+
title: name,
|
|
204
|
+
"aria-label": name
|
|
205
|
+
}, name)));
|
|
206
|
+
}
|
|
@@ -7,8 +7,9 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
7
7
|
import React, { PureComponent } from 'react';
|
|
8
8
|
import intl from 'react-intl-universal';
|
|
9
9
|
import { CellType, isNumber, TableUtils, Views } from 'dtable-store';
|
|
10
|
+
import PivotTableDisplayName from './pivot-table-display-name';
|
|
10
11
|
import { isMobile } from '../../utils';
|
|
11
|
-
import {
|
|
12
|
+
import { TITLE_TOTAL } from '../../constants';
|
|
12
13
|
import styles from './statistic-pivot-table.module.css';
|
|
13
14
|
var TwoDimensionTable = /*#__PURE__*/function (_PureComponent) {
|
|
14
15
|
_inherits(TwoDimensionTable, _PureComponent);
|
|
@@ -59,7 +60,9 @@ var TwoDimensionTable = /*#__PURE__*/function (_PureComponent) {
|
|
|
59
60
|
return 0;
|
|
60
61
|
};
|
|
61
62
|
_this.getCells = function (row, summaryColumn) {
|
|
62
|
-
var
|
|
63
|
+
var _this$props2 = _this.props,
|
|
64
|
+
pivotResult = _this$props2.pivotResult,
|
|
65
|
+
getSummaryValueDisplayString = _this$props2.getSummaryValueDisplayString;
|
|
63
66
|
var pivot_columns = pivotResult.pivot_columns,
|
|
64
67
|
pivot_summary_multiple_columns = pivotResult.pivot_summary_multiple_columns,
|
|
65
68
|
formulaRows = pivotResult.formulaRows,
|
|
@@ -72,39 +75,49 @@ var TwoDimensionTable = /*#__PURE__*/function (_PureComponent) {
|
|
|
72
75
|
return pivot_columns.map(function (item) {
|
|
73
76
|
var cell = cells[item.key];
|
|
74
77
|
var rowData = cell && cell.rows;
|
|
75
|
-
var summary_multiple_columns =
|
|
78
|
+
var summary_multiple_columns = [];
|
|
79
|
+
var formatted_summary_multiple_columns = [];
|
|
80
|
+
pivot_summary_multiple_columns.forEach(function (column) {
|
|
81
|
+
var key = column.key,
|
|
82
|
+
type = column.type,
|
|
83
|
+
sqlKey = column.sqlKey,
|
|
84
|
+
method = column.method;
|
|
76
85
|
if (Array.isArray(rowData)) {
|
|
77
86
|
var sum = 0;
|
|
78
87
|
rowData.forEach(function (rowDataItem) {
|
|
79
88
|
if (!isSqlQuery) {
|
|
80
|
-
if (
|
|
89
|
+
if (type === CellType.FORMULA) {
|
|
81
90
|
var formulaRow = formulaRows[rowDataItem._id];
|
|
82
|
-
sum += _this.getNumberValue(formulaRow[
|
|
91
|
+
sum += _this.getNumberValue(formulaRow[key]);
|
|
83
92
|
return;
|
|
84
93
|
}
|
|
85
|
-
sum += _this.getNumberValue(rowDataItem[
|
|
94
|
+
sum += _this.getNumberValue(rowDataItem[key]);
|
|
86
95
|
return;
|
|
87
96
|
}
|
|
88
|
-
sum += _this.getNumberValue(rowDataItem[
|
|
97
|
+
sum += _this.getNumberValue(rowDataItem[sqlKey]);
|
|
89
98
|
});
|
|
90
|
-
|
|
99
|
+
summary_multiple_columns.push(sum);
|
|
100
|
+
formatted_summary_multiple_columns.push(getSummaryValueDisplayString(column, sum, method));
|
|
101
|
+
return;
|
|
91
102
|
}
|
|
92
|
-
|
|
103
|
+
summary_multiple_columns.push(0);
|
|
104
|
+
formatted_summary_multiple_columns.push(getSummaryValueDisplayString(column, 0, method));
|
|
93
105
|
});
|
|
94
106
|
return _objectSpread(_objectSpread({}, cells[item.key]), {}, {
|
|
95
107
|
group_original_name: item.original_name,
|
|
96
108
|
group_name: item.key,
|
|
97
109
|
column: summaryColumn,
|
|
98
|
-
summary_multiple_columns: summary_multiple_columns
|
|
110
|
+
summary_multiple_columns: summary_multiple_columns,
|
|
111
|
+
formatted_summary_multiple_columns: formatted_summary_multiple_columns
|
|
99
112
|
});
|
|
100
113
|
});
|
|
101
114
|
};
|
|
102
115
|
_this.renderHeader = function (_ref3) {
|
|
103
116
|
var groupbyColumn = _ref3.groupbyColumn,
|
|
104
117
|
columnGroupbyColumn = _ref3.columnGroupbyColumn;
|
|
105
|
-
var _this$
|
|
106
|
-
pivotResult = _this$
|
|
107
|
-
statItem = _this$
|
|
118
|
+
var _this$props3 = _this.props,
|
|
119
|
+
pivotResult = _this$props3.pivotResult,
|
|
120
|
+
statItem = _this$props3.statItem;
|
|
108
121
|
var column_groupby_column_key = statItem.column_groupby_column_key,
|
|
109
122
|
column_groupby_multiple_numeric_column = statItem.column_groupby_multiple_numeric_column,
|
|
110
123
|
_statItem$display_tot = statItem.display_total,
|
|
@@ -118,11 +131,14 @@ var TwoDimensionTable = /*#__PURE__*/function (_PureComponent) {
|
|
|
118
131
|
return /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
|
|
119
132
|
className: "pivot-table-header"
|
|
120
133
|
}, !rowGroupName && groupName), Array.isArray(pivot_columns) && pivot_columns.map(function (item, index) {
|
|
121
|
-
var
|
|
134
|
+
var original_key = item.original_key;
|
|
122
135
|
return /*#__PURE__*/React.createElement("th", {
|
|
123
136
|
className: 'pivot-table-header',
|
|
124
137
|
key: "pivot-column-".concat(index)
|
|
125
|
-
}, /*#__PURE__*/React.createElement(
|
|
138
|
+
}, /*#__PURE__*/React.createElement(PivotTableDisplayName, {
|
|
139
|
+
value: original_key,
|
|
140
|
+
column: columnGroupbyColumn
|
|
141
|
+
}));
|
|
126
142
|
}), display_total && /*#__PURE__*/React.createElement("th", {
|
|
127
143
|
className: 'pivot-table-header'
|
|
128
144
|
}, /*#__PURE__*/React.createElement("div", null, intl.get(TITLE_TOTAL)))), isMultipleColumnHeader && /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
|
|
@@ -142,12 +158,49 @@ var TwoDimensionTable = /*#__PURE__*/function (_PureComponent) {
|
|
|
142
158
|
className: "pivot-table-header ".concat(styles['pivot-empty-cell'])
|
|
143
159
|
})));
|
|
144
160
|
};
|
|
161
|
+
_this.renderRowTotal = function (isValidSummaryDisplayValue, summaryDisplayValue, cells, pivotRowCells, rowItem, firstSummaryColumnFromMultiple) {
|
|
162
|
+
var rowTotal = summaryDisplayValue;
|
|
163
|
+
if (firstSummaryColumnFromMultiple) {
|
|
164
|
+
rowTotal = _this.props.getSummaryValueDisplayString(firstSummaryColumnFromMultiple, summaryDisplayValue, firstSummaryColumnFromMultiple.method);
|
|
165
|
+
}
|
|
166
|
+
return /*#__PURE__*/React.createElement("td", {
|
|
167
|
+
className: "".concat(styles['pivot-cell'], " ").concat(isValidSummaryDisplayValue ? '' : styles['pivot-empty-cell']),
|
|
168
|
+
title: isValidSummaryDisplayValue ? rowTotal : '',
|
|
169
|
+
onClick: function onClick() {
|
|
170
|
+
return _this.toggleRecords({
|
|
171
|
+
rows: Array.isArray(cells) && cells.length > 0 ? pivotRowCells : rowItem.rows,
|
|
172
|
+
name: rowItem.name,
|
|
173
|
+
rowItem: rowItem,
|
|
174
|
+
original_name: rowItem.original_name
|
|
175
|
+
}, {
|
|
176
|
+
isRow: true
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}, isValidSummaryDisplayValue ? /*#__PURE__*/React.createElement("div", null, rowTotal) : /*#__PURE__*/React.createElement("i", null));
|
|
180
|
+
};
|
|
181
|
+
_this.renderAllTotal = function (allTotalDisplay, pivotColumnCells, firstSummaryColumnFromMultiple) {
|
|
182
|
+
var isValidAllTotalDisplay = _this.props.isValidValue(allTotalDisplay);
|
|
183
|
+
var allTotal = allTotalDisplay;
|
|
184
|
+
if (firstSummaryColumnFromMultiple) {
|
|
185
|
+
allTotal = _this.props.getSummaryValueDisplayString(firstSummaryColumnFromMultiple, allTotalDisplay, firstSummaryColumnFromMultiple.method);
|
|
186
|
+
}
|
|
187
|
+
return /*#__PURE__*/React.createElement("td", {
|
|
188
|
+
className: "".concat(styles['pivot-cell'], " pivot-table-total ").concat(isValidAllTotalDisplay ? '' : styles['pivot-empty-cell']),
|
|
189
|
+
onClick: function onClick() {
|
|
190
|
+
return _this.onClickTotals(pivotColumnCells, {
|
|
191
|
+
isCurrentView: true
|
|
192
|
+
});
|
|
193
|
+
},
|
|
194
|
+
title: isValidAllTotalDisplay ? allTotal : ''
|
|
195
|
+
}, isValidAllTotalDisplay ? /*#__PURE__*/React.createElement("div", null, allTotal) : /*#__PURE__*/React.createElement("i", null));
|
|
196
|
+
};
|
|
145
197
|
_this.renderRows = function (_ref5) {
|
|
146
|
-
var table = _ref5.table
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
198
|
+
var table = _ref5.table,
|
|
199
|
+
groupbyColumn = _ref5.groupbyColumn;
|
|
200
|
+
var _this$props4 = _this.props,
|
|
201
|
+
pivotResult = _this$props4.pivotResult,
|
|
202
|
+
statItem = _this$props4.statItem,
|
|
203
|
+
getSummaryValueDisplayString = _this$props4.getSummaryValueDisplayString;
|
|
151
204
|
var summary_column_key = statItem.summary_column_key,
|
|
152
205
|
summary_method = statItem.summary_method,
|
|
153
206
|
column_groupby_multiple_numeric_column = statItem.column_groupby_multiple_numeric_column,
|
|
@@ -163,10 +216,11 @@ var TwoDimensionTable = /*#__PURE__*/function (_PureComponent) {
|
|
|
163
216
|
isSqlQuery = _pivotResult$isSqlQue2 === void 0 ? false : _pivotResult$isSqlQue2;
|
|
164
217
|
var summaryColumn = TableUtils.getTableColumnByKey(table, summary_column_key) || {};
|
|
165
218
|
var allTotalDisplay = column_groupby_multiple_numeric_column ? 0 : getSummaryValueDisplayString(summaryColumn, pivot_table_total, summary_method);
|
|
166
|
-
var
|
|
219
|
+
var firstSummaryColumnFromMultiple = column_groupby_multiple_numeric_column && pivot_summary_multiple_columns[0] || null;
|
|
167
220
|
var pivotColumnCells = [];
|
|
168
221
|
return /*#__PURE__*/React.createElement("tbody", null, pivot_rows.map(function (rowItem, rowIdx) {
|
|
169
222
|
var name = rowItem.name,
|
|
223
|
+
original_name = rowItem.original_name,
|
|
170
224
|
total = rowItem.total;
|
|
171
225
|
var cells = _this.getCells(rowItem, summaryColumn);
|
|
172
226
|
var pivotRowCells = [];
|
|
@@ -182,7 +236,10 @@ var TwoDimensionTable = /*#__PURE__*/function (_PureComponent) {
|
|
|
182
236
|
key: 'table-row' + rowIdx
|
|
183
237
|
}, /*#__PURE__*/React.createElement("td", {
|
|
184
238
|
className: 'pivot-row-name'
|
|
185
|
-
}, /*#__PURE__*/React.createElement(
|
|
239
|
+
}, /*#__PURE__*/React.createElement(PivotTableDisplayName, {
|
|
240
|
+
value: original_name,
|
|
241
|
+
column: groupbyColumn
|
|
242
|
+
})), Array.isArray(cells) && cells.map(function (c, cellIdx) {
|
|
186
243
|
if (c && Array.isArray(c.rows) && c.rows.length > 0) {
|
|
187
244
|
pivotRowCells.push.apply(pivotRowCells, _toConsumableArray(c.rows));
|
|
188
245
|
if (pivotColumnCells[cellIdx]) {
|
|
@@ -193,7 +250,8 @@ var TwoDimensionTable = /*#__PURE__*/function (_PureComponent) {
|
|
|
193
250
|
}
|
|
194
251
|
}
|
|
195
252
|
if (column_groupby_multiple_numeric_column) {
|
|
196
|
-
var summary_multiple_columns = c.summary_multiple_columns
|
|
253
|
+
var summary_multiple_columns = c.summary_multiple_columns,
|
|
254
|
+
formatted_summary_multiple_columns = c.formatted_summary_multiple_columns;
|
|
197
255
|
summary_multiple_columns.forEach(function (item) {
|
|
198
256
|
summaryDisplayValue += _this.getNumberValue(item);
|
|
199
257
|
});
|
|
@@ -212,12 +270,11 @@ var TwoDimensionTable = /*#__PURE__*/function (_PureComponent) {
|
|
|
212
270
|
}
|
|
213
271
|
}, /*#__PURE__*/React.createElement("div", {
|
|
214
272
|
className: styles['pivot-summary-multiple-columns-div']
|
|
215
|
-
},
|
|
273
|
+
}, formatted_summary_multiple_columns.map(function (label, index) {
|
|
216
274
|
return /*#__PURE__*/React.createElement("div", {
|
|
217
|
-
key: index
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}) : label);
|
|
275
|
+
key: index,
|
|
276
|
+
title: label
|
|
277
|
+
}, label);
|
|
221
278
|
})), /*#__PURE__*/React.createElement("span", null));
|
|
222
279
|
}
|
|
223
280
|
var displayValue = getSummaryValueDisplayString(c.column, c.total, summary_method);
|
|
@@ -237,27 +294,14 @@ var TwoDimensionTable = /*#__PURE__*/function (_PureComponent) {
|
|
|
237
294
|
});
|
|
238
295
|
}
|
|
239
296
|
}, isValidDisplayValue ? /*#__PURE__*/React.createElement("div", null, displayValue) : /*#__PURE__*/React.createElement("i", null), /*#__PURE__*/React.createElement("span", null));
|
|
240
|
-
}), display_total &&
|
|
241
|
-
className: "".concat(styles['pivot-cell'], " ").concat(isValidSummaryDisplayValue ? '' : styles['pivot-empty-cell']),
|
|
242
|
-
title: isValidSummaryDisplayValue ? summaryDisplayValue : '',
|
|
243
|
-
onClick: function onClick() {
|
|
244
|
-
return _this.toggleRecords({
|
|
245
|
-
rows: Array.isArray(cells) && cells.length > 0 ? pivotRowCells : rowItem.rows,
|
|
246
|
-
name: name,
|
|
247
|
-
rowItem: rowItem,
|
|
248
|
-
original_name: rowItem.original_name
|
|
249
|
-
}, {
|
|
250
|
-
isRow: true
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
}, isValidSummaryDisplayValue ? /*#__PURE__*/React.createElement("div", null, summaryDisplayValue) : /*#__PURE__*/React.createElement("i", null)));
|
|
297
|
+
}), display_total && _this.renderRowTotal(isValidSummaryDisplayValue, summaryDisplayValue, cells, pivotRowCells, rowItem, firstSummaryColumnFromMultiple));
|
|
254
298
|
}), display_total && /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
|
|
255
299
|
className: 'pivot-column-total'
|
|
256
300
|
}, /*#__PURE__*/React.createElement("div", null, intl.get(TITLE_TOTAL))), Array.isArray(pivot_columns) && pivot_columns.map(function (c, index) {
|
|
257
301
|
var pivotColumnCell = pivotColumnCells[index] || [];
|
|
258
302
|
var pivotColumnTotal = pivot_columns_total[c.key];
|
|
259
|
-
var totalDisplayValue =
|
|
260
|
-
var isValidTotalDisplayValue =
|
|
303
|
+
var totalDisplayValue = 0;
|
|
304
|
+
var isValidTotalDisplayValue = true;
|
|
261
305
|
if (column_groupby_multiple_numeric_column) {
|
|
262
306
|
var total = 0;
|
|
263
307
|
pivotColumnCell.forEach(function (item) {
|
|
@@ -279,6 +323,13 @@ var TwoDimensionTable = /*#__PURE__*/function (_PureComponent) {
|
|
|
279
323
|
});
|
|
280
324
|
totalDisplayValue = total;
|
|
281
325
|
allTotalDisplay += total;
|
|
326
|
+
isValidTotalDisplayValue = _this.props.isValidValue(totalDisplayValue);
|
|
327
|
+
if (firstSummaryColumnFromMultiple) {
|
|
328
|
+
totalDisplayValue = getSummaryValueDisplayString(firstSummaryColumnFromMultiple, totalDisplayValue, firstSummaryColumnFromMultiple.method);
|
|
329
|
+
}
|
|
330
|
+
} else {
|
|
331
|
+
totalDisplayValue = getSummaryValueDisplayString(summaryColumn, pivotColumnTotal, summary_method);
|
|
332
|
+
isValidTotalDisplayValue = _this.props.isValidValue(totalDisplayValue);
|
|
282
333
|
}
|
|
283
334
|
return /*#__PURE__*/React.createElement("td", {
|
|
284
335
|
className: "".concat(styles['pivot-cell'], " ").concat(isValidTotalDisplayValue ? '' : styles['pivot-empty-cell']),
|
|
@@ -294,27 +345,19 @@ var TwoDimensionTable = /*#__PURE__*/function (_PureComponent) {
|
|
|
294
345
|
});
|
|
295
346
|
}
|
|
296
347
|
}, isValidTotalDisplayValue ? /*#__PURE__*/React.createElement("div", null, totalDisplayValue) : /*#__PURE__*/React.createElement("i", null));
|
|
297
|
-
}),
|
|
298
|
-
className: "".concat(styles['pivot-cell'], " pivot-table-total ").concat(isValidAllTotalDisplay ? '' : styles['pivot-empty-cell']),
|
|
299
|
-
onClick: function onClick() {
|
|
300
|
-
return _this.onClickTotals(pivotColumnCells, {
|
|
301
|
-
isCurrentView: true
|
|
302
|
-
});
|
|
303
|
-
},
|
|
304
|
-
title: isValidAllTotalDisplay ? allTotalDisplay : ''
|
|
305
|
-
}, isValidAllTotalDisplay ? /*#__PURE__*/React.createElement("div", null, allTotalDisplay) : /*#__PURE__*/React.createElement("i", null))));
|
|
348
|
+
}), _this.renderAllTotal(allTotalDisplay, pivotColumnCells, firstSummaryColumnFromMultiple)));
|
|
306
349
|
};
|
|
307
350
|
return _this;
|
|
308
351
|
}
|
|
309
352
|
_createClass(TwoDimensionTable, [{
|
|
310
353
|
key: "render",
|
|
311
354
|
value: function render() {
|
|
312
|
-
var _this$
|
|
313
|
-
pivotResult = _this$
|
|
314
|
-
statItem = _this$
|
|
315
|
-
isPreview = _this$
|
|
316
|
-
textColor = _this$
|
|
317
|
-
getTableById = _this$
|
|
355
|
+
var _this$props5 = this.props,
|
|
356
|
+
pivotResult = _this$props5.pivotResult,
|
|
357
|
+
statItem = _this$props5.statItem,
|
|
358
|
+
isPreview = _this$props5.isPreview,
|
|
359
|
+
textColor = _this$props5.textColor,
|
|
360
|
+
getTableById = _this$props5.getTableById;
|
|
318
361
|
if (!pivotResult) return '';
|
|
319
362
|
var table_id = statItem.table_id,
|
|
320
363
|
groupby_column_key = statItem.groupby_column_key,
|
|
@@ -335,7 +378,8 @@ var TwoDimensionTable = /*#__PURE__*/function (_PureComponent) {
|
|
|
335
378
|
groupbyColumn: groupbyColumn,
|
|
336
379
|
columnGroupbyColumn: columnGroupbyColumn
|
|
337
380
|
}), this.renderRows({
|
|
338
|
-
table: table
|
|
381
|
+
table: table,
|
|
382
|
+
groupbyColumn: groupbyColumn
|
|
339
383
|
}));
|
|
340
384
|
}
|
|
341
385
|
}]);
|
package/es/utils/collaborator.js
CHANGED
|
@@ -28,4 +28,13 @@ export var getKnownCreatorByEmail = function getKnownCreatorByEmail(collaborator
|
|
|
28
28
|
creator = dtableCollaborators[email];
|
|
29
29
|
if (creator) return creator;
|
|
30
30
|
return null;
|
|
31
|
+
};
|
|
32
|
+
export var generateDefaultUser = function generateDefaultUser(name) {
|
|
33
|
+
if (!window || window.dtable) return {};
|
|
34
|
+
var mediaUrl = window.dtable.mediaUrl;
|
|
35
|
+
var defaultAvatarUrl = "".concat(mediaUrl, "avatars/default.png");
|
|
36
|
+
return {
|
|
37
|
+
name: name,
|
|
38
|
+
avatar_url: defaultAvatarUrl
|
|
39
|
+
};
|
|
31
40
|
};
|
package/es/utils/index.js
CHANGED
|
@@ -20,7 +20,7 @@ export var isMobile = typeof window !== 'undefined' && (window.innerWidth < 768
|
|
|
20
20
|
export { getClientCellValueDisplayString, getClientFormulaDisplayString } from './cell-format';
|
|
21
21
|
export { hasOwnProperty, isEmptyObject, isSameObject } from './object';
|
|
22
22
|
export { isCellValueChanged } from './cell-value';
|
|
23
|
-
export { getKnownCreatorByEmail } from './collaborator';
|
|
23
|
+
export { getKnownCreatorByEmail, generateDefaultUser } from './collaborator';
|
|
24
24
|
export { getDateColumnFormat, getSelectColumnOptions } from './column';
|
|
25
25
|
export { translateCalendar, getTodayDate } from './date-format';
|
|
26
26
|
export { searchRows } from './search';
|