@seafile/sdoc-editor 2.0.55 → 2.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/basic-sdk/extension/plugins/seatable-row/render-elem/index.css +10 -1
- package/dist/basic-sdk/extension/plugins/seatable-row/render-elem/index.js +15 -1
- package/dist/basic-sdk/extension/plugins/seatable-tables/render-element/index.css +9 -0
- package/dist/basic-sdk/extension/plugins/seatable-tables/render-element/seatable-table.js +17 -2
- package/package.json +1 -1
- package/public/locales/en/sdoc-editor.json +3 -1
- package/public/locales/zh_CN/sdoc-editor.json +3 -1
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
outline: none;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
+
.seatable-rows-record-wrapper.no-row {
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
border: 1px solid #ddd;
|
|
10
|
+
padding: 20px;
|
|
11
|
+
border-radius: 5px;
|
|
12
|
+
}
|
|
13
|
+
|
|
5
14
|
.seatable-rows-record-container {
|
|
6
15
|
margin: 5px 0;
|
|
7
16
|
border: 1.5px solid #ddd;
|
|
@@ -37,7 +46,7 @@
|
|
|
37
46
|
font-weight: 400;
|
|
38
47
|
}
|
|
39
48
|
|
|
40
|
-
.seatable-rows-record-wrapper .seatable-rows-record-container table td {
|
|
49
|
+
.seatable-rows-record-wrapper .seatable-rows-record-container table td {
|
|
41
50
|
font-size: 14px;
|
|
42
51
|
font-weight: 400;
|
|
43
52
|
color: #212529
|
|
@@ -33,6 +33,7 @@ const RowRecord = _ref => {
|
|
|
33
33
|
const [columnWidthMap, setColumnWidthMap] = (0, _react.useState)(column_width);
|
|
34
34
|
const [isShowColumnWidth, setIsShowColumnWidth] = (0, _react.useState)(false);
|
|
35
35
|
const [isCanModifyColumnWidth, setIsCanModifyColumnWidth] = (0, _react.useState)(false);
|
|
36
|
+
const [activeRow, setActiveRow] = (0, _react.useState)(null);
|
|
36
37
|
const isSelected = (0, _slateReact.useSelected)();
|
|
37
38
|
const {
|
|
38
39
|
t
|
|
@@ -42,6 +43,7 @@ const RowRecord = _ref => {
|
|
|
42
43
|
(0, _react.useEffect)(() => {
|
|
43
44
|
async function initTableData() {
|
|
44
45
|
const table = await editor.getTableById(table_id);
|
|
46
|
+
if (!table) return;
|
|
45
47
|
if (!tableInfoRef.current) {
|
|
46
48
|
tableInfoRef.current = {};
|
|
47
49
|
}
|
|
@@ -55,6 +57,10 @@ const RowRecord = _ref => {
|
|
|
55
57
|
};
|
|
56
58
|
}
|
|
57
59
|
const shownRecord = table.rows.filter(item => row_id === item._id);
|
|
60
|
+
setActiveRow(shownRecord);
|
|
61
|
+
if (!shownRecord) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
58
64
|
setShownRecord(shownRecord);
|
|
59
65
|
setRowRecordName(shownRecord[0]['0000']);
|
|
60
66
|
const updatedColumnWidthMap = Object.fromEntries(Object.entries(columnWidthMap).map(_ref2 => {
|
|
@@ -97,13 +103,14 @@ const RowRecord = _ref => {
|
|
|
97
103
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
98
104
|
}, [table_id]);
|
|
99
105
|
(0, _react.useEffect)(() => {
|
|
106
|
+
if (!activeRow) return;
|
|
100
107
|
if (!isSelected) {
|
|
101
108
|
queueMicrotask(() => {
|
|
102
109
|
setIsShowColumnWidth(false);
|
|
103
110
|
setIsCanModifyColumnWidth(false);
|
|
104
111
|
});
|
|
105
112
|
}
|
|
106
|
-
}, [editor, element, isSelected]);
|
|
113
|
+
}, [activeRow, editor, element, isSelected]);
|
|
107
114
|
const onTableClick = (0, _react.useCallback)(event => {
|
|
108
115
|
if (readOnly) return;
|
|
109
116
|
setIsShowColumnWidth(true);
|
|
@@ -114,6 +121,13 @@ const RowRecord = _ref => {
|
|
|
114
121
|
setIsCanModifyColumnWidth(true);
|
|
115
122
|
}, [readOnly]);
|
|
116
123
|
const formulaRows = (tableInfoRef === null || tableInfoRef === void 0 ? void 0 : (_tableInfoRef$current = tableInfoRef.current) === null || _tableInfoRef$current === void 0 ? void 0 : (_tableInfoRef$current2 = _tableInfoRef$current[table_id]) === null || _tableInfoRef$current2 === void 0 ? void 0 : _tableInfoRef$current2.formulaRows) || {};
|
|
124
|
+
if (!activeRow) {
|
|
125
|
+
return /*#__PURE__*/_react.default.createElement("div", Object.assign({}, attributes, {
|
|
126
|
+
className: "seatable-rows-record-wrapper no-row",
|
|
127
|
+
contentEditable: false,
|
|
128
|
+
suppressContentEditableWarning: true
|
|
129
|
+
}), t('Row_not_exist'), children);
|
|
130
|
+
}
|
|
117
131
|
return /*#__PURE__*/_react.default.createElement("div", Object.assign({}, attributes, {
|
|
118
132
|
className: "seatable-rows-record-wrapper"
|
|
119
133
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
outline: none;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
+
.seatable-table-wrapper.no-table {
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
border: 1px solid #ddd;
|
|
10
|
+
padding: 20px;
|
|
11
|
+
border-radius: 5px;
|
|
12
|
+
}
|
|
13
|
+
|
|
5
14
|
.seatable-view-container {
|
|
6
15
|
width: 100%;
|
|
7
16
|
overflow: auto;
|
|
@@ -45,6 +45,7 @@ function SeaTableTable(_ref) {
|
|
|
45
45
|
const [isShowColumnWidth, setIsShowColumnWidth] = (0, _react.useState)(false);
|
|
46
46
|
const [isCanModifyColumnWidth, setIsCanModifyColumnWidth] = (0, _react.useState)(false);
|
|
47
47
|
const tableInfoRef = (0, _react.useRef)(null);
|
|
48
|
+
const [activeTale, setActiveTable] = (0, _react.useState)(null);
|
|
48
49
|
const {
|
|
49
50
|
t
|
|
50
51
|
} = (0, _reactI18next.useTranslation)('sdoc-editor');
|
|
@@ -60,6 +61,8 @@ function SeaTableTable(_ref) {
|
|
|
60
61
|
// Compatible with old element data structures
|
|
61
62
|
if (!column_width) {
|
|
62
63
|
const table = editor.getTableById(table_id);
|
|
64
|
+
setActiveTable(table);
|
|
65
|
+
if (!table) return;
|
|
63
66
|
const columnWidth = {};
|
|
64
67
|
table.columns.forEach(item => {
|
|
65
68
|
columnWidth[item.key] = (0, _helpers.getColumnWidth)(item);
|
|
@@ -79,6 +82,11 @@ function SeaTableTable(_ref) {
|
|
|
79
82
|
table_id
|
|
80
83
|
} = element;
|
|
81
84
|
const table = await editor.getTableById(table_id);
|
|
85
|
+
setActiveTable(table);
|
|
86
|
+
if (!table) {
|
|
87
|
+
setIsLoading(false);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
82
90
|
if (!tableInfoRef.current) {
|
|
83
91
|
tableInfoRef.current = {};
|
|
84
92
|
}
|
|
@@ -255,7 +263,7 @@ function SeaTableTable(_ref) {
|
|
|
255
263
|
}
|
|
256
264
|
}, [editor, element]);
|
|
257
265
|
(0, _react.useEffect)(() => {
|
|
258
|
-
if (!isSelected) {
|
|
266
|
+
if (!isSelected && activeTale) {
|
|
259
267
|
handleSaveData();
|
|
260
268
|
queueMicrotask(() => {
|
|
261
269
|
setIsShowMenu(false);
|
|
@@ -263,7 +271,7 @@ function SeaTableTable(_ref) {
|
|
|
263
271
|
setIsCanModifyColumnWidth(false);
|
|
264
272
|
});
|
|
265
273
|
}
|
|
266
|
-
}, [editor, element, handleSaveData, isSelected]);
|
|
274
|
+
}, [activeTale, editor, element, handleSaveData, isSelected]);
|
|
267
275
|
const onTableClick = (0, _react.useCallback)(event => {
|
|
268
276
|
if (readOnly) return;
|
|
269
277
|
const {
|
|
@@ -291,6 +299,13 @@ function SeaTableTable(_ref) {
|
|
|
291
299
|
const containerClass = (0, _classnames.default)('seatable-view-container', {
|
|
292
300
|
selected: isSelected
|
|
293
301
|
});
|
|
302
|
+
if (!activeTale) {
|
|
303
|
+
return /*#__PURE__*/_react.default.createElement("div", Object.assign({}, attributes, {
|
|
304
|
+
className: "seatable-table-wrapper no-table",
|
|
305
|
+
contentEditable: false,
|
|
306
|
+
suppressContentEditableWarning: true
|
|
307
|
+
}), t('Table_not_exist'), children);
|
|
308
|
+
}
|
|
294
309
|
return /*#__PURE__*/_react.default.createElement("div", Object.assign({}, attributes, {
|
|
295
310
|
className: "seatable-table-wrapper",
|
|
296
311
|
contentEditable: true,
|
package/package.json
CHANGED
|
@@ -627,5 +627,7 @@
|
|
|
627
627
|
"Edit_chart": "Edit chart",
|
|
628
628
|
"Please_complete_the_chart_configuration_first": "Please complete the chart configuration first",
|
|
629
629
|
"chart": "chart",
|
|
630
|
-
"Image_is_upload_error": "Image upload failed, please delete it and try again"
|
|
630
|
+
"Image_is_upload_error": "Image upload failed, please delete it and try again",
|
|
631
|
+
"Table_not_exist": "The table does not exist, please delete the current table element",
|
|
632
|
+
"Row_not_exist": "The row data does not exist, please delete the current row element"
|
|
631
633
|
}
|
|
@@ -627,5 +627,7 @@
|
|
|
627
627
|
"Edit_chart": "编辑图表",
|
|
628
628
|
"Please_complete_the_chart_configuration_first": "请先完成图表配置",
|
|
629
629
|
"chart": "图表",
|
|
630
|
-
"Image_is_upload_error": "图片上传失败,请删除后重新尝试"
|
|
630
|
+
"Image_is_upload_error": "图片上传失败,请删除后重新尝试",
|
|
631
|
+
"Table_not_exist": "表格不存在,请删除当前表格元素",
|
|
632
|
+
"Row_not_exist": "表格不存在,请删除当前行元素"
|
|
631
633
|
}
|