sea-chart 0.0.68 → 0.0.69
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/components/row-card/row-card-item.js +7 -2
- package/dist/components/row-card/row-card.css +4 -0
- package/dist/components/row-card/row-card.js +1 -0
- package/dist/components/statistic-record-dialog/index.js +33 -15
- package/dist/constants/index.js +1 -1
- package/dist/context.js +4 -0
- package/dist/settings/table-settings/data-settings.js +6 -0
- package/dist/settings/widgets/title-settings/index.js +4 -4
- package/dist/utils/chart-utils/base-utils.js +2 -0
- package/dist/utils/chart-utils/sql-statistics-utils.js +3 -1
- package/dist/utils/row-record-utils.js +2 -1
- package/dist/view/index.css +1 -1
- package/dist/view/wrapper/index.js +2 -1
- package/dist/view/wrapper/table/index.css +9 -2
- package/dist/view/wrapper/table/two-dimension-table.js +24 -7
- package/package.json +1 -1
|
@@ -22,7 +22,8 @@ class RowCardItem extends PureComponent {
|
|
|
22
22
|
rowCardType,
|
|
23
23
|
isExpandRowDetail,
|
|
24
24
|
row,
|
|
25
|
-
table
|
|
25
|
+
table,
|
|
26
|
+
formulaRows
|
|
26
27
|
} = this.props;
|
|
27
28
|
if (rowCardType !== 'link') {
|
|
28
29
|
var _window, _window$app;
|
|
@@ -31,7 +32,11 @@ class RowCardItem extends PureComponent {
|
|
|
31
32
|
window.app.expandRow(row, table);
|
|
32
33
|
} else {
|
|
33
34
|
// row card detail opened by module (universal-app)
|
|
34
|
-
|
|
35
|
+
EventBus.dispatch(EXTERNAL_EVENT.SHOW_ROW_DETAIL_DIALOG, {
|
|
36
|
+
row,
|
|
37
|
+
table,
|
|
38
|
+
formulaRows
|
|
39
|
+
});
|
|
35
40
|
}
|
|
36
41
|
}
|
|
37
42
|
};
|
|
@@ -264,6 +264,10 @@
|
|
|
264
264
|
border-radius: 3px;
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
+
.row-card-item-content .row-cell-value .sea-chart-statistic-record-formula-container {
|
|
268
|
+
text-align: left !important;
|
|
269
|
+
}
|
|
270
|
+
|
|
267
271
|
.image-cell-value .cell-value-size {
|
|
268
272
|
position: absolute;
|
|
269
273
|
bottom: -2px;
|
|
@@ -226,6 +226,7 @@ class RowCard extends Component {
|
|
|
226
226
|
isAdditionEditorView: isAdditionEditorView,
|
|
227
227
|
isHighlightRow: highlightRowIndex === rowIdx,
|
|
228
228
|
formulaRow: formulaRow,
|
|
229
|
+
formulaRows: formulaRows,
|
|
229
230
|
displayRowName: displayRowName,
|
|
230
231
|
rowIdx: rowIdx,
|
|
231
232
|
columns: columns,
|
|
@@ -31,7 +31,8 @@ class StatisticRecordDialog extends React.Component {
|
|
|
31
31
|
} = statisticRecord || {};
|
|
32
32
|
const {
|
|
33
33
|
table_id,
|
|
34
|
-
view_id
|
|
34
|
+
view_id,
|
|
35
|
+
filters
|
|
35
36
|
} = chart.config;
|
|
36
37
|
this.table = getTableById(tables, table_id);
|
|
37
38
|
if (view_id) {
|
|
@@ -41,7 +42,26 @@ class StatisticRecordDialog extends React.Component {
|
|
|
41
42
|
this.unShowColumnKeyList = this.getUnShowColumnKeyList(this.view);
|
|
42
43
|
this.renderedColumns = this.getRenderedColumns(this.table);
|
|
43
44
|
if (this.isArchiveView || !isCalculateByView || statisticRecord.isQueryBySql) {
|
|
44
|
-
var _context$api;
|
|
45
|
+
var _context$api, _context$api2;
|
|
46
|
+
if ((_context$api = context.api) === null || _context$api === void 0 ? void 0 : _context$api.customQueryRows) {
|
|
47
|
+
const newFilters = (filters === null || filters === void 0 ? void 0 : filters.map(item => {
|
|
48
|
+
return {
|
|
49
|
+
...item,
|
|
50
|
+
column_key: (item === null || item === void 0 ? void 0 : item.column_key) || '',
|
|
51
|
+
value: (item === null || item === void 0 ? void 0 : item.filter_term) || ''
|
|
52
|
+
};
|
|
53
|
+
})) || [];
|
|
54
|
+
const detailFilterConditions = {
|
|
55
|
+
filters: newFilters
|
|
56
|
+
};
|
|
57
|
+
context.api.customQueryRows(detailFilterConditions).then(res => {
|
|
58
|
+
const {
|
|
59
|
+
results: rows
|
|
60
|
+
} = res.data;
|
|
61
|
+
this.processDrilledRows(rows);
|
|
62
|
+
}).catch(error => new Error(error));
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
45
65
|
const chartDataSQL = new ChartDataSQL({
|
|
46
66
|
table: this.table,
|
|
47
67
|
chart,
|
|
@@ -51,7 +71,7 @@ class StatisticRecordDialog extends React.Component {
|
|
|
51
71
|
isColumn,
|
|
52
72
|
isRow
|
|
53
73
|
});
|
|
54
|
-
((_context$
|
|
74
|
+
((_context$api2 = context.api) === null || _context$api2 === void 0 ? void 0 : _context$api2.sqlQuery) && context.api.sqlQuery(sqlString).then(res => {
|
|
55
75
|
const {
|
|
56
76
|
results: rows
|
|
57
77
|
} = res.data;
|
|
@@ -97,24 +117,22 @@ class StatisticRecordDialog extends React.Component {
|
|
|
97
117
|
});
|
|
98
118
|
};
|
|
99
119
|
this.initComputedProperties = drilledRows => {
|
|
100
|
-
if (this.isArchiveView) {
|
|
101
|
-
const formulaColumns = getFormulaColumnsContainLinks(this.table);
|
|
102
|
-
if (formulaColumns.length === 0) return {};
|
|
103
|
-
let formulaRows = {};
|
|
104
|
-
drilledRows.forEach(row => {
|
|
105
|
-
const rowId = row._id;
|
|
106
|
-
formulaRows[rowId] = {};
|
|
107
|
-
formulaColumns.forEach(column => formulaRows[rowId][column.key] = row[column.key]);
|
|
108
|
-
});
|
|
109
|
-
this.formulaRows = formulaRows;
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
120
|
if (this.view) {
|
|
113
121
|
const {
|
|
114
122
|
formulaRows
|
|
115
123
|
} = this.getTableViewFormulaRows();
|
|
116
124
|
this.formulaRows = formulaRows;
|
|
125
|
+
return;
|
|
117
126
|
}
|
|
127
|
+
const formulaColumns = getFormulaColumnsContainLinks(this.table);
|
|
128
|
+
if (formulaColumns.length === 0) return {};
|
|
129
|
+
let formulaRows = {};
|
|
130
|
+
drilledRows.forEach(row => {
|
|
131
|
+
const rowId = row._id;
|
|
132
|
+
formulaRows[rowId] = {};
|
|
133
|
+
formulaColumns.forEach(column => formulaRows[rowId][column.key] = row[column.key]);
|
|
134
|
+
});
|
|
135
|
+
this.formulaRows = formulaRows;
|
|
118
136
|
};
|
|
119
137
|
this.onSearch = searchVal => {
|
|
120
138
|
const {
|
package/dist/constants/index.js
CHANGED
|
@@ -198,7 +198,7 @@ export const LEGEND_DIRECTION = {
|
|
|
198
198
|
export const MIRROR_COLUMN_LIST = [CellType.TEXT, CellType.NUMBER, CellType.CTIME, CellType.MTIME, CellType.DATE, CellType.COLLABORATOR, CellType.AUTO_NUMBER, CellType.FORMULA, CellType.GEOLOCATION, CellType.URL, CellType.SINGLE_SELECT, CellType.LINK, CellType.CREATOR, CellType.LAST_MODIFIER, CellType.DURATION, CellType.EMAIL];
|
|
199
199
|
export const CHART_SUPPORT_FONT_WEIGHTS = [400, 700];
|
|
200
200
|
export const DEFAULT_CHART_FONT_WEIGHT = CHART_SUPPORT_FONT_WEIGHTS[1];
|
|
201
|
-
export const
|
|
201
|
+
export const DEFAULT_TREND_CHART_TITLE_FONT_SIZE = 16;
|
|
202
202
|
export const DEFAULT_CHART_TITLE_FONT_SIZE = 18;
|
|
203
203
|
export const DEFAULT_CHART_TITLE_FONT_COLOR = '#212529';
|
|
204
204
|
export const CHART_SETTINGS_TYPE = {
|
package/dist/context.js
CHANGED
|
@@ -20,8 +20,12 @@ class Context {
|
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
const table = getTableById(tables, chart.config.table_id);
|
|
23
|
+
|
|
24
|
+
// use default view here
|
|
25
|
+
const defaultView = table.views.find(view => view._id === '0000');
|
|
23
26
|
const chartDataSQL = new ChartDataSQL({
|
|
24
27
|
table,
|
|
28
|
+
view: defaultView,
|
|
25
29
|
chart
|
|
26
30
|
});
|
|
27
31
|
const {
|
|
@@ -254,6 +254,12 @@ const DataSettings = _ref => {
|
|
|
254
254
|
summary_type = CHART_SUMMARY_TYPE.ADVANCED;
|
|
255
255
|
column_groupby_multiple_numeric_column = true;
|
|
256
256
|
summary_columns = [];
|
|
257
|
+
if (numericColumns && numericColumns[0]) {
|
|
258
|
+
summary_columns.push({
|
|
259
|
+
column_key: numericColumns[0].key,
|
|
260
|
+
summary_method: BaseUtils.isDateSummaryColumn(numericColumns[0]) ? CHART_DATE_SUMMARY_CALCULATION_METHOD[0] : CHART_SUMMARY_CALCULATION_METHOD[0]
|
|
261
|
+
});
|
|
262
|
+
}
|
|
257
263
|
// column_groupby_column_key = null;
|
|
258
264
|
// column_groupby_date_granularity = null;
|
|
259
265
|
// column_groupby_geolocation_granularity = null;
|
|
@@ -4,7 +4,7 @@ import { Label } from 'reactstrap';
|
|
|
4
4
|
import { settingsContext } from '../../../utils/contexts';
|
|
5
5
|
import { FontSizeSettings, FontWeightSettings, FontColorSettings } from '../font-settings';
|
|
6
6
|
import TextHorizontalSettings from '../text-horizontal-settings';
|
|
7
|
-
import { DEFAULT_CHART_FONT_WEIGHT, DEFAULT_CHART_TITLE_FONT_SIZE, CHART_SUPPORT_FONT_WEIGHTS, HORIZONTAL_ALIGN, DEFAULT_CHART_TITLE_FONT_COLOR,
|
|
7
|
+
import { DEFAULT_CHART_FONT_WEIGHT, DEFAULT_CHART_TITLE_FONT_SIZE, CHART_SUPPORT_FONT_WEIGHTS, HORIZONTAL_ALIGN, DEFAULT_CHART_TITLE_FONT_COLOR, DEFAULT_TREND_CHART_TITLE_FONT_SIZE, CHART_TYPE } from '../../../constants';
|
|
8
8
|
import intl from '../../../intl';
|
|
9
9
|
import TitleText from './title-text';
|
|
10
10
|
const TitleSetting = props => {
|
|
@@ -55,9 +55,9 @@ const TitleSetting = props => {
|
|
|
55
55
|
const isCard = props.type === CHART_TYPE.TREND || props.type === CHART_TYPE.BASIC_NUMBER_CARD;
|
|
56
56
|
|
|
57
57
|
// if no text then set trend default font size to 16 and font_weight to 400
|
|
58
|
-
if (isCard && !initialTitle.
|
|
58
|
+
if (isCard && !initialTitle.text) {
|
|
59
59
|
initialTitle.font_weight = CHART_SUPPORT_FONT_WEIGHTS[0];
|
|
60
|
-
initialTitle.font_size =
|
|
60
|
+
initialTitle.font_size = DEFAULT_TREND_CHART_TITLE_FONT_SIZE;
|
|
61
61
|
}
|
|
62
62
|
const getChildren = () => {
|
|
63
63
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TitleText, {
|
|
@@ -66,7 +66,7 @@ const TitleSetting = props => {
|
|
|
66
66
|
}), /*#__PURE__*/React.createElement(FontSizeSettings, {
|
|
67
67
|
className: 'mt-3',
|
|
68
68
|
fontSize: initialTitle.font_size,
|
|
69
|
-
defaultFontSize: isCard ?
|
|
69
|
+
defaultFontSize: isCard ? DEFAULT_TREND_CHART_TITLE_FONT_SIZE : DEFAULT_CHART_TITLE_FONT_SIZE,
|
|
70
70
|
modifyFontSize: modifyFontSize
|
|
71
71
|
}), /*#__PURE__*/React.createElement(FontWeightSettings, {
|
|
72
72
|
className: 'mt-3',
|
|
@@ -646,7 +646,9 @@ SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
646
646
|
pivot_table_total, chart);
|
|
647
647
|
BaseUtils.sortCharts(pivot_rows, groupbyColumn, 'name');
|
|
648
648
|
BaseUtils.sortCharts(pivot_columns, columnGroupbyColumn, 'key');
|
|
649
|
-
|
|
649
|
+
if ((groupbyColumn === null || groupbyColumn === void 0 ? void 0 : groupbyColumn.type) === CellType.COLLABORATOR) {
|
|
650
|
+
pivot_rows = BaseUtils.mergePivotTableSameCollaborator(pivot_rows);
|
|
651
|
+
}
|
|
650
652
|
const summary_columns = [summaryColumn, ...summaryColumnsWithMethod.map(item => item.column)];
|
|
651
653
|
return {
|
|
652
654
|
summary_columns,
|
|
@@ -410,7 +410,8 @@ export const getFormattedCell = function (column, row) {
|
|
|
410
410
|
value: newValue,
|
|
411
411
|
column,
|
|
412
412
|
isCellSelected: false,
|
|
413
|
-
readOnly: true
|
|
413
|
+
readOnly: true,
|
|
414
|
+
containerClassName: 'sea-chart-statistic-record-formula-container'
|
|
414
415
|
};
|
|
415
416
|
displayValue = createColumnFormatter(type, formatterProps);
|
|
416
417
|
break;
|
package/dist/view/index.css
CHANGED
|
@@ -84,7 +84,8 @@ const Wrapper = _ref => {
|
|
|
84
84
|
return /*#__PURE__*/React.createElement(Table, Object.assign({}, baseProps, {
|
|
85
85
|
summaryColumns: summary_columns,
|
|
86
86
|
summaryMethod: summary_method,
|
|
87
|
-
chartTableColumns: chartTableColumns
|
|
87
|
+
chartTableColumns: chartTableColumns,
|
|
88
|
+
isCalculateByView: isCalculateByView
|
|
88
89
|
}));
|
|
89
90
|
}
|
|
90
91
|
case CHART_TYPE.COMBINATION:
|
|
@@ -147,8 +147,7 @@
|
|
|
147
147
|
padding: 0;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
.sea-chart-pivot-table .pivot-table-header-summary-columns-container
|
|
151
|
-
.sea-chart-pivot-table .pivot-cells-container {
|
|
150
|
+
.sea-chart-pivot-table .pivot-table-header-summary-columns-container {
|
|
152
151
|
height: 100%;
|
|
153
152
|
width: 100%;
|
|
154
153
|
overflow: hidden;
|
|
@@ -156,6 +155,14 @@
|
|
|
156
155
|
justify-content: space-between;
|
|
157
156
|
}
|
|
158
157
|
|
|
158
|
+
.sea-chart-pivot-table .pivot-cells-container {
|
|
159
|
+
height: 100%;
|
|
160
|
+
width: 100%;
|
|
161
|
+
overflow: hidden;
|
|
162
|
+
display: flex;
|
|
163
|
+
justify-content: center;
|
|
164
|
+
}
|
|
165
|
+
|
|
159
166
|
.sea-chart-pivot-table .pivot-table-header-summary-columns-container > div,
|
|
160
167
|
.sea-chart-pivot-table .pivot-cells-container > div {
|
|
161
168
|
flex:1;
|
|
@@ -126,6 +126,22 @@ class TwoDimensionTable extends PureComponent {
|
|
|
126
126
|
total
|
|
127
127
|
}, selectedCell);
|
|
128
128
|
};
|
|
129
|
+
this.renderByView = (total, display_empty, cellIdx, isSelectedCell, isSelectedCellTop, isSelectedCellLeft) => {
|
|
130
|
+
const isValidDisplayValue = BaseUtils.isValidValue(total, display_empty);
|
|
131
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
132
|
+
key: "table-cell-".concat(cellIdx),
|
|
133
|
+
className: classnames('pivot-cell', {
|
|
134
|
+
'pivot-empty-cell': !isValidDisplayValue,
|
|
135
|
+
'selected-pivot-cell': isSelectedCell,
|
|
136
|
+
'selected-pivot-cell-top': isSelectedCellTop,
|
|
137
|
+
'selected-pivot-cell-left': isSelectedCellLeft
|
|
138
|
+
})
|
|
139
|
+
}, isValidDisplayValue ? total : /*#__PURE__*/React.createElement("i", null), /*#__PURE__*/React.createElement("span", {
|
|
140
|
+
className: classnames({
|
|
141
|
+
'selected-pivot-cell-border': isSelectedCell
|
|
142
|
+
})
|
|
143
|
+
}));
|
|
144
|
+
};
|
|
129
145
|
this.renderRows = () => {
|
|
130
146
|
const {
|
|
131
147
|
result,
|
|
@@ -133,7 +149,8 @@ class TwoDimensionTable extends PureComponent {
|
|
|
133
149
|
selectedCell,
|
|
134
150
|
summaryColumn,
|
|
135
151
|
summaryMethod,
|
|
136
|
-
chart
|
|
152
|
+
chart,
|
|
153
|
+
isCalculateByView
|
|
137
154
|
} = this.props;
|
|
138
155
|
const {
|
|
139
156
|
display_total = true,
|
|
@@ -145,7 +162,7 @@ class TwoDimensionTable extends PureComponent {
|
|
|
145
162
|
pivot_columns,
|
|
146
163
|
pivot_columns_total,
|
|
147
164
|
pivot_table_total,
|
|
148
|
-
summary_columns
|
|
165
|
+
summary_columns: summaryColumns
|
|
149
166
|
} = result;
|
|
150
167
|
const {
|
|
151
168
|
rowIdx: selectRowIdx,
|
|
@@ -232,10 +249,10 @@ class TwoDimensionTable extends PureComponent {
|
|
|
232
249
|
className: classnames('pivot-cell'),
|
|
233
250
|
key: "table-cell-".concat(cellIdx)
|
|
234
251
|
}, /*#__PURE__*/React.createElement("div", {
|
|
235
|
-
className:
|
|
236
|
-
}, total && total.map && total.map((summaryCell, idx) => {
|
|
252
|
+
className: classnames('pivot-cells-container')
|
|
253
|
+
}, !isCalculateByView && total && total.map && total.map((summaryCell, idx) => {
|
|
237
254
|
const summaryCellColumnKey = summaryCell[2];
|
|
238
|
-
const summaryCellColumn =
|
|
255
|
+
const summaryCellColumn = summaryColumns.find(item => item.key === summaryCellColumnKey);
|
|
239
256
|
const displayValue = BaseUtils.getSummaryValueDisplayString(summaryCellColumn, summaryCell[1], summaryMethod);
|
|
240
257
|
const isValidDisplayValue = BaseUtils.isValidValue(displayValue, display_empty);
|
|
241
258
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -251,14 +268,14 @@ class TwoDimensionTable extends PureComponent {
|
|
|
251
268
|
'selected-pivot-cell-border': isSelectedCell
|
|
252
269
|
})
|
|
253
270
|
}));
|
|
254
|
-
}), !total && (
|
|
271
|
+
}), !isCalculateByView && !total && (summaryColumns === null || summaryColumns === void 0 ? void 0 : summaryColumns.map(() => {
|
|
255
272
|
return /*#__PURE__*/React.createElement("div", {
|
|
256
273
|
key: "table-cell-".concat(cellIdx),
|
|
257
274
|
className: classnames('pivot-cell', {
|
|
258
275
|
'pivot-empty-cell': true
|
|
259
276
|
})
|
|
260
277
|
}, /*#__PURE__*/React.createElement("i", null));
|
|
261
|
-
}))));
|
|
278
|
+
})), isCalculateByView && this.renderByView(total, display_empty, cellIdx, isSelectedCell, isSelectedCellTop, isSelectedCellLeft)));
|
|
262
279
|
}), display_total && /*#__PURE__*/React.createElement("td", {
|
|
263
280
|
className: classnames('pivot-cell', {
|
|
264
281
|
'pivot-empty-cell': !isValidSummaryDisplayValue,
|