sea-chart 1.1.93-alpha.3 → 1.1.93
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/index.js +1 -1
- package/dist/settings/widgets/data-filter/index.js +13 -19
- package/dist/utils/chart-utils/base-utils.js +7 -8
- package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +2 -2
- package/dist/utils/chart-utils/sql-statistics-utils.js +1 -0
- package/dist/utils/index.js +0 -20
- package/dist/utils/sql/column-2-sql-column.js +1 -3
- package/package.json +4 -4
package/dist/settings/index.js
CHANGED
|
@@ -107,7 +107,7 @@ const Settings = _ref => {
|
|
|
107
107
|
}
|
|
108
108
|
}, /*#__PURE__*/React.createElement(DepartmentsContext.Provider, {
|
|
109
109
|
value: {
|
|
110
|
-
departments
|
|
110
|
+
departments: departments || []
|
|
111
111
|
}
|
|
112
112
|
}, /*#__PURE__*/React.createElement(DataSettings, {
|
|
113
113
|
dataSources: dataSources,
|
|
@@ -40,21 +40,24 @@ const DataFilter = _ref => {
|
|
|
40
40
|
} = config;
|
|
41
41
|
return getTableById(tables, table_id);
|
|
42
42
|
}, [tables, chart]);
|
|
43
|
+
const {
|
|
44
|
+
config
|
|
45
|
+
} = chart;
|
|
46
|
+
const {
|
|
47
|
+
filters
|
|
48
|
+
} = config;
|
|
49
|
+
const validFilters = useMemo(() => {
|
|
50
|
+
return getValidFilters(filters, table.columns);
|
|
51
|
+
}, [filters, table]);
|
|
43
52
|
const filterMessage = useMemo(() => {
|
|
44
|
-
const {
|
|
45
|
-
config
|
|
46
|
-
} = chart;
|
|
47
|
-
const {
|
|
48
|
-
filters
|
|
49
|
-
} = config;
|
|
50
53
|
let filterMessage = intl.get('Filter');
|
|
51
|
-
if (
|
|
54
|
+
if (validFilters.length === 1) {
|
|
52
55
|
filterMessage = intl.get('1 Filter');
|
|
53
|
-
} else if (
|
|
54
|
-
filterMessage =
|
|
56
|
+
} else if (validFilters.length > 1) {
|
|
57
|
+
filterMessage = validFilters.length + ' ' + intl.get('Filters');
|
|
55
58
|
}
|
|
56
59
|
return filterMessage;
|
|
57
|
-
}, [
|
|
60
|
+
}, [validFilters]);
|
|
58
61
|
const filterConjunction = useMemo(() => {
|
|
59
62
|
const {
|
|
60
63
|
config
|
|
@@ -69,15 +72,6 @@ const DataFilter = _ref => {
|
|
|
69
72
|
'current_user_department_ids': [],
|
|
70
73
|
'current_user_department_and_sub_ids': []
|
|
71
74
|
};
|
|
72
|
-
const {
|
|
73
|
-
config
|
|
74
|
-
} = chart;
|
|
75
|
-
const {
|
|
76
|
-
filters
|
|
77
|
-
} = config;
|
|
78
|
-
const validFilters = useMemo(() => {
|
|
79
|
-
return getValidFilters(filters, table.columns);
|
|
80
|
-
}, [filters, table.columns]);
|
|
81
75
|
return /*#__PURE__*/React.createElement(FormGroup, {
|
|
82
76
|
className: "sea-chart-parameter-item"
|
|
83
77
|
}, /*#__PURE__*/React.createElement(Label, null, intl.get('Data_settings')), table ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
@@ -4,12 +4,12 @@ import dayjs from 'dayjs';
|
|
|
4
4
|
import { CellType, COLLABORATOR_COLUMN_TYPES, FORMULA_COLUMN_TYPES_MAP, FORMULA_RESULT_TYPE, getDateDisplayString, getNumberDisplayString, getOption, getPrecisionNumber, getTableById, getTableColumnByKey, isNumber, isNumericColumn, isDateColumn, sortText, sortNumber, sortDate, sortSingleSelect, sortFormula, getColumnOptions, DateUtils, getGeolocationDisplayString, getFormulaDisplayString, isArchiveView, getViewById, MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP } from 'dtable-utils';
|
|
5
5
|
import { PIE_CHART_COLORS, CHART_SUMMARY_TYPE, CHART_SUPPORT_SORT_COLUMNS, CHART_TYPE, CHART_STYLE_SETTING_KEYS, DEFAULT_LABEL_FONT_SIZE, DEFAULT_NUMBER_FORMAT_OBJECT, X_AXIS_IS_GROUPBY_COLUMN_KEY_CHART_TYPES, STYLE_COLORS, CHART_DATA_SORT_TYPE, CHART_Y_GROUP_TYPE, HORIZONTAL_BAR_CHART_TYPES, COMPLTETELESS_CHART_TYPES, CHART_STYLE_CONFIG_SETTING_KEYS, MAP_CHART_TYPES } from '../../constants';
|
|
6
6
|
import { getClientFormulaDisplayString } from '../cell-format-utils';
|
|
7
|
-
import { getKnownCollaboratorByEmail, generateDefaultUser } from '../collaborator-utils';
|
|
7
|
+
import { getKnownCollaboratorByEmail, generateDefaultUser, getUsers } from '../collaborator-utils';
|
|
8
8
|
import { getDateColumnFormat, getColumnByKey } from '../column-utils';
|
|
9
9
|
import intl from '../../intl';
|
|
10
10
|
import context from '../../context';
|
|
11
11
|
import { isValidCollaboratorEmail } from '../collaborator';
|
|
12
|
-
import { formatRowTotal
|
|
12
|
+
import { formatRowTotal } from '../index';
|
|
13
13
|
export function findIfColumnDataIsArray(column) {
|
|
14
14
|
// link-formula may also be an array type column
|
|
15
15
|
let isGroupbyColumnDataAsAnArray = !!MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP[column.type];
|
|
@@ -1180,11 +1180,11 @@ BaseUtils.getGroupLabel = (cellValue, formulaRow, column, dateGranularity, geoGr
|
|
|
1180
1180
|
if (!dateGranularity) {
|
|
1181
1181
|
return getDateDisplayString(cellValue);
|
|
1182
1182
|
}
|
|
1183
|
-
const firstDayOfWeek = getFirstDayOfWeekForGroupby('base');
|
|
1184
1183
|
if (dateGranularity.toUpperCase() === 'QUARTER') {
|
|
1185
|
-
|
|
1184
|
+
// TODO: fix the unknown word 'QUARTAR'
|
|
1185
|
+
return DateUtils.getDateByGranularity(cellValue, 'QUARTAR');
|
|
1186
1186
|
}
|
|
1187
|
-
return DateUtils.getDateByGranularity(cellValue, dateGranularity
|
|
1187
|
+
return DateUtils.getDateByGranularity(cellValue, dateGranularity);
|
|
1188
1188
|
}
|
|
1189
1189
|
case CellType.MULTIPLE_SELECT:
|
|
1190
1190
|
{
|
|
@@ -1218,9 +1218,8 @@ BaseUtils.getGroupLabel = (cellValue, formulaRow, column, dateGranularity, geoGr
|
|
|
1218
1218
|
if (array_type === 'date' && (formulaCellValue === null || formulaCellValue === void 0 ? void 0 : formulaCellValue.length) === 1) {
|
|
1219
1219
|
const dateCellValue = formulaCellValue[0];
|
|
1220
1220
|
if (!dateGranularity) return getDateDisplayString(dateCellValue);
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
return DateUtils.getDateByGranularity(dateCellValue, dateGranularity, firstDayOfWeek);
|
|
1221
|
+
if (dateGranularity.toUpperCase() === 'QUARTER') return DateUtils.getDateByGranularity(dateCellValue, 'QUARTAR');
|
|
1222
|
+
return DateUtils.getDateByGranularity(dateCellValue, dateGranularity);
|
|
1224
1223
|
}
|
|
1225
1224
|
return getFormulaDisplayString(formulaCellValue, data, {
|
|
1226
1225
|
tables: value.tables
|
|
@@ -182,7 +182,7 @@ async function calculateGroupingChart(chart, value, _ref2) {
|
|
|
182
182
|
});
|
|
183
183
|
return results;
|
|
184
184
|
}
|
|
185
|
-
function getGroupChartStatResult(table, value, groupbyColumn, groupColumnKey, statRows, formulaRows, includeEmpty, groupbyDateGranularity, groupbyGeolocationGranularity,
|
|
185
|
+
function getGroupChartStatResult(table, value, groupbyColumn, groupColumnKey, statRows, formulaRows, includeEmpty, groupbyDateGranularity, groupbyGeolocationGranularity, columnGroupbyGateGranularity, columnGroupbyGeolocationGranularity, summaryColumn, summaryType, summaryMethod, columnGroupbyMultipleNumericColumn, yAxisType) {
|
|
186
186
|
let columnGroupbyColumn = getTableColumnByKey(table, groupColumnKey);
|
|
187
187
|
if (!columnGroupbyColumn) {
|
|
188
188
|
return [];
|
|
@@ -199,7 +199,7 @@ function getGroupChartStatResult(table, value, groupbyColumn, groupColumnKey, st
|
|
|
199
199
|
let name = BaseUtils.getGroupLabel(row[groupbyColumn.key], formulaRow, groupbyColumn, groupbyDateGranularity, groupbyGeolocationGranularity, value);
|
|
200
200
|
let groupName = columnGroupbyColumn.name;
|
|
201
201
|
if (!columnGroupbyMultipleNumericColumn) {
|
|
202
|
-
groupName = BaseUtils.getGroupLabel(row[columnGroupbyColumn.key], formulaRow, columnGroupbyColumn,
|
|
202
|
+
groupName = BaseUtils.getGroupLabel(row[columnGroupbyColumn.key], formulaRow, columnGroupbyColumn, columnGroupbyGateGranularity, columnGroupbyGeolocationGranularity, value);
|
|
203
203
|
}
|
|
204
204
|
if (isGroupbyColumnDataAsAnArray) {
|
|
205
205
|
if (name.length === 0 && includeEmpty) {
|
package/dist/utils/index.js
CHANGED
|
@@ -230,24 +230,4 @@ export const getEventClassName = e => {
|
|
|
230
230
|
if (!e || !e.target) return '';
|
|
231
231
|
return e.target.getAttribute('class') || '';
|
|
232
232
|
};
|
|
233
|
-
export const getFirstDayOfWeekForGroupby = source => {
|
|
234
|
-
let firstDayOfWeek = 'Monday';
|
|
235
|
-
if (source === 'base') {
|
|
236
|
-
const {
|
|
237
|
-
settings
|
|
238
|
-
} = window.app.state.value;
|
|
239
|
-
const {
|
|
240
|
-
date_settings
|
|
241
|
-
} = settings || {};
|
|
242
|
-
firstDayOfWeek = date_settings === null || date_settings === void 0 ? void 0 : date_settings.first_day_of_week;
|
|
243
|
-
} else if (source === 'app') {
|
|
244
|
-
var _window$app, _window$app$dtableUti;
|
|
245
|
-
const dtableSettings = (_window$app = window.app) === null || _window$app === void 0 ? void 0 : (_window$app$dtableUti = _window$app.dtableUtils) === null || _window$app$dtableUti === void 0 ? void 0 : _window$app$dtableUti.settings;
|
|
246
|
-
const {
|
|
247
|
-
date_settings
|
|
248
|
-
} = dtableSettings || {};
|
|
249
|
-
firstDayOfWeek = date_settings === null || date_settings === void 0 ? void 0 : date_settings.first_day_of_week;
|
|
250
|
-
}
|
|
251
|
-
return firstDayOfWeek;
|
|
252
|
-
};
|
|
253
233
|
export { ObjectUtils, chartColumn2SqlColumn, summaryMethodColumn2SqlColumn, ChartUtils, ChartDataSQL, BaseUtils };
|
|
@@ -4,7 +4,6 @@ import BaseUtils from '../chart-utils/base-utils';
|
|
|
4
4
|
import { fixGeoGranularity } from '../map';
|
|
5
5
|
import { getSqlGroup } from '../column-utils';
|
|
6
6
|
import intl from '../../intl';
|
|
7
|
-
import { getFirstDayOfWeekForGroupby } from '../index';
|
|
8
7
|
export const column2SqlColumn = function (column) {
|
|
9
8
|
let {
|
|
10
9
|
dateGranularity,
|
|
@@ -16,7 +15,6 @@ export const column2SqlColumn = function (column) {
|
|
|
16
15
|
key
|
|
17
16
|
} = column;
|
|
18
17
|
const validColumnName = `\`${name}\``;
|
|
19
|
-
const startOfWeek = getFirstDayOfWeekForGroupby('app').toLowerCase();
|
|
20
18
|
switch (type) {
|
|
21
19
|
case CellType.DATE:
|
|
22
20
|
case CellType.MTIME:
|
|
@@ -31,7 +29,7 @@ export const column2SqlColumn = function (column) {
|
|
|
31
29
|
};
|
|
32
30
|
}
|
|
33
31
|
if (validDateGranularity === 'WEEK') {
|
|
34
|
-
const sqlColumnName = `ISODATE(STARTOFWEEK(${validColumnName}, "
|
|
32
|
+
const sqlColumnName = `ISODATE(STARTOFWEEK(${validColumnName}, "monday"))`;
|
|
35
33
|
return {
|
|
36
34
|
name: sqlColumnName,
|
|
37
35
|
key: sqlColumnName
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sea-chart",
|
|
3
|
-
"version": "1.1.93
|
|
3
|
+
"version": "1.1.93",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@antv/data-set": "0.11.8",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@antv/scale": "0.3.14",
|
|
26
|
-
"dtable-ui-component": "^6.0.
|
|
27
|
-
"dtable-utils": "
|
|
26
|
+
"dtable-ui-component": "^6.0.43",
|
|
27
|
+
"dtable-utils": "~5.0.*",
|
|
28
28
|
"prop-types": "15.8.1",
|
|
29
29
|
"react": "^18.3.1",
|
|
30
30
|
"react-dom": "^18.3.1"
|
|
@@ -143,9 +143,9 @@
|
|
|
143
143
|
"resolve": "1.12.0",
|
|
144
144
|
"resolve-url-loader": "5.0.0",
|
|
145
145
|
"rimraf": "^5.0.7",
|
|
146
|
+
"svgo-loader": "^3.0.0",
|
|
146
147
|
"sass-loader": "13.3.2",
|
|
147
148
|
"style-loader": "^1.0.1",
|
|
148
|
-
"svgo-loader": "^3.0.0",
|
|
149
149
|
"terser-webpack-plugin": "4.2.3",
|
|
150
150
|
"ts-pnp": "1.1.4",
|
|
151
151
|
"url-loader": "4.1.1",
|