@seafile/sdoc-editor 2.0.11 → 2.0.12-alpha.0
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-editor.js +2 -4
- package/dist/basic-sdk/comment/components/comment-item-wrapper.js +1 -4
- package/dist/basic-sdk/editor/editable-article.js +1 -4
- package/dist/basic-sdk/extension/commons/color-menu/index.js +2 -6
- package/dist/basic-sdk/extension/commons/menu/menu-item.js +2 -6
- package/dist/basic-sdk/extension/commons/more-dropdown/index.js +2 -6
- package/dist/basic-sdk/extension/constants/element-type.js +2 -1
- package/dist/basic-sdk/extension/constants/index.js +6 -0
- package/dist/basic-sdk/extension/constants/menus-config.js +5 -0
- package/dist/basic-sdk/extension/plugins/ai/ai-menu/menu-item.js +2 -6
- package/dist/basic-sdk/extension/plugins/chart/chart-edit-dialog/index.css +21 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-edit-dialog/index.js +66 -0
- package/dist/basic-sdk/extension/plugins/chart/helpers.js +106 -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 +58 -0
- package/dist/basic-sdk/extension/plugins/chart/index.js +19 -0
- package/dist/basic-sdk/extension/plugins/chart/menu/index.js +31 -0
- package/dist/basic-sdk/extension/plugins/chart/plugin.js +26 -0
- package/dist/basic-sdk/extension/plugins/chart/render-elem.css +61 -0
- package/dist/basic-sdk/extension/plugins/chart/render-elem.js +155 -0
- package/dist/basic-sdk/extension/plugins/font/menu/font-family/index.js +2 -6
- package/dist/basic-sdk/extension/plugins/font/menu/font-size/font-size-scale.js +2 -6
- package/dist/basic-sdk/extension/plugins/font/menu/font-size/index.js +2 -6
- package/dist/basic-sdk/extension/plugins/index.js +8 -1
- package/dist/basic-sdk/extension/plugins/seatable-tables/formatter/index.js +2 -2
- package/dist/basic-sdk/extension/plugins/seatable-tables/op-menu/index.css +1 -1
- package/dist/basic-sdk/extension/plugins/seatable-tables/op-menu/index.js +1 -3
- package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/dtable-search-input/index.js +2 -2
- package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/filter-setter/filter-popover-widgets/department-filter/selected-departments.js +6 -9
- package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/filter-setter/filter-popover.js +1 -1
- package/dist/basic-sdk/extension/plugins/table/dialogs/custom-table-size-dialog/number-input.js +8 -14
- package/dist/basic-sdk/extension/plugins/text-align/menu/index.js +2 -6
- package/dist/basic-sdk/extension/render/custom-element.js +5 -0
- package/dist/basic-sdk/extension/toolbar/comment-editor-toolbar/index.js +1 -4
- package/dist/basic-sdk/extension/toolbar/header-toolbar/insert-toolbar/index.js +4 -7
- package/dist/basic-sdk/extension/toolbar/insert-element-toolbar/index.js +2 -5
- package/dist/basic-sdk/extension/toolbar/side-toolbar/insert-block-menu.js +1 -4
- package/dist/basic-sdk/layout/editor-content.js +3 -8
- package/dist/basic-sdk/views/sdoc-wiki-viewer.js +1 -5
- package/dist/pages/document-plugin-editor.js +2 -0
- package/package.json +2 -1
- package/public/locales/cs/sdoc-editor.json +5 -1
- package/public/locales/de/sdoc-editor.json +64 -60
- package/public/locales/en/sdoc-editor.json +5 -1
- package/public/locales/es/sdoc-editor.json +5 -1
- package/public/locales/es_AR/sdoc-editor.json +5 -1
- package/public/locales/es_MX/sdoc-editor.json +5 -1
- package/public/locales/fr/sdoc-editor.json +238 -234
- package/public/locales/it/sdoc-editor.json +5 -1
- package/public/locales/ru/sdoc-editor.json +6 -2
- package/public/locales/zh_CN/sdoc-editor.json +4 -1
|
@@ -27,13 +27,14 @@ const getSubmitTip = (type, content) => {
|
|
|
27
27
|
if (content) return 'Save';
|
|
28
28
|
return type === 'comment' ? 'Comment' : 'Reply';
|
|
29
29
|
};
|
|
30
|
+
const DEFAULT_PLACEHOLDER = 'Enter_comment_shift_enter_for_new_line_Enter_to_send';
|
|
30
31
|
const CommentEditor = _ref => {
|
|
31
32
|
let {
|
|
32
33
|
type,
|
|
33
34
|
className,
|
|
34
35
|
content,
|
|
35
36
|
commentContent,
|
|
36
|
-
placeholder,
|
|
37
|
+
placeholder = DEFAULT_PLACEHOLDER,
|
|
37
38
|
insertContent,
|
|
38
39
|
updateContent,
|
|
39
40
|
setIsEditing,
|
|
@@ -159,7 +160,4 @@ const CommentEditor = _ref => {
|
|
|
159
160
|
onCancel: onCancel
|
|
160
161
|
}));
|
|
161
162
|
};
|
|
162
|
-
CommentEditor.defaultProps = {
|
|
163
|
-
placeholder: 'Enter_comment_shift_enter_for_new_line_Enter_to_send'
|
|
164
|
-
};
|
|
165
163
|
var _default = exports.default = CommentEditor;
|
|
@@ -19,7 +19,7 @@ var _constants = require("../constants");
|
|
|
19
19
|
var _commentDeletePopover = _interopRequireDefault(require("./comment-delete-popover"));
|
|
20
20
|
const CommentItemWrapper = _ref => {
|
|
21
21
|
let {
|
|
22
|
-
container,
|
|
22
|
+
container = 'sdoc-comment-list-container',
|
|
23
23
|
editor,
|
|
24
24
|
element,
|
|
25
25
|
isActive,
|
|
@@ -309,7 +309,4 @@ const CommentItemWrapper = _ref => {
|
|
|
309
309
|
parentDom: listRef.current
|
|
310
310
|
}));
|
|
311
311
|
};
|
|
312
|
-
CommentItemWrapper.defaultProps = {
|
|
313
|
-
container: 'sdoc-comment-list-container'
|
|
314
|
-
};
|
|
315
312
|
var _default = exports.default = CommentItemWrapper;
|
|
@@ -27,7 +27,7 @@ var _helpers = require("../extension/plugins/table/helpers");
|
|
|
27
27
|
var _useForceUpdate = _interopRequireDefault(require("../../basic-sdk/hooks/use-force-update"));
|
|
28
28
|
const EditableArticle = _ref => {
|
|
29
29
|
let {
|
|
30
|
-
showComment,
|
|
30
|
+
showComment = true,
|
|
31
31
|
editor,
|
|
32
32
|
slateValue,
|
|
33
33
|
updateSlateValue
|
|
@@ -239,7 +239,4 @@ const EditableArticle = _ref => {
|
|
|
239
239
|
type: "editor"
|
|
240
240
|
})));
|
|
241
241
|
};
|
|
242
|
-
EditableArticle.defaultProps = {
|
|
243
|
-
showComment: true
|
|
244
|
-
};
|
|
245
242
|
var _default = exports.default = EditableArticle;
|
|
@@ -19,11 +19,11 @@ var _tooltip = _interopRequireDefault(require("../../../../components/tooltip"))
|
|
|
19
19
|
require("./index.css");
|
|
20
20
|
const ColorMenu = _ref => {
|
|
21
21
|
let {
|
|
22
|
+
isRichEditor = true,
|
|
23
|
+
className = 'menu-group-item',
|
|
22
24
|
ariaLabel,
|
|
23
25
|
iconClass,
|
|
24
26
|
id,
|
|
25
|
-
isRichEditor,
|
|
26
|
-
className,
|
|
27
27
|
popoverClassName,
|
|
28
28
|
disabled,
|
|
29
29
|
t,
|
|
@@ -213,8 +213,4 @@ const ColorMenu = _ref => {
|
|
|
213
213
|
onChange: onChange
|
|
214
214
|
}))))));
|
|
215
215
|
};
|
|
216
|
-
ColorMenu.defaultProps = {
|
|
217
|
-
isRichEditor: true,
|
|
218
|
-
className: 'menu-group-item'
|
|
219
|
-
};
|
|
220
216
|
var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(ColorMenu);
|
|
@@ -13,12 +13,12 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
13
13
|
var _constants = require("../../constants");
|
|
14
14
|
const MenuItem = _ref => {
|
|
15
15
|
let {
|
|
16
|
+
isRichEditor = true,
|
|
17
|
+
className = 'menu-group-item',
|
|
16
18
|
disabled,
|
|
17
19
|
isActive,
|
|
18
|
-
isRichEditor,
|
|
19
20
|
type,
|
|
20
21
|
onMouseDown,
|
|
21
|
-
className,
|
|
22
22
|
iconClass,
|
|
23
23
|
id,
|
|
24
24
|
text,
|
|
@@ -57,8 +57,4 @@ const MenuItem = _ref => {
|
|
|
57
57
|
target: id
|
|
58
58
|
}, t(text)));
|
|
59
59
|
};
|
|
60
|
-
MenuItem.defaultProps = {
|
|
61
|
-
isRichEditor: true,
|
|
62
|
-
className: 'menu-group-item'
|
|
63
|
-
};
|
|
64
60
|
var _default = exports.default = MenuItem;
|
|
@@ -10,9 +10,9 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
10
10
|
var _reactstrap = require("reactstrap");
|
|
11
11
|
const MoreDropdown = _ref => {
|
|
12
12
|
let {
|
|
13
|
-
|
|
13
|
+
isRichEditor = true,
|
|
14
|
+
className = 'menu-group-item',
|
|
14
15
|
disabled,
|
|
15
|
-
isRichEditor,
|
|
16
16
|
children
|
|
17
17
|
} = _ref;
|
|
18
18
|
const validClassName = (0, _classnames.default)(className, 'sdoc-more-text-button', {
|
|
@@ -41,8 +41,4 @@ const MoreDropdown = _ref => {
|
|
|
41
41
|
className: "menu-group"
|
|
42
42
|
}, children)));
|
|
43
43
|
};
|
|
44
|
-
MoreDropdown.defaultProps = {
|
|
45
|
-
isRichEditor: true,
|
|
46
|
-
className: 'menu-group-item'
|
|
47
|
-
};
|
|
48
44
|
var _default = exports.default = MoreDropdown;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.WIKI_LINK = exports.VIDEO_LINK = exports.VIDEO = exports.UNORDERED_LIST = exports.TWO_COLUMN = exports.TOP_LEVEL_TYPES = exports.TITLE = exports.THREE_COLUMN = exports.TABLE_ROW = exports.TABLE_CELL = exports.TABLE = exports.SUBTITLE = exports.SEATABLE_TABLE = exports.SEATABLE_COLUMN = exports.SDOC_LINK = exports.QUICK_INSERT = exports.PARAGRAPH = exports.ORDERED_LIST = exports.MULTI_COLUMN = exports.MENTION_TEMP = exports.MENTION = exports.LIST_ITEM = exports.LINK = exports.INLINE_LEVEL_TYPES = exports.IMAGE_BLOCK = exports.IMAGE = exports.HEADER6 = exports.HEADER5 = exports.HEADER4 = exports.HEADER3 = exports.HEADER2 = exports.HEADER1 = exports.HEADER = exports.GROUP = exports.FOUR_COLUMN = exports.FONT_SIZE_REDUCE = exports.FONT_SIZE_INCREASE = exports.FONT_SIZE = exports.FIVE_COLUMN = exports.FILE_LINK_INSET_INPUT_TEMP = exports.FILE_LINK = exports.COLUMN = exports.CODE_LINE = exports.CODE_BLOCK = exports.CHECK_LIST_ITEM = exports.CALL_OUT = exports.BLOCKQUOTE = exports.ASK_AI = void 0;
|
|
6
|
+
exports.WIKI_LINK = exports.VIDEO_LINK = exports.VIDEO = exports.UNORDERED_LIST = exports.TWO_COLUMN = exports.TOP_LEVEL_TYPES = exports.TITLE = exports.THREE_COLUMN = exports.TABLE_ROW = exports.TABLE_CELL = exports.TABLE = exports.SUBTITLE = exports.SEATABLE_TABLE = exports.SEATABLE_COLUMN = exports.SDOC_LINK = exports.QUICK_INSERT = exports.PARAGRAPH = exports.ORDERED_LIST = exports.MULTI_COLUMN = exports.MENTION_TEMP = exports.MENTION = exports.LIST_ITEM = exports.LINK = exports.INLINE_LEVEL_TYPES = exports.IMAGE_BLOCK = exports.IMAGE = exports.HEADER6 = exports.HEADER5 = exports.HEADER4 = exports.HEADER3 = exports.HEADER2 = exports.HEADER1 = exports.HEADER = exports.GROUP = exports.FOUR_COLUMN = exports.FONT_SIZE_REDUCE = exports.FONT_SIZE_INCREASE = exports.FONT_SIZE = exports.FIVE_COLUMN = exports.FILE_LINK_INSET_INPUT_TEMP = exports.FILE_LINK = exports.COLUMN = exports.CODE_LINE = exports.CODE_BLOCK = exports.CHECK_LIST_ITEM = exports.CHART = exports.CALL_OUT = exports.BLOCKQUOTE = exports.ASK_AI = void 0;
|
|
7
7
|
const BLOCKQUOTE = exports.BLOCKQUOTE = 'blockquote';
|
|
8
8
|
const TITLE = exports.TITLE = 'title';
|
|
9
9
|
const SUBTITLE = exports.SUBTITLE = 'subtitle';
|
|
@@ -43,6 +43,7 @@ const MENTION_TEMP = exports.MENTION_TEMP = 'mention_temp';
|
|
|
43
43
|
const FILE_LINK_INSET_INPUT_TEMP = exports.FILE_LINK_INSET_INPUT_TEMP = 'file_link_insert_input_temp';
|
|
44
44
|
const QUICK_INSERT = exports.QUICK_INSERT = 'quick_insert';
|
|
45
45
|
const VIDEO_LINK = exports.VIDEO_LINK = 'video_link';
|
|
46
|
+
const CHART = exports.CHART = 'chart';
|
|
46
47
|
const SEATABLE_COLUMN = exports.SEATABLE_COLUMN = 'seatable_column';
|
|
47
48
|
const SEATABLE_TABLE = exports.SEATABLE_TABLE = 'seatable_table';
|
|
48
49
|
const ASK_AI = exports.ASK_AI = 'ask_ai';
|
|
@@ -23,6 +23,12 @@ Object.defineProperty(exports, "CALL_OUT", {
|
|
|
23
23
|
return _elementType.CALL_OUT;
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
+
Object.defineProperty(exports, "CHART", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () {
|
|
29
|
+
return _elementType.CHART;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
26
32
|
Object.defineProperty(exports, "CHECK_LIST_ITEM", {
|
|
27
33
|
enumerable: true,
|
|
28
34
|
get: function () {
|
|
@@ -233,6 +233,11 @@ const MENUS_CONFIG_MAP = exports.MENUS_CONFIG_MAP = {
|
|
|
233
233
|
iconClass: 'sdocfont sdoc-seatable-table',
|
|
234
234
|
type: _elementType.SEATABLE_TABLE,
|
|
235
235
|
text: 'SeaTable_table'
|
|
236
|
+
},
|
|
237
|
+
[_elementType.CHART]: {
|
|
238
|
+
id: `sdoc_${_elementType.CHART}`,
|
|
239
|
+
iconClass: 'sdocfont sdoc-chart',
|
|
240
|
+
text: 'Insert_chart'
|
|
236
241
|
}
|
|
237
242
|
};
|
|
238
243
|
|
|
@@ -13,12 +13,12 @@ var _tooltip = _interopRequireDefault(require("../../../../../components/tooltip
|
|
|
13
13
|
var _aiIcon = _interopRequireDefault(require("../ai-icon"));
|
|
14
14
|
const MenuItem = _ref => {
|
|
15
15
|
let {
|
|
16
|
+
isRichEditor = true,
|
|
17
|
+
className = 'menu-group-item',
|
|
16
18
|
disabled,
|
|
17
19
|
isActive,
|
|
18
|
-
isRichEditor,
|
|
19
20
|
type,
|
|
20
21
|
onMouseDown,
|
|
21
|
-
className,
|
|
22
22
|
iconClass,
|
|
23
23
|
id,
|
|
24
24
|
text,
|
|
@@ -55,8 +55,4 @@ const MenuItem = _ref => {
|
|
|
55
55
|
target: id
|
|
56
56
|
}, t(text)));
|
|
57
57
|
};
|
|
58
|
-
MenuItem.defaultProps = {
|
|
59
|
-
isRichEditor: true,
|
|
60
|
-
className: 'menu-group-item'
|
|
61
|
-
};
|
|
62
58
|
var _default = exports.default = MenuItem;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.sdoc-chart-edit-dialog {
|
|
2
|
+
max-width: 1100px;
|
|
3
|
+
width: 1100px;
|
|
4
|
+
height: calc(100% - 56px);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.sdoc-chart-edit-dialog .modal-content {
|
|
8
|
+
height: 100%;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.sdoc-chart-edit-dialog .modal-body {
|
|
12
|
+
padding: 0;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
display: flex;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.sdoc-chart-edit-dialog .sdoc-chart-fullscreen-view {
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 600px;
|
|
20
|
+
}
|
|
21
|
+
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _DTableModalHeader2 = _interopRequireDefault(require("dtable-ui-component/lib/DTableModalHeader"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _reactstrap = require("reactstrap");
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
var _reactI18next = require("react-i18next");
|
|
14
|
+
var _seaChart = require("sea-chart");
|
|
15
|
+
var _context = _interopRequireDefault(require("../../../../../context"));
|
|
16
|
+
require("./index.css");
|
|
17
|
+
const ChartEditDialog = _ref => {
|
|
18
|
+
var _window, _window$app, _window$app$state, _window2, _window2$app, _window2$app$state;
|
|
19
|
+
let {
|
|
20
|
+
editor,
|
|
21
|
+
element,
|
|
22
|
+
api,
|
|
23
|
+
isFullScreen,
|
|
24
|
+
onCloseEditDialog,
|
|
25
|
+
t
|
|
26
|
+
} = _ref;
|
|
27
|
+
const [statItemData, setStatItemData] = (0, _react.useState)(element.statItem || {});
|
|
28
|
+
const onSettingChange = (0, _react.useCallback)(setting => {
|
|
29
|
+
const newStatItemData = {
|
|
30
|
+
...statItemData,
|
|
31
|
+
...setting
|
|
32
|
+
};
|
|
33
|
+
setStatItemData(newStatItemData);
|
|
34
|
+
}, [statItemData]);
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement(_reactstrap.Modal, {
|
|
36
|
+
className: "sdoc-chart-edit-dialog",
|
|
37
|
+
isOpen: true,
|
|
38
|
+
toggle: () => onCloseEditDialog(statItemData)
|
|
39
|
+
}, /*#__PURE__*/_react.default.createElement(_DTableModalHeader2.default, {
|
|
40
|
+
toggle: () => onCloseEditDialog(statItemData)
|
|
41
|
+
}, t(!isFullScreen ? 'Edit_chart' : 'Chart')), /*#__PURE__*/_react.default.createElement(_reactstrap.ModalBody, {
|
|
42
|
+
className: (0, _classnames.default)({
|
|
43
|
+
'sdoc-chart-fullscreen-view': isFullScreen
|
|
44
|
+
})
|
|
45
|
+
}, !isFullScreen && /*#__PURE__*/_react.default.createElement(_seaChart.Editor, {
|
|
46
|
+
chart: statItemData,
|
|
47
|
+
config: _context.default.getSettings(),
|
|
48
|
+
api: api,
|
|
49
|
+
tables: editor.tables || [],
|
|
50
|
+
collaborators: editor.collaborators || [],
|
|
51
|
+
departments: ((_window = window) === null || _window === void 0 ? void 0 : (_window$app = _window.app) === null || _window$app === void 0 ? void 0 : (_window$app$state = _window$app.state) === null || _window$app$state === void 0 ? void 0 : _window$app$state.departments) || [],
|
|
52
|
+
isCalculateByView: true,
|
|
53
|
+
isRenderByD3: true,
|
|
54
|
+
onChange: onSettingChange
|
|
55
|
+
}), isFullScreen && /*#__PURE__*/_react.default.createElement(_seaChart.View, {
|
|
56
|
+
chart: statItemData,
|
|
57
|
+
api: api,
|
|
58
|
+
config: _context.default.getSettings(),
|
|
59
|
+
tables: editor.tables,
|
|
60
|
+
collaborators: editor.collaborators || [],
|
|
61
|
+
departments: ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$app = _window2.app) === null || _window2$app === void 0 ? void 0 : (_window2$app$state = _window2$app.state) === null || _window2$app$state === void 0 ? void 0 : _window2$app$state.departments) || [],
|
|
62
|
+
isCalculateByView: true,
|
|
63
|
+
isRenderByD3: true
|
|
64
|
+
})));
|
|
65
|
+
};
|
|
66
|
+
var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(ChartEditDialog);
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.isSelectedTable = exports.isInsertChartMenuDisabled = exports.isInit = exports.isInViewPort = exports.insertChart = exports.getChartDbMetaData = exports.generateChartNode = void 0;
|
|
8
|
+
var _slate = require("@seafile/slate");
|
|
9
|
+
var _seaChart = require("sea-chart");
|
|
10
|
+
var _context = _interopRequireDefault(require("../../../../context"));
|
|
11
|
+
var _core = require("../../core");
|
|
12
|
+
var _constants = require("../../constants");
|
|
13
|
+
const isInsertChartMenuDisabled = (editor, readonly) => {
|
|
14
|
+
if (readonly) return true;
|
|
15
|
+
const {
|
|
16
|
+
selection
|
|
17
|
+
} = editor;
|
|
18
|
+
if (selection === null) return true;
|
|
19
|
+
if (!_slate.Range.isCollapsed(selection)) return true;
|
|
20
|
+
const [match] = _slate.Editor.nodes(editor, {
|
|
21
|
+
match: n => {
|
|
22
|
+
let type = (0, _core.getNodeType)(n);
|
|
23
|
+
if (!type && (0, _core.isTextNode)(n) && n.id) {
|
|
24
|
+
const parentNode = (0, _core.getParentNode)(editor.children, n.id);
|
|
25
|
+
type = (0, _core.getNodeType)(parentNode);
|
|
26
|
+
}
|
|
27
|
+
if (type === _constants.CODE_BLOCK) return true;
|
|
28
|
+
if (type === _constants.TABLE) return true;
|
|
29
|
+
if (type.startsWith('header')) return true;
|
|
30
|
+
if (_slate.Editor.isVoid(editor, n)) return true;
|
|
31
|
+
return false;
|
|
32
|
+
},
|
|
33
|
+
universal: true
|
|
34
|
+
});
|
|
35
|
+
if (match) return true;
|
|
36
|
+
return false;
|
|
37
|
+
};
|
|
38
|
+
exports.isInsertChartMenuDisabled = isInsertChartMenuDisabled;
|
|
39
|
+
const generateChartNode = editor => {
|
|
40
|
+
const element = (0, _core.generateEmptyElement)(_constants.CHART);
|
|
41
|
+
const initConfig = {
|
|
42
|
+
option: {
|
|
43
|
+
id: element.id,
|
|
44
|
+
table_id: editor.tables[0]._id,
|
|
45
|
+
// Default first table
|
|
46
|
+
view_id: editor.tables[0].views[0]._id // Default first view
|
|
47
|
+
},
|
|
48
|
+
tables: []
|
|
49
|
+
};
|
|
50
|
+
const model = new _seaChart.ChartModel(initConfig.option, initConfig.tables);
|
|
51
|
+
return {
|
|
52
|
+
...element,
|
|
53
|
+
statItem: {
|
|
54
|
+
...model,
|
|
55
|
+
type: model.config.type
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
exports.generateChartNode = generateChartNode;
|
|
60
|
+
const insertChart = editor => {
|
|
61
|
+
const chartNode = generateChartNode(editor);
|
|
62
|
+
const path = _slate.Editor.path(editor, editor.selection);
|
|
63
|
+
_slate.Transforms.insertNodes(editor, chartNode, {
|
|
64
|
+
at: [path[0]]
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
exports.insertChart = insertChart;
|
|
68
|
+
const isInViewPort = element => {
|
|
69
|
+
const viewHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
70
|
+
const {
|
|
71
|
+
top
|
|
72
|
+
} = element.getBoundingClientRect();
|
|
73
|
+
return top >= 0 && top <= viewHeight;
|
|
74
|
+
};
|
|
75
|
+
exports.isInViewPort = isInViewPort;
|
|
76
|
+
const getChartDbMetaData = async (statItem, dtableBases, sql) => {
|
|
77
|
+
const {
|
|
78
|
+
base_id
|
|
79
|
+
} = statItem;
|
|
80
|
+
const integrationConfig = dtableBases === null || dtableBases === void 0 ? void 0 : dtableBases.find(item => item.base_api_token === base_id);
|
|
81
|
+
if (integrationConfig) {
|
|
82
|
+
const dtableServer = await _context.default.getDtableServer(integrationConfig);
|
|
83
|
+
const res = await _context.default.getDbMetaData(dtableServer, sql);
|
|
84
|
+
return res;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
exports.getChartDbMetaData = getChartDbMetaData;
|
|
88
|
+
const isInit = statItem => {
|
|
89
|
+
const {
|
|
90
|
+
base_id
|
|
91
|
+
} = statItem;
|
|
92
|
+
if (!base_id) {
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
return false;
|
|
96
|
+
};
|
|
97
|
+
exports.isInit = isInit;
|
|
98
|
+
const isSelectedTable = (statItem, dtableBases) => {
|
|
99
|
+
const {
|
|
100
|
+
base_id,
|
|
101
|
+
table_id,
|
|
102
|
+
table_name
|
|
103
|
+
} = statItem;
|
|
104
|
+
return base_id && table_id && table_name && (dtableBases === null || dtableBases === void 0 ? void 0 : dtableBases.length) > 0;
|
|
105
|
+
};
|
|
106
|
+
exports.isSelectedTable = isSelectedTable;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
.sdoc-chart-hover-menu-container {
|
|
2
|
+
position: absolute;
|
|
3
|
+
height: 42px;
|
|
4
|
+
z-index: 101;
|
|
5
|
+
width: auto;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.sdoc-chart-hover-menu-container .hover-menu-container {
|
|
9
|
+
height: 36px;
|
|
10
|
+
padding: 7px 8px;
|
|
11
|
+
background-color: #fff;
|
|
12
|
+
display: flex;
|
|
13
|
+
justify-content: flex-start;
|
|
14
|
+
align-items: center;
|
|
15
|
+
border-radius: 3px;
|
|
16
|
+
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
|
|
17
|
+
border: 1px solid #e8e8e8;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.sdoc-chart-hover-menu-container .hover-menu-container > span:not(:last-of-type) {
|
|
21
|
+
padding-right: 6px;
|
|
22
|
+
border-right: 1px solid #e5e5e5;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.sdoc-chart-hover-menu-container .hover-menu-container .op-item {
|
|
26
|
+
position: relative;
|
|
27
|
+
font-size: 12px;
|
|
28
|
+
color: #212529;
|
|
29
|
+
padding: 0 5px;
|
|
30
|
+
border-radius: 2px;
|
|
31
|
+
min-width: 24px;
|
|
32
|
+
height: 24px;
|
|
33
|
+
display: inline-flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.sdoc-chart-hover-menu-container .hover-menu-container .op-item:hover {
|
|
39
|
+
color: #212529;
|
|
40
|
+
text-decoration: none;
|
|
41
|
+
background: #f1f1f1;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.sdoc-chart-hover-menu-container .op-group-item:last-child .op-item {
|
|
45
|
+
margin-left: 8px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.sdoc-chart-hover-menu-container .hover-menu-container .active {
|
|
49
|
+
background: #f1f1f1;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.sdoc-chart-hover-menu-container .hover-menu-container .icon-font {
|
|
53
|
+
font-size: 12px;
|
|
54
|
+
color: #999999;
|
|
55
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _reactI18next = require("react-i18next");
|
|
11
|
+
var _commons = require("../../../commons");
|
|
12
|
+
var _tooltip = _interopRequireDefault(require("../../../../../components/tooltip"));
|
|
13
|
+
require("./index.css");
|
|
14
|
+
const ChartHoverMenu = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
menuPosition,
|
|
17
|
+
onEditChart,
|
|
18
|
+
onFullscreen,
|
|
19
|
+
t
|
|
20
|
+
} = _ref;
|
|
21
|
+
const [isShowTooltip, setIsShowTooltip] = (0, _react.useState)(false);
|
|
22
|
+
(0, _react.useEffect)(() => {
|
|
23
|
+
setIsShowTooltip(true);
|
|
24
|
+
}, []);
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement(_commons.ElementPopover, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
26
|
+
className: "sdoc-chart-hover-menu-container",
|
|
27
|
+
style: menuPosition
|
|
28
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
29
|
+
className: "hover-menu-container"
|
|
30
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
31
|
+
className: "op-group-item"
|
|
32
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
33
|
+
id: "sdoc_chart_edit",
|
|
34
|
+
role: "button",
|
|
35
|
+
className: "op-item",
|
|
36
|
+
onClick: onEditChart
|
|
37
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
38
|
+
className: "sdocfont sdoc-rename icon-font"
|
|
39
|
+
}), isShowTooltip && /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
40
|
+
target: "sdoc_chart_edit",
|
|
41
|
+
placement: "top",
|
|
42
|
+
fade: true
|
|
43
|
+
}, t('Edit_chart')))), /*#__PURE__*/_react.default.createElement("span", {
|
|
44
|
+
className: "op-group-item"
|
|
45
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
46
|
+
id: "sdoc_chart_full_screen_mode",
|
|
47
|
+
role: "button",
|
|
48
|
+
className: "op-item",
|
|
49
|
+
onClick: onFullscreen
|
|
50
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
51
|
+
className: "sdocfont sdoc-fullscreen icon-font"
|
|
52
|
+
}), isShowTooltip && /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
53
|
+
target: "sdoc_chart_full_screen_mode",
|
|
54
|
+
placement: "top",
|
|
55
|
+
fade: true
|
|
56
|
+
}, t('Full_screen_mode')))))));
|
|
57
|
+
};
|
|
58
|
+
var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(ChartHoverMenu);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _constants = require("../../constants");
|
|
9
|
+
var _menu = _interopRequireDefault(require("./menu"));
|
|
10
|
+
var _plugin = _interopRequireDefault(require("./plugin"));
|
|
11
|
+
var _renderElem = _interopRequireDefault(require("./render-elem"));
|
|
12
|
+
const ChartPlugin = {
|
|
13
|
+
type: _constants.CHART,
|
|
14
|
+
nodeType: 'element',
|
|
15
|
+
editorMenus: [_menu.default],
|
|
16
|
+
editorPlugin: _plugin.default,
|
|
17
|
+
renderElements: [_renderElem.default]
|
|
18
|
+
};
|
|
19
|
+
var _default = exports.default = ChartPlugin;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _helpers = require("../helpers");
|
|
11
|
+
var _constants = require("../../../constants");
|
|
12
|
+
var _dropdownMenuItem = _interopRequireDefault(require("../../../commons/dropdown-menu-item"));
|
|
13
|
+
const ChartMenu = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
editor,
|
|
16
|
+
readonly,
|
|
17
|
+
toggle
|
|
18
|
+
} = _ref;
|
|
19
|
+
const disabled = (0, _helpers.isInsertChartMenuDisabled)(editor, readonly);
|
|
20
|
+
const menuConfig = _constants.MENUS_CONFIG_MAP[_constants.CHART];
|
|
21
|
+
const onInsertChart = (0, _react.useCallback)(() => {
|
|
22
|
+
(0, _helpers.insertChart)(editor);
|
|
23
|
+
toggle && toggle();
|
|
24
|
+
}, [editor, toggle]);
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
|
|
26
|
+
disabled: disabled,
|
|
27
|
+
menuConfig: menuConfig,
|
|
28
|
+
onClick: onInsertChart
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
var _default = exports.default = ChartMenu;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _constants = require("../../constants");
|
|
8
|
+
const withChart = editor => {
|
|
9
|
+
const {
|
|
10
|
+
isVoid
|
|
11
|
+
} = editor;
|
|
12
|
+
const newEditor = editor;
|
|
13
|
+
|
|
14
|
+
// Rewrite isVoid
|
|
15
|
+
newEditor.isVoid = elem => {
|
|
16
|
+
const {
|
|
17
|
+
type
|
|
18
|
+
} = elem;
|
|
19
|
+
if (type === _constants.CHART) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
return isVoid(elem);
|
|
23
|
+
};
|
|
24
|
+
return newEditor;
|
|
25
|
+
};
|
|
26
|
+
var _default = exports.default = withChart;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
.sdoc-chart-container {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 300px;
|
|
4
|
+
padding: 8px;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.sdoc-chart-container .sdoc-chart-view {
|
|
9
|
+
position: relative;
|
|
10
|
+
background-color: #f5f5f5;
|
|
11
|
+
width: 100%;
|
|
12
|
+
height: 100%;
|
|
13
|
+
padding: 10px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.sdoc-chart-container .sdoc-chart-view .sdoc-chart-view-content {
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: 100%;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.sdoc-chart-container .active {
|
|
22
|
+
box-shadow: 0 0 0 2px #007bff;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.sdoc-chart-container .active .sdoc-chart-view-rect {
|
|
26
|
+
display: inline-block;
|
|
27
|
+
width: 8px;
|
|
28
|
+
height: 8px;
|
|
29
|
+
background-color: #007bff;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.sdoc-chart-container .active .sdoc-chart-view-rect-lt {
|
|
33
|
+
position: absolute;
|
|
34
|
+
left: -5px;
|
|
35
|
+
top: -5px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.sdoc-chart-container .active .sdoc-chart-view-rect-lb {
|
|
39
|
+
position: absolute;
|
|
40
|
+
left: -5px;
|
|
41
|
+
bottom: -5px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.sdoc-chart-container .active .sdoc-chart-view-rect-rt {
|
|
45
|
+
position: absolute;
|
|
46
|
+
right: -5px;
|
|
47
|
+
top: -5px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.sdoc-chart-container .active .sdoc-chart-view-rect-rb {
|
|
51
|
+
position: absolute;
|
|
52
|
+
right: -5px;
|
|
53
|
+
bottom: -5px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.sdoc-chart-container .sdoc-chart-view .sdoc-chart-tip {
|
|
57
|
+
top: 50%;
|
|
58
|
+
left: 50%;
|
|
59
|
+
transform: translate(-50%, -50%);
|
|
60
|
+
position: absolute;
|
|
61
|
+
}
|