sea-chart 0.0.76-alpha.1 → 0.0.76-alpha.3
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.
|
@@ -45,7 +45,7 @@ class StatisticRecordDialog extends React.Component {
|
|
|
45
45
|
var _context$api, _context$api2;
|
|
46
46
|
if ((_context$api = context.api) === null || _context$api === void 0 ? void 0 : _context$api.customQueryRows) {
|
|
47
47
|
const detailFilterConditions = {
|
|
48
|
-
filters: getFilterConditions(statisticRecord, chart, this.
|
|
48
|
+
filters: getFilterConditions(statisticRecord, chart, this.table.columns)
|
|
49
49
|
};
|
|
50
50
|
context.api.customQueryRows(detailFilterConditions).then(res => {
|
|
51
51
|
const {
|
package/dist/constants/index.js
CHANGED
|
@@ -285,4 +285,16 @@ export const xAxisMap = {
|
|
|
285
285
|
[CHART_TYPE.TREE_MAP]: 'groupby_column_key',
|
|
286
286
|
[CHART_TYPE.TREND]: 'date_column_key'
|
|
287
287
|
};
|
|
288
|
+
export const groupAxisMap = {
|
|
289
|
+
[CHART_TYPE.BAR_GROUP]: 'column_groupby_column_key',
|
|
290
|
+
[CHART_TYPE.BAR_STACK]: 'column_groupby_column_key',
|
|
291
|
+
[CHART_TYPE.AREA_GROUP]: 'column_groupby_column_key',
|
|
292
|
+
[CHART_TYPE.COMPLETENESS_GROUP]: 'column_groupby_column_key',
|
|
293
|
+
[CHART_TYPE.HORIZONTAL_GROUP_BAR]: 'column_groupby_column_key',
|
|
294
|
+
[CHART_TYPE.STACKED_HORIZONTAL_BAR]: 'column_groupby_column_key',
|
|
295
|
+
[CHART_TYPE.LINE_GROUP]: 'column_groupby_column_key',
|
|
296
|
+
[CHART_TYPE.SCATTER]: 'column_groupby_column_key',
|
|
297
|
+
[CHART_TYPE.MIRROR]: 'group_column_key',
|
|
298
|
+
[CHART_TYPE.TABLE]: 'groupby_column_key'
|
|
299
|
+
};
|
|
288
300
|
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 };
|
|
@@ -12,7 +12,7 @@ import Highlighter from '../components/highlighter/highlighter';
|
|
|
12
12
|
import DigitalSignUtils from '../utils/digital-sign-utils';
|
|
13
13
|
import { getColumnByKey } from '../utils/column-utils';
|
|
14
14
|
import context from '../context';
|
|
15
|
-
import { xAxisMap } from '../constants';
|
|
15
|
+
import { xAxisMap, groupAxisMap } from '../constants';
|
|
16
16
|
export const UNSHOW_COLUMN_TYPE = [CellType.LINK, CellType.LONG_TEXT, CellType.FORMULA, CellType.LINK_FORMULA];
|
|
17
17
|
export const getCellRecordWidth = column => {
|
|
18
18
|
let {
|
|
@@ -480,10 +480,24 @@ const createColumnFormatter = (columnType, formatterProps) => {
|
|
|
480
480
|
}
|
|
481
481
|
return /*#__PURE__*/React.createElement(SimpleCellFormatter, formatterProps);
|
|
482
482
|
};
|
|
483
|
+
const getFilterByColumnType = (columnKey, columns, value) => {
|
|
484
|
+
const filter = {
|
|
485
|
+
column_key: columnKey || ''
|
|
486
|
+
};
|
|
487
|
+
const column = getColumnByKey(columnKey, columns);
|
|
488
|
+
if (isDateColumn(column) || (column === null || column === void 0 ? void 0 : column.type) === CellType.GEOLOCATION) {
|
|
489
|
+
filter['value'] = value;
|
|
490
|
+
return filter;
|
|
491
|
+
}
|
|
492
|
+
filter['filter_predicate'] = 'is';
|
|
493
|
+
filter['filter_term'] = value;
|
|
494
|
+
return filter;
|
|
495
|
+
};
|
|
483
496
|
export const getFilterConditions = function (statisticRecord, chart) {
|
|
484
497
|
let columns = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
485
498
|
const {
|
|
486
|
-
name = ''
|
|
499
|
+
name = '',
|
|
500
|
+
group_name = ''
|
|
487
501
|
} = statisticRecord || {};
|
|
488
502
|
const {
|
|
489
503
|
config
|
|
@@ -491,19 +505,14 @@ export const getFilterConditions = function (statisticRecord, chart) {
|
|
|
491
505
|
const {
|
|
492
506
|
type
|
|
493
507
|
} = config;
|
|
494
|
-
const
|
|
508
|
+
const filters = [];
|
|
495
509
|
const columnKey = xAxisMap[type];
|
|
496
|
-
const
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
newFilters.push(filter);
|
|
503
|
-
return newFilters;
|
|
510
|
+
const groupColumnKey = groupAxisMap[type];
|
|
511
|
+
const columnFilter = getFilterByColumnType(config[columnKey], columns, name);
|
|
512
|
+
filters.push(columnFilter);
|
|
513
|
+
if (config[groupColumnKey]) {
|
|
514
|
+
const groupColumnFilter = getFilterByColumnType(config[groupColumnKey], columns, group_name);
|
|
515
|
+
filters.push(groupColumnFilter);
|
|
504
516
|
}
|
|
505
|
-
|
|
506
|
-
filter['filter_term'] = name;
|
|
507
|
-
newFilters.push(filter);
|
|
508
|
-
return newFilters;
|
|
517
|
+
return filters;
|
|
509
518
|
};
|