@yuntijs/ui 1.0.0-beta.99 → 1.1.0-beta.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/es/ChatItem/index.js +6 -2
- package/es/ChatItem/type.d.ts +1 -0
- package/es/ChatMarkdown/MarkdownElements/AntThinking/Component.js +6 -6
- package/es/ChatMarkdown/MarkdownElements/AntThinking/remarkPlugin.js +1 -1
- package/es/ChatMarkdown/utils.js +8 -3
- package/es/CodeEditor/index.d.ts +52 -0
- package/es/CodeEditor/index.js +418 -0
- package/es/CodeEditor/style.d.ts +9 -0
- package/es/CodeEditor/style.js +19 -0
- package/es/CollapseGroup/index.js +20 -4
- package/es/CollapseGroup/style.d.ts +3 -1
- package/es/CollapseGroup/style.js +3 -2
- package/es/Form/collapse-list/FieldsWatcher.d.ts +7 -0
- package/es/Form/collapse-list/FieldsWatcher.js +19 -0
- package/es/Form/collapse-list/hooks.d.ts +20 -0
- package/es/Form/collapse-list/hooks.js +158 -0
- package/es/Form/collapse-list/index.d.ts +19 -6
- package/es/Form/collapse-list/index.js +163 -59
- package/es/Form/collapse-list/style.d.ts +1 -0
- package/es/Form/collapse-list/style.js +4 -3
- package/es/Form/collapse-list/utils.d.ts +10 -0
- package/es/Form/collapse-list/utils.js +4 -0
- package/es/JsonViewer/index.d.ts +1 -0
- package/es/JsonViewer/index.js +1 -0
- package/es/Mentions/index.d.ts +2 -0
- package/es/Mentions/index.js +17 -2
- package/es/Mentions/plugins/mention-node/component.js +1 -1
- package/es/Mentions/plugins/mention-picker/hooks.js +1 -0
- package/es/Mentions/plugins/mention-picker/index.d.ts +4 -0
- package/es/Mentions/plugins/mention-picker/index.js +49 -12
- package/es/Mentions/plugins/mention-picker/menu-item.js +19 -3
- package/es/Mentions/plugins/mention-picker/style.js +1 -1
- package/es/Mentions/plugins/mention-picker/utils.d.ts +3 -1
- package/es/Mentions/plugins/mention-picker/utils.js +3 -0
- package/es/Mentions/style.d.ts +1 -0
- package/es/Mentions/style.js +4 -4
- package/es/MonacoEditor/base/helper.d.ts +4 -0
- package/es/MonacoEditor/base/helper.js +8 -3
- package/es/MonacoEditor/base/index.d.ts +2 -2
- package/es/MonacoEditor/base/index.js +33 -10
- package/es/MonacoEditor/base/style.js +1 -1
- package/es/MonacoEditor/index.js +1 -1
- package/es/hooks/useHighlight.js +13 -9
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/utils/platform.d.ts +1 -0
- package/es/utils/platform.js +1 -0
- package/package.json +5 -5
- package/umd/index.min.js +1 -1
- package/umd/index.min.js.map +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { NamePath } from 'antd/es/form/interface';
|
|
2
|
+
export declare const FIELD_KEY_PATH = "__YUNTI_FORM_COLLAPSE_LIST_FIELD_KEY_PATH";
|
|
3
|
+
export type ListFieldValue<K extends string = 'children'> = {
|
|
4
|
+
[P in K]?: ListFieldValue[];
|
|
5
|
+
} & {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
[FIELD_KEY_PATH]: number[];
|
|
8
|
+
};
|
|
9
|
+
export type FieldPath = NamePath<any>;
|
|
10
|
+
export declare const toRowKey: (keyPath: number[]) => string;
|
package/es/JsonViewer/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import React, { ReactNode } from 'react';
|
|
|
2
2
|
import type { JsonViewProps } from 'react18-json-view';
|
|
3
3
|
import 'react18-json-view/src/dark.css';
|
|
4
4
|
import 'react18-json-view/src/style.css';
|
|
5
|
+
export { stringify } from 'react18-json-view';
|
|
5
6
|
export interface JsonViewerProps extends JsonViewProps {
|
|
6
7
|
/**
|
|
7
8
|
* @description The type of the json block
|
package/es/JsonViewer/index.js
CHANGED
|
@@ -16,6 +16,7 @@ import Typography from "../Typography";
|
|
|
16
16
|
import { useStyles } from "./style";
|
|
17
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
18
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
export { stringify } from 'react18-json-view';
|
|
19
20
|
var Text = Typography.Text;
|
|
20
21
|
export var JsonViewer = function JsonViewer(_ref) {
|
|
21
22
|
var _ref$type = _ref.type,
|
package/es/Mentions/index.d.ts
CHANGED
|
@@ -19,5 +19,7 @@ export interface MentionsProps extends MentionPickerPluginProps {
|
|
|
19
19
|
onFocus?: () => void;
|
|
20
20
|
variant?: 'outlined' | 'filled' | 'borderless';
|
|
21
21
|
autoSize?: AutoSize;
|
|
22
|
+
code?: boolean;
|
|
23
|
+
getPopContainer?: () => HTMLElement;
|
|
22
24
|
}
|
|
23
25
|
export declare const Mentions: React.FC<MentionsProps>;
|
package/es/Mentions/index.js
CHANGED
|
@@ -8,6 +8,8 @@ import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin';
|
|
|
8
8
|
import { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin';
|
|
9
9
|
import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin';
|
|
10
10
|
import { ConfigProvider } from 'antd';
|
|
11
|
+
// @Todo: 升级 0.25.0 后,ops-console 使用的时候出现了只输入 / 无法触发的问题
|
|
12
|
+
|
|
11
13
|
import { $getRoot, TextNode } from 'lexical';
|
|
12
14
|
import React, { useMemo } from 'react';
|
|
13
15
|
import { isBrowser } from "../utils/tools";
|
|
@@ -44,11 +46,15 @@ export var Mentions = function Mentions(_ref) {
|
|
|
44
46
|
allowSpaces = _ref.allowSpaces,
|
|
45
47
|
punctuation = _ref.punctuation,
|
|
46
48
|
preTriggerChars = _ref.preTriggerChars,
|
|
47
|
-
onSelect = _ref.onSelect
|
|
49
|
+
onSelect = _ref.onSelect,
|
|
50
|
+
_ref$code = _ref.code,
|
|
51
|
+
code = _ref$code === void 0 ? false : _ref$code,
|
|
52
|
+
getPopContainer = _ref.getPopContainer;
|
|
48
53
|
var _ConfigProvider$useCo = ConfigProvider.useConfig(),
|
|
49
54
|
componentDisabled = _ConfigProvider$useCo.componentDisabled;
|
|
50
55
|
var _useStyles = useStyles({
|
|
51
|
-
autoSize: autoSize
|
|
56
|
+
autoSize: autoSize,
|
|
57
|
+
code: code
|
|
52
58
|
}),
|
|
53
59
|
styles = _useStyles.styles,
|
|
54
60
|
cx = _useStyles.cx;
|
|
@@ -103,6 +109,14 @@ export var Mentions = function Mentions(_ref) {
|
|
|
103
109
|
};
|
|
104
110
|
return buildMap(options);
|
|
105
111
|
}, [options]);
|
|
112
|
+
var parent = useMemo(function () {
|
|
113
|
+
if (!isBrowser) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (document.fullscreenElement) {
|
|
117
|
+
return document.fullscreenElement;
|
|
118
|
+
}
|
|
119
|
+
}, []);
|
|
106
120
|
if (!isBrowser) {
|
|
107
121
|
return /*#__PURE__*/_jsxs("div", {
|
|
108
122
|
className: cx(styles.wrapper, classNames === null || classNames === void 0 ? void 0 : classNames.wrapper),
|
|
@@ -140,6 +154,7 @@ export var Mentions = function Mentions(_ref) {
|
|
|
140
154
|
onSelect: onSelect,
|
|
141
155
|
options: options,
|
|
142
156
|
overlayClassName: classNames === null || classNames === void 0 ? void 0 : classNames.menuOverlay,
|
|
157
|
+
parent: parent,
|
|
143
158
|
preTriggerChars: preTriggerChars,
|
|
144
159
|
punctuation: punctuation,
|
|
145
160
|
triggers: triggers
|
|
@@ -47,7 +47,7 @@ export var MentionNodeComponent = /*#__PURE__*/memo(function (_ref) {
|
|
|
47
47
|
}), /*#__PURE__*/_jsx(Flex, {
|
|
48
48
|
className: styles.text,
|
|
49
49
|
gap: 2,
|
|
50
|
-
title: (option === null || option === void 0 ? void 0 : option.label) || variable,
|
|
50
|
+
title: (option === null || option === void 0 ? void 0 : option.selectedLabel) || (option === null || option === void 0 ? void 0 : option.label) || variable,
|
|
51
51
|
children: /*#__PURE__*/_jsx("span", {
|
|
52
52
|
children: (option === null || option === void 0 ? void 0 : option.selectedLabel) || (option === null || option === void 0 ? void 0 : option.label) || variable
|
|
53
53
|
})
|
|
@@ -32,6 +32,7 @@ export var useOptions = function useOptions(allOptions, queryString) {
|
|
|
32
32
|
var options = useMemo(function () {
|
|
33
33
|
var _addOnselect = function _addOnselect(option) {
|
|
34
34
|
var menuOption = _objectSpread(_objectSpread({}, option), {}, {
|
|
35
|
+
title: option.title || option.selectedLabel,
|
|
35
36
|
children: undefined,
|
|
36
37
|
onSelect: function onSelect() {
|
|
37
38
|
editor.dispatchCommand(INSERT_MENTION_COMMAND, option.value);
|
|
@@ -35,5 +35,9 @@ export interface MentionPickerPluginProps {
|
|
|
35
35
|
* When mention selected, this func will be called
|
|
36
36
|
*/
|
|
37
37
|
onSelect?: (option: MentionMenuOption, trigger: string | null, queryString: string | null) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Parent element
|
|
40
|
+
*/
|
|
41
|
+
parent?: HTMLElement;
|
|
38
42
|
}
|
|
39
43
|
export declare const MentionPickerPlugin: React.FC<MentionPickerPluginProps>;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
3
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
3
4
|
import { LexicalTypeaheadMenuPlugin } from '@lexical/react/LexicalTypeaheadMenuPlugin';
|
|
4
5
|
import { ConfigProvider, Tree } from 'antd';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// import { LexicalTypeaheadMenuPlugin } from '../LexicalTypeaheadMenuPlugin';
|
|
8
|
-
|
|
9
|
-
import React, { memo, useCallback, useState } from 'react';
|
|
6
|
+
import { flatMap } from 'lodash-es';
|
|
7
|
+
import React, { memo, useCallback, useMemo, useRef, useState } from 'react';
|
|
10
8
|
import ReactDOM from 'react-dom';
|
|
11
9
|
import { DEFAULT_PUNCTUATION, PRE_TRIGGER_CHARS } from "../../constants";
|
|
12
10
|
import { useCheckForMentionMatch } from "../../hooks";
|
|
@@ -27,7 +25,8 @@ export var MentionPickerPlugin = /*#__PURE__*/memo(function (_ref) {
|
|
|
27
25
|
punctuation = _ref$punctuation === void 0 ? DEFAULT_PUNCTUATION : _ref$punctuation,
|
|
28
26
|
_ref$preTriggerChars = _ref.preTriggerChars,
|
|
29
27
|
preTriggerChars = _ref$preTriggerChars === void 0 ? PRE_TRIGGER_CHARS : _ref$preTriggerChars,
|
|
30
|
-
onSelect = _ref.onSelect
|
|
28
|
+
onSelect = _ref.onSelect,
|
|
29
|
+
parent = _ref.parent;
|
|
31
30
|
var _useStyles = useStyles({}),
|
|
32
31
|
cx = _useStyles.cx,
|
|
33
32
|
styles = _useStyles.styles;
|
|
@@ -47,6 +46,14 @@ export var MentionPickerPlugin = /*#__PURE__*/memo(function (_ref) {
|
|
|
47
46
|
setQueryString = _useState2[1];
|
|
48
47
|
var _useOptions = useOptions(allOptions, queryString),
|
|
49
48
|
options = _useOptions.options;
|
|
49
|
+
var flatOptions = useMemo(function () {
|
|
50
|
+
var _flattenTree = function _flattenTree(nodes) {
|
|
51
|
+
return flatMap(nodes, function (node) {
|
|
52
|
+
return [node].concat(_toConsumableArray(node.children ? _flattenTree(node.children) : []));
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
return _flattenTree(options);
|
|
56
|
+
}, [options]);
|
|
50
57
|
var onSelectOption = useCallback(function (selectedOption, nodeToRemove, closeMenu, matchingString) {
|
|
51
58
|
onSelect === null || onSelect === void 0 || onSelect(selectedOption, trigger, queryString);
|
|
52
59
|
editor.update(function () {
|
|
@@ -59,9 +66,36 @@ export var MentionPickerPlugin = /*#__PURE__*/memo(function (_ref) {
|
|
|
59
66
|
closeMenu();
|
|
60
67
|
});
|
|
61
68
|
}, [editor, onSelect, queryString, trigger]);
|
|
69
|
+
var preSelectedIndex = useRef();
|
|
70
|
+
var handleDisabledItem = useCallback(function (itemProps) {
|
|
71
|
+
var selectedIndex = itemProps.selectedIndex,
|
|
72
|
+
setHighlightedIndex = itemProps.setHighlightedIndex;
|
|
73
|
+
if (selectedIndex !== null) {
|
|
74
|
+
var _flatOptions$selected;
|
|
75
|
+
if ((_flatOptions$selected = flatOptions[selectedIndex]) !== null && _flatOptions$selected !== void 0 && _flatOptions$selected.disabled) {
|
|
76
|
+
var newIndex = selectedIndex;
|
|
77
|
+
// 如果是最后一项,则回到第一项
|
|
78
|
+
if (selectedIndex === flatOptions.length - 1) {
|
|
79
|
+
newIndex = flatOptions.length === 1 ? null : 0;
|
|
80
|
+
// @ts-ignore
|
|
81
|
+
setHighlightedIndex(newIndex);
|
|
82
|
+
} else if (selectedIndex !== preSelectedIndex.current) {
|
|
83
|
+
var _preSelectedIndex$cur;
|
|
84
|
+
if (selectedIndex > ((_preSelectedIndex$cur = preSelectedIndex.current) !== null && _preSelectedIndex$cur !== void 0 ? _preSelectedIndex$cur : 0)) {
|
|
85
|
+
newIndex++;
|
|
86
|
+
} else {
|
|
87
|
+
newIndex--;
|
|
88
|
+
}
|
|
89
|
+
setHighlightedIndex(newIndex);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
preSelectedIndex.current = selectedIndex;
|
|
93
|
+
}
|
|
94
|
+
}, [flatOptions]);
|
|
62
95
|
var renderMenuTree = useCallback(function (itemProps) {
|
|
63
96
|
var selectedIndex = itemProps.selectedIndex,
|
|
64
97
|
selectOptionAndCleanUp = itemProps.selectOptionAndCleanUp;
|
|
98
|
+
handleDisabledItem(itemProps);
|
|
65
99
|
return /*#__PURE__*/_jsx(ConfigProvider, {
|
|
66
100
|
theme: {
|
|
67
101
|
components: {
|
|
@@ -69,7 +103,8 @@ export var MentionPickerPlugin = /*#__PURE__*/memo(function (_ref) {
|
|
|
69
103
|
indentSize: 16,
|
|
70
104
|
lineHeight: 32,
|
|
71
105
|
titleHeight: 32,
|
|
72
|
-
paddingXS: 0
|
|
106
|
+
paddingXS: 0,
|
|
107
|
+
nodeHoverBg: 'transparent'
|
|
73
108
|
}
|
|
74
109
|
}
|
|
75
110
|
},
|
|
@@ -86,9 +121,9 @@ export var MentionPickerPlugin = /*#__PURE__*/memo(function (_ref) {
|
|
|
86
121
|
selectOptionAndCleanUp(info.node);
|
|
87
122
|
},
|
|
88
123
|
titleRender: function titleRender(option) {
|
|
89
|
-
var
|
|
124
|
+
var _flatOptions;
|
|
90
125
|
return /*#__PURE__*/_jsx(MentionMenuItem, {
|
|
91
|
-
isSelected: ((
|
|
126
|
+
isSelected: ((_flatOptions = flatOptions[selectedIndex]) === null || _flatOptions === void 0 ? void 0 : _flatOptions.value) === option.value,
|
|
92
127
|
option: option,
|
|
93
128
|
queryString: queryString,
|
|
94
129
|
showIcon: !option.isChild
|
|
@@ -97,11 +132,12 @@ export var MentionPickerPlugin = /*#__PURE__*/memo(function (_ref) {
|
|
|
97
132
|
treeData: options
|
|
98
133
|
})
|
|
99
134
|
});
|
|
100
|
-
}, [options, editor, queryString]);
|
|
135
|
+
}, [handleDisabledItem, options, editor, flatOptions, queryString]);
|
|
101
136
|
var renderMenu = useCallback(function (anchorElementRef, itemProps, _matchingString) {
|
|
102
137
|
var selectedIndex = itemProps.selectedIndex,
|
|
103
138
|
selectOptionAndCleanUp = itemProps.selectOptionAndCleanUp,
|
|
104
139
|
setHighlightedIndex = itemProps.setHighlightedIndex;
|
|
140
|
+
handleDisabledItem(itemProps);
|
|
105
141
|
if (anchorElementRef.current) {
|
|
106
142
|
return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/_jsx("div", {
|
|
107
143
|
className: cx(styles.menuOverlay, overlayClassName),
|
|
@@ -125,13 +161,14 @@ export var MentionPickerPlugin = /*#__PURE__*/memo(function (_ref) {
|
|
|
125
161
|
}), anchorElementRef.current);
|
|
126
162
|
}
|
|
127
163
|
return null;
|
|
128
|
-
}, [cx, options, overlayClassName, queryString, renderMenuTree, styles.menuOverlay]);
|
|
164
|
+
}, [cx, handleDisabledItem, options, overlayClassName, queryString, renderMenuTree, styles.menuOverlay]);
|
|
129
165
|
return /*#__PURE__*/_jsx(LexicalTypeaheadMenuPlugin, {
|
|
130
166
|
anchorClassName: styles.anchor,
|
|
131
167
|
menuRenderFn: renderMenu,
|
|
132
168
|
onQueryChange: setQueryString,
|
|
133
169
|
onSelectOption: onSelectOption,
|
|
134
|
-
options:
|
|
170
|
+
options: flatOptions,
|
|
171
|
+
parent: parent,
|
|
135
172
|
triggerFn: checkForMentionMatch
|
|
136
173
|
});
|
|
137
174
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Flex } from 'antd';
|
|
2
2
|
import { escapeRegExp } from 'lodash-es';
|
|
3
|
-
import React, { memo, useMemo } from 'react';
|
|
3
|
+
import React, { memo, useEffect, useMemo, useRef } from 'react';
|
|
4
4
|
import Typography from "../../../Typography";
|
|
5
5
|
import { useStyles } from "./style";
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -43,6 +43,22 @@ export var MentionMenuItem = /*#__PURE__*/memo(function (_ref) {
|
|
|
43
43
|
before = _useMemo.before,
|
|
44
44
|
middle = _useMemo.middle,
|
|
45
45
|
after = _useMemo.after;
|
|
46
|
+
var ref = useRef(null);
|
|
47
|
+
|
|
48
|
+
// 自动滚动
|
|
49
|
+
useEffect(function () {
|
|
50
|
+
if (isSelected) {
|
|
51
|
+
var _ref$current;
|
|
52
|
+
ref === null || ref === void 0 || (_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.scrollIntoView({
|
|
53
|
+
behavior: 'smooth',
|
|
54
|
+
block: 'nearest'
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}, [isSelected]);
|
|
58
|
+
useEffect(function () {
|
|
59
|
+
option.setRefElement(ref === null || ref === void 0 ? void 0 : ref.current);
|
|
60
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
61
|
+
}, []);
|
|
46
62
|
return /*#__PURE__*/_jsxs(Flex, {
|
|
47
63
|
align: "center",
|
|
48
64
|
className: styles.menuItem,
|
|
@@ -53,14 +69,14 @@ export var MentionMenuItem = /*#__PURE__*/memo(function (_ref) {
|
|
|
53
69
|
onMouseEnter: function onMouseEnter() {
|
|
54
70
|
return _onMouseEnter === null || _onMouseEnter === void 0 ? void 0 : _onMouseEnter(index, option);
|
|
55
71
|
},
|
|
56
|
-
ref:
|
|
72
|
+
ref: ref,
|
|
57
73
|
tabIndex: -1,
|
|
74
|
+
title: option.htmlTitle || option.label,
|
|
58
75
|
children: [showIcon && /*#__PURE__*/_jsx(Flex, {
|
|
59
76
|
className: styles.menuItemIcon,
|
|
60
77
|
children: option.icon
|
|
61
78
|
}), /*#__PURE__*/_jsxs("div", {
|
|
62
79
|
className: styles.menuItemLabel,
|
|
63
|
-
title: option.label,
|
|
64
80
|
children: [before, /*#__PURE__*/_jsx(Text, {
|
|
65
81
|
mark: true,
|
|
66
82
|
children: middle
|
|
@@ -7,7 +7,7 @@ export var useStyles = createStyles(function (_ref, _ref2) {
|
|
|
7
7
|
prefixCls = _ref.prefixCls;
|
|
8
8
|
var isSelected = _ref2.isSelected,
|
|
9
9
|
disabled = _ref2.disabled;
|
|
10
|
-
var selectedBg = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), token.
|
|
10
|
+
var selectedBg = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), token.colorFillTertiary);
|
|
11
11
|
return {
|
|
12
12
|
anchor: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n z-index: 9999;\n "]))),
|
|
13
13
|
menuEmpty: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: ", "px;\n "])), token.padding),
|
|
@@ -3,6 +3,7 @@ import { MenuOption } from '@lexical/react/LexicalTypeaheadMenuPlugin';
|
|
|
3
3
|
export interface MentionMenuOptionInitParams {
|
|
4
4
|
label: string;
|
|
5
5
|
value: string;
|
|
6
|
+
title?: string;
|
|
6
7
|
data?: any;
|
|
7
8
|
icon?: JSX.Element;
|
|
8
9
|
extraElement?: JSX.Element;
|
|
@@ -16,6 +17,7 @@ export interface MentionMenuOptionInitParams {
|
|
|
16
17
|
export declare class MentionMenuOption extends MenuOption {
|
|
17
18
|
label: string;
|
|
18
19
|
value: string;
|
|
20
|
+
htmlTitle?: string;
|
|
19
21
|
title: string;
|
|
20
22
|
key: string;
|
|
21
23
|
icon?: JSX.Element;
|
|
@@ -27,5 +29,5 @@ export declare class MentionMenuOption extends MenuOption {
|
|
|
27
29
|
data?: any;
|
|
28
30
|
children?: MentionMenuOption[];
|
|
29
31
|
isChild?: boolean;
|
|
30
|
-
constructor({ label, value, data, icon, extraElement, keywords, keyboardShortcut, disabled, onSelect, children, isChild, }: MentionMenuOptionInitParams);
|
|
32
|
+
constructor({ label, value, title, data, icon, extraElement, keywords, keyboardShortcut, disabled, onSelect, children, isChild, }: MentionMenuOptionInitParams);
|
|
31
33
|
}
|
|
@@ -17,6 +17,7 @@ export var MentionMenuOption = /*#__PURE__*/function (_MenuOption) {
|
|
|
17
17
|
var _this;
|
|
18
18
|
var label = _ref.label,
|
|
19
19
|
value = _ref.value,
|
|
20
|
+
title = _ref.title,
|
|
20
21
|
data = _ref.data,
|
|
21
22
|
icon = _ref.icon,
|
|
22
23
|
extraElement = _ref.extraElement,
|
|
@@ -30,6 +31,7 @@ export var MentionMenuOption = /*#__PURE__*/function (_MenuOption) {
|
|
|
30
31
|
_this = _super.call(this, value);
|
|
31
32
|
_defineProperty(_assertThisInitialized(_this), "label", void 0);
|
|
32
33
|
_defineProperty(_assertThisInitialized(_this), "value", void 0);
|
|
34
|
+
_defineProperty(_assertThisInitialized(_this), "htmlTitle", void 0);
|
|
33
35
|
// for Tree, the same as label
|
|
34
36
|
_defineProperty(_assertThisInitialized(_this), "title", void 0);
|
|
35
37
|
// for Tree, the same as value
|
|
@@ -45,6 +47,7 @@ export var MentionMenuOption = /*#__PURE__*/function (_MenuOption) {
|
|
|
45
47
|
_defineProperty(_assertThisInitialized(_this), "isChild", void 0);
|
|
46
48
|
_this.value = value;
|
|
47
49
|
_this.label = label;
|
|
50
|
+
_this.htmlTitle = title;
|
|
48
51
|
_this.title = label;
|
|
49
52
|
_this.key = value;
|
|
50
53
|
_this.keywords = keywords || [];
|
package/es/Mentions/style.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AutoSize } from './types';
|
|
2
2
|
export declare const useStyles: (props?: {
|
|
3
3
|
autoSize?: AutoSize | undefined;
|
|
4
|
+
code: boolean;
|
|
4
5
|
} | undefined) => import("antd-style").ReturnStyles<{
|
|
5
6
|
wrapper: import("antd-style").SerializedStyles;
|
|
6
7
|
placeholder: import("antd-style").SerializedStyles;
|
package/es/Mentions/style.js
CHANGED
|
@@ -8,13 +8,13 @@ var calculateHeight = function calculateHeight(rows) {
|
|
|
8
8
|
};
|
|
9
9
|
export var useStyles = createStyles(function (_ref, _ref2) {
|
|
10
10
|
var css = _ref.css,
|
|
11
|
-
token = _ref.token
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
token = _ref.token;
|
|
12
|
+
var autoSize = _ref2.autoSize,
|
|
13
|
+
code = _ref2.code;
|
|
14
14
|
return {
|
|
15
15
|
wrapper: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n display: inline-block;\n width: 100%;\n min-width: 0;\n "]))),
|
|
16
16
|
placeholder: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n pointer-events: none;\n user-select: none;\n\n position: absolute;\n top: 0;\n left: 13px;\n\n height: ", "px;\n\n font-size: ", "px;\n line-height: ", "px;\n color: ", ";\n "])), inputHeight, token.fontSize, inputHeight, token.colorTextPlaceholder),
|
|
17
|
-
root: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n outline: none;\n border: 1px solid ", ";\n border-radius: ", "px;\n\n margin: 0;\n padding: 4px 11px;\n\n color: ", ";\n font-size: ", "px;\n font-family: ", ";\n\n display: inline-block;\n\n width: 100%;\n min-width: 0;\n\n ", "\n ", "\n overflow: auto;\n\n transition: all ", ";\n &:focus {\n border-color: ", ";\n }\n p {\n margin-bottom: 0;\n margin-block: 0 0;\n line-height: ", "px;\n }\n "])), token.colorBorder, token.borderRadius, token.colorText, token.fontSize, token.fontFamily, (autoSize === null || autoSize === void 0 ? void 0 : autoSize.minRows) && css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n min-height: ", "px;\n "])), calculateHeight(autoSize.minRows)), (autoSize === null || autoSize === void 0 ? void 0 : autoSize.maxRows) && css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n max-height: ", "px;\n "])), calculateHeight(autoSize.maxRows)), token.motionDurationMid, token.colorPrimaryBorder, lineHeight),
|
|
17
|
+
root: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n outline: none;\n border: 1px solid ", ";\n border-radius: ", "px;\n\n margin: 0;\n padding: 4px 11px;\n\n color: ", ";\n font-size: ", "px;\n .align-middle {\n vertical-align: middle;\n }\n font-family: ", ";\n\n display: inline-block;\n\n width: 100%;\n min-width: 0;\n\n ", "\n ", "\n overflow: auto;\n\n transition: all ", ";\n &:focus {\n border-color: ", ";\n }\n p {\n margin-bottom: 0;\n margin-block: 0 0;\n line-height: ", "px;\n }\n "])), token.colorBorder, token.borderRadius, token.colorText, token.fontSize, code ? token.fontFamilyCode : token.fontFamily, (autoSize === null || autoSize === void 0 ? void 0 : autoSize.minRows) && css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n min-height: ", "px;\n "])), calculateHeight(autoSize.minRows)), (autoSize === null || autoSize === void 0 ? void 0 : autoSize.maxRows) && css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n max-height: ", "px;\n "])), calculateHeight(autoSize.maxRows)), token.motionDurationMid, token.colorPrimaryBorder, lineHeight),
|
|
18
18
|
filled: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n background: ", ";\n border-color: transparent;\n &:hover {\n background: ", ";\n }\n &:focus {\n background: ", ";\n }\n "])), token.colorFillTertiary, token.colorFillSecondary, token.colorBgBase),
|
|
19
19
|
borderless: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n background: transparent;\n border: none;\n "]))),
|
|
20
20
|
disabled: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n cursor: not-allowed;\n color: ", ";\n background: ", ";\n "])), token.colorTextDisabled, token.colorBgContainerDisabled)
|
|
@@ -38,14 +38,18 @@ export interface IGeneralManacoEditorProps {
|
|
|
38
38
|
/** style of wrapper */
|
|
39
39
|
style?: CSSProperties;
|
|
40
40
|
enhancers?: EditorEnhancer[];
|
|
41
|
+
placeholder?: string;
|
|
41
42
|
}
|
|
42
43
|
export interface ISingleMonacoEditorProps extends IGeneralManacoEditorProps {
|
|
43
44
|
onChange?: (input: string, event: IEditor.IModelContentChangedEvent) => void;
|
|
45
|
+
onBlur?: (input: string, event: any) => void;
|
|
44
46
|
supportFullScreen?: boolean;
|
|
47
|
+
onFullScreenChange?: (isFullScreen: boolean) => void;
|
|
45
48
|
}
|
|
46
49
|
export interface IDiffMonacoEditorProps extends IGeneralManacoEditorProps {
|
|
47
50
|
onChange?: (input: string, event: IEditor.IModelContentChangedEvent) => void;
|
|
48
51
|
supportFullScreen?: boolean;
|
|
52
|
+
onFullScreenChange?: (isFullScreen: boolean) => void;
|
|
49
53
|
original?: string;
|
|
50
54
|
}
|
|
51
55
|
export declare const WORD_EDITOR_INITIALIZING: string;
|
|
@@ -90,7 +90,8 @@ export var useEditor = function useEditor(type, props) {
|
|
|
90
90
|
language = props.language,
|
|
91
91
|
saveViewState = props.saveViewState,
|
|
92
92
|
defaultValue = props.defaultValue,
|
|
93
|
-
enhancers = props.enhancers
|
|
93
|
+
enhancers = props.enhancers,
|
|
94
|
+
placeholder = props.placeholder;
|
|
94
95
|
var _useState = useState(false),
|
|
95
96
|
_useState2 = _slicedToArray(_useState, 2),
|
|
96
97
|
isEditorReady = _useState2[0],
|
|
@@ -164,14 +165,18 @@ export var useEditor = function useEditor(type, props) {
|
|
|
164
165
|
var model = getOrCreateModel(monaco, (_ref = (_valueRef$current = valueRef.current) !== null && _valueRef$current !== void 0 ? _valueRef$current : defaultValueRef.current) !== null && _ref !== void 0 ? _ref : '', languageRef.current, pathRef.current);
|
|
165
166
|
editor = monaco.editor.create(containerRef.current, _objectSpread(_objectSpread({
|
|
166
167
|
automaticLayout: true
|
|
167
|
-
}, INITIAL_OPTIONS),
|
|
168
|
+
}, INITIAL_OPTIONS), {}, {
|
|
169
|
+
placeholder: placeholder
|
|
170
|
+
}, optionRef.current));
|
|
168
171
|
editor.setModel(model);
|
|
169
172
|
} else {
|
|
170
173
|
var originalModel = monaco.editor.createModel(valueRef.current, languageRef.current);
|
|
171
174
|
var modifiedModel = monaco.editor.createModel(valueRef.current, languageRef.current);
|
|
172
175
|
editor = monaco.editor.createDiffEditor(containerRef.current, _objectSpread(_objectSpread({
|
|
173
176
|
automaticLayout: true
|
|
174
|
-
}, DIFF_EDITOR_INITIAL_OPTIONS),
|
|
177
|
+
}, DIFF_EDITOR_INITIAL_OPTIONS), {}, {
|
|
178
|
+
placeholder: placeholder
|
|
179
|
+
}, optionRef.current));
|
|
175
180
|
editor.setModel({
|
|
176
181
|
original: originalModel,
|
|
177
182
|
modified: modifiedModel
|
|
@@ -8,7 +8,7 @@ export declare const SingleMonacoEditorComponent: React.FC<ISingleMonacoEditorPr
|
|
|
8
8
|
variant?: "filled" | "borderless" | "outlined" | undefined;
|
|
9
9
|
}> & {
|
|
10
10
|
displayName: string;
|
|
11
|
-
|
|
11
|
+
default: {
|
|
12
12
|
width: string;
|
|
13
13
|
height: number;
|
|
14
14
|
defaultValue: string;
|
|
@@ -23,7 +23,7 @@ export declare const SingleMonacoEditorComponent: React.FC<ISingleMonacoEditorPr
|
|
|
23
23
|
variant?: "filled" | "borderless" | "outlined" | undefined;
|
|
24
24
|
}> & {
|
|
25
25
|
displayName: string;
|
|
26
|
-
|
|
26
|
+
default: {
|
|
27
27
|
width: string;
|
|
28
28
|
height: number;
|
|
29
29
|
defaultValue: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Icon } from '@lobehub/ui';
|
|
2
2
|
import { Button } from 'antd';
|
|
3
3
|
import { Maximize2, Minimize2 } from 'lucide-react';
|
|
4
|
-
import React, { useEffect, useMemo, useRef } from 'react';
|
|
4
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
5
5
|
import { INITIAL_OPTIONS, WORD_EDITOR_INITIALIZING, useEditor, useFullScreen } from "./helper";
|
|
6
6
|
import { useStyles } from "./style";
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -12,12 +12,15 @@ function noop() {}
|
|
|
12
12
|
var SingleMonacoEditor = function SingleMonacoEditor(props) {
|
|
13
13
|
var _props$options;
|
|
14
14
|
var onChange = props.onChange,
|
|
15
|
+
onBlur = props.onBlur,
|
|
15
16
|
enableOutline = props.enableOutline,
|
|
16
17
|
width = props.width,
|
|
17
18
|
height = props.height,
|
|
18
19
|
language = props.language,
|
|
19
|
-
supportFullScreen = props.supportFullScreen
|
|
20
|
+
supportFullScreen = props.supportFullScreen,
|
|
21
|
+
onFullScreenChange = props.onFullScreenChange;
|
|
20
22
|
var onChangeRef = useRef(onChange);
|
|
23
|
+
var onBlurRef = useRef(onBlur);
|
|
21
24
|
var _useEditor = useEditor('single', props),
|
|
22
25
|
isEditorReady = _useEditor.isEditorReady,
|
|
23
26
|
focused = _useEditor.focused,
|
|
@@ -27,6 +30,7 @@ var SingleMonacoEditor = function SingleMonacoEditor(props) {
|
|
|
27
30
|
editorRef = _useEditor.editorRef,
|
|
28
31
|
valueRef = _useEditor.valueRef;
|
|
29
32
|
var subscriptionRef = useRef();
|
|
33
|
+
var subscriptionBlurRef = useRef();
|
|
30
34
|
var _useFullScreen = useFullScreen(editorRef === null || editorRef === void 0 ? void 0 : editorRef.current),
|
|
31
35
|
isFullScreen = _useFullScreen.isFullScreen,
|
|
32
36
|
fullScreen = _useFullScreen.fullScreen;
|
|
@@ -50,9 +54,12 @@ var SingleMonacoEditor = function SingleMonacoEditor(props) {
|
|
|
50
54
|
useEffect(function () {
|
|
51
55
|
onChangeRef.current = onChange;
|
|
52
56
|
}, [onChange]);
|
|
57
|
+
useEffect(function () {
|
|
58
|
+
onBlurRef.current = onBlur;
|
|
59
|
+
}, [onBlur]);
|
|
53
60
|
useEffect(function () {
|
|
54
61
|
if (isEditorReady) {
|
|
55
|
-
var _subscriptionRef$curr
|
|
62
|
+
var _subscriptionRef$curr, _subscriptionBlurRef$;
|
|
56
63
|
var editorInstance = editorRef.current;
|
|
57
64
|
(_subscriptionRef$curr = subscriptionRef.current) === null || _subscriptionRef$curr === void 0 || _subscriptionRef$curr.dispose();
|
|
58
65
|
subscriptionRef.current = editorInstance === null || editorInstance === void 0 ? void 0 : editorInstance.onDidChangeModelContent(function (event) {
|
|
@@ -63,14 +70,21 @@ var SingleMonacoEditor = function SingleMonacoEditor(props) {
|
|
|
63
70
|
(_onChangeRef$current = onChangeRef.current) === null || _onChangeRef$current === void 0 || _onChangeRef$current.call(onChangeRef, editorValue, event);
|
|
64
71
|
}
|
|
65
72
|
});
|
|
73
|
+
(_subscriptionBlurRef$ = subscriptionBlurRef.current) === null || _subscriptionBlurRef$ === void 0 || _subscriptionBlurRef$.dispose();
|
|
74
|
+
subscriptionBlurRef.current = editorInstance === null || editorInstance === void 0 ? void 0 : editorInstance.onDidBlurEditorText(function (event) {
|
|
75
|
+
var _editorInstance$getMo2, _onBlurRef$current;
|
|
76
|
+
var editorValue = editorInstance === null || editorInstance === void 0 || (_editorInstance$getMo2 = editorInstance.getModel()) === null || _editorInstance$getMo2 === void 0 ? void 0 : _editorInstance$getMo2.getValue();
|
|
77
|
+
(_onBlurRef$current = onBlurRef.current) === null || _onBlurRef$current === void 0 || _onBlurRef$current.call(onBlurRef, editorValue, event);
|
|
78
|
+
});
|
|
66
79
|
}
|
|
67
80
|
}, [editorRef, isEditorReady, subscriptionRef, valueRef]);
|
|
68
81
|
useEffect(function () {
|
|
69
82
|
return function () {
|
|
70
|
-
var _subscriptionRef$curr2, _editorInstance$
|
|
83
|
+
var _subscriptionRef$curr2, _subscriptionBlurRef$2, _editorInstance$getMo3, _editorRef$current;
|
|
71
84
|
var editorInstance = editorRef.current;
|
|
72
85
|
(_subscriptionRef$curr2 = subscriptionRef.current) === null || _subscriptionRef$curr2 === void 0 || _subscriptionRef$curr2.dispose();
|
|
73
|
-
|
|
86
|
+
(_subscriptionBlurRef$2 = subscriptionBlurRef.current) === null || _subscriptionBlurRef$2 === void 0 || _subscriptionBlurRef$2.dispose();
|
|
87
|
+
editorInstance === null || editorInstance === void 0 || (_editorInstance$getMo3 = editorInstance.getModel()) === null || _editorInstance$getMo3 === void 0 || _editorInstance$getMo3.dispose();
|
|
74
88
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
75
89
|
(_editorRef$current = editorRef.current) === null || _editorRef$current === void 0 || _editorRef$current.dispose();
|
|
76
90
|
};
|
|
@@ -86,6 +100,10 @@ var SingleMonacoEditor = function SingleMonacoEditor(props) {
|
|
|
86
100
|
(_monacoRef$current = monacoRef.current) === null || _monacoRef$current === void 0 || _monacoRef$current.editor.setModelLanguage(model, language);
|
|
87
101
|
}
|
|
88
102
|
}, [editorRef, isEditorReady, language, monacoRef]);
|
|
103
|
+
var fullScreenChange = useCallback(function () {
|
|
104
|
+
onFullScreenChange === null || onFullScreenChange === void 0 || onFullScreenChange(!isFullScreen);
|
|
105
|
+
fullScreen();
|
|
106
|
+
}, [fullScreen, isFullScreen, onFullScreenChange]);
|
|
89
107
|
return /*#__PURE__*/_jsxs("div", {
|
|
90
108
|
className: className,
|
|
91
109
|
style: props.style,
|
|
@@ -101,7 +119,7 @@ var SingleMonacoEditor = function SingleMonacoEditor(props) {
|
|
|
101
119
|
icon: /*#__PURE__*/_jsx(Icon, {
|
|
102
120
|
icon: isFullScreen ? Minimize2 : Maximize2
|
|
103
121
|
}),
|
|
104
|
-
onClick:
|
|
122
|
+
onClick: fullScreenChange,
|
|
105
123
|
size: "small",
|
|
106
124
|
type: "text"
|
|
107
125
|
})
|
|
@@ -115,7 +133,8 @@ var DiffMonacoEditor = function DiffMonacoEditor(props) {
|
|
|
115
133
|
language = props.language,
|
|
116
134
|
onChange = props.onChange,
|
|
117
135
|
original = props.original,
|
|
118
|
-
supportFullScreen = props.supportFullScreen
|
|
136
|
+
supportFullScreen = props.supportFullScreen,
|
|
137
|
+
onFullScreenChange = props.onFullScreenChange;
|
|
119
138
|
var onChangeRef = useRef(onChange);
|
|
120
139
|
var _useEditor2 = useEditor('diff', props),
|
|
121
140
|
isEditorReady = _useEditor2.isEditorReady,
|
|
@@ -184,6 +203,10 @@ var DiffMonacoEditor = function DiffMonacoEditor(props) {
|
|
|
184
203
|
(_monacoRef$current2 = monacoRef.current) === null || _monacoRef$current2 === void 0 || _monacoRef$current2.editor.setModelLanguage(originalModel, language);
|
|
185
204
|
(_monacoRef$current3 = monacoRef.current) === null || _monacoRef$current3 === void 0 || _monacoRef$current3.editor.setModelLanguage(modifiedModel, language);
|
|
186
205
|
}, [editorRef, isEditorReady, language, monacoRef]);
|
|
206
|
+
var fullScreenChange = useCallback(function () {
|
|
207
|
+
onFullScreenChange === null || onFullScreenChange === void 0 || onFullScreenChange(!isFullScreen);
|
|
208
|
+
fullScreen();
|
|
209
|
+
}, [fullScreen, isFullScreen, onFullScreenChange]);
|
|
187
210
|
return /*#__PURE__*/_jsxs("div", {
|
|
188
211
|
className: className,
|
|
189
212
|
style: props.style,
|
|
@@ -199,7 +222,7 @@ var DiffMonacoEditor = function DiffMonacoEditor(props) {
|
|
|
199
222
|
icon: /*#__PURE__*/_jsx(Icon, {
|
|
200
223
|
icon: isFullScreen ? Minimize2 : Maximize2
|
|
201
224
|
}),
|
|
202
|
-
onClick:
|
|
225
|
+
onClick: fullScreenChange,
|
|
203
226
|
size: "small",
|
|
204
227
|
type: "text"
|
|
205
228
|
})
|
|
@@ -208,7 +231,7 @@ var DiffMonacoEditor = function DiffMonacoEditor(props) {
|
|
|
208
231
|
};
|
|
209
232
|
var DiffMonacoEditorComponent = Object.assign(DiffMonacoEditor, {
|
|
210
233
|
displayName: 'DiffMonacoEditor',
|
|
211
|
-
|
|
234
|
+
default: {
|
|
212
235
|
width: '100%',
|
|
213
236
|
height: 150,
|
|
214
237
|
defaultValue: '',
|
|
@@ -222,7 +245,7 @@ var DiffMonacoEditorComponent = Object.assign(DiffMonacoEditor, {
|
|
|
222
245
|
});
|
|
223
246
|
export var SingleMonacoEditorComponent = Object.assign(SingleMonacoEditor, {
|
|
224
247
|
displayName: 'SingleMonacoEditor',
|
|
225
|
-
|
|
248
|
+
default: {
|
|
226
249
|
width: '100%',
|
|
227
250
|
height: 150,
|
|
228
251
|
defaultValue: '',
|
|
@@ -34,7 +34,7 @@ export var useStyles = createStyles(function (_ref, _ref2) {
|
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
return {
|
|
37
|
-
base: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n\n box-sizing: content-box;\n min-height: 100px;\n\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: ", "px;\n &:hover {\n border-color: ", ";\n ", "\n }\n\n &.ve-focused {\n ", "\n ", "\n }\n\n &.ve-outline {\n border: 1px solid var(--color-field-border, rgba(31, 56, 88, 0.05)) !important;\n }\n\n & > .react-monaco-editor-container {\n width: 100%;\n height: 100%;\n min-height: 100px;\n background: transparent;\n\n ", "\n\n .monaco-editor,\n .monaco-editor-background,\n .monaco-editor .inputarea.ime-input,\n .monaco-editor .margin {\n ", "\n }\n\n & > .monaco-editor {\n border-radius: ", "px;\n .overflow-guard,\n .margin {\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n }\n .monaco-scrollable-element {\n border-top-right-radius: ", "px;\n border-bottom-right-radius: ", "px;\n }\n }\n .monaco-diff-editor {\n border-radius: ", "px;\n & > .original > .monaco-editor {\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n .overflow-guard,\n .margin {\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n }\n }\n .diffViewport {\n border-top-right-radius: ", "px;\n border-bottom-right-radius: ", "px;\n }\n }\n }\n\n .syntaxTips {\n position: absolute;\n bottom: 0;\n left: 0;\n\n box-sizing: border-box;\n width: 100%;\n max-height: 0;\n margin: 0;\n padding: 10px 30px;\n\n color: ", ";\n\n background: ", ";\n\n transition: 0.2s ease max-height;\n }\n\n .syntaxTips:hover {\n overflow: auto;\n max-height: 50%;\n }\n\n .syntaxTips .infoIcon {\n position: absolute;\n top: 2px;\n right: 5px;\n transform: rotateY(180deg);\n\n width: 20px;\n height: 16px;\n }\n "])), getBgColor(), variant === 'outlined' ? token.colorBorder : 'transparent', token.borderRadius, variant === 'outlined' ? token.colorPrimaryHover : 'transparent', variant === 'filled' && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), token.colorFillSecondary), variant === 'filled' && css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), token.colorBgBase), variant !== 'borderless' && css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n border-color: ", ";\n "])), token.colorPrimaryActive), isFullScreen && css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n position: fixed;\n z-index: 9998;\n inset: 0;\n\n width: auto !important;\n height: auto !important;\n "]))), !isFullScreen && css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n background-color: transparent;\n "]))), token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius - 1, token.borderRadius - 1, token.colorErrorText, token.colorErrorBg),
|
|
37
|
+
base: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n\n box-sizing: content-box;\n min-height: 100px;\n\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: ", "px;\n &:hover {\n border-color: ", ";\n ", "\n }\n\n &.ve-focused {\n ", "\n ", "\n }\n\n &.ve-outline {\n border: 1px solid var(--color-field-border, rgba(31, 56, 88, 0.05)) !important;\n }\n\n & > .react-monaco-editor-container {\n width: 100%;\n height: 100%;\n min-height: 100px;\n background: transparent;\n\n ", "\n\n .monaco-editor,\n .monaco-editor-background,\n .monaco-editor .inputarea.ime-input,\n .monaco-editor .margin {\n ", "\n }\n\n & > .monaco-editor {\n border-radius: ", "px;\n outline: none;\n .overflow-guard,\n .margin {\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n }\n .monaco-scrollable-element {\n border-top-right-radius: ", "px;\n border-bottom-right-radius: ", "px;\n }\n }\n .monaco-diff-editor {\n border-radius: ", "px;\n & > .original > .monaco-editor {\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n .overflow-guard,\n .margin {\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n }\n }\n .diffViewport {\n border-top-right-radius: ", "px;\n border-bottom-right-radius: ", "px;\n }\n }\n }\n\n .syntaxTips {\n position: absolute;\n bottom: 0;\n left: 0;\n\n box-sizing: border-box;\n width: 100%;\n max-height: 0;\n margin: 0;\n padding: 10px 30px;\n\n color: ", ";\n\n background: ", ";\n\n transition: 0.2s ease max-height;\n }\n\n .syntaxTips:hover {\n overflow: auto;\n max-height: 50%;\n }\n\n .syntaxTips .infoIcon {\n position: absolute;\n top: 2px;\n right: 5px;\n transform: rotateY(180deg);\n\n width: 20px;\n height: 16px;\n }\n "])), getBgColor(), variant === 'outlined' ? token.colorBorder : 'transparent', token.borderRadius, variant === 'outlined' ? token.colorPrimaryHover : 'transparent', variant === 'filled' && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), token.colorFillSecondary), variant === 'filled' && css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), token.colorBgBase), variant !== 'borderless' && css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n border-color: ", ";\n "])), token.colorPrimaryActive), isFullScreen && css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n position: fixed;\n z-index: 9998;\n inset: 0;\n\n width: auto !important;\n height: auto !important;\n "]))), !isFullScreen && css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n background-color: transparent;\n "]))), token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius - 1, token.borderRadius - 1, token.colorErrorText, token.colorErrorBg),
|
|
38
38
|
fullScreenBtn: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n &.", "-btn {\n position: absolute;\n top: 20px;\n color: ", ";\n transition: none;\n ", "\n }\n "])), prefixCls, token.colorTextSecondary, isFullScreen ? css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n z-index: 9999;\n right: ", "px;\n "])), diff ? 64 : 138) : css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n right: ", "px;\n "])), minimapEnabled || diff ? 64 : 20)),
|
|
39
39
|
loading: css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n position: absolute;\n inset: 0;\n\n display: flex;\n align-items: center;\n justify-content: center;\n\n font-size: ", "px;\n color: ", ";\n\n background-color: transparent;\n\n &::after {\n content: '';\n width: 16px;\n /* display: inline; */\n animation: ", " steps(3) 1s infinite;\n }\n "])), token.fontSizeSM, token.colorTextTertiary, dots)
|
|
40
40
|
};
|
package/es/MonacoEditor/index.js
CHANGED
|
@@ -28,7 +28,7 @@ export var BaseMonacoEditor = function BaseMonacoEditor(props) {
|
|
|
28
28
|
_props$minimapEnabled = props.minimapEnabled,
|
|
29
29
|
minimapEnabled = _props$minimapEnabled === void 0 ? false : _props$minimapEnabled,
|
|
30
30
|
_props$version = props.version,
|
|
31
|
-
version = _props$version === void 0 ? '0.
|
|
31
|
+
version = _props$version === void 0 ? '0.52.2' : _props$version,
|
|
32
32
|
_props$requireConfig = props.requireConfig,
|
|
33
33
|
requireConfigFromProps = _props$requireConfig === void 0 ? {} : _props$requireConfig,
|
|
34
34
|
options = props.options,
|