@sia.soul/sia-react-ui 0.1.27 → 0.1.29

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.
@@ -983,7 +983,7 @@ interface TreeProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect" | "o
983
983
  * @defaultValue false
984
984
  */
985
985
  defaultExpandAll?: boolean;
986
- /** 受控的勾选节点标识集合。 */
986
+ /** 受控勾选键;非独立模式自动向下关联子节点、向上汇总父节点及半选,禁用节点阻断传播。通过 onCheck 同步更新。 */
987
987
  checkedKeys?: readonly TreeKey[];
988
988
  /**
989
989
  * 非受控模式下初始勾选的节点标识。
@@ -1001,7 +1001,7 @@ interface TreeProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect" | "o
1001
1001
  */
1002
1002
  checkable?: boolean;
1003
1003
  /**
1004
- * 父子节点勾选状态是否相互独立。
1004
+ * 为 true 时父子独立;为 false 时父子联动,并显示部分子项选中的半选状态。
1005
1005
  * @defaultValue false
1006
1006
  */
1007
1007
  checkStrictly?: boolean;
@@ -1066,10 +1066,12 @@ interface TreeProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect" | "o
1066
1066
  /** 触发本次操作的原生事件。 */
1067
1067
  nativeEvent: React.MouseEvent;
1068
1068
  }) => void;
1069
- /** 勾选状态变化时调用。 */
1069
+ /** 用户切换勾选时调用;keys 为联动后的完整选中键,info.halfCheckedKeys 为半选父节点。 */
1070
1070
  onCheck?: (keys: TreeKey[], info: {
1071
1071
  /** 当前是否勾选;作为受控属性时通过回调更新。 */
1072
1072
  checked: boolean;
1073
+ /** 联动计算后处于半选状态的节点键;独立模式为空数组。 */
1074
+ halfCheckedKeys: TreeKey[];
1073
1075
  /** 当前操作关联的节点数据。 */
1074
1076
  node: TreeNode;
1075
1077
  }) => void;
@@ -1802,119 +1804,174 @@ interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "prefix
1802
1804
  /** 输入框组件。 */
1803
1805
  declare const Input: react.ForwardRefExoticComponent<InputProps & react.RefAttributes<HTMLInputElement>>;
1804
1806
 
1805
- declare const LIST_IGNORE: unique symbol;
1806
- /** UploadFile的状态类型。 */
1807
+ /** ready 为待上传,uploading 为进行中,done 为成功,error 为校验或网络失败。 */
1807
1808
  type UploadFileStatus = "ready" | "uploading" | "done" | "error";
1808
- /** 上传文件的状态记录,包含唯一标识、文件名、原始文件和服务端响应。 */
1809
+ /** 文件记录;受控更新时应保持 uid 不变。 */
1809
1810
  interface UploadFile {
1810
- /** 文件的唯一标识。 */
1811
+ /** 列表中唯一的文件标识。 */
1811
1812
  uid: string;
1812
- /** 名称或字段标识。 */
1813
+ /** 显示文件名,不含目录。 */
1813
1814
  name: string;
1814
- /** 组件尺寸;用于调整控件高度、字号和间距。 */
1815
+ /** 文件大小,单位字节。 */
1815
1816
  size?: number;
1816
- /** 类型标识,用于选择对应的表现形式。 */
1817
+ /** MIME 类型,例如 image/png。 */
1817
1818
  type?: string;
1818
- /** 当前状态,用于选择对应的状态样式。 */
1819
+ /** 当前状态,缺省按 ready 展示。 */
1819
1820
  status?: UploadFileStatus;
1820
- /** 进度百分比。 */
1821
+ /** 上传百分比,范围 0–100。 */
1821
1822
  percent?: number;
1822
- /** 文件或资源的访问地址。 */
1823
+ /** 远程访问地址,用于预览和文件链接。 */
1823
1824
  url?: string;
1824
- /** 上传服务返回的响应数据。 */
1825
+ /** 缩略图地址,优先于本地缩略图;预览优先使用 url。 */
1826
+ thumbUrl?: string;
1827
+ /** 包含所选根目录的相对路径,例如 photos/trip/a.png;普通文件为文件名。 */
1828
+ relativePath?: string;
1829
+ /** 服务端成功响应;内置请求优先解析 JSON,否则保留文本。 */
1825
1830
  response?: unknown;
1826
- /** 错误信息或错误对象。 */
1831
+ /** 最近一次校验或上传错误。 */
1827
1832
  error?: unknown;
1828
- /** 上传前的原始 File 对象。 */
1833
+ /** 原始 File,用于本地预览与重试;beforeUpload 转换只影响当次请求。 */
1829
1834
  originFileObj?: File;
1830
1835
  }
1831
- /** UploadRequest的配置选项。 */
1836
+ /** 自定义上传参数,可用于 SDK、分片、断点续传或业务请求。 */
1832
1837
  interface UploadRequestOptions {
1833
- /** 当前操作涉及的文件。 */
1838
+ /** 已经 beforeUpload 转换的实际上传文件。 */
1834
1839
  file: File;
1835
- /** 文件名。 */
1840
+ /** 文件名,不是 multipart 字段名。 */
1836
1841
  filename: string;
1837
- /** 上传进度更新时调用。 */
1842
+ /** 本次上传的列表记录快照,uid 可关联业务任务。 */
1843
+ uploadFile: UploadFile;
1844
+ /** 相对路径;普通文件为文件名。 */
1845
+ relativePath: string;
1846
+ /** 取消、移除或卸载时中止;获取签名及分片请求也应监听此信号。 */
1847
+ signal: AbortSignal;
1848
+ /** 更新百分比 0–100;任务结束或取消后的回调会被忽略。 */
1838
1849
  onProgress: (percent: number) => void;
1839
- /** 上传成功时调用,接收响应数据。 */
1840
- onSuccess: (response?: unknown) => void;
1841
- /** 操作发生错误时调用,可用于显示业务错误提示。 */
1850
+ /** 上传完成时调用一次,保存 response;url 可指定访问地址。 */
1851
+ onSuccess: (response?: unknown, url?: string) => void;
1852
+ /** 失败时调用一次,保存错误并通知 onChange。 */
1842
1853
  onError: (error: unknown) => void;
1843
1854
  }
1844
- /** 文件上传的变更事件上下文。 */
1855
+ /** 上传取消句柄,与 signal 一起用于中止底层任务。 */
1856
+ interface UploadRequestHandle {
1857
+ /** 取消、移除或卸载时调用;应终止 SDK 或分片上传。 */
1858
+ abort?: () => void;
1859
+ }
1860
+ /** 通用 HTTP 上传配置,支持业务接口、OSS 签名表单和预签名 PUT。 */
1861
+ interface UploadHttpRequest {
1862
+ /** 上传地址;签名应由业务服务端生成。 */
1863
+ action: string;
1864
+ /** 请求方法,预签名二进制直传通常使用 PUT。 @defaultValue "POST" */
1865
+ method?: "POST" | "PUT" | "PATCH";
1866
+ /** form-data 为 multipart 表单,file 为 File 二进制。 @defaultValue "form-data" */
1867
+ body?: "form-data" | "file";
1868
+ /** multipart 文件字段名。 @defaultValue "file" */
1869
+ name?: string;
1870
+ /** multipart 额外字段,在文件之前添加,例如 key、policy、签名和令牌。 */
1871
+ data?: Readonly<Record<string, string | Blob>>;
1872
+ /** 自定义请求头,需与签名一致;multipart 不要手动设置 Content-Type。 */
1873
+ headers?: Readonly<Record<string, string>>;
1874
+ /** 是否携带跨域 Cookie。 @defaultValue false */
1875
+ withCredentials?: boolean;
1876
+ /** 超时毫秒数,0 为不设超时。 @defaultValue 0 */
1877
+ timeout?: number;
1878
+ /** 成功后写入文件记录的访问地址。 */
1879
+ url?: string;
1880
+ }
1881
+ /** 文件列表变化的上下文。 */
1845
1882
  interface UploadChangeInfo {
1846
- /** 当前操作涉及的文件。 */
1883
+ /** 本次变化的文件;移除时仍提供被移除的记录。 */
1847
1884
  file: UploadFile;
1848
- /** 受控的文件列表。 */
1885
+ /** 最新完整列表,受控模式需回填给 fileList。 */
1849
1886
  fileList: readonly UploadFile[];
1887
+ /** 触发原因:添加、开始、进度、成功、失败、移除或取消。 */
1888
+ event: "add" | "start" | "progress" | "success" | "error" | "remove" | "cancel";
1889
+ }
1890
+ /** 类型或数量限制拒绝的文件。 */
1891
+ interface UploadRejectInfo {
1892
+ /** 未加入列表的原始文件。 */
1893
+ file: File;
1894
+ /** accept 为类型不匹配,max-count 为达到数量上限。 */
1895
+ reason: "accept" | "max-count";
1850
1896
  }
1851
- /** 文件上传的属性配置。 */
1897
+ /** 自定义列表项可调用的操作,仍遵循禁用、取消和 onRemove 规则。 */
1898
+ interface UploadItemActions {
1899
+ /** 开始或重试当前文件;已上传成功或正在上传时不重复启动。 */
1900
+ upload: () => Promise<void>;
1901
+ /** 取消当前任务并回到 ready,保留文件。 */
1902
+ abort: () => void;
1903
+ /** 请求移除,等待 onRemove 允许后取消并删除。 */
1904
+ remove: () => Promise<void>;
1905
+ /** 触发自定义 onPreview,未提供时打开框架图片预览。 */
1906
+ preview: () => void;
1907
+ }
1908
+ /** Upload 的命令式句柄,适用于手动上传及业务工具栏。 */
1909
+ interface UploadRef {
1910
+ /** 开始 ready/error 文件;省略 uid 开始所有待上传项。Promise 在这些任务成功、失败或取消后完成,结果通过 onChange 通知。 */
1911
+ upload: (uid?: string) => Promise<void>;
1912
+ /** 取消指定文件,省略 uid 取消全部;保留记录为 ready,可再次 upload。 */
1913
+ abort: (uid?: string) => void;
1914
+ /** 请求移除指定文件;onRemove 拒绝时保留记录。 */
1915
+ remove: (uid: string) => Promise<void>;
1916
+ }
1917
+ /** 文件上传属性;未配置 request/customRequest 时仅选择文件,不模拟上传成功。 */
1852
1918
  interface UploadProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultValue" | "onChange"> {
1853
- /** 允许的文件类型,格式同原生 input accept。 */
1919
+ /** 扩展名或 MIME 类型,逗号分隔;点击、拖拽和粘贴均校验。 */
1854
1920
  accept?: string;
1855
- /**
1856
- 是否允许同时选择多个项目。
1857
- * @defaultValue false
1858
- */
1921
+ /** 每批是否允许多个文件;false 仅取首个,directory 模式不受此限制。 @defaultValue false */
1859
1922
  multiple?: boolean;
1860
- /**
1861
- * 是否允许选择文件夹。
1862
- * @defaultValue false
1863
- */
1923
+ /** 选择或拖入文件夹,文件路径保存在 relativePath;不会上传空目录。 @defaultValue false */
1864
1924
  directory?: boolean;
1865
- /**
1866
- * 是否禁用交互。
1867
- * @defaultValue false
1868
- */
1925
+ /** 是否包括子文件夹中的文件;false 仅处理根目录直接包含的文件。 @defaultValue true */
1926
+ recursive?: boolean;
1927
+ /** 聚焦本区域后允许粘贴文件或截图,不监听整个页面也不处理普通文本。 @defaultValue false */
1928
+ pastable?: boolean;
1929
+ /** 禁止添加、移除和启动上传;已在进行的请求不会自动取消。 @defaultValue false */
1869
1930
  disabled?: boolean;
1870
- /** 允许的最大文件数量。 */
1931
+ /** 添加后自动上传;false 为手动模式,调用 ref.upload 或自定义列表操作启动。 @defaultValue true */
1932
+ autoUpload?: boolean;
1933
+ /** 最大文件数量,包含等待及失败项;超出部分拒绝,不替换已有文件。默认不限。 */
1871
1934
  maxCount?: number;
1872
- /** 受控的文件列表。 */
1935
+ /** 受控列表,onChange 中回填;外部移除记录会取消关联请求。 */
1873
1936
  fileList?: readonly UploadFile[];
1874
- /**
1875
- * 非受控模式下的初始文件列表。
1876
- * @defaultValue []
1877
- */
1937
+ /** 非受控初始列表,后续修改不重置列表。 @defaultValue [] */
1878
1938
  defaultFileList?: readonly UploadFile[];
1879
- /**
1880
- * 上传文件列表的展示形式。
1881
- * @defaultValue "text"
1882
- */
1939
+ /** text 为文件列表,picture 为图片行,picture-card 为照片墙;照片墙满额隐藏添加入口。 @defaultValue "text" */
1883
1940
  listType?: "text" | "picture" | "picture-card";
1884
- /**
1885
- * 是否显示上传文件列表。
1886
- * @defaultValue true
1887
- */
1941
+ /** 是否显示列表;隐藏时仍执行数量限制和变更通知。 @defaultValue true */
1888
1942
  showUploadList?: boolean;
1889
- /** 上传前校验或转换文件 */
1890
- beforeUpload?: (file: File, fileList: readonly File[]) => boolean | File | typeof LIST_IGNORE | Promise<boolean | File | typeof LIST_IGNORE>;
1891
- /** 自定义上传实现 */
1892
- customRequest?: (options: UploadRequestOptions) => void | {
1893
- /** 取消当前上传请求。 */
1894
- abort?: () => void;
1895
- };
1896
- /** 值发生变化时调用;参数为新值及类型声明中列出的关联信息。 */
1943
+ /** 启动前校验,可异步;false 保留 ready,Upload.LIST_IGNORE 移除,File 转换本次上传内容;拒绝或抛错进入 error。手动上传时在调用 upload 后执行。 */
1944
+ beforeUpload?: (file: File, fileList: readonly File[]) => boolean | File | symbol | Promise<boolean | File | symbol>;
1945
+ /** HTTP 配置或逐文件异步签名函数,拒绝时进入 error;接收记录和取消信号。customRequest 优先。 */
1946
+ request?: UploadHttpRequest | ((file: UploadFile, signal: AbortSignal) => UploadHttpRequest | Promise<UploadHttpRequest>);
1947
+ /** 自定义上传,负责调用状态回调,可异步返回取消句柄;函数异常或 Promise 拒绝按失败处理。优先于 request。 */
1948
+ customRequest?: (options: UploadRequestOptions) => void | UploadRequestHandle | Promise<void | UploadRequestHandle>;
1949
+ /** 添加、开始、进度、完成、失败、取消和移除时调用;取消任务的迟到回调被忽略。 */
1897
1950
  onChange?: (info: UploadChangeInfo) => void;
1898
- /** 请求移除文件时调用;返回值控制是否允许移除。 */
1899
- onRemove?: (file: UploadFile) => boolean | Promise<boolean>;
1900
- /** 子内容;组件嵌套内容或当前节点的子项。 */
1951
+ /** 移除前调用;false 或 Promise 拒绝阻止移除,否则取消任务并删除。 */
1952
+ onRemove?: (file: UploadFile) => boolean | void | Promise<boolean | void>;
1953
+ /** 文件类型不匹配或数量超限时调用,该文件不进入列表。 */
1954
+ onReject?: (info: UploadRejectInfo) => void;
1955
+ /** 拖拽目录读取失败时调用,本次批次不上传。 */
1956
+ onReadError?: (error: unknown) => void;
1957
+ /** 点击预览时调用,提供后完全接管预览,可实现 PDF、视频或业务弹窗。 */
1958
+ onPreview?: (file: UploadFile) => void;
1959
+ /** 完全自定义列表项;接收默认节点、记录、最新列表及操作句柄,应自行提供可访问的按钮。 */
1960
+ itemRender?: (node: ReactNode, file: UploadFile, fileList: readonly UploadFile[], actions: UploadItemActions) => ReactNode;
1961
+ /** 上传按钮内容,不应嵌套其他交互控件;外层负责点击和键盘操作。 */
1901
1962
  children?: ReactNode;
1902
1963
  }
1903
- /** UploadDragger的属性配置。 */
1964
+ /** 拖拽区域继承全部 Upload 能力,ref 同样支持手动控制。 */
1904
1965
  interface UploadDraggerProps extends UploadProps {
1905
- /**
1906
- * 帮助或校验信息
1907
- * @defaultValue "支持单个或批量上传"
1908
- */
1966
+ /** 辅助说明文字。 @defaultValue "支持单个或批量上传" */
1909
1967
  hint?: ReactNode;
1910
1968
  }
1911
- declare function UploadRoot({ accept, multiple, directory, disabled, maxCount, fileList, defaultFileList, listType, showUploadList, beforeUpload, customRequest, onChange, onRemove, children, className, onDragOver, onDrop, ...props }: UploadProps): react.JSX.Element;
1912
- declare function UploadDragger({ hint, children, className, ...props }: UploadDraggerProps): react.JSX.Element;
1913
- /** 文件上传组件。 */
1914
- declare const Upload: typeof UploadRoot & {
1915
- /** 支持拖入文件上传的区域组件。 */
1916
- Dragger: typeof UploadDragger;
1917
- /** beforeUpload 返回此标记时忽略该文件,不加入上传列表。 */
1969
+
1970
+ /** 上传组件,支持图片列表、照片墙、目录、粘贴与完全受控请求;未配置请求时仅选择文件。 */
1971
+ declare const Upload: react.ForwardRefExoticComponent<UploadProps & react.RefAttributes<UploadRef>> & {
1972
+ /** 可点击、键盘操作和拖拽的上传区域,ref 支持手动上传、取消及移除。 */
1973
+ Dragger: react.ForwardRefExoticComponent<UploadDraggerProps & react.RefAttributes<UploadRef>>;
1974
+ /** beforeUpload 返回时移除该文件,不进行上传。 */
1918
1975
  LIST_IGNORE: symbol;
1919
1976
  };
1920
1977
 
@@ -2167,4 +2224,4 @@ declare const FloatButton: react.ForwardRefExoticComponent<FloatButtonProps & re
2167
2224
  BackTop: typeof FloatButtonBackTop;
2168
2225
  };
2169
2226
 
2170
- export { type MenuTheme as $, type FloatButtonGroupProps as A, type BadgeProps as B, Calendar as C, Dropdown as D, type FloatButtonProps as E, FILLED_ICON_NAMES as F, type FloatButtonShape as G, type FloatingPlacement as H, type FloatingTrigger as I, ICON_NAMES as J, Icon as K, type IconName as L, type IconProps as M, type IconVariant as N, Image as O, ImagePreview as P, type ImagePreviewConfig as Q, type ImagePreviewProps as R, type ImageProps as S, type TagStatus as T, Input as U, type InputProps as V, Menu as W, type MenuClickInfo as X, type MenuItem as Y, type MenuMode as Z, type MenuProps as _, Badge as a, type UploadRequestOptions as a$, type MessageConfig as a0, type MessageHandle as a1, type MessageKey as a2, type MessageType as a3, type NotificationConfig as a4, type NotificationPlacement as a5, type NotificationType as a6, Popconfirm as a7, type PopconfirmProps as a8, Popover as a9, Timeline as aA, type TimelineItem as aB, type TimelineProps as aC, Toolbar as aD, type ToolbarItem as aE, type ToolbarProps as aF, Tooltip as aG, type TooltipProps as aH, Tour as aI, type TourProps as aJ, type TourStep as aK, Tree as aL, type TreeDropPosition as aM, type TreeKey as aN, type TreeNode as aO, type TreeProps as aP, Typography as aQ, type TypographyLinkProps as aR, type TypographyProps as aS, type TypographyTitleProps as aT, type TypographyType as aU, Upload as aV, type UploadChangeInfo as aW, type UploadDraggerProps as aX, type UploadFile as aY, type UploadFileStatus as aZ, type UploadProps as a_, type PopoverProps as aa, Progress as ab, type ProgressProps as ac, type ProgressStatus as ad, Rate as ae, type RateProps as af, Segmented as ag, type SegmentedOption as ah, type SegmentedProps as ai, type SegmentedValue as aj, Spin as ak, type SpinProps as al, type StepItem as am, type StepStatus as an, Steps as ao, type StepsProps as ap, type TabItem as aq, Tabs as ar, type TabsContextMenuClickInfo as as, type TabsOrientation as at, type TabsPosition as au, type TabsProps as av, type TabsType as aw, Tag as ax, type TagProps as ay, type TagVariant as az, type BadgeRibbonProps as b, Watermark as b0, type WatermarkFont as b1, type WatermarkProps as b2, message as b3, notification as b4, type BadgeStatus as c, Breadcrumb as d, type BreadcrumbItem as e, type BreadcrumbProps as f, type CalendarProps as g, Card as h, type CardAccent as i, type CardProps as j, Carousel as k, type CarouselProps as l, type CarouselRef as m, Collapse as n, type CollapseItem as o, type CollapseKey as p, type CollapseProps as q, type DropdownButtonProps as r, type DropdownMenuProps as s, type DropdownOpenSource as t, type DropdownPlacement as u, type DropdownProps as v, type DropdownTrigger as w, type FilledIconName as x, FloatButton as y, type FloatButtonBackTopProps as z };
2227
+ export { type MenuTheme as $, type FloatButtonGroupProps as A, type BadgeProps as B, Calendar as C, Dropdown as D, type FloatButtonProps as E, FILLED_ICON_NAMES as F, type FloatButtonShape as G, type FloatingPlacement as H, type FloatingTrigger as I, ICON_NAMES as J, Icon as K, type IconName as L, type IconProps as M, type IconVariant as N, Image as O, ImagePreview as P, type ImagePreviewConfig as Q, type ImagePreviewProps as R, type ImageProps as S, type TagStatus as T, Input as U, type InputProps as V, Menu as W, type MenuClickInfo as X, type MenuItem as Y, type MenuMode as Z, type MenuProps as _, Badge as a, type UploadItemActions as a$, type MessageConfig as a0, type MessageHandle as a1, type MessageKey as a2, type MessageType as a3, type NotificationConfig as a4, type NotificationPlacement as a5, type NotificationType as a6, Popconfirm as a7, type PopconfirmProps as a8, Popover as a9, Timeline as aA, type TimelineItem as aB, type TimelineProps as aC, Toolbar as aD, type ToolbarItem as aE, type ToolbarProps as aF, Tooltip as aG, type TooltipProps as aH, Tour as aI, type TourProps as aJ, type TourStep as aK, Tree as aL, type TreeDropPosition as aM, type TreeKey as aN, type TreeNode as aO, type TreeProps as aP, Typography as aQ, type TypographyLinkProps as aR, type TypographyProps as aS, type TypographyTitleProps as aT, type TypographyType as aU, Upload as aV, type UploadChangeInfo as aW, type UploadDraggerProps as aX, type UploadFile as aY, type UploadFileStatus as aZ, type UploadHttpRequest as a_, type PopoverProps as aa, Progress as ab, type ProgressProps as ac, type ProgressStatus as ad, Rate as ae, type RateProps as af, Segmented as ag, type SegmentedOption as ah, type SegmentedProps as ai, type SegmentedValue as aj, Spin as ak, type SpinProps as al, type StepItem as am, type StepStatus as an, Steps as ao, type StepsProps as ap, type TabItem as aq, Tabs as ar, type TabsContextMenuClickInfo as as, type TabsOrientation as at, type TabsPosition as au, type TabsProps as av, type TabsType as aw, Tag as ax, type TagProps as ay, type TagVariant as az, type BadgeRibbonProps as b, type UploadProps as b0, type UploadRef as b1, type UploadRejectInfo as b2, type UploadRequestHandle as b3, type UploadRequestOptions as b4, Watermark as b5, type WatermarkFont as b6, type WatermarkProps as b7, message as b8, notification as b9, type BadgeStatus as c, Breadcrumb as d, type BreadcrumbItem as e, type BreadcrumbProps as f, type CalendarProps as g, Card as h, type CardAccent as i, type CardProps as j, Carousel as k, type CarouselProps as l, type CarouselRef as m, Collapse as n, type CollapseItem as o, type CollapseKey as p, type CollapseProps as q, type DropdownButtonProps as r, type DropdownMenuProps as s, type DropdownOpenSource as t, type DropdownPlacement as u, type DropdownProps as v, type DropdownTrigger as w, type FilledIconName as x, FloatButton as y, type FloatButtonBackTopProps as z };
@@ -983,7 +983,7 @@ interface TreeProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect" | "o
983
983
  * @defaultValue false
984
984
  */
985
985
  defaultExpandAll?: boolean;
986
- /** 受控的勾选节点标识集合。 */
986
+ /** 受控勾选键;非独立模式自动向下关联子节点、向上汇总父节点及半选,禁用节点阻断传播。通过 onCheck 同步更新。 */
987
987
  checkedKeys?: readonly TreeKey[];
988
988
  /**
989
989
  * 非受控模式下初始勾选的节点标识。
@@ -1001,7 +1001,7 @@ interface TreeProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect" | "o
1001
1001
  */
1002
1002
  checkable?: boolean;
1003
1003
  /**
1004
- * 父子节点勾选状态是否相互独立。
1004
+ * 为 true 时父子独立;为 false 时父子联动,并显示部分子项选中的半选状态。
1005
1005
  * @defaultValue false
1006
1006
  */
1007
1007
  checkStrictly?: boolean;
@@ -1066,10 +1066,12 @@ interface TreeProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect" | "o
1066
1066
  /** 触发本次操作的原生事件。 */
1067
1067
  nativeEvent: React.MouseEvent;
1068
1068
  }) => void;
1069
- /** 勾选状态变化时调用。 */
1069
+ /** 用户切换勾选时调用;keys 为联动后的完整选中键,info.halfCheckedKeys 为半选父节点。 */
1070
1070
  onCheck?: (keys: TreeKey[], info: {
1071
1071
  /** 当前是否勾选;作为受控属性时通过回调更新。 */
1072
1072
  checked: boolean;
1073
+ /** 联动计算后处于半选状态的节点键;独立模式为空数组。 */
1074
+ halfCheckedKeys: TreeKey[];
1073
1075
  /** 当前操作关联的节点数据。 */
1074
1076
  node: TreeNode;
1075
1077
  }) => void;
@@ -1802,119 +1804,174 @@ interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "prefix
1802
1804
  /** 输入框组件。 */
1803
1805
  declare const Input: react.ForwardRefExoticComponent<InputProps & react.RefAttributes<HTMLInputElement>>;
1804
1806
 
1805
- declare const LIST_IGNORE: unique symbol;
1806
- /** UploadFile的状态类型。 */
1807
+ /** ready 为待上传,uploading 为进行中,done 为成功,error 为校验或网络失败。 */
1807
1808
  type UploadFileStatus = "ready" | "uploading" | "done" | "error";
1808
- /** 上传文件的状态记录,包含唯一标识、文件名、原始文件和服务端响应。 */
1809
+ /** 文件记录;受控更新时应保持 uid 不变。 */
1809
1810
  interface UploadFile {
1810
- /** 文件的唯一标识。 */
1811
+ /** 列表中唯一的文件标识。 */
1811
1812
  uid: string;
1812
- /** 名称或字段标识。 */
1813
+ /** 显示文件名,不含目录。 */
1813
1814
  name: string;
1814
- /** 组件尺寸;用于调整控件高度、字号和间距。 */
1815
+ /** 文件大小,单位字节。 */
1815
1816
  size?: number;
1816
- /** 类型标识,用于选择对应的表现形式。 */
1817
+ /** MIME 类型,例如 image/png。 */
1817
1818
  type?: string;
1818
- /** 当前状态,用于选择对应的状态样式。 */
1819
+ /** 当前状态,缺省按 ready 展示。 */
1819
1820
  status?: UploadFileStatus;
1820
- /** 进度百分比。 */
1821
+ /** 上传百分比,范围 0–100。 */
1821
1822
  percent?: number;
1822
- /** 文件或资源的访问地址。 */
1823
+ /** 远程访问地址,用于预览和文件链接。 */
1823
1824
  url?: string;
1824
- /** 上传服务返回的响应数据。 */
1825
+ /** 缩略图地址,优先于本地缩略图;预览优先使用 url。 */
1826
+ thumbUrl?: string;
1827
+ /** 包含所选根目录的相对路径,例如 photos/trip/a.png;普通文件为文件名。 */
1828
+ relativePath?: string;
1829
+ /** 服务端成功响应;内置请求优先解析 JSON,否则保留文本。 */
1825
1830
  response?: unknown;
1826
- /** 错误信息或错误对象。 */
1831
+ /** 最近一次校验或上传错误。 */
1827
1832
  error?: unknown;
1828
- /** 上传前的原始 File 对象。 */
1833
+ /** 原始 File,用于本地预览与重试;beforeUpload 转换只影响当次请求。 */
1829
1834
  originFileObj?: File;
1830
1835
  }
1831
- /** UploadRequest的配置选项。 */
1836
+ /** 自定义上传参数,可用于 SDK、分片、断点续传或业务请求。 */
1832
1837
  interface UploadRequestOptions {
1833
- /** 当前操作涉及的文件。 */
1838
+ /** 已经 beforeUpload 转换的实际上传文件。 */
1834
1839
  file: File;
1835
- /** 文件名。 */
1840
+ /** 文件名,不是 multipart 字段名。 */
1836
1841
  filename: string;
1837
- /** 上传进度更新时调用。 */
1842
+ /** 本次上传的列表记录快照,uid 可关联业务任务。 */
1843
+ uploadFile: UploadFile;
1844
+ /** 相对路径;普通文件为文件名。 */
1845
+ relativePath: string;
1846
+ /** 取消、移除或卸载时中止;获取签名及分片请求也应监听此信号。 */
1847
+ signal: AbortSignal;
1848
+ /** 更新百分比 0–100;任务结束或取消后的回调会被忽略。 */
1838
1849
  onProgress: (percent: number) => void;
1839
- /** 上传成功时调用,接收响应数据。 */
1840
- onSuccess: (response?: unknown) => void;
1841
- /** 操作发生错误时调用,可用于显示业务错误提示。 */
1850
+ /** 上传完成时调用一次,保存 response;url 可指定访问地址。 */
1851
+ onSuccess: (response?: unknown, url?: string) => void;
1852
+ /** 失败时调用一次,保存错误并通知 onChange。 */
1842
1853
  onError: (error: unknown) => void;
1843
1854
  }
1844
- /** 文件上传的变更事件上下文。 */
1855
+ /** 上传取消句柄,与 signal 一起用于中止底层任务。 */
1856
+ interface UploadRequestHandle {
1857
+ /** 取消、移除或卸载时调用;应终止 SDK 或分片上传。 */
1858
+ abort?: () => void;
1859
+ }
1860
+ /** 通用 HTTP 上传配置,支持业务接口、OSS 签名表单和预签名 PUT。 */
1861
+ interface UploadHttpRequest {
1862
+ /** 上传地址;签名应由业务服务端生成。 */
1863
+ action: string;
1864
+ /** 请求方法,预签名二进制直传通常使用 PUT。 @defaultValue "POST" */
1865
+ method?: "POST" | "PUT" | "PATCH";
1866
+ /** form-data 为 multipart 表单,file 为 File 二进制。 @defaultValue "form-data" */
1867
+ body?: "form-data" | "file";
1868
+ /** multipart 文件字段名。 @defaultValue "file" */
1869
+ name?: string;
1870
+ /** multipart 额外字段,在文件之前添加,例如 key、policy、签名和令牌。 */
1871
+ data?: Readonly<Record<string, string | Blob>>;
1872
+ /** 自定义请求头,需与签名一致;multipart 不要手动设置 Content-Type。 */
1873
+ headers?: Readonly<Record<string, string>>;
1874
+ /** 是否携带跨域 Cookie。 @defaultValue false */
1875
+ withCredentials?: boolean;
1876
+ /** 超时毫秒数,0 为不设超时。 @defaultValue 0 */
1877
+ timeout?: number;
1878
+ /** 成功后写入文件记录的访问地址。 */
1879
+ url?: string;
1880
+ }
1881
+ /** 文件列表变化的上下文。 */
1845
1882
  interface UploadChangeInfo {
1846
- /** 当前操作涉及的文件。 */
1883
+ /** 本次变化的文件;移除时仍提供被移除的记录。 */
1847
1884
  file: UploadFile;
1848
- /** 受控的文件列表。 */
1885
+ /** 最新完整列表,受控模式需回填给 fileList。 */
1849
1886
  fileList: readonly UploadFile[];
1887
+ /** 触发原因:添加、开始、进度、成功、失败、移除或取消。 */
1888
+ event: "add" | "start" | "progress" | "success" | "error" | "remove" | "cancel";
1889
+ }
1890
+ /** 类型或数量限制拒绝的文件。 */
1891
+ interface UploadRejectInfo {
1892
+ /** 未加入列表的原始文件。 */
1893
+ file: File;
1894
+ /** accept 为类型不匹配,max-count 为达到数量上限。 */
1895
+ reason: "accept" | "max-count";
1850
1896
  }
1851
- /** 文件上传的属性配置。 */
1897
+ /** 自定义列表项可调用的操作,仍遵循禁用、取消和 onRemove 规则。 */
1898
+ interface UploadItemActions {
1899
+ /** 开始或重试当前文件;已上传成功或正在上传时不重复启动。 */
1900
+ upload: () => Promise<void>;
1901
+ /** 取消当前任务并回到 ready,保留文件。 */
1902
+ abort: () => void;
1903
+ /** 请求移除,等待 onRemove 允许后取消并删除。 */
1904
+ remove: () => Promise<void>;
1905
+ /** 触发自定义 onPreview,未提供时打开框架图片预览。 */
1906
+ preview: () => void;
1907
+ }
1908
+ /** Upload 的命令式句柄,适用于手动上传及业务工具栏。 */
1909
+ interface UploadRef {
1910
+ /** 开始 ready/error 文件;省略 uid 开始所有待上传项。Promise 在这些任务成功、失败或取消后完成,结果通过 onChange 通知。 */
1911
+ upload: (uid?: string) => Promise<void>;
1912
+ /** 取消指定文件,省略 uid 取消全部;保留记录为 ready,可再次 upload。 */
1913
+ abort: (uid?: string) => void;
1914
+ /** 请求移除指定文件;onRemove 拒绝时保留记录。 */
1915
+ remove: (uid: string) => Promise<void>;
1916
+ }
1917
+ /** 文件上传属性;未配置 request/customRequest 时仅选择文件,不模拟上传成功。 */
1852
1918
  interface UploadProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultValue" | "onChange"> {
1853
- /** 允许的文件类型,格式同原生 input accept。 */
1919
+ /** 扩展名或 MIME 类型,逗号分隔;点击、拖拽和粘贴均校验。 */
1854
1920
  accept?: string;
1855
- /**
1856
- 是否允许同时选择多个项目。
1857
- * @defaultValue false
1858
- */
1921
+ /** 每批是否允许多个文件;false 仅取首个,directory 模式不受此限制。 @defaultValue false */
1859
1922
  multiple?: boolean;
1860
- /**
1861
- * 是否允许选择文件夹。
1862
- * @defaultValue false
1863
- */
1923
+ /** 选择或拖入文件夹,文件路径保存在 relativePath;不会上传空目录。 @defaultValue false */
1864
1924
  directory?: boolean;
1865
- /**
1866
- * 是否禁用交互。
1867
- * @defaultValue false
1868
- */
1925
+ /** 是否包括子文件夹中的文件;false 仅处理根目录直接包含的文件。 @defaultValue true */
1926
+ recursive?: boolean;
1927
+ /** 聚焦本区域后允许粘贴文件或截图,不监听整个页面也不处理普通文本。 @defaultValue false */
1928
+ pastable?: boolean;
1929
+ /** 禁止添加、移除和启动上传;已在进行的请求不会自动取消。 @defaultValue false */
1869
1930
  disabled?: boolean;
1870
- /** 允许的最大文件数量。 */
1931
+ /** 添加后自动上传;false 为手动模式,调用 ref.upload 或自定义列表操作启动。 @defaultValue true */
1932
+ autoUpload?: boolean;
1933
+ /** 最大文件数量,包含等待及失败项;超出部分拒绝,不替换已有文件。默认不限。 */
1871
1934
  maxCount?: number;
1872
- /** 受控的文件列表。 */
1935
+ /** 受控列表,onChange 中回填;外部移除记录会取消关联请求。 */
1873
1936
  fileList?: readonly UploadFile[];
1874
- /**
1875
- * 非受控模式下的初始文件列表。
1876
- * @defaultValue []
1877
- */
1937
+ /** 非受控初始列表,后续修改不重置列表。 @defaultValue [] */
1878
1938
  defaultFileList?: readonly UploadFile[];
1879
- /**
1880
- * 上传文件列表的展示形式。
1881
- * @defaultValue "text"
1882
- */
1939
+ /** text 为文件列表,picture 为图片行,picture-card 为照片墙;照片墙满额隐藏添加入口。 @defaultValue "text" */
1883
1940
  listType?: "text" | "picture" | "picture-card";
1884
- /**
1885
- * 是否显示上传文件列表。
1886
- * @defaultValue true
1887
- */
1941
+ /** 是否显示列表;隐藏时仍执行数量限制和变更通知。 @defaultValue true */
1888
1942
  showUploadList?: boolean;
1889
- /** 上传前校验或转换文件 */
1890
- beforeUpload?: (file: File, fileList: readonly File[]) => boolean | File | typeof LIST_IGNORE | Promise<boolean | File | typeof LIST_IGNORE>;
1891
- /** 自定义上传实现 */
1892
- customRequest?: (options: UploadRequestOptions) => void | {
1893
- /** 取消当前上传请求。 */
1894
- abort?: () => void;
1895
- };
1896
- /** 值发生变化时调用;参数为新值及类型声明中列出的关联信息。 */
1943
+ /** 启动前校验,可异步;false 保留 ready,Upload.LIST_IGNORE 移除,File 转换本次上传内容;拒绝或抛错进入 error。手动上传时在调用 upload 后执行。 */
1944
+ beforeUpload?: (file: File, fileList: readonly File[]) => boolean | File | symbol | Promise<boolean | File | symbol>;
1945
+ /** HTTP 配置或逐文件异步签名函数,拒绝时进入 error;接收记录和取消信号。customRequest 优先。 */
1946
+ request?: UploadHttpRequest | ((file: UploadFile, signal: AbortSignal) => UploadHttpRequest | Promise<UploadHttpRequest>);
1947
+ /** 自定义上传,负责调用状态回调,可异步返回取消句柄;函数异常或 Promise 拒绝按失败处理。优先于 request。 */
1948
+ customRequest?: (options: UploadRequestOptions) => void | UploadRequestHandle | Promise<void | UploadRequestHandle>;
1949
+ /** 添加、开始、进度、完成、失败、取消和移除时调用;取消任务的迟到回调被忽略。 */
1897
1950
  onChange?: (info: UploadChangeInfo) => void;
1898
- /** 请求移除文件时调用;返回值控制是否允许移除。 */
1899
- onRemove?: (file: UploadFile) => boolean | Promise<boolean>;
1900
- /** 子内容;组件嵌套内容或当前节点的子项。 */
1951
+ /** 移除前调用;false 或 Promise 拒绝阻止移除,否则取消任务并删除。 */
1952
+ onRemove?: (file: UploadFile) => boolean | void | Promise<boolean | void>;
1953
+ /** 文件类型不匹配或数量超限时调用,该文件不进入列表。 */
1954
+ onReject?: (info: UploadRejectInfo) => void;
1955
+ /** 拖拽目录读取失败时调用,本次批次不上传。 */
1956
+ onReadError?: (error: unknown) => void;
1957
+ /** 点击预览时调用,提供后完全接管预览,可实现 PDF、视频或业务弹窗。 */
1958
+ onPreview?: (file: UploadFile) => void;
1959
+ /** 完全自定义列表项;接收默认节点、记录、最新列表及操作句柄,应自行提供可访问的按钮。 */
1960
+ itemRender?: (node: ReactNode, file: UploadFile, fileList: readonly UploadFile[], actions: UploadItemActions) => ReactNode;
1961
+ /** 上传按钮内容,不应嵌套其他交互控件;外层负责点击和键盘操作。 */
1901
1962
  children?: ReactNode;
1902
1963
  }
1903
- /** UploadDragger的属性配置。 */
1964
+ /** 拖拽区域继承全部 Upload 能力,ref 同样支持手动控制。 */
1904
1965
  interface UploadDraggerProps extends UploadProps {
1905
- /**
1906
- * 帮助或校验信息
1907
- * @defaultValue "支持单个或批量上传"
1908
- */
1966
+ /** 辅助说明文字。 @defaultValue "支持单个或批量上传" */
1909
1967
  hint?: ReactNode;
1910
1968
  }
1911
- declare function UploadRoot({ accept, multiple, directory, disabled, maxCount, fileList, defaultFileList, listType, showUploadList, beforeUpload, customRequest, onChange, onRemove, children, className, onDragOver, onDrop, ...props }: UploadProps): react.JSX.Element;
1912
- declare function UploadDragger({ hint, children, className, ...props }: UploadDraggerProps): react.JSX.Element;
1913
- /** 文件上传组件。 */
1914
- declare const Upload: typeof UploadRoot & {
1915
- /** 支持拖入文件上传的区域组件。 */
1916
- Dragger: typeof UploadDragger;
1917
- /** beforeUpload 返回此标记时忽略该文件,不加入上传列表。 */
1969
+
1970
+ /** 上传组件,支持图片列表、照片墙、目录、粘贴与完全受控请求;未配置请求时仅选择文件。 */
1971
+ declare const Upload: react.ForwardRefExoticComponent<UploadProps & react.RefAttributes<UploadRef>> & {
1972
+ /** 可点击、键盘操作和拖拽的上传区域,ref 支持手动上传、取消及移除。 */
1973
+ Dragger: react.ForwardRefExoticComponent<UploadDraggerProps & react.RefAttributes<UploadRef>>;
1974
+ /** beforeUpload 返回时移除该文件,不进行上传。 */
1918
1975
  LIST_IGNORE: symbol;
1919
1976
  };
1920
1977
 
@@ -2167,4 +2224,4 @@ declare const FloatButton: react.ForwardRefExoticComponent<FloatButtonProps & re
2167
2224
  BackTop: typeof FloatButtonBackTop;
2168
2225
  };
2169
2226
 
2170
- export { type MenuTheme as $, type FloatButtonGroupProps as A, type BadgeProps as B, Calendar as C, Dropdown as D, type FloatButtonProps as E, FILLED_ICON_NAMES as F, type FloatButtonShape as G, type FloatingPlacement as H, type FloatingTrigger as I, ICON_NAMES as J, Icon as K, type IconName as L, type IconProps as M, type IconVariant as N, Image as O, ImagePreview as P, type ImagePreviewConfig as Q, type ImagePreviewProps as R, type ImageProps as S, type TagStatus as T, Input as U, type InputProps as V, Menu as W, type MenuClickInfo as X, type MenuItem as Y, type MenuMode as Z, type MenuProps as _, Badge as a, type UploadRequestOptions as a$, type MessageConfig as a0, type MessageHandle as a1, type MessageKey as a2, type MessageType as a3, type NotificationConfig as a4, type NotificationPlacement as a5, type NotificationType as a6, Popconfirm as a7, type PopconfirmProps as a8, Popover as a9, Timeline as aA, type TimelineItem as aB, type TimelineProps as aC, Toolbar as aD, type ToolbarItem as aE, type ToolbarProps as aF, Tooltip as aG, type TooltipProps as aH, Tour as aI, type TourProps as aJ, type TourStep as aK, Tree as aL, type TreeDropPosition as aM, type TreeKey as aN, type TreeNode as aO, type TreeProps as aP, Typography as aQ, type TypographyLinkProps as aR, type TypographyProps as aS, type TypographyTitleProps as aT, type TypographyType as aU, Upload as aV, type UploadChangeInfo as aW, type UploadDraggerProps as aX, type UploadFile as aY, type UploadFileStatus as aZ, type UploadProps as a_, type PopoverProps as aa, Progress as ab, type ProgressProps as ac, type ProgressStatus as ad, Rate as ae, type RateProps as af, Segmented as ag, type SegmentedOption as ah, type SegmentedProps as ai, type SegmentedValue as aj, Spin as ak, type SpinProps as al, type StepItem as am, type StepStatus as an, Steps as ao, type StepsProps as ap, type TabItem as aq, Tabs as ar, type TabsContextMenuClickInfo as as, type TabsOrientation as at, type TabsPosition as au, type TabsProps as av, type TabsType as aw, Tag as ax, type TagProps as ay, type TagVariant as az, type BadgeRibbonProps as b, Watermark as b0, type WatermarkFont as b1, type WatermarkProps as b2, message as b3, notification as b4, type BadgeStatus as c, Breadcrumb as d, type BreadcrumbItem as e, type BreadcrumbProps as f, type CalendarProps as g, Card as h, type CardAccent as i, type CardProps as j, Carousel as k, type CarouselProps as l, type CarouselRef as m, Collapse as n, type CollapseItem as o, type CollapseKey as p, type CollapseProps as q, type DropdownButtonProps as r, type DropdownMenuProps as s, type DropdownOpenSource as t, type DropdownPlacement as u, type DropdownProps as v, type DropdownTrigger as w, type FilledIconName as x, FloatButton as y, type FloatButtonBackTopProps as z };
2227
+ export { type MenuTheme as $, type FloatButtonGroupProps as A, type BadgeProps as B, Calendar as C, Dropdown as D, type FloatButtonProps as E, FILLED_ICON_NAMES as F, type FloatButtonShape as G, type FloatingPlacement as H, type FloatingTrigger as I, ICON_NAMES as J, Icon as K, type IconName as L, type IconProps as M, type IconVariant as N, Image as O, ImagePreview as P, type ImagePreviewConfig as Q, type ImagePreviewProps as R, type ImageProps as S, type TagStatus as T, Input as U, type InputProps as V, Menu as W, type MenuClickInfo as X, type MenuItem as Y, type MenuMode as Z, type MenuProps as _, Badge as a, type UploadItemActions as a$, type MessageConfig as a0, type MessageHandle as a1, type MessageKey as a2, type MessageType as a3, type NotificationConfig as a4, type NotificationPlacement as a5, type NotificationType as a6, Popconfirm as a7, type PopconfirmProps as a8, Popover as a9, Timeline as aA, type TimelineItem as aB, type TimelineProps as aC, Toolbar as aD, type ToolbarItem as aE, type ToolbarProps as aF, Tooltip as aG, type TooltipProps as aH, Tour as aI, type TourProps as aJ, type TourStep as aK, Tree as aL, type TreeDropPosition as aM, type TreeKey as aN, type TreeNode as aO, type TreeProps as aP, Typography as aQ, type TypographyLinkProps as aR, type TypographyProps as aS, type TypographyTitleProps as aT, type TypographyType as aU, Upload as aV, type UploadChangeInfo as aW, type UploadDraggerProps as aX, type UploadFile as aY, type UploadFileStatus as aZ, type UploadHttpRequest as a_, type PopoverProps as aa, Progress as ab, type ProgressProps as ac, type ProgressStatus as ad, Rate as ae, type RateProps as af, Segmented as ag, type SegmentedOption as ah, type SegmentedProps as ai, type SegmentedValue as aj, Spin as ak, type SpinProps as al, type StepItem as am, type StepStatus as an, Steps as ao, type StepsProps as ap, type TabItem as aq, Tabs as ar, type TabsContextMenuClickInfo as as, type TabsOrientation as at, type TabsPosition as au, type TabsProps as av, type TabsType as aw, Tag as ax, type TagProps as ay, type TagVariant as az, type BadgeRibbonProps as b, type UploadProps as b0, type UploadRef as b1, type UploadRejectInfo as b2, type UploadRequestHandle as b3, type UploadRequestOptions as b4, Watermark as b5, type WatermarkFont as b6, type WatermarkProps as b7, message as b8, notification as b9, type BadgeStatus as c, Breadcrumb as d, type BreadcrumbItem as e, type BreadcrumbProps as f, type CalendarProps as g, Card as h, type CardAccent as i, type CardProps as j, Carousel as k, type CarouselProps as l, type CarouselRef as m, Collapse as n, type CollapseItem as o, type CollapseKey as p, type CollapseProps as q, type DropdownButtonProps as r, type DropdownMenuProps as s, type DropdownOpenSource as t, type DropdownPlacement as u, type DropdownProps as v, type DropdownTrigger as w, type FilledIconName as x, FloatButton as y, type FloatButtonBackTopProps as z };