sea-chart 0.0.56-alpha.0 → 0.0.56
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 +5 -10
- package/dist/context.js +0 -5
- package/dist/locale/lang/en.js +6 -7
- package/dist/locale/lang/zh_CN.js +6 -7
- package/dist/settings/widgets/select-view/index.js +4 -4
- package/dist/utils/chart-utils/original-data-utils/compare-bar-chart-calculator.js +2 -12
- 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 +3 -22
- package/dist/view/wrapper/area.js +1 -1
- package/dist/view/wrapper/combination.js +0 -3
- package/dist/view/wrapper/dashboard.js +0 -3
- package/dist/view/wrapper/heat-map.js +1 -1
- package/dist/view/wrapper/index.js +233 -258
- package/dist/view/wrapper/line-group.js +3 -4
- package/dist/view/wrapper/line.js +3 -3
- package/dist/view/wrapper/map.js +5 -15
- package/dist/view/wrapper/mirror.js +1 -1
- package/dist/view/wrapper/scatter.js +1 -1
- package/dist/view/wrapper/table/index.js +5 -5
- package/dist/view/wrapper/table/one-dimension-table-no-numeric-columns.js +7 -14
- package/dist/view/wrapper/table/one-dimension-table-with-numeric-columns.js +7 -17
- package/dist/view/wrapper/table/two-dimension-table.js +23 -37
- package/dist/view/wrapper/treemap.js +0 -3
- package/dist/view/wrapper/world-map.js +4 -2
- 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 -352
- package/dist/utils/digital-sign-utils.js +0 -22
- package/dist/utils/row-record-utils.js +0 -479
- package/dist/utils/search.js +0 -66
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import { CellType } from 'dtable-utils';
|
|
2
1
|
export const CommonEventTypes = {
|
|
3
2
|
OPEN_SELECT: 'OPEN_SELECT',
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
EXPAND_ROW_UPDATED: 'EXPAND_ROW_UPDATED',
|
|
4
|
+
EXPAND_ROW_DELETED: 'EXPAND_ROW_DELETED',
|
|
5
|
+
REFRESH_CHARTS: 'REFRESH_CHARTS'
|
|
6
6
|
};
|
|
7
7
|
export const EXTERNAL_EVENT = {
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
export const ROW_HEIGHT = 32;
|
|
11
|
-
export const DELETED_OPTION_BACKGROUND_COLOR = '#eaeaea';
|
|
12
|
-
export const DELETED_OPTION_TIPS = 'deleted_option';
|
|
13
|
-
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];
|
|
14
|
-
export const NEED_FORMATTER = [CellType.CREATOR, CellType.LAST_MODIFIER, CellType.SINGLE_SELECT];
|
|
8
|
+
//
|
|
9
|
+
};
|
package/dist/context.js
CHANGED
|
@@ -121,7 +121,6 @@ class Context {
|
|
|
121
121
|
const {
|
|
122
122
|
config,
|
|
123
123
|
api,
|
|
124
|
-
departments,
|
|
125
124
|
collaborators,
|
|
126
125
|
collaboratorManager
|
|
127
126
|
} = props;
|
|
@@ -138,7 +137,6 @@ class Context {
|
|
|
138
137
|
this.settings = config || {};
|
|
139
138
|
this.hasInit = true;
|
|
140
139
|
this.collaborators = collaborators || [];
|
|
141
|
-
this.departments = departments || [];
|
|
142
140
|
this.collaboratorManager = collaboratorManager ? collaboratorManager : new CollaboratorManager(collaborators);
|
|
143
141
|
}
|
|
144
142
|
setSettings() {
|
|
@@ -151,9 +149,6 @@ class Context {
|
|
|
151
149
|
getSetting(key) {
|
|
152
150
|
return this.settings[key] || this.settings[key] === false ? this.settings[key] : '';
|
|
153
151
|
}
|
|
154
|
-
getDepartments() {
|
|
155
|
-
return this.departments || [];
|
|
156
|
-
}
|
|
157
152
|
getCollaboratorFromCache(email) {
|
|
158
153
|
return this.collaboratorManager.getCollaboratorFromCache(email);
|
|
159
154
|
}
|
package/dist/locale/lang/en.js
CHANGED
|
@@ -240,12 +240,11 @@ const en = {
|
|
|
240
240
|
"Can_not_compare_with_{var}": "Can not compare with {var}",
|
|
241
241
|
"Number_settings": "Number settings",
|
|
242
242
|
"Label_settings": "Label settings",
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
"Search_records": "Search records"
|
|
243
|
+
"polylines": "Polylines",
|
|
244
|
+
"curves": "Curves",
|
|
245
|
+
"Line_type": "Line type",
|
|
246
|
+
"Summarize_description": "Calculate the sum, maximum, minimum or average of records based on a field",
|
|
247
|
+
"Count_description": "Count the number of records based on data settings",
|
|
248
|
+
"Display_empty_when_data_is_zero": "Display empty when data is zero"
|
|
250
249
|
};
|
|
251
250
|
export default en;
|
|
@@ -240,12 +240,11 @@ const zh_CN = {
|
|
|
240
240
|
"Can_not_compare_with_{var}": "无法和 {var} 比较",
|
|
241
241
|
"Number_settings": "数字设置",
|
|
242
242
|
"Label_settings": "标签设置",
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
"Search_records": "搜索记录"
|
|
243
|
+
"polylines": "折线",
|
|
244
|
+
"curves": "曲线",
|
|
245
|
+
"Line_type": "线型",
|
|
246
|
+
"Summarize_description": "按照一个字段计算记录的总和、最大值、最小值或者平均值",
|
|
247
|
+
"Count_description": "根据数据设置计算记录数量",
|
|
248
|
+
"Display_empty_when_data_is_zero": "数据为零时留空"
|
|
250
249
|
};
|
|
251
250
|
export default zh_CN;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _DTableSelect from "dtable-ui-component/lib/DTableSelect";
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
3
|
import { Label, FormGroup } from 'reactstrap';
|
|
4
|
-
import { getTableById, getNonPrivateViews
|
|
4
|
+
import { getTableById, getNonPrivateViews } from 'dtable-utils';
|
|
5
5
|
import classnames from 'classnames';
|
|
6
6
|
import intl from '../../../intl';
|
|
7
7
|
import './index.css';
|
|
@@ -18,14 +18,14 @@ const SelectView = _ref => {
|
|
|
18
18
|
const views = getNonPrivateViews(table.views);
|
|
19
19
|
return Array.isArray(views) ? views.map(view => {
|
|
20
20
|
const value = view._id;
|
|
21
|
-
const
|
|
21
|
+
const isArchiveView = view.type === 'archive';
|
|
22
22
|
return {
|
|
23
23
|
label: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
24
24
|
className: "sea-chart-table-view mr-2"
|
|
25
25
|
}, /*#__PURE__*/React.createElement("i", {
|
|
26
26
|
className: classnames('dtable-font', {
|
|
27
|
-
'dtable-icon-archive-view':
|
|
28
|
-
'dtable-icon-main-view': !
|
|
27
|
+
'dtable-icon-archive-view': isArchiveView,
|
|
28
|
+
'dtable-icon-main-view': !isArchiveView
|
|
29
29
|
})
|
|
30
30
|
})), /*#__PURE__*/React.createElement("span", {
|
|
31
31
|
className: "select-option-name"
|
|
@@ -37,8 +37,6 @@ async function calculator(chart, value, _ref) {
|
|
|
37
37
|
const formulaRows = await getTableFormulaResults(table, statRows);
|
|
38
38
|
const dateRangeResultMap = new Map();
|
|
39
39
|
const comparedDateRangeResultMap = new Map();
|
|
40
|
-
const dateRangeRowMap = new Map();
|
|
41
|
-
const comparedDateRangeRowMap = new Map();
|
|
42
40
|
const isAdvance = y_axis_summary_type === CHART_SUMMARY_TYPE.ADVANCED;
|
|
43
41
|
statRows.forEach(row => {
|
|
44
42
|
const {
|
|
@@ -55,7 +53,6 @@ async function calculator(chart, value, _ref) {
|
|
|
55
53
|
const _cellValue = getCellValue(row, formulaRow, summaryColumn);
|
|
56
54
|
if (!currentValue) {
|
|
57
55
|
dateRangeResultMap.set(name, [_cellValue]);
|
|
58
|
-
dateRangeRowMap.set(name, [row]);
|
|
59
56
|
} else {
|
|
60
57
|
currentValue.push(_cellValue);
|
|
61
58
|
}
|
|
@@ -63,10 +60,8 @@ async function calculator(chart, value, _ref) {
|
|
|
63
60
|
const currentValue = dateRangeResultMap.get(name);
|
|
64
61
|
if (!currentValue) {
|
|
65
62
|
dateRangeResultMap.set(name, 1);
|
|
66
|
-
dateRangeRowMap.set(name, [row]);
|
|
67
63
|
} else {
|
|
68
64
|
dateRangeResultMap.set(name, currentValue + 1);
|
|
69
|
-
dateRangeRowMap.set(name, [row]);
|
|
70
65
|
}
|
|
71
66
|
}
|
|
72
67
|
} else {
|
|
@@ -75,7 +70,6 @@ async function calculator(chart, value, _ref) {
|
|
|
75
70
|
const _cellValue = getCellValue(row, formulaRow, summaryColumn);
|
|
76
71
|
if (!currentValue && summaryColumn) {
|
|
77
72
|
comparedDateRangeResultMap.set(name, [_cellValue]);
|
|
78
|
-
comparedDateRangeRowMap.set(name, [row]);
|
|
79
73
|
} else {
|
|
80
74
|
currentValue.push(_cellValue);
|
|
81
75
|
}
|
|
@@ -83,10 +77,8 @@ async function calculator(chart, value, _ref) {
|
|
|
83
77
|
const currentValue = comparedDateRangeResultMap.get(name);
|
|
84
78
|
if (!currentValue) {
|
|
85
79
|
comparedDateRangeResultMap.set(name, 1);
|
|
86
|
-
comparedDateRangeRowMap.set(name, [row]);
|
|
87
80
|
} else {
|
|
88
81
|
comparedDateRangeResultMap.set(name, currentValue + 1);
|
|
89
|
-
comparedDateRangeRowMap.set(name, [row]);
|
|
90
82
|
}
|
|
91
83
|
}
|
|
92
84
|
}
|
|
@@ -108,8 +100,7 @@ async function calculator(chart, value, _ref) {
|
|
|
108
100
|
group_name: groupName1,
|
|
109
101
|
raw_name: key,
|
|
110
102
|
value,
|
|
111
|
-
formatted_value
|
|
112
|
-
rows: dateRangeRowMap.get(key)
|
|
103
|
+
formatted_value
|
|
113
104
|
});
|
|
114
105
|
}
|
|
115
106
|
BaseUtils.sortCharts(dateRangeResult, groupbyColumn, 'name');
|
|
@@ -126,8 +117,7 @@ async function calculator(chart, value, _ref) {
|
|
|
126
117
|
group_name: groupName2,
|
|
127
118
|
raw_name: key,
|
|
128
119
|
value,
|
|
129
|
-
formatted_value
|
|
130
|
-
rows: comparedDateRangeRowMap.get(key)
|
|
120
|
+
formatted_value
|
|
131
121
|
});
|
|
132
122
|
}
|
|
133
123
|
BaseUtils.sortCharts(comparedDateRangeResult, groupbyColumn, 'name');
|
|
@@ -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
|
};
|
|
@@ -3,7 +3,6 @@ import dayjs from 'dayjs';
|
|
|
3
3
|
import { getSqlGroup } from '../column-utils';
|
|
4
4
|
import { CHART_TYPE, DTABLE_DB_SUMMARY_METHOD, CHART_SUMMARY_TYPE, CHART_Y_GROUP_TYPE } from '../../constants';
|
|
5
5
|
import { fixGeoGranularity } from '../map';
|
|
6
|
-
import { getDatabaseGroupName } from './column-2-sql-column';
|
|
7
6
|
|
|
8
7
|
/*
|
|
9
8
|
query chart data by dtable-db
|
|
@@ -996,71 +995,12 @@ class ChartDataSQL {
|
|
|
996
995
|
}
|
|
997
996
|
return {};
|
|
998
997
|
};
|
|
999
|
-
this.get_statistic_record_sql = (statItem, statisticRecord, _ref2) => {
|
|
1000
|
-
let {
|
|
1001
|
-
isColumn,
|
|
1002
|
-
isRow
|
|
1003
|
-
} = _ref2;
|
|
1004
|
-
const {
|
|
1005
|
-
column_groupby_column_key,
|
|
1006
|
-
column_groupby_multiple_numeric_column,
|
|
1007
|
-
type
|
|
1008
|
-
} = statItem.config;
|
|
1009
|
-
const {
|
|
1010
|
-
columnGroupName,
|
|
1011
|
-
groupName
|
|
1012
|
-
} = getDatabaseGroupName(statItem.config, this.table);
|
|
1013
|
-
const isGroup = column_groupby_column_key && !column_groupby_multiple_numeric_column;
|
|
1014
|
-
const {
|
|
1015
|
-
name,
|
|
1016
|
-
group_name
|
|
1017
|
-
} = statisticRecord;
|
|
1018
|
-
let sqlName = "'".concat(name, "'");
|
|
1019
|
-
let sqlGroupName;
|
|
1020
|
-
if (isGroup) {
|
|
1021
|
-
sqlGroupName = "'".concat(group_name, "'");
|
|
1022
|
-
}
|
|
1023
|
-
let sqlString;
|
|
1024
|
-
if (type === CHART_TYPE.TABLE) {
|
|
1025
|
-
let pivotGroupName = "".concat(isGroup ? "".concat(columnGroupName, "=").concat(sqlGroupName) : '');
|
|
1026
|
-
if (isColumn) {
|
|
1027
|
-
if (this.filter_sql && pivotGroupName) {
|
|
1028
|
-
sqlString = "select * from ".concat(this.table_name, " ").concat(this.filter_sql, " and ").concat(pivotGroupName, " limit 5000");
|
|
1029
|
-
} else if (groupName && !this.filter_sql) {
|
|
1030
|
-
sqlString = "select * from ".concat(this.table_name, " where ").concat(pivotGroupName, " limit 5000");
|
|
1031
|
-
} else {
|
|
1032
|
-
sqlString = "select * from ".concat(this.table_name, " ").concat(this.filter_sql, " limit 5000");
|
|
1033
|
-
}
|
|
1034
|
-
return sqlString;
|
|
1035
|
-
}
|
|
1036
|
-
if (isRow) {
|
|
1037
|
-
if (groupName && this.filter_sql) {
|
|
1038
|
-
sqlString = "select * from ".concat(this.table_name, " ").concat(this.filter_sql, " and ").concat(groupName, "=").concat(sqlName, " limit 5000");
|
|
1039
|
-
} else if (groupName && !this.filter_sql) {
|
|
1040
|
-
sqlString = "select * from ".concat(this.table_name, " where ").concat(groupName, "=").concat(sqlName, " limit 5000");
|
|
1041
|
-
} else {
|
|
1042
|
-
sqlString = "select * from ".concat(this.table_name, " ").concat(this.filter_sql, " limit 5000");
|
|
1043
|
-
}
|
|
1044
|
-
return sqlString;
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
if (groupName && this.filter_sql) {
|
|
1048
|
-
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");
|
|
1049
|
-
} else if (groupName && !this.filter_sql) {
|
|
1050
|
-
sqlString = "select * from ".concat(this.table_name, " where ").concat(groupName, "=").concat(sqlName, " ").concat(isGroup ? "and ".concat(columnGroupName, "=").concat(sqlGroupName) : '', " limit 5000");
|
|
1051
|
-
} else {
|
|
1052
|
-
sqlString = "select * from ".concat(this.table_name, " ").concat(this.filter_sql, " limit 5000");
|
|
1053
|
-
}
|
|
1054
|
-
return sqlString;
|
|
1055
|
-
};
|
|
1056
998
|
this.error = '';
|
|
1057
999
|
this.table = table;
|
|
1058
1000
|
this.chart = (chart === null || chart === void 0 ? void 0 : chart.config) || {};
|
|
1059
1001
|
this.username = username;
|
|
1060
1002
|
const table_name = (table === null || table === void 0 ? void 0 : table.name) || '';
|
|
1061
1003
|
this.table_name = "`".concat(table_name, "`");
|
|
1062
|
-
this.userId = userId;
|
|
1063
|
-
this.userDepartmentIdsMap = userDepartmentIdsMap;
|
|
1064
1004
|
this.chart_type = (chart === null || chart === void 0 ? void 0 : (_chart$config = chart.config) === null || _chart$config === void 0 ? void 0 : _chart$config.type) || '';
|
|
1065
1005
|
|
|
1066
1006
|
// columns
|