@ant-design/agentic-ui 2.14.1 → 2.16.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.
Files changed (103) hide show
  1. package/dist/Bubble/BubbleBeforeNode.js +9 -9
  2. package/dist/Bubble/List/PureBubbleList.js +1 -1
  3. package/dist/Bubble/MessagesContent/EXCEPTION.js +1 -1
  4. package/dist/ChatLayout/style.js +16 -17
  5. package/dist/Constants/mobile.d.ts +3 -0
  6. package/dist/Constants/mobile.js +7 -0
  7. package/dist/Hooks/useLanguage.d.ts +2 -0
  8. package/dist/I18n/locales.d.ts +2 -0
  9. package/dist/I18n/locales.js +4 -0
  10. package/dist/MarkdownEditor/BaseMarkdownEditor.js +1 -1
  11. package/dist/MarkdownEditor/editor/Editor.js +16 -8
  12. package/dist/MarkdownEditor/editor/code.css +2 -2
  13. package/dist/MarkdownEditor/editor/elements/Code.js +11 -6
  14. package/dist/MarkdownEditor/editor/elements/FootnoteDefinition.js +2 -1
  15. package/dist/MarkdownEditor/editor/elements/FootnoteReference.js +2 -1
  16. package/dist/MarkdownEditor/editor/elements/Head.d.ts +1 -0
  17. package/dist/MarkdownEditor/editor/elements/Head.js +1 -1
  18. package/dist/MarkdownEditor/editor/elements/Image/index.js +19 -7
  19. package/dist/MarkdownEditor/editor/elements/LinkCard/index.js +2 -1
  20. package/dist/MarkdownEditor/editor/elements/LinkCard/style.js +1 -1
  21. package/dist/MarkdownEditor/editor/elements/List/ListItem.js +1 -0
  22. package/dist/MarkdownEditor/editor/elements/List/style.js +2 -2
  23. package/dist/MarkdownEditor/editor/elements/Media.js +22 -10
  24. package/dist/MarkdownEditor/editor/elements/Paragraph.js +2 -1
  25. package/dist/MarkdownEditor/editor/elements/Schema.js +1 -1
  26. package/dist/MarkdownEditor/editor/elements/Table/ReadonlyTableComponent.js +16 -4
  27. package/dist/MarkdownEditor/editor/elements/Table/SimpleTable.js +17 -2
  28. package/dist/MarkdownEditor/editor/elements/Table/Table.js +155 -20
  29. package/dist/MarkdownEditor/editor/elements/Table/Td/style.js +5 -2
  30. package/dist/MarkdownEditor/editor/elements/Table/index.js +0 -2
  31. package/dist/MarkdownEditor/editor/elements/Table/style.js +7 -8
  32. package/dist/MarkdownEditor/editor/elements/TagPopup/index.js +5 -3
  33. package/dist/MarkdownEditor/editor/elements/TagPopup/style.js +2 -2
  34. package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.d.ts +100 -1
  35. package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.js +781 -240
  36. package/dist/MarkdownEditor/editor/plugins/useKeyboard.js +8 -19
  37. package/dist/MarkdownEditor/editor/store.js +3 -3
  38. package/dist/MarkdownEditor/editor/style.js +41 -6
  39. package/dist/MarkdownEditor/editor/tools/DragHandle.js +3 -3
  40. package/dist/MarkdownEditor/editor/types/Table.d.ts +1 -0
  41. package/dist/MarkdownEditor/editor/utils/findMatchingClose.d.ts +36 -0
  42. package/dist/MarkdownEditor/editor/utils/findMatchingClose.js +158 -0
  43. package/dist/MarkdownEditor/editor/utils/markdownToHtml.d.ts +41 -2
  44. package/dist/MarkdownEditor/editor/utils/markdownToHtml.js +159 -7
  45. package/dist/MarkdownEditor/style.js +8 -2
  46. package/dist/MarkdownEditor/types.d.ts +1 -1
  47. package/dist/MarkdownEditor/utils/exportHtml.js +1 -1
  48. package/dist/MarkdownInputField/MarkdownInputField.d.ts +7 -7
  49. package/dist/MarkdownInputField/MarkdownInputField.js +11 -35
  50. package/dist/MarkdownInputField/SendButton/index.js +17 -3
  51. package/dist/MarkdownInputField/style.js +23 -2
  52. package/dist/Plugins/chart/AreaChart/index.d.ts +12 -0
  53. package/dist/Plugins/chart/AreaChart/index.js +14 -188
  54. package/dist/Plugins/chart/BarChart/index.d.ts +2 -0
  55. package/dist/Plugins/chart/BarChart/index.js +3 -12
  56. package/dist/Plugins/chart/ChartMark/Container.js +5 -2
  57. package/dist/Plugins/chart/ChartRender.d.ts +1 -0
  58. package/dist/Plugins/chart/ChartRender.js +104 -43
  59. package/dist/Plugins/chart/DonutChart/index.js +4 -2
  60. package/dist/Plugins/chart/DonutChart/types.d.ts +2 -0
  61. package/dist/Plugins/chart/FunnelChart/index.d.ts +2 -0
  62. package/dist/Plugins/chart/FunnelChart/index.js +4 -2
  63. package/dist/Plugins/chart/LineChart/index.d.ts +2 -0
  64. package/dist/Plugins/chart/LineChart/index.js +17 -162
  65. package/dist/Plugins/chart/RadarChart/index.d.ts +2 -0
  66. package/dist/Plugins/chart/RadarChart/index.js +8 -4
  67. package/dist/Plugins/chart/ScatterChart/index.d.ts +2 -0
  68. package/dist/Plugins/chart/ScatterChart/index.js +8 -4
  69. package/dist/Plugins/chart/components/ChartContainer/ChartContainer.d.ts +1 -0
  70. package/dist/Plugins/chart/components/ChartContainer/ChartErrorBoundaryExample.js +1 -1
  71. package/dist/Plugins/chart/components/ChartFilter/ChartFilter.d.ts +1 -1
  72. package/dist/Plugins/chart/components/ChartFilter/ChartFilter.js +210 -16
  73. package/dist/Plugins/chart/components/ChartToolBar/ChartToolBar.d.ts +2 -0
  74. package/dist/Plugins/chart/components/ChartToolBar/ChartToolBar.js +9 -2
  75. package/dist/Plugins/chart/components/ChartToolBar/style.js +3 -1
  76. package/dist/Plugins/chart/hooks/index.d.ts +10 -0
  77. package/dist/Plugins/chart/hooks/index.js +8 -0
  78. package/dist/Plugins/chart/hooks/useChartDataFilter.d.ts +46 -0
  79. package/dist/Plugins/chart/hooks/useChartDataFilter.js +182 -0
  80. package/dist/Plugins/chart/hooks/useChartStatistics.d.ts +17 -0
  81. package/dist/Plugins/chart/hooks/useChartStatistics.js +25 -0
  82. package/dist/Plugins/chart/hooks/useChartTheme.d.ts +20 -0
  83. package/dist/Plugins/chart/hooks/useChartTheme.js +30 -0
  84. package/dist/Plugins/chart/hooks/useResponsiveSize.d.ts +23 -0
  85. package/dist/Plugins/chart/hooks/useResponsiveSize.js +94 -0
  86. package/dist/Plugins/chart/index.js +94 -10
  87. package/dist/Plugins/chart/utils/registerChart.d.ts +35 -0
  88. package/dist/Plugins/chart/utils/registerChart.js +54 -0
  89. package/dist/Plugins/chart/utils.d.ts +19 -0
  90. package/dist/Plugins/chart/utils.js +27 -0
  91. package/dist/Plugins/code/components/CodeContainer.js +2 -3
  92. package/dist/Plugins/code/components/CodeRenderer.js +53 -2
  93. package/dist/Plugins/code/components/CodeToolbar.js +22 -3
  94. package/dist/Plugins/katex/InlineKatex.js +1 -1
  95. package/dist/Plugins/katex/Katex.js +1 -1
  96. package/dist/Plugins/mermaid/Mermaid.js +66 -66
  97. package/dist/Plugins/mermaid/index.js +1 -1
  98. package/dist/ThoughtChainList/index.js +21 -2
  99. package/dist/ThoughtChainList/style.js +1 -0
  100. package/dist/Utils/loadCSS.js +6 -6
  101. package/dist/WelcomeMessage/index.js +21 -2
  102. package/dist/Workspace/Task/index.js +1 -1
  103. package/package.json +2 -2
@@ -54,6 +54,7 @@ import { ConfigProvider } from "antd";
54
54
  import classNames from "classnames";
55
55
  import React, { useContext, useMemo } from "react";
56
56
  import { ReactEditor, useSlate } from "slate-react";
57
+ import { Loading } from "../../../../Components/Loading";
57
58
  import { useTableStyle } from "./style";
58
59
  import { SlateTable } from "./Table";
59
60
  import { TablePropsProvider } from "./TableContext";
@@ -61,6 +62,7 @@ import { TablePropsProvider } from "./TableContext";
61
62
  * 简单表格组件 - 仅支持只读显示
62
63
  * 用于替代复杂的 Handsontable 实现,提供基础的表格功能
63
64
  */ export var SimpleTable = function(props) {
65
+ var _props_element_otherProps, _props_element;
64
66
  var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
65
67
  var baseCls = getPrefixCls('agentic-md-editor-content-table');
66
68
  var editor = useSlate();
@@ -70,14 +72,27 @@ import { TablePropsProvider } from "./TableContext";
70
72
  }, [
71
73
  props.element
72
74
  ]);
75
+ // 检查表格是否未闭合
76
+ var isUnclosed = ((_props_element = props.element) === null || _props_element === void 0 ? void 0 : (_props_element_otherProps = _props_element.otherProps) === null || _props_element_otherProps === void 0 ? void 0 : _props_element_otherProps.finish) === false;
73
77
  return wrapSSR(/*#__PURE__*/ React.createElement(TablePropsProvider, {
74
78
  tablePath: tablePath,
75
79
  tableNode: props.element
76
80
  }, /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, props.attributes), {
77
81
  "data-be": 'table',
82
+ "data-is-unclosed": isUnclosed,
78
83
  draggable: false,
79
- className: classNames("".concat(baseCls, "-container"), hashId)
80
- }), /*#__PURE__*/ React.createElement(SlateTable, _object_spread_props(_object_spread({}, props), {
84
+ className: classNames("".concat(baseCls, "-container"), hashId),
85
+ style: {
86
+ position: 'relative'
87
+ }
88
+ }), isUnclosed && /*#__PURE__*/ React.createElement("div", {
89
+ style: {
90
+ position: 'absolute',
91
+ top: '8px',
92
+ right: '8px',
93
+ zIndex: 10
94
+ }
95
+ }, /*#__PURE__*/ React.createElement(Loading, null)), /*#__PURE__*/ React.createElement(SlateTable, _object_spread_props(_object_spread({}, props), {
81
96
  hashId: hashId
82
97
  }), props.children))));
83
98
  };
@@ -9,6 +9,19 @@ function _array_with_holes(arr) {
9
9
  function _array_without_holes(arr) {
10
10
  if (Array.isArray(arr)) return _array_like_to_array(arr);
11
11
  }
12
+ function _define_property(obj, key, value) {
13
+ if (key in obj) {
14
+ Object.defineProperty(obj, key, {
15
+ value: value,
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true
19
+ });
20
+ } else {
21
+ obj[key] = value;
22
+ }
23
+ return obj;
24
+ }
12
25
  function _iterable_to_array(iter) {
13
26
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
14
27
  }
@@ -42,6 +55,45 @@ function _non_iterable_rest() {
42
55
  function _non_iterable_spread() {
43
56
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
44
57
  }
58
+ function _object_spread(target) {
59
+ for(var i = 1; i < arguments.length; i++){
60
+ var source = arguments[i] != null ? arguments[i] : {};
61
+ var ownKeys = Object.keys(source);
62
+ if (typeof Object.getOwnPropertySymbols === "function") {
63
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
64
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
65
+ }));
66
+ }
67
+ ownKeys.forEach(function(key) {
68
+ _define_property(target, key, source[key]);
69
+ });
70
+ }
71
+ return target;
72
+ }
73
+ function ownKeys(object, enumerableOnly) {
74
+ var keys = Object.keys(object);
75
+ if (Object.getOwnPropertySymbols) {
76
+ var symbols = Object.getOwnPropertySymbols(object);
77
+ if (enumerableOnly) {
78
+ symbols = symbols.filter(function(sym) {
79
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
80
+ });
81
+ }
82
+ keys.push.apply(keys, symbols);
83
+ }
84
+ return keys;
85
+ }
86
+ function _object_spread_props(target, source) {
87
+ source = source != null ? source : {};
88
+ if (Object.getOwnPropertyDescriptors) {
89
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
90
+ } else {
91
+ ownKeys(Object(source)).forEach(function(key) {
92
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
93
+ });
94
+ }
95
+ return target;
96
+ }
45
97
  function _object_without_properties(source, excluded) {
46
98
  if (source == null) return {};
47
99
  var target = _object_without_properties_loose(source, excluded);
@@ -88,6 +140,9 @@ import classNames from "classnames";
88
140
  import React, { useContext, useEffect, useMemo, useRef } from "react";
89
141
  import { Node } from "slate";
90
142
  import stringWidth from "string-width";
143
+ import { Loading } from "../../../../Components/Loading";
144
+ import { MOBILE_BREAKPOINT, MOBILE_TABLE_MIN_COLUMN_WIDTH } from "../../../../Constants/mobile";
145
+ import { useMEditor } from "../../../hooks/editor";
91
146
  import { useEditorStore } from "../../store";
92
147
  import { ReadonlyTableComponent } from "./ReadonlyTableComponent";
93
148
  import { TablePropsContext } from "./TableContext";
@@ -123,17 +178,19 @@ import useScrollShadow from "./useScrollShadow";
123
178
  "hashId",
124
179
  "children"
125
180
  ]);
126
- var _props_element_otherProps, _props_element, _props_element_children, _props_element1, _props_element_children__children, _props_element_children_, _props_element_children1, _props_element2;
127
- var _useEditorStore = useEditorStore(), readonly = _useEditorStore.readonly, markdownContainerRef = _useEditorStore.markdownContainerRef;
181
+ var _props_element_children__children, _props_element_children_, _props_element_children, _props_element, _props_element_otherProps, _props_element1, _props_element_children1, _props_element2, _props_element_otherProps1, _props_element3;
182
+ var _useEditorStore = useEditorStore(), readonly = _useEditorStore.readonly, markdownContainerRef = _useEditorStore.markdownContainerRef, store = _useEditorStore.store;
128
183
  var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
129
184
  var tablePath = useContext(TablePropsContext).tablePath;
130
185
  var baseCls = getPrefixCls('agentic-md-editor-content-table');
131
186
  var tableTargetRef = useRef(null);
187
+ var columnCount = ((_props_element = props.element) === null || _props_element === void 0 ? void 0 : (_props_element_children = _props_element.children) === null || _props_element_children === void 0 ? void 0 : (_props_element_children_ = _props_element_children[0]) === null || _props_element_children_ === void 0 ? void 0 : (_props_element_children__children = _props_element_children_.children) === null || _props_element_children__children === void 0 ? void 0 : _props_element_children__children.length) || 0;
188
+ var mobileBreakpointValue = parseInt(MOBILE_BREAKPOINT, 10) || 768;
132
189
  // 总是调用 hooks,避免条件调用
133
190
  var _useScrollShadow = _sliced_to_array(useScrollShadow(), 2), tableRef = _useScrollShadow[0], scrollState = _useScrollShadow[1];
134
191
  // 只在编辑模式下进行复杂的列宽计算
135
192
  var colWidths = useMemo(function() {
136
- var _props_element_otherProps, _props_element, _props_element_children, _props_element1, _tableRows__children, _tableRows_, _markdownContainerRef_current_querySelector, _markdownContainerRef_current, _tableRows__children1, _tableRows_1;
193
+ var _props_element_otherProps, _props_element, _props_element_children, _props_element1, _tableRows__children, _tableRows_, _markdownContainerRef_current_querySelector, _markdownContainerRef_current;
137
194
  // readonly 模式下使用简化计算
138
195
  if (readonly) {
139
196
  var _props_element2, _props_element_children__children, _props_element_children_, _props_element_children1, _props_element3;
@@ -141,9 +198,9 @@ import useScrollShadow from "./useScrollShadow";
141
198
  if (otherProps === null || otherProps === void 0 ? void 0 : otherProps.colWidths) {
142
199
  return otherProps.colWidths;
143
200
  }
144
- var columnCount = ((_props_element3 = props.element) === null || _props_element3 === void 0 ? void 0 : (_props_element_children1 = _props_element3.children) === null || _props_element_children1 === void 0 ? void 0 : (_props_element_children_ = _props_element_children1[0]) === null || _props_element_children_ === void 0 ? void 0 : (_props_element_children__children = _props_element_children_.children) === null || _props_element_children__children === void 0 ? void 0 : _props_element_children__children.length) || 0;
145
- if (columnCount === 0) return [];
146
- return Array(columnCount).fill(120); // 固定宽度
201
+ var columnCount1 = ((_props_element3 = props.element) === null || _props_element3 === void 0 ? void 0 : (_props_element_children1 = _props_element3.children) === null || _props_element_children1 === void 0 ? void 0 : (_props_element_children_ = _props_element_children1[0]) === null || _props_element_children_ === void 0 ? void 0 : (_props_element_children__children = _props_element_children_.children) === null || _props_element_children__children === void 0 ? void 0 : _props_element_children__children.length) || 0;
202
+ if (columnCount1 === 0) return [];
203
+ return Array(columnCount1).fill(80); // 固定宽度
147
204
  }
148
205
  // 如果在props中存在,直接使用以避免计算
149
206
  if ((_props_element = props.element) === null || _props_element === void 0 ? void 0 : (_props_element_otherProps = _props_element.otherProps) === null || _props_element_otherProps === void 0 ? void 0 : _props_element_otherProps.colWidths) {
@@ -155,13 +212,13 @@ import useScrollShadow from "./useScrollShadow";
155
212
  if (!(tableRows === null || tableRows === void 0 ? void 0 : (_tableRows_ = tableRows[0]) === null || _tableRows_ === void 0 ? void 0 : (_tableRows__children = _tableRows_.children) === null || _tableRows__children === void 0 ? void 0 : _tableRows__children.length)) return [];
156
213
  // 只获取一次容器宽度
157
214
  var containerWidth = ((markdownContainerRef === null || markdownContainerRef === void 0 ? void 0 : (_markdownContainerRef_current = markdownContainerRef.current) === null || _markdownContainerRef_current === void 0 ? void 0 : (_markdownContainerRef_current_querySelector = _markdownContainerRef_current.querySelector('.ant-agentic-md-editor-content')) === null || _markdownContainerRef_current_querySelector === void 0 ? void 0 : _markdownContainerRef_current_querySelector.clientWidth) || 400) - 32 - 12;
158
- var maxColumnWidth = containerWidth / 4;
159
- var minColumnWidth = 60;
160
- var columnCount1 = (tableRows === null || tableRows === void 0 ? void 0 : (_tableRows_1 = tableRows[0]) === null || _tableRows_1 === void 0 ? void 0 : (_tableRows__children1 = _tableRows_1.children) === null || _tableRows__children1 === void 0 ? void 0 : _tableRows__children1.length) || 0;
215
+ var isMobileLayout = containerWidth <= mobileBreakpointValue;
216
+ var minColumnWidth = isMobileLayout ? MOBILE_TABLE_MIN_COLUMN_WIDTH : 60;
217
+ var maxColumnWidth = isMobileLayout ? containerWidth : containerWidth / 4;
161
218
  var rowsToSample = Math.min(5, tableRows.length);
162
219
  // 一次性计算宽度
163
220
  var calculatedWidths = Array.from({
164
- length: columnCount1
221
+ length: columnCount
165
222
  }, function(_, colIndex) {
166
223
  var _Math;
167
224
  var cellWidths = [];
@@ -178,21 +235,21 @@ import useScrollShadow from "./useScrollShadow";
178
235
  ].concat(_to_consumable_array(cellWidths))), maxColumnWidth);
179
236
  });
180
237
  // 如果表格少于5行且总宽度超过容器宽度,则均匀分配宽度
181
- if (tableRows.length < 5) {
238
+ if (tableRows.length < 5 && columnCount > 0) {
182
239
  var totalWidth = calculatedWidths.reduce(function(sum, width) {
183
240
  return sum + width;
184
241
  }, 0);
185
242
  if (totalWidth > containerWidth) {
186
- var evenWidth = Math.max(minColumnWidth, Math.floor(containerWidth / columnCount1));
187
- return Array(columnCount1).fill(evenWidth);
243
+ var evenWidth = Math.max(minColumnWidth, Math.floor(containerWidth / columnCount));
244
+ return Array(columnCount).fill(evenWidth);
188
245
  }
189
246
  }
190
247
  return calculatedWidths;
191
248
  }, [
192
249
  readonly,
193
- (_props_element = props.element) === null || _props_element === void 0 ? void 0 : (_props_element_otherProps = _props_element.otherProps) === null || _props_element_otherProps === void 0 ? void 0 : _props_element_otherProps.colWidths,
194
- (_props_element1 = props.element) === null || _props_element1 === void 0 ? void 0 : (_props_element_children = _props_element1.children) === null || _props_element_children === void 0 ? void 0 : _props_element_children.length,
195
- (_props_element2 = props.element) === null || _props_element2 === void 0 ? void 0 : (_props_element_children1 = _props_element2.children) === null || _props_element_children1 === void 0 ? void 0 : (_props_element_children_ = _props_element_children1[0]) === null || _props_element_children_ === void 0 ? void 0 : (_props_element_children__children = _props_element_children_.children) === null || _props_element_children__children === void 0 ? void 0 : _props_element_children__children.length,
250
+ (_props_element1 = props.element) === null || _props_element1 === void 0 ? void 0 : (_props_element_otherProps = _props_element1.otherProps) === null || _props_element_otherProps === void 0 ? void 0 : _props_element_otherProps.colWidths,
251
+ (_props_element2 = props.element) === null || _props_element2 === void 0 ? void 0 : (_props_element_children1 = _props_element2.children) === null || _props_element_children1 === void 0 ? void 0 : _props_element_children1.length,
252
+ columnCount,
196
253
  markdownContainerRef
197
254
  ]);
198
255
  // 只在编辑模式下添加resize事件监听
@@ -208,7 +265,13 @@ import useScrollShadow from "./useScrollShadow";
208
265
  var dom = tableRef.current;
209
266
  if (dom) {
210
267
  setTimeout(function() {
211
- dom.style.minWidth = "min(".concat(((minWidth || 200) * 0.95).toFixed(0), "px,").concat(maxWidth || minWidth || 'xxx', "px,200px)");
268
+ var _markdownContainerRef_current_querySelector, _markdownContainerRef_current;
269
+ var containerWidthForBreakpoint = ((markdownContainerRef === null || markdownContainerRef === void 0 ? void 0 : (_markdownContainerRef_current = markdownContainerRef.current) === null || _markdownContainerRef_current === void 0 ? void 0 : (_markdownContainerRef_current_querySelector = _markdownContainerRef_current.querySelector('.ant-agentic-md-editor-content')) === null || _markdownContainerRef_current_querySelector === void 0 ? void 0 : _markdownContainerRef_current_querySelector.clientWidth) || 400) - 32 - 12;
270
+ var isMobileLayout = containerWidthForBreakpoint <= mobileBreakpointValue;
271
+ var computedMinColumnWidth = isMobileLayout ? MOBILE_TABLE_MIN_COLUMN_WIDTH : 60;
272
+ var fallbackMinWidth = Number(((minWidth || 200) * 0.95).toFixed(0));
273
+ var requiredMinWidth = Math.max(columnCount * computedMinColumnWidth, maxWidth, fallbackMinWidth, 200);
274
+ dom.style.minWidth = "".concat(requiredMinWidth, "px");
212
275
  }, 200);
213
276
  }
214
277
  };
@@ -279,7 +342,69 @@ import useScrollShadow from "./useScrollShadow";
279
342
  scrollState,
280
343
  readonly
281
344
  ]);
282
- // readonly 模式渲染 - 使用优化的组件
345
+ // 检查表格是否未闭合
346
+ var isUnclosed = ((_props_element3 = props.element) === null || _props_element3 === void 0 ? void 0 : (_props_element_otherProps1 = _props_element3.otherProps) === null || _props_element_otherProps1 === void 0 ? void 0 : _props_element_otherProps1.finish) === false;
347
+ // 获取编辑器更新函数 - 必须在早期返回之前调用 hooks
348
+ var _useMEditor = _sliced_to_array(useMEditor(props.element), 2), update = _useMEditor[1];
349
+ // 判断是否是最后一个节点 - 必须在早期返回之前调用 hooks
350
+ var isLastNode = useMemo(function() {
351
+ try {
352
+ return store.isLatestNode(props.element);
353
+ } catch (e) {
354
+ return false;
355
+ }
356
+ }, [
357
+ store,
358
+ props.element
359
+ ]);
360
+ // 如果不是最后一个节点,且未闭合,立即设置为完成 - 必须在早期返回之前调用 hooks
361
+ useEffect(function() {
362
+ if (isUnclosed && !readonly && !isLastNode) {
363
+ var _props_element_otherProps, _props_element;
364
+ // 检查 finish 是否仍然是 false(可能已经被其他逻辑更新)
365
+ if (((_props_element = props.element) === null || _props_element === void 0 ? void 0 : (_props_element_otherProps = _props_element.otherProps) === null || _props_element_otherProps === void 0 ? void 0 : _props_element_otherProps.finish) === false) {
366
+ var _props_element1;
367
+ update({
368
+ otherProps: _object_spread_props(_object_spread({}, (_props_element1 = props.element) === null || _props_element1 === void 0 ? void 0 : _props_element1.otherProps), {
369
+ finish: true
370
+ })
371
+ }, props.element);
372
+ }
373
+ }
374
+ }, [
375
+ isUnclosed,
376
+ readonly,
377
+ isLastNode,
378
+ props.element,
379
+ update
380
+ ]);
381
+ // 5 秒超时机制:如果是最后一个节点且未闭合,5 秒后自动设置为完成 - 必须在早期返回之前调用 hooks
382
+ useEffect(function() {
383
+ if (isUnclosed && !readonly && isLastNode) {
384
+ var timer = setTimeout(function() {
385
+ var _props_element_otherProps, _props_element;
386
+ // 检查 finish 是否仍然是 false(可能已经被其他逻辑更新)
387
+ if (((_props_element = props.element) === null || _props_element === void 0 ? void 0 : (_props_element_otherProps = _props_element.otherProps) === null || _props_element_otherProps === void 0 ? void 0 : _props_element_otherProps.finish) === false) {
388
+ var _props_element1;
389
+ update({
390
+ otherProps: _object_spread_props(_object_spread({}, (_props_element1 = props.element) === null || _props_element1 === void 0 ? void 0 : _props_element1.otherProps), {
391
+ finish: true
392
+ })
393
+ }, props.element);
394
+ }
395
+ }, 5000); // 5 秒超时
396
+ return function() {
397
+ clearTimeout(timer);
398
+ };
399
+ }
400
+ }, [
401
+ isUnclosed,
402
+ readonly,
403
+ isLastNode,
404
+ props.element,
405
+ update
406
+ ]);
407
+ // readonly 模式渲染 - 使用优化的组件(早期返回)
283
408
  if (readonly) {
284
409
  return /*#__PURE__*/ React.createElement(ReadonlyTableComponent, {
285
410
  hashId: hashId,
@@ -291,7 +416,10 @@ import useScrollShadow from "./useScrollShadow";
291
416
  return /*#__PURE__*/ React.createElement("div", {
292
417
  className: classNames(baseCls, hashId),
293
418
  ref: tableRef,
294
- style: boxShadowStyle,
419
+ style: _object_spread_props(_object_spread({}, boxShadowStyle), {
420
+ position: 'relative'
421
+ }),
422
+ "data-is-unclosed": isUnclosed,
295
423
  onDragStart: function(e) {
296
424
  // 阻止拖拽开始时的文字选择
297
425
  e.preventDefault();
@@ -300,5 +428,12 @@ import useScrollShadow from "./useScrollShadow";
300
428
  // 阻止双击选择文字
301
429
  e.preventDefault();
302
430
  }
303
- }, tableDom);
431
+ }, isUnclosed && /*#__PURE__*/ React.createElement("div", {
432
+ style: {
433
+ position: 'absolute',
434
+ top: '8px',
435
+ right: '8px',
436
+ zIndex: 10
437
+ }
438
+ }, /*#__PURE__*/ React.createElement(Loading, null)), tableDom);
304
439
  };
@@ -50,9 +50,10 @@ function _object_spread_props(target, source) {
50
50
  }
51
51
  return target;
52
52
  }
53
+ import { MOBILE_BREAKPOINT } from "../../../../../Constants/mobile";
53
54
  import { resetComponent, useEditorStyleRegister } from "../../../../../Hooks/useStyle";
54
55
  var genStyle = function(token) {
55
- return _define_property({}, token.componentCls, {
56
+ return _define_property({}, token.componentCls, _define_property({
56
57
  padding: '8px',
57
58
  verticalAlign: 'middle',
58
59
  wordWrap: 'break-word',
@@ -71,7 +72,9 @@ var genStyle = function(token) {
71
72
  pointerEvents: 'none',
72
73
  backgroundColor: 'var(--color-primary-control-fill-secondary-hover)'
73
74
  }
74
- });
75
+ }, "@media (max-width: ".concat(MOBILE_BREAKPOINT, ")"), {
76
+ padding: '2px'
77
+ }));
75
78
  };
76
79
  /**
77
80
  * Td 样式 hook
@@ -199,14 +199,12 @@ export var tableRenderElement = function(props, config) {
199
199
  case 'header-cell':
200
200
  return /*#__PURE__*/ React.createElement(ThWrapper, _object_spread({
201
201
  style: {
202
- padding: '8px',
203
202
  verticalAlign: 'middle'
204
203
  }
205
204
  }, props));
206
205
  case 'table-cell':
207
206
  return /*#__PURE__*/ React.createElement(TdWrapper, _object_spread({
208
207
  style: {
209
- padding: '8px',
210
208
  verticalAlign: 'middle'
211
209
  }
212
210
  }, props));
@@ -50,10 +50,13 @@ function _object_spread_props(target, source) {
50
50
  }
51
51
  return target;
52
52
  }
53
+ import { MOBILE_BREAKPOINT, MOBILE_PADDING } from "../../../../Constants/mobile";
53
54
  import { resetComponent, useEditorStyleRegister } from "../../../../Hooks/useStyle";
54
55
  var genStyle = function(token) {
55
56
  var _obj;
56
57
  return _define_property({}, token.componentCls, {
58
+ width: '100%',
59
+ overflow: 'auto',
57
60
  '--table-border-radius': '8px',
58
61
  '--table-border-color': '#E7E9E8',
59
62
  '--table-header-bg': '#f7f7f9',
@@ -94,7 +97,6 @@ var genStyle = function(token) {
94
97
  table: (_obj = {
95
98
  borderCollapse: 'separate',
96
99
  borderSpacing: 0,
97
- display: 'block',
98
100
  width: '100%',
99
101
  tableLayout: 'fixed',
100
102
  margin: '16px 0',
@@ -123,13 +125,6 @@ var genStyle = function(token) {
123
125
  'tr:not(.config-tr):last-child td:last-child:not(.config-td):not([colspan]):not([rowspan]), tr:not(.config-tr):last-child th:last-child:not(.config-td):not([colspan]):not([rowspan])': {
124
126
  borderBottomRightRadius: 'unset'
125
127
  }
126
- }), // 表格主体和表头使用 table 布局
127
- _define_property(_obj, 'tbody, thead', {
128
- display: 'table',
129
- width: '100%',
130
- tableLayout: 'fixed',
131
- position: 'relative',
132
- background: 'inherit'
133
128
  }), _define_property(_obj, 'th.config-th,td.config-td', {
134
129
  borderBottom: '1px solid var(--table-border-color)',
135
130
  borderLeft: '1px solid var(--table-border-color)'
@@ -226,6 +221,10 @@ var genStyle = function(token) {
226
221
  _define_property(_obj, 'th:not(.config-td)[rowspan]:first-child:last-child, td:not(.config-td)[rowspan]:first-child:last-child', {
227
222
  borderTopLeftRadius: 'var(--table-border-radius)',
228
223
  borderBottomLeftRadius: 'var(--table-border-radius)'
224
+ }), _define_property(_obj, "@media (max-width: ".concat(MOBILE_BREAKPOINT, ")"), {
225
+ 'th:not(.config-td), td:not(.config-td)': {
226
+ padding: "".concat(MOBILE_PADDING)
227
+ }
229
228
  }), _obj),
230
229
  'table.htCore': {
231
230
  boxSizing: 'content-box',
@@ -314,12 +314,12 @@ var initializeAutoOpen = function(autoOpen, type, setOpen, suggestionConnext) {
314
314
  var handleMouseEnter = function(domRef) {
315
315
  var target = domRef.current;
316
316
  if (!target) return;
317
- target.classList.remove('no-focus');
317
+ target.removeAttribute('data-no-focus');
318
318
  };
319
319
  var handleMouseLeave = function(domRef) {
320
320
  var target = domRef.current;
321
321
  if (!target) return;
322
- target.classList.add('no-focus');
322
+ target.setAttribute('data-no-focus', '');
323
323
  };
324
324
  var createDefaultDom = function(domRef, baseCls, hashId, loading, selectedItems, children, text, placeholder, isOpen) {
325
325
  var isEmpty = !(text === null || text === void 0 ? void 0 : text.trim());
@@ -327,7 +327,9 @@ var createDefaultDom = function(domRef, baseCls, hashId, loading, selectedItems,
327
327
  var _obj;
328
328
  return /*#__PURE__*/ React.createElement("div", {
329
329
  ref: domRef,
330
- className: classNames("".concat(baseCls, "-tag-popup-input"), 'no-focus', hashId, (_obj = {
330
+ "data-tag-popup-input": true,
331
+ "data-no-focus": true,
332
+ className: classNames("".concat(baseCls, "-tag-popup-input"), hashId, (_obj = {
331
333
  empty: isEmpty
332
334
  }, _define_property(_obj, "".concat(baseCls, "-tag-popup-input-loading"), loading), _define_property(_obj, "".concat(baseCls, "-tag-popup-input-has-arrow"), hasItems), _obj)),
333
335
  onMouseEnter: function() {
@@ -62,8 +62,8 @@ var genStyle = function(token) {
62
62
  color: 'var(--color-primary-text-secondary)',
63
63
  borderRadius: 'var(--radius-control-sm)',
64
64
  background: 'var(--color-primary-bg-tip)',
65
- '&-tag-popup-input': {
66
- '&:not(.tag-popup-input-composition).empty::before': {
65
+ '[data-tag-popup-input]': {
66
+ '&:not([data-composition]).empty::before': {
67
67
  color: 'var(--color-primary-text-disabled)',
68
68
  content: 'attr(title)',
69
69
  userSelect: 'none',
@@ -5,17 +5,116 @@
5
5
  import { Elements } from '../../el';
6
6
  import { MarkdownEditorPlugin } from '../../plugin';
7
7
  export declare const decodeURIComponentUrl: (url: string) => string;
8
+ /**
9
+ * 解析Markdown字符串的配置选项
10
+ */
11
+ export interface ParserMarkdownToSlateNodeConfig {
12
+ /** 是否在新标签页打开链接 */
13
+ openLinksInNewTab?: boolean;
14
+ /** 自定义段落标签(在 Slate 中可能不适用,保留用于兼容性) */
15
+ paragraphTag?: string;
16
+ /** 是否正在输入中(打字机模式) */
17
+ typing?: boolean;
18
+ }
19
+ /**
20
+ * Markdown 到 Slate 节点解析器类
21
+ *
22
+ * 将 Markdown 字符串解析为 Slate 编辑器节点,支持配置选项和插件。
23
+ * 使用类形式可以避免在函数调用链中传递配置参数和插件。
24
+ */
25
+ export declare class MarkdownToSlateParser {
26
+ private readonly config;
27
+ private readonly plugins;
28
+ constructor(config?: ParserMarkdownToSlateNodeConfig, plugins?: MarkdownEditorPlugin[]);
29
+ /**
30
+ * 解析 Markdown 字符串并返回解析后的结构和链接信息
31
+ *
32
+ * @param md - 要解析的 Markdown 字符串
33
+ * @returns 一个包含解析后的元素数组和链接信息的对象
34
+ */
35
+ parse(md: string): {
36
+ schema: Elements[];
37
+ links: {
38
+ path: number[];
39
+ target: string;
40
+ }[];
41
+ };
42
+ /**
43
+ * 解析 Markdown AST 节点为 Slate 节点(类方法版本)
44
+ * - 当有插件时,优先使用插件处理
45
+ * - 插件未处理时,使用默认处理逻辑
46
+ */
47
+ private parseNodes;
48
+ /**
49
+ * 处理单个元素(类方法版本)
50
+ */
51
+ private handleSingleElement;
52
+ /**
53
+ * 处理标题节点(类方法版本)
54
+ */
55
+ private handleHeading;
56
+ /**
57
+ * 处理列表节点(类方法版本)
58
+ */
59
+ private handleList;
60
+ /**
61
+ * 处理脚注定义节点(类方法版本)
62
+ */
63
+ private handleFootnoteDefinition;
64
+ /**
65
+ * 处理列表项节点(类方法版本)
66
+ */
67
+ private handleListItem;
68
+ /**
69
+ * 处理段落子节点(类方法版本)
70
+ */
71
+ private processParagraphChildren;
72
+ /**
73
+ * 处理段落节点(类方法版本)
74
+ */
75
+ private handleParagraph;
76
+ /**
77
+ * 处理引用块节点(类方法版本)
78
+ */
79
+ private handleBlockquote;
80
+ /**
81
+ * 处理文本和内联元素节点(类方法版本)
82
+ */
83
+ private handleTextAndInlineElements;
84
+ /**
85
+ * 应用内联格式到叶子节点(类方法版本)
86
+ */
87
+ private applyInlineFormatting;
88
+ /**
89
+ * 解析表格或图表(类方法版本)
90
+ */
91
+ private parseTableOrChart;
92
+ }
8
93
  /**
9
94
  * 解析Markdown字符串并返回解析后的结构和链接信息。
10
95
  *
11
96
  * @param md - 要解析的Markdown字符串。
12
97
  * @param plugins - 可选的Markdown编辑器插件数组,用于扩展解析功能。
98
+ * @param config - 可选的解析配置选项。
13
99
  * @returns 一个包含解析后的元素数组和链接信息的对象。
14
100
  *
15
101
  * @property schema - 解析后的元素数组。
16
102
  * @property links - 包含路径和目标链接的对象数组。
103
+ *
104
+ * @example
105
+ * ```typescript
106
+ * // 使用函数形式(向后兼容)
107
+ * const result = parserMarkdownToSlateNode(markdown, plugins, { openLinksInNewTab: true });
108
+ *
109
+ * // 使用类形式(推荐,避免配置传递问题)
110
+ * const parser = new MarkdownToSlateParser(
111
+ * { openLinksInNewTab: true },
112
+ * plugins
113
+ * );
114
+ * const result = parser.parse(markdown);
115
+ * ```
17
116
  */
18
- export declare const parserMarkdownToSlateNode: (md: string, plugins?: MarkdownEditorPlugin[]) => {
117
+ export declare const parserMarkdownToSlateNode: (md: string, plugins?: MarkdownEditorPlugin[], config?: ParserMarkdownToSlateNodeConfig) => {
19
118
  schema: Elements[];
20
119
  links: {
21
120
  path: number[];