sea-chart 0.0.67-alpha.1 → 0.0.67-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.
@@ -18,7 +18,7 @@
18
18
  color: #999;
19
19
  }
20
20
 
21
- .statistic-color-rules-popover .statistic-add-item-btn {
21
+ .statistic-color-rules-popover .add-item-btn {
22
22
  display: flex;
23
23
  align-items: center;
24
24
  height: 40px;
@@ -32,7 +32,7 @@
32
32
  position: relative;
33
33
  }
34
34
 
35
- .statistic-color-rules-popover .statistic-add-item-btn .dtable-icon-add-table {
35
+ .statistic-color-rules-popover .add-item-btn .dtable-icon-add-table {
36
36
  margin-right: 10px;
37
37
  font-size: 12px;
38
38
  font-weight: 600;
@@ -145,7 +145,7 @@
145
145
  color: #999;
146
146
  }
147
147
 
148
- .statistic-add-item-btn.statistic-btn-add-color-rule-filter {
148
+ .add-item-btn.statistic-btn-add-color-rule-filter {
149
149
  border-top: unset;
150
150
  background-color: #f5f5f5;
151
151
  padding-left: 27px;
@@ -1,4 +1,4 @@
1
- .statistic-add-item-btn {
1
+ .add-item-btn {
2
2
  display: flex;
3
3
  align-items: center;
4
4
  height: 40px;
@@ -12,7 +12,7 @@
12
12
  position: relative;
13
13
  }
14
14
 
15
- .statistic-add-item-btn .dtable-icon-add-table {
15
+ .add-item-btn .dtable-icon-add-table {
16
16
  margin-right: 10px;
17
17
  font-size: 12px;
18
18
  font-weight: 600;
@@ -8,7 +8,7 @@ function CommonAddTool(props) {
8
8
  addIconClassName
9
9
  } = props;
10
10
  return /*#__PURE__*/React.createElement("div", {
11
- className: "statistic-add-item-btn ".concat(className ? className : ''),
11
+ className: "add-item-btn ".concat(className ? className : ''),
12
12
  onClick: e => {
13
13
  callBack(e);
14
14
  }
@@ -40,12 +40,11 @@ class StatisticRecordDialog extends React.Component {
40
40
  }
41
41
  this.unShowColumnKeyList = this.getUnShowColumnKeyList(this.view);
42
42
  this.renderedColumns = this.getRenderedColumns(this.table);
43
- if (this.isArchiveView || !isCalculateByView || statisticRecord.isQueryBySql) {
43
+ if (this.isArchiveView || !isCalculateByView || (rows === null || rows === void 0 ? void 0 : rows.length) === 0) {
44
44
  var _context$api;
45
45
  const chartDataSQL = new ChartDataSQL({
46
46
  table: this.table,
47
- chart,
48
- view: this.view
47
+ chart
49
48
  });
50
49
  const sqlString = chartDataSQL.get_statistic_record_sql(chart, statisticRecord, {
51
50
  isColumn,
@@ -1372,6 +1372,8 @@ BaseUtils.mergePivotTableSameCollaborator = pivot_rows => {
1372
1372
  new_pivot_rows.push({
1373
1373
  ...item
1374
1374
  });
1375
+ } else {
1376
+ new_pivot_rows.push(item);
1375
1377
  }
1376
1378
  });
1377
1379
  return new_pivot_rows;
@@ -646,7 +646,9 @@ SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
646
646
  pivot_table_total, chart);
647
647
  BaseUtils.sortCharts(pivot_rows, groupbyColumn, 'name');
648
648
  BaseUtils.sortCharts(pivot_columns, columnGroupbyColumn, 'key');
649
- pivot_rows = BaseUtils.mergePivotTableSameCollaborator(pivot_rows);
649
+ if ((groupbyColumn === null || groupbyColumn === void 0 ? void 0 : groupbyColumn.type) === CellType.COLLABORATOR) {
650
+ pivot_rows = BaseUtils.mergePivotTableSameCollaborator(pivot_rows);
651
+ }
650
652
  const summary_columns = [summaryColumn, ...summaryColumnsWithMethod.map(item => item.column)];
651
653
  return {
652
654
  summary_columns,
@@ -13,7 +13,6 @@ class ChartDataSQL {
13
13
  var _chart$config;
14
14
  let {
15
15
  table,
16
- view,
17
16
  chart,
18
17
  username,
19
18
  userId,
@@ -1060,7 +1059,6 @@ class ChartDataSQL {
1060
1059
  };
1061
1060
  this.error = '';
1062
1061
  this.table = table;
1063
- this.view = view;
1064
1062
  this.chart = (chart === null || chart === void 0 ? void 0 : chart.config) || {};
1065
1063
  this.username = username;
1066
1064
  const table_name = (table === null || table === void 0 ? void 0 : table.name) || '';
@@ -1074,7 +1072,7 @@ class ChartDataSQL {
1074
1072
  Array.isArray(table.columns) && table.columns.forEach(column => {
1075
1073
  this.column_key_map[column.key] = column;
1076
1074
  });
1077
- this.filter_sql = filter2SqlCondition(table, view, username, userId, userDepartmentIdsMap);
1075
+ this.filter_sql = filter2SqlCondition(table, chart, username, userId, userDepartmentIdsMap);
1078
1076
  }
1079
1077
  }
1080
1078
  export default ChartDataSQL;
@@ -305,10 +305,7 @@ class Combination extends ChartComponent {
305
305
  }, 100));
306
306
  }
307
307
  this.chart.on('element:click', e => {
308
- this.props.toggleRecords({
309
- ...e.data.data,
310
- isQueryBySql: true
311
- });
308
+ this.props.toggleRecords(e.data.data);
312
309
  });
313
310
  this.chart.on('interval:mouseenter', e => {
314
311
  if (this.isInsideInterval) return;
@@ -147,8 +147,7 @@
147
147
  padding: 0;
148
148
  }
149
149
 
150
- .sea-chart-pivot-table .pivot-table-header-summary-columns-container,
151
- .sea-chart-pivot-table .pivot-cells-container {
150
+ .sea-chart-pivot-table .pivot-table-header-summary-columns-container {
152
151
  height: 100%;
153
152
  width: 100%;
154
153
  overflow: hidden;
@@ -156,6 +155,14 @@
156
155
  justify-content: space-between;
157
156
  }
158
157
 
158
+ .sea-chart-pivot-table .pivot-cells-container {
159
+ height: 100%;
160
+ width: 100%;
161
+ overflow: hidden;
162
+ display: flex;
163
+ justify-content: center;
164
+ }
165
+
159
166
  .sea-chart-pivot-table .pivot-table-header-summary-columns-container > div,
160
167
  .sea-chart-pivot-table .pivot-cells-container > div {
161
168
  flex:1;
@@ -153,7 +153,6 @@ class OneDimensionTableWithNumericColumns extends PureComponent {
153
153
  key: "table-cell-".concat(cellIdx),
154
154
  onClick: () => this.toggleRecords({
155
155
  rows,
156
- name: rowItem === null || rowItem === void 0 ? void 0 : rowItem.name,
157
156
  total: total[key]
158
157
  }, {
159
158
  rowIdx,
@@ -126,6 +126,24 @@ class TwoDimensionTable extends PureComponent {
126
126
  total
127
127
  }, selectedCell);
128
128
  };
129
+ this.renderEmptyCell = (summary_columns, cellIdx) => {
130
+ if ((summary_columns === null || summary_columns === void 0 ? void 0 : summary_columns.length) !== 0) {
131
+ return summary_columns.map(() => {
132
+ return /*#__PURE__*/React.createElement("div", {
133
+ key: "table-cell-".concat(cellIdx),
134
+ className: classnames('pivot-cell', {
135
+ 'pivot-empty-cell': true
136
+ })
137
+ }, /*#__PURE__*/React.createElement("i", null));
138
+ });
139
+ }
140
+ return /*#__PURE__*/React.createElement("div", {
141
+ key: "table-cell-".concat(cellIdx),
142
+ className: classnames('pivot-cell', {
143
+ 'pivot-empty-cell': true
144
+ })
145
+ }, /*#__PURE__*/React.createElement("i", null));
146
+ };
129
147
  this.renderRows = () => {
130
148
  const {
131
149
  result,
@@ -214,10 +232,7 @@ class TwoDimensionTable extends PureComponent {
214
232
  'selected-pivot-cell-left': isSelectedCellLeft
215
233
  }),
216
234
  key: "table-cell-".concat(cellIdx),
217
- onClick: () => this.toggleRecords({
218
- ...c,
219
- name: rowItem === null || rowItem === void 0 ? void 0 : rowItem.name
220
- }, {
235
+ onClick: () => this.toggleRecords(c, {
221
236
  rowIdx,
222
237
  cellIdx
223
238
  }),
@@ -251,14 +266,7 @@ class TwoDimensionTable extends PureComponent {
251
266
  'selected-pivot-cell-border': isSelectedCell
252
267
  })
253
268
  }));
254
- }), !total && (summary_columns === null || summary_columns === void 0 ? void 0 : summary_columns.map(() => {
255
- return /*#__PURE__*/React.createElement("div", {
256
- key: "table-cell-".concat(cellIdx),
257
- className: classnames('pivot-cell', {
258
- 'pivot-empty-cell': true
259
- })
260
- }, /*#__PURE__*/React.createElement("i", null));
261
- }))));
269
+ }), !total && this.renderEmptyCell(summary_columns, cellIdx)));
262
270
  }), display_total && /*#__PURE__*/React.createElement("td", {
263
271
  className: classnames('pivot-cell', {
264
272
  'pivot-empty-cell': !isValidSummaryDisplayValue,
@@ -268,8 +276,7 @@ class TwoDimensionTable extends PureComponent {
268
276
  }),
269
277
  onClick: () => this.toggleRecords({
270
278
  rows: Array.isArray(cells) && cells.length > 0 ? pivotRowCells : rowItem.rows,
271
- total: total,
272
- name: rowItem === null || rowItem === void 0 ? void 0 : rowItem.name
279
+ total: total
273
280
  }, {
274
281
  rowIdx,
275
282
  cellIdx: cells.length
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sea-chart",
3
- "version": "0.0.67-alpha.1",
3
+ "version": "0.0.67-alpha.2",
4
4
  "main": "./dist/index.js",
5
5
  "dependencies": {
6
6
  "@antv/data-set": "0.11.8",