sea-chart 0.0.40-beta.0 → 0.0.40-beta.1
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/constants/common-constants.js +2 -12
- package/dist/context.js +0 -5
- package/dist/index.js +1 -3
- package/dist/locale/lang/en.js +6 -7
- package/dist/locale/lang/zh_CN.js +6 -7
- package/dist/utils/column-utils.js +1 -7
- package/dist/utils/common-utils.js +0 -193
- package/dist/utils/sql/chart-data-sql.js +0 -60
- package/dist/utils/sql/column-2-sql-column.js +0 -220
- package/dist/view/index.js +0 -1
- package/dist/view/wrapper/combination.js +0 -3
- package/dist/view/wrapper/dashboard.js +0 -3
- package/dist/view/wrapper/index.js +232 -251
- package/dist/view/wrapper/line.js +0 -3
- package/dist/view/wrapper/treemap.js +0 -3
- package/package.json +2 -2
- package/dist/assets/css/react-data-grid-header.css +0 -515
- package/dist/components/cell-factory/FormatterConfig.js +0 -55
- package/dist/components/cell-factory/SimpleCellFormatter.js +0 -32
- package/dist/components/cell-factory/SingleSelectOption.js +0 -53
- package/dist/components/cell-factory/cell-editor-factory.js +0 -12
- package/dist/components/cell-factory/cell-formatter-factory.js +0 -12
- package/dist/components/cell-factory/link-content.js +0 -121
- package/dist/components/draggable/Draggable.js +0 -77
- package/dist/components/dtable-search-input/index.js +0 -127
- package/dist/components/highlighter/highlighter.js +0 -25
- package/dist/components/resize-handle/ResizeHandle.js +0 -30
- package/dist/components/row-card/row-card-header-cell.js +0 -116
- package/dist/components/row-card/row-card-header.js +0 -135
- package/dist/components/row-card/row-card-item.js +0 -246
- package/dist/components/row-card/row-card.css +0 -323
- package/dist/components/row-card/row-card.js +0 -240
- package/dist/components/statistic-record-dialog/index.css +0 -120
- package/dist/components/statistic-record-dialog/index.js +0 -308
- package/dist/utils/digital-sign-utils.js +0 -22
- package/dist/utils/event-bus.js +0 -28
- package/dist/utils/row-record-utils.js +0 -479
- package/dist/utils/search.js +0 -66
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import { CellType } from 'dtable-utils';
|
|
2
1
|
export const CommonEventTypes = {
|
|
3
2
|
OPEN_SELECT: 'OPEN_SELECT',
|
|
4
3
|
EXPAND_ROW_UPDATED: 'EXPAND_ROW_UPDATED',
|
|
5
4
|
EXPAND_ROW_DELETED: 'EXPAND_ROW_DELETED',
|
|
6
|
-
REFRESH_CHARTS: 'REFRESH_CHARTS'
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
export const EXTERNAL_EVENT = {
|
|
10
|
-
SHOW_ROW_DETAIL_DIALOG: 'RowDetailDialog'
|
|
11
|
-
};
|
|
12
|
-
export const ROW_HEIGHT = 32;
|
|
13
|
-
export const DELETED_OPTION_BACKGROUND_COLOR = '#eaeaea';
|
|
14
|
-
export const DELETED_OPTION_TIPS = 'deleted_option';
|
|
15
|
-
export const LINK_NOT_SUPPORT_TYPES = [CellType.CHECKBOX, CellType.RATE, CellType.LONG_TEXT, CellType.IMAGE, CellType.FILE, CellType.COLLABORATOR, CellType.MULTIPLE_SELECT, CellType.GEOLOCATION, CellType.LINK_FORMULA, CellType.BUTTON, CellType.LINK, CellType.DIGITAL_SIGN];
|
|
16
|
-
export const NEED_FORMATTER = [CellType.CREATOR, CellType.LAST_MODIFIER, CellType.SINGLE_SELECT];
|
|
5
|
+
REFRESH_CHARTS: 'REFRESH_CHARTS'
|
|
6
|
+
};
|
package/dist/context.js
CHANGED
|
@@ -118,7 +118,6 @@ class Context {
|
|
|
118
118
|
const {
|
|
119
119
|
config,
|
|
120
120
|
api,
|
|
121
|
-
departments,
|
|
122
121
|
collaborators,
|
|
123
122
|
collaboratorManager
|
|
124
123
|
} = props;
|
|
@@ -135,7 +134,6 @@ class Context {
|
|
|
135
134
|
this.settings = config || {};
|
|
136
135
|
this.hasInit = true;
|
|
137
136
|
this.collaborators = collaborators || [];
|
|
138
|
-
this.departments = departments || [];
|
|
139
137
|
this.collaboratorManager = collaboratorManager ? collaboratorManager : new CollaboratorManager(collaborators);
|
|
140
138
|
}
|
|
141
139
|
setSettings() {
|
|
@@ -148,9 +146,6 @@ class Context {
|
|
|
148
146
|
getSetting(key) {
|
|
149
147
|
return this.settings[key] || this.settings[key] === false ? this.settings[key] : '';
|
|
150
148
|
}
|
|
151
|
-
getDepartments() {
|
|
152
|
-
return this.departments || [];
|
|
153
|
-
}
|
|
154
149
|
getCollaboratorFromCache(email) {
|
|
155
150
|
return this.collaboratorManager.getCollaboratorFromCache(email);
|
|
156
151
|
}
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,5 @@ import Editor from './editor';
|
|
|
6
6
|
import Settings, { StyleSettings, Divider } from './settings';
|
|
7
7
|
import { ChartDataSQL } from './utils';
|
|
8
8
|
import Context from './context';
|
|
9
|
-
import EventBus from './utils/event-bus';
|
|
10
|
-
import { EXTERNAL_EVENT } from './constants/common-constants';
|
|
11
9
|
export default View;
|
|
12
|
-
export { SeaChartAPI, CHART_TYPE, CHART_TYPES, View, Editor, Settings, StyleSettings, Divider, Context, ChartModel, ChartDataSQL
|
|
10
|
+
export { SeaChartAPI, CHART_TYPE, CHART_TYPES, View, Editor, Settings, StyleSettings, Divider, Context, ChartModel, ChartDataSQL };
|
package/dist/locale/lang/en.js
CHANGED
|
@@ -239,12 +239,11 @@ const en = {
|
|
|
239
239
|
"Can_not_compare_with_{var}": "Can not compare with {var}",
|
|
240
240
|
"Number_settings": "Number settings",
|
|
241
241
|
"Label_settings": "Label settings",
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
"Search_records": "Search records"
|
|
242
|
+
"polylines": "Polylines",
|
|
243
|
+
"curves": "Curves",
|
|
244
|
+
"Line_type": "Line type",
|
|
245
|
+
"Summarize_description": "Calculate the sum, maximum, minimum or average of records based on a field",
|
|
246
|
+
"Count_description": "Count the number of records based on data settings",
|
|
247
|
+
"Display_empty_when_data_is_zero": "Display empty when data is zero"
|
|
249
248
|
};
|
|
250
249
|
export default en;
|
|
@@ -239,12 +239,11 @@ const zh_CN = {
|
|
|
239
239
|
"Can_not_compare_with_{var}": "无法和 {var} 比较",
|
|
240
240
|
"Number_settings": "数字设置",
|
|
241
241
|
"Label_settings": "标签设置",
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
"Search_records": "搜索记录"
|
|
242
|
+
"polylines": "折线",
|
|
243
|
+
"curves": "曲线",
|
|
244
|
+
"Line_type": "线型",
|
|
245
|
+
"Summarize_description": "按照一个字段计算记录的总和、最大值、最小值或者平均值",
|
|
246
|
+
"Count_description": "根据数据设置计算记录数量",
|
|
247
|
+
"Display_empty_when_data_is_zero": "数据为零时留空"
|
|
249
248
|
};
|
|
250
249
|
export default zh_CN;
|
|
@@ -472,10 +472,4 @@ export const formatNumericValue = function (value) {
|
|
|
472
472
|
} = data;
|
|
473
473
|
value = value || 0;
|
|
474
474
|
return parseFloat(value.toFixed(precision));
|
|
475
|
-
};
|
|
476
|
-
export function getSelectColumnOptions(column) {
|
|
477
|
-
if (!column || !column.data || !Array.isArray(column.data.options)) {
|
|
478
|
-
return [];
|
|
479
|
-
}
|
|
480
|
-
return column.data.options;
|
|
481
|
-
}
|
|
475
|
+
};
|
|
@@ -1,53 +1,3 @@
|
|
|
1
|
-
import { getCellValueDisplayString } from 'dtable-utils';
|
|
2
|
-
import context from '../context';
|
|
3
|
-
const FILEEXT_ICON_MAP = {
|
|
4
|
-
// text file
|
|
5
|
-
'md': 'txt.png',
|
|
6
|
-
'txt': 'txt.png',
|
|
7
|
-
// pdf file
|
|
8
|
-
'pdf': 'pdf.png',
|
|
9
|
-
// document file
|
|
10
|
-
'doc': 'word.png',
|
|
11
|
-
'docx': 'word.png',
|
|
12
|
-
'odt': 'word.png',
|
|
13
|
-
'fodt': 'word.png',
|
|
14
|
-
'ppt': 'ppt.png',
|
|
15
|
-
'pptx': 'ppt.png',
|
|
16
|
-
'odp': 'ppt.png',
|
|
17
|
-
'fodp': 'ppt.png',
|
|
18
|
-
'xls': 'excel.png',
|
|
19
|
-
'xlsx': 'excel.png',
|
|
20
|
-
'ods': 'excel.png',
|
|
21
|
-
'fods': 'excel.png',
|
|
22
|
-
// video
|
|
23
|
-
'mp4': 'video.png',
|
|
24
|
-
'ogv': 'video.png',
|
|
25
|
-
'webm': 'video.png',
|
|
26
|
-
'mov': 'video.png',
|
|
27
|
-
'flv': 'video.png',
|
|
28
|
-
'wmv': 'video.png',
|
|
29
|
-
'rmvb': 'video.png',
|
|
30
|
-
// music file
|
|
31
|
-
'mp3': 'music.png',
|
|
32
|
-
'oga': 'music.png',
|
|
33
|
-
'ogg': 'music.png',
|
|
34
|
-
'flac': 'music.png',
|
|
35
|
-
'aac': 'music.png',
|
|
36
|
-
'ac3': 'music.png',
|
|
37
|
-
'wma': 'music.png',
|
|
38
|
-
// image file
|
|
39
|
-
'jpg': 'pic.png',
|
|
40
|
-
'jpeg': 'pic.png',
|
|
41
|
-
'png': 'pic.png',
|
|
42
|
-
'svg': 'pic.png',
|
|
43
|
-
'gif': 'pic.png',
|
|
44
|
-
'bmp': 'pic.png',
|
|
45
|
-
'ico': 'pic.png',
|
|
46
|
-
// folder dir
|
|
47
|
-
'folder': 'folder-192.png',
|
|
48
|
-
// default
|
|
49
|
-
'default': 'file.png'
|
|
50
|
-
};
|
|
51
1
|
export const isFunction = functionToCheck => {
|
|
52
2
|
const getType = {};
|
|
53
3
|
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
|
|
@@ -65,147 +15,4 @@ export const hexToRgb = hex => {
|
|
|
65
15
|
g: bigint >> 8 & 255,
|
|
66
16
|
b: bigint & 255
|
|
67
17
|
};
|
|
68
|
-
};
|
|
69
|
-
export const getRowName = (columns, row, formula_rows) => {
|
|
70
|
-
if (!row) return '';
|
|
71
|
-
const displayColumn = columns.find(column => column.key === '0000');
|
|
72
|
-
if (!displayColumn) return '';
|
|
73
|
-
const {
|
|
74
|
-
type,
|
|
75
|
-
key,
|
|
76
|
-
data
|
|
77
|
-
} = displayColumn;
|
|
78
|
-
let formulaRows;
|
|
79
|
-
if (formula_rows) {
|
|
80
|
-
formulaRows = formula_rows;
|
|
81
|
-
}
|
|
82
|
-
const collaborators = context.getCollaboratorsFromCache() || [];
|
|
83
|
-
const departments = context.getDepartments();
|
|
84
|
-
return getCellValueDisplayString(row, type, key, {
|
|
85
|
-
formulaRows,
|
|
86
|
-
data,
|
|
87
|
-
collaborators,
|
|
88
|
-
departments
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
export function createObjectWithProperties(originalObj, properties) {
|
|
92
|
-
return properties.reduce((result, property) => {
|
|
93
|
-
if (property in originalObj) {
|
|
94
|
-
result[property] = originalObj[property];
|
|
95
|
-
}
|
|
96
|
-
return result;
|
|
97
|
-
}, {});
|
|
98
|
-
}
|
|
99
|
-
export const checkSVGImage = url => {
|
|
100
|
-
if (!url || typeof url !== 'string') return false;
|
|
101
|
-
const isSVGImage = url.substr(-4).toLowerCase() === '.svg';
|
|
102
|
-
return isSVGImage;
|
|
103
|
-
};
|
|
104
|
-
export const isInternalURL = url => {
|
|
105
|
-
if (!url || typeof url !== 'string') return false;
|
|
106
|
-
const {
|
|
107
|
-
server
|
|
108
|
-
} = context.getSettings();
|
|
109
|
-
return url.indexOf(server) > -1;
|
|
110
|
-
};
|
|
111
|
-
export const isTargetUrl = (target, url) => {
|
|
112
|
-
if (!url || typeof url !== 'string') return false;
|
|
113
|
-
return target && url ? url.indexOf(target) > -1 : false;
|
|
114
|
-
};
|
|
115
|
-
export const isCustomAssetUrl = url => {
|
|
116
|
-
return isTargetUrl('custom-asset://', url);
|
|
117
|
-
};
|
|
118
|
-
export const isDigitalSignsUrl = url => {
|
|
119
|
-
if (!url || typeof url !== 'string') return false;
|
|
120
|
-
return isTargetUrl('/digital-signs/', url) && !url.includes('http');
|
|
121
|
-
};
|
|
122
|
-
export const generateCurrentBaseImageThumbnailUrl = _ref => {
|
|
123
|
-
let {
|
|
124
|
-
server,
|
|
125
|
-
workspaceID,
|
|
126
|
-
dtableUuid,
|
|
127
|
-
partUrl,
|
|
128
|
-
size
|
|
129
|
-
} = _ref;
|
|
130
|
-
if (!partUrl || typeof partUrl !== 'string') return '';
|
|
131
|
-
return "".concat(server, "/thumbnail/workspace/").concat(workspaceID, "/asset/").concat(dtableUuid).concat(partUrl, "?size=").concat(size);
|
|
132
|
-
};
|
|
133
|
-
export const isInternalUrl = url => {
|
|
134
|
-
if (!url || typeof url !== 'string') return false;
|
|
135
|
-
const {
|
|
136
|
-
server
|
|
137
|
-
} = context.getSettings();
|
|
138
|
-
return url.indexOf(server) > -1;
|
|
139
|
-
};
|
|
140
|
-
export const getImageThumbnailUrl = function (url) {
|
|
141
|
-
let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 256;
|
|
142
|
-
if (!url || typeof url !== 'string') return '';
|
|
143
|
-
const {
|
|
144
|
-
server,
|
|
145
|
-
workspaceID,
|
|
146
|
-
dtableUuid
|
|
147
|
-
} = context.getSettings();
|
|
148
|
-
if (isCustomAssetUrl(url)) {
|
|
149
|
-
let assetUuid = url.slice(url.lastIndexOf('/') + 1, url.lastIndexOf('.'));
|
|
150
|
-
return server + '/dtable/' + dtableUuid + '/custom-asset-thumbnail/' + assetUuid + '?size=' + size;
|
|
151
|
-
}
|
|
152
|
-
if (isDigitalSignsUrl(url)) {
|
|
153
|
-
return generateCurrentBaseImageThumbnailUrl({
|
|
154
|
-
server,
|
|
155
|
-
workspaceID,
|
|
156
|
-
dtableUuid,
|
|
157
|
-
size,
|
|
158
|
-
partUrl: url
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
if (checkSVGImage(url) || !isInternalUrl(url)) {
|
|
162
|
-
return url;
|
|
163
|
-
}
|
|
164
|
-
return url.replace('/workspace', '/thumbnail/workspace') + '?size=' + size;
|
|
165
|
-
};
|
|
166
|
-
export const imageCheck = filename => {
|
|
167
|
-
// no file ext
|
|
168
|
-
if (!filename || typeof filename !== 'string') return false;
|
|
169
|
-
if (filename.lastIndexOf('.') === -1) {
|
|
170
|
-
return false;
|
|
171
|
-
}
|
|
172
|
-
const file_ext = filename.substr(filename.lastIndexOf('.') + 1).toLowerCase();
|
|
173
|
-
const image_exts = ['gif', 'jpeg', 'jpg', 'png', 'ico', 'bmp', 'tif', 'tiff', 'webp'];
|
|
174
|
-
return image_exts.includes(file_ext);
|
|
175
|
-
};
|
|
176
|
-
export const getFileIconUrl = (filename, direntType) => {
|
|
177
|
-
let commonUrl = '';
|
|
178
|
-
let file_ext = '';
|
|
179
|
-
if (filename.lastIndexOf('.') === -1) {
|
|
180
|
-
commonUrl = 'img/file/192/' + FILEEXT_ICON_MAP['default'];
|
|
181
|
-
} else {
|
|
182
|
-
file_ext = filename.substr(filename.lastIndexOf('.') + 1).toLowerCase();
|
|
183
|
-
}
|
|
184
|
-
if (FILEEXT_ICON_MAP[file_ext]) {
|
|
185
|
-
commonUrl = 'img/file/192/' + FILEEXT_ICON_MAP[file_ext];
|
|
186
|
-
} else if (direntType === 'dir') {
|
|
187
|
-
commonUrl = 'img/' + FILEEXT_ICON_MAP['folder'];
|
|
188
|
-
} else {
|
|
189
|
-
commonUrl = 'img/file/192/' + FILEEXT_ICON_MAP['default'];
|
|
190
|
-
}
|
|
191
|
-
const {
|
|
192
|
-
mediaUrl
|
|
193
|
-
} = context.getSettings();
|
|
194
|
-
let url = mediaUrl + commonUrl;
|
|
195
|
-
return url;
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
// The special symbols should not be used as wildcards in regular expressions, need to be escaped into normal symbols
|
|
199
|
-
export const escapeRegExp = value => {
|
|
200
|
-
if (typeof value !== 'string') return '';
|
|
201
|
-
return value.replace(/[.\\[\]{}()|^$?*+]/g, '\\$&');
|
|
202
|
-
};
|
|
203
|
-
export const isArchiveViewRowData = (row, column) => {
|
|
204
|
-
const values = row[column.key];
|
|
205
|
-
if (values && Array.isArray(values) && values.length > 0) {
|
|
206
|
-
const valueKeys = ['row_id', 'display_value'];
|
|
207
|
-
const item = values[0];
|
|
208
|
-
return valueKeys.every(key => item[key]);
|
|
209
|
-
}
|
|
210
|
-
return false;
|
|
211
18
|
};
|
|
@@ -2,7 +2,6 @@ import { CellType, filter2SqlCondition, isNumericColumn, isDateColumn } from 'dt
|
|
|
2
2
|
import { getSqlGroup } from '../column-utils';
|
|
3
3
|
import { CHART_TYPE, DTABLE_DB_SUMMARY_METHOD, CHART_SUMMARY_TYPE, CHART_Y_GROUP_TYPE } from '../../constants';
|
|
4
4
|
import { fixGeoGranularity } from '../map';
|
|
5
|
-
import { getDatabaseGroupName } from './column-2-sql-column';
|
|
6
5
|
|
|
7
6
|
/*
|
|
8
7
|
query chart data by dtable-db
|
|
@@ -983,71 +982,12 @@ class ChartDataSQL {
|
|
|
983
982
|
}
|
|
984
983
|
return {};
|
|
985
984
|
};
|
|
986
|
-
this.get_statistic_record_sql = (statItem, statisticRecord, _ref2) => {
|
|
987
|
-
let {
|
|
988
|
-
isColumn,
|
|
989
|
-
isRow
|
|
990
|
-
} = _ref2;
|
|
991
|
-
const {
|
|
992
|
-
column_groupby_column_key,
|
|
993
|
-
column_groupby_multiple_numeric_column,
|
|
994
|
-
type
|
|
995
|
-
} = statItem.config;
|
|
996
|
-
const {
|
|
997
|
-
columnGroupName,
|
|
998
|
-
groupName
|
|
999
|
-
} = getDatabaseGroupName(statItem.config, this.table);
|
|
1000
|
-
const isGroup = column_groupby_column_key && !column_groupby_multiple_numeric_column;
|
|
1001
|
-
const {
|
|
1002
|
-
name,
|
|
1003
|
-
group_name
|
|
1004
|
-
} = statisticRecord;
|
|
1005
|
-
let sqlName = "'".concat(name, "'");
|
|
1006
|
-
let sqlGroupName;
|
|
1007
|
-
if (isGroup) {
|
|
1008
|
-
sqlGroupName = "'".concat(group_name, "'");
|
|
1009
|
-
}
|
|
1010
|
-
let sqlString;
|
|
1011
|
-
if (CHART_TYPE.PIVOT_TABLE === type) {
|
|
1012
|
-
let pivotGroupName = "".concat(isGroup ? "".concat(columnGroupName, "=").concat(sqlGroupName) : '');
|
|
1013
|
-
if (isColumn) {
|
|
1014
|
-
if (this.filter_sql && pivotGroupName) {
|
|
1015
|
-
sqlString = "select * from ".concat(this.table_name, " ").concat(this.filter_sql, " and ").concat(pivotGroupName, " limit 5000");
|
|
1016
|
-
} else if (groupName && !this.filter_sql) {
|
|
1017
|
-
sqlString = "select * from ".concat(this.table_name, " where ").concat(pivotGroupName, " limit 5000");
|
|
1018
|
-
} else {
|
|
1019
|
-
sqlString = "select * from ".concat(this.table_name, " ").concat(this.filter_sql, " limit 5000");
|
|
1020
|
-
}
|
|
1021
|
-
return sqlString;
|
|
1022
|
-
}
|
|
1023
|
-
if (isRow) {
|
|
1024
|
-
if (groupName && this.filter_sql) {
|
|
1025
|
-
sqlString = "select * from ".concat(this.table_name, " ").concat(this.filter_sql, " and ").concat(groupName, "=").concat(sqlName, " limit 5000");
|
|
1026
|
-
} else if (groupName && !this.filter_sql) {
|
|
1027
|
-
sqlString = "select * from ".concat(this.table_name, " where ").concat(groupName, "=").concat(sqlName, " limit 5000");
|
|
1028
|
-
} else {
|
|
1029
|
-
sqlString = "select * from ".concat(this.table_name, " ").concat(this.filter_sql, " limit 5000");
|
|
1030
|
-
}
|
|
1031
|
-
return sqlString;
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
if (groupName && this.filter_sql) {
|
|
1035
|
-
sqlString = "select * from ".concat(this.table_name, " ").concat(this.filter_sql, " and ").concat(groupName, "=").concat(sqlName, " ").concat(isGroup ? "and ".concat(columnGroupName, "=").concat(sqlGroupName) : '', " limit 5000");
|
|
1036
|
-
} else if (groupName && !this.filter_sql) {
|
|
1037
|
-
sqlString = "select * from ".concat(this.table_name, " where ").concat(groupName, "=").concat(sqlName, " ").concat(isGroup ? "and ".concat(columnGroupName, "=").concat(sqlGroupName) : '', " limit 5000");
|
|
1038
|
-
} else {
|
|
1039
|
-
sqlString = "select * from ".concat(this.table_name, " ").concat(this.filter_sql, " limit 5000");
|
|
1040
|
-
}
|
|
1041
|
-
return sqlString;
|
|
1042
|
-
};
|
|
1043
985
|
this.error = '';
|
|
1044
986
|
this.table = table;
|
|
1045
987
|
this.chart = (chart === null || chart === void 0 ? void 0 : chart.config) || {};
|
|
1046
988
|
this.username = username;
|
|
1047
989
|
const table_name = (table === null || table === void 0 ? void 0 : table.name) || '';
|
|
1048
990
|
this.table_name = "`".concat(table_name, "`");
|
|
1049
|
-
this.userId = userId;
|
|
1050
|
-
this.userDepartmentIdsMap = userDepartmentIdsMap;
|
|
1051
991
|
this.chart_type = (chart === null || chart === void 0 ? void 0 : (_chart$config = chart.config) === null || _chart$config === void 0 ? void 0 : _chart$config.type) || '';
|
|
1052
992
|
|
|
1053
993
|
// columns
|
|
@@ -843,224 +843,4 @@ const chartColumn2SqlColumn = (chartElement, table) => {
|
|
|
843
843
|
return {};
|
|
844
844
|
}
|
|
845
845
|
};
|
|
846
|
-
export const getDatabaseGroupName = (statItem, selectedTable) => {
|
|
847
|
-
const type = statItem.type;
|
|
848
|
-
let groupName, selectedColumn, columnGroupName, columnSelectedColumn;
|
|
849
|
-
switch (type) {
|
|
850
|
-
case CHART_TYPE.BAR:
|
|
851
|
-
case CHART_TYPE.BAR_GROUP:
|
|
852
|
-
case CHART_TYPE.BAR_STACK:
|
|
853
|
-
case CHART_TYPE.LINE:
|
|
854
|
-
case CHART_TYPE.PIE:
|
|
855
|
-
case CHART_TYPE.RING:
|
|
856
|
-
case CHART_TYPE.AREA:
|
|
857
|
-
case CHART_TYPE.AREA_GROUP:
|
|
858
|
-
case CHART_TYPE.TREE_MAP:
|
|
859
|
-
case CHART_TYPE.HORIZONTAL_BAR:
|
|
860
|
-
case CHART_TYPE.HORIZONTAL_GROUP_BAR:
|
|
861
|
-
case CHART_TYPE.STACKED_HORIZONTAL_BAR:
|
|
862
|
-
{
|
|
863
|
-
let groupby_column_key, groupby_date_granularity, groupby_geolocation_granularity;
|
|
864
|
-
const {
|
|
865
|
-
column_groupby_multiple_numeric_column,
|
|
866
|
-
column_groupby_column_key,
|
|
867
|
-
column_groupby_date_granularity,
|
|
868
|
-
column_groupby_geolocation_granularity
|
|
869
|
-
} = statItem;
|
|
870
|
-
if (type === CHART_TYPE.PIE || type === CHART_TYPE.RING || type === CHART_TYPE.TREE_MAP) {
|
|
871
|
-
groupby_column_key = statItem.groupby_column_key;
|
|
872
|
-
groupby_date_granularity = statItem.groupby_date_granularity;
|
|
873
|
-
groupby_geolocation_granularity = statItem.groupby_geolocation_granularity;
|
|
874
|
-
} else if (type === CHART_TYPE.HORIZONTAL_BAR || type === CHART_TYPE.HORIZONTAL_GROUP_BAR || type === CHART_TYPE.STACKED_HORIZONTAL_BAR) {
|
|
875
|
-
groupby_column_key = statItem.vertical_axis_column_key;
|
|
876
|
-
groupby_date_granularity = statItem.vertical_axis_date_granularity;
|
|
877
|
-
groupby_geolocation_granularity = statItem.vertical_axis_geolocation_granularity;
|
|
878
|
-
} else {
|
|
879
|
-
groupby_column_key = statItem.x_axis_column_key;
|
|
880
|
-
groupby_date_granularity = statItem.x_axis_date_granularity;
|
|
881
|
-
groupby_geolocation_granularity = statItem.x_axis_geolocation_granularity;
|
|
882
|
-
}
|
|
883
|
-
if (!column_groupby_multiple_numeric_column && column_groupby_column_key) {
|
|
884
|
-
columnSelectedColumn = getTableColumnByKey(selectedTable, column_groupby_column_key);
|
|
885
|
-
const {
|
|
886
|
-
name
|
|
887
|
-
} = column2SqlColumn(columnSelectedColumn, {
|
|
888
|
-
dateGranularity: column_groupby_date_granularity,
|
|
889
|
-
geolocationGranularity: column_groupby_geolocation_granularity
|
|
890
|
-
});
|
|
891
|
-
columnGroupName = name;
|
|
892
|
-
}
|
|
893
|
-
selectedColumn = getTableColumnByKey(selectedTable, groupby_column_key);
|
|
894
|
-
const {
|
|
895
|
-
name
|
|
896
|
-
} = column2SqlColumn(selectedColumn, {
|
|
897
|
-
dateGranularity: groupby_date_granularity,
|
|
898
|
-
geolocationGranularity: groupby_geolocation_granularity
|
|
899
|
-
});
|
|
900
|
-
groupName = name;
|
|
901
|
-
break;
|
|
902
|
-
}
|
|
903
|
-
case CHART_TYPE.MAP:
|
|
904
|
-
case CHART_TYPE.MAP_BUBBLE:
|
|
905
|
-
{
|
|
906
|
-
const {
|
|
907
|
-
geolocation_granularity,
|
|
908
|
-
geo_column
|
|
909
|
-
} = statItem;
|
|
910
|
-
selectedColumn = getTableColumnByKey(selectedTable, geo_column);
|
|
911
|
-
const {
|
|
912
|
-
name
|
|
913
|
-
} = column2SqlColumn(selectedColumn, {
|
|
914
|
-
geolocationGranularity: geolocation_granularity
|
|
915
|
-
});
|
|
916
|
-
groupName = name;
|
|
917
|
-
break;
|
|
918
|
-
}
|
|
919
|
-
case CHART_TYPE.WORLD_MAP:
|
|
920
|
-
case CHART_TYPE.WORLD_MAP_BUBBLE:
|
|
921
|
-
case CHART_TYPE.MIRROR:
|
|
922
|
-
{
|
|
923
|
-
const {
|
|
924
|
-
column
|
|
925
|
-
} = statItem;
|
|
926
|
-
selectedColumn = getTableColumnByKey(selectedTable, column);
|
|
927
|
-
groupName = selectedColumn.name;
|
|
928
|
-
break;
|
|
929
|
-
}
|
|
930
|
-
case CHART_TYPE.HEAT_MAP:
|
|
931
|
-
{
|
|
932
|
-
const {
|
|
933
|
-
time_column
|
|
934
|
-
} = statItem;
|
|
935
|
-
selectedColumn = getTableColumnByKey(selectedTable, time_column);
|
|
936
|
-
groupName = "ISODATE(".concat(selectedColumn.name, ")");
|
|
937
|
-
break;
|
|
938
|
-
}
|
|
939
|
-
case CHART_TYPE.SCATTER:
|
|
940
|
-
{
|
|
941
|
-
const {
|
|
942
|
-
group_column
|
|
943
|
-
} = statItem;
|
|
944
|
-
selectedColumn = getTableColumnByKey(selectedTable, group_column);
|
|
945
|
-
groupName = selectedColumn.name;
|
|
946
|
-
break;
|
|
947
|
-
}
|
|
948
|
-
case CHART_TYPE.BASIC_NUMBER_CARD:
|
|
949
|
-
{
|
|
950
|
-
// todo
|
|
951
|
-
break;
|
|
952
|
-
}
|
|
953
|
-
case CHART_TYPE.COMPARE_BAR:
|
|
954
|
-
{
|
|
955
|
-
const {
|
|
956
|
-
x_axis_column_key,
|
|
957
|
-
x_axis_date_granularity
|
|
958
|
-
} = statItem;
|
|
959
|
-
selectedColumn = getTableColumnByKey(selectedTable, x_axis_column_key);
|
|
960
|
-
const {
|
|
961
|
-
name
|
|
962
|
-
} = column2SqlColumn(selectedColumn, {
|
|
963
|
-
dateGranularity: x_axis_date_granularity
|
|
964
|
-
});
|
|
965
|
-
groupName = name;
|
|
966
|
-
break;
|
|
967
|
-
}
|
|
968
|
-
case CHART_TYPE.COMBINATION_CHART:
|
|
969
|
-
{
|
|
970
|
-
const {
|
|
971
|
-
x_axis_column_key,
|
|
972
|
-
x_axis_date_granularity: groupby_date_granularity,
|
|
973
|
-
x_axis_geolocation_granularity: groupby_geolocation_granularity
|
|
974
|
-
} = statItem;
|
|
975
|
-
selectedColumn = getTableColumnByKey(selectedTable, x_axis_column_key);
|
|
976
|
-
if (!selectedColumn) return [];
|
|
977
|
-
groupName = "`".concat(selectedColumn.name, "`");
|
|
978
|
-
if ([CellType.CTIME, CellType.MTIME, CellType.DATE].includes(selectedColumn.type)) {
|
|
979
|
-
const {
|
|
980
|
-
name
|
|
981
|
-
} = column2SqlColumn(selectedColumn, {
|
|
982
|
-
dateGranularity: groupby_date_granularity
|
|
983
|
-
});
|
|
984
|
-
groupName = name;
|
|
985
|
-
} else if (selectedColumn.type === CellType.GEOLOCATION) {
|
|
986
|
-
const {
|
|
987
|
-
name
|
|
988
|
-
} = column2SqlColumn(selectedColumn, {
|
|
989
|
-
geolocationGranularity: groupby_geolocation_granularity
|
|
990
|
-
});
|
|
991
|
-
groupName = name;
|
|
992
|
-
}
|
|
993
|
-
break;
|
|
994
|
-
}
|
|
995
|
-
case CHART_TYPE.TREND_CHART:
|
|
996
|
-
{
|
|
997
|
-
const {
|
|
998
|
-
date_column,
|
|
999
|
-
date_granularity
|
|
1000
|
-
} = statItem;
|
|
1001
|
-
selectedColumn = getTableColumnByKey(selectedTable, date_column);
|
|
1002
|
-
const {
|
|
1003
|
-
name
|
|
1004
|
-
} = column2SqlColumn(selectedColumn, {
|
|
1005
|
-
dateGranularity: date_granularity
|
|
1006
|
-
});
|
|
1007
|
-
groupName = name;
|
|
1008
|
-
break;
|
|
1009
|
-
}
|
|
1010
|
-
case CHART_TYPE.COMPLETENESS_CHART:
|
|
1011
|
-
case CHART_TYPE.GROUP_COMPLETENESS_CHART:
|
|
1012
|
-
{
|
|
1013
|
-
const {
|
|
1014
|
-
name_column
|
|
1015
|
-
} = statItem;
|
|
1016
|
-
selectedColumn = getTableColumnByKey(selectedTable, name_column);
|
|
1017
|
-
groupName = "`".concat(selectedColumn.name, "`");
|
|
1018
|
-
break;
|
|
1019
|
-
}
|
|
1020
|
-
case CHART_TYPE.DASHBOARD:
|
|
1021
|
-
{
|
|
1022
|
-
// todo
|
|
1023
|
-
break;
|
|
1024
|
-
}
|
|
1025
|
-
case CHART_TYPE.PIVOT_TABLE:
|
|
1026
|
-
{
|
|
1027
|
-
let {
|
|
1028
|
-
groupby_column_key,
|
|
1029
|
-
groupby_date_granularity,
|
|
1030
|
-
groupby_geolocation_granularity,
|
|
1031
|
-
column_groupby_column_key,
|
|
1032
|
-
column_groupby_date_granularity,
|
|
1033
|
-
column_groupby_geolocation_granularity,
|
|
1034
|
-
column_groupby_multiple_numeric_column
|
|
1035
|
-
} = statItem;
|
|
1036
|
-
if (!column_groupby_multiple_numeric_column && column_groupby_column_key) {
|
|
1037
|
-
columnSelectedColumn = getTableColumnByKey(selectedTable, column_groupby_column_key);
|
|
1038
|
-
const {
|
|
1039
|
-
name
|
|
1040
|
-
} = column2SqlColumn(columnSelectedColumn, {
|
|
1041
|
-
dateGranularity: column_groupby_date_granularity,
|
|
1042
|
-
geolocationGranularity: column_groupby_geolocation_granularity
|
|
1043
|
-
});
|
|
1044
|
-
columnGroupName = name;
|
|
1045
|
-
}
|
|
1046
|
-
selectedColumn = getTableColumnByKey(selectedTable, groupby_column_key);
|
|
1047
|
-
const {
|
|
1048
|
-
name
|
|
1049
|
-
} = column2SqlColumn(selectedColumn, {
|
|
1050
|
-
dateGranularity: groupby_date_granularity,
|
|
1051
|
-
geolocationGranularity: groupby_geolocation_granularity
|
|
1052
|
-
});
|
|
1053
|
-
groupName = name;
|
|
1054
|
-
break;
|
|
1055
|
-
}
|
|
1056
|
-
default:
|
|
1057
|
-
break;
|
|
1058
|
-
}
|
|
1059
|
-
return {
|
|
1060
|
-
groupName,
|
|
1061
|
-
selectedColumn,
|
|
1062
|
-
columnGroupName,
|
|
1063
|
-
columnSelectedColumn
|
|
1064
|
-
};
|
|
1065
|
-
};
|
|
1066
846
|
export default chartColumn2SqlColumn;
|
package/dist/view/index.js
CHANGED
|
@@ -172,7 +172,6 @@ const propTypes = {
|
|
|
172
172
|
chart: PropTypes.object.isRequired,
|
|
173
173
|
api: PropTypes.object.isRequired,
|
|
174
174
|
collaborators: PropTypes.array,
|
|
175
|
-
departments: PropTypes.array,
|
|
176
175
|
tables: PropTypes.array.isRequired,
|
|
177
176
|
className: PropTypes.string,
|
|
178
177
|
collaboratorManager: PropTypes.object,
|
|
@@ -79,9 +79,6 @@ class Combination extends ChartComponent {
|
|
|
79
79
|
}, ['', -Infinity])[0];
|
|
80
80
|
const singleBarWidth = Math.round(chartWidth / (2 * nameNums * mostCommonCount));
|
|
81
81
|
const singleBarRadius = Math.min(singleBarWidth / 5, 10);
|
|
82
|
-
this.chart.on('interval:click', e => {
|
|
83
|
-
this.props.toggleRecords(e.data.data);
|
|
84
|
-
});
|
|
85
82
|
const currentTheme = BaseUtils.getCurrentTheme(themeName);
|
|
86
83
|
this.colorMap = data.reduce((acc, cur, index) => {
|
|
87
84
|
if (!acc[cur.group_name]) {
|
|
@@ -26,9 +26,6 @@ class Dashboard extends Component {
|
|
|
26
26
|
width: '100%',
|
|
27
27
|
height: '100%'
|
|
28
28
|
});
|
|
29
|
-
this.chart.on('interval:click', e => {
|
|
30
|
-
this.props.toggleRecords(e.data.data);
|
|
31
|
-
});
|
|
32
29
|
registerShape('point', 'pointer', {
|
|
33
30
|
draw(cfg, container) {
|
|
34
31
|
const group = container.addGroup();
|