@aloudata/aloudata-design 3.0.0-beta.1 → 3.0.0-beta.10

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 (133) hide show
  1. package/dist/AMenu.d.ts +2 -0
  2. package/dist/AProgress.d.ts +2 -0
  3. package/dist/Alert.d.ts +2 -0
  4. package/dist/App.d.ts +2 -0
  5. package/dist/Avatar/component/Avatar.d.ts +2 -0
  6. package/dist/Avatar.d.ts +2 -0
  7. package/dist/Badge.d.ts +2 -0
  8. package/dist/Breadcrumb.d.ts +2 -0
  9. package/dist/Button/index.d.ts +2 -0
  10. package/dist/Button/index.js.map +1 -1
  11. package/dist/Button.d.ts +2 -0
  12. package/dist/Card.d.ts +2 -0
  13. package/dist/Carousel.d.ts +2 -0
  14. package/dist/Checkbox/component/CheckboxGroup.d.ts +2 -0
  15. package/dist/Checkbox/type.d.ts +2 -1
  16. package/dist/Checkbox.d.ts +2 -0
  17. package/dist/Col.d.ts +2 -0
  18. package/dist/Collapse/index.d.ts +2 -0
  19. package/dist/Collapse/index.js.map +1 -1
  20. package/dist/Collapse.d.ts +2 -0
  21. package/dist/ColorPicker/ComplexColorPicker.d.ts +2 -0
  22. package/dist/ColorPicker.d.ts +2 -0
  23. package/dist/ConfigProvider.d.ts +2 -0
  24. package/dist/DataPreviewTable/components/Body.d.ts +2 -0
  25. package/dist/DataPreviewTable/components/DragBar.d.ts +2 -0
  26. package/dist/DataPreviewTable/components/Header.d.ts +2 -0
  27. package/dist/DataPreviewTable.d.ts +2 -0
  28. package/dist/DatePicker/index.d.ts +38 -3
  29. package/dist/DatePicker/index.js +56 -10
  30. package/dist/DatePicker/index.js.map +1 -1
  31. package/dist/DatePicker.d.ts +2 -0
  32. package/dist/Divider.d.ts +2 -0
  33. package/dist/DoubleCircleIcon.d.ts +2 -0
  34. package/dist/Drawer/index.d.ts +1 -0
  35. package/dist/Drawer/index.js.map +1 -1
  36. package/dist/Drawer.d.ts +2 -0
  37. package/dist/Dropdown.d.ts +2 -0
  38. package/dist/Empty.d.ts +2 -0
  39. package/dist/Form/index.d.ts +54 -4
  40. package/dist/Form/index.js +3 -1
  41. package/dist/Form/index.js.map +1 -1
  42. package/dist/Form.d.ts +2 -0
  43. package/dist/HighlightText.d.ts +2 -0
  44. package/dist/Icon.d.ts +2 -0
  45. package/dist/IconButton.d.ts +2 -0
  46. package/dist/Input/components/Input/index.d.ts +8 -2
  47. package/dist/Input/components/Input/index.js +5 -1
  48. package/dist/Input/components/Input/index.js.map +1 -1
  49. package/dist/Input/components/Input.d.ts +2 -0
  50. package/dist/Input/components/Password.d.ts +2 -0
  51. package/dist/Input/components/TextArea/index.d.ts +4 -0
  52. package/dist/Input/components/TextArea/index.js.map +1 -1
  53. package/dist/Input/components/TextArea.d.ts +2 -0
  54. package/dist/Input.d.ts +2 -0
  55. package/dist/InputNumber/type.d.ts +3 -2
  56. package/dist/InputNumber.d.ts +2 -0
  57. package/dist/InputSearch.d.ts +2 -0
  58. package/dist/Layout.d.ts +2 -0
  59. package/dist/List.d.ts +2 -0
  60. package/dist/LogicTree/components/DisplayLogicItem.d.ts +2 -0
  61. package/dist/LogicTree/components/LogicItem.d.ts +2 -0
  62. package/dist/LogicTree.d.ts +2 -0
  63. package/dist/MemberPicker/utils.d.ts +2 -0
  64. package/dist/MemberPicker.d.ts +2 -0
  65. package/dist/Menu.d.ts +2 -0
  66. package/dist/Modal/index.d.ts +5 -2
  67. package/dist/Modal/index.js.map +1 -1
  68. package/dist/Modal.d.ts +2 -0
  69. package/dist/OverflowCount.d.ts +2 -0
  70. package/dist/Pagination.d.ts +2 -0
  71. package/dist/Popconfirm.d.ts +2 -0
  72. package/dist/Popover/index.d.ts +1 -0
  73. package/dist/Popover/index.js.map +1 -1
  74. package/dist/Popover.d.ts +2 -0
  75. package/dist/Progress.d.ts +2 -0
  76. package/dist/Radio/components/Group.d.ts +2 -0
  77. package/dist/Radio/components/Radio.d.ts +2 -0
  78. package/dist/Radio.d.ts +2 -0
  79. package/dist/RenameInput.d.ts +2 -0
  80. package/dist/Result.d.ts +2 -0
  81. package/dist/Row.d.ts +2 -0
  82. package/dist/ScrollArea.d.ts +2 -0
  83. package/dist/Select/Selector.d.ts +2 -0
  84. package/dist/Select.d.ts +2 -0
  85. package/dist/Skeleton.d.ts +2 -0
  86. package/dist/Slider.d.ts +2 -0
  87. package/dist/Space.d.ts +2 -0
  88. package/dist/Spin/CustomIcon.d.ts +2 -0
  89. package/dist/Spin.d.ts +2 -0
  90. package/dist/StatusLight.d.ts +2 -0
  91. package/dist/Steps/components/CustomDot.d.ts +2 -0
  92. package/dist/Steps/components/ProcessIcon.d.ts +2 -0
  93. package/dist/Steps/components/Step.d.ts +2 -0
  94. package/dist/Steps.d.ts +2 -0
  95. package/dist/Switch/test.d.ts +2 -0
  96. package/dist/Switch.d.ts +2 -0
  97. package/dist/Table/components/Footer.d.ts +2 -0
  98. package/dist/Table.d.ts +2 -0
  99. package/dist/Tabs/index.d.ts +1 -0
  100. package/dist/Tabs/index.js.map +1 -1
  101. package/dist/Tabs.d.ts +2 -0
  102. package/dist/Tag.d.ts +2 -0
  103. package/dist/TextLink.d.ts +2 -0
  104. package/dist/Tooltip/index.d.ts +7 -1
  105. package/dist/Tooltip/index.js.map +1 -1
  106. package/dist/Tooltip.d.ts +2 -0
  107. package/dist/Tour.d.ts +2 -0
  108. package/dist/Tree/DirectoryTree.d.ts +2 -2
  109. package/dist/Tree/DirectoryTree.js.map +1 -1
  110. package/dist/Tree/Tree.d.ts +2 -2
  111. package/dist/Tree/Tree2.js.map +1 -1
  112. package/dist/Tree/index.d.ts +5 -2
  113. package/dist/Tree/index.js.map +1 -1
  114. package/dist/Tree.d.ts +2 -0
  115. package/dist/Typography.d.ts +2 -0
  116. package/dist/Upload/index.d.ts +15 -2
  117. package/dist/Upload/index.js.map +1 -1
  118. package/dist/Upload.d.ts +2 -0
  119. package/dist/User.d.ts +2 -0
  120. package/dist/Watermark.d.ts +2 -0
  121. package/dist/index.d.ts +11 -3
  122. package/dist/index.js +4 -1
  123. package/dist/locale/default.d.ts +2 -1
  124. package/dist/locale/default.js +4 -4
  125. package/dist/locale/en_US.d.ts +1 -0
  126. package/dist/locale/en_US.js +2 -0
  127. package/dist/locale/en_US.js.map +1 -1
  128. package/dist/locale/zh_CN.d.ts +1 -0
  129. package/dist/locale/zh_CN.js +2 -0
  130. package/dist/locale/zh_CN.js.map +1 -1
  131. package/dist/message.d.ts +2 -0
  132. package/dist/notification.d.ts +2 -0
  133. package/package.json +3 -2
@@ -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 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 DraggableConfig {\n icon?: React.ReactNode | false;\n nodeDraggable?: 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\nconst Tree = React.forwardRef<RcTree, 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 const draggableConfig = React.useMemo(() => {\n if (!draggable) {\n return false;\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 = {\n icon: newIcon,\n };\n switch (typeof draggable) {\n case 'function':\n mergedDraggable.nodeDraggable = draggable;\n break;\n case 'object':\n mergedDraggable = { ...draggable, icon: newIcon };\n break;\n default:\n break;\n // Do nothing\n }\n\n return mergedDraggable;\n }, [draggable]);\n const renderIndent = (nodeProps: AldTreeNodeProps) => {\n const { pos, isLeaf } = nodeProps as AldTreeNodeProps & { pos?: string };\n // Determine level from `pos` string (e.g. \"0-0-1\" → level 2)\n const level = pos ? pos.split('-').length - 1 : 0;\n const iconSize = TREE_SWITCH_CION_SIZE;\n let indentWidth = isLeaf ? iconSize : 0;\n indentWidth += level * (iconSize / 2);\n return <span style={{ width: indentWidth, flexShrink: 0 }}></span>;\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 const noChildren = React.useMemo(() => {\n if (newTreeData?.length) {\n return newTreeData.every((node) => {\n return !node.children?.length && node.isLeaf !== false;\n });\n }\n return true;\n }, [newTreeData]);\n\n return (\n <RcTree\n itemHeight={20}\n ref={ref}\n virtual={virtual}\n {...newProps}\n prefixCls={prefixCls}\n treeData={newTreeData}\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 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":";;;;;;;;;;;;;;;;AAeA,IAAM,wBAAwB;AAC9B,IAAM,0BAA0B;AAkKhC,IAAM,OAAO,QAAM,YAA+B,OAAO,QAAQ;CAC/D,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;CAC3B,MAAM,EACJ,WACA,WAAW,OACX,UACA,YAAY,OACZ,UACA,YAAY,OACZ,aAAa,MACb,WACA,aACA,eACA,gBAAgB,MAChB,gBACA,UACA,mBACA,SAAS;EAAE,GAAG;EAAgB,cAAc;EAAO,EACnD,GAAG,SACD;CACJ,MAAM,YAAY,aAAa,QAAQ,WAAW;CAElD,MAAM,oBAAoB,QAAM,aAC7B,SAAmB;AAMlB,SACE,qBAAA,UAAA,EAAA,UAAA;GANoB,cAClB,YAAY,KAAK,GACjB,OAAO,KAAK,UAAU,aACtB,KAAK,MAAM,KAAK,GAChB,KAAK;GAIJ,iBAAiB,oBAAC,OAAD,EAAK,WAAU,uBAA4B,CAAA;GAC5D,iBAAkB,cAAc,KAAK;GACrC,EAAA,CAAA;IAGP;EAAC;EAAa;EAAe;EAAc,CAC5C;CACD,MAAM,WAAW;EACf,GAAG;EACH;EACA;EACA;EACA;EACA;EACA,UAAU,QAAQ,SAAS;EAC3B;EACA,aAAa;EACd;CAED,MAAM,kBAAkB,QAAM,cAAc;AAC1C,MAAI,CAAC,UACH,QAAO;EAET,MAAM,UACJ,oBAAC,QAAD;GACE,MAAM;GACN,OAAO;GAC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CAAC,KAAK,UAAU,UAAU,KAAK,WAAW;IACjD;AAEJ,SAAO;IACN,CAAC,YAAY,CAAC;AAEjB,QACE,oBAAC,QAAD;EACE,YAAY;EACP;EACI;EACT,GAAI;EACO;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,EACD,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"}
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 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 DraggableConfig {\n icon?: React.ReactNode | false;\n nodeDraggable?: 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 const draggableConfig = React.useMemo(() => {\n if (!draggable) {\n return false;\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 = {\n icon: newIcon,\n };\n switch (typeof draggable) {\n case 'function':\n mergedDraggable.nodeDraggable = draggable;\n break;\n case 'object':\n mergedDraggable = { ...draggable, icon: newIcon };\n break;\n default:\n break;\n // Do nothing\n }\n\n return mergedDraggable;\n }, [draggable]);\n const renderIndent = (nodeProps: AldTreeNodeProps) => {\n const { pos, isLeaf } = nodeProps as AldTreeNodeProps & { pos?: string };\n // Determine level from `pos` string (e.g. \"0-0-1\" → level 2)\n const level = pos ? pos.split('-').length - 1 : 0;\n const iconSize = TREE_SWITCH_CION_SIZE;\n let indentWidth = isLeaf ? iconSize : 0;\n indentWidth += level * (iconSize / 2);\n return <span style={{ width: indentWidth, flexShrink: 0 }}></span>;\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 const noChildren = React.useMemo(() => {\n if (newTreeData?.length) {\n return newTreeData.every((node) => {\n return !node.children?.length && node.isLeaf !== false;\n });\n }\n return true;\n }, [newTreeData]);\n\n return (\n <RcTree\n itemHeight={20}\n ref={ref}\n virtual={virtual}\n {...newProps}\n prefixCls={prefixCls}\n treeData={newTreeData}\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 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":";;;;;;;;;;;;;;;;AAeA,IAAM,wBAAwB;AAC9B,IAAM,0BAA0B;AAmKhC,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;CAC3B,MAAM,EACJ,WACA,WAAW,OACX,UACA,YAAY,OACZ,UACA,YAAY,OACZ,aAAa,MACb,WACA,aACA,eACA,gBAAgB,MAChB,gBACA,UACA,mBACA,SAAS;EAAE,GAAG;EAAgB,cAAc;EAAO,EACnD,GAAG,SACD;CACJ,MAAM,YAAY,aAAa,QAAQ,WAAW;CAElD,MAAM,oBAAoB,QAAM,aAC7B,SAAmB;AAMlB,SACE,qBAAA,UAAA,EAAA,UAAA;GANoB,cAClB,YAAY,KAAK,GACjB,OAAO,KAAK,UAAU,aACtB,KAAK,MAAM,KA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/C,MAAK,WAAW,QADJ,2BACiB,IAAI;AAEnC,OAAI,qBAAqB,OAAO,KAAK,UAAU,WAC7C,MAAK,QACH,oBAAC,eAAD;IAAe,SAAS;cACrB,KAAK;IACQ,CAAA;AAGpB,UAAO;;AAOT,SALoB,QAAQ,WAAW,UAAU;AAC/C,QAAK,MAAM,YAAY,MACrB,oBAAmB,SAAS;IAE9B;IAED;EAAC;EAAgB;EAAU;EAAkB,CAAC;CAEjD,MAAM,aAAa,QAAM,cAAc;AACrC,MAAI,aAAa,OACf,QAAO,YAAY,OAAO,SAAS;AACjC,UAAO,CAAC,KAAK,UAAU,UAAU,KAAK,WAAW;IACjD;AAEJ,SAAO;IACN,CAAC,YAAY,CAAC;AAEjB,QACE,oBAAC,QAAD;EACE,YAAY;EACP;EACI;EACT,GAAI;EACO;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,EACD,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"}
@@ -1,13 +1,16 @@
1
- import { default as RcTree, BasicDataNode, TreeNode } from 'rc-tree';
1
+ import { BasicDataNode, TreeNode } from 'rc-tree';
2
2
  import { DataNode } from 'rc-tree/es/interface';
3
3
  import { default as DirectoryTree } from './DirectoryTree.js';
4
4
  import { TreeProps } from './Tree.js';
5
+ import type * as React from 'react';
5
6
  export type { EventDataNode } from 'rc-tree/es/interface';
6
7
  export type { ExpandAction as DirectoryTreeExpandAction, DirectoryTreeProps, } from './DirectoryTree.js';
7
8
  export type { AldTreeNode, AldTreeNodeAttribute, AldTreeNodeCheckedEvent, AldTreeNodeExpandedEvent, AldTreeNodeMouseEvent, AldTreeNodeProps, AldTreeNodeSelectedEvent, TreeProps, } from './Tree.js';
8
9
  export type { DataNode };
10
+ /** Public Tree ref type — hides rc-tree internals from consumers */
11
+ export type TreeRef = any;
9
12
  type CompoundedComponent = (<T extends BasicDataNode | DataNode = DataNode>(props: React.PropsWithChildren<TreeProps<T>> & {
10
- ref?: React.Ref<RcTree>;
13
+ ref?: React.Ref<TreeRef>;
11
14
  }) => React.ReactElement) & {
12
15
  TreeNode: typeof TreeNode;
13
16
  DirectoryTree: typeof DirectoryTree;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/Tree/index.tsx"],"sourcesContent":["import type RcTree from 'rc-tree';\nimport type { BasicDataNode } from 'rc-tree';\nimport { TreeNode } from 'rc-tree';\nimport type { DataNode } from 'rc-tree/es/interface';\nimport DirectoryTree from './DirectoryTree';\nimport type { TreeProps } from './Tree';\nimport TreePure from './Tree';\n\nexport type { EventDataNode } from 'rc-tree/es/interface';\nexport type {\n ExpandAction as DirectoryTreeExpandAction,\n DirectoryTreeProps,\n} from './DirectoryTree';\nexport type {\n AldTreeNode,\n AldTreeNodeAttribute,\n AldTreeNodeCheckedEvent,\n AldTreeNodeExpandedEvent,\n AldTreeNodeMouseEvent,\n AldTreeNodeProps,\n AldTreeNodeSelectedEvent,\n TreeProps,\n} from './Tree';\nexport type { DataNode };\n\ntype CompoundedComponent = (<T extends BasicDataNode | DataNode = DataNode>(\n props: React.PropsWithChildren<TreeProps<T>> & { ref?: React.Ref<RcTree> },\n) => React.ReactElement) & {\n TreeNode: typeof TreeNode;\n DirectoryTree: typeof DirectoryTree;\n};\n\nconst Tree = TreePure as unknown as CompoundedComponent;\nTree.DirectoryTree = DirectoryTree;\nTree.TreeNode = TreeNode;\n\nexport default Tree;\n"],"mappings":";;;;AAgCA,IAAM,OAAO;AACb,KAAK,gBAAgB;AACrB,KAAK,WAAW"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/Tree/index.tsx"],"sourcesContent":["import type * as React from 'react';\nimport type { BasicDataNode } from 'rc-tree';\nimport { TreeNode } from 'rc-tree';\nimport type { DataNode } from 'rc-tree/es/interface';\nimport DirectoryTree from './DirectoryTree';\nimport type { TreeProps } from './Tree';\nimport TreePure from './Tree';\n\nexport type { EventDataNode } from 'rc-tree/es/interface';\nexport type {\n ExpandAction as DirectoryTreeExpandAction,\n DirectoryTreeProps,\n} from './DirectoryTree';\nexport type {\n AldTreeNode,\n AldTreeNodeAttribute,\n AldTreeNodeCheckedEvent,\n AldTreeNodeExpandedEvent,\n AldTreeNodeMouseEvent,\n AldTreeNodeProps,\n AldTreeNodeSelectedEvent,\n TreeProps,\n} from './Tree';\nexport type { DataNode };\n\n/** Public Tree ref type — hides rc-tree internals from consumers */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type TreeRef = any;\n\ntype CompoundedComponent = (<T extends BasicDataNode | DataNode = DataNode>(\n props: React.PropsWithChildren<TreeProps<T>> & {\n ref?: React.Ref<TreeRef>;\n },\n) => React.ReactElement) & {\n TreeNode: typeof TreeNode;\n DirectoryTree: typeof DirectoryTree;\n};\n\nconst Tree = TreePure as unknown as CompoundedComponent;\nTree.DirectoryTree = DirectoryTree;\nTree.TreeNode = TreeNode;\n\nexport default Tree;\n"],"mappings":";;;;AAsCA,IAAM,OAAO;AACb,KAAK,gBAAgB;AACrB,KAAK,WAAW"}
package/dist/Tree.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './Tree/index.js';
2
+ export { default } from './Tree/index.js';
@@ -0,0 +1,2 @@
1
+ export * from './Typography/index.js';
2
+ export { default } from './Typography/index.js';
@@ -1,4 +1,4 @@
1
- import { RcFile as RcUploadFile, UploadProgressEvent, UploadProps as RcUploadProps } from 'rc-upload/es/interface';
1
+ import { RcFile as RcUploadFile, UploadProgressEvent } from 'rc-upload/es/interface';
2
2
  import { default as React } from 'react';
3
3
  export interface UploadFile<T = any> {
4
4
  uid: string;
@@ -33,7 +33,20 @@ export interface UploadProps<T = any> {
33
33
  data?: Record<string, unknown> | ((file: RcFile | string | Blob) => Record<string, unknown>);
34
34
  withCredentials?: boolean;
35
35
  beforeUpload?: (file: RcFile, fileList: RcFile[]) => boolean | Promise<void | Blob | File>;
36
- customRequest?: RcUploadProps['customRequest'];
36
+ customRequest?: (options: {
37
+ file: RcFile;
38
+ filename?: string;
39
+ data?: Record<string, unknown>;
40
+ headers?: Record<string, string>;
41
+ onProgress?: (event: {
42
+ percent: number;
43
+ }) => void;
44
+ onSuccess?: (body: unknown, xhr?: XMLHttpRequest) => void;
45
+ onError?: (event: Error) => void;
46
+ withCredentials?: boolean;
47
+ action?: string;
48
+ method?: string;
49
+ }) => void;
37
50
  disabled?: boolean;
38
51
  fileList?: UploadFile<T>[];
39
52
  defaultFileList?: UploadFile<T>[];
@@ -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?: RcUploadProps['customRequest'];\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,\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 className={cn('ald-upload-dragger', {\n 'ald-upload-drag-hover': dragOver,\n 'ald-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":";;;;;;;;;;;;;AA2GA,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,WAAW,MAA2B;AAC7C,KAAI,KAAK,KAAM,QAAO,KAAK,KAAK,WAAW,SAAS;CACpD,MAAM,MAAM,KAAK,MAAM,MAAM,IAAI,CAAC,KAAK,EAAE,aAAa,IAAI;AAC1D,QAAO;EAAC;EAAO;EAAO;EAAQ;EAAO;EAAO;EAAQ;EAAO;EAAM,CAAC,SAChE,IACD;;AAGH,SAAS,YAAY,MAAsC;AACzD,KAAI,KAAK,SAAU,QAAO,KAAK;AAC/B,KAAI,KAAK,IAAK,QAAO,KAAK;AAC1B,KAAI,KAAK,iBAAiB,WAAW,KAAK,CACxC,KAAI;AACF,SAAO,IAAI,gBAAgB,KAAK,cAAc;SACxC;AACN;;;AAUN,SAAS,WAAW,EAClB,QAAQ,EAAE,EACV,WAAW,QACX,iBAAiB,MACjB,UACA,WACA,YACkB;AAClB,KAAI,CAAC,kBAAkB,MAAM,WAAW,EAAG,QAAO;CAElD,MAAM,aACJ,OAAO,mBAAmB,WACtB,iBACA;EACE,gBAAgB;EAChB,iBAAiB;EACjB,kBAAkB;EACnB;CAEP,MAAM,gBAAgB,aAAa,aAAa,aAAa;AAE7D,QACE,oBAAC,MAAD;EAAI,WAAW,GAAG,mBAAmB,mB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EA,CAAA;;AAQX,SAAS,QAAQ,OAAqB;CACpC,MAAM,EAAE,QAAQ,OAAO,UAAU,WAAW,UAAU,GAAG,cAAc;CACvE,MAAM,CAAC,UAAU,eAAe,SAAS,MAAM;CAE/C,MAAM,cAAmC;EACvC,GAAG;EACH,GAAI,WAAW,QAAQ,WAAW,SAAY,EAAE,QAAQ,GAAG,EAAE;EAC9D;AAED,QACE,oBAAC,QAAD;EACE,GAAI;EACM;EACV,WAAW,GAAG,8BAA8B,UAAU;EACtD,OAAO;YAEP,oBAAC,OAAD;GACE,WAAW,GAAG,sBAAsB;IAClC,yBAAyB;IACzB,uBAAuB;IACxB,CAAC;GACF,aAAa,MAAM;AACjB,MAAE,gBAAgB;AAClB,QAAI,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 | 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 className={cn('ald-upload-dragger', {\n 'ald-upload-drag-hover': dragOver,\n 'ald-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,WAAW,MAA2B;AAC7C,KAAI,KAAK,KAAM,QAAO,KAAK,KAAK,WAAW,SAAS;CACpD,MAAM,MAAM,KAAK,MAAM,MAAM,IAAI,CAAC,KAAK,EAAE,aAAa,IAAI;AAC1D,QAAO;EAAC;EAAO;EAAO;EAAQ;EAAO;EAAO;EAAQ;EAAO;EAAM,CAAC,SAChE,IACD;;AAGH,SAAS,YAAY,MAAsC;AACzD,KAAI,KAAK,SAAU,QAAO,KAAK;AAC/B,KAAI,KAAK,IAAK,QAAO,KAAK;AAC1B,KAAI,KAAK,iBAAiB,WAAW,KAAK,CACxC,KAAI;AACF,SAAO,IAAI,gBAAgB,KAAK,cAAc;SACxC;AACN;;;AAUN,SAAS,WAAW,EAClB,QAAQ,EAAE,EACV,WAAW,QACX,iBAAiB,MACjB,UACA,WACA,YACkB;AAClB,KAAI,CAAC,kBAAkB,MAAM,WAAW,EAAG,QAAO;CAElD,MAAM,aACJ,OAAO,mBAAmB,WACtB,iBACA;EACE,gBAAgB;EAChB,iBAAiB;EACjB,kBAAkB;EACnB;CAEP,MAAM,gBAAgB,aAAa,aAAa,aAAa;AAE7D,QACE,oBA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ACC;GACF;GACV,CAAA,CACD,EAAA,CAAA;EAEA,CAAA;;AAQX,SAAS,QAAQ,OAAqB;CACpC,MAAM,EAAE,QAAQ,OAAO,UAAU,WAAW,UAAU,GAAG,cAAc;CACvE,MAAM,CAAC,UAAU,eAAe,SAAS,MAAM;CAE/C,MAAM,cAAmC;EACvC,GAAG;EACH,GAAI,WAAW,QAAQ,WAAW,SAAY,EAAE,QAAQ,GAAG,EAAE;EAC9D;AAED,QACE,oBAAC,QAAD;EACE,GAAI;EACM;EACV,WAAW,GAAG,8BAA8B,UAAU;EACtD,OAAO;YAEP,oBAAC,OAAD;GACE,WAAW,GAAG,sBAAsB;IAClC,yBAAyB;IACzB,uBAAuB;IACxB,CAAC;GACF,aAAa,MAAM;AACjB,MAAE,gBAAgB;AAClB,QAAI,CAAC,SAAU,aAAY,KAAK;;GAElC,mBAAmB,YAAY,MAAM;GACrC,cAAc,YAAY,MAAM;GAE/B;GACG,CAAA;EACC,CAAA;;AAIb,OAAO,UAAU"}
@@ -0,0 +1,2 @@
1
+ export * from './Upload/index.js';
2
+ export { default } from './Upload/index.js';
package/dist/User.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './User/index.js';
2
+ export { default } from './User/index.js';
@@ -0,0 +1,2 @@
1
+ export * from './Watermark/index.js';
2
+ export { default } from './Watermark/index.js';
package/dist/index.d.ts CHANGED
@@ -3,6 +3,10 @@ export type MenuClickEventHandler = (info: {
3
3
  keyPath: string[];
4
4
  domEvent: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>;
5
5
  }) => void;
6
+ export { default as localeZhCN } from './locale/zh_CN.js';
7
+ export { default as localeEnUS } from './locale/en_US.js';
8
+ /** DatePicker-specific zh_CN locale (rc-picker format) */
9
+ export { default as datePickerLocaleZhCN } from 'rc-picker/es/locale/zh_CN';
6
10
  export { default as AProgress } from './AProgress.js';
7
11
  export { default as Alert } from './Alert.js';
8
12
  export type { AlertProps } from './Alert.js';
@@ -34,7 +38,7 @@ export type { SizeType } from './ConfigProvider/sizeContext.js';
34
38
  export { default as DataPreviewTable } from './DataPreviewTable.js';
35
39
  export type { ITableProps as DataPreviewTableProps, DataPreviewTableRef, PreviewColumn, TValue as DataPreviewTableValue, } from './DataPreviewTable/interface.js';
36
40
  export { default as DatePicker } from './DatePicker.js';
37
- export type { DatePickerProps, RangeValue } from './DatePicker.js';
41
+ export type { DatePickerProps, RangePickerProps, RangeValue, } from './DatePicker.js';
38
42
  export { default as Divider } from './Divider.js';
39
43
  export type { IDividerProps as DividerProps } from './Divider.js';
40
44
  export { default as Drawer } from './Drawer.js';
@@ -44,11 +48,13 @@ export type { ActionType, IDropdownProps as DropdownProps, PlacementType, } from
44
48
  export { default as Empty } from './Empty.js';
45
49
  export type { IEmptyProps as EmptyProps } from './Empty.js';
46
50
  export { default as Form } from './Form.js';
47
- export type { FormInstance, FormItemProps, FormListFieldData, FormProps, Rule, RuleObject, RuleRender, } from './Form.js';
51
+ export type { FieldData, FormInstance, FormItemProps, FormLabelAlign, FormListFieldData, FormProps, Rule, RuleObject, RuleRender, } from './Form.js';
48
52
  export { default as HighlightText } from './HighlightText.js';
49
53
  export { default as IconButton } from './IconButton.js';
50
54
  export { default as Input } from './Input.js';
51
55
  export type { IInputProps as InputProps, InputRef, TSize, TextAreaRef, } from './Input.js';
56
+ /** antd v4 compat: InputStatus */
57
+ export type InputStatus = 'error' | 'warning' | '';
52
58
  export { default as InputNumber } from './InputNumber.js';
53
59
  export type { IInputNumberProps as InputNumberProps } from './InputNumber.js';
54
60
  export { default as InputSearch } from './InputSearch.js';
@@ -104,7 +110,7 @@ export { default as TextLink } from './TextLink.js';
104
110
  export { default as Tooltip } from './Tooltip.js';
105
111
  export type { ActionType as TooltipActionType, ITooltipProps as TooltipProps, } from './Tooltip.js';
106
112
  export { default as Tree } from './Tree.js';
107
- export type { DataNode as TreeDataNode, AldTreeNodeProps as TreeNodeProps, TreeProps, } from './Tree.js';
113
+ export type { DataNode as TreeDataNode, EventDataNode, AldTreeNodeProps as TreeNodeProps, TreeProps, } from './Tree.js';
108
114
  export { default as Typography } from './Typography.js';
109
115
  export type { TypographyProps } from './Typography.js';
110
116
  export { default as Upload } from './Upload.js';
@@ -117,6 +123,8 @@ export { default as AldSelect } from './Select.js';
117
123
  export type { ISelectProps } from './Select/interface.js';
118
124
  export { default as Select } from './Select.js';
119
125
  export type { ISelectProps as SelectProps } from './Select/interface.js';
126
+ export type { BaseSelectRef, DefaultOptionType } from './Select/interface.js';
127
+ export type { CustomTagProps } from './Select/BaseSelect.js';
120
128
  export { default as AMenu } from './AMenu.js';
121
129
  export type { AMenuProps } from './AMenu.js';
122
130
  export { default as Tour } from './Tour.js';
package/dist/index.js CHANGED
@@ -1,4 +1,6 @@
1
1
  /* empty css */
2
+ import localeValues$1 from "./locale/zh_CN.js";
3
+ import localeValues from "./locale/en_US.js";
2
4
  import AProgress from "./AProgress/index.js";
3
5
  import Alert from "./Alert/index.js";
4
6
  import AldApp from "./App/index.js";
@@ -68,4 +70,5 @@ import Watermark from "./Watermark/index.js";
68
70
  import notification from "./notification/index.js";
69
71
  import AMenu from "./AMenu/index.js";
70
72
  import Tour from "./Tour/index.js";
71
- export { AMenu, AProgress, Select_default as AldSelect, Alert, AldApp as App, Avatar, Badge, Breadcrumb, Button_default as Button, Card, Carousel, Checkbox, Col, Collapse, ColorPicker, AldCustomConfigProvider as ConfigProvider, DataPreviewTable_default as DataPreviewTable, DatePicker, DisplayLogicTree, Divider, Drawer, Dropdown, ELogicType, EMemberPicker, ENodeType, EUserType, Empty, Form, HighlightText, IconButton, Input, InputNumber, InputSearch, Layout, List, LogicTree, MemberSelector as MemberPicker, Menu, Modal, OverflowCount, Pagination, Popconfirm, Popover, Progress_default as Progress, Radio, RenameInput, Result, Row, ScrollArea_default as ScrollArea, Select_default as Select, Skeleton, Slider, Space, CustomSpin as Spin, StatusLight, Steps, Switch, Table_default as Table, Tabs, Tag, TextLink, Tooltip, Tour, Tree, Typography, Upload, User, Watermark, getInitialLogicNode, logicTreeIterator, message, notification };
73
+ import datePickerLocaleZhCN from "rc-picker/es/locale/zh_CN";
74
+ export { AMenu, AProgress, Select_default as AldSelect, Alert, AldApp as App, Avatar, Badge, Breadcrumb, Button_default as Button, Card, Carousel, Checkbox, Col, Collapse, ColorPicker, AldCustomConfigProvider as ConfigProvider, DataPreviewTable_default as DataPreviewTable, DatePicker, DisplayLogicTree, Divider, Drawer, Dropdown, ELogicType, EMemberPicker, ENodeType, EUserType, Empty, Form, HighlightText, IconButton, Input, InputNumber, InputSearch, Layout, List, LogicTree, MemberSelector as MemberPicker, Menu, Modal, OverflowCount, Pagination, Popconfirm, Popover, Progress_default as Progress, Radio, RenameInput, Result, Row, ScrollArea_default as ScrollArea, Select_default as Select, Skeleton, Slider, Space, CustomSpin as Spin, StatusLight, Steps, Switch, Table_default as Table, Tabs, Tag, TextLink, Tooltip, Tour, Tree, Typography, Upload, User, Watermark, datePickerLocaleZhCN, getInitialLogicNode, localeValues as localeEnUS, localeValues$1 as localeZhCN, logicTreeIterator, message, notification };
@@ -10,6 +10,7 @@ export declare const defaultLocale: {
10
10
  export declare const LocaleContext: import('react').Context<Locale>;
11
11
  export declare function getTranslator(lang?: string): {
12
12
  locale: string;
13
+ DatePicker: import('rc-picker/es/interface').Locale;
13
14
  Empty: {
14
15
  noContentFound: string;
15
16
  };
@@ -27,6 +28,7 @@ export declare function getTranslator(lang?: string): {
27
28
  };
28
29
  MemberPicker: {
29
30
  select: string;
31
+ ban: string;
30
32
  pleaseConfigGetUserByKeywordsMethod: string;
31
33
  pleaseConfigGetUserByIdsMethod: string;
32
34
  noData: string;
@@ -36,7 +38,6 @@ export declare function getTranslator(lang?: string): {
36
38
  selectedTotal: (total: number) => string;
37
39
  cancel: string;
38
40
  confirm: string;
39
- ban: string;
40
41
  };
41
42
  Modal: {
42
43
  cancel: string;
@@ -1,5 +1,5 @@
1
- import localeValues from "./en_US.js";
2
- import localeValues$1 from "./zh_CN.js";
1
+ import localeValues from "./zh_CN.js";
2
+ import localeValues$1 from "./en_US.js";
3
3
  import { createContext } from "react";
4
4
  //#region src/locale/default.ts
5
5
  var ELangType = /* @__PURE__ */ function(ELangType) {
@@ -10,8 +10,8 @@ var ELangType = /* @__PURE__ */ function(ELangType) {
10
10
  var defaultLocale = { locale: ELangType.ZH_CN };
11
11
  var LocaleContext = createContext(defaultLocale);
12
12
  function getTranslator(lang) {
13
- if (lang === ELangType.ZH_CN) return localeValues$1;
14
- return localeValues;
13
+ if (lang === ELangType.ZH_CN) return localeValues;
14
+ return localeValues$1;
15
15
  }
16
16
  //#endregion
17
17
  export { ELangType, LocaleContext, defaultLocale, getTranslator };
@@ -1,5 +1,6 @@
1
1
  declare const localeValues: {
2
2
  locale: string;
3
+ DatePicker: import('rc-picker/es/interface').Locale;
3
4
  Empty: {
4
5
  noContentFound: string;
5
6
  };
@@ -1,6 +1,8 @@
1
+ import enUSDatePicker from "rc-picker/es/locale/en_US";
1
2
  //#region src/locale/en_US.ts
2
3
  var localeValues = {
3
4
  locale: "en",
5
+ DatePicker: enUSDatePicker,
4
6
  Empty: { noContentFound: "No Content Found" },
5
7
  ColorPicker: {
6
8
  default: "Default",
@@ -1 +1 @@
1
- {"version":3,"file":"en_US.js","names":[],"sources":["../../src/locale/en_US.ts"],"sourcesContent":["const localeValues = {\n locale: 'en',\n Empty: {\n noContentFound: 'No Content Found',\n },\n ColorPicker: {\n default: 'Default',\n standardColor: 'Standard Color',\n recentlyUsed: 'Recently Used',\n },\n DataPreviewTable: {\n dataLoadFailed: 'Data loading failed',\n loadFailed: 'Loading failed',\n },\n InputSearch: {\n search: 'Search',\n },\n MemberPicker: {\n select: 'Select',\n pleaseConfigGetUserByKeywordsMethod:\n 'Please configure the getUsersByKeywords method in ConfigProvider',\n pleaseConfigGetUserByIdsMethod:\n 'Please configure the getUsersByIds method in ConfigProvider',\n noData: 'No Data',\n subLevel: 'Sub-level',\n users: 'Users',\n userGroups: 'User Groups',\n selectedTotal: (total: number) => `Selected ${total}`,\n cancel: 'Cancel',\n confirm: 'Confirm',\n ban: 'Banned',\n },\n Modal: {\n cancel: 'Cancel',\n sure: 'Ok',\n },\n Select: {\n noSearchResult: 'No search results',\n all: 'All',\n },\n Tree: {\n expand: 'Expand',\n },\n Table: {\n cancelSelect: 'Cancel Selection',\n selected: 'Selected ',\n item: ' items',\n selectAll: 'Select All',\n },\n ErrorBoundary: {\n happenedError: 'An error occurred',\n },\n LogicTree: {\n btn: {\n addCondition: 'Add condition',\n addRelation: 'Add relation',\n },\n select: {\n and: 'And',\n or: 'Or',\n },\n },\n Pagination: {\n itemsPerPage: '/ page',\n selectPageSize: 'Select size',\n totalItems: (total: number, range: [number, number]) =>\n `Total ${total} items, showing ${range[0]}-${range[1]}`,\n },\n};\n\nexport default localeValues;\n"],"mappings":";AAAA,IAAM,eAAe;CACnB,QAAQ;CACR,OAAO,EACL,gBAAgB,oBACjB;CACD,aAAa;EACX,SAAS;EACT,eAAe;EACf,cAAc;EACf;CACD,kBAAkB;EAChB,gBAAgB;EAChB,YAAY;EACb;CACD,aAAa,EACX,QAAQ,UACT;CACD,cAAc;EACZ,QAAQ;EACR,qCACE;EACF,gCACE;EACF,QAAQ;EACR,UAAU;EACV,OAAO;EACP,YAAY;EACZ,gBAAgB,UAAkB,YAAY;EAC9C,QAAQ;EACR,SAAS;EACT,KAAK;EACN;CACD,OAAO;EACL,QAAQ;EACR,MAAM;EACP;CACD,QAAQ;EACN,gBAAgB;EAChB,KAAK;EACN;CACD,MAAM,EACJ,QAAQ,UACT;CACD,OAAO;EACL,cAAc;EACd,UAAU;EACV,MAAM;EACN,WAAW;EACZ;CACD,eAAe,EACb,eAAe,qBAChB;CACD,WAAW;EACT,KAAK;GACH,cAAc;GACd,aAAa;GACd;EACD,QAAQ;GACN,KAAK;GACL,IAAI;GACL;EACF;CACD,YAAY;EACV,cAAc;EACd,gBAAgB;EAChB,aAAa,OAAe,UAC1B,SAAS,MAAM,kBAAkB,MAAM,GAAG,GAAG,MAAM;EACtD;CACF"}
1
+ {"version":3,"file":"en_US.js","names":[],"sources":["../../src/locale/en_US.ts"],"sourcesContent":["import enUSDatePicker from 'rc-picker/es/locale/en_US';\n\nconst localeValues = {\n locale: 'en',\n DatePicker: enUSDatePicker,\n Empty: {\n noContentFound: 'No Content Found',\n },\n ColorPicker: {\n default: 'Default',\n standardColor: 'Standard Color',\n recentlyUsed: 'Recently Used',\n },\n DataPreviewTable: {\n dataLoadFailed: 'Data loading failed',\n loadFailed: 'Loading failed',\n },\n InputSearch: {\n search: 'Search',\n },\n MemberPicker: {\n select: 'Select',\n pleaseConfigGetUserByKeywordsMethod:\n 'Please configure the getUsersByKeywords method in ConfigProvider',\n pleaseConfigGetUserByIdsMethod:\n 'Please configure the getUsersByIds method in ConfigProvider',\n noData: 'No Data',\n subLevel: 'Sub-level',\n users: 'Users',\n userGroups: 'User Groups',\n selectedTotal: (total: number) => `Selected ${total}`,\n cancel: 'Cancel',\n confirm: 'Confirm',\n ban: 'Banned',\n },\n Modal: {\n cancel: 'Cancel',\n sure: 'Ok',\n },\n Select: {\n noSearchResult: 'No search results',\n all: 'All',\n },\n Tree: {\n expand: 'Expand',\n },\n Table: {\n cancelSelect: 'Cancel Selection',\n selected: 'Selected ',\n item: ' items',\n selectAll: 'Select All',\n },\n ErrorBoundary: {\n happenedError: 'An error occurred',\n },\n LogicTree: {\n btn: {\n addCondition: 'Add condition',\n addRelation: 'Add relation',\n },\n select: {\n and: 'And',\n or: 'Or',\n },\n },\n Pagination: {\n itemsPerPage: '/ page',\n selectPageSize: 'Select size',\n totalItems: (total: number, range: [number, number]) =>\n `Total ${total} items, showing ${range[0]}-${range[1]}`,\n },\n};\n\nexport default localeValues;\n"],"mappings":";;AAEA,IAAM,eAAe;CACnB,QAAQ;CACR,YAAY;CACZ,OAAO,EACL,gBAAgB,oBACjB;CACD,aAAa;EACX,SAAS;EACT,eAAe;EACf,cAAc;EACf;CACD,kBAAkB;EAChB,gBAAgB;EAChB,YAAY;EACb;CACD,aAAa,EACX,QAAQ,UACT;CACD,cAAc;EACZ,QAAQ;EACR,qCACE;EACF,gCACE;EACF,QAAQ;EACR,UAAU;EACV,OAAO;EACP,YAAY;EACZ,gBAAgB,UAAkB,YAAY;EAC9C,QAAQ;EACR,SAAS;EACT,KAAK;EACN;CACD,OAAO;EACL,QAAQ;EACR,MAAM;EACP;CACD,QAAQ;EACN,gBAAgB;EAChB,KAAK;EACN;CACD,MAAM,EACJ,QAAQ,UACT;CACD,OAAO;EACL,cAAc;EACd,UAAU;EACV,MAAM;EACN,WAAW;EACZ;CACD,eAAe,EACb,eAAe,qBAChB;CACD,WAAW;EACT,KAAK;GACH,cAAc;GACd,aAAa;GACd;EACD,QAAQ;GACN,KAAK;GACL,IAAI;GACL;EACF;CACD,YAAY;EACV,cAAc;EACd,gBAAgB;EAChB,aAAa,OAAe,UAC1B,SAAS,MAAM,kBAAkB,MAAM,GAAG,GAAG,MAAM;EACtD;CACF"}
@@ -1,5 +1,6 @@
1
1
  declare const localeValues: {
2
2
  locale: string;
3
+ DatePicker: import('rc-picker/es/interface').Locale;
3
4
  Empty: {
4
5
  noContentFound: string;
5
6
  };
@@ -1,6 +1,8 @@
1
+ import zhCNDatePicker from "rc-picker/es/locale/zh_CN";
1
2
  //#region src/locale/zh_CN.ts
2
3
  var localeValues = {
3
4
  locale: "zh-cn",
5
+ DatePicker: zhCNDatePicker,
4
6
  Empty: { noContentFound: "未找到内容" },
5
7
  ColorPicker: {
6
8
  default: "默认",
@@ -1 +1 @@
1
- {"version":3,"file":"zh_CN.js","names":[],"sources":["../../src/locale/zh_CN.ts"],"sourcesContent":["const localeValues = {\n locale: 'zh-cn',\n Empty: {\n noContentFound: '未找到内容',\n },\n ColorPicker: {\n default: '默认',\n standardColor: '标准色',\n recentlyUsed: '最近使用',\n },\n DataPreviewTable: {\n dataLoadFailed: '数据加载失败',\n loadFailed: '加载失败',\n },\n InputSearch: {\n search: '搜索',\n },\n MemberPicker: {\n select: '选择',\n ban: '已停用',\n pleaseConfigGetUserByKeywordsMethod:\n '请在ConfigProvider中配置getUsersByKeywords方法',\n pleaseConfigGetUserByIdsMethod: '请在ConfigProvider中配置getUsersByIds方法',\n noData: '无数据',\n subLevel: '下级',\n users: '用户',\n userGroups: '用户组',\n selectedTotal: (total: number) => `已选 ${total}`,\n cancel: '取消',\n confirm: '确定',\n },\n Modal: {\n cancel: '取消',\n sure: '确定',\n },\n Select: {\n noSearchResult: '无搜索结果',\n all: '全部',\n },\n Tree: {\n expand: '展开',\n },\n Table: {\n cancelSelect: '取消选择',\n selected: '已选',\n item: '个',\n selectAll: '全选',\n },\n ErrorBoundary: {\n happenedError: '发生了错误',\n },\n LogicTree: {\n btn: {\n addCondition: '添加条件',\n addRelation: '添加关系',\n },\n select: {\n and: '且',\n or: '或',\n },\n },\n Pagination: {\n itemsPerPage: '条/页',\n selectPageSize: '选择条数',\n totalItems: (total: number, range: [number, number]) =>\n `共 ${total} 条,当前第 ${range[0]}-${range[1]} 条`,\n },\n};\n\nexport default localeValues;\n"],"mappings":";AAAA,IAAM,eAAe;CACnB,QAAQ;CACR,OAAO,EACL,gBAAgB,SACjB;CACD,aAAa;EACX,SAAS;EACT,eAAe;EACf,cAAc;EACf;CACD,kBAAkB;EAChB,gBAAgB;EAChB,YAAY;EACb;CACD,aAAa,EACX,QAAQ,MACT;CACD,cAAc;EACZ,QAAQ;EACR,KAAK;EACL,qCACE;EACF,gCAAgC;EAChC,QAAQ;EACR,UAAU;EACV,OAAO;EACP,YAAY;EACZ,gBAAgB,UAAkB,MAAM;EACxC,QAAQ;EACR,SAAS;EACV;CACD,OAAO;EACL,QAAQ;EACR,MAAM;EACP;CACD,QAAQ;EACN,gBAAgB;EAChB,KAAK;EACN;CACD,MAAM,EACJ,QAAQ,MACT;CACD,OAAO;EACL,cAAc;EACd,UAAU;EACV,MAAM;EACN,WAAW;EACZ;CACD,eAAe,EACb,eAAe,SAChB;CACD,WAAW;EACT,KAAK;GACH,cAAc;GACd,aAAa;GACd;EACD,QAAQ;GACN,KAAK;GACL,IAAI;GACL;EACF;CACD,YAAY;EACV,cAAc;EACd,gBAAgB;EAChB,aAAa,OAAe,UAC1B,KAAK,MAAM,SAAS,MAAM,GAAG,GAAG,MAAM,GAAG;EAC5C;CACF"}
1
+ {"version":3,"file":"zh_CN.js","names":[],"sources":["../../src/locale/zh_CN.ts"],"sourcesContent":["import zhCNDatePicker from 'rc-picker/es/locale/zh_CN';\n\nconst localeValues = {\n locale: 'zh-cn',\n DatePicker: zhCNDatePicker,\n Empty: {\n noContentFound: '未找到内容',\n },\n ColorPicker: {\n default: '默认',\n standardColor: '标准色',\n recentlyUsed: '最近使用',\n },\n DataPreviewTable: {\n dataLoadFailed: '数据加载失败',\n loadFailed: '加载失败',\n },\n InputSearch: {\n search: '搜索',\n },\n MemberPicker: {\n select: '选择',\n ban: '已停用',\n pleaseConfigGetUserByKeywordsMethod:\n '请在ConfigProvider中配置getUsersByKeywords方法',\n pleaseConfigGetUserByIdsMethod: '请在ConfigProvider中配置getUsersByIds方法',\n noData: '无数据',\n subLevel: '下级',\n users: '用户',\n userGroups: '用户组',\n selectedTotal: (total: number) => `已选 ${total}`,\n cancel: '取消',\n confirm: '确定',\n },\n Modal: {\n cancel: '取消',\n sure: '确定',\n },\n Select: {\n noSearchResult: '无搜索结果',\n all: '全部',\n },\n Tree: {\n expand: '展开',\n },\n Table: {\n cancelSelect: '取消选择',\n selected: '已选',\n item: '个',\n selectAll: '全选',\n },\n ErrorBoundary: {\n happenedError: '发生了错误',\n },\n LogicTree: {\n btn: {\n addCondition: '添加条件',\n addRelation: '添加关系',\n },\n select: {\n and: '且',\n or: '或',\n },\n },\n Pagination: {\n itemsPerPage: '条/页',\n selectPageSize: '选择条数',\n totalItems: (total: number, range: [number, number]) =>\n `共 ${total} 条,当前第 ${range[0]}-${range[1]} 条`,\n },\n};\n\nexport default localeValues;\n"],"mappings":";;AAEA,IAAM,eAAe;CACnB,QAAQ;CACR,YAAY;CACZ,OAAO,EACL,gBAAgB,SACjB;CACD,aAAa;EACX,SAAS;EACT,eAAe;EACf,cAAc;EACf;CACD,kBAAkB;EAChB,gBAAgB;EAChB,YAAY;EACb;CACD,aAAa,EACX,QAAQ,MACT;CACD,cAAc;EACZ,QAAQ;EACR,KAAK;EACL,qCACE;EACF,gCAAgC;EAChC,QAAQ;EACR,UAAU;EACV,OAAO;EACP,YAAY;EACZ,gBAAgB,UAAkB,MAAM;EACxC,QAAQ;EACR,SAAS;EACV;CACD,OAAO;EACL,QAAQ;EACR,MAAM;EACP;CACD,QAAQ;EACN,gBAAgB;EAChB,KAAK;EACN;CACD,MAAM,EACJ,QAAQ,MACT;CACD,OAAO;EACL,cAAc;EACd,UAAU;EACV,MAAM;EACN,WAAW;EACZ;CACD,eAAe,EACb,eAAe,SAChB;CACD,WAAW;EACT,KAAK;GACH,cAAc;GACd,aAAa;GACd;EACD,QAAQ;GACN,KAAK;GACL,IAAI;GACL;EACF;CACD,YAAY;EACV,cAAc;EACd,gBAAgB;EAChB,aAAa,OAAe,UAC1B,KAAK,MAAM,SAAS,MAAM,GAAG,GAAG,MAAM,GAAG;EAC5C;CACF"}
@@ -0,0 +1,2 @@
1
+ export * from './message/index.js';
2
+ export { default } from './message/index.js';
@@ -0,0 +1,2 @@
1
+ export * from './notification/index.js';
2
+ export { default } from './notification/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aloudata/aloudata-design",
3
- "version": "3.0.0-beta.1",
3
+ "version": "3.0.0-beta.10",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "sideEffects": [
@@ -70,7 +70,6 @@
70
70
  "@xobotyi/scrollbar-width": "^1.9.5",
71
71
  "ahooks": "^3.7.8",
72
72
  "compare-func": "^2.0.0",
73
- "dayjs": "^1.11.20",
74
73
  "embla-carousel-autoplay": "^8.6.0",
75
74
  "embla-carousel-react": "^8.6.0",
76
75
  "immer": "^10.0.3",
@@ -115,6 +114,7 @@
115
114
  "browserslist": "^4.21.9",
116
115
  "class-variance-authority": "^0.7.1",
117
116
  "clsx": "^2.1.1",
117
+ "dayjs": "^1.11.20",
118
118
  "eslint": "^8.45.0",
119
119
  "eslint-plugin-compat": "^4.1.4",
120
120
  "eslint-plugin-i18n": "^2.3.1",
@@ -141,6 +141,7 @@
141
141
  "zx": "^7.1.1"
142
142
  },
143
143
  "peerDependencies": {
144
+ "dayjs": ">=1.11.0",
144
145
  "react": ">=18.0.0",
145
146
  "react-dom": ">=18.0.0"
146
147
  },