sea-chart 1.1.65 → 1.1.67
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/settings/advance-bar-settings/style-settings.js +1 -1
- package/dist/settings/pie-settings/style-settings.js +1 -1
- package/dist/utils/chart-utils/base-utils.js +98 -75
- package/dist/utils/chart-utils/sql-statistics-utils.js +15 -15
- package/dist/view/wrapper/area.js +1 -1
- package/dist/view/wrapper/bar-group.js +2 -2
- package/dist/view/wrapper/horizontal-bar-group.js +1 -1
- package/dist/view/wrapper/line-group.js +1 -1
- package/dist/view/wrapper/pie.js +0 -1
- package/dist/view/wrapper/table-element/index.js +16 -21
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import _DTableRadioGroup from "dtable-ui-component/lib/DTableRadioGroup";
|
|
|
3
3
|
import _DTableSwitch from "dtable-ui-component/lib/DTableSwitch";
|
|
4
4
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
5
5
|
import { Label, Input, Row } from 'reactstrap';
|
|
6
|
-
import { CellType } from 'dtable-
|
|
6
|
+
import { CellType } from 'dtable-utils';
|
|
7
7
|
import Divider from '../widgets/divider';
|
|
8
8
|
import MinMaxSetting from '../widgets/min-max-setting';
|
|
9
9
|
import DisplayValuesSettings from '../widgets/display-values-settings';
|
|
@@ -3,7 +3,7 @@ import _DTableSelect from "dtable-ui-component/lib/DTableSelect";
|
|
|
3
3
|
import _DTableSwitch from "dtable-ui-component/lib/DTableSwitch";
|
|
4
4
|
import React, { useCallback, useMemo } from 'react';
|
|
5
5
|
import { Label, FormGroup } from 'reactstrap';
|
|
6
|
-
import { CellType } from 'dtable-
|
|
6
|
+
import { CellType } from 'dtable-utils';
|
|
7
7
|
import Divider from '../widgets/divider';
|
|
8
8
|
import MiniNumSlicePercent from '../widgets/mininum-slice-percent';
|
|
9
9
|
import { FontSizeSettings } from '../widgets/font-settings';
|
|
@@ -667,91 +667,114 @@ BaseUtils.formatPieChartData = (data, chart, tables, currentTheme, useColumnColo
|
|
|
667
667
|
};
|
|
668
668
|
// table
|
|
669
669
|
// format SINGLE_SELECT, LAST_MODIFIER, CREATOR, COLLABORATOR, DATE, NUMBER
|
|
670
|
-
BaseUtils.updateTableViewListItemNameAndColor = (result, column, nameKey, colorKey, isScatterChart, isNameField) => {
|
|
671
|
-
|
|
672
|
-
type: columnType,
|
|
673
|
-
data: columnData
|
|
674
|
-
} = column;
|
|
675
|
-
let name = result[nameKey];
|
|
676
|
-
if (columnType === CellType.SINGLE_SELECT || columnType === CellType.MULTIPLE_SELECT) {
|
|
677
|
-
const options = getColumnOptions(column);
|
|
678
|
-
let selectedOption = getOption(options, name);
|
|
670
|
+
BaseUtils.updateTableViewListItemNameAndColor = async (result, column, nameKey, colorKey, isScatterChart, isNameField) => {
|
|
671
|
+
return new Promise((resolve, reject) => {
|
|
679
672
|
let {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
if (
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
result[nameKey] = name.join(', ');
|
|
699
|
-
return;
|
|
673
|
+
type: columnType,
|
|
674
|
+
data: columnData
|
|
675
|
+
} = column;
|
|
676
|
+
let name = result[nameKey];
|
|
677
|
+
if (columnType === CellType.SINGLE_SELECT || columnType === CellType.MULTIPLE_SELECT) {
|
|
678
|
+
const options = getColumnOptions(column);
|
|
679
|
+
let selectedOption = getOption(options, name);
|
|
680
|
+
let {
|
|
681
|
+
name: optionName,
|
|
682
|
+
color: optionColor,
|
|
683
|
+
id
|
|
684
|
+
} = selectedOption || {};
|
|
685
|
+
if (selectedOption) {
|
|
686
|
+
result[nameKey] = optionName;
|
|
687
|
+
result[colorKey] = optionColor;
|
|
688
|
+
isNameField && (result.original_name = id);
|
|
689
|
+
} else {
|
|
690
|
+
result[colorKey] = '#dbdbdb';
|
|
700
691
|
}
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
692
|
+
} else if (columnType === CellType.COLLABORATOR) {
|
|
693
|
+
const users = context.getCollaboratorsFromCache();
|
|
694
|
+
const user = users.find(user => user.email === name);
|
|
695
|
+
if (user) {
|
|
696
|
+
result[nameKey] = (user === null || user === void 0 ? void 0 : user.name) || name;
|
|
697
|
+
isNameField && (result.original_name = name);
|
|
698
|
+
resolve();
|
|
699
|
+
} else {
|
|
700
|
+
context.queryUsers([name], users => {
|
|
701
|
+
const userEmail = name;
|
|
702
|
+
const user = users[userEmail] || generateDefaultUser(userEmail);
|
|
703
|
+
const userName = user.name || userEmail;
|
|
704
|
+
result[nameKey] = userName;
|
|
705
|
+
isNameField && (result.original_name = userEmail);
|
|
706
|
+
user.loaded = true;
|
|
707
|
+
context.updateCollaboratorsCache(userEmail, user);
|
|
708
|
+
resolve();
|
|
709
|
+
});
|
|
714
710
|
}
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
711
|
+
return;
|
|
712
|
+
} else if (columnType === CellType.CREATOR || columnType === CellType.LAST_MODIFIER) {
|
|
713
|
+
const users = context.getCollaboratorsFromCache();
|
|
714
|
+
const user = users.find(user => user.email === name);
|
|
715
|
+
if (user) {
|
|
716
|
+
result[nameKey] = (user === null || user === void 0 ? void 0 : user.name) || name;
|
|
717
|
+
isNameField && (result.original_name = name);
|
|
718
|
+
resolve();
|
|
719
|
+
} else {
|
|
720
|
+
context.queryUsers([name], users => {
|
|
721
|
+
const userEmail = name;
|
|
722
|
+
const user = users[userEmail] || generateDefaultUser(userEmail);
|
|
723
|
+
const userName = user.name || userEmail;
|
|
724
|
+
result[nameKey] = userName;
|
|
725
|
+
isNameField && (result.original_name = userEmail);
|
|
726
|
+
user.loaded = true;
|
|
727
|
+
context.updateCollaboratorsCache(userEmail, user);
|
|
728
|
+
resolve();
|
|
729
|
+
});
|
|
729
730
|
}
|
|
730
|
-
|
|
731
|
-
}
|
|
732
|
-
} else if (columnType === CellType.LINK_FORMULA) {
|
|
733
|
-
// scatter only use number
|
|
734
|
-
if (isScatterChart) {
|
|
735
|
-
name.length && (name = name[0]);
|
|
731
|
+
return;
|
|
732
|
+
} else if (columnType === CellType.NUMBER) {
|
|
736
733
|
let valueNumber = parseFloat(name);
|
|
737
734
|
result[nameKey] = isNumber(valueNumber) ? getNumberDisplayString(valueNumber, columnData) : name;
|
|
735
|
+
isNameField && (result.original_name = name);
|
|
736
|
+
} else if (columnType === CellType.DATE) {
|
|
737
|
+
name = name + '';
|
|
738
|
+
if (name && name.split('-').length === 3) {
|
|
739
|
+
let format = getDateColumnFormat(column);
|
|
740
|
+
let spaceIndex = format.indexOf(' ');
|
|
741
|
+
if (spaceIndex > -1) {
|
|
742
|
+
format = format.slice(0, spaceIndex);
|
|
743
|
+
}
|
|
744
|
+
result[nameKey] = dayjs(name).format(format);
|
|
745
|
+
}
|
|
746
|
+
} else if (columnType === CellType.LINK_FORMULA) {
|
|
747
|
+
// scatter only use number
|
|
748
|
+
if (isScatterChart) {
|
|
749
|
+
name.length && (name = name[0]);
|
|
750
|
+
let valueNumber = parseFloat(name);
|
|
751
|
+
result[nameKey] = isNumber(valueNumber) ? getNumberDisplayString(valueNumber, columnData) : name;
|
|
752
|
+
}
|
|
753
|
+
const {
|
|
754
|
+
array_data,
|
|
755
|
+
array_type
|
|
756
|
+
} = columnData;
|
|
757
|
+
const linkedColumn = {
|
|
758
|
+
...column,
|
|
759
|
+
type: array_type,
|
|
760
|
+
data: array_data
|
|
761
|
+
};
|
|
762
|
+
return _BaseUtils.updateTableViewListItemNameAndColor(result, linkedColumn, nameKey, colorKey, isScatterChart);
|
|
738
763
|
}
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
array_type
|
|
742
|
-
} = columnData;
|
|
743
|
-
const linkedColumn = {
|
|
744
|
-
...column,
|
|
745
|
-
type: array_type,
|
|
746
|
-
data: array_data
|
|
747
|
-
};
|
|
748
|
-
return _BaseUtils.updateTableViewListItemNameAndColor(result, linkedColumn, nameKey, colorKey, isScatterChart);
|
|
749
|
-
}
|
|
764
|
+
resolve();
|
|
765
|
+
});
|
|
750
766
|
};
|
|
751
|
-
BaseUtils.updateTableViewList = (result, column, nameKey, colorKey, isScatterChart, isNameField) => {
|
|
767
|
+
BaseUtils.updateTableViewList = async (result, column, nameKey, colorKey, isScatterChart, isNameField) => {
|
|
768
|
+
const promises = [];
|
|
752
769
|
result.forEach(result => {
|
|
753
|
-
_BaseUtils.updateTableViewListItemNameAndColor(result, column, nameKey, colorKey, isScatterChart, isNameField);
|
|
770
|
+
const promise = _BaseUtils.updateTableViewListItemNameAndColor(result, column, nameKey, colorKey, isScatterChart, isNameField);
|
|
771
|
+
promises.push(promise);
|
|
754
772
|
});
|
|
773
|
+
try {
|
|
774
|
+
await Promise.all(promises);
|
|
775
|
+
} catch (e) {
|
|
776
|
+
console.error(e);
|
|
777
|
+
}
|
|
755
778
|
};
|
|
756
779
|
// sort chart
|
|
757
780
|
BaseUtils.sortCharts = (charts, column, sortKey, isPivot) => {
|
|
@@ -724,7 +724,7 @@ SQLStatisticsUtils.basicChartSQLResult2JavaScript = async (chart, sqlRows, chart
|
|
|
724
724
|
}
|
|
725
725
|
}
|
|
726
726
|
BaseUtils.sortCharts(result, groupbyColumn, 'name');
|
|
727
|
-
BaseUtils.updateTableViewList(result, groupbyColumn, 'name', 'color', false, true);
|
|
727
|
+
await BaseUtils.updateTableViewList(result, groupbyColumn, 'name', 'color', false, true);
|
|
728
728
|
BaseUtils.updateSummaryValuePrecision(result, summaryColumn, 'value');
|
|
729
729
|
if (SUPPORT_DATA_SORT_CHART_TYPES.includes(type) && sort_type) {
|
|
730
730
|
BaseUtils.sortChartData(result, sort_type);
|
|
@@ -846,7 +846,7 @@ SQLStatisticsUtils.customChartSQLResult2JavaScript = async (chart, sqlRows, char
|
|
|
846
846
|
result = assembled;
|
|
847
847
|
}
|
|
848
848
|
BaseUtils.sortCharts(result, groupbyColumn, 'name');
|
|
849
|
-
BaseUtils.updateTableViewList(result, groupbyColumn, 'name', '', false, true);
|
|
849
|
+
await BaseUtils.updateTableViewList(result, groupbyColumn, 'name', '', false, true);
|
|
850
850
|
BaseUtils.updateSummaryValuePrecision(result, summaryColumn, 'value');
|
|
851
851
|
return result;
|
|
852
852
|
};
|
|
@@ -1182,7 +1182,7 @@ SQLStatisticsUtils.combinationSQLResult2Javascript = async (chart, sqlRows, char
|
|
|
1182
1182
|
}
|
|
1183
1183
|
}
|
|
1184
1184
|
}
|
|
1185
|
-
BaseUtils.updateTableViewList(result, groupbyColumn, 'name', '', false, true);
|
|
1185
|
+
await BaseUtils.updateTableViewList(result, groupbyColumn, 'name', '', false, true);
|
|
1186
1186
|
BaseUtils.sortCharts(result, groupbyColumn, 'name');
|
|
1187
1187
|
BaseUtils.updateSummaryValuePrecision(result, summaryColumnLeft, 'value_left');
|
|
1188
1188
|
BaseUtils.updateSummaryValuePrecision(result, summaryColumnRight, 'value_right');
|
|
@@ -1289,8 +1289,8 @@ SQLStatisticsUtils.groupingTwoDimensionChartSQLResult2JavaScript = async (chart,
|
|
|
1289
1289
|
}
|
|
1290
1290
|
}
|
|
1291
1291
|
BaseUtils.sortCharts(result, groupbyColumn, 'name');
|
|
1292
|
-
BaseUtils.updateTableViewList(result, groupbyColumn, 'name', 'color', false, true);
|
|
1293
|
-
BaseUtils.updateTableViewList(result, columnGroupbyColumn, 'group_name', 'group_color', false, false);
|
|
1292
|
+
await BaseUtils.updateTableViewList(result, groupbyColumn, 'name', 'color', false, true);
|
|
1293
|
+
await BaseUtils.updateTableViewList(result, columnGroupbyColumn, 'group_name', 'group_color', false, false);
|
|
1294
1294
|
BaseUtils.updateSummaryValuePrecision(result, summaryColumn, 'value');
|
|
1295
1295
|
return result;
|
|
1296
1296
|
};
|
|
@@ -1348,7 +1348,7 @@ SQLStatisticsUtils.groupingChartSQLResult2JavaScript = async (chart, sqlRows, ch
|
|
|
1348
1348
|
}
|
|
1349
1349
|
}
|
|
1350
1350
|
BaseUtils.sortCharts(result, groupbyColumn, 'name');
|
|
1351
|
-
BaseUtils.updateTableViewList(result, groupbyColumn, 'name', 'color', false, true);
|
|
1351
|
+
await BaseUtils.updateTableViewList(result, groupbyColumn, 'name', 'color', false, true);
|
|
1352
1352
|
const allSummaryColumns = [summaryColumn].concat(summaryColumnsWithMethod.map(item => item.column));
|
|
1353
1353
|
|
|
1354
1354
|
// format precision of enabled precision columns
|
|
@@ -1618,7 +1618,7 @@ SQLStatisticsUtils.sqlResult2JavaScript = async (chart, sqlRows, chartSQLMap, co
|
|
|
1618
1618
|
case CHART_TYPE.COMPLETENESS:
|
|
1619
1619
|
case CHART_TYPE.COMPLETENESS_GROUP:
|
|
1620
1620
|
{
|
|
1621
|
-
const result = _SQLStatisticsUtils.completenessSQlResult(chart, sqlRows, chartSQLMap, tables);
|
|
1621
|
+
const result = await _SQLStatisticsUtils.completenessSQlResult(chart, sqlRows, chartSQLMap, tables);
|
|
1622
1622
|
return {
|
|
1623
1623
|
result
|
|
1624
1624
|
};
|
|
@@ -1649,7 +1649,7 @@ SQLStatisticsUtils.sqlResult2JavaScript = async (chart, sqlRows, chartSQLMap, co
|
|
|
1649
1649
|
case CHART_TYPE.SCATTER:
|
|
1650
1650
|
{
|
|
1651
1651
|
return {
|
|
1652
|
-
result: _SQLStatisticsUtils.scatterSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1652
|
+
result: await _SQLStatisticsUtils.scatterSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1653
1653
|
};
|
|
1654
1654
|
}
|
|
1655
1655
|
case CHART_TYPE.BAR_CUSTOM:
|
|
@@ -1703,7 +1703,7 @@ SQLStatisticsUtils._get_completeness_name = (row, column) => {
|
|
|
1703
1703
|
}
|
|
1704
1704
|
return value;
|
|
1705
1705
|
};
|
|
1706
|
-
SQLStatisticsUtils.completenessSQlResult = (chart, sqlRows, chartSQLMap, tables) => {
|
|
1706
|
+
SQLStatisticsUtils.completenessSQlResult = async (chart, sqlRows, chartSQLMap, tables) => {
|
|
1707
1707
|
const {
|
|
1708
1708
|
config: {
|
|
1709
1709
|
type
|
|
@@ -1833,8 +1833,8 @@ SQLStatisticsUtils.completenessSQlResult = (chart, sqlRows, chartSQLMap, tables)
|
|
|
1833
1833
|
}
|
|
1834
1834
|
|
|
1835
1835
|
// format the fetched value
|
|
1836
|
-
BaseUtils.updateTableViewList(sqlRows, name_column, name_column.key, 'color', false, true);
|
|
1837
|
-
if (sqlColumnGroupByColumnKey) BaseUtils.updateTableViewList(sqlRows, column_groupby_column, sqlColumnGroupByColumnKey, 'color', false, false);
|
|
1836
|
+
await BaseUtils.updateTableViewList(sqlRows, name_column, name_column.key, 'color', false, true);
|
|
1837
|
+
if (sqlColumnGroupByColumnKey) await BaseUtils.updateTableViewList(sqlRows, column_groupby_column, sqlColumnGroupByColumnKey, 'color', false, false);
|
|
1838
1838
|
summedSqlRows.forEach(row => {
|
|
1839
1839
|
const nameValue = row[name_column.key];
|
|
1840
1840
|
let targetValue;
|
|
@@ -1888,7 +1888,7 @@ SQLStatisticsUtils.completenessSQlResult = (chart, sqlRows, chartSQLMap, tables)
|
|
|
1888
1888
|
});
|
|
1889
1889
|
return res;
|
|
1890
1890
|
};
|
|
1891
|
-
SQLStatisticsUtils.scatterSQLResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMap, tables) => {
|
|
1891
|
+
SQLStatisticsUtils.scatterSQLResult2JavaScript = async (chart, sqlRows, chartSQLMap, columnMap, tables) => {
|
|
1892
1892
|
const {
|
|
1893
1893
|
sqlXColumnKey,
|
|
1894
1894
|
sqlYColumnKey,
|
|
@@ -1902,9 +1902,9 @@ SQLStatisticsUtils.scatterSQLResult2JavaScript = (chart, sqlRows, chartSQLMap, c
|
|
|
1902
1902
|
// format sql rows
|
|
1903
1903
|
const originalSqlRows = cloneDeep(sqlRows);
|
|
1904
1904
|
const isScatter = true;
|
|
1905
|
-
BaseUtils.updateTableViewList(sqlRows, groupbyColumn, groupbyColumn.key, 'color', isScatter, true);
|
|
1906
|
-
BaseUtils.updateTableViewList(sqlRows, summaryColumn, summaryColumn.key, 'color', isScatter, true);
|
|
1907
|
-
if (sqlColumnGroupbyColumnKey) BaseUtils.updateTableViewList(sqlRows, columnGroupbyColumn, sqlColumnGroupbyColumnKey, 'color', isScatter, false);
|
|
1905
|
+
await BaseUtils.updateTableViewList(sqlRows, groupbyColumn, groupbyColumn.key, 'color', isScatter, true);
|
|
1906
|
+
await BaseUtils.updateTableViewList(sqlRows, summaryColumn, summaryColumn.key, 'color', isScatter, true);
|
|
1907
|
+
if (sqlColumnGroupbyColumnKey) await BaseUtils.updateTableViewList(sqlRows, columnGroupbyColumn, sqlColumnGroupbyColumnKey, 'color', isScatter, false);
|
|
1908
1908
|
const res = [];
|
|
1909
1909
|
sqlRows.forEach((row, index) => {
|
|
1910
1910
|
const xValue = row[sqlXColumnKey] ? '' + row[sqlXColumnKey] : intl.get('Empty');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import { CellType } from 'dtable-
|
|
4
|
+
import { CellType } from 'dtable-utils';
|
|
5
5
|
import { CHART_LINE_TYPES, CHART_STYLE_COLORS, CHART_THEME_COLOR, CHART_TYPE, EMPTY_NAME, TYPE_COLOR_USING } from '../../constants';
|
|
6
6
|
import intl from '../../intl';
|
|
7
7
|
import { BaseUtils, isFunction } from '../../utils';
|
|
@@ -4,7 +4,7 @@ import DataSet from '@antv/data-set';
|
|
|
4
4
|
import { getNumberDisplayString } from 'dtable-utils';
|
|
5
5
|
import { debounce, maxBy } from 'lodash-es';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
-
import { CellType } from 'dtable-
|
|
7
|
+
import { CellType } from 'dtable-utils';
|
|
8
8
|
import intl from '../../intl';
|
|
9
9
|
import { sortDataByGroupSum } from '../../utils/column-utils';
|
|
10
10
|
import { EMPTY_NAME, CHART_TYPE, CHART_SUMMARY_TYPE, DEFAULT_NUMBER_FORMAT_OBJECT, CHART_THEME_COLOR, CHART_STYLE_COLORS } from '../../constants';
|
|
@@ -96,7 +96,7 @@ class BarGroup extends ChartComponent {
|
|
|
96
96
|
const useSingleSelectColumnColor = (column_groupby_column === null || column_groupby_column === void 0 ? void 0 : column_groupby_column.type) === CellType.SINGLE_SELECT && color_theme === SUPPORT_SINGLE_SELECT_THEMES_OPTIONS.SINGLE_SELECT_COLUMN_COLORS;
|
|
97
97
|
let singleBarWidth, singleBarRadius;
|
|
98
98
|
// y-axis label width:6 + 10
|
|
99
|
-
const chartWidth = this.chart.width - 6 - 10; // 10 is y-axis number width and 6 is gap between number and y axis line
|
|
99
|
+
const chartWidth = this.chart.width - 6 - 10; // 10 is y-axis number width and 6 is gap between number and y axis line
|
|
100
100
|
if (!isGroup) {
|
|
101
101
|
singleBarWidth = Math.round(chartWidth / (2 * newData.length));
|
|
102
102
|
this.markFirstOrLast(data, 'first');
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { debounce, maxBy } from 'lodash-es';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
|
-
import { CellType } from 'dtable-
|
|
5
|
+
import { CellType } from 'dtable-utils';
|
|
6
6
|
import { CHART_TYPE, EMPTY_NAME, CHART_THEME_COLOR, CHART_STYLE_COLORS } from '../../constants';
|
|
7
7
|
import { BaseUtils, isFunction } from '../../utils';
|
|
8
8
|
import intl from '../../intl';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
|
-
import { CellType } from 'dtable-
|
|
4
|
+
import { CellType } from 'dtable-utils';
|
|
5
5
|
import { BaseUtils, isFunction } from '../../utils';
|
|
6
6
|
import intl from '../../intl';
|
|
7
7
|
import { CHART_LINE_TYPES, CHART_THEME_COLOR, EMPTY_NAME } from '../../constants';
|
package/dist/view/wrapper/pie.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { CellType } from 'dtable-ui-component/lib/constants';
|
|
4
3
|
import { CHART_LABEL_POSITIONS, CHART_LABEL_FORMATS, CHART_THEME_COLOR } from '../../constants';
|
|
5
4
|
import { BaseUtils, isFunction } from '../../utils';
|
|
6
5
|
import intl from '../../intl';
|
|
@@ -22,8 +22,9 @@ export default class TableElement extends React.Component {
|
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
24
|
this.queryUsers = emails => {
|
|
25
|
+
const currentEmails = context.getCollaboratorsFromCache().map(user => user.email);
|
|
25
26
|
let queryEmails = emails.filter(email => {
|
|
26
|
-
return !
|
|
27
|
+
return !currentEmails.includes(email);
|
|
27
28
|
});
|
|
28
29
|
if (queryEmails.length === 0) return;
|
|
29
30
|
if (this.isQuerying) {
|
|
@@ -31,32 +32,26 @@ export default class TableElement extends React.Component {
|
|
|
31
32
|
return;
|
|
32
33
|
}
|
|
33
34
|
this.isQuerying = true;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (this.pendingUserList.length === 0) {
|
|
38
|
-
this.isQuerying = false;
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
let queryEmails = [...new Set(this.pendingUserList)];
|
|
42
|
-
this.pendingUserList = [];
|
|
43
|
-
context.queryUsers(queryEmails, this.updateRelatedUser);
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
context.queryUsers(queryEmails, this.updateRelatedUser);
|
|
37
|
+
}, 500);
|
|
44
38
|
};
|
|
45
39
|
this.updateRelatedUser = emailUserMap => {
|
|
46
|
-
|
|
40
|
+
this.isQuerying = false;
|
|
41
|
+
const currentEmails = context.getCollaboratorsFromCache().map(user => user.email);
|
|
47
42
|
for (let email in emailUserMap) {
|
|
48
|
-
if (!
|
|
49
|
-
this.relatedUserEmailMap[email] = true;
|
|
43
|
+
if (!currentEmails.includes(email)) {
|
|
50
44
|
context.updateCollaboratorsCache(email, emailUserMap[email]);
|
|
51
|
-
newUsers.push(emailUserMap[email]);
|
|
52
45
|
}
|
|
53
46
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
this.
|
|
47
|
+
const newUsers = context.getCollaboratorsFromCache();
|
|
48
|
+
this.relatedUserEmailMap = {};
|
|
49
|
+
newUsers.forEach(u => {
|
|
50
|
+
this.relatedUserEmailMap[u.email] = true;
|
|
51
|
+
});
|
|
52
|
+
this.setState({
|
|
53
|
+
relatedUserList: newUsers
|
|
54
|
+
});
|
|
60
55
|
};
|
|
61
56
|
const {
|
|
62
57
|
chart,
|