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.
@@ -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
- const endDate = currentTime;
1297
- const middleDate = currentTime.subtract(days, 'days');
1298
- const startDate = dayjs(middleDate).subtract(days, 'days');
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, summary_column_key, false);
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
- const endDate = currentTime.format('YYYY-MM-DD');
79
- const middleDate = currentTime.subtract(days, 'days').format('YYYY-MM-DD');
80
- const startDate = dayjs(middleDate).subtract(days, 'days').format('YYYY-MM-DD');
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] || []);
@@ -116,6 +116,7 @@
116
116
  white-space: nowrap;
117
117
  width: -webkit-min-content;
118
118
  width: min-content;
119
+ margin-right: 3px;
119
120
  }
120
121
 
121
122
  .sea-chart-pivot-table .collaborator-avatar-container {
@@ -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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sea-chart",
3
- "version": "0.0.87",
3
+ "version": "0.0.88",
4
4
  "main": "./dist/index.js",
5
5
  "dependencies": {
6
6
  "@antv/data-set": "0.11.8",