@ant-design/agentic-ui 2.29.31 → 2.29.32
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/Bubble/AIBubble.d.ts +2 -0
- package/dist/Bubble/AIBubble.js +11 -11
- package/dist/Bubble/Avatar/index.js +3 -3
- package/dist/Bubble/List/PureBubbleList.js +3 -3
- package/dist/Bubble/List/index.js +3 -3
- package/dist/Bubble/PureBubble.js +9 -9
- package/dist/Bubble/Title.js +3 -3
- package/dist/Bubble/UserBubble.js +9 -9
- package/dist/Components/ActionIconBox/index.js +3 -3
- package/dist/Components/TextAnimate/index.js +1 -0
- package/dist/Components/lotties/TextLoading/index.js +2 -2
- package/dist/MarkdownEditor/editor/elements/CommentLeaf/index.d.ts +5 -0
- package/dist/MarkdownEditor/editor/elements/CommentLeaf/index.js +2 -1
- package/dist/MarkdownEditor/editor/plugins/elements.js +34 -1
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/arrow.js +3 -3
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/backspace.js +2 -2
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/match.js +2 -1
- package/dist/MarkdownEditor/editor/plugins/useHighlight.js +2 -1
- package/dist/MarkdownEditor/editor/tools/InsertAutocomplete.js +5 -4
- package/dist/MarkdownEditor/editor/tools/ToolBar/BaseBar.js +5 -5
- package/dist/MarkdownEditor/editor/tools/ToolBar/FloatBar.js +3 -1
- package/dist/MarkdownEditor/editor/tools/ToolBar/ReadonlyBaseBar.js +4 -4
- package/dist/MarkdownEditor/editor/tools/ToolBar/components/ClearFormatButton.js +2 -2
- package/dist/MarkdownEditor/editor/tools/ToolBar/components/ColorPickerButton.js +2 -2
- package/dist/MarkdownEditor/editor/tools/ToolBar/components/FormatButton.js +2 -2
- package/dist/MarkdownEditor/editor/tools/ToolBar/components/FormattingTools.js +2 -2
- package/dist/MarkdownEditor/editor/tools/ToolBar/components/HeadingDropdown.js +2 -2
- package/dist/MarkdownEditor/editor/tools/ToolBar/components/LinkButton.js +2 -2
- package/dist/MarkdownEditor/editor/tools/ToolBar/components/UndoRedoButtons.js +3 -3
- package/dist/MarkdownEditor/editor/tools/ToolBar/floatBarStyle.js +1 -1
- package/dist/MarkdownEditor/editor/tools/ToolBar/toolBarStyle.js +1 -1
- package/dist/MarkdownEditor/editor/utils/editorUtils.js +8 -6
- package/dist/MarkdownEditor/editor/utils/isMarkdown.js +4 -4
- package/dist/MarkdownEditor/editor/utils/keyboard.js +3 -2
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileListItem.js +11 -42
- package/dist/MarkdownInputField/QuickActions/index.js +2 -2
- package/dist/MarkdownInputField/RefinePromptButton/env.d.ts +4 -0
- package/dist/MarkdownInputField/RefinePromptButton/env.js +5 -0
- package/dist/MarkdownInputField/RefinePromptButton/index.js +2 -1
- package/dist/Plugins/chart/BarChart/index.js +6 -6
- package/dist/Plugins/chart/ChartMark/Area.js +2 -1
- package/dist/Plugins/chart/ChartMark/Bar.js +2 -1
- package/dist/Plugins/chart/ChartMark/Column.js +2 -1
- package/dist/Plugins/chart/ChartMark/Line.js +2 -1
- package/dist/Plugins/chart/ChartMark/Pie.js +2 -1
- package/dist/Plugins/chart/ChartRender.js +9 -1
- package/dist/Plugins/chart/DonutChart/index.js +2 -1
- package/dist/Plugins/chart/env.d.ts +4 -0
- package/dist/Plugins/chart/env.js +5 -0
- package/dist/Plugins/code/components/AceEditor.js +2 -0
- package/dist/Plugins/code/index.d.ts +1 -0
- package/dist/Plugins/code/index.js +1 -1
- package/dist/Plugins/mermaid/Mermaid.js +2 -2
- package/dist/Plugins/mermaid/env.d.ts +4 -0
- package/dist/Plugins/mermaid/env.js +5 -0
- package/dist/ToolUseBar/BarItem/Content.js +13 -13
- package/dist/ToolUseBar/BarItem/index.js +7 -7
- package/dist/WelcomeMessage/index.js +4 -4
- package/package.json +1 -1
|
@@ -153,7 +153,9 @@ var fileMap = new Map();
|
|
|
153
153
|
return function() {
|
|
154
154
|
return window.removeEventListener('resize', change);
|
|
155
155
|
};
|
|
156
|
-
}, [
|
|
156
|
+
}, [
|
|
157
|
+
isOpen
|
|
158
|
+
]);
|
|
157
159
|
var context = useContext(ConfigProvider.ConfigContext);
|
|
158
160
|
var baseClassName = context === null || context === void 0 ? void 0 : context.getPrefixCls("agentic-md-editor-float-bar");
|
|
159
161
|
var _useStyle = useStyle(baseClassName), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
|
|
@@ -174,7 +174,7 @@ function _ts_generator(thisArg, body) {
|
|
|
174
174
|
}
|
|
175
175
|
import { CommentOutlined, CopyFilled, HighlightFilled } from "@ant-design/icons";
|
|
176
176
|
import { Input, message, Modal } from "antd";
|
|
177
|
-
import
|
|
177
|
+
import classNames from "clsx";
|
|
178
178
|
import copy from "copy-to-clipboard";
|
|
179
179
|
import React, { useContext, useEffect, useMemo } from "react";
|
|
180
180
|
import { Editor, Element, Node, Point, Transforms } from "slate";
|
|
@@ -212,7 +212,7 @@ import { getPointStrOffset, getSelectionFromDomSelection } from "../../utils/edi
|
|
|
212
212
|
list.push(/*#__PURE__*/ React.createElement("div", {
|
|
213
213
|
role: "button",
|
|
214
214
|
key: "highlight",
|
|
215
|
-
className:
|
|
215
|
+
className: classNames("".concat(baseClassName, "-item")),
|
|
216
216
|
onClick: function onClick() {
|
|
217
217
|
return _async_to_generator(function() {
|
|
218
218
|
var _editorProps_comment_onSubmit, _editorProps_comment, domSelection, editor, selection, texts, title, fragments, i, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, str, focus, anchor, _ref, start, end, anchorOffset, focusOffset, comment;
|
|
@@ -308,7 +308,7 @@ import { getPointStrOffset, getSelectionFromDomSelection } from "../../utils/edi
|
|
|
308
308
|
list.push(/*#__PURE__*/ React.createElement("div", {
|
|
309
309
|
role: "button",
|
|
310
310
|
key: "comment",
|
|
311
|
-
className:
|
|
311
|
+
className: classNames("".concat(baseClassName, "-item")),
|
|
312
312
|
onClick: function onClick() {
|
|
313
313
|
var _i18n_locale, _editorProps_comment, _i18n_locale1;
|
|
314
314
|
if (typeof window === 'undefined') return;
|
|
@@ -443,7 +443,7 @@ import { getPointStrOffset, getSelectionFromDomSelection } from "../../utils/edi
|
|
|
443
443
|
list.push(/*#__PURE__*/ React.createElement("div", {
|
|
444
444
|
role: "button",
|
|
445
445
|
key: "insert",
|
|
446
|
-
className:
|
|
446
|
+
className: classNames("".concat(baseClassName, "-item")),
|
|
447
447
|
onClick: function onClick() {
|
|
448
448
|
var domSelection = window.getSelection();
|
|
449
449
|
var editor = markdownEditorRef.current;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import classNames from "clsx";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { ToolBarItem } from "./ToolBarItem";
|
|
4
4
|
var ClearIcon = /*#__PURE__*/ React.memo(function() {
|
|
@@ -21,7 +21,7 @@ export var ClearFormatButton = /*#__PURE__*/ React.memo(function(param) {
|
|
|
21
21
|
title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale = i18n.locale) === null || _i18n_locale === void 0 ? void 0 : _i18n_locale.clearFormatting) || '清除格式',
|
|
22
22
|
icon: /*#__PURE__*/ React.createElement(ClearIcon, null),
|
|
23
23
|
onClick: onClear,
|
|
24
|
-
className:
|
|
24
|
+
className: classNames("".concat(baseClassName, "-item"), hashId)
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
27
|
ClearFormatButton.displayName = 'ClearFormatButton';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HighlightOutlined } from "@ant-design/icons";
|
|
2
2
|
import { ColorPicker } from "antd";
|
|
3
|
-
import
|
|
3
|
+
import classNames from "clsx";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { ToolBarItem } from "./ToolBarItem";
|
|
6
6
|
var colors = [
|
|
@@ -40,7 +40,7 @@ export var ColorPickerButton = /*#__PURE__*/ React.memo(function(param) {
|
|
|
40
40
|
return /*#__PURE__*/ React.createElement(ToolBarItem, {
|
|
41
41
|
title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale = i18n.locale) === null || _i18n_locale === void 0 ? void 0 : _i18n_locale['font-color']) || '字体颜色',
|
|
42
42
|
icon: /*#__PURE__*/ React.createElement(HighlightOutlined, null),
|
|
43
|
-
className:
|
|
43
|
+
className: classNames("".concat(baseClassName, "-item"), hashId),
|
|
44
44
|
style: {
|
|
45
45
|
position: 'relative'
|
|
46
46
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FormatPainterOutlined } from "@ant-design/icons";
|
|
2
|
-
import
|
|
2
|
+
import classNames from "clsx";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { ToolBarItem } from "./ToolBarItem";
|
|
5
5
|
export var FormatButton = /*#__PURE__*/ React.memo(function(param) {
|
|
@@ -9,7 +9,7 @@ export var FormatButton = /*#__PURE__*/ React.memo(function(param) {
|
|
|
9
9
|
title: ((_i18n_locale = i18n.locale) === null || _i18n_locale === void 0 ? void 0 : _i18n_locale.format) || '格式化',
|
|
10
10
|
icon: /*#__PURE__*/ React.createElement(FormatPainterOutlined, null),
|
|
11
11
|
onClick: onFormat,
|
|
12
|
-
className:
|
|
12
|
+
className: classNames("".concat(baseClassName, "-item"), hashId),
|
|
13
13
|
style: {
|
|
14
14
|
fontSize: '0.9em'
|
|
15
15
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import classNames from "clsx";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { ToolBarItem } from "./ToolBarItem";
|
|
4
4
|
export var FormattingTools = /*#__PURE__*/ React.memo(function(param) {
|
|
@@ -28,7 +28,7 @@ export var FormattingTools = /*#__PURE__*/ React.memo(function(param) {
|
|
|
28
28
|
onClick: function onClick() {
|
|
29
29
|
return !isCodeNode && onToolClick(tool);
|
|
30
30
|
},
|
|
31
|
-
className:
|
|
31
|
+
className: classNames("".concat(baseClassName, "-item"), hashId),
|
|
32
32
|
style: {
|
|
33
33
|
color: isActive ? '#1677ff' : undefined
|
|
34
34
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dropdown } from "antd";
|
|
2
|
-
import
|
|
2
|
+
import classNames from "clsx";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { ToolBarItem } from "./ToolBarItem";
|
|
5
5
|
var HeadingLocaleKeyMap = {
|
|
@@ -58,7 +58,7 @@ export var HeadingDropdown = /*#__PURE__*/ React.memo(function(param) {
|
|
|
58
58
|
}, /*#__PURE__*/ React.createElement(ToolBarItem, {
|
|
59
59
|
title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale = i18n.locale) === null || _i18n_locale === void 0 ? void 0 : _i18n_locale.heading) || '标题',
|
|
60
60
|
icon: null,
|
|
61
|
-
className:
|
|
61
|
+
className: classNames("".concat(baseClassName, "-item"), hashId),
|
|
62
62
|
style: {
|
|
63
63
|
minWidth: 36,
|
|
64
64
|
textAlign: 'center',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LinkOutlined } from "@ant-design/icons";
|
|
2
|
-
import
|
|
2
|
+
import classNames from "clsx";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { ToolBarItem } from "./ToolBarItem";
|
|
5
5
|
export var LinkButton = /*#__PURE__*/ React.memo(function(param) {
|
|
@@ -9,7 +9,7 @@ export var LinkButton = /*#__PURE__*/ React.memo(function(param) {
|
|
|
9
9
|
title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale = i18n.locale) === null || _i18n_locale === void 0 ? void 0 : _i18n_locale.insertLink) || '插入链接',
|
|
10
10
|
icon: /*#__PURE__*/ React.createElement(LinkOutlined, null),
|
|
11
11
|
onClick: onInsertLink,
|
|
12
|
-
className:
|
|
12
|
+
className: classNames("".concat(baseClassName, "-item"), hashId),
|
|
13
13
|
style: {
|
|
14
14
|
color: isLinkActive ? '#1677ff' : undefined
|
|
15
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RedoOutlined, UndoOutlined } from "@ant-design/icons";
|
|
2
|
-
import
|
|
2
|
+
import classNames from "clsx";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { ToolBarItem } from "./ToolBarItem";
|
|
5
5
|
export var UndoRedoButtons = /*#__PURE__*/ React.memo(function(param) {
|
|
@@ -9,12 +9,12 @@ export var UndoRedoButtons = /*#__PURE__*/ React.memo(function(param) {
|
|
|
9
9
|
title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale = i18n.locale) === null || _i18n_locale === void 0 ? void 0 : _i18n_locale.undo) || '撤销',
|
|
10
10
|
icon: /*#__PURE__*/ React.createElement(UndoOutlined, null),
|
|
11
11
|
onClick: onUndo,
|
|
12
|
-
className:
|
|
12
|
+
className: classNames("".concat(baseClassName, "-item"), hashId)
|
|
13
13
|
}), /*#__PURE__*/ React.createElement(ToolBarItem, {
|
|
14
14
|
title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale1 = i18n.locale) === null || _i18n_locale1 === void 0 ? void 0 : _i18n_locale1.redo) || '重做',
|
|
15
15
|
icon: /*#__PURE__*/ React.createElement(RedoOutlined, null),
|
|
16
16
|
onClick: onRedo,
|
|
17
|
-
className:
|
|
17
|
+
className: classNames("".concat(baseClassName, "-item"), hashId)
|
|
18
18
|
}));
|
|
19
19
|
});
|
|
20
20
|
UndoRedoButtons.displayName = 'UndoRedoButtons';
|
|
@@ -530,16 +530,17 @@ export var EditorUtils = /*#__PURE__*/ function() {
|
|
|
530
530
|
* @returns 返回指定范围内的文本内容。
|
|
531
531
|
*/ function copyText(editor, start, end) {
|
|
532
532
|
var _leaf_text;
|
|
533
|
-
var
|
|
533
|
+
var _Editor_leaf = _sliced_to_array(Editor.leaf(editor, start), 2), leaf = _Editor_leaf[0], leafPath = _Editor_leaf[1];
|
|
534
534
|
var text = '';
|
|
535
535
|
// Handle first leaf node from start offset
|
|
536
536
|
text += ((_leaf_text = leaf.text) === null || _leaf_text === void 0 ? void 0 : _leaf_text.slice(start.offset)) || '';
|
|
537
537
|
// Get next nodes until we reach the end point
|
|
538
538
|
var next = Editor.next(editor, {
|
|
539
|
-
at:
|
|
539
|
+
at: leafPath
|
|
540
540
|
});
|
|
541
|
+
var endLeafPath = end ? Editor.leaf(editor, end)[1] : null;
|
|
541
542
|
while(next){
|
|
542
|
-
if (
|
|
543
|
+
if (endLeafPath && Path.equals(next[1], endLeafPath)) {
|
|
543
544
|
var _next__text;
|
|
544
545
|
// If we reach the end path, slice until end offset
|
|
545
546
|
text += ((_next__text = next[0].text) === null || _next__text === void 0 ? void 0 : _next__text.slice(0, end.offset)) || '';
|
|
@@ -566,17 +567,18 @@ export var EditorUtils = /*#__PURE__*/ function() {
|
|
|
566
567
|
* @returns 剪切的文本数组,每个元素为一个 CustomLeaf 对象。
|
|
567
568
|
*/ function cutText(editor, start, end) {
|
|
568
569
|
var _leaf_text;
|
|
569
|
-
var
|
|
570
|
+
var _Editor_leaf = _sliced_to_array(Editor.leaf(editor, start), 2), leaf = _Editor_leaf[0], leafPath = _Editor_leaf[1];
|
|
570
571
|
var texts = [
|
|
571
572
|
_object_spread_props(_object_spread({}, leaf), {
|
|
572
573
|
text: ((_leaf_text = leaf.text) === null || _leaf_text === void 0 ? void 0 : _leaf_text.slice(start.offset)) || ''
|
|
573
574
|
})
|
|
574
575
|
];
|
|
576
|
+
var endLeafPath = end ? Editor.leaf(editor, end)[1] : null;
|
|
575
577
|
var next = Editor.next(editor, {
|
|
576
|
-
at:
|
|
578
|
+
at: leafPath
|
|
577
579
|
});
|
|
578
580
|
while(next){
|
|
579
|
-
if (
|
|
581
|
+
if (endLeafPath && Path.equals(next[1], endLeafPath)) {
|
|
580
582
|
var _next__text;
|
|
581
583
|
texts.push(_object_spread_props(_object_spread({}, next[0]), {
|
|
582
584
|
text: ((_next__text = next[0].text) === null || _next__text === void 0 ? void 0 : _next__text.slice(0, end.offset)) || ''
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
if (/\|.+\|[\r\n]+\|[\s-:]+\|/m.test(text)) {
|
|
15
15
|
return true;
|
|
16
16
|
}
|
|
17
|
-
// Check for Markdown links
|
|
18
|
-
if (
|
|
17
|
+
// Check for Markdown images (before links:  also matches link pattern)
|
|
18
|
+
if (/!\[.+\]\(.+\)/.test(text)) {
|
|
19
19
|
return true;
|
|
20
20
|
}
|
|
21
|
-
// Check for Markdown
|
|
22
|
-
if (
|
|
21
|
+
// Check for Markdown links
|
|
22
|
+
if (/\[.+\]\(.+\)/.test(text)) {
|
|
23
23
|
return true;
|
|
24
24
|
}
|
|
25
25
|
// Check for Markdown code blocks
|
|
@@ -220,7 +220,7 @@ import { message } from "antd";
|
|
|
220
220
|
import copy from "copy-to-clipboard";
|
|
221
221
|
import isHotkey from "is-hotkey";
|
|
222
222
|
import { useEffect, useMemo } from "react";
|
|
223
|
-
import { Editor, Element,
|
|
223
|
+
import { Editor, Element, Path, Range, Transforms } from "slate";
|
|
224
224
|
import { ReactEditor } from "slate-react";
|
|
225
225
|
import { useRefFunction } from "../../../Hooks/useRefFunction";
|
|
226
226
|
import { useSubject } from "../../hooks/subscribe";
|
|
@@ -314,7 +314,8 @@ export var KeyboardTask = /*#__PURE__*/ function() {
|
|
|
314
314
|
value: function selectWord() {
|
|
315
315
|
var sel = this.editor.selection;
|
|
316
316
|
if (sel && Range.isCollapsed(sel)) {
|
|
317
|
-
var
|
|
317
|
+
var _Editor_leaf = _sliced_to_array(Editor.leaf(this.editor, sel.anchor), 1), leaf = _Editor_leaf[0];
|
|
318
|
+
var text = (leaf === null || leaf === void 0 ? void 0 : leaf.text) || '';
|
|
318
319
|
var start = sel.anchor.offset;
|
|
319
320
|
var end = start;
|
|
320
321
|
var next = text.slice(start);
|
package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileListItem.js
CHANGED
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
function _array_like_to_array(arr, len) {
|
|
2
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
-
return arr2;
|
|
5
|
-
}
|
|
6
|
-
function _array_without_holes(arr) {
|
|
7
|
-
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
8
|
-
}
|
|
9
|
-
function _iterable_to_array(iter) {
|
|
10
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
11
|
-
}
|
|
12
|
-
function _non_iterable_spread() {
|
|
13
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
14
|
-
}
|
|
15
|
-
function _to_consumable_array(arr) {
|
|
16
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
17
|
-
}
|
|
18
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
19
|
-
if (!o) return;
|
|
20
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
21
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
22
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
23
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
24
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
25
|
-
}
|
|
26
1
|
import { FileFailed, FileUploadingSpin, X } from "@sofa-design/icons";
|
|
27
2
|
import { Tooltip } from "antd";
|
|
28
3
|
import classNames from "clsx";
|
|
@@ -37,39 +12,33 @@ var getFileNameWithoutExtension = function getFileNameWithoutExtension(fileName)
|
|
|
37
12
|
var getFileExtension = function getFileExtension(fileName) {
|
|
38
13
|
return fileName.split('.').slice(-1)[0];
|
|
39
14
|
};
|
|
40
|
-
var buildClassName = function buildClassName() {
|
|
41
|
-
for(var _len = arguments.length, classes = new Array(_len), _key = 0; _key < _len; _key++){
|
|
42
|
-
classes[_key] = arguments[_key];
|
|
43
|
-
}
|
|
44
|
-
return classNames.apply(void 0, _to_consumable_array(classes));
|
|
45
|
-
};
|
|
46
15
|
var FileIcon = function FileIcon(param) {
|
|
47
16
|
var file = param.file, prefixCls = param.prefixCls, hashId = param.hashId;
|
|
48
17
|
var status = file.status || 'done';
|
|
49
18
|
var iconMap = {
|
|
50
19
|
uploading: /*#__PURE__*/ React.createElement("div", {
|
|
51
|
-
className:
|
|
20
|
+
className: classNames("".concat(prefixCls, "-uploading-icon"), hashId)
|
|
52
21
|
}, /*#__PURE__*/ React.createElement(FileUploadingSpin, null)),
|
|
53
22
|
error: /*#__PURE__*/ React.createElement("div", {
|
|
54
|
-
className:
|
|
23
|
+
className: classNames("".concat(prefixCls, "-error-icon"), hashId)
|
|
55
24
|
}, /*#__PURE__*/ React.createElement(FileFailed, null)),
|
|
56
25
|
done: /*#__PURE__*/ React.createElement(AttachmentFileIcon, {
|
|
57
26
|
file: file,
|
|
58
|
-
className:
|
|
27
|
+
className: classNames("".concat(prefixCls, "-file-icon-img"), hashId)
|
|
59
28
|
})
|
|
60
29
|
};
|
|
61
30
|
return /*#__PURE__*/ React.createElement("div", {
|
|
62
|
-
className:
|
|
31
|
+
className: classNames("".concat(prefixCls, "-file-icon"), hashId)
|
|
63
32
|
}, iconMap[status]);
|
|
64
33
|
};
|
|
65
34
|
var FileSizeInfo = function FileSizeInfo(param) {
|
|
66
35
|
var file = param.file, prefixCls = param.prefixCls, hashId = param.hashId, locale = param.locale;
|
|
67
36
|
var status = file.status || 'done';
|
|
68
|
-
var baseClassName =
|
|
37
|
+
var baseClassName = classNames("".concat(prefixCls, "-file-size"), hashId);
|
|
69
38
|
var statusContentMap = {
|
|
70
39
|
uploading: (locale === null || locale === void 0 ? void 0 : locale.uploading) || '上传中...',
|
|
71
40
|
error: /*#__PURE__*/ React.createElement("div", {
|
|
72
|
-
className:
|
|
41
|
+
className: classNames(baseClassName, "".concat(prefixCls, "-file-size-error"))
|
|
73
42
|
}, (locale === null || locale === void 0 ? void 0 : locale.uploadFailed) || '上传失败'),
|
|
74
43
|
done: function() {
|
|
75
44
|
var fileExtension = getFileExtension(file.name);
|
|
@@ -81,7 +50,7 @@ var FileSizeInfo = function FileSizeInfo(param) {
|
|
|
81
50
|
return sizeItems.map(function(item) {
|
|
82
51
|
return /*#__PURE__*/ React.createElement("span", {
|
|
83
52
|
key: item,
|
|
84
|
-
className:
|
|
53
|
+
className: classNames("".concat(prefixCls, "-file-size-item"), hashId)
|
|
85
54
|
}, item);
|
|
86
55
|
});
|
|
87
56
|
}()
|
|
@@ -98,7 +67,7 @@ var DeleteButton = function DeleteButton(param) {
|
|
|
98
67
|
if (!isVisible) return null;
|
|
99
68
|
return /*#__PURE__*/ React.createElement("div", {
|
|
100
69
|
onClick: onClick,
|
|
101
|
-
className:
|
|
70
|
+
className: classNames("".concat(prefixCls, "-close-icon"), hashId)
|
|
102
71
|
}, /*#__PURE__*/ React.createElement(X, {
|
|
103
72
|
role: "img",
|
|
104
73
|
"aria-label": "X"
|
|
@@ -149,12 +118,12 @@ export var AttachmentFileListItem = function AttachmentFileListItem(param) {
|
|
|
149
118
|
prefixCls: prefixCls,
|
|
150
119
|
hashId: hashId
|
|
151
120
|
}), /*#__PURE__*/ React.createElement("div", {
|
|
152
|
-
className:
|
|
121
|
+
className: classNames("".concat(prefixCls, "-file-info"), hashId)
|
|
153
122
|
}, /*#__PURE__*/ React.createElement("div", {
|
|
154
123
|
onClick: handleRetryClick,
|
|
155
|
-
className:
|
|
124
|
+
className: classNames("".concat(prefixCls, "-file-name"), hashId)
|
|
156
125
|
}, /*#__PURE__*/ React.createElement("span", {
|
|
157
|
-
className:
|
|
126
|
+
className: classNames("".concat(prefixCls, "-file-name-text"), hashId)
|
|
158
127
|
}, getFileNameWithoutExtension(file.name))), /*#__PURE__*/ React.createElement(FileSizeInfo, {
|
|
159
128
|
file: file,
|
|
160
129
|
prefixCls: prefixCls,
|
|
@@ -322,8 +322,8 @@ import { RefinePromptButton } from "../RefinePromptButton";
|
|
|
322
322
|
isHover: isHover,
|
|
323
323
|
isLoading: isLoading,
|
|
324
324
|
fileUploadStatus: fileUploadStatus
|
|
325
|
-
}) : []), //
|
|
326
|
-
_to_consumable_array(
|
|
325
|
+
}) : []), // 提示词优化按钮(有 refinePrompt 即渲染,enable 由 handleRefine 内校验)
|
|
326
|
+
_to_consumable_array(refinePrompt ? [
|
|
327
327
|
/*#__PURE__*/ React.createElement(RefinePromptButton, {
|
|
328
328
|
key: "refine-prompt",
|
|
329
329
|
isHover: isHover,
|
|
@@ -4,6 +4,7 @@ import { ConfigProvider, Tooltip } from "antd";
|
|
|
4
4
|
import React, { useContext } from "react";
|
|
5
5
|
import { ErrorBoundary } from "react-error-boundary";
|
|
6
6
|
import { ActionIconBox } from "../../Components/ActionIconBox";
|
|
7
|
+
import { isBrowserEnv } from "./env";
|
|
7
8
|
import { useStyle } from "./style";
|
|
8
9
|
export var RefinePromptButton = function RefinePromptButton(props) {
|
|
9
10
|
var disabled = props.disabled, status = props.status, onRefine = props.onRefine;
|
|
@@ -19,7 +20,7 @@ export var RefinePromptButton = function RefinePromptButton(props) {
|
|
|
19
20
|
if (status === 'loading') return /*#__PURE__*/ React.createElement(LoadingOutlined, null);
|
|
20
21
|
return /*#__PURE__*/ React.createElement(TextOptimize, null);
|
|
21
22
|
};
|
|
22
|
-
if (
|
|
23
|
+
if (!isBrowserEnv()) {
|
|
23
24
|
return null;
|
|
24
25
|
}
|
|
25
26
|
return wrapSSR(/*#__PURE__*/ React.createElement(Tooltip, {
|
|
@@ -115,7 +115,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
115
115
|
import { ConfigProvider } from "antd";
|
|
116
116
|
import { BarElement, CategoryScale, Chart as ChartJS, Legend, LinearScale, Tooltip } from "chart.js";
|
|
117
117
|
import ChartDataLabels from "chartjs-plugin-datalabels";
|
|
118
|
-
import
|
|
118
|
+
import clsx from "clsx";
|
|
119
119
|
import React, { useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
120
120
|
import { Bar } from "react-chartjs-2";
|
|
121
121
|
import { ChartContainer, ChartFilter, ChartStatistic, ChartToolBar, downloadChart } from "../components";
|
|
@@ -829,18 +829,18 @@ var BarChart = function BarChart(param) {
|
|
|
829
829
|
var handleDownload = function handleDownload() {
|
|
830
830
|
downloadChart(chartRef.current, 'bar-chart');
|
|
831
831
|
};
|
|
832
|
-
var rootClassName =
|
|
832
|
+
var rootClassName = clsx(classNames === null || classNames === void 0 ? void 0 : classNames.root, className);
|
|
833
833
|
var rootStyle = _object_spread({
|
|
834
834
|
width: responsiveWidth,
|
|
835
835
|
height: responsiveHeight
|
|
836
836
|
}, style, styles === null || styles === void 0 ? void 0 : styles.root);
|
|
837
|
-
var toolbarClassName =
|
|
837
|
+
var toolbarClassName = clsx(classNames === null || classNames === void 0 ? void 0 : classNames.toolbar);
|
|
838
838
|
var toolbarStyle = styles === null || styles === void 0 ? void 0 : styles.toolbar;
|
|
839
|
-
var statisticContainerClassName =
|
|
839
|
+
var statisticContainerClassName = clsx(classNames === null || classNames === void 0 ? void 0 : classNames.statisticContainer, "".concat(baseClassName, "-statistic-container"));
|
|
840
840
|
var statisticContainerStyle = styles === null || styles === void 0 ? void 0 : styles.statisticContainer;
|
|
841
|
-
var filterClassName =
|
|
841
|
+
var filterClassName = clsx(classNames === null || classNames === void 0 ? void 0 : classNames.filter);
|
|
842
842
|
var filterStyle = styles === null || styles === void 0 ? void 0 : styles.filter;
|
|
843
|
-
var wrapperClassName =
|
|
843
|
+
var wrapperClassName = clsx(classNames === null || classNames === void 0 ? void 0 : classNames.wrapper, "".concat(baseClassName, "-wrapper"));
|
|
844
844
|
var wrapperStyle = _object_spread({
|
|
845
845
|
marginTop: '20px',
|
|
846
846
|
height: responsiveHeight
|
|
@@ -26,6 +26,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
26
26
|
import { CategoryScale, Chart as ChartJS, Filler, Legend, LinearScale, LineElement, PointElement, Title, Tooltip } from "chart.js";
|
|
27
27
|
import React, { useImperativeHandle, useRef } from "react";
|
|
28
28
|
import { Line } from "react-chartjs-2";
|
|
29
|
+
import { isWindowDefined } from "../env";
|
|
29
30
|
import { Container } from "./Container";
|
|
30
31
|
var chartMarkAreaRegistered = false;
|
|
31
32
|
export var Area = function Area(props) {
|
|
@@ -33,7 +34,7 @@ export var Area = function Area(props) {
|
|
|
33
34
|
if (chartMarkAreaRegistered) {
|
|
34
35
|
return undefined;
|
|
35
36
|
}
|
|
36
|
-
if (
|
|
37
|
+
if (!isWindowDefined()) {
|
|
37
38
|
return undefined;
|
|
38
39
|
}
|
|
39
40
|
ChartJS.register(CategoryScale, LinearScale, PointElement, LineElement, Filler, Title, Tooltip, Legend);
|
|
@@ -26,6 +26,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
26
26
|
import { BarElement, CategoryScale, Chart as ChartJS, Legend, LinearScale, Title, Tooltip } from "chart.js";
|
|
27
27
|
import React, { useImperativeHandle, useRef } from "react";
|
|
28
28
|
import { Bar as ChartBar } from "react-chartjs-2";
|
|
29
|
+
import { isWindowDefined } from "../env";
|
|
29
30
|
import { stringFormatNumber } from "../utils";
|
|
30
31
|
import { Container } from "./Container";
|
|
31
32
|
var chartMarkBarRegistered = false;
|
|
@@ -34,7 +35,7 @@ export var Bar = function Bar(props) {
|
|
|
34
35
|
if (chartMarkBarRegistered) {
|
|
35
36
|
return undefined;
|
|
36
37
|
}
|
|
37
|
-
if (
|
|
38
|
+
if (!isWindowDefined()) {
|
|
38
39
|
return undefined;
|
|
39
40
|
}
|
|
40
41
|
ChartJS.register(CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend);
|
|
@@ -26,6 +26,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
26
26
|
import { BarElement, CategoryScale, Chart as ChartJS, Legend, LinearScale, Title, Tooltip } from "chart.js";
|
|
27
27
|
import React, { useImperativeHandle, useRef } from "react";
|
|
28
28
|
import { Bar as ChartBar } from "react-chartjs-2";
|
|
29
|
+
import { isWindowDefined } from "../env";
|
|
29
30
|
import { stringFormatNumber } from "../utils";
|
|
30
31
|
import { Container } from "./Container";
|
|
31
32
|
var chartMarkColumnRegistered = false;
|
|
@@ -34,7 +35,7 @@ export var Column = function Column(props) {
|
|
|
34
35
|
if (chartMarkColumnRegistered) {
|
|
35
36
|
return undefined;
|
|
36
37
|
}
|
|
37
|
-
if (
|
|
38
|
+
if (!isWindowDefined()) {
|
|
38
39
|
return undefined;
|
|
39
40
|
}
|
|
40
41
|
ChartJS.register(CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend);
|
|
@@ -26,6 +26,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
26
26
|
import { CategoryScale, Chart as ChartJS, Legend, LinearScale, LineElement, PointElement, Title, Tooltip } from "chart.js";
|
|
27
27
|
import React, { useImperativeHandle, useRef } from "react";
|
|
28
28
|
import { Line as ChartLine } from "react-chartjs-2";
|
|
29
|
+
import { isWindowDefined } from "../env";
|
|
29
30
|
import { stringFormatNumber } from "../utils";
|
|
30
31
|
import { Container } from "./Container";
|
|
31
32
|
var chartMarkLineRegistered = false;
|
|
@@ -34,7 +35,7 @@ export var Line = function Line(props) {
|
|
|
34
35
|
if (chartMarkLineRegistered) {
|
|
35
36
|
return undefined;
|
|
36
37
|
}
|
|
37
|
-
if (
|
|
38
|
+
if (!isWindowDefined()) {
|
|
38
39
|
return undefined;
|
|
39
40
|
}
|
|
40
41
|
ChartJS.register(CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip, Legend);
|
|
@@ -2,6 +2,7 @@ import { ArcElement, Chart as ChartJS, Legend, Tooltip } from "chart.js";
|
|
|
2
2
|
import React, { useImperativeHandle, useRef } from "react";
|
|
3
3
|
import { Doughnut } from "react-chartjs-2";
|
|
4
4
|
import { defaultColorList } from "../const";
|
|
5
|
+
import { isWindowDefined } from "../env";
|
|
5
6
|
import { Container } from "./Container";
|
|
6
7
|
var chartMarkPieRegistered = false;
|
|
7
8
|
export var Pie = function Pie(props) {
|
|
@@ -9,7 +10,7 @@ export var Pie = function Pie(props) {
|
|
|
9
10
|
if (chartMarkPieRegistered) {
|
|
10
11
|
return undefined;
|
|
11
12
|
}
|
|
12
|
-
if (
|
|
13
|
+
if (!isWindowDefined()) {
|
|
13
14
|
return undefined;
|
|
14
15
|
}
|
|
15
16
|
ChartJS.register(ArcElement, Tooltip, Legend);
|
|
@@ -678,6 +678,13 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
678
678
|
return k + 1;
|
|
679
679
|
});
|
|
680
680
|
}, 800));
|
|
681
|
+
// 卸载时取消未执行的防抖,避免在测试或 SSR 环境下 teardown 后回调触发 setState
|
|
682
|
+
React.useEffect(function() {
|
|
683
|
+
return function() {
|
|
684
|
+
var _debouncedUpdateRenderKeyRef_current_cancel, _debouncedUpdateRenderKeyRef_current;
|
|
685
|
+
(_debouncedUpdateRenderKeyRef_current = debouncedUpdateRenderKeyRef.current) === null || _debouncedUpdateRenderKeyRef_current === void 0 ? void 0 : (_debouncedUpdateRenderKeyRef_current_cancel = _debouncedUpdateRenderKeyRef_current.cancel) === null || _debouncedUpdateRenderKeyRef_current_cancel === void 0 ? void 0 : _debouncedUpdateRenderKeyRef_current_cancel.call(_debouncedUpdateRenderKeyRef_current);
|
|
686
|
+
};
|
|
687
|
+
}, []);
|
|
681
688
|
var renderDescriptionsFallback = React.useMemo(function() {
|
|
682
689
|
var _config_columns;
|
|
683
690
|
var columnCount = (config === null || config === void 0 ? void 0 : (_config_columns = config.columns) === null || _config_columns === void 0 ? void 0 : _config_columns.length) || 0;
|
|
@@ -833,6 +840,7 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
833
840
|
var filterByChanged = prevDataRef.current.filterBy !== filterBy;
|
|
834
841
|
var hasChanged = prevDataRef.current.dataHash !== dataHash || configChanged || groupByChanged || colorLegendChanged || filterByChanged;
|
|
835
842
|
if (hasChanged) {
|
|
843
|
+
var dataHashChanged = prevDataRef.current.dataHash !== dataHash;
|
|
836
844
|
// 更新缓存
|
|
837
845
|
prevDataRef.current = {
|
|
838
846
|
dataHash: dataHash,
|
|
@@ -842,7 +850,7 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
842
850
|
filterBy: filterBy
|
|
843
851
|
};
|
|
844
852
|
// 对于流式数据,使用防抖更新,避免频繁渲染
|
|
845
|
-
if (
|
|
853
|
+
if (dataHashChanged) {
|
|
846
854
|
debouncedUpdateRenderKeyRef.current();
|
|
847
855
|
} else {
|
|
848
856
|
// 配置变化时立即更新
|
|
@@ -150,6 +150,7 @@ import classNames from "clsx";
|
|
|
150
150
|
import React, { useContext, useMemo, useRef, useState } from "react";
|
|
151
151
|
import { Doughnut } from "react-chartjs-2";
|
|
152
152
|
import { ChartContainer, ChartFilter, ChartStatistic, ChartToolBar, downloadChart } from "../components";
|
|
153
|
+
import { isWindowDefined } from "../env";
|
|
153
154
|
import { defaultColorList } from "../const";
|
|
154
155
|
import { resolveCssVariable } from "../utils";
|
|
155
156
|
import { SINGLE_MODE_DESKTOP_CUTOUT, SINGLE_MODE_MOBILE_CUTOUT } from "./constants";
|
|
@@ -221,7 +222,7 @@ import { useStyle } from "./style";
|
|
|
221
222
|
if (donutChartComponentsRegistered) {
|
|
222
223
|
return undefined;
|
|
223
224
|
}
|
|
224
|
-
if (
|
|
225
|
+
if (!isWindowDefined()) {
|
|
225
226
|
return undefined;
|
|
226
227
|
}
|
|
227
228
|
ChartJS.register(ArcElement, Tooltip, Legend);
|
|
@@ -482,6 +482,7 @@ import { loadAceEditor, loadAceTheme } from "../loadAceEditor";
|
|
|
482
482
|
if (readonly) return;
|
|
483
483
|
clearTimeout(debounceTimer.current);
|
|
484
484
|
debounceTimer.current = window.setTimeout(function() {
|
|
485
|
+
if (typeof window === 'undefined') return;
|
|
485
486
|
onUpdate({
|
|
486
487
|
value: codeEditor.getValue()
|
|
487
488
|
});
|
|
@@ -552,6 +553,7 @@ import { loadAceEditor, loadAceTheme } from "../loadAceEditor";
|
|
|
552
553
|
// 配置编辑器事件
|
|
553
554
|
setupEditorEvents(codeEditor);
|
|
554
555
|
return function() {
|
|
556
|
+
clearTimeout(debounceTimer.current);
|
|
555
557
|
codeEditor.destroy();
|
|
556
558
|
};
|
|
557
559
|
}, [
|