@aloudata/aloudata-design 3.0.11 → 3.0.13

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 (43) hide show
  1. package/dist/Checkbox/index.js +2 -1
  2. package/dist/Checkbox/index.js.map +1 -1
  3. package/dist/Checkbox/type.d.ts +1 -0
  4. package/dist/DataPreviewTable/index.js +51 -47
  5. package/dist/DataPreviewTable/index.js.map +1 -1
  6. package/dist/Drawer/index.d.ts +1 -0
  7. package/dist/Drawer/index.js +2 -2
  8. package/dist/Drawer/index.js.map +1 -1
  9. package/dist/Dropdown/index.js +86 -12
  10. package/dist/Dropdown/index.js.map +1 -1
  11. package/dist/Form/index.d.ts +12 -21
  12. package/dist/Form/index.js +2 -1
  13. package/dist/Form/index.js.map +1 -1
  14. package/dist/Input/components/Input/index.d.ts +1 -1
  15. package/dist/Input/components/Input/index.js +3 -2
  16. package/dist/Input/components/Input/index.js.map +1 -1
  17. package/dist/Input/components/Password/index.d.ts +3 -2
  18. package/dist/Input/components/Password/index.js +2 -2
  19. package/dist/Input/components/Password/index.js.map +1 -1
  20. package/dist/Input/components/TextArea/index.d.ts +1 -1
  21. package/dist/Input/components/TextArea/index.js +5 -1
  22. package/dist/Input/components/TextArea/index.js.map +1 -1
  23. package/dist/Popconfirm/index.d.ts +2 -0
  24. package/dist/Popconfirm/index.js +61 -36
  25. package/dist/Popconfirm/index.js.map +1 -1
  26. package/dist/Popover/index.d.ts +6 -0
  27. package/dist/Popover/index.js +33 -3
  28. package/dist/Popover/index.js.map +1 -1
  29. package/dist/Select/BaseSelect.js +40 -3
  30. package/dist/Select/BaseSelect.js.map +1 -1
  31. package/dist/Select/interface.d.ts +1 -1
  32. package/dist/Tabs/index.d.ts +1 -0
  33. package/dist/Tabs/index.js +16 -6
  34. package/dist/Tabs/index.js.map +1 -1
  35. package/dist/Tree/Tree2.js +17 -5
  36. package/dist/Tree/Tree2.js.map +1 -1
  37. package/dist/Typography/index.d.ts +10 -7
  38. package/dist/Typography/index.js +38 -15
  39. package/dist/Typography/index.js.map +1 -1
  40. package/dist/Upload/index.d.ts +1 -1
  41. package/dist/Upload/index.js.map +1 -1
  42. package/dist/aloudata-design.css +1 -1
  43. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Tree2.js","names":[],"sources":["../../src/Tree/Tree.tsx"],"sourcesContent":["import './tree.css';\nimport { cn } from '../lib/utils';\nimport { produce } from 'immer';\nimport { noop } from 'lodash';\nimport type { BasicDataNode, TreeProps as RcTreeProps } from 'rc-tree';\nimport RcTree from 'rc-tree';\nimport type { DataNode, Key } from 'rc-tree/es/interface';\nimport * as React from 'react';\nimport { ConfigContext } from '../ConfigProvider';\nimport HighlightText from '../HighlightText';\nimport { ArrowRightLightLine, DragLine } from '../Icon';\nimport collapseMotion from '../_utils/motion';\nimport { LocaleContext, getTranslator } from '../locale/default';\nimport { composeAllowDrop } from './utils/composeAllowDrop';\nimport dropIndicatorRender from './utils/dropIndicator';\nimport renderSwitcherIcon from './utils/iconUtil';\nconst TREE_SWITCH_CION_SIZE = 16;\nconst NODE_DISABLE_CLASS_NAME = 'ald-tree-node-disabled';\nexport type SwitcherIcon =\n | React.ReactNode\n | ((props: AldTreeNodeProps) => React.ReactNode);\nexport type TreeLeafIcon =\n | React.ReactNode\n | ((props: AldTreeNodeProps) => React.ReactNode);\n\nexport interface AldTreeNodeAttribute {\n eventKey: string;\n prefixCls: string;\n className: string;\n expanded: boolean;\n selected: boolean;\n checked: boolean;\n halfChecked: boolean;\n children: React.ReactNode;\n title: React.ReactNode;\n pos: string;\n dragOver: boolean;\n dragOverGapTop: boolean;\n dragOverGapBottom: boolean;\n isLeaf: boolean;\n selectable: boolean;\n disabled: boolean;\n disableCheckbox: boolean;\n}\n\nexport interface AldTreeNodeProps {\n className?: string;\n checkable?: boolean;\n disabled?: boolean;\n disableCheckbox?: boolean;\n title?: string | React.ReactNode;\n key?: Key;\n eventKey?: string;\n isLeaf?: boolean;\n checked?: boolean;\n expanded?: boolean;\n loading?: boolean;\n selected?: boolean;\n selectable?: boolean;\n icon?:\n | ((treeNode: AldTreeNodeAttribute) => React.ReactNode)\n | React.ReactNode;\n children?: React.ReactNode;\n [customProp: string]: any;\n}\n\nexport type AldTreeNode = React.Component<AldTreeNodeProps, object>;\n\nexport interface AldTreeNodeBaseEvent {\n node: AldTreeNode;\n nativeEvent: MouseEvent;\n}\n\nexport interface AldTreeNodeCheckedEvent extends AldTreeNodeBaseEvent {\n event: 'check';\n checked?: boolean;\n checkedNodes?: AldTreeNode[];\n}\n\nexport interface AldTreeNodeSelectedEvent extends AldTreeNodeBaseEvent {\n event: 'select';\n selected?: boolean;\n selectedNodes?: DataNode[];\n}\n\nexport interface AldTreeNodeExpandedEvent extends AldTreeNodeBaseEvent {\n expanded?: boolean;\n}\n\nexport interface AldTreeNodeMouseEvent {\n node: AldTreeNode;\n event: React.DragEvent<HTMLElement>;\n}\n\nexport interface AldTreeNodeDragEnterEvent extends AldTreeNodeMouseEvent {\n expandedKeys: Key[];\n}\n\nexport interface AldTreeNodeAttribute {\n node: AldTreeNode;\n dragNode: AldTreeNode;\n dragNodesKeys: Key[];\n dropPosition: number;\n dropToGap?: boolean;\n event: React.MouseEvent<HTMLElement>;\n}\n\n// [Legacy] Compatible for v3\nexport type TreeNodeNormal = DataNode;\n\ntype DraggableFn = (node: DataNode) => boolean;\n\ninterface DropOnlyResolvers {\n nodeDraggable: DraggableFn | undefined;\n nodeDroppable: DraggableFn;\n}\n\ninterface DraggableConfig {\n icon?: React.ReactNode | false;\n /** 节点是否可作为 drag source(拖起来)。返回 false:不显示 drag handle、不能起拖。 */\n nodeDraggable?: DraggableFn;\n /**\n * 节点是否可作为 drop target(接收落入)。返回 true:即使 nodeDraggable=false 仍注册\n * onDragOver/onDrop 等 listener,浏览器才会真正派发 drop 事件。\n *\n * 解决 rc-tree 5.x 把\"可拖\"与\"可放\"绑到同一个 nodeDraggable 的限制——之前要让\"类目可接收\n * 资源拖入但本身不可拖\"只能让 nodeDraggable 全返回 true,再用业务侧 CSS hack 隐藏 drag icon。\n *\n * 默认不传 = 沿用 nodeDraggable 行为(向后兼容)。\n */\n nodeDroppable?: DraggableFn;\n}\n\nexport interface TreeProps<T extends BasicDataNode = DataNode>\n extends Omit<\n RcTreeProps<T>,\n | 'prefixCls'\n | 'showLine'\n | 'direction'\n | 'draggable'\n | 'icon'\n | 'switcherIcon'\n | 'filterTreeNode'\n > {\n showLine?: boolean | { showLeafIcon: boolean | TreeLeafIcon };\n className?: string;\n /** 是否支持多选 */\n multiple?: boolean;\n /** 是否自动展开父节点 */\n autoExpandParent?: boolean;\n /** Checkable状态下节点选择完全受控(父子节点选中状态不再关联) */\n checkStrictly?: boolean;\n /** 是否支持选中 */\n checkable?: boolean;\n /** 是否禁用树 */\n disabled?: boolean;\n /** 默认展开所有树节点 */\n defaultExpandAll?: boolean;\n /** 默认展开对应树节点 */\n defaultExpandParent?: boolean;\n /** 默认展开指定的树节点 */\n defaultExpandedKeys?: Key[];\n /** (受控)展开指定的树节点 */\n expandedKeys?: Key[];\n /** (受控)选中复选框的树节点 */\n checkedKeys?: Key[] | { checked: Key[]; halfChecked: Key[] };\n /** 默认选中复选框的树节点 */\n defaultCheckedKeys?: Key[];\n /** (受控)设置选中的树节点 */\n selectedKeys?: Key[];\n /** 默认选中的树节点 */\n defaultSelectedKeys?: Key[];\n selectable?: boolean;\n /** 点击树节点触发 */\n filterTreeNode?: (node: DataNode) => boolean;\n loadedKeys?: Key[];\n /** 设置节点可拖拽(IE>8) */\n draggable?: DraggableFn | boolean | DraggableConfig;\n style?: React.CSSProperties;\n showIcon?: boolean;\n icon?:\n | ((nodeProps: AldTreeNodeAttribute) => React.ReactNode)\n | React.ReactNode\n | RcTreeProps<T>['icon'];\n switcherIcon?: SwitcherIcon | RcTreeProps<T>['switcherIcon'];\n prefixCls?: string;\n children?: React.ReactNode;\n blockNode?: boolean;\n size?: 'large' | 'small';\n titleRender?: (node: T) => React.ReactNode;\n showTabLeader?: boolean;\n handlerRender?: (node: T) => React.ReactNode;\n highlightKeywords?: string;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst Tree = React.forwardRef<any, TreeProps>((props, ref) => {\n const { locale } = React.useContext(LocaleContext);\n const t = getTranslator(locale);\n\n const { getPrefixCls, direction, virtual } = React.useContext(ConfigContext);\n const size = props.size || 'large';\n const {\n className,\n showIcon = false,\n showLine,\n blockNode = false,\n children,\n checkable = false,\n selectable = true,\n draggable,\n titleRender,\n showTabLeader,\n handlerRender = noop,\n filterTreeNode,\n treeData,\n highlightKeywords,\n motion = { ...collapseMotion, motionAppear: false },\n ...rest\n } = props;\n const prefixCls = getPrefixCls('tree', 'ald-tree');\n\n const customTitleRender = React.useCallback(\n (node: DataNode) => {\n const renderedTitle = titleRender\n ? titleRender(node)\n : typeof node.title === 'function'\n ? node.title(node)\n : node.title;\n return (\n <>\n {renderedTitle}\n {showTabLeader && <div className=\"ald-tree-tab-leader\"></div>}\n {handlerRender && (handlerRender(node) as React.ReactNode)}\n </>\n );\n },\n [titleRender, showTabLeader, handlerRender],\n );\n const newProps = {\n ...rest,\n checkable,\n selectable,\n showIcon,\n motion,\n blockNode,\n showLine: Boolean(showLine),\n dropIndicatorRender,\n titleRender: customTitleRender,\n };\n\n // 一次性吃掉 draggable 的归一化:rc-tree 看到的 mergedDraggable + 我们内部用的\n // dropOnlyResolvers(原样保留用户 nodeDraggable/nodeDroppable)。集中一处避免两处 useMemo\n // 的判断散开导致字段扩展时遗漏。\n const { draggableConfig, dropOnlyResolvers } = React.useMemo(() => {\n if (!draggable) {\n return {\n draggableConfig: false as const,\n dropOnlyResolvers: null as DropOnlyResolvers | null,\n };\n }\n const newIcon = (\n <DragLine\n size={TREE_SWITCH_CION_SIZE}\n color={'var(--alias-colors-icon-subtle)'}\n ></DragLine>\n );\n let mergedDraggable: DraggableConfig = { icon: newIcon };\n switch (typeof draggable) {\n case 'function':\n mergedDraggable.nodeDraggable = draggable;\n break;\n case 'object':\n mergedDraggable = {\n ...draggable,\n icon: draggable.icon === undefined ? newIcon : draggable.icon,\n };\n break;\n default:\n break;\n }\n\n // rc-tree 5.x 把\"可拖(drag source)\"与\"可放(drop target)\"绑到同一个 nodeDraggable:\n // 该返回 false 时 onDragOver/onDrop 也连带不注册,浏览器认为该节点 not droppable\n // → drop 事件根本不派发。为了让\"类目可接收资源拖入但本身不可拖\",把 rc-tree 看到的\n // nodeDraggable 改成 nodeDraggable || nodeDroppable,从而保证 drop listener 仍注册。\n // 真正的 drag-source 阻断由 document 级 dragstart capture handler 负责(见下方 effect)。\n let resolvers: DropOnlyResolvers | null = null;\n if (mergedDraggable.nodeDroppable) {\n const userNodeDraggable = mergedDraggable.nodeDraggable;\n const userNodeDroppable = mergedDraggable.nodeDroppable;\n resolvers = {\n nodeDraggable: userNodeDraggable,\n nodeDroppable: userNodeDroppable,\n };\n mergedDraggable = {\n ...mergedDraggable,\n nodeDraggable: (node: DataNode) =>\n (userNodeDraggable ? userNodeDraggable(node) : true) ||\n userNodeDroppable(node),\n };\n }\n\n return { draggableConfig: mergedDraggable, dropOnlyResolvers: resolvers };\n }, [draggable]);\n\n /**\n * drop-only 节点不能真的起拖。\n *\n * 历史教训:以前在 props.onDragStart 里调 preventDefault。问题是 rc-tree 内部\n * onNodeDragStart(Tree.js:88-99)会在调用 user onDragStart **之前**把\n * draggingNodeKey/dragNodeProps 写进 state;TreeNode(TreeNode.js:112)也已经先\n * setDragNodeHighlight(true)。然后 preventDefault 让浏览器取消拖拽,dragend 不再派发\n * → onWindowDragEnd 永远不触发 → state 卡在\"正在拖类目\",外层 .ald-tree-treenode\n * 卡着 `dragging`、内层 .ald-tree-node-content-wrapper 卡着 `ald-tree-node-selected`\n * 高亮,直到下一次合法 dragstart 才被覆盖。\n *\n * 修复手段:document 级 dragstart capture handler,在 rc-tree 的 React 监听器之前\n * stopPropagation+preventDefault,让 TreeNode 的 onDragStart 整段都不执行,rc-tree\n * 内部 state 彻底不写入。document 是 React root 容器的祖先,capture 阶段先于 React\n * delegation 监听器,因此 stopPropagation 能彻底拦截。\n */\n React.useLayoutEffect(() => {\n if (!dropOnlyResolvers) return;\n const handler = (e: DragEvent) => {\n const target = e.target as HTMLElement | null;\n if (!target?.closest) return;\n if (target.closest('.ald-tree-treenode-drop-only')) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n document.addEventListener('dragstart', handler, true);\n return () => document.removeEventListener('dragstart', handler, true);\n }, [dropOnlyResolvers]);\n\n /**\n * nodeDroppable 同时收口到 rc-tree 的 allowDrop:避免出现\"nodeDroppable=false 但 rc-tree\n * 默认 allowDrop=()=>true 仍然接收 drop\"的语义裂缝。用户自传的 allowDrop 与 nodeDroppable\n * 取 AND(任一拒绝即拒绝)。\n */\n const composedAllowDrop = React.useMemo(\n () => composeAllowDrop(rest.allowDrop, dropOnlyResolvers?.nodeDroppable),\n [rest.allowDrop, dropOnlyResolvers],\n );\n const renderIndent = (nodeProps: AldTreeNodeProps) => {\n const { pos } = nodeProps as AldTreeNodeProps & { pos?: string };\n // rc-tree `pos` 格式:\"0\" 是虚拟根,\"0-0\" 是首层节点,\"0-0-1\" 是 leaf。\n // 顶层节点 level=0 不缩进;每层 +1 unit(switcher 宽度),与 antd Tree 行为一致。\n // 不再为 leaf 额外补 switcher 宽度——leaf 自身的 switcher-noop 已经占位,\n // 旧公式 `isLeaf + level * (iconSize/2)` 会让 leaf 比同级 group 视觉额外右移半个 unit。\n // `?? 2` 兜底:当 pos 缺失时按\"首层节点 `0-0` 长度 = 2\"处理,结果 level=0 不缩进;\n // 切勿改成 1 或 0,否则缺 pos 的节点会被错误右移。\n const level = Math.max(0, (pos?.split('-').length ?? 2) - 2);\n return (\n <span\n style={{ width: level * TREE_SWITCH_CION_SIZE, flexShrink: 0 }}\n ></span>\n );\n };\n const newTreeData = React.useMemo(() => {\n if (!filterTreeNode || !treeData) return treeData;\n\n const shouldNodeDisabled = (node: DataNode): boolean => {\n // 初始化一个标志来表示是否需要为当前节点添加className\n let shouldAddDisabled = true;\n if (filterTreeNode(node)) {\n shouldAddDisabled = false;\n }\n\n if (node.children) {\n // 遍历当前节点的子节点,只要有一个子节点不disable,则该不需要添加className\n const allChildrenShouldAddDisabled = node.children.reduce(\n (pre, child) => {\n return shouldNodeDisabled(child) && pre;\n },\n shouldAddDisabled,\n );\n shouldAddDisabled = allChildrenShouldAddDisabled;\n }\n\n // 如果shouldAddDisabled为true,就为当前节点添加className\n if (shouldAddDisabled) {\n node.className = node.className?.includes(NODE_DISABLE_CLASS_NAME)\n ? node.className\n : cn(node.className, NODE_DISABLE_CLASS_NAME);\n } else {\n const reg = /ald-tree-node-disabled/g;\n node.className?.replace(reg, ' ');\n }\n if (highlightKeywords && typeof node.title !== 'function') {\n node.title = (\n <HighlightText keyword={highlightKeywords}>\n {node.title}\n </HighlightText>\n );\n }\n return shouldAddDisabled;\n };\n const newTreeData = produce(treeData, (draft) => {\n for (const rootNode of draft) {\n shouldNodeDisabled(rootNode);\n }\n });\n return newTreeData;\n }, [filterTreeNode, treeData, highlightKeywords]);\n\n /** 给 drop-only 节点的 wrapper 加 'ald-tree-treenode-drop-only' className(rc-tree 5.x\n * 会把 DataNode.className 透传到 .ald-tree-treenode 上)。css 据此隐藏 drag handle icon\n * 并提供 not-allowed cursor,区分纯 drop target 与真正可拖节点。 */\n const finalTreeData = React.useMemo(() => {\n if (!dropOnlyResolvers || !newTreeData) return newTreeData;\n const { nodeDraggable, nodeDroppable } = dropOnlyResolvers;\n return produce(newTreeData, (draft) => {\n const visit = (nodes: DataNode[] | undefined) => {\n if (!nodes) return;\n for (const node of nodes) {\n const isDraggable = nodeDraggable ? nodeDraggable(node) : true;\n const isDroppable = nodeDroppable(node);\n if (!isDraggable && isDroppable) {\n const existing = node.className ?? '';\n if (!existing.includes('ald-tree-treenode-drop-only')) {\n node.className = cn(existing, 'ald-tree-treenode-drop-only');\n }\n }\n visit(node.children as DataNode[] | undefined);\n }\n };\n visit(draft as DataNode[]);\n });\n }, [newTreeData, dropOnlyResolvers]);\n\n const noChildren = React.useMemo(() => {\n if (finalTreeData?.length) {\n return finalTreeData.every((node) => {\n return !node.children?.length && node.isLeaf !== false;\n });\n }\n return true;\n }, [finalTreeData]);\n\n return (\n <RcTree\n itemHeight={20}\n ref={ref}\n virtual={virtual}\n {...newProps}\n allowDrop={composedAllowDrop}\n prefixCls={prefixCls}\n treeData={finalTreeData}\n className={cn(\n {\n [`${prefixCls}-icon-hide`]: !showIcon,\n [`${prefixCls}-block-node`]: blockNode,\n [`${prefixCls}-unselectable`]: !selectable,\n [`${prefixCls}-large`]: size === 'large',\n [`${prefixCls}-rtl`]: direction === 'rtl',\n ['ald-draggable-tree']: draggable,\n [`${prefixCls}-no-children`]: noChildren,\n },\n // antd 兼容:保留 ant-* class,消费方 CSS 可能依赖该选择器\n 'ant-tree',\n className,\n )}\n direction={direction as any}\n checkable={\n checkable ? (\n <span className={`${prefixCls}-checkbox-inner`} />\n ) : (\n checkable\n )\n }\n selectable={selectable}\n // @ts-ignore\n switcherIcon={(nodeProps: AldTreeNodeProps) => {\n return (\n <>\n {renderIndent(nodeProps)}\n {renderSwitcherIcon(\n prefixCls,\n <ArrowRightLightLine\n size={TREE_SWITCH_CION_SIZE}\n color={'var(--alias-colors-icon-subtle)'}\n >\n {t.Tree.expand}\n </ArrowRightLightLine>,\n showLine,\n nodeProps,\n TREE_SWITCH_CION_SIZE,\n )}\n </>\n );\n }}\n draggable={draggableConfig}\n >\n {children}\n </RcTree>\n );\n});\n\nexport default Tree;\n"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,IAAM,wBAAwB;AAC9B,IAAM,0BAA0B;AAmLhC,IAAM,OAAO,QAAM,YAA4B,OAAO,QAAQ;CAC5D,MAAM,EAAE,WAAW,QAAM,WAAW,cAAc;CAClD,MAAM,IAAI,cAAc,OAAO;CAE/B,MAAM,EAAE,cAAc,WAAW,YAAY,QAAM,WAAW,cAAc;CAC5E,MAAM,OAAO,MAAM,QAAQ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,kBAAoB,CAAA,GAElD;EAGQ;EAEZ,eAAe,cAAgC;AAC7C,UACE,qBAAA,UAAA,EAAA,UAAA,CACG,aAAa,UAAU,EACvB,mBACC,WACA,oBAAC,MAAD;IACE,MAAM;IACN,OAAO;cAEN,EAAE,KAAK;IACY,CAAA,EACtB,UACA,WACA,sBACD,CACA,EAAA,CAAA;;EAGP,WAAW;EAEV;EACM,CAAA;EAEX"}
1
+ {"version":3,"file":"Tree2.js","names":[],"sources":["../../src/Tree/Tree.tsx"],"sourcesContent":["import './tree.css';\nimport { cn } from '../lib/utils';\nimport { produce } from 'immer';\nimport { noop } from 'lodash';\nimport type { BasicDataNode, TreeProps as RcTreeProps } from 'rc-tree';\nimport RcTree from 'rc-tree';\nimport type { DataNode, Key } from 'rc-tree/es/interface';\nimport * as React from 'react';\nimport { ConfigContext } from '../ConfigProvider';\nimport HighlightText from '../HighlightText';\nimport { ArrowRightLightLine, DragLine } from '../Icon';\nimport collapseMotion from '../_utils/motion';\nimport { LocaleContext, getTranslator } from '../locale/default';\nimport { composeAllowDrop } from './utils/composeAllowDrop';\nimport dropIndicatorRender from './utils/dropIndicator';\nimport renderSwitcherIcon from './utils/iconUtil';\nconst TREE_SWITCH_CION_SIZE = 16;\nconst NODE_DISABLE_CLASS_NAME = 'ald-tree-node-disabled';\nexport type SwitcherIcon =\n | React.ReactNode\n | ((props: AldTreeNodeProps) => React.ReactNode);\nexport type TreeLeafIcon =\n | React.ReactNode\n | ((props: AldTreeNodeProps) => React.ReactNode);\n\nexport interface AldTreeNodeAttribute {\n eventKey: string;\n prefixCls: string;\n className: string;\n expanded: boolean;\n selected: boolean;\n checked: boolean;\n halfChecked: boolean;\n children: React.ReactNode;\n title: React.ReactNode;\n pos: string;\n dragOver: boolean;\n dragOverGapTop: boolean;\n dragOverGapBottom: boolean;\n isLeaf: boolean;\n selectable: boolean;\n disabled: boolean;\n disableCheckbox: boolean;\n}\n\nexport interface AldTreeNodeProps {\n className?: string;\n checkable?: boolean;\n disabled?: boolean;\n disableCheckbox?: boolean;\n title?: string | React.ReactNode;\n key?: Key;\n eventKey?: string;\n isLeaf?: boolean;\n checked?: boolean;\n expanded?: boolean;\n loading?: boolean;\n selected?: boolean;\n selectable?: boolean;\n icon?:\n | ((treeNode: AldTreeNodeAttribute) => React.ReactNode)\n | React.ReactNode;\n children?: React.ReactNode;\n [customProp: string]: any;\n}\n\nexport type AldTreeNode = React.Component<AldTreeNodeProps, object>;\n\nexport interface AldTreeNodeBaseEvent {\n node: AldTreeNode;\n nativeEvent: MouseEvent;\n}\n\nexport interface AldTreeNodeCheckedEvent extends AldTreeNodeBaseEvent {\n event: 'check';\n checked?: boolean;\n checkedNodes?: AldTreeNode[];\n}\n\nexport interface AldTreeNodeSelectedEvent extends AldTreeNodeBaseEvent {\n event: 'select';\n selected?: boolean;\n selectedNodes?: DataNode[];\n}\n\nexport interface AldTreeNodeExpandedEvent extends AldTreeNodeBaseEvent {\n expanded?: boolean;\n}\n\nexport interface AldTreeNodeMouseEvent {\n node: AldTreeNode;\n event: React.DragEvent<HTMLElement>;\n}\n\nexport interface AldTreeNodeDragEnterEvent extends AldTreeNodeMouseEvent {\n expandedKeys: Key[];\n}\n\nexport interface AldTreeNodeAttribute {\n node: AldTreeNode;\n dragNode: AldTreeNode;\n dragNodesKeys: Key[];\n dropPosition: number;\n dropToGap?: boolean;\n event: React.MouseEvent<HTMLElement>;\n}\n\n// [Legacy] Compatible for v3\nexport type TreeNodeNormal = DataNode;\n\ntype DraggableFn = (node: DataNode) => boolean;\n\ninterface DropOnlyResolvers {\n nodeDraggable: DraggableFn | undefined;\n nodeDroppable: DraggableFn;\n}\n\ninterface DraggableConfig {\n icon?: React.ReactNode | false;\n /** 节点是否可作为 drag source(拖起来)。返回 false:不显示 drag handle、不能起拖。 */\n nodeDraggable?: DraggableFn;\n /**\n * 节点是否可作为 drop target(接收落入)。返回 true:即使 nodeDraggable=false 仍注册\n * onDragOver/onDrop 等 listener,浏览器才会真正派发 drop 事件。\n *\n * 解决 rc-tree 5.x 把\"可拖\"与\"可放\"绑到同一个 nodeDraggable 的限制——之前要让\"类目可接收\n * 资源拖入但本身不可拖\"只能让 nodeDraggable 全返回 true,再用业务侧 CSS hack 隐藏 drag icon。\n *\n * 默认不传 = 沿用 nodeDraggable 行为(向后兼容)。\n */\n nodeDroppable?: DraggableFn;\n}\n\nexport interface TreeProps<T extends BasicDataNode = DataNode>\n extends Omit<\n RcTreeProps<T>,\n | 'prefixCls'\n | 'showLine'\n | 'direction'\n | 'draggable'\n | 'icon'\n | 'switcherIcon'\n | 'filterTreeNode'\n > {\n showLine?: boolean | { showLeafIcon: boolean | TreeLeafIcon };\n className?: string;\n /** 是否支持多选 */\n multiple?: boolean;\n /** 是否自动展开父节点 */\n autoExpandParent?: boolean;\n /** Checkable状态下节点选择完全受控(父子节点选中状态不再关联) */\n checkStrictly?: boolean;\n /** 是否支持选中 */\n checkable?: boolean;\n /** 是否禁用树 */\n disabled?: boolean;\n /** 默认展开所有树节点 */\n defaultExpandAll?: boolean;\n /** 默认展开对应树节点 */\n defaultExpandParent?: boolean;\n /** 默认展开指定的树节点 */\n defaultExpandedKeys?: Key[];\n /** (受控)展开指定的树节点 */\n expandedKeys?: Key[];\n /** (受控)选中复选框的树节点 */\n checkedKeys?: Key[] | { checked: Key[]; halfChecked: Key[] };\n /** 默认选中复选框的树节点 */\n defaultCheckedKeys?: Key[];\n /** (受控)设置选中的树节点 */\n selectedKeys?: Key[];\n /** 默认选中的树节点 */\n defaultSelectedKeys?: Key[];\n selectable?: boolean;\n /** 点击树节点触发 */\n filterTreeNode?: (node: DataNode) => boolean;\n loadedKeys?: Key[];\n /** 设置节点可拖拽(IE>8) */\n draggable?: DraggableFn | boolean | DraggableConfig;\n style?: React.CSSProperties;\n showIcon?: boolean;\n icon?:\n | ((nodeProps: AldTreeNodeAttribute) => React.ReactNode)\n | React.ReactNode\n | RcTreeProps<T>['icon'];\n switcherIcon?: SwitcherIcon | RcTreeProps<T>['switcherIcon'];\n prefixCls?: string;\n children?: React.ReactNode;\n blockNode?: boolean;\n size?: 'large' | 'small';\n titleRender?: (node: T) => React.ReactNode;\n showTabLeader?: boolean;\n handlerRender?: (node: T) => React.ReactNode;\n highlightKeywords?: string;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst Tree = React.forwardRef<any, TreeProps>((props, ref) => {\n const { locale } = React.useContext(LocaleContext);\n const t = getTranslator(locale);\n\n const { getPrefixCls, direction, virtual } = React.useContext(ConfigContext);\n const size = props.size || 'large';\n const {\n className,\n showIcon = false,\n showLine,\n blockNode = false,\n children,\n checkable = false,\n selectable = true,\n draggable,\n titleRender,\n showTabLeader,\n handlerRender = noop,\n filterTreeNode,\n treeData,\n highlightKeywords,\n motion = { ...collapseMotion, motionAppear: false },\n ...rest\n } = props;\n const prefixCls = getPrefixCls('tree', 'ald-tree');\n\n const customTitleRender = React.useCallback(\n (node: DataNode) => {\n const renderedTitle = titleRender\n ? titleRender(node)\n : typeof node.title === 'function'\n ? node.title(node)\n : node.title;\n const renderedHandler = handlerRender(node) as React.ReactNode;\n const hasHandler =\n renderedHandler !== null &&\n renderedHandler !== undefined &&\n renderedHandler !== false;\n return (\n <span\n className={cn(\n 'ald-tree-title-layout',\n hasHandler && 'ald-tree-title-layout-with-handler',\n )}\n >\n <span className=\"ald-tree-title-content\">{renderedTitle}</span>\n {showTabLeader && hasHandler && (\n <div className=\"ald-tree-tab-leader\"></div>\n )}\n {hasHandler && (\n <span className=\"ald-tree-title-handler\">{renderedHandler}</span>\n )}\n </span>\n );\n },\n [titleRender, showTabLeader, handlerRender],\n );\n const newProps = {\n ...rest,\n checkable,\n selectable,\n showIcon,\n motion,\n blockNode,\n showLine: Boolean(showLine),\n dropIndicatorRender,\n titleRender: customTitleRender,\n };\n\n // 一次性吃掉 draggable 的归一化:rc-tree 看到的 mergedDraggable + 我们内部用的\n // dropOnlyResolvers(原样保留用户 nodeDraggable/nodeDroppable)。集中一处避免两处 useMemo\n // 的判断散开导致字段扩展时遗漏。\n const { draggableConfig, dropOnlyResolvers } = React.useMemo(() => {\n if (!draggable) {\n return {\n draggableConfig: false as const,\n dropOnlyResolvers: null as DropOnlyResolvers | null,\n };\n }\n const newIcon = (\n <DragLine\n size={TREE_SWITCH_CION_SIZE}\n color={'var(--alias-colors-icon-subtle)'}\n ></DragLine>\n );\n let mergedDraggable: DraggableConfig = { icon: newIcon };\n switch (typeof draggable) {\n case 'function':\n mergedDraggable.nodeDraggable = draggable;\n break;\n case 'object':\n mergedDraggable = {\n ...draggable,\n icon: draggable.icon === undefined ? newIcon : draggable.icon,\n };\n break;\n default:\n break;\n }\n\n // rc-tree 5.x 把\"可拖(drag source)\"与\"可放(drop target)\"绑到同一个 nodeDraggable:\n // 该返回 false 时 onDragOver/onDrop 也连带不注册,浏览器认为该节点 not droppable\n // → drop 事件根本不派发。为了让\"类目可接收资源拖入但本身不可拖\",把 rc-tree 看到的\n // nodeDraggable 改成 nodeDraggable || nodeDroppable,从而保证 drop listener 仍注册。\n // 真正的 drag-source 阻断由 document 级 dragstart capture handler 负责(见下方 effect)。\n let resolvers: DropOnlyResolvers | null = null;\n if (mergedDraggable.nodeDroppable) {\n const userNodeDraggable = mergedDraggable.nodeDraggable;\n const userNodeDroppable = mergedDraggable.nodeDroppable;\n resolvers = {\n nodeDraggable: userNodeDraggable,\n nodeDroppable: userNodeDroppable,\n };\n mergedDraggable = {\n ...mergedDraggable,\n nodeDraggable: (node: DataNode) =>\n (userNodeDraggable ? userNodeDraggable(node) : true) ||\n userNodeDroppable(node),\n };\n }\n\n return { draggableConfig: mergedDraggable, dropOnlyResolvers: resolvers };\n }, [draggable]);\n\n /**\n * drop-only 节点不能真的起拖。\n *\n * 历史教训:以前在 props.onDragStart 里调 preventDefault。问题是 rc-tree 内部\n * onNodeDragStart(Tree.js:88-99)会在调用 user onDragStart **之前**把\n * draggingNodeKey/dragNodeProps 写进 state;TreeNode(TreeNode.js:112)也已经先\n * setDragNodeHighlight(true)。然后 preventDefault 让浏览器取消拖拽,dragend 不再派发\n * → onWindowDragEnd 永远不触发 → state 卡在\"正在拖类目\",外层 .ald-tree-treenode\n * 卡着 `dragging`、内层 .ald-tree-node-content-wrapper 卡着 `ald-tree-node-selected`\n * 高亮,直到下一次合法 dragstart 才被覆盖。\n *\n * 修复手段:document 级 dragstart capture handler,在 rc-tree 的 React 监听器之前\n * stopPropagation+preventDefault,让 TreeNode 的 onDragStart 整段都不执行,rc-tree\n * 内部 state 彻底不写入。document 是 React root 容器的祖先,capture 阶段先于 React\n * delegation 监听器,因此 stopPropagation 能彻底拦截。\n */\n React.useLayoutEffect(() => {\n if (!dropOnlyResolvers) return;\n const handler = (e: DragEvent) => {\n const target = e.target as HTMLElement | null;\n if (!target?.closest) return;\n if (target.closest('.ald-tree-treenode-drop-only')) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n document.addEventListener('dragstart', handler, true);\n return () => document.removeEventListener('dragstart', handler, true);\n }, [dropOnlyResolvers]);\n\n /**\n * nodeDroppable 同时收口到 rc-tree 的 allowDrop:避免出现\"nodeDroppable=false 但 rc-tree\n * 默认 allowDrop=()=>true 仍然接收 drop\"的语义裂缝。用户自传的 allowDrop 与 nodeDroppable\n * 取 AND(任一拒绝即拒绝)。\n */\n const composedAllowDrop = React.useMemo(\n () => composeAllowDrop(rest.allowDrop, dropOnlyResolvers?.nodeDroppable),\n [rest.allowDrop, dropOnlyResolvers],\n );\n const renderIndent = (nodeProps: AldTreeNodeProps) => {\n const { pos } = nodeProps as AldTreeNodeProps & { pos?: string };\n // rc-tree `pos` 格式:\"0\" 是虚拟根,\"0-0\" 是首层节点,\"0-0-1\" 是 leaf。\n // 顶层节点 level=0 不缩进;每层 +1 unit(switcher 宽度),与 antd Tree 行为一致。\n // 不再为 leaf 额外补 switcher 宽度——leaf 自身的 switcher-noop 已经占位,\n // 旧公式 `isLeaf + level * (iconSize/2)` 会让 leaf 比同级 group 视觉额外右移半个 unit。\n // `?? 2` 兜底:当 pos 缺失时按\"首层节点 `0-0` 长度 = 2\"处理,结果 level=0 不缩进;\n // 切勿改成 1 或 0,否则缺 pos 的节点会被错误右移。\n const level = Math.max(0, (pos?.split('-').length ?? 2) - 2);\n return (\n <span\n style={{ width: level * TREE_SWITCH_CION_SIZE, flexShrink: 0 }}\n ></span>\n );\n };\n const newTreeData = React.useMemo(() => {\n if (!filterTreeNode || !treeData) return treeData;\n\n const shouldNodeDisabled = (node: DataNode): boolean => {\n // 初始化一个标志来表示是否需要为当前节点添加className\n let shouldAddDisabled = true;\n if (filterTreeNode(node)) {\n shouldAddDisabled = false;\n }\n\n if (node.children) {\n // 遍历当前节点的子节点,只要有一个子节点不disable,则该不需要添加className\n const allChildrenShouldAddDisabled = node.children.reduce(\n (pre, child) => {\n return shouldNodeDisabled(child) && pre;\n },\n shouldAddDisabled,\n );\n shouldAddDisabled = allChildrenShouldAddDisabled;\n }\n\n // 如果shouldAddDisabled为true,就为当前节点添加className\n if (shouldAddDisabled) {\n node.className = node.className?.includes(NODE_DISABLE_CLASS_NAME)\n ? node.className\n : cn(node.className, NODE_DISABLE_CLASS_NAME);\n } else {\n const reg = /ald-tree-node-disabled/g;\n node.className?.replace(reg, ' ');\n }\n if (highlightKeywords && typeof node.title !== 'function') {\n node.title = (\n <HighlightText keyword={highlightKeywords}>\n {node.title}\n </HighlightText>\n );\n }\n return shouldAddDisabled;\n };\n const newTreeData = produce(treeData, (draft) => {\n for (const rootNode of draft) {\n shouldNodeDisabled(rootNode);\n }\n });\n return newTreeData;\n }, [filterTreeNode, treeData, highlightKeywords]);\n\n /** 给 drop-only 节点的 wrapper 加 'ald-tree-treenode-drop-only' className(rc-tree 5.x\n * 会把 DataNode.className 透传到 .ald-tree-treenode 上)。css 据此隐藏 drag handle icon\n * 并提供 not-allowed cursor,区分纯 drop target 与真正可拖节点。 */\n const finalTreeData = React.useMemo(() => {\n if (!dropOnlyResolvers || !newTreeData) return newTreeData;\n const { nodeDraggable, nodeDroppable } = dropOnlyResolvers;\n return produce(newTreeData, (draft) => {\n const visit = (nodes: DataNode[] | undefined) => {\n if (!nodes) return;\n for (const node of nodes) {\n const isDraggable = nodeDraggable ? nodeDraggable(node) : true;\n const isDroppable = nodeDroppable(node);\n if (!isDraggable && isDroppable) {\n const existing = node.className ?? '';\n if (!existing.includes('ald-tree-treenode-drop-only')) {\n node.className = cn(existing, 'ald-tree-treenode-drop-only');\n }\n }\n visit(node.children as DataNode[] | undefined);\n }\n };\n visit(draft as DataNode[]);\n });\n }, [newTreeData, dropOnlyResolvers]);\n\n const noChildren = React.useMemo(() => {\n if (finalTreeData?.length) {\n return finalTreeData.every((node) => {\n return !node.children?.length && node.isLeaf !== false;\n });\n }\n return true;\n }, [finalTreeData]);\n\n return (\n <RcTree\n itemHeight={20}\n ref={ref}\n virtual={virtual}\n {...newProps}\n allowDrop={composedAllowDrop}\n prefixCls={prefixCls}\n treeData={finalTreeData}\n className={cn(\n {\n [`${prefixCls}-icon-hide`]: !showIcon,\n [`${prefixCls}-block-node`]: blockNode,\n [`${prefixCls}-unselectable`]: !selectable,\n [`${prefixCls}-large`]: size === 'large',\n [`${prefixCls}-rtl`]: direction === 'rtl',\n ['ald-draggable-tree']: draggable,\n [`${prefixCls}-no-children`]: noChildren,\n },\n // antd 兼容:保留 ant-* class,消费方 CSS 可能依赖该选择器\n 'ant-tree',\n className,\n )}\n direction={direction as any}\n checkable={\n checkable ? (\n <span className={`${prefixCls}-checkbox-inner`} />\n ) : (\n checkable\n )\n }\n selectable={selectable}\n // @ts-ignore\n switcherIcon={(nodeProps: AldTreeNodeProps) => {\n return (\n <>\n {renderIndent(nodeProps)}\n {renderSwitcherIcon(\n prefixCls,\n <ArrowRightLightLine\n size={TREE_SWITCH_CION_SIZE}\n color={'var(--alias-colors-icon-subtle)'}\n >\n {t.Tree.expand}\n </ArrowRightLightLine>,\n showLine,\n nodeProps,\n TREE_SWITCH_CION_SIZE,\n )}\n </>\n );\n }}\n draggable={draggableConfig}\n >\n {children}\n </Rc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Ac;AACrC,MAAI,eAAe,OACjB,QAAO,cAAc,OAAO,SAAS;AACnC,UAAO,CAAC,KAAK,UAAU,UAAU,KAAK,WAAW;IACjD;AAEJ,SAAO;IACN,CAAC,cAAc,CAAC;AAEnB,QACE,oBAAC,QAAD;EACE,YAAY;EACP;EACI;EACT,GAAI;EACJ,WAAW;EACA;EACX,UAAU;EACV,WAAW,GACT;IACG,GAAG,UAAU,cAAc,CAAC;IAC5B,GAAG,UAAU,eAAe;IAC5B,GAAG,UAAU,iBAAiB,CAAC;IAC/B,GAAG,UAAU,UAAU,SAAS;IAChC,GAAG,UAAU,QAAQ,cAAc;IACnC,uBAAuB;IACvB,GAAG,UAAU,gBAAgB;GAC/B,EAED,YACA,UACD;EACU;EACX,WACE,YACE,oBAAC,QAAD,EAAM,WAAW,GAAG,UAAU,kBAAoB,CAAA,GAElD;EAGQ;EAEZ,eAAe,cAAgC;AAC7C,UACE,qBAAA,UAAA,EAAA,UAAA,CACG,aAAa,UAAU,EACvB,mBACC,WACA,oBAAC,MAAD;IACE,MAAM;IACN,OAAO;cAEN,EAAE,KAAK;IACY,CAAA,EACtB,UACA,WACA,sBACD,CACA,EAAA,CAAA;;EAGP,WAAW;EAEV;EACM,CAAA;EAEX"}
@@ -15,7 +15,10 @@ interface CopyableConfig {
15
15
  onCopy?: () => void;
16
16
  tooltips?: [React.ReactNode, React.ReactNode];
17
17
  }
18
- interface TextProps {
18
+ type EllipsisConfig = boolean | {
19
+ rows?: number;
20
+ };
21
+ interface TextProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'type'> {
19
22
  className?: string;
20
23
  style?: React.CSSProperties;
21
24
  children?: React.ReactNode;
@@ -26,24 +29,24 @@ interface TextProps {
26
29
  code?: boolean;
27
30
  disabled?: boolean;
28
31
  type?: 'secondary' | 'success' | 'warning' | 'danger';
29
- ellipsis?: boolean;
32
+ ellipsis?: EllipsisConfig;
30
33
  copyable?: boolean | CopyableConfig;
31
34
  }
32
- interface TitleProps {
35
+ interface TitleProps extends React.HTMLAttributes<HTMLHeadingElement> {
33
36
  className?: string;
34
37
  style?: React.CSSProperties;
35
38
  children?: React.ReactNode;
36
39
  level?: 1 | 2 | 3 | 4 | 5;
37
- ellipsis?: boolean;
40
+ ellipsis?: EllipsisConfig;
38
41
  }
39
- interface ParagraphProps {
42
+ interface ParagraphProps extends React.HTMLAttributes<HTMLDivElement> {
40
43
  className?: string;
41
44
  style?: React.CSSProperties;
42
45
  children?: React.ReactNode;
43
- ellipsis?: boolean;
46
+ ellipsis?: EllipsisConfig;
44
47
  copyable?: boolean | CopyableConfig;
45
48
  }
46
- interface LinkProps {
49
+ interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
47
50
  className?: string;
48
51
  style?: React.CSSProperties;
49
52
  children?: React.ReactNode;
@@ -40,8 +40,9 @@ var Typography = ({ className, style, children }) => /* @__PURE__ */ jsx("articl
40
40
  style,
41
41
  children
42
42
  });
43
- Typography.Text = ({ className, style, children, strong, italic, underline, code, disabled, type, ellipsis, copyable, ...rest }) => {
44
- const del = rest.delete;
43
+ Typography.Text = ({ className, style, children, strong, italic, underline, code, disabled, type, ellipsis, copyable, delete: del, ...rest }) => {
44
+ const isEllipsis = Boolean(ellipsis);
45
+ const ellipsisRows = typeof ellipsis === "object" ? ellipsis.rows : void 0;
45
46
  let content = children;
46
47
  if (code) content = /* @__PURE__ */ jsx("code", { children: content });
47
48
  if (del) content = /* @__PURE__ */ jsx("del", { children: content });
@@ -49,34 +50,56 @@ Typography.Text = ({ className, style, children, strong, italic, underline, code
49
50
  if (italic) content = /* @__PURE__ */ jsx("i", { children: content });
50
51
  if (strong) content = /* @__PURE__ */ jsx("strong", { children: content });
51
52
  return /* @__PURE__ */ jsxs("span", {
52
- className: cn("ald-typography-text", disabled && "tw-cursor-not-allowed tw-opacity-50", type === "secondary" && "tw-text-[var(--content-secondary)]", type === "success" && "tw-text-[var(--content-positive-primary)]", type === "warning" && "tw-text-[var(--content-warning-primary)]", type === "danger" && "tw-text-[var(--content-negative-primary)]", ellipsis && "tw-truncate", className),
53
- style,
53
+ className: cn("ald-typography-text", disabled && "tw-cursor-not-allowed tw-opacity-50", type === "secondary" && "tw-text-[var(--content-secondary)]", type === "success" && "tw-text-[var(--content-positive-primary)]", type === "warning" && "tw-text-[var(--content-warning-primary)]", type === "danger" && "tw-text-[var(--content-negative-primary)]", isEllipsis && (ellipsisRows ? "tw-overflow-hidden" : "tw-truncate"), className),
54
+ style: {
55
+ ...style,
56
+ ...ellipsisRows ? {
57
+ display: "-webkit-box",
58
+ WebkitLineClamp: ellipsisRows,
59
+ WebkitBoxOrient: "vertical"
60
+ } : {}
61
+ },
62
+ ...rest,
54
63
  children: [content, copyable && /* @__PURE__ */ jsx(CopyButton, {
55
64
  copyable,
56
65
  children
57
66
  })]
58
67
  });
59
68
  };
60
- Typography.Title = ({ className, style, children, level = 1, ellipsis }) => {
69
+ Typography.Title = ({ className, style, children, level = 1, ellipsis, ...rest }) => {
61
70
  return /* @__PURE__ */ jsx(`h${level}`, {
62
- className: cn("ald-typography-title tw-font-semibold tw-text-[var(--content-primary)]", ellipsis && "tw-truncate", className),
71
+ className: cn("ald-typography-title tw-font-semibold tw-text-[var(--content-primary)]", Boolean(ellipsis) && "tw-truncate", className),
63
72
  style,
73
+ ...rest,
64
74
  children
65
75
  });
66
76
  };
67
- Typography.Paragraph = ({ className, style, children, ellipsis, copyable }) => /* @__PURE__ */ jsxs("div", {
68
- className: cn("ald-typography-paragraph", ellipsis && "tw-truncate", className),
69
- style,
70
- children: [children, copyable && /* @__PURE__ */ jsx(CopyButton, {
71
- copyable,
72
- children
73
- })]
74
- });
75
- Typography.Link = ({ className, style, children, href, target }) => /* @__PURE__ */ jsx("a", {
77
+ Typography.Paragraph = ({ className, style, children, ellipsis, copyable, ...rest }) => {
78
+ const isEllipsis = Boolean(ellipsis);
79
+ const ellipsisRows = typeof ellipsis === "object" ? ellipsis.rows : void 0;
80
+ return /* @__PURE__ */ jsxs("div", {
81
+ className: cn("ald-typography-paragraph", isEllipsis && (ellipsisRows ? "tw-overflow-hidden" : "tw-truncate"), className),
82
+ style: {
83
+ ...style,
84
+ ...ellipsisRows ? {
85
+ display: "-webkit-box",
86
+ WebkitLineClamp: ellipsisRows,
87
+ WebkitBoxOrient: "vertical"
88
+ } : {}
89
+ },
90
+ ...rest,
91
+ children: [children, copyable && /* @__PURE__ */ jsx(CopyButton, {
92
+ copyable,
93
+ children
94
+ })]
95
+ });
96
+ };
97
+ Typography.Link = ({ className, style, children, href, target, ...rest }) => /* @__PURE__ */ jsx("a", {
76
98
  className: cn("ald-typography-link tw-text-[var(--alias-colors-link-default)] hover:tw-text-[var(--alias-colors-link-hover)]", className),
77
99
  style,
78
100
  href,
79
101
  target,
102
+ ...rest,
80
103
  children
81
104
  });
82
105
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/Typography/index.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\nimport { cn } from '../lib/utils';\n\nexport interface TypographyProps {\n className?: string;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n}\n\ninterface TypographyComponent extends React.FC<TypographyProps> {\n Text: React.FC<TextProps>;\n Title: React.FC<TitleProps>;\n Paragraph: React.FC<ParagraphProps>;\n Link: React.FC<LinkProps>;\n}\n\ninterface CopyableConfig {\n text?: string;\n onCopy?: () => void;\n tooltips?: [React.ReactNode, React.ReactNode];\n}\n\ninterface TextProps {\n className?: string;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n strong?: boolean;\n italic?: boolean;\n underline?: boolean;\n delete?: boolean;\n code?: boolean;\n disabled?: boolean;\n type?: 'secondary' | 'success' | 'warning' | 'danger';\n ellipsis?: boolean;\n copyable?: boolean | CopyableConfig;\n}\n\ninterface TitleProps {\n className?: string;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n level?: 1 | 2 | 3 | 4 | 5;\n ellipsis?: boolean;\n}\n\ninterface ParagraphProps {\n className?: string;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n ellipsis?: boolean;\n copyable?: boolean | CopyableConfig;\n}\n\ninterface LinkProps {\n className?: string;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n href?: string;\n target?: string;\n}\n\nfunction CopyButton({\n copyable,\n children,\n}: {\n copyable: boolean | CopyableConfig;\n children: React.ReactNode;\n}) {\n const [copied, setCopied] = useState(false);\n\n const handleCopy = useCallback(() => {\n const config =\n typeof copyable === 'object' ? copyable : ({} as CopyableConfig);\n const textToCopy =\n config.text ?? (typeof children === 'string' ? children : '');\n navigator.clipboard.writeText(String(textToCopy)).then(() => {\n setCopied(true);\n config.onCopy?.();\n setTimeout(() => setCopied(false), 2000);\n });\n }, [copyable, children]);\n\n return (\n <span\n role=\"button\"\n tabIndex={0}\n className=\"ald-typography-copy tw-ml-1 tw-inline-flex tw-cursor-pointer tw-align-middle tw-text-[var(--content-secondary)] hover:tw-text-[var(--content-primary)]\"\n onClick={handleCopy}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') handleCopy();\n }}\n aria-label=\"Copy\"\n >\n {copied ? (\n <span className=\"tw-text-xs tw-text-[var(--content-positive-primary)]\">\n Copied!\n </span>\n ) : (\n <svg\n viewBox=\"0 0 16 16\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path d=\"M4 2a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V2zm2-1a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H6z\" />\n <path d=\"M2 4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1v-1h1v1a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h1v1H2z\" />\n </svg>\n )}\n </span>\n );\n}\n\nconst Typography: TypographyComponent = ({ className, style, children }) => (\n <article className={cn('ald-typography', className)} style={style}>\n {children}\n </article>\n);\n\nTypography.Text = ({\n className,\n style,\n children,\n strong,\n italic,\n underline,\n code,\n disabled,\n type,\n ellipsis,\n copyable,\n ...rest\n}) => {\n const del = (rest as { delete?: boolean }).delete;\n let content: React.ReactNode = children;\n if (code) content = <code>{content}</code>;\n if (del) content = <del>{content}</del>;\n if (underline) content = <u>{content}</u>;\n if (italic) content = <i>{content}</i>;\n if (strong) content = <strong>{content}</strong>;\n\n return (\n <span\n className={cn(\n 'ald-typography-text',\n disabled && 'tw-cursor-not-allowed tw-opacity-50',\n type === 'secondary' && 'tw-text-[var(--content-secondary)]',\n type === 'success' && 'tw-text-[var(--content-positive-primary)]',\n type === 'warning' && 'tw-text-[var(--content-warning-primary)]',\n type === 'danger' && 'tw-text-[var(--content-negative-primary)]',\n ellipsis && 'tw-truncate',\n className,\n )}\n style={style}\n >\n {content}\n {copyable && <CopyButton copyable={copyable}>{children}</CopyButton>}\n </span>\n );\n};\n\nTypography.Title = ({ className, style, children, level = 1, ellipsis }) => {\n const Tag = `h${level}` as keyof JSX.IntrinsicElements;\n return (\n <Tag\n className={cn(\n 'ald-typography-title tw-font-semibold tw-text-[var(--content-primary)]',\n ellipsis && 'tw-truncate',\n className,\n )}\n style={style}\n >\n {children}\n </Tag>\n );\n};\n\nTypography.Paragraph = ({ className, style, children, ellipsis, copyable }) => (\n <div\n className={cn(\n 'ald-typography-paragraph',\n ellipsis && 'tw-truncate',\n className,\n )}\n style={style}\n >\n {children}\n {copyable && <CopyButton copyable={copyable}>{children}</CopyButton>}\n </div>\n);\n\nTypography.Link = ({ className, style, children, href, target }) => (\n <a\n className={cn(\n 'ald-typography-link tw-text-[var(--alias-colors-link-default)] hover:tw-text-[var(--alias-colors-link-hover)]',\n className,\n )}\n style={style}\n href={href}\n target={target}\n >\n {children}\n </a>\n);\n\nexport default Typography;\n"],"mappings":";;;;AA6DA,SAAS,WAAW,EAClB,UACA,YAIC;CACD,MAAM,CAAC,QAAQ,aAAa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AAU,oBAAC,UAAD,EAAA,UAAS,SAAiB,CAAA;AAEhD,QACE,qBAAC,QAAD;EACE,WAAW,GACT,uBACA,YAAY,uCACZ,SAAS,eAAe,sCACxB,SAAS,aAAa,6CACtB,SAAS,aAAa,4CACtB,SAAS,YAAY,6CACrB,YAAY,eACZ,UACD;EACM;YAXT,CAaG,SACA,YAAY,oBAAC,YAAD;GAAsB;GAAW;GAAsB,CAAA,CAC/D;;;AAIX,WAAW,SAAS,EAAE,WAAW,OAAO,UAAU,QAAQ,GAAG,eAAe;AAE1E,QACE,oBAFU,IAAI,SAEd;EACE,WAAW,GACT,0EACA,YAAY,eACZ,UACD;EACM;EAEN;EACG,CAAA;;AAIV,WAAW,aAAa,EAAE,WAAW,OAAO,UAAU,UAAU,eAC9D,qBAAC,OAAD;CACE,WAAW,GACT,4BACA,YAAY,eACZ,UACD;CACM;WANT,CAQG,UACA,YAAY,oBAAC,YAAD;EAAsB;EAAW;EAAsB,CAAA,CAChE;;AAGR,WAAW,QAAQ,EAAE,WAAW,OAAO,UAAU,MAAM,aACrD,oBAAC,KAAD;CACE,WAAW,GACT,iHACA,UACD;CACM;CACD;CACE;CAEP;CACC,CAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/Typography/index.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\nimport { cn } from '../lib/utils';\n\nexport interface TypographyProps {\n className?: string;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n}\n\ninterface TypographyComponent extends React.FC<TypographyProps> {\n Text: React.FC<TextProps>;\n Title: React.FC<TitleProps>;\n Paragraph: React.FC<ParagraphProps>;\n Link: React.FC<LinkProps>;\n}\n\ninterface CopyableConfig {\n text?: string;\n onCopy?: () => void;\n tooltips?: [React.ReactNode, React.ReactNode];\n}\n\ntype EllipsisConfig = boolean | { rows?: number };\n\ninterface TextProps\n extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'type'> {\n className?: string;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n strong?: boolean;\n italic?: boolean;\n underline?: boolean;\n delete?: boolean;\n code?: boolean;\n disabled?: boolean;\n type?: 'secondary' | 'success' | 'warning' | 'danger';\n ellipsis?: EllipsisConfig;\n copyable?: boolean | CopyableConfig;\n}\n\ninterface TitleProps extends React.HTMLAttributes<HTMLHeadingElement> {\n className?: string;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n level?: 1 | 2 | 3 | 4 | 5;\n ellipsis?: EllipsisConfig;\n}\n\ninterface ParagraphProps extends React.HTMLAttributes<HTMLDivElement> {\n className?: string;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n ellipsis?: EllipsisConfig;\n copyable?: boolean | CopyableConfig;\n}\n\ninterface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {\n className?: string;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n href?: string;\n target?: string;\n}\n\nfunction CopyButton({\n copyable,\n children,\n}: {\n copyable: boolean | CopyableConfig;\n children: React.ReactNode;\n}) {\n const [copied, setCopied] = useState(false);\n\n const handleCopy = useCallback(() => {\n const config =\n typeof copyable === 'object' ? copyable : ({} as CopyableConfig);\n const textToCopy =\n config.text ?? (typeof children === 'string' ? children : '');\n navigator.clipboard.writeText(String(textToCopy)).then(() => {\n setCopied(true);\n config.onCopy?.();\n setTimeout(() => setCopied(false), 2000);\n });\n }, [copyable, children]);\n\n return (\n <span\n role=\"button\"\n tabIndex={0}\n className=\"ald-typography-copy tw-ml-1 tw-inline-flex tw-cursor-pointer tw-align-middle tw-text-[var(--content-secondary)] hover:tw-text-[var(--content-primary)]\"\n onClick={handleCopy}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') handleCopy();\n }}\n aria-label=\"Copy\"\n >\n {copied ? (\n <span className=\"tw-text-xs tw-text-[var(--content-positive-primary)]\">\n Copied!\n </span>\n ) : (\n <svg\n viewBox=\"0 0 16 16\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path d=\"M4 2a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V2zm2-1a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H6z\" />\n <path d=\"M2 4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1v-1h1v1a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h1v1H2z\" />\n </svg>\n )}\n </span>\n );\n}\n\nconst Typography: TypographyComponent = ({ className, style, children }) => (\n <article className={cn('ald-typography', className)} style={style}>\n {children}\n </article>\n);\n\nTypography.Text = ({\n className,\n style,\n children,\n strong,\n italic,\n underline,\n code,\n disabled,\n type,\n ellipsis,\n copyable,\n delete: del,\n ...rest\n}) => {\n const isEllipsis = Boolean(ellipsis);\n const ellipsisRows = typeof ellipsis === 'object' ? ellipsis.rows : undefined;\n let content: React.ReactNode = children;\n if (code) content = <code>{content}</code>;\n if (del) content = <del>{content}</del>;\n if (underline) content = <u>{content}</u>;\n if (italic) content = <i>{content}</i>;\n if (strong) content = <strong>{content}</strong>;\n\n return (\n <span\n className={cn(\n 'ald-typography-text',\n disabled && 'tw-cursor-not-allowed tw-opacity-50',\n type === 'secondary' && 'tw-text-[var(--content-secondary)]',\n type === 'success' && 'tw-text-[var(--content-positive-primary)]',\n type === 'warning' && 'tw-text-[var(--content-warning-primary)]',\n type === 'danger' && 'tw-text-[var(--content-negative-primary)]',\n isEllipsis && (ellipsisRows ? 'tw-overflow-hidden' : 'tw-truncate'),\n className,\n )}\n style={{\n ...style,\n ...(ellipsisRows\n ? {\n display: '-webkit-box',\n WebkitLineClamp: ellipsisRows,\n WebkitBoxOrient: 'vertical',\n }\n : {}),\n }}\n {...rest}\n >\n {content}\n {copyable && <CopyButton copyable={copyable}>{children}</CopyButton>}\n </span>\n );\n};\n\nTypography.Title = ({\n className,\n style,\n children,\n level = 1,\n ellipsis,\n ...rest\n}) => {\n const Tag = `h${level}` as React.ElementType;\n const isEllipsis = Boolean(ellipsis);\n return (\n <Tag\n className={cn(\n 'ald-typography-title tw-font-semibold tw-text-[var(--content-primary)]',\n isEllipsis && 'tw-truncate',\n className,\n )}\n style={style}\n {...rest}\n >\n {children}\n </Tag>\n );\n};\n\nTypography.Paragraph = ({\n className,\n style,\n children,\n ellipsis,\n copyable,\n ...rest\n}) => {\n const isEllipsis = Boolean(ellipsis);\n const ellipsisRows = typeof ellipsis === 'object' ? ellipsis.rows : undefined;\n\n return (\n <div\n className={cn(\n 'ald-typography-paragraph',\n isEllipsis && (ellipsisRows ? 'tw-overflow-hidden' : 'tw-truncate'),\n className,\n )}\n style={{\n ...style,\n ...(ellipsisRows\n ? {\n display: '-webkit-box',\n WebkitLineClamp: ellipsisRows,\n WebkitBoxOrient: 'vertical',\n }\n : {}),\n }}\n {...rest}\n >\n {children}\n {copyable && <CopyButton copyable={copyable}>{children}</CopyButton>}\n </div>\n );\n};\n\nTypography.Link = ({ className, style, children, href, target, ...rest }) => (\n <a\n className={cn(\n 'ald-typography-link tw-text-[var(--alias-colors-link-default)] hover:tw-text-[var(--alias-colors-link-hover)]',\n className,\n )}\n style={style}\n href={href}\n target={target}\n {...rest}\n >\n {children}\n </a>\n);\n\nexport default Typography;\n"],"mappings":";;;;AAgEA,SAAS,WAAW,EAClB,UACA,YAIC;CACD,MAAM,CAAC,QAAQ,aAAa,SAAS,MAAM;CAE3C,MAAM,aAAa,kBAAkB;EACnC,MAAM,SACJ,OAAO,aAAa,WAAW,WAAY,EAAE;EAC/C,MAAM,aACJ,OAAO,SAAS,OAAO,aAAa,WAAW,WAAW;AAC5D,YAAU,UAAU,UAAU,OAAO,WAAW,CAAC,CAAC,WAAW;AAC3D,aAAU,KAAK;AACf,UAAO,UAAU;AACjB,oBAAiB,UAAU,MAAM,EAAE,IAAK;IACxC;IACD,CAAC,UAAU,SAAS,CAAC;AAExB,QACE,oBAAC,QAA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iBAAiB;IACjB,iBAAiB;IAClB,GACD,EAAE;GACP;EACD,GAAI;YArBN,CAuBG,SACA,YAAY,oBAAC,YAAD;GAAsB;GAAW;GAAsB,CAAA,CAC/D;;;AAIX,WAAW,SAAS,EAClB,WACA,OACA,UACA,QAAQ,GACR,UACA,GAAG,WACC;AAGJ,QACE,oBAHU,IAAI,SAGd;EACE,WAAW,GACT,0EAJa,QAAQ,SAAS,IAKhB,eACd,UACD;EACM;EACP,GAAI;EAEH;EACG,CAAA;;AAIV,WAAW,aAAa,EACtB,WACA,OACA,UACA,UACA,UACA,GAAG,WACC;CACJ,MAAM,aAAa,QAAQ,SAAS;CACpC,MAAM,eAAe,OAAO,aAAa,WAAW,SAAS,OAAO;AAEpE,QACE,qBAAC,OAAD;EACE,WAAW,GACT,4BACA,eAAe,eAAe,uBAAuB,gBACrD,UACD;EACD,OAAO;GACL,GAAG;GACH,GAAI,eACA;IACE,SAAS;IACT,iBAAiB;IACjB,iBAAiB;IAClB,GACD,EAAE;GACP;EACD,GAAI;YAhBN,CAkBG,UACA,YAAY,oBAAC,YAAD;GAAsB;GAAW;GAAsB,CAAA,CAChE;;;AAIV,WAAW,QAAQ,EAAE,WAAW,OAAO,UAAU,MAAM,QAAQ,GAAG,WAChE,oBAAC,KAAD;CACE,WAAW,GACT,iHACA,UACD;CACM;CACD;CACE;CACR,GAAI;CAEH;CACC,CAAA"}
@@ -32,7 +32,7 @@ export interface UploadProps<T = any> {
32
32
  headers?: Record<string, string>;
33
33
  data?: Record<string, unknown> | ((file: RcFile | string | Blob) => Record<string, unknown>);
34
34
  withCredentials?: boolean;
35
- beforeUpload?: (file: RcFile, fileList: RcFile[]) => boolean | Promise<void | Blob | File>;
35
+ beforeUpload?: (file: RcFile, fileList: RcFile[]) => boolean | void | Blob | File | Promise<boolean | void | Blob | File>;
36
36
  customRequest?: (options: {
37
37
  file: RcFile;
38
38
  filename?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/Upload/index.tsx"],"sourcesContent":["import './upload.css';\n\nimport RcUpload from 'rc-upload';\nimport type {\n RcFile as RcUploadFile,\n UploadProgressEvent,\n UploadProps as RcUploadProps,\n} from 'rc-upload/es/interface';\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\nimport {\n CheckCircleFill,\n CloseCircleFill,\n CloseLightLine,\n EyeOnLine,\n LoadingLine,\n TrashLightLine,\n} from '../Icon';\nimport { cn } from '../lib/utils';\nimport Tooltip from '../Tooltip';\n\n// ---------------------------------------------------------------------------\n// Public types – preserved from the previous API surface\n// ---------------------------------------------------------------------------\n\nexport interface UploadFile<T = any> {\n uid: string;\n name: string;\n status?: 'uploading' | 'done' | 'error' | 'removed';\n url?: string;\n thumbUrl?: string;\n size?: number;\n type?: string;\n percent?: number;\n originFileObj?: RcFile;\n response?: T;\n error?: any;\n linkProps?: any;\n}\n\nexport type RcFile = RcUploadFile;\n\nexport interface UploadChangeParam<T = UploadFile> {\n file: T;\n fileList: T[];\n event?: UploadProgressEvent;\n}\n\nexport interface ShowUploadListInterface {\n showRemoveIcon?: boolean;\n showPreviewIcon?: boolean;\n showDownloadIcon?: boolean;\n}\n\nexport interface UploadProps<T = any> {\n accept?: string;\n action?: string | ((file: RcFile) => string | Promise<string>);\n method?: 'POST' | 'PUT' | 'PATCH' | 'post' | 'put' | 'patch';\n headers?: Record<string, string>;\n data?:\n | Record<string, unknown>\n | ((file: RcFile | string | Blob) => Record<string, unknown>);\n withCredentials?: boolean;\n beforeUpload?: (\n file: RcFile,\n fileList: RcFile[],\n ) => boolean | Promise<void | Blob | File>;\n customRequest?: (options: {\n file: RcFile;\n filename?: string;\n data?: Record<string, unknown>;\n headers?: Record<string, string>;\n onProgress?: (event: { percent: number }) => void;\n onSuccess?: (body: unknown, xhr?: XMLHttpRequest) => void;\n onError?: (event: Error) => void;\n withCredentials?: boolean;\n action?: string;\n method?: string;\n }) => void;\n disabled?: boolean;\n fileList?: UploadFile<T>[];\n defaultFileList?: UploadFile<T>[];\n maxCount?: number;\n multiple?: boolean;\n directory?: boolean;\n name?: string;\n listType?: 'text' | 'picture' | 'picture-card';\n showUploadList?: boolean | ShowUploadListInterface;\n onChange?: (info: UploadChangeParam<UploadFile<T>>) => void;\n onRemove?: (file: UploadFile<T>) => void | boolean | Promise<void | boolean>;\n onPreview?: (file: UploadFile<T>) => void;\n onDownload?: (file: UploadFile<T>) => void;\n className?: string;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n openFileDialogOnClick?: boolean;\n /** @deprecated Use `id` instead */\n prefixCls?: string;\n id?: string;\n}\n\nexport interface UploadListProps {\n items?: UploadFile[];\n listType?: 'text' | 'picture' | 'picture-card';\n showUploadList?: boolean | ShowUploadListInterface;\n onRemove?: (file: UploadFile) => void;\n onPreview?: (file: UploadFile) => void;\n onDownload?: (file: UploadFile) => void;\n disabled?: boolean;\n}\n\nexport interface DraggerProps extends UploadProps {\n height?: number;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nlet fileUid = 0;\n\nfunction getUid(): string {\n fileUid += 1;\n return `ald-upload-${Date.now()}-${fileUid}`;\n}\n\nfunction fileToUploadFile(\n file: RcFile,\n status: UploadFile['status'] = 'uploading',\n): UploadFile {\n return {\n uid: file.uid ?? getUid(),\n name: file.name,\n size: file.size,\n type: file.type,\n status,\n percent: 0,\n originFileObj: file,\n };\n}\n\nfunction isImageUrl(file: UploadFile): boolean {\n if (file.type) return file.type.startsWith('image/');\n const ext = file.name?.split('.').pop()?.toLowerCase() ?? '';\n return ['png', 'jpg', 'jpeg', 'gif', 'bmp', 'webp', 'svg', 'ico'].includes(\n ext,\n );\n}\n\nfunction getThumbUrl(file: UploadFile): string | undefined {\n if (file.thumbUrl) return file.thumbUrl;\n if (file.url) return file.url;\n if (file.originFileObj && isImageUrl(file)) {\n try {\n return URL.createObjectURL(file.originFileObj);\n } catch {\n return undefined;\n }\n }\n return undefined;\n}\n\n// ---------------------------------------------------------------------------\n// UploadList\n// ---------------------------------------------------------------------------\n\nfunction UploadList({\n items = [],\n listType = 'text',\n showUploadList = true,\n onRemove,\n onPreview,\n disabled,\n}: UploadListProps) {\n if (!showUploadList || items.length === 0) return null;\n\n const showConfig: ShowUploadListInterface =\n typeof showUploadList === 'object'\n ? showUploadList\n : {\n showRemoveIcon: true,\n showPreviewIcon: true,\n showDownloadIcon: false,\n };\n\n const isPictureType = listType === 'picture' || listType === 'picture-card';\n\n return (\n <ul className={cn('ald-upload-list', `ald-upload-list-${listType}`)}>\n {items.map((file) => {\n const thumbUrl = isPictureType ? getThumbUrl(file) : undefined;\n\n return (\n <li\n key={file.uid}\n className={cn(\n 'ald-upload-list-item',\n `ald-upload-list-item-${file.status || 'done'}`,\n )}\n >\n {/* Thumbnail for picture types */}\n {isPictureType && (\n <div className=\"ald-upload-list-item-thumbnail\">\n {thumbUrl ? (\n <img src={thumbUrl} alt={file.name} />\n ) : (\n <div className=\"ald-upload-list-item-file-icon\">\n <FileIcon />\n </div>\n )}\n </div>\n )}\n\n {/* Status icon for text type */}\n {!isPictureType && (\n <span className=\"ald-upload-list-item-status-icon\">\n {file.status === 'uploading' && (\n <span className=\"ald-upload-list-item-loading-icon\">\n <LoadingLine style={{ fontSize: 14 }} />\n </span>\n )}\n {file.status === 'done' && (\n <CheckCircleFill style={{ fontSize: 14 }} />\n )}\n {file.status === 'error' && (\n <CloseCircleFill style={{ fontSize: 14 }} />\n )}\n </span>\n )}\n\n {/* File name */}\n <Tooltip title={file.name}>\n <span\n className=\"ald-upload-list-item-name\"\n onClick={() => onPreview?.(file)}\n style={onPreview ? { cursor: 'pointer' } : undefined}\n >\n {file.name}\n </span>\n </Tooltip>\n\n {/* Actions */}\n <span className=\"ald-upload-list-item-actions\">\n {showConfig.showPreviewIcon &&\n onPreview &&\n file.status === 'done' && (\n <button\n type=\"button\"\n className=\"ald-upload-list-item-action\"\n title=\"Preview\"\n onClick={() => onPreview(file)}\n >\n <EyeOnLine style={{ fontSize: 14 }} />\n </button>\n )}\n {showConfig.showRemoveIcon !== false && !disabled && (\n <button\n type=\"button\"\n className=\"ald-upload-list-item-action\"\n title=\"Remove\"\n onClick={() => onRemove?.(file)}\n >\n {listType === 'picture-card' ? (\n <TrashLightLine style={{ fontSize: 14 }} />\n ) : (\n <CloseLightLine style={{ fontSize: 14 }} />\n )}\n </button>\n )}\n </span>\n\n {/* Progress bar */}\n {file.status === 'uploading' && (\n <div className=\"ald-upload-list-item-progress\">\n <div\n className=\"ald-upload-list-item-progress-bar\"\n style={{ width: `${file.percent ?? 0}%` }}\n />\n </div>\n )}\n </li>\n );\n })}\n </ul>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Simple file icon SVG (inline to avoid extra dependency)\n// ---------------------------------------------------------------------------\n\nfunction FileIcon() {\n return (\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z\" />\n <polyline points=\"14 2 14 8 20 8\" />\n </svg>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Upload component\n// ---------------------------------------------------------------------------\n\nfunction Upload<T = any>(props: UploadProps<T>) {\n const {\n accept,\n action,\n method,\n headers,\n data,\n withCredentials,\n beforeUpload,\n customRequest,\n disabled = false,\n fileList: controlledFileList,\n defaultFileList,\n maxCount,\n multiple,\n directory,\n name = 'file',\n listType = 'text',\n showUploadList = true,\n onChange,\n onRemove,\n onPreview,\n onDownload,\n className,\n style,\n children,\n openFileDialogOnClick = true,\n id,\n } = props;\n\n const isControlled = controlledFileList !== undefined;\n const [internalFileList, setInternalFileList] = useState<UploadFile<T>[]>(\n defaultFileList ?? [],\n );\n\n const mergedFileList = isControlled ? controlledFileList! : internalFileList;\n\n // Keep a ref to latest list so callbacks always see fresh state\n const fileListRef = useRef(mergedFileList);\n fileListRef.current = mergedFileList;\n\n const rcUploadRef = useRef<any>(null);\n\n // ----- helpers to update state & fire onChange -----\n\n const updateFileList = useCallback(\n (newFile: UploadFile<T>, event?: UploadProgressEvent) => {\n const nextList = fileListRef.current.map((f) =>\n f.uid === newFile.uid ? newFile : f,\n );\n // If the file is new, append it\n if (!nextList.some((f) => f.uid === newFile.uid)) {\n nextList.push(newFile);\n }\n if (!isControlled) {\n setInternalFileList(nextList);\n }\n onChange?.({\n file: newFile,\n fileList: nextList,\n event,\n });\n },\n [isControlled, onChange],\n );\n\n // ----- rc-upload callback props -----\n\n const onBatchStart: RcUploadProps['onBatchStart'] = useCallback(\n (batchFileInfoList: { file: RcFile; parsedFile: any }[]) => {\n let nextList = [...fileListRef.current];\n\n for (const { file } of batchFileInfoList) {\n const uploadFile = fileToUploadFile(file, 'uploading') as UploadFile<T>;\n\n if (maxCount && nextList.length >= maxCount) {\n // replace if maxCount === 1, otherwise skip\n if (maxCount === 1) {\n nextList = [uploadFile];\n }\n continue;\n }\n nextList.push(uploadFile);\n }\n\n if (!isControlled) {\n setInternalFileList(nextList);\n }\n\n // Fire onChange for the first new file\n const firstNew = batchFileInfoList[0];\n if (firstNew) {\n const f = nextList.find((x) => x.uid === firstNew.file.uid);\n if (f) {\n onChange?.({ file: f, fileList: nextList });\n }\n }\n },\n [isControlled, maxCount, onChange],\n );\n\n const onRcProgress = useCallback(\n (event: UploadProgressEvent, file: RcFile) => {\n const target = fileListRef.current.find((f) => f.uid === file.uid);\n if (!target) return;\n const updated: UploadFile<T> = {\n ...target,\n status: 'uploading',\n percent: event.percent ?? 0,\n };\n updateFileList(updated, event);\n },\n [updateFileList],\n );\n\n const onRcSuccess = useCallback(\n (response: any, file: RcFile) => {\n const target = fileListRef.current.find((f) => f.uid === file.uid);\n if (!target) return;\n const updated: UploadFile<T> = {\n ...target,\n status: 'done',\n percent: 100,\n response,\n };\n updateFileList(updated);\n },\n [updateFileList],\n );\n\n const onRcError = useCallback(\n (error: Error, _ret: any, file: RcFile) => {\n const target = fileListRef.current.find((f) => f.uid === file.uid);\n if (!target) return;\n const updated: UploadFile<T> = {\n ...target,\n status: 'error',\n error,\n };\n updateFileList(updated);\n },\n [updateFileList],\n );\n\n // ----- remove handler -----\n\n const handleRemove = useCallback(\n async (file: UploadFile<T>) => {\n const result = await onRemove?.(file as any);\n if (result === false) return;\n const nextList = fileListRef.current.filter((f) => f.uid !== file.uid);\n if (!isControlled) {\n setInternalFileList(nextList);\n }\n const removedFile: UploadFile<T> = { ...file, status: 'removed' };\n onChange?.({ file: removedFile, fileList: nextList });\n },\n [isControlled, onChange, onRemove],\n );\n\n // ----- rc-upload props -----\n\n const rcUploadProps: RcUploadProps = useMemo(\n () => ({\n accept,\n action: action as RcUploadProps['action'],\n method,\n headers,\n data: data as RcUploadProps['data'],\n withCredentials,\n beforeUpload: beforeUpload as RcUploadProps['beforeUpload'],\n customRequest: customRequest as RcUploadProps['customRequest'],\n disabled,\n multiple,\n directory,\n name,\n openFileDialogOnClick,\n id,\n prefixCls: 'ald-upload',\n onBatchStart,\n onProgress: onRcProgress,\n onSuccess: onRcSuccess,\n onError: onRcError,\n }),\n [\n accept,\n action,\n method,\n headers,\n data,\n withCredentials,\n beforeUpload,\n customRequest,\n disabled,\n multiple,\n directory,\n name,\n openFileDialogOnClick,\n id,\n onBatchStart,\n onRcProgress,\n onRcSuccess,\n onRcError,\n ],\n );\n\n const isPictureCard = listType === 'picture-card';\n\n return (\n <span\n className={cn(\n 'ald-upload',\n { 'ald-upload-disabled': disabled },\n className,\n )}\n style={style}\n >\n {isPictureCard ? (\n // picture-card: render list first, then the upload trigger\n <>\n <UploadList\n items={mergedFileList as UploadFile[]}\n listType={listType}\n showUploadList={showUploadList}\n onRemove={handleRemove as any}\n onPreview={onPreview as any}\n onDownload={onDownload as any}\n disabled={disabled}\n />\n {(!maxCount || mergedFileList.length < maxCount) && (\n <RcUpload {...rcUploadProps} ref={rcUploadRef}>\n <div className=\"ald-upload-select\">{children}</div>\n </RcUpload>\n )}\n </>\n ) : (\n // text / picture: render trigger then list\n <>\n <RcUpload {...rcUploadProps} ref={rcUploadRef}>\n <div className=\"ald-upload-select\">{children}</div>\n </RcUpload>\n <UploadList\n items={mergedFileList as UploadFile[]}\n listType={listType}\n showUploadList={showUploadList}\n onRemove={handleRemove as any}\n onPreview={onPreview as any}\n onDownload={onDownload as any}\n disabled={disabled}\n />\n </>\n )}\n </span>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Dragger sub-component\n// ---------------------------------------------------------------------------\n\nfunction Dragger(props: DraggerProps) {\n const { height, style, disabled, className, children, ...restProps } = props;\n const [dragOver, setDragOver] = useState(false);\n\n const mergedStyle: React.CSSProperties = {\n ...style,\n ...(height !== null && height !== undefined ? { height } : {}),\n };\n\n return (\n <Upload\n {...restProps}\n disabled={disabled}\n className={cn('ald-upload-dragger-wrapper', className)}\n style={mergedStyle}\n >\n <div\n // antd 兼容:保留 ant-* class,消费方 CSS 可能依赖该选择器\n className={cn('ald-upload-dragger ant-upload-drag', {\n 'ald-upload-drag-hover': dragOver,\n 'ant-upload-drag-hover': dragOver,\n 'ald-upload-disabled': disabled,\n 'ant-upload-disabled': disabled,\n })}\n onDragOver={(e) => {\n e.preventDefault();\n if (!disabled) setDragOver(true);\n }}\n onDragLeave={() => setDragOver(false)}\n onDrop={() => setDragOver(false)}\n >\n {children}\n </div>\n </Upload>\n );\n}\n\nUpload.Dragger = Dragger;\n\nexport default Upload as typeof Upload & { Dragger: typeof Dragger };\n"],"mappings":";;;;;;;;;;;;;AAsHA,IAAI,UAAU;AAEd,SAAS,SAAiB;AACxB,YAAW;AACX,QAAO,cAAc,KAAK,KAAK,CAAC,GAAG;;AAGrC,SAAS,iBACP,MACA,SAA+B,aACnB;AACZ,QAAO;EACL,KAAK,KAAK,OAAO,QAAQ;EACzB,MAAM,KAAK;EACX,MAAM,KAAK;EACX,MAAM,KAAK;EACX;EACA,SAAS;EACT,eAAe;EAChB;;AAGH,SAAS,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AAI,CAAC,SAAU,aAAY,KAAK;;GAElC,mBAAmB,YAAY,MAAM;GACrC,cAAc,YAAY,MAAM;GAE/B;GACG,CAAA;EACC,CAAA;;AAIb,OAAO,UAAU"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/Upload/index.tsx"],"sourcesContent":["import './upload.css';\n\nimport RcUpload from 'rc-upload';\nimport type {\n RcFile as RcUploadFile,\n UploadProgressEvent,\n UploadProps as RcUploadProps,\n} from 'rc-upload/es/interface';\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\nimport {\n CheckCircleFill,\n CloseCircleFill,\n CloseLightLine,\n EyeOnLine,\n LoadingLine,\n TrashLightLine,\n} from '../Icon';\nimport { cn } from '../lib/utils';\nimport Tooltip from '../Tooltip';\n\n// ---------------------------------------------------------------------------\n// Public types – preserved from the previous API surface\n// ---------------------------------------------------------------------------\n\nexport interface UploadFile<T = any> {\n uid: string;\n name: string;\n status?: 'uploading' | 'done' | 'error' | 'removed';\n url?: string;\n thumbUrl?: string;\n size?: number;\n type?: string;\n percent?: number;\n originFileObj?: RcFile;\n response?: T;\n error?: any;\n linkProps?: any;\n}\n\nexport type RcFile = RcUploadFile;\n\nexport interface UploadChangeParam<T = UploadFile> {\n file: T;\n fileList: T[];\n event?: UploadProgressEvent;\n}\n\nexport interface ShowUploadListInterface {\n showRemoveIcon?: boolean;\n showPreviewIcon?: boolean;\n showDownloadIcon?: boolean;\n}\n\nexport interface UploadProps<T = any> {\n accept?: string;\n action?: string | ((file: RcFile) => string | Promise<string>);\n method?: 'POST' | 'PUT' | 'PATCH' | 'post' | 'put' | 'patch';\n headers?: Record<string, string>;\n data?:\n | Record<string, unknown>\n | ((file: RcFile | string | Blob) => Record<string, unknown>);\n withCredentials?: boolean;\n beforeUpload?: (\n file: RcFile,\n fileList: RcFile[],\n ) => boolean | void | Blob | File | Promise<boolean | void | Blob | File>;\n customRequest?: (options: {\n file: RcFile;\n filename?: string;\n data?: Record<string, unknown>;\n headers?: Record<string, string>;\n onProgress?: (event: { percent: number }) => void;\n onSuccess?: (body: unknown, xhr?: XMLHttpRequest) => void;\n onError?: (event: Error) => void;\n withCredentials?: boolean;\n action?: string;\n method?: string;\n }) => void;\n disabled?: boolean;\n fileList?: UploadFile<T>[];\n defaultFileList?: UploadFile<T>[];\n maxCount?: number;\n multiple?: boolean;\n directory?: boolean;\n name?: string;\n listType?: 'text' | 'picture' | 'picture-card';\n showUploadList?: boolean | ShowUploadListInterface;\n onChange?: (info: UploadChangeParam<UploadFile<T>>) => void;\n onRemove?: (file: UploadFile<T>) => void | boolean | Promise<void | boolean>;\n onPreview?: (file: UploadFile<T>) => void;\n onDownload?: (file: UploadFile<T>) => void;\n className?: string;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n openFileDialogOnClick?: boolean;\n /** @deprecated Use `id` instead */\n prefixCls?: string;\n id?: string;\n}\n\nexport interface UploadListProps {\n items?: UploadFile[];\n listType?: 'text' | 'picture' | 'picture-card';\n showUploadList?: boolean | ShowUploadListInterface;\n onRemove?: (file: UploadFile) => void;\n onPreview?: (file: UploadFile) => void;\n onDownload?: (file: UploadFile) => void;\n disabled?: boolean;\n}\n\nexport interface DraggerProps extends UploadProps {\n height?: number;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nlet fileUid = 0;\n\nfunction getUid(): string {\n fileUid += 1;\n return `ald-upload-${Date.now()}-${fileUid}`;\n}\n\nfunction fileToUploadFile(\n file: RcFile,\n status: UploadFile['status'] = 'uploading',\n): UploadFile {\n return {\n uid: file.uid ?? getUid(),\n name: file.name,\n size: file.size,\n type: file.type,\n status,\n percent: 0,\n originFileObj: file,\n };\n}\n\nfunction isImageUrl(file: UploadFile): boolean {\n if (file.type) return file.type.startsWith('image/');\n const ext = file.name?.split('.').pop()?.toLowerCase() ?? '';\n return ['png', 'jpg', 'jpeg', 'gif', 'bmp', 'webp', 'svg', 'ico'].includes(\n ext,\n );\n}\n\nfunction getThumbUrl(file: UploadFile): string | undefined {\n if (file.thumbUrl) return file.thumbUrl;\n if (file.url) return file.url;\n if (file.originFileObj && isImageUrl(file)) {\n try {\n return URL.createObjectURL(file.originFileObj);\n } catch {\n return undefined;\n }\n }\n return undefined;\n}\n\n// ---------------------------------------------------------------------------\n// UploadList\n// ---------------------------------------------------------------------------\n\nfunction UploadList({\n items = [],\n listType = 'text',\n showUploadList = true,\n onRemove,\n onPreview,\n disabled,\n}: UploadListProps) {\n if (!showUploadList || items.length === 0) return null;\n\n const showConfig: ShowUploadListInterface =\n typeof showUploadList === 'object'\n ? showUploadList\n : {\n showRemoveIcon: true,\n showPreviewIcon: true,\n showDownloadIcon: false,\n };\n\n const isPictureType = listType === 'picture' || listType === 'picture-card';\n\n return (\n <ul className={cn('ald-upload-list', `ald-upload-list-${listType}`)}>\n {items.map((file) => {\n const thumbUrl = isPictureType ? getThumbUrl(file) : undefined;\n\n return (\n <li\n key={file.uid}\n className={cn(\n 'ald-upload-list-item',\n `ald-upload-list-item-${file.status || 'done'}`,\n )}\n >\n {/* Thumbnail for picture types */}\n {isPictureType && (\n <div className=\"ald-upload-list-item-thumbnail\">\n {thumbUrl ? (\n <img src={thumbUrl} alt={file.name} />\n ) : (\n <div className=\"ald-upload-list-item-file-icon\">\n <FileIcon />\n </div>\n )}\n </div>\n )}\n\n {/* Status icon for text type */}\n {!isPictureType && (\n <span className=\"ald-upload-list-item-status-icon\">\n {file.status === 'uploading' && (\n <span className=\"ald-upload-list-item-loading-icon\">\n <LoadingLine style={{ fontSize: 14 }} />\n </span>\n )}\n {file.status === 'done' && (\n <CheckCircleFill style={{ fontSize: 14 }} />\n )}\n {file.status === 'error' && (\n <CloseCircleFill style={{ fontSize: 14 }} />\n )}\n </span>\n )}\n\n {/* File name */}\n <Tooltip title={file.name}>\n <span\n className=\"ald-upload-list-item-name\"\n onClick={() => onPreview?.(file)}\n style={onPreview ? { cursor: 'pointer' } : undefined}\n >\n {file.name}\n </span>\n </Tooltip>\n\n {/* Actions */}\n <span className=\"ald-upload-list-item-actions\">\n {showConfig.showPreviewIcon &&\n onPreview &&\n file.status === 'done' && (\n <button\n type=\"button\"\n className=\"ald-upload-list-item-action\"\n title=\"Preview\"\n onClick={() => onPreview(file)}\n >\n <EyeOnLine style={{ fontSize: 14 }} />\n </button>\n )}\n {showConfig.showRemoveIcon !== false && !disabled && (\n <button\n type=\"button\"\n className=\"ald-upload-list-item-action\"\n title=\"Remove\"\n onClick={() => onRemove?.(file)}\n >\n {listType === 'picture-card' ? (\n <TrashLightLine style={{ fontSize: 14 }} />\n ) : (\n <CloseLightLine style={{ fontSize: 14 }} />\n )}\n </button>\n )}\n </span>\n\n {/* Progress bar */}\n {file.status === 'uploading' && (\n <div className=\"ald-upload-list-item-progress\">\n <div\n className=\"ald-upload-list-item-progress-bar\"\n style={{ width: `${file.percent ?? 0}%` }}\n />\n </div>\n )}\n </li>\n );\n })}\n </ul>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Simple file icon SVG (inline to avoid extra dependency)\n// ---------------------------------------------------------------------------\n\nfunction FileIcon() {\n return (\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z\" />\n <polyline points=\"14 2 14 8 20 8\" />\n </svg>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Upload component\n// ---------------------------------------------------------------------------\n\nfunction Upload<T = any>(props: UploadProps<T>) {\n const {\n accept,\n action,\n method,\n headers,\n data,\n withCredentials,\n beforeUpload,\n customRequest,\n disabled = false,\n fileList: controlledFileList,\n defaultFileList,\n maxCount,\n multiple,\n directory,\n name = 'file',\n listType = 'text',\n showUploadList = true,\n onChange,\n onRemove,\n onPreview,\n onDownload,\n className,\n style,\n children,\n openFileDialogOnClick = true,\n id,\n } = props;\n\n const isControlled = controlledFileList !== undefined;\n const [internalFileList, setInternalFileList] = useState<UploadFile<T>[]>(\n defaultFileList ?? [],\n );\n\n const mergedFileList = isControlled ? controlledFileList! : internalFileList;\n\n // Keep a ref to latest list so callbacks always see fresh state\n const fileListRef = useRef(mergedFileList);\n fileListRef.current = mergedFileList;\n\n const rcUploadRef = useRef<any>(null);\n\n // ----- helpers to update state & fire onChange -----\n\n const updateFileList = useCallback(\n (newFile: UploadFile<T>, event?: UploadProgressEvent) => {\n const nextList = fileListRef.current.map((f) =>\n f.uid === newFile.uid ? newFile : f,\n );\n // If the file is new, append it\n if (!nextList.some((f) => f.uid === newFile.uid)) {\n nextList.push(newFile);\n }\n if (!isControlled) {\n setInternalFileList(nextList);\n }\n onChange?.({\n file: newFile,\n fileList: nextList,\n event,\n });\n },\n [isControlled, onChange],\n );\n\n // ----- rc-upload callback props -----\n\n const onBatchStart: RcUploadProps['onBatchStart'] = useCallback(\n (batchFileInfoList: { file: RcFile; parsedFile: any }[]) => {\n let nextList = [...fileListRef.current];\n\n for (const { file } of batchFileInfoList) {\n const uploadFile = fileToUploadFile(file, 'uploading') as UploadFile<T>;\n\n if (maxCount && nextList.length >= maxCount) {\n // replace if maxCount === 1, otherwise skip\n if (maxCount === 1) {\n nextList = [uploadFile];\n }\n continue;\n }\n nextList.push(uploadFile);\n }\n\n if (!isControlled) {\n setInternalFileList(nextList);\n }\n\n // Fire onChange for the first new file\n const firstNew = batchFileInfoList[0];\n if (firstNew) {\n const f = nextList.find((x) => x.uid === firstNew.file.uid);\n if (f) {\n onChange?.({ file: f, fileList: nextList });\n }\n }\n },\n [isControlled, maxCount, onChange],\n );\n\n const onRcProgress = useCallback(\n (event: UploadProgressEvent, file: RcFile) => {\n const target = fileListRef.current.find((f) => f.uid === file.uid);\n if (!target) return;\n const updated: UploadFile<T> = {\n ...target,\n status: 'uploading',\n percent: event.percent ?? 0,\n };\n updateFileList(updated, event);\n },\n [updateFileList],\n );\n\n const onRcSuccess = useCallback(\n (response: any, file: RcFile) => {\n const target = fileListRef.current.find((f) => f.uid === file.uid);\n if (!target) return;\n const updated: UploadFile<T> = {\n ...target,\n status: 'done',\n percent: 100,\n response,\n };\n updateFileList(updated);\n },\n [updateFileList],\n );\n\n const onRcError = useCallback(\n (error: Error, _ret: any, file: RcFile) => {\n const target = fileListRef.current.find((f) => f.uid === file.uid);\n if (!target) return;\n const updated: UploadFile<T> = {\n ...target,\n status: 'error',\n error,\n };\n updateFileList(updated);\n },\n [updateFileList],\n );\n\n // ----- remove handler -----\n\n const handleRemove = useCallback(\n async (file: UploadFile<T>) => {\n const result = await onRemove?.(file as any);\n if (result === false) return;\n const nextList = fileListRef.current.filter((f) => f.uid !== file.uid);\n if (!isControlled) {\n setInternalFileList(nextList);\n }\n const removedFile: UploadFile<T> = { ...file, status: 'removed' };\n onChange?.({ file: removedFile, fileList: nextList });\n },\n [isControlled, onChange, onRemove],\n );\n\n // ----- rc-upload props -----\n\n const rcUploadProps: RcUploadProps = useMemo(\n () => ({\n accept,\n action: action as RcUploadProps['action'],\n method,\n headers,\n data: data as RcUploadProps['data'],\n withCredentials,\n beforeUpload: beforeUpload as RcUploadProps['beforeUpload'],\n customRequest: customRequest as RcUploadProps['customRequest'],\n disabled,\n multiple,\n directory,\n name,\n openFileDialogOnClick,\n id,\n prefixCls: 'ald-upload',\n onBatchStart,\n onProgress: onRcProgress,\n onSuccess: onRcSuccess,\n onError: onRcError,\n }),\n [\n accept,\n action,\n method,\n headers,\n data,\n withCredentials,\n beforeUpload,\n customRequest,\n disabled,\n multiple,\n directory,\n name,\n openFileDialogOnClick,\n id,\n onBatchStart,\n onRcProgress,\n onRcSuccess,\n onRcError,\n ],\n );\n\n const isPictureCard = listType === 'picture-card';\n\n return (\n <span\n className={cn(\n 'ald-upload',\n { 'ald-upload-disabled': disabled },\n className,\n )}\n style={style}\n >\n {isPictureCard ? (\n // picture-card: render list first, then the upload trigger\n <>\n <UploadList\n items={mergedFileList as UploadFile[]}\n listType={listType}\n showUploadList={showUploadList}\n onRemove={handleRemove as any}\n onPreview={onPreview as any}\n onDownload={onDownload as any}\n disabled={disabled}\n />\n {(!maxCount || mergedFileList.length < maxCount) && (\n <RcUpload {...rcUploadProps} ref={rcUploadRef}>\n <div className=\"ald-upload-select\">{children}</div>\n </RcUpload>\n )}\n </>\n ) : (\n // text / picture: render trigger then list\n <>\n <RcUpload {...rcUploadProps} ref={rcUploadRef}>\n <div className=\"ald-upload-select\">{children}</div>\n </RcUpload>\n <UploadList\n items={mergedFileList as UploadFile[]}\n listType={listType}\n showUploadList={showUploadList}\n onRemove={handleRemove as any}\n onPreview={onPreview as any}\n onDownload={onDownload as any}\n disabled={disabled}\n />\n </>\n )}\n </span>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Dragger sub-component\n// ---------------------------------------------------------------------------\n\nfunction Dragger(props: DraggerProps) {\n const { height, style, disabled, className, children, ...restProps } = props;\n const [dragOver, setDragOver] = useState(false);\n\n const mergedStyle: React.CSSProperties = {\n ...style,\n ...(height !== null && height !== undefined ? { height } : {}),\n };\n\n return (\n <Upload\n {...restProps}\n disabled={disabled}\n className={cn('ald-upload-dragger-wrapper', className)}\n style={mergedStyle}\n >\n <div\n // antd 兼容:保留 ant-* class,消费方 CSS 可能依赖该选择器\n className={cn('ald-upload-dragger ant-upload-drag', {\n 'ald-upload-drag-hover': dragOver,\n 'ant-upload-drag-hover': dragOver,\n 'ald-upload-disabled': disabled,\n 'ant-upload-disabled': disabled,\n })}\n onDragOver={(e) => {\n e.preventDefault();\n if (!disabled) setDragOver(true);\n }}\n onDragLeave={() => setDragOver(false)}\n onDrop={() => setDragOver(false)}\n >\n {children}\n </div>\n </Upload>\n );\n}\n\nUpload.Dragger = Dragger;\n\nexport default Upload as typeof Upload & { Dragger: typeof Dragger };\n"],"mappings":";;;;;;;;;;;;;AAsHA,IAAI,UAAU;AAEd,SAAS,SAAiB;AACxB,YAAW;AACX,QAAO,cAAc,KAAK,KAAK,CAAC,G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