@seafile/sdoc-editor 0.3.24 → 0.3.26-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/api/seafile-api.js +20 -0
- package/dist/basic-sdk/editor/sdoc-editor.js +20 -2
- package/dist/basic-sdk/extension/constants/element-type.js +1 -0
- package/dist/basic-sdk/extension/constants/index.js +2 -2
- package/dist/basic-sdk/extension/constants/menus-config.js +6 -1
- package/dist/basic-sdk/extension/core/utils/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/chart/chart-components/base-setting/index.js +46 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/chart-type-setting/index.css +29 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/chart-type-setting/index.js +23 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/common-settings/column-setting.js +119 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/common-settings/data-sort-setting.js +54 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/common-settings/date-granularities.js +55 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/common-settings/dtable-select-setting.js +86 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/common-settings/geolocation-granularities.js +97 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/common-settings/groupby-numeric-item.js +108 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/common-settings/groupby-numeric-items.js +87 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/common-settings/include-empty-setting.js +35 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/common-settings/summary-field-setting.js +64 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/common-settings/summary-method-setting.js +61 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/common-settings/summary-type-setting.js +74 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/common-settings/x-axis-group-setting.js +108 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/common-settings/y-axis-group-settings.js +182 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/seatable-radio/index.js +28 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/seatable-radio/style.css +52 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/table-setting/index.js +46 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/toggle-setting/index.js +27 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/toggle-setting/style.css +29 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-edit-dialog/index.css +22 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-edit-dialog/index.js +50 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-setting/index.css +24 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-setting/index.js +115 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-utils/common-utils/base-utils.js +349 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-utils/common-utils/dtable-utils.js +147 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-utils/histogram-bar-utils.js +84 -0
- package/dist/basic-sdk/extension/plugins/chart/constants/date-constants.js +9 -0
- package/dist/basic-sdk/extension/plugins/chart/constants/geolocation-constants.js +11 -0
- package/dist/basic-sdk/extension/plugins/chart/constants/index.js +109 -0
- package/dist/basic-sdk/extension/plugins/chart/constants/special-column-types.js +7 -0
- package/dist/basic-sdk/extension/plugins/chart/constants/summary-constants.js +18 -0
- package/dist/basic-sdk/extension/plugins/chart/helpers.js +82 -0
- package/dist/basic-sdk/extension/plugins/chart/hover-menu/index.css +55 -0
- package/dist/basic-sdk/extension/plugins/chart/hover-menu/index.js +55 -0
- package/dist/basic-sdk/extension/plugins/chart/index.js +12 -0
- package/dist/basic-sdk/extension/plugins/chart/menu/index.js +23 -0
- package/dist/basic-sdk/extension/plugins/chart/model.js +33 -0
- package/dist/basic-sdk/extension/plugins/chart/plugin.js +20 -0
- package/dist/basic-sdk/extension/plugins/chart/render-elem.css +26 -0
- package/dist/basic-sdk/extension/plugins/chart/render-elem.js +284 -0
- package/dist/basic-sdk/extension/plugins/index.js +3 -2
- package/dist/basic-sdk/extension/plugins/link/hover/index.js +3 -1
- package/dist/basic-sdk/extension/plugins/link/render-elem.js +4 -3
- package/dist/basic-sdk/extension/render/custom-element.js +10 -4
- package/dist/basic-sdk/extension/toolbar/header-toolbar/insert-toolbar/index.js +2 -1
- package/dist/basic-sdk/socket/socket-client.js +3 -0
- package/dist/components/doc-operations/more-operations.js +21 -12
- package/dist/constants/index.js +3 -0
- package/dist/context.js +40 -0
- package/package.json +7 -1
- package/public/locales/en/sdoc-editor.json +34 -1
- package/public/locales/zh_CN/sdoc-editor.json +35 -1
- package/public/media/{sdoc-editor-font.css → iconfont.css} +10 -10
- package/public/media/sdoc-editor-font/iconfont.eot +0 -0
- package/public/media/sdoc-editor-font/iconfont.svg +2 -2
- package/public/media/sdoc-editor-font/iconfont.ttf +0 -0
- package/public/media/sdoc-editor-font/iconfont.woff +0 -0
- package/public/media/sdoc-editor-font/iconfont.woff2 +0 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import React, { Component, Fragment } from 'react';
|
|
2
|
+
import SummaryTypeSettings from './summary-type-setting';
|
|
3
|
+
import SummaryFieldSetting from './summary-field-setting';
|
|
4
|
+
import GroupbyNumericItem from './groupby-numeric-item';
|
|
5
|
+
import GroupbyNumericItems from './groupby-numeric-items';
|
|
6
|
+
import { DATE_COLUMN_TYPES } from '../../constants/special-column-types';
|
|
7
|
+
import { GROUP_TYPES, SUMMARY_TYPE, SUMMARY_METHOD } from '../../constants/summary-constants';
|
|
8
|
+
class YAxisGroupSettings extends Component {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.getDefaultGroupbyColumnKey = () => {
|
|
12
|
+
const {
|
|
13
|
+
statItem,
|
|
14
|
+
columns
|
|
15
|
+
} = this.props;
|
|
16
|
+
const {
|
|
17
|
+
x_axis_column_key
|
|
18
|
+
} = statItem;
|
|
19
|
+
const validColumns = columns.filter(column => {
|
|
20
|
+
const {
|
|
21
|
+
key,
|
|
22
|
+
type
|
|
23
|
+
} = column;
|
|
24
|
+
return key !== x_axis_column_key && !['date', 'geolocation'].includes(type);
|
|
25
|
+
});
|
|
26
|
+
const groupbyColumn = validColumns[0] || {};
|
|
27
|
+
return groupbyColumn.key;
|
|
28
|
+
};
|
|
29
|
+
this.getDefaultYAxisColumnKey = () => {
|
|
30
|
+
const {
|
|
31
|
+
columns
|
|
32
|
+
} = this.props;
|
|
33
|
+
const validColumns = columns.filter(column => DATE_COLUMN_TYPES.includes(column.type));
|
|
34
|
+
return validColumns && validColumns.key;
|
|
35
|
+
};
|
|
36
|
+
this.getSummaryType = () => {
|
|
37
|
+
const {
|
|
38
|
+
statItem
|
|
39
|
+
} = this.props;
|
|
40
|
+
const {
|
|
41
|
+
y_axis_summary_type,
|
|
42
|
+
column_groupby_multiple_numeric_column
|
|
43
|
+
} = statItem || {};
|
|
44
|
+
if (column_groupby_multiple_numeric_column) {
|
|
45
|
+
return GROUP_TYPES.MULTIPLE_NUMERIC_COLUMN;
|
|
46
|
+
}
|
|
47
|
+
if (y_axis_summary_type === SUMMARY_TYPE.ADVANCED) {
|
|
48
|
+
return GROUP_TYPES.SINGLE_NUMERIC_COLUMN;
|
|
49
|
+
}
|
|
50
|
+
return GROUP_TYPES.COUNT;
|
|
51
|
+
};
|
|
52
|
+
this.updateSummaryType = setting => {
|
|
53
|
+
const value = Object.values(setting)[0];
|
|
54
|
+
const {
|
|
55
|
+
statItem
|
|
56
|
+
} = this.props;
|
|
57
|
+
const {
|
|
58
|
+
y_axis_summary_type: oldValue
|
|
59
|
+
} = statItem;
|
|
60
|
+
if (value === oldValue) return;
|
|
61
|
+
if (value === GROUP_TYPES.COUNT) {
|
|
62
|
+
const y_axis_summary_type = SUMMARY_TYPE.COUNT;
|
|
63
|
+
const column_groupby_multiple_numeric_column = false;
|
|
64
|
+
const y_axis_column_key = null;
|
|
65
|
+
const column_groupby_numeric_columns = [];
|
|
66
|
+
const column_groupby_column_key = this.getDefaultGroupbyColumnKey();
|
|
67
|
+
const column_groupby_date_granularity = null;
|
|
68
|
+
const column_groupby_geolocation_granularity = null;
|
|
69
|
+
this.props.updateSetting({
|
|
70
|
+
y_axis_summary_type,
|
|
71
|
+
column_groupby_multiple_numeric_column,
|
|
72
|
+
y_axis_column_key,
|
|
73
|
+
column_groupby_numeric_columns,
|
|
74
|
+
column_groupby_column_key,
|
|
75
|
+
column_groupby_date_granularity,
|
|
76
|
+
column_groupby_geolocation_granularity
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
if (value === GROUP_TYPES.SINGLE_NUMERIC_COLUMN) {
|
|
80
|
+
const y_axis_summary_type = SUMMARY_TYPE.ADVANCED;
|
|
81
|
+
const column_groupby_multiple_numeric_column = false;
|
|
82
|
+
const y_axis_column_key = null;
|
|
83
|
+
const y_axis_summary_method = SUMMARY_METHOD[0];
|
|
84
|
+
const column_groupby_numeric_columns = [];
|
|
85
|
+
const column_groupby_column_key = null;
|
|
86
|
+
const column_groupby_date_granularity = null;
|
|
87
|
+
const column_groupby_geolocation_granularity = null;
|
|
88
|
+
this.props.updateSetting({
|
|
89
|
+
y_axis_summary_type,
|
|
90
|
+
column_groupby_multiple_numeric_column,
|
|
91
|
+
y_axis_column_key,
|
|
92
|
+
y_axis_summary_method,
|
|
93
|
+
column_groupby_numeric_columns,
|
|
94
|
+
column_groupby_column_key,
|
|
95
|
+
column_groupby_date_granularity,
|
|
96
|
+
column_groupby_geolocation_granularity
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (value === GROUP_TYPES.MULTIPLE_NUMERIC_COLUMN) {
|
|
100
|
+
const y_axis_summary_type = SUMMARY_TYPE.ADVANCED;
|
|
101
|
+
const column_groupby_multiple_numeric_column = true;
|
|
102
|
+
const y_axis_column_key = this.getDefaultYAxisColumnKey();
|
|
103
|
+
const y_axis_summary_method = SUMMARY_METHOD[0];
|
|
104
|
+
const column_groupby_numeric_columns = [];
|
|
105
|
+
const column_groupby_column_key = null;
|
|
106
|
+
const column_groupby_date_granularity = null;
|
|
107
|
+
const column_groupby_geolocation_granularity = null;
|
|
108
|
+
this.props.updateSetting({
|
|
109
|
+
y_axis_summary_type,
|
|
110
|
+
column_groupby_multiple_numeric_column,
|
|
111
|
+
y_axis_column_key,
|
|
112
|
+
y_axis_summary_method,
|
|
113
|
+
column_groupby_numeric_columns,
|
|
114
|
+
column_groupby_column_key,
|
|
115
|
+
column_groupby_date_granularity,
|
|
116
|
+
column_groupby_geolocation_granularity
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
this.updateGroupBySetting = setting => {
|
|
121
|
+
const key = Object.keys(setting)[0];
|
|
122
|
+
if (key === 'column_key') {
|
|
123
|
+
const newSetting = {
|
|
124
|
+
y_axis_column_key: setting[key]
|
|
125
|
+
};
|
|
126
|
+
this.props.updateSetting(newSetting);
|
|
127
|
+
}
|
|
128
|
+
if (key === 'summary_method') {
|
|
129
|
+
const newSetting = {
|
|
130
|
+
y_axis_summary_method: setting[key]
|
|
131
|
+
};
|
|
132
|
+
this.props.updateSetting(newSetting);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
this.updateSetting = setting => {
|
|
136
|
+
this.props.updateSetting(setting);
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
render() {
|
|
140
|
+
const {
|
|
141
|
+
label,
|
|
142
|
+
statItem,
|
|
143
|
+
supportSummaryTypes
|
|
144
|
+
} = this.props;
|
|
145
|
+
const {
|
|
146
|
+
y_axis_summary_type = GROUP_TYPES.COUNT,
|
|
147
|
+
y_axis_column_key,
|
|
148
|
+
y_axis_summary_method,
|
|
149
|
+
column_groupby_multiple_numeric_column,
|
|
150
|
+
column_groupby_numeric_columns
|
|
151
|
+
} = statItem || {};
|
|
152
|
+
const summaryType = this.getSummaryType();
|
|
153
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
154
|
+
className: "sdoc-chart-setting-item"
|
|
155
|
+
}, /*#__PURE__*/React.createElement("label", null, label), /*#__PURE__*/React.createElement(SummaryTypeSettings, {
|
|
156
|
+
settingValue: summaryType,
|
|
157
|
+
supportSummaryTypes: supportSummaryTypes,
|
|
158
|
+
updateSetting: this.updateSummaryType
|
|
159
|
+
}), y_axis_summary_type === SUMMARY_TYPE.ADVANCED && !column_groupby_multiple_numeric_column && /*#__PURE__*/React.createElement(SummaryFieldSetting, {
|
|
160
|
+
summarySingle: column_groupby_multiple_numeric_column,
|
|
161
|
+
columns: this.props.columns,
|
|
162
|
+
summaryColumnSettingKey: 'y_axis_column_key',
|
|
163
|
+
summaryColumnKey: y_axis_column_key,
|
|
164
|
+
summaryMethodSettingKey: 'y_axis_summary_method',
|
|
165
|
+
summaryMethod: y_axis_summary_method,
|
|
166
|
+
updateSetting: this.updateSetting
|
|
167
|
+
}), column_groupby_multiple_numeric_column && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(GroupbyNumericItem, {
|
|
168
|
+
index: 0,
|
|
169
|
+
columns: this.props.columns,
|
|
170
|
+
groupbyNumericItem: {
|
|
171
|
+
column_key: y_axis_column_key,
|
|
172
|
+
summary_method: y_axis_summary_method
|
|
173
|
+
},
|
|
174
|
+
updateGroupBySetting: this.updateGroupBySetting
|
|
175
|
+
}), /*#__PURE__*/React.createElement(GroupbyNumericItems, {
|
|
176
|
+
columns: this.props.columns,
|
|
177
|
+
groupbyNumericItems: column_groupby_numeric_columns,
|
|
178
|
+
updateSetting: this.updateSetting
|
|
179
|
+
})));
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
export default YAxisGroupSettings;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import './style.css';
|
|
4
|
+
function SeaTableRadio(props) {
|
|
5
|
+
return /*#__PURE__*/React.createElement("label", {
|
|
6
|
+
className: "seatable-radio"
|
|
7
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
8
|
+
type: "radio",
|
|
9
|
+
className: "seatable-radio-input",
|
|
10
|
+
checked: props.isChecked,
|
|
11
|
+
onChange: props.disabled ? () => {} : props.onCheckedChange,
|
|
12
|
+
name: props.name,
|
|
13
|
+
value: props.value
|
|
14
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
15
|
+
className: classnames('seatable-radio-indicator', {
|
|
16
|
+
'seatable-radio-selected-indicator': props.isChecked,
|
|
17
|
+
'seatable-radio-disable': props.disabled
|
|
18
|
+
})
|
|
19
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
20
|
+
className: "seatable-radio-description text-truncate"
|
|
21
|
+
}, props.label));
|
|
22
|
+
}
|
|
23
|
+
SeaTableRadio.defaultProps = {
|
|
24
|
+
disabled: false,
|
|
25
|
+
name: 'seatable-radio-input',
|
|
26
|
+
onCheckedChange: () => {}
|
|
27
|
+
};
|
|
28
|
+
export default SeaTableRadio;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
.seatable-radio {
|
|
2
|
+
user-select: none;
|
|
3
|
+
cursor: default;
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
margin: 0;
|
|
7
|
+
font-size: 14px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.seatable-radio .seatable-radio-input {
|
|
11
|
+
position: absolute;
|
|
12
|
+
z-index: -1;
|
|
13
|
+
opacity: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.seatable-radio .seatable-radio-indicator {
|
|
17
|
+
display: inline-block;
|
|
18
|
+
width: 16px;
|
|
19
|
+
height: 16px;
|
|
20
|
+
border-radius: 50%;
|
|
21
|
+
background-color: #ffffff;
|
|
22
|
+
border: 1px solid #bdbdbd;
|
|
23
|
+
position: relative;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.seatable-radio .seatable-radio-selected-indicator {
|
|
27
|
+
background-color: #FF8000;
|
|
28
|
+
border: unset !important;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.seatable-radio .seatable-radio-selected-indicator::before {
|
|
32
|
+
display: inline-block;
|
|
33
|
+
content: '';
|
|
34
|
+
width: 6px;
|
|
35
|
+
height: 6px;
|
|
36
|
+
background-color: #ffffff;
|
|
37
|
+
position: absolute;
|
|
38
|
+
left: 5px;
|
|
39
|
+
top: 5px;
|
|
40
|
+
border-radius: 50%;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.seatable-radio .seatable-radio-disable {
|
|
44
|
+
background-color: #f5f5f5;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.seatable-radio .seatable-radio-description {
|
|
48
|
+
margin-left: .5rem;
|
|
49
|
+
color: inherit;
|
|
50
|
+
transition: .3s color;
|
|
51
|
+
line-height: 16px;
|
|
52
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { withTranslation } from 'react-i18next';
|
|
3
|
+
import DtableSelect from '../common-settings/dtable-select-setting';
|
|
4
|
+
const TableSetting = _ref => {
|
|
5
|
+
let {
|
|
6
|
+
tables,
|
|
7
|
+
activeTableId,
|
|
8
|
+
onSelectedTableChanged,
|
|
9
|
+
t
|
|
10
|
+
} = _ref;
|
|
11
|
+
const getTablesOptions = useCallback(() => {
|
|
12
|
+
return Array.isArray(tables) && tables.map(table => {
|
|
13
|
+
return {
|
|
14
|
+
label: /*#__PURE__*/React.createElement("span", {
|
|
15
|
+
className: "select-option-name"
|
|
16
|
+
}, table.name),
|
|
17
|
+
value: {
|
|
18
|
+
name: table.name,
|
|
19
|
+
id: table._id
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
}, [tables]);
|
|
24
|
+
const getActiveTableOption = useCallback(() => {
|
|
25
|
+
if (!activeTableId) return null;
|
|
26
|
+
const tablesOptions = getTablesOptions();
|
|
27
|
+
return tablesOptions.find(option => {
|
|
28
|
+
const {
|
|
29
|
+
id
|
|
30
|
+
} = option.value;
|
|
31
|
+
return activeTableId === id;
|
|
32
|
+
});
|
|
33
|
+
}, [activeTableId, getTablesOptions]);
|
|
34
|
+
const activeTableOption = getActiveTableOption();
|
|
35
|
+
const tablesOptions = getTablesOptions();
|
|
36
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
className: "sdoc-chart-setting-item"
|
|
38
|
+
}, /*#__PURE__*/React.createElement("label", null, t('Table')), /*#__PURE__*/React.createElement(DtableSelect, {
|
|
39
|
+
value: activeTableOption,
|
|
40
|
+
options: tablesOptions,
|
|
41
|
+
onChange: option => {
|
|
42
|
+
onSelectedTableChanged(option);
|
|
43
|
+
}
|
|
44
|
+
}));
|
|
45
|
+
};
|
|
46
|
+
export default withTranslation('sdoc-editor')(TableSetting);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import './style.css';
|
|
3
|
+
class ToggleSetting extends Component {
|
|
4
|
+
render() {
|
|
5
|
+
const {
|
|
6
|
+
handleToggleChange,
|
|
7
|
+
isChecked,
|
|
8
|
+
label
|
|
9
|
+
} = this.props;
|
|
10
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
11
|
+
className: "big-screen statistic-toggle-parameter"
|
|
12
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
13
|
+
className: "custom-switch"
|
|
14
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
15
|
+
type: "checkbox",
|
|
16
|
+
className: "custom-switch-input",
|
|
17
|
+
checked: isChecked,
|
|
18
|
+
onChange: handleToggleChange,
|
|
19
|
+
name: "custom-switch-checkbox"
|
|
20
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
21
|
+
className: "custom-switch-indicator"
|
|
22
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
23
|
+
className: "custom-switch-description text-truncate"
|
|
24
|
+
}, label)));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export default ToggleSetting;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
.big-screen.statistic-toggle-parameter {
|
|
2
|
+
height: 36px;
|
|
3
|
+
padding-left: 8px;
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
font-size: 14px;
|
|
6
|
+
background-color: #fff;
|
|
7
|
+
display: flex;
|
|
8
|
+
border-radius: 4px;
|
|
9
|
+
border: 1px solid hsl(0,0%,80%);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.big-screen.statistic-toggle-parameter .custom-switch {
|
|
13
|
+
position: relative;
|
|
14
|
+
font-weight: normal;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.big-screen.statistic-toggle-parameter .custom-switch-indicator {
|
|
18
|
+
width: 22px;
|
|
19
|
+
height: 12px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.big-screen.statistic-toggle-parameter .custom-switch-indicator::before {
|
|
23
|
+
height: 8px;
|
|
24
|
+
width: 8px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.big-screen.statistic-toggle-parameter .custom-switch-input:checked ~ .custom-switch-indicator:before {
|
|
28
|
+
left: 12px;
|
|
29
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.sdoc-chart-edit-dialog {
|
|
2
|
+
max-width: 1100px;
|
|
3
|
+
width: 1100px;
|
|
4
|
+
height: calc(100% - 56px);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.sdoc-chart-edit-dialog .sdoc-chart-edit-modal-body {
|
|
8
|
+
padding: 0;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
display: flex;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.sdoc-chart-edit-dialog .sdoc-chart-edit-view {
|
|
14
|
+
max-height: 600px;
|
|
15
|
+
min-height: 400px;
|
|
16
|
+
width: 800px;
|
|
17
|
+
padding: 20px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.sdoc-chart-edit-dialog .sdoc-chart-container {
|
|
21
|
+
height: 100%;
|
|
22
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { useEffect, useState, useRef, useCallback } from 'react';
|
|
2
|
+
import { Modal, ModalHeader, ModalBody } from 'reactstrap';
|
|
3
|
+
import { withTranslation } from 'react-i18next';
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
import ChartSetting from '../chart-setting';
|
|
6
|
+
import './index.css';
|
|
7
|
+
const ChartEditDialog = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
editor,
|
|
10
|
+
element,
|
|
11
|
+
onHideEditDialog,
|
|
12
|
+
t
|
|
13
|
+
} = _ref;
|
|
14
|
+
const {
|
|
15
|
+
statItem
|
|
16
|
+
} = element;
|
|
17
|
+
const chartRef = useRef(null);
|
|
18
|
+
const isInit = useCallback(() => {
|
|
19
|
+
const {
|
|
20
|
+
base_id
|
|
21
|
+
} = statItem;
|
|
22
|
+
if (!base_id) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
}, [statItem]);
|
|
27
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
28
|
+
isOpen: true,
|
|
29
|
+
toggle: onHideEditDialog,
|
|
30
|
+
className: "sdoc-chart-edit-dialog",
|
|
31
|
+
zIndex: 1048
|
|
32
|
+
}, /*#__PURE__*/React.createElement(ModalHeader, {
|
|
33
|
+
toggle: onHideEditDialog
|
|
34
|
+
}, t('Edit_chart')), /*#__PURE__*/React.createElement(ModalBody, {
|
|
35
|
+
className: "sdoc-chart-edit-modal-body"
|
|
36
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
className: "sdoc-chart-edit-view"
|
|
38
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
className: "sdoc-chart-container"
|
|
40
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
41
|
+
className: "sdoc-chart-view",
|
|
42
|
+
ref: chartRef
|
|
43
|
+
}, isInit() && /*#__PURE__*/React.createElement("span", {
|
|
44
|
+
className: "sdoc-chart-tip"
|
|
45
|
+
}, t('Please_complete_the_chart_configuration_first'))))), /*#__PURE__*/React.createElement(ChartSetting, {
|
|
46
|
+
editor: editor,
|
|
47
|
+
element: element
|
|
48
|
+
})));
|
|
49
|
+
};
|
|
50
|
+
export default withTranslation('sdoc-editor')(ChartEditDialog);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.sdoc-chart-setting-container {
|
|
2
|
+
width: 300px;
|
|
3
|
+
height: 100%;
|
|
4
|
+
overflow-y: auto;
|
|
5
|
+
padding: 16px;
|
|
6
|
+
background-color: #fff;
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.sdoc-chart-setting-container .chart-summary-types__value-container .summary-type-explanation {
|
|
11
|
+
display: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.sdoc-chart-setting-container .sdoc-chart-setting-item {
|
|
15
|
+
padding-bottom: 14px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.sdoc-chart-setting-container .sdoc-chart-setting-item {
|
|
19
|
+
padding-bottom: 14px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.sdoc-chart-setting-container .sdoc-chart-setting-item .mt-14 {
|
|
23
|
+
margin-top: 14px;
|
|
24
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
3
|
+
import { Transforms } from '@seafile/slate';
|
|
4
|
+
import { ReactEditor } from '@seafile/slate-react';
|
|
5
|
+
import { withTranslation } from 'react-i18next';
|
|
6
|
+
import context from '../../../../../context';
|
|
7
|
+
import ChartTypeSetting from '../chart-components/chart-type-setting';
|
|
8
|
+
import BaseSetting from '../chart-components/base-setting';
|
|
9
|
+
import TableSetting from '../chart-components/table-setting';
|
|
10
|
+
import XAxisGroupSettings from '../chart-components/common-settings/x-axis-group-setting';
|
|
11
|
+
import YAxisGroupSettings from '../chart-components/common-settings/y-axis-group-settings';
|
|
12
|
+
import DataSort from '../chart-components/common-settings/data-sort-setting';
|
|
13
|
+
import { GROUP_TYPES } from '../constants/summary-constants';
|
|
14
|
+
import './index.css';
|
|
15
|
+
const ChartSetting = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
editor,
|
|
18
|
+
element,
|
|
19
|
+
t
|
|
20
|
+
} = _ref;
|
|
21
|
+
const [dtables, setDtables] = useState([]);
|
|
22
|
+
const {
|
|
23
|
+
statItem
|
|
24
|
+
} = element;
|
|
25
|
+
const {
|
|
26
|
+
table_id,
|
|
27
|
+
sort_type,
|
|
28
|
+
base_id
|
|
29
|
+
} = statItem;
|
|
30
|
+
const getDtables = useCallback(async base_id => {
|
|
31
|
+
var _editor$dtableBases;
|
|
32
|
+
const integrationConfig = (_editor$dtableBases = editor.dtableBases) === null || _editor$dtableBases === void 0 ? void 0 : _editor$dtableBases.find(item => item.base_api_token === base_id);
|
|
33
|
+
if (integrationConfig) {
|
|
34
|
+
const dtableServer = await context.getDtableServer(integrationConfig);
|
|
35
|
+
const res = await context.getDtables(dtableServer);
|
|
36
|
+
if (res === null || res === void 0 ? void 0 : res.data) {
|
|
37
|
+
setDtables([...res.data.tables]);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
41
|
+
}, []);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
getDtables(base_id);
|
|
44
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45
|
+
}, [base_id]);
|
|
46
|
+
const updateSetting = useCallback(setting => {
|
|
47
|
+
const path = ReactEditor.findPath(editor, element);
|
|
48
|
+
Transforms.setNodes(editor, {
|
|
49
|
+
statItem: _objectSpread(_objectSpread({}, statItem), setting)
|
|
50
|
+
}, {
|
|
51
|
+
at: path
|
|
52
|
+
});
|
|
53
|
+
}, [editor, element, statItem]);
|
|
54
|
+
const onSelectedTableChanged = useCallback(option => {
|
|
55
|
+
const {
|
|
56
|
+
value
|
|
57
|
+
} = option;
|
|
58
|
+
const newSetting = {
|
|
59
|
+
'table_id': value.id,
|
|
60
|
+
'table_name': value.name
|
|
61
|
+
};
|
|
62
|
+
updateSetting(newSetting);
|
|
63
|
+
}, [updateSetting]);
|
|
64
|
+
const onSelectedBaseChanged = useCallback(option => {
|
|
65
|
+
const {
|
|
66
|
+
value
|
|
67
|
+
} = option;
|
|
68
|
+
const newSetting = {
|
|
69
|
+
'base_id': value.id
|
|
70
|
+
};
|
|
71
|
+
updateSetting(newSetting);
|
|
72
|
+
}, [updateSetting]);
|
|
73
|
+
const getColumns = useCallback(() => {
|
|
74
|
+
const tables = dtables || [];
|
|
75
|
+
const activeTable = tables.find(table => table._id === table_id);
|
|
76
|
+
if (!activeTable) return [];
|
|
77
|
+
return activeTable.columns;
|
|
78
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
79
|
+
}, [table_id, dtables]);
|
|
80
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
81
|
+
className: "sdoc-chart-setting-container"
|
|
82
|
+
}, /*#__PURE__*/React.createElement(ChartTypeSetting, {
|
|
83
|
+
element: element
|
|
84
|
+
}), /*#__PURE__*/React.createElement(BaseSetting, {
|
|
85
|
+
tables: editor.dtableBases || [],
|
|
86
|
+
activeTableId: base_id,
|
|
87
|
+
onSelectedBaseChanged: onSelectedBaseChanged
|
|
88
|
+
}), /*#__PURE__*/React.createElement(TableSetting, {
|
|
89
|
+
tables: dtables || [],
|
|
90
|
+
activeTableId: table_id,
|
|
91
|
+
onSelectedTableChanged: onSelectedTableChanged
|
|
92
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
93
|
+
className: 'seafile-divider dropdown-divider'
|
|
94
|
+
}), /*#__PURE__*/React.createElement(XAxisGroupSettings, {
|
|
95
|
+
label: t('X-axis'),
|
|
96
|
+
statItem: statItem,
|
|
97
|
+
columns: getColumns(),
|
|
98
|
+
renderIncludeEmpty: true,
|
|
99
|
+
updateSetting: updateSetting
|
|
100
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
101
|
+
className: 'seafile-divider dropdown-divider'
|
|
102
|
+
}), /*#__PURE__*/React.createElement(YAxisGroupSettings, {
|
|
103
|
+
label: t('Y-axis'),
|
|
104
|
+
statItem: statItem,
|
|
105
|
+
columns: getColumns(),
|
|
106
|
+
updateSetting: updateSetting,
|
|
107
|
+
supportSummaryTypes: [GROUP_TYPES.COUNT, GROUP_TYPES.SINGLE_NUMERIC_COLUMN]
|
|
108
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
109
|
+
className: 'seafile-divider dropdown-divider'
|
|
110
|
+
}), /*#__PURE__*/React.createElement(DataSort, {
|
|
111
|
+
settingValue: sort_type,
|
|
112
|
+
updateSetting: updateSetting
|
|
113
|
+
}));
|
|
114
|
+
};
|
|
115
|
+
export default withTranslation('sdoc-editor')(ChartSetting);
|