sea-chart 0.0.87 → 0.0.88
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/dist/utils/chart-utils/base-utils.js +8 -3
- package/dist/utils/chart-utils/original-data-utils/trend-calculator.js +1 -1
- package/dist/utils/trend-utils.js +12 -5
- package/dist/view/wrapper/table/index.css +1 -0
- package/dist/view/wrapper/table/one-dimension-table-no-numeric-columns.js +9 -1
- package/dist/view/wrapper/table/two-dimension-table.js +2 -2
- package/package.json +1 -1
|
@@ -1293,9 +1293,13 @@ BaseUtils.getMean = function (list) {
|
|
|
1293
1293
|
BaseUtils.summaryDurationResult = (result, duration, summaryType, summaryMethod, useDataDb, dbDateKey, valueKey) => {
|
|
1294
1294
|
const currentTime = dayjs();
|
|
1295
1295
|
const days = duration === 'days_30' ? 30 : 7;
|
|
1296
|
-
|
|
1297
|
-
const
|
|
1298
|
-
const
|
|
1296
|
+
// set date to start of the day
|
|
1297
|
+
const formattedEndDate = currentTime.format('YYYY-MM-DD');
|
|
1298
|
+
const formattedMiddleDate = currentTime.subtract(days, 'days').format('YYYY-MM-DD');
|
|
1299
|
+
const formattedStartDate = dayjs(formattedMiddleDate).subtract(days, 'days').format('YYYY-MM-DD');
|
|
1300
|
+
const endDate = dayjs(formattedEndDate);
|
|
1301
|
+
const middleDate = dayjs(formattedMiddleDate);
|
|
1302
|
+
const startDate = dayjs(formattedStartDate);
|
|
1299
1303
|
let compareValue = [];
|
|
1300
1304
|
let comparedValue = [];
|
|
1301
1305
|
if (useDataDb) {
|
|
@@ -1304,6 +1308,7 @@ BaseUtils.summaryDurationResult = (result, duration, summaryType, summaryMethod,
|
|
|
1304
1308
|
for (let index = 0; index < result.length; index++) {
|
|
1305
1309
|
const item = result[index];
|
|
1306
1310
|
const key = dayjs(item[dbDateKey]);
|
|
1311
|
+
if (!key.isValid()) continue;
|
|
1307
1312
|
if (key >= startDate && key < middleDate) {
|
|
1308
1313
|
comparedValue.push(item[valueKey]);
|
|
1309
1314
|
days1.push(key);
|
|
@@ -59,7 +59,7 @@ async function calculator(chart, value, _ref) {
|
|
|
59
59
|
const {
|
|
60
60
|
compareValue: value1,
|
|
61
61
|
comparedValue: value2
|
|
62
|
-
} = summaryDurationResult(resultMap, date_granularity, summary_type,
|
|
62
|
+
} = summaryDurationResult(resultMap, date_granularity, summary_type, summary_method, false);
|
|
63
63
|
currentValues = value1;
|
|
64
64
|
previousValues = value2;
|
|
65
65
|
} else {
|
|
@@ -75,9 +75,14 @@ export function getCompareDate(dateGranularity) {
|
|
|
75
75
|
export function summaryDurationResult(result, duration, summaryType, summaryMethod, useDataDb, dbDateKey, valueKey) {
|
|
76
76
|
const currentTime = dayjs();
|
|
77
77
|
const days = duration === 'days_30' ? 30 : 7;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const
|
|
78
|
+
|
|
79
|
+
// set date to start of the day
|
|
80
|
+
const formattedEndDate = currentTime.format('YYYY-MM-DD');
|
|
81
|
+
const formattedMiddleDate = currentTime.subtract(days, 'days').format('YYYY-MM-DD');
|
|
82
|
+
const formattedStartDate = dayjs(formattedMiddleDate).subtract(days, 'days').format('YYYY-MM-DD');
|
|
83
|
+
const endDate = dayjs(formattedEndDate);
|
|
84
|
+
const middleDate = dayjs(formattedMiddleDate);
|
|
85
|
+
const startDate = dayjs(formattedStartDate);
|
|
81
86
|
let compareValue = [];
|
|
82
87
|
let comparedValue = [];
|
|
83
88
|
if (useDataDb) {
|
|
@@ -85,7 +90,8 @@ export function summaryDurationResult(result, duration, summaryType, summaryMeth
|
|
|
85
90
|
const days2 = [];
|
|
86
91
|
for (let index = 0; index < result.length; index++) {
|
|
87
92
|
const item = result[index];
|
|
88
|
-
const key = item[dbDateKey];
|
|
93
|
+
const key = dayjs(item[dbDateKey]);
|
|
94
|
+
if (!key.isValid()) continue;
|
|
89
95
|
if (key >= startDate && key < middleDate) {
|
|
90
96
|
comparedValue.push(item[valueKey]);
|
|
91
97
|
days1.push(key);
|
|
@@ -97,7 +103,8 @@ export function summaryDurationResult(result, duration, summaryType, summaryMeth
|
|
|
97
103
|
} else {
|
|
98
104
|
// eslint-disable-next-line
|
|
99
105
|
for (let item of result) {
|
|
100
|
-
const key = item[0];
|
|
106
|
+
const key = dayjs(item[0]);
|
|
107
|
+
if (!key.isValid()) continue;
|
|
101
108
|
if (key >= startDate && key < middleDate) {
|
|
102
109
|
if (summaryType === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
103
110
|
comparedValue = comparedValue.concat(item[1] || []);
|
|
@@ -142,7 +142,15 @@ class OneDimensionTableNoNumericColumns extends PureComponent {
|
|
|
142
142
|
'selected-pivot-cell-top': isSelectedTotalCellTop,
|
|
143
143
|
'selected-pivot-cell-left': isSelectedTotalCellLeft
|
|
144
144
|
}),
|
|
145
|
-
total: totalDisplayValue
|
|
145
|
+
total: totalDisplayValue,
|
|
146
|
+
onClick: () => this.toggleRecords({
|
|
147
|
+
...rowItem,
|
|
148
|
+
total: total
|
|
149
|
+
}, {
|
|
150
|
+
rowIdx,
|
|
151
|
+
cellIdx: 0,
|
|
152
|
+
isRow: true
|
|
153
|
+
})
|
|
146
154
|
}, isValidTotalDisplayValue ? totalDisplayValue : /*#__PURE__*/React.createElement("i", null), /*#__PURE__*/React.createElement("span", {
|
|
147
155
|
className: classnames({
|
|
148
156
|
'selected-pivot-cell-border': isSelectedTotalCell
|
|
@@ -68,7 +68,7 @@ class TwoDimensionTable extends PureComponent {
|
|
|
68
68
|
let {
|
|
69
69
|
original_key
|
|
70
70
|
} = item;
|
|
71
|
-
if (isCollaborator) {
|
|
71
|
+
if (isCollaborator && !Array.isArray(original_key)) {
|
|
72
72
|
original_key = [original_key];
|
|
73
73
|
}
|
|
74
74
|
let isSelectedHeaderBottom = selectRowIdx === 0 && selectedCellIdx === index;
|
|
@@ -187,7 +187,7 @@ class TwoDimensionTable extends PureComponent {
|
|
|
187
187
|
name,
|
|
188
188
|
total
|
|
189
189
|
} = rowItem;
|
|
190
|
-
if (isCollaborator) {
|
|
190
|
+
if (isCollaborator && !Array.isArray(name)) {
|
|
191
191
|
name = [name];
|
|
192
192
|
}
|
|
193
193
|
const cells = this.getCells(rowItem);
|