@ant-design/agentic-ui 2.10.2 → 2.11.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.
@@ -49,7 +49,7 @@ import { Button, Modal, Tooltip } from "antd";
49
49
  import React, { useCallback, useContext, useMemo, useState } from "react";
50
50
  import { useRefFunction } from "../../Hooks/useRefFunction";
51
51
  import { I18nContext } from "../../I18n";
52
- import { isMobileDevice, isVivoOrOppoDevice, kbToSize } from "./utils";
52
+ import { isMobileDevice, isVivoOrOppoDevice, isWeChat, kbToSize } from "./utils";
53
53
  /**
54
54
  * 移动设备默认的文件类型 accept 值
55
55
  */ var MOBILE_DEFAULT_ACCEPT = 'application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,.csv,text/plain,application/x-zip-compressed';
@@ -142,6 +142,9 @@ export var AttachmentButtonPopover = function(param) {
142
142
  var isMobile = useMemo(function() {
143
143
  return isMobileDevice();
144
144
  }, []);
145
+ var isWeChatEnv = useMemo(function() {
146
+ return isWeChat();
147
+ }, []);
145
148
  var trigger = useMemo(function() {
146
149
  return isVivoOrOppo ? [
147
150
  'click'
@@ -156,12 +159,25 @@ export var AttachmentButtonPopover = function(param) {
156
159
  var extensions = format.extensions || [];
157
160
  /**
158
161
  * 根据支持的格式获取 accept 属性值
162
+ * 优先级:微信 > 手机品牌(oppo/vivo)> 移动设备 > 相册模式 > 默认
159
163
  */ var getAcceptValue = useRefFunction(function(forGallery) {
160
- // 如果是移动设备,返回默认的 accept 值
161
- if (isMobile || forGallery) {
162
- return MOBILE_DEFAULT_ACCEPT;
164
+ // 相册模式
165
+ if (forGallery) {
166
+ return 'image/*';
167
+ }
168
+ // 1. 微信环境最优先:设置为空字符串以打开文件浏览器
169
+ if (isWeChatEnv) {
170
+ return '*';
171
+ }
172
+ // 2. 手机品牌其次(oppo/vivo):设置为空字符串以打开文件浏览器
173
+ if (isVivoOrOppo) {
174
+ return '*';
175
+ }
176
+ // 3. 移动设备其次:设置为空字符串以打开文件浏览器
177
+ if (isMobile) {
178
+ return '*';
163
179
  }
164
- // 打开文件,使用具体扩展名列表
180
+ // 5. 默认情况:使用具体扩展名列表
165
181
  return extensions.length > 0 ? extensions.map(function(ext) {
166
182
  return ".".concat(ext);
167
183
  }).join(',') : MOBILE_DEFAULT_ACCEPT;
@@ -1,4 +1,4 @@
1
- import { default as React } from 'react';
1
+ import React from 'react';
2
2
  import { AttachmentButtonPopoverProps } from './AttachmentButtonPopover';
3
3
  import { AttachmentFile, UploadResponse } from './types';
4
4
  export * from './AttachmentButtonPopover';
@@ -138,7 +138,7 @@ function _ts_generator(thisArg, body) {
138
138
  import { Paperclip } from "@sofa-design/icons";
139
139
  import { ConfigProvider, message } from "antd";
140
140
  import classNames from "classnames";
141
- import { default as React, useContext } from "react";
141
+ import React, { useContext } from "react";
142
142
  import { compileTemplate } from "../../I18n";
143
143
  import AttachmentButtonPopover, { SupportedFileFormats } from "./AttachmentButtonPopover";
144
144
  import { useStyle } from "./style";
@@ -85,3 +85,15 @@ export declare const isVivoOrOppoDevice: (ua?: string) => boolean;
85
85
  * ```
86
86
  */
87
87
  export declare const isMobileDevice: () => boolean;
88
+ /**
89
+ * 检测是否为微信环境
90
+ *
91
+ * @param {string} [ua] - User Agent 字符串,如果不提供则使用 navigator.userAgent
92
+ * @returns {boolean} 是否为微信环境
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * isWeChat() // true | false
97
+ * ```
98
+ */
99
+ export declare const isWeChat: (ua?: string) => boolean;
@@ -366,3 +366,20 @@
366
366
  var isSmallScreen = typeof window !== 'undefined' && window.innerWidth <= 768;
367
367
  return mobileRegex.test(userAgent) || hasTouchScreen && isSmallScreen;
368
368
  };
369
+ /**
370
+ * 检测是否为微信环境
371
+ *
372
+ * @param {string} [ua] - User Agent 字符串,如果不提供则使用 navigator.userAgent
373
+ * @returns {boolean} 是否为微信环境
374
+ *
375
+ * @example
376
+ * ```ts
377
+ * isWeChat() // true | false
378
+ * ```
379
+ */ export var isWeChat = function(ua) {
380
+ if (typeof navigator === 'undefined' && !ua) {
381
+ return false;
382
+ }
383
+ var userAgent = (ua || navigator.userAgent).toLowerCase();
384
+ return /micromessenger/i.test(userAgent);
385
+ };
@@ -181,9 +181,6 @@ import { I18nContext } from "../../I18n";
181
181
  import { upLoadFileToServer } from "../AttachmentButton";
182
182
  import { SupportedFileFormats } from "../AttachmentButton/AttachmentButtonPopover";
183
183
  import { isMobileDevice, isVivoOrOppoDevice } from "../AttachmentButton/utils";
184
- /**
185
- * 移动设备默认的文件类型 accept 值
186
- */ var MOBILE_DEFAULT_ACCEPT = 'application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,.csv,image/*,text/plain,application/x-zip-compressed';
187
184
  /**
188
185
  * 文件上传管理器
189
186
  *
@@ -210,16 +207,6 @@ import { isMobileDevice, isVivoOrOppoDevice } from "../AttachmentButton/utils";
210
207
  var isMobile = isMobileDevice();
211
208
  var isVivoOrOppo = isVivoOrOppoDevice();
212
209
  var extensions = (supportedFormat === null || supportedFormat === void 0 ? void 0 : supportedFormat.extensions) || [];
213
- // 如果是移动设备,返回默认的 accept 值
214
- if (isMobile) {
215
- return MOBILE_DEFAULT_ACCEPT;
216
- }
217
- if (!isVivoOrOppo) {
218
- // 非 vivo/oppo 设备,直接使用扩展名列表
219
- return extensions.length > 0 ? extensions.map(function(ext) {
220
- return ".".concat(ext);
221
- }).join(',') : 'image/*';
222
- }
223
210
  // vivo/oppo 设备:判断是否只包含图片格式
224
211
  var imageExtensions = [
225
212
  'jpg',
@@ -237,6 +224,16 @@ import { isMobileDevice, isVivoOrOppoDevice } from "../AttachmentButton/utils";
237
224
  // 只支持图片格式,使用 image/* 打开相册
238
225
  return 'image/*';
239
226
  }
227
+ // 如果是移动设备,返回默认的 accept 值
228
+ if (isMobile) {
229
+ return '';
230
+ }
231
+ if (!isVivoOrOppo) {
232
+ // 非 vivo/oppo 设备,直接使用扩展名列表
233
+ return extensions.length > 0 ? extensions.map(function(ext) {
234
+ return ".".concat(ext);
235
+ }).join(',') : 'image/*';
236
+ }
240
237
  // 支持其他格式,使用具体扩展名列表打开文件选择器
241
238
  return extensions.length > 0 ? extensions.map(function(ext) {
242
239
  return ".".concat(ext);
@@ -1,4 +1,4 @@
1
- import { default as React } from 'react';
1
+ import React from 'react';
2
2
  export interface ChartStatisticProps {
3
3
  title?: string;
4
4
  tooltip?: string;
@@ -1,7 +1,7 @@
1
1
  import { QuestionCircleOutlined } from "@ant-design/icons";
2
2
  import { ConfigProvider, Tooltip } from "antd";
3
3
  import classNames from "classnames";
4
- import { default as React, useContext } from "react";
4
+ import React, { useContext } from "react";
5
5
  import { useStyle } from "./style";
6
6
  import { formatNumber } from "./utils";
7
7
  var ChartStatistic = function(param) {
@@ -1,4 +1,4 @@
1
- import { default as React } from 'react';
1
+ import React from 'react';
2
2
  export interface FilterOption {
3
3
  label: string;
4
4
  value: string;
@@ -1,7 +1,7 @@
1
1
  import { ChevronDown } from "@sofa-design/icons";
2
2
  import { Button, ConfigProvider, Dropdown, Segmented } from "antd";
3
3
  import classNames from "classnames";
4
- import { default as React, useContext } from "react";
4
+ import React, { useContext } from "react";
5
5
  import { I18nContext } from "../../../../I18n";
6
6
  import { useStyle } from "./style";
7
7
  var ChartFilter = function(param) {
@@ -1,4 +1,4 @@
1
- import { default as React } from 'react';
1
+ import React from 'react';
2
2
  /**
3
3
  * @fileoverview 图表工具栏组件文件
4
4
  *
@@ -1,7 +1,7 @@
1
1
  import { DownloadOutlined } from "@ant-design/icons";
2
2
  import { ConfigProvider, Tooltip } from "antd";
3
3
  import classNames from "classnames";
4
- import { default as React, useContext } from "react";
4
+ import React, { useContext } from "react";
5
5
  import { I18nContext } from "../../../../I18n";
6
6
  import TimeIcon from "../icons/TimeIcon";
7
7
  import { useStyle } from "./style";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ant-design/agentic-ui",
3
- "version": "2.10.2",
3
+ "version": "2.11.1",
4
4
  "description": "面向智能体的 UI 组件库,提供多步推理可视化、工具调用展示、任务执行协同等 Agentic UI 能力",
5
5
  "repository": "git@github.com:ant-design/agentic-ui.git",
6
6
  "license": "MIT",