sea-chart 0.0.88 → 0.0.89
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/components/statistic-record-dialog/index.js +12 -2
- package/dist/constants/index.js +1 -1
- package/dist/locale/lang/de.js +6 -5
- package/dist/locale/lang/en.js +2 -1
- package/dist/locale/lang/es.js +2 -1
- package/dist/locale/lang/fr.js +4 -3
- package/dist/locale/lang/pt.js +2 -1
- package/dist/locale/lang/ru.js +2 -1
- package/dist/locale/lang/zh_CN.js +2 -1
- package/dist/settings/stacks-settings/index.js +15 -7
- package/dist/settings/widgets/numeric-summary-item.js +1 -1
- package/dist/settings/widgets/y-axis-group-settings.js +11 -3
- package/dist/utils/chart-utils/original-data-utils/pivot-table-calculator.js +19 -2
- package/dist/utils/chart-utils/sql-statistics-utils.js +4 -1
- package/dist/utils/index.js +2 -2
- package/dist/utils/row-record-utils.js +31 -6
- package/dist/view/wrapper/table/two-dimension-table.js +1 -1
- package/package.json +5 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _toaster from "dtable-ui-component/lib/toaster";
|
|
1
2
|
import React, { Fragment } from 'react';
|
|
2
3
|
import { Modal, ModalBody } from 'reactstrap';
|
|
3
4
|
import { getTableById, getViewById, isArchiveView, getFormulaColumnsContainLinks, getViewShownColumns } from 'dtable-utils';
|
|
@@ -11,6 +12,7 @@ import ChartDataSQL from '../../utils/sql/chart-data-sql';
|
|
|
11
12
|
import { getFilterConditions } from '../../utils/row-record-utils';
|
|
12
13
|
import RowCard from '../row-card/row-card';
|
|
13
14
|
import { CommonEventTypes } from '../../constants/common-constants';
|
|
15
|
+
import { getErrorMessage } from '../../utils';
|
|
14
16
|
import './index.css';
|
|
15
17
|
class StatisticRecordDialog extends React.Component {
|
|
16
18
|
constructor(_props) {
|
|
@@ -52,7 +54,11 @@ class StatisticRecordDialog extends React.Component {
|
|
|
52
54
|
results: rows
|
|
53
55
|
} = res.data;
|
|
54
56
|
this.processDrilledRows(rows);
|
|
55
|
-
}).catch(error =>
|
|
57
|
+
}).catch(error => {
|
|
58
|
+
const errMsg = getErrorMessage(error);
|
|
59
|
+
_toaster.danger(errMsg);
|
|
60
|
+
console.error(error);
|
|
61
|
+
});
|
|
56
62
|
return;
|
|
57
63
|
}
|
|
58
64
|
const chartDataSQL = new ChartDataSQL({
|
|
@@ -69,7 +75,11 @@ class StatisticRecordDialog extends React.Component {
|
|
|
69
75
|
results: rows
|
|
70
76
|
} = res.data;
|
|
71
77
|
this.processDrilledRows(rows);
|
|
72
|
-
}).catch(error =>
|
|
78
|
+
}).catch(error => {
|
|
79
|
+
const errMsg = getErrorMessage(error);
|
|
80
|
+
_toaster.danger(errMsg);
|
|
81
|
+
console.error(error);
|
|
82
|
+
});
|
|
73
83
|
return;
|
|
74
84
|
}
|
|
75
85
|
this.processDrilledRows(rows);
|
package/dist/constants/index.js
CHANGED
|
@@ -297,6 +297,6 @@ export const groupAxisMap = {
|
|
|
297
297
|
[CHART_TYPE.LINE_GROUP]: 'column_groupby_column_key',
|
|
298
298
|
[CHART_TYPE.SCATTER]: 'column_groupby_column_key',
|
|
299
299
|
[CHART_TYPE.MIRROR]: 'group_column_key',
|
|
300
|
-
[CHART_TYPE.TABLE]: '
|
|
300
|
+
[CHART_TYPE.TABLE]: 'column_groupby_column_key'
|
|
301
301
|
};
|
|
302
302
|
export { GEOLOCATION_FORMAT_CITY, GEOLOCATION_FORMAT_MAP, CHART_KEY, GENERIC_KEY, GENERIC_KEY_2_SIMILAR_KEYS, STYLE_COLORS, HORIZONTAL_ALIGN, HORIZONTAL_ALIGNS, HORIZONTAL_ALIGN_SHOW, CHART_TYPE, CHART_TYPE_SHOW, CHART_TYPES, CHART_TYPE_IMAGE, GEOLOCATION_GRANULARITY, GEOLOCATION_GRANULARITY_LIST, MAP_LEVEL, MUNICIPALITIES, regions, TABLE_DIMENSIONS };
|
package/dist/locale/lang/de.js
CHANGED
|
@@ -227,10 +227,10 @@ const de = {
|
|
|
227
227
|
"Transpose": "Transpose",
|
|
228
228
|
"Comparison_mode": "Vergleichsmodus",
|
|
229
229
|
"Yesterday_vs_the_day_before_yesterday": "Gestern vs. vorgestern",
|
|
230
|
-
"Last_week_vs_the_week_before_last": "Letzte Woche vs.
|
|
231
|
-
"Last_month_vs_the_month_before_last": "Letzter Monat vs.
|
|
232
|
-
"Last_quarter_vs_the_quarter_before_last": "Letztes Quartal vs.
|
|
233
|
-
"Last_year_vs_the_year_before_last": "Letztes Jahr vs.
|
|
230
|
+
"Last_week_vs_the_week_before_last": "Letzte Woche vs. Vorwoche",
|
|
231
|
+
"Last_month_vs_the_month_before_last": "Letzter Monat vs. Vormonat",
|
|
232
|
+
"Last_quarter_vs_the_quarter_before_last": "Letztes Quartal vs. Vorquartal",
|
|
233
|
+
"Last_year_vs_the_year_before_last": "Letztes Jahr vs. Vorjahr",
|
|
234
234
|
"Last_7_days_vs_previous_7_days": "Letzte 7 Tage vs. 7 Tage davor",
|
|
235
235
|
"Last_30_days_vs_previous_30_days": "Letzte 30 Tage vs. 30 Tage davor",
|
|
236
236
|
"The_year_before_last": "Das vorletzte Jahr",
|
|
@@ -249,6 +249,7 @@ const de = {
|
|
|
249
249
|
"Count_description": "Einträge basierend auf den Dateneinstellungen zählen",
|
|
250
250
|
"Display_empty_when_data_is_zero": "Wert 0 als leeren Wert anzeigen",
|
|
251
251
|
"Use_default_color": "Standardfarbe verwenden",
|
|
252
|
-
"Use_colors_in_single_select_solumn": "Verwenden Sie Farben in einer einzelnen Auswahlspalte"
|
|
252
|
+
"Use_colors_in_single_select_solumn": "Verwenden Sie Farben in einer einzelnen Auswahlspalte",
|
|
253
|
+
"Search_records": "Einträge suchen"
|
|
253
254
|
};
|
|
254
255
|
export default de;
|
package/dist/locale/lang/en.js
CHANGED
|
@@ -249,6 +249,7 @@ const en = {
|
|
|
249
249
|
"Count_description": "Count the number of records based on data settings",
|
|
250
250
|
"Display_empty_when_data_is_zero": "Display empty when data is zero",
|
|
251
251
|
"Use_default_color": "Use default color",
|
|
252
|
-
"Use_colors_in_single_select_solumn": "Use colors in single select column"
|
|
252
|
+
"Use_colors_in_single_select_solumn": "Use colors in single select column",
|
|
253
|
+
"Search_records": "Search records"
|
|
253
254
|
};
|
|
254
255
|
export default en;
|
package/dist/locale/lang/es.js
CHANGED
|
@@ -249,6 +249,7 @@ const es = {
|
|
|
249
249
|
"Count_description": "Count the number of records based on data settings",
|
|
250
250
|
"Display_empty_when_data_is_zero": "Display empty when data is zero",
|
|
251
251
|
"Use_default_color": "Use default color",
|
|
252
|
-
"Use_colors_in_single_select_solumn": "Use colors in single select column"
|
|
252
|
+
"Use_colors_in_single_select_solumn": "Use colors in single select column",
|
|
253
|
+
"Search_records": "Search records"
|
|
253
254
|
};
|
|
254
255
|
export default es;
|
package/dist/locale/lang/fr.js
CHANGED
|
@@ -229,8 +229,8 @@ const fr = {
|
|
|
229
229
|
"Yesterday_vs_the_day_before_yesterday": "Hier vs. avant-hier",
|
|
230
230
|
"Last_week_vs_the_week_before_last": "La semaine dernière vs. la semaine précédente",
|
|
231
231
|
"Last_month_vs_the_month_before_last": "Le mois dernier vs. le mois précédent",
|
|
232
|
-
"Last_quarter_vs_the_quarter_before_last": "
|
|
233
|
-
"Last_year_vs_the_year_before_last": "
|
|
232
|
+
"Last_quarter_vs_the_quarter_before_last": "Le dernier trimestre vs. le trimestre précédent",
|
|
233
|
+
"Last_year_vs_the_year_before_last": "La dernière année vs. l'année précédente",
|
|
234
234
|
"Last_7_days_vs_previous_7_days": "7 derniers jours vs. 7 jours précédents",
|
|
235
235
|
"Last_30_days_vs_previous_30_days": "30 derniers jours vs. 30 jours précédents",
|
|
236
236
|
"The_year_before_last": "L'année précédente",
|
|
@@ -249,6 +249,7 @@ const fr = {
|
|
|
249
249
|
"Count_description": "Compter les enregistrements basé sur les paramètres de données",
|
|
250
250
|
"Display_empty_when_data_is_zero": "Afficher la valeur 0 comme valeur vide",
|
|
251
251
|
"Use_default_color": "Utiliser la couleur par défaut",
|
|
252
|
-
"Use_colors_in_single_select_solumn": "Utiliser les couleurs dans une colonne de sélection unique"
|
|
252
|
+
"Use_colors_in_single_select_solumn": "Utiliser les couleurs dans une colonne de sélection unique",
|
|
253
|
+
"Search_records": "Rechercher des enregistrements"
|
|
253
254
|
};
|
|
254
255
|
export default fr;
|
package/dist/locale/lang/pt.js
CHANGED
|
@@ -249,6 +249,7 @@ const pt = {
|
|
|
249
249
|
"Count_description": "Count the number of records based on data settings",
|
|
250
250
|
"Display_empty_when_data_is_zero": "Display empty when data is zero",
|
|
251
251
|
"Use_default_color": "Use default color",
|
|
252
|
-
"Use_colors_in_single_select_solumn": "Use colors in single select column"
|
|
252
|
+
"Use_colors_in_single_select_solumn": "Use colors in single select column",
|
|
253
|
+
"Search_records": "Search records"
|
|
253
254
|
};
|
|
254
255
|
export default pt;
|
package/dist/locale/lang/ru.js
CHANGED
|
@@ -249,6 +249,7 @@ const ru = {
|
|
|
249
249
|
"Count_description": "Count the number of records based on data settings",
|
|
250
250
|
"Display_empty_when_data_is_zero": "Display empty when data is zero",
|
|
251
251
|
"Use_default_color": "Use default color",
|
|
252
|
-
"Use_colors_in_single_select_solumn": "Use colors in single select column"
|
|
252
|
+
"Use_colors_in_single_select_solumn": "Use colors in single select column",
|
|
253
|
+
"Search_records": "Search records"
|
|
253
254
|
};
|
|
254
255
|
export default ru;
|
|
@@ -249,6 +249,7 @@ const zh_CN = {
|
|
|
249
249
|
"Count_description": "根据数据设置计算记录数量",
|
|
250
250
|
"Display_empty_when_data_is_zero": "数据为零时留空",
|
|
251
251
|
"Use_default_color": "使用默认颜色",
|
|
252
|
-
"Use_colors_in_single_select_solumn": "使用列中的选项颜色"
|
|
252
|
+
"Use_colors_in_single_select_solumn": "使用列中的选项颜色",
|
|
253
|
+
"Search_records": "搜索记录"
|
|
253
254
|
};
|
|
254
255
|
export default zh_CN;
|
|
@@ -33,12 +33,13 @@ class StacksSettings extends Component {
|
|
|
33
33
|
currentSelectedOptions
|
|
34
34
|
} = this.state;
|
|
35
35
|
if (!Array.isArray(y_axises) || !y_axises[index]) return;
|
|
36
|
-
|
|
37
36
|
// batch delete current selected options when "deleteStackNumericColumn"
|
|
38
|
-
currentSelectedOptions
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
if (currentSelectedOptions) {
|
|
38
|
+
currentSelectedOptions.forEach(o => {
|
|
39
|
+
o[index] && this.removeCurrentSelectedOptions(o[index], index);
|
|
40
|
+
});
|
|
41
|
+
this.setCurrentSelectedOptions();
|
|
42
|
+
}
|
|
42
43
|
let updatedStacks = [...y_axises];
|
|
43
44
|
updatedStacks.splice(index, 1);
|
|
44
45
|
if (updatedStacks.length === 0) {
|
|
@@ -55,6 +56,7 @@ class StacksSettings extends Component {
|
|
|
55
56
|
const {
|
|
56
57
|
currentSelectedOptions
|
|
57
58
|
} = this.state;
|
|
59
|
+
if (!currentSelectedOptions) return numericColumnsOptions;
|
|
58
60
|
return numericColumnsOptions.filter(option => {
|
|
59
61
|
const i = currentSelectedOptions.findIndex(o => {
|
|
60
62
|
return Object.values(o)[0] && Object.values(o)[0].key === option.column.key;
|
|
@@ -77,6 +79,7 @@ class StacksSettings extends Component {
|
|
|
77
79
|
} = updatedStack;
|
|
78
80
|
let updatedNumericColumns = column_groupby_numeric_columns ? [...column_groupby_numeric_columns] : [];
|
|
79
81
|
const availableOptions = this.getAvailableNumericColumns();
|
|
82
|
+
if (!availableOptions.length) return;
|
|
80
83
|
const newNumericColumnKey = availableOptions[0].value;
|
|
81
84
|
updatedNumericColumns.push({
|
|
82
85
|
column_key: newNumericColumnKey,
|
|
@@ -99,7 +102,11 @@ class StacksSettings extends Component {
|
|
|
99
102
|
const {
|
|
100
103
|
y_axises
|
|
101
104
|
} = chart.config;
|
|
102
|
-
if (
|
|
105
|
+
if (!prevColumnOption) {
|
|
106
|
+
this.addCurrentSelectedOptions(columnOption.column, currentAxisesIndex);
|
|
107
|
+
this.setCurrentSelectedOptions();
|
|
108
|
+
}
|
|
109
|
+
if (columnOption !== prevColumnOption && prevColumnOption) {
|
|
103
110
|
// do not need to use "currentAxisesIndex" when delete cause every option is unique , "currentAxisesIndex" was used to batch delete "column_groupby_numeric_columns"
|
|
104
111
|
// need "currentAxisesIndex" to identical the stack index
|
|
105
112
|
this.removeCurrentSelectedOptions(prevColumnOption.column, currentAxisesIndex);
|
|
@@ -167,9 +174,10 @@ class StacksSettings extends Component {
|
|
|
167
174
|
});
|
|
168
175
|
};
|
|
169
176
|
this.addCurrentSelectedOptions = (column, currentAxisesIndex) => {
|
|
170
|
-
|
|
177
|
+
let {
|
|
171
178
|
currentSelectedOptions
|
|
172
179
|
} = this.state;
|
|
180
|
+
if (!currentSelectedOptions) currentSelectedOptions = [];
|
|
173
181
|
const newValue = this.newValue || [...currentSelectedOptions];
|
|
174
182
|
newValue.push({
|
|
175
183
|
[currentAxisesIndex]: column
|
|
@@ -104,7 +104,7 @@ class NumericSummaryItem extends Component {
|
|
|
104
104
|
if (currentSelectedOptions) {
|
|
105
105
|
[selectedColumnOption, availableOptions] = this.getAvailableOptions();
|
|
106
106
|
} else {
|
|
107
|
-
selectedColumnOption = numericColumnOptions.find(option => option.value.key === column_key);
|
|
107
|
+
selectedColumnOption = numericColumnOptions.find(option => option.value.key === column_key || option.value === column_key);
|
|
108
108
|
availableOptions = numericColumnOptions;
|
|
109
109
|
}
|
|
110
110
|
const selectedSummaryMethodOption = this.summaryMethodOptions.find(option => option.value === summary_method);
|
|
@@ -402,6 +402,10 @@ class YAxisGroupSettings extends Component {
|
|
|
402
402
|
column_groupby_date_granularity,
|
|
403
403
|
column_groupby_geolocation_granularity
|
|
404
404
|
} = chart.config;
|
|
405
|
+
|
|
406
|
+
// if user do not select Single Numeric Column, then do not use it as the first config of multiple numeric column
|
|
407
|
+
const hasSingleNumericColumnConfig = !!(y_axis_summary_column_key && y_axis_summary_method);
|
|
408
|
+
const hasMultipleNumericColumnsConfig = column_groupby_multiple_numeric_column;
|
|
405
409
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormGroup, {
|
|
406
410
|
className: "sea-chart-parameter-item"
|
|
407
411
|
}, /*#__PURE__*/React.createElement(Label, null, label), /*#__PURE__*/React.createElement(_DTableSelect, {
|
|
@@ -410,7 +414,9 @@ class YAxisGroupSettings extends Component {
|
|
|
410
414
|
value: selectedTypeOption,
|
|
411
415
|
onChange: this.onGroupTypeChange,
|
|
412
416
|
options: this.groupTypeOptions
|
|
413
|
-
})),
|
|
417
|
+
})),
|
|
418
|
+
// multiple but has single selected numeric column as the first config item
|
|
419
|
+
hasMultipleNumericColumnsConfig && (hasSingleNumericColumnConfig ? /*#__PURE__*/React.createElement(NumericSummaryItem, {
|
|
414
420
|
index: 0,
|
|
415
421
|
value: {
|
|
416
422
|
column_key: y_axis_summary_column_key,
|
|
@@ -420,7 +426,9 @@ class YAxisGroupSettings extends Component {
|
|
|
420
426
|
numericColumnOptions: this.numericColumnOptions,
|
|
421
427
|
onColumnOptionChange: this.onGroupbyNumericColumnChange,
|
|
422
428
|
onSummaryMethodChange: this.onSummaryMethodChange
|
|
423
|
-
}) :
|
|
429
|
+
}) : null),
|
|
430
|
+
// single selected numeric columns
|
|
431
|
+
!hasMultipleNumericColumnsConfig && hasSingleNumericColumnConfig && /*#__PURE__*/React.createElement(SummaryMethodSettings, {
|
|
424
432
|
value: {
|
|
425
433
|
column_key: y_axis_summary_column_key,
|
|
426
434
|
summary_method: y_axis_summary_method
|
|
@@ -429,7 +437,7 @@ class YAxisGroupSettings extends Component {
|
|
|
429
437
|
numericColumnOptions: this.numericColumnOptions,
|
|
430
438
|
onColumnOptionChange: option => this.onGroupbyNumericColumnChange(option, 0),
|
|
431
439
|
onSummaryMethodChange: option => this.onSummaryMethodChange(option, 0)
|
|
432
|
-
})
|
|
440
|
+
}), this.renderColumnGroupbyMultipleNumericColumn(), (!column_groupby_multiple_numeric_column && y_axis_summary_type === CHART_SUMMARY_TYPE.ADVANCED || y_axis_summary_type === CHART_SUMMARY_TYPE.COUNT) && !this.isMapChart && /*#__PURE__*/React.createElement(Groupby, {
|
|
433
441
|
label: intl.get('Group_by'),
|
|
434
442
|
tables: tables,
|
|
435
443
|
selectedTableId: table_id,
|
|
@@ -240,7 +240,6 @@ async function calculateTwoDimensionTable(chart, value, _ref2) {
|
|
|
240
240
|
return calculateOneDimensionTable(chart, value);
|
|
241
241
|
}
|
|
242
242
|
const isRowGroupbyColumnDataAsAnArray = isArrayCellValue(rowGroupbyColumn);
|
|
243
|
-
const summaryColumn = getTableColumnByKey(table, summary_column_key);
|
|
244
243
|
const statRows = await getViewRows(view, table);
|
|
245
244
|
const formulaRows = await getTableFormulaResults(table, statRows);
|
|
246
245
|
let pivot_columns = [];
|
|
@@ -281,6 +280,10 @@ async function calculateTwoDimensionTable(chart, value, _ref2) {
|
|
|
281
280
|
}
|
|
282
281
|
}
|
|
283
282
|
});
|
|
283
|
+
let summaryColumn = null;
|
|
284
|
+
if (summary_column_key) {
|
|
285
|
+
summaryColumn = getTableColumnByKey(table, summary_column_key);
|
|
286
|
+
}
|
|
284
287
|
let {
|
|
285
288
|
pivot_columns_total,
|
|
286
289
|
pivot_table_total
|
|
@@ -314,7 +317,7 @@ async function calculateTwoDimensionTable(chart, value, _ref2) {
|
|
|
314
317
|
pivot_table_total,
|
|
315
318
|
formulaRows,
|
|
316
319
|
dimensions: TABLE_DIMENSIONS.TWO,
|
|
317
|
-
summary_columns:
|
|
320
|
+
summary_columns: getAllSummaryColumns(summaryColumn, summary_columns, table),
|
|
318
321
|
isSingleNumericColumn: !summary_columns.length ? 'true' : 'false'
|
|
319
322
|
};
|
|
320
323
|
}
|
|
@@ -828,6 +831,20 @@ function getTotalByType(oldTotal, value) {
|
|
|
828
831
|
return newTotal;
|
|
829
832
|
}
|
|
830
833
|
|
|
834
|
+
// Get all non-empty summary columns
|
|
835
|
+
function getAllSummaryColumns(singleSummaryColumn, multipleSummaryColumns, table) {
|
|
836
|
+
const allSummaryColumns = [];
|
|
837
|
+
if (singleSummaryColumn) {
|
|
838
|
+
allSummaryColumns.push(singleSummaryColumn);
|
|
839
|
+
}
|
|
840
|
+
multipleSummaryColumns && multipleSummaryColumns.forEach(item => {
|
|
841
|
+
if (item === null || item === void 0 ? void 0 : item.column_key) {
|
|
842
|
+
allSummaryColumns.push(getTableColumnByKey(table, item.column_key));
|
|
843
|
+
}
|
|
844
|
+
});
|
|
845
|
+
return allSummaryColumns;
|
|
846
|
+
}
|
|
847
|
+
|
|
831
848
|
// index
|
|
832
849
|
function calculator(chart, value, _ref3) {
|
|
833
850
|
let {
|
|
@@ -163,7 +163,10 @@ SQLStatisticsUtils.formatedTableSqlRows = (chart, sqlRows, chartSQLMap, columnMa
|
|
|
163
163
|
if ((collaborators === null || collaborators === void 0 ? void 0 : collaborators.length) > 1) {
|
|
164
164
|
newSqlRows.splice(index, 1);
|
|
165
165
|
collaborators.forEach(collaborator => {
|
|
166
|
-
const rowIndex = newSqlRows.findIndex(rows =>
|
|
166
|
+
const rowIndex = newSqlRows.findIndex(rows => {
|
|
167
|
+
var _rows$sqlGroupbyColum2;
|
|
168
|
+
return ((_rows$sqlGroupbyColum2 = rows[sqlGroupbyColumnKey]) === null || _rows$sqlGroupbyColum2 === void 0 ? void 0 : _rows$sqlGroupbyColum2[0]) === collaborator;
|
|
169
|
+
});
|
|
167
170
|
if (rowIndex !== -1) {
|
|
168
171
|
summarySQLColumnName2ColumnKeys.forEach(key => {
|
|
169
172
|
let newKey = key;
|
package/dist/utils/index.js
CHANGED
|
@@ -37,6 +37,8 @@ export function getMapCanvasStyle(container, ratio) {
|
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
export const getErrorMessage = err => {
|
|
40
|
+
// log error to locate problems
|
|
41
|
+
console.error(err);
|
|
40
42
|
if (!err.response) {
|
|
41
43
|
return intl.get('Network_error');
|
|
42
44
|
}
|
|
@@ -50,8 +52,6 @@ export const getErrorMessage = err => {
|
|
|
50
52
|
if (status === 500 || status === 502) {
|
|
51
53
|
return intl.get('Internal_server_error');
|
|
52
54
|
}
|
|
53
|
-
// log error to locate problems
|
|
54
|
-
console.error(err);
|
|
55
55
|
return intl.get('Error');
|
|
56
56
|
};
|
|
57
57
|
export const getGeoGranularityByLevel = mapLevel => {
|
|
@@ -3,6 +3,7 @@ import _RateFormatter from "dtable-ui-component/lib/RateFormatter";
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { CellType, FORMULA_RESULT_TYPE, getNumberDisplayString, getDateDisplayString, getCellValueStringResult, isNumber, isDateColumn, isValidLink } from 'dtable-utils';
|
|
5
5
|
import dayjs from 'dayjs';
|
|
6
|
+
import { isEqual } from 'lodash-es';
|
|
6
7
|
import cellFormatterFactory from '../components/cell-factory/cell-formatter-factory';
|
|
7
8
|
import SimpleCellFormatter from '../components/cell-factory/SimpleCellFormatter';
|
|
8
9
|
import SingleSelectOption from '../components/cell-factory/SingleSelectOption';
|
|
@@ -517,7 +518,8 @@ export const getFilterConditions = function (statisticRecord, chart) {
|
|
|
517
518
|
let columns = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
518
519
|
const {
|
|
519
520
|
name = '',
|
|
520
|
-
group_name = ''
|
|
521
|
+
group_name = '',
|
|
522
|
+
rows
|
|
521
523
|
} = statisticRecord || {};
|
|
522
524
|
const {
|
|
523
525
|
config
|
|
@@ -528,11 +530,34 @@ export const getFilterConditions = function (statisticRecord, chart) {
|
|
|
528
530
|
const filters = [];
|
|
529
531
|
const columnKey = xAxisMap[type];
|
|
530
532
|
const groupColumnKey = groupAxisMap[type];
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
533
|
+
if (!group_name && (rows === null || rows === void 0 ? void 0 : rows.length)) {
|
|
534
|
+
const xValueList = [];
|
|
535
|
+
const yValueList = [];
|
|
536
|
+
rows.forEach(r => {
|
|
537
|
+
const xValue = r[config[columnKey]];
|
|
538
|
+
const yValue = r[config[groupColumnKey]];
|
|
539
|
+
if (!xValueList.some(v => isEqual(v, xValue))) {
|
|
540
|
+
xValueList.push(xValue);
|
|
541
|
+
}
|
|
542
|
+
if (!yValueList.some(v => isEqual(v, yValue))) {
|
|
543
|
+
yValueList.push(yValue);
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
if (xValueList.length === 1) {
|
|
547
|
+
const columnFilter = getFilterByColumnType(config[columnKey], columns, xValueList[0]);
|
|
548
|
+
filters.push(columnFilter);
|
|
549
|
+
}
|
|
550
|
+
if (yValueList.length === 1) {
|
|
551
|
+
const columnFilter = getFilterByColumnType(config[groupColumnKey], columns, yValueList[0]);
|
|
552
|
+
filters.push(columnFilter);
|
|
553
|
+
}
|
|
554
|
+
} else {
|
|
555
|
+
const columnFilter = getFilterByColumnType(config[columnKey], columns, name);
|
|
556
|
+
filters.push(columnFilter);
|
|
557
|
+
if (config[groupColumnKey]) {
|
|
558
|
+
const groupColumnFilter = getFilterByColumnType(config[groupColumnKey], columns, group_name);
|
|
559
|
+
filters.push(groupColumnFilter);
|
|
560
|
+
}
|
|
536
561
|
}
|
|
537
562
|
return filters;
|
|
538
563
|
};
|
|
@@ -134,7 +134,7 @@ class TwoDimensionTable extends PureComponent {
|
|
|
134
134
|
if (summaryColumns && (summaryColumns === null || summaryColumns === void 0 ? void 0 : summaryColumns.length) !== 0) {
|
|
135
135
|
return summaryColumns.map(item => {
|
|
136
136
|
return /*#__PURE__*/React.createElement("div", {
|
|
137
|
-
key: "table-cell-".concat(item.key),
|
|
137
|
+
key: "table-cell-".concat(item === null || item === void 0 ? void 0 : item.key),
|
|
138
138
|
className: classnames('pivot-cell', {
|
|
139
139
|
'pivot-empty-cell': true
|
|
140
140
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sea-chart",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.89",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@antv/data-set": "0.11.8",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"react-dom": "^17.0.0"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
|
-
"clean": "
|
|
32
|
+
"clean": "rimraf dist && mkdirp dist",
|
|
33
33
|
"start.bak": "node scripts/start.js",
|
|
34
34
|
"build": "node scripts/build.js",
|
|
35
35
|
"pub:dist": "cross-env BABEL_ENV=production ./node_modules/.bin/babel src --out-dir dist --copy-files",
|
|
36
36
|
"eslint": "eslint --ext .jsx,.js src --max-warnings=0",
|
|
37
37
|
"lint": "lint-staged",
|
|
38
|
-
"pub:optimized": "
|
|
38
|
+
"pub:optimized": "rimraf dist/config.js",
|
|
39
39
|
"prepare": "husky install",
|
|
40
40
|
"prepublishOnly": "npm run clean && npm run pub:dist",
|
|
41
41
|
"release": "release-it",
|
|
@@ -122,6 +122,7 @@
|
|
|
122
122
|
"koa2-cors": "2.0.6",
|
|
123
123
|
"lint-staged": "14.0.0",
|
|
124
124
|
"mini-css-extract-plugin": "^1.3.5",
|
|
125
|
+
"mkdirp": "^3.0.1",
|
|
125
126
|
"nodemon": "^3.1.0",
|
|
126
127
|
"object-assign": "4.1.1",
|
|
127
128
|
"pnp-webpack-plugin": "1.5.0",
|
|
@@ -144,6 +145,7 @@
|
|
|
144
145
|
"release-it": "16.2.1",
|
|
145
146
|
"resolve": "1.12.0",
|
|
146
147
|
"resolve-url-loader": "5.0.0",
|
|
148
|
+
"rimraf": "^5.0.7",
|
|
147
149
|
"sass-loader": "13.3.2",
|
|
148
150
|
"style-loader": "^1.0.1",
|
|
149
151
|
"terser-webpack-plugin": "4.2.3",
|