@seafile/sdoc-editor 1.0.50 → 1.0.53
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/comment/components/comment-item-content.js +3 -3
- package/dist/basic-sdk/comment/components/comment-item-wrapper.js +6 -5
- package/dist/basic-sdk/comment/components/comment-list.js +3 -3
- package/dist/basic-sdk/comment/components/global-comment/index.js +3 -3
- package/dist/basic-sdk/comment/provider/comment-context-provider.js +3 -2
- package/dist/basic-sdk/comment/provider/notification-context-provider.js +3 -2
- package/dist/basic-sdk/comment/reducer/comment-reducer.js +50 -24
- package/dist/basic-sdk/comment/reducer/notification-reducer.js +9 -7
- package/dist/basic-sdk/cursor/helper.js +11 -4
- package/dist/basic-sdk/editor/comment-article.js +3 -3
- package/dist/basic-sdk/editor/sdoc-comment-editor.js +5 -4
- package/dist/basic-sdk/editor/sdoc-editor.js +5 -4
- package/dist/basic-sdk/editor/wiki-editor.js +5 -4
- package/dist/basic-sdk/extension/commons/dropdown-menu-item/index.css +4 -0
- package/dist/basic-sdk/extension/commons/dropdown-menu-item/index.js +7 -6
- package/dist/basic-sdk/extension/commons/file-insert-dialog/index.js +7 -6
- package/dist/basic-sdk/extension/commons/select/field-setting.js +6 -5
- package/dist/basic-sdk/extension/commons/select-file-dialog/index.js +6 -4
- package/dist/basic-sdk/extension/core/queries/index.js +21 -20
- package/dist/basic-sdk/extension/core/transforms/remove-node-children.js +3 -3
- package/dist/basic-sdk/extension/core/transforms/replace-node.js +13 -9
- package/dist/basic-sdk/extension/core/transforms/update-parent-node.js +3 -2
- package/dist/basic-sdk/extension/core/utils/index.js +4 -5
- package/dist/basic-sdk/extension/plugins/blockquote/helpers.js +3 -3
- package/dist/basic-sdk/extension/plugins/blockquote/menu/index.js +4 -5
- package/dist/basic-sdk/extension/plugins/check-list/menu/index.js +4 -5
- package/dist/basic-sdk/extension/plugins/clear-format/menu/index.js +4 -5
- package/dist/basic-sdk/extension/plugins/code-block/hover-menu/index.js +1 -0
- package/dist/basic-sdk/extension/plugins/code-block/plugin.js +6 -3
- package/dist/basic-sdk/extension/plugins/code-block/render-elem.js +3 -3
- package/dist/basic-sdk/extension/plugins/file-link/render-elem.js +6 -3
- package/dist/basic-sdk/extension/plugins/header/render-elem.js +16 -11
- package/dist/basic-sdk/extension/plugins/image/helpers.js +9 -7
- package/dist/basic-sdk/extension/plugins/image/hover-menu/index.js +7 -3
- package/dist/basic-sdk/extension/plugins/image/menu/index.js +7 -7
- package/dist/basic-sdk/extension/plugins/image/plugin.js +2 -2
- package/dist/basic-sdk/extension/plugins/image/render-elem.js +17 -10
- package/dist/basic-sdk/extension/plugins/link/helpers.js +3 -3
- package/dist/basic-sdk/extension/plugins/link/menu/index.js +4 -5
- package/dist/basic-sdk/extension/plugins/list/menu/index.js +4 -5
- package/dist/basic-sdk/extension/plugins/list/plugin/on-tab-handle.js +6 -3
- package/dist/basic-sdk/extension/plugins/list/transforms/insert-list-item.js +4 -2
- package/dist/basic-sdk/extension/plugins/list/transforms/toggle-list.js +6 -4
- package/dist/basic-sdk/extension/plugins/markdown/plugin.js +17 -6
- package/dist/basic-sdk/extension/plugins/mention/plugin.js +6 -5
- package/dist/basic-sdk/extension/plugins/paragraph/render-elem.js +4 -4
- package/dist/basic-sdk/extension/plugins/sdoc-link/helpers.js +3 -2
- package/dist/basic-sdk/extension/plugins/sdoc-link/render/render-elem.js +6 -3
- package/dist/basic-sdk/extension/plugins/search-replace/helper.js +6 -5
- package/dist/basic-sdk/extension/plugins/seatable-column/helpers.js +6 -3
- package/dist/basic-sdk/extension/plugins/seatable-column/menu/column-list-menu.js +16 -12
- package/dist/basic-sdk/extension/plugins/seatable-column/menu/index.js +11 -7
- package/dist/basic-sdk/extension/plugins/seatable-column/render-elem.js +6 -6
- package/dist/basic-sdk/extension/plugins/seatable-tables/helpers.js +3 -2
- package/dist/basic-sdk/extension/plugins/seatable-tables/menu/index.js +9 -7
- package/dist/basic-sdk/extension/plugins/seatable-tables/menu/seatable-list.js +11 -11
- package/dist/basic-sdk/extension/plugins/seatable-tables/render-element/index.css +23 -1
- package/dist/basic-sdk/extension/plugins/seatable-tables/render-element/record-header.js +3 -3
- package/dist/basic-sdk/extension/plugins/seatable-tables/render-element/seatable-table.js +8 -7
- package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/filter-setter/filter-popover-widgets/department-filter/_department-utils.js +3 -3
- package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/filter-setter/filter-popover-widgets/department-filter/department-single-select.js +3 -3
- package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/filter-setter/filter-popover-widgets/rate-item/index.js +3 -3
- package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/index.js +4 -2
- package/dist/basic-sdk/extension/plugins/table/helpers.js +32 -16
- package/dist/basic-sdk/extension/plugins/table/menu/table-context-menu/index.css +2 -1
- package/dist/basic-sdk/extension/plugins/table/plugin.js +6 -5
- package/dist/basic-sdk/extension/plugins/table/render/index.js +6 -3
- package/dist/basic-sdk/extension/plugins/table/render/render-cell.js +15 -6
- package/dist/basic-sdk/extension/plugins/table/render/resize-handlers/column-resize-handler.js +6 -5
- package/dist/basic-sdk/extension/plugins/table/render/resize-handlers/first-column-left-resize-handler.js +3 -3
- package/dist/basic-sdk/extension/plugins/table/render/resize-mask/index.js +19 -15
- package/dist/basic-sdk/extension/plugins/table/render/table-root.js +3 -3
- package/dist/basic-sdk/extension/plugins/text-style/caret.js +6 -5
- package/dist/basic-sdk/extension/plugins/text-style/menu/comemnt-editor-menu.js +4 -3
- package/dist/basic-sdk/extension/plugins/text-style/menu/index.js +4 -3
- package/dist/basic-sdk/extension/plugins/text-style/render-elem.js +3 -5
- package/dist/basic-sdk/extension/render/custom-element.js +12 -8
- package/dist/basic-sdk/extension/render/render-comment-editor-element.js +12 -8
- package/dist/basic-sdk/extension/toolbar/header-toolbar/redo-undo.js +8 -9
- package/dist/basic-sdk/extension/toolbar/insert-element-toolbar/index.js +30 -11
- package/dist/basic-sdk/extension/toolbar/side-toolbar/insert-block-menu.js +25 -10
- package/dist/basic-sdk/extension/toolbar/side-toolbar/side-menu.css +0 -1
- package/dist/basic-sdk/extension/toolbar/side-toolbar/side-menu.js +1 -1
- package/dist/basic-sdk/extension/utils/index.js +22 -0
- package/dist/basic-sdk/highlight/setNodeToDecorations.js +4 -4
- package/dist/basic-sdk/node-id/helpers.js +6 -5
- package/dist/basic-sdk/socket/helpers.js +6 -5
- package/dist/basic-sdk/socket/socket-client.js +4 -4
- package/dist/basic-sdk/utils/diff.js +43 -29
- package/dist/basic-sdk/utils/object-utils.js +4 -2
- package/dist/basic-sdk/utils/rebase.js +37 -21
- package/dist/components/toast/alert.js +24 -105
- package/dist/components/toast/index.css +118 -0
- package/dist/components/toast/toast.js +2 -41
- package/dist/components/toast/toastManager.js +9 -23
- package/dist/components/toast/toaster.js +13 -9
- package/dist/components/tooltip/index.js +7 -6
- package/dist/layout/content.js +5 -8
- package/dist/layout/header.js +5 -8
- package/dist/layout/layout.js +4 -6
- package/dist/pages/document-plugin-editor.js +1 -1
- package/dist/slate-convert/md-to-slate/transform.js +30 -23
- package/dist/slate-convert/slate-to-md/transform.js +3 -3
- package/package.json +35 -40
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import { Editor, Transforms, Range } from '@seafile/slate';
|
|
3
2
|
import { toggleList } from '../list/transforms';
|
|
4
3
|
import { getSelectedNodeByType } from '../../core';
|
|
@@ -26,8 +25,14 @@ const LIST_SHORT_CUT = {
|
|
|
26
25
|
const REFERENCE_SHORT_CUT = {
|
|
27
26
|
'>': BLOCKQUOTE
|
|
28
27
|
};
|
|
29
|
-
const KEY_TO_TYPE_FOR_SPACE_DEFAULT_EDITOR =
|
|
30
|
-
|
|
28
|
+
const KEY_TO_TYPE_FOR_SPACE_DEFAULT_EDITOR = {
|
|
29
|
+
...TITLE_SHORT_CUT,
|
|
30
|
+
...LIST_SHORT_CUT,
|
|
31
|
+
...REFERENCE_SHORT_CUT
|
|
32
|
+
};
|
|
33
|
+
const KEY_TO_TYPE_FOR_SPACE_COMMENT_EDITOR = {
|
|
34
|
+
...LIST_SHORT_CUT
|
|
35
|
+
};
|
|
31
36
|
const KEY_TO_INLINE_TYPE_FOR_SPACE = {
|
|
32
37
|
// Inline shortcut keys
|
|
33
38
|
'**': TEXT_STYLE_MAP.BOLD,
|
|
@@ -100,7 +105,9 @@ const withMarkDown = editor => {
|
|
|
100
105
|
path: range.focus.path,
|
|
101
106
|
offset: startOffset
|
|
102
107
|
},
|
|
103
|
-
focus:
|
|
108
|
+
focus: {
|
|
109
|
+
...selection.focus
|
|
110
|
+
}
|
|
104
111
|
},
|
|
105
112
|
voids: true
|
|
106
113
|
});
|
|
@@ -123,7 +130,9 @@ const withMarkDown = editor => {
|
|
|
123
130
|
path: range.focus.path,
|
|
124
131
|
offset: startOffset
|
|
125
132
|
},
|
|
126
|
-
focus:
|
|
133
|
+
focus: {
|
|
134
|
+
...selection.focus
|
|
135
|
+
}
|
|
127
136
|
},
|
|
128
137
|
voids: true
|
|
129
138
|
});
|
|
@@ -150,7 +159,9 @@ const withMarkDown = editor => {
|
|
|
150
159
|
path: range.focus.path,
|
|
151
160
|
offset: startOffset
|
|
152
161
|
},
|
|
153
|
-
focus:
|
|
162
|
+
focus: {
|
|
163
|
+
...selection.focus
|
|
164
|
+
}
|
|
154
165
|
},
|
|
155
166
|
voids: true
|
|
156
167
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import { Editor, Node, Range, Text, Transforms } from '@seafile/slate';
|
|
3
2
|
import EventBus from '../../../utils/event-bus';
|
|
4
3
|
import { INTERNAL_EVENT } from '../../../constants';
|
|
@@ -57,9 +56,10 @@ const withMention = editor => {
|
|
|
57
56
|
});
|
|
58
57
|
}
|
|
59
58
|
}
|
|
60
|
-
return focusEditor(editor,
|
|
59
|
+
return focusEditor(editor, {
|
|
60
|
+
...insertPoint,
|
|
61
61
|
offset: insertPoint.offset + text.length
|
|
62
|
-
})
|
|
62
|
+
});
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -221,9 +221,10 @@ const withMention = editor => {
|
|
|
221
221
|
at: insertPoint
|
|
222
222
|
});
|
|
223
223
|
event.preventDefault();
|
|
224
|
-
focusEditor(editor,
|
|
224
|
+
focusEditor(editor, {
|
|
225
|
+
...insertPoint,
|
|
225
226
|
offset: insertPoint.offset + data.length
|
|
226
|
-
})
|
|
227
|
+
});
|
|
227
228
|
if (nextNodeEntry) {
|
|
228
229
|
const [nextNode, nextPath] = nextNodeEntry;
|
|
229
230
|
if (Text.isText(nextNode) && nextNode.text === '') {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { Node, Range } from '@seafile/slate';
|
|
4
3
|
import { ReactEditor, useSelected, useSlateStatic } from '@seafile/slate-react';
|
|
@@ -45,9 +44,10 @@ const Paragraph = _ref => {
|
|
|
45
44
|
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
46
45
|
"data-id": element.id
|
|
47
46
|
}, attributes, {
|
|
48
|
-
style:
|
|
49
|
-
position: isShowPlaceHolder ? 'relative' : ''
|
|
50
|
-
|
|
47
|
+
style: {
|
|
48
|
+
position: isShowPlaceHolder ? 'relative' : '',
|
|
49
|
+
...style
|
|
50
|
+
},
|
|
51
51
|
className: className
|
|
52
52
|
}), children, isShowPlaceHolder && /*#__PURE__*/React.createElement(Placeholder, {
|
|
53
53
|
title: placeholder,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import { ReactEditor } from '@seafile/slate-react';
|
|
3
2
|
import { Editor, Transforms, Range, Text, Path, Node } from '@seafile/slate';
|
|
4
3
|
import slugid from 'slugid';
|
|
@@ -168,7 +167,9 @@ export const removeShortCutSymbol = editor => {
|
|
|
168
167
|
path: beforeRange.focus.path,
|
|
169
168
|
offset: beforeText.length - 2
|
|
170
169
|
},
|
|
171
|
-
focus:
|
|
170
|
+
focus: {
|
|
171
|
+
...selection.focus
|
|
172
|
+
}
|
|
172
173
|
},
|
|
173
174
|
voids: true
|
|
174
175
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import React, { useCallback, useEffect, useState, useRef, useMemo } from 'react';
|
|
3
2
|
import { Editor, Range } from '@seafile/slate';
|
|
4
3
|
import { ReactEditor, useReadOnly } from '@seafile/slate-react';
|
|
@@ -101,9 +100,13 @@ const SdocFileLink = _ref => {
|
|
|
101
100
|
}, []);
|
|
102
101
|
let style = {};
|
|
103
102
|
if (element.add) {
|
|
104
|
-
style =
|
|
103
|
+
style = {
|
|
104
|
+
...ADDED_STYLE
|
|
105
|
+
};
|
|
105
106
|
} else if (element.delete) {
|
|
106
|
-
style =
|
|
107
|
+
style = {
|
|
108
|
+
...DELETED_STYLE
|
|
109
|
+
};
|
|
107
110
|
}
|
|
108
111
|
if (style.computed_background_color) {
|
|
109
112
|
style['backgroundColor'] = style.computed_background_color;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import { Editor, Element, Node, Text, Transforms } from '@seafile/slate';
|
|
3
2
|
import { ReactEditor } from '@seafile/slate-react';
|
|
4
3
|
import { CODE_BLOCK, IMAGE } from '../../constants';
|
|
@@ -27,16 +26,18 @@ const formatTextEntries = textEntries => {
|
|
|
27
26
|
const splitTextNode = node => {
|
|
28
27
|
return node.children.reduce((pre, cur) => {
|
|
29
28
|
if (cur.type === IMAGE) {
|
|
30
|
-
pre.push(
|
|
29
|
+
pre.push({
|
|
30
|
+
...node,
|
|
31
31
|
children: []
|
|
32
|
-
})
|
|
32
|
+
});
|
|
33
33
|
} else {
|
|
34
34
|
pre[pre.length - 1].children.push(cur);
|
|
35
35
|
}
|
|
36
36
|
return pre;
|
|
37
|
-
}, [
|
|
37
|
+
}, [{
|
|
38
|
+
...node,
|
|
38
39
|
children: []
|
|
39
|
-
}
|
|
40
|
+
}]);
|
|
40
41
|
};
|
|
41
42
|
const matchSearchWordPosition = (node, searchWord) => {
|
|
42
43
|
const content = Node.string(node);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import { Editor, Transforms, Range } from '@seafile/slate';
|
|
3
2
|
import slugid from 'slugid';
|
|
4
3
|
import { BLOCKQUOTE, CHECK_LIST_ITEM, COLUMN, IMAGE, ORDERED_LIST, PARAGRAPH, TABLE_CELL, UNORDERED_LIST } from '../../constants/element-type';
|
|
@@ -54,13 +53,17 @@ export const insertSeaTableColumn = function (editor, active, option) {
|
|
|
54
53
|
column.id = slugid.nice();
|
|
55
54
|
if (insertPosition === INSERT_POSITION.AFTER) {
|
|
56
55
|
const path = Editor.path(editor, editor.selection);
|
|
57
|
-
path && Transforms.insertNodes(editor,
|
|
56
|
+
path && Transforms.insertNodes(editor, {
|
|
57
|
+
...column
|
|
58
|
+
}, {
|
|
58
59
|
at: [path[0] + 1]
|
|
59
60
|
});
|
|
60
61
|
focusEditor(editor);
|
|
61
62
|
return;
|
|
62
63
|
}
|
|
63
|
-
Transforms.insertNodes(editor,
|
|
64
|
+
Transforms.insertNodes(editor, {
|
|
65
|
+
...column
|
|
66
|
+
});
|
|
64
67
|
}
|
|
65
68
|
focusEditor(editor);
|
|
66
69
|
};
|
|
@@ -2,28 +2,31 @@ import React, { useMemo, useCallback, useRef, useEffect, useState } from 'react'
|
|
|
2
2
|
import { COLUMNS_ICON_CONFIG } from '../constants/column';
|
|
3
3
|
import { insertSeaTableColumn, getColumnType } from '../helpers';
|
|
4
4
|
import { COLUMN } from '../../../constants/element-type';
|
|
5
|
+
import { isOverflowPortByDirection } from '../../../utils';
|
|
5
6
|
import './column-list-menu.css';
|
|
6
7
|
const NOT_SUPPORT_COLUMN_TYPES = ['button', 'file'];
|
|
7
8
|
export default function ColumnListMenu(_ref) {
|
|
8
9
|
let {
|
|
9
10
|
editor,
|
|
10
|
-
insertPosition
|
|
11
|
+
insertPosition,
|
|
12
|
+
toggle
|
|
11
13
|
} = _ref;
|
|
12
14
|
const columnRef = useRef(null);
|
|
13
15
|
const [computedStyle, setComputedStyle] = useState({});
|
|
14
16
|
useEffect(() => {
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
if (columnRef.current) {
|
|
18
|
+
// bottom overflow
|
|
19
|
+
if (isOverflowPortByDirection(columnRef.current, 'bottom')) {
|
|
20
|
+
return setComputedStyle({
|
|
21
|
+
bottom: '0px'
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
// default
|
|
25
|
+
return setComputedStyle({
|
|
26
|
+
top: '-20px'
|
|
18
27
|
});
|
|
19
28
|
}
|
|
20
|
-
|
|
21
|
-
const centerPosition = parseInt(columnRef.current.getBoundingClientRect().height / 2);
|
|
22
|
-
setComputedStyle({
|
|
23
|
-
top: "-".concat(centerPosition, "px")
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}, [insertPosition]);
|
|
29
|
+
}, []);
|
|
27
30
|
const columns = useMemo(() => {
|
|
28
31
|
if (!editor.columns) return [];
|
|
29
32
|
return editor.columns.filter(column => !NOT_SUPPORT_COLUMN_TYPES.includes(column.type));
|
|
@@ -44,7 +47,8 @@ export default function ColumnListMenu(_ref) {
|
|
|
44
47
|
const onMousedown = useCallback(option => {
|
|
45
48
|
const active = isActive(editor);
|
|
46
49
|
insertSeaTableColumn(editor, active, option, insertPosition);
|
|
47
|
-
|
|
50
|
+
toggle && toggle();
|
|
51
|
+
}, [editor, insertPosition, toggle]);
|
|
48
52
|
return /*#__PURE__*/React.createElement("div", {
|
|
49
53
|
ref: columnRef,
|
|
50
54
|
className: "column-list-menu",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
2
|
import { MENUS_CONFIG_MAP, ELEMENT_TYPE } from '../../../constants';
|
|
3
3
|
import DropdownMenuItem from '../../../commons/dropdown-menu-item';
|
|
4
4
|
import ColumnListMenu from './column-list-menu';
|
|
@@ -8,27 +8,31 @@ const SeaTableColumnMenu = _ref => {
|
|
|
8
8
|
let {
|
|
9
9
|
editor,
|
|
10
10
|
readonly,
|
|
11
|
-
insertPosition
|
|
11
|
+
insertPosition,
|
|
12
|
+
toggle
|
|
12
13
|
} = _ref;
|
|
14
|
+
const dropDownMenuRef = useRef(null);
|
|
13
15
|
const disabled = isMenuDisabled(editor, readonly);
|
|
14
16
|
const menuConfig = MENUS_CONFIG_MAP[ELEMENT_TYPE.COLUMN];
|
|
15
17
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DropdownMenuItem, {
|
|
16
18
|
disabled: disabled,
|
|
17
19
|
menuConfig: menuConfig,
|
|
18
|
-
className: "pr-2"
|
|
20
|
+
className: "pr-2 sdoc-dropdown-menu-item-relative",
|
|
21
|
+
ref: dropDownMenuRef
|
|
19
22
|
}, !disabled && /*#__PURE__*/React.createElement("i", {
|
|
20
23
|
className: "sdocfont sdoc-right-slide sdoc-dropdown-item-right-icon"
|
|
21
24
|
}), !disabled && /*#__PURE__*/React.createElement(UncontrolledPopover, {
|
|
22
25
|
target: menuConfig.id,
|
|
23
|
-
trigger: "hover",
|
|
24
|
-
placement: "right-start",
|
|
25
26
|
hideArrow: true,
|
|
27
|
+
trigger: "hover",
|
|
26
28
|
fade: false,
|
|
27
|
-
popperClassName: "seatable-column-popover"
|
|
29
|
+
popperClassName: "seatable-column-popover",
|
|
30
|
+
container: dropDownMenuRef === null || dropDownMenuRef === void 0 ? void 0 : dropDownMenuRef.current
|
|
28
31
|
}, /*#__PURE__*/React.createElement(ColumnListMenu, {
|
|
29
32
|
editor: editor,
|
|
30
33
|
readonly: readonly,
|
|
31
|
-
insertPosition: insertPosition
|
|
34
|
+
insertPosition: insertPosition,
|
|
35
|
+
toggle: toggle
|
|
32
36
|
}))));
|
|
33
37
|
};
|
|
34
38
|
export default SeaTableColumnMenu;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import React, { useState, useEffect } from 'react';
|
|
3
2
|
import { useReadOnly, useSelected } from '@seafile/slate-react';
|
|
4
3
|
const Column = _ref => {
|
|
@@ -30,12 +29,13 @@ const Column = _ref => {
|
|
|
30
29
|
setIsClicked(false);
|
|
31
30
|
}
|
|
32
31
|
}, [isSelected, isReadOnly]);
|
|
33
|
-
const style =
|
|
32
|
+
const style = {
|
|
34
33
|
margin: '0 10px',
|
|
35
|
-
border: '1px solid transparent'
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
border: '1px solid transparent',
|
|
35
|
+
...(isClicked && {
|
|
36
|
+
border: '1px solid red'
|
|
37
|
+
})
|
|
38
|
+
};
|
|
39
39
|
return /*#__PURE__*/React.createElement("span", Object.assign({}, attributes, {
|
|
40
40
|
style: style
|
|
41
41
|
}), displayValue, children);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import { Editor, Transforms } from '@seafile/slate';
|
|
3
2
|
import slugId from 'slugid';
|
|
4
3
|
import { getNodeType, isTextNode, getParentNode, generateDefaultText } from '../../core';
|
|
@@ -72,5 +71,7 @@ export const insertSeaTableTable = function (editor, item) {
|
|
|
72
71
|
Transforms.setNodes(editor, node);
|
|
73
72
|
};
|
|
74
73
|
export const updateSeaTableTable = (editor, props) => {
|
|
75
|
-
Transforms.setNodes(editor,
|
|
74
|
+
Transforms.setNodes(editor, {
|
|
75
|
+
...props
|
|
76
|
+
});
|
|
76
77
|
};
|
|
@@ -9,28 +9,30 @@ const SeaTableTableMenu = _ref => {
|
|
|
9
9
|
let {
|
|
10
10
|
editor,
|
|
11
11
|
readonly,
|
|
12
|
-
insertPosition
|
|
12
|
+
insertPosition,
|
|
13
|
+
toggle
|
|
13
14
|
} = _ref;
|
|
14
|
-
const
|
|
15
|
+
const dropDownMenuRef = useRef(null);
|
|
15
16
|
const disabled = isInsertSeaTableTableDisabled(editor, readonly);
|
|
16
17
|
const menuConfig = MENUS_CONFIG_MAP[SEATABLE_TABLE];
|
|
17
18
|
const onViewClick = useCallback(item => {
|
|
18
19
|
insertSeaTableTable(editor, item, insertPosition);
|
|
19
|
-
|
|
20
|
+
toggle && toggle();
|
|
21
|
+
}, [editor, insertPosition, toggle]);
|
|
20
22
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DropdownMenuItem, {
|
|
21
23
|
disabled: disabled,
|
|
22
24
|
menuConfig: menuConfig,
|
|
23
|
-
className: "pr-2"
|
|
25
|
+
className: "pr-2 sdoc-dropdown-menu-item-relative",
|
|
26
|
+
ref: dropDownMenuRef
|
|
24
27
|
}, !disabled && /*#__PURE__*/React.createElement("i", {
|
|
25
28
|
className: "sdocfont sdoc-right-slide sdoc-dropdown-item-right-icon"
|
|
26
29
|
}), !disabled && /*#__PURE__*/React.createElement(UncontrolledPopover, {
|
|
27
30
|
target: menuConfig.id,
|
|
28
31
|
trigger: "hover",
|
|
29
|
-
className: "sdoc-menu-popover sdoc-
|
|
30
|
-
placement: "right-start",
|
|
32
|
+
className: "sdoc-menu-popover sdoc-sub-dropdown-menu",
|
|
31
33
|
hideArrow: true,
|
|
32
34
|
fade: false,
|
|
33
|
-
|
|
35
|
+
container: dropDownMenuRef === null || dropDownMenuRef === void 0 ? void 0 : dropDownMenuRef.current
|
|
34
36
|
}, /*#__PURE__*/React.createElement(SeaTableList, {
|
|
35
37
|
editor: editor,
|
|
36
38
|
readonly: readonly,
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef } from 'react';
|
|
2
|
+
import { isOverflowPortByDirection } from '../../../utils';
|
|
2
3
|
const SeaTableList = _ref => {
|
|
3
4
|
let {
|
|
4
5
|
editor,
|
|
5
|
-
insertPosition,
|
|
6
6
|
onViewClick
|
|
7
7
|
} = _ref;
|
|
8
8
|
const seatableRef = useRef(null);
|
|
9
9
|
const [computedStyle, setComputedStyle] = useState({});
|
|
10
10
|
const tables = editor.tables;
|
|
11
11
|
useEffect(() => {
|
|
12
|
-
if (
|
|
12
|
+
if (seatableRef.current) {
|
|
13
|
+
// bottom overflow
|
|
14
|
+
if (isOverflowPortByDirection(seatableRef.current, 'bottom')) {
|
|
15
|
+
return setComputedStyle({
|
|
16
|
+
bottom: '0px'
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
// default
|
|
13
20
|
setComputedStyle({
|
|
14
|
-
|
|
21
|
+
top: '-20px'
|
|
15
22
|
});
|
|
16
23
|
}
|
|
17
|
-
|
|
18
|
-
const centerPosition = parseInt(seatableRef.current.getBoundingClientRect().height / 2);
|
|
19
|
-
// 30 is seatable menu height
|
|
20
|
-
setComputedStyle({
|
|
21
|
-
top: "-".concat(centerPosition + 30, "px")
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}, [insertPosition]);
|
|
24
|
+
}, []);
|
|
25
25
|
return /*#__PURE__*/React.createElement("div", {
|
|
26
26
|
ref: seatableRef,
|
|
27
27
|
className: "sdoc-dropdown-menu-container sdoc-seatable-selected-table-list-wrapper",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
.seatable-view-container .seatable-view-records {
|
|
14
14
|
margin: 0;
|
|
15
|
+
width: fit-content;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
.seatable-view-container .seatable-column-editor-wrapper {
|
|
@@ -24,6 +25,7 @@
|
|
|
24
25
|
width: 100%;
|
|
25
26
|
height: 30px;
|
|
26
27
|
}
|
|
28
|
+
|
|
27
29
|
.seatable-view-container .seatable-column-editor-wrapper .seatable-column-width-tip {
|
|
28
30
|
background-color: #0009;
|
|
29
31
|
border-radius: 3px;
|
|
@@ -70,7 +72,27 @@
|
|
|
70
72
|
justify-content: center;
|
|
71
73
|
}
|
|
72
74
|
|
|
73
|
-
.seatable-view-records.
|
|
75
|
+
.seatable-view-records .article tr:first-child {
|
|
76
|
+
font-weight: normal;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.seatable-view-records tr:nth-child(2n+1) td {
|
|
80
|
+
background-color: #fff;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.seatable-view-records tr:nth-child(2n) td {
|
|
84
|
+
background-color: #f8f8f8;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.seatable-view-records.no_alternate_color tr:nth-child(2n) td {
|
|
88
|
+
background-color: #fff;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.seatable-view-records thead tr:nth-child(2n+1) th {
|
|
92
|
+
background-color: #f8f8f8;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.seatable-view-records.no_alternate_color thead tr:nth-child(2n+1) th {
|
|
74
96
|
background-color: #fff;
|
|
75
97
|
}
|
|
76
98
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
3
2
|
import { ReactEditor } from '@seafile/slate-react';
|
|
4
3
|
import { Transforms } from '@seafile/slate';
|
|
@@ -36,9 +35,10 @@ export default function RecordHeader(_ref) {
|
|
|
36
35
|
const onDrag = (e, currentCell, currentColumnKey) => {
|
|
37
36
|
const width = getWidthFromMouseEvent(e, currentCell);
|
|
38
37
|
if (width >= 80) {
|
|
39
|
-
const newColumnWidthMap =
|
|
38
|
+
const newColumnWidthMap = {
|
|
39
|
+
...columnWidthMap,
|
|
40
40
|
[currentColumnKey]: width
|
|
41
|
-
}
|
|
41
|
+
};
|
|
42
42
|
setColumnWidthMap(newColumnWidthMap);
|
|
43
43
|
}
|
|
44
44
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import { useTranslation } from 'react-i18next';
|
|
@@ -163,11 +162,13 @@ function SeaTableTable(_ref) {
|
|
|
163
162
|
type: array_type || CellType.TEXT,
|
|
164
163
|
data: array_data || null
|
|
165
164
|
};
|
|
166
|
-
return
|
|
167
|
-
|
|
165
|
+
return {
|
|
166
|
+
...column,
|
|
167
|
+
data: {
|
|
168
|
+
...data,
|
|
168
169
|
display_column
|
|
169
|
-
}
|
|
170
|
-
}
|
|
170
|
+
}
|
|
171
|
+
};
|
|
171
172
|
}
|
|
172
173
|
return column;
|
|
173
174
|
});
|
|
@@ -257,12 +258,12 @@ function SeaTableTable(_ref) {
|
|
|
257
258
|
className: classNames('seatable-view-records', {
|
|
258
259
|
'no_alternate_color': !element.alternate_color
|
|
259
260
|
})
|
|
260
|
-
}, /*#__PURE__*/React.createElement("
|
|
261
|
+
}, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement(RecordHeader, {
|
|
261
262
|
editor: editor,
|
|
262
263
|
element: element,
|
|
263
264
|
columns: columns,
|
|
264
265
|
isCanModifyColumnWidth: isCanModifyColumnWidth
|
|
265
|
-
}), /*#__PURE__*/React.createElement(RecordList, {
|
|
266
|
+
})), /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement(RecordList, {
|
|
266
267
|
element: element,
|
|
267
268
|
editor: editor,
|
|
268
269
|
records: shownRecords,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
export const DEPARTMENT_SELECT_RANGE_OPTIONS = [{
|
|
3
2
|
name: 'Current_user_department',
|
|
4
3
|
type: 'current_user_department'
|
|
@@ -31,9 +30,10 @@ export const getNormalizedDepartments = function (departments) {
|
|
|
31
30
|
return departments.map(depart => {
|
|
32
31
|
const hasChild = canExpand && !!parentIdMap[depart.id];
|
|
33
32
|
const isExpanded = depart.parent_id === -1 ? true : false;
|
|
34
|
-
return
|
|
33
|
+
return {
|
|
34
|
+
...depart,
|
|
35
35
|
hasChild,
|
|
36
36
|
isExpanded
|
|
37
|
-
}
|
|
37
|
+
};
|
|
38
38
|
});
|
|
39
39
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _Loading from "dtable-ui-component/lib/Loading";
|
|
2
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
3
|
import React, { Component, Fragment } from 'react';
|
|
5
4
|
import { withTranslation } from 'react-i18next';
|
|
@@ -176,9 +175,10 @@ class DepartmentSingleSelect extends Component {
|
|
|
176
175
|
departments
|
|
177
176
|
} = this.state;
|
|
178
177
|
return /*#__PURE__*/React.createElement(React.Fragment, null, this.validDepartments.length === 0 && this.renderEmptyTip(), this.validDepartments.length > 0 && this.validDepartments.map(department => {
|
|
179
|
-
const value =
|
|
178
|
+
const value = {
|
|
179
|
+
...department,
|
|
180
180
|
hasChild: false
|
|
181
|
-
}
|
|
181
|
+
};
|
|
182
182
|
return this.renderDepartment(value, departments, -1, false);
|
|
183
183
|
}));
|
|
184
184
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import { UncontrolledTooltip } from 'reactstrap';
|
|
@@ -50,10 +49,11 @@ class RateItem extends React.Component {
|
|
|
50
49
|
};
|
|
51
50
|
let style = itemStyle;
|
|
52
51
|
if (enterRateItemIndex >= rateItemIndex) {
|
|
53
|
-
style =
|
|
52
|
+
style = {
|
|
53
|
+
...itemStyle,
|
|
54
54
|
color: rate_style_color,
|
|
55
55
|
opacity: 0.4
|
|
56
|
-
}
|
|
56
|
+
};
|
|
57
57
|
}
|
|
58
58
|
return /*#__PURE__*/React.createElement("div", {
|
|
59
59
|
onMouseEnter: this.onMouseEnterRateItem,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
2
|
import { useTranslation } from 'react-i18next';
|
|
4
3
|
import TableSetting from './table-setting';
|
|
@@ -28,7 +27,10 @@ export default function TableSettings(_ref) {
|
|
|
28
27
|
setColumns(table.columns);
|
|
29
28
|
}, [editor, settings]);
|
|
30
29
|
const updatePageSettings = useCallback(updateProperties => {
|
|
31
|
-
const newElement =
|
|
30
|
+
const newElement = {
|
|
31
|
+
...settings,
|
|
32
|
+
...updateProperties
|
|
33
|
+
};
|
|
32
34
|
updateSettings(newElement);
|
|
33
35
|
if (timer.current) {
|
|
34
36
|
clearTimeout(timer.current);
|