sea-chart 1.1.95 → 1.1.96-alpha.2
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/utils/chart-utils/base-utils.js +8 -7
- package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +2 -2
- package/dist/utils/chart-utils/sql-statistics-utils.js +0 -1
- package/dist/utils/index.js +20 -0
- package/dist/utils/sql/column-2-sql-column.js +3 -1
- package/package.json +3 -3
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
|
|
111
111
|
}
|
|
112
112
|
}, /*#__PURE__*/React.createElement(DataSettings, {
|
|
113
113
|
dataSources: dataSources,
|
|
@@ -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
|
|
7
|
+
import { getKnownCollaboratorByEmail, generateDefaultUser } 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 } from '../index';
|
|
12
|
+
import { formatRowTotal, getFirstDayOfWeekForGroupby } 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');
|
|
1183
1184
|
if (dateGranularity.toUpperCase() === 'QUARTER') {
|
|
1184
|
-
|
|
1185
|
-
return DateUtils.getDateByGranularity(cellValue, 'QUARTAR');
|
|
1185
|
+
return DateUtils.getDateByGranularity(cellValue, 'QUARTAR', firstDayOfWeek);
|
|
1186
1186
|
}
|
|
1187
|
-
return DateUtils.getDateByGranularity(cellValue, dateGranularity);
|
|
1187
|
+
return DateUtils.getDateByGranularity(cellValue, dateGranularity, firstDayOfWeek);
|
|
1188
1188
|
}
|
|
1189
1189
|
case CellType.MULTIPLE_SELECT:
|
|
1190
1190
|
{
|
|
@@ -1218,8 +1218,9 @@ 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
|
-
return DateUtils.getDateByGranularity(dateCellValue,
|
|
1221
|
+
const firstDayOfWeek = getFirstDayOfWeekForGroupby('base');
|
|
1222
|
+
if (dateGranularity.toUpperCase() === 'QUARTER') return DateUtils.getDateByGranularity(dateCellValue, 'QUARTAR', firstDayOfWeek);
|
|
1223
|
+
return DateUtils.getDateByGranularity(dateCellValue, dateGranularity, firstDayOfWeek);
|
|
1223
1224
|
}
|
|
1224
1225
|
return getFormulaDisplayString(formulaCellValue, data, {
|
|
1225
1226
|
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, columnGroupbyDateGranularity, 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, columnGroupbyDateGranularity, columnGroupbyGeolocationGranularity, value);
|
|
203
203
|
}
|
|
204
204
|
if (isGroupbyColumnDataAsAnArray) {
|
|
205
205
|
if (name.length === 0 && includeEmpty) {
|
package/dist/utils/index.js
CHANGED
|
@@ -230,4 +230,24 @@ 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
|
+
};
|
|
233
253
|
export { ObjectUtils, chartColumn2SqlColumn, summaryMethodColumn2SqlColumn, ChartUtils, ChartDataSQL, BaseUtils };
|
|
@@ -4,6 +4,7 @@ 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';
|
|
7
8
|
export const column2SqlColumn = function (column) {
|
|
8
9
|
let {
|
|
9
10
|
dateGranularity,
|
|
@@ -15,6 +16,7 @@ export const column2SqlColumn = function (column) {
|
|
|
15
16
|
key
|
|
16
17
|
} = column;
|
|
17
18
|
const validColumnName = `\`${name}\``;
|
|
19
|
+
const startOfWeek = getFirstDayOfWeekForGroupby('app').toLowerCase();
|
|
18
20
|
switch (type) {
|
|
19
21
|
case CellType.DATE:
|
|
20
22
|
case CellType.MTIME:
|
|
@@ -29,7 +31,7 @@ export const column2SqlColumn = function (column) {
|
|
|
29
31
|
};
|
|
30
32
|
}
|
|
31
33
|
if (validDateGranularity === 'WEEK') {
|
|
32
|
-
const sqlColumnName = `ISODATE(STARTOFWEEK(${validColumnName}, "
|
|
34
|
+
const sqlColumnName = `ISODATE(STARTOFWEEK(${validColumnName}, "${startOfWeek}"))`;
|
|
33
35
|
return {
|
|
34
36
|
name: sqlColumnName,
|
|
35
37
|
key: sqlColumnName
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sea-chart",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.96-alpha.2",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@antv/data-set": "0.11.8",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@antv/scale": "0.3.14",
|
|
26
26
|
"dtable-ui-component": "^6.0.46",
|
|
27
|
-
"dtable-utils": "
|
|
27
|
+
"dtable-utils": "^5.0.22-alpha.2",
|
|
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",
|
|
147
146
|
"sass-loader": "13.3.2",
|
|
148
147
|
"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",
|