@ant-design/agentic-ui 2.29.5 → 2.29.7

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 (308) hide show
  1. package/dist/AILabel/index.js +17 -8
  2. package/dist/AgenticLayout/index.js +3 -5
  3. package/dist/BackTo/BackBottom.js +17 -8
  4. package/dist/BackTo/BackTop.js +17 -8
  5. package/dist/BackTo/ScrollVisibleButton.js +75 -11
  6. package/dist/Bubble/AIBubble.js +131 -121
  7. package/dist/Bubble/Avatar/index.js +19 -10
  8. package/dist/Bubble/FileView.js +2 -2
  9. package/dist/Bubble/List/PureBubbleList.js +4 -5
  10. package/dist/Bubble/List/index.js +4 -5
  11. package/dist/Bubble/List/style.js +3 -0
  12. package/dist/Bubble/MessagesContent/BubbleExtra.js +108 -93
  13. package/dist/Bubble/MessagesContent/CopyButton/index.js +36 -26
  14. package/dist/Bubble/MessagesContent/DocInfo.js +19 -10
  15. package/dist/Bubble/MessagesContent/MarkdownPreview.js +2 -2
  16. package/dist/Bubble/MessagesContent/index.js +149 -130
  17. package/dist/Bubble/PureBubble.js +151 -133
  18. package/dist/Bubble/UserBubble.js +1 -1
  19. package/dist/Bubble/style.js +2 -2
  20. package/dist/Bubble/types/BubbleExtra.js +4 -1
  21. package/dist/Bubble/types/DocInfo.js +9 -1
  22. package/dist/ChatLayout/components/FooterBackgroundLottie/images/img_0.png +0 -0
  23. package/dist/ChatLayout/components/FooterBackgroundLottie/images/img_1.png +0 -0
  24. package/dist/ChatLayout/components/FooterBackgroundLottie/images/img_2.png +0 -0
  25. package/dist/ChatLayout/components/FooterBackgroundLottie/index.d.ts +51 -0
  26. package/dist/ChatLayout/components/FooterBackgroundLottie/index.js +45 -0
  27. package/dist/ChatLayout/components/FooterBackgroundLottie/lottie.d.ts +85 -0
  28. package/dist/ChatLayout/components/FooterBackgroundLottie/lottie.js +382 -0
  29. package/dist/ChatLayout/index.js +52 -14
  30. package/dist/ChatLayout/style.js +11 -0
  31. package/dist/ChatLayout/types.d.ts +28 -0
  32. package/dist/Components/ActionIconBox/index.js +30 -38
  33. package/dist/Components/ActionItemBox/ActionItemBox.js +1 -1
  34. package/dist/Components/Button/SwitchButton/index.js +18 -17
  35. package/dist/Components/LayoutHeader/index.js +5 -3
  36. package/dist/Components/LayoutHeader/style.js +5 -0
  37. package/dist/Components/Loading/CreativeRecommendationLoading.js +2 -2
  38. package/dist/Components/Loading/CreativeSparkLoading.js +2 -2
  39. package/dist/Components/SuggestionList/index.js +20 -19
  40. package/dist/Components/TextAnimate/index.js +19 -10
  41. package/dist/Components/TypingAnimation/index.js +19 -10
  42. package/dist/Components/effects/EffectPlayer.js +20 -11
  43. package/dist/Components/icons/LoadingSpinnerIcon.js +19 -10
  44. package/dist/History/components/HistoryActionsBox.js +21 -23
  45. package/dist/History/components/HistoryItem.js +61 -53
  46. package/dist/History/components/HistoryRunningIcon.js +19 -10
  47. package/dist/History/components/LoadMoreComponent.js +61 -55
  48. package/dist/History/components/NewChatComponent.js +53 -47
  49. package/dist/History/components/SearchComponent.js +24 -26
  50. package/dist/History/hooks/useHistory.js +80 -73
  51. package/dist/History/index.js +17 -16
  52. package/dist/History/menu.js +17 -8
  53. package/dist/Hooks/useAutoScroll.js +19 -19
  54. package/dist/Hooks/useDebounceFn/index.js +51 -45
  55. package/dist/Hooks/useElementSize.d.ts +5 -0
  56. package/dist/Hooks/useElementSize.js +71 -0
  57. package/dist/Hooks/useIntersectionOnce.js +17 -8
  58. package/dist/Hooks/useLanguage.d.ts +3 -0
  59. package/dist/I18n/locales.d.ts +3 -0
  60. package/dist/I18n/locales.js +8 -0
  61. package/dist/MarkdownEditor/BaseMarkdownEditor.js +22 -12
  62. package/dist/MarkdownEditor/editor/Editor.js +31 -39
  63. package/dist/MarkdownEditor/editor/components/CommentList/index.js +29 -37
  64. package/dist/MarkdownEditor/editor/elements/Image/index.js +86 -71
  65. package/dist/MarkdownEditor/editor/elements/List/ListItem.js +17 -16
  66. package/dist/MarkdownEditor/editor/elements/Media/index.js +107 -92
  67. package/dist/MarkdownEditor/editor/elements/Table/Table.js +19 -10
  68. package/dist/MarkdownEditor/editor/elements/TagPopup/index.js +17 -16
  69. package/dist/MarkdownEditor/editor/parser/parse/parseBlockElements.js +1 -1
  70. package/dist/MarkdownEditor/editor/parser/parse/parseCode.js +1 -1
  71. package/dist/MarkdownEditor/editor/parser/parse/parseEmptyLines.js +1 -1
  72. package/dist/MarkdownEditor/editor/parser/parse/parseTable.js +4 -1
  73. package/dist/MarkdownEditor/editor/parser/parserSlateNodeToMarkdown.js +2 -2
  74. package/dist/MarkdownEditor/editor/parser/remarkParse.js +3 -1
  75. package/dist/MarkdownEditor/editor/plugins/handlePaste.js +25 -30
  76. package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/arrow.js +0 -1
  77. package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/enter.js +0 -1
  78. package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/match.js +0 -1
  79. package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/tab.js +0 -1
  80. package/dist/MarkdownEditor/editor/plugins/insertParsedHtmlNodes.js +39 -53
  81. package/dist/MarkdownEditor/editor/plugins/useKeyboard.js +1 -1
  82. package/dist/MarkdownEditor/editor/plugins/useOnchange.js +28 -22
  83. package/dist/MarkdownEditor/editor/plugins/withMarkdown.js +1 -1
  84. package/dist/MarkdownEditor/editor/store.js +17 -13
  85. package/dist/MarkdownEditor/editor/tools/InsertAutocomplete.js +202 -197
  86. package/dist/MarkdownEditor/editor/tools/InsertLink.js +2 -2
  87. package/dist/MarkdownEditor/editor/tools/ToolBar/ReadonlyBaseBar.js +142 -134
  88. package/dist/MarkdownEditor/editor/utils/ace.js +61 -61
  89. package/dist/MarkdownEditor/editor/utils/editorUtils.js +11 -4
  90. package/dist/MarkdownEditor/editor/utils/index.js +8 -2
  91. package/dist/MarkdownEditor/editor/utils/keyboard.js +31 -35
  92. package/dist/MarkdownEditor/editor/utils/markdownToHtml.js +23 -17
  93. package/dist/MarkdownEditor/editor/utils/media.js +21 -23
  94. package/dist/MarkdownEditor/editor/utils/performanceMonitor.js +55 -50
  95. package/dist/MarkdownEditor/editor/utils/useLocalState.js +11 -4
  96. package/dist/MarkdownEditor/types.d.ts +1 -0
  97. package/dist/MarkdownEditor/types.js +4 -1
  98. package/dist/MarkdownEditor/utils/native-table/native-table-editor.js +14 -14
  99. package/dist/MarkdownEditor/utils/native-table/native-table-keyboard.js +2 -2
  100. package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/style.js +1 -0
  101. package/dist/MarkdownInputField/AttachmentButton/index.js +33 -31
  102. package/dist/MarkdownInputField/BeforeToolContainer/BeforeToolContainer.js +14 -7
  103. package/dist/MarkdownInputField/FileMapView/FileMapViewItem.js +2 -2
  104. package/dist/MarkdownInputField/FileMapView/index.js +17 -16
  105. package/dist/MarkdownInputField/FilePaste/index.js +25 -30
  106. package/dist/MarkdownInputField/FileUploadManager/index.js +39 -40
  107. package/dist/MarkdownInputField/MarkdownInputField.js +38 -29
  108. package/dist/MarkdownInputField/QuickActions/index.js +66 -60
  109. package/dist/MarkdownInputField/SendButton/index.js +22 -13
  110. package/dist/MarkdownInputField/Suggestion/index.js +17 -16
  111. package/dist/MarkdownInputField/VoiceInput/index.js +51 -45
  112. package/dist/MarkdownInputField/VoiceInputManager/index.js +133 -125
  113. package/dist/MarkdownInputField/hooks/useMarkdownInputFieldHandlers.js +103 -101
  114. package/dist/MarkdownInputField/hooks/useMarkdownInputFieldStyles.js +1 -1
  115. package/dist/MarkdownInputField/style.js +1 -2
  116. package/dist/MarkdownInputField/types/MarkdownInputFieldProps.js +14 -1
  117. package/dist/Plugins/chart/BarChart/index.js +8 -8
  118. package/dist/Plugins/chart/ChartRender.js +52 -46
  119. package/dist/Plugins/chart/DonutChart/index.js +26 -17
  120. package/dist/Plugins/chart/DonutChart/plugins.js +1 -1
  121. package/dist/Plugins/chart/DonutChart/types.js +1 -1
  122. package/dist/Plugins/chart/FunnelChart/index.js +31 -28
  123. package/dist/Plugins/chart/LineChart/index.js +19 -10
  124. package/dist/Plugins/chart/RadarChart/index.js +19 -10
  125. package/dist/Plugins/chart/ScatterChart/index.js +19 -10
  126. package/dist/Plugins/chart/components/ChartContainer/ChartContainer.js +20 -11
  127. package/dist/Plugins/chart/index.js +31 -13
  128. package/dist/Plugins/chart/loadChartRuntime.js +17 -16
  129. package/dist/Plugins/chart/types/classNames.js +4 -1
  130. package/dist/Plugins/chart/utils.js +20 -20
  131. package/dist/Plugins/code/CodeUI/Katex/Katex.js +52 -46
  132. package/dist/Plugins/code/components/AceEditor.js +149 -133
  133. package/dist/Plugins/code/components/CodeRenderer.js +7 -7
  134. package/dist/Plugins/code/components/CodeToolbar.js +2 -2
  135. package/dist/Plugins/code/components/LanguageSelector.js +6 -6
  136. package/dist/Plugins/code/components/LoadImage.js +5 -5
  137. package/dist/Plugins/code/components/ThinkBlock.js +8 -8
  138. package/dist/Plugins/code/hooks/useCodeEditorState.js +5 -5
  139. package/dist/Plugins/code/index.js +6 -6
  140. package/dist/Plugins/code/langIconMap.js +0 -1
  141. package/dist/Plugins/code/langIcons/AbapIcon.js +19 -10
  142. package/dist/Plugins/code/langIcons/ActionscriptIcon.js +19 -10
  143. package/dist/Plugins/code/langIcons/AdaIcon.js +19 -10
  144. package/dist/Plugins/code/langIcons/ApacheIcon.js +19 -10
  145. package/dist/Plugins/code/langIcons/ApexIcon.js +19 -10
  146. package/dist/Plugins/code/langIcons/AplIcon.js +19 -10
  147. package/dist/Plugins/code/langIcons/ApplescriptIcon.js +19 -10
  148. package/dist/Plugins/code/langIcons/AstroIcon.js +19 -10
  149. package/dist/Plugins/code/langIcons/AwkIcon.js +19 -10
  150. package/dist/Plugins/code/langIcons/BallerinaIcon.js +19 -10
  151. package/dist/Plugins/code/langIcons/BatIcon.js +19 -10
  152. package/dist/Plugins/code/langIcons/BicepIcon.js +19 -10
  153. package/dist/Plugins/code/langIcons/BladeIcon.js +19 -10
  154. package/dist/Plugins/code/langIcons/CIcon.js +19 -10
  155. package/dist/Plugins/code/langIcons/CadenceIcon.js +19 -10
  156. package/dist/Plugins/code/langIcons/ClojureIcon.js +19 -10
  157. package/dist/Plugins/code/langIcons/CmakeIcon.js +19 -10
  158. package/dist/Plugins/code/langIcons/CobolIcon.js +19 -10
  159. package/dist/Plugins/code/langIcons/CodeqlIcon.js +19 -10
  160. package/dist/Plugins/code/langIcons/CoffeeIcon.js +19 -10
  161. package/dist/Plugins/code/langIcons/ConsoleIcon.js +19 -10
  162. package/dist/Plugins/code/langIcons/CppIcon.js +19 -10
  163. package/dist/Plugins/code/langIcons/CrystalIcon.js +19 -10
  164. package/dist/Plugins/code/langIcons/CsharpIcon.js +19 -10
  165. package/dist/Plugins/code/langIcons/CssIcon.js +19 -10
  166. package/dist/Plugins/code/langIcons/DIcon.js +19 -10
  167. package/dist/Plugins/code/langIcons/DartIcon.js +19 -10
  168. package/dist/Plugins/code/langIcons/DatabaseIcon.js +19 -10
  169. package/dist/Plugins/code/langIcons/DiffIcon.js +19 -10
  170. package/dist/Plugins/code/langIcons/DockerIcon.js +19 -10
  171. package/dist/Plugins/code/langIcons/DotenvIcon.js +19 -10
  172. package/dist/Plugins/code/langIcons/ElixirIcon.js +19 -10
  173. package/dist/Plugins/code/langIcons/ElmIcon.js +19 -10
  174. package/dist/Plugins/code/langIcons/ErbIcon.js +19 -10
  175. package/dist/Plugins/code/langIcons/ErlangIcon.js +19 -10
  176. package/dist/Plugins/code/langIcons/FsharpIcon.js +19 -10
  177. package/dist/Plugins/code/langIcons/GdscriptIcon.js +19 -10
  178. package/dist/Plugins/code/langIcons/GlslIcon.js +19 -10
  179. package/dist/Plugins/code/langIcons/GnuplotIcon.js +19 -10
  180. package/dist/Plugins/code/langIcons/GoIcon.js +19 -10
  181. package/dist/Plugins/code/langIcons/GraphqlIcon.js +19 -10
  182. package/dist/Plugins/code/langIcons/GroovyIcon.js +19 -10
  183. package/dist/Plugins/code/langIcons/HackIcon.js +19 -10
  184. package/dist/Plugins/code/langIcons/HamlIcon.js +19 -10
  185. package/dist/Plugins/code/langIcons/HandlebarsIcon.js +19 -10
  186. package/dist/Plugins/code/langIcons/HaskellIcon.js +19 -10
  187. package/dist/Plugins/code/langIcons/HclIcon.js +19 -10
  188. package/dist/Plugins/code/langIcons/HclLightIcon.js +19 -10
  189. package/dist/Plugins/code/langIcons/HjsonIcon.js +19 -10
  190. package/dist/Plugins/code/langIcons/HlslIcon.js +19 -10
  191. package/dist/Plugins/code/langIcons/HtmlIcon.js +19 -10
  192. package/dist/Plugins/code/langIcons/HttpIcon.js +19 -10
  193. package/dist/Plugins/code/langIcons/ImbaIcon.js +19 -10
  194. package/dist/Plugins/code/langIcons/IniIcon.js +19 -10
  195. package/dist/Plugins/code/langIcons/JavaIcon.js +19 -10
  196. package/dist/Plugins/code/langIcons/JavascriptIcon.js +19 -10
  197. package/dist/Plugins/code/langIcons/JinjaIcon.js +19 -10
  198. package/dist/Plugins/code/langIcons/Json5Icon.js +19 -10
  199. package/dist/Plugins/code/langIcons/JsonIcon.js +19 -10
  200. package/dist/Plugins/code/langIcons/JsonnetIcon.js +19 -10
  201. package/dist/Plugins/code/langIcons/JuliaIcon.js +19 -10
  202. package/dist/Plugins/code/langIcons/KotlinIcon.js +19 -10
  203. package/dist/Plugins/code/langIcons/KustoIcon.js +19 -10
  204. package/dist/Plugins/code/langIcons/LessIcon.js +19 -10
  205. package/dist/Plugins/code/langIcons/LiquidIcon.js +19 -10
  206. package/dist/Plugins/code/langIcons/LispIcon.js +19 -10
  207. package/dist/Plugins/code/langIcons/LuaIcon.js +19 -10
  208. package/dist/Plugins/code/langIcons/MakefileIcon.js +19 -10
  209. package/dist/Plugins/code/langIcons/MarkdownIcon.js +19 -10
  210. package/dist/Plugins/code/langIcons/MarkojsIcon.js +19 -10
  211. package/dist/Plugins/code/langIcons/MatlabIcon.js +19 -10
  212. package/dist/Plugins/code/langIcons/MdxIcon.js +19 -10
  213. package/dist/Plugins/code/langIcons/MermaidIcon.js +19 -10
  214. package/dist/Plugins/code/langIcons/MojoIcon.js +19 -10
  215. package/dist/Plugins/code/langIcons/NginxIcon.js +19 -10
  216. package/dist/Plugins/code/langIcons/NimIcon.js +19 -10
  217. package/dist/Plugins/code/langIcons/NixIcon.js +19 -10
  218. package/dist/Plugins/code/langIcons/ObjectiveCIcon.js +19 -10
  219. package/dist/Plugins/code/langIcons/ObjectiveCppIcon.js +19 -10
  220. package/dist/Plugins/code/langIcons/OcamlIcon.js +19 -10
  221. package/dist/Plugins/code/langIcons/PascalIcon.js +19 -10
  222. package/dist/Plugins/code/langIcons/Perl6Icon.js +19 -10
  223. package/dist/Plugins/code/langIcons/PerlIcon.js +19 -10
  224. package/dist/Plugins/code/langIcons/PhpIcon.js +19 -10
  225. package/dist/Plugins/code/langIcons/PostcssIcon.js +19 -10
  226. package/dist/Plugins/code/langIcons/PowershellIcon.js +19 -10
  227. package/dist/Plugins/code/langIcons/PrismaIcon.js +19 -10
  228. package/dist/Plugins/code/langIcons/PrologIcon.js +19 -10
  229. package/dist/Plugins/code/langIcons/ProtoIcon.js +19 -10
  230. package/dist/Plugins/code/langIcons/PugIcon.js +19 -10
  231. package/dist/Plugins/code/langIcons/PuppetIcon.js +19 -10
  232. package/dist/Plugins/code/langIcons/PurescriptIcon.js +19 -10
  233. package/dist/Plugins/code/langIcons/PythonIcon.js +19 -10
  234. package/dist/Plugins/code/langIcons/RIcon.js +19 -10
  235. package/dist/Plugins/code/langIcons/RazorIcon.js +19 -10
  236. package/dist/Plugins/code/langIcons/ReactIcon.js +19 -10
  237. package/dist/Plugins/code/langIcons/ReactTsIcon.js +19 -10
  238. package/dist/Plugins/code/langIcons/RubyIcon.js +19 -10
  239. package/dist/Plugins/code/langIcons/RustIcon.js +19 -10
  240. package/dist/Plugins/code/langIcons/SasIcon.js +19 -10
  241. package/dist/Plugins/code/langIcons/SassIcon.js +19 -10
  242. package/dist/Plugins/code/langIcons/ScalaIcon.js +19 -10
  243. package/dist/Plugins/code/langIcons/SchemeIcon.js +19 -10
  244. package/dist/Plugins/code/langIcons/ShaderlabIcon.js +19 -10
  245. package/dist/Plugins/code/langIcons/SolidityIcon.js +19 -10
  246. package/dist/Plugins/code/langIcons/SparqlIcon.js +19 -10
  247. package/dist/Plugins/code/langIcons/StataIcon.js +19 -10
  248. package/dist/Plugins/code/langIcons/StylusIcon.js +19 -10
  249. package/dist/Plugins/code/langIcons/SvelteIcon.js +19 -10
  250. package/dist/Plugins/code/langIcons/SwiftIcon.js +19 -10
  251. package/dist/Plugins/code/langIcons/SystemverilogIcon.js +19 -10
  252. package/dist/Plugins/code/langIcons/TclIcon.js +19 -10
  253. package/dist/Plugins/code/langIcons/TexIcon.js +19 -10
  254. package/dist/Plugins/code/langIcons/TomlIcon.js +19 -10
  255. package/dist/Plugins/code/langIcons/TwigIcon.js +19 -10
  256. package/dist/Plugins/code/langIcons/TypescriptIcon.js +19 -10
  257. package/dist/Plugins/code/langIcons/VerilogIcon.js +19 -10
  258. package/dist/Plugins/code/langIcons/VhdlIcon.js +19 -10
  259. package/dist/Plugins/code/langIcons/VimIcon.js +19 -10
  260. package/dist/Plugins/code/langIcons/VueIcon.js +19 -10
  261. package/dist/Plugins/code/langIcons/WebassemblyIcon.js +19 -10
  262. package/dist/Plugins/code/langIcons/WenyanIcon.js +19 -10
  263. package/dist/Plugins/code/langIcons/WgslIcon.js +19 -10
  264. package/dist/Plugins/code/langIcons/WolframlanguageIcon.js +19 -10
  265. package/dist/Plugins/code/langIcons/XmlIcon.js +19 -10
  266. package/dist/Plugins/code/langIcons/XslIcon.js +19 -10
  267. package/dist/Plugins/code/langIcons/YamlIcon.js +19 -10
  268. package/dist/Plugins/code/langIcons/ZigIcon.js +19 -10
  269. package/dist/Plugins/code/loadAceEditor.js +21 -23
  270. package/dist/Plugins/code/utils/langOptions.js +6 -6
  271. package/dist/Plugins/formatter/index.js +6 -6
  272. package/dist/Plugins/katex/InlineKatex.js +52 -46
  273. package/dist/Plugins/katex/Katex.js +53 -47
  274. package/dist/Plugins/katex/index.js +6 -6
  275. package/dist/Plugins/katex/loadKatex.js +27 -29
  276. package/dist/Plugins/mermaid/Mermaid.js +34 -28
  277. package/dist/Plugins/mermaid/useMermaidRender.js +103 -97
  278. package/dist/Plugins/mermaid/utils.js +25 -17
  279. package/dist/Schema/SchemaEditor/AceEditorWrapper.js +162 -150
  280. package/dist/Schema/SchemaEditor/index.js +8 -1
  281. package/dist/Schema/SchemaForm/index.js +2 -2
  282. package/dist/Schema/SchemaRenderer/index.js +45 -46
  283. package/dist/ThoughtChainList/index.js +22 -13
  284. package/dist/ToolUseBar/BarItem/Content.js +3 -3
  285. package/dist/ToolUseBar/BarItem/index.js +10 -3
  286. package/dist/ToolUseBar/index.js +19 -10
  287. package/dist/ToolUseBar/style.js +4 -4
  288. package/dist/Types/common.js +4 -1
  289. package/dist/Types/message.js +4 -1
  290. package/dist/Utils/debugUtils.js +8 -8
  291. package/dist/Utils/getScroll.js +12 -5
  292. package/dist/Utils/loadCSS.js +23 -22
  293. package/dist/Utils/proxySandbox/ProxySandbox.js +42 -34
  294. package/dist/Utils/proxySandbox/SecurityContextManager.js +54 -54
  295. package/dist/Utils/proxySandbox/index.js +25 -22
  296. package/dist/Utils/proxySandbox/types.js +11 -11
  297. package/dist/Utils/scrollTo.js +8 -1
  298. package/dist/WelcomeMessage/index.js +1 -1
  299. package/dist/Workspace/File/FileComponent.js +91 -66
  300. package/dist/Workspace/File/PreviewComponent.js +15 -8
  301. package/dist/Workspace/File/index.d.ts +1 -1
  302. package/dist/Workspace/File/style.js +7 -0
  303. package/dist/Workspace/RealtimeFollow/index.js +1 -2
  304. package/dist/Workspace/index.js +13 -11
  305. package/dist/Workspace/style.js +8 -14
  306. package/dist/Workspace/types.d.ts +50 -0
  307. package/dist/Workspace/types.js +0 -1
  308. package/package.json +25 -25
@@ -48,6 +48,13 @@ function _define_property(obj, key, value) {
48
48
  }
49
49
  return obj;
50
50
  }
51
+ function _instanceof(left, right) {
52
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
53
+ return !!right[Symbol.hasInstance](left);
54
+ } else {
55
+ return left instanceof right;
56
+ }
57
+ }
51
58
  function _iterable_to_array_limit(arr, i) {
52
59
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
53
60
  if (_i == null) return;
@@ -130,7 +137,7 @@ function _unsupported_iterable_to_array(o, minLen) {
130
137
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
131
138
  }
132
139
  function _ts_generator(thisArg, body) {
133
- var f, y, t, g, _ = {
140
+ var f, y, t, _ = {
134
141
  label: 0,
135
142
  sent: function() {
136
143
  if (t[0] & 1) throw t[1];
@@ -138,13 +145,17 @@ function _ts_generator(thisArg, body) {
138
145
  },
139
146
  trys: [],
140
147
  ops: []
141
- };
142
- return g = {
143
- next: verb(0),
144
- "throw": verb(1),
145
- "return": verb(2)
146
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
147
- return this;
148
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
149
+ return d(g, "next", {
150
+ value: verb(0)
151
+ }), d(g, "throw", {
152
+ value: verb(1)
153
+ }), d(g, "return", {
154
+ value: verb(2)
155
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
156
+ value: function() {
157
+ return this;
158
+ }
148
159
  }), g;
149
160
  function verb(n) {
150
161
  return function(v) {
@@ -156,7 +167,7 @@ function _ts_generator(thisArg, body) {
156
167
  }
157
168
  function step(op) {
158
169
  if (f) throw new TypeError("Generator is already executing.");
159
- while(_)try {
170
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
160
171
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
161
172
  if (y = 0, t) op = [
162
173
  op[0] & 2,
@@ -261,7 +272,7 @@ var handleFileDownload = function(file) {
261
272
  });
262
273
  blobUrl = URL.createObjectURL(blob);
263
274
  link.href = blobUrl;
264
- } else if (file.file instanceof File || file.file instanceof Blob) {
275
+ } else if (_instanceof(file.file, File) || _instanceof(file.file, Blob)) {
265
276
  // 处理 File 或 Blob 对象
266
277
  blobUrl = URL.createObjectURL(file.file);
267
278
  link.href = blobUrl;
@@ -269,7 +280,7 @@ var handleFileDownload = function(file) {
269
280
  return; // 没有可下载的内容
270
281
  }
271
282
  // 设置文件名(如果是 File 对象且没有指定文件名,使用 File 对象的名称)
272
- link.download = file.name || (file.file instanceof File ? file.file.name : '');
283
+ link.download = file.name || (_instanceof(file.file, File) ? file.file.name : '');
273
284
  // 执行下载
274
285
  document.body.appendChild(link);
275
286
  link.click();
@@ -282,8 +293,8 @@ var handleFileDownload = function(file) {
282
293
  }
283
294
  };
284
295
  // 通用的默认分享处理函数
285
- var handleDefaultShare = /*#__PURE__*/ function() {
286
- var _ref = _async_to_generator(function(file, locale) {
296
+ var handleDefaultShare = function(file, locale) {
297
+ return _async_to_generator(function() {
287
298
  var shareUrl, error;
288
299
  return _ts_generator(this, function(_state) {
289
300
  switch(_state.label){
@@ -334,11 +345,8 @@ var handleDefaultShare = /*#__PURE__*/ function() {
334
345
  ];
335
346
  }
336
347
  });
337
- });
338
- return function handleDefaultShare(file, locale) {
339
- return _ref.apply(this, arguments);
340
- };
341
- }();
348
+ })();
349
+ };
342
350
  // 确保节点有唯一ID的辅助函数
343
351
  var ensureNodeWithId = function(node) {
344
352
  return _object_spread_props(_object_spread({}, node), {
@@ -370,8 +378,7 @@ var SearchInput = /*#__PURE__*/ React.memo(function(param) {
370
378
  className: classNames("".concat(prefixCls, "-search"), hashId)
371
379
  }, /*#__PURE__*/ React.createElement(Input, {
372
380
  ref: inputRef,
373
- key: "file-search-input" // 添加稳定的 key
374
- ,
381
+ key: "file-search-input",
375
382
  allowClear: true,
376
383
  placeholder: searchPlaceholder || (locale === null || locale === void 0 ? void 0 : locale['workspace.searchPlaceholder']) || '搜索文件名',
377
384
  prefix: /*#__PURE__*/ React.createElement(Search, null),
@@ -391,7 +398,11 @@ var FileItemComponent = function(param) {
391
398
  // 确保文件有唯一ID
392
399
  var fileWithId = ensureNodeWithId(file);
393
400
  var fileTypeInfo = fileTypeProcessor.inferFileType(fileWithId);
401
+ // 禁用状态
402
+ var isDisabled = fileWithId.disabled === true;
394
403
  var handleClick = function() {
404
+ // 禁用状态下不响应点击
405
+ if (isDisabled) return;
395
406
  // 如果有传入 onClick 事件,优先使用
396
407
  if (onClick) {
397
408
  onClick(fileWithId);
@@ -452,6 +463,54 @@ var FileItemComponent = function(param) {
452
463
  e.stopPropagation();
453
464
  onLocate === null || onLocate === void 0 ? void 0 : onLocate(fileWithId);
454
465
  };
466
+ // 内置操作按钮
467
+ var actionBtnClass = classNames("".concat(finalPrefixCls, "-item-action-btn"), hashId);
468
+ var builtinActions = {
469
+ preview: showPreviewButton ? /*#__PURE__*/ React.createElement(ActionIconBox, {
470
+ key: "preview",
471
+ title: (locale === null || locale === void 0 ? void 0 : locale['workspace.file.preview']) || '预览',
472
+ onClick: handlePreview,
473
+ tooltipProps: {
474
+ mouseEnterDelay: 0.3
475
+ },
476
+ className: actionBtnClass
477
+ }, /*#__PURE__*/ React.createElement(EyeIcon, null)) : null,
478
+ locate: showLocationButton ? /*#__PURE__*/ React.createElement(ActionIconBox, {
479
+ key: "locate",
480
+ title: (locale === null || locale === void 0 ? void 0 : locale['workspace.file.location']) || '定位',
481
+ onClick: handleLocate,
482
+ tooltipProps: {
483
+ mouseEnterDelay: 0.3
484
+ },
485
+ className: actionBtnClass
486
+ }, /*#__PURE__*/ React.createElement(Locate, null)) : null,
487
+ share: showShareButton ? /*#__PURE__*/ React.createElement(ActionIconBox, {
488
+ key: "share",
489
+ title: (locale === null || locale === void 0 ? void 0 : locale['workspace.file.share']) || '分享',
490
+ onClick: handleShare,
491
+ tooltipProps: {
492
+ mouseEnterDelay: 0.3
493
+ },
494
+ className: actionBtnClass
495
+ }, /*#__PURE__*/ React.createElement(ShareIcon, null)) : null,
496
+ download: showDownloadButton ? /*#__PURE__*/ React.createElement(ActionIconBox, {
497
+ key: "download",
498
+ title: (locale === null || locale === void 0 ? void 0 : locale['workspace.file.download']) || '下载',
499
+ onClick: handleDownload,
500
+ tooltipProps: {
501
+ mouseEnterDelay: 0.3
502
+ },
503
+ className: actionBtnClass
504
+ }, /*#__PURE__*/ React.createElement(DownloadIcon, null)) : null
505
+ };
506
+ // 自定义渲染上下文
507
+ var renderContext = {
508
+ file: fileWithId,
509
+ prefixCls: finalPrefixCls,
510
+ hashId: hashId || '',
511
+ disabled: isDisabled,
512
+ actions: builtinActions
513
+ };
455
514
  return /*#__PURE__*/ React.createElement(AccessibleButton, {
456
515
  icon: /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("div", {
457
516
  className: classNames("".concat(finalPrefixCls, "-item-icon"), hashId)
@@ -459,13 +518,13 @@ var FileItemComponent = function(param) {
459
518
  className: classNames("".concat(finalPrefixCls, "-item-info"), hashId)
460
519
  }, /*#__PURE__*/ React.createElement("div", {
461
520
  className: classNames("".concat(finalPrefixCls, "-item-name"), hashId)
462
- }, /*#__PURE__*/ React.createElement(Typography.Text, {
521
+ }, fileWithId.renderName ? fileWithId.renderName(renderContext) : /*#__PURE__*/ React.createElement(Typography.Text, {
463
522
  ellipsis: {
464
523
  tooltip: fileWithId.name
465
524
  }
466
525
  }, fileWithId.name)), /*#__PURE__*/ React.createElement("div", {
467
526
  className: classNames("".concat(finalPrefixCls, "-item-details"), hashId)
468
- }, /*#__PURE__*/ React.createElement(Typography.Text, {
527
+ }, fileWithId.renderDetails ? fileWithId.renderDetails(renderContext) : /*#__PURE__*/ React.createElement(Typography.Text, {
469
528
  type: "secondary",
470
529
  ellipsis: true
471
530
  }, /*#__PURE__*/ React.createElement("span", {
@@ -483,37 +542,9 @@ var FileItemComponent = function(param) {
483
542
  onClick: function(e) {
484
543
  return e.stopPropagation();
485
544
  }
486
- }, showPreviewButton && /*#__PURE__*/ React.createElement(ActionIconBox, {
487
- title: (locale === null || locale === void 0 ? void 0 : locale['workspace.file.preview']) || '预览',
488
- onClick: handlePreview,
489
- tooltipProps: {
490
- mouseEnterDelay: 0.3
491
- },
492
- className: classNames("".concat(finalPrefixCls, "-item-action-btn"), hashId)
493
- }, /*#__PURE__*/ React.createElement(EyeIcon, null)), showLocationButton && /*#__PURE__*/ React.createElement(ActionIconBox, {
494
- title: (locale === null || locale === void 0 ? void 0 : locale['workspace.file.location']) || '定位',
495
- onClick: handleLocate,
496
- tooltipProps: {
497
- mouseEnterDelay: 0.3
498
- },
499
- className: classNames("".concat(finalPrefixCls, "-item-action-btn"), hashId)
500
- }, /*#__PURE__*/ React.createElement(Locate, null)), showShareButton && /*#__PURE__*/ React.createElement(ActionIconBox, {
501
- title: (locale === null || locale === void 0 ? void 0 : locale['workspace.file.share']) || '分享',
502
- onClick: handleShare,
503
- tooltipProps: {
504
- mouseEnterDelay: 0.3
505
- },
506
- className: classNames("".concat(finalPrefixCls, "-item-action-btn"), hashId)
507
- }, /*#__PURE__*/ React.createElement(ShareIcon, null)), showDownloadButton && /*#__PURE__*/ React.createElement(ActionIconBox, {
508
- title: (locale === null || locale === void 0 ? void 0 : locale['workspace.file.download']) || '下载',
509
- onClick: handleDownload,
510
- tooltipProps: {
511
- mouseEnterDelay: 0.3
512
- },
513
- className: classNames("".concat(finalPrefixCls, "-item-action-btn"), hashId)
514
- }, /*#__PURE__*/ React.createElement(DownloadIcon, null)))),
545
+ }, fileWithId.renderActions ? fileWithId.renderActions(renderContext) : !isDisabled ? /*#__PURE__*/ React.createElement(React.Fragment, null, builtinActions.preview, builtinActions.locate, builtinActions.share, builtinActions.download) : null)),
515
546
  onClick: handleClick,
516
- className: classNames("".concat(finalPrefixCls, "-item"), hashId),
547
+ className: classNames("".concat(finalPrefixCls, "-item"), _define_property({}, "".concat(finalPrefixCls, "-item-disabled"), isDisabled), hashId),
517
548
  ariaLabel: "".concat((locale === null || locale === void 0 ? void 0 : locale['workspace.file']) || '文件', ":").concat(fileWithId.name),
518
549
  id: bindDomId ? fileWithId.id : undefined
519
550
  });
@@ -755,8 +786,8 @@ export var FileComponent = function(param) {
755
786
  }
756
787
  };
757
788
  // 包装后的返回逻辑,允许外部拦截
758
- var handleBack = /*#__PURE__*/ function() {
759
- var _ref = _async_to_generator(function() {
789
+ var handleBack = function() {
790
+ return _async_to_generator(function() {
760
791
  var result, _;
761
792
  return _ts_generator(this, function(_state) {
762
793
  switch(_state.label){
@@ -799,11 +830,8 @@ export var FileComponent = function(param) {
799
830
  ];
800
831
  }
801
832
  });
802
- });
803
- return function handleBack() {
804
- return _ref.apply(this, arguments);
805
- };
806
- }();
833
+ })();
834
+ };
807
835
  // 预览页面的下载(供预览页调用)
808
836
  var handleDownloadInPreview = function(file) {
809
837
  // 优先使用用户传入的下载方法
@@ -814,8 +842,8 @@ export var FileComponent = function(param) {
814
842
  handleFileDownload(file);
815
843
  };
816
844
  // 预览文件处理
817
- var handlePreview = /*#__PURE__*/ function() {
818
- var _ref = _async_to_generator(function(file) {
845
+ var handlePreview = function(file) {
846
+ return _async_to_generator(function() {
819
847
  var currentCallId, previewData, content, err, previewSrc;
820
848
  return _ts_generator(this, function(_state) {
821
849
  switch(_state.label){
@@ -923,11 +951,8 @@ export var FileComponent = function(param) {
923
951
  ];
924
952
  }
925
953
  });
926
- });
927
- return function handlePreview(file) {
928
- return _ref.apply(this, arguments);
929
- };
930
- }();
954
+ })();
955
+ };
931
956
  // 通过 actionRef 暴露可编程接口
932
957
  React.useEffect(function() {
933
958
  if (!actionRef) return;
@@ -19,6 +19,13 @@ function _define_property(obj, key, value) {
19
19
  }
20
20
  return obj;
21
21
  }
22
+ function _instanceof(left, right) {
23
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
24
+ return !!right[Symbol.hasInstance](left);
25
+ } else {
26
+ return left instanceof right;
27
+ }
28
+ }
22
29
  function _iterable_to_array_limit(arr, i) {
23
30
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
24
31
  if (_i == null) return;
@@ -131,6 +138,7 @@ var PlaceholderContent = function(param) {
131
138
  * 文件预览组件
132
139
  */ export var PreviewComponent = function(param) {
133
140
  var file = param.file, customContent = param.customContent, customHeader = param.customHeader, customActions = param.customActions, onBack = param.onBack, onDownload = param.onDownload, onShare = param.onShare, onLocate = param.onLocate, markdownEditorProps = param.markdownEditorProps, headerFileOverride = param.headerFileOverride;
141
+ var _ref, _ref1;
134
142
  var locale = useContext(I18nContext).locale;
135
143
  var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
136
144
  var filePrefixCls = getPrefixCls('workspace-file');
@@ -166,7 +174,7 @@ var PlaceholderContent = function(param) {
166
174
  } catch (err) {
167
175
  setContentState({
168
176
  status: 'error',
169
- error: err instanceof Error ? err.message : '文件处理失败'
177
+ error: _instanceof(err, Error) ? err.message : (locale === null || locale === void 0 ? void 0 : locale['workspace.file.processFailed']) || '文件处理失败'
170
178
  });
171
179
  }
172
180
  }, [
@@ -201,7 +209,7 @@ var PlaceholderContent = function(param) {
201
209
  }
202
210
  return response.text();
203
211
  }).then(setReadyContent).catch(function(err) {
204
- var errorMessage = err instanceof Error ? err.message : '加载文本内容失败';
212
+ var errorMessage = _instanceof(err, Error) ? err.message : '加载文本内容失败';
205
213
  setContentState({
206
214
  status: 'error',
207
215
  error: errorMessage
@@ -246,7 +254,7 @@ var PlaceholderContent = function(param) {
246
254
  className: classNames("".concat(prefixCls, "-content-loading"), hashId)
247
255
  }, /*#__PURE__*/ React.createElement("span", {
248
256
  className: classNames("".concat(prefixCls, "-content-loading-tip"), hashId)
249
- }, /*#__PURE__*/ React.createElement(LoadingOutlined, null), "正在生成"), /*#__PURE__*/ React.createElement("div", {
257
+ }, /*#__PURE__*/ React.createElement(LoadingOutlined, null), (locale === null || locale === void 0 ? void 0 : locale['workspace.file.generating']) || '正在生成'), /*#__PURE__*/ React.createElement("div", {
250
258
  className: classNames("".concat(prefixCls, "-content-loading-inner"), hashId)
251
259
  }, (file === null || file === void 0 ? void 0 : (_file_content = file.content) === null || _file_content === void 0 ? void 0 : _file_content.padEnd(10000, file === null || file === void 0 ? void 0 : file.content)) || '...'.padEnd(10000, '...')));
252
260
  }
@@ -261,7 +269,7 @@ var PlaceholderContent = function(param) {
261
269
  hashId: hashId
262
270
  }, /*#__PURE__*/ React.createElement(Spin, {
263
271
  size: "large",
264
- tip: "正在处理文件..."
272
+ tip: (locale === null || locale === void 0 ? void 0 : locale['workspace.file.processing']) || '正在处理文件...'
265
273
  }));
266
274
  }
267
275
  if (contentState.status === 'error') {
@@ -269,7 +277,7 @@ var PlaceholderContent = function(param) {
269
277
  prefixCls: prefixCls,
270
278
  hashId: hashId
271
279
  }, /*#__PURE__*/ React.createElement(Alert, {
272
- message: "文件处理失败",
280
+ message: (locale === null || locale === void 0 ? void 0 : locale['workspace.file.processFailed']) || '文件处理失败',
273
281
  description: contentState.error,
274
282
  type: "error",
275
283
  showIcon: true
@@ -432,7 +440,6 @@ var PlaceholderContent = function(param) {
432
440
  }, /*#__PURE__*/ React.createElement("p", null, (locale === null || locale === void 0 ? void 0 : locale['workspace.file.unknownFileType']) || '未知的文件类型'), /*#__PURE__*/ React.createElement("p", null, "文件类型:", typeInference.fileType));
433
441
  }
434
442
  };
435
- var _headerFileOverride_lastModified, _headerFileOverride_lastModified1;
436
443
  return wrapSSR(/*#__PURE__*/ React.createElement("div", {
437
444
  className: classNames(prefixCls, hashId)
438
445
  }, customHeader ? /*#__PURE__*/ React.createElement("div", {
@@ -458,9 +465,9 @@ var PlaceholderContent = function(param) {
458
465
  }, getFileTypeIcon(fileType, headerFile.icon, headerFile.name)), /*#__PURE__*/ React.createElement("span", {
459
466
  className: classNames("".concat(prefixCls, "-file-name"), hashId)
460
467
  }, headerFile.name));
461
- }()), ((_headerFileOverride_lastModified = headerFileOverride === null || headerFileOverride === void 0 ? void 0 : headerFileOverride.lastModified) !== null && _headerFileOverride_lastModified !== void 0 ? _headerFileOverride_lastModified : file.lastModified) && /*#__PURE__*/ React.createElement("div", {
468
+ }()), ((_ref = headerFileOverride === null || headerFileOverride === void 0 ? void 0 : headerFileOverride.lastModified) !== null && _ref !== void 0 ? _ref : file.lastModified) && /*#__PURE__*/ React.createElement("div", {
462
469
  className: classNames("".concat(prefixCls, "-generate-time"), hashId)
463
- }, (locale === null || locale === void 0 ? void 0 : locale['workspace.file.generationTime']) || '生成时间:', formatLastModified((_headerFileOverride_lastModified1 = headerFileOverride === null || headerFileOverride === void 0 ? void 0 : headerFileOverride.lastModified) !== null && _headerFileOverride_lastModified1 !== void 0 ? _headerFileOverride_lastModified1 : file.lastModified))), /*#__PURE__*/ React.createElement("div", {
470
+ }, (locale === null || locale === void 0 ? void 0 : locale['workspace.file.generationTime']) || '生成时间:', formatLastModified((_ref1 = headerFileOverride === null || headerFileOverride === void 0 ? void 0 : headerFileOverride.lastModified) !== null && _ref1 !== void 0 ? _ref1 : file.lastModified))), /*#__PURE__*/ React.createElement("div", {
464
471
  className: classNames("".concat(prefixCls, "-actions"), hashId)
465
472
  }, !customContent && isCurrentFileHtml && /*#__PURE__*/ React.createElement(Segmented, {
466
473
  size: "small",
@@ -1,5 +1,5 @@
1
1
  export { FileComponent as File } from './FileComponent';
2
2
  export { PreviewComponent } from './PreviewComponent';
3
3
  export type { PreviewComponentProps } from './PreviewComponent';
4
- export type { FileActionRef, FileNode, FileProps, FileType, GroupNode, } from '../types';
4
+ export type { FileActionRef, FileBuiltinActions, FileNode, FileProps, FileRenderContext, FileType, GroupNode, } from '../types';
5
5
  export { getFileTypeIcon, getGroupIcon } from './utils';
@@ -187,6 +187,13 @@ var genStyle = function(token) {
187
187
  font: 'var(--font-text-body-sm)',
188
188
  color: 'var(--color-gray-text-light)',
189
189
  letterSpacing: 'var(--letter-spacing-body-sm, normal)'
190
+ }), // 禁用状态
191
+ _define_property(_obj3, "&-disabled", {
192
+ cursor: 'not-allowed',
193
+ opacity: 0.5,
194
+ '&:hover': {
195
+ background: 'transparent'
196
+ }
190
197
  }), // 分割符
191
198
  _define_property(_obj3, "&-separator", {
192
199
  fontSize: 'var(--font-size-xs)',
@@ -268,6 +268,7 @@ var shouldUpdateEditor = function(type, htmlViewMode) {
268
268
  * ```
269
269
  */ export var RealtimeFollow = function(param) {
270
270
  var data = param.data, _param_htmlViewMode = param.htmlViewMode, htmlViewMode = _param_htmlViewMode === void 0 ? 'preview' : _param_htmlViewMode, prefixCls = param.prefixCls, hashId = param.hashId;
271
+ var _data_typewriter, _data_content;
271
272
  var _data_markdownEditorProps;
272
273
  var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
273
274
  var finalPrefixCls = prefixCls || getPrefixCls('workspace-realtime');
@@ -336,14 +337,12 @@ var shouldUpdateEditor = function(type, htmlViewMode) {
336
337
  return null;
337
338
  }
338
339
  var defaultProps = getEditorConfig(data.type);
339
- var _data_typewriter;
340
340
  var mergedProps = _object_spread_props(_object_spread({}, defaultProps, data.markdownEditorProps), {
341
341
  typewriter: isTestEnv ? false : (_data_typewriter = data.typewriter) !== null && _data_typewriter !== void 0 ? _data_typewriter : defaultProps.typewriter,
342
342
  style: _object_spread({
343
343
  maxHeight: 'auto'
344
344
  }, defaultProps.style, (_data_markdownEditorProps = data.markdownEditorProps) === null || _data_markdownEditorProps === void 0 ? void 0 : _data_markdownEditorProps.style)
345
345
  });
346
- var _data_content;
347
346
  var contentStr = String((_data_content = data.content) !== null && _data_content !== void 0 ? _data_content : '');
348
347
  var isEmpty = contentStr.trim() === '';
349
348
  var shouldShowEmpty = !isTestEnv && isEmpty && data.status !== 'loading' && data.status !== 'error';
@@ -72,11 +72,11 @@ function _unsupported_iterable_to_array(o, minLen) {
72
72
  if (n === "Map" || n === "Set") return Array.from(n);
73
73
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
74
74
  }
75
- import { CloseOutlined } from "@ant-design/icons";
76
- import { FileStack, Language, ListTodo, MousePointerClick } from "@sofa-design/icons";
75
+ import { FileStack, Language, ListTodo, MousePointerClick, X } from "@sofa-design/icons";
77
76
  import { ConfigProvider, Segmented } from "antd";
78
77
  import classNames from "classnames";
79
78
  import React, { useContext, useEffect, useMemo, useRef, useState } from "react";
79
+ import { ActionIconBox } from "../Components/ActionIconBox";
80
80
  import { I18nContext } from "../I18n";
81
81
  import Browser from "./Browser";
82
82
  import { File } from "./File";
@@ -121,10 +121,10 @@ var DEFAULT_CONFIG = function(locale) {
121
121
  }), _obj;
122
122
  };
123
123
  var resolveTabConfig = function(tab, defaultConfig, index) {
124
- var _tab_icon;
124
+ var _ref;
125
125
  return {
126
126
  key: (tab === null || tab === void 0 ? void 0 : tab.key) || defaultConfig.key + (index !== undefined ? "-".concat(index) : ''),
127
- icon: (_tab_icon = tab === null || tab === void 0 ? void 0 : tab.icon) !== null && _tab_icon !== void 0 ? _tab_icon : defaultConfig.icon,
127
+ icon: (_ref = tab === null || tab === void 0 ? void 0 : tab.icon) !== null && _ref !== void 0 ? _ref : defaultConfig.icon,
128
128
  title: (tab === null || tab === void 0 ? void 0 : tab.title) || defaultConfig.label,
129
129
  count: tab === null || tab === void 0 ? void 0 : tab.count
130
130
  };
@@ -178,7 +178,8 @@ var COMPONENT_MAP = new Map([
178
178
  * 工作空间组件
179
179
  * 提供多标签页界面,支持实时跟随、浏览器、任务、文件等功能模块
180
180
  */ var Workspace = function(param) {
181
- var activeTabKey = param.activeTabKey, onTabChange = param.onTabChange, style = param.style, className = param.className, title = param.title, onClose = param.onClose, children = param.children, _param_pure = param.pure, pure = _param_pure === void 0 ? false : _param_pure;
181
+ var activeTabKey = param.activeTabKey, onTabChange = param.onTabChange, style = param.style, className = param.className, title = param.title, onClose = param.onClose, children = param.children, _param_pure = param.pure, pure = _param_pure === void 0 ? false : _param_pure, headerExtra = param.headerExtra;
182
+ var _ref, _ref1;
182
183
  var _availableTabs_find, _availableTabs_, _availableTabs_find1;
183
184
  var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
184
185
  var locale = useContext(I18nContext).locale;
@@ -277,10 +278,9 @@ var COMPONENT_MAP = new Map([
277
278
  return observer.disconnect();
278
279
  };
279
280
  }, []);
280
- var _availableTabs_find_key, _ref;
281
- var currentActiveTab = (_ref = (_availableTabs_find_key = (_availableTabs_find = availableTabs.find(function(tab) {
281
+ var currentActiveTab = (_ref = (_ref1 = (_availableTabs_find = availableTabs.find(function(tab) {
282
282
  return tab.key === (activeTabKey !== null && activeTabKey !== void 0 ? activeTabKey : internalActiveTab);
283
- })) === null || _availableTabs_find === void 0 ? void 0 : _availableTabs_find.key) !== null && _availableTabs_find_key !== void 0 ? _availableTabs_find_key : (_availableTabs_ = availableTabs[0]) === null || _availableTabs_ === void 0 ? void 0 : _availableTabs_.key) !== null && _ref !== void 0 ? _ref : '';
283
+ })) === null || _availableTabs_find === void 0 ? void 0 : _availableTabs_find.key) !== null && _ref1 !== void 0 ? _ref1 : (_availableTabs_ = availableTabs[0]) === null || _availableTabs_ === void 0 ? void 0 : _availableTabs_.key) !== null && _ref !== void 0 ? _ref : '';
284
284
  var handleTabChange = function(key) {
285
285
  var tabKey = String(key);
286
286
  if (activeTabKey === undefined) setInternalActiveTab(tabKey);
@@ -301,12 +301,14 @@ var COMPONENT_MAP = new Map([
301
301
  }, /*#__PURE__*/ React.createElement("div", {
302
302
  className: classNames("".concat(prefixCls, "-title"), hashId),
303
303
  "data-testid": "workspace-title"
304
- }, displayTitle), onClose && /*#__PURE__*/ React.createElement(CloseOutlined, {
304
+ }, displayTitle), /*#__PURE__*/ React.createElement("div", {
305
+ className: classNames("".concat(prefixCls, "-header-right"), hashId)
306
+ }, headerExtra, onClose && /*#__PURE__*/ React.createElement(ActionIconBox, {
305
307
  className: classNames("".concat(prefixCls, "-close"), hashId),
306
308
  onClick: onClose,
307
- "aria-label": (locale === null || locale === void 0 ? void 0 : locale['workspace.closeWorkspace']) || '关闭工作空间',
309
+ title: (locale === null || locale === void 0 ? void 0 : locale['workspace.closeWorkspace']) || '关闭工作空间',
308
310
  "data-testid": "workspace-close"
309
- })), availableTabs.length > 1 && /*#__PURE__*/ React.createElement("div", {
311
+ }, /*#__PURE__*/ React.createElement(X, null)))), availableTabs.length > 1 && /*#__PURE__*/ React.createElement("div", {
310
312
  className: classNames("".concat(prefixCls, "-tabs"), hashId),
311
313
  "data-testid": "workspace-tabs"
312
314
  }, /*#__PURE__*/ React.createElement(Segmented, {
@@ -78,21 +78,15 @@ var genStyle = function(token) {
78
78
  font: 'var(--font-text-h5-base)',
79
79
  color: 'var(--color-gray-text-default)',
80
80
  letterSpacing: 'var(--letter-spacing-h5-base, normal)'
81
- }), _define_property(_obj, "".concat(token.componentCls, "-close"), {
82
- padding: 'var(--padding-1x)',
83
- borderRadius: '6px',
84
- color: 'var(--color-gray-text-secondary)',
81
+ }), _define_property(_obj, "".concat(token.componentCls, "-header-right"), _define_property({
82
+ display: 'flex',
83
+ alignItems: 'center',
84
+ justifyContent: 'flex-end',
85
+ gap: 'var(--gap-2x)'
86
+ }, "".concat(token.componentCls, "-close"), {
85
87
  cursor: 'pointer',
86
- transition: 'all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1)',
87
- '&:hover': {
88
- color: 'var(--color-gray-text-default)',
89
- backgroundColor: 'var(--color-gray-control-fill-hover)'
90
- },
91
- '&:focus': {
92
- outline: '2px solid var(--color-primary-control-fill-primary)',
93
- outlineOffset: '2px'
94
- }
95
- }), _define_property(_obj, "".concat(token.componentCls, "-tabs"), {
88
+ transition: 'all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1)'
89
+ })), _define_property(_obj, "".concat(token.componentCls, "-tabs"), {
96
90
  margin: 'var(--margin-3x)'
97
91
  }), // 分割线样式
98
92
  _define_property(_obj, "".concat(token.componentCls, "-segmented"), {
@@ -28,6 +28,8 @@ export interface WorkspaceProps {
28
28
  children?: React.ReactNode;
29
29
  /** 纯净模式,关闭阴影和边框 */
30
30
  pure?: boolean;
31
+ /** 自定义 header 右侧区域内容 */
32
+ headerExtra?: ReactNode;
31
33
  }
32
34
  export interface BaseChildProps {
33
35
  tab?: TabConfiguration;
@@ -67,6 +69,34 @@ export interface BaseNode {
67
69
  name: string;
68
70
  icon?: ReactNode;
69
71
  }
72
+ /**
73
+ * 内置操作按钮
74
+ */
75
+ export interface FileBuiltinActions {
76
+ /** 预览按钮 */
77
+ preview: ReactNode;
78
+ /** 定位按钮 */
79
+ locate: ReactNode;
80
+ /** 分享按钮 */
81
+ share: ReactNode;
82
+ /** 下载按钮 */
83
+ download: ReactNode;
84
+ }
85
+ /**
86
+ * 文件卡片自定义渲染函数参数
87
+ */
88
+ export interface FileRenderContext {
89
+ /** 当前文件节点 */
90
+ file: FileNode;
91
+ /** 样式前缀 */
92
+ prefixCls: string;
93
+ /** 样式 hash */
94
+ hashId: string;
95
+ /** 是否禁用 */
96
+ disabled: boolean;
97
+ /** 内置操作按钮,可在 renderActions 中复用 */
98
+ actions: FileBuiltinActions;
99
+ }
70
100
  export interface FileNode extends BaseNode {
71
101
  displayType?: string;
72
102
  type?: FileType;
@@ -84,6 +114,26 @@ export interface FileNode extends BaseNode {
84
114
  /** 用户自定义是否可以定位(默认隐藏,设置为 true 显示) */
85
115
  canLocate?: boolean;
86
116
  loading?: boolean;
117
+ /**
118
+ * 是否禁用文件卡片
119
+ * @description 禁用后文件卡片不可点击,操作按钮也会隐藏
120
+ */
121
+ disabled?: boolean;
122
+ /**
123
+ * 自定义渲染文件名区域
124
+ * @description 传入后将替换默认的文件名渲染
125
+ */
126
+ renderName?: (ctx: FileRenderContext) => ReactNode;
127
+ /**
128
+ * 自定义渲染详情行区域
129
+ * @description 传入后将替换默认的详情行(类型、大小、时间等)渲染
130
+ */
131
+ renderDetails?: (ctx: FileRenderContext) => ReactNode;
132
+ /**
133
+ * 自定义渲染操作按钮区域
134
+ * @description 传入后将替换默认的操作按钮(预览、下载、分享等)渲染
135
+ */
136
+ renderActions?: (ctx: FileRenderContext) => ReactNode;
87
137
  }
88
138
  export interface GroupNode extends BaseNode {
89
139
  collapsed?: boolean;
@@ -44,7 +44,6 @@ function _unsupported_iterable_to_array(o, minLen) {
44
44
  if (n === "Map" || n === "Set") return Array.from(n);
45
45
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
46
46
  }
47
- import React from "react";
48
47
  // ... (rest of the file content unchanged)
49
48
  // 文件类型分类
50
49
  export var FileCategory = /*#__PURE__*/ function(FileCategory) {